@reqvire-org/ads 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/dist/ads-errors.mjs +382 -34
- package/dist/ads-views.mjs +4 -4
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/design-usage.mjs +20 -4
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/mock-check.mjs +5 -4
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +195 -43
- package/dist/analysis/owner-composition.mjs +152 -43
- package/dist/analysis/owner-controls.mjs +27 -0
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +309 -83
- package/dist/analysis/prose-owners.mjs +57 -0
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/styling-ownership.mjs +22 -0
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +20 -7
- package/dist/cli-arguments.mjs +2 -2
- package/dist/cli.mjs +4 -4
- package/dist/composed-contrast.mjs +28 -8
- package/dist/composed-keyline.mjs +107 -0
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +149 -20
- package/dist/construction-spec.d.mts +320 -12
- package/dist/construction-spec.mjs +452 -69
- package/dist/corner-overpaint.mjs +65 -0
- package/dist/derived-states.mjs +182 -0
- package/dist/design-foundation.mjs +6 -1
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/design-usage.mjs +8 -2
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +14 -5
- package/dist/emit/font-emission.mjs +21 -1
- package/dist/emit/foundation-sheet.mjs +6 -5
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +10 -0
- package/dist/font-checks.mjs +42 -0
- package/dist/font-declaration.d.mts +10 -0
- package/dist/font-declaration.mjs +25 -3
- package/dist/font-fallback.d.mts +37 -0
- package/dist/font-fallback.mjs +25 -0
- package/dist/font-macro.d.mts +10 -0
- package/dist/font-metrics.d.mts +34 -0
- package/dist/font-metrics.mjs +314 -0
- package/dist/font-model.mjs +28 -2
- package/dist/form-states.mjs +8 -0
- package/dist/foundation-macro.d.mts +1 -1
- package/dist/frame-regions.mjs +92 -9
- package/dist/grid-facts.mjs +72 -16
- package/dist/grid-lowering.mjs +11 -5
- package/dist/hover-geometry.mjs +15 -0
- package/dist/init.mjs +14 -23
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-enter.mjs +31 -0
- package/dist/lowering-properties.mjs +27 -1
- package/dist/lowering-region-layout.mjs +49 -10
- package/dist/lowering-sequence.mjs +89 -0
- package/dist/lowering-session.mjs +7 -0
- package/dist/lowering-transitions.mjs +22 -8
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +5 -5
- package/dist/motion-model.mjs +3 -1
- package/dist/owner-analysis-check.mjs +86 -12
- package/dist/owner-errors.mjs +20 -2
- package/dist/owner-lowering.mjs +104 -25
- package/dist/owner-scenarios.mjs +29 -4
- package/dist/ownership-model.mjs +37 -4
- package/dist/paint-contrast.mjs +5 -0
- package/dist/placeholder-contrast.mjs +18 -1
- package/dist/platform-features.mjs +35 -2
- package/dist/preview-bun.mjs +17 -16
- package/dist/preview-controls.mjs +35 -0
- package/dist/preview-incremental.mjs +1 -1
- package/dist/preview-source.mjs +2 -2
- package/dist/profile-macro.d.mts +15 -0
- package/dist/profile-model.mjs +3 -3
- package/dist/profile-view-facts.mjs +55 -4
- package/dist/prose-model.d.mts +81 -0
- package/dist/prose-model.mjs +101 -0
- package/dist/recipe-macro.d.mts +176 -15
- package/dist/recipe-model.mjs +35 -7
- package/dist/region-lowering.mjs +463 -65
- package/dist/render-audit/corner-overpaint.page.mjs +54 -0
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +23 -3
- package/dist/render-audit.mjs +139 -1
- package/dist/role-vocabulary.d.mts +43 -2
- package/dist/role-vocabulary.mjs +50 -4
- package/dist/scenario-kit.d.mts +6 -0
- package/dist/scenario-registry.mjs +1 -1
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/scheme-switch.d.mts +8 -0
- package/dist/scheme-switch.mjs +1 -0
- package/dist/showcase/ads-views.mjs +116 -53
- package/dist/showcase/assets-view.mjs +136 -89
- package/dist/showcase/client.bundle.js +65 -65
- package/dist/showcase/http-client.bundle.js +17 -17
- package/dist/showcase/preview-frame.css +2 -0
- package/dist/showcase/profiles-view.mjs +163 -122
- package/dist/showcase/scenario-page.d.mts +11 -1
- package/dist/showcase/scenario-page.mjs +18 -3
- package/dist/showcase/token-sample.mjs +47 -4
- package/dist/showcase/tokens-view.mjs +82 -34
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/README.md +5 -5
- package/dist/skills/ads-designer/README.md +1 -1
- package/dist/skills/ads-designer/SKILL.md +13 -12
- package/dist/skills/ads-designer/references/accessibility.md +9 -2
- package/dist/skills/ads-designer/references/atomic-styles.md +8 -1
- package/dist/skills/ads-designer/references/branding.md +20 -5
- package/dist/skills/ads-designer/references/cli.md +4 -4
- package/dist/skills/ads-designer/references/contracts.md +14 -4
- package/dist/skills/ads-designer/references/design-craft.md +1 -1
- package/dist/skills/ads-designer/references/design-data.md +3 -3
- package/dist/skills/ads-designer/references/forms.md +6 -6
- package/dist/skills/ads-designer/references/layout.md +46 -3
- package/dist/skills/ads-designer/references/motion.md +45 -1
- package/dist/skills/ads-designer/references/performance.md +7 -1
- package/dist/skills/ads-designer/references/recipes.md +92 -7
- package/dist/skills/ads-designer/references/runtimes.md +1 -1
- package/dist/skills/ads-designer/references/scenarios.md +1 -0
- package/dist/skills/ads-import/references/atomic-styles.md +8 -1
- package/dist/skills/ads-import/references/cli.md +4 -4
- package/dist/skills/ads-import/references/contracts.md +14 -4
- package/dist/skills/ads-import/references/design-data.md +3 -3
- package/dist/skills/ads-import/references/forms.md +6 -6
- package/dist/skills/ads-import/references/layout.md +46 -3
- package/dist/skills/ads-import/references/recipes.md +92 -7
- package/dist/skills/ads-import/references/runtimes.md +1 -1
- package/dist/skills/ads-import/references/scenarios.md +1 -0
- package/dist/skills/ads-migrate/SKILL.md +3 -1
- package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-port/references/atomic-styles.md +8 -1
- package/dist/skills/ads-port/references/cli.md +4 -4
- package/dist/skills/ads-port/references/contracts.md +14 -4
- package/dist/skills/ads-port/references/design-data.md +3 -3
- package/dist/skills/ads-port/references/forms.md +6 -6
- package/dist/skills/ads-port/references/layout.md +46 -3
- package/dist/skills/ads-port/references/recipes.md +92 -7
- package/dist/skills/ads-port/references/runtimes.md +1 -1
- package/dist/skills/ads-port/references/scenarios.md +1 -0
- package/dist/spatial-model.mjs +20 -4
- package/dist/state-conditions.d.mts +29 -0
- package/dist/state-conditions.mjs +42 -2
- package/dist/surface-contrast.mjs +69 -10
- package/dist/surface-effects.mjs +100 -0
- package/dist/target-size.mjs +1 -1
- package/dist/task-cache.mjs +9 -19
- package/dist/token-dtcg.mjs +1 -0
- package/dist/token-view-facts.mjs +54 -5
- package/dist/unreached-sources.mjs +5 -0
- package/dist/validation-checks.mjs +1 -1
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +36 -13
- package/docs/ARCHITECTURE.md +223 -23
- package/docs/ASSETS.md +81 -10
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +525 -23
- package/docs/DESIGN-REFERENCES.md +5 -5
- package/docs/GUIDE.md +286 -73
- package/docs/LANGUAGE.md +428 -24
- package/docs/LOWERING.md +13 -1
- package/docs/MOTION.md +241 -7
- package/docs/PROFILE-KINDS.md +176 -14
- package/docs/PROFILES.md +2 -2
- package/docs/RULES.md +63 -24
- package/docs/TOKEN-ROLES.md +15 -7
- package/package.json +1 -1
- package/dist/starter-files.mjs +0 -155
- package/dist/starter-overlay.mjs +0 -189
- package/dist/starters/preact/design-system/assets/avatars/avatar.ads.ts +0 -10
- package/dist/starters/preact/design-system/assets/avatars/member.svg +0 -1
- package/dist/starters/preact/design-system/assets/brand/emblem.ads.ts +0 -18
- package/dist/starters/preact/design-system/assets/brand/emblem.svg +0 -4
- package/dist/starters/preact/design-system/assets/brand/iris-emblem.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/brand/iris-emblem.svg +0 -4
- package/dist/starters/preact/design-system/assets/brand/mark.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/brand/mark.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/arrow.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/glyphs/arrow.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron-20.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron-24.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/chevron.ads.ts +0 -20
- package/dist/starters/preact/design-system/assets/glyphs/close.ads.ts +0 -13
- package/dist/starters/preact/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/favorite.ads.ts +0 -23
- package/dist/starters/preact/design-system/assets/glyphs/favorite.normal.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/favorite.selected.svg +0 -1
- package/dist/starters/preact/design-system/assets/glyphs/search.ads.ts +0 -10
- package/dist/starters/preact/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/preact/design-system/assets/illustrations/journey.ads.ts +0 -32
- package/dist/starters/preact/design-system/assets/illustrations/journey.contrast.svg +0 -6
- package/dist/starters/preact/design-system/assets/illustrations/journey.dark.svg +0 -13
- package/dist/starters/preact/design-system/assets/illustrations/journey.light.svg +0 -13
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.ads.ts +0 -17
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.dark.svg +0 -10
- package/dist/starters/preact/design-system/assets/logos/harbor-pay.light.svg +0 -10
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.ads.ts +0 -15
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.dark.svg +0 -9
- package/dist/starters/preact/design-system/assets/logos/lumen-cloud.light.svg +0 -9
- package/dist/starters/preact/design-system/assets/status/error.svg +0 -1
- package/dist/starters/preact/design-system/assets/status/outcomes.ads.ts +0 -31
- package/dist/starters/preact/design-system/assets/status/status.ads.ts +0 -16
- package/dist/starters/preact/design-system/assets/status/success.svg +0 -1
- package/dist/starters/preact/design-system/assets/status/sync-status.ads.ts +0 -14
- package/dist/starters/preact/design-system/assets/status/sync-status.svg +0 -7
- package/dist/starters/preact/design-system/assets/status/warning.svg +0 -1
- package/dist/starters/preact/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -12
- package/dist/starters/preact/design-system/components/Actions/Button/Button.tsx +0 -198
- package/dist/starters/preact/design-system/components/Actions/IconButton/IconButton.tsx +0 -95
- package/dist/starters/preact/design-system/components/Actions/ToggleTile/ToggleTile.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/components/Actions/ToggleTile/ToggleTile.tsx +0 -60
- package/dist/starters/preact/design-system/components/Containers/Disclosure/Disclosure.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/components/Containers/Disclosure/Disclosure.tsx +0 -50
- package/dist/starters/preact/design-system/components/Content/Artwork/Artwork.ads.scenario.tsx +0 -8
- package/dist/starters/preact/design-system/components/Content/Artwork/Artwork.tsx +0 -110
- package/dist/starters/preact/design-system/components/Content/BarChart/BarChart.ads.scenario.tsx +0 -25
- package/dist/starters/preact/design-system/components/Content/BarChart/BarChart.tsx +0 -72
- package/dist/starters/preact/design-system/components/Content/GuideGrid/GuideGrid.ads.scenario.tsx +0 -8
- package/dist/starters/preact/design-system/components/Content/GuideGrid/GuideGrid.tsx +0 -43
- package/dist/starters/preact/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/components/Content/Icon/Icon.tsx +0 -41
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/arrow.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/close.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Icon/glyphs/search.tsx +0 -10
- package/dist/starters/preact/design-system/components/Content/Image/Image.ads.fixture.ts +0 -9
- package/dist/starters/preact/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -12
- package/dist/starters/preact/design-system/components/Content/Image/Image.tsx +0 -83
- package/dist/starters/preact/design-system/components/Content/InspectedGlyph/InspectedGlyph.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/components/Content/InspectedGlyph/InspectedGlyph.tsx +0 -46
- package/dist/starters/preact/design-system/components/Content/PartnerLogo/PartnerLogo.ads.scenario.tsx +0 -17
- package/dist/starters/preact/design-system/components/Content/PartnerLogo/PartnerLogo.tsx +0 -41
- package/dist/starters/preact/design-system/components/Content/StatusIcon/StatusIcon.ads.scenario.tsx +0 -20
- package/dist/starters/preact/design-system/components/Content/StatusIcon/StatusIcon.tsx +0 -37
- package/dist/starters/preact/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/components/Forms/TextField/TextField.tsx +0 -173
- package/dist/starters/preact/design-system/components/Identity/Identity.ads.scenario.tsx +0 -13
- package/dist/starters/preact/design-system/components/Identity/Identity.tsx +0 -146
- package/dist/starters/preact/design-system/components/Overlays/Menu/Menu.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/components/Overlays/Menu/Menu.tsx +0 -194
- package/dist/starters/preact/design-system/components/Overlays/Popover/Popover.ads.scenario.tsx +0 -19
- package/dist/starters/preact/design-system/components/Overlays/Popover/Popover.tsx +0 -37
- package/dist/starters/preact/design-system/controllers/FormField/FormField.ads.behavior.ts +0 -70
- package/dist/starters/preact/design-system/controllers/FormField/FormField.behavior.spec.ts +0 -237
- package/dist/starters/preact/design-system/controllers/FormField/FormField.ts +0 -343
- package/dist/starters/preact/design-system/controllers/FormField/useFormField.ts +0 -70
- package/dist/starters/preact/design-system/controllers/Palette/Palette.ts +0 -165
- package/dist/starters/preact/design-system/foundation.ads.ts +0 -22
- package/dist/starters/preact/design-system/index.ts +0 -51
- package/dist/starters/preact/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.fixture.ts +0 -5
- package/dist/starters/preact/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/mocks/Inspector/Inspector.ads.fixture.ts +0 -12
- package/dist/starters/preact/design-system/mocks/Inspector/Inspector.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/mocks/Workspace/Layouts.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/mocks/Workspace/Media.ads.scenario.tsx +0 -24
- package/dist/starters/preact/design-system/mocks/Workspace/Stress.ads.scenario.tsx +0 -36
- package/dist/starters/preact/design-system/mocks/Workspace/Workspace.ads.fixture.ts +0 -13
- package/dist/starters/preact/design-system/mocks/Workspace/Workspace.ads.scenario.tsx +0 -27
- package/dist/starters/preact/design-system/mocks/Workspace/media/ads.svg +0 -1
- package/dist/starters/preact/design-system/palette.generated.ts +0 -188
- package/dist/starters/preact/design-system/patterns/ArtworkCatalogue/ArtworkCatalogue/ArtworkCatalogue.tsx +0 -73
- package/dist/starters/preact/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.ads.scenario.tsx +0 -23
- package/dist/starters/preact/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.tsx +0 -94
- package/dist/starters/preact/design-system/patterns/Forms/InviteMember/InviteMember.ads.scenario.tsx +0 -21
- package/dist/starters/preact/design-system/patterns/Forms/InviteMember/InviteMember.tsx +0 -137
- package/dist/starters/preact/design-system/patterns/Inspector/Inspector/Inspector.ads.scenario.tsx +0 -22
- package/dist/starters/preact/design-system/patterns/Inspector/Inspector/Inspector.tsx +0 -248
- package/dist/starters/preact/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -26
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -268
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/Workspace.ads.scenario.tsx +0 -28
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/Workspace.tsx +0 -105
- package/dist/starters/preact/design-system/patterns/Workspace/Workspace/WorkspacePanels.tsx +0 -179
- package/dist/starters/preact/design-system/profiles/Containers/containers.ads.ts +0 -67
- package/dist/starters/preact/design-system/profiles/Containers/frames.ads.ts +0 -32
- package/dist/starters/preact/design-system/profiles/Containers/geometry.ads.ts +0 -30
- package/dist/starters/preact/design-system/profiles/Containers/spacing.ads.ts +0 -26
- package/dist/starters/preact/design-system/profiles/Controls/controls.ads.ts +0 -157
- package/dist/starters/preact/design-system/profiles/Controls/frames.ads.ts +0 -50
- package/dist/starters/preact/design-system/profiles/Controls/spacing.ads.ts +0 -29
- package/dist/starters/preact/design-system/profiles/Focus/keyboard.ads.ts +0 -13
- package/dist/starters/preact/design-system/profiles/Identity/identity.ads.ts +0 -25
- package/dist/starters/preact/design-system/profiles/Identity/spacing.ads.ts +0 -22
- package/dist/starters/preact/design-system/profiles/Layout/grid.ads.ts +0 -69
- package/dist/starters/preact/design-system/profiles/Layout/inspector.ads.ts +0 -146
- package/dist/starters/preact/design-system/profiles/Layout/overlays.ads.ts +0 -94
- package/dist/starters/preact/design-system/profiles/Layout/regions.ads.ts +0 -296
- package/dist/starters/preact/design-system/profiles/Motion/feedback.ads.ts +0 -92
- package/dist/starters/preact/design-system/profiles/Surfaces/controls.ads.ts +0 -142
- package/dist/starters/preact/design-system/profiles/Surfaces/document.ads.ts +0 -2
- package/dist/starters/preact/design-system/profiles/Surfaces/materials.ads.ts +0 -18
- package/dist/starters/preact/design-system/profiles/Surfaces/surfaces.ads.ts +0 -48
- package/dist/starters/preact/design-system/profiles/Typography/details.ads.ts +0 -19
- package/dist/starters/preact/design-system/profiles/Typography/document.ads.ts +0 -2
- package/dist/starters/preact/design-system/profiles/Typography/headings.ads.ts +0 -15
- package/dist/starters/preact/design-system/profiles/Typography/text.ads.ts +0 -73
- package/dist/starters/preact/design-system/profiles/Visuals/artwork.ads.ts +0 -46
- package/dist/starters/preact/design-system/profiles/Visuals/charts.ads.ts +0 -31
- package/dist/starters/preact/design-system/profiles/Visuals/content.ads.ts +0 -52
- package/dist/starters/preact/design-system/profiles/Visuals/glyphs.ads.ts +0 -35
- package/dist/starters/preact/design-system/profiles/Visuals/identity.ads.ts +0 -24
- package/dist/starters/preact/design-system/tokens/Artwork/paint.ads.css +0 -7
- package/dist/starters/preact/design-system/tokens/Artwork/visual-size.ads.css +0 -12
- package/dist/starters/preact/design-system/tokens/Brand/paint.ads.css +0 -7
- package/dist/starters/preact/design-system/tokens/Charts/paint.ads.css +0 -19
- package/dist/starters/preact/design-system/tokens/Containers/border-width.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Containers/content-gap.ads.css +0 -5
- package/dist/starters/preact/design-system/tokens/Containers/frame-inset.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Containers/frame-size.ads.css +0 -11
- package/dist/starters/preact/design-system/tokens/Containers/radius.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Controls/border-width.ads.css +0 -4
- package/dist/starters/preact/design-system/tokens/Controls/content-gap.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Controls/control-min-size.ads.css +0 -17
- package/dist/starters/preact/design-system/tokens/Controls/frame-inset.ads.css +0 -21
- package/dist/starters/preact/design-system/tokens/Controls/radius.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Controls/target-min-size.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Controls/visual-size.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Focus/border-width.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Focus/focus-offset.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Foundation/spacing.ads.css +0 -20
- package/dist/starters/preact/design-system/tokens/Grid/grid-gutter.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Grid/layer.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Grid/layout-size.ads.css +0 -15
- package/dist/starters/preact/design-system/tokens/Grid/spacing.ads.css +0 -12
- package/dist/starters/preact/design-system/tokens/Grid/track-count.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Identity/content-gap.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Identity/visual-size.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Motion/duration.ads.css +0 -6
- package/dist/starters/preact/design-system/tokens/Motion/easing.ads.css +0 -5
- package/dist/starters/preact/design-system/tokens/Motion/motion-angle.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Motion/motion-distance.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Motion/motion-scale.ads.css +0 -9
- package/dist/starters/preact/design-system/tokens/Surfaces/blur.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/gradient.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/opacity.ads.css +0 -2
- package/dist/starters/preact/design-system/tokens/Surfaces/paint.ads.css +0 -58
- package/dist/starters/preact/design-system/tokens/Surfaces/shadow.ads.css +0 -20
- package/dist/starters/preact/design-system/tokens/Typography/font-family.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-features.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-size.ads.css +0 -9
- package/dist/starters/preact/design-system/tokens/Typography/font-stretch.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-variations.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/font-weight.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/letter-spacing.ads.css +0 -1
- package/dist/starters/preact/design-system/tokens/Typography/line-height.ads.css +0 -11
- package/dist/starters/preact/design-system/tokens/Typography/word-spacing.ads.css +0 -1
- package/dist/starters/preact/starter.json +0 -11
- package/dist/starters/react/design-system/assets/avatars/avatar.ads.ts +0 -10
- package/dist/starters/react/design-system/assets/avatars/member.svg +0 -1
- package/dist/starters/react/design-system/assets/brand/emblem.ads.ts +0 -18
- package/dist/starters/react/design-system/assets/brand/emblem.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/iris-emblem.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/brand/iris-emblem.svg +0 -4
- package/dist/starters/react/design-system/assets/brand/mark.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/brand/mark.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/arrow.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/glyphs/arrow.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-20.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron-24.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/chevron.ads.ts +0 -20
- package/dist/starters/react/design-system/assets/glyphs/close.ads.ts +0 -13
- package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/favorite.ads.ts +0 -23
- package/dist/starters/react/design-system/assets/glyphs/favorite.normal.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/favorite.selected.svg +0 -1
- package/dist/starters/react/design-system/assets/glyphs/search.ads.ts +0 -10
- package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
- package/dist/starters/react/design-system/assets/illustrations/journey.ads.ts +0 -32
- package/dist/starters/react/design-system/assets/illustrations/journey.contrast.svg +0 -6
- package/dist/starters/react/design-system/assets/illustrations/journey.dark.svg +0 -13
- package/dist/starters/react/design-system/assets/illustrations/journey.light.svg +0 -13
- package/dist/starters/react/design-system/assets/logos/harbor-pay.ads.ts +0 -17
- package/dist/starters/react/design-system/assets/logos/harbor-pay.dark.svg +0 -10
- package/dist/starters/react/design-system/assets/logos/harbor-pay.light.svg +0 -10
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.ads.ts +0 -15
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.dark.svg +0 -9
- package/dist/starters/react/design-system/assets/logos/lumen-cloud.light.svg +0 -9
- package/dist/starters/react/design-system/assets/status/error.svg +0 -1
- package/dist/starters/react/design-system/assets/status/outcomes.ads.ts +0 -31
- package/dist/starters/react/design-system/assets/status/status.ads.ts +0 -16
- package/dist/starters/react/design-system/assets/status/success.svg +0 -1
- package/dist/starters/react/design-system/assets/status/sync-status.ads.ts +0 -14
- package/dist/starters/react/design-system/assets/status/sync-status.svg +0 -7
- package/dist/starters/react/design-system/assets/status/warning.svg +0 -1
- package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -198
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -95
- package/dist/starters/react/design-system/components/Actions/ToggleTile/ToggleTile.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/components/Actions/ToggleTile/ToggleTile.tsx +0 -60
- package/dist/starters/react/design-system/components/Containers/Disclosure/Disclosure.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/components/Containers/Disclosure/Disclosure.tsx +0 -50
- package/dist/starters/react/design-system/components/Content/Artwork/Artwork.ads.scenario.tsx +0 -8
- package/dist/starters/react/design-system/components/Content/Artwork/Artwork.tsx +0 -110
- package/dist/starters/react/design-system/components/Content/BarChart/BarChart.ads.scenario.tsx +0 -25
- package/dist/starters/react/design-system/components/Content/BarChart/BarChart.tsx +0 -72
- package/dist/starters/react/design-system/components/Content/GuideGrid/GuideGrid.ads.scenario.tsx +0 -8
- package/dist/starters/react/design-system/components/Content/GuideGrid/GuideGrid.tsx +0 -43
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -41
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/arrow.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/close.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Icon/glyphs/search.tsx +0 -10
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -9
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -12
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -83
- package/dist/starters/react/design-system/components/Content/InspectedGlyph/InspectedGlyph.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/components/Content/InspectedGlyph/InspectedGlyph.tsx +0 -46
- package/dist/starters/react/design-system/components/Content/PartnerLogo/PartnerLogo.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Content/PartnerLogo/PartnerLogo.tsx +0 -41
- package/dist/starters/react/design-system/components/Content/StatusIcon/StatusIcon.ads.scenario.tsx +0 -20
- package/dist/starters/react/design-system/components/Content/StatusIcon/StatusIcon.tsx +0 -37
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -173
- package/dist/starters/react/design-system/components/Identity/Identity.ads.scenario.tsx +0 -13
- package/dist/starters/react/design-system/components/Identity/Identity.tsx +0 -146
- package/dist/starters/react/design-system/components/Overlays/Menu/Menu.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/components/Overlays/Menu/Menu.tsx +0 -194
- package/dist/starters/react/design-system/components/Overlays/Popover/Popover.ads.scenario.tsx +0 -19
- package/dist/starters/react/design-system/components/Overlays/Popover/Popover.tsx +0 -37
- package/dist/starters/react/design-system/controllers/FormField/FormField.ads.behavior.ts +0 -70
- package/dist/starters/react/design-system/controllers/FormField/FormField.behavior.spec.ts +0 -237
- package/dist/starters/react/design-system/controllers/FormField/FormField.ts +0 -343
- package/dist/starters/react/design-system/controllers/FormField/useFormField.ts +0 -70
- package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -165
- package/dist/starters/react/design-system/foundation.ads.ts +0 -22
- package/dist/starters/react/design-system/index.ts +0 -51
- package/dist/starters/react/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.fixture.ts +0 -5
- package/dist/starters/react/design-system/mocks/ConstructionProofs/ConstructionProofs.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/mocks/Inspector/Inspector.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/mocks/Inspector/Inspector.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/mocks/Workspace/Layouts.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/mocks/Workspace/Media.ads.scenario.tsx +0 -24
- package/dist/starters/react/design-system/mocks/Workspace/Stress.ads.scenario.tsx +0 -36
- package/dist/starters/react/design-system/mocks/Workspace/Workspace.ads.fixture.ts +0 -13
- package/dist/starters/react/design-system/mocks/Workspace/Workspace.ads.scenario.tsx +0 -27
- package/dist/starters/react/design-system/mocks/Workspace/media/ads.svg +0 -1
- package/dist/starters/react/design-system/palette.generated.ts +0 -188
- package/dist/starters/react/design-system/patterns/ArtworkCatalogue/ArtworkCatalogue/ArtworkCatalogue.tsx +0 -73
- package/dist/starters/react/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.ads.scenario.tsx +0 -23
- package/dist/starters/react/design-system/patterns/ConstructionWorkbench/ConstructionWorkbench/ConstructionWorkbench.tsx +0 -94
- package/dist/starters/react/design-system/patterns/Forms/InviteMember/InviteMember.ads.scenario.tsx +0 -21
- package/dist/starters/react/design-system/patterns/Forms/InviteMember/InviteMember.tsx +0 -137
- package/dist/starters/react/design-system/patterns/Inspector/Inspector/Inspector.ads.scenario.tsx +0 -22
- package/dist/starters/react/design-system/patterns/Inspector/Inspector/Inspector.tsx +0 -248
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -26
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -268
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/Workspace.ads.scenario.tsx +0 -28
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/Workspace.tsx +0 -105
- package/dist/starters/react/design-system/patterns/Workspace/Workspace/WorkspacePanels.tsx +0 -179
- package/dist/starters/react/design-system/profiles/Containers/containers.ads.ts +0 -67
- package/dist/starters/react/design-system/profiles/Containers/frames.ads.ts +0 -32
- package/dist/starters/react/design-system/profiles/Containers/geometry.ads.ts +0 -30
- package/dist/starters/react/design-system/profiles/Containers/spacing.ads.ts +0 -26
- package/dist/starters/react/design-system/profiles/Controls/controls.ads.ts +0 -157
- package/dist/starters/react/design-system/profiles/Controls/frames.ads.ts +0 -50
- package/dist/starters/react/design-system/profiles/Controls/spacing.ads.ts +0 -29
- package/dist/starters/react/design-system/profiles/Focus/keyboard.ads.ts +0 -13
- package/dist/starters/react/design-system/profiles/Identity/identity.ads.ts +0 -25
- package/dist/starters/react/design-system/profiles/Identity/spacing.ads.ts +0 -22
- package/dist/starters/react/design-system/profiles/Layout/grid.ads.ts +0 -69
- package/dist/starters/react/design-system/profiles/Layout/inspector.ads.ts +0 -146
- package/dist/starters/react/design-system/profiles/Layout/overlays.ads.ts +0 -94
- package/dist/starters/react/design-system/profiles/Layout/regions.ads.ts +0 -296
- package/dist/starters/react/design-system/profiles/Motion/feedback.ads.ts +0 -92
- package/dist/starters/react/design-system/profiles/Surfaces/controls.ads.ts +0 -142
- package/dist/starters/react/design-system/profiles/Surfaces/document.ads.ts +0 -2
- package/dist/starters/react/design-system/profiles/Surfaces/materials.ads.ts +0 -18
- package/dist/starters/react/design-system/profiles/Surfaces/surfaces.ads.ts +0 -48
- package/dist/starters/react/design-system/profiles/Typography/details.ads.ts +0 -19
- package/dist/starters/react/design-system/profiles/Typography/document.ads.ts +0 -2
- package/dist/starters/react/design-system/profiles/Typography/headings.ads.ts +0 -15
- package/dist/starters/react/design-system/profiles/Typography/text.ads.ts +0 -73
- package/dist/starters/react/design-system/profiles/Visuals/artwork.ads.ts +0 -46
- package/dist/starters/react/design-system/profiles/Visuals/charts.ads.ts +0 -31
- package/dist/starters/react/design-system/profiles/Visuals/content.ads.ts +0 -52
- package/dist/starters/react/design-system/profiles/Visuals/glyphs.ads.ts +0 -35
- package/dist/starters/react/design-system/profiles/Visuals/identity.ads.ts +0 -24
- package/dist/starters/react/design-system/tokens/Artwork/paint.ads.css +0 -7
- package/dist/starters/react/design-system/tokens/Artwork/visual-size.ads.css +0 -12
- package/dist/starters/react/design-system/tokens/Brand/paint.ads.css +0 -7
- package/dist/starters/react/design-system/tokens/Charts/paint.ads.css +0 -19
- package/dist/starters/react/design-system/tokens/Containers/border-width.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Containers/content-gap.ads.css +0 -5
- package/dist/starters/react/design-system/tokens/Containers/frame-inset.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Containers/frame-size.ads.css +0 -11
- package/dist/starters/react/design-system/tokens/Containers/radius.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Controls/border-width.ads.css +0 -4
- package/dist/starters/react/design-system/tokens/Controls/content-gap.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Controls/control-min-size.ads.css +0 -17
- package/dist/starters/react/design-system/tokens/Controls/frame-inset.ads.css +0 -21
- package/dist/starters/react/design-system/tokens/Controls/radius.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Controls/target-min-size.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Controls/visual-size.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Focus/border-width.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Focus/focus-offset.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Foundation/spacing.ads.css +0 -20
- package/dist/starters/react/design-system/tokens/Grid/grid-gutter.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Grid/layer.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Grid/layout-size.ads.css +0 -15
- package/dist/starters/react/design-system/tokens/Grid/spacing.ads.css +0 -12
- package/dist/starters/react/design-system/tokens/Grid/track-count.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Identity/content-gap.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Identity/visual-size.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Motion/duration.ads.css +0 -6
- package/dist/starters/react/design-system/tokens/Motion/easing.ads.css +0 -5
- package/dist/starters/react/design-system/tokens/Motion/motion-angle.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Motion/motion-distance.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Motion/motion-scale.ads.css +0 -9
- package/dist/starters/react/design-system/tokens/Surfaces/blur.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/gradient.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/opacity.ads.css +0 -2
- package/dist/starters/react/design-system/tokens/Surfaces/paint.ads.css +0 -58
- package/dist/starters/react/design-system/tokens/Surfaces/shadow.ads.css +0 -20
- package/dist/starters/react/design-system/tokens/Typography/font-family.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-features.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-size.ads.css +0 -9
- package/dist/starters/react/design-system/tokens/Typography/font-stretch.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-variations.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/font-weight.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/letter-spacing.ads.css +0 -1
- package/dist/starters/react/design-system/tokens/Typography/line-height.ads.css +0 -11
- package/dist/starters/react/design-system/tokens/Typography/word-spacing.ads.css +0 -1
- package/dist/starters/react/starter.json +0 -11
- package/docs/STARTER.md +0 -167
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var{create:If,defineProperty:$i,getOwnPropertyDescriptor:Of,getOwnPropertyNames:Mf,getPrototypeOf:Af}=Object,Nf=Object.prototype.hasOwnProperty,Nl=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ql=(e,t)=>{let o={};for(var r in e)$i(o,r,{get:e[r],enumerable:!0});if(t)$i(o,Symbol.toStringTag,{value:"Module"});return o},qf=(e,t,o,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=Mf(t),i=0,s=n.length,c;i<s;i++)if(c=n[i],!Nf.call(e,c)&&c!==o)$i(e,c,{get:((l)=>t[l]).bind(null,c),enumerable:!(r=Of(t,c))||r.enumerable})}return e},jl=(e,t,o)=>(o=e!=null?If(Af(e)):{},qf(t||!e||!e.__esModule?$i(o,"default",{value:e,enumerable:!0}):o,e));var jf=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ll=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Lf=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Uf=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Ul(e){return typeof e==="string"&&Ll.has(e.replace(/#$/,""))}function Dl(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let o=e.$schema.replace(/#$/,"");if(jf.has(o))return"2020-12";if(Ll.has(o))return"2019-09";if(Lf.has(o)||Uf.has(o))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Zl,Da=Object.freeze({status:"aborted"});function _(e,t,o){function r(c,l){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let u=s.prototype,h=Object.keys(u);for(let m=0;m<h.length;m++){let f=h[m];if(!(f in c))c[f]=u[f].bind(c)}}let n=o?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(c){var l;let u=o?.Parent?new i:this;r(u,c),(l=u._zod).deferred??(l.deferred=[]);for(let h of u._zod.deferred)h();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:(c)=>{if(o?.Parent&&c instanceof o.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Df=Symbol("zod_brand");class Ct extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Yr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Zl=globalThis).__zod_globalConfig??(Zl.__zod_globalConfig={});var Uo=globalThis.__zod_globalConfig;function ct(e){if(e)Object.assign(Uo,e);return Uo}function Ii(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function Ha(e,t="|"){return e.map((o)=>Ba(o)).join(t)}function Qr(e,t){if(typeof t==="bigint")return t.toString();return t}function Xr(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function Oi(e){return e===null||e===void 0}function Mi(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function Fl(e,t){let o=e/t,r=Math.round(o),n=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-r)<n)return 0;return o-r}var Hl=Symbol("evaluating");function Se(e,t,o){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Hl)return;if(r===void 0)r=Hl,r=o();return r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function po(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function Jt(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function Fa(e){return JSON.stringify(e)}function Vl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Va="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Do(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Jl=Xr(()=>{if(Uo.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ho(e){if(Do(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let o=t.prototype;if(Do(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Ja(e){if(ho(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Bl=new Set(["string","number","symbol"]);function Bt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(e,t,o){let r=new e._zod.constr(t??e._zod.def);if(!t||o?.parent)r._zod.parent=e;return r}function H(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Ba(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Gl(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Wl={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]};function Zf(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=Jt(e._zod.def,{get shape(){let s={};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;s[c]=o.shape[c]}return po(this,"shape",s),s},checks:[]});return yt(e,i)}function Hf(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=Jt(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete s[c]}return po(this,"shape",s),s},checks:[]});return yt(e,i)}function Ff(e,t){if(!ho(t))throw Error("Invalid input to extend: expected a plain object");let o=e._zod.def.checks;if(o&&o.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Jt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return po(this,"shape",i),i}});return yt(e,n)}function Vf(e,t){if(!ho(t))throw Error("Invalid input to safeExtend: expected a plain object");let o=Jt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return po(this,"shape",r),r}});return yt(e,o)}function Jf(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=Jt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return po(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return yt(e,o)}function Bf(e,t,o){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=Jt(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(o)for(let u in o){if(!(u in c))throw Error(`Unrecognized key: "${u}"`);if(!o[u])continue;l[u]=e?new e({type:"optional",innerType:c[u]}):c[u]}else for(let u in c)l[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return po(this,"shape",l),l},checks:[]});return yt(t,s)}function Gf(e,t,o){let r=Jt(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(o)for(let s in o){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!o[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return po(this,"shape",i),i}});return yt(t,r)}function mo(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function Kl(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue===!1)return!0;return!1}function Gt(e,t){return t.map((o)=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function Ci(e){return typeof e==="string"?e:e?.message}function bt(e,t,o){let r=e.message?e.message:Ci(e.inst?._zod.def?.error?.(e))??Ci(t?.error?.(e))??Ci(o.customError?.(e))??Ci(o.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...c}=e;if(c.path??(c.path=[]),c.message=r,t?.reportInput)c.input=s;return c}function Ai(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Yl(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let o=e;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return t}function fo(...e){let[t,o,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:o,inst:r};return{...t}}var Ql=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Qr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ni=_("$ZodError",Ql),Ga=_("$ZodError",Ql,{Parent:Error});function Wa(e,t=(o)=>o.message){let o={},r=[];for(let n of e.issues)if(n.path.length>0)o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(t(n));else r.push(t(n));return{formErrors:r,fieldErrors:o}}function Ka(e,t=(o)=>o.message){let o={_errors:[]},r=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>r({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)o._errors.push(t(s));else{let l=o,u=0;while(u<c.length){let h=c[u];if(u!==c.length-1)l[h]=l[h]||{_errors:[]};else l[h]=l[h]||{_errors:[]},l[h]._errors.push(t(s));l=l[h],u++}}}};return r(e),o}var qi=(e)=>(t,o,r,n)=>{let i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:o,issues:[]},i);if(s instanceof Promise)throw new Ct;if(s.issues.length){let c=new(n?.Err??e)(s.issues.map((l)=>bt(l,i,ct())));throw Va(c,n?.callee),c}return s.value};var ji=(e)=>async(t,o,r,n)=>{let i=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:o,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let c=new(n?.Err??e)(s.issues.map((l)=>bt(l,i,ct())));throw Va(c,n?.callee),c}return s.value};var en=(e)=>(t,o,r)=>{let n=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)throw new Ct;return i.issues.length?{success:!1,error:new(e??Ni)(i.issues.map((s)=>bt(s,n,ct())))}:{success:!0,data:i.value}},Xl=en(Ga),tn=(e)=>async(t,o,r)=>{let n=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>bt(s,n,ct())))}:{success:!0,data:i.value}},eu=tn(Ga),tu=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return qi(e)(t,o,n)};var ou=(e)=>(t,o,r)=>qi(e)(t,o,r);var ru=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return ji(e)(t,o,n)};var nu=(e)=>async(t,o,r)=>ji(e)(t,o,r);var su=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return en(e)(t,o,n)};var iu=(e)=>(t,o,r)=>en(e)(t,o,r);var au=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return tn(e)(t,o,n)};var cu=(e)=>async(t,o,r)=>tn(e)(t,o,r);var lu=/^[cC][0-9a-z]{6,}$/,uu=/^[0-9a-z]+$/,du=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pu=/^[0-9a-vA-V]{20}$/,hu=/^[A-Za-z0-9]{27}$/,mu=/^[a-zA-Z0-9_-]{21}$/,fu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var gu=/^([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})$/,Ya=(e)=>{if(!e)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}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Su=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Kf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _u(){return new RegExp(Kf,"u")}var yu=/^(?:(?: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])$/,bu=/^(([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 vu=/^((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])$/,wu=/^(([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])$/,zu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qa=/^[A-Za-z0-9_-]*$/;var Ru=/^https?$/,xu=/^\+[1-9]\d{6,14}$/,Pu="(?:(?:\\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])))",Eu=new RegExp(`^${Pu}$`);function ku(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Tu(e){return new RegExp(`^${ku(e)}$`)}function $u(e){let t=ku({precision:e.precision}),o=["Z"];if(e.local)o.push("");if(e.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${o.join("|")})`;return new RegExp(`^${Pu}T(?:${r})$`)}var Cu=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Iu=/^-?\d+$/,Xa=/^-?\d+(?:\.\d+)?$/,Ou=/^(?:true|false)$/i,Mu=/^null$/i;var Au=/^undefined$/i;var Nu=/^[^A-Z]*$/,qu=/^[^a-z]*$/;var et=_("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),ju={number:"number",bigint:"bigint",object:"date"},ec=_("$ZodCheckLessThan",(e,t)=>{et.init(e,t);let o=ju[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:o,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tc=_("$ZodCheckGreaterThan",(e,t)=>{et.init(e,t);let o=ju[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:o,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lu=_("$ZodCheckMultipleOf",(e,t)=>{et.init(e,t),e._zod.onattach.push((o)=>{var r;(r=o._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=(o)=>{if(typeof o.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof o.value==="bigint"?o.value%t.value===BigInt(0):Fl(o.value,t.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),Uu=_("$ZodCheckNumberFormat",(e,t)=>{et.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,i]=Wl[t.format];e._zod.onattach.push((s)=>{let c=s._zod.bag;if(c.format=t.format,c.minimum=n,c.maximum=i,o)c.pattern=Iu}),e._zod.check=(s)=>{let c=s.value;if(o){if(!Number.isInteger(c)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(c<n)s.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Du=_("$ZodCheckMaxLength",(e,t)=>{var o;et.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Oi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let n=r.value;if(n.length<=t.maximum)return;let s=Ai(n);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Zu=_("$ZodCheckMinLength",(e,t)=>{var o;et.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Oi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let n=r.value;if(n.length>=t.minimum)return;let s=Ai(n);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hu=_("$ZodCheckLengthEquals",(e,t)=>{var o;et.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!Oi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(r)=>{let n=r.value,i=n.length;if(i===t.length)return;let s=Ai(n),c=i>t.length;r.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),rn=_("$ZodCheckStringFormat",(e,t)=>{var o,r;if(et.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(o=e._zod).check??(o.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Fu=_("$ZodCheckRegex",(e,t)=>{rn.init(e,t),e._zod.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vu=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Nu),rn.init(e,t)}),Ju=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qu),rn.init(e,t)}),Bu=_("$ZodCheckIncludes",(e,t)=>{et.init(e,t);let o=Bt(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${o}`:o);t.pattern=r,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Gu=_("$ZodCheckStartsWith",(e,t)=>{et.init(e,t);let o=new RegExp(`^${Bt(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Wu=_("$ZodCheckEndsWith",(e,t)=>{et.init(e,t);let o=new RegExp(`.*${Bt(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Ku=_("$ZodCheckOverwrite",(e,t)=>{et.init(e,t),e._zod.check=(o)=>{o.value=t.tx(o.value)}});class oc{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
|
|
2
2
|
`).filter((i)=>i),r=Math.min(...o.map((i)=>i.length-i.trimStart().length)),n=o.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,r.join(`
|
|
3
|
-
`))}}var Qu={major:4,minor:4,patch:3};var Te=_("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qu;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let n of r)for(let i of n._zod.onattach)i(e);if(r.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,c,l)=>{let u=mo(s),h;for(let m of c){if(m._zod.def.when){if(Kl(s))continue;if(!m._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,S=m._zod.check(s);if(S instanceof Promise&&l?.async===!1)throw new Ct;if(h||S instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await S,s.issues.length===f)return;if(!u)u=mo(s,f)});else{if(s.issues.length===f)continue;if(!u)u=mo(s,f)}}if(h)return h.then(()=>s);return s},i=(s,c,l)=>{if(mo(s))return s.aborted=!0,s;let u=n(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new Ct;return u.then((h)=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((h)=>i(h,s,c));return i(u,s,c)}let l=e._zod.parse(s,c);if(l instanceof Promise){if(c.async===!1)throw new Ct;return l.then((u)=>n(u,r,c))}return n(l,r,c)}}Se(e,"~standard",()=>({validate:(n)=>{try{let i=Xl(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return eu(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Di=_("$ZodString",(e,t)=>{Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Cu(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch(n){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),Me=_("$ZodStringFormat",(e,t)=>{rn.init(e,t),Di.init(e,t)}),ad=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gu),Me.init(e,t)}),cd=_("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ya(r))}else t.pattern??(t.pattern=Ya());Me.init(e,t)}),ld=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Su),Me.init(e,t)}),ud=_("$ZodURL",(e,t)=>{Me.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Ru.source){if(!/^https?:\/\//i.test(r)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:e,continue:!t.abort});return}}let n=new URL(r);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})}if(t.normalize)o.value=n.href;else o.value=r;return}catch(r){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),dd=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=_u()),Me.init(e,t)}),pd=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mu),Me.init(e,t)}),hd=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lu),Me.init(e,t)}),md=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=uu),Me.init(e,t)}),fd=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=du),Me.init(e,t)}),gd=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pu),Me.init(e,t)}),Sd=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hu),Me.init(e,t)}),_d=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$u(t)),Me.init(e,t)}),yd=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Eu),Me.init(e,t)}),bd=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tu(t)),Me.init(e,t)}),vd=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fu),Me.init(e,t)}),wd=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yu),Me.init(e,t),e._zod.bag.format="ipv4"}),zd=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bu),Me.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}});var Rd=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vu),Me.init(e,t)}),xd=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wu),Me.init(e,t),e._zod.check=(o)=>{let r=o.value.split("/");try{if(r.length!==2)throw Error();let[n,i]=r;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function Pd(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ed=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zu),Me.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(Pd(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Yf(e){if(!Qa.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pd(o)}var kd=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qa),Me.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Yf(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Td=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xu),Me.init(e,t)});function Qf(e,t=null){try{let o=e.split(".");if(o.length!==3)return!1;let[r]=o;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var $d=_("$ZodJWT",(e,t)=>{Me.init(e,t),e._zod.check=(o)=>{if(Qf(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var nc=_("$ZodNumber",(e,t)=>{Te.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xa,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch(s){}let n=o.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),o}}),Cd=_("$ZodNumberFormat",(e,t)=>{Uu.init(e,t),nc.init(e,t)}),Id=_("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=Ou,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Boolean(o.value)}catch(i){}let n=o.value;if(typeof n==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),o}});var Od=_("$ZodUndefined",(e,t)=>{Te.init(e,t),e._zod.pattern=Au,e._zod.values=new Set([void 0]),e._zod.parse=(o,r)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),o}}),Md=_("$ZodNull",(e,t)=>{Te.init(e,t),e._zod.pattern=Mu,e._zod.values=new Set([null]),e._zod.parse=(o,r)=>{let n=o.value;if(n===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),o}}),Ad=_("$ZodAny",(e,t)=>{Te.init(e,t),e._zod.parse=(o)=>o}),Nd=_("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=(o)=>o}),qd=_("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Xu(e,t,o){if(e.issues.length)t.issues.push(...Gt(o,e.issues));t.value[o]=e.value}var jd=_("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),o;o.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let c=n[s],l=t.element._zod.run({value:c,issues:[]},r);if(l instanceof Promise)i.push(l.then((u)=>Xu(u,o,s)));else Xu(l,o,s)}if(i.length)return Promise.all(i).then(()=>o);return o}});function Ui(e,t,o,r,n,i){let s=o in r;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...Gt(o,e.issues))}if(!s&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(e.value===void 0){if(s)t.value[o]=void 0}else t.value[o]=e.value}function Ld(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let o=Gl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Ud(e,t,o,r,n,i){let s=[],c=n.keySet,l=n.catchall._zod,u=l.def.type,h=l.optin==="optional",m=l.optout==="optional";for(let f in t){if(f==="__proto__")continue;if(c.has(f))continue;if(u==="never"){s.push(f);continue}let S=l.run({value:t[f],issues:[]},r);if(S instanceof Promise)e.push(S.then((y)=>Ui(y,o,f,t,h,m)));else Ui(S,o,f,t,h,m)}if(s.length)o.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return o;return Promise.all(e).then(()=>o)}var Xf=_("$ZodObject",(e,t)=>{if(Te.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let r=Xr(()=>Ld(t));Se(e._zod,"propValues",()=>{let c=t.shape,l={};for(let u in c){let h=c[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(let m of h.values)l[u].add(m)}}return l});let n=Do,i=t.catchall,s;e._zod.parse=(c,l)=>{s??(s=r.value);let u=c.value;if(!n(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};let h=[],m=s.shape;for(let f of s.keys){let S=m[f],y=S._zod.optin==="optional",b=S._zod.optout==="optional",v=S._zod.run({value:u[f],issues:[]},l);if(v instanceof Promise)h.push(v.then((k)=>Ui(k,c,f,u,y,b)));else Ui(v,c,f,u,y,b)}if(!i)return h.length?Promise.all(h).then(()=>c):c;return Ud(h,u,c,l,r.value,e)}}),Dd=_("$ZodObjectJIT",(e,t)=>{Xf.init(e,t);let o=e._zod.parse,r=Xr(()=>Ld(t)),n=(f)=>{let S=new oc(["shape","payload","ctx"]),y=r.value,b=(z)=>{let R=Fa(z);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};S.write("const input = payload.value;");let v=Object.create(null),k=0;for(let z of y.keys)v[z]=`key_${k++}`;S.write("const newResult = {};");for(let z of y.keys){let R=v[z],M=Fa(z),oe=f[z],pe=oe?._zod?.optin==="optional",we=oe?._zod?.optout==="optional";if(S.write(`const ${R} = ${b(z)};`),pe&&we)S.write(`
|
|
3
|
+
`))}}var Qu={major:4,minor:4,patch:3};var Te=_("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qu;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let n of r)for(let i of n._zod.onattach)i(e);if(r.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,c,l)=>{let u=mo(s),h;for(let m of c){if(m._zod.def.when){if(Kl(s))continue;if(!m._zod.def.when(s))continue}else if(u)continue;let f=s.issues.length,S=m._zod.check(s);if(S instanceof Promise&&l?.async===!1)throw new Ct;if(h||S instanceof Promise)h=(h??Promise.resolve()).then(async()=>{if(await S,s.issues.length===f)return;if(!u)u=mo(s,f)});else{if(s.issues.length===f)continue;if(!u)u=mo(s,f)}}if(h)return h.then(()=>s);return s},i=(s,c,l)=>{if(mo(s))return s.aborted=!0,s;let u=n(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new Ct;return u.then((h)=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((h)=>i(h,s,c));return i(u,s,c)}let l=e._zod.parse(s,c);if(l instanceof Promise){if(c.async===!1)throw new Ct;return l.then((u)=>n(u,r,c))}return n(l,r,c)}}Se(e,"~standard",()=>({validate:(n)=>{try{let i=Xl(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return eu(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Di=_("$ZodString",(e,t)=>{Te.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Cu(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch(n){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),Ae=_("$ZodStringFormat",(e,t)=>{rn.init(e,t),Di.init(e,t)}),ad=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gu),Ae.init(e,t)}),cd=_("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ya(r))}else t.pattern??(t.pattern=Ya());Ae.init(e,t)}),ld=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Su),Ae.init(e,t)}),ud=_("$ZodURL",(e,t)=>{Ae.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Ru.source){if(!/^https?:\/\//i.test(r)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:e,continue:!t.abort});return}}let n=new URL(r);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})}if(t.normalize)o.value=n.href;else o.value=r;return}catch(r){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),dd=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=_u()),Ae.init(e,t)}),pd=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mu),Ae.init(e,t)}),hd=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lu),Ae.init(e,t)}),md=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=uu),Ae.init(e,t)}),fd=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=du),Ae.init(e,t)}),gd=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pu),Ae.init(e,t)}),Sd=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hu),Ae.init(e,t)}),_d=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$u(t)),Ae.init(e,t)}),yd=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Eu),Ae.init(e,t)}),bd=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tu(t)),Ae.init(e,t)}),vd=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fu),Ae.init(e,t)}),wd=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yu),Ae.init(e,t),e._zod.bag.format="ipv4"}),zd=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bu),Ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}});var Rd=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vu),Ae.init(e,t)}),xd=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wu),Ae.init(e,t),e._zod.check=(o)=>{let r=o.value.split("/");try{if(r.length!==2)throw Error();let[n,i]=r;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function Pd(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ed=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zu),Ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(Pd(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Yf(e){if(!Qa.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pd(o)}var kd=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qa),Ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Yf(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Td=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xu),Ae.init(e,t)});function Qf(e,t=null){try{let o=e.split(".");if(o.length!==3)return!1;let[r]=o;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var $d=_("$ZodJWT",(e,t)=>{Ae.init(e,t),e._zod.check=(o)=>{if(Qf(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var nc=_("$ZodNumber",(e,t)=>{Te.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xa,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch(s){}let n=o.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),o}}),Cd=_("$ZodNumberFormat",(e,t)=>{Uu.init(e,t),nc.init(e,t)}),Id=_("$ZodBoolean",(e,t)=>{Te.init(e,t),e._zod.pattern=Ou,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Boolean(o.value)}catch(i){}let n=o.value;if(typeof n==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),o}});var Od=_("$ZodUndefined",(e,t)=>{Te.init(e,t),e._zod.pattern=Au,e._zod.values=new Set([void 0]),e._zod.parse=(o,r)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),o}}),Md=_("$ZodNull",(e,t)=>{Te.init(e,t),e._zod.pattern=Mu,e._zod.values=new Set([null]),e._zod.parse=(o,r)=>{let n=o.value;if(n===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),o}}),Ad=_("$ZodAny",(e,t)=>{Te.init(e,t),e._zod.parse=(o)=>o}),Nd=_("$ZodUnknown",(e,t)=>{Te.init(e,t),e._zod.parse=(o)=>o}),qd=_("$ZodNever",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function Xu(e,t,o){if(e.issues.length)t.issues.push(...Gt(o,e.issues));t.value[o]=e.value}var jd=_("$ZodArray",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),o;o.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let c=n[s],l=t.element._zod.run({value:c,issues:[]},r);if(l instanceof Promise)i.push(l.then((u)=>Xu(u,o,s)));else Xu(l,o,s)}if(i.length)return Promise.all(i).then(()=>o);return o}});function Ui(e,t,o,r,n,i){let s=o in r;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...Gt(o,e.issues))}if(!s&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(e.value===void 0){if(s)t.value[o]=void 0}else t.value[o]=e.value}function Ld(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let o=Gl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Ud(e,t,o,r,n,i){let s=[],c=n.keySet,l=n.catchall._zod,u=l.def.type,h=l.optin==="optional",m=l.optout==="optional";for(let f in t){if(f==="__proto__")continue;if(c.has(f))continue;if(u==="never"){s.push(f);continue}let S=l.run({value:t[f],issues:[]},r);if(S instanceof Promise)e.push(S.then((y)=>Ui(y,o,f,t,h,m)));else Ui(S,o,f,t,h,m)}if(s.length)o.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return o;return Promise.all(e).then(()=>o)}var Xf=_("$ZodObject",(e,t)=>{if(Te.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let r=Xr(()=>Ld(t));Se(e._zod,"propValues",()=>{let c=t.shape,l={};for(let u in c){let h=c[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(let m of h.values)l[u].add(m)}}return l});let n=Do,i=t.catchall,s;e._zod.parse=(c,l)=>{s??(s=r.value);let u=c.value;if(!n(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};let h=[],m=s.shape;for(let f of s.keys){let S=m[f],y=S._zod.optin==="optional",b=S._zod.optout==="optional",v=S._zod.run({value:u[f],issues:[]},l);if(v instanceof Promise)h.push(v.then((k)=>Ui(k,c,f,u,y,b)));else Ui(v,c,f,u,y,b)}if(!i)return h.length?Promise.all(h).then(()=>c):c;return Ud(h,u,c,l,r.value,e)}}),Dd=_("$ZodObjectJIT",(e,t)=>{Xf.init(e,t);let o=e._zod.parse,r=Xr(()=>Ld(t)),n=(f)=>{let S=new oc(["shape","payload","ctx"]),y=r.value,b=(z)=>{let R=Fa(z);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};S.write("const input = payload.value;");let v=Object.create(null),k=0;for(let z of y.keys)v[z]=`key_${k++}`;S.write("const newResult = {};");for(let z of y.keys){let R=v[z],M=Fa(z),oe=f[z],pe=oe?._zod?.optin==="optional",we=oe?._zod?.optout==="optional";if(S.write(`const ${R} = ${b(z)};`),pe&&we)S.write(`
|
|
4
4
|
if (${R}.issues.length) {
|
|
5
5
|
if (${M} in input) {
|
|
6
6
|
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
@@ -61,14 +61,14 @@ var{create:If,defineProperty:$i,getOwnPropertyDescriptor:Of,getOwnPropertyNames:
|
|
|
61
61
|
|
|
62
62
|
`)}S.write("payload.value = newResult;"),S.write("return payload;");let U=S.compile();return(z,R)=>U(f,z,R)},i,s=Do,c=!Uo.jitless,u=c&&Jl.value,h=t.catchall,m;e._zod.parse=(f,S)=>{m??(m=r.value);let y=f.value;if(!s(y))return f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f;if(c&&u&&S?.async===!1&&S.jitless!==!0){if(!i)i=n(t.shape);if(f=i(f,S),!h)return f;return Ud([],y,f,S,m,e)}return o(f,S)}});function ed(e,t,o,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!mo(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map((i)=>i.issues.map((s)=>bt(s,r,ct())))}),t}var sc=_("$ZodUnion",(e,t)=>{Te.init(e,t),Se(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),Se(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),Se(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),Se(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${r.map((n)=>Mi(n.source)).join("|")})$`)}return});let o=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,n)=>{if(o)return o(r,n);let i=!1,s=[];for(let c of t.options){let l=c._zod.run({value:r.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}if(!i)return ed(s,r,e,n);return Promise.all(s).then((c)=>ed(c,r,e,n))}});var Zd=_("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,sc.init(e,t);let o=e._zod.parse;Se(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,l]of Object.entries(s)){if(!n[c])n[c]=new Set;for(let u of l)n[c].add(u)}}return n});let r=Xr(()=>{let n=t.options,i=new Map;for(let s of n){let c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of c){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!Do(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let c=r.value.get(s?.[t.discriminator]);if(c)return c._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return o(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:s,path:[t.discriminator],inst:e}),n}}),Hd=_("$ZodIntersection",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,i=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,u])=>td(o,l,u));return td(o,i,s)}});function rc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ho(e)&&ho(t)){let o=Object.keys(t),r=Object.keys(e).filter((i)=>o.indexOf(i)!==-1),n={...e,...t};for(let i of r){let s=rc(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let r=0;r<e.length;r++){let n=e[r],i=t[r],s=rc(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};o.push(s.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function td(e,t,o){let r=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let l of c.keys){if(!r.has(l))r.set(l,{});r.get(l).l=!0}}else e.issues.push(c);for(let c of o.issues)if(c.code==="unrecognized_keys")for(let l of c.keys){if(!r.has(l))r.set(l,{});r.get(l).r=!0}else e.issues.push(c);let i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n)e.issues.push({...n,keys:i});if(mo(e))return e;let s=rc(t.value,o.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var Fd=_("$ZodRecord",(e,t)=>{Te.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!ho(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let i=[],s=t.keyType._zod.values;if(s){o.value={};let c=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){c.add(typeof u==="number"?u.toString():u);let h=t.keyType._zod.run({value:u,issues:[]},r);if(h instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(h.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map((S)=>bt(S,r,ct())),input:u,path:[u],inst:e});continue}let m=h.value,f=t.valueType._zod.run({value:n[u],issues:[]},r);if(f instanceof Promise)i.push(f.then((S)=>{if(S.issues.length)o.issues.push(...Gt(u,S.issues));o.value[m]=S.value}));else{if(f.issues.length)o.issues.push(...Gt(u,f.issues));o.value[m]=f.value}}let l;for(let u in n)if(!c.has(u))l=l??[],l.push(u);if(l&&l.length>0)o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{o.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Xa.test(c)&&l.issues.length){let m=t.keyType._zod.run({value:Number(c),issues:[]},r);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)l=m}if(l.issues.length){if(t.mode==="loose")o.value[c]=n[c];else o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((m)=>bt(m,r,ct())),input:c,path:[c],inst:e});continue}let h=t.valueType._zod.run({value:n[c],issues:[]},r);if(h instanceof Promise)i.push(h.then((m)=>{if(m.issues.length)o.issues.push(...Gt(c,m.issues));o.value[l.value]=m.value}));else{if(h.issues.length)o.issues.push(...Gt(c,h.issues));o.value[l.value]=h.value}}}if(i.length)return Promise.all(i).then(()=>o);return o}});var Vd=_("$ZodEnum",(e,t)=>{Te.init(e,t);let o=Ii(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter((n)=>Bl.has(typeof n)).map((n)=>typeof n==="string"?Bt(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:o,input:s,inst:e}),n}}),Jd=_("$ZodLiteral",(e,t)=>{if(Te.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let o=new Set(t.values);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Bt(r):r?Bt(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let i=r.value;if(o.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});var Bd=_("$ZodTransform",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Yr(e.constructor.name);let n=t.transform(o.value,o);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(o.value=s,o.fallback=!0,o));if(n instanceof Promise)throw new Ct;return o.value=n,o.fallback=!0,o}});function od(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var ic=_("$ZodOptional",(e,t)=>{Te.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Se(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Mi(o.source)})?$`):void 0}),e._zod.parse=(o,r)=>{if(t.innerType._zod.optin==="optional"){let n=o.value,i=t.innerType._zod.run(o,r);if(i instanceof Promise)return i.then((s)=>od(s,n));return od(i,n)}if(o.value===void 0)return o;return t.innerType._zod.run(o,r)}}),Gd=_("$ZodExactOptional",(e,t)=>{ic.init(e,t),Se(e._zod,"values",()=>t.innerType._zod.values),Se(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),Wd=_("$ZodNullable",(e,t)=>{Te.init(e,t),Se(e._zod,"optin",()=>t.innerType._zod.optin),Se(e._zod,"optout",()=>t.innerType._zod.optout),Se(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Mi(o.source)}|null)$`):void 0}),Se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,r)=>{if(o.value===null)return o;return t.innerType._zod.run(o,r)}}),Kd=_("$ZodDefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)return o.value=t.defaultValue,o;let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>rd(i,t));return rd(n,t)}});function rd(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Yd=_("$ZodPrefault",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)o.value=t.defaultValue;return t.innerType._zod.run(o,r)}}),Qd=_("$ZodNonOptional",(e,t)=>{Te.init(e,t),Se(e._zod,"values",()=>{let o=t.innerType._zod.values;return o?new Set([...o].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(o,r)=>{let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>nd(i,e));return nd(n,e)}});function nd(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Xd=_("$ZodCatch",(e,t)=>{Te.init(e,t),e._zod.optin="optional",Se(e._zod,"optout",()=>t.innerType._zod.optout),Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>{if(o.value=i.value,i.issues.length)o.value=t.catchValue({...o,error:{issues:i.issues.map((s)=>bt(s,r,ct()))},input:o.value}),o.issues=[],o.fallback=!0;return o});if(o.value=n.value,n.issues.length)o.value=t.catchValue({...o,error:{issues:n.issues.map((i)=>bt(i,r,ct()))},input:o.value}),o.issues=[],o.fallback=!0;return o}});var ac=_("$ZodPipe",(e,t)=>{Te.init(e,t),Se(e._zod,"values",()=>t.in._zod.values),Se(e._zod,"optin",()=>t.in._zod.optin),Se(e._zod,"optout",()=>t.out._zod.optout),Se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(o,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(o,r);if(i instanceof Promise)return i.then((s)=>Li(s,t.in,r));return Li(i,t.in,r)}let n=t.in._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Li(i,t.out,r));return Li(n,t.out,r)}});function Li(e,t,o){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}var ep=_("$ZodPreprocess",(e,t)=>{ac.init(e,t)}),tp=_("$ZodReadonly",(e,t)=>{Te.init(e,t),Se(e._zod,"propValues",()=>t.innerType._zod.propValues),Se(e._zod,"values",()=>t.innerType._zod.values),Se(e._zod,"optin",()=>t.innerType?._zod?.optin),Se(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then(sd);return sd(n)}});function sd(e){return e.value=Object.freeze(e.value),e}var op=_("$ZodLazy",(e,t)=>{Te.init(e,t),Se(e._zod,"innerType",()=>{let o=t;if(!o._cachedInner)o._cachedInner=t.getter();return o._cachedInner}),Se(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Se(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Se(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Se(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),rp=_("$ZodCustom",(e,t)=>{et.init(e,t),Te.init(e,t),e._zod.parse=(o,r)=>o,e._zod.check=(o)=>{let r=o.value,n=t.fn(r);if(n instanceof Promise)return n.then((i)=>id(i,o,r,e));id(n,o,r,e);return}});function id(e,t,o,r){if(!e){let n={code:"custom",input:o,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)n.params=r._zod.def.params;t.issues.push(fo(n))}}var eg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let o={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",mac:"MAC 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"},r={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=r[n.expected]??n.expected,s=Yl(n.input),c=r[s]??s;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${Ba(n.values[0])}`;return`Invalid option: expected one of ${Ha(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Ha(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function cc(){return{localeError:eg()}}var np,tg=Symbol("ZodOutput"),og=Symbol("ZodInput");class sp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let o=t[0];if(this._map.set(e,o),o&&typeof o==="object"&&"id"in o)this._idmap.set(o.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let o={...this.get(t)??{}};delete o.id;let r={...o,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ip(){return new sp}(np=globalThis).__zod_globalRegistry??(np.__zod_globalRegistry=ip());var Wt=globalThis.__zod_globalRegistry;function ap(e,t){return new e({type:"string",...H(t)})}function lc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...H(t)})}function uc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...H(t)})}function cp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...H(t)})}function lp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(t)})}function up(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(t)})}function dp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(t)})}function dc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...H(t)})}function pp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...H(t)})}function hp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(t)})}function mp(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...H(t)})}function fp(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(t)})}function gp(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...H(t)})}function Sp(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...H(t)})}function _p(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(t)})}function yp(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(t)})}function bp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(t)})}function vp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(t)})}function wp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(t)})}function zp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...H(t)})}function Rp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...H(t)})}function xp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...H(t)})}function Pp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...H(t)})}function Ep(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(t)})}function kp(e,t){return new e({type:"string",format:"date",check:"string_format",...H(t)})}function Tp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...H(t)})}function $p(e,t){return new e({type:"string",format:"duration",check:"string_format",...H(t)})}function Cp(e,t){return new e({type:"number",checks:[],...H(t)})}function Ip(e,t){return new e({type:"number",coerce:!0,checks:[],...H(t)})}function Op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...H(t)})}function Mp(e,t){return new e({type:"boolean",...H(t)})}function Ap(e,t){return new e({type:"undefined",...H(t)})}function Np(e,t){return new e({type:"null",...H(t)})}function qp(e){return new e({type:"any"})}function jp(e){return new e({type:"unknown"})}function Lp(e,t){return new e({type:"never",...H(t)})}function Zi(e,t){return new ec({check:"less_than",...H(t),value:e,inclusive:!1})}function nn(e,t){return new ec({check:"less_than",...H(t),value:e,inclusive:!0})}function Hi(e,t){return new tc({check:"greater_than",...H(t),value:e,inclusive:!1})}function sn(e,t){return new tc({check:"greater_than",...H(t),value:e,inclusive:!0})}function Fi(e,t){return new Lu({check:"multiple_of",...H(t),value:e})}function Vi(e,t){return new Du({check:"max_length",...H(t),maximum:e})}function Zo(e,t){return new Zu({check:"min_length",...H(t),minimum:e})}function Ji(e,t){return new Hu({check:"length_equals",...H(t),length:e})}function pc(e,t){return new Fu({check:"string_format",format:"regex",...H(t),pattern:e})}function hc(e){return new Vu({check:"string_format",format:"lowercase",...H(e)})}function mc(e){return new Ju({check:"string_format",format:"uppercase",...H(e)})}function fc(e,t){return new Bu({check:"string_format",format:"includes",...H(t),includes:e})}function gc(e,t){return new Gu({check:"string_format",format:"starts_with",...H(t),prefix:e})}function Sc(e,t){return new Wu({check:"string_format",format:"ends_with",...H(t),suffix:e})}function Kt(e){return new Ku({check:"overwrite",tx:e})}function _c(e){return Kt((t)=>t.normalize(e))}function yc(){return Kt((e)=>e.trim())}function bc(){return Kt((e)=>e.toLowerCase())}function vc(){return Kt((e)=>e.toUpperCase())}function wc(){return Kt((e)=>Vl(e))}function Up(e,t,o){return new e({type:"array",element:t,...H(o)})}function Dp(e,t,o){return new e({type:"custom",check:"custom",fn:t,...H(o)})}function Zp(e,t){let o=rg((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(fo(n,r.value,o._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=o),i.continue??(i.continue=!o._zod.def.abort),r.issues.push(fo(i))}},e(r.value,r)),t);return o}function rg(e,t){let o=new et({check:"custom",...H(t)});return o._zod.check=e,o}function cn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Wt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function $e(e,t,o={path:[],schemaPath:[]}){var r;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,o.schemaPath.includes(e))i.cycle=o.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,s);let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let h={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,h);else{let f=s.schema,S=t.processors[n.type];if(!S)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);S(e,t,f,h)}let m=e._zod.parent;if(m){if(!s.ref)s.ref=m;$e(m,t,h),t.seen.get(m).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(t.io==="input"&<(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function ln(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let l=r.get(c);if(l&&l!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,s[0])}}let n=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let m=e.external.registry.get(s[0])?.id,f=e.external.uri??((y)=>y);if(m)return{ref:f(m)};let S=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=S,{defId:S,ref:`${f("__shared")}#/${c}/${S}`}}if(s[1]===o)return{ref:"#"};let u=`${"#"}/${c}/`,h=s[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:u+h}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:l,defId:u}=n(s);if(c.def={...c.schema},u)c.defId=u;let h=c.schema;for(let m in h)delete h[m];h.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref"){i(s);continue}}}}function un(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let l=e.seen.get(c);if(l.ref===null)return;let u=l.def??l.schema,h={...u},m=l.ref;if(l.ref=null,m){r(m);let S=e.seen.get(m),y=S.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(y);else Object.assign(u,y);if(Object.assign(u,h),c._zod.parent===m)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in h))delete u[v]}if(y.$ref&&S.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in S.def&&JSON.stringify(u[v])===JSON.stringify(S.def[v]))delete u[v]}}let f=c._zod.parent;if(f&&f!==m){r(f);let S=e.seen.get(f);if(S?.schema.$ref){if(u.$ref=S.schema.$ref,S.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in S.def&&JSON.stringify(u[y])===JSON.stringify(S.def[y]))delete u[y]}}}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Object.assign(n,o.def??o.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let c of e.seen.entries()){let l=c[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;s[l.defId]=l.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:an(t,"input",e.processors),output:an(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function lt(e,t){let o=t??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return lt(r.element,o);if(r.type==="set")return lt(r.valueType,o);if(r.type==="lazy")return lt(r.getter(),o);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return lt(r.innerType,o);if(r.type==="intersection")return lt(r.left,o)||lt(r.right,o);if(r.type==="record"||r.type==="map")return lt(r.keyType,o)||lt(r.valueType,o);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return lt(r.in,o)||lt(r.out,o)}if(r.type==="object"){for(let n in r.shape)if(lt(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(lt(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(lt(n,o))return!0;if(r.rest&<(r.rest,o))return!0;return!1}return!1}var Hp=(e,t={})=>(o)=>{let r=cn({...o,processors:t});return $e(e,r),ln(r,e),un(r,e)},an=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},s=cn({...n??{},target:i,io:t,processors:o});return $e(e,s),ln(s,e),un(s,e)};var ng={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zc=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:s,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=ng[c]??c,n.format==="")delete n.format;if(c==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let h=[...l];if(h.length===1)n.pattern=h[0].source;else if(h.length>1)n.allOf=[...h.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Rc=(e,t,o,r)=>{let n=o,{minimum:i,maximum:s,format:c,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))n.type="integer";else n.type="number";let m=typeof h==="number"&&h>=(i??Number.NEGATIVE_INFINITY),f=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),S=t.target==="draft-04"||t.target==="openapi-3.0";if(m)if(S)n.minimum=h,n.exclusiveMinimum=!0;else n.exclusiveMinimum=h;else if(typeof i==="number")n.minimum=i;if(f)if(S)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof l==="number")n.multipleOf=l},xc=(e,t,o,r)=>{o.type="boolean"},Vp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Jp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Pc=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},Ec=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Bp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},kc=(e,t,o,r)=>{o.not={}},Tc=(e,t,o,r)=>{},$c=(e,t,o,r)=>{},Gp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Cc=(e,t,o,r)=>{let n=e._zod.def,i=Ii(n.entries);if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";o.enum=i},Ic=(e,t,o,r)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(o.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")o.enum=[s];else o.const=s}else{if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";if(i.every((s)=>typeof s==="boolean"))o.type="boolean";if(i.every((s)=>s===null))o.type="null";o.enum=i}},Wp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Kp=(e,t,o,r)=>{let n=o,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Yp=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:l}=e._zod.bag;if(s!==void 0)i.minLength=s;if(c!==void 0)i.maxLength=c;if(l)if(l.length===1)i.contentMediaType=l[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},Qp=(e,t,o,r)=>{o.type="boolean"},Oc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Xp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Mc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},eh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},th=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Ac=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=$e(i.element,t,{...r,path:[...r.path,"items"]})},Nc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=$e(s[u],t,{...r,path:[...r.path,"properties",u]});let c=new Set(Object.keys(s)),l=new Set([...c].filter((u)=>{let h=i.shape[u]._zod;if(t.io==="input")return h.optin===void 0;else return h.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=$e(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},qc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,l)=>$e(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));if(i)o.oneOf=s;else o.anyOf=s},jc=(e,t,o,r)=>{let n=e._zod.def,i=$e(n.left,t,{...r,path:[...r.path,"allOf",0]}),s=$e(n.right,t,{...r,path:[...r.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];o.allOf=l},oh=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((f,S)=>$e(f,t,{...r,path:[...r.path,s,S]})),u=i.rest?$e(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=l,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:l},u)n.items.anyOf.push(u);if(n.minItems=l.length,!u)n.maxItems=l.length}else if(n.items=l,u)n.additionalItems=u;let{minimum:h,maximum:m}=e._zod.bag;if(typeof h==="number")n.minItems=h;if(typeof m==="number")n.maxItems=m},Lc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let h=$e(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let m of l)n.patternProperties[m.source]=h}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=$e(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});n.additionalProperties=$e(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values;if(u){let h=[...u].filter((m)=>typeof m==="string"||typeof m==="number");if(h.length>0)n.required=h}},Uc=(e,t,o,r)=>{let n=e._zod.def,i=$e(n.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,o.nullable=!0;else o.anyOf=[i,{type:"null"}]},Dc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Zc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Hc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")o._prefault=JSON.parse(JSON.stringify(n.defaultValue))},Fc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=s},Vc=(e,t,o,r)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;$e(s,t,r);let c=t.seen.get(e);c.ref=s},Jc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.readOnly=!0},rh=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Bi=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Bc=(e,t,o,r)=>{let n=e._zod.innerType;$e(n,t,r);let i=t.seen.get(e);i.ref=n},Fp={string:zc,number:Rc,boolean:xc,bigint:Vp,symbol:Jp,null:Pc,undefined:Ec,void:Bp,never:kc,any:Tc,unknown:$c,date:Gp,enum:Cc,literal:Ic,nan:Wp,template_literal:Kp,file:Yp,success:Qp,custom:Oc,function:Xp,transform:Mc,map:eh,set:th,array:Ac,object:Nc,union:qc,intersection:jc,tuple:oh,record:Lc,nullable:Uc,nonoptional:Dc,default:Zc,prefault:Hc,catch:Fc,pipe:Vc,readonly:Jc,promise:rh,optional:Bi,lazy:Bc};function Gi(e,t){if("_idmap"in e){let r=e,n=cn({...t,processors:Fp}),i={};for(let l of r._idmap.entries()){let[u,h]=l;$e(h,n)}let s={},c={registry:r,uri:t?.uri,defs:i};n.external=c;for(let l of r._idmap.entries()){let[u,h]=l;ln(n,h),s[u]=un(n,h)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let o=cn({...t,processors:Fp});return $e(e,o),ln(o,e),un(o,e)}var pg=_("ZodISODateTime",(e,t)=>{_d.init(e,t),qe.init(e,t)});function Fo(e){return Ep(pg,e)}var hg=_("ZodISODate",(e,t)=>{yd.init(e,t),qe.init(e,t)});function Gc(e){return kp(hg,e)}var mg=_("ZodISOTime",(e,t)=>{bd.init(e,t),qe.init(e,t)});function nh(e){return Tp(mg,e)}var fg=_("ZodISODuration",(e,t)=>{vd.init(e,t),qe.init(e,t)});function sh(e){return $p(fg,e)}var gg=(e,t)=>{Ni.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>Ka(e,o)},flatten:{value:(o)=>Wa(e,o)},addIssue:{value:(o)=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Qr,2)}},addIssues:{value:(o)=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Qr,2)}},isEmpty:{get(){return e.issues.length===0}}})};var St=_("ZodError",gg,{Parent:Error});var ah=qi(St),ch=ji(St),Ki=en(St),lh=tn(St),uh=tu(St),dh=ou(St),ph=ru(St),hh=nu(St),mh=su(St),fh=iu(St),gh=au(St),Sh=cu(St);var _h=new WeakMap;function dn(e,t,o){let r=Object.getPrototypeOf(e),n=_h.get(r);if(!n)n=new Set,_h.set(r,n);if(n.has(t))return;n.add(t);for(let i in o){let s=o[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){let c=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var Ce=_("ZodType",(e,t)=>(Te.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:an(e,"input"),output:an(e,"output")}}),e.toJSONSchema=Hp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>ah(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>Ki(e,o,r),e.parseAsync=async(o,r)=>ch(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>lh(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>uh(e,o,r),e.decode=(o,r)=>dh(e,o,r),e.encodeAsync=async(o,r)=>ph(e,o,r),e.decodeAsync=async(o,r)=>hh(e,o,r),e.safeEncode=(o,r)=>mh(e,o,r),e.safeDecode=(o,r)=>fh(e,o,r),e.safeEncodeAsync=async(o,r)=>gh(e,o,r),e.safeDecodeAsync=async(o,r)=>Sh(e,o,r),dn(e,"ZodType",{check(...o){let r=this.def;return this.clone(Jt(r,{checks:[...r.checks??[],...o.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,r){return yt(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(sS(o,r))},superRefine(o,r){return this.check(iS(o,r))},overwrite(o){return this.check(Kt(o))},optional(){return V(this)},exactOptional(){return Vg(this)},nullable(){return wh(this)},nullish(){return V(wh(this))},nonoptional(o){return Yg(this,o)},array(){return g(this)},or(o){return C([this,o])},and(o){return It(this,o)},transform(o){return zh(this,Ih(o))},default(o){return Gg(this,o)},prefault(o){return Kg(this,o)},catch(o){return Xg(this,o)},pipe(o){return zh(this,o)},readonly(){return oS(this)},describe(o){let r=this.clone();return Wt.add(r,{description:o}),r},meta(...o){if(o.length===0)return Wt.get(this);let r=this.clone();return Wt.add(r,o[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return Wt.get(e)?.description},configurable:!0}),e)),Rh=_("_ZodString",(e,t)=>{Di.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zc(e,r,n,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,dn(e,"_ZodString",{regex(...r){return this.check(pc(...r))},includes(...r){return this.check(fc(...r))},startsWith(...r){return this.check(gc(...r))},endsWith(...r){return this.check(Sc(...r))},min(...r){return this.check(Zo(...r))},max(...r){return this.check(Vi(...r))},length(...r){return this.check(Ji(...r))},nonempty(...r){return this.check(Zo(1,...r))},lowercase(r){return this.check(hc(r))},uppercase(r){return this.check(mc(r))},trim(){return this.check(yc())},normalize(...r){return this.check(_c(...r))},toLowerCase(){return this.check(bc())},toUpperCase(){return this.check(vc())},slugify(){return this.check(wc())}})}),xh=_("ZodString",(e,t)=>{Di.init(e,t),Rh.init(e,t),e.email=(o)=>e.check(lc(Ph,o)),e.url=(o)=>e.check(dc(kh,o)),e.jwt=(o)=>e.check(Pp(Ig,o)),e.emoji=(o)=>e.check(pp(_g,o)),e.guid=(o)=>e.check(uc(yh,o)),e.uuid=(o)=>e.check(cp(Yi,o)),e.uuidv4=(o)=>e.check(lp(Yi,o)),e.uuidv6=(o)=>e.check(up(Yi,o)),e.uuidv7=(o)=>e.check(dp(Yi,o)),e.nanoid=(o)=>e.check(hp(yg,o)),e.guid=(o)=>e.check(uc(yh,o)),e.cuid=(o)=>e.check(mp(bg,o)),e.cuid2=(o)=>e.check(fp(vg,o)),e.ulid=(o)=>e.check(gp(wg,o)),e.base64=(o)=>e.check(zp(Tg,o)),e.base64url=(o)=>e.check(Rp($g,o)),e.xid=(o)=>e.check(Sp(zg,o)),e.ksuid=(o)=>e.check(_p(Rg,o)),e.ipv4=(o)=>e.check(yp(xg,o)),e.ipv6=(o)=>e.check(bp(Pg,o)),e.cidrv4=(o)=>e.check(vp(Eg,o)),e.cidrv6=(o)=>e.check(wp(kg,o)),e.e164=(o)=>e.check(xp(Cg,o)),e.datetime=(o)=>e.check(Fo(o)),e.date=(o)=>e.check(Gc(o)),e.time=(o)=>e.check(nh(o)),e.duration=(o)=>e.check(sh(o))});function a(e){return ap(xh,e)}var qe=_("ZodStringFormat",(e,t)=>{Me.init(e,t),Rh.init(e,t)}),Ph=_("ZodEmail",(e,t)=>{ld.init(e,t),qe.init(e,t)});function Eh(e){return lc(Ph,e)}var yh=_("ZodGUID",(e,t)=>{ad.init(e,t),qe.init(e,t)});var Yi=_("ZodUUID",(e,t)=>{cd.init(e,t),qe.init(e,t)});var kh=_("ZodURL",(e,t)=>{ud.init(e,t),qe.init(e,t)});function Qi(e){return dc(kh,e)}var _g=_("ZodEmoji",(e,t)=>{dd.init(e,t),qe.init(e,t)});var yg=_("ZodNanoID",(e,t)=>{pd.init(e,t),qe.init(e,t)});var bg=_("ZodCUID",(e,t)=>{hd.init(e,t),qe.init(e,t)});var vg=_("ZodCUID2",(e,t)=>{md.init(e,t),qe.init(e,t)});var wg=_("ZodULID",(e,t)=>{fd.init(e,t),qe.init(e,t)});var zg=_("ZodXID",(e,t)=>{gd.init(e,t),qe.init(e,t)});var Rg=_("ZodKSUID",(e,t)=>{Sd.init(e,t),qe.init(e,t)});var xg=_("ZodIPv4",(e,t)=>{wd.init(e,t),qe.init(e,t)});var Pg=_("ZodIPv6",(e,t)=>{zd.init(e,t),qe.init(e,t)});var Eg=_("ZodCIDRv4",(e,t)=>{Rd.init(e,t),qe.init(e,t)});var kg=_("ZodCIDRv6",(e,t)=>{xd.init(e,t),qe.init(e,t)});var Tg=_("ZodBase64",(e,t)=>{Ed.init(e,t),qe.init(e,t)});var $g=_("ZodBase64URL",(e,t)=>{kd.init(e,t),qe.init(e,t)});var Cg=_("ZodE164",(e,t)=>{Td.init(e,t),qe.init(e,t)});var Ig=_("ZodJWT",(e,t)=>{$d.init(e,t),qe.init(e,t)});var Xi=_("ZodNumber",(e,t)=>{nc.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rc(e,r,n,i),dn(e,"ZodNumber",{gt(r,n){return this.check(Hi(r,n))},gte(r,n){return this.check(sn(r,n))},min(r,n){return this.check(sn(r,n))},lt(r,n){return this.check(Zi(r,n))},lte(r,n){return this.check(nn(r,n))},max(r,n){return this.check(nn(r,n))},int(r){return this.check(bh(r))},safe(r){return this.check(bh(r))},positive(r){return this.check(Hi(0,r))},nonnegative(r){return this.check(sn(0,r))},negative(r){return this.check(Zi(0,r))},nonpositive(r){return this.check(nn(0,r))},multipleOf(r,n){return this.check(Fi(r,n))},step(r,n){return this.check(Fi(r,n))},finite(){return this}});let o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??0.5),e.isFinite=!0,e.format=o.format??null});function w(e){return Cp(Xi,e)}var Og=_("ZodNumberFormat",(e,t)=>{Cd.init(e,t),Xi.init(e,t)});function bh(e){return Op(Og,e)}var Th=_("ZodBoolean",(e,t)=>{Id.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xc(e,o,r,n)});function T(e){return Mp(Th,e)}var Mg=_("ZodUndefined",(e,t)=>{Od.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ec(e,o,r,n)});function Kc(e){return Ap(Mg,e)}var Ag=_("ZodNull",(e,t)=>{Md.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Pc(e,o,r,n)});function go(e){return Np(Ag,e)}var Ng=_("ZodAny",(e,t)=>{Ad.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Tc(e,o,r,n)});function ea(){return qp(Ng)}var qg=_("ZodUnknown",(e,t)=>{Nd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$c(e,o,r,n)});function L(){return jp(qg)}var jg=_("ZodNever",(e,t)=>{qd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kc(e,o,r,n)});function Yc(e){return Lp(jg,e)}var Lg=_("ZodArray",(e,t)=>{jd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ac(e,o,r,n),e.element=t.element,dn(e,"ZodArray",{min(o,r){return this.check(Zo(o,r))},nonempty(o){return this.check(Zo(1,o))},max(o,r){return this.check(Vi(o,r))},length(o,r){return this.check(Ji(o,r))},unwrap(){return this.element}})});function g(e,t){return Up(Lg,e,t)}var $h=_("ZodObject",(e,t)=>{Dd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nc(e,o,r,n),Se(e,"shape",()=>t.shape),dn(e,"ZodObject",{keyof(){return ae(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:L()})},loose(){return this.clone({...this._zod.def,catchall:L()})},strict(){return this.clone({...this._zod.def,catchall:Yc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Ff(this,o)},safeExtend(o){return Vf(this,o)},merge(o){return Jf(this,o)},pick(o){return Zf(this,o)},omit(o){return Hf(this,o)},partial(...o){return Bf(Oh,this,o[0])},required(...o){return Gf(Mh,this,o[0])}})});function d(e,t){let o={type:"object",shape:e??{},...H(t)};return new $h(o)}function K(e,t){return new $h({type:"object",shape:e,catchall:L(),...H(t)})}var Ch=_("ZodUnion",(e,t)=>{sc.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qc(e,o,r,n),e.options=t.options});function C(e,t){return new Ch({type:"union",options:e,...H(t)})}var Ug=_("ZodDiscriminatedUnion",(e,t)=>{Ch.init(e,t),Zd.init(e,t)});function Vo(e,t,o){return new Ug({type:"union",options:t,discriminator:e,...H(o)})}var Dg=_("ZodIntersection",(e,t)=>{Hd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n)});function It(e,t){return new Dg({type:"intersection",left:e,right:t})}var vh=_("ZodRecord",(e,t)=>{Fd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lc(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function E(e,t,o){if(!t||!t._zod)return new vh({type:"record",keyType:a(),valueType:e,...H(t)});return new vh({type:"record",keyType:e,valueType:t,...H(o)})}var Wc=_("ZodEnum",(e,t)=>{Vd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cc(e,r,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(r,n)=>{let i={};for(let s of r)if(o.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Wc({...t,checks:[],...H(n),entries:i})},e.exclude=(r,n)=>{let i={...t.entries};for(let s of r)if(o.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Wc({...t,checks:[],...H(n),entries:i})}});function ae(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Wc({type:"enum",entries:o,...H(t)})}var Zg=_("ZodLiteral",(e,t)=>{Jd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ic(e,o,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function p(e,t){return new Zg({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}var Hg=_("ZodTransform",(e,t)=>{Bd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Mc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Yr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(fo(i,o.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=e),o.issues.push(fo(s))}};let n=t.transform(o.value,o);if(n instanceof Promise)return n.then((i)=>(o.value=i,o.fallback=!0,o));return o.value=n,o.fallback=!0,o}});function Ih(e){return new Hg({type:"transform",transform:e})}var Oh=_("ZodOptional",(e,t)=>{ic.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bi(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Oh({type:"optional",innerType:e})}var Fg=_("ZodExactOptional",(e,t)=>{Gd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bi(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new Fg({type:"optional",innerType:e})}var Jg=_("ZodNullable",(e,t)=>{Wd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Uc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function wh(e){return new Jg({type:"nullable",innerType:e})}var Bg=_("ZodDefault",(e,t)=>{Kd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Zc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gg(e,t){return new Bg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ja(t)}})}var Wg=_("ZodPrefault",(e,t)=>{Yd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Hc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Kg(e,t){return new Wg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ja(t)}})}var Mh=_("ZodNonOptional",(e,t)=>{Qd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Dc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Yg(e,t){return new Mh({type:"nonoptional",innerType:e,...H(t)})}var Qg=_("ZodCatch",(e,t)=>{Xd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Fc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xg(e,t){return new Qg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var Ah=_("ZodPipe",(e,t)=>{ac.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Vc(e,o,r,n),e.in=t.in,e.out=t.out});function zh(e,t){return new Ah({type:"pipe",in:e,out:t})}var eS=_("ZodPreprocess",(e,t)=>{Ah.init(e,t),ep.init(e,t)}),tS=_("ZodReadonly",(e,t)=>{tp.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Jc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new tS({type:"readonly",innerType:e})}var rS=_("ZodLazy",(e,t)=>{op.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bc(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function pn(e){return new rS({type:"lazy",getter:e})}var nS=_("ZodCustom",(e,t)=>{rp.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oc(e,o,r,n)});function sS(e,t={}){return Dp(nS,e,t)}function iS(e,t){return Zp(e,t)}function So(e,t){return new eS({type:"pipe",in:Ih(e),out:t})}var qh={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"};var Nh;(function(e){})(Nh||(Nh={}));function aS(e){return Ip(Xi,e)}ct(cc());var hn="2025-11-25";var ta=[hn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oa="io.modelcontextprotocol/related-task",_o="io.modelcontextprotocol/protocolVersion",Jo="io.modelcontextprotocol/clientInfo",Pt="io.modelcontextprotocol/serverInfo",yo="io.modelcontextprotocol/clientCapabilities",Bo="io.modelcontextprotocol/subscriptionId",Go="io.modelcontextprotocol/logLevel";var bo="2.0";var Ot=pn(()=>C([a(),w(),T(),go(),E(a(),Ot),g(Ot)])),De=E(a(),Ot),ra=g(Ot),Wo=C([a(),w().int()]),Ko=a(),mn=d({ttl:w().optional()}),fn=d({taskId:a()}),Yo=K({progressToken:Wo.optional(),[oa]:fn.optional()}),Ke=d({_meta:Yo.optional()}),Qt=Ke.extend({task:mn.optional()}),Ze=d({method:a(),params:Ke.loose().optional()}),st=d({_meta:Yo.optional()}),tt=d({method:a(),params:st.loose().optional()}),Qo=K({get[Pt](){return Et.optional().catch(void 0)}}),He=K({_meta:Qo.optional()}),vt=C([a(),w().int()]),Xo=d({jsonrpc:p(bo),id:vt,...Ze.shape}).strict(),er=d({jsonrpc:p(bo),...tt.shape}).strict(),vo=d({jsonrpc:p(bo),id:vt,result:He}).strict(),wo=d({jsonrpc:p(bo),id:vt.optional(),error:d({code:w().int(),message:a(),data:L().optional()})}).strict(),zo=C([Xo,er,vo,wo]),na=C([vo,wo]),Xt=He.strict(),gn=st.extend({requestId:vt.optional(),reason:a().optional()}),tr=tt.extend({method:p("notifications/cancelled"),params:gn}),Sn=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),Mt=d({icons:g(Sn).optional()}),xt=d({name:a(),title:a().optional()}),Et=xt.extend({...xt.shape,...Mt.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),cS=It(d({applyDefaults:T().optional()}),De),lS=So((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},It(d({form:cS.optional(),url:De.optional()}),De.optional())),sa=K({list:De.optional(),cancel:De.optional(),requests:K({sampling:K({createMessage:De.optional()}).optional(),elicitation:K({create:De.optional()}).optional()}).optional()}),ia=K({list:De.optional(),cancel:De.optional(),requests:K({tools:K({call:De.optional()}).optional()}).optional()}),_n=d({experimental:E(a(),De).optional(),sampling:d({context:De.optional(),tools:De.optional()}).optional(),elicitation:lS.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:sa.optional(),extensions:E(a(),De).optional()}),yn=Ke.extend({protocolVersion:a(),capabilities:_n,clientInfo:Et}),bn=Ze.extend({method:p("initialize"),params:yn}),or=d({experimental:E(a(),De).optional(),logging:De.optional(),completions:De.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:ia.optional(),extensions:E(a(),De).optional()}),vn=He.extend({protocolVersion:a(),capabilities:or,serverInfo:Et,instructions:a().optional()}),wn=tt.extend({method:p("notifications/initialized"),params:st.optional()}),zn=Ze.extend({method:p("server/discover"),params:Ke.optional()}),eo=He.extend({supportedVersions:g(a()),capabilities:or,instructions:a().optional()}),rr=Ze.extend({method:p("ping"),params:Ke.optional()}),Rn=d({progress:w(),total:V(w()),message:V(a())}),xn=d({...st.shape,...Rn.shape,progressToken:Wo}),nr=tt.extend({method:p("notifications/progress"),params:xn}),Pn=Ke.extend({cursor:Ko.optional()}),At=Ze.extend({params:Pn.optional()}),Nt=He.extend({nextCursor:Ko.optional()}),sr=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),ir=sr.extend({text:a()}),Xc=a().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ar=sr.extend({blob:Xc}),qt=ae(["user","assistant"]),kt=d({audience:g(qt).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),cr=d({...xt.shape,...Mt.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:kt.optional(),_meta:V(K({}))}),En=d({...xt.shape,...Mt.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:kt.optional(),_meta:V(K({}))}),kn=At.extend({method:p("resources/list")}),Tn=Nt.extend({resources:g(cr)}),$n=At.extend({method:p("resources/templates/list")}),Cn=Nt.extend({resourceTemplates:g(En)}),Ro=Ke.extend({uri:a()}),In=Ro,On=Ze.extend({method:p("resources/read"),params:In}),Mn=He.extend({contents:g(C([ir,ar]))}),An=tt.extend({method:p("notifications/resources/list_changed"),params:st.optional()}),Nn=Ro,qn=Ze.extend({method:p("resources/subscribe"),params:Nn}),jn=Ro,Ln=Ze.extend({method:p("resources/unsubscribe"),params:jn}),lr=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:g(a()).optional()}),Un=Ke.extend({notifications:lr}),Dn=Ze.extend({method:p("subscriptions/listen"),params:Un}),Zn=st.extend({notifications:lr}),Hn=tt.extend({method:p("notifications/subscriptions/acknowledged"),params:Zn}),Fn=Qo.extend({[Bo]:vt}),Vn=He.extend({_meta:Fn}),Jn=st.extend({uri:a()}),Bn=tt.extend({method:p("notifications/resources/updated"),params:Jn}),Gn=d({name:a(),description:V(a()),required:V(T())}),Wn=d({...xt.shape,...Mt.shape,description:V(a()),arguments:V(g(Gn)),_meta:V(K({}))}),Kn=At.extend({method:p("prompts/list")}),Yn=Nt.extend({prompts:g(Wn)}),Qn=Ke.extend({name:a(),arguments:E(a(),a()).optional()}),Xn=Ze.extend({method:p("prompts/get"),params:Qn}),xo=d({type:p("text"),text:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),Po=d({type:p("image"),data:Xc,mimeType:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),Eo=d({type:p("audio"),data:Xc,mimeType:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),es=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),ko=d({type:p("resource"),resource:C([ir,ar]),annotations:kt.optional(),_meta:E(a(),L()).optional()}),To=cr.extend({type:p("resource_link")}),Tt=C([xo,Po,Eo,To,ko]),ts=d({role:qt,content:Tt}),os=He.extend({description:a().optional(),messages:g(ts)}),rs=tt.extend({method:p("notifications/prompts/list_changed"),params:st.optional()}),ns=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),ss=d({taskSupport:ae(["required","optional","forbidden"]).optional()}),to=d({...xt.shape,...Mt.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:E(a(),Ot).optional(),required:g(a()).optional()}).catchall(L()),outputSchema:K({$schema:a().optional()}).optional(),annotations:ns.optional(),execution:ss.optional(),_meta:E(a(),L()).optional()}),is=At.extend({method:p("tools/list")}),as=Nt.extend({tools:g(to)}),oo=He.extend({content:g(Tt).default([]),structuredContent:L().optional(),isError:T().optional()}),aa=oo.or(He.extend({toolResult:L()})),cs=Qt.extend({name:a(),arguments:E(a(),L()).optional()}),ls=Ze.extend({method:p("tools/call"),params:cs}),us=tt.extend({method:p("notifications/tools/list_changed"),params:st.optional()}),ds=d({autoRefresh:T().default(!0),debounceMs:w().int().nonnegative().default(300)}),ur=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),ps=Ke.extend({level:ur}),hs=Ze.extend({method:p("logging/setLevel"),params:ps}),ms=st.extend({level:ur,logger:a().optional(),data:L()}),fs=tt.extend({method:p("notifications/message"),params:ms}),gs=d({name:a().optional()}),Ss=d({hints:g(gs).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),_s=d({mode:ae(["auto","required","none"]).optional()}),ys=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(Tt),structuredContent:L().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),bs=Vo("type",[xo,Po,Eo]),Yt=Vo("type",[xo,Po,Eo,es,ys]),vs=d({role:qt,content:C([Yt,g(Yt)]),_meta:E(a(),L()).optional()}),ws=Qt.extend({messages:g(vs),modelPreferences:Ss.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:De.optional(),tools:g(to).optional(),toolChoice:_s.optional()}),zs=Ze.extend({method:p("sampling/createMessage"),params:ws}),Rs=He.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens"]).or(a())),role:qt,content:bs}),xs=He.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:qt,content:C([Yt,g(Yt)])}),dr=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),$o=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),Co=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),pr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),hr=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),mr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),Ps=C([pr,hr]),fr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),gr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),Es=C([fr,gr]),ks=C([mr,Ps,Es]),Sr=C([ks,dr,$o,Co]),Io=Qt.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),Sr),required:g(a()).optional()}).catchall(L())}),Ts=Qt.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),$s=C([Io,Ts]),Cs=Ze.extend({method:p("elicitation/create"),params:$s}),Is=st.extend({elicitationId:a()}),Os=tt.extend({method:p("notifications/elicitation/complete"),params:Is}),Ms=He.extend({action:ae(["accept","decline","cancel"]),content:So((e)=>e===null?void 0:e,E(a(),C([a(),w(),T(),g(a())])).optional())}),As=d({type:p("ref/resource"),uri:a()}),Ns=d({type:p("ref/prompt"),name:a()}),qs=Ke.extend({ref:C([Ns,As]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()}),js=Ze.extend({method:p("completion/complete"),params:qs}),Ls=He.extend({completion:K({values:g(a()).max(100),total:V(w().int()),hasMore:V(T())})}),Us=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),Ds=Ze.extend({method:p("roots/list"),params:Ke.optional()}),Zs=He.extend({roots:g(Us)}),Hs=tt.extend({method:p("notifications/roots/list_changed"),params:st.optional()}),ca=K({ttl:w().optional(),pollInterval:w().optional()}),Fs=ae(["working","input_required","completed","failed","cancelled"]),jt=d({taskId:a(),status:Fs,ttl:C([w(),go()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:V(w()),statusMessage:V(a())}),la=He.extend({task:jt}),Vs=st.merge(jt),ua=tt.extend({method:p("notifications/tasks/status"),params:Vs}),da=Ze.extend({method:p("tasks/get"),params:Ke.extend({taskId:a()})}),pa=He.merge(jt),ha=Ze.extend({method:p("tasks/result"),params:Ke.extend({taskId:a()})}),ma=He.loose(),fa=At.extend({method:p("tasks/list")}),ga=Nt.extend({tasks:g(jt)}),Sa=Ze.extend({method:p("tasks/cancel"),params:Ke.extend({taskId:a()})}),_a=He.merge(jt),ya=C([rr,bn,zn,js,hs,Xn,Kn,kn,$n,On,qn,Ln,Dn,ls,is]),ba=C([tr,nr,wn,Hs]),va=C([Xt,Rs,xs,Ms,Zs]),wa=C([rr,zs,Cs,Ds]),za=C([tr,nr,fs,Bn,An,us,rs,Hn,Os]),Ra=C([Xt,vn,eo,Ls,os,Yn,Tn,Cn,Mn,oo,as,Vn]);var Ye=Qi().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qh.custom,message:"URL must be parseable",fatal:!0}),Da}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Js=K({resource:a().url(),authorization_servers:g(Ye).optional(),jwks_uri:a().url().optional(),scopes_supported:g(a()).optional(),bearer_methods_supported:g(a()).optional(),resource_signing_alg_values_supported:g(a()).optional(),resource_name:a().optional(),resource_documentation:a().optional(),resource_policy_uri:a().url().optional(),resource_tos_uri:a().url().optional(),tls_client_certificate_bound_access_tokens:T().optional(),authorization_details_types_supported:g(a()).optional(),dpop_signing_alg_values_supported:g(a()).optional(),dpop_bound_access_tokens_required:T().optional()}),_r=K({issuer:a(),authorization_endpoint:Ye,token_endpoint:Ye,registration_endpoint:Ye.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),service_documentation:Ye.optional(),revocation_endpoint:Ye.optional(),revocation_endpoint_auth_methods_supported:g(a()).optional(),revocation_endpoint_auth_signing_alg_values_supported:g(a()).optional(),introspection_endpoint:a().optional(),introspection_endpoint_auth_methods_supported:g(a()).optional(),introspection_endpoint_auth_signing_alg_values_supported:g(a()).optional(),code_challenge_methods_supported:g(a()).optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0),dpop_signing_alg_values_supported:g(a()).optional()}),Bs=K({issuer:a(),authorization_endpoint:Ye,token_endpoint:Ye,userinfo_endpoint:Ye.optional(),jwks_uri:Ye,registration_endpoint:Ye.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),acr_values_supported:g(a()).optional(),subject_types_supported:g(a()),id_token_signing_alg_values_supported:g(a()),id_token_encryption_alg_values_supported:g(a()).optional(),id_token_encryption_enc_values_supported:g(a()).optional(),userinfo_signing_alg_values_supported:g(a()).optional(),userinfo_encryption_alg_values_supported:g(a()).optional(),userinfo_encryption_enc_values_supported:g(a()).optional(),request_object_signing_alg_values_supported:g(a()).optional(),request_object_encryption_alg_values_supported:g(a()).optional(),request_object_encryption_enc_values_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),display_values_supported:g(a()).optional(),claim_types_supported:g(a()).optional(),claims_supported:g(a()).optional(),service_documentation:a().optional(),claims_locales_supported:g(a()).optional(),ui_locales_supported:g(a()).optional(),claims_parameter_supported:T().optional(),request_parameter_supported:T().optional(),request_uri_parameter_supported:T().optional(),require_request_uri_registration:T().optional(),op_policy_uri:Ye.optional(),op_tos_uri:Ye.optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0)}),Gs=d({...Bs.shape,..._r.pick({code_challenge_methods_supported:!0}).shape}),yr=d({access_token:a(),id_token:a().optional(),token_type:a(),expires_in:aS().optional(),scope:a().optional(),refresh_token:a().optional(),issuer:a().optional().catch(void 0)}).strip(),Ws=d({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:a(),token_type:a().optional(),expires_in:w().optional(),scope:a().optional()}).strip(),br=d({error:a(),error_description:a().optional(),error_uri:a().optional()}),el=Ye.optional().or(p("").transform(()=>{return})),Ks=d({redirect_uris:g(Ye),token_endpoint_auth_method:a().optional(),grant_types:g(a()).optional(),response_types:g(a()).optional(),application_type:a().optional(),client_name:a().optional(),client_uri:Ye.optional(),logo_uri:el,scope:a().optional(),contacts:g(a()).optional(),tos_uri:el,policy_uri:a().optional(),jwks_uri:Ye.optional(),jwks:ea().optional(),software_id:a().optional(),software_version:a().optional(),software_statement:a().optional()}).strip(),Ys=d({client_id:a(),client_secret:a().optional(),client_id_issued_at:w().optional(),client_secret_expires_at:w().optional(),issuer:a().optional().catch(void 0)}).strip(),Qs=Ks.merge(Ys),xa=d({error:a(),error_description:a().optional()}).strip(),Pa=d({token:a(),token_type_hint:a().optional()}).strip();var sl=Symbol.for("mcp.sdk.errorBrands");function no(e,t){let o=new Set,r=t;while(typeof r==="function"){let n=r.mcpBrand;if(Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof n==="string")o.add(n);r=Object.getPrototypeOf(r)}if(o.size===0)return;Object.defineProperty(e,sl,{value:o,enumerable:!1,configurable:!0})}function pt(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,sl)){let o=t[sl];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var am=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return pt(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",no(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},F=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),q=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",no(this,new.target)}},ni=class extends q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o,r){super(e,t,o,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var cm="2026-07-28",ul=[cm];function Ut(e){return e>=cm}function dl(e){return e.filter((t)=>!Ut(t))}function si(e){return e.filter((t)=>Ut(t))}function lm(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((o)=>o.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var um=["task","inputRequests","requestState"];function uS(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||um.some((t)=>(t in e)))return e;return{...e,content:[]}}function dS(){let e=pn(()=>C([a(),w(),T(),go(),E(a(),e),g(e)])),t=E(a(),e),o=C([a(),w().int()]),r=a(),n=d({ttl:w().optional()}),i=d({taskId:a()}),s=K({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=d({_meta:s.optional()}),l=c.extend({task:n.optional()}),u=d({method:a(),params:c.loose().optional()}),h=d({_meta:s.optional()}),m=d({method:a(),params:h.loose().optional()}),f=K({_meta:s.optional()}),S=C([a(),w().int()]),y=f.strict(),b=h.extend({requestId:S.optional(),reason:a().optional()}),v=m.extend({method:p("notifications/cancelled"),params:b}),k=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),U=d({icons:g(k).optional()}),z=d({name:a(),title:a().optional()}),R=z.extend({...z.shape,...U.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),M=It(d({applyDefaults:T().optional()}),t),oe=So((nt)=>{if(nt&&typeof nt==="object"&&!Array.isArray(nt)&&Object.keys(nt).length===0)return{form:{}};return nt},It(d({form:M.optional(),url:t.optional()}),t.optional())),pe=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),we=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),de=d({experimental:E(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:oe.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:pe.optional(),extensions:E(a(),t).optional()}),Ae=c.extend({protocolVersion:a(),capabilities:de,clientInfo:R}),Ve=u.extend({method:p("initialize"),params:Ae}),Be=d({experimental:E(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:we.optional(),extensions:E(a(),t).optional()}),ot=f.extend({protocolVersion:a(),capabilities:Be,serverInfo:R,instructions:a().optional()}),Qe=m.extend({method:p("notifications/initialized"),params:h.optional()}),te=u.extend({method:p("ping"),params:c.optional()}),fe=d({progress:w(),total:V(w()),message:V(a())}),D=d({...h.shape,...fe.shape,progressToken:o}),ne=m.extend({method:p("notifications/progress"),params:D}),be=c.extend({cursor:r.optional()}),re=u.extend({params:be.optional()}),le=f.extend({nextCursor:r.optional()}),je=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),Ie=je.extend({text:a()}),Ne=a().refine((nt)=>{try{return atob(nt),!0}catch{return!1}},{message:"Invalid Base64 string"}),Z=je.extend({blob:Ne}),se=ae(["user","assistant"]),J=d({audience:g(se).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),ke=d({...z.shape,...U.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:J.optional(),_meta:V(K({}))}),ht=d({...z.shape,...U.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:J.optional(),_meta:V(K({}))}),I=re.extend({method:p("resources/list")}),A=le.extend({resources:g(ke)}),B=re.extend({method:p("resources/templates/list")}),X=le.extend({resourceTemplates:g(ht)}),ve=c.extend({uri:a()}),_e=ve,Pe=u.extend({method:p("resources/read"),params:_e}),Le=f.extend({contents:g(C([Ie,Z]))}),ye=m.extend({method:p("notifications/resources/list_changed"),params:h.optional()}),ze=ve,P=u.extend({method:p("resources/subscribe"),params:ze}),We=ve,j=u.extend({method:p("resources/unsubscribe"),params:We}),N=h.extend({uri:a()}),G=m.extend({method:p("notifications/resources/updated"),params:N}),O=d({name:a(),description:V(a()),required:V(T())}),x=d({...z.shape,...U.shape,description:V(a()),arguments:V(g(O)),_meta:V(K({}))}),Y=re.extend({method:p("prompts/list")}),W=le.extend({prompts:g(x)}),ge=c.extend({name:a(),arguments:E(a(),a()).optional()}),zt=u.extend({method:p("prompts/get"),params:ge}),mt=d({type:p("text"),text:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),Re=d({type:p("image"),data:Ne,mimeType:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),ue=d({type:p("audio"),data:Ne,mimeType:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),ce=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),he=d({type:p("resource"),resource:C([Ie,Z]),annotations:J.optional(),_meta:E(a(),L()).optional()}),ie=ke.extend({type:p("resource_link")}),ee=C([mt,Re,ue,ie,he]),Oe=d({role:se,content:ee}),Ee=f.extend({description:a().optional(),messages:g(Oe)}),Je=m.extend({method:p("notifications/prompts/list_changed"),params:h.optional()}),it=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),Ue=d({taskSupport:ae(["required","optional","forbidden"]).optional()}),Xe=d({...z.shape,...U.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:E(a(),e).optional(),required:g(a()).optional()}).catchall(L()),outputSchema:d({type:p("object"),properties:E(a(),e).optional(),required:g(a()).optional()}).catchall(L()).optional(),annotations:it.optional(),execution:Ue.optional(),_meta:E(a(),L()).optional()}),Zt=re.extend({method:p("tools/list")}),Ht=le.extend({tools:g(Xe)}),Mo=f.extend({content:g(ee),structuredContent:E(a(),L()).optional(),isError:T().optional()}),rt=l.extend({name:a(),arguments:E(a(),L()).optional()}),Pr=u.extend({method:p("tools/call"),params:rt}),mi=m.extend({method:p("notifications/tools/list_changed"),params:h.optional()}),Ao=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),Er=c.extend({level:Ao}),kr=u.extend({method:p("logging/setLevel"),params:Er}),Tr=h.extend({level:Ao,logger:a().optional(),data:L()}),$r=m.extend({method:p("notifications/message"),params:Tr}),Cr=d({name:a().optional()}),Ir=d({hints:g(Cr).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),Or=d({mode:ae(["auto","required","none"]).optional()}),fi=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(ee),structuredContent:d({}).loose().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),Mr=Vo("type",[mt,Re,ue]),Ft=Vo("type",[mt,Re,ue,ce,fi]),Ar=d({role:se,content:C([Ft,g(Ft)]),_meta:E(a(),L()).optional()}),Nr=l.extend({messages:g(Ar),modelPreferences:Ir.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Xe).optional(),toolChoice:Or.optional()}),qr=u.extend({method:p("sampling/createMessage"),params:Nr}),jr=f.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens"]).or(a())),role:se,content:Mr}),Lr=f.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:se,content:C([Ft,g(Ft)])}),Ur=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),Dr=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),Zr=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),Hr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),Fr=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),Vr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),Jr=C([Hr,Fr]),ao=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),co=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),gi=C([ao,co]),Si=C([Vr,Jr,gi]),ft=C([Si,Ur,Dr,Zr]),gt=l.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),ft),required:g(a()).optional()}).catchall(L())}),Br=l.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),_t=C([gt,Br]),_i=u.extend({method:p("elicitation/create"),params:_t}),yi=h.extend({elicitationId:a()}),bi=m.extend({method:p("notifications/elicitation/complete"),params:yi}),vi=f.extend({action:ae(["accept","decline","cancel"]),content:So((nt)=>nt===null?void 0:nt,E(a(),C([a(),w(),T(),g(a())])).optional())}),wi=d({type:p("ref/resource"),uri:a()}),zi=d({type:p("ref/prompt"),name:a()}),Ri=c.extend({ref:C([zi,wi]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()}),Gr=u.extend({method:p("completion/complete"),params:Ri}),xi=f.extend({completion:K({values:g(a()).max(100),total:V(w().int()),hasMore:V(T())})}),Pi=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),No=u.extend({method:p("roots/list"),params:c.optional()}),Wr=f.extend({roots:g(Pi)}),Ei=m.extend({method:p("notifications/roots/list_changed"),params:h.optional()}),ki=K({ttl:w().optional(),pollInterval:w().optional()}),Kr=ae(["working","input_required","completed","failed","cancelled"]),Vt=d({taskId:a(),status:Kr,ttl:C([w(),go()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:V(w()),statusMessage:V(a())}),dt=f.extend({task:Vt}),Ti=h.merge(Vt),lo=m.extend({method:p("notifications/tasks/status"),params:Ti}),qo=u.extend({method:p("tasks/get"),params:c.extend({taskId:a()})}),jo=f.merge(Vt),Lo=u.extend({method:p("tasks/result"),params:c.extend({taskId:a()})}),Ua=f.loose(),at=re.extend({method:p("tasks/list")}),Ge=le.extend({tasks:g(Vt)}),uo=u.extend({method:p("tasks/cancel"),params:c.extend({taskId:a()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:h,NotificationSchema:m,ResultSchema:f,RequestIdSchema:S,EmptyResultSchema:y,CancelledNotificationParamsSchema:b,CancelledNotificationSchema:v,IconSchema:k,IconsSchema:U,BaseMetadataSchema:z,ImplementationSchema:R,ClientTasksCapabilitySchema:pe,ServerTasksCapabilitySchema:we,ClientCapabilitiesSchema:de,InitializeRequestParamsSchema:Ae,InitializeRequestSchema:Ve,ServerCapabilitiesSchema:Be,InitializeResultSchema:ot,InitializedNotificationSchema:Qe,PingRequestSchema:te,ProgressSchema:fe,ProgressNotificationParamsSchema:D,ProgressNotificationSchema:ne,PaginatedRequestParamsSchema:be,PaginatedRequestSchema:re,PaginatedResultSchema:le,ResourceContentsSchema:je,TextResourceContentsSchema:Ie,BlobResourceContentsSchema:Z,RoleSchema:se,AnnotationsSchema:J,ResourceSchema:ke,ResourceTemplateSchema:ht,ListResourcesRequestSchema:I,ListResourcesResultSchema:A,ListResourceTemplatesRequestSchema:B,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:ve,ReadResourceRequestParamsSchema:_e,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Le,ResourceListChangedNotificationSchema:ye,SubscribeRequestParamsSchema:ze,SubscribeRequestSchema:P,UnsubscribeRequestParamsSchema:We,UnsubscribeRequestSchema:j,ResourceUpdatedNotificationParamsSchema:N,ResourceUpdatedNotificationSchema:G,PromptArgumentSchema:O,PromptSchema:x,ListPromptsRequestSchema:Y,ListPromptsResultSchema:W,GetPromptRequestParamsSchema:ge,GetPromptRequestSchema:zt,TextContentSchema:mt,ImageContentSchema:Re,AudioContentSchema:ue,ToolUseContentSchema:ce,EmbeddedResourceSchema:he,ResourceLinkSchema:ie,ContentBlockSchema:ee,PromptMessageSchema:Oe,GetPromptResultSchema:Ee,PromptListChangedNotificationSchema:Je,ToolAnnotationsSchema:it,ToolExecutionSchema:Ue,ToolSchema:Xe,ListToolsRequestSchema:Zt,ListToolsResultSchema:Ht,CallToolResultSchema:Mo,CallToolRequestParamsSchema:rt,CallToolRequestSchema:Pr,ToolListChangedNotificationSchema:mi,LoggingLevelSchema:Ao,SetLevelRequestParamsSchema:Er,SetLevelRequestSchema:kr,LoggingMessageNotificationParamsSchema:Tr,LoggingMessageNotificationSchema:$r,ModelHintSchema:Cr,ModelPreferencesSchema:Ir,ToolChoiceSchema:Or,ToolResultContentSchema:fi,SamplingContentSchema:Mr,SamplingMessageContentBlockSchema:Ft,SamplingMessageSchema:Ar,CreateMessageRequestParamsSchema:Nr,CreateMessageRequestSchema:qr,CreateMessageResultSchema:jr,CreateMessageResultWithToolsSchema:Lr,BooleanSchemaSchema:Ur,StringSchemaSchema:Dr,NumberSchemaSchema:Zr,UntitledSingleSelectEnumSchemaSchema:Hr,TitledSingleSelectEnumSchemaSchema:Fr,LegacyTitledEnumSchemaSchema:Vr,SingleSelectEnumSchemaSchema:Jr,UntitledMultiSelectEnumSchemaSchema:ao,TitledMultiSelectEnumSchemaSchema:co,MultiSelectEnumSchemaSchema:gi,EnumSchemaSchema:Si,PrimitiveSchemaDefinitionSchema:ft,ElicitRequestFormParamsSchema:gt,ElicitRequestURLParamsSchema:Br,ElicitRequestParamsSchema:_t,ElicitRequestSchema:_i,ElicitationCompleteNotificationParamsSchema:yi,ElicitationCompleteNotificationSchema:bi,ElicitResultSchema:vi,ResourceTemplateReferenceSchema:wi,PromptReferenceSchema:zi,CompleteRequestParamsSchema:Ri,CompleteRequestSchema:Gr,CompleteResultSchema:xi,RootSchema:Pi,ListRootsRequestSchema:No,ListRootsResultSchema:Wr,RootsListChangedNotificationSchema:Ei,TaskCreationParamsSchema:ki,TaskStatusSchema:Kr,TaskSchema:Vt,CreateTaskResultSchema:dt,TaskStatusNotificationParamsSchema:Ti,TaskStatusNotificationSchema:lo,GetTaskRequestSchema:qo,GetTaskResultSchema:jo,GetTaskPayloadRequestSchema:Lo,GetTaskPayloadResultSchema:Ua,ListTasksRequestSchema:at,ListTasksResultSchema:Ge,CancelTaskRequestSchema:uo,CancelTaskResultSchema:f.merge(Vt),ClientRequestSchema:C([te,Ve,Gr,kr,zt,Y,I,B,Pe,P,j,Pr,Zt,qo,Lo,at,uo]),ClientNotificationSchema:C([v,ne,Qe,Ei,lo]),ClientResultSchema:C([y,jr,Lr,vi,Wr,jo,Ge,dt]),ServerRequestSchema:C([te,qr,_i,No,qo,Lo,at,uo]),ServerNotificationSchema:C([v,ne,$r,G,ye,mi,Je,lo,bi]),ServerResultSchema:C([y,ot,xi,Ee,W,A,X,Le,Mo,Ht,jo,Ge,dt]),CallToolResultWireSchema:L().superRefine((nt,Cf)=>{if(typeof nt!=="object"||nt===null||Array.isArray(nt)||nt.content!==void 0)return;for(let Al of um)if(Al in nt){Cf.addIssue({code:"custom",message:`content is required when the body carries '${Al}' — another result family cannot default into an empty tools/call success`});return}}).transform(uS).pipe(Mo)}}var pS;function dm(){return pS??=dS()}function pm(e){return e.type!=="object"}var hS=new Set(["const","enum","default","examples"]),mS=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Wh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function fS(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Wh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=Ul(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((l)=>r(l,!1));if(n===null||typeof n!=="object")return n;if(!i&&Wh(n.$id))return n;let s={},c=!1;for(let[l,u]of Object.entries(n))if(i)s[l]=r(u,!1);else if((l==="$ref"||l==="$dynamicRef")&&typeof u==="string")s[l]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(l==="$recursiveRef"&&u==="#"&&o)c=!0;else if(hS.has(l))s[l]=u;else if(mS.has(l))s[l]=r(u,!0);else s[l]=r(u,!1);if(c)if("$ref"in s)s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}];else s.$ref="#/properties/result";return s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var hm={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},mm={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},gS={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ea;function pl(){if(Ea)return Ea;let e=dm();return Ea={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ea}function fm(e){return Object.prototype.hasOwnProperty.call(hm,e)}function gm(e){return Object.prototype.hasOwnProperty.call(mm,e)}function SS(e){return Object.prototype.hasOwnProperty.call(gS,e)}function _S(e){return SS(e)?pl().resultSchemas[e]:void 0}function yS(e){return fm(e)?pl().requestSchemas[e]:void 0}function bS(e){return gm(e)?pl().notificationSchemas[e]:void 0}var nz=Object.keys(hm),sz=Object.keys(mm);function il(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ka(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var Kh={ok:!1,reason:"not-in-era"};function Yh(e){return il(e)&&il(e.outputSchema)&&pm(e.outputSchema)}function Qh(e){return e}var hl={era:"2025-11-25",hasRequestMethod:fm,hasNotificationMethod:gm,validateRequest:(e,t)=>ka(yS(e),t),validateResult:(e,t)=>ka(_S(e),t),validateNotification:(e,t)=>ka(bS(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Kh,validateInputResponse:()=>Kh,samplingResultVariant:(e,t)=>{let o=dm();return ka(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=lm(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&pm(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(il(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:Qh(o)}}return{kind:"complete",result:Qh(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>Yh(r)))return t;return{...t,tools:o.map((r)=>Yh(r)?{...r,outputSchema:fS(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function vS(){let e=pn(()=>C([a(),w(),T(),go(),E(a(),e),g(e)])),t=E(a(),e),o=C([a(),w().int()]),r=a(),n=C([a(),w().int()]),i=ae(["user","assistant"]),s=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),c=a().refine((Ge)=>{try{return atob(Ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=d({ttl:w().optional()}),u=d({taskId:a()}),h=K({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),m=d({_meta:h.optional()}),f=m.extend({task:l.optional()}),S=d({_meta:h.optional()}),y=d({method:a(),params:S.loose().optional()}),b=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),v=d({icons:g(b).optional()}),k=d({name:a(),title:a().optional()}),U=k.extend({...k.shape,...v.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),z=It(d({applyDefaults:T().optional()}),t),R=So((Ge)=>{if(Ge&&typeof Ge==="object"&&!Array.isArray(Ge)&&Object.keys(Ge).length===0)return{form:{}};return Ge},It(d({form:z.optional(),url:t.optional()}),t.optional())),M=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),oe=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),pe=d({experimental:E(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:M.optional(),extensions:E(a(),t).optional()}),we=d({experimental:E(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:oe.optional(),extensions:E(a(),t).optional()}),de=d({progress:w(),total:V(w()),message:V(a())}),Ae=d({...S.shape,...de.shape,progressToken:o}),Ve=y.extend({method:p("notifications/progress"),params:Ae}),Be=S.extend({level:s,logger:a().optional(),data:L()}),ot=y.extend({method:p("notifications/message"),params:Be}),Qe=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),te=Qe.extend({text:a()}),fe=Qe.extend({blob:c}),D=d({audience:g(i).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),ne=d({...k.shape,...v.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:D.optional(),_meta:V(K({}))}),be=d({...k.shape,...v.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:D.optional(),_meta:V(K({}))}),re=y.extend({method:p("notifications/resources/list_changed"),params:S.optional()}),le=S.extend({uri:a()}),je=y.extend({method:p("notifications/resources/updated"),params:le}),Ie=d({name:a(),description:V(a()),required:V(T())}),Ne=d({...k.shape,...v.shape,description:V(a()),arguments:V(g(Ie)),_meta:V(K({}))}),Z=y.extend({method:p("notifications/prompts/list_changed"),params:S.optional()}),se=d({type:p("text"),text:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),J=d({type:p("image"),data:c,mimeType:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),ke=d({type:p("audio"),data:c,mimeType:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),ht=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),I=d({type:p("resource"),resource:C([te,fe]),annotations:D.optional(),_meta:E(a(),L()).optional()}),A=ne.extend({type:p("resource_link")}),B=C([se,J,ke,A,I]),X=d({role:i,content:B}),ve=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),_e=y.extend({method:p("notifications/tools/list_changed"),params:S.optional()}),Pe=d({name:a().optional()}),Le=d({hints:g(Pe).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),ye=d({mode:ae(["auto","required","none"]).optional()}),ze=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),P=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),We=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),j=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),N=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),G=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),O=C([j,N]),x=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),Y=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),W=C([x,Y]),ge=C([G,O,W]),zt=C([ge,ze,P,We]),mt=f.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),zt),required:g(a()).optional()}).catchall(L())}),Re=d({type:p("ref/resource"),uri:a()}),ue=d({type:p("ref/prompt"),name:a()}),ce=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),he=pe.shape,ie=d({experimental:he.experimental,sampling:he.sampling,elicitation:he.elicitation,roots:he.roots,extensions:he.extensions}),ee=we.shape,Oe=d({experimental:ee.experimental,logging:ee.logging,completions:ee.completions,prompts:ee.prompts,resources:ee.resources,tools:ee.tools,extensions:ee.extensions}),Ee=K({progressToken:o.optional(),[_o]:a(),[Jo]:U.optional(),[yo]:ie,[Go]:s.optional()}),Je=d({...k.shape,...v.shape,description:a().optional(),inputSchema:K({$schema:a().optional(),type:p("object")}),outputSchema:K({$schema:a().optional()}).optional(),annotations:ve.optional(),_meta:E(a(),L()).optional()}),it=d({type:p("tool_result"),toolUseId:a(),content:g(B),structuredContent:L().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),Ue=C([se,J,ke,ht,it]),Xe=d({role:i,content:C([Ue,g(Ue)]),_meta:E(a(),L()).optional()}),Zt=a(),Ht=K({[Pt]:U.optional().catch(void 0)}),Mo=Ht.optional();function rt(Ge){return K({_meta:Mo,resultType:Zt.default("complete"),...Ge})}let Pr=rt({}),mi=rt({nextCursor:r.optional()}),Ao=rt({content:g(B),structuredContent:L().optional(),isError:T().optional()}),Er=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),tools:g(Je),nextCursor:r.optional()}),kr=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),prompts:g(Ne),nextCursor:r.optional()}),Tr=rt({description:a().optional(),messages:g(X)}),$r=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resources:g(ne),nextCursor:r.optional()}),Cr=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resourceTemplates:g(be),nextCursor:r.optional()}),Ir=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),contents:g(C([te,fe]))}),Or=rt({completion:d({values:g(a()).max(100),total:w().int().optional(),hasMore:T().optional()}).loose()}),fi=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"])}),Mr=rt({ttlMs:w().int().min(0).catch(0),cacheScope:ae(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Oe,instructions:a().optional()}),Ft=d({messages:g(Xe),modelPreferences:Le.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Je).optional(),toolChoice:ye.optional()}),Ar=d({method:p("sampling/createMessage"),params:Ft}),Nr=d({method:p("roots/list"),params:d({_meta:E(a(),L()).optional()}).optional()}),qr=d({...Xe.shape,model:a(),stopReason:a().optional()}),jr=d({roots:g(ce)}),Lr=d({action:ae(["accept","decline","cancel"]),content:E(a(),C([a(),w(),T(),g(a())])).optional()}),Ur=d({mode:p("url"),message:a(),url:a().url()}),Dr=C([mt,Ur]),Zr=d({method:p("elicitation/create"),params:Dr}),Hr=C([Ar,Nr,Zr]),Fr=C([qr,jr,Lr]),Vr=E(a(),Hr),Jr=E(a(),Fr),ao=rt({inputRequests:Vr.optional(),requestState:a().optional()}),co={inputResponses:Jr.optional(),requestState:a().optional()},gi=d({_meta:Ee,...co}),Si=K({progressToken:o.optional()});function ft(Ge,uo){return d({method:p(Ge),params:d({_meta:Ee,...uo})})}function gt(Ge,uo){return d({method:p(Ge),params:d({_meta:Si.optional(),...uo}).optional()})}let Br={name:a(),arguments:E(a(),L()).optional(),...co},_t={cursor:r.optional()},_i=ft("tools/call",Br),yi=ft("tools/list",_t),bi=ft("prompts/list",_t),vi=ft("prompts/get",{name:a(),arguments:E(a(),a()).optional(),...co}),wi=ft("resources/list",_t),zi=ft("resources/templates/list",_t),Ri=ft("resources/read",{uri:a(),...co}),Gr={ref:C([ue,Re]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()},xi=ft("completion/complete",Gr),Pi=ft("server/discover",{}),No=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:g(a()).optional()}),Wr={notifications:No},Ei=ft("subscriptions/listen",Wr),ki=Ht.extend({"io.modelcontextprotocol/subscriptionId":n}),Kr=K({_meta:ki,resultType:Zt.default("complete")}),Vt={"tools/call":gt("tools/call",Br),"tools/list":gt("tools/list",_t),"prompts/get":gt("prompts/get",{name:a(),arguments:E(a(),a()).optional()}),"prompts/list":gt("prompts/list",_t),"resources/list":gt("resources/list",_t),"resources/templates/list":gt("resources/templates/list",_t),"resources/read":gt("resources/read",{uri:a()}),"completion/complete":gt("completion/complete",Gr),"server/discover":gt("server/discover",{}),"subscriptions/listen":gt("subscriptions/listen",Wr)};function dt(Ge){return K({_meta:Mo,...Ge})}let Ti={"tools/call":dt({content:g(B),structuredContent:L().optional(),isError:T().optional()}),"tools/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),tools:g(Je),nextCursor:r.optional()}),"prompts/get":dt({description:a().optional(),messages:g(X)}),"prompts/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),prompts:g(Ne),nextCursor:r.optional()}),"resources/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resources:g(ne),nextCursor:r.optional()}),"resources/templates/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resourceTemplates:g(be),nextCursor:r.optional()}),"resources/read":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),contents:g(C([te,fe]))}),"completion/complete":dt({completion:d({values:g(a()).max(100),total:w().int().optional(),hasMore:T().optional()}).loose()}),"server/discover":dt({ttlMs:w().int().min(0).catch(0),cacheScope:ae(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Oe,instructions:a().optional()}),"subscriptions/listen":dt({})},lo=K({"io.modelcontextprotocol/subscriptionId":n.optional()}),qo=d({method:p("notifications/subscriptions/acknowledged"),params:d({_meta:lo.optional(),notifications:No})}),jo=d({_meta:lo.optional(),requestId:n,reason:a().optional()}),Lo=d({method:p("notifications/cancelled"),params:jo}),Ua={"notifications/cancelled":Lo,"notifications/progress":Ve,"notifications/message":ot,"notifications/resources/updated":je,"notifications/resources/list_changed":re,"notifications/tools/list_changed":_e,"notifications/prompts/list_changed":Z,"notifications/subscriptions/acknowledged":qo},at=(Ge)=>d({jsonrpc:p("2.0"),id:C([a(),w().int()]),result:Ge}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:h,BaseRequestParamsSchema:m,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:S,NotificationSchema:y,IconSchema:b,IconsSchema:v,BaseMetadataSchema:k,ImplementationSchema:U,ClientTasksCapabilitySchema:M,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:pe,ServerCapabilitiesSchema:we,ProgressSchema:de,ProgressNotificationParamsSchema:Ae,ProgressNotificationSchema:Ve,LoggingMessageNotificationParamsSchema:Be,LoggingMessageNotificationSchema:ot,ResourceContentsSchema:Qe,TextResourceContentsSchema:te,BlobResourceContentsSchema:fe,AnnotationsSchema:D,ResourceSchema:ne,ResourceTemplateSchema:be,ResourceListChangedNotificationSchema:re,ResourceUpdatedNotificationParamsSchema:le,ResourceUpdatedNotificationSchema:je,PromptArgumentSchema:Ie,PromptSchema:Ne,PromptListChangedNotificationSchema:Z,TextContentSchema:se,ImageContentSchema:J,AudioContentSchema:ke,ToolUseContentSchema:ht,EmbeddedResourceSchema:I,ResourceLinkSchema:A,ContentBlockSchema:B,PromptMessageSchema:X,ToolAnnotationsSchema:ve,ToolListChangedNotificationSchema:_e,ModelHintSchema:Pe,ModelPreferencesSchema:Le,ToolChoiceSchema:ye,BooleanSchemaSchema:ze,StringSchemaSchema:P,NumberSchemaSchema:We,UntitledSingleSelectEnumSchemaSchema:j,TitledSingleSelectEnumSchemaSchema:N,LegacyTitledEnumSchemaSchema:G,SingleSelectEnumSchemaSchema:O,UntitledMultiSelectEnumSchemaSchema:x,TitledMultiSelectEnumSchemaSchema:Y,MultiSelectEnumSchemaSchema:W,EnumSchemaSchema:ge,PrimitiveSchemaDefinitionSchema:zt,ElicitRequestFormParamsSchema:mt,ResourceTemplateReferenceSchema:Re,PromptReferenceSchema:ue,RootSchema:ce,ClientCapabilities2026Schema:ie,ServerCapabilities2026Schema:Oe,RequestMetaEnvelopeSchema:Ee,ToolSchema:Je,ToolResultContentSchema:it,SamplingMessageContentBlockSchema:Ue,SamplingMessageSchema:Xe,ResultTypeSchema:Zt,ResultMetaSchema:Ht,ResultSchema:Pr,PaginatedResultSchema:mi,CallToolResultSchema:Ao,ListToolsResultSchema:Er,ListPromptsResultSchema:kr,GetPromptResultSchema:Tr,ListResourcesResultSchema:$r,ListResourceTemplatesResultSchema:Cr,ReadResourceResultSchema:Ir,CompleteResultSchema:Or,CacheableResultSchema:fi,DiscoverResultSchema:Mr,CreateMessageRequestParamsSchema:Ft,CreateMessageRequestSchema:Ar,ListRootsRequestSchema:Nr,CreateMessageResultSchema:qr,ListRootsResultSchema:jr,ElicitResultSchema:Lr,ElicitRequestURLParamsSchema:Ur,ElicitRequestParamsSchema:Dr,ElicitRequestSchema:Zr,InputRequestSchema:Hr,InputResponseSchema:Fr,InputRequestsSchema:Vr,InputResponsesSchema:Jr,InputRequiredResultSchema:ao,InputResponseRequestParamsSchema:gi,CallToolRequestSchema:_i,ListToolsRequestSchema:yi,ListPromptsRequestSchema:bi,GetPromptRequestSchema:vi,ListResourcesRequestSchema:wi,ListResourceTemplatesRequestSchema:zi,ReadResourceRequestSchema:Ri,CompleteRequestSchema:xi,DiscoverRequestSchema:Pi,SubscriptionFilterSchema:No,SubscriptionsListenRequestSchema:Ei,SubscriptionsListenResultMetaSchema:ki,SubscriptionsListenResultSchema:Kr,dispatchRequestSchemas:Vt,dispatchResultSchemas:Ti,NotificationMetaSchema:lo,SubscriptionsAcknowledgedNotificationSchema:qo,CancelledNotificationParamsSchema:jo,CancelledNotificationSchema:Lo,notificationSchemas2026:Ua,JSONRPCResultResponseSchema:at(Pr),CallToolResultResponseSchema:at(C([Ao,ao])),ListToolsResultResponseSchema:at(Er),ListPromptsResultResponseSchema:at(kr),GetPromptResultResponseSchema:at(C([Tr,ao])),ListResourcesResultResponseSchema:at($r),ListResourceTemplatesResultResponseSchema:at(Cr),ReadResourceResultResponseSchema:at(C([Ir,ao])),CompleteResultResponseSchema:at(Or),DiscoverResultResponseSchema:at(Mr),SubscriptionsListenResultResponseSchema:at(Kr)}}var wS;function ro(){return wS??=vS()}var zS=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function RS(e){return zS.includes(e)}var ml=Symbol("modelcontextprotocol.resultCacheHintFallback");function xS(e){return e[ml]}function Sm(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function _m(e){return e==="public"||e==="private"}var Q=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),xe=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return pt(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",no(this,new.target)}static fromError(t,o,r){if(t===Q.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new bm(n.elicitations,o)}if(t===Q.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new ii({supported:n.supported,requested:n.requested},o)}if(t===Q.InvalidParams||t===Q.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===Q.ResourceNotFound||Object.keys(n).length===1))return new ym(n.uri,o)}if(t===Q.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new vm({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},ym=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},bm=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ii=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},vm=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},PS=0,ES="private",kS=["tools/call","prompts/get","resources/read"];function TS(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(kS.includes(e))return t;throw new xe(Q.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function $S(e,t){let o=xS(t);if(t.resultType!=="complete"||!RS(e))return o===void 0?t:AS(t);let r=t,n=Sm(r.ttlMs)?r.ttlMs:OS(o),i=_m(r.cacheScope)?r.cacheScope:MS(o),s={...r,ttlMs:n,cacheScope:i};return delete s[ml],s}function CS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function IS(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[Pt]:t}};if(!CS(o))return e;if(o[Pt]!==void 0)return e;return{...e,_meta:{...o,[Pt]:t}}}function OS(e){return e!==void 0&&Sm(e.ttlMs)?e.ttlMs:PS}function MS(e){return e!==void 0&&_m(e.cacheScope)?e.cacheScope:ES}function AS(e){let t={...e};return delete t[ml],t}var NS=["elicitation/create","sampling/createMessage","roots/list"],Ta;function wm(){if(Ta)return Ta;let e=ro();return Ta={request:{"elicitation/create":d({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":d({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":d({method:p("roots/list"),params:K({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ta}function zm(e){return NS.includes(e)}function tl(e){return zm(e)?wm().request[e]:void 0}function qS(e){return zm(e)?wm().response[e]:void 0}var fl={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Rm={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function xm(e){return Object.prototype.hasOwnProperty.call(fl,e)}function Pm(e){return Object.prototype.hasOwnProperty.call(Rm,e)}function jS(e){return Object.prototype.hasOwnProperty.call(fl,e)}function LS(e){return xm(e)?ro().dispatchRequestSchemas[e]:void 0}function US(e){return jS(e)?ro().dispatchResultSchemas[e]:void 0}function DS(e){return Pm(e)?ro().notificationSchemas2026[e]:void 0}var iz=Object.keys(fl),az=Object.keys(Rm);function ti(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Xs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var ZS={ok:!1,reason:"not-in-era"},HS=[_o,yo];function FS(e,t){let o=t,r=!1,n=()=>{if(!r)o={...o},r=!0;return o},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((c)=>ti(c)&&("execution"in c)))n().tools=i.map((c)=>{if(!ti(c)||!("execution"in c))return c;let l={...c};return delete l.execution,l});let s=t.capabilities;if(ti(s)&&"tasks"in s){let c={...s};delete c.tasks,n().capabilities=c}return o}var gl={era:"2026-07-28",hasRequestMethod:xm,hasNotificationMethod:Pm,hasInputRequestMethod:(e)=>tl(e)!==void 0,validateRequest:(e,t)=>Xs(LS(e),t),validateResult:(e,t)=>Xs(US(e),t),validateNotification:(e,t)=>Xs(DS(e),t),validateInputRequest:(e,t)=>Xs(tl(e),t),validateInputResponse:(e,t)=>Xs(qS(e),t),samplingResultVariant:()=>ZS,outboundEnvelope(e){return{[_o]:e.protocolVersion,[Jo]:e.clientInfo,[yo]:e.clientCapabilities,...e.logLevel!==void 0&&{[Go]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of HS)if(!(r in e))t.push({key:r,problem:"missing"});let o=ro().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let r of o.error.issues){let n=r.path.map(String),i=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((s)=>s.key===i&&s.problem==="missing"))continue;t.push({key:i,problem:r.message})}return t},projectCallToolResult:(e)=>lm(e),inputRequestSchema:tl,decodeResult(e,t){if(!ti(t))return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof o!=="string")return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let s=t.inputRequests,c=ti(s)?s:{},l=t.requestState,u=t._meta===void 0?void 0:ro().ResultMetaSchema.safeParse(t._meta),h=u?.success?u.data:void 0;if(Object.keys(c).length===0&&typeof l!=="string")return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:c,...typeof l==="string"&&{requestState:l},...h!==void 0&&{_meta:h}}}if(o!=="complete")return{kind:"invalid",error:new q(F.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=VS(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let s=n.safeParse(t);if(!s.success)return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,o){return IS($S(e,TS(e,FS(e,t))),o)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=ro().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((o)=>o.message).join("; ")}`}},$a;function VS(){if($a)return $a;let e=ro();return $a={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},$a}var Oa="2026-07-28";function Lt(e){return e!==void 0&&Ut(e)?gl:hl}function Xh(e){if(e.revision!==void 0)return Lt(e.revision).era;return e.era==="modern"?gl.era:hl.era}function ol(e){return Em.some((t)=>t.hasRequestMethod(e))}function rl(e){return Em.some((t)=>t.hasNotificationMethod(e))}function em(e){return e==="tasks/get"||e==="tasks/cancel"}var Em=[hl,gl],JS=ql({AnnotationsSchema:()=>kt,AudioContentSchema:()=>Eo,BaseMetadataSchema:()=>xt,BaseRequestParamsSchema:()=>Ke,BlobResourceContentsSchema:()=>ar,BooleanSchemaSchema:()=>dr,CallToolRequestParamsSchema:()=>cs,CallToolRequestSchema:()=>ls,CallToolResultSchema:()=>oo,CancelTaskRequestSchema:()=>Sa,CancelTaskResultSchema:()=>_a,CancelledNotificationParamsSchema:()=>gn,CancelledNotificationSchema:()=>tr,ClientCapabilitiesSchema:()=>_n,ClientNotificationSchema:()=>ba,ClientRequestSchema:()=>ya,ClientResultSchema:()=>va,ClientTasksCapabilitySchema:()=>sa,CompatibilityCallToolResultSchema:()=>aa,CompleteRequestParamsSchema:()=>qs,CompleteRequestSchema:()=>js,CompleteResultSchema:()=>Ls,ContentBlockSchema:()=>Tt,CreateMessageRequestParamsSchema:()=>ws,CreateMessageRequestSchema:()=>zs,CreateMessageResultSchema:()=>Rs,CreateMessageResultWithToolsSchema:()=>xs,CreateTaskResultSchema:()=>la,CursorSchema:()=>Ko,DiscoverRequestSchema:()=>zn,DiscoverResultSchema:()=>eo,ElicitRequestFormParamsSchema:()=>Io,ElicitRequestParamsSchema:()=>$s,ElicitRequestSchema:()=>Cs,ElicitRequestURLParamsSchema:()=>Ts,ElicitResultSchema:()=>Ms,ElicitationCompleteNotificationParamsSchema:()=>Is,ElicitationCompleteNotificationSchema:()=>Os,EmbeddedResourceSchema:()=>ko,EmptyResultSchema:()=>Xt,EnumSchemaSchema:()=>ks,GetPromptRequestParamsSchema:()=>Qn,GetPromptRequestSchema:()=>Xn,GetPromptResultSchema:()=>os,GetTaskPayloadRequestSchema:()=>ha,GetTaskPayloadResultSchema:()=>ma,GetTaskRequestSchema:()=>da,GetTaskResultSchema:()=>pa,IconSchema:()=>Sn,IconsSchema:()=>Mt,ImageContentSchema:()=>Po,ImplementationSchema:()=>Et,InitializeRequestParamsSchema:()=>yn,InitializeRequestSchema:()=>bn,InitializeResultSchema:()=>vn,InitializedNotificationSchema:()=>wn,JSONArraySchema:()=>ra,JSONObjectSchema:()=>De,JSONRPCErrorResponseSchema:()=>wo,JSONRPCMessageSchema:()=>zo,JSONRPCNotificationSchema:()=>er,JSONRPCRequestSchema:()=>Xo,JSONRPCResponseSchema:()=>na,JSONRPCResultResponseSchema:()=>vo,JSONValueSchema:()=>Ot,LegacyTitledEnumSchemaSchema:()=>mr,ListChangedOptionsBaseSchema:()=>ds,ListPromptsRequestSchema:()=>Kn,ListPromptsResultSchema:()=>Yn,ListResourceTemplatesRequestSchema:()=>$n,ListResourceTemplatesResultSchema:()=>Cn,ListResourcesRequestSchema:()=>kn,ListResourcesResultSchema:()=>Tn,ListRootsRequestSchema:()=>Ds,ListRootsResultSchema:()=>Zs,ListTasksRequestSchema:()=>fa,ListTasksResultSchema:()=>ga,ListToolsRequestSchema:()=>is,ListToolsResultSchema:()=>as,LoggingLevelSchema:()=>ur,LoggingMessageNotificationParamsSchema:()=>ms,LoggingMessageNotificationSchema:()=>fs,ModelHintSchema:()=>gs,ModelPreferencesSchema:()=>Ss,MultiSelectEnumSchemaSchema:()=>Es,NotificationSchema:()=>tt,NotificationsParamsSchema:()=>st,NumberSchemaSchema:()=>Co,PaginatedRequestParamsSchema:()=>Pn,PaginatedRequestSchema:()=>At,PaginatedResultSchema:()=>Nt,PingRequestSchema:()=>rr,PrimitiveSchemaDefinitionSchema:()=>Sr,ProgressNotificationParamsSchema:()=>xn,ProgressNotificationSchema:()=>nr,ProgressSchema:()=>Rn,ProgressTokenSchema:()=>Wo,PromptArgumentSchema:()=>Gn,PromptListChangedNotificationSchema:()=>rs,PromptMessageSchema:()=>ts,PromptReferenceSchema:()=>Ns,PromptSchema:()=>Wn,ReadResourceRequestParamsSchema:()=>In,ReadResourceRequestSchema:()=>On,ReadResourceResultSchema:()=>Mn,RelatedTaskMetadataSchema:()=>fn,RequestIdSchema:()=>vt,RequestMetaSchema:()=>Yo,RequestSchema:()=>Ze,ResourceContentsSchema:()=>sr,ResourceLinkSchema:()=>To,ResourceListChangedNotificationSchema:()=>An,ResourceRequestParamsSchema:()=>Ro,ResourceSchema:()=>cr,ResourceTemplateReferenceSchema:()=>As,ResourceTemplateSchema:()=>En,ResourceUpdatedNotificationParamsSchema:()=>Jn,ResourceUpdatedNotificationSchema:()=>Bn,ResultMetaObjectSchema:()=>Qo,ResultSchema:()=>He,RoleSchema:()=>qt,RootSchema:()=>Us,RootsListChangedNotificationSchema:()=>Hs,SamplingContentSchema:()=>bs,SamplingMessageContentBlockSchema:()=>Yt,SamplingMessageSchema:()=>vs,ServerCapabilitiesSchema:()=>or,ServerNotificationSchema:()=>za,ServerRequestSchema:()=>wa,ServerResultSchema:()=>Ra,ServerTasksCapabilitySchema:()=>ia,SetLevelRequestParamsSchema:()=>ps,SetLevelRequestSchema:()=>hs,SingleSelectEnumSchemaSchema:()=>Ps,StringSchemaSchema:()=>$o,SubscribeRequestParamsSchema:()=>Nn,SubscribeRequestSchema:()=>qn,SubscriptionFilterSchema:()=>lr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Zn,SubscriptionsAcknowledgedNotificationSchema:()=>Hn,SubscriptionsListenRequestParamsSchema:()=>Un,SubscriptionsListenRequestSchema:()=>Dn,SubscriptionsListenResultMetaSchema:()=>Fn,SubscriptionsListenResultSchema:()=>Vn,TaskAugmentedRequestParamsSchema:()=>Qt,TaskCreationParamsSchema:()=>ca,TaskMetadataSchema:()=>mn,TaskSchema:()=>jt,TaskStatusNotificationParamsSchema:()=>Vs,TaskStatusNotificationSchema:()=>ua,TaskStatusSchema:()=>Fs,TextContentSchema:()=>xo,TextResourceContentsSchema:()=>ir,TitledMultiSelectEnumSchemaSchema:()=>gr,TitledSingleSelectEnumSchemaSchema:()=>hr,ToolAnnotationsSchema:()=>ns,ToolChoiceSchema:()=>_s,ToolExecutionSchema:()=>ss,ToolListChangedNotificationSchema:()=>us,ToolResultContentSchema:()=>ys,ToolSchema:()=>to,ToolUseContentSchema:()=>es,UnsubscribeRequestParamsSchema:()=>jn,UnsubscribeRequestSchema:()=>Ln,UntitledMultiSelectEnumSchemaSchema:()=>fr,UntitledSingleSelectEnumSchemaSchema:()=>pr});var Ma=(e)=>Xo.safeParse(e).success,km=(e)=>er.safeParse(e).success,wr=(e)=>vo.safeParse(e).success,ai=(e)=>wo.safeParse(e).success;var Tm=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var BS="Mcp-Param-",tm="x-mcp-header",GS=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,WS=new Set(["string","integer","boolean"]);function Sl(e){let t=[],o=new Map,r,n=(s,c,l)=>{if(s===null||typeof s!=="object")return;let u=s;if(tm in u){if(!l||c.length===0)return`${Ca(c)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let m=u[tm];if(typeof m!=="string"||m.length===0)return`${Ca(c)}: x-mcp-header MUST be a non-empty string`;if(!GS.test(m))return`${Ca(c)}: x-mcp-header '${m}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let f=typeof u.type==="string"?u.type:void 0;if(f===void 0||!WS.has(f)){let b=`${Ca(c)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${f??"<none>"}`;if(f!=="number")return b;r??=b}let S=m.toLowerCase(),y=o.get(S);if(y!==void 0)return`x-mcp-header '${m}' is not case-insensitively unique (also declared as '${y}')`;o.set(S,m),t.push({path:c,headerName:m,type:f})}let h=u.properties;if(h!==null&&typeof h==="object")for(let[m,f]of Object.entries(h)){let S=n(f,[...c,m],l);if(S!==void 0)return S}for(let m of KS){let f=u[m];if(f===void 0)continue;let S=Array.isArray(f)?f:f!==null&&typeof f==="object"&&YS.has(m)?Object.values(f):[f];for(let y of S){let b=n(y,[...c,`<${m}>`],!1);if(b!==void 0)return b}}},i=n(e,[],!0);if(i!==void 0)return{valid:!1,reason:r??i};return r===void 0?{valid:!0,declarations:t}:{valid:!1,reason:r,declarations:t}}var KS=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],YS=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ca(e){return e.length===0?"<root>":e.join(".")}var $m="=?base64?",Cm="?=";function QS(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function XS(e){if(e.length===0)return!0;if(e.startsWith($m)&&e.endsWith(Cm))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let o=e.codePointAt(t);if(o===9||o>=32&&o<=126)continue;return!0}return!1}function e_(e){let t=new TextEncoder().encode(e),o="";for(let r of t)o+=String.fromCodePoint(r);return btoa(o)}function Im(e){return XS(e)?`${$m}${e_(e)}${Cm}`:e}function t_(e,t){let o=e;for(let r of t){if(o===null||typeof o!=="object")return;o=o[r]}return o}function Om(e,t){let o={};for(let r of e){let n=t_(t,r.path);if(n===void 0||n===null)continue;let i=QS(n);if(i===void 0)continue;o[`${BS}${r.headerName}`]=Im(i)}return o}var vr=-32020,cz=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Q.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[vr,Q.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Q.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Q.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Q.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[vr],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Q.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[vr],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],lz={[Q.ParseError]:400,[Q.InvalidRequest]:400,[Q.MethodNotFound]:404,[Q.UnsupportedProtocolVersion]:400,[Q.MissingRequiredClientCapability]:400,[vr]:400};function Aa(e,t){return Ki(e,t)}function ei(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function al(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var om=!1,cl="draft-2020-12";function o_(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:cl});else if(o.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!om)om=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");r=Gi(e,{target:cl,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(r.type!==void 0)return r;return Mm(r)?{type:"object",...r}:r}if(r.type!==void 0&&r.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}var r_=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function Mm(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let o=typeof e.$ref==="string"&&r_.exec(e.$ref);if(o&&t[o[1]]?.[o[2]]?.type==="object")return!0;for(let r of["oneOf","anyOf","allOf"]){let n=e[r];if(Array.isArray(n)&&n.length>0)return n.every((i)=>i!==null&&typeof i==="object"&&(i.type==="object"||Mm(i,"$id"in i?{}:t)))}return!1}function n_(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function nl(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>n_(r)).join(", ")};return{success:!0,data:o.value}}function s_(e){let t=Gi(e,{target:cl,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var i_=/\\\.\\d\{(\d+)\}/;function a_(e){let t=i_.exec(e),o=[void 0,-1,0];if(t)o.push(Number(t[1]));return[!1,!0].flatMap((r)=>[!1,!0].flatMap((n)=>o.map((i)=>Fo({local:r,offset:n,precision:i}))))}function c_(e,t){let o;switch(e){case"email":o=[Eh()];break;case"uri":o=[Qi()];break;case"date":o=[Gc()];break;case"date-time":o=a_(t);break}return new Set(o.map((r)=>s_(r)).filter((r)=>r!==void 0))}function l_(e,t,o){if(o!=="zod")return!0;return c_(e,t).has(t)}function ri(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function u_(e){try{return o_(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new xe(Q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var d_=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function _l(e){return d_.has(e)||e.startsWith("x-")}var p_=new Set(["$schema",...Object.keys(Io.shape.requestedSchema.shape)]),rm={string:ei([$o,pr,hr,mr]),number:ei([Co]),integer:ei([Co]),boolean:ei([dr]),array:ei([fr,gr])},h_=new Set($o.shape.format.unwrap().options);function m_(e,t,o,r){if(!ri(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(rm,e.type)?rm[e.type]:void 0;if(n===void 0)return e;let i={};for(let[s,c]of Object.entries(e))if(n.has(s)||_l(s))i[s]=c;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!h_.has(e.format))i[s]=c;else if(typeof c!=="string"||!l_(e.format,c,o))r.push(`${t}.${s}`)}else r.push(`${t}.${s}`);return i}function f_(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&ri(i))o[n]=Object.fromEntries(Object.entries(i).map(([s,c])=>[s,m_(c,`properties.${s}`,t,r)]));else if(p_.has(n))o[n]=i;else if(!_l(n))r.push(n);if(r.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function g_(e,t){if(!ri(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!Aa(Sr,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function ll(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>ll(r,t[n],`${o}[${n}]`));if(!ri(e)||!ri(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return _l(r)?[]:[i];return ll(n,t[r],i)})}function S_(e){if(!al(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=f_(u_(e.requestedSchema),t),r=Aa(Io.shape.requestedSchema,o);if(!r.success)throw new xe(Q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${g_(o,r.error.message)}`);let n=ll(o,r.data);if(n.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let i=(r.data.required??[]).filter((s)=>!Object.prototype.hasOwnProperty.call(r.data.properties,s));if(i.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function __(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,o=typeof e.requestState==="string";if(!t&&!o)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var uz=Object.assign(__,{elicit(e){try{return{method:"elicitation/create",params:S_(e)}}catch(t){throw t instanceof xe?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var y_=!0,b_=10,v_=250;function Am(e){return{autoFulfill:e?.autoFulfill??y_,maxRounds:e?.maxRounds??b_}}function w_(e,t,o){let r=t!==void 0&&Object.keys(t).length>0;if(!r&&o===void 0)return e;return{...e,...r&&{inputResponses:t},...o!==void 0&&{requestState:o}}}function z_(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function R_(e,t){return new Promise((o,r)=>{if(t?.aborted){r(t.reason instanceof q?t.reason:new q(F.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",i),o()},e),i=()=>{clearTimeout(n),r(t?.reason instanceof q?t.reason:new q(F.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function x_(e){let t=new AbortController,o=()=>t.abort(e?.reason);if(e?.addEventListener("abort",o,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(r)=>t.abort(r),dispose:()=>e?.removeEventListener("abort",o)}}async function P_(e){let{config:t,method:o,originalParams:r,requestOptions:n,hooks:i,signal:s}=e,c=e.flowStartedAt??Date.now(),l=e.firstPayload,u=0;while(!0){if(u+=1,u>t.maxRounds)throw new q(F.InputRequiredRoundsExceeded,z_(o,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...l.requestState!==void 0&&{requestState:l.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${o}' (round ${u})`});let h=Object.entries(l.inputRequests??{}),m;if(h.length>0){let y=x_(s);try{let b=await Promise.all(h.map(async([v,k])=>{try{return[v,await i.dispatchInputRequest(v,k,y.signal)]}catch(U){throw y.abort(U),U}}));m=Object.fromEntries(b)}finally{y.dispose()}}else await R_(v_,s);let f={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let y=Date.now()-c,b=n.maxTotalTimeout-y;if(b<=0)throw new q(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:y});f.maxTotalTimeout=b}let S=await i.retry(w_(r,m,l.requestState),f);if(Tm(S)){l={inputRequests:S.inputRequests??{},...S.requestState!==void 0&&{requestState:S.requestState}};continue}return S}}var E_=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],k_={IdJagTokenExchangeResponseSchema:Ws,OAuthClientInformationFullSchema:Qs,OAuthClientInformationSchema:Ys,OAuthClientMetadataSchema:Ks,OAuthClientRegistrationErrorSchema:xa,OAuthErrorResponseSchema:br,OAuthMetadataSchema:_r,OAuthProtectedResourceMetadataSchema:Js,OAuthTokenRevocationRequestSchema:Pa,OAuthTokensSchema:yr,OpenIdProviderDiscoveryMetadataSchema:Gs,OpenIdProviderMetadataSchema:Bs},Nm={},qm={};function jm(e,t){let o=e.slice(0,-6);Nm[o]=t,qm[o]=(r)=>t.safeParse(r).success}for(let e of E_)jm(e,JS[e]);for(let[e,t]of Object.entries(k_))jm(e,t);var T_=Object.freeze(Nm),yl=Object.freeze(qm);function $_(e){switch(e){case"initialize":case"notifications/initialized":return Lt(void 0);case"server/discover":return Lt(Oa);default:return}}var ci=60000,C_=[_o,Jo,yo,Go],I_=["inputResponses","requestState"];function nm(e,t){let o=e.params;if(!oi(o))return{message:e,lifted:{}};let r=o._meta,n=oi(r)?C_.filter((l)=>(l in r)):[],i=t==="request"?I_.filter((l)=>(l in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let s={},c={...o};if(n.length>0&&oi(r)){let l={},u={...r};for(let h of n)l[h]=r[h],delete u[h];if(s.envelope=l,Object.keys(u).length>0)c._meta=u;else delete c._meta}for(let l of i){if(l==="inputResponses")s.inputResponses=c[l];if(l==="requestState")s.requestState=c[l];delete c[l]}return{message:{...e,params:c},lifted:s}}function sm(e,t){let o=e.validateResult(t,void 0);if(!o.ok&&o.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let n=e.validateResult(t,r);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function bl(e){return()=>e}var O_=bl(void 0),M_,li=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{M_=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ta,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new q(F.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let o=Date.now()-t.startTime;if(t.maxTotalTimeout&&o>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new q(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:o});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=(n)=>{o?.(n),this._onerror(n)};let r=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(r?.(n,i),wr(n)||ai(n))this._onresponse(n);else if(Ma(n))this._onrequest(n,i);else if(km(n))this._onnotification(n,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new q(F.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of e.values())r(o);for(let r of t.values())r.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=nm(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=Xh(t.classification);if(s!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${s} but this instance serves ${r.era}`));return}}if(rl(o.method)&&!r.hasNotificationMethod(o.method))return;let n=this._notificationHandlers.get(o.method),i=this.fallbackNotificationHandler;if(n===void 0&&i===void 0)return;Promise.resolve().then(()=>n===void 0?i(o):n(o,r)).catch((s)=>this._onerror(Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){let{message:o,lifted:r}=nm(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,s=(b,v,k)=>{let U={jsonrpc:"2.0",id:o.id,error:{code:b,message:v,...k!==void 0&&{data:k}}};i?.send(U).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)))};if(t?.classification!==void 0){let b=Xh(t.classification);if(b!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${b} but this instance serves ${n.era}`));let v=t.classification.revision??b;s(Q.UnsupportedProtocolVersion,`Unsupported protocol version: ${v}`,{supported:this._supportedProtocolVersions,requested:v});return}}if(ol(o.method)&&!n.hasRequestMethod(o.method)&&!(em(o.method)&&this._customSchemaRequestMethods.has(o.method))){s(Q.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){s(Q.MethodNotFound,"Method not found");return}let l=n.checkInboundEnvelope(r);if(l!==void 0){s(Q.InvalidParams,l);return}let u=(b,v)=>this._notificationViaCodec(this._resolveOutboundCodec(b.method),b,{...v,relatedRequestId:o.id}),h=(b,v,k)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(b.method),b,v,{...k,relatedRequestId:o.id}),m=new AbortController;this._requestHandlerAbortControllers.set(o.id,m);let f=r.inputResponses===void 0?void 0:A_(r.inputResponses),S={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?O_:bl(r.requestState),signal:m.signal,send:(b,v,k)=>{let U=this._resolveOutboundCodec(b.method);if(this._assertOutboundRequestInEra(U,b.method),al(v))return h(b,v,k);let z=sm(U,b.method);if(z===void 0)throw TypeError(`'${b.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return h(b,z,v)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},y=this.buildContext(S,t);Promise.resolve().then(()=>c(o,y)).then(async(b)=>{if(m.signal.aborted)return;let v;try{v=n.encodeResult(o.method,b,this._outboundServerInfo())}catch(U){this._onerror(Error(`Failed to encode result for ${o.method}: ${U}`)),s(Q.InternalError,"Internal error");return}let k={result:v,jsonrpc:"2.0",id:o.id};await i?.send(k)},async(b)=>{if(m.signal.aborted)return;let v=Number.isSafeInteger(b.code)?b.code:Q.InternalError,k={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(v),message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};await i?.send(k)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===m)this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);return}n(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wr(e))o(e);else o(xe.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,o){let r=this._resolveOutboundCodec(e.method);if(al(t)){if(!em(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=sm(r,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,n,t)}_negotiatedWireCodec(){return Lt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$_(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(ol(t)&&!e.hasRequestMethod(t))throw new q(F.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,o){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o)}_requestWithSchemaViaCodec(e,t,o,r){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s,headers:c}=r??{},l=Date.now(),u,h;return new Promise((m,f)=>{let S=(oe)=>{f(oe)};if(!this._transport){S(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(oe){S(oe);return}if(r?.signal?.aborted){let oe=r.signal.reason;throw oe instanceof q?oe:new q(F.RequestTimeout,String(oe))}let y=e.era===Oa&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,b=this._requestMessageId++;h=b;let v={...t,jsonrpc:"2.0",id:b};if(r?.onprogress)this._progressHandlers.set(b,r.onprogress),v.params={...t.params,_meta:{...t.params?._meta,progressToken:b}};let k=this._envelopeOutbound(v),U=!1,z=(oe)=>{if(U)return;if(this._progressHandlers.delete(b),y===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(oe)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}).catch((pe)=>this._onerror(Error(`Failed to send cancellation: ${pe}`)))}else y.abort();f(oe instanceof q?oe:new q(F.RequestTimeout,String(oe)))};this._responseHandlers.set(b,(oe)=>{if(r?.signal?.aborted)return;if(U=!0,oe instanceof Error)return f(oe);let pe;try{pe=e.decodeResult(t.method,oe.result)}catch(de){return f(de instanceof Error?de:Error(String(de)))}if(pe.kind==="invalid")return f(pe.error);if(pe.kind==="input_required"){if(r?.allowInputRequired===!0)return m(L_(pe));let de={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:l,retry:(Ae,Ve)=>this._requestWithSchemaViaCodec(e,Ae===void 0?{method:t.method}:{method:t.method,params:Ae},o,Ve)};return m(this._resolveNonCompleteResult(pe,de))}let we=pe.result;nl(o,we).then((de)=>{if(de.success)m(de.data);else f(new q(F.InvalidResult,`Invalid result for ${t.method}: ${de.error}`))},f)}),u=()=>z(r?.signal?.reason),r?.signal?.addEventListener("abort",u,{once:!0});let R=r?.timeout??ci,M=()=>z(new q(F.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(b,R,r?.maxTotalTimeout,M,r?.resetTimeoutOnProgress??!1),this._transport.send(k,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s,headers:c,requestSignal:y?.signal}).catch((oe)=>{this._progressHandlers.delete(b),f(oe)})}).finally(()=>{if(u)r?.signal?.removeEventListener("abort",u);if(h!==void 0)this._responseHandlers.delete(h),this._cleanupTimeout(h)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new q(F.NotConnected,"Not connected");if(rl(t.method)&&!e.hasNotificationMethod(t.method))throw new q(F.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(r,o).catch((n)=>this._onerror(n))});return}await this._transport.send(r,o)}setRequestHandler(e,t,o){this.assertRequestHandlerCapability(e);let r;if(typeof t==="function"){if(!ol(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,i)=>{let s=this._negotiatedWireCodec(),c=s.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era")c=s.validateInputRequest(e,n);if(!c.ok){if(c.reason==="not-in-era")throw new xe(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(c.message)}return Promise.resolve(t(c.value,i))}}else if(o)r=async(n,i)=>{let s=await nl(t.params,{...n.params});if(!s.success)throw new xe(Q.InvalidParams,`Invalid params for ${e}: ${s.error}`);return o(s.data,i)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,o){if(typeof t==="function"){if(!rl(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,n)=>{let i=n.validateNotification(e,r);if(!i.ok){if(i.reason==="not-in-era")throw new xe(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(r)=>{let n=await nl(t.params,{...r.params});if(!n.success)throw new xe(Q.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function oi(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function vl(e,t){let o={...e};for(let r in t){let n=r,i=t[n];if(i===void 0)continue;let s=o[n];o[n]=oi(s)&&oi(i)?{...s,...i}:i}return o}function Ia(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function A_(e){let t={},o=[];if(!Ia(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!Ia(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function im(e){throw new q(F.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function N_(e,t,o,r,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:o?._meta,requestState:bl(void 0),signal:r,send:()=>im("send"),notify:()=>im("notify")}}}async function q_(e,t,o,r,n){if(!Ia(r)||typeof r.method!=="string")throw new q(F.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let i=r.method;if(!t.hasInputRequestMethod(i))throw new q(F.InvalidResult,`Invalid input request '${o}': '${i}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:i});let s=e.getRequestHandler(i);if(s===void 0)throw new q(F.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${i}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:i});let c=Ia(r.params)?r.params:void 0;return await s({jsonrpc:"2.0",id:o,method:i,...c!==void 0&&{params:c}},e.buildContext(N_(o,i,c,n,e.sessionId)))}function j_(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function Lm(e,t,o,r){let{codec:n,request:i,options:s,flowStartedAt:c}=r,l={inputRequests:o.inputRequests,...o.requestState!==void 0&&{requestState:o.requestState}},u={dispatchInputRequest:(h,m,f)=>q_(e,n,h,m,f),retry:(h,m)=>r.retry(h,j_(s,m))};return P_({config:t,method:i.method,originalParams:i.params,firstPayload:l,flowStartedAt:c,signal:s?.signal,requestOptions:{...s?.timeout!==void 0&&{timeout:s.timeout},...s?.maxTotalTimeout!==void 0&&{maxTotalTimeout:s.maxTotalTimeout},...s?.onprogress!==void 0&&{onprogress:s.onprogress}},hooks:u})}function L_(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref"){i(s);continue}}}}function un(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let l=e.seen.get(c);if(l.ref===null)return;let u=l.def??l.schema,h={...u},m=l.ref;if(l.ref=null,m){r(m);let S=e.seen.get(m),y=S.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(y);else Object.assign(u,y);if(Object.assign(u,h),c._zod.parent===m)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in h))delete u[v]}if(y.$ref&&S.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in S.def&&JSON.stringify(u[v])===JSON.stringify(S.def[v]))delete u[v]}}let f=c._zod.parent;if(f&&f!==m){r(f);let S=e.seen.get(f);if(S?.schema.$ref){if(u.$ref=S.schema.$ref,S.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in S.def&&JSON.stringify(u[y])===JSON.stringify(S.def[y]))delete u[y]}}}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Object.assign(n,o.def??o.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let c of e.seen.entries()){let l=c[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;s[l.defId]=l.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:an(t,"input",e.processors),output:an(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function lt(e,t){let o=t??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return lt(r.element,o);if(r.type==="set")return lt(r.valueType,o);if(r.type==="lazy")return lt(r.getter(),o);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return lt(r.innerType,o);if(r.type==="intersection")return lt(r.left,o)||lt(r.right,o);if(r.type==="record"||r.type==="map")return lt(r.keyType,o)||lt(r.valueType,o);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return lt(r.in,o)||lt(r.out,o)}if(r.type==="object"){for(let n in r.shape)if(lt(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(lt(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(lt(n,o))return!0;if(r.rest&<(r.rest,o))return!0;return!1}return!1}var Hp=(e,t={})=>(o)=>{let r=cn({...o,processors:t});return $e(e,r),ln(r,e),un(r,e)},an=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},s=cn({...n??{},target:i,io:t,processors:o});return $e(e,s),ln(s,e),un(s,e)};var ng={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zc=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:s,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(c){if(n.format=ng[c]??c,n.format==="")delete n.format;if(c==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let h=[...l];if(h.length===1)n.pattern=h[0].source;else if(h.length>1)n.allOf=[...h.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Rc=(e,t,o,r)=>{let n=o,{minimum:i,maximum:s,format:c,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))n.type="integer";else n.type="number";let m=typeof h==="number"&&h>=(i??Number.NEGATIVE_INFINITY),f=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),S=t.target==="draft-04"||t.target==="openapi-3.0";if(m)if(S)n.minimum=h,n.exclusiveMinimum=!0;else n.exclusiveMinimum=h;else if(typeof i==="number")n.minimum=i;if(f)if(S)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof l==="number")n.multipleOf=l},xc=(e,t,o,r)=>{o.type="boolean"},Vp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Jp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Pc=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},Ec=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Bp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},kc=(e,t,o,r)=>{o.not={}},Tc=(e,t,o,r)=>{},$c=(e,t,o,r)=>{},Gp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Cc=(e,t,o,r)=>{let n=e._zod.def,i=Ii(n.entries);if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";o.enum=i},Ic=(e,t,o,r)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(o.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")o.enum=[s];else o.const=s}else{if(i.every((s)=>typeof s==="number"))o.type="number";if(i.every((s)=>typeof s==="string"))o.type="string";if(i.every((s)=>typeof s==="boolean"))o.type="boolean";if(i.every((s)=>s===null))o.type="null";o.enum=i}},Wp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Kp=(e,t,o,r)=>{let n=o,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Yp=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:l}=e._zod.bag;if(s!==void 0)i.minLength=s;if(c!==void 0)i.maxLength=c;if(l)if(l.length===1)i.contentMediaType=l[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},Qp=(e,t,o,r)=>{o.type="boolean"},Oc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Xp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Mc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},eh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},th=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Ac=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=$e(i.element,t,{...r,path:[...r.path,"items"]})},Nc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=$e(s[u],t,{...r,path:[...r.path,"properties",u]});let c=new Set(Object.keys(s)),l=new Set([...c].filter((u)=>{let h=i.shape[u]._zod;if(t.io==="input")return h.optin===void 0;else return h.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=$e(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},qc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,l)=>$e(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));if(i)o.oneOf=s;else o.anyOf=s},jc=(e,t,o,r)=>{let n=e._zod.def,i=$e(n.left,t,{...r,path:[...r.path,"allOf",0]}),s=$e(n.right,t,{...r,path:[...r.path,"allOf",1]}),c=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];o.allOf=l},oh=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((f,S)=>$e(f,t,{...r,path:[...r.path,s,S]})),u=i.rest?$e(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=l,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:l},u)n.items.anyOf.push(u);if(n.minItems=l.length,!u)n.maxItems=l.length}else if(n.items=l,u)n.additionalItems=u;let{minimum:h,maximum:m}=e._zod.bag;if(typeof h==="number")n.minItems=h;if(typeof m==="number")n.maxItems=m},Lc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let h=$e(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let m of l)n.patternProperties[m.source]=h}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=$e(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});n.additionalProperties=$e(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values;if(u){let h=[...u].filter((m)=>typeof m==="string"||typeof m==="number");if(h.length>0)n.required=h}},Uc=(e,t,o,r)=>{let n=e._zod.def,i=$e(n.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,o.nullable=!0;else o.anyOf=[i,{type:"null"}]},Dc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Zc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Hc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")o._prefault=JSON.parse(JSON.stringify(n.defaultValue))},Fc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=s},Vc=(e,t,o,r)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;$e(s,t,r);let c=t.seen.get(e);c.ref=s},Jc=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.readOnly=!0},rh=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Bi=(e,t,o,r)=>{let n=e._zod.def;$e(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Bc=(e,t,o,r)=>{let n=e._zod.innerType;$e(n,t,r);let i=t.seen.get(e);i.ref=n},Fp={string:zc,number:Rc,boolean:xc,bigint:Vp,symbol:Jp,null:Pc,undefined:Ec,void:Bp,never:kc,any:Tc,unknown:$c,date:Gp,enum:Cc,literal:Ic,nan:Wp,template_literal:Kp,file:Yp,success:Qp,custom:Oc,function:Xp,transform:Mc,map:eh,set:th,array:Ac,object:Nc,union:qc,intersection:jc,tuple:oh,record:Lc,nullable:Uc,nonoptional:Dc,default:Zc,prefault:Hc,catch:Fc,pipe:Vc,readonly:Jc,promise:rh,optional:Bi,lazy:Bc};function Gi(e,t){if("_idmap"in e){let r=e,n=cn({...t,processors:Fp}),i={};for(let l of r._idmap.entries()){let[u,h]=l;$e(h,n)}let s={},c={registry:r,uri:t?.uri,defs:i};n.external=c;for(let l of r._idmap.entries()){let[u,h]=l;ln(n,h),s[u]=un(n,h)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let o=cn({...t,processors:Fp});return $e(e,o),ln(o,e),un(o,e)}var pg=_("ZodISODateTime",(e,t)=>{_d.init(e,t),qe.init(e,t)});function Fo(e){return Ep(pg,e)}var hg=_("ZodISODate",(e,t)=>{yd.init(e,t),qe.init(e,t)});function Gc(e){return kp(hg,e)}var mg=_("ZodISOTime",(e,t)=>{bd.init(e,t),qe.init(e,t)});function nh(e){return Tp(mg,e)}var fg=_("ZodISODuration",(e,t)=>{vd.init(e,t),qe.init(e,t)});function sh(e){return $p(fg,e)}var gg=(e,t)=>{Ni.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>Ka(e,o)},flatten:{value:(o)=>Wa(e,o)},addIssue:{value:(o)=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Qr,2)}},addIssues:{value:(o)=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Qr,2)}},isEmpty:{get(){return e.issues.length===0}}})};var St=_("ZodError",gg,{Parent:Error});var ah=qi(St),ch=ji(St),Ki=en(St),lh=tn(St),uh=tu(St),dh=ou(St),ph=ru(St),hh=nu(St),mh=su(St),fh=iu(St),gh=au(St),Sh=cu(St);var _h=new WeakMap;function dn(e,t,o){let r=Object.getPrototypeOf(e),n=_h.get(r);if(!n)n=new Set,_h.set(r,n);if(n.has(t))return;n.add(t);for(let i in o){let s=o[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){let c=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var Ce=_("ZodType",(e,t)=>(Te.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:an(e,"input"),output:an(e,"output")}}),e.toJSONSchema=Hp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>ah(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>Ki(e,o,r),e.parseAsync=async(o,r)=>ch(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>lh(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>uh(e,o,r),e.decode=(o,r)=>dh(e,o,r),e.encodeAsync=async(o,r)=>ph(e,o,r),e.decodeAsync=async(o,r)=>hh(e,o,r),e.safeEncode=(o,r)=>mh(e,o,r),e.safeDecode=(o,r)=>fh(e,o,r),e.safeEncodeAsync=async(o,r)=>gh(e,o,r),e.safeDecodeAsync=async(o,r)=>Sh(e,o,r),dn(e,"ZodType",{check(...o){let r=this.def;return this.clone(Jt(r,{checks:[...r.checks??[],...o.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,r){return yt(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(sS(o,r))},superRefine(o,r){return this.check(iS(o,r))},overwrite(o){return this.check(Kt(o))},optional(){return V(this)},exactOptional(){return Vg(this)},nullable(){return wh(this)},nullish(){return V(wh(this))},nonoptional(o){return Yg(this,o)},array(){return g(this)},or(o){return C([this,o])},and(o){return It(this,o)},transform(o){return zh(this,Ih(o))},default(o){return Gg(this,o)},prefault(o){return Kg(this,o)},catch(o){return Xg(this,o)},pipe(o){return zh(this,o)},readonly(){return oS(this)},describe(o){let r=this.clone();return Wt.add(r,{description:o}),r},meta(...o){if(o.length===0)return Wt.get(this);let r=this.clone();return Wt.add(r,o[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return Wt.get(e)?.description},configurable:!0}),e)),Rh=_("_ZodString",(e,t)=>{Di.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zc(e,r,n,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,dn(e,"_ZodString",{regex(...r){return this.check(pc(...r))},includes(...r){return this.check(fc(...r))},startsWith(...r){return this.check(gc(...r))},endsWith(...r){return this.check(Sc(...r))},min(...r){return this.check(Zo(...r))},max(...r){return this.check(Vi(...r))},length(...r){return this.check(Ji(...r))},nonempty(...r){return this.check(Zo(1,...r))},lowercase(r){return this.check(hc(r))},uppercase(r){return this.check(mc(r))},trim(){return this.check(yc())},normalize(...r){return this.check(_c(...r))},toLowerCase(){return this.check(bc())},toUpperCase(){return this.check(vc())},slugify(){return this.check(wc())}})}),xh=_("ZodString",(e,t)=>{Di.init(e,t),Rh.init(e,t),e.email=(o)=>e.check(lc(Ph,o)),e.url=(o)=>e.check(dc(kh,o)),e.jwt=(o)=>e.check(Pp(Ig,o)),e.emoji=(o)=>e.check(pp(_g,o)),e.guid=(o)=>e.check(uc(yh,o)),e.uuid=(o)=>e.check(cp(Yi,o)),e.uuidv4=(o)=>e.check(lp(Yi,o)),e.uuidv6=(o)=>e.check(up(Yi,o)),e.uuidv7=(o)=>e.check(dp(Yi,o)),e.nanoid=(o)=>e.check(hp(yg,o)),e.guid=(o)=>e.check(uc(yh,o)),e.cuid=(o)=>e.check(mp(bg,o)),e.cuid2=(o)=>e.check(fp(vg,o)),e.ulid=(o)=>e.check(gp(wg,o)),e.base64=(o)=>e.check(zp(Tg,o)),e.base64url=(o)=>e.check(Rp($g,o)),e.xid=(o)=>e.check(Sp(zg,o)),e.ksuid=(o)=>e.check(_p(Rg,o)),e.ipv4=(o)=>e.check(yp(xg,o)),e.ipv6=(o)=>e.check(bp(Pg,o)),e.cidrv4=(o)=>e.check(vp(Eg,o)),e.cidrv6=(o)=>e.check(wp(kg,o)),e.e164=(o)=>e.check(xp(Cg,o)),e.datetime=(o)=>e.check(Fo(o)),e.date=(o)=>e.check(Gc(o)),e.time=(o)=>e.check(nh(o)),e.duration=(o)=>e.check(sh(o))});function a(e){return ap(xh,e)}var qe=_("ZodStringFormat",(e,t)=>{Ae.init(e,t),Rh.init(e,t)}),Ph=_("ZodEmail",(e,t)=>{ld.init(e,t),qe.init(e,t)});function Eh(e){return lc(Ph,e)}var yh=_("ZodGUID",(e,t)=>{ad.init(e,t),qe.init(e,t)});var Yi=_("ZodUUID",(e,t)=>{cd.init(e,t),qe.init(e,t)});var kh=_("ZodURL",(e,t)=>{ud.init(e,t),qe.init(e,t)});function Qi(e){return dc(kh,e)}var _g=_("ZodEmoji",(e,t)=>{dd.init(e,t),qe.init(e,t)});var yg=_("ZodNanoID",(e,t)=>{pd.init(e,t),qe.init(e,t)});var bg=_("ZodCUID",(e,t)=>{hd.init(e,t),qe.init(e,t)});var vg=_("ZodCUID2",(e,t)=>{md.init(e,t),qe.init(e,t)});var wg=_("ZodULID",(e,t)=>{fd.init(e,t),qe.init(e,t)});var zg=_("ZodXID",(e,t)=>{gd.init(e,t),qe.init(e,t)});var Rg=_("ZodKSUID",(e,t)=>{Sd.init(e,t),qe.init(e,t)});var xg=_("ZodIPv4",(e,t)=>{wd.init(e,t),qe.init(e,t)});var Pg=_("ZodIPv6",(e,t)=>{zd.init(e,t),qe.init(e,t)});var Eg=_("ZodCIDRv4",(e,t)=>{Rd.init(e,t),qe.init(e,t)});var kg=_("ZodCIDRv6",(e,t)=>{xd.init(e,t),qe.init(e,t)});var Tg=_("ZodBase64",(e,t)=>{Ed.init(e,t),qe.init(e,t)});var $g=_("ZodBase64URL",(e,t)=>{kd.init(e,t),qe.init(e,t)});var Cg=_("ZodE164",(e,t)=>{Td.init(e,t),qe.init(e,t)});var Ig=_("ZodJWT",(e,t)=>{$d.init(e,t),qe.init(e,t)});var Xi=_("ZodNumber",(e,t)=>{nc.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rc(e,r,n,i),dn(e,"ZodNumber",{gt(r,n){return this.check(Hi(r,n))},gte(r,n){return this.check(sn(r,n))},min(r,n){return this.check(sn(r,n))},lt(r,n){return this.check(Zi(r,n))},lte(r,n){return this.check(nn(r,n))},max(r,n){return this.check(nn(r,n))},int(r){return this.check(bh(r))},safe(r){return this.check(bh(r))},positive(r){return this.check(Hi(0,r))},nonnegative(r){return this.check(sn(0,r))},negative(r){return this.check(Zi(0,r))},nonpositive(r){return this.check(nn(0,r))},multipleOf(r,n){return this.check(Fi(r,n))},step(r,n){return this.check(Fi(r,n))},finite(){return this}});let o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??0.5),e.isFinite=!0,e.format=o.format??null});function w(e){return Cp(Xi,e)}var Og=_("ZodNumberFormat",(e,t)=>{Cd.init(e,t),Xi.init(e,t)});function bh(e){return Op(Og,e)}var Th=_("ZodBoolean",(e,t)=>{Id.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xc(e,o,r,n)});function T(e){return Mp(Th,e)}var Mg=_("ZodUndefined",(e,t)=>{Od.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ec(e,o,r,n)});function Kc(e){return Ap(Mg,e)}var Ag=_("ZodNull",(e,t)=>{Md.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Pc(e,o,r,n)});function go(e){return Np(Ag,e)}var Ng=_("ZodAny",(e,t)=>{Ad.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Tc(e,o,r,n)});function ea(){return qp(Ng)}var qg=_("ZodUnknown",(e,t)=>{Nd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$c(e,o,r,n)});function L(){return jp(qg)}var jg=_("ZodNever",(e,t)=>{qd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kc(e,o,r,n)});function Yc(e){return Lp(jg,e)}var Lg=_("ZodArray",(e,t)=>{jd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ac(e,o,r,n),e.element=t.element,dn(e,"ZodArray",{min(o,r){return this.check(Zo(o,r))},nonempty(o){return this.check(Zo(1,o))},max(o,r){return this.check(Vi(o,r))},length(o,r){return this.check(Ji(o,r))},unwrap(){return this.element}})});function g(e,t){return Up(Lg,e,t)}var $h=_("ZodObject",(e,t)=>{Dd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nc(e,o,r,n),Se(e,"shape",()=>t.shape),dn(e,"ZodObject",{keyof(){return ae(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:L()})},loose(){return this.clone({...this._zod.def,catchall:L()})},strict(){return this.clone({...this._zod.def,catchall:Yc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Ff(this,o)},safeExtend(o){return Vf(this,o)},merge(o){return Jf(this,o)},pick(o){return Zf(this,o)},omit(o){return Hf(this,o)},partial(...o){return Bf(Oh,this,o[0])},required(...o){return Gf(Mh,this,o[0])}})});function d(e,t){let o={type:"object",shape:e??{},...H(t)};return new $h(o)}function K(e,t){return new $h({type:"object",shape:e,catchall:L(),...H(t)})}var Ch=_("ZodUnion",(e,t)=>{sc.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qc(e,o,r,n),e.options=t.options});function C(e,t){return new Ch({type:"union",options:e,...H(t)})}var Ug=_("ZodDiscriminatedUnion",(e,t)=>{Ch.init(e,t),Zd.init(e,t)});function Vo(e,t,o){return new Ug({type:"union",options:t,discriminator:e,...H(o)})}var Dg=_("ZodIntersection",(e,t)=>{Hd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n)});function It(e,t){return new Dg({type:"intersection",left:e,right:t})}var vh=_("ZodRecord",(e,t)=>{Fd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lc(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function E(e,t,o){if(!t||!t._zod)return new vh({type:"record",keyType:a(),valueType:e,...H(t)});return new vh({type:"record",keyType:e,valueType:t,...H(o)})}var Wc=_("ZodEnum",(e,t)=>{Vd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cc(e,r,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(r,n)=>{let i={};for(let s of r)if(o.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Wc({...t,checks:[],...H(n),entries:i})},e.exclude=(r,n)=>{let i={...t.entries};for(let s of r)if(o.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Wc({...t,checks:[],...H(n),entries:i})}});function ae(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Wc({type:"enum",entries:o,...H(t)})}var Zg=_("ZodLiteral",(e,t)=>{Jd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ic(e,o,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function p(e,t){return new Zg({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}var Hg=_("ZodTransform",(e,t)=>{Bd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Mc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Yr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(fo(i,o.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=e),o.issues.push(fo(s))}};let n=t.transform(o.value,o);if(n instanceof Promise)return n.then((i)=>(o.value=i,o.fallback=!0,o));return o.value=n,o.fallback=!0,o}});function Ih(e){return new Hg({type:"transform",transform:e})}var Oh=_("ZodOptional",(e,t)=>{ic.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bi(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Oh({type:"optional",innerType:e})}var Fg=_("ZodExactOptional",(e,t)=>{Gd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bi(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new Fg({type:"optional",innerType:e})}var Jg=_("ZodNullable",(e,t)=>{Wd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Uc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function wh(e){return new Jg({type:"nullable",innerType:e})}var Bg=_("ZodDefault",(e,t)=>{Kd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Zc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gg(e,t){return new Bg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ja(t)}})}var Wg=_("ZodPrefault",(e,t)=>{Yd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Hc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Kg(e,t){return new Wg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ja(t)}})}var Mh=_("ZodNonOptional",(e,t)=>{Qd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Dc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Yg(e,t){return new Mh({type:"nonoptional",innerType:e,...H(t)})}var Qg=_("ZodCatch",(e,t)=>{Xd.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Fc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xg(e,t){return new Qg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var Ah=_("ZodPipe",(e,t)=>{ac.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Vc(e,o,r,n),e.in=t.in,e.out=t.out});function zh(e,t){return new Ah({type:"pipe",in:e,out:t})}var eS=_("ZodPreprocess",(e,t)=>{Ah.init(e,t),ep.init(e,t)}),tS=_("ZodReadonly",(e,t)=>{tp.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Jc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function oS(e){return new tS({type:"readonly",innerType:e})}var rS=_("ZodLazy",(e,t)=>{op.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bc(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function pn(e){return new rS({type:"lazy",getter:e})}var nS=_("ZodCustom",(e,t)=>{rp.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oc(e,o,r,n)});function sS(e,t={}){return Dp(nS,e,t)}function iS(e,t){return Zp(e,t)}function So(e,t){return new eS({type:"pipe",in:Ih(e),out:t})}var qh={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"};var Nh;(function(e){})(Nh||(Nh={}));function aS(e){return Ip(Xi,e)}ct(cc());var hn="2025-11-25";var ta=[hn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oa="io.modelcontextprotocol/related-task",_o="io.modelcontextprotocol/protocolVersion",Jo="io.modelcontextprotocol/clientInfo",Pt="io.modelcontextprotocol/serverInfo",yo="io.modelcontextprotocol/clientCapabilities",Bo="io.modelcontextprotocol/subscriptionId",Go="io.modelcontextprotocol/logLevel";var bo="2.0";var Ot=pn(()=>C([a(),w(),T(),go(),E(a(),Ot),g(Ot)])),De=E(a(),Ot),ra=g(Ot),Wo=C([a(),w().int()]),Ko=a(),mn=d({ttl:w().optional()}),fn=d({taskId:a()}),Yo=K({progressToken:Wo.optional(),[oa]:fn.optional()}),Ke=d({_meta:Yo.optional()}),Qt=Ke.extend({task:mn.optional()}),Ze=d({method:a(),params:Ke.loose().optional()}),st=d({_meta:Yo.optional()}),tt=d({method:a(),params:st.loose().optional()}),Qo=K({get[Pt](){return Et.optional().catch(void 0)}}),He=K({_meta:Qo.optional()}),vt=C([a(),w().int()]),Xo=d({jsonrpc:p(bo),id:vt,...Ze.shape}).strict(),er=d({jsonrpc:p(bo),...tt.shape}).strict(),vo=d({jsonrpc:p(bo),id:vt,result:He}).strict(),wo=d({jsonrpc:p(bo),id:vt.optional(),error:d({code:w().int(),message:a(),data:L().optional()})}).strict(),zo=C([Xo,er,vo,wo]),na=C([vo,wo]),Xt=He.strict(),gn=st.extend({requestId:vt.optional(),reason:a().optional()}),tr=tt.extend({method:p("notifications/cancelled"),params:gn}),Sn=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),Mt=d({icons:g(Sn).optional()}),xt=d({name:a(),title:a().optional()}),Et=xt.extend({...xt.shape,...Mt.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),cS=It(d({applyDefaults:T().optional()}),De),lS=So((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},It(d({form:cS.optional(),url:De.optional()}),De.optional())),sa=K({list:De.optional(),cancel:De.optional(),requests:K({sampling:K({createMessage:De.optional()}).optional(),elicitation:K({create:De.optional()}).optional()}).optional()}),ia=K({list:De.optional(),cancel:De.optional(),requests:K({tools:K({call:De.optional()}).optional()}).optional()}),_n=d({experimental:E(a(),De).optional(),sampling:d({context:De.optional(),tools:De.optional()}).optional(),elicitation:lS.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:sa.optional(),extensions:E(a(),De).optional()}),yn=Ke.extend({protocolVersion:a(),capabilities:_n,clientInfo:Et}),bn=Ze.extend({method:p("initialize"),params:yn}),or=d({experimental:E(a(),De).optional(),logging:De.optional(),completions:De.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:ia.optional(),extensions:E(a(),De).optional()}),vn=He.extend({protocolVersion:a(),capabilities:or,serverInfo:Et,instructions:a().optional()}),wn=tt.extend({method:p("notifications/initialized"),params:st.optional()}),zn=Ze.extend({method:p("server/discover"),params:Ke.optional()}),eo=He.extend({supportedVersions:g(a()),capabilities:or,instructions:a().optional()}),rr=Ze.extend({method:p("ping"),params:Ke.optional()}),Rn=d({progress:w(),total:V(w()),message:V(a())}),xn=d({...st.shape,...Rn.shape,progressToken:Wo}),nr=tt.extend({method:p("notifications/progress"),params:xn}),Pn=Ke.extend({cursor:Ko.optional()}),At=Ze.extend({params:Pn.optional()}),Nt=He.extend({nextCursor:Ko.optional()}),sr=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),ir=sr.extend({text:a()}),Xc=a().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ar=sr.extend({blob:Xc}),qt=ae(["user","assistant"]),kt=d({audience:g(qt).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),cr=d({...xt.shape,...Mt.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:kt.optional(),_meta:V(K({}))}),En=d({...xt.shape,...Mt.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:kt.optional(),_meta:V(K({}))}),kn=At.extend({method:p("resources/list")}),Tn=Nt.extend({resources:g(cr)}),$n=At.extend({method:p("resources/templates/list")}),Cn=Nt.extend({resourceTemplates:g(En)}),Ro=Ke.extend({uri:a()}),In=Ro,On=Ze.extend({method:p("resources/read"),params:In}),Mn=He.extend({contents:g(C([ir,ar]))}),An=tt.extend({method:p("notifications/resources/list_changed"),params:st.optional()}),Nn=Ro,qn=Ze.extend({method:p("resources/subscribe"),params:Nn}),jn=Ro,Ln=Ze.extend({method:p("resources/unsubscribe"),params:jn}),lr=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:g(a()).optional()}),Un=Ke.extend({notifications:lr}),Dn=Ze.extend({method:p("subscriptions/listen"),params:Un}),Zn=st.extend({notifications:lr}),Hn=tt.extend({method:p("notifications/subscriptions/acknowledged"),params:Zn}),Fn=Qo.extend({[Bo]:vt}),Vn=He.extend({_meta:Fn}),Jn=st.extend({uri:a()}),Bn=tt.extend({method:p("notifications/resources/updated"),params:Jn}),Gn=d({name:a(),description:V(a()),required:V(T())}),Wn=d({...xt.shape,...Mt.shape,description:V(a()),arguments:V(g(Gn)),_meta:V(K({}))}),Kn=At.extend({method:p("prompts/list")}),Yn=Nt.extend({prompts:g(Wn)}),Qn=Ke.extend({name:a(),arguments:E(a(),a()).optional()}),Xn=Ze.extend({method:p("prompts/get"),params:Qn}),xo=d({type:p("text"),text:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),Po=d({type:p("image"),data:Xc,mimeType:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),Eo=d({type:p("audio"),data:Xc,mimeType:a(),annotations:kt.optional(),_meta:E(a(),L()).optional()}),es=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),ko=d({type:p("resource"),resource:C([ir,ar]),annotations:kt.optional(),_meta:E(a(),L()).optional()}),To=cr.extend({type:p("resource_link")}),Tt=C([xo,Po,Eo,To,ko]),ts=d({role:qt,content:Tt}),os=He.extend({description:a().optional(),messages:g(ts)}),rs=tt.extend({method:p("notifications/prompts/list_changed"),params:st.optional()}),ns=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),ss=d({taskSupport:ae(["required","optional","forbidden"]).optional()}),to=d({...xt.shape,...Mt.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:E(a(),Ot).optional(),required:g(a()).optional()}).catchall(L()),outputSchema:K({$schema:a().optional()}).optional(),annotations:ns.optional(),execution:ss.optional(),_meta:E(a(),L()).optional()}),is=At.extend({method:p("tools/list")}),as=Nt.extend({tools:g(to)}),oo=He.extend({content:g(Tt).default([]),structuredContent:L().optional(),isError:T().optional()}),aa=oo.or(He.extend({toolResult:L()})),cs=Qt.extend({name:a(),arguments:E(a(),L()).optional()}),ls=Ze.extend({method:p("tools/call"),params:cs}),us=tt.extend({method:p("notifications/tools/list_changed"),params:st.optional()}),ds=d({autoRefresh:T().default(!0),debounceMs:w().int().nonnegative().default(300)}),ur=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),ps=Ke.extend({level:ur}),hs=Ze.extend({method:p("logging/setLevel"),params:ps}),ms=st.extend({level:ur,logger:a().optional(),data:L()}),fs=tt.extend({method:p("notifications/message"),params:ms}),gs=d({name:a().optional()}),Ss=d({hints:g(gs).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),_s=d({mode:ae(["auto","required","none"]).optional()}),ys=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(Tt),structuredContent:L().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),bs=Vo("type",[xo,Po,Eo]),Yt=Vo("type",[xo,Po,Eo,es,ys]),vs=d({role:qt,content:C([Yt,g(Yt)]),_meta:E(a(),L()).optional()}),ws=Qt.extend({messages:g(vs),modelPreferences:Ss.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:De.optional(),tools:g(to).optional(),toolChoice:_s.optional()}),zs=Ze.extend({method:p("sampling/createMessage"),params:ws}),Rs=He.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens"]).or(a())),role:qt,content:bs}),xs=He.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:qt,content:C([Yt,g(Yt)])}),dr=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),$o=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),Co=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),pr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),hr=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),mr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),Ps=C([pr,hr]),fr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),gr=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),Es=C([fr,gr]),ks=C([mr,Ps,Es]),Sr=C([ks,dr,$o,Co]),Io=Qt.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),Sr),required:g(a()).optional()}).catchall(L())}),Ts=Qt.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),$s=C([Io,Ts]),Cs=Ze.extend({method:p("elicitation/create"),params:$s}),Is=st.extend({elicitationId:a()}),Os=tt.extend({method:p("notifications/elicitation/complete"),params:Is}),Ms=He.extend({action:ae(["accept","decline","cancel"]),content:So((e)=>e===null?void 0:e,E(a(),C([a(),w(),T(),g(a())])).optional())}),As=d({type:p("ref/resource"),uri:a()}),Ns=d({type:p("ref/prompt"),name:a()}),qs=Ke.extend({ref:C([Ns,As]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()}),js=Ze.extend({method:p("completion/complete"),params:qs}),Ls=He.extend({completion:K({values:g(a()).max(100),total:V(w().int()),hasMore:V(T())})}),Us=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),Ds=Ze.extend({method:p("roots/list"),params:Ke.optional()}),Zs=He.extend({roots:g(Us)}),Hs=tt.extend({method:p("notifications/roots/list_changed"),params:st.optional()}),ca=K({ttl:w().optional(),pollInterval:w().optional()}),Fs=ae(["working","input_required","completed","failed","cancelled"]),jt=d({taskId:a(),status:Fs,ttl:C([w(),go()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:V(w()),statusMessage:V(a())}),la=He.extend({task:jt}),Vs=st.merge(jt),ua=tt.extend({method:p("notifications/tasks/status"),params:Vs}),da=Ze.extend({method:p("tasks/get"),params:Ke.extend({taskId:a()})}),pa=He.merge(jt),ha=Ze.extend({method:p("tasks/result"),params:Ke.extend({taskId:a()})}),ma=He.loose(),fa=At.extend({method:p("tasks/list")}),ga=Nt.extend({tasks:g(jt)}),Sa=Ze.extend({method:p("tasks/cancel"),params:Ke.extend({taskId:a()})}),_a=He.merge(jt),ya=C([rr,bn,zn,js,hs,Xn,Kn,kn,$n,On,qn,Ln,Dn,ls,is]),ba=C([tr,nr,wn,Hs]),va=C([Xt,Rs,xs,Ms,Zs]),wa=C([rr,zs,Cs,Ds]),za=C([tr,nr,fs,Bn,An,us,rs,Hn,Os]),Ra=C([Xt,vn,eo,Ls,os,Yn,Tn,Cn,Mn,oo,as,Vn]);var Ye=Qi().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qh.custom,message:"URL must be parseable",fatal:!0}),Da}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Js=K({resource:a().url(),authorization_servers:g(Ye).optional(),jwks_uri:a().url().optional(),scopes_supported:g(a()).optional(),bearer_methods_supported:g(a()).optional(),resource_signing_alg_values_supported:g(a()).optional(),resource_name:a().optional(),resource_documentation:a().optional(),resource_policy_uri:a().url().optional(),resource_tos_uri:a().url().optional(),tls_client_certificate_bound_access_tokens:T().optional(),authorization_details_types_supported:g(a()).optional(),dpop_signing_alg_values_supported:g(a()).optional(),dpop_bound_access_tokens_required:T().optional()}),_r=K({issuer:a(),authorization_endpoint:Ye,token_endpoint:Ye,registration_endpoint:Ye.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),service_documentation:Ye.optional(),revocation_endpoint:Ye.optional(),revocation_endpoint_auth_methods_supported:g(a()).optional(),revocation_endpoint_auth_signing_alg_values_supported:g(a()).optional(),introspection_endpoint:a().optional(),introspection_endpoint_auth_methods_supported:g(a()).optional(),introspection_endpoint_auth_signing_alg_values_supported:g(a()).optional(),code_challenge_methods_supported:g(a()).optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0),dpop_signing_alg_values_supported:g(a()).optional()}),Bs=K({issuer:a(),authorization_endpoint:Ye,token_endpoint:Ye,userinfo_endpoint:Ye.optional(),jwks_uri:Ye,registration_endpoint:Ye.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),acr_values_supported:g(a()).optional(),subject_types_supported:g(a()),id_token_signing_alg_values_supported:g(a()),id_token_encryption_alg_values_supported:g(a()).optional(),id_token_encryption_enc_values_supported:g(a()).optional(),userinfo_signing_alg_values_supported:g(a()).optional(),userinfo_encryption_alg_values_supported:g(a()).optional(),userinfo_encryption_enc_values_supported:g(a()).optional(),request_object_signing_alg_values_supported:g(a()).optional(),request_object_encryption_alg_values_supported:g(a()).optional(),request_object_encryption_enc_values_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),display_values_supported:g(a()).optional(),claim_types_supported:g(a()).optional(),claims_supported:g(a()).optional(),service_documentation:a().optional(),claims_locales_supported:g(a()).optional(),ui_locales_supported:g(a()).optional(),claims_parameter_supported:T().optional(),request_parameter_supported:T().optional(),request_uri_parameter_supported:T().optional(),require_request_uri_registration:T().optional(),op_policy_uri:Ye.optional(),op_tos_uri:Ye.optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0)}),Gs=d({...Bs.shape,..._r.pick({code_challenge_methods_supported:!0}).shape}),yr=d({access_token:a(),id_token:a().optional(),token_type:a(),expires_in:aS().optional(),scope:a().optional(),refresh_token:a().optional(),issuer:a().optional().catch(void 0)}).strip(),Ws=d({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:a(),token_type:a().optional(),expires_in:w().optional(),scope:a().optional()}).strip(),br=d({error:a(),error_description:a().optional(),error_uri:a().optional()}),el=Ye.optional().or(p("").transform(()=>{return})),Ks=d({redirect_uris:g(Ye),token_endpoint_auth_method:a().optional(),grant_types:g(a()).optional(),response_types:g(a()).optional(),application_type:a().optional(),client_name:a().optional(),client_uri:Ye.optional(),logo_uri:el,scope:a().optional(),contacts:g(a()).optional(),tos_uri:el,policy_uri:a().optional(),jwks_uri:Ye.optional(),jwks:ea().optional(),software_id:a().optional(),software_version:a().optional(),software_statement:a().optional()}).strip(),Ys=d({client_id:a(),client_secret:a().optional(),client_id_issued_at:w().optional(),client_secret_expires_at:w().optional(),issuer:a().optional().catch(void 0)}).strip(),Qs=Ks.merge(Ys),xa=d({error:a(),error_description:a().optional()}).strip(),Pa=d({token:a(),token_type_hint:a().optional()}).strip();var sl=Symbol.for("mcp.sdk.errorBrands");function no(e,t){let o=new Set,r=t;while(typeof r==="function"){let n=r.mcpBrand;if(Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof n==="string")o.add(n);r=Object.getPrototypeOf(r)}if(o.size===0)return;Object.defineProperty(e,sl,{value:o,enumerable:!1,configurable:!0})}function pt(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,sl)){let o=t[sl];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var am=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return pt(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",no(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},F=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),q=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",no(this,new.target)}},ni=class extends q{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o,r){super(e,t,o,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var cm="2026-07-28",ul=[cm];function Ut(e){return e>=cm}function dl(e){return e.filter((t)=>!Ut(t))}function si(e){return e.filter((t)=>Ut(t))}function lm(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((o)=>o.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var um=["task","inputRequests","requestState"];function uS(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||um.some((t)=>(t in e)))return e;return{...e,content:[]}}function dS(){let e=pn(()=>C([a(),w(),T(),go(),E(a(),e),g(e)])),t=E(a(),e),o=C([a(),w().int()]),r=a(),n=d({ttl:w().optional()}),i=d({taskId:a()}),s=K({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=d({_meta:s.optional()}),l=c.extend({task:n.optional()}),u=d({method:a(),params:c.loose().optional()}),h=d({_meta:s.optional()}),m=d({method:a(),params:h.loose().optional()}),f=K({_meta:s.optional()}),S=C([a(),w().int()]),y=f.strict(),b=h.extend({requestId:S.optional(),reason:a().optional()}),v=m.extend({method:p("notifications/cancelled"),params:b}),k=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),U=d({icons:g(k).optional()}),z=d({name:a(),title:a().optional()}),R=z.extend({...z.shape,...U.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),M=It(d({applyDefaults:T().optional()}),t),oe=So((nt)=>{if(nt&&typeof nt==="object"&&!Array.isArray(nt)&&Object.keys(nt).length===0)return{form:{}};return nt},It(d({form:M.optional(),url:t.optional()}),t.optional())),pe=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),we=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),de=d({experimental:E(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:oe.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:pe.optional(),extensions:E(a(),t).optional()}),Ne=c.extend({protocolVersion:a(),capabilities:de,clientInfo:R}),Ve=u.extend({method:p("initialize"),params:Ne}),Be=d({experimental:E(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:we.optional(),extensions:E(a(),t).optional()}),ot=f.extend({protocolVersion:a(),capabilities:Be,serverInfo:R,instructions:a().optional()}),Qe=m.extend({method:p("notifications/initialized"),params:h.optional()}),te=u.extend({method:p("ping"),params:c.optional()}),fe=d({progress:w(),total:V(w()),message:V(a())}),D=d({...h.shape,...fe.shape,progressToken:o}),ne=m.extend({method:p("notifications/progress"),params:D}),be=c.extend({cursor:r.optional()}),re=u.extend({params:be.optional()}),le=f.extend({nextCursor:r.optional()}),je=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),Ie=je.extend({text:a()}),Oe=a().refine((nt)=>{try{return atob(nt),!0}catch{return!1}},{message:"Invalid Base64 string"}),Z=je.extend({blob:Oe}),se=ae(["user","assistant"]),J=d({audience:g(se).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),ke=d({...z.shape,...U.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:J.optional(),_meta:V(K({}))}),ht=d({...z.shape,...U.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:J.optional(),_meta:V(K({}))}),I=re.extend({method:p("resources/list")}),A=le.extend({resources:g(ke)}),B=re.extend({method:p("resources/templates/list")}),X=le.extend({resourceTemplates:g(ht)}),ve=c.extend({uri:a()}),_e=ve,Pe=u.extend({method:p("resources/read"),params:_e}),Le=f.extend({contents:g(C([Ie,Z]))}),ye=m.extend({method:p("notifications/resources/list_changed"),params:h.optional()}),ze=ve,P=u.extend({method:p("resources/subscribe"),params:ze}),We=ve,j=u.extend({method:p("resources/unsubscribe"),params:We}),N=h.extend({uri:a()}),G=m.extend({method:p("notifications/resources/updated"),params:N}),O=d({name:a(),description:V(a()),required:V(T())}),x=d({...z.shape,...U.shape,description:V(a()),arguments:V(g(O)),_meta:V(K({}))}),Y=re.extend({method:p("prompts/list")}),W=le.extend({prompts:g(x)}),ge=c.extend({name:a(),arguments:E(a(),a()).optional()}),zt=u.extend({method:p("prompts/get"),params:ge}),mt=d({type:p("text"),text:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),Re=d({type:p("image"),data:Oe,mimeType:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),ue=d({type:p("audio"),data:Oe,mimeType:a(),annotations:J.optional(),_meta:E(a(),L()).optional()}),ce=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),he=d({type:p("resource"),resource:C([Ie,Z]),annotations:J.optional(),_meta:E(a(),L()).optional()}),ie=ke.extend({type:p("resource_link")}),ee=C([mt,Re,ue,ie,he]),Me=d({role:se,content:ee}),Ee=f.extend({description:a().optional(),messages:g(Me)}),Je=m.extend({method:p("notifications/prompts/list_changed"),params:h.optional()}),it=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),Ue=d({taskSupport:ae(["required","optional","forbidden"]).optional()}),Xe=d({...z.shape,...U.shape,description:a().optional(),inputSchema:d({type:p("object"),properties:E(a(),e).optional(),required:g(a()).optional()}).catchall(L()),outputSchema:d({type:p("object"),properties:E(a(),e).optional(),required:g(a()).optional()}).catchall(L()).optional(),annotations:it.optional(),execution:Ue.optional(),_meta:E(a(),L()).optional()}),Zt=re.extend({method:p("tools/list")}),Ht=le.extend({tools:g(Xe)}),Mo=f.extend({content:g(ee),structuredContent:E(a(),L()).optional(),isError:T().optional()}),rt=l.extend({name:a(),arguments:E(a(),L()).optional()}),Pr=u.extend({method:p("tools/call"),params:rt}),mi=m.extend({method:p("notifications/tools/list_changed"),params:h.optional()}),Ao=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),Er=c.extend({level:Ao}),kr=u.extend({method:p("logging/setLevel"),params:Er}),Tr=h.extend({level:Ao,logger:a().optional(),data:L()}),$r=m.extend({method:p("notifications/message"),params:Tr}),Cr=d({name:a().optional()}),Ir=d({hints:g(Cr).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),Or=d({mode:ae(["auto","required","none"]).optional()}),fi=d({type:p("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(ee),structuredContent:d({}).loose().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),Mr=Vo("type",[mt,Re,ue]),Ft=Vo("type",[mt,Re,ue,ce,fi]),Ar=d({role:se,content:C([Ft,g(Ft)]),_meta:E(a(),L()).optional()}),Nr=l.extend({messages:g(Ar),modelPreferences:Ir.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Xe).optional(),toolChoice:Or.optional()}),qr=u.extend({method:p("sampling/createMessage"),params:Nr}),jr=f.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens"]).or(a())),role:se,content:Mr}),Lr=f.extend({model:a(),stopReason:V(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:se,content:C([Ft,g(Ft)])}),Ur=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),Dr=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),Zr=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),Hr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),Fr=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),Vr=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),Jr=C([Hr,Fr]),ao=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),co=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),gi=C([ao,co]),Si=C([Vr,Jr,gi]),ft=C([Si,Ur,Dr,Zr]),gt=l.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),ft),required:g(a()).optional()}).catchall(L())}),Br=l.extend({mode:p("url"),message:a(),elicitationId:a(),url:a().url()}),_t=C([gt,Br]),_i=u.extend({method:p("elicitation/create"),params:_t}),yi=h.extend({elicitationId:a()}),bi=m.extend({method:p("notifications/elicitation/complete"),params:yi}),vi=f.extend({action:ae(["accept","decline","cancel"]),content:So((nt)=>nt===null?void 0:nt,E(a(),C([a(),w(),T(),g(a())])).optional())}),wi=d({type:p("ref/resource"),uri:a()}),zi=d({type:p("ref/prompt"),name:a()}),Ri=c.extend({ref:C([zi,wi]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()}),Gr=u.extend({method:p("completion/complete"),params:Ri}),xi=f.extend({completion:K({values:g(a()).max(100),total:V(w().int()),hasMore:V(T())})}),Pi=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),No=u.extend({method:p("roots/list"),params:c.optional()}),Wr=f.extend({roots:g(Pi)}),Ei=m.extend({method:p("notifications/roots/list_changed"),params:h.optional()}),ki=K({ttl:w().optional(),pollInterval:w().optional()}),Kr=ae(["working","input_required","completed","failed","cancelled"]),Vt=d({taskId:a(),status:Kr,ttl:C([w(),go()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:V(w()),statusMessage:V(a())}),dt=f.extend({task:Vt}),Ti=h.merge(Vt),lo=m.extend({method:p("notifications/tasks/status"),params:Ti}),qo=u.extend({method:p("tasks/get"),params:c.extend({taskId:a()})}),jo=f.merge(Vt),Lo=u.extend({method:p("tasks/result"),params:c.extend({taskId:a()})}),Ua=f.loose(),at=re.extend({method:p("tasks/list")}),Ge=le.extend({tasks:g(Vt)}),uo=u.extend({method:p("tasks/cancel"),params:c.extend({taskId:a()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:s,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:h,NotificationSchema:m,ResultSchema:f,RequestIdSchema:S,EmptyResultSchema:y,CancelledNotificationParamsSchema:b,CancelledNotificationSchema:v,IconSchema:k,IconsSchema:U,BaseMetadataSchema:z,ImplementationSchema:R,ClientTasksCapabilitySchema:pe,ServerTasksCapabilitySchema:we,ClientCapabilitiesSchema:de,InitializeRequestParamsSchema:Ne,InitializeRequestSchema:Ve,ServerCapabilitiesSchema:Be,InitializeResultSchema:ot,InitializedNotificationSchema:Qe,PingRequestSchema:te,ProgressSchema:fe,ProgressNotificationParamsSchema:D,ProgressNotificationSchema:ne,PaginatedRequestParamsSchema:be,PaginatedRequestSchema:re,PaginatedResultSchema:le,ResourceContentsSchema:je,TextResourceContentsSchema:Ie,BlobResourceContentsSchema:Z,RoleSchema:se,AnnotationsSchema:J,ResourceSchema:ke,ResourceTemplateSchema:ht,ListResourcesRequestSchema:I,ListResourcesResultSchema:A,ListResourceTemplatesRequestSchema:B,ListResourceTemplatesResultSchema:X,ResourceRequestParamsSchema:ve,ReadResourceRequestParamsSchema:_e,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Le,ResourceListChangedNotificationSchema:ye,SubscribeRequestParamsSchema:ze,SubscribeRequestSchema:P,UnsubscribeRequestParamsSchema:We,UnsubscribeRequestSchema:j,ResourceUpdatedNotificationParamsSchema:N,ResourceUpdatedNotificationSchema:G,PromptArgumentSchema:O,PromptSchema:x,ListPromptsRequestSchema:Y,ListPromptsResultSchema:W,GetPromptRequestParamsSchema:ge,GetPromptRequestSchema:zt,TextContentSchema:mt,ImageContentSchema:Re,AudioContentSchema:ue,ToolUseContentSchema:ce,EmbeddedResourceSchema:he,ResourceLinkSchema:ie,ContentBlockSchema:ee,PromptMessageSchema:Me,GetPromptResultSchema:Ee,PromptListChangedNotificationSchema:Je,ToolAnnotationsSchema:it,ToolExecutionSchema:Ue,ToolSchema:Xe,ListToolsRequestSchema:Zt,ListToolsResultSchema:Ht,CallToolResultSchema:Mo,CallToolRequestParamsSchema:rt,CallToolRequestSchema:Pr,ToolListChangedNotificationSchema:mi,LoggingLevelSchema:Ao,SetLevelRequestParamsSchema:Er,SetLevelRequestSchema:kr,LoggingMessageNotificationParamsSchema:Tr,LoggingMessageNotificationSchema:$r,ModelHintSchema:Cr,ModelPreferencesSchema:Ir,ToolChoiceSchema:Or,ToolResultContentSchema:fi,SamplingContentSchema:Mr,SamplingMessageContentBlockSchema:Ft,SamplingMessageSchema:Ar,CreateMessageRequestParamsSchema:Nr,CreateMessageRequestSchema:qr,CreateMessageResultSchema:jr,CreateMessageResultWithToolsSchema:Lr,BooleanSchemaSchema:Ur,StringSchemaSchema:Dr,NumberSchemaSchema:Zr,UntitledSingleSelectEnumSchemaSchema:Hr,TitledSingleSelectEnumSchemaSchema:Fr,LegacyTitledEnumSchemaSchema:Vr,SingleSelectEnumSchemaSchema:Jr,UntitledMultiSelectEnumSchemaSchema:ao,TitledMultiSelectEnumSchemaSchema:co,MultiSelectEnumSchemaSchema:gi,EnumSchemaSchema:Si,PrimitiveSchemaDefinitionSchema:ft,ElicitRequestFormParamsSchema:gt,ElicitRequestURLParamsSchema:Br,ElicitRequestParamsSchema:_t,ElicitRequestSchema:_i,ElicitationCompleteNotificationParamsSchema:yi,ElicitationCompleteNotificationSchema:bi,ElicitResultSchema:vi,ResourceTemplateReferenceSchema:wi,PromptReferenceSchema:zi,CompleteRequestParamsSchema:Ri,CompleteRequestSchema:Gr,CompleteResultSchema:xi,RootSchema:Pi,ListRootsRequestSchema:No,ListRootsResultSchema:Wr,RootsListChangedNotificationSchema:Ei,TaskCreationParamsSchema:ki,TaskStatusSchema:Kr,TaskSchema:Vt,CreateTaskResultSchema:dt,TaskStatusNotificationParamsSchema:Ti,TaskStatusNotificationSchema:lo,GetTaskRequestSchema:qo,GetTaskResultSchema:jo,GetTaskPayloadRequestSchema:Lo,GetTaskPayloadResultSchema:Ua,ListTasksRequestSchema:at,ListTasksResultSchema:Ge,CancelTaskRequestSchema:uo,CancelTaskResultSchema:f.merge(Vt),ClientRequestSchema:C([te,Ve,Gr,kr,zt,Y,I,B,Pe,P,j,Pr,Zt,qo,Lo,at,uo]),ClientNotificationSchema:C([v,ne,Qe,Ei,lo]),ClientResultSchema:C([y,jr,Lr,vi,Wr,jo,Ge,dt]),ServerRequestSchema:C([te,qr,_i,No,qo,Lo,at,uo]),ServerNotificationSchema:C([v,ne,$r,G,ye,mi,Je,lo,bi]),ServerResultSchema:C([y,ot,xi,Ee,W,A,X,Le,Mo,Ht,jo,Ge,dt]),CallToolResultWireSchema:L().superRefine((nt,Cf)=>{if(typeof nt!=="object"||nt===null||Array.isArray(nt)||nt.content!==void 0)return;for(let Al of um)if(Al in nt){Cf.addIssue({code:"custom",message:`content is required when the body carries '${Al}' — another result family cannot default into an empty tools/call success`});return}}).transform(uS).pipe(Mo)}}var pS;function dm(){return pS??=dS()}function pm(e){return e.type!=="object"}var hS=new Set(["const","enum","default","examples"]),mS=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Wh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function fS(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Wh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=Ul(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((l)=>r(l,!1));if(n===null||typeof n!=="object")return n;if(!i&&Wh(n.$id))return n;let s={},c=!1;for(let[l,u]of Object.entries(n))if(i)s[l]=r(u,!1);else if((l==="$ref"||l==="$dynamicRef")&&typeof u==="string")s[l]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(l==="$recursiveRef"&&u==="#"&&o)c=!0;else if(hS.has(l))s[l]=u;else if(mS.has(l))s[l]=r(u,!0);else s[l]=r(u,!1);if(c)if("$ref"in s)s.allOf=[...Array.isArray(s.allOf)?s.allOf:[],{$ref:"#/properties/result"}];else s.$ref="#/properties/result";return s};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var hm={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},mm={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},gS={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ea;function pl(){if(Ea)return Ea;let e=dm();return Ea={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ea}function fm(e){return Object.prototype.hasOwnProperty.call(hm,e)}function gm(e){return Object.prototype.hasOwnProperty.call(mm,e)}function SS(e){return Object.prototype.hasOwnProperty.call(gS,e)}function _S(e){return SS(e)?pl().resultSchemas[e]:void 0}function yS(e){return fm(e)?pl().requestSchemas[e]:void 0}function bS(e){return gm(e)?pl().notificationSchemas[e]:void 0}var nz=Object.keys(hm),sz=Object.keys(mm);function il(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ka(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var Kh={ok:!1,reason:"not-in-era"};function Yh(e){return il(e)&&il(e.outputSchema)&&pm(e.outputSchema)}function Qh(e){return e}var hl={era:"2025-11-25",hasRequestMethod:fm,hasNotificationMethod:gm,validateRequest:(e,t)=>ka(yS(e),t),validateResult:(e,t)=>ka(_S(e),t),validateNotification:(e,t)=>ka(bS(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Kh,validateInputResponse:()=>Kh,samplingResultVariant:(e,t)=>{let o=dm();return ka(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=lm(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&pm(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(il(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:Qh(o)}}return{kind:"complete",result:Qh(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>Yh(r)))return t;return{...t,tools:o.map((r)=>Yh(r)?{...r,outputSchema:fS(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function vS(){let e=pn(()=>C([a(),w(),T(),go(),E(a(),e),g(e)])),t=E(a(),e),o=C([a(),w().int()]),r=a(),n=C([a(),w().int()]),i=ae(["user","assistant"]),s=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),c=a().refine((Ge)=>{try{return atob(Ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=d({ttl:w().optional()}),u=d({taskId:a()}),h=K({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),m=d({_meta:h.optional()}),f=m.extend({task:l.optional()}),S=d({_meta:h.optional()}),y=d({method:a(),params:S.loose().optional()}),b=d({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:ae(["light","dark"]).optional()}),v=d({icons:g(b).optional()}),k=d({name:a(),title:a().optional()}),U=k.extend({...k.shape,...v.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),z=It(d({applyDefaults:T().optional()}),t),R=So((Ge)=>{if(Ge&&typeof Ge==="object"&&!Array.isArray(Ge)&&Object.keys(Ge).length===0)return{form:{}};return Ge},It(d({form:z.optional(),url:t.optional()}),t.optional())),M=K({list:t.optional(),cancel:t.optional(),requests:K({sampling:K({createMessage:t.optional()}).optional(),elicitation:K({create:t.optional()}).optional()}).optional()}),oe=K({list:t.optional(),cancel:t.optional(),requests:K({tools:K({call:t.optional()}).optional()}).optional()}),pe=d({experimental:E(a(),t).optional(),sampling:d({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:d({listChanged:T().optional()}).optional(),tasks:M.optional(),extensions:E(a(),t).optional()}),we=d({experimental:E(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:d({listChanged:T().optional()}).optional(),resources:d({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:d({listChanged:T().optional()}).optional(),tasks:oe.optional(),extensions:E(a(),t).optional()}),de=d({progress:w(),total:V(w()),message:V(a())}),Ne=d({...S.shape,...de.shape,progressToken:o}),Ve=y.extend({method:p("notifications/progress"),params:Ne}),Be=S.extend({level:s,logger:a().optional(),data:L()}),ot=y.extend({method:p("notifications/message"),params:Be}),Qe=d({uri:a(),mimeType:V(a()),_meta:E(a(),L()).optional()}),te=Qe.extend({text:a()}),fe=Qe.extend({blob:c}),D=d({audience:g(i).optional(),priority:w().min(0).max(1).optional(),lastModified:Fo({offset:!0}).optional()}),ne=d({...k.shape,...v.shape,uri:a(),description:V(a()),mimeType:V(a()),size:V(w()),annotations:D.optional(),_meta:V(K({}))}),be=d({...k.shape,...v.shape,uriTemplate:a(),description:V(a()),mimeType:V(a()),annotations:D.optional(),_meta:V(K({}))}),re=y.extend({method:p("notifications/resources/list_changed"),params:S.optional()}),le=S.extend({uri:a()}),je=y.extend({method:p("notifications/resources/updated"),params:le}),Ie=d({name:a(),description:V(a()),required:V(T())}),Oe=d({...k.shape,...v.shape,description:V(a()),arguments:V(g(Ie)),_meta:V(K({}))}),Z=y.extend({method:p("notifications/prompts/list_changed"),params:S.optional()}),se=d({type:p("text"),text:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),J=d({type:p("image"),data:c,mimeType:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),ke=d({type:p("audio"),data:c,mimeType:a(),annotations:D.optional(),_meta:E(a(),L()).optional()}),ht=d({type:p("tool_use"),name:a(),id:a(),input:E(a(),L()),_meta:E(a(),L()).optional()}),I=d({type:p("resource"),resource:C([te,fe]),annotations:D.optional(),_meta:E(a(),L()).optional()}),A=ne.extend({type:p("resource_link")}),B=C([se,J,ke,A,I]),X=d({role:i,content:B}),ve=d({title:a().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),_e=y.extend({method:p("notifications/tools/list_changed"),params:S.optional()}),Pe=d({name:a().optional()}),Le=d({hints:g(Pe).optional(),costPriority:w().min(0).max(1).optional(),speedPriority:w().min(0).max(1).optional(),intelligencePriority:w().min(0).max(1).optional()}),ye=d({mode:ae(["auto","required","none"]).optional()}),ze=d({type:p("boolean"),title:a().optional(),description:a().optional(),default:T().optional()}),P=d({type:p("string"),title:a().optional(),description:a().optional(),minLength:w().optional(),maxLength:w().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:a().optional()}),We=d({type:ae(["number","integer"]),title:a().optional(),description:a().optional(),minimum:w().optional(),maximum:w().optional(),default:w().optional()}),j=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),N=d({type:p("string"),title:a().optional(),description:a().optional(),oneOf:g(d({const:a(),title:a()})),default:a().optional()}),G=d({type:p("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),O=C([j,N]),x=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({type:p("string"),enum:g(a())}),default:g(a()).optional()}),Y=d({type:p("array"),title:a().optional(),description:a().optional(),minItems:w().optional(),maxItems:w().optional(),items:d({anyOf:g(d({const:a(),title:a()}))}),default:g(a()).optional()}),W=C([x,Y]),ge=C([G,O,W]),zt=C([ge,ze,P,We]),mt=f.extend({mode:p("form").optional(),message:a(),requestedSchema:d({type:p("object"),properties:E(a(),zt),required:g(a()).optional()}).catchall(L())}),Re=d({type:p("ref/resource"),uri:a()}),ue=d({type:p("ref/prompt"),name:a()}),ce=d({uri:a().startsWith("file://"),name:a().optional(),_meta:E(a(),L()).optional()}),he=pe.shape,ie=d({experimental:he.experimental,sampling:he.sampling,elicitation:he.elicitation,roots:he.roots,extensions:he.extensions}),ee=we.shape,Me=d({experimental:ee.experimental,logging:ee.logging,completions:ee.completions,prompts:ee.prompts,resources:ee.resources,tools:ee.tools,extensions:ee.extensions}),Ee=K({progressToken:o.optional(),[_o]:a(),[Jo]:U.optional(),[yo]:ie,[Go]:s.optional()}),Je=d({...k.shape,...v.shape,description:a().optional(),inputSchema:K({$schema:a().optional(),type:p("object")}),outputSchema:K({$schema:a().optional()}).optional(),annotations:ve.optional(),_meta:E(a(),L()).optional()}),it=d({type:p("tool_result"),toolUseId:a(),content:g(B),structuredContent:L().optional(),isError:T().optional(),_meta:E(a(),L()).optional()}),Ue=C([se,J,ke,ht,it]),Xe=d({role:i,content:C([Ue,g(Ue)]),_meta:E(a(),L()).optional()}),Zt=a(),Ht=K({[Pt]:U.optional().catch(void 0)}),Mo=Ht.optional();function rt(Ge){return K({_meta:Mo,resultType:Zt.default("complete"),...Ge})}let Pr=rt({}),mi=rt({nextCursor:r.optional()}),Ao=rt({content:g(B),structuredContent:L().optional(),isError:T().optional()}),Er=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),tools:g(Je),nextCursor:r.optional()}),kr=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),prompts:g(Oe),nextCursor:r.optional()}),Tr=rt({description:a().optional(),messages:g(X)}),$r=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resources:g(ne),nextCursor:r.optional()}),Cr=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resourceTemplates:g(be),nextCursor:r.optional()}),Ir=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),contents:g(C([te,fe]))}),Or=rt({completion:d({values:g(a()).max(100),total:w().int().optional(),hasMore:T().optional()}).loose()}),fi=rt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"])}),Mr=rt({ttlMs:w().int().min(0).catch(0),cacheScope:ae(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Me,instructions:a().optional()}),Ft=d({messages:g(Xe),modelPreferences:Le.optional(),systemPrompt:a().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:w().optional(),maxTokens:w().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Je).optional(),toolChoice:ye.optional()}),Ar=d({method:p("sampling/createMessage"),params:Ft}),Nr=d({method:p("roots/list"),params:d({_meta:E(a(),L()).optional()}).optional()}),qr=d({...Xe.shape,model:a(),stopReason:a().optional()}),jr=d({roots:g(ce)}),Lr=d({action:ae(["accept","decline","cancel"]),content:E(a(),C([a(),w(),T(),g(a())])).optional()}),Ur=d({mode:p("url"),message:a(),url:a().url()}),Dr=C([mt,Ur]),Zr=d({method:p("elicitation/create"),params:Dr}),Hr=C([Ar,Nr,Zr]),Fr=C([qr,jr,Lr]),Vr=E(a(),Hr),Jr=E(a(),Fr),ao=rt({inputRequests:Vr.optional(),requestState:a().optional()}),co={inputResponses:Jr.optional(),requestState:a().optional()},gi=d({_meta:Ee,...co}),Si=K({progressToken:o.optional()});function ft(Ge,uo){return d({method:p(Ge),params:d({_meta:Ee,...uo})})}function gt(Ge,uo){return d({method:p(Ge),params:d({_meta:Si.optional(),...uo}).optional()})}let Br={name:a(),arguments:E(a(),L()).optional(),...co},_t={cursor:r.optional()},_i=ft("tools/call",Br),yi=ft("tools/list",_t),bi=ft("prompts/list",_t),vi=ft("prompts/get",{name:a(),arguments:E(a(),a()).optional(),...co}),wi=ft("resources/list",_t),zi=ft("resources/templates/list",_t),Ri=ft("resources/read",{uri:a(),...co}),Gr={ref:C([ue,Re]),argument:d({name:a(),value:a()}),context:d({arguments:E(a(),a()).optional()}).optional()},xi=ft("completion/complete",Gr),Pi=ft("server/discover",{}),No=d({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:g(a()).optional()}),Wr={notifications:No},Ei=ft("subscriptions/listen",Wr),ki=Ht.extend({"io.modelcontextprotocol/subscriptionId":n}),Kr=K({_meta:ki,resultType:Zt.default("complete")}),Vt={"tools/call":gt("tools/call",Br),"tools/list":gt("tools/list",_t),"prompts/get":gt("prompts/get",{name:a(),arguments:E(a(),a()).optional()}),"prompts/list":gt("prompts/list",_t),"resources/list":gt("resources/list",_t),"resources/templates/list":gt("resources/templates/list",_t),"resources/read":gt("resources/read",{uri:a()}),"completion/complete":gt("completion/complete",Gr),"server/discover":gt("server/discover",{}),"subscriptions/listen":gt("subscriptions/listen",Wr)};function dt(Ge){return K({_meta:Mo,...Ge})}let Ti={"tools/call":dt({content:g(B),structuredContent:L().optional(),isError:T().optional()}),"tools/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),tools:g(Je),nextCursor:r.optional()}),"prompts/get":dt({description:a().optional(),messages:g(X)}),"prompts/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),prompts:g(Oe),nextCursor:r.optional()}),"resources/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resources:g(ne),nextCursor:r.optional()}),"resources/templates/list":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),resourceTemplates:g(be),nextCursor:r.optional()}),"resources/read":dt({ttlMs:w().int().min(0),cacheScope:ae(["public","private"]),contents:g(C([te,fe]))}),"completion/complete":dt({completion:d({values:g(a()).max(100),total:w().int().optional(),hasMore:T().optional()}).loose()}),"server/discover":dt({ttlMs:w().int().min(0).catch(0),cacheScope:ae(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Me,instructions:a().optional()}),"subscriptions/listen":dt({})},lo=K({"io.modelcontextprotocol/subscriptionId":n.optional()}),qo=d({method:p("notifications/subscriptions/acknowledged"),params:d({_meta:lo.optional(),notifications:No})}),jo=d({_meta:lo.optional(),requestId:n,reason:a().optional()}),Lo=d({method:p("notifications/cancelled"),params:jo}),Ua={"notifications/cancelled":Lo,"notifications/progress":Ve,"notifications/message":ot,"notifications/resources/updated":je,"notifications/resources/list_changed":re,"notifications/tools/list_changed":_e,"notifications/prompts/list_changed":Z,"notifications/subscriptions/acknowledged":qo},at=(Ge)=>d({jsonrpc:p("2.0"),id:C([a(),w().int()]),result:Ge}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:s,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:h,BaseRequestParamsSchema:m,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:S,NotificationSchema:y,IconSchema:b,IconsSchema:v,BaseMetadataSchema:k,ImplementationSchema:U,ClientTasksCapabilitySchema:M,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:pe,ServerCapabilitiesSchema:we,ProgressSchema:de,ProgressNotificationParamsSchema:Ne,ProgressNotificationSchema:Ve,LoggingMessageNotificationParamsSchema:Be,LoggingMessageNotificationSchema:ot,ResourceContentsSchema:Qe,TextResourceContentsSchema:te,BlobResourceContentsSchema:fe,AnnotationsSchema:D,ResourceSchema:ne,ResourceTemplateSchema:be,ResourceListChangedNotificationSchema:re,ResourceUpdatedNotificationParamsSchema:le,ResourceUpdatedNotificationSchema:je,PromptArgumentSchema:Ie,PromptSchema:Oe,PromptListChangedNotificationSchema:Z,TextContentSchema:se,ImageContentSchema:J,AudioContentSchema:ke,ToolUseContentSchema:ht,EmbeddedResourceSchema:I,ResourceLinkSchema:A,ContentBlockSchema:B,PromptMessageSchema:X,ToolAnnotationsSchema:ve,ToolListChangedNotificationSchema:_e,ModelHintSchema:Pe,ModelPreferencesSchema:Le,ToolChoiceSchema:ye,BooleanSchemaSchema:ze,StringSchemaSchema:P,NumberSchemaSchema:We,UntitledSingleSelectEnumSchemaSchema:j,TitledSingleSelectEnumSchemaSchema:N,LegacyTitledEnumSchemaSchema:G,SingleSelectEnumSchemaSchema:O,UntitledMultiSelectEnumSchemaSchema:x,TitledMultiSelectEnumSchemaSchema:Y,MultiSelectEnumSchemaSchema:W,EnumSchemaSchema:ge,PrimitiveSchemaDefinitionSchema:zt,ElicitRequestFormParamsSchema:mt,ResourceTemplateReferenceSchema:Re,PromptReferenceSchema:ue,RootSchema:ce,ClientCapabilities2026Schema:ie,ServerCapabilities2026Schema:Me,RequestMetaEnvelopeSchema:Ee,ToolSchema:Je,ToolResultContentSchema:it,SamplingMessageContentBlockSchema:Ue,SamplingMessageSchema:Xe,ResultTypeSchema:Zt,ResultMetaSchema:Ht,ResultSchema:Pr,PaginatedResultSchema:mi,CallToolResultSchema:Ao,ListToolsResultSchema:Er,ListPromptsResultSchema:kr,GetPromptResultSchema:Tr,ListResourcesResultSchema:$r,ListResourceTemplatesResultSchema:Cr,ReadResourceResultSchema:Ir,CompleteResultSchema:Or,CacheableResultSchema:fi,DiscoverResultSchema:Mr,CreateMessageRequestParamsSchema:Ft,CreateMessageRequestSchema:Ar,ListRootsRequestSchema:Nr,CreateMessageResultSchema:qr,ListRootsResultSchema:jr,ElicitResultSchema:Lr,ElicitRequestURLParamsSchema:Ur,ElicitRequestParamsSchema:Dr,ElicitRequestSchema:Zr,InputRequestSchema:Hr,InputResponseSchema:Fr,InputRequestsSchema:Vr,InputResponsesSchema:Jr,InputRequiredResultSchema:ao,InputResponseRequestParamsSchema:gi,CallToolRequestSchema:_i,ListToolsRequestSchema:yi,ListPromptsRequestSchema:bi,GetPromptRequestSchema:vi,ListResourcesRequestSchema:wi,ListResourceTemplatesRequestSchema:zi,ReadResourceRequestSchema:Ri,CompleteRequestSchema:xi,DiscoverRequestSchema:Pi,SubscriptionFilterSchema:No,SubscriptionsListenRequestSchema:Ei,SubscriptionsListenResultMetaSchema:ki,SubscriptionsListenResultSchema:Kr,dispatchRequestSchemas:Vt,dispatchResultSchemas:Ti,NotificationMetaSchema:lo,SubscriptionsAcknowledgedNotificationSchema:qo,CancelledNotificationParamsSchema:jo,CancelledNotificationSchema:Lo,notificationSchemas2026:Ua,JSONRPCResultResponseSchema:at(Pr),CallToolResultResponseSchema:at(C([Ao,ao])),ListToolsResultResponseSchema:at(Er),ListPromptsResultResponseSchema:at(kr),GetPromptResultResponseSchema:at(C([Tr,ao])),ListResourcesResultResponseSchema:at($r),ListResourceTemplatesResultResponseSchema:at(Cr),ReadResourceResultResponseSchema:at(C([Ir,ao])),CompleteResultResponseSchema:at(Or),DiscoverResultResponseSchema:at(Mr),SubscriptionsListenResultResponseSchema:at(Kr)}}var wS;function ro(){return wS??=vS()}var zS=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function RS(e){return zS.includes(e)}var ml=Symbol("modelcontextprotocol.resultCacheHintFallback");function xS(e){return e[ml]}function Sm(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function _m(e){return e==="public"||e==="private"}var Q=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),xe=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return pt(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",no(this,new.target)}static fromError(t,o,r){if(t===Q.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new bm(n.elicitations,o)}if(t===Q.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new ii({supported:n.supported,requested:n.requested},o)}if(t===Q.InvalidParams||t===Q.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===Q.ResourceNotFound||Object.keys(n).length===1))return new ym(n.uri,o)}if(t===Q.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new vm({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},ym=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},bm=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ii=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},vm=class extends xe{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},PS=0,ES="private",kS=["tools/call","prompts/get","resources/read"];function TS(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(kS.includes(e))return t;throw new xe(Q.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function $S(e,t){let o=xS(t);if(t.resultType!=="complete"||!RS(e))return o===void 0?t:AS(t);let r=t,n=Sm(r.ttlMs)?r.ttlMs:OS(o),i=_m(r.cacheScope)?r.cacheScope:MS(o),s={...r,ttlMs:n,cacheScope:i};return delete s[ml],s}function CS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function IS(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[Pt]:t}};if(!CS(o))return e;if(o[Pt]!==void 0)return e;return{...e,_meta:{...o,[Pt]:t}}}function OS(e){return e!==void 0&&Sm(e.ttlMs)?e.ttlMs:PS}function MS(e){return e!==void 0&&_m(e.cacheScope)?e.cacheScope:ES}function AS(e){let t={...e};return delete t[ml],t}var NS=["elicitation/create","sampling/createMessage","roots/list"],Ta;function wm(){if(Ta)return Ta;let e=ro();return Ta={request:{"elicitation/create":d({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":d({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":d({method:p("roots/list"),params:K({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ta}function zm(e){return NS.includes(e)}function tl(e){return zm(e)?wm().request[e]:void 0}function qS(e){return zm(e)?wm().response[e]:void 0}var fl={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Rm={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function xm(e){return Object.prototype.hasOwnProperty.call(fl,e)}function Pm(e){return Object.prototype.hasOwnProperty.call(Rm,e)}function jS(e){return Object.prototype.hasOwnProperty.call(fl,e)}function LS(e){return xm(e)?ro().dispatchRequestSchemas[e]:void 0}function US(e){return jS(e)?ro().dispatchResultSchemas[e]:void 0}function DS(e){return Pm(e)?ro().notificationSchemas2026[e]:void 0}var iz=Object.keys(fl),az=Object.keys(Rm);function ti(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Xs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var ZS={ok:!1,reason:"not-in-era"},HS=[_o,yo];function FS(e,t){let o=t,r=!1,n=()=>{if(!r)o={...o},r=!0;return o},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((c)=>ti(c)&&("execution"in c)))n().tools=i.map((c)=>{if(!ti(c)||!("execution"in c))return c;let l={...c};return delete l.execution,l});let s=t.capabilities;if(ti(s)&&"tasks"in s){let c={...s};delete c.tasks,n().capabilities=c}return o}var gl={era:"2026-07-28",hasRequestMethod:xm,hasNotificationMethod:Pm,hasInputRequestMethod:(e)=>tl(e)!==void 0,validateRequest:(e,t)=>Xs(LS(e),t),validateResult:(e,t)=>Xs(US(e),t),validateNotification:(e,t)=>Xs(DS(e),t),validateInputRequest:(e,t)=>Xs(tl(e),t),validateInputResponse:(e,t)=>Xs(qS(e),t),samplingResultVariant:()=>ZS,outboundEnvelope(e){return{[_o]:e.protocolVersion,[Jo]:e.clientInfo,[yo]:e.clientCapabilities,...e.logLevel!==void 0&&{[Go]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of HS)if(!(r in e))t.push({key:r,problem:"missing"});let o=ro().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let r of o.error.issues){let n=r.path.map(String),i=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((s)=>s.key===i&&s.problem==="missing"))continue;t.push({key:i,problem:r.message})}return t},projectCallToolResult:(e)=>lm(e),inputRequestSchema:tl,decodeResult(e,t){if(!ti(t))return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof o!=="string")return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let s=t.inputRequests,c=ti(s)?s:{},l=t.requestState,u=t._meta===void 0?void 0:ro().ResultMetaSchema.safeParse(t._meta),h=u?.success?u.data:void 0;if(Object.keys(c).length===0&&typeof l!=="string")return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:c,...typeof l==="string"&&{requestState:l},...h!==void 0&&{_meta:h}}}if(o!=="complete")return{kind:"invalid",error:new q(F.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=VS(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let s=n.safeParse(t);if(!s.success)return{kind:"invalid",error:new q(F.InvalidResult,`Invalid result for ${e}: ${s.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,o){return IS($S(e,TS(e,FS(e,t))),o)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=ro().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((o)=>o.message).join("; ")}`}},$a;function VS(){if($a)return $a;let e=ro();return $a={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},$a}var Oa="2026-07-28";function Lt(e){return e!==void 0&&Ut(e)?gl:hl}function Xh(e){if(e.revision!==void 0)return Lt(e.revision).era;return e.era==="modern"?gl.era:hl.era}function ol(e){return Em.some((t)=>t.hasRequestMethod(e))}function rl(e){return Em.some((t)=>t.hasNotificationMethod(e))}function em(e){return e==="tasks/get"||e==="tasks/cancel"}var Em=[hl,gl],JS=ql({AnnotationsSchema:()=>kt,AudioContentSchema:()=>Eo,BaseMetadataSchema:()=>xt,BaseRequestParamsSchema:()=>Ke,BlobResourceContentsSchema:()=>ar,BooleanSchemaSchema:()=>dr,CallToolRequestParamsSchema:()=>cs,CallToolRequestSchema:()=>ls,CallToolResultSchema:()=>oo,CancelTaskRequestSchema:()=>Sa,CancelTaskResultSchema:()=>_a,CancelledNotificationParamsSchema:()=>gn,CancelledNotificationSchema:()=>tr,ClientCapabilitiesSchema:()=>_n,ClientNotificationSchema:()=>ba,ClientRequestSchema:()=>ya,ClientResultSchema:()=>va,ClientTasksCapabilitySchema:()=>sa,CompatibilityCallToolResultSchema:()=>aa,CompleteRequestParamsSchema:()=>qs,CompleteRequestSchema:()=>js,CompleteResultSchema:()=>Ls,ContentBlockSchema:()=>Tt,CreateMessageRequestParamsSchema:()=>ws,CreateMessageRequestSchema:()=>zs,CreateMessageResultSchema:()=>Rs,CreateMessageResultWithToolsSchema:()=>xs,CreateTaskResultSchema:()=>la,CursorSchema:()=>Ko,DiscoverRequestSchema:()=>zn,DiscoverResultSchema:()=>eo,ElicitRequestFormParamsSchema:()=>Io,ElicitRequestParamsSchema:()=>$s,ElicitRequestSchema:()=>Cs,ElicitRequestURLParamsSchema:()=>Ts,ElicitResultSchema:()=>Ms,ElicitationCompleteNotificationParamsSchema:()=>Is,ElicitationCompleteNotificationSchema:()=>Os,EmbeddedResourceSchema:()=>ko,EmptyResultSchema:()=>Xt,EnumSchemaSchema:()=>ks,GetPromptRequestParamsSchema:()=>Qn,GetPromptRequestSchema:()=>Xn,GetPromptResultSchema:()=>os,GetTaskPayloadRequestSchema:()=>ha,GetTaskPayloadResultSchema:()=>ma,GetTaskRequestSchema:()=>da,GetTaskResultSchema:()=>pa,IconSchema:()=>Sn,IconsSchema:()=>Mt,ImageContentSchema:()=>Po,ImplementationSchema:()=>Et,InitializeRequestParamsSchema:()=>yn,InitializeRequestSchema:()=>bn,InitializeResultSchema:()=>vn,InitializedNotificationSchema:()=>wn,JSONArraySchema:()=>ra,JSONObjectSchema:()=>De,JSONRPCErrorResponseSchema:()=>wo,JSONRPCMessageSchema:()=>zo,JSONRPCNotificationSchema:()=>er,JSONRPCRequestSchema:()=>Xo,JSONRPCResponseSchema:()=>na,JSONRPCResultResponseSchema:()=>vo,JSONValueSchema:()=>Ot,LegacyTitledEnumSchemaSchema:()=>mr,ListChangedOptionsBaseSchema:()=>ds,ListPromptsRequestSchema:()=>Kn,ListPromptsResultSchema:()=>Yn,ListResourceTemplatesRequestSchema:()=>$n,ListResourceTemplatesResultSchema:()=>Cn,ListResourcesRequestSchema:()=>kn,ListResourcesResultSchema:()=>Tn,ListRootsRequestSchema:()=>Ds,ListRootsResultSchema:()=>Zs,ListTasksRequestSchema:()=>fa,ListTasksResultSchema:()=>ga,ListToolsRequestSchema:()=>is,ListToolsResultSchema:()=>as,LoggingLevelSchema:()=>ur,LoggingMessageNotificationParamsSchema:()=>ms,LoggingMessageNotificationSchema:()=>fs,ModelHintSchema:()=>gs,ModelPreferencesSchema:()=>Ss,MultiSelectEnumSchemaSchema:()=>Es,NotificationSchema:()=>tt,NotificationsParamsSchema:()=>st,NumberSchemaSchema:()=>Co,PaginatedRequestParamsSchema:()=>Pn,PaginatedRequestSchema:()=>At,PaginatedResultSchema:()=>Nt,PingRequestSchema:()=>rr,PrimitiveSchemaDefinitionSchema:()=>Sr,ProgressNotificationParamsSchema:()=>xn,ProgressNotificationSchema:()=>nr,ProgressSchema:()=>Rn,ProgressTokenSchema:()=>Wo,PromptArgumentSchema:()=>Gn,PromptListChangedNotificationSchema:()=>rs,PromptMessageSchema:()=>ts,PromptReferenceSchema:()=>Ns,PromptSchema:()=>Wn,ReadResourceRequestParamsSchema:()=>In,ReadResourceRequestSchema:()=>On,ReadResourceResultSchema:()=>Mn,RelatedTaskMetadataSchema:()=>fn,RequestIdSchema:()=>vt,RequestMetaSchema:()=>Yo,RequestSchema:()=>Ze,ResourceContentsSchema:()=>sr,ResourceLinkSchema:()=>To,ResourceListChangedNotificationSchema:()=>An,ResourceRequestParamsSchema:()=>Ro,ResourceSchema:()=>cr,ResourceTemplateReferenceSchema:()=>As,ResourceTemplateSchema:()=>En,ResourceUpdatedNotificationParamsSchema:()=>Jn,ResourceUpdatedNotificationSchema:()=>Bn,ResultMetaObjectSchema:()=>Qo,ResultSchema:()=>He,RoleSchema:()=>qt,RootSchema:()=>Us,RootsListChangedNotificationSchema:()=>Hs,SamplingContentSchema:()=>bs,SamplingMessageContentBlockSchema:()=>Yt,SamplingMessageSchema:()=>vs,ServerCapabilitiesSchema:()=>or,ServerNotificationSchema:()=>za,ServerRequestSchema:()=>wa,ServerResultSchema:()=>Ra,ServerTasksCapabilitySchema:()=>ia,SetLevelRequestParamsSchema:()=>ps,SetLevelRequestSchema:()=>hs,SingleSelectEnumSchemaSchema:()=>Ps,StringSchemaSchema:()=>$o,SubscribeRequestParamsSchema:()=>Nn,SubscribeRequestSchema:()=>qn,SubscriptionFilterSchema:()=>lr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Zn,SubscriptionsAcknowledgedNotificationSchema:()=>Hn,SubscriptionsListenRequestParamsSchema:()=>Un,SubscriptionsListenRequestSchema:()=>Dn,SubscriptionsListenResultMetaSchema:()=>Fn,SubscriptionsListenResultSchema:()=>Vn,TaskAugmentedRequestParamsSchema:()=>Qt,TaskCreationParamsSchema:()=>ca,TaskMetadataSchema:()=>mn,TaskSchema:()=>jt,TaskStatusNotificationParamsSchema:()=>Vs,TaskStatusNotificationSchema:()=>ua,TaskStatusSchema:()=>Fs,TextContentSchema:()=>xo,TextResourceContentsSchema:()=>ir,TitledMultiSelectEnumSchemaSchema:()=>gr,TitledSingleSelectEnumSchemaSchema:()=>hr,ToolAnnotationsSchema:()=>ns,ToolChoiceSchema:()=>_s,ToolExecutionSchema:()=>ss,ToolListChangedNotificationSchema:()=>us,ToolResultContentSchema:()=>ys,ToolSchema:()=>to,ToolUseContentSchema:()=>es,UnsubscribeRequestParamsSchema:()=>jn,UnsubscribeRequestSchema:()=>Ln,UntitledMultiSelectEnumSchemaSchema:()=>fr,UntitledSingleSelectEnumSchemaSchema:()=>pr});var Ma=(e)=>Xo.safeParse(e).success,km=(e)=>er.safeParse(e).success,wr=(e)=>vo.safeParse(e).success,ai=(e)=>wo.safeParse(e).success;var Tm=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var BS="Mcp-Param-",tm="x-mcp-header",GS=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,WS=new Set(["string","integer","boolean"]);function Sl(e){let t=[],o=new Map,r,n=(s,c,l)=>{if(s===null||typeof s!=="object")return;let u=s;if(tm in u){if(!l||c.length===0)return`${Ca(c)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let m=u[tm];if(typeof m!=="string"||m.length===0)return`${Ca(c)}: x-mcp-header MUST be a non-empty string`;if(!GS.test(m))return`${Ca(c)}: x-mcp-header '${m}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let f=typeof u.type==="string"?u.type:void 0;if(f===void 0||!WS.has(f)){let b=`${Ca(c)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${f??"<none>"}`;if(f!=="number")return b;r??=b}let S=m.toLowerCase(),y=o.get(S);if(y!==void 0)return`x-mcp-header '${m}' is not case-insensitively unique (also declared as '${y}')`;o.set(S,m),t.push({path:c,headerName:m,type:f})}let h=u.properties;if(h!==null&&typeof h==="object")for(let[m,f]of Object.entries(h)){let S=n(f,[...c,m],l);if(S!==void 0)return S}for(let m of KS){let f=u[m];if(f===void 0)continue;let S=Array.isArray(f)?f:f!==null&&typeof f==="object"&&YS.has(m)?Object.values(f):[f];for(let y of S){let b=n(y,[...c,`<${m}>`],!1);if(b!==void 0)return b}}},i=n(e,[],!0);if(i!==void 0)return{valid:!1,reason:r??i};return r===void 0?{valid:!0,declarations:t}:{valid:!1,reason:r,declarations:t}}var KS=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],YS=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ca(e){return e.length===0?"<root>":e.join(".")}var $m="=?base64?",Cm="?=";function QS(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function XS(e){if(e.length===0)return!0;if(e.startsWith($m)&&e.endsWith(Cm))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let o=e.codePointAt(t);if(o===9||o>=32&&o<=126)continue;return!0}return!1}function e_(e){let t=new TextEncoder().encode(e),o="";for(let r of t)o+=String.fromCodePoint(r);return btoa(o)}function Im(e){return XS(e)?`${$m}${e_(e)}${Cm}`:e}function t_(e,t){let o=e;for(let r of t){if(o===null||typeof o!=="object")return;o=o[r]}return o}function Om(e,t){let o={};for(let r of e){let n=t_(t,r.path);if(n===void 0||n===null)continue;let i=QS(n);if(i===void 0)continue;o[`${BS}${r.headerName}`]=Im(i)}return o}var vr=-32020,cz=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Q.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[vr,Q.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Q.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Q.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Q.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[vr],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Q.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[vr],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],lz={[Q.ParseError]:400,[Q.InvalidRequest]:400,[Q.MethodNotFound]:404,[Q.UnsupportedProtocolVersion]:400,[Q.MissingRequiredClientCapability]:400,[vr]:400};function Aa(e,t){return Ki(e,t)}function ei(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function al(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var om=!1,cl="draft-2020-12";function o_(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:cl});else if(o.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!om)om=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");r=Gi(e,{target:cl,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(r.type!==void 0)return r;return Mm(r)?{type:"object",...r}:r}if(r.type!==void 0&&r.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}var r_=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function Mm(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let o=typeof e.$ref==="string"&&r_.exec(e.$ref);if(o&&t[o[1]]?.[o[2]]?.type==="object")return!0;for(let r of["oneOf","anyOf","allOf"]){let n=e[r];if(Array.isArray(n)&&n.length>0)return n.every((i)=>i!==null&&typeof i==="object"&&(i.type==="object"||Mm(i,"$id"in i?{}:t)))}return!1}function n_(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function nl(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>n_(r)).join(", ")};return{success:!0,data:o.value}}function s_(e){let t=Gi(e,{target:cl,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var i_=/\\\.\\d\{(\d+)\}/;function a_(e){let t=i_.exec(e),o=[void 0,-1,0];if(t)o.push(Number(t[1]));return[!1,!0].flatMap((r)=>[!1,!0].flatMap((n)=>o.map((i)=>Fo({local:r,offset:n,precision:i}))))}function c_(e,t){let o;switch(e){case"email":o=[Eh()];break;case"uri":o=[Qi()];break;case"date":o=[Gc()];break;case"date-time":o=a_(t);break}return new Set(o.map((r)=>s_(r)).filter((r)=>r!==void 0))}function l_(e,t,o){if(o!=="zod")return!0;return c_(e,t).has(t)}function ri(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function u_(e){try{return o_(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new xe(Q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var d_=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function _l(e){return d_.has(e)||e.startsWith("x-")}var p_=new Set(["$schema",...Object.keys(Io.shape.requestedSchema.shape)]),rm={string:ei([$o,pr,hr,mr]),number:ei([Co]),integer:ei([Co]),boolean:ei([dr]),array:ei([fr,gr])},h_=new Set($o.shape.format.unwrap().options);function m_(e,t,o,r){if(!ri(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(rm,e.type)?rm[e.type]:void 0;if(n===void 0)return e;let i={};for(let[s,c]of Object.entries(e))if(n.has(s)||_l(s))i[s]=c;else if(s==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!h_.has(e.format))i[s]=c;else if(typeof c!=="string"||!l_(e.format,c,o))r.push(`${t}.${s}`)}else r.push(`${t}.${s}`);return i}function f_(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&ri(i))o[n]=Object.fromEntries(Object.entries(i).map(([s,c])=>[s,m_(c,`properties.${s}`,t,r)]));else if(p_.has(n))o[n]=i;else if(!_l(n))r.push(n);if(r.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function g_(e,t){if(!ri(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!Aa(Sr,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function ll(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>ll(r,t[n],`${o}[${n}]`));if(!ri(e)||!ri(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return _l(r)?[]:[i];return ll(n,t[r],i)})}function S_(e){if(!al(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=f_(u_(e.requestedSchema),t),r=Aa(Io.shape.requestedSchema,o);if(!r.success)throw new xe(Q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${g_(o,r.error.message)}`);let n=ll(o,r.data);if(n.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let i=(r.data.required??[]).filter((s)=>!Object.prototype.hasOwnProperty.call(r.data.properties,s));if(i.length>0)throw new xe(Q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function __(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,o=typeof e.requestState==="string";if(!t&&!o)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var uz=Object.assign(__,{elicit(e){try{return{method:"elicitation/create",params:S_(e)}}catch(t){throw t instanceof xe?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var y_=!0,b_=10,v_=250;function Am(e){return{autoFulfill:e?.autoFulfill??y_,maxRounds:e?.maxRounds??b_}}function w_(e,t,o){let r=t!==void 0&&Object.keys(t).length>0;if(!r&&o===void 0)return e;return{...e,...r&&{inputResponses:t},...o!==void 0&&{requestState:o}}}function z_(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function R_(e,t){return new Promise((o,r)=>{if(t?.aborted){r(t.reason instanceof q?t.reason:new q(F.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",i),o()},e),i=()=>{clearTimeout(n),r(t?.reason instanceof q?t.reason:new q(F.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function x_(e){let t=new AbortController,o=()=>t.abort(e?.reason);if(e?.addEventListener("abort",o,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(r)=>t.abort(r),dispose:()=>e?.removeEventListener("abort",o)}}async function P_(e){let{config:t,method:o,originalParams:r,requestOptions:n,hooks:i,signal:s}=e,c=e.flowStartedAt??Date.now(),l=e.firstPayload,u=0;while(!0){if(u+=1,u>t.maxRounds)throw new q(F.InputRequiredRoundsExceeded,z_(o,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:l.inputRequests,...l.requestState!==void 0&&{requestState:l.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${o}' (round ${u})`});let h=Object.entries(l.inputRequests??{}),m;if(h.length>0){let y=x_(s);try{let b=await Promise.all(h.map(async([v,k])=>{try{return[v,await i.dispatchInputRequest(v,k,y.signal)]}catch(U){throw y.abort(U),U}}));m=Object.fromEntries(b)}finally{y.dispose()}}else await R_(v_,s);let f={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let y=Date.now()-c,b=n.maxTotalTimeout-y;if(b<=0)throw new q(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:y});f.maxTotalTimeout=b}let S=await i.retry(w_(r,m,l.requestState),f);if(Tm(S)){l={inputRequests:S.inputRequests??{},...S.requestState!==void 0&&{requestState:S.requestState}};continue}return S}}var E_=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],k_={IdJagTokenExchangeResponseSchema:Ws,OAuthClientInformationFullSchema:Qs,OAuthClientInformationSchema:Ys,OAuthClientMetadataSchema:Ks,OAuthClientRegistrationErrorSchema:xa,OAuthErrorResponseSchema:br,OAuthMetadataSchema:_r,OAuthProtectedResourceMetadataSchema:Js,OAuthTokenRevocationRequestSchema:Pa,OAuthTokensSchema:yr,OpenIdProviderDiscoveryMetadataSchema:Gs,OpenIdProviderMetadataSchema:Bs},Nm={},qm={};function jm(e,t){let o=e.slice(0,-6);Nm[o]=t,qm[o]=(r)=>t.safeParse(r).success}for(let e of E_)jm(e,JS[e]);for(let[e,t]of Object.entries(k_))jm(e,t);var T_=Object.freeze(Nm),yl=Object.freeze(qm);function $_(e){switch(e){case"initialize":case"notifications/initialized":return Lt(void 0);case"server/discover":return Lt(Oa);default:return}}var ci=60000,C_=[_o,Jo,yo,Go],I_=["inputResponses","requestState"];function nm(e,t){let o=e.params;if(!oi(o))return{message:e,lifted:{}};let r=o._meta,n=oi(r)?C_.filter((l)=>(l in r)):[],i=t==="request"?I_.filter((l)=>(l in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let s={},c={...o};if(n.length>0&&oi(r)){let l={},u={...r};for(let h of n)l[h]=r[h],delete u[h];if(s.envelope=l,Object.keys(u).length>0)c._meta=u;else delete c._meta}for(let l of i){if(l==="inputResponses")s.inputResponses=c[l];if(l==="requestState")s.requestState=c[l];delete c[l]}return{message:{...e,params:c},lifted:s}}function sm(e,t){let o=e.validateResult(t,void 0);if(!o.ok&&o.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let n=e.validateResult(t,r);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function bl(e){return()=>e}var O_=bl(void 0),M_,li=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{M_=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ta,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new q(F.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let o=Date.now()-t.startTime;if(t.maxTotalTimeout&&o>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new q(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:o});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=(n)=>{o?.(n),this._onerror(n)};let r=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(r?.(n,i),wr(n)||ai(n))this._onresponse(n);else if(Ma(n))this._onrequest(n,i);else if(km(n))this._onnotification(n,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new q(F.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of e.values())r(o);for(let r of t.values())r.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=nm(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let s=Xh(t.classification);if(s!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${s} but this instance serves ${r.era}`));return}}if(rl(o.method)&&!r.hasNotificationMethod(o.method))return;let n=this._notificationHandlers.get(o.method),i=this.fallbackNotificationHandler;if(n===void 0&&i===void 0)return;Promise.resolve().then(()=>n===void 0?i(o):n(o,r)).catch((s)=>this._onerror(Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){let{message:o,lifted:r}=nm(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,s=(b,v,k)=>{let U={jsonrpc:"2.0",id:o.id,error:{code:b,message:v,...k!==void 0&&{data:k}}};i?.send(U).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)))};if(t?.classification!==void 0){let b=Xh(t.classification);if(b!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${b} but this instance serves ${n.era}`));let v=t.classification.revision??b;s(Q.UnsupportedProtocolVersion,`Unsupported protocol version: ${v}`,{supported:this._supportedProtocolVersions,requested:v});return}}if(ol(o.method)&&!n.hasRequestMethod(o.method)&&!(em(o.method)&&this._customSchemaRequestMethods.has(o.method))){s(Q.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){s(Q.MethodNotFound,"Method not found");return}let l=n.checkInboundEnvelope(r);if(l!==void 0){s(Q.InvalidParams,l);return}let u=(b,v)=>this._notificationViaCodec(this._resolveOutboundCodec(b.method),b,{...v,relatedRequestId:o.id}),h=(b,v,k)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(b.method),b,v,{...k,relatedRequestId:o.id}),m=new AbortController;this._requestHandlerAbortControllers.set(o.id,m);let f=r.inputResponses===void 0?void 0:A_(r.inputResponses),S={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?O_:bl(r.requestState),signal:m.signal,send:(b,v,k)=>{let U=this._resolveOutboundCodec(b.method);if(this._assertOutboundRequestInEra(U,b.method),al(v))return h(b,v,k);let z=sm(U,b.method);if(z===void 0)throw TypeError(`'${b.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return h(b,z,v)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},y=this.buildContext(S,t);Promise.resolve().then(()=>c(o,y)).then(async(b)=>{if(m.signal.aborted)return;let v;try{v=n.encodeResult(o.method,b,this._outboundServerInfo())}catch(U){this._onerror(Error(`Failed to encode result for ${o.method}: ${U}`)),s(Q.InternalError,"Internal error");return}let k={result:v,jsonrpc:"2.0",id:o.id};await i?.send(k)},async(b)=>{if(m.signal.aborted)return;let v=Number.isSafeInteger(b.code)?b.code:Q.InternalError,k={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(v),message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};await i?.send(k)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===m)this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&i&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);return}n(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),wr(e))o(e);else o(xe.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,o){let r=this._resolveOutboundCodec(e.method);if(al(t)){if(!em(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=sm(r,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,n,t)}_negotiatedWireCodec(){return Lt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$_(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(ol(t)&&!e.hasRequestMethod(t))throw new q(F.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,o){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o)}_requestWithSchemaViaCodec(e,t,o,r){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s,headers:c}=r??{},l=Date.now(),u,h;return new Promise((m,f)=>{let S=(oe)=>{f(oe)};if(!this._transport){S(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(oe){S(oe);return}if(r?.signal?.aborted){let oe=r.signal.reason;throw oe instanceof q?oe:new q(F.RequestTimeout,String(oe))}let y=e.era===Oa&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,b=this._requestMessageId++;h=b;let v={...t,jsonrpc:"2.0",id:b};if(r?.onprogress)this._progressHandlers.set(b,r.onprogress),v.params={...t.params,_meta:{...t.params?._meta,progressToken:b}};let k=this._envelopeOutbound(v),U=!1,z=(oe)=>{if(U)return;if(this._progressHandlers.delete(b),y===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(oe)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s}).catch((pe)=>this._onerror(Error(`Failed to send cancellation: ${pe}`)))}else y.abort();f(oe instanceof q?oe:new q(F.RequestTimeout,String(oe)))};this._responseHandlers.set(b,(oe)=>{if(r?.signal?.aborted)return;if(U=!0,oe instanceof Error)return f(oe);let pe;try{pe=e.decodeResult(t.method,oe.result)}catch(de){return f(de instanceof Error?de:Error(String(de)))}if(pe.kind==="invalid")return f(pe.error);if(pe.kind==="input_required"){if(r?.allowInputRequired===!0)return m(L_(pe));let de={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:l,retry:(Ne,Ve)=>this._requestWithSchemaViaCodec(e,Ne===void 0?{method:t.method}:{method:t.method,params:Ne},o,Ve)};return m(this._resolveNonCompleteResult(pe,de))}let we=pe.result;nl(o,we).then((de)=>{if(de.success)m(de.data);else f(new q(F.InvalidResult,`Invalid result for ${t.method}: ${de.error}`))},f)}),u=()=>z(r?.signal?.reason),r?.signal?.addEventListener("abort",u,{once:!0});let R=r?.timeout??ci,M=()=>z(new q(F.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(b,R,r?.maxTotalTimeout,M,r?.resetTimeoutOnProgress??!1),this._transport.send(k,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:s,headers:c,requestSignal:y?.signal}).catch((oe)=>{this._progressHandlers.delete(b),f(oe)})}).finally(()=>{if(u)r?.signal?.removeEventListener("abort",u);if(h!==void 0)this._responseHandlers.delete(h),this._cleanupTimeout(h)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new q(F.NotConnected,"Not connected");if(rl(t.method)&&!e.hasNotificationMethod(t.method))throw new q(F.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(r,o).catch((n)=>this._onerror(n))});return}await this._transport.send(r,o)}setRequestHandler(e,t,o){this.assertRequestHandlerCapability(e);let r;if(typeof t==="function"){if(!ol(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,i)=>{let s=this._negotiatedWireCodec(),c=s.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era")c=s.validateInputRequest(e,n);if(!c.ok){if(c.reason==="not-in-era")throw new xe(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(c.message)}return Promise.resolve(t(c.value,i))}}else if(o)r=async(n,i)=>{let s=await nl(t.params,{...n.params});if(!s.success)throw new xe(Q.InvalidParams,`Invalid params for ${e}: ${s.error}`);return o(s.data,i)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,o){if(typeof t==="function"){if(!rl(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,n)=>{let i=n.validateNotification(e,r);if(!i.ok){if(i.reason==="not-in-era")throw new xe(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(r)=>{let n=await nl(t.params,{...r.params});if(!n.success)throw new xe(Q.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function oi(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function vl(e,t){let o={...e};for(let r in t){let n=r,i=t[n];if(i===void 0)continue;let s=o[n];o[n]=oi(s)&&oi(i)?{...s,...i}:i}return o}function Ia(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function A_(e){let t={},o=[];if(!Ia(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!Ia(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function im(e){throw new q(F.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function N_(e,t,o,r,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:o?._meta,requestState:bl(void 0),signal:r,send:()=>im("send"),notify:()=>im("notify")}}}async function q_(e,t,o,r,n){if(!Ia(r)||typeof r.method!=="string")throw new q(F.InvalidResult,`Invalid input request '${o}': each inputRequests entry must be an embedded request object with a method`,{key:o});let i=r.method;if(!t.hasInputRequestMethod(i))throw new q(F.InvalidResult,`Invalid input request '${o}': '${i}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:o,method:i});let s=e.getRequestHandler(i);if(s===void 0)throw new q(F.CapabilityNotSupported,`Cannot fulfil input request '${o}': no handler is registered for '${i}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:o,method:i});let c=Ia(r.params)?r.params:void 0;return await s({jsonrpc:"2.0",id:o,method:i,...c!==void 0&&{params:c}},e.buildContext(N_(o,i,c,n,e.sessionId)))}function j_(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function Lm(e,t,o,r){let{codec:n,request:i,options:s,flowStartedAt:c}=r,l={inputRequests:o.inputRequests,...o.requestState!==void 0&&{requestState:o.requestState}},u={dispatchInputRequest:(h,m,f)=>q_(e,n,h,m,f),retry:(h,m)=>r.retry(h,j_(s,m))};return P_({config:t,method:i.method,originalParams:i.params,firstPayload:l,flowStartedAt:c,signal:s?.signal,requestOptions:{...s?.timeout!==void 0&&{timeout:s.timeout},...s?.maxTotalTimeout!==void 0&&{maxTotalTimeout:s.maxTotalTimeout},...s?.onprogress!==void 0&&{onprogress:s.onprogress}},hooks:u})}function L_(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
65
65
|
* content-type
|
|
66
66
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
67
67
|
* MIT Licensed
|
|
68
|
-
*/var U_=Nl((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw TypeError("argument string is required");var l=typeof c==="object"?i(c):c;if(typeof l!=="string")throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),h=u!==-1?l.slice(0,u).trim():l.trim();if(!r.test(h))throw TypeError("invalid media type");var m=new s(h.toLowerCase());if(u!==-1){var f,S,y;t.lastIndex=u;while(S=t.exec(l)){if(S.index!==u)throw TypeError("invalid parameter format");if(u+=S[0].length,f=S[1].toLowerCase(),y=S[2],y.charCodeAt(0)===34){if(y=y.slice(1,-1),y.indexOf("\\")!==-1)y=y.replace(o,"$1")}m.parameters[f]=y}if(u!==l.length)throw TypeError("invalid parameter format")}return m}function i(c){var l;if(typeof c.getHeader==="function")l=c.getHeader("content-type");else if(typeof c.headers==="object")l=c.headers&&c.headers["content-type"];if(typeof l!=="string")throw TypeError("content-type header is missing from object");return l}function s(c){this.parameters=Object.create(null),this.type=c}}),dz=jl(U_(),1);function ui(e,t){let o=typeof e;if(o!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(!ui(e[n],t[n]))return!1;return!0}if(o==="object"){if(!e||!t)return e===t;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r)if(!ui(e[i],t[i]))return!1;return!0}return e===t}function wt(e){return encodeURI(D_(e))}function D_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Z_={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},H_={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},F_={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},V_=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function Oo(e,t=Object.create(null),o=V_,r=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let s=new URL(i,o.href);if(s.hash.length>1)t[s.href]=e;else if(s.hash="",r==="")o=s;else Oo(e,t,o)}}else if(e!==!0&&e!==!1)return t;let n=o.href+(r?"#"+r:"");if(t[n]!==void 0)throw Error(`Duplicate schema URI "${n}".`);if(t[n]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:n});if(e.$ref&&e.__absolute_ref__===void 0){let i=new URL(e.$ref,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let i=new URL(e.$recursiveRef,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){let i=new URL("#"+e.$anchor,o.href);t[i.href]=e}for(let i in e){if(F_[i])continue;let s=`${r}/${wt(i)}`,c=e[i];if(Array.isArray(c)){if(Z_[i]){let l=c.length;for(let u=0;u<l;u++)Oo(c[u],t,o,`${s}/${u}`)}}else if(H_[i])for(let l in c)Oo(c[l],t,o,`${s}/${wt(l)}`);else Oo(c,t,o,s)}return t}var J_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,B_=[0,31,28,31,30,31,30,31,31,30,31,30,31],G_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,W_=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,K_=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Y_=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Q_=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,X_=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ey=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ty=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oy=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,ry=(e)=>{if(e[0]==='"')return!1;let[t,o,...r]=e.split("@");if(!t||!o||r.length!==0||t.length>64||o.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return o.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},ny=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,sy=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,iy=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function $t(e){return e.test.bind(e)}var Um={date:Dm,time:Zm.bind(void 0,!1),"date-time":ly,duration:iy,uri:py,"uri-reference":$t(K_),"uri-template":$t(Y_),url:$t(Q_),email:ry,hostname:$t(W_),ipv4:$t(ny),ipv6:$t(sy),regex:my,uuid:$t(X_),"json-pointer":$t(ey),"json-pointer-uri-fragment":$t(ty),"relative-json-pointer":$t(oy)};function ay(e){return e%4===0&&(e%100!==0||e%400===0)}function Dm(e){let t=e.match(J_);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&ay(o)?29:B_[r])}function Zm(e,t){let o=t.match(G_);if(!o)return!1;let r=+o[1],n=+o[2],i=+o[3],s=!!o[5];return(r<=23&&n<=59&&i<=59||r==23&&n==59&&i==60)&&(!e||s)}var cy=/t|\s/i;function ly(e){let t=e.split(cy);return t.length==2&&Dm(t[0])&&Zm(!0,t[1])}var uy=/\/|:/,dy=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function py(e){return uy.test(e)&&dy.test(e)}var hy=/[^\\]\\Z/;function my(e){if(hy.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function fy(e){let t=0,o=e.length,r=0,n;while(r<o)if(t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<o){if(n=e.charCodeAt(r),(n&64512)==56320)r++}return t}function Fe(e,t,o="2019-09",r=Oo(t),n=!0,i=null,s="#",c="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let u=typeof e,h;switch(u){case"boolean":case"number":case"string":h=u;break;case"object":if(e===null)h="null";else if(Array.isArray(e))h="array";else h="object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:m,$recursiveRef:f,$recursiveAnchor:S,type:y,const:b,enum:v,required:k,not:U,anyOf:z,allOf:R,oneOf:M,if:oe,then:pe,else:we,format:de,properties:Ae,patternProperties:Ve,additionalProperties:Be,unevaluatedProperties:ot,minProperties:Qe,maxProperties:te,propertyNames:fe,dependentRequired:D,dependentSchemas:ne,dependencies:be,prefixItems:re,items:le,additionalItems:je,unevaluatedItems:Ie,contains:Ne,minContains:Z,maxContains:se,minItems:J,maxItems:ke,uniqueItems:ht,minimum:I,maximum:A,exclusiveMinimum:B,exclusiveMaximum:X,multipleOf:ve,minLength:_e,maxLength:Pe,pattern:Le,__absolute_ref__:ye,__absolute_recursive_ref__:ze}=t,P=[];if(S===!0&&i===null)i=t;if(f==="#"){let j=i===null?r[ze]:i,N=`${c}/$recursiveRef`,G=Fe(e,i===null?t:i,o,r,n,j,s,N,l);if(!G.valid)P.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:N,error:"A subschema had errors."},...G.errors)}if(m!==void 0){let j=r[ye||m];if(j===void 0){let O=`Unresolved $ref "${m}".`;if(ye&&ye!==m)O+=` Absolute URI "${ye}".`;throw O+=`
|
|
68
|
+
*/var U_=Nl((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw TypeError("argument string is required");var l=typeof c==="object"?i(c):c;if(typeof l!=="string")throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),h=u!==-1?l.slice(0,u).trim():l.trim();if(!r.test(h))throw TypeError("invalid media type");var m=new s(h.toLowerCase());if(u!==-1){var f,S,y;t.lastIndex=u;while(S=t.exec(l)){if(S.index!==u)throw TypeError("invalid parameter format");if(u+=S[0].length,f=S[1].toLowerCase(),y=S[2],y.charCodeAt(0)===34){if(y=y.slice(1,-1),y.indexOf("\\")!==-1)y=y.replace(o,"$1")}m.parameters[f]=y}if(u!==l.length)throw TypeError("invalid parameter format")}return m}function i(c){var l;if(typeof c.getHeader==="function")l=c.getHeader("content-type");else if(typeof c.headers==="object")l=c.headers&&c.headers["content-type"];if(typeof l!=="string")throw TypeError("content-type header is missing from object");return l}function s(c){this.parameters=Object.create(null),this.type=c}}),dz=jl(U_(),1);function ui(e,t){let o=typeof e;if(o!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(!ui(e[n],t[n]))return!1;return!0}if(o==="object"){if(!e||!t)return e===t;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r)if(!ui(e[i],t[i]))return!1;return!0}return e===t}function wt(e){return encodeURI(D_(e))}function D_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Z_={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},H_={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},F_={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},V_=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function Oo(e,t=Object.create(null),o=V_,r=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let s=new URL(i,o.href);if(s.hash.length>1)t[s.href]=e;else if(s.hash="",r==="")o=s;else Oo(e,t,o)}}else if(e!==!0&&e!==!1)return t;let n=o.href+(r?"#"+r:"");if(t[n]!==void 0)throw Error(`Duplicate schema URI "${n}".`);if(t[n]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:n});if(e.$ref&&e.__absolute_ref__===void 0){let i=new URL(e.$ref,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let i=new URL(e.$recursiveRef,o.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){let i=new URL("#"+e.$anchor,o.href);t[i.href]=e}for(let i in e){if(F_[i])continue;let s=`${r}/${wt(i)}`,c=e[i];if(Array.isArray(c)){if(Z_[i]){let l=c.length;for(let u=0;u<l;u++)Oo(c[u],t,o,`${s}/${u}`)}}else if(H_[i])for(let l in c)Oo(c[l],t,o,`${s}/${wt(l)}`);else Oo(c,t,o,s)}return t}var J_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,B_=[0,31,28,31,30,31,30,31,31,30,31,30,31],G_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,W_=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,K_=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Y_=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Q_=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,X_=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ey=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ty=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oy=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,ry=(e)=>{if(e[0]==='"')return!1;let[t,o,...r]=e.split("@");if(!t||!o||r.length!==0||t.length>64||o.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return o.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},ny=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,sy=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,iy=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function $t(e){return e.test.bind(e)}var Um={date:Dm,time:Zm.bind(void 0,!1),"date-time":ly,duration:iy,uri:py,"uri-reference":$t(K_),"uri-template":$t(Y_),url:$t(Q_),email:ry,hostname:$t(W_),ipv4:$t(ny),ipv6:$t(sy),regex:my,uuid:$t(X_),"json-pointer":$t(ey),"json-pointer-uri-fragment":$t(ty),"relative-json-pointer":$t(oy)};function ay(e){return e%4===0&&(e%100!==0||e%400===0)}function Dm(e){let t=e.match(J_);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&ay(o)?29:B_[r])}function Zm(e,t){let o=t.match(G_);if(!o)return!1;let r=+o[1],n=+o[2],i=+o[3],s=!!o[5];return(r<=23&&n<=59&&i<=59||r==23&&n==59&&i==60)&&(!e||s)}var cy=/t|\s/i;function ly(e){let t=e.split(cy);return t.length==2&&Dm(t[0])&&Zm(!0,t[1])}var uy=/\/|:/,dy=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function py(e){return uy.test(e)&&dy.test(e)}var hy=/[^\\]\\Z/;function my(e){if(hy.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function fy(e){let t=0,o=e.length,r=0,n;while(r<o)if(t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<o){if(n=e.charCodeAt(r),(n&64512)==56320)r++}return t}function Fe(e,t,o="2019-09",r=Oo(t),n=!0,i=null,s="#",c="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};let u=typeof e,h;switch(u){case"boolean":case"number":case"string":h=u;break;case"object":if(e===null)h="null";else if(Array.isArray(e))h="array";else h="object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:m,$recursiveRef:f,$recursiveAnchor:S,type:y,const:b,enum:v,required:k,not:U,anyOf:z,allOf:R,oneOf:M,if:oe,then:pe,else:we,format:de,properties:Ne,patternProperties:Ve,additionalProperties:Be,unevaluatedProperties:ot,minProperties:Qe,maxProperties:te,propertyNames:fe,dependentRequired:D,dependentSchemas:ne,dependencies:be,prefixItems:re,items:le,additionalItems:je,unevaluatedItems:Ie,contains:Oe,minContains:Z,maxContains:se,minItems:J,maxItems:ke,uniqueItems:ht,minimum:I,maximum:A,exclusiveMinimum:B,exclusiveMaximum:X,multipleOf:ve,minLength:_e,maxLength:Pe,pattern:Le,__absolute_ref__:ye,__absolute_recursive_ref__:ze}=t,P=[];if(S===!0&&i===null)i=t;if(f==="#"){let j=i===null?r[ze]:i,N=`${c}/$recursiveRef`,G=Fe(e,i===null?t:i,o,r,n,j,s,N,l);if(!G.valid)P.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:N,error:"A subschema had errors."},...G.errors)}if(m!==void 0){let j=r[ye||m];if(j===void 0){let O=`Unresolved $ref "${m}".`;if(ye&&ye!==m)O+=` Absolute URI "${ye}".`;throw O+=`
|
|
69
69
|
Known schemas:
|
|
70
70
|
- ${Object.keys(r).join(`
|
|
71
|
-
- `)}`,Error(O)}let N=`${c}/$ref`,G=Fe(e,j,o,r,n,i,s,N,l);if(!G.valid)P.push({instanceLocation:s,keyword:"$ref",keywordLocation:N,error:"A subschema had errors."},...G.errors);if(o==="4"||o==="7")return{valid:P.length===0,errors:P}}if(Array.isArray(y)){let j=y.length,N=!1;for(let G=0;G<j;G++)if(h===y[G]||y[G]==="integer"&&h==="number"&&e%1===0&&e===e){N=!0;break}if(!N)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y.join('", "')}".`})}else if(y==="integer"){if(h!=="number"||e%1||e!==e)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`})}else if(y!==void 0&&h!==y)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`});if(b!==void 0){if(h==="object"||h==="array"){if(!ui(e,b))P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(b)}.`})}else if(e!==b)P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(b)}.`})}if(v!==void 0){if(h==="object"||h==="array"){if(!v.some((j)=>ui(e,j)))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}else if(!v.some((j)=>e===j))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}if(U!==void 0){let j=`${c}/not`;if(Fe(e,U,o,r,n,i,s,j).valid)P.push({instanceLocation:s,keyword:"not",keywordLocation:j,error:'Instance matched "not" schema.'})}let We=[];if(z!==void 0){let j=`${c}/anyOf`,N=P.length,G=!1;for(let O=0;O<z.length;O++){let x=z[O],Y=Object.create(l),W=Fe(e,x,o,r,n,S===!0?i:null,s,`${j}/${O}`,Y);if(P.push(...W.errors),G=G||W.valid,W.valid)We.push(Y)}if(G)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:j,error:"Instance does not match any subschemas."})}if(R!==void 0){let j=`${c}/allOf`,N=P.length,G=!0;for(let O=0;O<R.length;O++){let x=R[O],Y=Object.create(l),W=Fe(e,x,o,r,n,S===!0?i:null,s,`${j}/${O}`,Y);if(P.push(...W.errors),G=G&&W.valid,W.valid)We.push(Y)}if(G)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"allOf",keywordLocation:j,error:"Instance does not match every subschema."})}if(M!==void 0){let j=`${c}/oneOf`,N=P.length,G=M.filter((O,x)=>{let Y=Object.create(l),W=Fe(e,O,o,r,n,S===!0?i:null,s,`${j}/${x}`,Y);if(P.push(...W.errors),W.valid)We.push(Y);return W.valid}).length;if(G===1)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:j,error:`Instance does not match exactly one subschema (${G} matches).`})}if(h==="object"||h==="array")Object.assign(l,...We);if(oe!==void 0){let j=`${c}/if`;if(Fe(e,oe,o,r,n,i,s,j,l).valid){if(pe!==void 0){let N=Fe(e,pe,o,r,n,i,s,`${c}/then`,l);if(!N.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "then" schema.'},...N.errors)}}else if(we!==void 0){let N=Fe(e,we,o,r,n,i,s,`${c}/else`,l);if(!N.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "else" schema.'},...N.errors)}}if(h==="object"){if(k!==void 0){for(let O of k)if(!(O in e))P.push({instanceLocation:s,keyword:"required",keywordLocation:`${c}/required`,error:`Instance does not have required property "${O}".`})}let j=Object.keys(e);if(Qe!==void 0&&j.length<Qe)P.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${c}/minProperties`,error:`Instance does not have at least ${Qe} properties.`});if(te!==void 0&&j.length>te)P.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${c}/maxProperties`,error:`Instance does not have at least ${te} properties.`});if(fe!==void 0){let O=`${c}/propertyNames`;for(let x in e){let Y=`${s}/${wt(x)}`,W=Fe(x,fe,o,r,n,i,Y,O);if(!W.valid)P.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:O,error:`Property name "${x}" does not match schema.`},...W.errors)}}if(D!==void 0){let O=`${c}/dependantRequired`;for(let x in D)if(x in e){let Y=D[x];for(let W of Y)if(!(W in e))P.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:O,error:`Instance has "${x}" but does not have "${W}".`})}}if(ne!==void 0)for(let O in ne){let x=`${c}/dependentSchemas`;if(O in e){let Y=Fe(e,ne[O],o,r,n,i,s,`${x}/${wt(O)}`,l);if(!Y.valid)P.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:x,error:`Instance has "${O}" but does not match dependant schema.`},...Y.errors)}}if(be!==void 0){let O=`${c}/dependencies`;for(let x in be)if(x in e){let Y=be[x];if(Array.isArray(Y)){for(let W of Y)if(!(W in e))P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:O,error:`Instance has "${x}" but does not have "${W}".`})}else{let W=Fe(e,Y,o,r,n,i,s,`${O}/${wt(x)}`);if(!W.valid)P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:O,error:`Instance has "${x}" but does not match dependant schema.`},...W.errors)}}}let N=Object.create(null),G=!1;if(Ae!==void 0){let O=`${c}/properties`;for(let x in Ae){if(!(x in e))continue;let Y=`${s}/${wt(x)}`,W=Fe(e[x],Ae[x],o,r,n,i,Y,`${O}/${wt(x)}`);if(W.valid)l[x]=N[x]=!0;else if(G=n,P.push({instanceLocation:s,keyword:"properties",keywordLocation:O,error:`Property "${x}" does not match schema.`},...W.errors),G)break}}if(!G&&Ve!==void 0){let O=`${c}/patternProperties`;for(let x in Ve){let Y=new RegExp(x,"u"),W=Ve[x];for(let ge in e){if(!Y.test(ge))continue;let zt=`${s}/${wt(ge)}`,mt=Fe(e[ge],W,o,r,n,i,zt,`${O}/${wt(x)}`);if(mt.valid)l[ge]=N[ge]=!0;else G=n,P.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:O,error:`Property "${ge}" matches pattern "${x}" but does not match associated schema.`},...mt.errors)}}}if(!G&&Be!==void 0){let O=`${c}/additionalProperties`;for(let x in e){if(N[x])continue;let Y=`${s}/${wt(x)}`,W=Fe(e[x],Be,o,r,n,i,Y,O);if(W.valid)l[x]=!0;else G=n,P.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:O,error:`Property "${x}" does not match additional properties schema.`},...W.errors)}}else if(!G&&ot!==void 0){let O=`${c}/unevaluatedProperties`;for(let x in e)if(!l[x]){let Y=`${s}/${wt(x)}`,W=Fe(e[x],ot,o,r,n,i,Y,O);if(W.valid)l[x]=!0;else P.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:O,error:`Property "${x}" does not match unevaluated properties schema.`},...W.errors)}}}else if(h==="array"){if(ke!==void 0&&e.length>ke)P.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${c}/maxItems`,error:`Array has too many items (${e.length} > ${ke}).`});if(J!==void 0&&e.length<J)P.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${c}/minItems`,error:`Array has too few items (${e.length} < ${J}).`});let j=e.length,N=0,G=!1;if(re!==void 0){let O=`${c}/prefixItems`,x=Math.min(re.length,j);for(;N<x;N++){let Y=Fe(e[N],re[N],o,r,n,i,`${s}/${N}`,`${O}/${N}`);if(l[N]=!0,!Y.valid){if(G=n,P.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:O,error:"Items did not match schema."},...Y.errors),G)break}}}if(le!==void 0){let O=`${c}/items`;if(Array.isArray(le)){let x=Math.min(le.length,j);for(;N<x;N++){let Y=Fe(e[N],le[N],o,r,n,i,`${s}/${N}`,`${O}/${N}`);if(l[N]=!0,!Y.valid){if(G=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...Y.errors),G)break}}}else for(;N<j;N++){let x=Fe(e[N],le,o,r,n,i,`${s}/${N}`,O);if(l[N]=!0,!x.valid){if(G=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...x.errors),G)break}}if(!G&&je!==void 0){let x=`${c}/additionalItems`;for(;N<j;N++){let Y=Fe(e[N],je,o,r,n,i,`${s}/${N}`,x);if(l[N]=!0,!Y.valid)G=n,P.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:x,error:"Items did not match additional items schema."},...Y.errors)}}}if(Ne!==void 0)if(j===0&&Z===void 0)P.push({instanceLocation:s,keyword:"contains",keywordLocation:`${c}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Z!==void 0&&j<Z)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array has less items (${j}) than minContains (${Z}).`});else{let O=`${c}/contains`,x=P.length,Y=0;for(let W=0;W<j;W++){let ge=Fe(e[W],Ne,o,r,n,i,`${s}/${W}`,O);if(ge.valid)l[W]=!0,Y++;else P.push(...ge.errors)}if(Y>=(Z||0))P.length=x;if(Z===void 0&&se===void 0&&Y===0)P.splice(x,0,{instanceLocation:s,keyword:"contains",keywordLocation:O,error:"Array does not contain item matching schema."});else if(Z!==void 0&&Y<Z)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array must contain at least ${Z} items matching schema. Only ${Y} items were found.`});else if(se!==void 0&&Y>se)P.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${c}/maxContains`,error:`Array may contain at most ${se} items matching schema. ${Y} items were found.`})}if(!G&&Ie!==void 0){let O=`${c}/unevaluatedItems`;for(;N<j;N++){if(l[N])continue;let x=Fe(e[N],Ie,o,r,n,i,`${s}/${N}`,O);if(l[N]=!0,!x.valid)P.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:O,error:"Items did not match unevaluated items schema."},...x.errors)}}if(ht)for(let O=0;O<j;O++){let x=e[O],Y=typeof x==="object"&&x!==null;for(let W=0;W<j;W++){if(O===W)continue;let ge=e[W];if(x===ge||Y&&typeof ge==="object"&&ge!==null&&ui(x,ge))P.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${c}/uniqueItems`,error:`Duplicate items at indexes ${O} and ${W}.`}),O=Number.MAX_SAFE_INTEGER,W=Number.MAX_SAFE_INTEGER}}}else if(h==="number"){if(o==="4"){if(I!==void 0&&(B===!0&&e<=I||e<I))P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${B?"or equal to ":""} ${I}.`});if(A!==void 0&&(X===!0&&e>=A||e>A))P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${X?"or equal to ":""} ${A}.`})}else{if(I!==void 0&&e<I)P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${I}.`});if(A!==void 0&&e>A)P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${A}.`});if(B!==void 0&&e<=B)P.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${c}/exclusiveMinimum`,error:`${e} is less than ${B}.`});if(X!==void 0&&e>=X)P.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${c}/exclusiveMaximum`,error:`${e} is greater than or equal to ${X}.`})}if(ve!==void 0){let j=e%ve;if(Math.abs(0-j)>=0.00000011920929&&Math.abs(ve-j)>=0.00000011920929)P.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${c}/multipleOf`,error:`${e} is not a multiple of ${ve}.`})}}else if(h==="string"){let j=_e===void 0&&Pe===void 0?0:fy(e);if(_e!==void 0&&j<_e)P.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${c}/minLength`,error:`String is too short (${j} < ${_e}).`});if(Pe!==void 0&&j>Pe)P.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${c}/maxLength`,error:`String is too long (${j} > ${Pe}).`});if(Le!==void 0&&!new RegExp(Le,"u").test(e))P.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${c}/pattern`,error:"String does not match pattern."});if(de!==void 0&&Um[de]&&!Um[de](e))P.push({instanceLocation:s,keyword:"format",keywordLocation:`${c}/format`,error:`String does not match format "${de}".`})}return{valid:P.length===0,errors:P}}var gy=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",o=!0){this.schema=e,this.draft=t,this.shortCircuit=o,this.lookup=Oo(e)}validate(e){return Fe(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};Oo(e,this.lookup)}},Na=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Dl(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new gy(e,this.draft??this._draftFor(e),this.shortcircuit);return(o)=>{let r=t.validate(o);return r.valid?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errors.map((n)=>`${n.instanceLocation}: ${n.error}`).join("; ")}}}};var Sy;Sy=globalThis.crypto;var zr=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e){super(e);this.name=new.target.name,no(this,new.target)}},zy=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`);this.kind=e,this.expected=t,this.received=o}},Ry=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},xy=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},Py=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},Ey=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var Km=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",no(this,new.target)}};var qa=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),Ym=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(wl(e))}set(e,t){let o=wl(e),r=qa.has(e.method),n=!this._entries.has(o);if(!r&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let s of this._entries.keys())if(!qa.has(s.slice(0,s.indexOf("\x00")))){this._entries.delete(s),this._cappedSize--;break}}let i=++this._stamp;if(this._entries.set(o,{...t,stamp:i}),n&&!r)this._cappedSize++;return i}delete(e){if(this._entries.delete(wl(e))&&!qa.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,o=qa.has(e);for(let r of this._entries.keys())if(r.startsWith(t)){if(this._entries.delete(r),!o)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function wl(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function zl(e,t){return t===void 0?e:`${e}\x00${t}`}var Qm=86400000,ky=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,o=()=>{},r="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=o,this._cachePartition=r,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let o={method:e,params:t??""},r=this._partitionFor("private"),n=await this._store.get({...o,partition:r});if(n!==void 0)return n;let i=this._partitionFor("public");if(i===r)return;let s=await this._store.get({...o,partition:i});return s?.scope==="public"?s:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let o=this._partitionFor("private"),r=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}if(r!==o)try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}}async evictKey(e,t){let o=zl(e,t),r=this._evictionGeneration.get(o);if(r!==void 0)this._evictionGeneration.set(o,r+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let o=zl(e,t),r=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,r),r}async write(e,t,o,r){if((this._evictionGeneration.get(zl(e,r?.params))??0)!==o)return;let n=r?.params??"",i=this._partitionFor("private"),s=this._partitionFor("public"),c=(r?.scope??"private")==="public"?s:i;try{await this._store.set({method:e,params:n,partition:c},{value:Ty(t),expiresAt:r?.expiresAt,scope:r?.scope})}catch(l){this._reportError(l)}if(s!==i)try{await this._store.delete({method:e,params:n,partition:c===i?s:i})}catch(l){this._reportError(l)}}async read(e,t){let o=await this._probe(e,t);if(o?.expiresAt===void 0||!(o.expiresAt>this.now()))return;try{let r=JSON.parse(o.value);if(typeof r!=="object"||r===null||Array.isArray(r))throw TypeError("cached document is not an object");return{value:r}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let o=this._decodeListTools(t),r=new Map;if(o!==void 0)for(let n of o.tools)r.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let o=await this._probe("tools/list");if(o===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let r=this._decodeListTools(o)??{tools:[]},n=new Map;for(let i of r.tools){let s=t(i);if(s!==void 0)n.set(i.name,s)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((o)=>o!==null&&typeof o==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function Ty(e){let t;try{t=JSON.stringify(e)}catch(o){throw TypeError(`cache value is not JSON-serializable: ${o instanceof Error?o.message:String(o)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var $y=Symbol.for("mcp.authSeamEscape");function Cy(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[$y]===!0}var Iy=-32022,Oy=new Set([-32001,-32020,-32021]);function My(e,t){switch(e.kind){case"result":return Ay(e.result,t);case"rpc-error":return Xm(e,t);case"http-error":return Ny(e,t);case"network-error":return Hm(e.error,t);case"unusable-reply":return{kind:"error",error:new q(F.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${ef(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Hm(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new q(F.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function Ay(e,t){let o=Lt(Oa).validateResult("server/discover",e);if(!o.ok)return{kind:"legacy"};let r=o.value.supportedVersions,n=t.clientModernVersions.find((i)=>r.includes(i));if(n!==void 0)return{kind:"modern",version:n,discover:o.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new ii({supported:[...r],requested:t.requestedVersion})}}function Xm(e,t){let{code:o,message:r,data:n}=e;if(o===Iy){let i=jy(n);if(i===void 0)return{kind:"legacy"};let s=new ii({supported:i,requested:Ly(n)??t.requestedVersion},r),c=si(i),l=t.clientModernVersions.find((u)=>c.includes(u));if(l!==void 0)return{kind:"corrective",version:l,error:s};if(c.length>0)return{kind:"error",error:s};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:s}}if(Oy.has(o))return{kind:"legacy"};return{kind:"legacy"}}function Ny(e,t){if(e.status===401||e.status===403){let r=e.status===403;return{kind:"error",error:new ni(r?F.ClientHttpForbidden:F.ClientHttpAuthentication,`Version negotiation failed: ${r?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new ni(F.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let o=Uy(e.body);if(o!==void 0)return Xm(o,t);return{kind:"legacy"}}function Hm(e,t){if(t.environment==="browser"&&qy(e))return{kind:"legacy"};return{kind:"error",error:new q(F.EraNegotiationFailed,`Version negotiation probe failed: ${ef(e)}`,{cause:e},{cause:e})}}function qy(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function ef(e){return e instanceof Error?e.message:String(e)}function jy(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((o)=>typeof o==="string"))return;return t}function Ly(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function Uy(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let o=t.error;if(typeof o!=="object"||o===null)return;let{code:r,message:n,data:i}=o;if(typeof r!=="number")return;return{code:r,message:typeof n==="string"?n:"",data:i}}var Dy="legacy";function Zy(e,t){let o=e?.mode??Dy;if(o==="legacy")return{kind:"legacy"};let r=e?.probe??{};if(typeof o==="object"){if(!Ut(o.pin))throw TypeError(`versionNegotiation: { pin: '${o.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:o.pin,probe:r}}let n=t?si(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...ul],fallbackAvailable:t?dl(t).length>0:!0,probe:r}}function Fm(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Vm(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var Hy=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let o=new e(t);t.onmessage=(r)=>{let n=o._pending;if(n!==void 0&&(wr(r)||ai(r))&&r.id===n.id){if(o._pending=void 0,wr(r))n.resolve({kind:"response",result:r.result});else n.resolve({kind:"response",error:r.error});return}},t.onerror=(r)=>{o._savedOnError?.(r)},t.onclose=()=>{let r=o._pending;if(r!==void 0)o._pending=void 0,r.resolve({kind:"closed"});o._closeDelivered=!0,o._savedOnClose?.()};try{await t.start()}catch(r){throw o.detach(),r}return o}async exchange(t,o){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise((n)=>{let i=!1,s=(l)=>{if(i)return;if(i=!0,clearTimeout(c),this._pending?.id===r)this._pending=void 0;n(l)},c=setTimeout(()=>s({kind:"timeout"}),o);this._pending={id:r,resolve:s},this._transport.send(t(r)).catch((l)=>s({kind:"send-error",error:l}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,o=this._transport,r=!1,n=()=>{if(!r){r=!0;return}t()};o.onclose=n,xl.set(o,()=>{if(o.onclose===n)o.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,o=t.start,r=!0;t.start=async function(){if(r){r=!1,t.start=o;return}return o.call(t)}}},xl=new WeakMap;function Jm(e){let t=xl.get(e);xl.delete(e),t?.()}function Fy(e,t,o,r){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Lt(t).outboundEnvelope({protocolVersion:t,clientInfo:o,clientCapabilities:r})}}}function Vy(e){if(e instanceof q&&e.code===F.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function Jy(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let o=e.error;if(Cy(o)||o instanceof Km||o instanceof Error&&o.name==="UnauthorizedError")return{kind:"auth-required",error:o};if(o instanceof ni){let r=o.data?.text;return{kind:"http-error",status:o.data.status,body:typeof r==="string"?r:void 0,statusText:o.data.statusText}}if(Vy(o))return{kind:"unusable-reply",error:o};return{kind:"network-error",error:o}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function tf(e,t){let o=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,i=e.kind==="auto"&&e.fallbackAvailable,s=await Hy.open(t.transport),c=async()=>{let u=n[0],h=!1,m=r;for(;;){let f=await s.exchange((b)=>Fy(b,u,t.clientInfo,t.capabilities),o);if(f.kind==="timeout"&&m>0){m--;continue}let S=Jy(f,o),y=My(S,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:i,environment:t.environment,transportKind:t.transportKind});switch(y.kind){case"modern":return{era:"modern",version:y.version,discover:y.discover};case"corrective":if(h)throw y.error;h=!0,u=y.version;continue;case"legacy":{let b=S.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new q(F.EraNegotiationFailed,b===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${b} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new q(F.EraNegotiationFailed,b===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${b} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(b!==void 0&&t.disposableProbe!==!0)throw new q(F.EraNegotiationFailed,`Version negotiation failed: ${b} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw y.error}}},l;try{l=await c()}catch(u){throw s.detach(),u}return s.release(),l}function By(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let o=e._serverParams;return typeof o==="object"&&o!==null&&typeof o.command==="string"?o:void 0}async function Gy(e,t,o,r){let i=new t.constructor({...o,stderr:"ignore"}),s=t.close,c=!1,l,u=new Promise((m,f)=>{l=()=>f(Bm())});t.close=async function(){return c=!0,l?.(),s.call(t)};let h;try{let m=tf(e,{...r,transport:i,transportKind:"stdio",disposableProbe:!0});m.catch(()=>{}),h=await Promise.race([m,u])}finally{await Wy(i),t.close=s}if(c)throw Bm();return h}function Bm(){return new q(F.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function Wy(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Gm(e){let t=e._meta?.[Pt];return yl.Implementation(t)?t:void 0}function ja(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let o=t,r=e.properties;for(let n of Object.keys(r)){let i=r[n];if(o[n]===void 0&&Object.prototype.hasOwnProperty.call(i,"default"))o[n]=i.default;if(o[n]!==void 0)ja(i,o[n])}}if(Array.isArray(e.anyOf)){for(let o of e.anyOf)if(typeof o!=="boolean")ja(o,t)}if(Array.isArray(e.oneOf)){for(let o of e.oneOf)if(typeof o!=="boolean")ja(o,t)}}function of(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,o=e.url!==void 0;return{supportsFormMode:t||!t&&!o,supportsUrlMode:o}}function Ky(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&eo.safeParse(e.discover).success)return e}throw new q(F.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Wm={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},Yy=64,Rl={},Qy=class extends li{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{Rl.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,Rl.walkPages=(e,t,o,r)=>e._walkPages(t,o,r),Rl.readResource=(e,t,o)=>e._readResource(t,o)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new q(F.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Na,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=Am(t?.inputRequired),this._cache=new ky(t?.responseCacheStore??new Ym,t?.responseCacheStore!==void 0,(o)=>this._reportStoreError(o),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??Yy,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Ut(this._negotiatedProtocolVersion)&&Ma(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new q(F.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return Lm({getRequestHandler:(o)=>this._getRequestHandler(o),buildContext:(o)=>this.buildContext(o,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=vl(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(o,r)=>{let n=Lt(this._negotiatedProtocolVersion),i=n.validateRequest("elicitation/create",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("elicitation/create",o);if(!i.ok)throw new xe(i.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,i.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${i.message}`);let{params:s}=i.value;s.mode=s.mode??"form";let{supportsFormMode:c,supportsUrlMode:l}=of(this._capabilities.elicitation);if(s.mode==="form"&&!c)throw new xe(Q.InvalidParams,"Client does not support form-mode elicitation requests");if(s.mode==="url"&&!l)throw new xe(Q.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(o,r),h=n.validateResult("elicitation/create",u);if(!h.ok&&h.reason==="not-in-era")h=n.validateInputResponse("elicitation/create",u);if(!h.ok)throw new xe(h.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,h.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${h.message}`);let m=h.value,f=s.mode==="form"?s.requestedSchema:void 0;if(s.mode==="form"&&m.action==="accept"&&m.content&&f&&this._capabilities.elicitation?.form?.applyDefaults)try{ja(f,m.content)}catch{}return m};if(e==="sampling/createMessage")return async(o,r)=>{let n=Lt(this._negotiatedProtocolVersion),i=n.validateRequest("sampling/createMessage",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("sampling/createMessage",o);if(!i.ok)throw new xe(i.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,i.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${i.message}`);let{params:s}=i.value,c=await t(o,r),l=Boolean(s.tools||s.toolChoice),u=n.samplingResultVariant(l,c);if(!u.ok&&u.reason==="not-in-era")u=n.validateInputResponse("sampling/createMessage",c);if(!u.ok)throw new xe(u.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new q(F.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,Ky(t.prior),t);let o=Zy(this._versionNegotiation,this._supportedProtocolVersionsOption);if(o.kind!=="legacy")return this._connectNegotiated(e,o,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let o=this._negotiatedProtocolVersion;if(o!==void 0)e.setProtocolVersion?.(o);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let o=dl(this._supportedProtocolVersions);try{let r=o[0];if(r===void 0)throw new q(F.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:r,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!o.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);if(this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(n.protocolVersion);if(this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(r){throw this.close(),r}}async _connectNegotiated(e,t,o){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;if(n!==void 0&&e.setProtocolVersion)e.setProtocolVersion(n);return}this._resetConnectionState();let r;try{let n=Vm(e),i={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Fm(),defaultTimeoutMs:o?.timeout??ci},s=n==="stdio"?By(e):void 0;r=s===void 0?await tf(t,{...i,transport:e,transportKind:n}):await Gy(t,e,s,i)}catch(n){throw await e.close().catch(()=>{}),Jm(e),n}if(Jm(e),await super.connect(e),r.era==="legacy"){await this._legacyHandshake(e,o);return}if(this._serverCapabilities=r.discover.capabilities,this._serverVersion=Gm(r.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.discover.instructions,this._discoverResult=r.discover,this._negotiatedProtocolVersion=r.version,e.setProtocolVersion)e.setProtocolVersion(r.version);if(this._listChangedConfig){let n=this._listChangedConfig,i=this._serverCapabilities,s={...n.tools&&i?.tools?.listChanged&&{tools:n.tools},...n.prompts&&i?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&i?.resources?.listChanged&&{resources:n.resources}},c=!0;try{this._setupListChangedHandlers(s)}catch(u){c=!1,this.onerror?.(u instanceof Error?u:Error(String(u)))}let l=c?{...s.tools&&{toolsListChanged:!0},...s.prompts&&{promptsListChanged:!0},...s.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(l).length>0){let u=new AbortController,h=()=>u.abort(o?.signal?.reason);if(o?.signal?.aborted)h();o?.signal?.addEventListener("abort",h);try{this._autoOpenedSubscription=await this.listen(l,{timeout:o?.timeout,signal:u.signal})}catch(m){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),m;this.onerror?.(m instanceof Error?m:Error(String(m)))}finally{o?.signal?.removeEventListener("abort",h)}}}}async _connectFromPrior(e,t,o){if(t.kind==="legacy")return this._connectPlainLegacy(e,o);let r=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,i=(n&&si(n).length>0?si(n):ul).find((s)=>r.supportedVersions.includes(s));if(i===void 0)throw new q(F.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=r,this._serverCapabilities=r.capabilities,this._serverVersion=Gm(r),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.instructions,this._negotiatedProtocolVersion=i,e.setProtocolVersion?.(i),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(s){this.onerror?.(s instanceof Error?s:Error(String(s)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return Ut(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new q(F.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new q(F.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new q(F.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new q(F.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new q(F.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new q(F.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new q(F.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new q(F.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new q(F.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new q(F.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},eo,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let o=await this._serveFromCache("prompts/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("prompts/list",e,t,(r)=>r.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let o=await this._serveFromCache("resources/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/list",e,t,(r)=>r.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let o=await this._serveFromCache("resources/templates/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/templates/list",e,t,(r)=>r.resourceTemplates)}async _listAllPages(e,t,o,r,n){let i=o?.cacheMode==="bypass",s=this._cache.captureGeneration(e),c=(u)=>{let h=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...h&&{params:h}},o)},l=await this._walkPages(e,c,r);if(delete l.nextCursor,n?.(l),i)return l;return await this._cache.write(e,l,s,this._freshness(l)),l}async _walkPages(e,t,o){let r=await t(void 0),n=r.nextCursor,i=r,s=1;while(n!==void 0){if(this._listMaxPages!==0&&s>=this._listMaxPages)throw new q(F.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let c=await t(n);if(c.nextCursor===n&&JSON.stringify(o(c))===JSON.stringify(o(i)))break;o(r).push(...o(c)),i=c,n=c.nextCursor,s++}return r}_freshness(e,t){let o=e,r=typeof o.ttlMs==="number"?o.ttlMs:this._defaultCacheTtlMs,n=o.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),Qm),scope:n,params:t}}async _serveFromCache(e,t,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let r=await this._cache.read(e,t).catch((n)=>void this._reportStoreError(n));if(r!==void 0){if(o?.signal?.aborted){let n=o.signal.reason;throw n instanceof q?n:new q(F.RequestTimeout,String(n))}return r.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let o=t??await this._cache.toolDefinition(e);return o===void 0?void 0:Sl(o.inputSchema)}async readResource(e,t){let{result:o}=await this._readResource(e,t);return o}async _readResource(e,t){let o=await this._serveFromCache("resources/read",e.uri,t);if(o!==void 0)return{result:o,cached:!0};let r=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let i=this._freshness(n,e.uri);if(i.expiresAt>this._cache.now())await this._cache.write("resources/read",n,r,i);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:n,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new q(F.NotConnected,"Not connected");let o=this._negotiatedProtocolVersion;if(o===void 0||!Ut(o))throw new q(F.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${o??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:o});if(t?.signal?.aborted){let z=t.signal.reason;throw z instanceof q?z:new q(F.RequestTimeout,String(z))}let r=new AbortController,n=`listen:${this._nextListenId++}`,i="opening",s,c,l,u,h=new Promise((z,R)=>{l=z,u=R}),m,f=new Promise((z)=>{m=z}),S=(z)=>{if(i==="closed")return;let R=i==="opening";if(s!==void 0)clearTimeout(s),s=void 0;if("ack"in z){i="open",l(z.ack);return}if(i="closed",c!==void 0)t?.signal?.removeEventListener("abort",c);if(this._listenState.delete(n),r.abort(),m(z.cause),R)u(z.error??new q(F.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},y=async()=>{r.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},b=async()=>{if(i==="closed")return;S({cause:"local"}),await y()};this._listenState.set(n,{settle:S});let v=t?.timeout??ci;if(s=setTimeout(()=>{S({cause:"remote",error:new q(F.RequestTimeout,"subscriptions/listen ack timed out",{timeout:v})}),y().catch(()=>{})},v),t?.signal){let z=t.signal;c=()=>{if(i==="closed")return;let R=z.reason;S({cause:"local",error:R instanceof Error?R:Error(String(R??"Aborted"))}),y().catch(()=>{})},z.addEventListener("abort",c,{once:!0})}let k={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},U=(z)=>{S({cause:"remote",error:z instanceof Error?z:Error(String(z))})};try{this.transport.send(k,{requestSignal:r.signal,onRequestStreamEnd:()=>S({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(U)}catch(z){U(z)}return{honoredFilter:await h,close:b,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let o=Object.hasOwn(Wm,e.method)?Wm[e.method]:void 0;if(e.method==="notifications/resources/updated"){let r=e.params?.uri;if(typeof r==="string")this._cache.evictKey("resources/read",r)}else if(o!==void 0)for(let r of o)this._cache.evict(r);if(e.method==="notifications/subscriptions/acknowledged"){let r=e.params?._meta?.[Bo],n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){let i=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:i.ok?i.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let r=e.params?.requestId,n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){n.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,o=typeof t==="string"?this._listenState.get(t):void 0;if(o!==void 0){if(ai(e))o.settle({cause:"remote",error:xe.fromError(e.error.code,e.error.message,e.error.data)});else o.settle({cause:"graceful",error:new q(F.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new q(F.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let o=this.getProtocolEra()==="modern"&&Fm()!=="browser",r=async()=>{if(!o)return t;let l;try{l=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(h){this._reportStoreError(h)}if(!l?.valid||l.declarations.length===0)return t;let u=Om(l.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(l)=>this._compileOutputValidator(l)).catch((l)=>void this._reportStoreError(l)):this._compileOutputValidator(t.toolDefinition),i=()=>{if(n===void 0||n.ok)return;let l=n.compileError,u=(l instanceof Error?l.message:String(l)).slice(0,200);throw new xe(Q.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};i();let s;try{s=await this.request({method:"tools/call",params:e},await r())}catch(l){let u=l instanceof xe&&l.code===vr;if(!o||!u||t?.toolDefinition!==void 0)throw l;let h={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,h).catch((m)=>this._reportStoreError(m)),n=await this._cache.outputValidator(e.name,(m)=>this._compileOutputValidator(m)).catch((m)=>void this._reportStoreError(m)),i(),s=await this.request({method:"tools/call",params:e},await r())}let c=n!==void 0&&n.ok?n.validator:void 0;if(c){if(s.structuredContent===void 0&&!s.isError)throw new xe(Q.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent!==void 0&&!s.isError)try{let l=c(s.structuredContent);if(!l.valid)throw new xe(Q.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)}catch(l){if(l instanceof xe)throw l;throw new xe(Q.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return s}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let o=await this._serveFromCache("tools/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("tools/list",e,t,(r)=>r.tools,(r)=>this._excludeInvalidXMcpHeaderTools(r))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Vm(this.transport)==="stdio")return;let t=e.tools.filter((o)=>{let r=Sl(o.inputSchema);if(!r.valid)return console.warn(`[mcp-sdk] excluding tool '${o.name}' from tools/list: invalid x-mcp-header declaration — ${r.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,o,r){let n=Aa(ds,o);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof o.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:s}=n.data,{onChanged:c}=o,l=async()=>{if(!i){c(null,null);return}try{c(null,await r())}catch(h){c(h instanceof Error?h:Error(String(h)),null)}},u=()=>{if(s){let h=this._listChangedDebounceTimers.get(e);if(h)clearTimeout(h);let m=setTimeout(l,s);this._listChangedDebounceTimers.set(e,m)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var VR=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,no(this,new.target)}};class lf{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);if(o.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);o.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let o=this._eventSlots.get(e);if(!o)return;let r=o.listeners.indexOf(t);if(r!==-1)o.listeners.splice(r,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(!o)return;o.onHandler?.(t);for(let r of[...o.listeners])r(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class uf{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var rf=new Set;function nf(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,s=e==="request"?"setRequestHandler":"setNotificationHandler";if(!rf.has(s))rf.add(s),console.warn(`[ext-apps] ${s}(Schema, handler) is deprecated; use ${s}("${i}", { params: Schema.shape.params }, handler).`);let c=r;return[i,{params:n.params},e==="request"?(l,u)=>c({method:i,params:l},Xy(u)):(l)=>c({method:i,params:l})]}function Xy(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var eb="2026-01-26";var tb="ui/notifications/tool-input-partial";class df{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(o)=>{if(t&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=zo.safeParse(o.data);if(r.success)console.debug("Parsed message",r.data),this.onmessage?.(r.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",r.error.message,o);else console.error("Failed to parse message",r.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==tb)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var ob=C([p("light"),p("dark")]).describe("Color theme preference for the host environment."),di=C([p("inline"),p("fullscreen"),p("pip")]).describe("Display mode for UI presentation."),rb=C([p("--color-background-primary"),p("--color-background-secondary"),p("--color-background-tertiary"),p("--color-background-inverse"),p("--color-background-ghost"),p("--color-background-info"),p("--color-background-danger"),p("--color-background-success"),p("--color-background-warning"),p("--color-background-disabled"),p("--color-text-primary"),p("--color-text-secondary"),p("--color-text-tertiary"),p("--color-text-inverse"),p("--color-text-ghost"),p("--color-text-info"),p("--color-text-danger"),p("--color-text-success"),p("--color-text-warning"),p("--color-text-disabled"),p("--color-border-primary"),p("--color-border-secondary"),p("--color-border-tertiary"),p("--color-border-inverse"),p("--color-border-ghost"),p("--color-border-info"),p("--color-border-danger"),p("--color-border-success"),p("--color-border-warning"),p("--color-border-disabled"),p("--color-ring-primary"),p("--color-ring-secondary"),p("--color-ring-inverse"),p("--color-ring-info"),p("--color-ring-danger"),p("--color-ring-success"),p("--color-ring-warning"),p("--font-sans"),p("--font-mono"),p("--font-weight-normal"),p("--font-weight-medium"),p("--font-weight-semibold"),p("--font-weight-bold"),p("--font-text-xs-size"),p("--font-text-sm-size"),p("--font-text-md-size"),p("--font-text-lg-size"),p("--font-heading-xs-size"),p("--font-heading-sm-size"),p("--font-heading-md-size"),p("--font-heading-lg-size"),p("--font-heading-xl-size"),p("--font-heading-2xl-size"),p("--font-heading-3xl-size"),p("--font-text-xs-line-height"),p("--font-text-sm-line-height"),p("--font-text-md-line-height"),p("--font-text-lg-line-height"),p("--font-heading-xs-line-height"),p("--font-heading-sm-line-height"),p("--font-heading-md-line-height"),p("--font-heading-lg-line-height"),p("--font-heading-xl-line-height"),p("--font-heading-2xl-line-height"),p("--font-heading-3xl-line-height"),p("--border-radius-xs"),p("--border-radius-sm"),p("--border-radius-md"),p("--border-radius-lg"),p("--border-radius-xl"),p("--border-radius-full"),p("--border-width-regular"),p("--shadow-hairline"),p("--shadow-sm"),p("--shadow-md"),p("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),nb=E(rb.describe(`Style variables for theming MCP apps.
|
|
71
|
+
- `)}`,Error(O)}let N=`${c}/$ref`,G=Fe(e,j,o,r,n,i,s,N,l);if(!G.valid)P.push({instanceLocation:s,keyword:"$ref",keywordLocation:N,error:"A subschema had errors."},...G.errors);if(o==="4"||o==="7")return{valid:P.length===0,errors:P}}if(Array.isArray(y)){let j=y.length,N=!1;for(let G=0;G<j;G++)if(h===y[G]||y[G]==="integer"&&h==="number"&&e%1===0&&e===e){N=!0;break}if(!N)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y.join('", "')}".`})}else if(y==="integer"){if(h!=="number"||e%1||e!==e)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`})}else if(y!==void 0&&h!==y)P.push({instanceLocation:s,keyword:"type",keywordLocation:`${c}/type`,error:`Instance type "${h}" is invalid. Expected "${y}".`});if(b!==void 0){if(h==="object"||h==="array"){if(!ui(e,b))P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(b)}.`})}else if(e!==b)P.push({instanceLocation:s,keyword:"const",keywordLocation:`${c}/const`,error:`Instance does not match ${JSON.stringify(b)}.`})}if(v!==void 0){if(h==="object"||h==="array"){if(!v.some((j)=>ui(e,j)))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}else if(!v.some((j)=>e===j))P.push({instanceLocation:s,keyword:"enum",keywordLocation:`${c}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}if(U!==void 0){let j=`${c}/not`;if(Fe(e,U,o,r,n,i,s,j).valid)P.push({instanceLocation:s,keyword:"not",keywordLocation:j,error:'Instance matched "not" schema.'})}let We=[];if(z!==void 0){let j=`${c}/anyOf`,N=P.length,G=!1;for(let O=0;O<z.length;O++){let x=z[O],Y=Object.create(l),W=Fe(e,x,o,r,n,S===!0?i:null,s,`${j}/${O}`,Y);if(P.push(...W.errors),G=G||W.valid,W.valid)We.push(Y)}if(G)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:j,error:"Instance does not match any subschemas."})}if(R!==void 0){let j=`${c}/allOf`,N=P.length,G=!0;for(let O=0;O<R.length;O++){let x=R[O],Y=Object.create(l),W=Fe(e,x,o,r,n,S===!0?i:null,s,`${j}/${O}`,Y);if(P.push(...W.errors),G=G&&W.valid,W.valid)We.push(Y)}if(G)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"allOf",keywordLocation:j,error:"Instance does not match every subschema."})}if(M!==void 0){let j=`${c}/oneOf`,N=P.length,G=M.filter((O,x)=>{let Y=Object.create(l),W=Fe(e,O,o,r,n,S===!0?i:null,s,`${j}/${x}`,Y);if(P.push(...W.errors),W.valid)We.push(Y);return W.valid}).length;if(G===1)P.length=N;else P.splice(N,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:j,error:`Instance does not match exactly one subschema (${G} matches).`})}if(h==="object"||h==="array")Object.assign(l,...We);if(oe!==void 0){let j=`${c}/if`;if(Fe(e,oe,o,r,n,i,s,j,l).valid){if(pe!==void 0){let N=Fe(e,pe,o,r,n,i,s,`${c}/then`,l);if(!N.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "then" schema.'},...N.errors)}}else if(we!==void 0){let N=Fe(e,we,o,r,n,i,s,`${c}/else`,l);if(!N.valid)P.push({instanceLocation:s,keyword:"if",keywordLocation:j,error:'Instance does not match "else" schema.'},...N.errors)}}if(h==="object"){if(k!==void 0){for(let O of k)if(!(O in e))P.push({instanceLocation:s,keyword:"required",keywordLocation:`${c}/required`,error:`Instance does not have required property "${O}".`})}let j=Object.keys(e);if(Qe!==void 0&&j.length<Qe)P.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${c}/minProperties`,error:`Instance does not have at least ${Qe} properties.`});if(te!==void 0&&j.length>te)P.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${c}/maxProperties`,error:`Instance does not have at least ${te} properties.`});if(fe!==void 0){let O=`${c}/propertyNames`;for(let x in e){let Y=`${s}/${wt(x)}`,W=Fe(x,fe,o,r,n,i,Y,O);if(!W.valid)P.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:O,error:`Property name "${x}" does not match schema.`},...W.errors)}}if(D!==void 0){let O=`${c}/dependantRequired`;for(let x in D)if(x in e){let Y=D[x];for(let W of Y)if(!(W in e))P.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:O,error:`Instance has "${x}" but does not have "${W}".`})}}if(ne!==void 0)for(let O in ne){let x=`${c}/dependentSchemas`;if(O in e){let Y=Fe(e,ne[O],o,r,n,i,s,`${x}/${wt(O)}`,l);if(!Y.valid)P.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:x,error:`Instance has "${O}" but does not match dependant schema.`},...Y.errors)}}if(be!==void 0){let O=`${c}/dependencies`;for(let x in be)if(x in e){let Y=be[x];if(Array.isArray(Y)){for(let W of Y)if(!(W in e))P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:O,error:`Instance has "${x}" but does not have "${W}".`})}else{let W=Fe(e,Y,o,r,n,i,s,`${O}/${wt(x)}`);if(!W.valid)P.push({instanceLocation:s,keyword:"dependencies",keywordLocation:O,error:`Instance has "${x}" but does not match dependant schema.`},...W.errors)}}}let N=Object.create(null),G=!1;if(Ne!==void 0){let O=`${c}/properties`;for(let x in Ne){if(!(x in e))continue;let Y=`${s}/${wt(x)}`,W=Fe(e[x],Ne[x],o,r,n,i,Y,`${O}/${wt(x)}`);if(W.valid)l[x]=N[x]=!0;else if(G=n,P.push({instanceLocation:s,keyword:"properties",keywordLocation:O,error:`Property "${x}" does not match schema.`},...W.errors),G)break}}if(!G&&Ve!==void 0){let O=`${c}/patternProperties`;for(let x in Ve){let Y=new RegExp(x,"u"),W=Ve[x];for(let ge in e){if(!Y.test(ge))continue;let zt=`${s}/${wt(ge)}`,mt=Fe(e[ge],W,o,r,n,i,zt,`${O}/${wt(x)}`);if(mt.valid)l[ge]=N[ge]=!0;else G=n,P.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:O,error:`Property "${ge}" matches pattern "${x}" but does not match associated schema.`},...mt.errors)}}}if(!G&&Be!==void 0){let O=`${c}/additionalProperties`;for(let x in e){if(N[x])continue;let Y=`${s}/${wt(x)}`,W=Fe(e[x],Be,o,r,n,i,Y,O);if(W.valid)l[x]=!0;else G=n,P.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:O,error:`Property "${x}" does not match additional properties schema.`},...W.errors)}}else if(!G&&ot!==void 0){let O=`${c}/unevaluatedProperties`;for(let x in e)if(!l[x]){let Y=`${s}/${wt(x)}`,W=Fe(e[x],ot,o,r,n,i,Y,O);if(W.valid)l[x]=!0;else P.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:O,error:`Property "${x}" does not match unevaluated properties schema.`},...W.errors)}}}else if(h==="array"){if(ke!==void 0&&e.length>ke)P.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${c}/maxItems`,error:`Array has too many items (${e.length} > ${ke}).`});if(J!==void 0&&e.length<J)P.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${c}/minItems`,error:`Array has too few items (${e.length} < ${J}).`});let j=e.length,N=0,G=!1;if(re!==void 0){let O=`${c}/prefixItems`,x=Math.min(re.length,j);for(;N<x;N++){let Y=Fe(e[N],re[N],o,r,n,i,`${s}/${N}`,`${O}/${N}`);if(l[N]=!0,!Y.valid){if(G=n,P.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:O,error:"Items did not match schema."},...Y.errors),G)break}}}if(le!==void 0){let O=`${c}/items`;if(Array.isArray(le)){let x=Math.min(le.length,j);for(;N<x;N++){let Y=Fe(e[N],le[N],o,r,n,i,`${s}/${N}`,`${O}/${N}`);if(l[N]=!0,!Y.valid){if(G=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...Y.errors),G)break}}}else for(;N<j;N++){let x=Fe(e[N],le,o,r,n,i,`${s}/${N}`,O);if(l[N]=!0,!x.valid){if(G=n,P.push({instanceLocation:s,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...x.errors),G)break}}if(!G&&je!==void 0){let x=`${c}/additionalItems`;for(;N<j;N++){let Y=Fe(e[N],je,o,r,n,i,`${s}/${N}`,x);if(l[N]=!0,!Y.valid)G=n,P.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:x,error:"Items did not match additional items schema."},...Y.errors)}}}if(Oe!==void 0)if(j===0&&Z===void 0)P.push({instanceLocation:s,keyword:"contains",keywordLocation:`${c}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Z!==void 0&&j<Z)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array has less items (${j}) than minContains (${Z}).`});else{let O=`${c}/contains`,x=P.length,Y=0;for(let W=0;W<j;W++){let ge=Fe(e[W],Oe,o,r,n,i,`${s}/${W}`,O);if(ge.valid)l[W]=!0,Y++;else P.push(...ge.errors)}if(Y>=(Z||0))P.length=x;if(Z===void 0&&se===void 0&&Y===0)P.splice(x,0,{instanceLocation:s,keyword:"contains",keywordLocation:O,error:"Array does not contain item matching schema."});else if(Z!==void 0&&Y<Z)P.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${c}/minContains`,error:`Array must contain at least ${Z} items matching schema. Only ${Y} items were found.`});else if(se!==void 0&&Y>se)P.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${c}/maxContains`,error:`Array may contain at most ${se} items matching schema. ${Y} items were found.`})}if(!G&&Ie!==void 0){let O=`${c}/unevaluatedItems`;for(;N<j;N++){if(l[N])continue;let x=Fe(e[N],Ie,o,r,n,i,`${s}/${N}`,O);if(l[N]=!0,!x.valid)P.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:O,error:"Items did not match unevaluated items schema."},...x.errors)}}if(ht)for(let O=0;O<j;O++){let x=e[O],Y=typeof x==="object"&&x!==null;for(let W=0;W<j;W++){if(O===W)continue;let ge=e[W];if(x===ge||Y&&typeof ge==="object"&&ge!==null&&ui(x,ge))P.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${c}/uniqueItems`,error:`Duplicate items at indexes ${O} and ${W}.`}),O=Number.MAX_SAFE_INTEGER,W=Number.MAX_SAFE_INTEGER}}}else if(h==="number"){if(o==="4"){if(I!==void 0&&(B===!0&&e<=I||e<I))P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${B?"or equal to ":""} ${I}.`});if(A!==void 0&&(X===!0&&e>=A||e>A))P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${X?"or equal to ":""} ${A}.`})}else{if(I!==void 0&&e<I)P.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${c}/minimum`,error:`${e} is less than ${I}.`});if(A!==void 0&&e>A)P.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${c}/maximum`,error:`${e} is greater than ${A}.`});if(B!==void 0&&e<=B)P.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${c}/exclusiveMinimum`,error:`${e} is less than ${B}.`});if(X!==void 0&&e>=X)P.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${c}/exclusiveMaximum`,error:`${e} is greater than or equal to ${X}.`})}if(ve!==void 0){let j=e%ve;if(Math.abs(0-j)>=0.00000011920929&&Math.abs(ve-j)>=0.00000011920929)P.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${c}/multipleOf`,error:`${e} is not a multiple of ${ve}.`})}}else if(h==="string"){let j=_e===void 0&&Pe===void 0?0:fy(e);if(_e!==void 0&&j<_e)P.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${c}/minLength`,error:`String is too short (${j} < ${_e}).`});if(Pe!==void 0&&j>Pe)P.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${c}/maxLength`,error:`String is too long (${j} > ${Pe}).`});if(Le!==void 0&&!new RegExp(Le,"u").test(e))P.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${c}/pattern`,error:"String does not match pattern."});if(de!==void 0&&Um[de]&&!Um[de](e))P.push({instanceLocation:s,keyword:"format",keywordLocation:`${c}/format`,error:`String does not match format "${de}".`})}return{valid:P.length===0,errors:P}}var gy=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",o=!0){this.schema=e,this.draft=t,this.shortCircuit=o,this.lookup=Oo(e)}validate(e){return Fe(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};Oo(e,this.lookup)}},Na=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Dl(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new gy(e,this.draft??this._draftFor(e),this.shortcircuit);return(o)=>{let r=t.validate(o);return r.valid?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:r.errors.map((n)=>`${n.instanceLocation}: ${n.error}`).join("; ")}}}};var Sy;Sy=globalThis.crypto;var zr=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e){super(e);this.name=new.target.name,no(this,new.target)}},zy=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`);this.kind=e,this.expected=t,this.received=o}},Ry=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},xy=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},Py=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},Ey=class extends zr{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var Km=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",no(this,new.target)}};var qa=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),Ym=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(wl(e))}set(e,t){let o=wl(e),r=qa.has(e.method),n=!this._entries.has(o);if(!r&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let s of this._entries.keys())if(!qa.has(s.slice(0,s.indexOf("\x00")))){this._entries.delete(s),this._cappedSize--;break}}let i=++this._stamp;if(this._entries.set(o,{...t,stamp:i}),n&&!r)this._cappedSize++;return i}delete(e){if(this._entries.delete(wl(e))&&!qa.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,o=qa.has(e);for(let r of this._entries.keys())if(r.startsWith(t)){if(this._entries.delete(r),!o)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function wl(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function zl(e,t){return t===void 0?e:`${e}\x00${t}`}var Qm=86400000,ky=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,o=()=>{},r="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=o,this._cachePartition=r,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let o={method:e,params:t??""},r=this._partitionFor("private"),n=await this._store.get({...o,partition:r});if(n!==void 0)return n;let i=this._partitionFor("public");if(i===r)return;let s=await this._store.get({...o,partition:i});return s?.scope==="public"?s:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let o=this._partitionFor("private"),r=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}if(r!==o)try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}}async evictKey(e,t){let o=zl(e,t),r=this._evictionGeneration.get(o);if(r!==void 0)this._evictionGeneration.set(o,r+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let o=zl(e,t),r=this._evictionGeneration.get(o)??0;return this._evictionGeneration.set(o,r),r}async write(e,t,o,r){if((this._evictionGeneration.get(zl(e,r?.params))??0)!==o)return;let n=r?.params??"",i=this._partitionFor("private"),s=this._partitionFor("public"),c=(r?.scope??"private")==="public"?s:i;try{await this._store.set({method:e,params:n,partition:c},{value:Ty(t),expiresAt:r?.expiresAt,scope:r?.scope})}catch(l){this._reportError(l)}if(s!==i)try{await this._store.delete({method:e,params:n,partition:c===i?s:i})}catch(l){this._reportError(l)}}async read(e,t){let o=await this._probe(e,t);if(o?.expiresAt===void 0||!(o.expiresAt>this.now()))return;try{let r=JSON.parse(o.value);if(typeof r!=="object"||r===null||Array.isArray(r))throw TypeError("cached document is not an object");return{value:r}}catch(r){this._reportError(r),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let o=this._decodeListTools(t),r=new Map;if(o!==void 0)for(let n of o.tools)r.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:r}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let o=await this._probe("tools/list");if(o===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==o.stamp){let r=this._decodeListTools(o)??{tools:[]},n=new Map;for(let i of r.tools){let s=t(i);if(s!==void 0)n.set(i.name,s)}this._toolOutputValidatorIndex={stamp:o.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((o)=>o!==null&&typeof o==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function Ty(e){let t;try{t=JSON.stringify(e)}catch(o){throw TypeError(`cache value is not JSON-serializable: ${o instanceof Error?o.message:String(o)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var $y=Symbol.for("mcp.authSeamEscape");function Cy(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[$y]===!0}var Iy=-32022,Oy=new Set([-32001,-32020,-32021]);function My(e,t){switch(e.kind){case"result":return Ay(e.result,t);case"rpc-error":return Xm(e,t);case"http-error":return Ny(e,t);case"network-error":return Hm(e.error,t);case"unusable-reply":return{kind:"error",error:new q(F.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${ef(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Hm(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new q(F.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function Ay(e,t){let o=Lt(Oa).validateResult("server/discover",e);if(!o.ok)return{kind:"legacy"};let r=o.value.supportedVersions,n=t.clientModernVersions.find((i)=>r.includes(i));if(n!==void 0)return{kind:"modern",version:n,discover:o.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new ii({supported:[...r],requested:t.requestedVersion})}}function Xm(e,t){let{code:o,message:r,data:n}=e;if(o===Iy){let i=jy(n);if(i===void 0)return{kind:"legacy"};let s=new ii({supported:i,requested:Ly(n)??t.requestedVersion},r),c=si(i),l=t.clientModernVersions.find((u)=>c.includes(u));if(l!==void 0)return{kind:"corrective",version:l,error:s};if(c.length>0)return{kind:"error",error:s};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:s}}if(Oy.has(o))return{kind:"legacy"};return{kind:"legacy"}}function Ny(e,t){if(e.status===401||e.status===403){let r=e.status===403;return{kind:"error",error:new ni(r?F.ClientHttpForbidden:F.ClientHttpAuthentication,`Version negotiation failed: ${r?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new ni(F.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let o=Uy(e.body);if(o!==void 0)return Xm(o,t);return{kind:"legacy"}}function Hm(e,t){if(t.environment==="browser"&&qy(e))return{kind:"legacy"};return{kind:"error",error:new q(F.EraNegotiationFailed,`Version negotiation probe failed: ${ef(e)}`,{cause:e},{cause:e})}}function qy(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function ef(e){return e instanceof Error?e.message:String(e)}function jy(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((o)=>typeof o==="string"))return;return t}function Ly(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function Uy(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let o=t.error;if(typeof o!=="object"||o===null)return;let{code:r,message:n,data:i}=o;if(typeof r!=="number")return;return{code:r,message:typeof n==="string"?n:"",data:i}}var Dy="legacy";function Zy(e,t){let o=e?.mode??Dy;if(o==="legacy")return{kind:"legacy"};let r=e?.probe??{};if(typeof o==="object"){if(!Ut(o.pin))throw TypeError(`versionNegotiation: { pin: '${o.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:o.pin,probe:r}}let n=t?si(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...ul],fallbackAvailable:t?dl(t).length>0:!0,probe:r}}function Fm(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Vm(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var Hy=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let o=new e(t);t.onmessage=(r)=>{let n=o._pending;if(n!==void 0&&(wr(r)||ai(r))&&r.id===n.id){if(o._pending=void 0,wr(r))n.resolve({kind:"response",result:r.result});else n.resolve({kind:"response",error:r.error});return}},t.onerror=(r)=>{o._savedOnError?.(r)},t.onclose=()=>{let r=o._pending;if(r!==void 0)o._pending=void 0,r.resolve({kind:"closed"});o._closeDelivered=!0,o._savedOnClose?.()};try{await t.start()}catch(r){throw o.detach(),r}return o}async exchange(t,o){let r=`server-discover-probe-${++this._probeCounter}`;return new Promise((n)=>{let i=!1,s=(l)=>{if(i)return;if(i=!0,clearTimeout(c),this._pending?.id===r)this._pending=void 0;n(l)},c=setTimeout(()=>s({kind:"timeout"}),o);this._pending={id:r,resolve:s},this._transport.send(t(r)).catch((l)=>s({kind:"send-error",error:l}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,o=this._transport,r=!1,n=()=>{if(!r){r=!0;return}t()};o.onclose=n,xl.set(o,()=>{if(o.onclose===n)o.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,o=t.start,r=!0;t.start=async function(){if(r){r=!1,t.start=o;return}return o.call(t)}}},xl=new WeakMap;function Jm(e){let t=xl.get(e);xl.delete(e),t?.()}function Fy(e,t,o,r){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Lt(t).outboundEnvelope({protocolVersion:t,clientInfo:o,clientCapabilities:r})}}}function Vy(e){if(e instanceof q&&e.code===F.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function Jy(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let o=e.error;if(Cy(o)||o instanceof Km||o instanceof Error&&o.name==="UnauthorizedError")return{kind:"auth-required",error:o};if(o instanceof ni){let r=o.data?.text;return{kind:"http-error",status:o.data.status,body:typeof r==="string"?r:void 0,statusText:o.data.statusText}}if(Vy(o))return{kind:"unusable-reply",error:o};return{kind:"network-error",error:o}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function tf(e,t){let o=e.probe.timeoutMs??t.defaultTimeoutMs,r=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,i=e.kind==="auto"&&e.fallbackAvailable,s=await Hy.open(t.transport),c=async()=>{let u=n[0],h=!1,m=r;for(;;){let f=await s.exchange((b)=>Fy(b,u,t.clientInfo,t.capabilities),o);if(f.kind==="timeout"&&m>0){m--;continue}let S=Jy(f,o),y=My(S,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:i,environment:t.environment,transportKind:t.transportKind});switch(y.kind){case"modern":return{era:"modern",version:y.version,discover:y.discover};case"corrective":if(h)throw y.error;h=!0,u=y.version;continue;case"legacy":{let b=S.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new q(F.EraNegotiationFailed,b===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${b} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new q(F.EraNegotiationFailed,b===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${b} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(b!==void 0&&t.disposableProbe!==!0)throw new q(F.EraNegotiationFailed,`Version negotiation failed: ${b} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw y.error}}},l;try{l=await c()}catch(u){throw s.detach(),u}return s.release(),l}function By(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let o=e._serverParams;return typeof o==="object"&&o!==null&&typeof o.command==="string"?o:void 0}async function Gy(e,t,o,r){let i=new t.constructor({...o,stderr:"ignore"}),s=t.close,c=!1,l,u=new Promise((m,f)=>{l=()=>f(Bm())});t.close=async function(){return c=!0,l?.(),s.call(t)};let h;try{let m=tf(e,{...r,transport:i,transportKind:"stdio",disposableProbe:!0});m.catch(()=>{}),h=await Promise.race([m,u])}finally{await Wy(i),t.close=s}if(c)throw Bm();return h}function Bm(){return new q(F.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function Wy(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Gm(e){let t=e._meta?.[Pt];return yl.Implementation(t)?t:void 0}function ja(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let o=t,r=e.properties;for(let n of Object.keys(r)){let i=r[n];if(o[n]===void 0&&Object.prototype.hasOwnProperty.call(i,"default"))o[n]=i.default;if(o[n]!==void 0)ja(i,o[n])}}if(Array.isArray(e.anyOf)){for(let o of e.anyOf)if(typeof o!=="boolean")ja(o,t)}if(Array.isArray(e.oneOf)){for(let o of e.oneOf)if(typeof o!=="boolean")ja(o,t)}}function of(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,o=e.url!==void 0;return{supportsFormMode:t||!t&&!o,supportsUrlMode:o}}function Ky(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&eo.safeParse(e.discover).success)return e}throw new q(F.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Wm={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},Yy=64,Rl={},Qy=class extends li{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{Rl.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,Rl.walkPages=(e,t,o,r)=>e._walkPages(t,o,r),Rl.readResource=(e,t,o)=>e._readResource(t,o)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new q(F.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Na,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=Am(t?.inputRequired),this._cache=new ky(t?.responseCacheStore??new Ym,t?.responseCacheStore!==void 0,(o)=>this._reportStoreError(o),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??Yy,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Ut(this._negotiatedProtocolVersion)&&Ma(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new q(F.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return Lm({getRequestHandler:(o)=>this._getRequestHandler(o),buildContext:(o)=>this.buildContext(o,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=vl(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(o,r)=>{let n=Lt(this._negotiatedProtocolVersion),i=n.validateRequest("elicitation/create",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("elicitation/create",o);if(!i.ok)throw new xe(i.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,i.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${i.message}`);let{params:s}=i.value;s.mode=s.mode??"form";let{supportsFormMode:c,supportsUrlMode:l}=of(this._capabilities.elicitation);if(s.mode==="form"&&!c)throw new xe(Q.InvalidParams,"Client does not support form-mode elicitation requests");if(s.mode==="url"&&!l)throw new xe(Q.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(o,r),h=n.validateResult("elicitation/create",u);if(!h.ok&&h.reason==="not-in-era")h=n.validateInputResponse("elicitation/create",u);if(!h.ok)throw new xe(h.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,h.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${h.message}`);let m=h.value,f=s.mode==="form"?s.requestedSchema:void 0;if(s.mode==="form"&&m.action==="accept"&&m.content&&f&&this._capabilities.elicitation?.form?.applyDefaults)try{ja(f,m.content)}catch{}return m};if(e==="sampling/createMessage")return async(o,r)=>{let n=Lt(this._negotiatedProtocolVersion),i=n.validateRequest("sampling/createMessage",o);if(!i.ok&&i.reason==="not-in-era")i=n.validateInputRequest("sampling/createMessage",o);if(!i.ok)throw new xe(i.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,i.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${i.message}`);let{params:s}=i.value,c=await t(o,r),l=Boolean(s.tools||s.toolChoice),u=n.samplingResultVariant(l,c);if(!u.ok&&u.reason==="not-in-era")u=n.validateInputResponse("sampling/createMessage",c);if(!u.ok)throw new xe(u.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new q(F.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,Ky(t.prior),t);let o=Zy(this._versionNegotiation,this._supportedProtocolVersionsOption);if(o.kind!=="legacy")return this._connectNegotiated(e,o,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let o=this._negotiatedProtocolVersion;if(o!==void 0)e.setProtocolVersion?.(o);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let o=dl(this._supportedProtocolVersions);try{let r=o[0];if(r===void 0)throw new q(F.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:r,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!o.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);if(this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(n.protocolVersion);if(this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(r){throw this.close(),r}}async _connectNegotiated(e,t,o){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;if(n!==void 0&&e.setProtocolVersion)e.setProtocolVersion(n);return}this._resetConnectionState();let r;try{let n=Vm(e),i={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Fm(),defaultTimeoutMs:o?.timeout??ci},s=n==="stdio"?By(e):void 0;r=s===void 0?await tf(t,{...i,transport:e,transportKind:n}):await Gy(t,e,s,i)}catch(n){throw await e.close().catch(()=>{}),Jm(e),n}if(Jm(e),await super.connect(e),r.era==="legacy"){await this._legacyHandshake(e,o);return}if(this._serverCapabilities=r.discover.capabilities,this._serverVersion=Gm(r.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.discover.instructions,this._discoverResult=r.discover,this._negotiatedProtocolVersion=r.version,e.setProtocolVersion)e.setProtocolVersion(r.version);if(this._listChangedConfig){let n=this._listChangedConfig,i=this._serverCapabilities,s={...n.tools&&i?.tools?.listChanged&&{tools:n.tools},...n.prompts&&i?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&i?.resources?.listChanged&&{resources:n.resources}},c=!0;try{this._setupListChangedHandlers(s)}catch(u){c=!1,this.onerror?.(u instanceof Error?u:Error(String(u)))}let l=c?{...s.tools&&{toolsListChanged:!0},...s.prompts&&{promptsListChanged:!0},...s.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(l).length>0){let u=new AbortController,h=()=>u.abort(o?.signal?.reason);if(o?.signal?.aborted)h();o?.signal?.addEventListener("abort",h);try{this._autoOpenedSubscription=await this.listen(l,{timeout:o?.timeout,signal:u.signal})}catch(m){if(o?.signal?.aborted)throw await this.close().catch(()=>{}),m;this.onerror?.(m instanceof Error?m:Error(String(m)))}finally{o?.signal?.removeEventListener("abort",h)}}}}async _connectFromPrior(e,t,o){if(t.kind==="legacy")return this._connectPlainLegacy(e,o);let r=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,i=(n&&si(n).length>0?si(n):ul).find((s)=>r.supportedVersions.includes(s));if(i===void 0)throw new q(F.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=r,this._serverCapabilities=r.capabilities,this._serverVersion=Gm(r),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=r.instructions,this._negotiatedProtocolVersion=i,e.setProtocolVersion?.(i),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(s){this.onerror?.(s instanceof Error?s:Error(String(s)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return Ut(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new q(F.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new q(F.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new q(F.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new q(F.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new q(F.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new q(F.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new q(F.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new q(F.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new q(F.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new q(F.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},eo,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let o=await this._serveFromCache("prompts/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("prompts/list",e,t,(r)=>r.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let o=await this._serveFromCache("resources/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/list",e,t,(r)=>r.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let o=await this._serveFromCache("resources/templates/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("resources/templates/list",e,t,(r)=>r.resourceTemplates)}async _listAllPages(e,t,o,r,n){let i=o?.cacheMode==="bypass",s=this._cache.captureGeneration(e),c=(u)=>{let h=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...h&&{params:h}},o)},l=await this._walkPages(e,c,r);if(delete l.nextCursor,n?.(l),i)return l;return await this._cache.write(e,l,s,this._freshness(l)),l}async _walkPages(e,t,o){let r=await t(void 0),n=r.nextCursor,i=r,s=1;while(n!==void 0){if(this._listMaxPages!==0&&s>=this._listMaxPages)throw new q(F.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let c=await t(n);if(c.nextCursor===n&&JSON.stringify(o(c))===JSON.stringify(o(i)))break;o(r).push(...o(c)),i=c,n=c.nextCursor,s++}return r}_freshness(e,t){let o=e,r=typeof o.ttlMs==="number"?o.ttlMs:this._defaultCacheTtlMs,n=o.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,r),Qm),scope:n,params:t}}async _serveFromCache(e,t,o){if(o?.cacheMode==="bypass"||o?.cacheMode==="refresh")return;let r=await this._cache.read(e,t).catch((n)=>void this._reportStoreError(n));if(r!==void 0){if(o?.signal?.aborted){let n=o.signal.reason;throw n instanceof q?n:new q(F.RequestTimeout,String(n))}return r.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let o=t??await this._cache.toolDefinition(e);return o===void 0?void 0:Sl(o.inputSchema)}async readResource(e,t){let{result:o}=await this._readResource(e,t);return o}async _readResource(e,t){let o=await this._serveFromCache("resources/read",e.uri,t);if(o!==void 0)return{result:o,cached:!0};let r=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let i=this._freshness(n,e.uri);if(i.expiresAt>this._cache.now())await this._cache.write("resources/read",n,r,i);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:n,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new q(F.NotConnected,"Not connected");let o=this._negotiatedProtocolVersion;if(o===void 0||!Ut(o))throw new q(F.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${o??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:o});if(t?.signal?.aborted){let z=t.signal.reason;throw z instanceof q?z:new q(F.RequestTimeout,String(z))}let r=new AbortController,n=`listen:${this._nextListenId++}`,i="opening",s,c,l,u,h=new Promise((z,R)=>{l=z,u=R}),m,f=new Promise((z)=>{m=z}),S=(z)=>{if(i==="closed")return;let R=i==="opening";if(s!==void 0)clearTimeout(s),s=void 0;if("ack"in z){i="open",l(z.ack);return}if(i="closed",c!==void 0)t?.signal?.removeEventListener("abort",c);if(this._listenState.delete(n),r.abort(),m(z.cause),R)u(z.error??new q(F.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},y=async()=>{r.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},b=async()=>{if(i==="closed")return;S({cause:"local"}),await y()};this._listenState.set(n,{settle:S});let v=t?.timeout??ci;if(s=setTimeout(()=>{S({cause:"remote",error:new q(F.RequestTimeout,"subscriptions/listen ack timed out",{timeout:v})}),y().catch(()=>{})},v),t?.signal){let z=t.signal;c=()=>{if(i==="closed")return;let R=z.reason;S({cause:"local",error:R instanceof Error?R:Error(String(R??"Aborted"))}),y().catch(()=>{})},z.addEventListener("abort",c,{once:!0})}let k={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},U=(z)=>{S({cause:"remote",error:z instanceof Error?z:Error(String(z))})};try{this.transport.send(k,{requestSignal:r.signal,onRequestStreamEnd:()=>S({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(U)}catch(z){U(z)}return{honoredFilter:await h,close:b,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let o=Object.hasOwn(Wm,e.method)?Wm[e.method]:void 0;if(e.method==="notifications/resources/updated"){let r=e.params?.uri;if(typeof r==="string")this._cache.evictKey("resources/read",r)}else if(o!==void 0)for(let r of o)this._cache.evict(r);if(e.method==="notifications/subscriptions/acknowledged"){let r=e.params?._meta?.[Bo],n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){let i=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:i.ok?i.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let r=e.params?.requestId,n=typeof r==="string"?this._listenState.get(r):void 0;if(n!==void 0){n.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,o=typeof t==="string"?this._listenState.get(t):void 0;if(o!==void 0){if(ai(e))o.settle({cause:"remote",error:xe.fromError(e.error.code,e.error.message,e.error.data)});else o.settle({cause:"graceful",error:new q(F.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new q(F.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let o=this.getProtocolEra()==="modern"&&Fm()!=="browser",r=async()=>{if(!o)return t;let l;try{l=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(h){this._reportStoreError(h)}if(!l?.valid||l.declarations.length===0)return t;let u=Om(l.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(l)=>this._compileOutputValidator(l)).catch((l)=>void this._reportStoreError(l)):this._compileOutputValidator(t.toolDefinition),i=()=>{if(n===void 0||n.ok)return;let l=n.compileError,u=(l instanceof Error?l.message:String(l)).slice(0,200);throw new xe(Q.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};i();let s;try{s=await this.request({method:"tools/call",params:e},await r())}catch(l){let u=l instanceof xe&&l.code===vr;if(!o||!u||t?.toolDefinition!==void 0)throw l;let h={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,h).catch((m)=>this._reportStoreError(m)),n=await this._cache.outputValidator(e.name,(m)=>this._compileOutputValidator(m)).catch((m)=>void this._reportStoreError(m)),i(),s=await this.request({method:"tools/call",params:e},await r())}let c=n!==void 0&&n.ok?n.validator:void 0;if(c){if(s.structuredContent===void 0&&!s.isError)throw new xe(Q.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent!==void 0&&!s.isError)try{let l=c(s.structuredContent);if(!l.valid)throw new xe(Q.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)}catch(l){if(l instanceof xe)throw l;throw new xe(Q.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return s}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let r=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(r),r}let o=await this._serveFromCache("tools/list",void 0,t);if(o!==void 0)return o;return this._listAllPages("tools/list",e,t,(r)=>r.tools,(r)=>this._excludeInvalidXMcpHeaderTools(r))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Vm(this.transport)==="stdio")return;let t=e.tools.filter((o)=>{let r=Sl(o.inputSchema);if(!r.valid)return console.warn(`[mcp-sdk] excluding tool '${o.name}' from tools/list: invalid x-mcp-header declaration — ${r.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,o,r){let n=Aa(ds,o);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof o.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:s}=n.data,{onChanged:c}=o,l=async()=>{if(!i){c(null,null);return}try{c(null,await r())}catch(h){c(h instanceof Error?h:Error(String(h)),null)}},u=()=>{if(s){let h=this._listChangedDebounceTimers.get(e);if(h)clearTimeout(h);let m=setTimeout(l,s);this._listChangedDebounceTimers.set(e,m)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var VR=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return pt(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return pt(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,no(this,new.target)}};class lf{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);if(o.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);o.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let o=this._eventSlots.get(e);if(!o)return;let r=o.listeners.indexOf(t);if(r!==-1)o.listeners.splice(r,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(!o)return;o.onHandler?.(t);for(let r of[...o.listeners])r(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class uf{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var rf=new Set;function nf(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,s=e==="request"?"setRequestHandler":"setNotificationHandler";if(!rf.has(s))rf.add(s),console.warn(`[ext-apps] ${s}(Schema, handler) is deprecated; use ${s}("${i}", { params: Schema.shape.params }, handler).`);let c=r;return[i,{params:n.params},e==="request"?(l,u)=>c({method:i,params:l},Xy(u)):(l)=>c({method:i,params:l})]}function Xy(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var eb="2026-01-26";var tb="ui/notifications/tool-input-partial";class df{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(o)=>{if(t&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=zo.safeParse(o.data);if(r.success)console.debug("Parsed message",r.data),this.onmessage?.(r.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",r.error.message,o);else console.error("Failed to parse message",r.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==tb)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var ob=C([p("light"),p("dark")]).describe("Color theme preference for the host environment."),di=C([p("inline"),p("fullscreen"),p("pip")]).describe("Display mode for UI presentation."),rb=C([p("--color-background-primary"),p("--color-background-secondary"),p("--color-background-tertiary"),p("--color-background-inverse"),p("--color-background-ghost"),p("--color-background-info"),p("--color-background-danger"),p("--color-background-success"),p("--color-background-warning"),p("--color-background-disabled"),p("--color-text-primary"),p("--color-text-secondary"),p("--color-text-tertiary"),p("--color-text-inverse"),p("--color-text-ghost"),p("--color-text-info"),p("--color-text-danger"),p("--color-text-success"),p("--color-text-warning"),p("--color-text-disabled"),p("--color-border-primary"),p("--color-border-secondary"),p("--color-border-tertiary"),p("--color-border-inverse"),p("--color-border-ghost"),p("--color-border-info"),p("--color-border-danger"),p("--color-border-success"),p("--color-border-warning"),p("--color-border-disabled"),p("--color-ring-primary"),p("--color-ring-secondary"),p("--color-ring-inverse"),p("--color-ring-info"),p("--color-ring-danger"),p("--color-ring-success"),p("--color-ring-warning"),p("--font-sans"),p("--font-mono"),p("--font-weight-normal"),p("--font-weight-medium"),p("--font-weight-semibold"),p("--font-weight-bold"),p("--font-text-xs-size"),p("--font-text-sm-size"),p("--font-text-md-size"),p("--font-text-lg-size"),p("--font-heading-xs-size"),p("--font-heading-sm-size"),p("--font-heading-md-size"),p("--font-heading-lg-size"),p("--font-heading-xl-size"),p("--font-heading-2xl-size"),p("--font-heading-3xl-size"),p("--font-text-xs-line-height"),p("--font-text-sm-line-height"),p("--font-text-md-line-height"),p("--font-text-lg-line-height"),p("--font-heading-xs-line-height"),p("--font-heading-sm-line-height"),p("--font-heading-md-line-height"),p("--font-heading-lg-line-height"),p("--font-heading-xl-line-height"),p("--font-heading-2xl-line-height"),p("--font-heading-3xl-line-height"),p("--border-radius-xs"),p("--border-radius-sm"),p("--border-radius-md"),p("--border-radius-lg"),p("--border-radius-xl"),p("--border-radius-full"),p("--border-width-regular"),p("--shadow-hairline"),p("--shadow-sm"),p("--shadow-md"),p("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),nb=E(rb.describe(`Style variables for theming MCP apps.
|
|
72
72
|
|
|
73
73
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
74
74
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -106,6 +106,6 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
106
106
|
- omitted: host decides border`)}),cx=d({method:p("ui/request-display-mode"),params:d({mode:di.describe("The display mode being requested.")})}),Sb=d({mode:di.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),_b=C([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),lx=d({resourceUri:a().optional(),visibility:g(_b).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
107
107
|
- "model": Tool visible to and callable by the agent
|
|
108
108
|
- "app": Tool callable by the app from this server only`),csp:Yc().optional(),permissions:Yc().optional()}),ux=d({mimeTypes:g(a()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),dx=d({method:p("ui/download-file"),params:d({contents:g(C([ko,To])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),px=d({method:p("ui/message"),params:d({role:p("user").describe('Message role, currently only "user" is supported.'),content:g(Tt).describe("Message content blocks (text, image, etc.).")})}),hx=d({method:p("ui/notifications/sandbox-resource-ready"),params:d({html:a().describe("HTML content to load into the inner iframe."),sandbox:a().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Pl.optional().describe("CSP configuration from resource metadata."),permissions:El.optional().describe("Sandbox permissions from resource metadata.")})}),yb=d({method:p("ui/notifications/tool-result"),params:oo.describe("Standard MCP tool execution result.")}),pf=d({toolInfo:d({id:vt.optional().describe("JSON-RPC id of the tools/call request."),tool:to.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:ob.optional().describe("Current color theme preference."),styles:pb.optional().describe("Style configuration for theming the app."),displayMode:di.optional().describe("How the UI is currently displayed."),availableDisplayModes:g(di).optional().describe("Display modes the host supports."),containerDimensions:C([d({height:w().describe("Fixed container height in pixels.")}),d({maxHeight:C([w(),Kc()]).optional().describe("Maximum container height in pixels.")})]).and(C([d({width:w().describe("Fixed container width in pixels.")}),d({maxWidth:C([w(),Kc()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
109
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:a().optional().describe("User's language and region preference in BCP 47 format."),timeZone:a().optional().describe("User's timezone in IANA format."),userAgent:a().optional().describe("Host application identifier."),platform:C([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d({touch:T().optional().describe("Whether the device supports touch input."),hover:T().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:d({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),bb=d({method:p("ui/notifications/host-context-changed"),params:pf.describe("Partial context update containing only changed fields.")}),mx=d({method:p("ui/update-model-context"),params:d({content:g(Tt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E(a(),L().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),fx=d({method:p("ui/initialize"),params:d({appInfo:Et.describe("App identification (name and version)."),appCapabilities:gb.describe("Features and capabilities this app provides."),protocolVersion:a().describe("Protocol version this app supports.")})}),vb=d({protocolVersion:a().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Et.describe("Host application identification and version."),hostCapabilities:fb.describe("Features and capabilities provided by the host."),hostContext:pf.describe("Rich context about the host environment.")}).passthrough(),wb={target:"draft-2020-12"};async function af(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](wb);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function cf(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let s=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function zb(e,t){let o={...e,...t};if(t.experimental!==void 0)o.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)o.tools={...e.tools,...t.tools};return o}class La extends li{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new lf;_methods=new uf;setRequestHandler=(...e)=>{let[t,...o]=nf("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=nf("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...o)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:cb,toolinputpartial:lb,toolresult:yb,toolcancelled:ub,hostcontextchanged:bb};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!La.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>{let r=o;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...r};this._events.dispatch(e,r)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},o={autoResize:!0}){super(o);if(this._appInfo=e,this._appCapabilities=t,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval)ct({jitless:!0});this.replaceRequestHandler("ping",(r)=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=zb(this._appCapabilities,e)}registerTool(e,t,o){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,n=()=>{if(r._initializedSent&&r._appCapabilities.tools?.listChanged)r.sendToolListChanged()},i=t.inputSchema!==void 0,s={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==s)return;delete r._registeredTools[e],n()},handler:async(c,l)=>{if(!s.enabled)throw Error(`Tool ${e} is disabled`);let u;if(i){let h=s.inputSchema,m=h?await cf(h,c??{},`Invalid input for tool ${e}: `):c??{};u=await o(m,l)}else u=await o(l);if(s.outputSchema&&!u.isError)u.structuredContent=await cf(s.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `);return u}};if(this._registeredTools[e]=s,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),s}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let o=this._registeredTools[e.name];if(!o)throw Error(`Tool ${e.name} not found`);return o.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let n={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await af(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await af(r.outputSchema,"output");if(r.annotations)n.annotations=r.annotations;if(r._meta)n._meta=r._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:hb.shape.params,result:mb},(t,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,o)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},ab,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},Xt,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},sb,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},ib,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},Sb,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,o=0,r=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let i=document.documentElement,s=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=s;let l=Math.ceil(window.innerWidth);if(l!==t||c!==o)t=l,o=c,this.sendSizeChanged({width:l,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new df(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:eb}},vb,t);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}var Rb=(e)=>typeof e==="object"&&e!==null,hf=(e)=>new Map([...e].flatMap(([t,o])=>o.hot?[[o.hot.id,{uri:t,source:o.hot.source,record:o}]]:[]));function mf(){let e=new Map,t=new Set,o=!1,r;function n(s){let l={data:e.get(s)?.data??{},callbacks:[],listeners:new Map};return e.set(s,l),{data:l.data,accept(u,h){if(!u||typeof u==="function"){let m=typeof u==="function"?u:void 0;l.callbacks.push({deps:[s],callback:(f)=>m?.(f[0])})}else l.callbacks.push({deps:typeof u==="string"?[u]:u,callback:(m)=>h?.(typeof u==="string"?m[0]:m)})},acceptExports(u,h){l.callbacks.push({deps:[s],callback:(m)=>h?.(m[0])})},dispose(u){l.dispose=u},prune(u){l.prune=u},invalidate(){o=!0},decline(){o=!0},on(u,h){let m=l.listeners.get(u)??new Set;m.add(h),l.listeners.set(u,m)},off(u,h){l.listeners.get(u)?.delete(h)},send(){throw Error("Preview hot-update custom messages are not a public transport.")}}}async function i(s){for(let c of e.values())for(let l of c.listeners.get(s)??[])await l()}return{context:n,observe(s,c,l){let u=e.get(s);if(!u)return;let m=import(c).then((f)=>{u.exports=Rb(f)?f:void 0,u.isComponent=l});t.add(m),m.then(()=>t.delete(m),(f)=>{t.delete(m),r=f})},async update(s,c,l,u){if(await Promise.all(t),r)throw r;let h=hf(s),m=hf(c),f=new Map,S=new Map;for(let[v,{record:k}]of h)for(let U of[...k.imports,...k.dynamicImports]){let z=s.get(U)?.hot?.id;if(!z)continue;let R=f.get(z)??new Set;R.add(v),f.set(z,R)}function y(v,k=new Set){if(k.has(v))return!1;let U=e.get(v);if(U?.callbacks.some((M)=>M.deps.includes(v))&&m.has(v))return S.set(v,U),!0;let z=f.get(v);if(!z?.size)return!1;let R=new Set([...k,v]);for(let M of z)if(!y(M,R))return!1;return!0}for(let[v,k]of h){let U=m.get(v);if(!U||k.source!==U.source){if(!y(v))return!1}}if(!S.size)return!0;o=!1,await i("vite:beforeUpdate");let b=[];for(let[v,k]of S){if(!u())return!1;await k.dispose?.(k.data);let U=m.get(v)?.uri??"";b.push([v,k,await l(U)])}if(!u())return!1;for(let[,v,k]of b){let{isComponent:U,exports:z}=v;if(!U)continue;let R=Object.keys(k).filter((M)=>M!=="__esModule");if(!z||R.length!==Object.keys(z).filter((M)=>M!=="__esModule").length||R.some((M)=>!Object.hasOwn(z,M)||!U(k[M])&&z[M]!==k[M]))return!1}for(let[v,k,U]of b)for(let z of k.callbacks)if(z.deps.includes(v))await z.callback(z.deps.map((R)=>R===v?U:void 0));return await i("vite:afterUpdate"),await new Promise((v)=>setTimeout(v,20)),u()&&!o},async dispose(){for(let s of e.values())await s.dispose?.(s.data),await s.prune?.(s.data);e.clear(),t.clear(),r=void 0}}}var xb=["imports","dynamicImports","styles","references"],Rr=(e)=>typeof e==="object"&&e!==null,ff=(e)=>Rr(e)?e.message:void 0,pi=(e,t,o)=>Object.assign(Error(e,o),t);function Pb(e,t){if(Rr(e))Reflect.set(e,"resourceUri",t);return e}var gf=(e)=>Rr(e)?e.epoch:void 0;function kl(e){if(typeof e.module!=="string")throw Error(`Missing preview dependency metadata: ${String(e.module)}`);return e.module}var Eb=(e)=>Rr(e)?e:{};async function kb(e,t){let o=await crypto.subtle.digest("SHA-256",t),r="sha256:"+[...new Uint8Array(o)].map((n)=>n.toString(16).padStart(2,"0")).join("");if(t.length!==e?.size||r!==e.digest)throw pi("Preview resource integrity check failed. Rebuild and reopen the preview.",{code:"ADS_RESOURCE_INTEGRITY",category:"build"});return t}function Sf(e,t){let o=[],r=new Set;function n(i){if(r.has(i))return;r.add(i);let s=e.get(i);if(!s)throw Error(`Missing preview dependency metadata: ${i}`);for(let c of[...s.imports,...s.styles,...s.references])n(c);o.push(i)}return n(t),o}function _f(e,t){if(!e||e.revision===t.revision)return[];let o=(r,n)=>{let i=new Map(Object.entries(r.assets));return JSON.stringify(Sf(i,kl(n)).map((s)=>[s,i.get(s)]))};return t.scenarios.filter((r)=>{let n=e.scenarios.find((i)=>i.id===r.id);return!n||o(e,n)!==o(t,r)}).map((r)=>r.id)}function Tb(e,t,o,r){let{digest:n,hot:i}=t;if(!/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/.test(e)||typeof n!=="string"||!/^sha256:[a-f0-9]{64}$/.test(n))return null;if(i&&(!o.refresh||t.kind!=="module"||!Rr(i)||typeof i.id!=="string"||!i.id||i.id.length>4096||r.has(i.id)||typeof i.source!=="string"||!/^[a-f0-9]{64}$/.test(i.source)))return null;if(!xb.every((s)=>Array.isArray(t[s])&&t[s].every((c)=>Object.hasOwn(o.assets,c))))return null;return t}class Tl{read;records=new Map;bytes=new Map;urls=new Map;styles=new Map;styleReady=new Map;revisions=new Set;loadedModules=new Set;executed=new Map;moduleHistory=new Set;importing=Promise.resolve();mounting=Promise.resolve();refreshDirty=!1;generation=0;prefetchGeneration=0;closed=!1;hot;mounted;unmount;constructor(e){this.read=e,this.hot=mf(),Reflect.set(globalThis,"__adsPreviewHot",this.hot),Reflect.set(globalThis,"__dsPreviewImport",(t)=>this.importModule(t))}register(e){if(e.schemaVersion!==1||!Array.isArray(e.scenarios)||!e.assets||typeof e.revision!=="string")throw Error("Unsupported preview manifest. Rebuild previews with the installed ADS version.");let t=e.refresh;if(t&&(!Rr(t)||t.version!==1||typeof t.epoch!=="string"||!t.epoch||t.epoch.length>100))throw Error("Unsupported preview refresh protocol. Reopen with the current ADS version.");let o=new Set,r=[];for(let[n,i]of Object.entries(e.assets)){let s=Tb(n,i,e,o);if(!s)throw Error("Invalid preview dependency graph.");if(s.hot)o.add(s.hot.id);if(this.records.has(n)&&this.records.get(n)?.digest!==s.digest)throw pi("An immutable preview resource changed its content. Rebuild previews with the current ADS version.",{code:"ADS_RESOURCE_IDENTITY",category:"build",resourceUri:n});r.push([n,s])}for(let[n,i]of r)this.records.set(n,i)}async resource(e){let t=this.bytes.get(e);if(!t)t=(async()=>{let o=this.records.get(e);if(!o)throw Error(`Unknown preview dependency: ${e}`);let r;try{r=await this.read(e)}catch(s){throw pi(`Preview resource read failed for ${e}: ${String(ff(s))}`,{code:"ADS_RESOURCE_READ",category:"transport",resourceUri:e},{cause:s})}if(this.closed)throw Error("The preview App was closed.");let n=r.contents.find((s)=>s.uri===e);if(!n)throw pi(`Missing preview dependency: ${e}`,{code:"ADS_RESOURCE_CONTENT",category:"build",resourceUri:e});let i=typeof n.text==="string"?new TextEncoder().encode(n.text):Uint8Array.from(atob(String(n.blob)),(s)=>s.charCodeAt(0));try{return await kb(o,i)}catch(s){throw Pb(s,e)}})(),this.bytes.set(e,t),t.catch(()=>this.bytes.delete(e));return t}closure(e){return Sf(this.records,e)}asset(e){let t=this.records.get(e);if(!t)throw Error(`Missing preview dependency metadata: ${e}`);return t}async prefetch(e,t){if(this.closed)return;this.register(e);let o=++this.prefetchGeneration,r=new Set,n=[],i=0;for(let u of t){let h=e.scenarios.find((S)=>S.id===u);if(!h)continue;let m=this.closure(kl(h)).filter((S)=>!this.bytes.has(S)&&!r.has(S)),f=m.reduce((S,y)=>S+this.asset(y).size,0);if(i+f>16777216||r.size+m.length>256)continue;i+=f,n.push(u);for(let S of m)r.add(S)}let s=[...r],c=0,l=async()=>{while(!this.closed&&o===this.prefetchGeneration&&c<s.length)await this.resource(s[c++]??"")};return await Promise.all(Array.from({length:Math.min(3,s.length)},l)),{scenarios:n,resources:s.length}}mapImports(e){if(!Object.keys(e).length)return;let t=document.createElement("script");t.type="importmap",t.textContent=JSON.stringify({imports:e}),document.head.append(t)}async materialize(e){let t=this.closure(e);await Promise.all(t.map((r)=>this.resource(r)));let o={};for(let r of t){if(this.closed)throw Error("The preview App was closed.");if(this.urls.has(r))continue;let n=this.asset(r),i=await this.resource(r);if(n.kind==="module"||n.mimeType==="text/css"||n.mimeType==="text/javascript"){let c=new TextDecoder().decode(i);for(let l of n.references){let u=this.urls.get(l);if(!u)throw Error("Unsupported cyclic asset reference.");c=c.replaceAll(l,u)}i=c}let s=URL.createObjectURL(new Blob([i],{type:n.mimeType}));if(this.urls.set(r,s),n.kind==="module")o[r]=s}return this.mapImports(o),t}async importModule(e){let t=this.importing.then(()=>this.materialize(e));this.importing=t.catch(()=>{});let o=await t;await this.attachStyles(o);try{let r=await import(e);this.loadedModules.add(e);for(let n of o){let i=this.records.get(n);if(i?.hot)this.executed.set(i.hot.id,{uri:n,record:i}),this.moduleHistory.add(n)}return Eb(r)}catch(r){throw Error(`Preview module import failed for ${e}: ${String(ff(r))}. Inspect the App resource bridge, browser network/CSP diagnostics and current build.`,{cause:r})}}async attachStyles(e){for(let t of e){if(this.records.get(t)?.mimeType!=="text/css")continue;if(this.styles.has(t)){await this.styleReady.get(t);continue}let r=document.createElement("link");r.rel="stylesheet",r.href=this.urls.get(t)??"",this.styles.set(t,r);let n=new Promise((i,s)=>{r.onload=i,r.onerror=()=>s(Error("The host CSP blocked a preview stylesheet."))});this.styleReady.set(t,n),document.head.append(r);try{await n}catch(i){throw r.remove(),this.styles.delete(t),this.styleReady.delete(t),i}}}async refreshStyles(e,t){let o=[e],r=new Set,n=new Set;for(let i of o){if(r.has(i))continue;r.add(i);for(let s of await this.materialize(i)){n.add(s);for(let c of this.asset(s).dynamicImports){let l=this.records.get(c)?.hot?.id;if(this.loadedModules.has(c)||l!==void 0&&this.executed.has(l))o.push(c)}}}if(await this.attachStyles([...n]),t!==this.generation||this.closed)return!1;for(let[i,s]of this.styles)if(!n.has(i))s.remove(),this.styles.delete(i),this.styleReady.delete(i);for(let i of n){let s=this.styles.get(i);if(s)document.head.append(s)}return!0}async mount(e,t,o){let r=++this.generation,n=this.mounting.then(()=>r!==this.generation||this.closed?!1:this.mountRevision(e,t,o,r));return this.mounting=n.catch(()=>{}),n}async mountRevision(e,t,o,r){this.register(e);let n=e.scenarios.find((b)=>b.id===t);if(!n)throw Error("The selected scenario is no longer registered.");let i=kl(n),s=JSON.stringify(this.closure(i).map((b)=>[b,this.records.get(b)])),c=new Map(this.closure(i).map((b)=>[b,this.records.get(b)])),l=(b)=>{throw pi(b,{code:"ADS_PREVIEW_REOPEN"})};if(this.refreshDirty)l("An interrupted module update requires a clean preview frame.");let u=[...this.urls.keys()].reduce((b,v)=>b+this.asset(v).size,0);if(this.records.size>4096||u>67108864)l("Reopen the preview to release retained module revisions.");let h=e.refresh;if(this.mounted&&gf(this.mounted.refresh)!==gf(h))l("The preview compiler changed. Reopening an isolated frame for its new runtime.");if(h&&this.mounted){let b=new Map(Object.keys(e.assets).map((z)=>[z,this.asset(z)])),v=new Map([...b].flatMap(([z,R])=>R.hot?[[R.hot.id,{uri:z,record:R}]]:[]));for(let[z,{record:R}]of this.executed){let M=v.get(z);if(M&&M.record.hot?.source!==R.hot?.source&&this.moduleHistory.has(M.uri))l("Restoring a previous module revision requires a clean preview frame.")}let k=new Map([...this.executed.values()].map(({uri:z,record:R})=>[z,R]));this.refreshDirty=!0;let U=await this.hot.update(k,b,(z)=>this.importModule(z),()=>r===this.generation&&!this.closed);if(r!==this.generation||this.closed)return!1;if(!U)l("This edit changes a refresh boundary. Reopening the preview with fresh component state.");this.refreshDirty=!1;for(let z of this.executed.keys()){let R=v.get(z);if(R)this.executed.set(z,R)}if(this.mounted.id===t){if(!await this.refreshStyles(i,r))return!1;return this.revisions.add(i),this.mounted={...this.mounted,signature:s,records:c,module:i},!0}}if(this.mounted?.id===t&&this.mounted.container===o&&this.mounted.signature===s)return this.refreshStyles(i,r);if(this.revisions.add(i),!h&&this.revisions.size>20)l("Reopen the preview to release retained module revisions.");let m=await this.importModule(i);if(r!==this.generation)return!1;let f=this.unmount;if(this.unmount=void 0,this.mounted=void 0,await f?.(),r!==this.generation||this.closed)return!1;if(o.replaceChildren(),!await this.refreshStyles(i,r))return!1;let S=m.mount;if(typeof S!=="function")throw Error("The compiled scenario has no mount adapter.");let y=S(o);if(typeof y!=="function")throw Error("The scenario mount adapter must return an unmount callback.");return this.unmount=()=>y(),this.mounted={id:t,container:o,signature:s,records:c,module:i,refresh:h},!0}async dispose(){if(this.closed)return;this.closed=!0,++this.generation,++this.prefetchGeneration,await this.mounting,await this.unmount?.(),await this.hot.dispose(),this.mounted=void 0;for(let e of this.styles.values())e.remove();for(let e of this.urls.values())URL.revokeObjectURL(e);if(this.styles.clear(),this.styleReady.clear(),this.urls.clear(),this.bytes.clear(),this.records.clear(),this.revisions.clear(),this.loadedModules.clear(),this.executed.clear(),this.moduleHistory.clear(),Reflect.deleteProperty(globalThis,"__dsPreviewImport"),Reflect.get(globalThis,"__adsPreviewHot")===this.hot)Reflect.deleteProperty(globalThis,"__adsPreviewHot")}}var $l="ads-preview-guide-options",yf="ads-preview-guide-state",$b=["off","hover","always"];var vx=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1}),Cb=(e)=>$b.some((t)=>t===e),so=(e,t)=>typeof e==="object"&&e!==null?e[t]:void 0;function hi(e){let t=so(e,"mode");return{mode:Cb(t)?t:so(e,"all")===!0?"always":"off",bounds:so(e,"bounds")===!0,tracks:so(e,"tracks")===!0,gaps:so(e,"gaps")===!0,padding:so(e,"padding")===!0,margins:so(e,"margins")===!0,mini:so(e,"mini")===!0}}function bf(e){let{mode:t,...o}=hi(e);return{all:t==="always",...o}}function vf(e){let{mode:t,...o}=hi(e);return t!=="off"&&Object.values(o).some(Boolean)}var Ib={bounds:"bounds",content:"bounds",column:"tracks",row:"tracks",gap:"gaps",gutter:"gaps",margin:"margins",padding:"padding","mini-unit":"mini"},Cl=["Top","Right","Bottom","Left"],Ob=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft"],io=(e)=>typeof e==="object"&&e!==null,Mb=(e)=>io(e)&&typeof e.property==="string"&&typeof e.value==="string";function Ab(e){if(!io(e))return null;let t={},o={};for(let[r,n]of Object.entries(io(e.profiles)?e.profiles:{}))if(io(n)&&typeof n.miniUnit==="string"&&typeof n.miniUnitPx==="number")t[r]={miniUnit:n.miniUnit,miniUnitPx:n.miniUnitPx};for(let[r,n]of Object.entries(io(e.owners)?e.owners:{}))if(Array.isArray(n))o[r]=n.filter((i)=>typeof i==="string");return{profiles:t,owners:o}}function Nb(e){if(!io(e)||e.schemaVersion!==1||typeof e.source!=="string"||!Array.isArray(e.rules))return null;let t=e.rules.flatMap((o)=>{if(!io(o)||typeof o.selector!=="string"||!Array.isArray(o.declarations))return[];return[{selector:o.selector,declarations:o.declarations.filter(Mb)}]});return{source:e.source,rules:t}}function qb(e){let t=e.defaultView;if(!t)throw Error("The preview document has no window.");return t}function wf(e,{onDetails:t=()=>{}}={}){let o=e.ownerDocument,r=qb(o),n=(D)=>parseFloat(D)||0,i,s,c="",l,u=!1,h=[],m="components",f=null,S={},y=null,b=new Set,v=new r.ResizeObserver(M),k=new r.MutationObserver(M),U=(D)=>D instanceof r.Element?D:null,z=(D,ne)=>D instanceof r.HTMLElement?D[ne]:0,R=(D)=>D?.getAttribute("data-ads-source")??void 0;function M(){if(u&&!s)s=r.requestAnimationFrame(Qe)}function oe(D){let ne=U(D.target),be=ne?.closest("[data-ads-source]"),re=ne?.closest('button, summary, a[href], [role="button"]'),le=be&&e.contains(be)?re&&e.contains(re)?re:ne:null;if(f!==le)f=le,M()}function pe(){if(f)f=null,M()}function we(D){let ne=D.relatedTarget;if(!(ne instanceof r.Node&&e.contains(ne)))pe()}function de(D,ne){let be=y?.profiles??{},re=D.closest("[data-ads-profile]")?.getAttribute("data-ads-profile")??void 0,le=R(D.closest("[data-ads-source]")),je=re!==void 0?[re]:(le===void 0?void 0:y?.owners[le])??[],Ie=(je.length?je:Object.keys(be)).flatMap((se)=>{let J=be[se];return J?[J]:[]}),[Ne]=Ie;if(!Ne||new Set(Ie.map((se)=>`${se.miniUnit}:${se.miniUnitPx}`)).size!==1)return 0;let Z=ne.getPropertyValue(Ne.miniUnit).trim();return/^\d*\.?\d+px$/.test(Z)?n(Z):/^\d*\.?\d+rem$/.test(Z)?n(Z)*n(r.getComputedStyle(o.documentElement).fontSize):Ne.miniUnitPx}function Ae(D){let ne=R(D.closest("[data-ads-source]"));return h.filter((be)=>be.source===ne).flatMap((be)=>be.rules.filter((re)=>{try{return D.matches(re.selector)}catch{return!1}}).flatMap((re)=>re.declarations))}function Ve(){let D=[...e.querySelectorAll("[data-ads-source]")].filter((ne)=>{let be=ne.getBoundingClientRect();return be.width&&be.height});if(D.length)return D;return[...(e.querySelector(".ads-preview-root")??e).children].filter((ne)=>!["STYLE","SCRIPT","LINK","H1"].includes(ne.tagName))}let Be=()=>({width:o.documentElement.clientWidth,height:o.documentElement.clientHeight});function ot(D){let{width:ne,height:be}=Be(),re={left:0,top:0,right:ne,bottom:be};for(let le=D.parentElement;le;le=le.parentElement){let je=r.getComputedStyle(le),Ie=le.getBoundingClientRect(),Ne=le.offsetWidth?Ie.width/le.offsetWidth:1,Z=le.offsetHeight?Ie.height/le.offsetHeight:1;if(/(auto|scroll|hidden|clip)/.test(je.overflowX))re.left=Math.max(re.left,Ie.left+le.clientLeft*Ne),re.right=Math.min(re.right,Ie.left+(le.clientLeft+le.clientWidth)*Ne);if(/(auto|scroll|hidden|clip)/.test(je.overflowY))re.top=Math.max(re.top,Ie.top+le.clientTop*Z),re.bottom=Math.min(re.bottom,Ie.top+(le.clientTop+le.clientHeight)*Z)}return re}function Qe(){if(s=void 0,!u)return;let D=Ve();if(f&&!e.contains(f))f=null;let ne=S.all===!0?[...D]:f?[f]:[];if(S.all===!0)for(let Z of D)for(let se of Z.querySelectorAll("*")){if(se.closest("svg")||["STYLE","SCRIPT","LINK"].includes(se.tagName)||ne.includes(se))continue;let J=r.getComputedStyle(se);if(/grid|flex/.test(J.display)||Ob.some((ke)=>n(J[ke])!==0))ne.push(se)}if(f&&!ne.includes(f))ne.push(f);let be=ne.filter((Z)=>S.mini===!0||/\/components\//.test(R(Z.closest("[data-ads-source]"))??"")||m==="components"||m==="tokens"||m==="foundation"),re=new Set(be.filter((Z)=>!be.some((se)=>se!==Z&&se.contains(Z)))),le=[],je=new Set([e]),Ie=[];for(let Z of ne){let se=r.getComputedStyle(Z),J=Z.getBoundingClientRect(),ke=ot(Z);if(!J.width||!J.height||J.right<=ke.left||J.left>=ke.right||J.bottom<=ke.top||J.top>=ke.bottom)continue;je.add(Z);let ht=z(Z,"offsetWidth"),I=z(Z,"offsetHeight"),A=ht?J.width/ht:1,B=I?J.height/I:1,X=Cl.map((Re)=>n(se[`border${Re}Width`])),ve=Cl.map((Re)=>n(se[`padding${Re}`])),_e=Cl.map((Re)=>n(se[`margin${Re}`])),[Pe=0,Le=0,ye=0,ze=0]=X,[P=0,We=0,j=0,N=0]=ve,G=J.left+(ze+N)*A,O=J.top+(Pe+P)*B,x=J.width-(Le+ze+We+N)*A,Y=J.height-(Pe+ye+P+j)*B,W=o.createElement("div");W.dataset.adsSpatialSource=R(Z)??"measured-box",Object.assign(W.style,{position:"fixed",inset:"0",clipPath:`inset(${ke.top}px ${Math.max(0,Be().width-ke.right)}px ${Math.max(0,Be().height-ke.bottom)}px ${ke.left}px)`});let ge=(Re,ue,ce,he,ie,ee,Oe=!1)=>{if(ce<=0||he<=0||S[Ib[ie]]===!1)return;let Ee=o.createElement("div");return Ee.dataset.adsGuide=ie,Object.assign(Ee.style,{position:"absolute",left:`${Re}px`,top:`${ue}px`,width:`${ce}px`,height:`${he}px`,boxSizing:"border-box",...Oe?{border:`1px solid ${ee}`}:{background:ee}}),W.append(Ee),Ee};if(ge(J.left,J.top,J.width,J.height,"bounds","rgb(70 120 250 / .75)",!0),re.has(Z)){let Re=de(Z,se);if(Re>0){let ue=r.devicePixelRatio||1,ce=Math.floor(J.left*ue),he=Math.floor(J.top*ue),ie=Math.ceil(J.right*ue)-ce,ee=Math.ceil(J.bottom*ue)-he,Oe=ge(ce/ue,he/ue,ie/ue,ee/ue,"mini-unit","transparent");if(Oe&&ie>0&&ee>0){Oe.dataset.adsUnit=`${Re}`,Oe.dataset.adsMajor=`${Re*2}`;let Ee=o.createElement("canvas");Ee.width=ie,Ee.height=ee,Object.assign(Ee.style,{display:"block",width:`${ie/ue}px`,height:`${ee/ue}px`,imageRendering:"pixelated"});let Je=Ee.getContext("2d");if(Je){let it=[Re*A*ue,Re*B*ue];for(let Ue=0;;Ue++){let Xe=Math.round(J.left*ue+Ue*it[0])-ce;if(Xe>=ie)break;Je.fillStyle=Ue%2?"#617dba14":"#617dba38",Je.fillRect(Xe,0,1,ee)}for(let Ue=0;;Ue++){let Xe=Math.round(J.top*ue+Ue*it[1])-he;if(Xe>=ee)break;Je.fillStyle=Ue%2?"#617dba14":"#617dba38",Je.fillRect(0,Xe,ie,1)}}Oe.append(Ee)}}}let zt=(Re,ue,ce,he)=>{let[ie=0,ee=0,Oe=0,Ee=0]=Re.map((Zt,Ht)=>Math.max(0,Zt)*(Ht%2?A:B)),Je=ue?J.left-Ee:J.left+ze*A,it=ue?J.top-ie:J.top+Pe*B,Ue=ue?J.width+Ee+ee:J.width-(Le+ze)*A,Xe=ue?J.height+ie+Oe:J.height-(Pe+ye)*B;ge(Je,it,Ue,ie,ce,he),ge(Je,it+Xe-Oe,Ue,Oe,ce,he),ge(Je,it+ie,Ee,Xe-ie-Oe,ce,he),ge(Je+Ue-ee,it+ie,ee,Xe-ie-Oe,ce,he)};if(zt(_e,!0,"margin","rgb(234 149 43 / .2)"),m!=="mocks"||f===Z||S.padding===!0)zt(ve,!1,"padding","rgb(55 186 130 / .22)");let mt=Ae(Z);if(se.display.includes("grid")){let Re=(ue,ce)=>{let he=ue.replace(/\[[^\]]*\]/g,"").trim().split(/\s+/);if(!he.length||!he.every((Je)=>/^\d*\.?\d+px$/.test(Je)))return;let ie=he.map(n),ee=n(ce==="columns"?se.columnGap:se.rowGap)*(ce==="columns"?A:B),Oe=ce==="columns"&&se.direction==="rtl",Ee=ce==="columns"?Oe?G+x:G:O;W.dataset[ce==="columns"?"adsGridColumns":"adsGridRows"]=String(ie.length),ie.forEach((Je,it)=>{let Ue=Je*(ce==="columns"?A:B);if(Oe)Ee-=Ue;if(ge(ce==="columns"?Ee:G,ce==="columns"?O:Ee,ce==="columns"?Ue:x,ce==="columns"?Y:Ue,ce==="columns"?"column":"row","rgb(200 66 135 / .35)",!0),Ee+=Oe?0:Ue,it<ie.length-1)ge(ce==="columns"?Oe?Ee-ee:Ee:G,ce==="columns"?O:Ee,ce==="columns"?ee:x,ce==="columns"?Y:ee,"gap","rgb(200 66 135 / .12)");Ee+=Oe?-ee:ee})};if(Re(se.gridTemplateColumns,"columns"),mt.some((ue)=>ue.property==="grid-template-rows"&&ue.value!=="none"))Re(se.gridTemplateRows,"rows");for(let ue of Z.children){let ce=r.getComputedStyle(ue),he=ue.getBoundingClientRect();if(ce.display==="none"||!he.width||!he.height)continue;let ie=n(ce.marginLeft)*A,ee=n(ce.marginRight)*A;ge(he.left-ie,he.top,ie,he.height,"gutter","rgb(200 66 135 / .16)"),ge(he.right,he.top,ee,he.height,"gutter","rgb(200 66 135 / .16)")}}if(se.display.includes("flex")||m==="mocks"){let Re=[...Z.children].filter((ue)=>{let ce=ue.getBoundingClientRect();return ce.width&&ce.height});for(let ue of Re){je.add(ue);let ce=ue.getBoundingClientRect();ge(ce.left,ce.top,ce.width,ce.height,"content","rgb(70 120 250 / .5)",!0)}Re.forEach((ue,ce)=>{let he=Re[ce-1];if(!he)return;let ie=he.getBoundingClientRect(),ee=ue.getBoundingClientRect();if(ee.top>=ie.bottom)ge(Math.max(ie.left,ee.left),ie.bottom,Math.min(ie.right,ee.right)-Math.max(ie.left,ee.left),ee.top-ie.bottom,"gap","rgb(200 66 135 / .16)");else if(ee.left>=ie.right)ge(ie.right,Math.max(ie.top,ee.top),ee.left-ie.right,Math.min(ie.bottom,ee.bottom)-Math.max(ie.top,ee.top),"gap","rgb(200 66 135 / .16)");else if(ie.left>=ee.right)ge(ee.right,Math.max(ie.top,ee.top),ie.left-ee.right,Math.min(ie.bottom,ee.bottom)-Math.max(ie.top,ee.top),"gap","rgb(200 66 135 / .16)")})}if(le.push(W),f===Z){let Re=[...new Set(mt.flatMap((ue)=>ue.value.match(/--[\w-]+/g)??[]))];Ie.push({label:Z.getAttribute("aria-label")??Z.getAttribute("role")??Z.tagName.toLowerCase(),width:Math.round(J.width*10)/10,height:Math.round(J.height*10)/10,display:se.display,padding:ve,margin:_e,rowGap:se.rowGap,columnGap:se.columnGap,tokens:Re})}}for(let Z of b)if(!je.has(Z))v.unobserve(Z),b.delete(Z);for(let Z of je)if(!b.has(Z))v.observe(Z),b.add(Z);let[Ne]=Ie;if(Ne){l=f??void 0;let Z=JSON.stringify(Ne);if(Z!==c)c=Z,t(Ne)}else if(l&&!e.contains(l))te();i?.replaceChildren(...le)}function te(){l=void 0,c="",t(null)}function fe(D){if(u===D){M();return}if(u=D,D)i=o.createElement("div"),i.id="ads-grid-overlay",i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;inset:0;z-index:2147483646;pointer-events:none;overflow:hidden",o.body.append(i),k.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),k.observe(o.documentElement,{attributes:!0}),e.addEventListener("pointermove",oe,{passive:!0}),e.addEventListener("pointerleave",pe),e.addEventListener("focusin",oe),e.addEventListener("focusout",we),r.addEventListener("resize",M),o.addEventListener("scroll",M,!0),M();else{if(s!==void 0)r.cancelAnimationFrame(s);s=void 0,v.disconnect(),b.clear(),k.disconnect(),e.removeEventListener("pointermove",oe),e.removeEventListener("pointerleave",pe),e.removeEventListener("focusin",oe),e.removeEventListener("focusout",we),r.removeEventListener("resize",M),o.removeEventListener("scroll",M,!0),i?.remove(),i=void 0,f=null,te()}}return{setVisible:fe,setGuides(D){S=io(D)?D:{},M()},setMetadata(D,ne,be=null){h=D.flatMap((re)=>{let le=Nb(re);return le?[le]:[]}),m=ne,y=Ab(be),f=null,te(),M()},dispose(){fe(!1)}}}function jb(e){let t=e instanceof HTMLElement?Number(e.dataset.adsStageInset??""):Number.NaN;return Number.isFinite(t)&&t>=0&&e instanceof HTMLElement&&e.dataset.adsStageInset!==void 0?t:null}function Lb(e){let t=e.defaultView;if(!t)throw Error("The preview document has no window.");return t}function Ub(e){let t=e.map((o)=>({...o}));for(let o=!0;o;){o=!1;e:for(let r=0;r<t.length;r++)for(let n=r+1;n<t.length;n++){let i=t[r],s=t[n];if(i&&s&&i.left<=s.right&&s.left<=i.right&&i.top<=s.bottom&&s.top<=i.bottom){t[r]={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)},t.splice(n,1),o=!0;break e}}}return t}function zf(e,{decorate:t=!0}={}){let o=e.ownerDocument,r=Lb(o),n=null,i=null,s=null,c=0,l=null,u=new r.ResizeObserver(()=>k()),h=new r.MutationObserver(()=>U()),m=new r.MutationObserver(()=>k()),f=()=>k();function S(){if(l?.remove(),l=null,s)delete s.dataset.adsStaged,delete s.dataset.adsSubjectOnly}function y(z){if(z===s)return;if(s?.removeEventListener("scroll",f),u.disconnect(),S(),s=z,!s)return;s.addEventListener("scroll",f,{passive:!0}),u.observe(s)}function b(){let z=e.querySelector(":scope > .ads-preview-root");y(z instanceof r.HTMLElement?z:null);let R=s&&n?[...s.querySelectorAll(n)]:[],M=R.filter((de)=>!R.some((Ae)=>Ae!==de&&Ae.contains(de))),[oe]=M,pe=M.length===1&&oe?oe.parentElement:null,we=s!==null&&pe!==null&&(pe===s||pe.parentElement===s&&pe.children.length===1)&&[...s.children].every((de)=>de===l||de===pe||de===oe);return s?.toggleAttribute("data-ads-subject-only",we),M}function v(){c=0;let z=b();if(!t||!s||s.hasAttribute("data-ads-subject-only")){if(l?.remove(),l=null,s)delete s.dataset.adsStaged;return}let R=s,M=new Set(["SPAN","STRONG","EM","B","I","SMALL","CODE","LABEL","ABBR"]),oe=(te)=>M.has(te.tagName)&&!z.includes(te)&&te.querySelector("*")===null&&Boolean(te.textContent?.trim()),pe=(te)=>{let fe=te.parentElement;if(!fe||fe===R)return te;if(fe.children.length===1)return[...fe.childNodes].some((re)=>re.nodeType===3&&re.textContent?.trim())?fe:te;let D=[...fe.children].filter((re)=>re!==te),ne=r.getComputedStyle(fe);return(ne.display.includes("flex")&&!ne.flexDirection.startsWith("column")||ne.display.startsWith("inline"))&&D.some(oe)&&D.every((re)=>oe(re)||z.includes(re))?fe:te},we=Ub(z.map(pe).flatMap((te)=>{u.observe(te,{box:"border-box"});let fe=te.getBoundingClientRect(),D=i&&te.matches(i)?0:jb(te)??16;return fe.width&&fe.height?[{left:fe.left-D,top:fe.top-D,right:fe.right+D,bottom:fe.bottom+D}]:[]}));if(!we.length){S();return}let de=R.getBoundingClientRect(),Ae=de.left+R.clientLeft,Ve=de.top+R.clientTop,Be={left:Ae,top:Ve,right:Ae+R.clientWidth,bottom:Ve+R.clientHeight};if(!l||l.parentElement!==R)l?.remove(),l=o.createElement("div"),l.dataset.adsSubjectStage="",l.setAttribute("aria-hidden","true"),Object.assign(l.style,{position:"fixed",inset:"0",pointerEvents:"none",background:"var(--bg-canvas, Canvas)",zIndex:"-1"}),R.prepend(l);R.dataset.adsStaged="";let ot=we.map((te)=>({left:Math.max(te.left,Be.left),top:Math.max(te.top,Be.top),right:Math.min(te.right,Be.right),bottom:Math.min(te.bottom,Be.bottom)})).filter((te)=>te.right>te.left&&te.bottom>te.top),Qe=(te)=>`M${te.left} ${te.top}H${te.right}V${te.bottom}H${te.left}Z`;l.style.clipPath=ot.length?`path("${ot.map(Qe).join("")}")`:"inset(50%)",l.dataset.adsStages=String(we.length)}function k(){if(!c)c=r.requestAnimationFrame(v)}function U(){b(),k()}return h.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","hidden","open","data-ads-source"]}),m.observe(o.documentElement,{attributes:!0,attributeFilter:["data-theme","data-brand"]}),r.addEventListener("resize",k),{setSubjectSelector(z,R=null){n=z||null,i=R,U()},refresh:U,dispose(){if(h.disconnect(),m.disconnect(),c)r.cancelAnimationFrame(c);r.removeEventListener("resize",k),y(null),S(),n=null,i=null}}}var ut=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Map);var Rf=/^[a-f0-9]{64}$/,Db=/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/;var Zb=["react","preact"],Hb=["imports","dynamicImports","styles","references"];function Fb(e){if(!ut(e)||e.schemaVersion!==1||!Zb.includes(e.framework)||!Rf.test(String(e.revision))||!ut(e.assets)||!Array.isArray(e.scenarios))throw Error("Invalid preview manifest update.");let t=e.assets,o=new Set;for(let r of e.scenarios){let n=ut(r)?r.id:void 0,i=ut(r)?r.module:void 0,s=typeof i==="string"?t[i]:void 0;if(typeof n!=="string"||o.has(n)||!ut(s)||s.kind!=="module")throw Error("Invalid updated preview scenarios.");o.add(n)}for(let[r,n]of Object.entries(t))if(!Db.test(r)||!ut(n)||!Hb.every((i)=>{let s=n[i];return Array.isArray(s)&&s.every((c)=>typeof c==="string"&&Object.hasOwn(t,c))}))throw Error("Invalid updated preview dependencies.")}function Il(e){return Fb(e),e}function xf(e,t){if(!ut(e)||e.version!==1)throw Error("Unsupported preview manifest update.");if(e.type==="full")return Il(e.manifest);if(!t||e.baseRevision!==t.revision)throw Error("Preview manifest update base does not match.");let o=e.header;if(!ut(o)||Object.hasOwn(o,"assets")||Object.hasOwn(o,"scenarios")||!Rf.test(String(o.revision)))throw Error("Invalid preview manifest update header.");if(e.type==="unchanged"){if(o.revision!==t.revision)throw Error("Unchanged preview revision does not match.");return Il({...o,assets:t.assets,scenarios:t.scenarios})}let{assets:r,scenarios:n}=e,i=ut(r)?r.upsert:void 0,s=ut(r)?r.remove:void 0,c=ut(n)?n.upsert:void 0,l=ut(n)?n.remove:void 0;if(e.type!=="delta"||!i||!Array.isArray(s)||!Array.isArray(c)||!Array.isArray(l))throw Error("Invalid preview manifest delta.");let u=new Map(Object.entries(t.assets)),h=new Map(t.scenarios.map((y)=>[y.id,y]));for(let y of s)if(typeof y!=="string"||!u.delete(y))throw Error("Unknown removed preview asset.");let m=Object.entries(i);for(let[y,b]of m)u.set(y,b);for(let y of l)if(!h.delete(y))throw Error("Unknown removed preview scenario.");let f=new Set;for(let y of c){let b=ut(y)?y.id:void 0;if(!y||f.has(b))throw Error("Duplicate updated preview scenario.");f.add(b),h.set(b,y)}let S=(ut(n)?n.order:void 0)??t.scenarios.map((y)=>y.id);if(!Array.isArray(S)||S.length!==h.size||new Set(S).size!==S.length||S.some((y)=>!h.has(y)))throw Error("Invalid updated preview scenario order.");return Il({...o,assets:Object.fromEntries(u),scenarios:S.map((y)=>h.get(y))})}var Pf=(e,t)=>typeof e==="object"&&e!==null?Reflect.get(e,t):void 0;function Vb(e){let t=e.contents.find((o)=>typeof o.text==="string")?.text;if(t===void 0)throw Error("The preview manifest resource has no text.");return JSON.parse(t)}function Ef(e){let t=new Map,o=new Map,r=0,n,i=0,s=0,c=!0;function l(u){t.delete(u.revision),t.set(u.revision,{graph:u,size:new TextEncoder().encode(JSON.stringify(u)).byteLength});let h=[...t.values()].reduce((m,f)=>m+f.size,0);while(t.size>6||h>8388608){let[m]=t;if(!m)break;h-=m[1].size,t.delete(m[0])}}return{clear(){r++,t.clear(),o.clear(),n=void 0,c=!0},async get(u,{revision:h,session:m}={}){let f=h?t.get(h)?.graph:void 0;if(f&&(!m||f.session===m))return{...f,transportManifestUri:u};let S=n,y=r,b=JSON.stringify([u,h,m,S?.revision]),v=o.get(b);if(!v){let k=++i,U=(async()=>{let z;if(S&&c)try{z=await e(u+"?from="+S.revision)}catch(pe){if(Pf(pe,"code")!==-32002&&!/unknown (?:ADS )?resource|resource not found/i.test(String(Pf(pe,"message"))))throw pe;if(y===r)c=!1;z=await e(u)}else z=await e(u);let R=Vb(z),M=typeof R==="object"&&R!==null&&Boolean(Reflect.get(R,"type")),oe=xf(M?R:{version:1,type:"full",manifest:R},S);if(y===r){if(l(oe),k>=s)n=oe,s=k}return oe})();o.set(b,U),U.then(()=>{if(o.get(b)===U)o.delete(b)},()=>{if(o.get(b)===U)o.delete(b)}),v=U}return{...await v,transportManifestUri:u}}}}var Ml=(e)=>typeof e==="object"&&e!==null,Ol=(e)=>Ml(e)?e:{},me=(e,t)=>Ml(e)?e[t]:void 0,xr=(e)=>typeof e==="string"?e:void 0,kf=(e)=>({message:xr(me(e,"message"))??"",code:me(e,"code"),category:me(e,"category"),resourceUri:me(e,"resourceUri")});function Tf(e){let t=document.getElementById(e);if(!t)throw Error(`The preview document has no #${e}.`);return t}async function $f(e,t=(o)=>new Tl(o)){let o=Tf("root"),r=Tf("ads-preview-status"),n=document.documentElement,i,s=async(I)=>{if(!e.getHostCapabilities()?.serverResources)throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");try{return await e.readServerResource({uri:i?i+encodeURIComponent(I):I},{timeout:15000})}catch(A){if(me(A,"code")===-32601||me(A,"message")==="Method not found")throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");throw A}},c=t(s),l=Ef(s);n.dataset.adsPreviewDelivery=e.delivery??"mcp-blob";let u,h,m,f,S,y=!1,b,v=0,k={},U=[],z=!1,R,M,oe=new Set;function pe(I){if(e.getHostVersion()?.name!=="ADS showcase")return;let A=M;if(M=I,!A)return;let B=_f(A,I).filter((X)=>X!==u&&oe.has(X));if(!B.length)return;c.prefetch(I,B).then((X)=>de("prefetched",{revision:I.revision,...X})).catch((X)=>console.warn("ADS preview prefetch",me(X,"message")))}function we(I,A=!1){r.textContent=I,r.hidden=!I||e.getHostVersion()?.name==="ADS showcase",r.setAttribute("role",A?"alert":"status")}async function de(I,A={}){try{if(e.getHostCapabilities()?.logging)await e.sendLog({level:I==="error"?"error":"info",logger:"ads-preview",data:{state:I,id:u,...A}})}catch{}}let Ae=!1,Ve=wf(o),Be=zf(o,{decorate:Reflect.get(globalThis,"__ADS_RENDER_AUDIT__")!==!0}),ot={foundation:".ads-grid-example, .ads-grid-unit",tokens:'[data-slot="sample"][data-ads-specimen]:not([data-ads-specimen="value"])',profiles:'[data-slot="sample"][data-ads-specimen]:not([data-ads-specimen="value"]):not([data-ads-specimen="motion"]):not([data-ads-specimen="applied"]), .ds-motion-track, .ds-applied-sample',assets:'[data-slot="sample"]:not(:empty), .icons-set, .icons-mag, .icons-sizes'},Qe='[data-slot="specimen"]:not([data-frame="screen"])',te=".ads-preview-root[data-ads-bare] > :not([data-ads-subject-stage])";function fe(I){let A=Ol(I);k={...k,...A,styles:{...Ol(k.styles),...Ol(A.styles)}};let B=k.theme,X=k.adsTheme??(B==="light"||B==="dark"?me(U.find((_e)=>me(_e,"scheme")===B)??{name:B},"name"):void 0);if(X)n.dataset.theme=String(X);let ve=k.adsBrand;if(typeof ve==="string"&&/^[a-z][a-z0-9-]*$/.test(ve))n.dataset.brand=ve;Ve.setGuides(k.gridGuides),Ve.setVisible(Ae&&k.gridOverlay===!0),le(),Z(),be()}let D;function ne(I){if(I===D)return;if(D=I,I===void 0){Reflect.deleteProperty(globalThis,"__ADS_SCENARIO_STATE__");return}Reflect.set(globalThis,"__ADS_SCENARIO_STATE__",I),document.dispatchEvent(new CustomEvent("ads-scenario-state",{detail:{state:I}}))}function be(){if(!("adsState"in k))return;let I=k.adsState;ne(typeof I==="string"?I:void 0)}let re=(I)=>{let A=me(I instanceof CustomEvent?I.detail:void 0,"state");if(typeof A!=="string")return;D=A,Reflect.set(globalThis,"__ADS_SCENARIO_STATE__",A),de("scenario-state",{name:A})};document.addEventListener("ads-scenario-state-chosen",re);function le(){document.dispatchEvent(new CustomEvent(yf,{detail:hi(k.gridGuideChoices??k.gridGuides)}))}function je(I){let A=I instanceof CustomEvent?I.detail:void 0;if(!A){le();return}let B=hi(A);fe({gridGuideChoices:B,gridGuides:bf(B),gridOverlay:vf(B)}),de("guide-options",{options:B})}document.addEventListener($l,je);let Ie=(I)=>{let A=I instanceof CustomEvent?I.detail:void 0,B=me(A,"target");if(typeof B==="string")de("navigate",{target:B,token:me(A,"token")})};document.addEventListener("ads-preview-navigate",Ie);let Ne;function Z(){let I=k.adsFocus;if(!Ml(I)||I.nonce===Ne||I.target!==u||n.dataset.adsPreviewState!=="ready")return;Ne=I.nonce,document.dispatchEvent(new CustomEvent("ads-preview-focus",{detail:{token:I.token}}))}async function se(I="ads://preview/manifest",A,B){try{return await(c.manifest?c.manifest(I,{revision:A,session:B,scenario:u}):l.get(I,{revision:A,session:B}))}catch(X){throw Object.assign(Error(xr(me(X,"message")),{cause:X}),{code:"ADS_MANIFEST_READ",category:"transport"})}}async function J(I,A,B=!1,X="",ve=!1,_e){let Pe=B||ve;if(!X&&I===u&&A&&A===m&&(!_e||_e===f)&&Pe===z){we(Pe?"Checking changes…":""),await de(Pe?"checking":"ready",{revision:m});return}let Le=++v;++c.generation,u=I,Ae=!1,Ve.setVisible(!1),oe.add(I),n.dataset.adsScenario=I,n.dataset.adsPreviewState="loading";for(let ye of["adsPreviewErrorCategory","adsPreviewErrorCode","adsPreviewResourceUri"])delete n.dataset[ye];we(""),await de(X?"reverting":"loading");try{let ye=performance.now(),ze=await se(B?"ads://preview/live":"ads://preview/manifest",A,_e);if(Le!==v)return;let P=ze.themes;if(Array.isArray(P))U=P,fe({});if(A&&ze.revision!==A||_e&&ze.session!==_e){if(Le===v)we("Updating preview…"),await de("loading",{code:"ADS_PREVIEW_CHANGED"});return}if(Le!==v)return;let We=performance.now();performance.measure("ads-preview:manifest",{start:ye,end:We});let j=await c.mount(ze,I,o);if(performance.measure("ads-preview:load-mount",{start:We,end:performance.now()}),!j||Le!==v)return;let G=ze.scenarios.find((x)=>x.id===I)?.kind;o.dataset.adsScenarioKind=String(G??"");let O=typeof G==="string"&&Object.hasOwn(ot,G)?ot[G]:void 0;if(O!==void 0)Be.setSubjectSelector(O,".ads-grid-example");else Be.setSubjectSelector(`${Qe}, ${te}`,Qe);if(m=ze.revision,f=ze.session,z=Pe,await new Promise((x)=>requestAnimationFrame(()=>requestAnimationFrame(x))),await document.fonts.ready,Le!==v)return;if(Ae=G==="components"||G==="patterns"||G==="mocks"||G==="foundation",Ve.setMetadata(Object.values(ze.assets).flatMap((x)=>x.spatial?[x.spatial]:[]),G,ze.spatial),fe({}),o.dataset.adsPaintBindings="[]",o.dataset.adsPaintAudit="false",o.dataset.adsPaintAuditComplete="not-requested",Le===v){if(n.dataset.adsPreviewRevision=m,n.dataset.adsPreviewState=X?"error":Pe?"checking":"ready",we(X||(Pe?"Checking changes…":""),Boolean(X)),await de(X?"error":Pe?"checking":"ready",{revision:m,selectionRevision:h,...X?{message:X}:{}}),!Pe&&!X)pe(ze)}if(Le===v)Z()}catch(ye){if(Le===v){let{message:ze,code:P,category:We,resourceUri:j}=kf(ye);if(n.dataset.adsPreviewState="error",n.dataset.adsPreviewErrorCategory=String(We??"runner"),n.dataset.adsPreviewErrorCode=String(P??"ADS_PREVIEW_STARTUP"),j)n.dataset.adsPreviewResourceUri=String(j);we(ze,!0),await de("error",{message:ze,...P?{code:P}:{},...We?{category:We}:{},...j?{resourceUri:j}:{}})}}}async function ke(I){if(!u)return;if(document.visibilityState==="hidden"){if(I)b=I;return}if(y){if(I)b=I;return}y=!0;let A=v;try{let B=I??JSON.parse((await s("ads://project/build")).contents.find((ye)=>typeof ye.text==="string")?.text??"");if(A!==v)return;R=void 0;let X=me(B,"previews");if(!Array.isArray(X))throw Error("The build report lists no previews.");let ve=X.find((ye)=>me(ye,"id")===u),_e=me(B,"session"),Pe=xr(me(B,"manifestRevision")),Le=me(ve,"live");if(Le&&!me(ve,"current")){let ye=xr(me(Le,"revision"));if(ye!==m||_e!==f||!z)await J(u,ye,!0,"",!1,_e);else we("Checking changes…")}else if(!ve||!me(ve,"current")){let ye=me(ve,"diagnostics"),ze=Array.isArray(ye)?me(ye[0],"message"):void 0;if(ze&&z){let P=await se("ads://preview/manifest",Pe,_e);await J(u,P.revision,!1,`Build failed. Showing the previous preview.
|
|
109
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:a().optional().describe("User's language and region preference in BCP 47 format."),timeZone:a().optional().describe("User's timezone in IANA format."),userAgent:a().optional().describe("Host application identifier."),platform:C([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d({touch:T().optional().describe("Whether the device supports touch input."),hover:T().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:d({top:w().describe("Top safe area inset in pixels."),right:w().describe("Right safe area inset in pixels."),bottom:w().describe("Bottom safe area inset in pixels."),left:w().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),bb=d({method:p("ui/notifications/host-context-changed"),params:pf.describe("Partial context update containing only changed fields.")}),mx=d({method:p("ui/update-model-context"),params:d({content:g(Tt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:E(a(),L().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),fx=d({method:p("ui/initialize"),params:d({appInfo:Et.describe("App identification (name and version)."),appCapabilities:gb.describe("Features and capabilities this app provides."),protocolVersion:a().describe("Protocol version this app supports.")})}),vb=d({protocolVersion:a().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Et.describe("Host application identification and version."),hostCapabilities:fb.describe("Features and capabilities provided by the host."),hostContext:pf.describe("Rich context about the host environment.")}).passthrough(),wb={target:"draft-2020-12"};async function af(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](wb);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function cf(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let s=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function zb(e,t){let o={...e,...t};if(t.experimental!==void 0)o.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)o.tools={...e.tools,...t.tools};return o}class La extends li{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new lf;_methods=new uf;setRequestHandler=(...e)=>{let[t,...o]=nf("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=nf("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...o)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:cb,toolinputpartial:lb,toolresult:yb,toolcancelled:ub,hostcontextchanged:bb};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!La.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>{let r=o;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...r};this._events.dispatch(e,r)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},o={autoResize:!0}){super(o);if(this._appInfo=e,this._appCapabilities=t,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval)ct({jitless:!0});this.replaceRequestHandler("ping",(r)=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=zb(this._appCapabilities,e)}registerTool(e,t,o){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,n=()=>{if(r._initializedSent&&r._appCapabilities.tools?.listChanged)r.sendToolListChanged()},i=t.inputSchema!==void 0,s={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==s)return;delete r._registeredTools[e],n()},handler:async(c,l)=>{if(!s.enabled)throw Error(`Tool ${e} is disabled`);let u;if(i){let h=s.inputSchema,m=h?await cf(h,c??{},`Invalid input for tool ${e}: `):c??{};u=await o(m,l)}else u=await o(l);if(s.outputSchema&&!u.isError)u.structuredContent=await cf(s.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `);return u}};if(this._registeredTools[e]=s,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),s}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let o=this._registeredTools[e.name];if(!o)throw Error(`Tool ${e.name} not found`);return o.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let n={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await af(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await af(r.outputSchema,"output");if(r.annotations)n.annotations=r.annotations;if(r._meta)n._meta=r._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:hb.shape.params,result:mb},(t,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,o)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},ab,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},Xt,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},sb,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},ib,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},Sb,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,o=0,r=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let i=document.documentElement,s=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=s;let l=Math.ceil(window.innerWidth);if(l!==t||c!==o)t=l,o=c,this.sendSizeChanged({width:l,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new df(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:eb}},vb,t);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}var Rb=(e)=>typeof e==="object"&&e!==null,hf=(e)=>new Map([...e].flatMap(([t,o])=>o.hot?[[o.hot.id,{uri:t,source:o.hot.source,record:o}]]:[]));function mf(){let e=new Map,t=new Set,o=!1,r;function n(s){let l={data:e.get(s)?.data??{},callbacks:[],listeners:new Map};return e.set(s,l),{data:l.data,accept(u,h){if(!u||typeof u==="function"){let m=typeof u==="function"?u:void 0;l.callbacks.push({deps:[s],callback:(f)=>m?.(f[0])})}else l.callbacks.push({deps:typeof u==="string"?[u]:u,callback:(m)=>h?.(typeof u==="string"?m[0]:m)})},acceptExports(u,h){l.callbacks.push({deps:[s],callback:(m)=>h?.(m[0])})},dispose(u){l.dispose=u},prune(u){l.prune=u},invalidate(){o=!0},decline(){o=!0},on(u,h){let m=l.listeners.get(u)??new Set;m.add(h),l.listeners.set(u,m)},off(u,h){l.listeners.get(u)?.delete(h)},send(){throw Error("Preview hot-update custom messages are not a public transport.")}}}async function i(s){for(let c of e.values())for(let l of c.listeners.get(s)??[])await l()}return{context:n,observe(s,c,l){let u=e.get(s);if(!u)return;let m=import(c).then((f)=>{u.exports=Rb(f)?f:void 0,u.isComponent=l});t.add(m),m.then(()=>t.delete(m),(f)=>{t.delete(m),r=f})},async update(s,c,l,u){if(await Promise.all(t),r)throw r;let h=hf(s),m=hf(c),f=new Map,S=new Map;for(let[v,{record:k}]of h)for(let U of[...k.imports,...k.dynamicImports]){let z=s.get(U)?.hot?.id;if(!z)continue;let R=f.get(z)??new Set;R.add(v),f.set(z,R)}function y(v,k=new Set){if(k.has(v))return!1;let U=e.get(v);if(U?.callbacks.some((M)=>M.deps.includes(v))&&m.has(v))return S.set(v,U),!0;let z=f.get(v);if(!z?.size)return!1;let R=new Set([...k,v]);for(let M of z)if(!y(M,R))return!1;return!0}for(let[v,k]of h){let U=m.get(v);if(!U||k.source!==U.source){if(!y(v))return!1}}if(!S.size)return!0;o=!1,await i("vite:beforeUpdate");let b=[];for(let[v,k]of S){if(!u())return!1;await k.dispose?.(k.data);let U=m.get(v)?.uri??"";b.push([v,k,await l(U)])}if(!u())return!1;for(let[,v,k]of b){let{isComponent:U,exports:z}=v;if(!U)continue;let R=Object.keys(k).filter((M)=>M!=="__esModule");if(!z||R.length!==Object.keys(z).filter((M)=>M!=="__esModule").length||R.some((M)=>!Object.hasOwn(z,M)||!U(k[M])&&z[M]!==k[M]))return!1}for(let[v,k,U]of b)for(let z of k.callbacks)if(z.deps.includes(v))await z.callback(z.deps.map((R)=>R===v?U:void 0));return await i("vite:afterUpdate"),await new Promise((v)=>setTimeout(v,20)),u()&&!o},async dispose(){for(let s of e.values())await s.dispose?.(s.data),await s.prune?.(s.data);e.clear(),t.clear(),r=void 0}}}var xb=["imports","dynamicImports","styles","references"],Rr=(e)=>typeof e==="object"&&e!==null,ff=(e)=>Rr(e)?e.message:void 0,pi=(e,t,o)=>Object.assign(Error(e,o),t);function Pb(e,t){if(Rr(e))Reflect.set(e,"resourceUri",t);return e}var gf=(e)=>Rr(e)?e.epoch:void 0;function kl(e){if(typeof e.module!=="string")throw Error(`Missing preview dependency metadata: ${String(e.module)}`);return e.module}var Eb=(e)=>Rr(e)?e:{};async function kb(e,t){let o=await crypto.subtle.digest("SHA-256",t),r="sha256:"+[...new Uint8Array(o)].map((n)=>n.toString(16).padStart(2,"0")).join("");if(t.length!==e?.size||r!==e.digest)throw pi("Preview resource integrity check failed. Rebuild and reopen the preview.",{code:"ADS_RESOURCE_INTEGRITY",category:"build"});return t}function Sf(e,t){let o=[],r=new Set;function n(i){if(r.has(i))return;r.add(i);let s=e.get(i);if(!s)throw Error(`Missing preview dependency metadata: ${i}`);for(let c of[...s.imports,...s.styles,...s.references])n(c);o.push(i)}return n(t),o}function _f(e,t){if(!e||e.revision===t.revision)return[];let o=(r,n)=>{let i=new Map(Object.entries(r.assets));return JSON.stringify(Sf(i,kl(n)).map((s)=>[s,i.get(s)]))};return t.scenarios.filter((r)=>{let n=e.scenarios.find((i)=>i.id===r.id);return!n||o(e,n)!==o(t,r)}).map((r)=>r.id)}function Tb(e,t,o,r){let{digest:n,hot:i}=t;if(!/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/.test(e)||typeof n!=="string"||!/^sha256:[a-f0-9]{64}$/.test(n))return null;if(i&&(!o.refresh||t.kind!=="module"||!Rr(i)||typeof i.id!=="string"||!i.id||i.id.length>4096||r.has(i.id)||typeof i.source!=="string"||!/^[a-f0-9]{64}$/.test(i.source)))return null;if(!xb.every((s)=>Array.isArray(t[s])&&t[s].every((c)=>Object.hasOwn(o.assets,c))))return null;return t}class Tl{read;records=new Map;bytes=new Map;urls=new Map;styles=new Map;styleReady=new Map;revisions=new Set;loadedModules=new Set;executed=new Map;moduleHistory=new Set;importing=Promise.resolve();mounting=Promise.resolve();refreshDirty=!1;generation=0;prefetchGeneration=0;closed=!1;hot;mounted;unmount;constructor(e){this.read=e,this.hot=mf(),Reflect.set(globalThis,"__adsPreviewHot",this.hot),Reflect.set(globalThis,"__dsPreviewImport",(t)=>this.importModule(t))}register(e){if(e.schemaVersion!==1||!Array.isArray(e.scenarios)||!e.assets||typeof e.revision!=="string")throw Error("Unsupported preview manifest. Rebuild previews with the installed ADS version.");let t=e.refresh;if(t&&(!Rr(t)||t.version!==1||typeof t.epoch!=="string"||!t.epoch||t.epoch.length>100))throw Error("Unsupported preview refresh protocol. Reopen with the current ADS version.");let o=new Set,r=[];for(let[n,i]of Object.entries(e.assets)){let s=Tb(n,i,e,o);if(!s)throw Error("Invalid preview dependency graph.");if(s.hot)o.add(s.hot.id);if(this.records.has(n)&&this.records.get(n)?.digest!==s.digest)throw pi("An immutable preview resource changed its content. Rebuild previews with the current ADS version.",{code:"ADS_RESOURCE_IDENTITY",category:"build",resourceUri:n});r.push([n,s])}for(let[n,i]of r)this.records.set(n,i)}async resource(e){let t=this.bytes.get(e);if(!t)t=(async()=>{let o=this.records.get(e);if(!o)throw Error(`Unknown preview dependency: ${e}`);let r;try{r=await this.read(e)}catch(s){throw pi(`Preview resource read failed for ${e}: ${String(ff(s))}`,{code:"ADS_RESOURCE_READ",category:"transport",resourceUri:e},{cause:s})}if(this.closed)throw Error("The preview App was closed.");let n=r.contents.find((s)=>s.uri===e);if(!n)throw pi(`Missing preview dependency: ${e}`,{code:"ADS_RESOURCE_CONTENT",category:"build",resourceUri:e});let i=typeof n.text==="string"?new TextEncoder().encode(n.text):Uint8Array.from(atob(String(n.blob)),(s)=>s.charCodeAt(0));try{return await kb(o,i)}catch(s){throw Pb(s,e)}})(),this.bytes.set(e,t),t.catch(()=>this.bytes.delete(e));return t}closure(e){return Sf(this.records,e)}asset(e){let t=this.records.get(e);if(!t)throw Error(`Missing preview dependency metadata: ${e}`);return t}async prefetch(e,t){if(this.closed)return;this.register(e);let o=++this.prefetchGeneration,r=new Set,n=[],i=0;for(let u of t){let h=e.scenarios.find((S)=>S.id===u);if(!h)continue;let m=this.closure(kl(h)).filter((S)=>!this.bytes.has(S)&&!r.has(S)),f=m.reduce((S,y)=>S+this.asset(y).size,0);if(i+f>16777216||r.size+m.length>256)continue;i+=f,n.push(u);for(let S of m)r.add(S)}let s=[...r],c=0,l=async()=>{while(!this.closed&&o===this.prefetchGeneration&&c<s.length)await this.resource(s[c++]??"")};return await Promise.all(Array.from({length:Math.min(3,s.length)},l)),{scenarios:n,resources:s.length}}mapImports(e){if(!Object.keys(e).length)return;let t=document.createElement("script");t.type="importmap",t.textContent=JSON.stringify({imports:e}),document.head.append(t)}async materialize(e){let t=this.closure(e);await Promise.all(t.map((r)=>this.resource(r)));let o={};for(let r of t){if(this.closed)throw Error("The preview App was closed.");if(this.urls.has(r))continue;let n=this.asset(r),i=await this.resource(r);if(n.kind==="module"||n.mimeType==="text/css"||n.mimeType==="text/javascript"){let c=new TextDecoder().decode(i);for(let l of n.references){let u=this.urls.get(l);if(!u)throw Error("Unsupported cyclic asset reference.");c=c.replaceAll(l,u)}i=c}let s=URL.createObjectURL(new Blob([i],{type:n.mimeType}));if(this.urls.set(r,s),n.kind==="module")o[r]=s}return this.mapImports(o),t}async importModule(e){let t=this.importing.then(()=>this.materialize(e));this.importing=t.catch(()=>{});let o=await t;await this.attachStyles(o);try{let r=await import(e);this.loadedModules.add(e);for(let n of o){let i=this.records.get(n);if(i?.hot)this.executed.set(i.hot.id,{uri:n,record:i}),this.moduleHistory.add(n)}return Eb(r)}catch(r){throw Error(`Preview module import failed for ${e}: ${String(ff(r))}. Inspect the App resource bridge, browser network/CSP diagnostics and current build.`,{cause:r})}}async attachStyles(e){for(let t of e){if(this.records.get(t)?.mimeType!=="text/css")continue;if(this.styles.has(t)){await this.styleReady.get(t);continue}let r=document.createElement("link");r.rel="stylesheet",r.href=this.urls.get(t)??"",this.styles.set(t,r);let n=new Promise((i,s)=>{r.onload=i,r.onerror=()=>s(Error("The host CSP blocked a preview stylesheet."))});this.styleReady.set(t,n),document.head.append(r);try{await n}catch(i){throw r.remove(),this.styles.delete(t),this.styleReady.delete(t),i}}}async refreshStyles(e,t){let o=[e],r=new Set,n=new Set;for(let i of o){if(r.has(i))continue;r.add(i);for(let s of await this.materialize(i)){n.add(s);for(let c of this.asset(s).dynamicImports){let l=this.records.get(c)?.hot?.id;if(this.loadedModules.has(c)||l!==void 0&&this.executed.has(l))o.push(c)}}}if(await this.attachStyles([...n]),t!==this.generation||this.closed)return!1;for(let[i,s]of this.styles)if(!n.has(i))s.remove(),this.styles.delete(i),this.styleReady.delete(i);for(let i of n){let s=this.styles.get(i);if(s)document.head.append(s)}return!0}async mount(e,t,o){let r=++this.generation,n=this.mounting.then(()=>r!==this.generation||this.closed?!1:this.mountRevision(e,t,o,r));return this.mounting=n.catch(()=>{}),n}async mountRevision(e,t,o,r){this.register(e);let n=e.scenarios.find((b)=>b.id===t);if(!n)throw Error("The selected scenario is no longer registered.");let i=kl(n),s=JSON.stringify(this.closure(i).map((b)=>[b,this.records.get(b)])),c=new Map(this.closure(i).map((b)=>[b,this.records.get(b)])),l=(b)=>{throw pi(b,{code:"ADS_PREVIEW_REOPEN"})};if(this.refreshDirty)l("An interrupted module update requires a clean preview frame.");let u=[...this.urls.keys()].reduce((b,v)=>b+this.asset(v).size,0);if(this.records.size>4096||u>67108864)l("Reopen the preview to release retained module revisions.");let h=e.refresh;if(this.mounted&&gf(this.mounted.refresh)!==gf(h))l("The preview compiler changed. Reopening an isolated frame for its new runtime.");if(h&&this.mounted){let b=new Map(Object.keys(e.assets).map((z)=>[z,this.asset(z)])),v=new Map([...b].flatMap(([z,R])=>R.hot?[[R.hot.id,{uri:z,record:R}]]:[]));for(let[z,{record:R}]of this.executed){let M=v.get(z);if(M&&M.record.hot?.source!==R.hot?.source&&this.moduleHistory.has(M.uri))l("Restoring a previous module revision requires a clean preview frame.")}let k=new Map([...this.executed.values()].map(({uri:z,record:R})=>[z,R]));this.refreshDirty=!0;let U=await this.hot.update(k,b,(z)=>this.importModule(z),()=>r===this.generation&&!this.closed);if(r!==this.generation||this.closed)return!1;if(!U)l("This edit changes a refresh boundary. Reopening the preview with fresh component state.");this.refreshDirty=!1;for(let z of this.executed.keys()){let R=v.get(z);if(R)this.executed.set(z,R)}if(this.mounted.id===t){if(!await this.refreshStyles(i,r))return!1;return this.revisions.add(i),this.mounted={...this.mounted,signature:s,records:c,module:i},!0}}if(this.mounted?.id===t&&this.mounted.container===o&&this.mounted.signature===s)return this.refreshStyles(i,r);if(this.revisions.add(i),!h&&this.revisions.size>20)l("Reopen the preview to release retained module revisions.");let m=await this.importModule(i);if(r!==this.generation)return!1;let f=this.unmount;if(this.unmount=void 0,this.mounted=void 0,await f?.(),r!==this.generation||this.closed)return!1;if(o.replaceChildren(),!await this.refreshStyles(i,r))return!1;let S=m.mount;if(typeof S!=="function")throw Error("The compiled scenario has no mount adapter.");let y=S(o);if(typeof y!=="function")throw Error("The scenario mount adapter must return an unmount callback.");return this.unmount=()=>y(),this.mounted={id:t,container:o,signature:s,records:c,module:i,refresh:h},!0}async dispose(){if(this.closed)return;this.closed=!0,++this.generation,++this.prefetchGeneration,await this.mounting,await this.unmount?.(),await this.hot.dispose(),this.mounted=void 0;for(let e of this.styles.values())e.remove();for(let e of this.urls.values())URL.revokeObjectURL(e);if(this.styles.clear(),this.styleReady.clear(),this.urls.clear(),this.bytes.clear(),this.records.clear(),this.revisions.clear(),this.loadedModules.clear(),this.executed.clear(),this.moduleHistory.clear(),Reflect.deleteProperty(globalThis,"__dsPreviewImport"),Reflect.get(globalThis,"__adsPreviewHot")===this.hot)Reflect.deleteProperty(globalThis,"__adsPreviewHot")}}var $l="ads-preview-guide-options",yf="ads-preview-guide-state",$b=["off","hover","always"];var vx=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1}),Cb=(e)=>$b.some((t)=>t===e),so=(e,t)=>typeof e==="object"&&e!==null?e[t]:void 0;function hi(e){let t=so(e,"mode");return{mode:Cb(t)?t:so(e,"all")===!0?"always":"off",bounds:so(e,"bounds")===!0,tracks:so(e,"tracks")===!0,gaps:so(e,"gaps")===!0,padding:so(e,"padding")===!0,margins:so(e,"margins")===!0,mini:so(e,"mini")===!0}}function bf(e){let{mode:t,...o}=hi(e);return{all:t==="always",...o}}function vf(e){let{mode:t,...o}=hi(e);return t!=="off"&&Object.values(o).some(Boolean)}var Ib={bounds:"bounds",content:"bounds",column:"tracks",row:"tracks",gap:"gaps",gutter:"gaps",margin:"margins",padding:"padding","mini-unit":"mini"},Cl=["Top","Right","Bottom","Left"],Ob=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft"],io=(e)=>typeof e==="object"&&e!==null,Mb=(e)=>io(e)&&typeof e.property==="string"&&typeof e.value==="string";function Ab(e){if(!io(e))return null;let t={},o={};for(let[r,n]of Object.entries(io(e.profiles)?e.profiles:{}))if(io(n)&&typeof n.miniUnit==="string"&&typeof n.miniUnitPx==="number")t[r]={miniUnit:n.miniUnit,miniUnitPx:n.miniUnitPx};for(let[r,n]of Object.entries(io(e.owners)?e.owners:{}))if(Array.isArray(n))o[r]=n.filter((i)=>typeof i==="string");return{profiles:t,owners:o}}function Nb(e){if(!io(e)||e.schemaVersion!==1||typeof e.source!=="string"||!Array.isArray(e.rules))return null;let t=e.rules.flatMap((o)=>{if(!io(o)||typeof o.selector!=="string"||!Array.isArray(o.declarations))return[];return[{selector:o.selector,declarations:o.declarations.filter(Mb)}]});return{source:e.source,rules:t}}function qb(e){let t=e.defaultView;if(!t)throw Error("The preview document has no window.");return t}function wf(e,{onDetails:t=()=>{}}={}){let o=e.ownerDocument,r=qb(o),n=(D)=>parseFloat(D)||0,i,s,c="",l,u=!1,h=[],m="components",f=null,S={},y=null,b=new Set,v=new r.ResizeObserver(M),k=new r.MutationObserver(M),U=(D)=>D instanceof r.Element?D:null,z=(D,ne)=>D instanceof r.HTMLElement?D[ne]:0,R=(D)=>D?.getAttribute("data-ads-source")??void 0;function M(){if(u&&!s)s=r.requestAnimationFrame(Qe)}function oe(D){let ne=U(D.target),be=ne?.closest("[data-ads-source]"),re=ne?.closest('button, summary, a[href], [role="button"]'),le=be&&e.contains(be)?re&&e.contains(re)?re:ne:null;if(f!==le)f=le,M()}function pe(){if(f)f=null,M()}function we(D){let ne=D.relatedTarget;if(!(ne instanceof r.Node&&e.contains(ne)))pe()}function de(D,ne){let be=y?.profiles??{},re=D.closest("[data-ads-profile]")?.getAttribute("data-ads-profile")??void 0,le=R(D.closest("[data-ads-source]")),je=re!==void 0?[re]:(le===void 0?void 0:y?.owners[le])??[],Ie=(je.length?je:Object.keys(be)).flatMap((se)=>{let J=be[se];return J?[J]:[]}),[Oe]=Ie;if(!Oe||new Set(Ie.map((se)=>`${se.miniUnit}:${se.miniUnitPx}`)).size!==1)return 0;let Z=ne.getPropertyValue(Oe.miniUnit).trim();return/^\d*\.?\d+px$/.test(Z)?n(Z):/^\d*\.?\d+rem$/.test(Z)?n(Z)*n(r.getComputedStyle(o.documentElement).fontSize):Oe.miniUnitPx}function Ne(D){let ne=R(D.closest("[data-ads-source]"));return h.filter((be)=>be.source===ne).flatMap((be)=>be.rules.filter((re)=>{try{return D.matches(re.selector)}catch{return!1}}).flatMap((re)=>re.declarations))}function Ve(){let D=[...e.querySelectorAll("[data-ads-source]")].filter((ne)=>{let be=ne.getBoundingClientRect();return be.width&&be.height});if(D.length)return D;return[...(e.querySelector(".ads-preview-root")??e).children].filter((ne)=>!["STYLE","SCRIPT","LINK","H1"].includes(ne.tagName))}let Be=()=>({width:o.documentElement.clientWidth,height:o.documentElement.clientHeight});function ot(D){let{width:ne,height:be}=Be(),re={left:0,top:0,right:ne,bottom:be};for(let le=D.parentElement;le;le=le.parentElement){let je=r.getComputedStyle(le),Ie=le.getBoundingClientRect(),Oe=le.offsetWidth?Ie.width/le.offsetWidth:1,Z=le.offsetHeight?Ie.height/le.offsetHeight:1;if(/(auto|scroll|hidden|clip)/.test(je.overflowX))re.left=Math.max(re.left,Ie.left+le.clientLeft*Oe),re.right=Math.min(re.right,Ie.left+(le.clientLeft+le.clientWidth)*Oe);if(/(auto|scroll|hidden|clip)/.test(je.overflowY))re.top=Math.max(re.top,Ie.top+le.clientTop*Z),re.bottom=Math.min(re.bottom,Ie.top+(le.clientTop+le.clientHeight)*Z)}return re}function Qe(){if(s=void 0,!u)return;let D=Ve();if(f&&!e.contains(f))f=null;let ne=S.all===!0?[...D]:f?[f]:[];if(S.all===!0)for(let Z of D)for(let se of Z.querySelectorAll("*")){if(se.closest("svg")||["STYLE","SCRIPT","LINK"].includes(se.tagName)||ne.includes(se))continue;let J=r.getComputedStyle(se);if(/grid|flex/.test(J.display)||Ob.some((ke)=>n(J[ke])!==0))ne.push(se)}if(f&&!ne.includes(f))ne.push(f);let be=ne.filter((Z)=>S.mini===!0||/\/components\//.test(R(Z.closest("[data-ads-source]"))??"")||m==="components"||m==="tokens"||m==="foundation"),re=new Set(be.filter((Z)=>!be.some((se)=>se!==Z&&se.contains(Z)))),le=[],je=new Set([e]),Ie=[];for(let Z of ne){let se=r.getComputedStyle(Z),J=Z.getBoundingClientRect(),ke=ot(Z);if(!J.width||!J.height||J.right<=ke.left||J.left>=ke.right||J.bottom<=ke.top||J.top>=ke.bottom)continue;je.add(Z);let ht=z(Z,"offsetWidth"),I=z(Z,"offsetHeight"),A=ht?J.width/ht:1,B=I?J.height/I:1,X=Cl.map((Re)=>n(se[`border${Re}Width`])),ve=Cl.map((Re)=>n(se[`padding${Re}`])),_e=Cl.map((Re)=>n(se[`margin${Re}`])),[Pe=0,Le=0,ye=0,ze=0]=X,[P=0,We=0,j=0,N=0]=ve,G=J.left+(ze+N)*A,O=J.top+(Pe+P)*B,x=J.width-(Le+ze+We+N)*A,Y=J.height-(Pe+ye+P+j)*B,W=o.createElement("div");W.dataset.adsSpatialSource=R(Z)??"measured-box",Object.assign(W.style,{position:"fixed",inset:"0",clipPath:`inset(${ke.top}px ${Math.max(0,Be().width-ke.right)}px ${Math.max(0,Be().height-ke.bottom)}px ${ke.left}px)`});let ge=(Re,ue,ce,he,ie,ee,Me=!1)=>{if(ce<=0||he<=0||S[Ib[ie]]===!1)return;let Ee=o.createElement("div");return Ee.dataset.adsGuide=ie,Object.assign(Ee.style,{position:"absolute",left:`${Re}px`,top:`${ue}px`,width:`${ce}px`,height:`${he}px`,boxSizing:"border-box",...Me?{border:`1px solid ${ee}`}:{background:ee}}),W.append(Ee),Ee};if(ge(J.left,J.top,J.width,J.height,"bounds","rgb(70 120 250 / .75)",!0),re.has(Z)){let Re=de(Z,se);if(Re>0){let ue=r.devicePixelRatio||1,ce=Math.floor(J.left*ue),he=Math.floor(J.top*ue),ie=Math.ceil(J.right*ue)-ce,ee=Math.ceil(J.bottom*ue)-he,Me=ge(ce/ue,he/ue,ie/ue,ee/ue,"mini-unit","transparent");if(Me&&ie>0&&ee>0){Me.dataset.adsUnit=`${Re}`,Me.dataset.adsMajor=`${Re*2}`;let Ee=o.createElement("canvas");Ee.width=ie,Ee.height=ee,Object.assign(Ee.style,{display:"block",width:`${ie/ue}px`,height:`${ee/ue}px`,imageRendering:"pixelated"});let Je=Ee.getContext("2d");if(Je){let it=[Re*A*ue,Re*B*ue];for(let Ue=0;;Ue++){let Xe=Math.round(J.left*ue+Ue*it[0])-ce;if(Xe>=ie)break;Je.fillStyle=Ue%2?"#617dba14":"#617dba38",Je.fillRect(Xe,0,1,ee)}for(let Ue=0;;Ue++){let Xe=Math.round(J.top*ue+Ue*it[1])-he;if(Xe>=ee)break;Je.fillStyle=Ue%2?"#617dba14":"#617dba38",Je.fillRect(0,Xe,ie,1)}}Me.append(Ee)}}}let zt=(Re,ue,ce,he)=>{let[ie=0,ee=0,Me=0,Ee=0]=Re.map((Zt,Ht)=>Math.max(0,Zt)*(Ht%2?A:B)),Je=ue?J.left-Ee:J.left+ze*A,it=ue?J.top-ie:J.top+Pe*B,Ue=ue?J.width+Ee+ee:J.width-(Le+ze)*A,Xe=ue?J.height+ie+Me:J.height-(Pe+ye)*B;ge(Je,it,Ue,ie,ce,he),ge(Je,it+Xe-Me,Ue,Me,ce,he),ge(Je,it+ie,Ee,Xe-ie-Me,ce,he),ge(Je+Ue-ee,it+ie,ee,Xe-ie-Me,ce,he)};if(zt(_e,!0,"margin","rgb(234 149 43 / .2)"),m!=="mocks"||f===Z||S.padding===!0)zt(ve,!1,"padding","rgb(55 186 130 / .22)");let mt=Ne(Z);if(se.display.includes("grid")){let Re=(ue,ce)=>{let he=ue.replace(/\[[^\]]*\]/g,"").trim().split(/\s+/);if(!he.length||!he.every((Je)=>/^\d*\.?\d+px$/.test(Je)))return;let ie=he.map(n),ee=n(ce==="columns"?se.columnGap:se.rowGap)*(ce==="columns"?A:B),Me=ce==="columns"&&se.direction==="rtl",Ee=ce==="columns"?Me?G+x:G:O;W.dataset[ce==="columns"?"adsGridColumns":"adsGridRows"]=String(ie.length),ie.forEach((Je,it)=>{let Ue=Je*(ce==="columns"?A:B);if(Me)Ee-=Ue;if(ge(ce==="columns"?Ee:G,ce==="columns"?O:Ee,ce==="columns"?Ue:x,ce==="columns"?Y:Ue,ce==="columns"?"column":"row","rgb(200 66 135 / .35)",!0),Ee+=Me?0:Ue,it<ie.length-1)ge(ce==="columns"?Me?Ee-ee:Ee:G,ce==="columns"?O:Ee,ce==="columns"?ee:x,ce==="columns"?Y:ee,"gap","rgb(200 66 135 / .12)");Ee+=Me?-ee:ee})};if(Re(se.gridTemplateColumns,"columns"),mt.some((ue)=>ue.property==="grid-template-rows"&&ue.value!=="none"))Re(se.gridTemplateRows,"rows");for(let ue of Z.children){let ce=r.getComputedStyle(ue),he=ue.getBoundingClientRect();if(ce.display==="none"||!he.width||!he.height)continue;let ie=n(ce.marginLeft)*A,ee=n(ce.marginRight)*A;ge(he.left-ie,he.top,ie,he.height,"gutter","rgb(200 66 135 / .16)"),ge(he.right,he.top,ee,he.height,"gutter","rgb(200 66 135 / .16)")}}if(se.display.includes("flex")||m==="mocks"){let Re=[...Z.children].filter((ue)=>{let ce=ue.getBoundingClientRect();return ce.width&&ce.height});for(let ue of Re){je.add(ue);let ce=ue.getBoundingClientRect();ge(ce.left,ce.top,ce.width,ce.height,"content","rgb(70 120 250 / .5)",!0)}Re.forEach((ue,ce)=>{let he=Re[ce-1];if(!he)return;let ie=he.getBoundingClientRect(),ee=ue.getBoundingClientRect();if(ee.top>=ie.bottom)ge(Math.max(ie.left,ee.left),ie.bottom,Math.min(ie.right,ee.right)-Math.max(ie.left,ee.left),ee.top-ie.bottom,"gap","rgb(200 66 135 / .16)");else if(ee.left>=ie.right)ge(ie.right,Math.max(ie.top,ee.top),ee.left-ie.right,Math.min(ie.bottom,ee.bottom)-Math.max(ie.top,ee.top),"gap","rgb(200 66 135 / .16)");else if(ie.left>=ee.right)ge(ee.right,Math.max(ie.top,ee.top),ie.left-ee.right,Math.min(ie.bottom,ee.bottom)-Math.max(ie.top,ee.top),"gap","rgb(200 66 135 / .16)")})}if(le.push(W),f===Z){let Re=[...new Set(mt.flatMap((ue)=>ue.value.match(/--[\w-]+/g)??[]))];Ie.push({label:Z.getAttribute("aria-label")??Z.getAttribute("role")??Z.tagName.toLowerCase(),width:Math.round(J.width*10)/10,height:Math.round(J.height*10)/10,display:se.display,padding:ve,margin:_e,rowGap:se.rowGap,columnGap:se.columnGap,tokens:Re})}}for(let Z of b)if(!je.has(Z))v.unobserve(Z),b.delete(Z);for(let Z of je)if(!b.has(Z))v.observe(Z),b.add(Z);let[Oe]=Ie;if(Oe){l=f??void 0;let Z=JSON.stringify(Oe);if(Z!==c)c=Z,t(Oe)}else if(l&&!e.contains(l))te();i?.replaceChildren(...le)}function te(){l=void 0,c="",t(null)}function fe(D){if(u===D){M();return}if(u=D,D)i=o.createElement("div"),i.id="ads-grid-overlay",i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;inset:0;z-index:2147483646;pointer-events:none;overflow:hidden",o.body.append(i),k.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),k.observe(o.documentElement,{attributes:!0}),e.addEventListener("pointermove",oe,{passive:!0}),e.addEventListener("pointerleave",pe),e.addEventListener("focusin",oe),e.addEventListener("focusout",we),r.addEventListener("resize",M),o.addEventListener("scroll",M,!0),M();else{if(s!==void 0)r.cancelAnimationFrame(s);s=void 0,v.disconnect(),b.clear(),k.disconnect(),e.removeEventListener("pointermove",oe),e.removeEventListener("pointerleave",pe),e.removeEventListener("focusin",oe),e.removeEventListener("focusout",we),r.removeEventListener("resize",M),o.removeEventListener("scroll",M,!0),i?.remove(),i=void 0,f=null,te()}}return{setVisible:fe,setGuides(D){S=io(D)?D:{},M()},setMetadata(D,ne,be=null){h=D.flatMap((re)=>{let le=Nb(re);return le?[le]:[]}),m=ne,y=Ab(be),f=null,te(),M()},dispose(){fe(!1)}}}function jb(e){let t=e instanceof HTMLElement?Number(e.dataset.adsStageInset??""):Number.NaN;return Number.isFinite(t)&&t>=0&&e instanceof HTMLElement&&e.dataset.adsStageInset!==void 0?t:null}function Lb(e){let t=e.defaultView;if(!t)throw Error("The preview document has no window.");return t}function Ub(e){let t=e.map((o)=>({...o}));for(let o=!0;o;){o=!1;e:for(let r=0;r<t.length;r++)for(let n=r+1;n<t.length;n++){let i=t[r],s=t[n];if(i&&s&&i.left<=s.right&&s.left<=i.right&&i.top<=s.bottom&&s.top<=i.bottom){t[r]={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)},t.splice(n,1),o=!0;break e}}}return t}function zf(e,{decorate:t=!0}={}){let o=e.ownerDocument,r=Lb(o),n=null,i=null,s=null,c=0,l=null,u=new r.ResizeObserver(()=>k()),h=new r.MutationObserver(()=>U()),m=new r.MutationObserver(()=>k()),f=()=>k();function S(){if(l?.remove(),l=null,s)delete s.dataset.adsStaged,delete s.dataset.adsSubjectOnly}function y(z){if(z===s)return;if(s?.removeEventListener("scroll",f),u.disconnect(),S(),s=z,!s)return;s.addEventListener("scroll",f,{passive:!0}),u.observe(s)}function b(){let z=e.querySelector(":scope > .ads-preview-root");y(z instanceof r.HTMLElement?z:null);let R=s&&n?[...s.querySelectorAll(n)]:[],M=R.filter((de)=>!R.some((Ne)=>Ne!==de&&Ne.contains(de))),[oe]=M,pe=M.length===1&&oe?oe.parentElement:null,we=s!==null&&pe!==null&&(pe===s||pe.parentElement===s&&pe.children.length===1)&&[...s.children].every((de)=>de===l||de===pe||de===oe);return s?.toggleAttribute("data-ads-subject-only",we),M}function v(){c=0;let z=b();if(!t||!s||s.hasAttribute("data-ads-subject-only")){if(l?.remove(),l=null,s)delete s.dataset.adsStaged;return}let R=s,M=new Set(["SPAN","STRONG","EM","B","I","SMALL","CODE","LABEL","ABBR"]),oe=(te)=>M.has(te.tagName)&&!z.includes(te)&&te.querySelector("*")===null&&Boolean(te.textContent?.trim()),pe=(te)=>{let fe=te.parentElement;if(!fe||fe===R)return te;if(fe.children.length===1)return[...fe.childNodes].some((re)=>re.nodeType===3&&re.textContent?.trim())?fe:te;let D=[...fe.children].filter((re)=>re!==te),ne=r.getComputedStyle(fe);return(ne.display.includes("flex")&&!ne.flexDirection.startsWith("column")||ne.display.startsWith("inline"))&&D.some(oe)&&D.every((re)=>oe(re)||z.includes(re))?fe:te},we=Ub(z.map(pe).flatMap((te)=>{u.observe(te,{box:"border-box"});let fe=te.getBoundingClientRect(),D=i&&te.matches(i)?0:jb(te)??16;return fe.width&&fe.height?[{left:fe.left-D,top:fe.top-D,right:fe.right+D,bottom:fe.bottom+D}]:[]}));if(!we.length){S();return}let de=R.getBoundingClientRect(),Ne=de.left+R.clientLeft,Ve=de.top+R.clientTop,Be={left:Ne,top:Ve,right:Ne+R.clientWidth,bottom:Ve+R.clientHeight};if(!l||l.parentElement!==R)l?.remove(),l=o.createElement("div"),l.dataset.adsSubjectStage="",l.setAttribute("aria-hidden","true"),Object.assign(l.style,{position:"fixed",inset:"0",pointerEvents:"none",background:"var(--bg-canvas, Canvas)",zIndex:"-1"}),R.prepend(l);R.dataset.adsStaged="";let ot=we.map((te)=>({left:Math.max(te.left,Be.left),top:Math.max(te.top,Be.top),right:Math.min(te.right,Be.right),bottom:Math.min(te.bottom,Be.bottom)})).filter((te)=>te.right>te.left&&te.bottom>te.top),Qe=(te)=>`M${te.left} ${te.top}H${te.right}V${te.bottom}H${te.left}Z`;l.style.clipPath=ot.length?`path("${ot.map(Qe).join("")}")`:"inset(50%)",l.dataset.adsStages=String(we.length)}function k(){if(!c)c=r.requestAnimationFrame(v)}function U(){b(),k()}return h.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","hidden","open","data-ads-source"]}),m.observe(o.documentElement,{attributes:!0,attributeFilter:["data-theme","data-brand"]}),r.addEventListener("resize",k),{setSubjectSelector(z,R=null){n=z||null,i=R,U()},refresh:U,dispose(){if(h.disconnect(),m.disconnect(),c)r.cancelAnimationFrame(c);r.removeEventListener("resize",k),y(null),S(),n=null,i=null}}}var ut=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Map);var Rf=/^[a-f0-9]{64}$/,Db=/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/;var Zb=["react","preact"],Hb=["imports","dynamicImports","styles","references"];function Fb(e){if(!ut(e)||e.schemaVersion!==1||!Zb.includes(e.framework)||!Rf.test(String(e.revision))||!ut(e.assets)||!Array.isArray(e.scenarios))throw Error("Invalid preview manifest update.");let t=e.assets,o=new Set;for(let r of e.scenarios){let n=ut(r)?r.id:void 0,i=ut(r)?r.module:void 0,s=typeof i==="string"?t[i]:void 0;if(typeof n!=="string"||o.has(n)||!ut(s)||s.kind!=="module")throw Error("Invalid updated preview scenarios.");o.add(n)}for(let[r,n]of Object.entries(t))if(!Db.test(r)||!ut(n)||!Hb.every((i)=>{let s=n[i];return Array.isArray(s)&&s.every((c)=>typeof c==="string"&&Object.hasOwn(t,c))}))throw Error("Invalid updated preview dependencies.")}function Il(e){return Fb(e),e}function xf(e,t){if(!ut(e)||e.version!==1)throw Error("Unsupported preview manifest update.");if(e.type==="full")return Il(e.manifest);if(!t||e.baseRevision!==t.revision)throw Error("Preview manifest update base does not match.");let o=e.header;if(!ut(o)||Object.hasOwn(o,"assets")||Object.hasOwn(o,"scenarios")||!Rf.test(String(o.revision)))throw Error("Invalid preview manifest update header.");if(e.type==="unchanged"){if(o.revision!==t.revision)throw Error("Unchanged preview revision does not match.");return Il({...o,assets:t.assets,scenarios:t.scenarios})}let{assets:r,scenarios:n}=e,i=ut(r)?r.upsert:void 0,s=ut(r)?r.remove:void 0,c=ut(n)?n.upsert:void 0,l=ut(n)?n.remove:void 0;if(e.type!=="delta"||!i||!Array.isArray(s)||!Array.isArray(c)||!Array.isArray(l))throw Error("Invalid preview manifest delta.");let u=new Map(Object.entries(t.assets)),h=new Map(t.scenarios.map((y)=>[y.id,y]));for(let y of s)if(typeof y!=="string"||!u.delete(y))throw Error("Unknown removed preview asset.");let m=Object.entries(i);for(let[y,b]of m)u.set(y,b);for(let y of l)if(!h.delete(y))throw Error("Unknown removed preview scenario.");let f=new Set;for(let y of c){let b=ut(y)?y.id:void 0;if(!y||f.has(b))throw Error("Duplicate updated preview scenario.");f.add(b),h.set(b,y)}let S=(ut(n)?n.order:void 0)??t.scenarios.map((y)=>y.id);if(!Array.isArray(S)||S.length!==h.size||new Set(S).size!==S.length||S.some((y)=>!h.has(y)))throw Error("Invalid updated preview scenario order.");return Il({...o,assets:Object.fromEntries(u),scenarios:S.map((y)=>h.get(y))})}var Pf=(e,t)=>typeof e==="object"&&e!==null?Reflect.get(e,t):void 0;function Vb(e){let t=e.contents.find((o)=>typeof o.text==="string")?.text;if(t===void 0)throw Error("The preview manifest resource has no text.");return JSON.parse(t)}function Ef(e){let t=new Map,o=new Map,r=0,n,i=0,s=0,c=!0;function l(u){t.delete(u.revision),t.set(u.revision,{graph:u,size:new TextEncoder().encode(JSON.stringify(u)).byteLength});let h=[...t.values()].reduce((m,f)=>m+f.size,0);while(t.size>6||h>8388608){let[m]=t;if(!m)break;h-=m[1].size,t.delete(m[0])}}return{clear(){r++,t.clear(),o.clear(),n=void 0,c=!0},async get(u,{revision:h,session:m}={}){let f=h?t.get(h)?.graph:void 0;if(f&&(!m||f.session===m))return{...f,transportManifestUri:u};let S=n,y=r,b=JSON.stringify([u,h,m,S?.revision]),v=o.get(b);if(!v){let k=++i,U=(async()=>{let z;if(S&&c)try{z=await e(u+"?from="+S.revision)}catch(pe){if(Pf(pe,"code")!==-32002&&!/unknown (?:ADS )?resource|resource not found/i.test(String(Pf(pe,"message"))))throw pe;if(y===r)c=!1;z=await e(u)}else z=await e(u);let R=Vb(z),M=typeof R==="object"&&R!==null&&Boolean(Reflect.get(R,"type")),oe=xf(M?R:{version:1,type:"full",manifest:R},S);if(y===r){if(l(oe),k>=s)n=oe,s=k}return oe})();o.set(b,U),U.then(()=>{if(o.get(b)===U)o.delete(b)},()=>{if(o.get(b)===U)o.delete(b)}),v=U}return{...await v,transportManifestUri:u}}}}var Ml=(e)=>typeof e==="object"&&e!==null,Ol=(e)=>Ml(e)?e:{},me=(e,t)=>Ml(e)?e[t]:void 0,xr=(e)=>typeof e==="string"?e:void 0,kf=(e)=>({message:xr(me(e,"message"))??"",code:me(e,"code"),category:me(e,"category"),resourceUri:me(e,"resourceUri")});function Tf(e){let t=document.getElementById(e);if(!t)throw Error(`The preview document has no #${e}.`);return t}async function $f(e,t=(o)=>new Tl(o)){let o=Tf("root"),r=Tf("ads-preview-status"),n=document.documentElement,i,s=async(I)=>{if(!e.getHostCapabilities()?.serverResources)throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");try{return await e.readServerResource({uri:i?i+encodeURIComponent(I):I},{timeout:15000})}catch(A){if(me(A,"code")===-32601||me(A,"message")==="Method not found")throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");throw A}},c=t(s),l=Ef(s);n.dataset.adsPreviewDelivery=e.delivery??"mcp-blob";let u,h,m,f,S,y=!1,b,v=0,k={},U=[],z=!1,R,M,oe=new Set;function pe(I){if(e.getHostVersion()?.name!=="ADS showcase")return;let A=M;if(M=I,!A)return;let B=_f(A,I).filter((X)=>X!==u&&oe.has(X));if(!B.length)return;c.prefetch(I,B).then((X)=>de("prefetched",{revision:I.revision,...X})).catch((X)=>console.warn("ADS preview prefetch",me(X,"message")))}function we(I,A=!1){r.textContent=I,r.hidden=!I||e.getHostVersion()?.name==="ADS showcase",r.setAttribute("role",A?"alert":"status")}async function de(I,A={}){try{if(e.getHostCapabilities()?.logging)await e.sendLog({level:I==="error"?"error":"info",logger:"ads-preview",data:{state:I,id:u,...A}})}catch{}}let Ne=!1,Ve=wf(o),Be=zf(o,{decorate:Reflect.get(globalThis,"__ADS_RENDER_AUDIT__")!==!0}),ot={foundation:'.ads-grid-example, .ads-grid-unit, [data-slot="sample"][data-ads-specimen]',tokens:'[data-slot="sample"][data-ads-specimen]:not([data-ads-specimen="value"])',profiles:'[data-slot="sample"][data-ads-specimen]:not([data-ads-specimen="value"]):not([data-ads-specimen="motion"]):not([data-ads-specimen="applied"]), .ds-motion-track, .ds-applied-sample',assets:'[data-slot="sample"]:not(:empty), .catalogue-set, .catalogue-mag, .catalogue-sizes'},Qe='[data-slot="specimen"]:not([data-frame="screen"])',te=".ads-preview-root[data-ads-bare] > :not([data-ads-subject-stage])";function fe(I){let A=Ol(I);k={...k,...A,styles:{...Ol(k.styles),...Ol(A.styles)}};let B=k.theme,X=k.adsTheme??(B==="light"||B==="dark"?me(U.find((_e)=>me(_e,"scheme")===B)??{name:B},"name"):void 0);if(X)n.dataset.theme=String(X);if(k.adsChoices==="host")n.dataset.adsChoices="host";let ve=k.adsBrand;if(typeof ve==="string"&&/^[a-z][a-z0-9-]*$/.test(ve))n.dataset.brand=ve;Ve.setGuides(k.gridGuides),Ve.setVisible(Ne&&k.gridOverlay===!0),le(),Z(),be()}let D;function ne(I){if(I===D)return;if(D=I,I===void 0){Reflect.deleteProperty(globalThis,"__ADS_SCENARIO_STATE__");return}Reflect.set(globalThis,"__ADS_SCENARIO_STATE__",I),document.dispatchEvent(new CustomEvent("ads-scenario-state",{detail:{state:I}}))}function be(){if(!("adsState"in k))return;let I=k.adsState;ne(typeof I==="string"?I:void 0)}let re=(I)=>{let A=me(I instanceof CustomEvent?I.detail:void 0,"state");if(typeof A!=="string")return;D=A,Reflect.set(globalThis,"__ADS_SCENARIO_STATE__",A),de("scenario-state",{name:A})};document.addEventListener("ads-scenario-state-chosen",re);function le(){document.dispatchEvent(new CustomEvent(yf,{detail:hi(k.gridGuideChoices??k.gridGuides)}))}function je(I){let A=I instanceof CustomEvent?I.detail:void 0;if(!A){le();return}let B=hi(A);fe({gridGuideChoices:B,gridGuides:bf(B),gridOverlay:vf(B)}),de("guide-options",{options:B})}document.addEventListener($l,je);let Ie=(I)=>{let A=I instanceof CustomEvent?I.detail:void 0,B=me(A,"target");if(typeof B==="string")de("navigate",{target:B,token:me(A,"token")})};document.addEventListener("ads-preview-navigate",Ie);let Oe;function Z(){let I=k.adsFocus;if(!Ml(I)||I.nonce===Oe||I.target!==u||n.dataset.adsPreviewState!=="ready")return;Oe=I.nonce,document.dispatchEvent(new CustomEvent("ads-preview-focus",{detail:{token:I.token}}))}async function se(I="ads://preview/manifest",A,B){try{return await(c.manifest?c.manifest(I,{revision:A,session:B,scenario:u}):l.get(I,{revision:A,session:B}))}catch(X){throw Object.assign(Error(xr(me(X,"message")),{cause:X}),{code:"ADS_MANIFEST_READ",category:"transport"})}}async function J(I,A,B=!1,X="",ve=!1,_e){let Pe=B||ve;if(!X&&I===u&&A&&A===m&&(!_e||_e===f)&&Pe===z){we(Pe?"Checking changes…":""),await de(Pe?"checking":"ready",{revision:m});return}let Le=++v;++c.generation,u=I,Ne=!1,Ve.setVisible(!1),oe.add(I),n.dataset.adsScenario=I,n.dataset.adsPreviewState="loading";for(let ye of["adsPreviewErrorCategory","adsPreviewErrorCode","adsPreviewResourceUri"])delete n.dataset[ye];we(""),await de(X?"reverting":"loading");try{let ye=performance.now(),ze=await se(B?"ads://preview/live":"ads://preview/manifest",A,_e);if(Le!==v)return;let P=ze.themes;if(Array.isArray(P))U=P,fe({});if(A&&ze.revision!==A||_e&&ze.session!==_e){if(Le===v)we("Updating preview…"),await de("loading",{code:"ADS_PREVIEW_CHANGED"});return}if(Le!==v)return;let We=performance.now();performance.measure("ads-preview:manifest",{start:ye,end:We});let j=await c.mount(ze,I,o);if(performance.measure("ads-preview:load-mount",{start:We,end:performance.now()}),!j||Le!==v)return;let G=ze.scenarios.find((x)=>x.id===I)?.kind;o.dataset.adsScenarioKind=String(G??"");let O=typeof G==="string"&&Object.hasOwn(ot,G)?ot[G]:void 0;if(O!==void 0)Be.setSubjectSelector(O,".ads-grid-example");else Be.setSubjectSelector(`${Qe}, ${te}`,Qe);if(m=ze.revision,f=ze.session,z=Pe,await new Promise((x)=>requestAnimationFrame(()=>requestAnimationFrame(x))),await document.fonts.ready,Le!==v)return;if(Ne=G==="components"||G==="patterns"||G==="mocks"||G==="foundation",Ve.setMetadata(Object.values(ze.assets).flatMap((x)=>x.spatial?[x.spatial]:[]),G,ze.spatial),fe({}),o.dataset.adsPaintBindings="[]",o.dataset.adsPaintAudit="false",o.dataset.adsPaintAuditComplete="not-requested",Le===v){if(n.dataset.adsPreviewRevision=m,n.dataset.adsPreviewState=X?"error":Pe?"checking":"ready",we(X||(Pe?"Checking changes…":""),Boolean(X)),await de(X?"error":Pe?"checking":"ready",{revision:m,selectionRevision:h,...X?{message:X}:{}}),!Pe&&!X)pe(ze)}if(Le===v)Oe=void 0,Z()}catch(ye){if(Le===v){let{message:ze,code:P,category:We,resourceUri:j}=kf(ye);if(n.dataset.adsPreviewState="error",n.dataset.adsPreviewErrorCategory=String(We??"runner"),n.dataset.adsPreviewErrorCode=String(P??"ADS_PREVIEW_STARTUP"),j)n.dataset.adsPreviewResourceUri=String(j);we(ze,!0),await de("error",{message:ze,...P?{code:P}:{},...We?{category:We}:{},...j?{resourceUri:j}:{}})}}}async function ke(I){if(!u)return;if(document.visibilityState==="hidden"){if(I)b=I;return}if(y){if(I)b=I;return}y=!0;let A=v;try{let B=I??JSON.parse((await s("ads://project/build")).contents.find((ye)=>typeof ye.text==="string")?.text??"");if(A!==v)return;R=void 0;let X=me(B,"previews");if(!Array.isArray(X))throw Error("The build report lists no previews.");let ve=X.find((ye)=>me(ye,"id")===u),_e=me(B,"session"),Pe=xr(me(B,"manifestRevision")),Le=me(ve,"live");if(Le&&!me(ve,"current")){let ye=xr(me(Le,"revision"));if(ye!==m||_e!==f||!z)await J(u,ye,!0,"",!1,_e);else we("Checking changes…")}else if(!ve||!me(ve,"current")){let ye=me(ve,"diagnostics"),ze=Array.isArray(ye)?me(ye[0],"message"):void 0;if(ze&&z){let P=await se("ads://preview/manifest",Pe,_e);await J(u,P.revision,!1,`Build failed. Showing the previous preview.
|
|
110
110
|
${String(ze)}`,!1,_e)}we(ze?`Build failed. Showing the previous preview.
|
|
111
111
|
${String(ze)}`:"Rebuilding. This is the previous preview.",Boolean(ze))}else{let ye=await se("ads://preview/manifest",Pe,_e);if(A!==v)return;if(ye.revision!==m||ye.session!==f||z)await J(u,ye.revision,!1,"",!1,_e);else we(""),pe(ye)}}catch(B){if(A!==v)return;let X=`Preview freshness unavailable: ${String(me(B,"message"))}`;if(we(X,!0),R!==X)R=X,await de("error",{message:X})}finally{y=!1;let B=b;if(b=void 0,B)ke(B)}}e.onbuildreport=(I)=>{ke(I)};let ht=()=>{if(document.visibilityState!=="hidden")b=void 0,ke()};document.addEventListener("visibilitychange",ht),e.ontoolresult=(I)=>{let A=I.structuredContent,B=xr(me(A,"draftScope"));if(B!==i)++v,++c.generation,l.clear(),m=f=M=void 0,oe.clear();i=B;let X=me(me(A,"previewResult"),"structuredContent")??A,ve=me(me(X,"scenario"),"id");if(ve&&!("adsState"in k)){let _e=me(X,"state");if(typeof _e==="string")ne(_e);else if(String(ve)!==u)ne(void 0)}if(ve){let _e=me(X,"manifestRevision");h=_e;let Pe=me(X,"build");J(String(ve),xr(_e),me(X,"manifestUri")==="ads://preview/live","",me(Pe,"current")===!1,me(Pe,"session")).then(()=>{if(e.buildPollInterval===0)ke()})}},e.onhostcontextchanged=fe,e.onteardown=async()=>(++v,u=b=void 0,e.onbuildreport=void 0,l.clear(),document.removeEventListener("visibilitychange",ht),document.removeEventListener($l,je),document.removeEventListener("ads-preview-navigate",Ie),document.removeEventListener("ads-scenario-state-chosen",re),Ve.dispose(),Be.dispose(),clearInterval(S),await c.dispose(),{});try{let I=performance.now();if(await e.connect(),performance.measure("ads-preview:connect",{start:I,end:performance.now()}),fe(e.getHostContext()??{}),!e.getHostCapabilities()?.serverResources)throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");let A=e.buildPollInterval??150;if(A>0)S=setInterval(()=>{ke()},A);let B=document.getElementById("ads-preview-selection");if(B)J(String(me(JSON.parse(B.textContent??""),"id")))}catch(I){we(kf(I).message,!0)}window.addEventListener("pagehide",()=>{u=b=void 0,e.onbuildreport=void 0,clearInterval(S),l.clear(),c.dispose()},{once:!0})}var Dt=new La({name:"ADS resource preview",version:"1.0.0"},{},{autoResize:!0}),Jb={getHostCapabilities:()=>Dt.getHostCapabilities(),getHostVersion:()=>Dt.getHostVersion(),getHostContext:()=>Dt.getHostContext(),connect:()=>Dt.connect(),readServerResource:(e,t)=>Dt.readServerResource(e,t),sendLog:(e)=>Dt.sendLog(e),set ontoolresult(e){Dt.ontoolresult=e},set onhostcontextchanged(e){Dt.onhostcontextchanged=e},set onteardown(e){Dt.onteardown=e}};await $f(Jb);
|