@reqvire-org/ads 0.4.0 → 0.4.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 +105 -86
- package/dist/a11y.mjs +108 -29
- package/dist/analysis/compiler-options.mjs +13 -0
- package/dist/analysis/context.mjs +46 -0
- package/dist/analysis/file-tree.mjs +52 -0
- package/dist/analysis/helpers.mjs +140 -0
- package/dist/analysis/impact.mjs +20 -0
- package/dist/analysis/inputs.mjs +15 -0
- package/dist/analysis/native-adapter.mjs +180 -0
- package/dist/analysis/native-project.mjs +323 -0
- package/dist/analysis/queries.mjs +133 -0
- package/dist/analysis/service.mjs +146 -0
- package/dist/analysis/standalone.mjs +57 -0
- package/dist/analysis/syntax.mjs +164 -0
- package/dist/analysis/worker.mjs +182 -0
- package/dist/assets.mjs +5 -5
- package/dist/atomic-composition.mjs +191 -70
- package/dist/atomic-trace.mjs +120 -50
- package/dist/behavior-libraries.mjs +106 -37
- package/dist/behaviors.mjs +219 -77
- package/dist/boundaries.mjs +135 -38
- package/dist/brand-assets.mjs +219 -47
- package/dist/brands.mjs +86 -27
- package/dist/bun-compiler.mjs +28 -14
- package/dist/bun-worker.mjs +7 -5
- package/dist/capture/worker.mjs +15 -4
- package/dist/capture-store.mjs +4 -2
- package/dist/capture.mjs +17 -14
- package/dist/check-service.mjs +40 -57
- package/dist/check.mjs +749 -188
- package/dist/cli.mjs +200 -99
- package/dist/color-values.mjs +21 -21
- package/dist/component-contrast.mjs +2 -2
- package/dist/config.mjs +303 -135
- package/dist/construction-styles.cjs +10 -0
- package/dist/control-padding.mjs +45 -25
- package/dist/css-values.mjs +3 -2
- package/dist/declarative-flow.mjs +209 -109
- package/dist/design-values.mjs +136 -51
- package/dist/development-runtime.mjs +4 -6
- package/dist/draft-boundary.mjs +11 -6
- package/dist/evidence.mjs +1 -1
- package/dist/finding-rules.mjs +7 -5
- package/dist/font-rules.mjs +2 -2
- package/dist/fonts-generated.mjs +2 -2
- package/dist/foundation-views.mjs +238 -0
- package/dist/foundation.mjs +63 -39
- package/dist/generated-entries.mjs +101 -34
- package/dist/icons.mjs +79 -32
- package/dist/image-attributes.mjs +109 -36
- package/dist/image-size.mjs +1 -1
- package/dist/index.mjs +0 -2
- package/dist/init.mjs +122 -41
- package/dist/investigations.mjs +2 -2
- package/dist/layers.mjs +298 -129
- package/dist/layout-widths.mjs +180 -85
- package/dist/linaria/preserve-values.cjs +7 -0
- package/dist/linaria/spatial-inputs.cjs +56 -0
- package/dist/lockup-composition.mjs +44 -0
- package/dist/lockup-model.cjs +64 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
- package/dist/mcp/apps.mjs +4 -30
- package/dist/mcp/behavior-pages.mjs +72 -24
- package/dist/mcp/build-status.mjs +257 -64
- package/dist/mcp/catalog.mjs +90 -26
- package/dist/mcp/context.mjs +17 -18
- package/dist/mcp/draft-discovery.mjs +44 -21
- package/dist/mcp/drafts.mjs +901 -281
- package/dist/mcp/execution-coordinator.mjs +417 -167
- package/dist/mcp/execution-results.mjs +7 -7
- package/dist/mcp/mutations.mjs +670 -234
- package/dist/mcp/preview-watch.mjs +448 -170
- package/dist/mcp/preview-widget.bundle.js +44 -50
- package/dist/mcp/prompts.mjs +5 -5
- package/dist/mcp/result-pages.mjs +1 -1
- package/dist/mcp/sandbox-host.mjs +1 -1
- package/dist/mcp/server.mjs +2402 -577
- package/dist/mcp/showcase-host.mjs +165 -41
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/text-diff.mjs +29 -10
- package/dist/paint-contracts.mjs +174 -81
- package/dist/palette-generated.mjs +2 -2
- package/dist/preview-bun.mjs +493 -187
- package/dist/preview-failure.mjs +1 -1
- package/dist/preview-files.mjs +13 -13
- package/dist/preview-imports.mjs +104 -55
- package/dist/preview-inputs.mjs +2 -2
- package/dist/preview-requests.mjs +24 -0
- package/dist/preview-resources.mjs +288 -147
- package/dist/preview-scope.mjs +5 -4
- package/dist/program-cache.mjs +8 -34
- package/dist/project-documents.mjs +1 -1
- package/dist/public-api.mjs +69 -31
- package/dist/public-props.mjs +39 -22
- package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
- package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
- package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
- package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
- package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
- package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
- package/dist/render-audit.mjs +828 -0
- package/dist/render-color-probe.mjs +96 -42
- package/dist/resource-limits.mjs +229 -97
- package/dist/runtime-contracts.mjs +467 -185
- package/dist/scenario-groups.mjs +22 -10
- package/dist/scenario-inspector.mjs +6 -43
- package/dist/scenario-program.mjs +8 -25
- package/dist/scenario-registry.mjs +72 -30
- package/dist/scenario-selectors.mjs +161 -64
- package/dist/scenario-slots.mjs +149 -56
- package/dist/scenario-trace.mjs +215 -109
- package/dist/scenarios-compiler.mjs +719 -378
- package/dist/scenarios-vite.d.mts +1 -3
- package/dist/scenarios-vite.mjs +2 -81
- package/dist/scenarios.mjs +421 -157
- package/dist/selector-match.mjs +2 -2
- package/dist/showcase/client.bundle.js +57 -56
- package/dist/showcase/draft-navigation.js +18 -0
- package/dist/showcase/favicon.ico +0 -0
- package/dist/showcase/favicon.svg +1 -0
- package/dist/showcase/foundation-view.css +55 -0
- package/dist/showcase/foundation-view.mjs +252 -0
- package/dist/showcase/guide-controls.ads.review.mjs +32 -0
- package/dist/showcase/icons.js +1 -145
- package/dist/showcase/index.html +3 -31
- package/dist/showcase/preview-frame.ads.review.css +46 -0
- package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
- package/dist/showcase/preview-frame.ads.review.mjs +22 -0
- package/dist/showcase/preview-state.js +0 -9
- package/dist/showcase/refresh-scheduler.js +23 -0
- package/dist/showcase/style.css +5 -47
- package/dist/showcase/ui/ui.css +1353 -0
- package/dist/showcase/ui/ui.js +1062 -0
- package/dist/showcase-coverage.mjs +58 -37
- package/dist/skills/README.md +24 -23
- package/dist/skills/ads-designer/README.md +8 -2
- package/dist/skills/ads-designer/SKILL.md +130 -119
- package/dist/skills/ads-designer/references/accessibility.md +12 -13
- package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
- package/dist/skills/ads-designer/references/behaviors.md +30 -27
- package/dist/skills/ads-designer/references/branding.md +98 -10
- package/dist/skills/ads-designer/references/captures.md +25 -0
- package/dist/skills/ads-designer/references/cli.md +21 -24
- package/dist/skills/ads-designer/references/contracts.md +7 -6
- package/dist/skills/ads-designer/references/design-data.md +49 -52
- package/dist/skills/ads-designer/references/drafts.md +20 -17
- package/dist/skills/ads-designer/references/evidence.md +1 -5
- package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
- package/dist/skills/ads-designer/references/layers.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +347 -0
- package/dist/skills/ads-designer/references/mobile.md +2 -1
- package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
- package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
- package/dist/skills/ads-designer/references/review.md +37 -34
- package/dist/skills/ads-designer/references/runtimes.md +33 -30
- package/dist/skills/ads-designer/references/scenarios.md +16 -18
- package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
- package/dist/skills/ads-designer/references/stress-test.md +68 -0
- package/dist/skills/ads-designer/references/validation.md +83 -75
- package/dist/skills/ads-designer/references/workflows.md +8 -33
- package/dist/skills/ads-import/SKILL.md +43 -325
- package/dist/skills/ads-import/references/atomic-styles.md +4 -4
- package/dist/skills/ads-import/references/behaviors.md +30 -27
- package/dist/skills/ads-import/references/branding.md +5 -5
- package/dist/skills/ads-import/references/captures.md +25 -0
- package/dist/skills/ads-import/references/cli.md +21 -24
- package/dist/skills/ads-import/references/compatibility.md +1 -1
- package/dist/skills/ads-import/references/contracts.md +7 -6
- package/dist/skills/ads-import/references/design-data.md +49 -52
- package/dist/skills/ads-import/references/drafts.md +20 -17
- package/dist/skills/ads-import/references/evidence.md +1 -5
- package/dist/skills/ads-import/references/guarded-editing.md +14 -18
- package/dist/skills/ads-import/references/implementation.md +2 -1
- package/dist/skills/ads-import/references/layers.md +1 -1
- package/dist/skills/ads-import/references/layout.md +347 -0
- package/dist/skills/ads-import/references/review.md +37 -34
- package/dist/skills/ads-import/references/runtimes.md +33 -30
- package/dist/skills/ads-import/references/scenarios.md +16 -18
- package/dist/skills/ads-import/references/tokens.md +3 -3
- package/dist/skills/ads-import/references/validation.md +83 -75
- package/dist/skills/ads-import/references/workflows.md +8 -33
- package/dist/skills/ads-migrate/SKILL.md +56 -0
- package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
- package/dist/skills/ads-port/SKILL.md +54 -343
- package/dist/skills/ads-port/references/atomic-styles.md +4 -4
- package/dist/skills/ads-port/references/behaviors.md +30 -27
- package/dist/skills/ads-port/references/captures.md +25 -0
- package/dist/skills/ads-port/references/cli.md +21 -24
- package/dist/skills/ads-port/references/contracts.md +7 -6
- package/dist/skills/ads-port/references/design-data.md +49 -52
- package/dist/skills/ads-port/references/drafts.md +20 -17
- package/dist/skills/ads-port/references/evidence.md +1 -5
- package/dist/skills/ads-port/references/guarded-editing.md +14 -18
- package/dist/skills/ads-port/references/layers.md +1 -1
- package/dist/skills/ads-port/references/layout.md +347 -0
- package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
- package/dist/skills/ads-port/references/native-implementation.md +2 -1
- package/dist/skills/ads-port/references/review.md +37 -34
- package/dist/skills/ads-port/references/runtimes.md +33 -30
- package/dist/skills/ads-port/references/scenarios.md +16 -18
- package/dist/skills/ads-port/references/validation.md +83 -75
- package/dist/skills/ads-port/references/workflows.md +8 -33
- package/dist/source-symbols.mjs +1 -8
- package/dist/source-values.mjs +266 -128
- package/dist/spatial-composition.mjs +322 -0
- package/dist/spatial-contexts.cjs +56 -0
- package/dist/spatial-css.cjs +351 -0
- package/dist/spatial-inputs.cjs +80 -0
- package/dist/spatial-metadata.mjs +18 -0
- package/dist/spatial-model.cjs +322 -0
- package/dist/spatial.mjs +21 -0
- package/dist/stage-timing.cjs +20 -0
- package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
- package/dist/starters/preact/ds.config.json +25 -6
- package/dist/starters/preact/package.json +4 -8
- package/dist/starters/preact/tsconfig.json +4 -5
- package/dist/starters/preact/vite.config.ts +3 -3
- package/dist/starters/react/ADS.md +42 -47
- package/dist/starters/react/README.md +47 -49
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
- package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
- package/dist/starters/react/design-system/index.ts +2 -1
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
- package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
- package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
- package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
- package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
- package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
- package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
- package/dist/starters/react/design-system/tokens/colors.css +1 -1
- package/dist/starters/react/design-system/tokens/spacing.css +22 -32
- package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
- package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
- package/dist/starters/react/ds.config.json +25 -6
- package/dist/starters/react/package.json +2 -6
- package/dist/starters/react/tsconfig.json +2 -3
- package/dist/starters/react/vite.config.ts +3 -3
- package/dist/style-boundaries.mjs +70 -25
- package/dist/task-cache.mjs +173 -72
- package/dist/task-worker.mjs +22 -11
- package/dist/test-boundaries.mjs +132 -59
- package/dist/themes-generated.mjs +1 -1
- package/dist/themes-watch.mjs +57 -22
- package/dist/themes.mjs +176 -73
- package/dist/token-export.mjs +39 -14
- package/dist/token-policy.mjs +6 -3
- package/dist/token-quality.mjs +6 -6
- package/dist/token-samples.mjs +16 -5
- package/dist/tokens.mjs +71 -26
- package/dist/ui-framework.mjs +16 -14
- package/dist/unit-contracts.mjs +251 -104
- package/dist/units.mjs +208 -98
- package/dist/usage.mjs +138 -38
- package/dist/validation-checks.mjs +115 -38
- package/dist/validation-inputs.mjs +187 -78
- package/dist/validation.mjs +268 -102
- package/dist/verification/browser.mjs +27 -5
- package/dist/verification.mjs +711 -187
- package/docs/ADS.md +90 -79
- package/docs/ARCHITECTURE.md +294 -136
- package/docs/BEHAVIORS.md +29 -25
- package/docs/CACHING.md +52 -17
- package/docs/CHANGELOG.md +309 -17
- package/docs/CONTRACTS.md +12 -4
- package/docs/DESIGN-REFERENCES.md +40 -0
- package/docs/GUIDE.md +270 -258
- package/docs/MCP.md +181 -324
- package/docs/SPATIAL-CHECKS.md +69 -0
- package/docs/benchmarks/README.md +39 -0
- package/package.json +42 -34
- package/dist/browser-audit.mjs +0 -429
- package/dist/create.mjs +0 -48
- package/dist/lint-config.mjs +0 -50
- package/dist/mcp/project-widget.bundle.js +0 -114
- package/dist/mcp/reports.mjs +0 -101
- package/dist/mcp/widget.bundle.js +0 -147
- package/dist/oxlint.mjs +0 -89
- package/dist/preview-builder.mjs +0 -133
- package/dist/preview-workers.mjs +0 -184
- package/dist/showcase.mjs +0 -77
- package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
- package/dist/skills/ads-break-ui/README.md +0 -16
- package/dist/skills/ads-break-ui/SKILL.md +0 -412
- package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
- package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
- package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
- package/dist/skills/ads-break-ui/references/captures.md +0 -135
- package/dist/skills/ads-break-ui/references/contracts.md +0 -317
- package/dist/skills/ads-break-ui/references/design-data.md +0 -354
- package/dist/skills/ads-break-ui/references/drafts.md +0 -194
- package/dist/skills/ads-break-ui/references/evidence.md +0 -128
- package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
- package/dist/skills/ads-break-ui/references/layers.md +0 -145
- package/dist/skills/ads-break-ui/references/reporting.md +0 -101
- package/dist/skills/ads-break-ui/references/review.md +0 -97
- package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
- package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
- package/dist/skills/ads-break-ui/references/validation.md +0 -166
- package/dist/skills/ads-break-ui/references/verification.md +0 -58
- package/dist/skills/ads-break-ui/references/workflows.md +0 -90
- package/dist/skills/ads-designer/references/reporting.md +0 -101
- package/dist/skills/ads-import/references/reporting.md +0 -101
- package/dist/skills/ads-motion/LICENSE.upstream +0 -21
- package/dist/skills/ads-motion/README.md +0 -22
- package/dist/skills/ads-motion/SKILL.md +0 -385
- package/dist/skills/ads-motion/agents/openai.yaml +0 -4
- package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
- package/dist/skills/ads-motion/references/audit.md +0 -44
- package/dist/skills/ads-motion/references/behaviors.md +0 -412
- package/dist/skills/ads-motion/references/captures.md +0 -135
- package/dist/skills/ads-motion/references/contracts.md +0 -317
- package/dist/skills/ads-motion/references/design-data.md +0 -354
- package/dist/skills/ads-motion/references/drafts.md +0 -194
- package/dist/skills/ads-motion/references/evidence.md +0 -128
- package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
- package/dist/skills/ads-motion/references/layers.md +0 -145
- package/dist/skills/ads-motion/references/motion-review.md +0 -35
- package/dist/skills/ads-motion/references/reporting.md +0 -101
- package/dist/skills/ads-motion/references/review.md +0 -97
- package/dist/skills/ads-motion/references/runtimes.md +0 -203
- package/dist/skills/ads-motion/references/scenarios.md +0 -246
- package/dist/skills/ads-motion/references/validation.md +0 -166
- package/dist/skills/ads-motion/references/verification.md +0 -39
- package/dist/skills/ads-motion/references/workflows.md +0 -90
- package/dist/skills/ads-port/references/reporting.md +0 -101
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
- package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
- package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
- package/dist/starters/react/design-system/review/index.ts +0 -6
- package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
- package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
- package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
- package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
- package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
- package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
- package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
- package/dist/starters/react/package-lock.json +0 -4707
- package/dist/token-fixtures.mjs +0 -30
- package/docs/benchmarks/bun-previews.md +0 -91
- package/docs/benchmarks/preview-memory.md +0 -147
- package/docs/benchmarks/turbo-poc.md +0 -284
- package/docs/plans/execution-coordination.md +0 -57
- /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
- /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)}var{create:b_,defineProperty:xa,getOwnPropertyDescriptor:y_,getOwnPropertyNames:v_,getPrototypeOf:z_}=Object,w_=Object.prototype.hasOwnProperty,Td=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ed=(e,t)=>{let r={};for(var o in e)xa(r,o,{get:e[o],enumerable:!0});if(t)xa(r,Symbol.toStringTag,{value:"Module"});return r},R_=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=v_(t),s=0,i=n.length,a;s<i;s++)if(a=n[s],!w_.call(e,a)&&a!==r)xa(e,a,{get:((l)=>t[l]).bind(null,a),enumerable:!(o=y_(t,a))||o.enumerable})}return e},kd=(e,t,r)=>(r=e!=null?b_(z_(e)):{},R_(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e));var x_=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),$d=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),P_=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),T_=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Cd(e){return typeof e==="string"&&$d.has(e.replace(/#$/,""))}function Id(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(x_.has(r))return"2020-12";if($d.has(r))return"2019-09";if(P_.has(r)||T_.has(r))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 Od,el=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,l){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:l,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);let u=i.prototype,d=Object.keys(u);for(let m=0;m<d.length;m++){let f=d[m];if(!(f in a))a[f]=u[f].bind(a)}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var l;let u=r?.Parent?new s:this;o(u,a),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var E_=Symbol("zod_brand");class qt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Hn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Od=globalThis).__zod_globalConfig??(Od.__zod_globalConfig={});var bo=globalThis.__zod_globalConfig;function Ue(e){if(e)Object.assign(bo,e);return bo}function Ta(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function rl(e,t="|"){return e.map((r)=>il(r)).join(t)}function Vn(e,t){if(typeof t==="bigint")return t.toString();return t}function Jn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Ea(e){return e===null||e===void 0}function ka(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ad(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}var Nd=Symbol("evaluating");function ee(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===Nd)return;if(o===void 0)o=Nd,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function $r(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tr(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ol(e){return JSON.stringify(e)}function Md(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var qd=Jn(()=>{if(bo.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Cr(e){if(yo(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(yo(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function sl(e){if(Cr(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 jd=new Set(["string","number","symbol"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function at(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function j(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 il(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ld(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ud={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 k_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=tr(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return $r(this,"shape",i),i},checks:[]});return at(e,s)}function $_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=tr(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return $r(this,"shape",i),i},checks:[]});return at(e,s)}function C_(e,t){if(!Cr(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tr(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return $r(this,"shape",s),s}});return at(e,n)}function I_(e,t){if(!Cr(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=tr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return $r(this,"shape",o),o}});return at(e,r)}function O_(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=tr(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return $r(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return at(e,r)}function N_(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=tr(t._zod.def,{get shape(){let a=t._zod.def.shape,l={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;l[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return $r(this,"shape",l),l},checks:[]});return at(t,i)}function A_(e,t,r){let o=tr(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:n[i]})}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return $r(this,"shape",s),s}});return at(t,o)}function Ir(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Zd(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function or(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Pa(e){return typeof e==="string"?e:e?.message}function ct(e,t,r){let o=e.message?e.message:Pa(e.inst?._zod.def?.error?.(e))??Pa(t?.error?.(e))??Pa(r.customError?.(e))??Pa(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=i;return a}function $a(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Dd(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 r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Or(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Fd=(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,Vn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ca=_("$ZodError",Fd),al=_("$ZodError",Fd,{Parent:Error});function cl(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function ll(e,t=(r)=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let l=r,u=0;while(u<a.length){let d=a[u];if(u!==a.length-1)l[d]=l[d]||{_errors:[]};else l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(i));l=l[d],u++}}}};return o(e),r}var Ia=(e)=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new qt;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((l)=>ct(l,s,Ue())));throw nl(a,n?.callee),a}return i.value};var Oa=(e)=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((l)=>ct(l,s,Ue())));throw nl(a,n?.callee),a}return i.value};var Bn=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new qt;return s.issues.length?{success:!1,error:new(e??Ca)(s.issues.map((i)=>ct(i,n,Ue())))}:{success:!0,data:s.value}},Hd=Bn(al),Wn=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>ct(i,n,Ue())))}:{success:!0,data:s.value}},Vd=Wn(al),Jd=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ia(e)(t,r,n)};var Bd=(e)=>(t,r,o)=>Ia(e)(t,r,o);var Wd=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Oa(e)(t,r,n)};var Kd=(e)=>async(t,r,o)=>Oa(e)(t,r,o);var Gd=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Bn(e)(t,r,n)};var Yd=(e)=>(t,r,o)=>Bn(e)(t,r,o);var Xd=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Wn(e)(t,r,n)};var Qd=(e)=>async(t,r,o)=>Wn(e)(t,r,o);var ep=/^[cC][0-9a-z]{6,}$/,tp=/^[0-9a-z]+$/,rp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,op=/^[0-9a-vA-V]{20}$/,np=/^[A-Za-z0-9]{27}$/,sp=/^[a-zA-Z0-9_-]{21}$/,ip=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ap=/^([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})$/,ul=(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 cp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var q_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lp(){return new RegExp(q_,"u")}var up=/^(?:(?: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])$/,dp=/^(([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 pp=/^((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])$/,hp=/^(([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])$/,mp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,dl=/^[A-Za-z0-9_-]*$/;var fp=/^https?$/,gp=/^\+[1-9]\d{6,14}$/,Sp="(?:(?:\\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])))",_p=new RegExp(`^${Sp}$`);function bp(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 yp(e){return new RegExp(`^${bp(e)}$`)}function vp(e){let t=bp({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Sp}T(?:${o})$`)}var zp=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var wp=/^-?\d+$/,pl=/^-?\d+(?:\.\d+)?$/,Rp=/^(?:true|false)$/i,xp=/^null$/i;var Pp=/^undefined$/i;var Tp=/^[^A-Z]*$/,Ep=/^[^a-z]*$/;var Re=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kp={number:"number",bigint:"bigint",object:"date"},hl=_("$ZodCheckLessThan",(e,t)=>{Re.init(e,t);let r=kp[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ml=_("$ZodCheckGreaterThan",(e,t)=>{Re.init(e,t);let r=kp[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$p=_("$ZodCheckMultipleOf",(e,t)=>{Re.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Ad(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Cp=_("$ZodCheckNumberFormat",(e,t)=>{Re.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Ud[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=wp}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Ip=_("$ZodCheckMaxLength",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Ea(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=$a(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Op=_("$ZodCheckMinLength",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Ea(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=$a(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Np=_("$ZodCheckLengthEquals",(e,t)=>{var r;Re.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Ea(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=$a(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Gn=_("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Re.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.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(o=e._zod).check??(o.check=()=>{})}),Ap=_("$ZodCheckRegex",(e,t)=>{Gn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mp=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Tp),Gn.init(e,t)}),qp=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ep),Gn.init(e,t)}),jp=_("$ZodCheckIncludes",(e,t)=>{Re.init(e,t);let r=rr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),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})}}),Lp=_("$ZodCheckStartsWith",(e,t)=>{Re.init(e,t);let r=new RegExp(`^${rr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Up=_("$ZodCheckEndsWith",(e,t)=>{Re.init(e,t);let r=new RegExp(`.*${rr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Zp=_("$ZodCheckOverwrite",(e,t)=>{Re.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class fl{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 r=e.split(`
|
|
3
|
-
`).filter((
|
|
4
|
-
`))}}var Fp={major:4,minor:4,patch:3};var oe=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fp;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,l)=>{let u=Ir(i),d;for(let m of a){if(m._zod.def.when){if(Zd(i))continue;if(!m._zod.def.when(i))continue}else if(u)continue;let f=i.issues.length,g=m._zod.check(i);if(g instanceof Promise&&l?.async===!1)throw new qt;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,i.issues.length===f)return;if(!u)u=Ir(i,f)});else{if(i.issues.length===f)continue;if(!u)u=Ir(i,f)}}if(d)return d.then(()=>i);return i},s=(i,a,l)=>{if(Ir(i))return i.aborted=!0,i;let u=n(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new qt;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,i,a));return s(u,i,a)}let l=e._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new qt;return l.then((u)=>n(u,o,a))}return n(l,o,a)}}ee(e,"~standard",()=>({validate:(n)=>{try{let s=Hd(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Vd(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ma=_("$ZodString",(e,t)=>{oe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zp(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ce=_("$ZodStringFormat",(e,t)=>{Gn.init(e,t),Ma.init(e,t)}),Xp=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ap),ce.init(e,t)}),Qp=_("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ul(o))}else t.pattern??(t.pattern=ul());ce.init(e,t)}),eh=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cp),ce.init(e,t)}),th=_("$ZodURL",(e,t)=>{ce.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===fp.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.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))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),rh=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lp()),ce.init(e,t)}),oh=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sp),ce.init(e,t)}),nh=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ep),ce.init(e,t)}),sh=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tp),ce.init(e,t)}),ih=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rp),ce.init(e,t)}),ah=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=op),ce.init(e,t)}),ch=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=np),ce.init(e,t)}),lh=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vp(t)),ce.init(e,t)}),uh=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=_p),ce.init(e,t)}),dh=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yp(t)),ce.init(e,t)}),ph=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ip),ce.init(e,t)}),hh=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=up),ce.init(e,t),e._zod.bag.format="ipv4"}),mh=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=dp),ce.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var fh=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pp),ce.init(e,t)}),gh=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hp),ce.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,s]=o;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Sh(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 _h=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mp),ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Sh(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function j_(e){if(!dl.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Sh(r)}var bh=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dl),ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(j_(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),yh=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gp),ce.init(e,t)});function L_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));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 vh=_("$ZodJWT",(e,t)=>{ce.init(e,t),e._zod.check=(r)=>{if(L_(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Sl=_("$ZodNumber",(e,t)=>{oe.init(e,t),e._zod.pattern=e._zod.bag.pattern??pl,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),zh=_("$ZodNumberFormat",(e,t)=>{Cp.init(e,t),Sl.init(e,t)}),wh=_("$ZodBoolean",(e,t)=>{oe.init(e,t),e._zod.pattern=Rp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var Rh=_("$ZodUndefined",(e,t)=>{oe.init(e,t),e._zod.pattern=Pp,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),xh=_("$ZodNull",(e,t)=>{oe.init(e,t),e._zod.pattern=xp,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ph=_("$ZodAny",(e,t)=>{oe.init(e,t),e._zod.parse=(r)=>r}),Th=_("$ZodUnknown",(e,t)=>{oe.init(e,t),e._zod.parse=(r)=>r}),Eh=_("$ZodNever",(e,t)=>{oe.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Hp(e,t,r){if(e.issues.length)t.issues.push(...or(r,e.issues));t.value[r]=e.value}var kh=_("$ZodArray",(e,t)=>{oe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((u)=>Hp(u,r,i)));else Hp(l,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Aa(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...or(r,e.issues))}if(!i&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i)t.value[r]=void 0}else t.value[r]=e.value}function $h(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Ld(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ch(e,t,r,o,n,s){let i=[],a=n.keySet,l=n.catchall._zod,u=l.def.type,d=l.optin==="optional",m=l.optout==="optional";for(let f in t){if(f==="__proto__")continue;if(a.has(f))continue;if(u==="never"){i.push(f);continue}let g=l.run({value:t[f],issues:[]},o);if(g instanceof Promise)e.push(g.then((b)=>Aa(b,r,f,t,d,m)));else Aa(g,r,f,t,d,m)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var U_=_("$ZodObject",(e,t)=>{if(oe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}let o=Jn(()=>$h(t));ee(e._zod,"propValues",()=>{let a=t.shape,l={};for(let u in a){let d=a[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(let m of d.values)l[u].add(m)}}return l});let n=yo,s=t.catchall,i;e._zod.parse=(a,l)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let d=[],m=i.shape;for(let f of i.keys){let g=m[f],b=g._zod.optin==="optional",y=g._zod.optout==="optional",v=g._zod.run({value:u[f],issues:[]},l);if(v instanceof Promise)d.push(v.then((L)=>Aa(L,a,f,u,b,y)));else Aa(v,a,f,u,b,y)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return Ch(d,u,a,l,o.value,e)}}),Ih=_("$ZodObjectJIT",(e,t)=>{U_.init(e,t);let r=e._zod.parse,o=Jn(()=>$h(t)),n=(f)=>{let g=new fl(["shape","payload","ctx"]),b=o.value,y=(x)=>{let Z=ol(x);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};g.write("const input = payload.value;");let v=Object.create(null),L=0;for(let x of b.keys)v[x]=`key_${L++}`;g.write("const newResult = {};");for(let x of b.keys){let Z=v[x],R=ol(x),w=f[x],D=w?._zod?.optin==="optional",X=w?._zod?.optout==="optional";if(g.write(`const ${Z} = ${y(x)};`),D&&X)g.write(`
|
|
5
|
-
if (${
|
|
6
|
-
if (${
|
|
7
|
-
payload.issues = payload.issues.concat(${
|
|
1
|
+
function Zi(e){if(e?.failure?.scope!=="project")return"Preview build failed";if(e.failure.phase==="validation")return"Project validation failed";if(e.failure.phase==="discovery")return"Project scenario discovery failed";return"Project preview build failed"}function gm(e=[]){return e.map((t)=>{let r=t.file?t.file+(t.line?`:${t.line}`:"")+(t.column?`:${t.column}`:""):"";return(r?`${r}: `:"")+t.message}).join(`
|
|
2
|
+
`)}var{create:ab,defineProperty:Hi,getOwnPropertyDescriptor:ib,getOwnPropertyNames:cb,getPrototypeOf:ub}=Object,lb=Object.prototype.hasOwnProperty,Sm=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vm=(e,t)=>{let r={};for(var o in e)Hi(r,o,{get:e[o],enumerable:!0});if(t)Hi(r,Symbol.toStringTag,{value:"Module"});return r},db=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var s=cb(t),n=0,a=s.length,i;n<a;n++)if(i=s[n],!lb.call(e,i)&&i!==r)Hi(e,i,{get:((u)=>t[u]).bind(null,i),enumerable:!(o=ib(t,i))||o.enumerable})}return e},bm=(e,t,r)=>(r=e!=null?ab(ub(e)):{},db(t||!e||!e.__esModule?Hi(r,"default",{value:e,enumerable:!0}):r,e));var mb=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ym=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),pb=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),hb=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function wm(e){return typeof e==="string"&&ym.has(e.replace(/#$/,""))}function zm(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(mb.has(r))return"2020-12";if(ym.has(r))return"2019-09";if(pb.has(r)||hb.has(r))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 Rm,Eu=Object.freeze({status:"aborted"});function y(e,t,r){function o(i,u){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1});if(i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,u);let l=a.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){let h=d[f];if(!(h in i))i[h]=l[h].bind(i)}}let s=r?.Parent??Object;class n extends s{}Object.defineProperty(n,"name",{value:e});function a(i){var u;let l=r?.Parent?new n:this;o(l,i),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:(i)=>{if(r?.Parent&&i instanceof r.Parent)return!0;return i?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var fb=Symbol("zod_brand");class Ht extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Rm=globalThis).__zod_globalConfig??(Rm.__zod_globalConfig={});var Oo=globalThis.__zod_globalConfig;function Je(e){if(e)Object.assign(Oo,e);return Oo}function Vi(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,s])=>t.indexOf(+o)===-1).map(([o,s])=>s)}function Cu(e,t="|"){return e.map((r)=>Nu(r)).join(t)}function an(e,t){if(typeof t==="bigint")return t.toString();return t}function cn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Bi(e){return e===null||e===void 0}function Ji(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function km(e,t){let r=e/t,o=Math.round(r),s=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<s)return 0;return r-o}var xm=Symbol("evaluating");function oe(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===xm)return;if(o===void 0)o=xm,o=r();return o},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Zr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ir(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Iu(e){return JSON.stringify(e)}function Pm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function No(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Tm=cn(()=>{if(Oo.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Hr(e){if(No(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(No(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Ou(e){if(Hr(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 Em=new Set(["string","number","symbol"]);function cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pt(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}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 Nu(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function $m(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Cm={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 _b(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let n=ir(e._zod.def,{get shape(){let a={};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;a[i]=r.shape[i]}return Zr(this,"shape",a),a},checks:[]});return pt(e,n)}function gb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let n=ir(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);if(!t[i])continue;delete a[i]}return Zr(this,"shape",a),a},checks:[]});return pt(e,n)}function Sb(e,t){if(!Hr(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(n,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let s=ir(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Zr(this,"shape",n),n}});return pt(e,s)}function vb(e,t){if(!Hr(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ir(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Zr(this,"shape",o),o}});return pt(e,r)}function bb(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ir(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Zr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return pt(e,r)}function yb(e,t,r){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ir(t._zod.def,{get shape(){let i=t._zod.def.shape,u={...i};if(r)for(let l in r){if(!(l in i))throw Error(`Unrecognized key: "${l}"`);if(!r[l])continue;u[l]=e?new e({type:"optional",innerType:i[l]}):i[l]}else for(let l in i)u[l]=e?new e({type:"optional",innerType:i[l]}):i[l];return Zr(this,"shape",u),u},checks:[]});return pt(t,a)}function wb(e,t,r){let o=ir(t._zod.def,{get shape(){let s=t._zod.def.shape,n={...s};if(r)for(let a in r){if(!(a in n))throw Error(`Unrecognized key: "${a}"`);if(!r[a])continue;n[a]=new e({type:"nonoptional",innerType:s[a]})}else for(let a in s)n[a]=new e({type:"nonoptional",innerType:s[a]});return Zr(this,"shape",n),n}});return pt(t,o)}function Fr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Im(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ur(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Fi(e){return typeof e==="string"?e:e?.message}function ht(e,t,r){let o=e.message?e.message:Fi(e.inst?._zod.def?.error?.(e))??Fi(t?.error?.(e))??Fi(r.customError?.(e))??Fi(r.localeError?.(e))??"Invalid input",{inst:s,continue:n,input:a,...i}=e;if(i.path??(i.path=[]),i.message=o,t?.reportInput)i.input=a;return i}function Wi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function qm(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 r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Vr(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Om=(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,an,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ki=y("$ZodError",Om),ju=y("$ZodError",Om,{Parent:Error});function Mu(e,t=(r)=>r.message){let r={},o=[];for(let s of e.issues)if(s.path.length>0)r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s));else o.push(t(s));return{formErrors:o,fieldErrors:r}}function Au(e,t=(r)=>r.message){let r={_errors:[]},o=(s,n=[])=>{for(let a of s.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((i)=>o({issues:i},[...n,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...n,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...n,...a.path]);else{let i=[...n,...a.path];if(i.length===0)r._errors.push(t(a));else{let u=r,l=0;while(l<i.length){let d=i[l];if(l!==i.length-1)u[d]=u[d]||{_errors:[]};else u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(a));u=u[d],l++}}}};return o(e),r}var Gi=(e)=>(t,r,o,s)=>{let n=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new Ht;if(a.issues.length){let i=new(s?.Err??e)(a.issues.map((u)=>ht(u,n,Je())));throw qu(i,s?.callee),i}return a.value};var Yi=(e)=>async(t,r,o,s)=>{let n=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)a=await a;if(a.issues.length){let i=new(s?.Err??e)(a.issues.map((u)=>ht(u,n,Je())));throw qu(i,s?.callee),i}return a.value};var un=(e)=>(t,r,o)=>{let s=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)throw new Ht;return n.issues.length?{success:!1,error:new(e??Ki)(n.issues.map((a)=>ht(a,s,Je())))}:{success:!0,data:n.value}},Nm=un(ju),ln=(e)=>async(t,r,o)=>{let s=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},s);if(n instanceof Promise)n=await n;return n.issues.length?{success:!1,error:new e(n.issues.map((a)=>ht(a,s,Je())))}:{success:!0,data:n.value}},jm=ln(ju),Mm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Gi(e)(t,r,s)};var Am=(e)=>(t,r,o)=>Gi(e)(t,r,o);var Lm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return Yi(e)(t,r,s)};var Um=(e)=>async(t,r,o)=>Yi(e)(t,r,o);var Dm=(e)=>(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return un(e)(t,r,s)};var Zm=(e)=>(t,r,o)=>un(e)(t,r,o);var Hm=(e)=>async(t,r,o)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return ln(e)(t,r,s)};var Fm=(e)=>async(t,r,o)=>ln(e)(t,r,o);var Vm=/^[cC][0-9a-z]{6,}$/,Bm=/^[0-9a-z]+$/,Jm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wm=/^[0-9a-vA-V]{20}$/,Km=/^[A-Za-z0-9]{27}$/,Gm=/^[a-zA-Z0-9_-]{21}$/,Ym=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Xm=/^([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})$/,Lu=(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 Qm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Rb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ep(){return new RegExp(Rb,"u")}var tp=/^(?:(?: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])$/,rp=/^(([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 op=/^((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])$/,sp=/^(([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])$/,np=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Uu=/^[A-Za-z0-9_-]*$/;var ap=/^https?$/,ip=/^\+[1-9]\d{6,14}$/,cp="(?:(?:\\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])))",up=new RegExp(`^${cp}$`);function lp(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 dp(e){return new RegExp(`^${lp(e)}$`)}function mp(e){let t=lp({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${cp}T(?:${o})$`)}var pp=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var hp=/^-?\d+$/,Du=/^-?\d+(?:\.\d+)?$/,fp=/^(?:true|false)$/i,_p=/^null$/i;var gp=/^undefined$/i;var Sp=/^[^A-Z]*$/,vp=/^[^a-z]*$/;var Ce=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bp={number:"number",bigint:"bigint",object:"date"},Zu=y("$ZodCheckLessThan",(e,t)=>{Ce.init(e,t);let r=bp[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<n)if(t.inclusive)s.maximum=t.value;else s.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hu=y("$ZodCheckGreaterThan",(e,t)=>{Ce.init(e,t);let r=bp[typeof t.value];e._zod.onattach.push((o)=>{let s=o._zod.bag,n=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>n)if(t.inclusive)s.minimum=t.value;else s.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yp=y("$ZodCheckMultipleOf",(e,t)=>{Ce.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):km(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),wp=y("$ZodCheckNumberFormat",(e,t)=>{Ce.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[s,n]=Cm[t.format];e._zod.onattach.push((a)=>{let i=a._zod.bag;if(i.format=t.format,i.minimum=s,i.maximum=n,r)i.pattern=hp}),e._zod.check=(a)=>{let i=a.value;if(r){if(!Number.isInteger(i)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){if(i>0)a.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else a.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(i<s)a.issues.push({origin:"number",input:i,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort});if(i>n)a.issues.push({origin:"number",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}});var zp=y("$ZodCheckMaxLength",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<s)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let s=o.value;if(s.length<=t.maximum)return;let a=Wi(s);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Rp=y("$ZodCheckMinLength",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>s)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let s=o.value;if(s.length>=t.minimum)return;let a=Wi(s);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),xp=y("$ZodCheckLengthEquals",(e,t)=>{var r;Ce.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let s=o.value;return!Bi(s)&&s.length!==void 0}),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=(o)=>{let s=o.value,n=s.length;if(n===t.length)return;let a=Wi(s),i=n>t.length;o.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),mn=y("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Ce.init(e,t),e._zod.onattach.push((s)=>{let n=s._zod.bag;if(n.format=t.format,t.pattern)n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(s)=>{if(t.pattern.lastIndex=0,t.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),kp=y("$ZodCheckRegex",(e,t)=>{mn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sp),mn.init(e,t)}),Tp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vp),mn.init(e,t)}),Ep=y("$ZodCheckIncludes",(e,t)=>{Ce.init(e,t);let r=cr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((s)=>{let n=s._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(s)=>{if(s.value.includes(t.includes,t.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),$p=y("$ZodCheckStartsWith",(e,t)=>{Ce.init(e,t);let r=new RegExp(`^${cr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Cp=y("$ZodCheckEndsWith",(e,t)=>{Ce.init(e,t);let r=new RegExp(`.*${cr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Ip=y("$ZodCheckOverwrite",(e,t)=>{Ce.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Fu{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 r=e.split(`
|
|
3
|
+
`).filter((n)=>n),o=Math.min(...r.map((n)=>n.length-n.trimStart().length)),s=r.map((n)=>n.slice(o)).map((n)=>" ".repeat(this.indent*2)+n);for(let n of s)this.content.push(n)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((s)=>` ${s}`)];return new e(...t,o.join(`
|
|
4
|
+
`))}}var Op={major:4,minor:4,patch:3};var ie=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Op;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let s of o)for(let n of s._zod.onattach)n(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,i,u)=>{let l=Fr(a),d;for(let f of i){if(f._zod.def.when){if(Im(a))continue;if(!f._zod.def.when(a))continue}else if(l)continue;let h=a.issues.length,g=f._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new Ht;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await g,a.issues.length===h)return;if(!l)l=Fr(a,h)});else{if(a.issues.length===h)continue;if(!l)l=Fr(a,h)}}if(d)return d.then(()=>a);return a},n=(a,i,u)=>{if(Fr(a))return a.aborted=!0,a;let l=s(i,o,u);if(l instanceof Promise){if(u.async===!1)throw new Ht;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,i)=>{if(i.skipChecks)return e._zod.parse(a,i);if(i.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...i,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>n(d,a,i));return n(l,a,i)}let u=e._zod.parse(a,i);if(u instanceof Promise){if(i.async===!1)throw new Ht;return u.then((l)=>s(l,o,i))}return s(u,o,i)}}oe(e,"~standard",()=>({validate:(s)=>{try{let n=Nm(e,s);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return jm(e,s).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ec=y("$ZodString",(e,t)=>{ie.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??pp(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(s){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),me=y("$ZodStringFormat",(e,t)=>{mn.init(e,t),ec.init(e,t)}),Hp=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xm),me.init(e,t)}),Fp=y("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Lu(o))}else t.pattern??(t.pattern=Lu());me.init(e,t)}),Vp=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Qm),me.init(e,t)}),Bp=y("$ZodURL",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===ap.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let s=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(s.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=s.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Jp=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ep()),me.init(e,t)}),Wp=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Gm),me.init(e,t)}),Kp=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Vm),me.init(e,t)}),Gp=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Bm),me.init(e,t)}),Yp=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Jm),me.init(e,t)}),Xp=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wm),me.init(e,t)}),Qp=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Km),me.init(e,t)}),eh=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mp(t)),me.init(e,t)}),th=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=up),me.init(e,t)}),rh=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=dp(t)),me.init(e,t)}),oh=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ym),me.init(e,t)}),sh=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tp),me.init(e,t),e._zod.bag.format="ipv4"}),nh=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rp),me.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var ah=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=op),me.init(e,t)}),ih=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=sp),me.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[s,n]=o;if(!n)throw Error();let a=Number(n);if(`${a}`!==n)throw Error();if(a<0||a>128)throw Error();new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ch(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 uh=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=np),me.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(ch(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function xb(e){if(!Uu.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ch(r)}var lh=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Uu),me.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(xb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),dh=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ip),me.init(e,t)});function kb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let s=JSON.parse(atob(o));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}var mh=y("$ZodJWT",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{if(kb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Bu=y("$ZodNumber",(e,t)=>{ie.init(e,t),e._zod.pattern=e._zod.bag.pattern??Du,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}let s=r.value;if(typeof s==="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let n=typeof s==="number"?Number.isNaN(s)?"NaN":!Number.isFinite(s)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...n?{received:n}:{}}),r}}),ph=y("$ZodNumberFormat",(e,t)=>{wp.init(e,t),Bu.init(e,t)}),hh=y("$ZodBoolean",(e,t)=>{ie.init(e,t),e._zod.pattern=fp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(n){}let s=r.value;if(typeof s==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}});var fh=y("$ZodUndefined",(e,t)=>{ie.init(e,t),e._zod.pattern=gp,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let s=r.value;if(typeof s>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:s,inst:e}),r}}),_h=y("$ZodNull",(e,t)=>{ie.init(e,t),e._zod.pattern=_p,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let s=r.value;if(s===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),r}}),gh=y("$ZodAny",(e,t)=>{ie.init(e,t),e._zod.parse=(r)=>r}),Sh=y("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=(r)=>r}),vh=y("$ZodNever",(e,t)=>{ie.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Np(e,t,r){if(e.issues.length)t.issues.push(...ur(r,e.issues));t.value[r]=e.value}var bh=y("$ZodArray",(e,t)=>{ie.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let n=[];for(let a=0;a<s.length;a++){let i=s[a],u=t.element._zod.run({value:i,issues:[]},o);if(u instanceof Promise)n.push(u.then((l)=>Np(l,r,a)));else Np(u,r,a)}if(n.length)return Promise.all(n).then(()=>r);return r}});function Qi(e,t,r,o,s,n){let a=r in o;if(e.issues.length){if(s&&n&&!a)return;t.issues.push(...ur(r,e.issues))}if(!a&&!s){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(a)t.value[r]=void 0}else t.value[r]=e.value}function yh(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=$m(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function wh(e,t,r,o,s,n){let a=[],i=s.keySet,u=s.catchall._zod,l=u.def.type,d=u.optin==="optional",f=u.optout==="optional";for(let h in t){if(h==="__proto__")continue;if(i.has(h))continue;if(l==="never"){a.push(h);continue}let g=u.run({value:t[h],issues:[]},o);if(g instanceof Promise)e.push(g.then((b)=>Qi(b,r,h,t,d,f)));else Qi(g,r,h,t,d,f)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:n});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Pb=y("$ZodObject",(e,t)=>{if(ie.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let i=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=cn(()=>yh(t));oe(e._zod,"propValues",()=>{let i=t.shape,u={};for(let l in i){let d=i[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(let f of d.values)u[l].add(f)}}return u});let s=No,n=t.catchall,a;e._zod.parse=(i,u)=>{a??(a=o.value);let l=i.value;if(!s(l))return i.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),i;i.value={};let d=[],f=a.shape;for(let h of a.keys){let g=f[h],b=g._zod.optin==="optional",_=g._zod.optout==="optional",w=g._zod.run({value:l[h],issues:[]},u);if(w instanceof Promise)d.push(w.then((I)=>Qi(I,i,h,l,b,_)));else Qi(w,i,h,l,b,_)}if(!n)return d.length?Promise.all(d).then(()=>i):i;return wh(d,l,i,u,o.value,e)}}),zh=y("$ZodObjectJIT",(e,t)=>{Pb.init(e,t);let r=e._zod.parse,o=cn(()=>yh(t)),s=(h)=>{let g=new Fu(["shape","payload","ctx"]),b=o.value,_=(z)=>{let q=Iu(z);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};g.write("const input = payload.value;");let w=Object.create(null),I=0;for(let z of b.keys)w[z]=`key_${I++}`;g.write("const newResult = {};");for(let z of b.keys){let q=w[z],x=Iu(z),R=h[z],Z=R?._zod?.optin==="optional",ee=R?._zod?.optout==="optional";if(g.write(`const ${q} = ${_(z)};`),Z&&ee)g.write(`
|
|
5
|
+
if (${q}.issues.length) {
|
|
6
|
+
if (${x} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
8
8
|
...iss,
|
|
9
|
-
path: iss.path ? [${
|
|
9
|
+
path: iss.path ? [${x}, ...iss.path] : [${x}]
|
|
10
10
|
})));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
if (${
|
|
15
|
-
if (${
|
|
16
|
-
newResult[${
|
|
14
|
+
if (${q}.value === undefined) {
|
|
15
|
+
if (${x} in input) {
|
|
16
|
+
newResult[${x}] = undefined;
|
|
17
17
|
}
|
|
18
18
|
} else {
|
|
19
|
-
newResult[${
|
|
19
|
+
newResult[${x}] = ${q}.value;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
`);else if(!
|
|
23
|
-
const ${
|
|
24
|
-
if (${
|
|
25
|
-
payload.issues = payload.issues.concat(${
|
|
22
|
+
`);else if(!Z)g.write(`
|
|
23
|
+
const ${q}_present = ${x} in input;
|
|
24
|
+
if (${q}.issues.length) {
|
|
25
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
26
26
|
...iss,
|
|
27
|
-
path: iss.path ? [${
|
|
27
|
+
path: iss.path ? [${x}, ...iss.path] : [${x}]
|
|
28
28
|
})));
|
|
29
29
|
}
|
|
30
|
-
if (!${
|
|
30
|
+
if (!${q}_present && !${q}.issues.length) {
|
|
31
31
|
payload.issues.push({
|
|
32
32
|
code: "invalid_type",
|
|
33
33
|
expected: "nonoptional",
|
|
34
34
|
input: undefined,
|
|
35
|
-
path: [${
|
|
35
|
+
path: [${x}]
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
if (${
|
|
40
|
-
if (${
|
|
41
|
-
newResult[${
|
|
39
|
+
if (${q}_present) {
|
|
40
|
+
if (${q}.value === undefined) {
|
|
41
|
+
newResult[${x}] = undefined;
|
|
42
42
|
} else {
|
|
43
|
-
newResult[${
|
|
43
|
+
newResult[${x}] = ${q}.value;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
`);else g.write(`
|
|
48
|
-
if (${
|
|
49
|
-
payload.issues = payload.issues.concat(${
|
|
48
|
+
if (${q}.issues.length) {
|
|
49
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
50
50
|
...iss,
|
|
51
|
-
path: iss.path ? [${
|
|
51
|
+
path: iss.path ? [${x}, ...iss.path] : [${x}]
|
|
52
52
|
})));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
if (${
|
|
56
|
-
if (${
|
|
57
|
-
newResult[${
|
|
55
|
+
if (${q}.value === undefined) {
|
|
56
|
+
if (${x} in input) {
|
|
57
|
+
newResult[${x}] = undefined;
|
|
58
58
|
}
|
|
59
59
|
} else {
|
|
60
|
-
newResult[${
|
|
60
|
+
newResult[${x}] = ${q}.value;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
`)}g.write("payload.value = newResult;"),g.write("return payload;");let H=g.compile();return(x,Z)=>H(f,x,Z)},s,i=yo,a=!bo.jitless,u=a&&qd.value,d=t.catchall,m;e._zod.parse=(f,g)=>{m??(m=o.value);let b=f.value;if(!i(b))return f.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),f;if(a&&u&&g?.async===!1&&g.jitless!==!0){if(!s)s=n(t.shape);if(f=s(f,g),!d)return f;return Ch([],b,f,g,m,e)}return r(f,g)}});function Vp(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!Ir(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>ct(i,o,Ue())))}),t}var _l=_("$ZodUnion",(e,t)=>{oe.init(e,t),ee(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),ee(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),ee(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),ee(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>ka(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)i.push(l),s=!0;else{if(l.issues.length===0)return l;i.push(l)}}if(!s)return Vp(i,o,e,n);return Promise.all(i).then((a)=>Vp(a,o,e,n))}});var Oh=_("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_l.init(e,t);let r=e._zod.parse;ee(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,l]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let u of l)n[a].add(u)}}return n});let o=Jn(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let l of a){if(s.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!yo(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback||s.direction==="backward")return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n}}),Nh=_("$ZodIntersection",(e,t)=>{oe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([l,u])=>Jp(r,l,u));return Jp(r,s,i)}});function gl(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(Cr(e)&&Cr(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=gl(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=gl(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Jp(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let l of a.keys){if(!o.has(l))o.set(l,{});o.get(l).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let l of a.keys){if(!o.has(l))o.set(l,{});o.get(l).r=!0}else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n)e.issues.push({...n,keys:s});if(Ir(e))return e;let i=gl(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Ah=_("$ZodRecord",(e,t)=>{oe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Cr(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>ct(g,o,Ue())),input:u,path:[u],inst:e});continue}let m=d.value,f=t.valueType._zod.run({value:n[u],issues:[]},o);if(f instanceof Promise)s.push(f.then((g)=>{if(g.issues.length)r.issues.push(...or(u,g.issues));r.value[m]=g.value}));else{if(f.issues.length)r.issues.push(...or(u,f.issues));r.value[m]=f.value}}let l;for(let u in n)if(!a.has(u))l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&pl.test(a)&&l.issues.length){let m=t.keyType._zod.run({value:Number(a),issues:[]},o);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")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((m)=>ct(m,o,Ue())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:n[a],issues:[]},o);if(d instanceof Promise)s.push(d.then((m)=>{if(m.issues.length)r.issues.push(...or(a,m.issues));r.value[l.value]=m.value}));else{if(d.issues.length)r.issues.push(...or(a,d.issues));r.value[l.value]=d.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var Mh=_("$ZodEnum",(e,t)=>{oe.init(e,t);let r=Ta(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>jd.has(typeof n)).map((n)=>typeof n==="string"?rr(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),qh=_("$ZodLiteral",(e,t)=>{if(oe.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?rr(o):o?rr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var jh=_("$ZodTransform",(e,t)=>{oe.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Hn(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new qt;return r.value=n,r.fallback=!0,r}});function Bp(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var bl=_("$ZodOptional",(e,t)=>{oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ka(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>Bp(i,n));return Bp(s,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Lh=_("$ZodExactOptional",(e,t)=>{bl.init(e,t),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Uh=_("$ZodNullable",(e,t)=>{oe.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${ka(r.source)}|null)$`):void 0}),ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Zh=_("$ZodDefault",(e,t)=>{oe.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Wp(s,t));return Wp(n,t)}});function Wp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Dh=_("$ZodPrefault",(e,t)=>{oe.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Fh=_("$ZodNonOptional",(e,t)=>{oe.init(e,t),ee(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Kp(s,e));return Kp(n,e)}});function Kp(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 Hh=_("$ZodCatch",(e,t)=>{oe.init(e,t),e._zod.optin="optional",ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>ct(i,o,Ue()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>ct(s,o,Ue()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var yl=_("$ZodPipe",(e,t)=>{oe.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>Na(i,t.in,o));return Na(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Na(s,t.out,o));return Na(n,t.out,o)}});function Na(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Vh=_("$ZodPreprocess",(e,t)=>{yl.init(e,t)}),Jh=_("$ZodReadonly",(e,t)=>{oe.init(e,t),ee(e._zod,"propValues",()=>t.innerType._zod.propValues),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"optin",()=>t.innerType?._zod?.optin),ee(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Gp);return Gp(n)}});function Gp(e){return e.value=Object.freeze(e.value),e}var Bh=_("$ZodLazy",(e,t)=>{oe.init(e,t),ee(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),ee(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ee(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ee(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ee(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Wh=_("$ZodCustom",(e,t)=>{Re.init(e,t),oe.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Yp(s,r,o,e));Yp(n,r,o,e);return}});function Yp(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Or(n))}}var Z_=()=>{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 r={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"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Dd(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${il(n.values[0])}`;return`Invalid option: expected one of ${rl(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);if(i)return`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);if(i)return`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`;return`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.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":""}: ${rl(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((i)=>`'${i}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function vl(){return{localeError:Z_()}}var Kh,D_=Symbol("ZodOutput"),F_=Symbol("ZodInput");class Gh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.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 r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Yh(){return new Gh}(Kh=globalThis).__zod_globalRegistry??(Kh.__zod_globalRegistry=Yh());var nr=globalThis.__zod_globalRegistry;function Xh(e,t){return new e({type:"string",...j(t)})}function zl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...j(t)})}function wl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...j(t)})}function Qh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...j(t)})}function em(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(t)})}function tm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(t)})}function rm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(t)})}function Rl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...j(t)})}function om(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...j(t)})}function nm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(t)})}function sm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...j(t)})}function im(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(t)})}function am(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...j(t)})}function cm(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...j(t)})}function lm(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(t)})}function um(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(t)})}function dm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(t)})}function pm(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(t)})}function hm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(t)})}function mm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...j(t)})}function fm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...j(t)})}function gm(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...j(t)})}function Sm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...j(t)})}function _m(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(t)})}function bm(e,t){return new e({type:"string",format:"date",check:"string_format",...j(t)})}function ym(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...j(t)})}function vm(e,t){return new e({type:"string",format:"duration",check:"string_format",...j(t)})}function zm(e,t){return new e({type:"number",checks:[],...j(t)})}function wm(e,t){return new e({type:"number",coerce:!0,checks:[],...j(t)})}function Rm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...j(t)})}function xm(e,t){return new e({type:"boolean",...j(t)})}function Pm(e,t){return new e({type:"undefined",...j(t)})}function Tm(e,t){return new e({type:"null",...j(t)})}function Em(e){return new e({type:"any"})}function km(e){return new e({type:"unknown"})}function $m(e,t){return new e({type:"never",...j(t)})}function qa(e,t){return new hl({check:"less_than",...j(t),value:e,inclusive:!1})}function Yn(e,t){return new hl({check:"less_than",...j(t),value:e,inclusive:!0})}function ja(e,t){return new ml({check:"greater_than",...j(t),value:e,inclusive:!1})}function Xn(e,t){return new ml({check:"greater_than",...j(t),value:e,inclusive:!0})}function La(e,t){return new $p({check:"multiple_of",...j(t),value:e})}function Ua(e,t){return new Ip({check:"max_length",...j(t),maximum:e})}function vo(e,t){return new Op({check:"min_length",...j(t),minimum:e})}function Za(e,t){return new Np({check:"length_equals",...j(t),length:e})}function xl(e,t){return new Ap({check:"string_format",format:"regex",...j(t),pattern:e})}function Pl(e){return new Mp({check:"string_format",format:"lowercase",...j(e)})}function Tl(e){return new qp({check:"string_format",format:"uppercase",...j(e)})}function El(e,t){return new jp({check:"string_format",format:"includes",...j(t),includes:e})}function kl(e,t){return new Lp({check:"string_format",format:"starts_with",...j(t),prefix:e})}function $l(e,t){return new Up({check:"string_format",format:"ends_with",...j(t),suffix:e})}function sr(e){return new Zp({check:"overwrite",tx:e})}function Cl(e){return sr((t)=>t.normalize(e))}function Il(){return sr((e)=>e.trim())}function Ol(){return sr((e)=>e.toLowerCase())}function Nl(){return sr((e)=>e.toUpperCase())}function Al(){return sr((e)=>Md(e))}function Cm(e,t,r){return new e({type:"array",element:t,...j(r)})}function Im(e,t,r){return new e({type:"custom",check:"custom",fn:t,...j(r)})}function Om(e,t){let r=H_((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(Or(n,o.value,r._zod.def));else{let s=n;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Or(s))}},e(o.value,o)),t);return r}function H_(e,t){let r=new Re({check:"custom",...j(t)});return r._zod.check=e,r}function es(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??nr,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 se(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{let f=i.schema,g=t.processors[n.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);g(e,t,f,d)}let m=e._zod.parent;if(m){if(!i.ref)i.ref=m;se(m,t,d),t.seen.get(m).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Object.assign(i.schema,l);if(t.io==="input"&&Me(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function ts(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let l=o.get(a);if(l&&l!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let m=e.external.registry.get(i[0])?.id,f=e.external.uri??((b)=>b);if(m)return{ref:f(m)};let g=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=g,{defId:g,ref:`${f("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:l,defId:u}=n(i);if(a.def={...a.schema},u)a.defId=u;let d=a.schema;for(let m in d)delete d[m];d.$ref=l};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
63
|
+
`)}g.write("payload.value = newResult;"),g.write("return payload;");let A=g.compile();return(z,q)=>A(h,z,q)},n,a=No,i=!Oo.jitless,l=i&&Tm.value,d=t.catchall,f;e._zod.parse=(h,g)=>{f??(f=o.value);let b=h.value;if(!a(b))return h.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),h;if(i&&l&&g?.async===!1&&g.jitless!==!0){if(!n)n=s(t.shape);if(h=n(h,g),!d)return h;return wh([],b,h,g,f,e)}return r(h,g)}});function jp(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let s=e.filter((n)=>!Fr(n));if(s.length===1)return t.value=s[0].value,s[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((a)=>ht(a,o,Je())))}),t}var Ju=y("$ZodUnion",(e,t)=>{ie.init(e,t),oe(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),oe(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),oe(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),oe(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Ji(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,s)=>{if(r)return r(o,s);let n=!1,a=[];for(let i of t.options){let u=i._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),n=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!n)return jp(a,o,e,s);return Promise.all(a).then((i)=>jp(i,o,e,s))}});var Rh=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ju.init(e,t);let r=e._zod.parse;oe(e._zod,"propValues",()=>{let s={};for(let n of t.options){let a=n._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[i,u]of Object.entries(a)){if(!s[i])s[i]=new Set;for(let l of u)s[i].add(l)}}return s});let o=cn(()=>{let s=t.options,n=new Map;for(let a of s){let i=a._zod.propValues?.[t.discriminator];if(!i||i.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let u of i){if(n.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);n.set(u,a)}}return n});e._zod.parse=(s,n)=>{let a=s.value;if(!No(a))return s.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),s;let i=o.value.get(a?.[t.discriminator]);if(i)return i._zod.run(s,n);if(t.unionFallback||n.direction==="backward")return r(s,n);return s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:a,path:[t.discriminator],inst:e}),s}}),xh=y("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(r,o)=>{let s=r.value,n=t.left._zod.run({value:s,issues:[]},o),a=t.right._zod.run({value:s,issues:[]},o);if(n instanceof Promise||a instanceof Promise)return Promise.all([n,a]).then(([u,l])=>Mp(r,u,l));return Mp(r,n,a)}});function Vu(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(Hr(e)&&Hr(t)){let r=Object.keys(t),o=Object.keys(e).filter((n)=>r.indexOf(n)!==-1),s={...e,...t};for(let n of o){let a=Vu(e[n],t[n]);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};s[n]=a.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let s=e[o],n=t[o],a=Vu(s,n);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mp(e,t,r){let o=new Map,s;for(let i of t.issues)if(i.code==="unrecognized_keys"){s??(s=i);for(let u of i.keys){if(!o.has(u))o.set(u,{});o.get(u).l=!0}}else e.issues.push(i);for(let i of r.issues)if(i.code==="unrecognized_keys")for(let u of i.keys){if(!o.has(u))o.set(u,{});o.get(u).r=!0}else e.issues.push(i);let n=[...o].filter(([,i])=>i.l&&i.r).map(([i])=>i);if(n.length&&s)e.issues.push({...s,keys:n});if(Fr(e))return e;let a=Vu(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var kh=y("$ZodRecord",(e,t)=>{ie.init(e,t),e._zod.parse=(r,o)=>{let s=r.value;if(!Hr(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let n=[],a=t.keyType._zod.values;if(a){r.value={};let i=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){i.add(typeof l==="number"?l.toString():l);let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((g)=>ht(g,o,Je())),input:l,path:[l],inst:e});continue}let f=d.value,h=t.valueType._zod.run({value:s[l],issues:[]},o);if(h instanceof Promise)n.push(h.then((g)=>{if(g.issues.length)r.issues.push(...ur(l,g.issues));r.value[f]=g.value}));else{if(h.issues.length)r.issues.push(...ur(l,h.issues));r.value[f]=h.value}}let u;for(let l in s)if(!i.has(l))u=u??[],u.push(l);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{r.value={};for(let i of Reflect.ownKeys(s)){if(i==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,i))continue;let u=t.keyType._zod.run({value:i,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof i==="string"&&Du.test(i)&&u.issues.length){let f=t.keyType._zod.run({value:Number(i),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)u=f}if(u.issues.length){if(t.mode==="loose")r.value[i]=s[i];else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((f)=>ht(f,o,Je())),input:i,path:[i],inst:e});continue}let d=t.valueType._zod.run({value:s[i],issues:[]},o);if(d instanceof Promise)n.push(d.then((f)=>{if(f.issues.length)r.issues.push(...ur(i,f.issues));r.value[u.value]=f.value}));else{if(d.issues.length)r.issues.push(...ur(i,d.issues));r.value[u.value]=d.value}}}if(n.length)return Promise.all(n).then(()=>r);return r}});var Ph=y("$ZodEnum",(e,t)=>{ie.init(e,t);let r=Vi(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((s)=>Em.has(typeof s)).map((s)=>typeof s==="string"?cr(s):s.toString()).join("|")})$`),e._zod.parse=(s,n)=>{let a=s.value;if(o.has(a))return s;return s.issues.push({code:"invalid_value",values:r,input:a,inst:e}),s}}),Th=y("$ZodLiteral",(e,t)=>{if(ie.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?cr(o):o?cr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,s)=>{let n=o.value;if(r.has(n))return o;return o.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),o}});var Eh=y("$ZodTransform",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new nn(e.constructor.name);let s=t.transform(r.value,r);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then((a)=>(r.value=a,r.fallback=!0,r));if(s instanceof Promise)throw new Ht;return r.value=s,r.fallback=!0,r}});function Ap(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Wu=y("$ZodOptional",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ji(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let s=r.value,n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((a)=>Ap(a,s));return Ap(n,s)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),$h=y("$ZodExactOptional",(e,t)=>{Wu.init(e,t),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Ch=y("$ZodNullable",(e,t)=>{ie.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ji(r.source)}|null)$`):void 0}),oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Ih=y("$ZodDefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Lp(n,t));return Lp(s,t)}});function Lp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var qh=y("$ZodPrefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Oh=y("$ZodNonOptional",(e,t)=>{ie.init(e,t),oe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Up(n,e));return Up(s,e)}});function Up(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 Nh=y("$ZodCatch",(e,t)=>{ie.init(e,t),e._zod.optin="optional",oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>{if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((a)=>ht(a,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((n)=>ht(n,o,Je()))},input:r.value}),r.issues=[],r.fallback=!0;return r}});var Ku=y("$ZodPipe",(e,t)=>{ie.init(e,t),oe(e._zod,"values",()=>t.in._zod.values),oe(e._zod,"optin",()=>t.in._zod.optin),oe(e._zod,"optout",()=>t.out._zod.optout),oe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let n=t.out._zod.run(r,o);if(n instanceof Promise)return n.then((a)=>Xi(a,t.in,o));return Xi(n,t.in,o)}let s=t.in._zod.run(r,o);if(s instanceof Promise)return s.then((n)=>Xi(n,t.out,o));return Xi(s,t.out,o)}});function Xi(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var jh=y("$ZodPreprocess",(e,t)=>{Ku.init(e,t)}),Mh=y("$ZodReadonly",(e,t)=>{ie.init(e,t),oe(e._zod,"propValues",()=>t.innerType._zod.propValues),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"optin",()=>t.innerType?._zod?.optin),oe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let s=t.innerType._zod.run(r,o);if(s instanceof Promise)return s.then(Dp);return Dp(s)}});function Dp(e){return e.value=Object.freeze(e.value),e}var Ah=y("$ZodLazy",(e,t)=>{ie.init(e,t),oe(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),oe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),oe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),oe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),oe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Lh=y("$ZodCustom",(e,t)=>{Ce.init(e,t),ie.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,s=t.fn(o);if(s instanceof Promise)return s.then((n)=>Zp(n,r,o,e));Zp(s,r,o,e);return}});function Zp(e,t,r,o){if(!e){let s={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)s.params=o._zod.def.params;t.issues.push(Vr(s))}}var Tb=()=>{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(s){return e[s]??null}let r={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"},o={nan:"NaN"};return(s)=>{switch(s.code){case"invalid_type":{let n=o[s.expected]??s.expected,a=qm(s.input),i=o[a]??a;return`Invalid input: expected ${n}, received ${i}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Nu(s.values[0])}`;return`Invalid option: expected one of ${Cu(s.values,"|")}`;case"too_big":{let n=s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${n}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${n}${s.maximum.toString()}`}case"too_small":{let n=s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${n}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${n}${s.minimum.toString()}`}case"invalid_format":{let n=s;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Cu(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Gu(){return{localeError:Tb()}}var Uh,Eb=Symbol("ZodOutput"),$b=Symbol("ZodInput");class Dh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.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 r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zh(){return new Dh}(Uh=globalThis).__zod_globalRegistry??(Uh.__zod_globalRegistry=Zh());var lr=globalThis.__zod_globalRegistry;function Hh(e,t){return new e({type:"string",...H(t)})}function Yu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...H(t)})}function Xu(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...H(t)})}function Fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...H(t)})}function Vh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(t)})}function Bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(t)})}function Jh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(t)})}function Qu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...H(t)})}function Wh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...H(t)})}function Kh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(t)})}function Gh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...H(t)})}function Yh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(t)})}function Xh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...H(t)})}function Qh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...H(t)})}function ef(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(t)})}function tf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(t)})}function rf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(t)})}function of(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(t)})}function sf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(t)})}function nf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...H(t)})}function af(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...H(t)})}function cf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...H(t)})}function uf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...H(t)})}function lf(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(t)})}function df(e,t){return new e({type:"string",format:"date",check:"string_format",...H(t)})}function mf(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...H(t)})}function pf(e,t){return new e({type:"string",format:"duration",check:"string_format",...H(t)})}function hf(e,t){return new e({type:"number",checks:[],...H(t)})}function ff(e,t){return new e({type:"number",coerce:!0,checks:[],...H(t)})}function _f(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...H(t)})}function gf(e,t){return new e({type:"boolean",...H(t)})}function Sf(e,t){return new e({type:"undefined",...H(t)})}function vf(e,t){return new e({type:"null",...H(t)})}function bf(e){return new e({type:"any"})}function yf(e){return new e({type:"unknown"})}function wf(e,t){return new e({type:"never",...H(t)})}function tc(e,t){return new Zu({check:"less_than",...H(t),value:e,inclusive:!1})}function pn(e,t){return new Zu({check:"less_than",...H(t),value:e,inclusive:!0})}function rc(e,t){return new Hu({check:"greater_than",...H(t),value:e,inclusive:!1})}function hn(e,t){return new Hu({check:"greater_than",...H(t),value:e,inclusive:!0})}function oc(e,t){return new yp({check:"multiple_of",...H(t),value:e})}function sc(e,t){return new zp({check:"max_length",...H(t),maximum:e})}function jo(e,t){return new Rp({check:"min_length",...H(t),minimum:e})}function nc(e,t){return new xp({check:"length_equals",...H(t),length:e})}function el(e,t){return new kp({check:"string_format",format:"regex",...H(t),pattern:e})}function tl(e){return new Pp({check:"string_format",format:"lowercase",...H(e)})}function rl(e){return new Tp({check:"string_format",format:"uppercase",...H(e)})}function ol(e,t){return new Ep({check:"string_format",format:"includes",...H(t),includes:e})}function sl(e,t){return new $p({check:"string_format",format:"starts_with",...H(t),prefix:e})}function nl(e,t){return new Cp({check:"string_format",format:"ends_with",...H(t),suffix:e})}function dr(e){return new Ip({check:"overwrite",tx:e})}function al(e){return dr((t)=>t.normalize(e))}function il(){return dr((e)=>e.trim())}function cl(){return dr((e)=>e.toLowerCase())}function ul(){return dr((e)=>e.toUpperCase())}function ll(){return dr((e)=>Pm(e))}function zf(e,t,r){return new e({type:"array",element:t,...H(r)})}function Rf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...H(r)})}function xf(e,t){let r=Cb((o)=>(o.addIssue=(s)=>{if(typeof s==="string")o.issues.push(Vr(s,o.value,r._zod.def));else{let n=s;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=o.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),o.issues.push(Vr(n))}},e(o.value,o)),t);return r}function Cb(e,t){let r=new Ce({check:"custom",...H(t)});return r._zod.check=e,r}function _n(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??lr,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 ce(e,t,r={path:[],schemaPath:[]}){var o;let s=e._zod.def,n=t.seen.get(e);if(n){if(n.count++,r.schemaPath.includes(e))n.cycle=r.path;return n.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let i=e._zod.toJSONSchema?.();if(i)a.schema=i;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let h=a.schema,g=t.processors[s.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);g(e,t,h,d)}let f=e._zod.parent;if(f){if(!a.ref)a.ref=f;ce(f,t,d),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)Object.assign(a.schema,u);if(t.io==="input"&&He(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(o=a.schema).default??(o.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function gn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let a of e.seen.entries()){let i=e.metadataRegistry.get(a[0])?.id;if(i){let u=o.get(i);if(u&&u!==a[0])throw Error(`Duplicate schema id "${i}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(i,a[0])}}let s=(a)=>{let i=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(a[0])?.id,h=e.external.uri??((b)=>b);if(f)return{ref:h(f)};let g=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=g,{defId:g,ref:`${h("__shared")}#/${i}/${g}`}}if(a[1]===r)return{ref:"#"};let l=`${"#"}/${i}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+d}},n=(a)=>{if(a[1].schema.$ref)return;let i=a[1],{ref:u,defId:l}=s(a);if(i.def={...i.schema},l)i.defId=l;let d=i.schema;for(let f in d)delete d[f];d.$ref=u};if(e.cycles==="throw")for(let a of e.seen.entries()){let i=a[1];if(i.cycle)throw Error(`Cycle detected: #/${i.cycle?.join("/")}/<root>
|
|
64
64
|
|
|
65
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function rs(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,d={...u},m=l.ref;if(l.ref=null,m){o(m);let g=e.seen.get(m),b=g.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(b);else Object.assign(u,b);if(Object.assign(u,d),a._zod.parent===m)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in d))delete u[v]}if(b.$ref&&g.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in g.def&&JSON.stringify(u[v])===JSON.stringify(g.def[v]))delete u[v]}}let f=a._zod.parent;if(f&&f!==m){o(f);let g=e.seen.get(f);if(g?.schema.$ref){if(u.$ref=g.schema.$ref,g.def)for(let b in u){if(b==="$ref"||b==="allOf")continue;if(b in g.def&&JSON.stringify(u[b])===JSON.stringify(g.def[b]))delete u[b]}}}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[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 a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&n.id===s)delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;i[l.defId]=l.def}}if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")n.$defs=i;else n.definitions=i;try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qn(t,"input",e.processors),output:Qn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Me(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Me(o.element,r);if(o.type==="set")return Me(o.valueType,r);if(o.type==="lazy")return Me(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Me(o.innerType,r);if(o.type==="intersection")return Me(o.left,r)||Me(o.right,r);if(o.type==="record"||o.type==="map")return Me(o.keyType,r)||Me(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Me(o.in,r)||Me(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(Me(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Me(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Me(n,r))return!0;if(o.rest&&Me(o.rest,r))return!0;return!1}return!1}var Nm=(e,t={})=>(r)=>{let o=es({...r,processors:t});return se(e,o),ts(o,e),rs(o,e)},Qn=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=es({...n??{},target:s,io:t,processors:r});return se(e,i),ts(i,e),rs(i,e)};var V_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ml=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=V_[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let d=[...l];if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},ql=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";let m=typeof d==="number"&&d>=(s??Number.NEGATIVE_INFINITY),f=typeof u==="number"&&u<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(m)if(g)n.minimum=d,n.exclusiveMinimum=!0;else n.exclusiveMinimum=d;else if(typeof s==="number")n.minimum=s;if(f)if(g)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof i==="number")n.maximum=i;if(typeof l==="number")n.multipleOf=l},jl=(e,t,r,o)=>{r.type="boolean"},Mm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},qm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Ll=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Ul=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},jm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Zl=(e,t,r,o)=>{r.not={}},Dl=(e,t,r,o)=>{},Fl=(e,t,r,o)=>{},Lm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Hl=(e,t,r,o)=>{let n=e._zod.def,s=Ta(n.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},Vl=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}},Um=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Zm=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},Dm=(e,t,r,o)=>{let n=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:l}=e._zod.bag;if(i!==void 0)s.minLength=i;if(a!==void 0)s.maxLength=a;if(l)if(l.length===1)s.contentMediaType=l[0],Object.assign(n,s);else Object.assign(n,s),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,s)},Fm=(e,t,r,o)=>{r.type="boolean"},Jl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Hm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Bl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Vm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Jm=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Wl=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=se(s.element,t,{...o,path:[...o.path,"items"]})},Kl=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=se(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),l=new Set([...a].filter((u)=>{let d=s.shape[u]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=se(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Gl=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,l)=>se(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",l]}));if(s)r.oneOf=i;else r.anyOf=i},Yl=(e,t,r,o)=>{let n=e._zod.def,s=se(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=se(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=l},Bm=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((f,g)=>se(f,t,{...o,path:[...o.path,i,g]})),u=s.rest?se(s.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[s.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:d,maximum:m}=e._zod.bag;if(typeof d==="number")n.minItems=d;if(typeof m==="number")n.maxItems=m},Xl=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){let d=se(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let m of l)n.patternProperties[m.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=se(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=se(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=i._zod.values;if(u){let d=[...u].filter((m)=>typeof m==="string"||typeof m==="number");if(d.length>0)n.required=d}},Ql=(e,t,r,o)=>{let n=e._zod.def,s=se(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},eu=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},tu=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},ru=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},ou=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},nu=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;se(i,t,o);let a=t.seen.get(e);a.ref=i},su=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Wm=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Da=(e,t,r,o)=>{let n=e._zod.def;se(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},iu=(e,t,r,o)=>{let n=e._zod.innerType;se(n,t,o);let s=t.seen.get(e);s.ref=n},Am={string:Ml,number:ql,boolean:jl,bigint:Mm,symbol:qm,null:Ll,undefined:Ul,void:jm,never:Zl,any:Dl,unknown:Fl,date:Lm,enum:Hl,literal:Vl,nan:Um,template_literal:Zm,file:Dm,success:Fm,custom:Jl,function:Hm,transform:Bl,map:Vm,set:Jm,array:Wl,object:Kl,union:Gl,intersection:Yl,tuple:Bm,record:Xl,nullable:Ql,nonoptional:eu,default:tu,prefault:ru,catch:ou,pipe:nu,readonly:su,promise:Wm,optional:Da,lazy:iu};function Fa(e,t){if("_idmap"in e){let o=e,n=es({...t,processors:Am}),s={};for(let l of o._idmap.entries()){let[u,d]=l;se(d,n)}let i={},a={registry:o,uri:t?.uri,defs:s};n.external=a;for(let l of o._idmap.entries()){let[u,d]=l;ts(n,d),i[u]=rs(n,d)}if(Object.keys(s).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[l]:s}}return{schemas:i}}let r=es({...t,processors:Am});return se(e,r),ts(r,e),rs(r,e)}var Q_=_("ZodISODateTime",(e,t)=>{lh.init(e,t),le.init(e,t)});function wo(e){return _m(Q_,e)}var eb=_("ZodISODate",(e,t)=>{uh.init(e,t),le.init(e,t)});function au(e){return bm(eb,e)}var tb=_("ZodISOTime",(e,t)=>{dh.init(e,t),le.init(e,t)});function Km(e){return ym(tb,e)}var rb=_("ZodISODuration",(e,t)=>{ph.init(e,t),le.init(e,t)});function Gm(e){return vm(rb,e)}var ob=(e,t)=>{Ca.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>ll(e,r)},flatten:{value:(r)=>cl(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Vn,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Vn,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Ke=_("ZodError",ob,{Parent:Error});var Xm=Ia(Ke),Qm=Oa(Ke),Va=Bn(Ke),ef=Wn(Ke),tf=Jd(Ke),rf=Bd(Ke),of=Wd(Ke),nf=Kd(Ke),sf=Gd(Ke),af=Yd(Ke),cf=Xd(Ke),lf=Qd(Ke);var uf=new WeakMap;function os(e,t,r){let o=Object.getPrototypeOf(e),n=uf.get(o);if(!n)n=new Set,uf.set(o,n);if(n.has(t))return;n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}var ie=_("ZodType",(e,t)=>(oe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Qn(e,"input"),output:Qn(e,"output")}}),e.toJSONSchema=Nm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Xm(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Va(e,r,o),e.parseAsync=async(r,o)=>Qm(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>ef(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>tf(e,r,o),e.decode=(r,o)=>rf(e,r,o),e.encodeAsync=async(r,o)=>of(e,r,o),e.decodeAsync=async(r,o)=>nf(e,r,o),e.safeEncode=(r,o)=>sf(e,r,o),e.safeDecode=(r,o)=>af(e,r,o),e.safeEncodeAsync=async(r,o)=>cf(e,r,o),e.safeDecodeAsync=async(r,o)=>lf(e,r,o),os(e,"ZodType",{check(...r){let o=this.def;return this.clone(tr(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return at(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Jb(r,o))},superRefine(r,o){return this.check(Bb(r,o))},overwrite(r){return this.check(sr(r))},optional(){return U(this)},exactOptional(){return Ib(this)},nullable(){return mf(this)},nullish(){return U(mf(this))},nonoptional(r){return jb(this,r)},array(){return S(this)},or(r){return E([this,r])},and(r){return jt(this,r)},transform(r){return ff(this,Rf(r))},default(r){return Ab(this,r)},prefault(r){return qb(this,r)},catch(r){return Ub(this,r)},pipe(r){return ff(this,r)},readonly(){return Fb(this)},describe(r){let o=this.clone();return nr.add(o,{description:r}),o},meta(...r){if(r.length===0)return nr.get(this);let o=this.clone();return nr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return nr.get(e)?.description},configurable:!0}),e)),gf=_("_ZodString",(e,t)=>{Ma.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Ml(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,os(e,"_ZodString",{regex(...o){return this.check(xl(...o))},includes(...o){return this.check(El(...o))},startsWith(...o){return this.check(kl(...o))},endsWith(...o){return this.check($l(...o))},min(...o){return this.check(vo(...o))},max(...o){return this.check(Ua(...o))},length(...o){return this.check(Za(...o))},nonempty(...o){return this.check(vo(1,...o))},lowercase(o){return this.check(Pl(o))},uppercase(o){return this.check(Tl(o))},trim(){return this.check(Il())},normalize(...o){return this.check(Cl(...o))},toLowerCase(){return this.check(Ol())},toUpperCase(){return this.check(Nl())},slugify(){return this.check(Al())}})}),Sf=_("ZodString",(e,t)=>{Ma.init(e,t),gf.init(e,t),e.email=(r)=>e.check(zl(_f,r)),e.url=(r)=>e.check(Rl(yf,r)),e.jwt=(r)=>e.check(Sm(bb,r)),e.emoji=(r)=>e.check(om(sb,r)),e.guid=(r)=>e.check(wl(df,r)),e.uuid=(r)=>e.check(Qh(Ja,r)),e.uuidv4=(r)=>e.check(em(Ja,r)),e.uuidv6=(r)=>e.check(tm(Ja,r)),e.uuidv7=(r)=>e.check(rm(Ja,r)),e.nanoid=(r)=>e.check(nm(ib,r)),e.guid=(r)=>e.check(wl(df,r)),e.cuid=(r)=>e.check(sm(ab,r)),e.cuid2=(r)=>e.check(im(cb,r)),e.ulid=(r)=>e.check(am(lb,r)),e.base64=(r)=>e.check(mm(gb,r)),e.base64url=(r)=>e.check(fm(Sb,r)),e.xid=(r)=>e.check(cm(ub,r)),e.ksuid=(r)=>e.check(lm(db,r)),e.ipv4=(r)=>e.check(um(pb,r)),e.ipv6=(r)=>e.check(dm(hb,r)),e.cidrv4=(r)=>e.check(pm(mb,r)),e.cidrv6=(r)=>e.check(hm(fb,r)),e.e164=(r)=>e.check(gm(_b,r)),e.datetime=(r)=>e.check(wo(r)),e.date=(r)=>e.check(au(r)),e.time=(r)=>e.check(Km(r)),e.duration=(r)=>e.check(Gm(r))});function c(e){return Xh(Sf,e)}var le=_("ZodStringFormat",(e,t)=>{ce.init(e,t),gf.init(e,t)}),_f=_("ZodEmail",(e,t)=>{eh.init(e,t),le.init(e,t)});function bf(e){return zl(_f,e)}var df=_("ZodGUID",(e,t)=>{Xp.init(e,t),le.init(e,t)});var Ja=_("ZodUUID",(e,t)=>{Qp.init(e,t),le.init(e,t)});var yf=_("ZodURL",(e,t)=>{th.init(e,t),le.init(e,t)});function Ba(e){return Rl(yf,e)}var sb=_("ZodEmoji",(e,t)=>{rh.init(e,t),le.init(e,t)});var ib=_("ZodNanoID",(e,t)=>{oh.init(e,t),le.init(e,t)});var ab=_("ZodCUID",(e,t)=>{nh.init(e,t),le.init(e,t)});var cb=_("ZodCUID2",(e,t)=>{sh.init(e,t),le.init(e,t)});var lb=_("ZodULID",(e,t)=>{ih.init(e,t),le.init(e,t)});var ub=_("ZodXID",(e,t)=>{ah.init(e,t),le.init(e,t)});var db=_("ZodKSUID",(e,t)=>{ch.init(e,t),le.init(e,t)});var pb=_("ZodIPv4",(e,t)=>{hh.init(e,t),le.init(e,t)});var hb=_("ZodIPv6",(e,t)=>{mh.init(e,t),le.init(e,t)});var mb=_("ZodCIDRv4",(e,t)=>{fh.init(e,t),le.init(e,t)});var fb=_("ZodCIDRv6",(e,t)=>{gh.init(e,t),le.init(e,t)});var gb=_("ZodBase64",(e,t)=>{_h.init(e,t),le.init(e,t)});var Sb=_("ZodBase64URL",(e,t)=>{bh.init(e,t),le.init(e,t)});var _b=_("ZodE164",(e,t)=>{yh.init(e,t),le.init(e,t)});var bb=_("ZodJWT",(e,t)=>{vh.init(e,t),le.init(e,t)});var Wa=_("ZodNumber",(e,t)=>{Sl.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ql(e,o,n,s),os(e,"ZodNumber",{gt(o,n){return this.check(ja(o,n))},gte(o,n){return this.check(Xn(o,n))},min(o,n){return this.check(Xn(o,n))},lt(o,n){return this.check(qa(o,n))},lte(o,n){return this.check(Yn(o,n))},max(o,n){return this.check(Yn(o,n))},int(o){return this.check(pf(o))},safe(o){return this.check(pf(o))},positive(o){return this.check(ja(0,o))},nonnegative(o){return this.check(Xn(0,o))},negative(o){return this.check(qa(0,o))},nonpositive(o){return this.check(Yn(0,o))},multipleOf(o,n){return this.check(La(o,n))},step(o,n){return this.check(La(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function z(e){return zm(Wa,e)}var yb=_("ZodNumberFormat",(e,t)=>{zh.init(e,t),Wa.init(e,t)});function pf(e){return Rm(yb,e)}var vf=_("ZodBoolean",(e,t)=>{wh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jl(e,r,o,n)});function T(e){return xm(vf,e)}var vb=_("ZodUndefined",(e,t)=>{Rh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ul(e,r,o,n)});function lu(e){return Pm(vb,e)}var zb=_("ZodNull",(e,t)=>{xh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ll(e,r,o,n)});function Nr(e){return Tm(zb,e)}var wb=_("ZodAny",(e,t)=>{Ph.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dl(e,r,o,n)});function Ka(){return Em(wb)}var Rb=_("ZodUnknown",(e,t)=>{Th.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fl(e,r,o,n)});function q(){return km(Rb)}var xb=_("ZodNever",(e,t)=>{Eh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zl(e,r,o,n)});function uu(e){return $m(xb,e)}var Pb=_("ZodArray",(e,t)=>{kh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wl(e,r,o,n),e.element=t.element,os(e,"ZodArray",{min(r,o){return this.check(vo(r,o))},nonempty(r){return this.check(vo(1,r))},max(r,o){return this.check(Ua(r,o))},length(r,o){return this.check(Za(r,o))},unwrap(){return this.element}})});function S(e,t){return Cm(Pb,e,t)}var zf=_("ZodObject",(e,t)=>{Ih.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kl(e,r,o,n),ee(e,"shape",()=>t.shape),os(e,"ZodObject",{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:q()})},loose(){return this.clone({...this._zod.def,catchall:q()})},strict(){return this.clone({...this._zod.def,catchall:uu()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return C_(this,r)},safeExtend(r){return I_(this,r)},merge(r){return O_(this,r)},pick(r){return k_(this,r)},omit(r){return $_(this,r)},partial(...r){return N_(xf,this,r[0])},required(...r){return A_(Pf,this,r[0])}})});function p(e,t){let r={type:"object",shape:e??{},...j(t)};return new zf(r)}function F(e,t){return new zf({type:"object",shape:e,catchall:q(),...j(t)})}var wf=_("ZodUnion",(e,t)=>{_l.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gl(e,r,o,n),e.options=t.options});function E(e,t){return new wf({type:"union",options:e,...j(t)})}var Tb=_("ZodDiscriminatedUnion",(e,t)=>{wf.init(e,t),Oh.init(e,t)});function Ro(e,t,r){return new Tb({type:"union",options:t,discriminator:e,...j(r)})}var Eb=_("ZodIntersection",(e,t)=>{Nh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yl(e,r,o,n)});function jt(e,t){return new Eb({type:"intersection",left:e,right:t})}var hf=_("ZodRecord",(e,t)=>{Ah.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xl(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function P(e,t,r){if(!t||!t._zod)return new hf({type:"record",keyType:c(),valueType:e,...j(t)});return new hf({type:"record",keyType:e,valueType:t,...j(r)})}var cu=_("ZodEnum",(e,t)=>{Mh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Hl(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...j(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...j(n),entries:s})}});function K(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new cu({type:"enum",entries:r,...j(t)})}var kb=_("ZodLiteral",(e,t)=>{qh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vl(e,r,o,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 h(e,t){return new kb({type:"literal",values:Array.isArray(e)?e:[e],...j(t)})}var $b=_("ZodTransform",(e,t)=>{jh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bl(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Hn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(Or(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Or(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});function Rf(e){return new $b({type:"transform",transform:e})}var xf=_("ZodOptional",(e,t)=>{bl.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Da(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function U(e){return new xf({type:"optional",innerType:e})}var Cb=_("ZodExactOptional",(e,t)=>{Lh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Da(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ib(e){return new Cb({type:"optional",innerType:e})}var Ob=_("ZodNullable",(e,t)=>{Uh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ql(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function mf(e){return new Ob({type:"nullable",innerType:e})}var Nb=_("ZodDefault",(e,t)=>{Zh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ab(e,t){return new Nb({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():sl(t)}})}var Mb=_("ZodPrefault",(e,t)=>{Dh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ru(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qb(e,t){return new Mb({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():sl(t)}})}var Pf=_("ZodNonOptional",(e,t)=>{Fh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>eu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jb(e,t){return new Pf({type:"nonoptional",innerType:e,...j(t)})}var Lb=_("ZodCatch",(e,t)=>{Hh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ou(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ub(e,t){return new Lb({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var Tf=_("ZodPipe",(e,t)=>{yl.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nu(e,r,o,n),e.in=t.in,e.out=t.out});function ff(e,t){return new Tf({type:"pipe",in:e,out:t})}var Zb=_("ZodPreprocess",(e,t)=>{Tf.init(e,t),Vh.init(e,t)}),Db=_("ZodReadonly",(e,t)=>{Jh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>su(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Fb(e){return new Db({type:"readonly",innerType:e})}var Hb=_("ZodLazy",(e,t)=>{Bh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iu(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function ns(e){return new Hb({type:"lazy",getter:e})}var Vb=_("ZodCustom",(e,t)=>{Wh.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jl(e,r,o,n)});function Jb(e,t={}){return Im(Vb,e,t)}function Bb(e,t){return Om(e,t)}function Ar(e,t){return new Zb({type:"pipe",in:Rf(e),out:t})}var kf={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 Ef;(function(e){})(Ef||(Ef={}));function Wb(e){return wm(Wa,e)}Ue(vl());var Mr="2025-11-25";var Ga=[Mr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ya="io.modelcontextprotocol/related-task",Ut="io.modelcontextprotocol/protocolVersion",xo="io.modelcontextprotocol/clientInfo",Pt="io.modelcontextprotocol/serverInfo",qr="io.modelcontextprotocol/clientCapabilities",Po="io.modelcontextprotocol/subscriptionId",To="io.modelcontextprotocol/logLevel";var jr="2.0";var Lt=ns(()=>E([c(),z(),T(),Nr(),P(c(),Lt),S(Lt)])),de=P(c(),Lt),Xa=S(Lt),Eo=E([c(),z().int()]),ko=c(),ss=p({ttl:z().optional()}),is=p({taskId:c()}),$o=F({progressToken:Eo.optional(),[Ya]:is.optional()}),ze=p({_meta:$o.optional()}),ar=ze.extend({task:ss.optional()}),pe=p({method:c(),params:ze.loose().optional()}),ke=p({_meta:$o.optional()}),xe=p({method:c(),params:ke.loose().optional()}),Co=F({get[Pt](){return Tt.optional().catch(void 0)}}),he=F({_meta:Co.optional()}),lt=E([c(),z().int()]),Io=p({jsonrpc:h(jr),id:lt,...pe.shape}).strict(),Oo=p({jsonrpc:h(jr),...xe.shape}).strict(),Lr=p({jsonrpc:h(jr),id:lt,result:he}).strict(),Ur=p({jsonrpc:h(jr),id:lt.optional(),error:p({code:z().int(),message:c(),data:q().optional()})}).strict(),ut=E([Io,Oo,Lr,Ur]),Qa=E([Lr,Ur]),cr=he.strict(),as=ke.extend({requestId:lt.optional(),reason:c().optional()}),No=xe.extend({method:h("notifications/cancelled"),params:as}),cs=p({src:c(),mimeType:c().optional(),sizes:S(c()).optional(),theme:K(["light","dark"]).optional()}),Zt=p({icons:S(cs).optional()}),xt=p({name:c(),title:c().optional()}),Tt=xt.extend({...xt.shape,...Zt.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),Kb=jt(p({applyDefaults:T().optional()}),de),Gb=Ar((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},jt(p({form:Kb.optional(),url:de.optional()}),de.optional())),ec=F({list:de.optional(),cancel:de.optional(),requests:F({sampling:F({createMessage:de.optional()}).optional(),elicitation:F({create:de.optional()}).optional()}).optional()}),tc=F({list:de.optional(),cancel:de.optional(),requests:F({tools:F({call:de.optional()}).optional()}).optional()}),ls=p({experimental:P(c(),de).optional(),sampling:p({context:de.optional(),tools:de.optional()}).optional(),elicitation:Gb.optional(),roots:p({listChanged:T().optional()}).optional(),tasks:ec.optional(),extensions:P(c(),de).optional()}),us=ze.extend({protocolVersion:c(),capabilities:ls,clientInfo:Tt}),Ao=pe.extend({method:h("initialize"),params:us}),Mo=p({experimental:P(c(),de).optional(),logging:de.optional(),completions:de.optional(),prompts:p({listChanged:T().optional()}).optional(),resources:p({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:p({listChanged:T().optional()}).optional(),tasks:tc.optional(),extensions:P(c(),de).optional()}),ds=he.extend({protocolVersion:c(),capabilities:Mo,serverInfo:Tt,instructions:c().optional()}),qo=xe.extend({method:h("notifications/initialized"),params:ke.optional()}),ps=pe.extend({method:h("server/discover"),params:ze.optional()}),lr=he.extend({supportedVersions:S(c()),capabilities:Mo,instructions:c().optional()}),jo=pe.extend({method:h("ping"),params:ze.optional()}),hs=p({progress:z(),total:U(z()),message:U(c())}),ms=p({...ke.shape,...hs.shape,progressToken:Eo}),Lo=xe.extend({method:h("notifications/progress"),params:ms}),fs=ze.extend({cursor:ko.optional()}),Dt=pe.extend({params:fs.optional()}),Ft=he.extend({nextCursor:ko.optional()}),Uo=p({uri:c(),mimeType:U(c()),_meta:P(c(),q()).optional()}),Zo=Uo.extend({text:c()}),du=c().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Do=Uo.extend({blob:du}),Ht=K(["user","assistant"]),Et=p({audience:S(Ht).optional(),priority:z().min(0).max(1).optional(),lastModified:wo({offset:!0}).optional()}),Fo=p({...xt.shape,...Zt.shape,uri:c(),description:U(c()),mimeType:U(c()),size:U(z()),annotations:Et.optional(),_meta:U(F({}))}),gs=p({...xt.shape,...Zt.shape,uriTemplate:c(),description:U(c()),mimeType:U(c()),annotations:Et.optional(),_meta:U(F({}))}),Ss=Dt.extend({method:h("resources/list")}),_s=Ft.extend({resources:S(Fo)}),bs=Dt.extend({method:h("resources/templates/list")}),ys=Ft.extend({resourceTemplates:S(gs)}),Zr=ze.extend({uri:c()}),vs=Zr,zs=pe.extend({method:h("resources/read"),params:vs}),ws=he.extend({contents:S(E([Zo,Do]))}),Rs=xe.extend({method:h("notifications/resources/list_changed"),params:ke.optional()}),xs=Zr,Ps=pe.extend({method:h("resources/subscribe"),params:xs}),Ts=Zr,Es=pe.extend({method:h("resources/unsubscribe"),params:Ts}),Ho=p({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:S(c()).optional()}),ks=ze.extend({notifications:Ho}),$s=pe.extend({method:h("subscriptions/listen"),params:ks}),Cs=ke.extend({notifications:Ho}),Is=xe.extend({method:h("notifications/subscriptions/acknowledged"),params:Cs}),Os=Co.extend({[Po]:lt}),Ns=he.extend({_meta:Os}),As=ke.extend({uri:c()}),Ms=xe.extend({method:h("notifications/resources/updated"),params:As}),qs=p({name:c(),description:U(c()),required:U(T())}),js=p({...xt.shape,...Zt.shape,description:U(c()),arguments:U(S(qs)),_meta:U(F({}))}),Ls=Dt.extend({method:h("prompts/list")}),Us=Ft.extend({prompts:S(js)}),Zs=ze.extend({name:c(),arguments:P(c(),c()).optional()}),Ds=pe.extend({method:h("prompts/get"),params:Zs}),Dr=p({type:h("text"),text:c(),annotations:Et.optional(),_meta:P(c(),q()).optional()}),Fr=p({type:h("image"),data:du,mimeType:c(),annotations:Et.optional(),_meta:P(c(),q()).optional()}),Hr=p({type:h("audio"),data:du,mimeType:c(),annotations:Et.optional(),_meta:P(c(),q()).optional()}),Fs=p({type:h("tool_use"),name:c(),id:c(),input:P(c(),q()),_meta:P(c(),q()).optional()}),Vr=p({type:h("resource"),resource:E([Zo,Do]),annotations:Et.optional(),_meta:P(c(),q()).optional()}),Jr=Fo.extend({type:h("resource_link")}),kt=E([Dr,Fr,Hr,Jr,Vr]),Hs=p({role:Ht,content:kt}),Vs=he.extend({description:c().optional(),messages:S(Hs)}),Js=xe.extend({method:h("notifications/prompts/list_changed"),params:ke.optional()}),Bs=p({title:c().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),Ws=p({taskSupport:K(["required","optional","forbidden"]).optional()}),ur=p({...xt.shape,...Zt.shape,description:c().optional(),inputSchema:p({type:h("object"),properties:P(c(),Lt).optional(),required:S(c()).optional()}).catchall(q()),outputSchema:F({$schema:c().optional()}).optional(),annotations:Bs.optional(),execution:Ws.optional(),_meta:P(c(),q()).optional()}),Ks=Dt.extend({method:h("tools/list")}),Gs=Ft.extend({tools:S(ur)}),dr=he.extend({content:S(kt).default([]),structuredContent:q().optional(),isError:T().optional()}),rc=dr.or(he.extend({toolResult:q()})),Ys=ar.extend({name:c(),arguments:P(c(),q()).optional()}),Xs=pe.extend({method:h("tools/call"),params:Ys}),Qs=xe.extend({method:h("notifications/tools/list_changed"),params:ke.optional()}),ei=p({autoRefresh:T().default(!0),debounceMs:z().int().nonnegative().default(300)}),Vo=K(["debug","info","notice","warning","error","critical","alert","emergency"]),ti=ze.extend({level:Vo}),ri=pe.extend({method:h("logging/setLevel"),params:ti}),oi=ke.extend({level:Vo,logger:c().optional(),data:q()}),Br=xe.extend({method:h("notifications/message"),params:oi}),ni=p({name:c().optional()}),si=p({hints:S(ni).optional(),costPriority:z().min(0).max(1).optional(),speedPriority:z().min(0).max(1).optional(),intelligencePriority:z().min(0).max(1).optional()}),ii=p({mode:K(["auto","required","none"]).optional()}),ai=p({type:h("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:S(kt),structuredContent:q().optional(),isError:T().optional(),_meta:P(c(),q()).optional()}),ci=Ro("type",[Dr,Fr,Hr]),ir=Ro("type",[Dr,Fr,Hr,Fs,ai]),li=p({role:Ht,content:E([ir,S(ir)]),_meta:P(c(),q()).optional()}),ui=ar.extend({messages:S(li),modelPreferences:si.optional(),systemPrompt:c().optional(),includeContext:K(["none","thisServer","allServers"]).optional(),temperature:z().optional(),maxTokens:z().int(),stopSequences:S(c()).optional(),metadata:de.optional(),tools:S(ur).optional(),toolChoice:ii.optional()}),di=pe.extend({method:h("sampling/createMessage"),params:ui}),pi=he.extend({model:c(),stopReason:U(K(["endTurn","stopSequence","maxTokens"]).or(c())),role:Ht,content:ci}),hi=he.extend({model:c(),stopReason:U(K(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Ht,content:E([ir,S(ir)])}),Jo=p({type:h("boolean"),title:c().optional(),description:c().optional(),default:T().optional()}),Wr=p({type:h("string"),title:c().optional(),description:c().optional(),minLength:z().optional(),maxLength:z().optional(),format:K(["email","uri","date","date-time"]).optional(),default:c().optional()}),Kr=p({type:K(["number","integer"]),title:c().optional(),description:c().optional(),minimum:z().optional(),maximum:z().optional(),default:z().optional()}),Bo=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),default:c().optional()}),Wo=p({type:h("string"),title:c().optional(),description:c().optional(),oneOf:S(p({const:c(),title:c()})),default:c().optional()}),Ko=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),enumNames:S(c()).optional(),default:c().optional()}),mi=E([Bo,Wo]),Go=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({type:h("string"),enum:S(c())}),default:S(c()).optional()}),Yo=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({anyOf:S(p({const:c(),title:c()}))}),default:S(c()).optional()}),fi=E([Go,Yo]),gi=E([Ko,mi,fi]),Xo=E([gi,Jo,Wr,Kr]),Gr=ar.extend({mode:h("form").optional(),message:c(),requestedSchema:p({type:h("object"),properties:P(c(),Xo),required:S(c()).optional()}).catchall(q())}),Si=ar.extend({mode:h("url"),message:c(),elicitationId:c(),url:c().url()}),_i=E([Gr,Si]),bi=pe.extend({method:h("elicitation/create"),params:_i}),yi=ke.extend({elicitationId:c()}),vi=xe.extend({method:h("notifications/elicitation/complete"),params:yi}),zi=he.extend({action:K(["accept","decline","cancel"]),content:Ar((e)=>e===null?void 0:e,P(c(),E([c(),z(),T(),S(c())])).optional())}),wi=p({type:h("ref/resource"),uri:c()}),Ri=p({type:h("ref/prompt"),name:c()}),xi=ze.extend({ref:E([Ri,wi]),argument:p({name:c(),value:c()}),context:p({arguments:P(c(),c()).optional()}).optional()}),Pi=pe.extend({method:h("completion/complete"),params:xi}),Ti=he.extend({completion:F({values:S(c()).max(100),total:U(z().int()),hasMore:U(T())})}),Ei=p({uri:c().startsWith("file://"),name:c().optional(),_meta:P(c(),q()).optional()}),ki=pe.extend({method:h("roots/list"),params:ze.optional()}),$i=he.extend({roots:S(Ei)}),Ci=xe.extend({method:h("notifications/roots/list_changed"),params:ke.optional()}),oc=F({ttl:z().optional(),pollInterval:z().optional()}),Ii=K(["working","input_required","completed","failed","cancelled"]),Vt=p({taskId:c(),status:Ii,ttl:E([z(),Nr()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:U(z()),statusMessage:U(c())}),nc=he.extend({task:Vt}),Oi=ke.merge(Vt),sc=xe.extend({method:h("notifications/tasks/status"),params:Oi}),ic=pe.extend({method:h("tasks/get"),params:ze.extend({taskId:c()})}),ac=he.merge(Vt),cc=pe.extend({method:h("tasks/result"),params:ze.extend({taskId:c()})}),lc=he.loose(),uc=Dt.extend({method:h("tasks/list")}),dc=Ft.extend({tasks:S(Vt)}),pc=pe.extend({method:h("tasks/cancel"),params:ze.extend({taskId:c()})}),hc=he.merge(Vt),mc=E([jo,Ao,ps,Pi,ri,Ds,Ls,Ss,bs,zs,Ps,Es,$s,Xs,Ks]),fc=E([No,Lo,qo,Ci]),gc=E([cr,pi,hi,zi,$i]),Sc=E([jo,di,bi,ki]),_c=E([No,Lo,Br,Ms,Rs,Qs,Js,Is,vi]),bc=E([cr,ds,lr,Ti,Vs,Us,_s,ys,ws,dr,Gs,Ns]);var we=Ba().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:kf.custom,message:"URL must be parseable",fatal:!0}),el}).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"}),Qo=F({resource:c().url(),authorization_servers:S(we).optional(),jwks_uri:c().url().optional(),scopes_supported:S(c()).optional(),bearer_methods_supported:S(c()).optional(),resource_signing_alg_values_supported:S(c()).optional(),resource_name:c().optional(),resource_documentation:c().optional(),resource_policy_uri:c().url().optional(),resource_tos_uri:c().url().optional(),tls_client_certificate_bound_access_tokens:T().optional(),authorization_details_types_supported:S(c()).optional(),dpop_signing_alg_values_supported:S(c()).optional(),dpop_bound_access_tokens_required:T().optional()}),Yr=F({issuer:c(),authorization_endpoint:we,token_endpoint:we,registration_endpoint:we.optional(),scopes_supported:S(c()).optional(),response_types_supported:S(c()),response_modes_supported:S(c()).optional(),grant_types_supported:S(c()).optional(),token_endpoint_auth_methods_supported:S(c()).optional(),token_endpoint_auth_signing_alg_values_supported:S(c()).optional(),service_documentation:we.optional(),revocation_endpoint:we.optional(),revocation_endpoint_auth_methods_supported:S(c()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(c()).optional(),introspection_endpoint:c().optional(),introspection_endpoint_auth_methods_supported:S(c()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(c()).optional(),code_challenge_methods_supported:S(c()).optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0),dpop_signing_alg_values_supported:S(c()).optional()}),Ni=F({issuer:c(),authorization_endpoint:we,token_endpoint:we,userinfo_endpoint:we.optional(),jwks_uri:we,registration_endpoint:we.optional(),scopes_supported:S(c()).optional(),response_types_supported:S(c()),response_modes_supported:S(c()).optional(),grant_types_supported:S(c()).optional(),acr_values_supported:S(c()).optional(),subject_types_supported:S(c()),id_token_signing_alg_values_supported:S(c()),id_token_encryption_alg_values_supported:S(c()).optional(),id_token_encryption_enc_values_supported:S(c()).optional(),userinfo_signing_alg_values_supported:S(c()).optional(),userinfo_encryption_alg_values_supported:S(c()).optional(),userinfo_encryption_enc_values_supported:S(c()).optional(),request_object_signing_alg_values_supported:S(c()).optional(),request_object_encryption_alg_values_supported:S(c()).optional(),request_object_encryption_enc_values_supported:S(c()).optional(),token_endpoint_auth_methods_supported:S(c()).optional(),token_endpoint_auth_signing_alg_values_supported:S(c()).optional(),display_values_supported:S(c()).optional(),claim_types_supported:S(c()).optional(),claims_supported:S(c()).optional(),service_documentation:c().optional(),claims_locales_supported:S(c()).optional(),ui_locales_supported:S(c()).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:we.optional(),op_tos_uri:we.optional(),client_id_metadata_document_supported:T().optional(),authorization_response_iss_parameter_supported:T().optional().catch(void 0)}),en=p({...Ni.shape,...Yr.pick({code_challenge_methods_supported:!0}).shape}),Xr=p({access_token:c(),id_token:c().optional(),token_type:c(),expires_in:Wb().optional(),scope:c().optional(),refresh_token:c().optional(),issuer:c().optional().catch(void 0)}).strip(),Ai=p({issued_token_type:h("urn:ietf:params:oauth:token-type:id-jag"),access_token:c(),token_type:c().optional(),expires_in:z().optional(),scope:c().optional()}).strip(),Qr=p({error:c(),error_description:c().optional(),error_uri:c().optional()}),pu=we.optional().or(h("").transform(()=>{return})),Mi=p({redirect_uris:S(we),token_endpoint_auth_method:c().optional(),grant_types:S(c()).optional(),response_types:S(c()).optional(),application_type:c().optional(),client_name:c().optional(),client_uri:we.optional(),logo_uri:pu,scope:c().optional(),contacts:S(c()).optional(),tos_uri:pu,policy_uri:c().optional(),jwks_uri:we.optional(),jwks:Ka().optional(),software_id:c().optional(),software_version:c().optional(),software_statement:c().optional()}).strip(),qi=p({client_id:c(),client_secret:c().optional(),client_id_issued_at:z().optional(),client_secret_expires_at:z().optional(),issuer:c().optional().catch(void 0)}).strip(),tn=Mi.merge(qi),yc=p({error:c(),error_description:c().optional()}).strip(),vc=p({token:c(),token_type_hint:c().optional()}).strip();var Su=Symbol.for("mcp.sdk.errorBrands");function hr(e,t){let r=new Set,o=t;while(typeof o==="function"){let n=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n==="string")r.add(n);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,Su,{value:r,enumerable:!1,configurable:!0})}function Ze(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Su)){let r=t[Su];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var $t=function(e){return e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedGrantType="unsupported_grant_type",e.InvalidScope="invalid_scope",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedTokenType="unsupported_token_type",e.InvalidToken="invalid_token",e.MethodNotAllowed="method_not_allowed",e.TooManyRequests="too_many_requests",e.InvalidClientMetadata="invalid_client_metadata",e.InvalidRedirectUri="invalid_redirect_uri",e.InsufficientScope="insufficient_scope",e.InvalidTarget="invalid_target",e.InvalidDpopProof="invalid_dpop_proof",e.UseDpopNonce="use_dpop_nonce",e}({}),mr=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Ze(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 Ze(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",hr(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)}},N=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}({}),A=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Ze(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 Ze(this,e)}constructor(e,t,r,o){super(t,o);this.code=e,this.data=r,this.name="SdkError",hr(this,new.target)}},dt=class extends A{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function zu(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Ec(e){if(typeof e!=="object"||e===null||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function wu({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var rg="2026-07-28",Ru=[rg];function Ct(e){return e>=rg}function xu(e){return e.filter((t)=>!Ct(t))}function Fi(e){return e.filter((t)=>Ct(t))}function og(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((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var ng=["task","inputRequests","requestState"];function Yb(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||ng.some((t)=>(t in e)))return e;return{...e,content:[]}}function Xb(){let e=ns(()=>E([c(),z(),T(),Nr(),P(c(),e),S(e)])),t=P(c(),e),r=E([c(),z().int()]),o=c(),n=p({ttl:z().optional()}),s=p({taskId:c()}),i=F({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=p({_meta:i.optional()}),l=a.extend({task:n.optional()}),u=p({method:c(),params:a.loose().optional()}),d=p({_meta:i.optional()}),m=p({method:c(),params:d.loose().optional()}),f=F({_meta:i.optional()}),g=E([c(),z().int()]),b=f.strict(),y=d.extend({requestId:g.optional(),reason:c().optional()}),v=m.extend({method:h("notifications/cancelled"),params:y}),L=p({src:c(),mimeType:c().optional(),sizes:S(c()).optional(),theme:K(["light","dark"]).optional()}),H=p({icons:S(L).optional()}),x=p({name:c(),title:c().optional()}),Z=x.extend({...x.shape,...H.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),R=jt(p({applyDefaults:T().optional()}),t),w=Ar((Ee)=>{if(Ee&&typeof Ee==="object"&&!Array.isArray(Ee)&&Object.keys(Ee).length===0)return{form:{}};return Ee},jt(p({form:R.optional(),url:t.optional()}),t.optional())),D=F({list:t.optional(),cancel:t.optional(),requests:F({sampling:F({createMessage:t.optional()}).optional(),elicitation:F({create:t.optional()}).optional()}).optional()}),X=F({list:t.optional(),cancel:t.optional(),requests:F({tools:F({call:t.optional()}).optional()}).optional()}),Y=p({experimental:P(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:p({listChanged:T().optional()}).optional(),tasks:D.optional(),extensions:P(c(),t).optional()}),ue=a.extend({protocolVersion:c(),capabilities:Y,clientInfo:Z}),$e=u.extend({method:h("initialize"),params:ue}),ne=p({experimental:P(c(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:T().optional()}).optional(),resources:p({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:p({listChanged:T().optional()}).optional(),tasks:X.optional(),extensions:P(c(),t).optional()}),_e=f.extend({protocolVersion:c(),capabilities:ne,serverInfo:Z,instructions:c().optional()}),ae=m.extend({method:h("notifications/initialized"),params:d.optional()}),Ce=u.extend({method:h("ping"),params:a.optional()}),gt=p({progress:z(),total:U(z()),message:U(c())}),qe=p({...d.shape,...gt.shape,progressToken:r}),Xe=m.extend({method:h("notifications/progress"),params:qe}),St=a.extend({cursor:o.optional()}),He=u.extend({params:St.optional()}),Ie=f.extend({nextCursor:o.optional()}),At=p({uri:c(),mimeType:U(c()),_meta:P(c(),q()).optional()}),Mt=At.extend({text:c()}),_t=c().refine((Ee)=>{try{return atob(Ee),!0}catch{return!1}},{message:"Invalid Base64 string"}),Pe=At.extend({blob:_t}),Oe=K(["user","assistant"]),Ne=p({audience:S(Oe).optional(),priority:z().min(0).max(1).optional(),lastModified:wo({offset:!0}).optional()}),st=p({...x.shape,...H.shape,uri:c(),description:U(c()),mimeType:U(c()),size:U(z()),annotations:Ne.optional(),_meta:U(F({}))}),br=p({...x.shape,...H.shape,uriTemplate:c(),description:U(c()),mimeType:U(c()),annotations:Ne.optional(),_meta:U(F({}))}),Ve=He.extend({method:h("resources/list")}),Je=Ie.extend({resources:S(st)}),je=He.extend({method:h("resources/templates/list")}),Qe=Ie.extend({resourceTemplates:S(br)}),et=a.extend({uri:c()}),bt=et,yt=u.extend({method:h("resources/read"),params:bt}),Yt=f.extend({contents:S(E([Mt,Pe]))}),vt=m.extend({method:h("notifications/resources/list_changed"),params:d.optional()}),yr=et,I=u.extend({method:h("resources/subscribe"),params:yr}),zt=et,V=u.extend({method:h("resources/unsubscribe"),params:zt}),M=d.extend({uri:c()}),G=m.extend({method:h("notifications/resources/updated"),params:M}),O=p({name:c(),description:U(c()),required:U(T())}),C=p({...x.shape,...H.shape,description:U(c()),arguments:U(S(O)),_meta:U(F({}))}),W=He.extend({method:h("prompts/list")}),J=Ie.extend({prompts:S(C)}),be=a.extend({name:c(),arguments:P(c(),c()).optional()}),vr=u.extend({method:h("prompts/get"),params:be}),wt=p({type:h("text"),text:c(),annotations:Ne.optional(),_meta:P(c(),q()).optional()}),zr=p({type:h("image"),data:_t,mimeType:c(),annotations:Ne.optional(),_meta:P(c(),q()).optional()}),wr=p({type:h("audio"),data:_t,mimeType:c(),annotations:Ne.optional(),_meta:P(c(),q()).optional()}),gn=p({type:h("tool_use"),name:c(),id:c(),input:P(c(),q()),_meta:P(c(),q()).optional()}),Xt=p({type:h("resource"),resource:E([Mt,Pe]),annotations:Ne.optional(),_meta:P(c(),q()).optional()}),Sn=st.extend({type:h("resource_link")}),tt=E([wt,zr,wr,Sn,Xt]),ao=p({role:Oe,content:tt}),co=f.extend({description:c().optional(),messages:S(ao)}),Rr=m.extend({method:h("notifications/prompts/list_changed"),params:d.optional()}),_n=p({title:c().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),lo=p({taskSupport:K(["required","optional","forbidden"]).optional()}),xr=p({...x.shape,...H.shape,description:c().optional(),inputSchema:p({type:h("object"),properties:P(c(),e).optional(),required:S(c()).optional()}).catchall(q()),outputSchema:p({type:h("object"),properties:P(c(),e).optional(),required:S(c()).optional()}).catchall(q()).optional(),annotations:_n.optional(),execution:lo.optional(),_meta:P(c(),q()).optional()}),uo=He.extend({method:h("tools/list")}),po=Ie.extend({tools:S(xr)}),ho=f.extend({content:S(tt),structuredContent:P(c(),q()).optional(),isError:T().optional()}),Te=l.extend({name:c(),arguments:P(c(),q()).optional()}),bn=u.extend({method:h("tools/call"),params:Te}),ca=m.extend({method:h("notifications/tools/list_changed"),params:d.optional()}),mo=K(["debug","info","notice","warning","error","critical","alert","emergency"]),yn=a.extend({level:mo}),vn=u.extend({method:h("logging/setLevel"),params:yn}),zn=d.extend({level:mo,logger:c().optional(),data:q()}),wn=m.extend({method:h("notifications/message"),params:zn}),Rn=p({name:c().optional()}),xn=p({hints:S(Rn).optional(),costPriority:z().min(0).max(1).optional(),speedPriority:z().min(0).max(1).optional(),intelligencePriority:z().min(0).max(1).optional()}),Pn=p({mode:K(["auto","required","none"]).optional()}),la=p({type:h("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:S(tt),structuredContent:p({}).loose().optional(),isError:T().optional(),_meta:P(c(),q()).optional()}),Tn=Ro("type",[wt,zr,wr]),Qt=Ro("type",[wt,zr,wr,gn,la]),En=p({role:Oe,content:E([Qt,S(Qt)]),_meta:P(c(),q()).optional()}),kn=l.extend({messages:S(En),modelPreferences:xn.optional(),systemPrompt:c().optional(),includeContext:K(["none","thisServer","allServers"]).optional(),temperature:z().optional(),maxTokens:z().int(),stopSequences:S(c()).optional(),metadata:t.optional(),tools:S(xr).optional(),toolChoice:Pn.optional()}),$n=u.extend({method:h("sampling/createMessage"),params:kn}),Cn=f.extend({model:c(),stopReason:U(K(["endTurn","stopSequence","maxTokens"]).or(c())),role:Oe,content:Tn}),In=f.extend({model:c(),stopReason:U(K(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Oe,content:E([Qt,S(Qt)])}),On=p({type:h("boolean"),title:c().optional(),description:c().optional(),default:T().optional()}),Nn=p({type:h("string"),title:c().optional(),description:c().optional(),minLength:z().optional(),maxLength:z().optional(),format:K(["email","uri","date","date-time"]).optional(),default:c().optional()}),An=p({type:K(["number","integer"]),title:c().optional(),description:c().optional(),minimum:z().optional(),maximum:z().optional(),default:z().optional()}),Mn=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),default:c().optional()}),qn=p({type:h("string"),title:c().optional(),description:c().optional(),oneOf:S(p({const:c(),title:c()})),default:c().optional()}),jn=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),enumNames:S(c()).optional(),default:c().optional()}),Ln=E([Mn,qn]),Pr=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({type:h("string"),enum:S(c())}),default:S(c()).optional()}),Tr=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({anyOf:S(p({const:c(),title:c()}))}),default:S(c()).optional()}),ua=E([Pr,Tr]),da=E([jn,Ln,ua]),Be=E([da,On,Nn,An]),We=l.extend({mode:h("form").optional(),message:c(),requestedSchema:p({type:h("object"),properties:P(c(),Be),required:S(c()).optional()}).catchall(q())}),Un=l.extend({mode:h("url"),message:c(),elicitationId:c(),url:c().url()}),it=E([We,Un]),pa=u.extend({method:h("elicitation/create"),params:it}),ha=d.extend({elicitationId:c()}),ma=m.extend({method:h("notifications/elicitation/complete"),params:ha}),fa=f.extend({action:K(["accept","decline","cancel"]),content:Ar((Ee)=>Ee===null?void 0:Ee,P(c(),E([c(),z(),T(),S(c())])).optional())}),ga=p({type:h("ref/resource"),uri:c()}),Sa=p({type:h("ref/prompt"),name:c()}),_a=a.extend({ref:E([Sa,ga]),argument:p({name:c(),value:c()}),context:p({arguments:P(c(),c()).optional()}).optional()}),Zn=u.extend({method:h("completion/complete"),params:_a}),ba=f.extend({completion:F({values:S(c()).max(100),total:U(z().int()),hasMore:U(T())})}),ya=p({uri:c().startsWith("file://"),name:c().optional(),_meta:P(c(),q()).optional()}),fo=u.extend({method:h("roots/list"),params:a.optional()}),Dn=f.extend({roots:S(ya)}),va=m.extend({method:h("notifications/roots/list_changed"),params:d.optional()}),za=F({ttl:z().optional(),pollInterval:z().optional()}),Fn=K(["working","input_required","completed","failed","cancelled"]),er=p({taskId:c(),status:Fn,ttl:E([z(),Nr()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:U(z()),statusMessage:U(c())}),Le=f.extend({task:er}),wa=d.merge(er),Er=m.extend({method:h("notifications/tasks/status"),params:wa}),go=u.extend({method:h("tasks/get"),params:a.extend({taskId:c()})}),So=f.merge(er),_o=u.extend({method:h("tasks/result"),params:a.extend({taskId:c()})}),Qc=f.loose(),Ae=He.extend({method:h("tasks/list")}),ge=Ie.extend({tasks:S(er)}),kr=u.extend({method:h("tasks/cancel"),params:a.extend({taskId:c()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:m,ResultSchema:f,RequestIdSchema:g,EmptyResultSchema:b,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:v,IconSchema:L,IconsSchema:H,BaseMetadataSchema:x,ImplementationSchema:Z,ClientTasksCapabilitySchema:D,ServerTasksCapabilitySchema:X,ClientCapabilitiesSchema:Y,InitializeRequestParamsSchema:ue,InitializeRequestSchema:$e,ServerCapabilitiesSchema:ne,InitializeResultSchema:_e,InitializedNotificationSchema:ae,PingRequestSchema:Ce,ProgressSchema:gt,ProgressNotificationParamsSchema:qe,ProgressNotificationSchema:Xe,PaginatedRequestParamsSchema:St,PaginatedRequestSchema:He,PaginatedResultSchema:Ie,ResourceContentsSchema:At,TextResourceContentsSchema:Mt,BlobResourceContentsSchema:Pe,RoleSchema:Oe,AnnotationsSchema:Ne,ResourceSchema:st,ResourceTemplateSchema:br,ListResourcesRequestSchema:Ve,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:je,ListResourceTemplatesResultSchema:Qe,ResourceRequestParamsSchema:et,ReadResourceRequestParamsSchema:bt,ReadResourceRequestSchema:yt,ReadResourceResultSchema:Yt,ResourceListChangedNotificationSchema:vt,SubscribeRequestParamsSchema:yr,SubscribeRequestSchema:I,UnsubscribeRequestParamsSchema:zt,UnsubscribeRequestSchema:V,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:G,PromptArgumentSchema:O,PromptSchema:C,ListPromptsRequestSchema:W,ListPromptsResultSchema:J,GetPromptRequestParamsSchema:be,GetPromptRequestSchema:vr,TextContentSchema:wt,ImageContentSchema:zr,AudioContentSchema:wr,ToolUseContentSchema:gn,EmbeddedResourceSchema:Xt,ResourceLinkSchema:Sn,ContentBlockSchema:tt,PromptMessageSchema:ao,GetPromptResultSchema:co,PromptListChangedNotificationSchema:Rr,ToolAnnotationsSchema:_n,ToolExecutionSchema:lo,ToolSchema:xr,ListToolsRequestSchema:uo,ListToolsResultSchema:po,CallToolResultSchema:ho,CallToolRequestParamsSchema:Te,CallToolRequestSchema:bn,ToolListChangedNotificationSchema:ca,LoggingLevelSchema:mo,SetLevelRequestParamsSchema:yn,SetLevelRequestSchema:vn,LoggingMessageNotificationParamsSchema:zn,LoggingMessageNotificationSchema:wn,ModelHintSchema:Rn,ModelPreferencesSchema:xn,ToolChoiceSchema:Pn,ToolResultContentSchema:la,SamplingContentSchema:Tn,SamplingMessageContentBlockSchema:Qt,SamplingMessageSchema:En,CreateMessageRequestParamsSchema:kn,CreateMessageRequestSchema:$n,CreateMessageResultSchema:Cn,CreateMessageResultWithToolsSchema:In,BooleanSchemaSchema:On,StringSchemaSchema:Nn,NumberSchemaSchema:An,UntitledSingleSelectEnumSchemaSchema:Mn,TitledSingleSelectEnumSchemaSchema:qn,LegacyTitledEnumSchemaSchema:jn,SingleSelectEnumSchemaSchema:Ln,UntitledMultiSelectEnumSchemaSchema:Pr,TitledMultiSelectEnumSchemaSchema:Tr,MultiSelectEnumSchemaSchema:ua,EnumSchemaSchema:da,PrimitiveSchemaDefinitionSchema:Be,ElicitRequestFormParamsSchema:We,ElicitRequestURLParamsSchema:Un,ElicitRequestParamsSchema:it,ElicitRequestSchema:pa,ElicitationCompleteNotificationParamsSchema:ha,ElicitationCompleteNotificationSchema:ma,ElicitResultSchema:fa,ResourceTemplateReferenceSchema:ga,PromptReferenceSchema:Sa,CompleteRequestParamsSchema:_a,CompleteRequestSchema:Zn,CompleteResultSchema:ba,RootSchema:ya,ListRootsRequestSchema:fo,ListRootsResultSchema:Dn,RootsListChangedNotificationSchema:va,TaskCreationParamsSchema:za,TaskStatusSchema:Fn,TaskSchema:er,CreateTaskResultSchema:Le,TaskStatusNotificationParamsSchema:wa,TaskStatusNotificationSchema:Er,GetTaskRequestSchema:go,GetTaskResultSchema:So,GetTaskPayloadRequestSchema:_o,GetTaskPayloadResultSchema:Qc,ListTasksRequestSchema:Ae,ListTasksResultSchema:ge,CancelTaskRequestSchema:kr,CancelTaskResultSchema:f.merge(er),ClientRequestSchema:E([Ce,$e,Zn,vn,vr,W,Ve,je,yt,I,V,bn,uo,go,_o,Ae,kr]),ClientNotificationSchema:E([v,Xe,ae,va,Er]),ClientResultSchema:E([b,Cn,In,fa,Dn,So,ge,Le]),ServerRequestSchema:E([Ce,$n,pa,fo,go,_o,Ae,kr]),ServerNotificationSchema:E([v,Xe,wn,G,vt,ca,Rr,Er,ma]),ServerResultSchema:E([b,_e,ba,co,J,Je,Qe,Yt,ho,po,So,ge,Le]),CallToolResultWireSchema:q().superRefine((Ee,__)=>{if(typeof Ee!=="object"||Ee===null||Array.isArray(Ee)||Ee.content!==void 0)return;for(let xd of ng)if(xd in Ee){__.addIssue({code:"custom",message:`content is required when the body carries '${xd}' — another result family cannot default into an empty tools/call success`});return}}).transform(Yb).pipe(ho)}}var Qb;function sg(){return Qb??=Xb()}function ig(e){return e.type!=="object"}var ey=new Set(["const","enum","default","examples"]),ty=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Df(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function ry(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Df(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Cd(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map((l)=>o(l,!1));if(n===null||typeof n!=="object")return n;if(!s&&Df(n.$id))return n;let i={},a=!1;for(let[l,u]of Object.entries(n))if(s)i[l]=o(u,!1);else if((l==="$ref"||l==="$dynamicRef")&&typeof u==="string")i[l]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(l==="$recursiveRef"&&u==="#"&&r)a=!0;else if(ey.has(l))i[l]=u;else if(ty.has(l))i[l]=o(u,!0);else i[l]=o(u,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var ag={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},cg={"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},oy={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},zc;function Pu(){if(zc)return zc;let e=sg();return zc={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}},zc}function lg(e){return Object.prototype.hasOwnProperty.call(ag,e)}function ug(e){return Object.prototype.hasOwnProperty.call(cg,e)}function ny(e){return Object.prototype.hasOwnProperty.call(oy,e)}function sy(e){return ny(e)?Pu().resultSchemas[e]:void 0}function iy(e){return lg(e)?Pu().requestSchemas[e]:void 0}function ay(e){return ug(e)?Pu().notificationSchemas[e]:void 0}var tP=Object.keys(ag),rP=Object.keys(cg);function _u(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function wc(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Ff={ok:!1,reason:"not-in-era"};function Hf(e){return _u(e)&&_u(e.outputSchema)&&ig(e.outputSchema)}function Vf(e){return e}var Tu={era:"2025-11-25",hasRequestMethod:lg,hasNotificationMethod:ug,validateRequest:(e,t)=>wc(iy(e),t),validateResult:(e,t)=>wc(sy(e),t),validateNotification:(e,t)=>wc(ay(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ff,validateInputResponse:()=>Ff,samplingResultVariant:(e,t)=>{let r=sg();return wc(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=og(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!=="object"||o===null||Array.isArray(o),s=t!==void 0&&ig(t);if(!n&&!s)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(_u(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Vf(r)}}return{kind:"complete",result:Vf(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>Hf(o)))return t;return{...t,tools:r.map((o)=>Hf(o)?{...o,outputSchema:ry(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function cy(){let e=ns(()=>E([c(),z(),T(),Nr(),P(c(),e),S(e)])),t=P(c(),e),r=E([c(),z().int()]),o=c(),n=E([c(),z().int()]),s=K(["user","assistant"]),i=K(["debug","info","notice","warning","error","critical","alert","emergency"]),a=c().refine((ge)=>{try{return atob(ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=p({ttl:z().optional()}),u=p({taskId:c()}),d=F({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),m=p({_meta:d.optional()}),f=m.extend({task:l.optional()}),g=p({_meta:d.optional()}),b=p({method:c(),params:g.loose().optional()}),y=p({src:c(),mimeType:c().optional(),sizes:S(c()).optional(),theme:K(["light","dark"]).optional()}),v=p({icons:S(y).optional()}),L=p({name:c(),title:c().optional()}),H=L.extend({...L.shape,...v.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),x=jt(p({applyDefaults:T().optional()}),t),Z=Ar((ge)=>{if(ge&&typeof ge==="object"&&!Array.isArray(ge)&&Object.keys(ge).length===0)return{form:{}};return ge},jt(p({form:x.optional(),url:t.optional()}),t.optional())),R=F({list:t.optional(),cancel:t.optional(),requests:F({sampling:F({createMessage:t.optional()}).optional(),elicitation:F({create:t.optional()}).optional()}).optional()}),w=F({list:t.optional(),cancel:t.optional(),requests:F({tools:F({call:t.optional()}).optional()}).optional()}),D=p({experimental:P(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:Z.optional(),roots:p({listChanged:T().optional()}).optional(),tasks:R.optional(),extensions:P(c(),t).optional()}),X=p({experimental:P(c(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:T().optional()}).optional(),resources:p({subscribe:T().optional(),listChanged:T().optional()}).optional(),tools:p({listChanged:T().optional()}).optional(),tasks:w.optional(),extensions:P(c(),t).optional()}),Y=p({progress:z(),total:U(z()),message:U(c())}),ue=p({...g.shape,...Y.shape,progressToken:r}),$e=b.extend({method:h("notifications/progress"),params:ue}),ne=g.extend({level:i,logger:c().optional(),data:q()}),_e=b.extend({method:h("notifications/message"),params:ne}),ae=p({uri:c(),mimeType:U(c()),_meta:P(c(),q()).optional()}),Ce=ae.extend({text:c()}),gt=ae.extend({blob:a}),qe=p({audience:S(s).optional(),priority:z().min(0).max(1).optional(),lastModified:wo({offset:!0}).optional()}),Xe=p({...L.shape,...v.shape,uri:c(),description:U(c()),mimeType:U(c()),size:U(z()),annotations:qe.optional(),_meta:U(F({}))}),St=p({...L.shape,...v.shape,uriTemplate:c(),description:U(c()),mimeType:U(c()),annotations:qe.optional(),_meta:U(F({}))}),He=b.extend({method:h("notifications/resources/list_changed"),params:g.optional()}),Ie=g.extend({uri:c()}),At=b.extend({method:h("notifications/resources/updated"),params:Ie}),Mt=p({name:c(),description:U(c()),required:U(T())}),_t=p({...L.shape,...v.shape,description:U(c()),arguments:U(S(Mt)),_meta:U(F({}))}),Pe=b.extend({method:h("notifications/prompts/list_changed"),params:g.optional()}),Oe=p({type:h("text"),text:c(),annotations:qe.optional(),_meta:P(c(),q()).optional()}),Ne=p({type:h("image"),data:a,mimeType:c(),annotations:qe.optional(),_meta:P(c(),q()).optional()}),st=p({type:h("audio"),data:a,mimeType:c(),annotations:qe.optional(),_meta:P(c(),q()).optional()}),br=p({type:h("tool_use"),name:c(),id:c(),input:P(c(),q()),_meta:P(c(),q()).optional()}),Ve=p({type:h("resource"),resource:E([Ce,gt]),annotations:qe.optional(),_meta:P(c(),q()).optional()}),Je=Xe.extend({type:h("resource_link")}),je=E([Oe,Ne,st,Je,Ve]),Qe=p({role:s,content:je}),et=p({title:c().optional(),readOnlyHint:T().optional(),destructiveHint:T().optional(),idempotentHint:T().optional(),openWorldHint:T().optional()}),bt=b.extend({method:h("notifications/tools/list_changed"),params:g.optional()}),yt=p({name:c().optional()}),Yt=p({hints:S(yt).optional(),costPriority:z().min(0).max(1).optional(),speedPriority:z().min(0).max(1).optional(),intelligencePriority:z().min(0).max(1).optional()}),vt=p({mode:K(["auto","required","none"]).optional()}),yr=p({type:h("boolean"),title:c().optional(),description:c().optional(),default:T().optional()}),I=p({type:h("string"),title:c().optional(),description:c().optional(),minLength:z().optional(),maxLength:z().optional(),format:K(["email","uri","date","date-time"]).optional(),default:c().optional()}),zt=p({type:K(["number","integer"]),title:c().optional(),description:c().optional(),minimum:z().optional(),maximum:z().optional(),default:z().optional()}),V=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),default:c().optional()}),M=p({type:h("string"),title:c().optional(),description:c().optional(),oneOf:S(p({const:c(),title:c()})),default:c().optional()}),G=p({type:h("string"),title:c().optional(),description:c().optional(),enum:S(c()),enumNames:S(c()).optional(),default:c().optional()}),O=E([V,M]),C=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({type:h("string"),enum:S(c())}),default:S(c()).optional()}),W=p({type:h("array"),title:c().optional(),description:c().optional(),minItems:z().optional(),maxItems:z().optional(),items:p({anyOf:S(p({const:c(),title:c()}))}),default:S(c()).optional()}),J=E([C,W]),be=E([G,O,J]),vr=E([be,yr,I,zt]),wt=f.extend({mode:h("form").optional(),message:c(),requestedSchema:p({type:h("object"),properties:P(c(),vr),required:S(c()).optional()}).catchall(q())}),zr=p({type:h("ref/resource"),uri:c()}),wr=p({type:h("ref/prompt"),name:c()}),gn=p({uri:c().startsWith("file://"),name:c().optional(),_meta:P(c(),q()).optional()}),Xt=D.shape,Sn=p({experimental:Xt.experimental,sampling:Xt.sampling,elicitation:Xt.elicitation,roots:Xt.roots,extensions:Xt.extensions}),tt=X.shape,ao=p({experimental:tt.experimental,logging:tt.logging,completions:tt.completions,prompts:tt.prompts,resources:tt.resources,tools:tt.tools,extensions:tt.extensions}),co=F({progressToken:r.optional(),[Ut]:c(),[xo]:H.optional(),[qr]:Sn,[To]:i.optional()}),Rr=p({...L.shape,...v.shape,description:c().optional(),inputSchema:F({$schema:c().optional(),type:h("object")}),outputSchema:F({$schema:c().optional()}).optional(),annotations:et.optional(),_meta:P(c(),q()).optional()}),_n=p({type:h("tool_result"),toolUseId:c(),content:S(je),structuredContent:q().optional(),isError:T().optional(),_meta:P(c(),q()).optional()}),lo=E([Oe,Ne,st,br,_n]),xr=p({role:s,content:E([lo,S(lo)]),_meta:P(c(),q()).optional()}),uo=c(),po=F({[Pt]:H.optional().catch(void 0)}),ho=po.optional();function Te(ge){return F({_meta:ho,resultType:uo.default("complete"),...ge})}let bn=Te({}),ca=Te({nextCursor:o.optional()}),mo=Te({content:S(je),structuredContent:q().optional(),isError:T().optional()}),yn=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),tools:S(Rr),nextCursor:o.optional()}),vn=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),prompts:S(_t),nextCursor:o.optional()}),zn=Te({description:c().optional(),messages:S(Qe)}),wn=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),resources:S(Xe),nextCursor:o.optional()}),Rn=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),resourceTemplates:S(St),nextCursor:o.optional()}),xn=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),contents:S(E([Ce,gt]))}),Pn=Te({completion:p({values:S(c()).max(100),total:z().int().optional(),hasMore:T().optional()}).loose()}),la=Te({ttlMs:z().int().min(0),cacheScope:K(["public","private"])}),Tn=Te({ttlMs:z().int().min(0).catch(0),cacheScope:K(["public","private"]).catch("private"),supportedVersions:S(c()),capabilities:ao,instructions:c().optional()}),Qt=p({messages:S(xr),modelPreferences:Yt.optional(),systemPrompt:c().optional(),includeContext:K(["none","thisServer","allServers"]).optional(),temperature:z().optional(),maxTokens:z().int(),stopSequences:S(c()).optional(),metadata:t.optional(),tools:S(Rr).optional(),toolChoice:vt.optional()}),En=p({method:h("sampling/createMessage"),params:Qt}),kn=p({method:h("roots/list"),params:p({_meta:P(c(),q()).optional()}).optional()}),$n=p({...xr.shape,model:c(),stopReason:c().optional()}),Cn=p({roots:S(gn)}),In=p({action:K(["accept","decline","cancel"]),content:P(c(),E([c(),z(),T(),S(c())])).optional()}),On=p({mode:h("url"),message:c(),url:c().url()}),Nn=E([wt,On]),An=p({method:h("elicitation/create"),params:Nn}),Mn=E([En,kn,An]),qn=E([$n,Cn,In]),jn=P(c(),Mn),Ln=P(c(),qn),Pr=Te({inputRequests:jn.optional(),requestState:c().optional()}),Tr={inputResponses:Ln.optional(),requestState:c().optional()},ua=p({_meta:co,...Tr}),da=F({progressToken:r.optional()});function Be(ge,kr){return p({method:h(ge),params:p({_meta:co,...kr})})}function We(ge,kr){return p({method:h(ge),params:p({_meta:da.optional(),...kr}).optional()})}let Un={name:c(),arguments:P(c(),q()).optional(),...Tr},it={cursor:o.optional()},pa=Be("tools/call",Un),ha=Be("tools/list",it),ma=Be("prompts/list",it),fa=Be("prompts/get",{name:c(),arguments:P(c(),c()).optional(),...Tr}),ga=Be("resources/list",it),Sa=Be("resources/templates/list",it),_a=Be("resources/read",{uri:c(),...Tr}),Zn={ref:E([wr,zr]),argument:p({name:c(),value:c()}),context:p({arguments:P(c(),c()).optional()}).optional()},ba=Be("completion/complete",Zn),ya=Be("server/discover",{}),fo=p({toolsListChanged:T().optional(),promptsListChanged:T().optional(),resourcesListChanged:T().optional(),resourceSubscriptions:S(c()).optional()}),Dn={notifications:fo},va=Be("subscriptions/listen",Dn),za=po.extend({"io.modelcontextprotocol/subscriptionId":n}),Fn=F({_meta:za,resultType:uo.default("complete")}),er={"tools/call":We("tools/call",Un),"tools/list":We("tools/list",it),"prompts/get":We("prompts/get",{name:c(),arguments:P(c(),c()).optional()}),"prompts/list":We("prompts/list",it),"resources/list":We("resources/list",it),"resources/templates/list":We("resources/templates/list",it),"resources/read":We("resources/read",{uri:c()}),"completion/complete":We("completion/complete",Zn),"server/discover":We("server/discover",{}),"subscriptions/listen":We("subscriptions/listen",Dn)};function Le(ge){return F({_meta:ho,...ge})}let wa={"tools/call":Le({content:S(je),structuredContent:q().optional(),isError:T().optional()}),"tools/list":Le({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),tools:S(Rr),nextCursor:o.optional()}),"prompts/get":Le({description:c().optional(),messages:S(Qe)}),"prompts/list":Le({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),prompts:S(_t),nextCursor:o.optional()}),"resources/list":Le({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),resources:S(Xe),nextCursor:o.optional()}),"resources/templates/list":Le({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),resourceTemplates:S(St),nextCursor:o.optional()}),"resources/read":Le({ttlMs:z().int().min(0),cacheScope:K(["public","private"]),contents:S(E([Ce,gt]))}),"completion/complete":Le({completion:p({values:S(c()).max(100),total:z().int().optional(),hasMore:T().optional()}).loose()}),"server/discover":Le({ttlMs:z().int().min(0).catch(0),cacheScope:K(["public","private"]).catch("private"),supportedVersions:S(c()),capabilities:ao,instructions:c().optional()}),"subscriptions/listen":Le({})},Er=F({"io.modelcontextprotocol/subscriptionId":n.optional()}),go=p({method:h("notifications/subscriptions/acknowledged"),params:p({_meta:Er.optional(),notifications:fo})}),So=p({_meta:Er.optional(),requestId:n,reason:c().optional()}),_o=p({method:h("notifications/cancelled"),params:So}),Qc={"notifications/cancelled":_o,"notifications/progress":$e,"notifications/message":_e,"notifications/resources/updated":At,"notifications/resources/list_changed":He,"notifications/tools/list_changed":bt,"notifications/prompts/list_changed":Pe,"notifications/subscriptions/acknowledged":go},Ae=(ge)=>p({jsonrpc:h("2.0"),id:E([c(),z().int()]),result:ge}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:m,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:g,NotificationSchema:b,IconSchema:y,IconsSchema:v,BaseMetadataSchema:L,ImplementationSchema:H,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:w,ClientCapabilitiesSchema:D,ServerCapabilitiesSchema:X,ProgressSchema:Y,ProgressNotificationParamsSchema:ue,ProgressNotificationSchema:$e,LoggingMessageNotificationParamsSchema:ne,LoggingMessageNotificationSchema:_e,ResourceContentsSchema:ae,TextResourceContentsSchema:Ce,BlobResourceContentsSchema:gt,AnnotationsSchema:qe,ResourceSchema:Xe,ResourceTemplateSchema:St,ResourceListChangedNotificationSchema:He,ResourceUpdatedNotificationParamsSchema:Ie,ResourceUpdatedNotificationSchema:At,PromptArgumentSchema:Mt,PromptSchema:_t,PromptListChangedNotificationSchema:Pe,TextContentSchema:Oe,ImageContentSchema:Ne,AudioContentSchema:st,ToolUseContentSchema:br,EmbeddedResourceSchema:Ve,ResourceLinkSchema:Je,ContentBlockSchema:je,PromptMessageSchema:Qe,ToolAnnotationsSchema:et,ToolListChangedNotificationSchema:bt,ModelHintSchema:yt,ModelPreferencesSchema:Yt,ToolChoiceSchema:vt,BooleanSchemaSchema:yr,StringSchemaSchema:I,NumberSchemaSchema:zt,UntitledSingleSelectEnumSchemaSchema:V,TitledSingleSelectEnumSchemaSchema:M,LegacyTitledEnumSchemaSchema:G,SingleSelectEnumSchemaSchema:O,UntitledMultiSelectEnumSchemaSchema:C,TitledMultiSelectEnumSchemaSchema:W,MultiSelectEnumSchemaSchema:J,EnumSchemaSchema:be,PrimitiveSchemaDefinitionSchema:vr,ElicitRequestFormParamsSchema:wt,ResourceTemplateReferenceSchema:zr,PromptReferenceSchema:wr,RootSchema:gn,ClientCapabilities2026Schema:Sn,ServerCapabilities2026Schema:ao,RequestMetaEnvelopeSchema:co,ToolSchema:Rr,ToolResultContentSchema:_n,SamplingMessageContentBlockSchema:lo,SamplingMessageSchema:xr,ResultTypeSchema:uo,ResultMetaSchema:po,ResultSchema:bn,PaginatedResultSchema:ca,CallToolResultSchema:mo,ListToolsResultSchema:yn,ListPromptsResultSchema:vn,GetPromptResultSchema:zn,ListResourcesResultSchema:wn,ListResourceTemplatesResultSchema:Rn,ReadResourceResultSchema:xn,CompleteResultSchema:Pn,CacheableResultSchema:la,DiscoverResultSchema:Tn,CreateMessageRequestParamsSchema:Qt,CreateMessageRequestSchema:En,ListRootsRequestSchema:kn,CreateMessageResultSchema:$n,ListRootsResultSchema:Cn,ElicitResultSchema:In,ElicitRequestURLParamsSchema:On,ElicitRequestParamsSchema:Nn,ElicitRequestSchema:An,InputRequestSchema:Mn,InputResponseSchema:qn,InputRequestsSchema:jn,InputResponsesSchema:Ln,InputRequiredResultSchema:Pr,InputResponseRequestParamsSchema:ua,CallToolRequestSchema:pa,ListToolsRequestSchema:ha,ListPromptsRequestSchema:ma,GetPromptRequestSchema:fa,ListResourcesRequestSchema:ga,ListResourceTemplatesRequestSchema:Sa,ReadResourceRequestSchema:_a,CompleteRequestSchema:ba,DiscoverRequestSchema:ya,SubscriptionFilterSchema:fo,SubscriptionsListenRequestSchema:va,SubscriptionsListenResultMetaSchema:za,SubscriptionsListenResultSchema:Fn,dispatchRequestSchemas:er,dispatchResultSchemas:wa,NotificationMetaSchema:Er,SubscriptionsAcknowledgedNotificationSchema:go,CancelledNotificationParamsSchema:So,CancelledNotificationSchema:_o,notificationSchemas2026:Qc,JSONRPCResultResponseSchema:Ae(bn),CallToolResultResponseSchema:Ae(E([mo,Pr])),ListToolsResultResponseSchema:Ae(yn),ListPromptsResultResponseSchema:Ae(vn),GetPromptResultResponseSchema:Ae(E([zn,Pr])),ListResourcesResultResponseSchema:Ae(wn),ListResourceTemplatesResultResponseSchema:Ae(Rn),ReadResourceResultResponseSchema:Ae(E([xn,Pr])),CompleteResultResponseSchema:Ae(Pn),DiscoverResultResponseSchema:Ae(Tn),SubscriptionsListenResultResponseSchema:Ae(Fn)}}var ly;function pr(){return ly??=cy()}var uy=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function dy(e){return uy.includes(e)}var Eu=Symbol("modelcontextprotocol.resultCacheHintFallback");function py(e){return e[Eu]}function dg(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function pg(e){return e==="public"||e==="private"}var B=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}({}),re=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Ze(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 Ze(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",hr(this,new.target)}static fromError(t,r,o){if(t===B.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new mg(n.elicitations,r)}if(t===B.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new Hi({supported:n.supported,requested:n.requested},r)}if(t===B.InvalidParams||t===B.ResourceNotFound){let n=o;if(typeof n?.uri==="string"&&(t===B.ResourceNotFound||Object.keys(n).length===1))return new hg(n.uri,r)}if(t===B.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new fg({requiredCapabilities:n.requiredCapabilities},r)}return new e(t,r,o)}},hg=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(B.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},mg=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(B.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Hi=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(B.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},fg=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(B.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},hy=0,my="private",fy=["tools/call","prompts/get","resources/read"];function gy(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(fy.includes(e))return t;throw new re(B.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Sy(e,t){let r=py(t);if(t.resultType!=="complete"||!dy(e))return r===void 0?t:zy(t);let o=t,n=dg(o.ttlMs)?o.ttlMs:yy(r),s=pg(o.cacheScope)?o.cacheScope:vy(r),i={...o,ttlMs:n,cacheScope:s};return delete i[Eu],i}function _y(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function by(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[Pt]:t}};if(!_y(r))return e;if(r[Pt]!==void 0)return e;return{...e,_meta:{...r,[Pt]:t}}}function yy(e){return e!==void 0&&dg(e.ttlMs)?e.ttlMs:hy}function vy(e){return e!==void 0&&pg(e.cacheScope)?e.cacheScope:my}function zy(e){let t={...e};return delete t[Eu],t}var wy=["elicitation/create","sampling/createMessage","roots/list"],Rc;function gg(){if(Rc)return Rc;let e=pr();return Rc={request:{"elicitation/create":p({method:h("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":p({method:h("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":p({method:h("roots/list"),params:F({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Rc}function Sg(e){return wy.includes(e)}function hu(e){return Sg(e)?gg().request[e]:void 0}function Ry(e){return Sg(e)?gg().response[e]:void 0}var ku={"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},_g={"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 bg(e){return Object.prototype.hasOwnProperty.call(ku,e)}function yg(e){return Object.prototype.hasOwnProperty.call(_g,e)}function xy(e){return Object.prototype.hasOwnProperty.call(ku,e)}function Py(e){return bg(e)?pr().dispatchRequestSchemas[e]:void 0}function Ty(e){return xy(e)?pr().dispatchResultSchemas[e]:void 0}function Ey(e){return yg(e)?pr().notificationSchemas2026[e]:void 0}var oP=Object.keys(ku),nP=Object.keys(_g);function Ui(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ji(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var ky={ok:!1,reason:"not-in-era"},$y=[Ut,qr];function Cy(e,t){let r=t,o=!1,n=()=>{if(!o)r={...r},o=!0;return r},s=t.tools;if(e==="tools/list"&&Array.isArray(s)&&s.some((a)=>Ui(a)&&("execution"in a)))n().tools=s.map((a)=>{if(!Ui(a)||!("execution"in a))return a;let l={...a};return delete l.execution,l});let i=t.capabilities;if(Ui(i)&&"tasks"in i){let a={...i};delete a.tasks,n().capabilities=a}return r}var $u={era:"2026-07-28",hasRequestMethod:bg,hasNotificationMethod:yg,hasInputRequestMethod:(e)=>hu(e)!==void 0,validateRequest:(e,t)=>ji(Py(e),t),validateResult:(e,t)=>ji(Ty(e),t),validateNotification:(e,t)=>ji(Ey(e),t),validateInputRequest:(e,t)=>ji(hu(e),t),validateInputResponse:(e,t)=>ji(Ry(e),t),samplingResultVariant:()=>ky,outboundEnvelope(e){return{[Ut]:e.protocolVersion,[xo]:e.clientInfo,[qr]:e.clientCapabilities,...e.logLevel!==void 0&&{[To]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of $y)if(!(o in e))t.push({key:o,problem:"missing"});let r=pr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((i)=>i.key===s&&i.problem==="missing"))continue;t.push({key:s,problem:o.message})}return t},projectCallToolResult:(e)=>og(e),inputRequestSchema:hu,decodeResult(e,t){if(!Ui(t))return{kind:"invalid",error:new A(N.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new A(N.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 r!=="string")return{kind:"invalid",error:new A(N.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=Ui(i)?i:{},l=t.requestState,u=t._meta===void 0?void 0:pr().ResultMetaSchema.safeParse(t._meta),d=u?.success?u.data:void 0;if(Object.keys(a).length===0&&typeof l!=="string")return{kind:"invalid",error:new A(N.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:a,...typeof l==="string"&&{requestState:l},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new A(N.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Iy(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new A(N.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return by(Sy(e,gy(e,Cy(e,t))),r)},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=pr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},xc;function Iy(){if(xc)return xc;let e=pr();return xc={"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},xc}var kc="2026-07-28";function Jt(e){return e!==void 0&&Ct(e)?$u:Tu}function Jf(e){if(e.revision!==void 0)return Jt(e.revision).era;return e.era==="modern"?$u.era:Tu.era}function mu(e){return vg.some((t)=>t.hasRequestMethod(e))}function fu(e){return vg.some((t)=>t.hasNotificationMethod(e))}function Bf(e){return e==="tasks/get"||e==="tasks/cancel"}var vg=[Tu,$u],Oy=Ed({AnnotationsSchema:()=>Et,AudioContentSchema:()=>Hr,BaseMetadataSchema:()=>xt,BaseRequestParamsSchema:()=>ze,BlobResourceContentsSchema:()=>Do,BooleanSchemaSchema:()=>Jo,CallToolRequestParamsSchema:()=>Ys,CallToolRequestSchema:()=>Xs,CallToolResultSchema:()=>dr,CancelTaskRequestSchema:()=>pc,CancelTaskResultSchema:()=>hc,CancelledNotificationParamsSchema:()=>as,CancelledNotificationSchema:()=>No,ClientCapabilitiesSchema:()=>ls,ClientNotificationSchema:()=>fc,ClientRequestSchema:()=>mc,ClientResultSchema:()=>gc,ClientTasksCapabilitySchema:()=>ec,CompatibilityCallToolResultSchema:()=>rc,CompleteRequestParamsSchema:()=>xi,CompleteRequestSchema:()=>Pi,CompleteResultSchema:()=>Ti,ContentBlockSchema:()=>kt,CreateMessageRequestParamsSchema:()=>ui,CreateMessageRequestSchema:()=>di,CreateMessageResultSchema:()=>pi,CreateMessageResultWithToolsSchema:()=>hi,CreateTaskResultSchema:()=>nc,CursorSchema:()=>ko,DiscoverRequestSchema:()=>ps,DiscoverResultSchema:()=>lr,ElicitRequestFormParamsSchema:()=>Gr,ElicitRequestParamsSchema:()=>_i,ElicitRequestSchema:()=>bi,ElicitRequestURLParamsSchema:()=>Si,ElicitResultSchema:()=>zi,ElicitationCompleteNotificationParamsSchema:()=>yi,ElicitationCompleteNotificationSchema:()=>vi,EmbeddedResourceSchema:()=>Vr,EmptyResultSchema:()=>cr,EnumSchemaSchema:()=>gi,GetPromptRequestParamsSchema:()=>Zs,GetPromptRequestSchema:()=>Ds,GetPromptResultSchema:()=>Vs,GetTaskPayloadRequestSchema:()=>cc,GetTaskPayloadResultSchema:()=>lc,GetTaskRequestSchema:()=>ic,GetTaskResultSchema:()=>ac,IconSchema:()=>cs,IconsSchema:()=>Zt,ImageContentSchema:()=>Fr,ImplementationSchema:()=>Tt,InitializeRequestParamsSchema:()=>us,InitializeRequestSchema:()=>Ao,InitializeResultSchema:()=>ds,InitializedNotificationSchema:()=>qo,JSONArraySchema:()=>Xa,JSONObjectSchema:()=>de,JSONRPCErrorResponseSchema:()=>Ur,JSONRPCMessageSchema:()=>ut,JSONRPCNotificationSchema:()=>Oo,JSONRPCRequestSchema:()=>Io,JSONRPCResponseSchema:()=>Qa,JSONRPCResultResponseSchema:()=>Lr,JSONValueSchema:()=>Lt,LegacyTitledEnumSchemaSchema:()=>Ko,ListChangedOptionsBaseSchema:()=>ei,ListPromptsRequestSchema:()=>Ls,ListPromptsResultSchema:()=>Us,ListResourceTemplatesRequestSchema:()=>bs,ListResourceTemplatesResultSchema:()=>ys,ListResourcesRequestSchema:()=>Ss,ListResourcesResultSchema:()=>_s,ListRootsRequestSchema:()=>ki,ListRootsResultSchema:()=>$i,ListTasksRequestSchema:()=>uc,ListTasksResultSchema:()=>dc,ListToolsRequestSchema:()=>Ks,ListToolsResultSchema:()=>Gs,LoggingLevelSchema:()=>Vo,LoggingMessageNotificationParamsSchema:()=>oi,LoggingMessageNotificationSchema:()=>Br,ModelHintSchema:()=>ni,ModelPreferencesSchema:()=>si,MultiSelectEnumSchemaSchema:()=>fi,NotificationSchema:()=>xe,NotificationsParamsSchema:()=>ke,NumberSchemaSchema:()=>Kr,PaginatedRequestParamsSchema:()=>fs,PaginatedRequestSchema:()=>Dt,PaginatedResultSchema:()=>Ft,PingRequestSchema:()=>jo,PrimitiveSchemaDefinitionSchema:()=>Xo,ProgressNotificationParamsSchema:()=>ms,ProgressNotificationSchema:()=>Lo,ProgressSchema:()=>hs,ProgressTokenSchema:()=>Eo,PromptArgumentSchema:()=>qs,PromptListChangedNotificationSchema:()=>Js,PromptMessageSchema:()=>Hs,PromptReferenceSchema:()=>Ri,PromptSchema:()=>js,ReadResourceRequestParamsSchema:()=>vs,ReadResourceRequestSchema:()=>zs,ReadResourceResultSchema:()=>ws,RelatedTaskMetadataSchema:()=>is,RequestIdSchema:()=>lt,RequestMetaSchema:()=>$o,RequestSchema:()=>pe,ResourceContentsSchema:()=>Uo,ResourceLinkSchema:()=>Jr,ResourceListChangedNotificationSchema:()=>Rs,ResourceRequestParamsSchema:()=>Zr,ResourceSchema:()=>Fo,ResourceTemplateReferenceSchema:()=>wi,ResourceTemplateSchema:()=>gs,ResourceUpdatedNotificationParamsSchema:()=>As,ResourceUpdatedNotificationSchema:()=>Ms,ResultMetaObjectSchema:()=>Co,ResultSchema:()=>he,RoleSchema:()=>Ht,RootSchema:()=>Ei,RootsListChangedNotificationSchema:()=>Ci,SamplingContentSchema:()=>ci,SamplingMessageContentBlockSchema:()=>ir,SamplingMessageSchema:()=>li,ServerCapabilitiesSchema:()=>Mo,ServerNotificationSchema:()=>_c,ServerRequestSchema:()=>Sc,ServerResultSchema:()=>bc,ServerTasksCapabilitySchema:()=>tc,SetLevelRequestParamsSchema:()=>ti,SetLevelRequestSchema:()=>ri,SingleSelectEnumSchemaSchema:()=>mi,StringSchemaSchema:()=>Wr,SubscribeRequestParamsSchema:()=>xs,SubscribeRequestSchema:()=>Ps,SubscriptionFilterSchema:()=>Ho,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Cs,SubscriptionsAcknowledgedNotificationSchema:()=>Is,SubscriptionsListenRequestParamsSchema:()=>ks,SubscriptionsListenRequestSchema:()=>$s,SubscriptionsListenResultMetaSchema:()=>Os,SubscriptionsListenResultSchema:()=>Ns,TaskAugmentedRequestParamsSchema:()=>ar,TaskCreationParamsSchema:()=>oc,TaskMetadataSchema:()=>ss,TaskSchema:()=>Vt,TaskStatusNotificationParamsSchema:()=>Oi,TaskStatusNotificationSchema:()=>sc,TaskStatusSchema:()=>Ii,TextContentSchema:()=>Dr,TextResourceContentsSchema:()=>Zo,TitledMultiSelectEnumSchemaSchema:()=>Yo,TitledSingleSelectEnumSchemaSchema:()=>Wo,ToolAnnotationsSchema:()=>Bs,ToolChoiceSchema:()=>ii,ToolExecutionSchema:()=>Ws,ToolListChangedNotificationSchema:()=>Qs,ToolResultContentSchema:()=>ai,ToolSchema:()=>ur,ToolUseContentSchema:()=>Fs,UnsubscribeRequestParamsSchema:()=>Ts,UnsubscribeRequestSchema:()=>Es,UntitledMultiSelectEnumSchemaSchema:()=>Go,UntitledSingleSelectEnumSchemaSchema:()=>Bo});var fr=(e)=>Io.safeParse(e).success,zg=(e)=>Oo.safeParse(e).success,eo=(e)=>Lr.safeParse(e).success,to=(e)=>Ur.safeParse(e).success;var wg=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Cu=(e)=>Ao.safeParse(e).success,Rg=(e)=>qo.safeParse(e).success;var Ny="Mcp-Param-",Wf="x-mcp-header",Ay=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,My=new Set(["string","integer","boolean"]);function Iu(e){let t=[],r=new Map,o,n=(i,a,l)=>{if(i===null||typeof i!=="object")return;let u=i;if(Wf in u){if(!l||a.length===0)return`${Pc(a)}: 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[Wf];if(typeof m!=="string"||m.length===0)return`${Pc(a)}: x-mcp-header MUST be a non-empty string`;if(!Ay.test(m))return`${Pc(a)}: 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||!My.has(f)){let y=`${Pc(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${f??"<none>"}`;if(f!=="number")return y;o??=y}let g=m.toLowerCase(),b=r.get(g);if(b!==void 0)return`x-mcp-header '${m}' is not case-insensitively unique (also declared as '${b}')`;r.set(g,m),t.push({path:a,headerName:m,type:f})}let d=u.properties;if(d!==null&&typeof d==="object")for(let[m,f]of Object.entries(d)){let g=n(f,[...a,m],l);if(g!==void 0)return g}for(let m of qy){let f=u[m];if(f===void 0)continue;let g=Array.isArray(f)?f:f!==null&&typeof f==="object"&&jy.has(m)?Object.values(f):[f];for(let b of g){let y=n(b,[...a,`<${m}>`],!1);if(y!==void 0)return y}}},s=n(e,[],!0);if(s!==void 0)return{valid:!1,reason:o??s};return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var qy=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],jy=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Pc(e){return e.length===0?"<root>":e.join(".")}var xg="=?base64?",Pg="?=";function Ly(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 Uy(e){if(e.length===0)return!0;if(e.startsWith(xg)&&e.endsWith(Pg))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r===9||r>=32&&r<=126)continue;return!0}return!1}function Zy(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function Ou(e){return Uy(e)?`${xg}${Zy(e)}${Pg}`:e}function Dy(e,t){let r=e;for(let o of t){if(r===null||typeof r!=="object")return;r=r[o]}return r}function Tg(e,t){let r={};for(let o of e){let n=Dy(t,o.path);if(n===void 0||n===null)continue;let s=Ly(n);if(s===void 0)continue;r[`${Ny}${o.headerName}`]=Ou(s)}return r}var rn=-32020,sP=[{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:[B.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:[rn,B.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:[B.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:[B.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:[B.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:[rn],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:[B.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:[rn],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."}],iP={[B.ParseError]:400,[B.InvalidRequest]:400,[B.MethodNotFound]:404,[B.UnsupportedProtocolVersion]:400,[B.MissingRequiredClientCapability]:400,[rn]:400},Kf={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function Eg(e,t){let r=Object.hasOwn(Kf,e)?Kf[e]:void 0;if(r===void 0)return;let o=Fy(t)?t[r]:void 0;return{field:r,value:typeof o==="string"?o:void 0}}function Fy(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function $c(e,t){return Va(e,t)}function Li(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function bu(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 Gf=!1,yu="draft-2020-12";function Hy(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:yu});else if(r.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(!Gf)Gf=!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.");o=Fa(e,{target:yu,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return kg(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var Vy=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function kg(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref==="string"&&Vy.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let n=e[o];if(Array.isArray(n)&&n.length>0)return n.every((s)=>s!==null&&typeof s==="object"&&(s.type==="object"||kg(s,"$id"in s?{}:t)))}return!1}function Jy(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 gu(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>Jy(o)).join(", ")};return{success:!0,data:r.value}}function By(e){let t=Fa(e,{target:yu,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Wy=/\\\.\\d\{(\d+)\}/;function Ky(e){let t=Wy.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((n)=>r.map((s)=>wo({local:o,offset:n,precision:s}))))}function Gy(e,t){let r;switch(e){case"email":r=[bf()];break;case"uri":r=[Ba()];break;case"date":r=[au()];break;case"date-time":r=Ky(t);break}return new Set(r.map((o)=>By(o)).filter((o)=>o!==void 0))}function Yy(e,t,r){if(r!=="zod")return!0;return Gy(e,t).has(t)}function Di(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Xy(e){try{return Hy(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new re(B.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Qy=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Nu(e){return Qy.has(e)||e.startsWith("x-")}var ev=new Set(["$schema",...Object.keys(Gr.shape.requestedSchema.shape)]),Yf={string:Li([Wr,Bo,Wo,Ko]),number:Li([Kr]),integer:Li([Kr]),boolean:Li([Jo]),array:Li([Go,Yo])},tv=new Set(Wr.shape.format.unwrap().options);function rv(e,t,r,o){if(!Di(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(Yf,e.type)?Yf[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(n.has(i)||Nu(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!tv.has(e.format))s[i]=a;else if(typeof a!=="string"||!Yy(e.format,a,r))o.push(`${t}.${i}`)}else o.push(`${t}.${i}`);return s}function ov(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))if(n==="properties"&&Di(s))r[n]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,rv(a,`properties.${i}`,t,o)]));else if(ev.has(n))r[n]=s;else if(!Nu(n))o.push(n);if(o.length>0)throw new re(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function nv(e,t){if(!Di(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!$c(Xo,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function vu(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,n)=>vu(o,t[n],`${r}[${n}]`));if(!Di(e)||!Di(t))return[];return Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return Nu(o)?[]:[s];return vu(n,t[o],s)})}function sv(e){if(!bu(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=ov(Xy(e.requestedSchema),t),o=$c(Gr.shape.requestedSchema,r);if(!o.success)throw new re(B.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${nv(r,o.error.message)}`);let n=vu(r,o.data);if(n.length>0)throw new re(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new re(B.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function iv(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)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 aP=Object.assign(iv,{elicit(e){try{return{method:"elicitation/create",params:sv(e)}}catch(t){throw t instanceof re?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 av=!0,cv=10,lv=250;function $g(e){return{autoFulfill:e?.autoFulfill??av,maxRounds:e?.maxRounds??cv}}function uv(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;if(!o&&r===void 0)return e;return{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function dv(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function pv(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof A?t.reason:new A(N.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof A?t.reason:new A(N.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function hv(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function mv(e){let{config:t,method:r,originalParams:o,requestOptions:n,hooks:s,signal:i}=e,a=e.flowStartedAt??Date.now(),l=e.firstPayload,u=0;while(!0){if(u+=1,u>t.maxRounds)throw new A(N.InputRequiredRoundsExceeded,dv(r,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 '${r}' (round ${u})`});let d=Object.entries(l.inputRequests??{}),m;if(d.length>0){let b=hv(i);try{let y=await Promise.all(d.map(async([v,L])=>{try{return[v,await s.dispatchInputRequest(v,L,b.signal)]}catch(H){throw b.abort(H),H}}));m=Object.fromEntries(y)}finally{b.dispose()}}else await pv(lv,i);let f={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let b=Date.now()-a,y=n.maxTotalTimeout-b;if(y<=0)throw new A(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:b});f.maxTotalTimeout=y}let g=await s.retry(uv(o,m,l.requestState),f);if(wg(g)){l={inputRequests:g.inputRequests??{},...g.requestState!==void 0&&{requestState:g.requestState}};continue}return g}}var fv=["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"],gv={IdJagTokenExchangeResponseSchema:Ai,OAuthClientInformationFullSchema:tn,OAuthClientInformationSchema:qi,OAuthClientMetadataSchema:Mi,OAuthClientRegistrationErrorSchema:yc,OAuthErrorResponseSchema:Qr,OAuthMetadataSchema:Yr,OAuthProtectedResourceMetadataSchema:Qo,OAuthTokenRevocationRequestSchema:vc,OAuthTokensSchema:Xr,OpenIdProviderDiscoveryMetadataSchema:en,OpenIdProviderMetadataSchema:Ni},Cg={},Ig={};function Og(e,t){let r=e.slice(0,-6);Cg[r]=t,Ig[r]=(o)=>t.safeParse(o).success}for(let e of fv)Og(e,Oy[e]);for(let[e,t]of Object.entries(gv))Og(e,t);var Sv=Object.freeze(Cg),Au=Object.freeze(Ig);function _v(e){switch(e){case"initialize":case"notifications/initialized":return Jt(void 0);case"server/discover":return Jt(kc);default:return}}var Vi=60000,bv=[Ut,xo,qr,To],yv=["inputResponses","requestState"];function Xf(e,t){let r=e.params;if(!Zi(r))return{message:e,lifted:{}};let o=r._meta,n=Zi(o)?bv.filter((l)=>(l in o)):[],s=t==="request"?yv.filter((l)=>(l in r)):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(n.length>0&&Zi(o)){let l={},u={...o};for(let d of n)l[d]=o[d],delete u[d];if(i.envelope=l,Object.keys(u).length>0)a._meta=u;else delete a._meta}for(let l of s){if(l==="inputResponses")i.inputResponses=a[l];if(l==="requestState")i.requestState=a[l];delete a[l]}return{message:{...e,params:a},lifted:i}}function Qf(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function Mu(e){return()=>e}var vv=Mu(void 0),zv,Ji=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{zv=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ga,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 r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new A(N.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,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new A(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),eo(n)||to(n))this._onresponse(n);else if(fr(n))this._onrequest(n,s);else if(zg(n))this._onnotification(n,s);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 o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new A(N.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=Xf(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=Jf(t.classification);if(i!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(fu(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;if(n===void 0&&s===void 0)return;Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=Xf(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 s=this._transport,i=(y,v,L)=>{let H={jsonrpc:"2.0",id:r.id,error:{code:y,message:v,...L!==void 0&&{data:L}}};s?.send(H).catch((x)=>this._onerror(Error(`Failed to send an error response: ${x}`)))};if(t?.classification!==void 0){let y=Jf(t.classification);if(y!==n.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${y} but this instance serves ${n.era}`));let v=t.classification.revision??y;i(B.UnsupportedProtocolVersion,`Unsupported protocol version: ${v}`,{supported:this._supportedProtocolVersions,requested:v});return}}if(mu(r.method)&&!n.hasRequestMethod(r.method)&&!(Bf(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(B.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(B.MethodNotFound,"Method not found");return}let l=n.checkInboundEnvelope(o);if(l!==void 0){i(B.InvalidParams,l);return}let u=(y,v)=>this._notificationViaCodec(this._resolveOutboundCodec(y.method),y,{...v,relatedRequestId:r.id}),d=(y,v,L)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(y.method),y,v,{...L,relatedRequestId:r.id}),m=new AbortController;this._requestHandlerAbortControllers.set(r.id,m);let f=o.inputResponses===void 0?void 0:wv(o.inputResponses),g={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:o.requestState===void 0?vv:Mu(o.requestState),signal:m.signal,send:(y,v,L)=>{let H=this._resolveOutboundCodec(y.method);if(this._assertOutboundRequestInEra(H,y.method),bu(v))return d(y,v,L);let x=Qf(H,y.method);if(x===void 0)throw TypeError(`'${y.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(y,x,v)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},b=this.buildContext(g,t);Promise.resolve().then(()=>a(r,b)).then(async(y)=>{if(m.signal.aborted)return;let v;try{v=n.encodeResult(r.method,y,this._outboundServerInfo())}catch(H){this._onerror(Error(`Failed to encode result for ${r.method}: ${H}`)),i(B.InternalError,"Internal error");return}let L={result:v,jsonrpc:"2.0",id:r.id};await s?.send(L)},async(y)=>{if(m.signal.aborted)return;let v=Number.isSafeInteger(y.code)?y.code:B.InternalError,L={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(v),message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};await s?.send(L)}).catch((y)=>this._onerror(Error(`Failed to send response: ${y}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===m)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===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),eo(e))r(e);else r(re.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(bu(t)){if(!Bf(e.method))this._assertOutboundRequestInEra(o,e.method);return this._requestWithSchemaViaCodec(o,e,t,r)}this._assertOutboundRequestInEra(o,e.method);let n=Qf(o,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(o,e,n,t)}_negotiatedWireCodec(){return Jt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=_v(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(mu(t)&&!e.hasRequestMethod(t))throw new A(N.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a}=o??{},l=Date.now(),u,d;return new Promise((m,f)=>{let g=(w)=>{f(w)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(w){g(w);return}if(o?.signal?.aborted){let w=o.signal.reason;throw w instanceof A?w:new A(N.RequestTimeout,String(w))}let b=e.era===kc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,y=this._requestMessageId++;d=y;let v={...t,jsonrpc:"2.0",id:y};if(o?.onprogress)this._progressHandlers.set(y,o.onprogress),v.params={...t.params,_meta:{...t.params?._meta,progressToken:y}};let L=this._envelopeOutbound(v),H=!1,x=(w)=>{if(H)return;if(this._progressHandlers.delete(y),b===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,reason:String(w)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch((D)=>this._onerror(Error(`Failed to send cancellation: ${D}`)))}else b.abort();f(w instanceof A?w:new A(N.RequestTimeout,String(w)))};this._responseHandlers.set(y,(w)=>{if(o?.signal?.aborted)return;if(H=!0,w instanceof Error)return f(w);let D;try{D=e.decodeResult(t.method,w.result)}catch(Y){return f(Y instanceof Error?Y:Error(String(Y)))}if(D.kind==="invalid")return f(D.error);if(D.kind==="input_required"){if(o?.allowInputRequired===!0)return m(Tv(D));let Y={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:l,retry:(ue,$e)=>this._requestWithSchemaViaCodec(e,ue===void 0?{method:t.method}:{method:t.method,params:ue},r,$e)};return m(this._resolveNonCompleteResult(D,Y))}let X=D.result;gu(r,X).then((Y)=>{if(Y.success)m(Y.data);else f(new A(N.InvalidResult,`Invalid result for ${t.method}: ${Y.error}`))},f)}),u=()=>x(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let Z=o?.timeout??Vi,R=()=>x(new A(N.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(y,Z,o?.maxTotalTimeout,R,o?.resetTimeoutOnProgress??!1),this._transport.send(L,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:b?.signal}).catch((w)=>{this._progressHandlers.delete(y),f(w)})}).finally(()=>{if(u)o?.signal?.removeEventListener("abort",u);if(d!==void 0)this._responseHandlers.delete(d),this._cleanupTimeout(d)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new A(N.NotConnected,"Not connected");if(fu(t.method)&&!e.hasNotificationMethod(t.method))throw new A(N.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 o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.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(o,r).catch((n)=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!mu(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,n);if(!a.ok){if(a.reason==="not-in-era")throw new re(B.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,s))}}else if(r)o=async(n,s)=>{let i=await gu(t.params,{...n.params});if(!i.success)throw new re(B.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};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,o))}_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,r){if(typeof t==="function"){if(!fu(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok){if(s.reason==="not-in-era")throw new re(B.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let n=await gu(t.params,{...o.params});if(!n.success)throw new re(B.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Zi(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function qu(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Zi(i)&&Zi(s)?{...i,...s}:s}return r}function Tc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function wv(e){let t={},r=[];if(!Tc(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!Tc(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function eg(e){throw new A(N.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 Rv(e,t,r,o,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:Mu(void 0),signal:o,send:()=>eg("send"),notify:()=>eg("notify")}}}async function xv(e,t,r,o,n){if(!Tc(o)||typeof o.method!=="string")throw new A(N.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let s=o.method;if(!t.hasInputRequestMethod(s))throw new A(N.InvalidResult,`Invalid input request '${r}': '${s}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:s});let i=e.getRequestHandler(s);if(i===void 0)throw new A(N.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${s}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:s});let a=Tc(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:s,...a!==void 0&&{params:a}},e.buildContext(Rv(r,s,a,n,e.sessionId)))}function Pv(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 Ng(e,t,r,o){let{codec:n,request:s,options:i,flowStartedAt:a}=o,l={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},u={dispatchInputRequest:(d,m,f)=>xv(e,n,d,m,f),retry:(d,m)=>o.retry(d,Pv(i,m))};return mv({config:t,method:s.method,originalParams:s.params,firstPayload:l,flowStartedAt:a,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:u})}function Tv(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let i=a[1];if(t===a[0]){n(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(i.cycle){n(a);continue}if(i.count>1){if(e.reused==="ref"){n(a);continue}}}}function Sn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(i)=>{let u=e.seen.get(i);if(u.ref===null)return;let l=u.def??u.schema,d={...l},f=u.ref;if(u.ref=null,f){o(f);let g=e.seen.get(f),b=g.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(b);else Object.assign(l,b);if(Object.assign(l,d),i._zod.parent===f)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(!(w in d))delete l[w]}if(b.$ref&&g.def)for(let w in l){if(w==="$ref"||w==="allOf")continue;if(w in g.def&&JSON.stringify(l[w])===JSON.stringify(g.def[w]))delete l[w]}}let h=i._zod.parent;if(h&&h!==f){o(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let b in l){if(b==="$ref"||b==="allOf")continue;if(b in g.def&&JSON.stringify(l[b])===JSON.stringify(g.def[b]))delete l[b]}}}e.override({zodSchema:i,jsonSchema:l,path:u.path??[]})};for(let i of[...e.seen.entries()].reverse())o(i[0]);let s={};if(e.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");s.$id=e.external.uri(i)}Object.assign(s,r.def??r.schema);let n=e.metadataRegistry.get(t)?.id;if(n!==void 0&&s.id===n)delete s.id;let a=e.external?.defs??{};for(let i of e.seen.entries()){let u=i[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;a[u.defId]=u.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")s.$defs=a;else s.definitions=a;try{let i=JSON.parse(JSON.stringify(s));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:fn(t,"input",e.processors),output:fn(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function He(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return He(o.element,r);if(o.type==="set")return He(o.valueType,r);if(o.type==="lazy")return He(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return He(o.innerType,r);if(o.type==="intersection")return He(o.left,r)||He(o.right,r);if(o.type==="record"||o.type==="map")return He(o.keyType,r)||He(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return He(o.in,r)||He(o.out,r)}if(o.type==="object"){for(let s in o.shape)if(He(o.shape[s],r))return!0;return!1}if(o.type==="union"){for(let s of o.options)if(He(s,r))return!0;return!1}if(o.type==="tuple"){for(let s of o.items)if(He(s,r))return!0;if(o.rest&&He(o.rest,r))return!0;return!1}return!1}var kf=(e,t={})=>(r)=>{let o=_n({...r,processors:t});return ce(e,o),gn(o,e),Sn(o,e)},fn=(e,t,r={})=>(o)=>{let{libraryOptions:s,target:n}=o??{},a=_n({...s??{},target:n,io:t,processors:r});return ce(e,a),gn(a,e),Sn(a,e)};var Ib={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dl=(e,t,r,o)=>{let s=r;s.type="string";let{minimum:n,maximum:a,format:i,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof n==="number")s.minLength=n;if(typeof a==="number")s.maxLength=a;if(i){if(s.format=Ib[i]??i,s.format==="")delete s.format;if(i==="time")delete s.format}if(l)s.contentEncoding=l;if(u&&u.size>0){let d=[...u];if(d.length===1)s.pattern=d[0].source;else if(d.length>1)s.allOf=[...d.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},ml=(e,t,r,o)=>{let s=r,{minimum:n,maximum:a,format:i,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;if(typeof i==="string"&&i.includes("int"))s.type="integer";else s.type="number";let f=typeof d==="number"&&d>=(n??Number.NEGATIVE_INFINITY),h=typeof l==="number"&&l<=(a??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(g)s.minimum=d,s.exclusiveMinimum=!0;else s.exclusiveMinimum=d;else if(typeof n==="number")s.minimum=n;if(h)if(g)s.maximum=l,s.exclusiveMaximum=!0;else s.exclusiveMaximum=l;else if(typeof a==="number")s.maximum=a;if(typeof u==="number")s.multipleOf=u},pl=(e,t,r,o)=>{r.type="boolean"},Tf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Ef=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},hl=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},fl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},$f=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},_l=(e,t,r,o)=>{r.not={}},gl=(e,t,r,o)=>{},Sl=(e,t,r,o)=>{},Cf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},vl=(e,t,r,o)=>{let s=e._zod.def,n=Vi(s.entries);if(n.every((a)=>typeof a==="number"))r.type="number";if(n.every((a)=>typeof a==="string"))r.type="string";r.enum=n},bl=(e,t,r,o)=>{let s=e._zod.def,n=[];for(let a of s.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else n.push(Number(a));else n.push(a);if(n.length===0);else if(n.length===1){let a=n[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(n.every((a)=>typeof a==="number"))r.type="number";if(n.every((a)=>typeof a==="string"))r.type="string";if(n.every((a)=>typeof a==="boolean"))r.type="boolean";if(n.every((a)=>a===null))r.type="null";r.enum=n}},If=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},qf=(e,t,r,o)=>{let s=r,n=e._zod.pattern;if(!n)throw Error("Pattern not found in template literal");s.type="string",s.pattern=n.source},Of=(e,t,r,o)=>{let s=r,n={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:i,mime:u}=e._zod.bag;if(a!==void 0)n.minLength=a;if(i!==void 0)n.maxLength=i;if(u)if(u.length===1)n.contentMediaType=u[0],Object.assign(s,n);else Object.assign(s,n),s.anyOf=u.map((l)=>({contentMediaType:l}));else Object.assign(s,n)},Nf=(e,t,r,o)=>{r.type="boolean"},yl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},jf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},wl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Mf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Af=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},zl=(e,t,r,o)=>{let s=r,n=e._zod.def,{minimum:a,maximum:i}=e._zod.bag;if(typeof a==="number")s.minItems=a;if(typeof i==="number")s.maxItems=i;s.type="array",s.items=ce(n.element,t,{...o,path:[...o.path,"items"]})},Rl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object",s.properties={};let a=n.shape;for(let l in a)s.properties[l]=ce(a[l],t,{...o,path:[...o.path,"properties",l]});let i=new Set(Object.keys(a)),u=new Set([...i].filter((l)=>{let d=n.shape[l]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(u.size>0)s.required=Array.from(u);if(n.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!n.catchall){if(t.io==="output")s.additionalProperties=!1}else if(n.catchall)s.additionalProperties=ce(n.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},xl=(e,t,r,o)=>{let s=e._zod.def,n=s.inclusive===!1,a=s.options.map((i,u)=>ce(i,t,{...o,path:[...o.path,n?"oneOf":"anyOf",u]}));if(n)r.oneOf=a;else r.anyOf=a},kl=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.left,t,{...o,path:[...o.path,"allOf",0]}),a=ce(s.right,t,{...o,path:[...o.path,"allOf",1]}),i=(l)=>("allOf"in l)&&Object.keys(l).length===1,u=[...i(n)?n.allOf:[n],...i(a)?a.allOf:[a]];r.allOf=u},Lf=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",i=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",u=n.items.map((h,g)=>ce(h,t,{...o,path:[...o.path,a,g]})),l=n.rest?ce(n.rest,t,{...o,path:[...o.path,i,...t.target==="openapi-3.0"?[n.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(s.prefixItems=u,l)s.items=l}else if(t.target==="openapi-3.0"){if(s.items={anyOf:u},l)s.items.anyOf.push(l);if(s.minItems=u.length,!l)s.maxItems=u.length}else if(s.items=u,l)s.additionalItems=l;let{minimum:d,maximum:f}=e._zod.bag;if(typeof d==="number")s.minItems=d;if(typeof f==="number")s.maxItems=f},Pl=(e,t,r,o)=>{let s=r,n=e._zod.def;s.type="object";let a=n.keyType,u=a._zod.bag?.patterns;if(n.mode==="loose"&&u&&u.size>0){let d=ce(n.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(let f of u)s.patternProperties[f.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")s.propertyNames=ce(n.keyType,t,{...o,path:[...o.path,"propertyNames"]});s.additionalProperties=ce(n.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let l=a._zod.values;if(l){let d=[...l].filter((f)=>typeof f==="string"||typeof f==="number");if(d.length>0)s.required=d}},Tl=(e,t,r,o)=>{let s=e._zod.def,n=ce(s.innerType,t,o),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=s.innerType,r.nullable=!0;else r.anyOf=[n,{type:"null"}]},El=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},$l=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},Cl=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);if(n.ref=s.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(s.defaultValue))},Il=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType;let a;try{a=s.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},ql=(e,t,r,o)=>{let s=e._zod.def,n=s.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?n?s.out:s.in:s.out;ce(a,t,o);let i=t.seen.get(e);i.ref=a},Ol=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType,r.readOnly=!0},Uf=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},ac=(e,t,r,o)=>{let s=e._zod.def;ce(s.innerType,t,o);let n=t.seen.get(e);n.ref=s.innerType},Nl=(e,t,r,o)=>{let s=e._zod.innerType;ce(s,t,o);let n=t.seen.get(e);n.ref=s},Pf={string:dl,number:ml,boolean:pl,bigint:Tf,symbol:Ef,null:hl,undefined:fl,void:$f,never:_l,any:gl,unknown:Sl,date:Cf,enum:vl,literal:bl,nan:If,template_literal:qf,file:Of,success:Nf,custom:yl,function:jf,transform:wl,map:Mf,set:Af,array:zl,object:Rl,union:xl,intersection:kl,tuple:Lf,record:Pl,nullable:Tl,nonoptional:El,default:$l,prefault:Cl,catch:Il,pipe:ql,readonly:Ol,promise:Uf,optional:ac,lazy:Nl};function ic(e,t){if("_idmap"in e){let o=e,s=_n({...t,processors:Pf}),n={};for(let u of o._idmap.entries()){let[l,d]=u;ce(d,s)}let a={},i={registry:o,uri:t?.uri,defs:n};s.external=i;for(let u of o._idmap.entries()){let[l,d]=u;gn(s,d),a[l]=Sn(s,d)}if(Object.keys(n).length>0){let u=s.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:n}}return{schemas:a}}let r=_n({...t,processors:Pf});return ce(e,r),gn(r,e),Sn(r,e)}var Ub=y("ZodISODateTime",(e,t)=>{eh.init(e,t),he.init(e,t)});function Ao(e){return lf(Ub,e)}var Db=y("ZodISODate",(e,t)=>{th.init(e,t),he.init(e,t)});function jl(e){return df(Db,e)}var Zb=y("ZodISOTime",(e,t)=>{rh.init(e,t),he.init(e,t)});function Df(e){return mf(Zb,e)}var Hb=y("ZodISODuration",(e,t)=>{oh.init(e,t),he.init(e,t)});function Zf(e){return pf(Hb,e)}var Fb=(e,t)=>{Ki.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Au(e,r)},flatten:{value:(r)=>Mu(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,an,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,an,2)}},isEmpty:{get(){return e.issues.length===0}}})};var tt=y("ZodError",Fb,{Parent:Error});var Ff=Gi(tt),Vf=Yi(tt),uc=un(tt),Bf=ln(tt),Jf=Mm(tt),Wf=Am(tt),Kf=Lm(tt),Gf=Um(tt),Yf=Dm(tt),Xf=Zm(tt),Qf=Hm(tt),e_=Fm(tt);var t_=new WeakMap;function vn(e,t,r){let o=Object.getPrototypeOf(e),s=t_.get(o);if(!s)s=new Set,t_.set(o,s);if(s.has(t))return;s.add(t);for(let n in r){let a=r[n];Object.defineProperty(o,n,{configurable:!0,enumerable:!1,get(){let i=a.bind(this);return Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:i}),i},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:!0,value:i})}})}}var ue=y("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fn(e,"input"),output:fn(e,"output")}}),e.toJSONSchema=kf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Ff(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>uc(e,r,o),e.parseAsync=async(r,o)=>Vf(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Bf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Jf(e,r,o),e.decode=(r,o)=>Wf(e,r,o),e.encodeAsync=async(r,o)=>Kf(e,r,o),e.decodeAsync=async(r,o)=>Gf(e,r,o),e.safeEncode=(r,o)=>Yf(e,r,o),e.safeDecode=(r,o)=>Xf(e,r,o),e.safeEncodeAsync=async(r,o)=>Qf(e,r,o),e.safeDecodeAsync=async(r,o)=>e_(e,r,o),vn(e,"ZodType",{check(...r){let o=this.def;return this.clone(ir(o,{checks:[...o.checks??[],...r.map((s)=>typeof s==="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return pt(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(qy(r,o))},superRefine(r,o){return this.check(Oy(r,o))},overwrite(r){return this.check(dr(r))},optional(){return F(this)},exactOptional(){return vy(this)},nullable(){return n_(this)},nullish(){return F(n_(this))},nonoptional(r){return xy(this,r)},array(){return v(this)},or(r){return C([this,r])},and(r){return Ft(this,r)},transform(r){return a_(this,f_(r))},default(r){return wy(this,r)},prefault(r){return Ry(this,r)},catch(r){return Py(this,r)},pipe(r){return a_(this,r)},readonly(){return $y(this)},describe(r){let o=this.clone();return lr.add(o,{description:r}),o},meta(...r){if(r.length===0)return lr.get(this);let o=this.clone();return lr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return lr.get(e)?.description},configurable:!0}),e)),i_=y("_ZodString",(e,t)=>{ec.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>dl(e,o,s,n);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,vn(e,"_ZodString",{regex(...o){return this.check(el(...o))},includes(...o){return this.check(ol(...o))},startsWith(...o){return this.check(sl(...o))},endsWith(...o){return this.check(nl(...o))},min(...o){return this.check(jo(...o))},max(...o){return this.check(sc(...o))},length(...o){return this.check(nc(...o))},nonempty(...o){return this.check(jo(1,...o))},lowercase(o){return this.check(tl(o))},uppercase(o){return this.check(rl(o))},trim(){return this.check(il())},normalize(...o){return this.check(al(...o))},toLowerCase(){return this.check(cl())},toUpperCase(){return this.check(ul())},slugify(){return this.check(ll())}})}),c_=y("ZodString",(e,t)=>{ec.init(e,t),i_.init(e,t),e.email=(r)=>e.check(Yu(u_,r)),e.url=(r)=>e.check(Qu(d_,r)),e.jwt=(r)=>e.check(uf(ay,r)),e.emoji=(r)=>e.check(Wh(Bb,r)),e.guid=(r)=>e.check(Xu(r_,r)),e.uuid=(r)=>e.check(Fh(lc,r)),e.uuidv4=(r)=>e.check(Vh(lc,r)),e.uuidv6=(r)=>e.check(Bh(lc,r)),e.uuidv7=(r)=>e.check(Jh(lc,r)),e.nanoid=(r)=>e.check(Kh(Jb,r)),e.guid=(r)=>e.check(Xu(r_,r)),e.cuid=(r)=>e.check(Gh(Wb,r)),e.cuid2=(r)=>e.check(Yh(Kb,r)),e.ulid=(r)=>e.check(Xh(Gb,r)),e.base64=(r)=>e.check(nf(oy,r)),e.base64url=(r)=>e.check(af(sy,r)),e.xid=(r)=>e.check(Qh(Yb,r)),e.ksuid=(r)=>e.check(ef(Xb,r)),e.ipv4=(r)=>e.check(tf(Qb,r)),e.ipv6=(r)=>e.check(rf(ey,r)),e.cidrv4=(r)=>e.check(of(ty,r)),e.cidrv6=(r)=>e.check(sf(ry,r)),e.e164=(r)=>e.check(cf(ny,r)),e.datetime=(r)=>e.check(Ao(r)),e.date=(r)=>e.check(jl(r)),e.time=(r)=>e.check(Df(r)),e.duration=(r)=>e.check(Zf(r))});function c(e){return Hh(c_,e)}var he=y("ZodStringFormat",(e,t)=>{me.init(e,t),i_.init(e,t)}),u_=y("ZodEmail",(e,t)=>{Vp.init(e,t),he.init(e,t)});function l_(e){return Yu(u_,e)}var r_=y("ZodGUID",(e,t)=>{Hp.init(e,t),he.init(e,t)});var lc=y("ZodUUID",(e,t)=>{Fp.init(e,t),he.init(e,t)});var d_=y("ZodURL",(e,t)=>{Bp.init(e,t),he.init(e,t)});function dc(e){return Qu(d_,e)}var Bb=y("ZodEmoji",(e,t)=>{Jp.init(e,t),he.init(e,t)});var Jb=y("ZodNanoID",(e,t)=>{Wp.init(e,t),he.init(e,t)});var Wb=y("ZodCUID",(e,t)=>{Kp.init(e,t),he.init(e,t)});var Kb=y("ZodCUID2",(e,t)=>{Gp.init(e,t),he.init(e,t)});var Gb=y("ZodULID",(e,t)=>{Yp.init(e,t),he.init(e,t)});var Yb=y("ZodXID",(e,t)=>{Xp.init(e,t),he.init(e,t)});var Xb=y("ZodKSUID",(e,t)=>{Qp.init(e,t),he.init(e,t)});var Qb=y("ZodIPv4",(e,t)=>{sh.init(e,t),he.init(e,t)});var ey=y("ZodIPv6",(e,t)=>{nh.init(e,t),he.init(e,t)});var ty=y("ZodCIDRv4",(e,t)=>{ah.init(e,t),he.init(e,t)});var ry=y("ZodCIDRv6",(e,t)=>{ih.init(e,t),he.init(e,t)});var oy=y("ZodBase64",(e,t)=>{uh.init(e,t),he.init(e,t)});var sy=y("ZodBase64URL",(e,t)=>{lh.init(e,t),he.init(e,t)});var ny=y("ZodE164",(e,t)=>{dh.init(e,t),he.init(e,t)});var ay=y("ZodJWT",(e,t)=>{mh.init(e,t),he.init(e,t)});var mc=y("ZodNumber",(e,t)=>{Bu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>ml(e,o,s,n),vn(e,"ZodNumber",{gt(o,s){return this.check(rc(o,s))},gte(o,s){return this.check(hn(o,s))},min(o,s){return this.check(hn(o,s))},lt(o,s){return this.check(tc(o,s))},lte(o,s){return this.check(pn(o,s))},max(o,s){return this.check(pn(o,s))},int(o){return this.check(o_(o))},safe(o){return this.check(o_(o))},positive(o){return this.check(rc(0,o))},nonnegative(o){return this.check(hn(0,o))},negative(o){return this.check(tc(0,o))},nonpositive(o){return this.check(pn(0,o))},multipleOf(o,s){return this.check(oc(o,s))},step(o,s){return this.check(oc(o,s))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function k(e){return hf(mc,e)}var iy=y("ZodNumberFormat",(e,t)=>{ph.init(e,t),mc.init(e,t)});function o_(e){return _f(iy,e)}var m_=y("ZodBoolean",(e,t)=>{hh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>pl(e,r,o,s)});function E(e){return gf(m_,e)}var cy=y("ZodUndefined",(e,t)=>{fh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fl(e,r,o,s)});function Al(e){return Sf(cy,e)}var uy=y("ZodNull",(e,t)=>{_h.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>hl(e,r,o,s)});function Br(e){return vf(uy,e)}var ly=y("ZodAny",(e,t)=>{gh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>gl(e,r,o,s)});function pc(){return bf(ly)}var dy=y("ZodUnknown",(e,t)=>{Sh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Sl(e,r,o,s)});function D(){return yf(dy)}var my=y("ZodNever",(e,t)=>{vh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>_l(e,r,o,s)});function Ll(e){return wf(my,e)}var py=y("ZodArray",(e,t)=>{bh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>zl(e,r,o,s),e.element=t.element,vn(e,"ZodArray",{min(r,o){return this.check(jo(r,o))},nonempty(r){return this.check(jo(1,r))},max(r,o){return this.check(sc(r,o))},length(r,o){return this.check(nc(r,o))},unwrap(){return this.element}})});function v(e,t){return zf(py,e,t)}var p_=y("ZodObject",(e,t)=>{zh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Rl(e,r,o,s),oe(e,"shape",()=>t.shape),vn(e,"ZodObject",{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:D()})},loose(){return this.clone({...this._zod.def,catchall:D()})},strict(){return this.clone({...this._zod.def,catchall:Ll()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Sb(this,r)},safeExtend(r){return vb(this,r)},merge(r){return bb(this,r)},pick(r){return _b(this,r)},omit(r){return gb(this,r)},partial(...r){return yb(__,this,r[0])},required(...r){return wb(g_,this,r[0])}})});function m(e,t){let r={type:"object",shape:e??{},...H(t)};return new p_(r)}function V(e,t){return new p_({type:"object",shape:e,catchall:D(),...H(t)})}var h_=y("ZodUnion",(e,t)=>{Ju.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>xl(e,r,o,s),e.options=t.options});function C(e,t){return new h_({type:"union",options:e,...H(t)})}var hy=y("ZodDiscriminatedUnion",(e,t)=>{h_.init(e,t),Rh.init(e,t)});function Lo(e,t,r){return new hy({type:"union",options:t,discriminator:e,...H(r)})}var fy=y("ZodIntersection",(e,t)=>{xh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>kl(e,r,o,s)});function Ft(e,t){return new fy({type:"intersection",left:e,right:t})}var s_=y("ZodRecord",(e,t)=>{kh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Pl(e,r,o,s),e.keyType=t.keyType,e.valueType=t.valueType});function T(e,t,r){if(!t||!t._zod)return new s_({type:"record",keyType:c(),valueType:e,...H(t)});return new s_({type:"record",keyType:e,valueType:t,...H(r)})}var Ml=y("ZodEnum",(e,t)=>{Ph.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(o,s,n)=>vl(e,o,s,n),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,s)=>{let n={};for(let a of o)if(r.has(a))n[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new Ml({...t,checks:[],...H(s),entries:n})},e.exclude=(o,s)=>{let n={...t.entries};for(let a of o)if(r.has(a))delete n[a];else throw Error(`Key ${a} not found in enum`);return new Ml({...t,checks:[],...H(s),entries:n})}});function Y(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ml({type:"enum",entries:r,...H(t)})}var _y=y("ZodLiteral",(e,t)=>{Th.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>bl(e,r,o,s),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 _y({type:"literal",values:Array.isArray(e)?e:[e],...H(t)})}var gy=y("ZodTransform",(e,t)=>{Eh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>wl(e,r,o,s),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new nn(e.constructor.name);r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Vr(n,r.value,t));else{let a=n;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Vr(a))}};let s=t.transform(r.value,r);if(s instanceof Promise)return s.then((n)=>(r.value=n,r.fallback=!0,r));return r.value=s,r.fallback=!0,r}});function f_(e){return new gy({type:"transform",transform:e})}var __=y("ZodOptional",(e,t)=>{Wu.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ac(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function F(e){return new __({type:"optional",innerType:e})}var Sy=y("ZodExactOptional",(e,t)=>{$h.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ac(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function vy(e){return new Sy({type:"optional",innerType:e})}var by=y("ZodNullable",(e,t)=>{Ch.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Tl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function n_(e){return new by({type:"nullable",innerType:e})}var yy=y("ZodDefault",(e,t)=>{Ih.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>$l(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function wy(e,t){return new yy({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var zy=y("ZodPrefault",(e,t)=>{qh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Cl(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function Ry(e,t){return new zy({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ou(t)}})}var g_=y("ZodNonOptional",(e,t)=>{Oh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>El(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function xy(e,t){return new g_({type:"nonoptional",innerType:e,...H(t)})}var ky=y("ZodCatch",(e,t)=>{Nh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Il(e,r,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Py(e,t){return new ky({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var S_=y("ZodPipe",(e,t)=>{Ku.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ql(e,r,o,s),e.in=t.in,e.out=t.out});function a_(e,t){return new S_({type:"pipe",in:e,out:t})}var Ty=y("ZodPreprocess",(e,t)=>{S_.init(e,t),jh.init(e,t)}),Ey=y("ZodReadonly",(e,t)=>{Mh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Ol(e,r,o,s),e.unwrap=()=>e._zod.def.innerType});function $y(e){return new Ey({type:"readonly",innerType:e})}var Cy=y("ZodLazy",(e,t)=>{Ah.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Nl(e,r,o,s),e.unwrap=()=>e._zod.def.getter()});function bn(e){return new Cy({type:"lazy",getter:e})}var Iy=y("ZodCustom",(e,t)=>{Lh.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>yl(e,r,o,s)});function qy(e,t={}){return Rf(Iy,e,t)}function Oy(e,t){return xf(e,t)}function Jr(e,t){return new Ty({type:"pipe",in:f_(e),out:t})}var b_={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 v_;(function(e){})(v_||(v_={}));function Ny(e){return ff(mc,e)}Je(Gu());var Wr="2025-11-25";var hc=[Wr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],fc="io.modelcontextprotocol/related-task",Bt="io.modelcontextprotocol/protocolVersion",Uo="io.modelcontextprotocol/clientInfo",$t="io.modelcontextprotocol/serverInfo",Kr="io.modelcontextprotocol/clientCapabilities",Do="io.modelcontextprotocol/subscriptionId",Zo="io.modelcontextprotocol/logLevel";var Gr="2.0";var Vt=bn(()=>C([c(),k(),E(),Br(),T(c(),Vt),v(Vt)])),fe=T(c(),Vt),_c=v(Vt),Ho=C([c(),k().int()]),Fo=c(),yn=m({ttl:k().optional()}),wn=m({taskId:c()}),Vo=V({progressToken:Ho.optional(),[fc]:wn.optional()}),Te=m({_meta:Vo.optional()}),pr=Te.extend({task:yn.optional()}),_e=m({method:c(),params:Te.loose().optional()}),Me=m({_meta:Vo.optional()}),Ie=m({method:c(),params:Me.loose().optional()}),Bo=V({get[$t](){return Ct.optional().catch(void 0)}}),ge=V({_meta:Bo.optional()}),ft=C([c(),k().int()]),Jo=m({jsonrpc:p(Gr),id:ft,..._e.shape}).strict(),Wo=m({jsonrpc:p(Gr),...Ie.shape}).strict(),Yr=m({jsonrpc:p(Gr),id:ft,result:ge}).strict(),Xr=m({jsonrpc:p(Gr),id:ft.optional(),error:m({code:k().int(),message:c(),data:D().optional()})}).strict(),_t=C([Jo,Wo,Yr,Xr]),gc=C([Yr,Xr]),hr=ge.strict(),zn=Me.extend({requestId:ft.optional(),reason:c().optional()}),Ko=Ie.extend({method:p("notifications/cancelled"),params:zn}),Rn=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),Jt=m({icons:v(Rn).optional()}),Et=m({name:c(),title:c().optional()}),Ct=Et.extend({...Et.shape,...Jt.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),jy=Ft(m({applyDefaults:E().optional()}),fe),My=Jr((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Ft(m({form:jy.optional(),url:fe.optional()}),fe.optional())),Sc=V({list:fe.optional(),cancel:fe.optional(),requests:V({sampling:V({createMessage:fe.optional()}).optional(),elicitation:V({create:fe.optional()}).optional()}).optional()}),vc=V({list:fe.optional(),cancel:fe.optional(),requests:V({tools:V({call:fe.optional()}).optional()}).optional()}),xn=m({experimental:T(c(),fe).optional(),sampling:m({context:fe.optional(),tools:fe.optional()}).optional(),elicitation:My.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:Sc.optional(),extensions:T(c(),fe).optional()}),kn=Te.extend({protocolVersion:c(),capabilities:xn,clientInfo:Ct}),Go=_e.extend({method:p("initialize"),params:kn}),Yo=m({experimental:T(c(),fe).optional(),logging:fe.optional(),completions:fe.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:vc.optional(),extensions:T(c(),fe).optional()}),Pn=ge.extend({protocolVersion:c(),capabilities:Yo,serverInfo:Ct,instructions:c().optional()}),Xo=Ie.extend({method:p("notifications/initialized"),params:Me.optional()}),Tn=_e.extend({method:p("server/discover"),params:Te.optional()}),fr=ge.extend({supportedVersions:v(c()),capabilities:Yo,instructions:c().optional()}),Qo=_e.extend({method:p("ping"),params:Te.optional()}),En=m({progress:k(),total:F(k()),message:F(c())}),$n=m({...Me.shape,...En.shape,progressToken:Ho}),es=Ie.extend({method:p("notifications/progress"),params:$n}),Cn=Te.extend({cursor:Fo.optional()}),Wt=_e.extend({params:Cn.optional()}),Kt=ge.extend({nextCursor:Fo.optional()}),ts=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),rs=ts.extend({text:c()}),Ul=c().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),os=ts.extend({blob:Ul}),Gt=Y(["user","assistant"]),It=m({audience:v(Gt).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),ss=m({...Et.shape,...Jt.shape,uri:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:It.optional(),_meta:F(V({}))}),In=m({...Et.shape,...Jt.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),annotations:It.optional(),_meta:F(V({}))}),qn=Wt.extend({method:p("resources/list")}),On=Kt.extend({resources:v(ss)}),Nn=Wt.extend({method:p("resources/templates/list")}),jn=Kt.extend({resourceTemplates:v(In)}),Qr=Te.extend({uri:c()}),Mn=Qr,An=_e.extend({method:p("resources/read"),params:Mn}),Ln=ge.extend({contents:v(C([rs,os]))}),Un=Ie.extend({method:p("notifications/resources/list_changed"),params:Me.optional()}),Dn=Qr,Zn=_e.extend({method:p("resources/subscribe"),params:Dn}),Hn=Qr,Fn=_e.extend({method:p("resources/unsubscribe"),params:Hn}),ns=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(c()).optional()}),Vn=Te.extend({notifications:ns}),Bn=_e.extend({method:p("subscriptions/listen"),params:Vn}),Jn=Me.extend({notifications:ns}),Wn=Ie.extend({method:p("notifications/subscriptions/acknowledged"),params:Jn}),Kn=Bo.extend({[Do]:ft}),Gn=ge.extend({_meta:Kn}),Yn=Me.extend({uri:c()}),Xn=Ie.extend({method:p("notifications/resources/updated"),params:Yn}),Qn=m({name:c(),description:F(c()),required:F(E())}),ea=m({...Et.shape,...Jt.shape,description:F(c()),arguments:F(v(Qn)),_meta:F(V({}))}),ta=Wt.extend({method:p("prompts/list")}),ra=Kt.extend({prompts:v(ea)}),oa=Te.extend({name:c(),arguments:T(c(),c()).optional()}),sa=_e.extend({method:p("prompts/get"),params:oa}),eo=m({type:p("text"),text:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),to=m({type:p("image"),data:Ul,mimeType:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),ro=m({type:p("audio"),data:Ul,mimeType:c(),annotations:It.optional(),_meta:T(c(),D()).optional()}),na=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),oo=m({type:p("resource"),resource:C([rs,os]),annotations:It.optional(),_meta:T(c(),D()).optional()}),so=ss.extend({type:p("resource_link")}),qt=C([eo,to,ro,so,oo]),aa=m({role:Gt,content:qt}),ia=ge.extend({description:c().optional(),messages:v(aa)}),ca=Ie.extend({method:p("notifications/prompts/list_changed"),params:Me.optional()}),ua=m({title:c().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),la=m({taskSupport:Y(["required","optional","forbidden"]).optional()}),_r=m({...Et.shape,...Jt.shape,description:c().optional(),inputSchema:m({type:p("object"),properties:T(c(),Vt).optional(),required:v(c()).optional()}).catchall(D()),outputSchema:V({$schema:c().optional()}).optional(),annotations:ua.optional(),execution:la.optional(),_meta:T(c(),D()).optional()}),da=Wt.extend({method:p("tools/list")}),ma=Kt.extend({tools:v(_r)}),gr=ge.extend({content:v(qt).default([]),structuredContent:D().optional(),isError:E().optional()}),bc=gr.or(ge.extend({toolResult:D()})),pa=pr.extend({name:c(),arguments:T(c(),D()).optional()}),ha=_e.extend({method:p("tools/call"),params:pa}),fa=Ie.extend({method:p("notifications/tools/list_changed"),params:Me.optional()}),_a=m({autoRefresh:E().default(!0),debounceMs:k().int().nonnegative().default(300)}),as=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),ga=Te.extend({level:as}),Sa=_e.extend({method:p("logging/setLevel"),params:ga}),va=Me.extend({level:as,logger:c().optional(),data:D()}),no=Ie.extend({method:p("notifications/message"),params:va}),ba=m({name:c().optional()}),ya=m({hints:v(ba).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),wa=m({mode:Y(["auto","required","none"]).optional()}),za=m({type:p("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:v(qt),structuredContent:D().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),Ra=Lo("type",[eo,to,ro]),mr=Lo("type",[eo,to,ro,na,za]),xa=m({role:Gt,content:C([mr,v(mr)]),_meta:T(c(),D()).optional()}),ka=pr.extend({messages:v(xa),modelPreferences:ya.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:fe.optional(),tools:v(_r).optional(),toolChoice:wa.optional()}),Pa=_e.extend({method:p("sampling/createMessage"),params:ka}),Ta=ge.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(c())),role:Gt,content:Ra}),Ea=ge.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Gt,content:C([mr,v(mr)])}),is=m({type:p("boolean"),title:c().optional(),description:c().optional(),default:E().optional()}),ao=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),io=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),cs=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),us=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),ls=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),$a=C([cs,us]),ds=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),ms=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),Ca=C([ds,ms]),Ia=C([ls,$a,Ca]),ps=C([Ia,is,ao,io]),co=pr.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),ps),required:v(c()).optional()}).catchall(D())}),qa=pr.extend({mode:p("url"),message:c(),elicitationId:c(),url:c().url()}),Oa=C([co,qa]),Na=_e.extend({method:p("elicitation/create"),params:Oa}),ja=Me.extend({elicitationId:c()}),Ma=Ie.extend({method:p("notifications/elicitation/complete"),params:ja}),Aa=ge.extend({action:Y(["accept","decline","cancel"]),content:Jr((e)=>e===null?void 0:e,T(c(),C([c(),k(),E(),v(c())])).optional())}),La=m({type:p("ref/resource"),uri:c()}),Ua=m({type:p("ref/prompt"),name:c()}),Da=Te.extend({ref:C([Ua,La]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()}),Za=_e.extend({method:p("completion/complete"),params:Da}),Ha=ge.extend({completion:V({values:v(c()).max(100),total:F(k().int()),hasMore:F(E())})}),Fa=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),Va=_e.extend({method:p("roots/list"),params:Te.optional()}),Ba=ge.extend({roots:v(Fa)}),Ja=Ie.extend({method:p("notifications/roots/list_changed"),params:Me.optional()}),yc=V({ttl:k().optional(),pollInterval:k().optional()}),Wa=Y(["working","input_required","completed","failed","cancelled"]),Yt=m({taskId:c(),status:Wa,ttl:C([k(),Br()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:F(k()),statusMessage:F(c())}),wc=ge.extend({task:Yt}),Ka=Me.merge(Yt),zc=Ie.extend({method:p("notifications/tasks/status"),params:Ka}),Rc=_e.extend({method:p("tasks/get"),params:Te.extend({taskId:c()})}),xc=ge.merge(Yt),kc=_e.extend({method:p("tasks/result"),params:Te.extend({taskId:c()})}),Pc=ge.loose(),Tc=Wt.extend({method:p("tasks/list")}),Ec=Kt.extend({tasks:v(Yt)}),$c=_e.extend({method:p("tasks/cancel"),params:Te.extend({taskId:c()})}),Cc=ge.merge(Yt),Ic=C([Qo,Go,Tn,Za,Sa,sa,ta,qn,Nn,An,Zn,Fn,Bn,ha,da]),qc=C([Ko,es,Xo,Ja]),Oc=C([hr,Ta,Ea,Aa,Ba]),Nc=C([Qo,Pa,Na,Va]),jc=C([Ko,es,no,Xn,Un,fa,ca,Wn,Ma]),Mc=C([hr,Pn,fr,Ha,ia,ra,On,jn,Ln,gr,ma,Gn]);var Ee=dc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:b_.custom,message:"URL must be parseable",fatal:!0}),Eu}).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"}),hs=V({resource:c().url(),authorization_servers:v(Ee).optional(),jwks_uri:c().url().optional(),scopes_supported:v(c()).optional(),bearer_methods_supported:v(c()).optional(),resource_signing_alg_values_supported:v(c()).optional(),resource_name:c().optional(),resource_documentation:c().optional(),resource_policy_uri:c().url().optional(),resource_tos_uri:c().url().optional(),tls_client_certificate_bound_access_tokens:E().optional(),authorization_details_types_supported:v(c()).optional(),dpop_signing_alg_values_supported:v(c()).optional(),dpop_bound_access_tokens_required:E().optional()}),uo=V({issuer:c(),authorization_endpoint:Ee,token_endpoint:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(c()).optional(),response_types_supported:v(c()),response_modes_supported:v(c()).optional(),grant_types_supported:v(c()).optional(),token_endpoint_auth_methods_supported:v(c()).optional(),token_endpoint_auth_signing_alg_values_supported:v(c()).optional(),service_documentation:Ee.optional(),revocation_endpoint:Ee.optional(),revocation_endpoint_auth_methods_supported:v(c()).optional(),revocation_endpoint_auth_signing_alg_values_supported:v(c()).optional(),introspection_endpoint:c().optional(),introspection_endpoint_auth_methods_supported:v(c()).optional(),introspection_endpoint_auth_signing_alg_values_supported:v(c()).optional(),code_challenge_methods_supported:v(c()).optional(),client_id_metadata_document_supported:E().optional(),authorization_response_iss_parameter_supported:E().optional().catch(void 0),dpop_signing_alg_values_supported:v(c()).optional()}),Ga=V({issuer:c(),authorization_endpoint:Ee,token_endpoint:Ee,userinfo_endpoint:Ee.optional(),jwks_uri:Ee,registration_endpoint:Ee.optional(),scopes_supported:v(c()).optional(),response_types_supported:v(c()),response_modes_supported:v(c()).optional(),grant_types_supported:v(c()).optional(),acr_values_supported:v(c()).optional(),subject_types_supported:v(c()),id_token_signing_alg_values_supported:v(c()),id_token_encryption_alg_values_supported:v(c()).optional(),id_token_encryption_enc_values_supported:v(c()).optional(),userinfo_signing_alg_values_supported:v(c()).optional(),userinfo_encryption_alg_values_supported:v(c()).optional(),userinfo_encryption_enc_values_supported:v(c()).optional(),request_object_signing_alg_values_supported:v(c()).optional(),request_object_encryption_alg_values_supported:v(c()).optional(),request_object_encryption_enc_values_supported:v(c()).optional(),token_endpoint_auth_methods_supported:v(c()).optional(),token_endpoint_auth_signing_alg_values_supported:v(c()).optional(),display_values_supported:v(c()).optional(),claim_types_supported:v(c()).optional(),claims_supported:v(c()).optional(),service_documentation:c().optional(),claims_locales_supported:v(c()).optional(),ui_locales_supported:v(c()).optional(),claims_parameter_supported:E().optional(),request_parameter_supported:E().optional(),request_uri_parameter_supported:E().optional(),require_request_uri_registration:E().optional(),op_policy_uri:Ee.optional(),op_tos_uri:Ee.optional(),client_id_metadata_document_supported:E().optional(),authorization_response_iss_parameter_supported:E().optional().catch(void 0)}),fs=m({...Ga.shape,...uo.pick({code_challenge_methods_supported:!0}).shape}),lo=m({access_token:c(),id_token:c().optional(),token_type:c(),expires_in:Ny().optional(),scope:c().optional(),refresh_token:c().optional(),issuer:c().optional().catch(void 0)}).strip(),Ya=m({issued_token_type:p("urn:ietf:params:oauth:token-type:id-jag"),access_token:c(),token_type:c().optional(),expires_in:k().optional(),scope:c().optional()}).strip(),mo=m({error:c(),error_description:c().optional(),error_uri:c().optional()}),Dl=Ee.optional().or(p("").transform(()=>{return})),Xa=m({redirect_uris:v(Ee),token_endpoint_auth_method:c().optional(),grant_types:v(c()).optional(),response_types:v(c()).optional(),application_type:c().optional(),client_name:c().optional(),client_uri:Ee.optional(),logo_uri:Dl,scope:c().optional(),contacts:v(c()).optional(),tos_uri:Dl,policy_uri:c().optional(),jwks_uri:Ee.optional(),jwks:pc().optional(),software_id:c().optional(),software_version:c().optional(),software_statement:c().optional()}).strip(),Qa=m({client_id:c(),client_secret:c().optional(),client_id_issued_at:k().optional(),client_secret_expires_at:k().optional(),issuer:c().optional().catch(void 0)}).strip(),_s=Xa.merge(Qa),Ac=m({error:c(),error_description:c().optional()}).strip(),Lc=m({token:c(),token_type_hint:c().optional()}).strip();var Bl=Symbol.for("mcp.sdk.errorBrands");function vr(e,t){let r=new Set,o=t;while(typeof o==="function"){let s=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof s==="string")r.add(s);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,Bl,{value:r,enumerable:!1,configurable:!0})}function We(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Bl)){let r=t[Bl];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Ot=function(e){return e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedGrantType="unsupported_grant_type",e.InvalidScope="invalid_scope",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedTokenType="unsupported_token_type",e.InvalidToken="invalid_token",e.MethodNotAllowed="method_not_allowed",e.TooManyRequests="too_many_requests",e.InvalidClientMetadata="invalid_client_metadata",e.InvalidRedirectUri="invalid_redirect_uri",e.InsufficientScope="insufficient_scope",e.InvalidTarget="invalid_target",e.InvalidDpopProof="invalid_dpop_proof",e.UseDpopNonce="use_dpop_nonce",e}({}),br=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return We(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 We(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",vr(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)}},M=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}({}),L=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return We(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 We(this,e)}constructor(e,t,r,o){super(t,o);this.code=e,this.data=r,this.name="SdkError",vr(this,new.target)}},gt=class extends L{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Yl(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Bc(e){if(typeof e!=="object"||e===null||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function Xl({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",n=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return s.startsWith(n)}var J_="2026-07-28",Ql=[J_];function Nt(e){return e>=J_}function ed(e){return e.filter((t)=>!Nt(t))}function ni(e){return e.filter((t)=>Nt(t))}function W_(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((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var K_=["task","inputRequests","requestState"];function Ay(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||K_.some((t)=>(t in e)))return e;return{...e,content:[]}}function Ly(){let e=bn(()=>C([c(),k(),E(),Br(),T(c(),e),v(e)])),t=T(c(),e),r=C([c(),k().int()]),o=c(),s=m({ttl:k().optional()}),n=m({taskId:c()}),a=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":n.optional()}),i=m({_meta:a.optional()}),u=i.extend({task:s.optional()}),l=m({method:c(),params:i.loose().optional()}),d=m({_meta:a.optional()}),f=m({method:c(),params:d.loose().optional()}),h=V({_meta:a.optional()}),g=C([c(),k().int()]),b=h.strict(),_=d.extend({requestId:g.optional(),reason:c().optional()}),w=f.extend({method:p("notifications/cancelled"),params:_}),I=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),A=m({icons:v(I).optional()}),z=m({name:c(),title:c().optional()}),q=z.extend({...z.shape,...A.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),x=Ft(m({applyDefaults:E().optional()}),t),R=Jr((je)=>{if(je&&typeof je==="object"&&!Array.isArray(je)&&Object.keys(je).length===0)return{form:{}};return je},Ft(m({form:x.optional(),url:t.optional()}),t.optional())),Z=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),ee=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),X=m({experimental:T(c(),t).optional(),sampling:m({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:Z.optional(),extensions:T(c(),t).optional()}),ne=i.extend({protocolVersion:c(),capabilities:X,clientInfo:q}),xe=l.extend({method:p("initialize"),params:ne}),te=m({experimental:T(c(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:ee.optional(),extensions:T(c(),t).optional()}),ae=h.extend({protocolVersion:c(),capabilities:te,serverInfo:q,instructions:c().optional()}),re=f.extend({method:p("notifications/initialized"),params:d.optional()}),de=l.extend({method:p("ping"),params:i.optional()}),bt=m({progress:k(),total:F(k()),message:F(c())}),Fe=m({...d.shape,...bt.shape,progressToken:r}),st=f.extend({method:p("notifications/progress"),params:Fe}),yt=i.extend({cursor:o.optional()}),Ge=l.extend({params:yt.optional()}),Le=h.extend({nextCursor:o.optional()}),Dt=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),Zt=Dt.extend({text:c()}),wt=c().refine((je)=>{try{return atob(je),!0}catch{return!1}},{message:"Invalid Base64 string"}),Oe=Dt.extend({blob:wt}),Ue=Y(["user","assistant"]),De=m({audience:v(Ue).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),dt=m({...z.shape,...A.shape,uri:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:De.optional(),_meta:F(V({}))}),Cr=m({...z.shape,...A.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),annotations:De.optional(),_meta:F(V({}))}),Ye=Ge.extend({method:p("resources/list")}),Xe=Le.extend({resources:v(dt)}),Ve=Ge.extend({method:p("resources/templates/list")}),nt=Le.extend({resourceTemplates:v(Cr)}),at=i.extend({uri:c()}),zt=at,Rt=l.extend({method:p("resources/read"),params:zt}),or=h.extend({contents:v(C([Zt,Oe]))}),xt=f.extend({method:p("notifications/resources/list_changed"),params:d.optional()}),Ir=at,N=l.extend({method:p("resources/subscribe"),params:Ir}),kt=at,B=l.extend({method:p("resources/unsubscribe"),params:kt}),U=d.extend({uri:c()}),Q=f.extend({method:p("notifications/resources/updated"),params:U}),j=m({name:c(),description:F(c()),required:F(E())}),O=m({...z.shape,...A.shape,description:F(c()),arguments:F(v(j)),_meta:F(V({}))}),K=Ge.extend({method:p("prompts/list")}),J=Le.extend({prompts:v(O)}),ke=i.extend({name:c(),arguments:T(c(),c()).optional()}),qr=l.extend({method:p("prompts/get"),params:ke}),Pt=m({type:p("text"),text:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Or=m({type:p("image"),data:wt,mimeType:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Nr=m({type:p("audio"),data:wt,mimeType:c(),annotations:De.optional(),_meta:T(c(),D()).optional()}),Cs=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),sr=m({type:p("resource"),resource:C([Zt,Oe]),annotations:De.optional(),_meta:T(c(),D()).optional()}),Is=dt.extend({type:p("resource_link")}),it=C([Pt,Or,Nr,Is,sr]),zo=m({role:Ue,content:it}),Ro=h.extend({description:c().optional(),messages:v(zo)}),jr=f.extend({method:p("notifications/prompts/list_changed"),params:d.optional()}),qs=m({title:c().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),xo=m({taskSupport:Y(["required","optional","forbidden"]).optional()}),Mr=m({...z.shape,...A.shape,description:c().optional(),inputSchema:m({type:p("object"),properties:T(c(),e).optional(),required:v(c()).optional()}).catchall(D()),outputSchema:m({type:p("object"),properties:T(c(),e).optional(),required:v(c()).optional()}).catchall(D()).optional(),annotations:qs.optional(),execution:xo.optional(),_meta:T(c(),D()).optional()}),ko=Ge.extend({method:p("tools/list")}),Po=Le.extend({tools:v(Mr)}),To=h.extend({content:v(it),structuredContent:T(c(),D()).optional(),isError:E().optional()}),Ne=u.extend({name:c(),arguments:T(c(),D()).optional()}),Os=l.extend({method:p("tools/call"),params:Ne}),ki=f.extend({method:p("notifications/tools/list_changed"),params:d.optional()}),Eo=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),Ns=i.extend({level:Eo}),js=l.extend({method:p("logging/setLevel"),params:Ns}),Ms=d.extend({level:Eo,logger:c().optional(),data:D()}),As=f.extend({method:p("notifications/message"),params:Ms}),Ls=m({name:c().optional()}),Us=m({hints:v(Ls).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),Ds=m({mode:Y(["auto","required","none"]).optional()}),Pi=m({type:p("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:v(it),structuredContent:m({}).loose().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),Zs=Lo("type",[Pt,Or,Nr]),nr=Lo("type",[Pt,Or,Nr,Cs,Pi]),Hs=m({role:Ue,content:C([nr,v(nr)]),_meta:T(c(),D()).optional()}),Fs=u.extend({messages:v(Hs),modelPreferences:Us.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:t.optional(),tools:v(Mr).optional(),toolChoice:Ds.optional()}),Vs=l.extend({method:p("sampling/createMessage"),params:Fs}),Bs=h.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens"]).or(c())),role:Ue,content:Zs}),Js=h.extend({model:c(),stopReason:F(Y(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Ue,content:C([nr,v(nr)])}),Ws=m({type:p("boolean"),title:c().optional(),description:c().optional(),default:E().optional()}),Ks=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),Gs=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),Ys=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),Xs=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),Qs=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),en=C([Ys,Xs]),Ar=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),Lr=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),Ti=C([Ar,Lr]),Ei=C([Qs,en,Ti]),Qe=C([Ei,Ws,Ks,Gs]),et=u.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),Qe),required:v(c()).optional()}).catchall(D())}),tn=u.extend({mode:p("url"),message:c(),elicitationId:c(),url:c().url()}),mt=C([et,tn]),$i=l.extend({method:p("elicitation/create"),params:mt}),Ci=d.extend({elicitationId:c()}),Ii=f.extend({method:p("notifications/elicitation/complete"),params:Ci}),qi=h.extend({action:Y(["accept","decline","cancel"]),content:Jr((je)=>je===null?void 0:je,T(c(),C([c(),k(),E(),v(c())])).optional())}),Oi=m({type:p("ref/resource"),uri:c()}),Ni=m({type:p("ref/prompt"),name:c()}),ji=i.extend({ref:C([Ni,Oi]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()}),rn=l.extend({method:p("completion/complete"),params:ji}),Mi=h.extend({completion:V({values:v(c()).max(100),total:F(k().int()),hasMore:F(E())})}),Ai=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),$o=l.extend({method:p("roots/list"),params:i.optional()}),on=h.extend({roots:v(Ai)}),Li=f.extend({method:p("notifications/roots/list_changed"),params:d.optional()}),Ui=V({ttl:k().optional(),pollInterval:k().optional()}),sn=Y(["working","input_required","completed","failed","cancelled"]),ar=m({taskId:c(),status:sn,ttl:C([k(),Br()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:F(k()),statusMessage:F(c())}),Be=h.extend({task:ar}),Di=d.merge(ar),Ur=f.extend({method:p("notifications/tasks/status"),params:Di}),Co=l.extend({method:p("tasks/get"),params:i.extend({taskId:c()})}),Io=h.merge(ar),qo=l.extend({method:p("tasks/result"),params:i.extend({taskId:c()})}),Tu=h.loose(),Ze=Ge.extend({method:p("tasks/list")}),ye=Le.extend({tasks:v(ar)}),Dr=l.extend({method:p("tasks/cancel"),params:i.extend({taskId:c()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:s,RelatedTaskMetadataSchema:n,RequestMetaSchema:a,BaseRequestParamsSchema:i,TaskAugmentedRequestParamsSchema:u,RequestSchema:l,NotificationsParamsSchema:d,NotificationSchema:f,ResultSchema:h,RequestIdSchema:g,EmptyResultSchema:b,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:w,IconSchema:I,IconsSchema:A,BaseMetadataSchema:z,ImplementationSchema:q,ClientTasksCapabilitySchema:Z,ServerTasksCapabilitySchema:ee,ClientCapabilitiesSchema:X,InitializeRequestParamsSchema:ne,InitializeRequestSchema:xe,ServerCapabilitiesSchema:te,InitializeResultSchema:ae,InitializedNotificationSchema:re,PingRequestSchema:de,ProgressSchema:bt,ProgressNotificationParamsSchema:Fe,ProgressNotificationSchema:st,PaginatedRequestParamsSchema:yt,PaginatedRequestSchema:Ge,PaginatedResultSchema:Le,ResourceContentsSchema:Dt,TextResourceContentsSchema:Zt,BlobResourceContentsSchema:Oe,RoleSchema:Ue,AnnotationsSchema:De,ResourceSchema:dt,ResourceTemplateSchema:Cr,ListResourcesRequestSchema:Ye,ListResourcesResultSchema:Xe,ListResourceTemplatesRequestSchema:Ve,ListResourceTemplatesResultSchema:nt,ResourceRequestParamsSchema:at,ReadResourceRequestParamsSchema:zt,ReadResourceRequestSchema:Rt,ReadResourceResultSchema:or,ResourceListChangedNotificationSchema:xt,SubscribeRequestParamsSchema:Ir,SubscribeRequestSchema:N,UnsubscribeRequestParamsSchema:kt,UnsubscribeRequestSchema:B,ResourceUpdatedNotificationParamsSchema:U,ResourceUpdatedNotificationSchema:Q,PromptArgumentSchema:j,PromptSchema:O,ListPromptsRequestSchema:K,ListPromptsResultSchema:J,GetPromptRequestParamsSchema:ke,GetPromptRequestSchema:qr,TextContentSchema:Pt,ImageContentSchema:Or,AudioContentSchema:Nr,ToolUseContentSchema:Cs,EmbeddedResourceSchema:sr,ResourceLinkSchema:Is,ContentBlockSchema:it,PromptMessageSchema:zo,GetPromptResultSchema:Ro,PromptListChangedNotificationSchema:jr,ToolAnnotationsSchema:qs,ToolExecutionSchema:xo,ToolSchema:Mr,ListToolsRequestSchema:ko,ListToolsResultSchema:Po,CallToolResultSchema:To,CallToolRequestParamsSchema:Ne,CallToolRequestSchema:Os,ToolListChangedNotificationSchema:ki,LoggingLevelSchema:Eo,SetLevelRequestParamsSchema:Ns,SetLevelRequestSchema:js,LoggingMessageNotificationParamsSchema:Ms,LoggingMessageNotificationSchema:As,ModelHintSchema:Ls,ModelPreferencesSchema:Us,ToolChoiceSchema:Ds,ToolResultContentSchema:Pi,SamplingContentSchema:Zs,SamplingMessageContentBlockSchema:nr,SamplingMessageSchema:Hs,CreateMessageRequestParamsSchema:Fs,CreateMessageRequestSchema:Vs,CreateMessageResultSchema:Bs,CreateMessageResultWithToolsSchema:Js,BooleanSchemaSchema:Ws,StringSchemaSchema:Ks,NumberSchemaSchema:Gs,UntitledSingleSelectEnumSchemaSchema:Ys,TitledSingleSelectEnumSchemaSchema:Xs,LegacyTitledEnumSchemaSchema:Qs,SingleSelectEnumSchemaSchema:en,UntitledMultiSelectEnumSchemaSchema:Ar,TitledMultiSelectEnumSchemaSchema:Lr,MultiSelectEnumSchemaSchema:Ti,EnumSchemaSchema:Ei,PrimitiveSchemaDefinitionSchema:Qe,ElicitRequestFormParamsSchema:et,ElicitRequestURLParamsSchema:tn,ElicitRequestParamsSchema:mt,ElicitRequestSchema:$i,ElicitationCompleteNotificationParamsSchema:Ci,ElicitationCompleteNotificationSchema:Ii,ElicitResultSchema:qi,ResourceTemplateReferenceSchema:Oi,PromptReferenceSchema:Ni,CompleteRequestParamsSchema:ji,CompleteRequestSchema:rn,CompleteResultSchema:Mi,RootSchema:Ai,ListRootsRequestSchema:$o,ListRootsResultSchema:on,RootsListChangedNotificationSchema:Li,TaskCreationParamsSchema:Ui,TaskStatusSchema:sn,TaskSchema:ar,CreateTaskResultSchema:Be,TaskStatusNotificationParamsSchema:Di,TaskStatusNotificationSchema:Ur,GetTaskRequestSchema:Co,GetTaskResultSchema:Io,GetTaskPayloadRequestSchema:qo,GetTaskPayloadResultSchema:Tu,ListTasksRequestSchema:Ze,ListTasksResultSchema:ye,CancelTaskRequestSchema:Dr,CancelTaskResultSchema:h.merge(ar),ClientRequestSchema:C([de,xe,rn,js,qr,K,Ye,Ve,Rt,N,B,Os,ko,Co,qo,Ze,Dr]),ClientNotificationSchema:C([w,st,re,Li,Ur]),ClientResultSchema:C([b,Bs,Js,qi,on,Io,ye,Be]),ServerRequestSchema:C([de,Vs,$i,$o,Co,qo,Ze,Dr]),ServerNotificationSchema:C([w,st,As,Q,xt,ki,jr,Ur,Ii]),ServerResultSchema:C([b,ae,Mi,Ro,J,Xe,nt,or,To,Po,Io,ye,Be]),CallToolResultWireSchema:D().superRefine((je,nb)=>{if(typeof je!=="object"||je===null||Array.isArray(je)||je.content!==void 0)return;for(let _m of K_)if(_m in je){nb.addIssue({code:"custom",message:`content is required when the body carries '${_m}' — another result family cannot default into an empty tools/call success`});return}}).transform(Ay).pipe(To)}}var Uy;function G_(){return Uy??=Ly()}function Y_(e){return e.type!=="object"}var Dy=new Set(["const","enum","default","examples"]),Zy=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function q_(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function Hy(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(q_(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=wm(e.$schema)&&e.$recursiveAnchor!==!0,o=(s,n)=>{if(Array.isArray(s))return s.map((u)=>o(u,!1));if(s===null||typeof s!=="object")return s;if(!n&&q_(s.$id))return s;let a={},i=!1;for(let[u,l]of Object.entries(s))if(n)a[u]=o(l,!1);else if((u==="$ref"||u==="$dynamicRef")&&typeof l==="string")a[u]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l;else if(u==="$recursiveRef"&&l==="#"&&r)i=!0;else if(Dy.has(u))a[u]=l;else if(Zy.has(u))a[u]=o(l,!0);else a[u]=o(l,!1);if(i)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var X_={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},Q_={"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},Fy={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},Uc;function td(){if(Uc)return Uc;let e=G_();return Uc={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}},Uc}function eg(e){return Object.prototype.hasOwnProperty.call(X_,e)}function tg(e){return Object.prototype.hasOwnProperty.call(Q_,e)}function Vy(e){return Object.prototype.hasOwnProperty.call(Fy,e)}function By(e){return Vy(e)?td().resultSchemas[e]:void 0}function Jy(e){return eg(e)?td().requestSchemas[e]:void 0}function Wy(e){return tg(e)?td().notificationSchemas[e]:void 0}var Z0=Object.keys(X_),H0=Object.keys(Q_);function Jl(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Dc(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var O_={ok:!1,reason:"not-in-era"};function N_(e){return Jl(e)&&Jl(e.outputSchema)&&Y_(e.outputSchema)}function j_(e){return e}var rd={era:"2025-11-25",hasRequestMethod:eg,hasNotificationMethod:tg,validateRequest:(e,t)=>Dc(Jy(e),t),validateResult:(e,t)=>Dc(By(e),t),validateNotification:(e,t)=>Dc(Wy(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>O_,validateInputResponse:()=>O_,samplingResultVariant:(e,t)=>{let r=G_();return Dc(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=W_(e),o=r.structuredContent;if(o===void 0)return r;let s=typeof o!=="object"||o===null||Array.isArray(o),n=t!==void 0&&Y_(t);if(!s&&!n)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(Jl(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:j_(r)}}return{kind:"complete",result:j_(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>N_(o)))return t;return{...t,tools:r.map((o)=>N_(o)?{...o,outputSchema:Hy(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Ky(){let e=bn(()=>C([c(),k(),E(),Br(),T(c(),e),v(e)])),t=T(c(),e),r=C([c(),k().int()]),o=c(),s=C([c(),k().int()]),n=Y(["user","assistant"]),a=Y(["debug","info","notice","warning","error","critical","alert","emergency"]),i=c().refine((ye)=>{try{return atob(ye),!0}catch{return!1}},{message:"Invalid Base64 string"}),u=m({ttl:k().optional()}),l=m({taskId:c()}),d=V({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),f=m({_meta:d.optional()}),h=f.extend({task:u.optional()}),g=m({_meta:d.optional()}),b=m({method:c(),params:g.loose().optional()}),_=m({src:c(),mimeType:c().optional(),sizes:v(c()).optional(),theme:Y(["light","dark"]).optional()}),w=m({icons:v(_).optional()}),I=m({name:c(),title:c().optional()}),A=I.extend({...I.shape,...w.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),z=Ft(m({applyDefaults:E().optional()}),t),q=Jr((ye)=>{if(ye&&typeof ye==="object"&&!Array.isArray(ye)&&Object.keys(ye).length===0)return{form:{}};return ye},Ft(m({form:z.optional(),url:t.optional()}),t.optional())),x=V({list:t.optional(),cancel:t.optional(),requests:V({sampling:V({createMessage:t.optional()}).optional(),elicitation:V({create:t.optional()}).optional()}).optional()}),R=V({list:t.optional(),cancel:t.optional(),requests:V({tools:V({call:t.optional()}).optional()}).optional()}),Z=m({experimental:T(c(),t).optional(),sampling:m({context:t.optional(),tools:t.optional()}).optional(),elicitation:q.optional(),roots:m({listChanged:E().optional()}).optional(),tasks:x.optional(),extensions:T(c(),t).optional()}),ee=m({experimental:T(c(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:m({listChanged:E().optional()}).optional(),resources:m({subscribe:E().optional(),listChanged:E().optional()}).optional(),tools:m({listChanged:E().optional()}).optional(),tasks:R.optional(),extensions:T(c(),t).optional()}),X=m({progress:k(),total:F(k()),message:F(c())}),ne=m({...g.shape,...X.shape,progressToken:r}),xe=b.extend({method:p("notifications/progress"),params:ne}),te=g.extend({level:a,logger:c().optional(),data:D()}),ae=b.extend({method:p("notifications/message"),params:te}),re=m({uri:c(),mimeType:F(c()),_meta:T(c(),D()).optional()}),de=re.extend({text:c()}),bt=re.extend({blob:i}),Fe=m({audience:v(n).optional(),priority:k().min(0).max(1).optional(),lastModified:Ao({offset:!0}).optional()}),st=m({...I.shape,...w.shape,uri:c(),description:F(c()),mimeType:F(c()),size:F(k()),annotations:Fe.optional(),_meta:F(V({}))}),yt=m({...I.shape,...w.shape,uriTemplate:c(),description:F(c()),mimeType:F(c()),annotations:Fe.optional(),_meta:F(V({}))}),Ge=b.extend({method:p("notifications/resources/list_changed"),params:g.optional()}),Le=g.extend({uri:c()}),Dt=b.extend({method:p("notifications/resources/updated"),params:Le}),Zt=m({name:c(),description:F(c()),required:F(E())}),wt=m({...I.shape,...w.shape,description:F(c()),arguments:F(v(Zt)),_meta:F(V({}))}),Oe=b.extend({method:p("notifications/prompts/list_changed"),params:g.optional()}),Ue=m({type:p("text"),text:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),De=m({type:p("image"),data:i,mimeType:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),dt=m({type:p("audio"),data:i,mimeType:c(),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),Cr=m({type:p("tool_use"),name:c(),id:c(),input:T(c(),D()),_meta:T(c(),D()).optional()}),Ye=m({type:p("resource"),resource:C([de,bt]),annotations:Fe.optional(),_meta:T(c(),D()).optional()}),Xe=st.extend({type:p("resource_link")}),Ve=C([Ue,De,dt,Xe,Ye]),nt=m({role:n,content:Ve}),at=m({title:c().optional(),readOnlyHint:E().optional(),destructiveHint:E().optional(),idempotentHint:E().optional(),openWorldHint:E().optional()}),zt=b.extend({method:p("notifications/tools/list_changed"),params:g.optional()}),Rt=m({name:c().optional()}),or=m({hints:v(Rt).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),xt=m({mode:Y(["auto","required","none"]).optional()}),Ir=m({type:p("boolean"),title:c().optional(),description:c().optional(),default:E().optional()}),N=m({type:p("string"),title:c().optional(),description:c().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y(["email","uri","date","date-time"]).optional(),default:c().optional()}),kt=m({type:Y(["number","integer"]),title:c().optional(),description:c().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),B=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),default:c().optional()}),U=m({type:p("string"),title:c().optional(),description:c().optional(),oneOf:v(m({const:c(),title:c()})),default:c().optional()}),Q=m({type:p("string"),title:c().optional(),description:c().optional(),enum:v(c()),enumNames:v(c()).optional(),default:c().optional()}),j=C([B,U]),O=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({type:p("string"),enum:v(c())}),default:v(c()).optional()}),K=m({type:p("array"),title:c().optional(),description:c().optional(),minItems:k().optional(),maxItems:k().optional(),items:m({anyOf:v(m({const:c(),title:c()}))}),default:v(c()).optional()}),J=C([O,K]),ke=C([Q,j,J]),qr=C([ke,Ir,N,kt]),Pt=h.extend({mode:p("form").optional(),message:c(),requestedSchema:m({type:p("object"),properties:T(c(),qr),required:v(c()).optional()}).catchall(D())}),Or=m({type:p("ref/resource"),uri:c()}),Nr=m({type:p("ref/prompt"),name:c()}),Cs=m({uri:c().startsWith("file://"),name:c().optional(),_meta:T(c(),D()).optional()}),sr=Z.shape,Is=m({experimental:sr.experimental,sampling:sr.sampling,elicitation:sr.elicitation,roots:sr.roots,extensions:sr.extensions}),it=ee.shape,zo=m({experimental:it.experimental,logging:it.logging,completions:it.completions,prompts:it.prompts,resources:it.resources,tools:it.tools,extensions:it.extensions}),Ro=V({progressToken:r.optional(),[Bt]:c(),[Uo]:A.optional(),[Kr]:Is,[Zo]:a.optional()}),jr=m({...I.shape,...w.shape,description:c().optional(),inputSchema:V({$schema:c().optional(),type:p("object")}),outputSchema:V({$schema:c().optional()}).optional(),annotations:at.optional(),_meta:T(c(),D()).optional()}),qs=m({type:p("tool_result"),toolUseId:c(),content:v(Ve),structuredContent:D().optional(),isError:E().optional(),_meta:T(c(),D()).optional()}),xo=C([Ue,De,dt,Cr,qs]),Mr=m({role:n,content:C([xo,v(xo)]),_meta:T(c(),D()).optional()}),ko=c(),Po=V({[$t]:A.optional().catch(void 0)}),To=Po.optional();function Ne(ye){return V({_meta:To,resultType:ko.default("complete"),...ye})}let Os=Ne({}),ki=Ne({nextCursor:o.optional()}),Eo=Ne({content:v(Ve),structuredContent:D().optional(),isError:E().optional()}),Ns=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),tools:v(jr),nextCursor:o.optional()}),js=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),prompts:v(wt),nextCursor:o.optional()}),Ms=Ne({description:c().optional(),messages:v(nt)}),As=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resources:v(st),nextCursor:o.optional()}),Ls=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:v(yt),nextCursor:o.optional()}),Us=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),contents:v(C([de,bt]))}),Ds=Ne({completion:m({values:v(c()).max(100),total:k().int().optional(),hasMore:E().optional()}).loose()}),Pi=Ne({ttlMs:k().int().min(0),cacheScope:Y(["public","private"])}),Zs=Ne({ttlMs:k().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:v(c()),capabilities:zo,instructions:c().optional()}),nr=m({messages:v(Mr),modelPreferences:or.optional(),systemPrompt:c().optional(),includeContext:Y(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:v(c()).optional(),metadata:t.optional(),tools:v(jr).optional(),toolChoice:xt.optional()}),Hs=m({method:p("sampling/createMessage"),params:nr}),Fs=m({method:p("roots/list"),params:m({_meta:T(c(),D()).optional()}).optional()}),Vs=m({...Mr.shape,model:c(),stopReason:c().optional()}),Bs=m({roots:v(Cs)}),Js=m({action:Y(["accept","decline","cancel"]),content:T(c(),C([c(),k(),E(),v(c())])).optional()}),Ws=m({mode:p("url"),message:c(),url:c().url()}),Ks=C([Pt,Ws]),Gs=m({method:p("elicitation/create"),params:Ks}),Ys=C([Hs,Fs,Gs]),Xs=C([Vs,Bs,Js]),Qs=T(c(),Ys),en=T(c(),Xs),Ar=Ne({inputRequests:Qs.optional(),requestState:c().optional()}),Lr={inputResponses:en.optional(),requestState:c().optional()},Ti=m({_meta:Ro,...Lr}),Ei=V({progressToken:r.optional()});function Qe(ye,Dr){return m({method:p(ye),params:m({_meta:Ro,...Dr})})}function et(ye,Dr){return m({method:p(ye),params:m({_meta:Ei.optional(),...Dr}).optional()})}let tn={name:c(),arguments:T(c(),D()).optional(),...Lr},mt={cursor:o.optional()},$i=Qe("tools/call",tn),Ci=Qe("tools/list",mt),Ii=Qe("prompts/list",mt),qi=Qe("prompts/get",{name:c(),arguments:T(c(),c()).optional(),...Lr}),Oi=Qe("resources/list",mt),Ni=Qe("resources/templates/list",mt),ji=Qe("resources/read",{uri:c(),...Lr}),rn={ref:C([Nr,Or]),argument:m({name:c(),value:c()}),context:m({arguments:T(c(),c()).optional()}).optional()},Mi=Qe("completion/complete",rn),Ai=Qe("server/discover",{}),$o=m({toolsListChanged:E().optional(),promptsListChanged:E().optional(),resourcesListChanged:E().optional(),resourceSubscriptions:v(c()).optional()}),on={notifications:$o},Li=Qe("subscriptions/listen",on),Ui=Po.extend({"io.modelcontextprotocol/subscriptionId":s}),sn=V({_meta:Ui,resultType:ko.default("complete")}),ar={"tools/call":et("tools/call",tn),"tools/list":et("tools/list",mt),"prompts/get":et("prompts/get",{name:c(),arguments:T(c(),c()).optional()}),"prompts/list":et("prompts/list",mt),"resources/list":et("resources/list",mt),"resources/templates/list":et("resources/templates/list",mt),"resources/read":et("resources/read",{uri:c()}),"completion/complete":et("completion/complete",rn),"server/discover":et("server/discover",{}),"subscriptions/listen":et("subscriptions/listen",on)};function Be(ye){return V({_meta:To,...ye})}let Di={"tools/call":Be({content:v(Ve),structuredContent:D().optional(),isError:E().optional()}),"tools/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),tools:v(jr),nextCursor:o.optional()}),"prompts/get":Be({description:c().optional(),messages:v(nt)}),"prompts/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),prompts:v(wt),nextCursor:o.optional()}),"resources/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resources:v(st),nextCursor:o.optional()}),"resources/templates/list":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),resourceTemplates:v(yt),nextCursor:o.optional()}),"resources/read":Be({ttlMs:k().int().min(0),cacheScope:Y(["public","private"]),contents:v(C([de,bt]))}),"completion/complete":Be({completion:m({values:v(c()).max(100),total:k().int().optional(),hasMore:E().optional()}).loose()}),"server/discover":Be({ttlMs:k().int().min(0).catch(0),cacheScope:Y(["public","private"]).catch("private"),supportedVersions:v(c()),capabilities:zo,instructions:c().optional()}),"subscriptions/listen":Be({})},Ur=V({"io.modelcontextprotocol/subscriptionId":s.optional()}),Co=m({method:p("notifications/subscriptions/acknowledged"),params:m({_meta:Ur.optional(),notifications:$o})}),Io=m({_meta:Ur.optional(),requestId:s,reason:c().optional()}),qo=m({method:p("notifications/cancelled"),params:Io}),Tu={"notifications/cancelled":qo,"notifications/progress":xe,"notifications/message":ae,"notifications/resources/updated":Dt,"notifications/resources/list_changed":Ge,"notifications/tools/list_changed":zt,"notifications/prompts/list_changed":Oe,"notifications/subscriptions/acknowledged":Co},Ze=(ye)=>m({jsonrpc:p("2.0"),id:C([c(),k().int()]),result:ye}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:s,RoleSchema:n,LoggingLevelSchema:a,TaskMetadataSchema:u,RelatedTaskMetadataSchema:l,RequestMetaSchema:d,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:h,NotificationsParamsSchema:g,NotificationSchema:b,IconSchema:_,IconsSchema:w,BaseMetadataSchema:I,ImplementationSchema:A,ClientTasksCapabilitySchema:x,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:Z,ServerCapabilitiesSchema:ee,ProgressSchema:X,ProgressNotificationParamsSchema:ne,ProgressNotificationSchema:xe,LoggingMessageNotificationParamsSchema:te,LoggingMessageNotificationSchema:ae,ResourceContentsSchema:re,TextResourceContentsSchema:de,BlobResourceContentsSchema:bt,AnnotationsSchema:Fe,ResourceSchema:st,ResourceTemplateSchema:yt,ResourceListChangedNotificationSchema:Ge,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Dt,PromptArgumentSchema:Zt,PromptSchema:wt,PromptListChangedNotificationSchema:Oe,TextContentSchema:Ue,ImageContentSchema:De,AudioContentSchema:dt,ToolUseContentSchema:Cr,EmbeddedResourceSchema:Ye,ResourceLinkSchema:Xe,ContentBlockSchema:Ve,PromptMessageSchema:nt,ToolAnnotationsSchema:at,ToolListChangedNotificationSchema:zt,ModelHintSchema:Rt,ModelPreferencesSchema:or,ToolChoiceSchema:xt,BooleanSchemaSchema:Ir,StringSchemaSchema:N,NumberSchemaSchema:kt,UntitledSingleSelectEnumSchemaSchema:B,TitledSingleSelectEnumSchemaSchema:U,LegacyTitledEnumSchemaSchema:Q,SingleSelectEnumSchemaSchema:j,UntitledMultiSelectEnumSchemaSchema:O,TitledMultiSelectEnumSchemaSchema:K,MultiSelectEnumSchemaSchema:J,EnumSchemaSchema:ke,PrimitiveSchemaDefinitionSchema:qr,ElicitRequestFormParamsSchema:Pt,ResourceTemplateReferenceSchema:Or,PromptReferenceSchema:Nr,RootSchema:Cs,ClientCapabilities2026Schema:Is,ServerCapabilities2026Schema:zo,RequestMetaEnvelopeSchema:Ro,ToolSchema:jr,ToolResultContentSchema:qs,SamplingMessageContentBlockSchema:xo,SamplingMessageSchema:Mr,ResultTypeSchema:ko,ResultMetaSchema:Po,ResultSchema:Os,PaginatedResultSchema:ki,CallToolResultSchema:Eo,ListToolsResultSchema:Ns,ListPromptsResultSchema:js,GetPromptResultSchema:Ms,ListResourcesResultSchema:As,ListResourceTemplatesResultSchema:Ls,ReadResourceResultSchema:Us,CompleteResultSchema:Ds,CacheableResultSchema:Pi,DiscoverResultSchema:Zs,CreateMessageRequestParamsSchema:nr,CreateMessageRequestSchema:Hs,ListRootsRequestSchema:Fs,CreateMessageResultSchema:Vs,ListRootsResultSchema:Bs,ElicitResultSchema:Js,ElicitRequestURLParamsSchema:Ws,ElicitRequestParamsSchema:Ks,ElicitRequestSchema:Gs,InputRequestSchema:Ys,InputResponseSchema:Xs,InputRequestsSchema:Qs,InputResponsesSchema:en,InputRequiredResultSchema:Ar,InputResponseRequestParamsSchema:Ti,CallToolRequestSchema:$i,ListToolsRequestSchema:Ci,ListPromptsRequestSchema:Ii,GetPromptRequestSchema:qi,ListResourcesRequestSchema:Oi,ListResourceTemplatesRequestSchema:Ni,ReadResourceRequestSchema:ji,CompleteRequestSchema:Mi,DiscoverRequestSchema:Ai,SubscriptionFilterSchema:$o,SubscriptionsListenRequestSchema:Li,SubscriptionsListenResultMetaSchema:Ui,SubscriptionsListenResultSchema:sn,dispatchRequestSchemas:ar,dispatchResultSchemas:Di,NotificationMetaSchema:Ur,SubscriptionsAcknowledgedNotificationSchema:Co,CancelledNotificationParamsSchema:Io,CancelledNotificationSchema:qo,notificationSchemas2026:Tu,JSONRPCResultResponseSchema:Ze(Os),CallToolResultResponseSchema:Ze(C([Eo,Ar])),ListToolsResultResponseSchema:Ze(Ns),ListPromptsResultResponseSchema:Ze(js),GetPromptResultResponseSchema:Ze(C([Ms,Ar])),ListResourcesResultResponseSchema:Ze(As),ListResourceTemplatesResultResponseSchema:Ze(Ls),ReadResourceResultResponseSchema:Ze(C([Us,Ar])),CompleteResultResponseSchema:Ze(Ds),DiscoverResultResponseSchema:Ze(Zs),SubscriptionsListenResultResponseSchema:Ze(sn)}}var Gy;function Sr(){return Gy??=Ky()}var Yy=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Xy(e){return Yy.includes(e)}var od=Symbol("modelcontextprotocol.resultCacheHintFallback");function Qy(e){return e[od]}function rg(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function og(e){return e==="public"||e==="private"}var W=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}({}),se=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return We(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 We(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",vr(this,new.target)}static fromError(t,r,o){if(t===W.UrlElicitationRequired&&o){let s=o;if(s.elicitations)return new ng(s.elicitations,r)}if(t===W.UnsupportedProtocolVersion&&o){let s=o;if(Array.isArray(s.supported)&&typeof s.requested==="string")return new ai({supported:s.supported,requested:s.requested},r)}if(t===W.InvalidParams||t===W.ResourceNotFound){let s=o;if(typeof s?.uri==="string"&&(t===W.ResourceNotFound||Object.keys(s).length===1))return new sg(s.uri,r)}if(t===W.MissingRequiredClientCapability&&o){let s=o;if(s.requiredCapabilities!==null&&typeof s.requiredCapabilities==="object"&&!Array.isArray(s.requiredCapabilities))return new ag({requiredCapabilities:s.requiredCapabilities},r)}return new e(t,r,o)}},sg=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(W.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},ng=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(W.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ai=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(W.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ag=class extends se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(W.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ew=0,tw="private",rw=["tools/call","prompts/get","resources/read"];function ow(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(rw.includes(e))return t;throw new se(W.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function sw(e,t){let r=Qy(t);if(t.resultType!=="complete"||!Xy(e))return r===void 0?t:uw(t);let o=t,s=rg(o.ttlMs)?o.ttlMs:iw(r),n=og(o.cacheScope)?o.cacheScope:cw(r),a={...o,ttlMs:s,cacheScope:n};return delete a[od],a}function nw(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function aw(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[$t]:t}};if(!nw(r))return e;if(r[$t]!==void 0)return e;return{...e,_meta:{...r,[$t]:t}}}function iw(e){return e!==void 0&&rg(e.ttlMs)?e.ttlMs:ew}function cw(e){return e!==void 0&&og(e.cacheScope)?e.cacheScope:tw}function uw(e){let t={...e};return delete t[od],t}var lw=["elicitation/create","sampling/createMessage","roots/list"],Zc;function ig(){if(Zc)return Zc;let e=Sr();return Zc={request:{"elicitation/create":m({method:p("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":m({method:p("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":m({method:p("roots/list"),params:V({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Zc}function cg(e){return lw.includes(e)}function Zl(e){return cg(e)?ig().request[e]:void 0}function dw(e){return cg(e)?ig().response[e]:void 0}var sd={"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},ug={"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 lg(e){return Object.prototype.hasOwnProperty.call(sd,e)}function dg(e){return Object.prototype.hasOwnProperty.call(ug,e)}function mw(e){return Object.prototype.hasOwnProperty.call(sd,e)}function pw(e){return lg(e)?Sr().dispatchRequestSchemas[e]:void 0}function hw(e){return mw(e)?Sr().dispatchResultSchemas[e]:void 0}function fw(e){return dg(e)?Sr().notificationSchemas2026[e]:void 0}var F0=Object.keys(sd),V0=Object.keys(ug);function ri(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ei(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var _w={ok:!1,reason:"not-in-era"},gw=[Bt,Kr];function Sw(e,t){let r=t,o=!1,s=()=>{if(!o)r={...r},o=!0;return r},n=t.tools;if(e==="tools/list"&&Array.isArray(n)&&n.some((i)=>ri(i)&&("execution"in i)))s().tools=n.map((i)=>{if(!ri(i)||!("execution"in i))return i;let u={...i};return delete u.execution,u});let a=t.capabilities;if(ri(a)&&"tasks"in a){let i={...a};delete i.tasks,s().capabilities=i}return r}var nd={era:"2026-07-28",hasRequestMethod:lg,hasNotificationMethod:dg,hasInputRequestMethod:(e)=>Zl(e)!==void 0,validateRequest:(e,t)=>ei(pw(e),t),validateResult:(e,t)=>ei(hw(e),t),validateNotification:(e,t)=>ei(fw(e),t),validateInputRequest:(e,t)=>ei(Zl(e),t),validateInputResponse:(e,t)=>ei(dw(e),t),samplingResultVariant:()=>_w,outboundEnvelope(e){return{[Bt]:e.protocolVersion,[Uo]:e.clientInfo,[Kr]:e.clientCapabilities,...e.logLevel!==void 0&&{[Zo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of gw)if(!(o in e))t.push({key:o,problem:"missing"});let r=Sr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let s=o.path.map(String),n=s.length>0?s.join("."):"_meta";if(s.length===1&&t.some((a)=>a.key===n&&a.problem==="missing"))continue;t.push({key:n,problem:o.message})}return t},projectCallToolResult:(e)=>W_(e),inputRequestSchema:Zl,decodeResult(e,t){if(!ri(t))return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new L(M.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 r!=="string")return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,i=ri(a)?a:{},u=t.requestState,l=t._meta===void 0?void 0:Sr().ResultMetaSchema.safeParse(t._meta),d=l?.success?l.data:void 0;if(Object.keys(i).length===0&&typeof u!=="string")return{kind:"invalid",error:new L(M.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:i,...typeof u==="string"&&{requestState:u},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new L(M.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=vw(),s=Object.hasOwn(o,e)?o[e]:void 0;if(s!==void 0){let a=s.safeParse(t);if(!a.success)return{kind:"invalid",error:new L(M.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let n={...t};return delete n.resultType,{kind:"complete",result:n}},encodeResult(e,t,r){return aw(sw(e,ow(e,Sw(e,t))),r)},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=Sr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},Hc;function vw(){if(Hc)return Hc;let e=Sr();return Hc={"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},Hc}var Jc="2026-07-28";function Xt(e){return e!==void 0&&Nt(e)?nd:rd}function M_(e){if(e.revision!==void 0)return Xt(e.revision).era;return e.era==="modern"?nd.era:rd.era}function Hl(e){return mg.some((t)=>t.hasRequestMethod(e))}function Fl(e){return mg.some((t)=>t.hasNotificationMethod(e))}function A_(e){return e==="tasks/get"||e==="tasks/cancel"}var mg=[rd,nd],bw=vm({AnnotationsSchema:()=>It,AudioContentSchema:()=>ro,BaseMetadataSchema:()=>Et,BaseRequestParamsSchema:()=>Te,BlobResourceContentsSchema:()=>os,BooleanSchemaSchema:()=>is,CallToolRequestParamsSchema:()=>pa,CallToolRequestSchema:()=>ha,CallToolResultSchema:()=>gr,CancelTaskRequestSchema:()=>$c,CancelTaskResultSchema:()=>Cc,CancelledNotificationParamsSchema:()=>zn,CancelledNotificationSchema:()=>Ko,ClientCapabilitiesSchema:()=>xn,ClientNotificationSchema:()=>qc,ClientRequestSchema:()=>Ic,ClientResultSchema:()=>Oc,ClientTasksCapabilitySchema:()=>Sc,CompatibilityCallToolResultSchema:()=>bc,CompleteRequestParamsSchema:()=>Da,CompleteRequestSchema:()=>Za,CompleteResultSchema:()=>Ha,ContentBlockSchema:()=>qt,CreateMessageRequestParamsSchema:()=>ka,CreateMessageRequestSchema:()=>Pa,CreateMessageResultSchema:()=>Ta,CreateMessageResultWithToolsSchema:()=>Ea,CreateTaskResultSchema:()=>wc,CursorSchema:()=>Fo,DiscoverRequestSchema:()=>Tn,DiscoverResultSchema:()=>fr,ElicitRequestFormParamsSchema:()=>co,ElicitRequestParamsSchema:()=>Oa,ElicitRequestSchema:()=>Na,ElicitRequestURLParamsSchema:()=>qa,ElicitResultSchema:()=>Aa,ElicitationCompleteNotificationParamsSchema:()=>ja,ElicitationCompleteNotificationSchema:()=>Ma,EmbeddedResourceSchema:()=>oo,EmptyResultSchema:()=>hr,EnumSchemaSchema:()=>Ia,GetPromptRequestParamsSchema:()=>oa,GetPromptRequestSchema:()=>sa,GetPromptResultSchema:()=>ia,GetTaskPayloadRequestSchema:()=>kc,GetTaskPayloadResultSchema:()=>Pc,GetTaskRequestSchema:()=>Rc,GetTaskResultSchema:()=>xc,IconSchema:()=>Rn,IconsSchema:()=>Jt,ImageContentSchema:()=>to,ImplementationSchema:()=>Ct,InitializeRequestParamsSchema:()=>kn,InitializeRequestSchema:()=>Go,InitializeResultSchema:()=>Pn,InitializedNotificationSchema:()=>Xo,JSONArraySchema:()=>_c,JSONObjectSchema:()=>fe,JSONRPCErrorResponseSchema:()=>Xr,JSONRPCMessageSchema:()=>_t,JSONRPCNotificationSchema:()=>Wo,JSONRPCRequestSchema:()=>Jo,JSONRPCResponseSchema:()=>gc,JSONRPCResultResponseSchema:()=>Yr,JSONValueSchema:()=>Vt,LegacyTitledEnumSchemaSchema:()=>ls,ListChangedOptionsBaseSchema:()=>_a,ListPromptsRequestSchema:()=>ta,ListPromptsResultSchema:()=>ra,ListResourceTemplatesRequestSchema:()=>Nn,ListResourceTemplatesResultSchema:()=>jn,ListResourcesRequestSchema:()=>qn,ListResourcesResultSchema:()=>On,ListRootsRequestSchema:()=>Va,ListRootsResultSchema:()=>Ba,ListTasksRequestSchema:()=>Tc,ListTasksResultSchema:()=>Ec,ListToolsRequestSchema:()=>da,ListToolsResultSchema:()=>ma,LoggingLevelSchema:()=>as,LoggingMessageNotificationParamsSchema:()=>va,LoggingMessageNotificationSchema:()=>no,ModelHintSchema:()=>ba,ModelPreferencesSchema:()=>ya,MultiSelectEnumSchemaSchema:()=>Ca,NotificationSchema:()=>Ie,NotificationsParamsSchema:()=>Me,NumberSchemaSchema:()=>io,PaginatedRequestParamsSchema:()=>Cn,PaginatedRequestSchema:()=>Wt,PaginatedResultSchema:()=>Kt,PingRequestSchema:()=>Qo,PrimitiveSchemaDefinitionSchema:()=>ps,ProgressNotificationParamsSchema:()=>$n,ProgressNotificationSchema:()=>es,ProgressSchema:()=>En,ProgressTokenSchema:()=>Ho,PromptArgumentSchema:()=>Qn,PromptListChangedNotificationSchema:()=>ca,PromptMessageSchema:()=>aa,PromptReferenceSchema:()=>Ua,PromptSchema:()=>ea,ReadResourceRequestParamsSchema:()=>Mn,ReadResourceRequestSchema:()=>An,ReadResourceResultSchema:()=>Ln,RelatedTaskMetadataSchema:()=>wn,RequestIdSchema:()=>ft,RequestMetaSchema:()=>Vo,RequestSchema:()=>_e,ResourceContentsSchema:()=>ts,ResourceLinkSchema:()=>so,ResourceListChangedNotificationSchema:()=>Un,ResourceRequestParamsSchema:()=>Qr,ResourceSchema:()=>ss,ResourceTemplateReferenceSchema:()=>La,ResourceTemplateSchema:()=>In,ResourceUpdatedNotificationParamsSchema:()=>Yn,ResourceUpdatedNotificationSchema:()=>Xn,ResultMetaObjectSchema:()=>Bo,ResultSchema:()=>ge,RoleSchema:()=>Gt,RootSchema:()=>Fa,RootsListChangedNotificationSchema:()=>Ja,SamplingContentSchema:()=>Ra,SamplingMessageContentBlockSchema:()=>mr,SamplingMessageSchema:()=>xa,ServerCapabilitiesSchema:()=>Yo,ServerNotificationSchema:()=>jc,ServerRequestSchema:()=>Nc,ServerResultSchema:()=>Mc,ServerTasksCapabilitySchema:()=>vc,SetLevelRequestParamsSchema:()=>ga,SetLevelRequestSchema:()=>Sa,SingleSelectEnumSchemaSchema:()=>$a,StringSchemaSchema:()=>ao,SubscribeRequestParamsSchema:()=>Dn,SubscribeRequestSchema:()=>Zn,SubscriptionFilterSchema:()=>ns,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Jn,SubscriptionsAcknowledgedNotificationSchema:()=>Wn,SubscriptionsListenRequestParamsSchema:()=>Vn,SubscriptionsListenRequestSchema:()=>Bn,SubscriptionsListenResultMetaSchema:()=>Kn,SubscriptionsListenResultSchema:()=>Gn,TaskAugmentedRequestParamsSchema:()=>pr,TaskCreationParamsSchema:()=>yc,TaskMetadataSchema:()=>yn,TaskSchema:()=>Yt,TaskStatusNotificationParamsSchema:()=>Ka,TaskStatusNotificationSchema:()=>zc,TaskStatusSchema:()=>Wa,TextContentSchema:()=>eo,TextResourceContentsSchema:()=>rs,TitledMultiSelectEnumSchemaSchema:()=>ms,TitledSingleSelectEnumSchemaSchema:()=>us,ToolAnnotationsSchema:()=>ua,ToolChoiceSchema:()=>wa,ToolExecutionSchema:()=>la,ToolListChangedNotificationSchema:()=>fa,ToolResultContentSchema:()=>za,ToolSchema:()=>_r,ToolUseContentSchema:()=>na,UnsubscribeRequestParamsSchema:()=>Hn,UnsubscribeRequestSchema:()=>Fn,UntitledMultiSelectEnumSchemaSchema:()=>ds,UntitledSingleSelectEnumSchemaSchema:()=>cs});var yr=(e)=>Jo.safeParse(e).success,pg=(e)=>Wo.safeParse(e).success,po=(e)=>Yr.safeParse(e).success,ho=(e)=>Xr.safeParse(e).success;var hg=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var ad=(e)=>Go.safeParse(e).success,fg=(e)=>Xo.safeParse(e).success;var yw="Mcp-Param-",L_="x-mcp-header",ww=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,zw=new Set(["string","integer","boolean"]);function id(e){let t=[],r=new Map,o,s=(a,i,u)=>{if(a===null||typeof a!=="object")return;let l=a;if(L_ in l){if(!u||i.length===0)return`${Fc(i)}: 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 f=l[L_];if(typeof f!=="string"||f.length===0)return`${Fc(i)}: x-mcp-header MUST be a non-empty string`;if(!ww.test(f))return`${Fc(i)}: x-mcp-header '${f}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let h=typeof l.type==="string"?l.type:void 0;if(h===void 0||!zw.has(h)){let _=`${Fc(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${h??"<none>"}`;if(h!=="number")return _;o??=_}let g=f.toLowerCase(),b=r.get(g);if(b!==void 0)return`x-mcp-header '${f}' is not case-insensitively unique (also declared as '${b}')`;r.set(g,f),t.push({path:i,headerName:f,type:h})}let d=l.properties;if(d!==null&&typeof d==="object")for(let[f,h]of Object.entries(d)){let g=s(h,[...i,f],u);if(g!==void 0)return g}for(let f of Rw){let h=l[f];if(h===void 0)continue;let g=Array.isArray(h)?h:h!==null&&typeof h==="object"&&xw.has(f)?Object.values(h):[h];for(let b of g){let _=s(b,[...i,`<${f}>`],!1);if(_!==void 0)return _}}},n=s(e,[],!0);if(n!==void 0)return{valid:!1,reason:o??n};return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var Rw=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],xw=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Fc(e){return e.length===0?"<root>":e.join(".")}var _g="=?base64?",gg="?=";function kw(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 Pw(e){if(e.length===0)return!0;if(e.startsWith(_g)&&e.endsWith(gg))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r===9||r>=32&&r<=126)continue;return!0}return!1}function Tw(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function cd(e){return Pw(e)?`${_g}${Tw(e)}${gg}`:e}function Ew(e,t){let r=e;for(let o of t){if(r===null||typeof r!=="object")return;r=r[o]}return r}function Sg(e,t){let r={};for(let o of e){let s=Ew(t,o.path);if(s===void 0||s===null)continue;let n=kw(s);if(n===void 0)continue;r[`${yw}${o.headerName}`]=cd(n)}return r}var gs=-32020,B0=[{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:[W.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:[gs,W.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:[W.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:[W.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:[W.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:[gs],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:[W.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:[gs],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."}],J0={[W.ParseError]:400,[W.InvalidRequest]:400,[W.MethodNotFound]:404,[W.UnsupportedProtocolVersion]:400,[W.MissingRequiredClientCapability]:400,[gs]:400},U_={"tools/call":"name","prompts/get":"name","resources/read":"uri","tasks/get":"taskId","tasks/update":"taskId","tasks/cancel":"taskId"};function vg(e,t){let r=Object.hasOwn(U_,e)?U_[e]:void 0;if(r===void 0)return;let o=$w(t)?t[r]:void 0;return{field:r,value:typeof o==="string"?o:void 0}}function $w(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Wc(e,t){return uc(e,t)}function ti(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Wl(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 D_=!1,Kl="draft-2020-12";function Cw(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Kl});else if(r.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(!D_)D_=!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.");o=ic(e,{target:Kl,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return bg(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var Iw=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function bg(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref==="string"&&Iw.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let s=e[o];if(Array.isArray(s)&&s.length>0)return s.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||bg(n,"$id"in n?{}:t)))}return!1}function qw(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 Vl(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>qw(o)).join(", ")};return{success:!0,data:r.value}}function Ow(e){let t=ic(e,{target:Kl,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var Nw=/\\\.\\d\{(\d+)\}/;function jw(e){let t=Nw.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((s)=>r.map((n)=>Ao({local:o,offset:s,precision:n}))))}function Mw(e,t){let r;switch(e){case"email":r=[l_()];break;case"uri":r=[dc()];break;case"date":r=[jl()];break;case"date-time":r=jw(t);break}return new Set(r.map((o)=>Ow(o)).filter((o)=>o!==void 0))}function Aw(e,t,r){if(r!=="zod")return!0;return Mw(e,t).has(t)}function si(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Lw(e){try{return Cw(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new se(W.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Uw=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function ud(e){return Uw.has(e)||e.startsWith("x-")}var Dw=new Set(["$schema",...Object.keys(co.shape.requestedSchema.shape)]),Z_={string:ti([ao,cs,us,ls]),number:ti([io]),integer:ti([io]),boolean:ti([is]),array:ti([ds,ms])},Zw=new Set(ao.shape.format.unwrap().options);function Hw(e,t,r,o){if(!si(e))return e;let s=typeof e.type==="string"&&Object.hasOwn(Z_,e.type)?Z_[e.type]:void 0;if(s===void 0)return e;let n={};for(let[a,i]of Object.entries(e))if(s.has(a)||ud(a))n[a]=i;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Zw.has(e.format))n[a]=i;else if(typeof i!=="string"||!Aw(e.format,i,r))o.push(`${t}.${a}`)}else o.push(`${t}.${a}`);return n}function Fw(e,t){let r={},o=[];for(let[s,n]of Object.entries(e))if(s==="properties"&&si(n))r[s]=Object.fromEntries(Object.entries(n).map(([a,i])=>[a,Hw(i,`properties.${a}`,t,o)]));else if(Dw.has(s))r[s]=n;else if(!ud(s))o.push(s);if(o.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function Vw(e,t){if(!si(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Wc(ps,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Gl(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,s)=>Gl(o,t[s],`${r}[${s}]`));if(!si(e)||!si(t))return[];return Object.entries(e).flatMap(([o,s])=>{let n=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return ud(o)?[]:[n];return Gl(s,t[o],n)})}function Bw(e){if(!Wl(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Fw(Lw(e.requestedSchema),t),o=Wc(co.shape.requestedSchema,r);if(!o.success)throw new se(W.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Vw(r,o.error.message)}`);let s=Gl(r,o.data);if(s.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${s.join(", ")}`);let n=(o.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(o.data.properties,a));if(n.length>0)throw new se(W.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${n.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function Jw(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)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 W0=Object.assign(Jw,{elicit(e){try{return{method:"elicitation/create",params:Bw(e)}}catch(t){throw t instanceof se?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 Ww=!0,Kw=10,Gw=250;function yg(e){return{autoFulfill:e?.autoFulfill??Ww,maxRounds:e?.maxRounds??Kw}}function Yw(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;if(!o&&r===void 0)return e;return{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function Xw(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Qw(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof L?t.reason:new L(M.RequestTimeout,String(t.reason)));return}let s=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e),n=()=>{clearTimeout(s),o(t?.reason instanceof L?t.reason:new L(M.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",n,{once:!0})})}function ez(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function tz(e){let{config:t,method:r,originalParams:o,requestOptions:s,hooks:n,signal:a}=e,i=e.flowStartedAt??Date.now(),u=e.firstPayload,l=0;while(!0){if(l+=1,l>t.maxRounds)throw new L(M.InputRequiredRoundsExceeded,Xw(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:u.inputRequests,...u.requestState!==void 0&&{requestState:u.requestState}}});s.onprogress?.({progress:l,message:`Fulfilling input required by '${r}' (round ${l})`});let d=Object.entries(u.inputRequests??{}),f;if(d.length>0){let b=ez(a);try{let _=await Promise.all(d.map(async([w,I])=>{try{return[w,await n.dispatchInputRequest(w,I,b.signal)]}catch(A){throw b.abort(A),A}}));f=Object.fromEntries(_)}finally{b.dispose()}}else await Qw(Gw,a);let h={...s.timeout!==void 0&&{timeout:s.timeout}};if(s.maxTotalTimeout!==void 0){let b=Date.now()-i,_=s.maxTotalTimeout-b;if(_<=0)throw new L(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:s.maxTotalTimeout,totalElapsed:b});h.maxTotalTimeout=_}let g=await n.retry(Yw(o,f,u.requestState),h);if(hg(g)){u={inputRequests:g.inputRequests??{},...g.requestState!==void 0&&{requestState:g.requestState}};continue}return g}}var rz=["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"],oz={IdJagTokenExchangeResponseSchema:Ya,OAuthClientInformationFullSchema:_s,OAuthClientInformationSchema:Qa,OAuthClientMetadataSchema:Xa,OAuthClientRegistrationErrorSchema:Ac,OAuthErrorResponseSchema:mo,OAuthMetadataSchema:uo,OAuthProtectedResourceMetadataSchema:hs,OAuthTokenRevocationRequestSchema:Lc,OAuthTokensSchema:lo,OpenIdProviderDiscoveryMetadataSchema:fs,OpenIdProviderMetadataSchema:Ga},wg={},zg={};function Rg(e,t){let r=e.slice(0,-6);wg[r]=t,zg[r]=(o)=>t.safeParse(o).success}for(let e of rz)Rg(e,bw[e]);for(let[e,t]of Object.entries(oz))Rg(e,t);var sz=Object.freeze(wg),ld=Object.freeze(zg);function nz(e){switch(e){case"initialize":case"notifications/initialized":return Xt(void 0);case"server/discover":return Xt(Jc);default:return}}var ii=60000,az=[Bt,Uo,Kr,Zo],iz=["inputResponses","requestState"];function H_(e,t){let r=e.params;if(!oi(r))return{message:e,lifted:{}};let o=r._meta,s=oi(o)?az.filter((u)=>(u in o)):[],n=t==="request"?iz.filter((u)=>(u in r)):[];if(s.length===0&&n.length===0)return{message:e,lifted:{}};let a={},i={...r};if(s.length>0&&oi(o)){let u={},l={...o};for(let d of s)u[d]=o[d],delete l[d];if(a.envelope=u,Object.keys(l).length>0)i._meta=l;else delete i._meta}for(let u of n){if(u==="inputResponses")a.inputResponses=i[u];if(u==="requestState")a.requestState=i[u];delete i[u]}return{message:{...e,params:i},lifted:a}}function F_(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let s=e.validateResult(t,o);if(s.ok)return{value:s.value};return{issues:[{message:s.reason==="invalid"?s.message:`not-in-era: ${t}`}]}}}}}function dd(e){return()=>e}var cz=dd(void 0),uz,ci=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{uz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??hc,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 r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new L(M.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,r,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new L(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=(s)=>{r?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,n)=>{if(o?.(s,n),po(s)||ho(s))this._onresponse(s);else if(yr(s))this._onrequest(s,n);else if(pg(s))this._onnotification(s,n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(s)}`))},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 o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new L(M.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=H_(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=M_(t.classification);if(a!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} but this instance serves ${o.era}`));return}}if(Fl(r.method)&&!o.hasNotificationMethod(r.method))return;let s=this._notificationHandlers.get(r.method),n=this.fallbackNotificationHandler;if(s===void 0&&n===void 0)return;Promise.resolve().then(()=>s===void 0?n(r):s(r,o)).catch((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:r,lifted:o}=H_(e,"request"),s=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 n=this._transport,a=(_,w,I)=>{let A={jsonrpc:"2.0",id:r.id,error:{code:_,message:w,...I!==void 0&&{data:I}}};n?.send(A).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)))};if(t?.classification!==void 0){let _=M_(t.classification);if(_!==s.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${s.era}`));let w=t.classification.revision??_;a(W.UnsupportedProtocolVersion,`Unsupported protocol version: ${w}`,{supported:this._supportedProtocolVersions,requested:w});return}}if(Hl(r.method)&&!s.hasRequestMethod(r.method)&&!(A_(r.method)&&this._customSchemaRequestMethods.has(r.method))){a(W.MethodNotFound,"Method not found");return}let i=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(i===void 0){a(W.MethodNotFound,"Method not found");return}let u=s.checkInboundEnvelope(o);if(u!==void 0){a(W.InvalidParams,u);return}let l=(_,w)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...w,relatedRequestId:r.id}),d=(_,w,I)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,w,{...I,relatedRequestId:r.id}),f=new AbortController;this._requestHandlerAbortControllers.set(r.id,f);let h=o.inputResponses===void 0?void 0:lz(o.inputResponses),g={sessionId:n?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...h!==void 0&&{inputResponses:h.accepted},...h!==void 0&&h.droppedKeys.length>0&&{droppedInputResponseKeys:h.droppedKeys},requestState:o.requestState===void 0?cz:dd(o.requestState),signal:f.signal,send:(_,w,I)=>{let A=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(A,_.method),Wl(w))return d(_,w,I);let z=F_(A,_.method);if(z===void 0)throw TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(_,z,w)},notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},b=this.buildContext(g,t);Promise.resolve().then(()=>i(r,b)).then(async(_)=>{if(f.signal.aborted)return;let w;try{w=s.encodeResult(r.method,_,this._outboundServerInfo())}catch(A){this._onerror(Error(`Failed to encode result for ${r.method}: ${A}`)),a(W.InternalError,"Internal error");return}let I={result:w,jsonrpc:"2.0",id:r.id};await n?.send(I)},async(_)=>{if(f.signal.aborted)return;let w=Number.isSafeInteger(_.code)?_.code:W.InternalError,I={jsonrpc:"2.0",id:r.id,error:{code:s.encodeErrorCode(w),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await n?.send(I)}).catch((_)=>this._onerror(Error(`Failed to send response: ${_}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===f)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),s=this._progressHandlers.get(o);if(!s){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let n=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&n&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(i){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),n(i);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===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),po(e))r(e);else r(se.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(Wl(t)){if(!A_(e.method))this._assertOutboundRequestInEra(o,e.method);return this._requestWithSchemaViaCodec(o,e,t,r)}this._assertOutboundRequestInEra(o,e.method);let s=F_(o,e.method);if(s===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,s,t)}_negotiatedWireCodec(){return Xt(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=nz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Hl(t)&&!e.hasRequestMethod(t))throw new L(M.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a,headers:i}=o??{},u=Date.now(),l,d;return new Promise((f,h)=>{let g=(R)=>{h(R)};if(!this._transport){g(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){g(R);return}if(o?.signal?.aborted){let R=o.signal.reason;throw R instanceof L?R:new L(M.RequestTimeout,String(R))}let b=e.era===Jc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;d=_;let w={...t,jsonrpc:"2.0",id:_};if(o?.onprogress)this._progressHandlers.set(_,o.onprogress),w.params={...t.params,_meta:{...t.params?._meta,progressToken:_}};let I=this._envelopeOutbound(w),A=!1,z=(R)=>{if(A)return;if(this._progressHandlers.delete(_),b===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(R)}}),{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a}).catch((Z)=>this._onerror(Error(`Failed to send cancellation: ${Z}`)))}else b.abort();h(R instanceof L?R:new L(M.RequestTimeout,String(R)))};this._responseHandlers.set(_,(R)=>{if(o?.signal?.aborted)return;if(A=!0,R instanceof Error)return h(R);let Z;try{Z=e.decodeResult(t.method,R.result)}catch(X){return h(X instanceof Error?X:Error(String(X)))}if(Z.kind==="invalid")return h(Z.error);if(Z.kind==="input_required"){if(o?.allowInputRequired===!0)return f(hz(Z));let X={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:u,retry:(ne,xe)=>this._requestWithSchemaViaCodec(e,ne===void 0?{method:t.method}:{method:t.method,params:ne},r,xe)};return f(this._resolveNonCompleteResult(Z,X))}let ee=Z.result;Vl(r,ee).then((X)=>{if(X.success)f(X.data);else h(new L(M.InvalidResult,`Invalid result for ${t.method}: ${X.error}`))},h)}),l=()=>z(o?.signal?.reason),o?.signal?.addEventListener("abort",l,{once:!0});let q=o?.timeout??ii,x=()=>z(new L(M.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(_,q,o?.maxTotalTimeout,x,o?.resetTimeoutOnProgress??!1),this._transport.send(I,{relatedRequestId:s,resumptionToken:n,onresumptiontoken:a,headers:i,requestSignal:b?.signal}).catch((R)=>{this._progressHandlers.delete(_),h(R)})}).finally(()=>{if(l)o?.signal?.removeEventListener("abort",l);if(d!==void 0)this._responseHandlers.delete(d),this._cleanupTimeout(d)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new L(M.NotConnected,"Not connected");if(Fl(t.method)&&!e.hasNotificationMethod(t.method))throw new L(M.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 o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.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(o,r).catch((s)=>this._onerror(s))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!Hl(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(s,n)=>{let a=this._negotiatedWireCodec(),i=a.validateRequest(e,s);if(!i.ok&&i.reason==="not-in-era")i=a.validateInputRequest(e,s);if(!i.ok){if(i.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value,n))}}else if(r)o=async(s,n)=>{let a=await Vl(t.params,{...s.params});if(!a.success)throw new se(W.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.data,n)};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,o))}_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,r){if(typeof t==="function"){if(!Fl(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,s)=>{let n=s.validateNotification(e,o);if(!n.ok){if(n.reason==="not-in-era")throw new se(W.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(n.message)}return Promise.resolve(t(n.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let s=await Vl(t.params,{...o.params});if(!s.success)throw new se(W.InvalidParams,`Invalid params for notification ${e}: ${s.error}`);await r(s.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function oi(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function md(e,t){let r={...e};for(let o in t){let s=o,n=t[s];if(n===void 0)continue;let a=r[s];r[s]=oi(a)&&oi(n)?{...a,...n}:n}return r}function Vc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function lz(e){let t={},r=[];if(!Vc(e))return{accepted:t,droppedKeys:r};for(let[o,s]of Object.entries(e)){if(!Vc(s)||"method"in s||"result"in s){r.push(o);continue}t[o]=s}return{accepted:t,droppedKeys:r}}function V_(e){throw new L(M.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 dz(e,t,r,o,s){return{sessionId:s,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:dd(void 0),signal:o,send:()=>V_("send"),notify:()=>V_("notify")}}}async function mz(e,t,r,o,s){if(!Vc(o)||typeof o.method!=="string")throw new L(M.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let n=o.method;if(!t.hasInputRequestMethod(n))throw new L(M.InvalidResult,`Invalid input request '${r}': '${n}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:n});let a=e.getRequestHandler(n);if(a===void 0)throw new L(M.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${n}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:n});let i=Vc(o.params)?o.params:void 0;return await a({jsonrpc:"2.0",id:r,method:n,...i!==void 0&&{params:i}},e.buildContext(dz(r,n,i,s,e.sessionId)))}function pz(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 xg(e,t,r,o){let{codec:s,request:n,options:a,flowStartedAt:i}=o,u={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},l={dispatchInputRequest:(d,f,h)=>mz(e,s,d,f,h),retry:(d,f)=>o.retry(d,pz(a,f))};return tz({config:t,method:n.method,originalParams:n.params,firstPayload:u,flowStartedAt:i,signal:a?.signal,requestOptions:{...a?.timeout!==void 0&&{timeout:a.timeout},...a?.maxTotalTimeout!==void 0&&{maxTotalTimeout:a.maxTotalTimeout},...a?.onprogress!==void 0&&{onprogress:a.onprogress}},hooks:l})}function hz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
66
66
|
* content-type
|
|
67
67
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
68
68
|
* MIT Licensed
|
|
69
|
-
*/var Ev=Td((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw TypeError("argument string is required");var l=typeof a==="object"?s(a):a;if(typeof l!=="string")throw TypeError("argument string is required to be a string");var u=l.indexOf(";"),d=u!==-1?l.slice(0,u).trim():l.trim();if(!o.test(d))throw TypeError("invalid media type");var m=new i(d.toLowerCase());if(u!==-1){var f,g,b;t.lastIndex=u;while(g=t.exec(l)){if(g.index!==u)throw TypeError("invalid parameter format");if(u+=g[0].length,f=g[1].toLowerCase(),b=g[2],b.charCodeAt(0)===34){if(b=b.slice(1,-1),b.indexOf("\\")!==-1)b=b.replace(r,"$1")}m.parameters[f]=b}if(u!==l.length)throw TypeError("invalid parameter format")}return m}function s(a){var l;if(typeof a.getHeader==="function")l=a.getHeader("content-type");else if(typeof a.headers==="object")l=a.headers&&a.headers["content-type"];if(typeof l!=="string")throw TypeError("content-type header is missing from object");return l}function i(a){this.parameters=Object.create(null),this.type=a}}),kv=kd(Ev(),1);function Ag(e){if(!e)return;try{return kv.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function tg(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function Mg(e=fetch,t){if(!t)return e;return async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...tg(t.headers),...tg(o.headers)}:t.headers})}var $v=new Set([301,302,303,307,308]),Cv=5;function Iv(e,t){if(e.protocol===t.protocol&&e.host===t.host)return!0;return e.protocol==="http:"&&t.protocol==="https:"&&e.hostname===t.hostname&&!e.port&&!t.port}function qg(e,t){let r=$v.has(t.status)?t.headers?.get("location"):void 0;if(!r)return;try{return new URL(r,e)}catch{return}}var jg=new WeakSet;function Lg(e){let t=(r,o)=>e(r,o);return jg.add(t),t}function on(e){if(jg.has(e))return e;return async(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);let o=(r?.method??"GET").toUpperCase(),n=t;for(let s=0;;s++){let i=await e(n,{...r,redirect:"manual"}),a=qg(n,i);if(!a||s===Cv)return i;let l=new URL(n),u=o==="GET"||i.status===307||i.status===308,d=!(a.username||a.password)||a.username===l.username&&a.password===l.password;if(!u||!d||!Iv(l,a))return i;await i.text?.().catch(()=>{}),n=a}}}function Ug(e,t){if(t.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose where it points";let r=qg(t.url||e,t);if(!r)return;if(r.username=r.password=r.search=r.hash="",r.protocol==="http:"&&new URL(t.url||e).protocol==="https:")return r.protocol="https:",`Redirect from https to plain http not followed; try ${r.href} as the endpoint`;return`Redirect to ${r.href} not followed; use that URL as the endpoint if it is the intended server`}function Bi(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let n=0;n<o;n++)if(!Bi(e[n],t[n]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s of o)if(!Bi(e[s],t[s]))return!1;return!0}return e===t}function pt(e){return encodeURI(Ov(e))}function Ov(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var Nv={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Av={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Mv={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},qv=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 ro(e,t=Object.create(null),r=qv,o=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e.$id||e.id;if(s){let i=new URL(s,r.href);if(i.hash.length>1)t[i.href]=e;else if(i.hash="",o==="")r=i;else ro(e,t,r)}}else if(e!==!0&&e!==!1)return t;let n=r.href+(o?"#"+o:"");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 s=new URL(e.$ref,r.href);s.hash=s.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:s.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let s=new URL(e.$recursiveRef,r.href);s.hash=s.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:s.href})}if(e.$anchor){let s=new URL("#"+e.$anchor,r.href);t[s.href]=e}for(let s in e){if(Mv[s])continue;let i=`${o}/${pt(s)}`,a=e[s];if(Array.isArray(a)){if(Nv[s]){let l=a.length;for(let u=0;u<l;u++)ro(a[u],t,r,`${i}/${u}`)}}else if(Av[s])for(let l in a)ro(a[l],t,r,`${i}/${pt(l)}`);else ro(a,t,r,i)}return t}var jv=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Lv=[0,31,28,31,30,31,30,31,31,30,31,30,31],Uv=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Zv=/^(?=.{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,Dv=/^(?:[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,Fv=/^(?:(?:[^\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,Hv=/^(?:(?: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,Vv=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Jv=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Bv=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Wv=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Kv=(e)=>{if(e[0]==='"')return!1;let[t,r,...o]=e.split("@");if(!t||!r||o.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return r.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},Gv=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Yv=/^((([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,Xv=(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 It(e){return e.test.bind(e)}var Zg={date:Dg,time:Fg.bind(void 0,!1),"date-time":tz,duration:Xv,uri:nz,"uri-reference":It(Dv),"uri-template":It(Fv),url:It(Hv),email:Kv,hostname:It(Zv),ipv4:It(Gv),ipv6:It(Yv),regex:iz,uuid:It(Vv),"json-pointer":It(Jv),"json-pointer-uri-fragment":It(Bv),"relative-json-pointer":It(Wv)};function Qv(e){return e%4===0&&(e%100!==0||e%400===0)}function Dg(e){let t=e.match(jv);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o==2&&Qv(r)?29:Lv[o])}function Fg(e,t){let r=t.match(Uv);if(!r)return!1;let o=+r[1],n=+r[2],s=+r[3],i=!!r[5];return(o<=23&&n<=59&&s<=59||o==23&&n==59&&s==60)&&(!e||i)}var ez=/t|\s/i;function tz(e){let t=e.split(ez);return t.length==2&&Dg(t[0])&&Fg(!0,t[1])}var rz=/\/|:/,oz=/^(?:[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 nz(e){return rz.test(e)&&oz.test(e)}var sz=/[^\\]\\Z/;function iz(e){if(sz.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function az(e){let t=0,r=e.length,o=0,n;while(o<r)if(t++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<r){if(n=e.charCodeAt(o),(n&64512)==56320)o++}return t}function me(e,t,r="2019-09",o=ro(t),n=!0,s=null,i="#",a="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};let u=typeof e,d;switch(u){case"boolean":case"number":case"string":d=u;break;case"object":if(e===null)d="null";else if(Array.isArray(e))d="array";else d="object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:m,$recursiveRef:f,$recursiveAnchor:g,type:b,const:y,enum:v,required:L,not:H,anyOf:x,allOf:Z,oneOf:R,if:w,then:D,else:X,format:Y,properties:ue,patternProperties:$e,additionalProperties:ne,unevaluatedProperties:_e,minProperties:ae,maxProperties:Ce,propertyNames:gt,dependentRequired:qe,dependentSchemas:Xe,dependencies:St,prefixItems:He,items:Ie,additionalItems:At,unevaluatedItems:Mt,contains:_t,minContains:Pe,maxContains:Oe,minItems:Ne,maxItems:st,uniqueItems:br,minimum:Ve,maximum:Je,exclusiveMinimum:je,exclusiveMaximum:Qe,multipleOf:et,minLength:bt,maxLength:yt,pattern:Yt,__absolute_ref__:vt,__absolute_recursive_ref__:yr}=t,I=[];if(g===!0&&s===null)s=t;if(f==="#"){let V=s===null?o[yr]:s,M=`${a}/$recursiveRef`,G=me(e,s===null?t:s,r,o,n,V,i,M,l);if(!G.valid)I.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:M,error:"A subschema had errors."},...G.errors)}if(m!==void 0){let V=o[vt||m];if(V===void 0){let O=`Unresolved $ref "${m}".`;if(vt&&vt!==m)O+=` Absolute URI "${vt}".`;throw O+=`
|
|
69
|
+
*/var fz=Sm((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=s;function s(i){if(!i)throw TypeError("argument string is required");var u=typeof i==="object"?n(i):i;if(typeof u!=="string")throw TypeError("argument string is required to be a string");var l=u.indexOf(";"),d=l!==-1?u.slice(0,l).trim():u.trim();if(!o.test(d))throw TypeError("invalid media type");var f=new a(d.toLowerCase());if(l!==-1){var h,g,b;t.lastIndex=l;while(g=t.exec(u)){if(g.index!==l)throw TypeError("invalid parameter format");if(l+=g[0].length,h=g[1].toLowerCase(),b=g[2],b.charCodeAt(0)===34){if(b=b.slice(1,-1),b.indexOf("\\")!==-1)b=b.replace(r,"$1")}f.parameters[h]=b}if(l!==u.length)throw TypeError("invalid parameter format")}return f}function n(i){var u;if(typeof i.getHeader==="function")u=i.getHeader("content-type");else if(typeof i.headers==="object")u=i.headers&&i.headers["content-type"];if(typeof u!=="string")throw TypeError("content-type header is missing from object");return u}function a(i){this.parameters=Object.create(null),this.type=i}}),_z=bm(fz(),1);function kg(e){if(!e)return;try{return _z.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function B_(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function Pg(e=fetch,t){if(!t)return e;return async(r,o)=>e(r,{...t,...o,headers:o?.headers?{...B_(t.headers),...B_(o.headers)}:t.headers})}var gz=new Set([301,302,303,307,308]),Sz=5;function vz(e,t){if(e.protocol===t.protocol&&e.host===t.host)return!0;return e.protocol==="http:"&&t.protocol==="https:"&&e.hostname===t.hostname&&!e.port&&!t.port}function Tg(e,t){let r=gz.has(t.status)?t.headers?.get("location"):void 0;if(!r)return;try{return new URL(r,e)}catch{return}}var Eg=new WeakSet;function $g(e){let t=(r,o)=>e(r,o);return Eg.add(t),t}function Ss(e){if(Eg.has(e))return e;return async(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);let o=(r?.method??"GET").toUpperCase(),s=t;for(let n=0;;n++){let a=await e(s,{...r,redirect:"manual"}),i=Tg(s,a);if(!i||n===Sz)return a;let u=new URL(s),l=o==="GET"||a.status===307||a.status===308,d=!(i.username||i.password)||i.username===u.username&&i.password===u.password;if(!l||!d||!vz(u,i))return a;await a.text?.().catch(()=>{}),s=i}}}function Cg(e,t){if(t.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose where it points";let r=Tg(t.url||e,t);if(!r)return;if(r.username=r.password=r.search=r.hash="",r.protocol==="http:"&&new URL(t.url||e).protocol==="https:")return r.protocol="https:",`Redirect from https to plain http not followed; try ${r.href} as the endpoint`;return`Redirect to ${r.href} not followed; use that URL as the endpoint if it is the intended server`}function ui(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let s=0;s<o;s++)if(!ui(e[s],t[s]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(let n of o)if(!ui(e[n],t[n]))return!1;return!0}return e===t}function St(e){return encodeURI(bz(e))}function bz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var yz={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},wz={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},zz={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},Rz=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 fo(e,t=Object.create(null),r=Rz,o=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let n=e.$id||e.id;if(n){let a=new URL(n,r.href);if(a.hash.length>1)t[a.href]=e;else if(a.hash="",o==="")r=a;else fo(e,t,r)}}else if(e!==!0&&e!==!1)return t;let s=r.href+(o?"#"+o:"");if(t[s]!==void 0)throw Error(`Duplicate schema URI "${s}".`);if(t[s]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:s});if(e.$ref&&e.__absolute_ref__===void 0){let n=new URL(e.$ref,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:n.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let n=new URL(e.$recursiveRef,r.href);n.hash=n.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:n.href})}if(e.$anchor){let n=new URL("#"+e.$anchor,r.href);t[n.href]=e}for(let n in e){if(zz[n])continue;let a=`${o}/${St(n)}`,i=e[n];if(Array.isArray(i)){if(yz[n]){let u=i.length;for(let l=0;l<u;l++)fo(i[l],t,r,`${a}/${l}`)}}else if(wz[n])for(let u in i)fo(i[u],t,r,`${a}/${St(u)}`);else fo(i,t,r,a)}return t}var xz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,kz=[0,31,28,31,30,31,30,31,31,30,31,30,31],Pz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Tz=/^(?=.{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,Ez=/^(?:[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,$z=/^(?:(?:[^\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,Cz=/^(?:(?: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,Iz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,qz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Oz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Nz=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,jz=(e)=>{if(e[0]==='"')return!1;let[t,r,...o]=e.split("@");if(!t||!r||o.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return r.split(".").every((s)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(s))},Mz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Az=/^((([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,Lz=(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 jt(e){return e.test.bind(e)}var Ig={date:qg,time:Og.bind(void 0,!1),"date-time":Zz,duration:Lz,uri:Vz,"uri-reference":jt(Ez),"uri-template":jt($z),url:jt(Cz),email:jz,hostname:jt(Tz),ipv4:jt(Mz),ipv6:jt(Az),regex:Jz,uuid:jt(Iz),"json-pointer":jt(qz),"json-pointer-uri-fragment":jt(Oz),"relative-json-pointer":jt(Nz)};function Uz(e){return e%4===0&&(e%100!==0||e%400===0)}function qg(e){let t=e.match(xz);if(!t)return!1;let r=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o==2&&Uz(r)?29:kz[o])}function Og(e,t){let r=t.match(Pz);if(!r)return!1;let o=+r[1],s=+r[2],n=+r[3],a=!!r[5];return(o<=23&&s<=59&&n<=59||o==23&&s==59&&n==60)&&(!e||a)}var Dz=/t|\s/i;function Zz(e){let t=e.split(Dz);return t.length==2&&qg(t[0])&&Og(!0,t[1])}var Hz=/\/|:/,Fz=/^(?:[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 Vz(e){return Hz.test(e)&&Fz.test(e)}var Bz=/[^\\]\\Z/;function Jz(e){if(Bz.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function Wz(e){let t=0,r=e.length,o=0,s;while(o<r)if(t++,s=e.charCodeAt(o++),s>=55296&&s<=56319&&o<r){if(s=e.charCodeAt(o),(s&64512)==56320)o++}return t}function Se(e,t,r="2019-09",o=fo(t),s=!0,n=null,a="#",i="#",u=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:a,keyword:"false",keywordLocation:a,error:"False boolean schema."}]};let l=typeof e,d;switch(l){case"boolean":case"number":case"string":d=l;break;case"object":if(e===null)d="null";else if(Array.isArray(e))d="array";else d="object";break;default:throw Error(`Instances of "${l}" type are not supported.`)}let{$ref:f,$recursiveRef:h,$recursiveAnchor:g,type:b,const:_,enum:w,required:I,not:A,anyOf:z,allOf:q,oneOf:x,if:R,then:Z,else:ee,format:X,properties:ne,patternProperties:xe,additionalProperties:te,unevaluatedProperties:ae,minProperties:re,maxProperties:de,propertyNames:bt,dependentRequired:Fe,dependentSchemas:st,dependencies:yt,prefixItems:Ge,items:Le,additionalItems:Dt,unevaluatedItems:Zt,contains:wt,minContains:Oe,maxContains:Ue,minItems:De,maxItems:dt,uniqueItems:Cr,minimum:Ye,maximum:Xe,exclusiveMinimum:Ve,exclusiveMaximum:nt,multipleOf:at,minLength:zt,maxLength:Rt,pattern:or,__absolute_ref__:xt,__absolute_recursive_ref__:Ir}=t,N=[];if(g===!0&&n===null)n=t;if(h==="#"){let B=n===null?o[Ir]:n,U=`${i}/$recursiveRef`,Q=Se(e,n===null?t:n,r,o,s,B,a,U,u);if(!Q.valid)N.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:U,error:"A subschema had errors."},...Q.errors)}if(f!==void 0){let B=o[xt||f];if(B===void 0){let j=`Unresolved $ref "${f}".`;if(xt&&xt!==f)j+=` Absolute URI "${xt}".`;throw j+=`
|
|
70
70
|
Known schemas:
|
|
71
71
|
- ${Object.keys(o).join(`
|
|
72
|
-
- `)}`,Error(O)}let M=`${a}/$ref`,G=me(e,V,r,o,n,s,i,M,l);if(!G.valid)I.push({instanceLocation:i,keyword:"$ref",keywordLocation:M,error:"A subschema had errors."},...G.errors);if(r==="4"||r==="7")return{valid:I.length===0,errors:I}}if(Array.isArray(b)){let V=b.length,M=!1;for(let G=0;G<V;G++)if(d===b[G]||b[G]==="integer"&&d==="number"&&e%1===0&&e===e){M=!0;break}if(!M)I.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b.join('", "')}".`})}else if(b==="integer"){if(d!=="number"||e%1||e!==e)I.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`})}else if(b!==void 0&&d!==b)I.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`});if(y!==void 0){if(d==="object"||d==="array"){if(!Bi(e,y))I.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(y)}.`})}else if(e!==y)I.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(y)}.`})}if(v!==void 0){if(d==="object"||d==="array"){if(!v.some((V)=>Bi(e,V)))I.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}else if(!v.some((V)=>e===V))I.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}if(H!==void 0){let V=`${a}/not`;if(me(e,H,r,o,n,s,i,V).valid)I.push({instanceLocation:i,keyword:"not",keywordLocation:V,error:'Instance matched "not" schema.'})}let zt=[];if(x!==void 0){let V=`${a}/anyOf`,M=I.length,G=!1;for(let O=0;O<x.length;O++){let C=x[O],W=Object.create(l),J=me(e,C,r,o,n,g===!0?s:null,i,`${V}/${O}`,W);if(I.push(...J.errors),G=G||J.valid,J.valid)zt.push(W)}if(G)I.length=M;else I.splice(M,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:V,error:"Instance does not match any subschemas."})}if(Z!==void 0){let V=`${a}/allOf`,M=I.length,G=!0;for(let O=0;O<Z.length;O++){let C=Z[O],W=Object.create(l),J=me(e,C,r,o,n,g===!0?s:null,i,`${V}/${O}`,W);if(I.push(...J.errors),G=G&&J.valid,J.valid)zt.push(W)}if(G)I.length=M;else I.splice(M,0,{instanceLocation:i,keyword:"allOf",keywordLocation:V,error:"Instance does not match every subschema."})}if(R!==void 0){let V=`${a}/oneOf`,M=I.length,G=R.filter((O,C)=>{let W=Object.create(l),J=me(e,O,r,o,n,g===!0?s:null,i,`${V}/${C}`,W);if(I.push(...J.errors),J.valid)zt.push(W);return J.valid}).length;if(G===1)I.length=M;else I.splice(M,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:V,error:`Instance does not match exactly one subschema (${G} matches).`})}if(d==="object"||d==="array")Object.assign(l,...zt);if(w!==void 0){let V=`${a}/if`;if(me(e,w,r,o,n,s,i,V,l).valid){if(D!==void 0){let M=me(e,D,r,o,n,s,i,`${a}/then`,l);if(!M.valid)I.push({instanceLocation:i,keyword:"if",keywordLocation:V,error:'Instance does not match "then" schema.'},...M.errors)}}else if(X!==void 0){let M=me(e,X,r,o,n,s,i,`${a}/else`,l);if(!M.valid)I.push({instanceLocation:i,keyword:"if",keywordLocation:V,error:'Instance does not match "else" schema.'},...M.errors)}}if(d==="object"){if(L!==void 0){for(let O of L)if(!(O in e))I.push({instanceLocation:i,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${O}".`})}let V=Object.keys(e);if(ae!==void 0&&V.length<ae)I.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${ae} properties.`});if(Ce!==void 0&&V.length>Ce)I.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${Ce} properties.`});if(gt!==void 0){let O=`${a}/propertyNames`;for(let C in e){let W=`${i}/${pt(C)}`,J=me(C,gt,r,o,n,s,W,O);if(!J.valid)I.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:O,error:`Property name "${C}" does not match schema.`},...J.errors)}}if(qe!==void 0){let O=`${a}/dependantRequired`;for(let C in qe)if(C in e){let W=qe[C];for(let J of W)if(!(J in e))I.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:O,error:`Instance has "${C}" but does not have "${J}".`})}}if(Xe!==void 0)for(let O in Xe){let C=`${a}/dependentSchemas`;if(O in e){let W=me(e,Xe[O],r,o,n,s,i,`${C}/${pt(O)}`,l);if(!W.valid)I.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:C,error:`Instance has "${O}" but does not match dependant schema.`},...W.errors)}}if(St!==void 0){let O=`${a}/dependencies`;for(let C in St)if(C in e){let W=St[C];if(Array.isArray(W)){for(let J of W)if(!(J in e))I.push({instanceLocation:i,keyword:"dependencies",keywordLocation:O,error:`Instance has "${C}" but does not have "${J}".`})}else{let J=me(e,W,r,o,n,s,i,`${O}/${pt(C)}`);if(!J.valid)I.push({instanceLocation:i,keyword:"dependencies",keywordLocation:O,error:`Instance has "${C}" but does not match dependant schema.`},...J.errors)}}}let M=Object.create(null),G=!1;if(ue!==void 0){let O=`${a}/properties`;for(let C in ue){if(!(C in e))continue;let W=`${i}/${pt(C)}`,J=me(e[C],ue[C],r,o,n,s,W,`${O}/${pt(C)}`);if(J.valid)l[C]=M[C]=!0;else if(G=n,I.push({instanceLocation:i,keyword:"properties",keywordLocation:O,error:`Property "${C}" does not match schema.`},...J.errors),G)break}}if(!G&&$e!==void 0){let O=`${a}/patternProperties`;for(let C in $e){let W=new RegExp(C,"u"),J=$e[C];for(let be in e){if(!W.test(be))continue;let vr=`${i}/${pt(be)}`,wt=me(e[be],J,r,o,n,s,vr,`${O}/${pt(C)}`);if(wt.valid)l[be]=M[be]=!0;else G=n,I.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:O,error:`Property "${be}" matches pattern "${C}" but does not match associated schema.`},...wt.errors)}}}if(!G&&ne!==void 0){let O=`${a}/additionalProperties`;for(let C in e){if(M[C])continue;let W=`${i}/${pt(C)}`,J=me(e[C],ne,r,o,n,s,W,O);if(J.valid)l[C]=!0;else G=n,I.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:O,error:`Property "${C}" does not match additional properties schema.`},...J.errors)}}else if(!G&&_e!==void 0){let O=`${a}/unevaluatedProperties`;for(let C in e)if(!l[C]){let W=`${i}/${pt(C)}`,J=me(e[C],_e,r,o,n,s,W,O);if(J.valid)l[C]=!0;else I.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:O,error:`Property "${C}" does not match unevaluated properties schema.`},...J.errors)}}}else if(d==="array"){if(st!==void 0&&e.length>st)I.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${st}).`});if(Ne!==void 0&&e.length<Ne)I.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${Ne}).`});let V=e.length,M=0,G=!1;if(He!==void 0){let O=`${a}/prefixItems`,C=Math.min(He.length,V);for(;M<C;M++){let W=me(e[M],He[M],r,o,n,s,`${i}/${M}`,`${O}/${M}`);if(l[M]=!0,!W.valid){if(G=n,I.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:O,error:"Items did not match schema."},...W.errors),G)break}}}if(Ie!==void 0){let O=`${a}/items`;if(Array.isArray(Ie)){let C=Math.min(Ie.length,V);for(;M<C;M++){let W=me(e[M],Ie[M],r,o,n,s,`${i}/${M}`,`${O}/${M}`);if(l[M]=!0,!W.valid){if(G=n,I.push({instanceLocation:i,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...W.errors),G)break}}}else for(;M<V;M++){let C=me(e[M],Ie,r,o,n,s,`${i}/${M}`,O);if(l[M]=!0,!C.valid){if(G=n,I.push({instanceLocation:i,keyword:"items",keywordLocation:O,error:"Items did not match schema."},...C.errors),G)break}}if(!G&&At!==void 0){let C=`${a}/additionalItems`;for(;M<V;M++){let W=me(e[M],At,r,o,n,s,`${i}/${M}`,C);if(l[M]=!0,!W.valid)G=n,I.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:C,error:"Items did not match additional items schema."},...W.errors)}}}if(_t!==void 0)if(V===0&&Pe===void 0)I.push({instanceLocation:i,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Pe!==void 0&&V<Pe)I.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${V}) than minContains (${Pe}).`});else{let O=`${a}/contains`,C=I.length,W=0;for(let J=0;J<V;J++){let be=me(e[J],_t,r,o,n,s,`${i}/${J}`,O);if(be.valid)l[J]=!0,W++;else I.push(...be.errors)}if(W>=(Pe||0))I.length=C;if(Pe===void 0&&Oe===void 0&&W===0)I.splice(C,0,{instanceLocation:i,keyword:"contains",keywordLocation:O,error:"Array does not contain item matching schema."});else if(Pe!==void 0&&W<Pe)I.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${Pe} items matching schema. Only ${W} items were found.`});else if(Oe!==void 0&&W>Oe)I.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${Oe} items matching schema. ${W} items were found.`})}if(!G&&Mt!==void 0){let O=`${a}/unevaluatedItems`;for(;M<V;M++){if(l[M])continue;let C=me(e[M],Mt,r,o,n,s,`${i}/${M}`,O);if(l[M]=!0,!C.valid)I.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:O,error:"Items did not match unevaluated items schema."},...C.errors)}}if(br)for(let O=0;O<V;O++){let C=e[O],W=typeof C==="object"&&C!==null;for(let J=0;J<V;J++){if(O===J)continue;let be=e[J];if(C===be||W&&typeof be==="object"&&be!==null&&Bi(C,be))I.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${O} and ${J}.`}),O=Number.MAX_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER}}}else if(d==="number"){if(r==="4"){if(Ve!==void 0&&(je===!0&&e<=Ve||e<Ve))I.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${je?"or equal to ":""} ${Ve}.`});if(Je!==void 0&&(Qe===!0&&e>=Je||e>Je))I.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Qe?"or equal to ":""} ${Je}.`})}else{if(Ve!==void 0&&e<Ve)I.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ve}.`});if(Je!==void 0&&e>Je)I.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Je}.`});if(je!==void 0&&e<=je)I.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${je}.`});if(Qe!==void 0&&e>=Qe)I.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${Qe}.`})}if(et!==void 0){let V=e%et;if(Math.abs(0-V)>=0.00000011920929&&Math.abs(et-V)>=0.00000011920929)I.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${et}.`})}}else if(d==="string"){let V=bt===void 0&&yt===void 0?0:az(e);if(bt!==void 0&&V<bt)I.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${V} < ${bt}).`});if(yt!==void 0&&V>yt)I.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${V} > ${yt}).`});if(Yt!==void 0&&!new RegExp(Yt,"u").test(e))I.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."});if(Y!==void 0&&Zg[Y]&&!Zg[Y](e))I.push({instanceLocation:i,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${Y}".`})}return{valid:I.length===0,errors:I}}var cz=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",r=!0){this.schema=e,this.draft=t,this.shortCircuit=r,this.lookup=ro(e)}validate(e){return me(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};ro(e,this.lookup)}},Cc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Id(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new cz(e,this.draft??this._draftFor(e),this.shortcircuit);return(r)=>{let o=t.validate(r);return o.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map((n)=>`${n.instanceLocation}: ${n.error}`).join("; ")}}}};var Hg=!0;var ju;ju=globalThis.crypto;async function lz(e){return(await ju).getRandomValues(new Uint8Array(e))}async function uz(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let n=await lz(e-o.length);for(let s of n)if(s<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return o}async function dz(e){return await uz(e)}async function pz(e){let t=await(await ju).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Lu(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await dz(e),r=await pz(t);return{code_verifier:t,code_challenge:r}}var nn=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Ze(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 Ze(this,e)}constructor(e){super(e);this.name=new.target.name,hr(this,new.target)}},Ac=class extends nn{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`);this.kind=e,this.expected=t,this.received=r}},eS=class extends nn{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}},Ku=class extends nn{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}},Wi=class extends nn{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}},Gu=class extends nn{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}};function Ju(e,t,r){if(!e)return;if(typeof e.issuer!=="string"){if(r?.canPersistStamp!==!1)console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.");return e.issuer===void 0?e:{...e,issuer:void 0}}return tS(e.issuer,t)?e:void 0}function tS(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function rS(e){if(e==null)return!1;let t=e;return typeof t.tokens==="function"&&typeof t.clientInformation==="function"}async function hz(e,t,r){let{resourceMetadataUrl:o,scope:n}=sn(t.response);if(await jc(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:n,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new ht}function oS(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async(r)=>hz(e,r,t)}}var ht=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Ze(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 Ze(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",hr(this,new.target)}};function Yu(e){return e?.authorization_response_iss_parameter_supported===!0}function Mc({iss:e,expectedIssuer:t,issParameterSupported:r}){if(t===void 0)return;if(e===void 0){if(r)throw new Ac("authorization_response",t,void 0);return}if(e!==t)throw new Ac("authorization_response",t,e)}function qc(...e){let t=new Set;for(let r of e){if(!r)continue;for(let o of r.split(/\s+/))if(o)t.add(o)}return t.size>0?[...t].join(" "):void 0}function nS(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let o of e.split(/\s+/))if(o&&!r.has(o))return!0;return!1}async function sS(e,t,r,o,n){if(typeof e==="string")return{authorizationCode:e,iss:t};let s=e.get("iss")??void 0,i=e.get("code");if(i)return{authorizationCode:i,iss:s};let a=(await r.discoveryState?.())?.authorizationServerMetadata;if(!a)try{a=(await ed(o,n)).authorizationServerMetadata}catch{a=void 0}if(!a)throw new ht("Authorization callback failed and the issuer could not be verified");Mc({iss:s,expectedIssuer:a.issuer,issParameterSupported:Yu(a)});let l=e.get("error");if(l)throw new mr(l,e.get("error_description")??l,e.get("error_uri")??void 0);throw new ht("Authorization callback contained neither `code` nor `error`")}function mz(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Uu="code",Zu="S256";function iS(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&mz(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function aS(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":fz(n,s,r);return;case"client_secret_post":gz(n,s,o);return;case"none":Sz(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function fz(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function gz(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function Sz(e,t){t.set("client_id",e)}function cS(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function lS(e){let t=new URL(String(e));if(t.protocol!=="https:"&&!cS(t.hostname))throw new Ku(t.href);return t}function _z(e){for(let t of e??[]){let r;try{r=new URL(t)}catch{continue}if(r.protocol!=="http:"&&r.protocol!=="https:")return"native";if(cS(r.hostname))return"native"}return"web"}function uS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:["authorization_code","refresh_token"]),application_type:t.application_type??_z(t.redirect_uris)}}async function Bu(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Qr.parse(JSON.parse(r));return mr.fromResponse(o)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new mr($t.ServerError,n)}}function Vg(e,t,r){let o=e.invalidateCredentials===void 0?`retrying authorization without discarding the stored ${r} (provider implements no invalidateCredentials())`:`invalidating the stored ${r} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(t.code)} — ${o}. Cause: ${JSON.stringify(t.message)}`)}async function jc(e,t){try{return await Du(e,t)}catch(r){if(r instanceof mr){if(r.code===$t.InvalidClient||r.code===$t.UnauthorizedClient)return Vg(e,r,"client credentials and tokens"),await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await Du(e,t);else if(r.code===$t.InvalidGrant||r.code===$t.InvalidDpopProof)return Vg(e,r,"tokens"),await e.invalidateCredentials?.("tokens"),await Du(e,t)}throw r}}function bz(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:n}=e,s=t||r?.scopes_supported?.join(" ")||n.scope;if(s&&o?.scopes_supported?.includes("offline_access")&&!s.split(" ").includes("offline_access")&&n.grant_types?.includes("refresh_token"))s=`${s} offline_access`;return s}async function Du(e,{serverUrl:t,authorizationCode:r,iss:o,scope:n,resourceMetadataUrl:s,fetchFn:i,skipIssuerMetadataValidation:a,forceReauthorization:l}){let u=uS(e),d=await e.discoveryState?.(),m,f,g,b,y=s;if(!y&&d?.resourceMetadataUrl)y=new URL(d.resourceMetadataUrl);if(d?.authorizationServerUrl){if(f=d.authorizationServerUrl,m=d.resourceMetadata,g=d.authorizationServerMetadata??await Qu(f,{fetchFn:i,skipIssuerValidation:a}),!m)try{m=await Xu(t,{resourceMetadataUrl:y},i)}catch(ne){if(ne instanceof TypeError)throw ne}if(g!==d.authorizationServerMetadata||m!==d.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(f),resourceMetadataUrl:y?.toString(),resourceMetadata:m,authorizationServerMetadata:g})}else{let ne=await ed(t,{resourceMetadataUrl:y,fetchFn:i,skipIssuerMetadataValidation:a});f=ne.authorizationServerUrl,g=ne.authorizationServerMetadata,m=ne.resourceMetadata,b={authorizationServerUrl:String(f),resourceMetadataUrl:y?.toString(),resourceMetadata:m,authorizationServerMetadata:g}}let v=g?.issuer??String(f),L={issuer:v};if(await e.saveAuthorizationServerUrl?.(v),r!==void 0){let ne=d?.authorizationServerMetadata?.issuer??d?.authorizationServerUrl;if(ne===void 0){if(e.saveDiscoveryState!==void 0)throw new Wi("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",v);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.")}else if(!tS(ne,v))throw new Wi(ne,v)}if(b)await e.saveDiscoveryState?.(b);let H=await pS(t,e,m),x=H&&m&&!e.validateResourceURL?m.resource:H;if(x)await e.saveResourceUrl?.(td(x));let Z=bz({requestedScope:n,resourceMetadata:m,authServerMetadata:g,clientMetadata:e.clientMetadata}),R=await Promise.resolve(e.clientInformation(L)),w=Ju(R,v,{canPersistStamp:e.saveClientInformation!==void 0});if(w===void 0&&R?.issuer&&e.saveClientInformation===void 0)throw new Wi(R.issuer,v);if(w&&w.issuer===void 0)w={...w,issuer:v},await e.saveClientInformation?.(w,L);if(!w){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let ne=g?.client_id_metadata_document_supported===!0,_e=e.clientMetadataUrl;if(_e&&!dS(_e))throw new mr($t.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${_e}`);if(ne&&_e)w={client_id:_e,issuer:v},await e.saveClientInformation?.(w,L);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");w={...await yS(f,{metadata:g,clientMetadata:u,scope:Z,fetchFn:i}),issuer:v},await e.saveClientInformation(w,L)}}let D=!e.redirectUrl;if(r!==void 0||D){if(r!==void 0)Mc({iss:o,expectedIssuer:g?.issuer,issParameterSupported:Yu(g)});let ne=await bS(e,f,{metadata:g,resource:x,authorizationCode:r,iss:o,scope:Z,fetchFn:i});return await e.saveTokens({...ne,issuer:v},L),"AUTHORIZED"}let X=Ju(await e.tokens(L),v);if(X&&X.issuer===void 0)X={...X,issuer:v},await e.saveTokens(X,L);if(X?.refresh_token&&!l){let ne=await e.scopeForRefresh?.(X),_e;try{_e=await _S(f,{metadata:g,clientInformation:w,refreshToken:X.refresh_token,scope:ne,resource:x,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:i})}catch(ae){if(ae instanceof Ku)throw ae;if(!(ae instanceof mr)||ae.code===$t.ServerError)console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(ae instanceof Error?ae.message:String(ae))}`);else throw ae}if(_e)return await e.saveTokens({..._e,issuer:v},L),"AUTHORIZED"}let Y=e.state?await e.state():void 0,{authorizationUrl:ue,codeVerifier:$e}=await fS(f,{metadata:g,clientInformation:w,state:Y,redirectUrl:e.redirectUrl,scope:Z,resource:x});return await e.saveCodeVerifier($e),await e.redirectToAuthorization(ue),"REDIRECT"}function dS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function pS(e,t,r){let o=zu(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!wu({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}var yz=new Set(["bearer","dpop"]);function sn(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!yz.has(r.toLowerCase())||!o)return{};let n=Ic(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=Ic(e,"scope")||void 0,a=Ic(e,"error")||void 0,l=Ic(e,"error_description")||void 0;return{resourceMetadataUrl:s,scope:i,error:a,errorDescription:l}}function Ic(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),n=r.match(o);if(n){let s=n[1]||n[2];if(s)return s}return null}async function Xu(e,t,r=fetch){let o=await wz(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Qo.parse(await o.json())}async function hS(e,t,r=fetch){let o=on(r);try{return await o(e,{headers:t})}catch(n){if(!(n instanceof TypeError)||!Hg)throw n;if(t)try{return await o(e,{})}catch(s){if(!(s instanceof TypeError))throw s;return}return}}function vz(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Jg(e,t,r=fetch){return await hS(e,{"MCP-Protocol-Version":t},r)}function zz(e,t){if(!e)return!0;if(t==="/")return!1;return!e.ok&&e.status<500||e.status===502}async function wz(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??Mr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let l=vz(t,n.pathname);i=new URL(l,o?.metadataServerUrl??n),i.search=n.search}let a=await Jg(i,s,r);if(!o?.metadataUrl&&zz(a,n.pathname))a=await Jg(new URL(`/.well-known/${t}`,n),s,r);return a}function mS(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;if(n.endsWith("/"))n=n.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"},{url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Qu(e,{fetchFn:t=fetch,protocolVersion:r=Mr,skipIssuerValidation:o=!1}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},s=mS(e);for(let{url:i,type:a}of s){let l=await hS(i,n,t);if(!l)continue;if(!l.ok){if(await l.text?.().catch(()=>{}),l.status<500||l.status===502)continue;throw Error(`HTTP ${l.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}let u=a==="oauth"?Yr.parse(await l.json()):en.parse(await l.json());if(!o){let d=typeof e==="string"?e:e.href;if(!(u.issuer===d||d.endsWith("/")&&u.issuer===d.slice(0,-1)))throw new Ac("metadata",d,u.issuer)}return u}}async function ed(e,t){let r,o;try{if(r=await Xu(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch(s){if(s instanceof TypeError)throw s}if(!o)o=String(new URL("/",e));let n=await Qu(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}function td(e){return typeof e==="string"?e:e.href}async function fS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Uu))throw Error(`Incompatible auth server: does not support response type ${Uu}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Zu))throw Error(`Incompatible auth server: does not support code challenge method ${Zu}`)}else a=new URL("/authorize",e);let l=await Lu(),{code_verifier:u,code_challenge:d}=l;if(a.searchParams.set("response_type",Uu),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",Zu),a.searchParams.set("redirect_uri",String(o)),s)a.searchParams.set("state",s);if(n)a.searchParams.set("scope",n);if(n?.split(" ").includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",td(i));return{authorizationUrl:a,codeVerifier:u}}function gS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function SS(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,dpop:i,fetchFn:a}){let l=lS(t?.token_endpoint??new URL("/token",e)),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",td(s));if(!n&&o)aS(iS(o,t?.token_endpoint_auth_methods_supported??[]),o,u,r);let d=async()=>{let g=new Headers(u);if(n)await n(g,r,l,t);if(i)g.set("DPoP",await i.buildProof({htm:"POST",htu:l}));return on(a??fetch)(l,{method:"POST",headers:g,body:r})},m=await d();if(i&&m.status===400){if((await m.clone().json().catch(()=>{}))?.error===$t.UseDpopNonce)i.observeNonce(m,l),m=await d()}if(i?.observeNonce(m,l),!m.ok)throw await Bu(m);let f=await m.json();try{return Xr.parse(Ec(f))}catch(g){if(typeof f==="object"&&f!==null&&"error"in f)throw await Bu(JSON.stringify(f));throw g}}async function _S(e,{metadata:t,clientInformation:r,refreshToken:o,scope:n,resource:s,addClientAuthentication:i,dpop:a,fetchFn:l}){let u=new URLSearchParams({grant_type:"refresh_token",refresh_token:o});if(n)u.set("scope",n);let d=await SS(e,{metadata:t,tokenRequestParams:u,clientInformation:r,addClientAuthentication:i,resource:s,dpop:a,fetchFn:l});return{refresh_token:o,...d,...n&&!d.scope&&{scope:n}}}async function bS(e,t,{metadata:r,resource:o,authorizationCode:n,iss:s,scope:i,fetchFn:a}={}){if(n!==void 0)Mc({iss:s,expectedIssuer:r?.issuer,issParameterSupported:Yu(r)});let l=r?.issuer??String(t),u=async()=>{let g=await e.clientInformation({issuer:l}),b=Ju(g,l,{canPersistStamp:!1});if(g&&b===void 0)throw new Wi(String(g.issuer),l);return b},d=await u(),m=i??e.clientMetadata.scope,f;if(e.prepareTokenRequest)f=await e.prepareTokenRequest(m);if(!f){if(!n)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");f=gS(n,await e.codeVerifier(),e.redirectUrl)}return d??=await u(),SS(t,{metadata:r,tokenRequestParams:f,clientInformation:d,addClientAuthentication:e.addClientAuthentication,resource:o,dpop:await e.dpop?.(),fetchFn:a})}async function yS(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i={...r,...o===void 0?{}:{scope:o}},a=await on(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok)throw new eS({status:a.status,body:await a.text(),submittedMetadata:i});return tn.parse(Ec(await a.json()))}var Oc=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),vS=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(Fu(e))}set(e,t){let r=Fu(e),o=Oc.has(e.method),n=!this._entries.has(r);if(!o&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!Oc.has(i.slice(0,i.indexOf("\x00")))){this._entries.delete(i),this._cappedSize--;break}}let s=++this._stamp;if(this._entries.set(r,{...t,stamp:s}),n&&!o)this._cappedSize++;return s}delete(e){if(this._entries.delete(Fu(e))&&!Oc.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,r=Oc.has(e);for(let o of this._entries.keys())if(o.startsWith(t)){if(this._entries.delete(o),!r)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function Fu(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function Hu(e,t){return t===void 0?e:`${e}\x00${t}`}var zS=86400000,Rz=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,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 r={method:e,params:t??""},o=this._partitionFor("private"),n=await this._store.get({...r,partition:o});if(n!==void 0)return n;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}}async evictKey(e,t){let r=Hu(e,t),o=this._evictionGeneration.get(r);if(o!==void 0)this._evictionGeneration.set(r,o+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let r=Hu(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(Hu(e,o?.params))??0)!==r)return;let n=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),a=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:n,partition:a},{value:xz(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(l){this._reportError(l)}if(i!==s)try{await this._store.delete({method:e,params:n,partition:a===s?i:s})}catch(l){this._reportError(l)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt===void 0||!(r.expiresAt>this.now()))return;try{let o=JSON.parse(r.value);if(typeof o!=="object"||o===null||Array.isArray(o))throw TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),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 r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let n of r.tools)o.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},n=new Map;for(let s of o.tools){let i=t(s);if(i!==void 0)n.set(s.name,i)}this._toolOutputValidatorIndex={stamp:r.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((r)=>r!==null&&typeof r==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function xz(e){let t;try{t=JSON.stringify(e)}catch(r){throw TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var wS=Symbol.for("mcp.authSeamEscape");function Ge(e){if(typeof e==="object"&&e!==null||typeof e==="function")try{Object.defineProperty(e,wS,{value:!0,configurable:!0})}catch{}return e}function Pz(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[wS]===!0}var Tz=-32022,Ez=new Set([-32001,-32020,-32021]);function kz(e,t){switch(e.kind){case"result":return $z(e.result,t);case"rpc-error":return RS(e,t);case"http-error":return Cz(e,t);case"network-error":return Bg(e.error,t);case"unusable-reply":return{kind:"error",error:new A(N.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${xS(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 Bg(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new A(N.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function $z(e,t){let r=Jt(kc).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,n=t.clientModernVersions.find((s)=>o.includes(s));if(n!==void 0)return{kind:"modern",version:n,discover:r.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new Hi({supported:[...o],requested:t.requestedVersion})}}function RS(e,t){let{code:r,message:o,data:n}=e;if(r===Tz){let s=Oz(n);if(s===void 0)return{kind:"legacy"};let i=new Hi({supported:s,requested:Nz(n)??t.requestedVersion},o),a=Fi(s),l=t.clientModernVersions.find((u)=>a.includes(u));if(l!==void 0)return{kind:"corrective",version:l,error:i};if(a.length>0)return{kind:"error",error:i};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}if(Ez.has(r))return{kind:"legacy"};return{kind:"legacy"}}function Cz(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new dt(o?N.ClientHttpForbidden:N.ClientHttpAuthentication,`Version negotiation failed: ${o?"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 dt(N.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=Az(e.body);if(r!==void 0)return RS(r,t);return{kind:"legacy"}}function Bg(e,t){if(t.environment==="browser"&&Iz(e))return{kind:"legacy"};return{kind:"error",error:new A(N.EraNegotiationFailed,`Version negotiation probe failed: ${xS(e)}`,{cause:e},{cause:e})}}function Iz(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function xS(e){return e instanceof Error?e.message:String(e)}function Oz(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((r)=>typeof r==="string"))return;return t}function Nz(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function Az(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let r=t.error;if(typeof r!=="object"||r===null)return;let{code:o,message:n,data:s}=r;if(typeof o!=="number")return;return{code:o,message:typeof n==="string"?n:"",data:s}}var Mz="legacy";function qz(e,t){let r=e?.mode??Mz;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r==="object"){if(!Ct(r.pin))throw TypeError(`versionNegotiation: { pin: '${r.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:r.pin,probe:o}}let n=t?Fi(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...Ru],fallbackAvailable:t?xu(t).length>0:!0,probe:o}}function Wg(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Kg(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var jz=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 r=new e(t);t.onmessage=(o)=>{let n=r._pending;if(n!==void 0&&(eo(o)||to(o))&&o.id===n.id){if(r._pending=void 0,eo(o))n.resolve({kind:"response",result:o.result});else n.resolve({kind:"response",error:o.error});return}},t.onerror=(o)=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;if(o!==void 0)r._pending=void 0,o.resolve({kind:"closed"});r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise((n)=>{let s=!1,i=(l)=>{if(s)return;if(s=!0,clearTimeout(a),this._pending?.id===o)this._pending=void 0;n(l)},a=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch((l)=>i({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,r=this._transport,o=!1,n=()=>{if(!o){o=!0;return}t()};r.onclose=n,Wu.set(r,()=>{if(r.onclose===n)r.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},Wu=new WeakMap;function Gg(e){let t=Wu.get(e);Wu.delete(e),t?.()}function Lz(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Jt(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function Uz(e){if(e instanceof A&&e.code===N.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function Zz(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 r=e.error;if(Pz(r)||r instanceof ht||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof dt){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o==="string"?o:void 0,statusText:r.data.statusText}}if(Uz(r))return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function PS(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,s=e.kind==="auto"&&e.fallbackAvailable,i=await jz.open(t.transport),a=async()=>{let u=n[0],d=!1,m=o;for(;;){let f=await i.exchange((y)=>Lz(y,u,t.clientInfo,t.capabilities),r);if(f.kind==="timeout"&&m>0){m--;continue}let g=Zz(f,r),b=kz(g,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:s,environment:t.environment,transportKind:t.transportKind});switch(b.kind){case"modern":return{era:"modern",version:b.version,discover:b.discover};case"corrective":if(d)throw b.error;d=!0,u=b.version;continue;case"legacy":{let y=g.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new A(N.EraNegotiationFailed,y===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: ${y} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new A(N.EraNegotiationFailed,y===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: ${y} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(y!==void 0&&t.disposableProbe!==!0)throw new A(N.EraNegotiationFailed,`Version negotiation failed: ${y} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw b.error}}},l;try{l=await a()}catch(u){throw i.detach(),u}return i.release(),l}function Dz(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r==="object"&&r!==null&&typeof r.command==="string"?r:void 0}async function Fz(e,t,r,o){let s=new t.constructor({...r,stderr:"ignore"}),i=t.close,a=!1,l,u=new Promise((m,f)=>{l=()=>f(Yg())});t.close=async function(){return a=!0,l?.(),i.call(t)};let d;try{let m=PS(e,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});m.catch(()=>{}),d=await Promise.race([m,u])}finally{await Hz(s),t.close=i}if(a)throw Yg();return d}function Yg(){return new A(N.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function Hz(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Xg(e){let t=e._meta?.[Pt];return Au.Implementation(t)?t:void 0}function Nc(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)Nc(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Nc(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Nc(r,t)}}function TS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function Vz(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&lr.safeParse(e.discover).success)return e}throw new A(N.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Qg={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},Jz=64,Vu={},rd=class extends Ji{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{Vu.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,Vu.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),Vu.readResource=(e,t,r)=>e._readResource(t,r)}_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 A(N.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 Cc,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=$g(t?.inputRequired),this._cache=new Rz(t?.responseCacheStore??new vS,t?.responseCacheStore!==void 0,(r)=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??Jz,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Ct(this._negotiatedProtocolVersion)&&fr(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 A(N.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 Ng({getRequestHandler:(r)=>this._getRequestHandler(r),buildContext:(r)=>this.buildContext(r,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=qu(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(r,o)=>{let n=Jt(this._negotiatedProtocolVersion),s=n.validateRequest("elicitation/create",r);if(!s.ok&&s.reason==="not-in-era")s=n.validateInputRequest("elicitation/create",r);if(!s.ok)throw new re(s.reason==="not-in-era"?B.InternalError:B.InvalidParams,s.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${s.message}`);let{params:i}=s.value;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:l}=TS(this._capabilities.elicitation);if(i.mode==="form"&&!a)throw new re(B.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!l)throw new re(B.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(r,o),d=n.validateResult("elicitation/create",u);if(!d.ok&&d.reason==="not-in-era")d=n.validateInputResponse("elicitation/create",u);if(!d.ok)throw new re(d.reason==="not-in-era"?B.InternalError:B.InvalidParams,d.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${d.message}`);let m=d.value,f=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&m.action==="accept"&&m.content&&f&&this._capabilities.elicitation?.form?.applyDefaults)try{Nc(f,m.content)}catch{}return m};if(e==="sampling/createMessage")return async(r,o)=>{let n=Jt(this._negotiatedProtocolVersion),s=n.validateRequest("sampling/createMessage",r);if(!s.ok&&s.reason==="not-in-era")s=n.validateInputRequest("sampling/createMessage",r);if(!s.ok)throw new re(s.reason==="not-in-era"?B.InternalError:B.InvalidParams,s.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${s.message}`);let{params:i}=s.value,a=await t(r,o),l=Boolean(i.tools||i.toolChoice),u=n.samplingResultVariant(l,a);if(!u.ok&&u.reason==="not-in-era")u=n.validateInputResponse("sampling/createMessage",a);if(!u.ok)throw new re(u.reason==="not-in-era"?B.InternalError:B.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 A(N.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,Vz(t.prior),t);let r=qz(this._versionNegotiation,this._supportedProtocolVersionsOption);if(r.kind!=="legacy")return this._connectNegotiated(e,r,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;if(r!==void 0)e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=xu(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new A(N.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!r.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(o){throw this.close(),o}}async _connectNegotiated(e,t,r){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 o;try{let n=Kg(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Wg(),defaultTimeoutMs:r?.timeout??Vi},i=n==="stdio"?Dz(e):void 0;o=i===void 0?await PS(t,{...s,transport:e,transportKind:n}):await Fz(t,e,i,s)}catch(n){throw await e.close().catch(()=>{}),Gg(e),n}if(Gg(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Xg(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion)e.setProtocolVersion(o.version);if(this._listChangedConfig){let n=this._listChangedConfig,s=this._serverCapabilities,i={...n.tools&&s?.tools?.listChanged&&{tools:n.tools},...n.prompts&&s?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&s?.resources?.listChanged&&{resources:n.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(u){a=!1,this.onerror?.(u instanceof Error?u:Error(String(u)))}let l=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(l).length>0){let u=new AbortController,d=()=>u.abort(r?.signal?.reason);if(r?.signal?.aborted)d();r?.signal?.addEventListener("abort",d);try{this._autoOpenedSubscription=await this.listen(l,{timeout:r?.timeout,signal:u.signal})}catch(m){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),m;this.onerror?.(m instanceof Error?m:Error(String(m)))}finally{r?.signal?.removeEventListener("abort",d)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,s=(n&&Fi(n).length>0?Fi(n):Ru).find((i)=>o.supportedVersions.includes(i));if(s===void 0)throw new A(N.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=o,this._serverCapabilities=o.capabilities,this._serverVersion=Xg(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}}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 Ct(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new A(N.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new A(N.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 A(N.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new A(N.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new A(N.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new A(N.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 A(N.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 A(N.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new A(N.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new A(N.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"},lr,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 r=await this._serveFromCache("prompts/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("prompts/list",e,t,(o)=>o.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 r=await this._serveFromCache("resources/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/list",e,t,(o)=>o.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 r=await this._serveFromCache("resources/templates/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/templates/list",e,t,(o)=>o.resourceTemplates)}async _listAllPages(e,t,r,o,n){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),a=(u)=>{let d=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...d&&{params:d}},r)},l=await this._walkPages(e,a,o);if(delete l.nextCursor,n?.(l),s)return l;return await this._cache.write(e,l,i,this._freshness(l)),l}async _walkPages(e,t,r){let o=await t(void 0),n=o.nextCursor,s=o,i=1;while(n!==void 0){if(this._listMaxPages!==0&&i>=this._listMaxPages)throw new A(N.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let a=await t(n);if(a.nextCursor===n&&JSON.stringify(r(a))===JSON.stringify(r(s)))break;r(o).push(...r(a)),s=a,n=a.nextCursor,i++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs==="number"?r.ttlMs:this._defaultCacheTtlMs,n=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),zS),scope:n,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch((n)=>void this._reportStoreError(n));if(o!==void 0){if(r?.signal?.aborted){let n=r.signal.reason;throw n instanceof A?n:new A(N.RequestTimeout,String(n))}return o.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 r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:Iu(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let s=this._freshness(n,e.uri);if(s.expiresAt>this._cache.now())await this._cache.write("resources/read",n,o,s);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 A(N.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Ct(r))throw new A(N.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let x=t.signal.reason;throw x instanceof A?x:new A(N.RequestTimeout,String(x))}let o=new AbortController,n=`listen:${this._nextListenId++}`,s="opening",i,a,l,u,d=new Promise((x,Z)=>{l=x,u=Z}),m,f=new Promise((x)=>{m=x}),g=(x)=>{if(s==="closed")return;let Z=s==="opening";if(i!==void 0)clearTimeout(i),i=void 0;if("ack"in x){s="open",l(x.ack);return}if(s="closed",a!==void 0)t?.signal?.removeEventListener("abort",a);if(this._listenState.delete(n),o.abort(),m(x.cause),Z)u(x.error??new A(N.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},b=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},y=async()=>{if(s==="closed")return;g({cause:"local"}),await b()};this._listenState.set(n,{settle:g});let v=t?.timeout??Vi;if(i=setTimeout(()=>{g({cause:"remote",error:new A(N.RequestTimeout,"subscriptions/listen ack timed out",{timeout:v})}),b().catch(()=>{})},v),t?.signal){let x=t.signal;a=()=>{if(s==="closed")return;let Z=x.reason;g({cause:"local",error:Z instanceof Error?Z:Error(String(Z??"Aborted"))}),b().catch(()=>{})},x.addEventListener("abort",a,{once:!0})}let L={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},H=(x)=>{g({cause:"remote",error:x instanceof Error?x:Error(String(x))})};try{this.transport.send(L,{requestSignal:o.signal,onRequestStreamEnd:()=>g({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(H)}catch(x){H(x)}return{honoredFilter:await d,close:y,closed:f}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(Qg,e.method)?Qg[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;if(typeof o==="string")this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Po],n=typeof o==="string"?this._listenState.get(o):void 0;if(n!==void 0){let s=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:s.ok?s.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,n=typeof o==="string"?this._listenState.get(o):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,r=typeof t==="string"?this._listenState.get(t):void 0;if(r!==void 0){if(to(e))r.settle({cause:"remote",error:re.fromError(e.error.code,e.error.message,e.error.data)});else r.settle({cause:"graceful",error:new A(N.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new A(N.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 r=this.getProtocolEra()==="modern"&&Wg()!=="browser",o=async()=>{if(!r)return t;let l;try{l=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(d){this._reportStoreError(d)}if(!l?.valid||l.declarations.length===0)return t;let u=Tg(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),s=()=>{if(n===void 0||n.ok)return;let l=n.compileError,u=(l instanceof Error?l.message:String(l)).slice(0,200);throw new re(B.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};s();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(l){let u=l instanceof re&&l.code===rn;if(!r||!u||t?.toolDefinition!==void 0)throw l;let d={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,d).catch((m)=>this._reportStoreError(m)),n=await this._cache.outputValidator(e.name,(m)=>this._compileOutputValidator(m)).catch((m)=>void this._reportStoreError(m)),s(),i=await this.request({method:"tools/call",params:e},await o())}let a=n!==void 0&&n.ok?n.validator:void 0;if(a){if(i.structuredContent===void 0&&!i.isError)throw new re(B.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let l=a(i.structuredContent);if(!l.valid)throw new re(B.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)}catch(l){if(l instanceof re)throw l;throw new re(B.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)}}return i}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 o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("tools/list",e,t,(o)=>o.tools,(o)=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Kg(this.transport)==="stdio")return;let t=e.tools.filter((r)=>{let o=Iu(r.inputSchema);if(!o.valid)return console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration — ${o.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,r,o){let n=$c(ei,r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,l=async()=>{if(!s){a(null,null);return}try{a(null,await o())}catch(d){a(d instanceof Error?d:Error(String(d)),null)}},u=()=>{if(i){let d=this._listChangedDebounceTimers.get(e);if(d)clearTimeout(d);let m=setTimeout(l,i);this._listChangedDebounceTimers.set(e,m)}else l()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class Lc extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var ES=10,Bz=13,oo=32;function od(e){}function CS(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=od,onError:r=od,onRetry:o=od,onComment:n,maxBufferSize:s}=e,i=[],a=0,l=!0,u,d="",m=0,f,g=!1;function b(R){if(g)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,R.charCodeAt(0)===239&&R.charCodeAt(1)===187&&R.charCodeAt(2)===191&&(R=R.slice(3))),i.length===0){let X=v(R);X!==""&&(i.push(X),a=X.length),y();return}if(R.indexOf(`
|
|
73
|
-
`)===-1&&
|
|
74
|
-
`,
|
|
75
|
-
`,
|
|
76
|
-
`,
|
|
77
|
-
${
|
|
78
|
-
`,
|
|
79
|
-
`,
|
|
80
|
-
${
|
|
81
|
-
${w}`,m++;break;case"id":w.includes("\x00")||(u=w);break;case"retry":/^\d+$/.test(w)?o(parseInt(w,10)):r(new Lc(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:D}));break;default:r(new Lc(`Unknown field "${R.length>20?`${R.slice(0,20)}…`:R}"`,{type:"unknown-field",field:R,value:w,line:D}));break}}function x(){m>0&&t({id:u,event:f,data:d}),u=void 0,d="",m=0,f=void 0}function Z(R={}){if(R.consume&&i.length>0){let w=i.join("");L(w,0,w.length)}l=!0,u=void 0,d="",m=0,f=void 0,i.length=0,a=0,g=!1}return{feed:b,reset:Z}}function kS(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function $S(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class nd extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let n;super({start(s){n=CS({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:o})},transform(s){n.feed(s)}})}}function Wz(e){return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(e)}function Kz(e){if(e.status!==401)return!1;let t=e.headers.get("www-authenticate")??"";return Wz(t)&&/use_dpop_nonce/i.test(t)}var Gz=(e,t)=>(r)=>{let o=typeof e==="function"?e:()=>e;return async(n,s)=>{let i=(s?.method??"GET").toUpperCase(),a=new URL(n.toString()),l=await o();if(!l)return r(n,s);let u=async()=>{let m=await t();if(!m)return r(n,s);let f=new Headers(s?.headers),g=await l.buildProof({htm:i,htu:a,accessToken:m});return f.set("Authorization",`DPoP ${m}`),f.set("DPoP",g),r(n,{...s,headers:f})},d=await u();if(Kz(d)&&d.headers.has("dpop-nonce"))l.observeNonce(d,a),await d.text?.().catch(()=>{}),d=await u();return l.observeNonce(d,a),d}},Yz=(e)=>Gz(async()=>{try{return await e.dpop?.()}catch(t){throw Ge(t)}},async()=>{let t;try{t=await e.tokens()}catch(r){throw Ge(r)}return t?.token_type?.toLowerCase()==="dpop"?t.access_token:void 0});var dT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Ze(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 Ze(this,e)}constructor(e,t,r){super(`SSE error: ${t}`);this.code=e,this.event=r,hr(this,new.target)}};var Xz=1,Qz={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2},ew=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function IS(e,t){if(typeof AbortSignal.any==="function")return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",n),t.removeEventListener("abort",s)};function n(){o(),r.abort(e.reason)}function s(){o(),r.abort(t.reason)}return e.addEventListener("abort",n,{once:!0}),t.addEventListener("abort",s,{once:!0}),r.signal}var OS=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){if(this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,this._fetch=t?.fetch,rS(t?.authProvider)){if(this._oauthProvider=t.authProvider,this._authProvider=oS(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation}),t.authProvider.dpop)this._fetch=Yz(t.authProvider)(t.fetch??fetch)}else this._authProvider=t?.authProvider;if(this._redirectPolicy=t?.redirectPolicy,this._fetchWithInit=Mg(t?.fetch,t?.requestInit),this._redirectPolicy==="follow")this._fetchWithInit=Lg(this._fetchWithInit);this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??Qz,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??Xz)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(r){throw Ge(r)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope==="throw")throw new Gu({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(!this._oauthProvider)throw new Gu({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new dt(N.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});if(e.resourceMetadataUrl)this._resourceMetadataUrl=e.resourceMetadataUrl;let r=await this._oauthProvider.tokens(),o=qc(this._scope,r?.scope,e.scope);this._scope=o;let n=nS(o,r?.scope);return jc(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:n,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(e){return this._redirectPolicy==="follow"?e:on(e)}_unfollowedRedirect(e,t){let r=this._redirectPolicy==="follow"?void 0:Ug(e,t);return r&&`${r} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let e=new Headers(this._requestInit?.headers||void 0),t;try{t=await this._authProvider?.token()}catch(r){throw Ge(r)}if(t)e.set("Authorization",`Bearer ${t}`);if(this._sessionId)e.set("mcp-session-id",this._sessionId);if(this._protocolVersion)e.set("mcp-protocol-version",this._protocolVersion);return e}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!fr(t))return;let r=t.params?._meta?.[Ut];if(typeof r!=="string")return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=Eg(t.method,t.params);if(o?.value!==void 0)e.set("mcp-name",Ou(o.value))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!fr(e))return!1;let t=e.params?._meta?.[Ut];return typeof t==="string"&&Ct(t)}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:n}=e,s=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0;try{let i=await this._commonHeaders(),a=[...i.get("accept")?.split(",").map((m)=>m.trim().toLowerCase())??[],"text/event-stream"];if(i.set("accept",[...new Set(a)].join(", ")),o)i.set("last-event-id",o);let l=this._abortController?.signal,u=n!==void 0&&l!==void 0?IS(l,n):n??l,d=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:i,signal:u});if(!d.ok){if(d.status===401&&this._authProvider){if(d.headers.has("www-authenticate")){let{resourceMetadataUrl:f,scope:g}=sn(d);this._resourceMetadataUrl=f,this._scope=qc(this._scope,g)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:d,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(f){throw Ge(f)}return await d.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await d.text?.().catch(()=>{}),t)throw Ge(new dt(N.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:d.statusText}));throw Ge(new ht)}if(d.status===403){let{resourceMetadataUrl:f,scope:g,error:b,errorDescription:y}=sn(d);if(b==="insufficient_scope"){let v=await d.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:g,resourceMetadataUrl:f,errorDescription:y,statusText:d.statusText,text:v},r)!=="AUTHORIZED")throw Ge(new ht);return this._startOrAuthSse(e,t,r+1)}}if(await d.text?.().catch(()=>{}),d.status===405){e.onRequestStreamEnd?.();return}let m=this._unfollowedRedirect(this._url,d)??d.statusText;throw new dt(N.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${m}`,{status:d.status,statusText:d.statusText})}this._handleSseStream(d.body,e,!0)}catch(i){if(!s())this.onerror?.(i);throw i}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),n=()=>{if(this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this._startOrAuthSse(e).catch((s)=>{if(this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this.onerror?.(Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`));try{this._scheduleReconnection(e,t+1)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}})};if(this._reconnectionScheduler){let s=this._reconnectionScheduler(n,o,t);this._cancelReconnection=typeof s==="function"?s:void 0}else{let s=setTimeout(n,o);this._cancelReconnection=()=>clearTimeout(s)}}_handleSseStream(e,t,r){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i}=t,a=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0,l,u=!1,d=!1;(async()=>{try{let f=e.pipeThrough(new TextDecoderStream).pipeThrough(new nd({onRetry:(g)=>{this._serverRetryMs=g}})).getReader();while(!0){let{value:g,done:b}=await f.read();if(b)break;if(g.id)l=g.id,u=!0,o?.(g.id);if(!g.data)continue;if(!g.event||g.event==="message")try{let y=ut.parse(JSON.parse(g.data));if(eo(y)||to(y)){if(d=!0,n!==void 0)y.id=n}this.onmessage?.(y)}catch(y){this.onerror?.(y)}}if((r||u)&&!d&&this._abortController&&!a())this._scheduleReconnection({resumptionToken:l,onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i},0);else if(!a())i?.()}catch(f){if(a())return;if(this.onerror?.(Error(`SSE stream disconnected: ${f}`)),(r||u)&&!d&&this._abortController&&!a())try{this._scheduleReconnection({resumptionToken:l,onresumptiontoken:o,replayMessageId:n,requestSignal:s,onRequestStreamEnd:i},0)}catch(g){this.onerror?.(Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`)),i?.()}else i?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new ht("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await sS(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await jc(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new ht("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:n,onresumptiontoken:s}=t||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:fr(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch((v)=>this.onerror?.(v));return}let i=await this._commonHeaders();this._applyBodyDerivedHeaders(i,e);let a=Array.isArray(e)?e.some((v)=>Cu(v)):Cu(e);if(a)i.delete("mcp-session-id");if(t?.headers!==void 0)for(let[v,L]of Object.entries(t.headers)){if(ew.has(v.toLowerCase()))continue;i.set(v,L)}i.set("content-type","application/json");let l=[...i.get("accept")?.split(",").map((v)=>v.trim().toLowerCase())??[],"application/json","text/event-stream"];i.set("accept",[...new Set(l)].join(", "));let u=this._abortController?.signal,d=t?.requestSignal!==void 0&&u!==void 0?IS(u,t.requestSignal):t?.requestSignal??u,m={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:d},f=await this._redirects(this._fetch??fetch)(this._url,m);if(a&&f.ok)this._sessionId=f.headers.get("mcp-session-id")||void 0;if(!f.ok){if(f.status===401&&this._authProvider){if(f.headers.has("www-authenticate")){let{resourceMetadataUrl:H,scope:x}=sn(f);this._resourceMetadataUrl=H,this._scope=qc(this._scope,x)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:f,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(H){throw Ge(H)}return await f.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await f.text?.().catch(()=>{}),r)throw Ge(new dt(N.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:f.statusText}));throw Ge(new ht)}let v=await f.text?.().catch(()=>null);if(f.status===403){let{resourceMetadataUrl:H,scope:x,error:Z,errorDescription:R}=sn(f);if(Z==="insufficient_scope"){if(await this._stepUpAuthorize({scope:x,resourceMetadataUrl:H,errorDescription:R,statusText:f.statusText,text:v},o)!=="AUTHORIZED")throw Ge(new ht);return this._send(e,t,r,o+1)}}if(f.status===400&&typeof v==="string"&&this._isModernEnvelopedRequest(e))try{let H=ut.parse(JSON.parse(v)),x=(Array.isArray(e)?e:[e]).filter((Z)=>fr(Z));if(to(H)&&x.some((Z)=>Z.id===H.id)){this.onmessage?.(H);return}}catch{}let L=this._unfollowedRedirect(this._url,f)??v;throw new dt(N.ClientHttpNotImplemented,`Error POSTing to endpoint: ${L}`,{status:f.status,statusText:f.statusText,text:v})}if(f.status===202){if(await f.text?.().catch(()=>{}),Rg(e))this._startOrAuthSse({resumptionToken:void 0}).catch((v)=>this.onerror?.(v));return}let g=(Array.isArray(e)?e:[e]).some((v)=>("method"in v)&&("id"in v)&&v.id!==void 0),b=f.headers.get("content-type"),y=Ag(b);if(g)if(y==="text/event-stream")this._handleSseStream(f.body,{onresumptiontoken:s,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(y==="application/json"){let v=await f.json(),L=Array.isArray(v)?v.map((H)=>ut.parse(H)):[ut.parse(v)];for(let H of L)this.onmessage?.(H)}else throw await f.text?.().catch(()=>{}),new A(N.ClientHttpUnexpectedContent,`Unexpected content type: ${b}`,{contentType:b});else await f.text?.().catch(()=>{})}catch(n){if(t?.requestSignal?.aborted!==!0)this.onerror?.(n);throw n}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await this._redirects(this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&r.status!==405)throw new dt(N.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,r)??r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class LS{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let o=r.listeners.indexOf(t);if(o!==-1)r.listeners.splice(o,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let o of[...r.listeners])o(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class US{_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 NS=new Set;function AS(e,t){let[r,o]=t,n=r?.shape;if(typeof n?.method?.value!=="string")return;let s=n.method.value,i=e==="request"?"setRequestHandler":"setNotificationHandler";if(!NS.has(i))NS.add(i),console.warn(`[ext-apps] ${i}(Schema, handler) is deprecated; use ${i}("${s}", { params: Schema.shape.params }, handler).`);let a=o;return[s,{params:n.params},e==="request"?(l,u)=>a({method:s,params:l},tw(u)):(l)=>a({method:s,params:l})]}function tw(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 ZS="2026-01-26";var rw="ui/notifications/tool-input-partial";var ow=E([h("light"),h("dark")]).describe("Color theme preference for the host environment."),Ki=E([h("inline"),h("fullscreen"),h("pip")]).describe("Display mode for UI presentation."),nw=E([h("--color-background-primary"),h("--color-background-secondary"),h("--color-background-tertiary"),h("--color-background-inverse"),h("--color-background-ghost"),h("--color-background-info"),h("--color-background-danger"),h("--color-background-success"),h("--color-background-warning"),h("--color-background-disabled"),h("--color-text-primary"),h("--color-text-secondary"),h("--color-text-tertiary"),h("--color-text-inverse"),h("--color-text-ghost"),h("--color-text-info"),h("--color-text-danger"),h("--color-text-success"),h("--color-text-warning"),h("--color-text-disabled"),h("--color-border-primary"),h("--color-border-secondary"),h("--color-border-tertiary"),h("--color-border-inverse"),h("--color-border-ghost"),h("--color-border-info"),h("--color-border-danger"),h("--color-border-success"),h("--color-border-warning"),h("--color-border-disabled"),h("--color-ring-primary"),h("--color-ring-secondary"),h("--color-ring-inverse"),h("--color-ring-info"),h("--color-ring-danger"),h("--color-ring-success"),h("--color-ring-warning"),h("--font-sans"),h("--font-mono"),h("--font-weight-normal"),h("--font-weight-medium"),h("--font-weight-semibold"),h("--font-weight-bold"),h("--font-text-xs-size"),h("--font-text-sm-size"),h("--font-text-md-size"),h("--font-text-lg-size"),h("--font-heading-xs-size"),h("--font-heading-sm-size"),h("--font-heading-md-size"),h("--font-heading-lg-size"),h("--font-heading-xl-size"),h("--font-heading-2xl-size"),h("--font-heading-3xl-size"),h("--font-text-xs-line-height"),h("--font-text-sm-line-height"),h("--font-text-md-line-height"),h("--font-text-lg-line-height"),h("--font-heading-xs-line-height"),h("--font-heading-sm-line-height"),h("--font-heading-md-line-height"),h("--font-heading-lg-line-height"),h("--font-heading-xl-line-height"),h("--font-heading-2xl-line-height"),h("--font-heading-3xl-line-height"),h("--border-radius-xs"),h("--border-radius-sm"),h("--border-radius-md"),h("--border-radius-lg"),h("--border-radius-xl"),h("--border-radius-full"),h("--border-width-regular"),h("--shadow-hairline"),h("--shadow-sm"),h("--shadow-md"),h("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),sw=P(nw.describe(`Style variables for theming MCP apps.
|
|
72
|
+
- `)}`,Error(j)}let U=`${i}/$ref`,Q=Se(e,B,r,o,s,n,a,U,u);if(!Q.valid)N.push({instanceLocation:a,keyword:"$ref",keywordLocation:U,error:"A subschema had errors."},...Q.errors);if(r==="4"||r==="7")return{valid:N.length===0,errors:N}}if(Array.isArray(b)){let B=b.length,U=!1;for(let Q=0;Q<B;Q++)if(d===b[Q]||b[Q]==="integer"&&d==="number"&&e%1===0&&e===e){U=!0;break}if(!U)N.push({instanceLocation:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b.join('", "')}".`})}else if(b==="integer"){if(d!=="number"||e%1||e!==e)N.push({instanceLocation:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`})}else if(b!==void 0&&d!==b)N.push({instanceLocation:a,keyword:"type",keywordLocation:`${i}/type`,error:`Instance type "${d}" is invalid. Expected "${b}".`});if(_!==void 0){if(d==="object"||d==="array"){if(!ui(e,_))N.push({instanceLocation:a,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}else if(e!==_)N.push({instanceLocation:a,keyword:"const",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}if(w!==void 0){if(d==="object"||d==="array"){if(!w.some((B)=>ui(e,B)))N.push({instanceLocation:a,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}else if(!w.some((B)=>e===B))N.push({instanceLocation:a,keyword:"enum",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(w)}.`})}if(A!==void 0){let B=`${i}/not`;if(Se(e,A,r,o,s,n,a,B).valid)N.push({instanceLocation:a,keyword:"not",keywordLocation:B,error:'Instance matched "not" schema.'})}let kt=[];if(z!==void 0){let B=`${i}/anyOf`,U=N.length,Q=!1;for(let j=0;j<z.length;j++){let O=z[j],K=Object.create(u),J=Se(e,O,r,o,s,g===!0?n:null,a,`${B}/${j}`,K);if(N.push(...J.errors),Q=Q||J.valid,J.valid)kt.push(K)}if(Q)N.length=U;else N.splice(U,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:B,error:"Instance does not match any subschemas."})}if(q!==void 0){let B=`${i}/allOf`,U=N.length,Q=!0;for(let j=0;j<q.length;j++){let O=q[j],K=Object.create(u),J=Se(e,O,r,o,s,g===!0?n:null,a,`${B}/${j}`,K);if(N.push(...J.errors),Q=Q&&J.valid,J.valid)kt.push(K)}if(Q)N.length=U;else N.splice(U,0,{instanceLocation:a,keyword:"allOf",keywordLocation:B,error:"Instance does not match every subschema."})}if(x!==void 0){let B=`${i}/oneOf`,U=N.length,Q=x.filter((j,O)=>{let K=Object.create(u),J=Se(e,j,r,o,s,g===!0?n:null,a,`${B}/${O}`,K);if(N.push(...J.errors),J.valid)kt.push(K);return J.valid}).length;if(Q===1)N.length=U;else N.splice(U,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:B,error:`Instance does not match exactly one subschema (${Q} matches).`})}if(d==="object"||d==="array")Object.assign(u,...kt);if(R!==void 0){let B=`${i}/if`;if(Se(e,R,r,o,s,n,a,B,u).valid){if(Z!==void 0){let U=Se(e,Z,r,o,s,n,a,`${i}/then`,u);if(!U.valid)N.push({instanceLocation:a,keyword:"if",keywordLocation:B,error:'Instance does not match "then" schema.'},...U.errors)}}else if(ee!==void 0){let U=Se(e,ee,r,o,s,n,a,`${i}/else`,u);if(!U.valid)N.push({instanceLocation:a,keyword:"if",keywordLocation:B,error:'Instance does not match "else" schema.'},...U.errors)}}if(d==="object"){if(I!==void 0){for(let j of I)if(!(j in e))N.push({instanceLocation:a,keyword:"required",keywordLocation:`${i}/required`,error:`Instance does not have required property "${j}".`})}let B=Object.keys(e);if(re!==void 0&&B.length<re)N.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${i}/minProperties`,error:`Instance does not have at least ${re} properties.`});if(de!==void 0&&B.length>de)N.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${i}/maxProperties`,error:`Instance does not have at least ${de} properties.`});if(bt!==void 0){let j=`${i}/propertyNames`;for(let O in e){let K=`${a}/${St(O)}`,J=Se(O,bt,r,o,s,n,K,j);if(!J.valid)N.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:j,error:`Property name "${O}" does not match schema.`},...J.errors)}}if(Fe!==void 0){let j=`${i}/dependantRequired`;for(let O in Fe)if(O in e){let K=Fe[O];for(let J of K)if(!(J in e))N.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}}if(st!==void 0)for(let j in st){let O=`${i}/dependentSchemas`;if(j in e){let K=Se(e,st[j],r,o,s,n,a,`${O}/${St(j)}`,u);if(!K.valid)N.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:O,error:`Instance has "${j}" but does not match dependant schema.`},...K.errors)}}if(yt!==void 0){let j=`${i}/dependencies`;for(let O in yt)if(O in e){let K=yt[O];if(Array.isArray(K)){for(let J of K)if(!(J in e))N.push({instanceLocation:a,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not have "${J}".`})}else{let J=Se(e,K,r,o,s,n,a,`${j}/${St(O)}`);if(!J.valid)N.push({instanceLocation:a,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not match dependant schema.`},...J.errors)}}}let U=Object.create(null),Q=!1;if(ne!==void 0){let j=`${i}/properties`;for(let O in ne){if(!(O in e))continue;let K=`${a}/${St(O)}`,J=Se(e[O],ne[O],r,o,s,n,K,`${j}/${St(O)}`);if(J.valid)u[O]=U[O]=!0;else if(Q=s,N.push({instanceLocation:a,keyword:"properties",keywordLocation:j,error:`Property "${O}" does not match schema.`},...J.errors),Q)break}}if(!Q&&xe!==void 0){let j=`${i}/patternProperties`;for(let O in xe){let K=new RegExp(O,"u"),J=xe[O];for(let ke in e){if(!K.test(ke))continue;let qr=`${a}/${St(ke)}`,Pt=Se(e[ke],J,r,o,s,n,qr,`${j}/${St(O)}`);if(Pt.valid)u[ke]=U[ke]=!0;else Q=s,N.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:j,error:`Property "${ke}" matches pattern "${O}" but does not match associated schema.`},...Pt.errors)}}}if(!Q&&te!==void 0){let j=`${i}/additionalProperties`;for(let O in e){if(U[O])continue;let K=`${a}/${St(O)}`,J=Se(e[O],te,r,o,s,n,K,j);if(J.valid)u[O]=!0;else Q=s,N.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:j,error:`Property "${O}" does not match additional properties schema.`},...J.errors)}}else if(!Q&&ae!==void 0){let j=`${i}/unevaluatedProperties`;for(let O in e)if(!u[O]){let K=`${a}/${St(O)}`,J=Se(e[O],ae,r,o,s,n,K,j);if(J.valid)u[O]=!0;else N.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:j,error:`Property "${O}" does not match unevaluated properties schema.`},...J.errors)}}}else if(d==="array"){if(dt!==void 0&&e.length>dt)N.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${i}/maxItems`,error:`Array has too many items (${e.length} > ${dt}).`});if(De!==void 0&&e.length<De)N.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${i}/minItems`,error:`Array has too few items (${e.length} < ${De}).`});let B=e.length,U=0,Q=!1;if(Ge!==void 0){let j=`${i}/prefixItems`,O=Math.min(Ge.length,B);for(;U<O;U++){let K=Se(e[U],Ge[U],r,o,s,n,`${a}/${U}`,`${j}/${U}`);if(u[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:j,error:"Items did not match schema."},...K.errors),Q)break}}}if(Le!==void 0){let j=`${i}/items`;if(Array.isArray(Le)){let O=Math.min(Le.length,B);for(;U<O;U++){let K=Se(e[U],Le[U],r,o,s,n,`${a}/${U}`,`${j}/${U}`);if(u[U]=!0,!K.valid){if(Q=s,N.push({instanceLocation:a,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...K.errors),Q)break}}}else for(;U<B;U++){let O=Se(e[U],Le,r,o,s,n,`${a}/${U}`,j);if(u[U]=!0,!O.valid){if(Q=s,N.push({instanceLocation:a,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...O.errors),Q)break}}if(!Q&&Dt!==void 0){let O=`${i}/additionalItems`;for(;U<B;U++){let K=Se(e[U],Dt,r,o,s,n,`${a}/${U}`,O);if(u[U]=!0,!K.valid)Q=s,N.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:O,error:"Items did not match additional items schema."},...K.errors)}}}if(wt!==void 0)if(B===0&&Oe===void 0)N.push({instanceLocation:a,keyword:"contains",keywordLocation:`${i}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Oe!==void 0&&B<Oe)N.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array has less items (${B}) than minContains (${Oe}).`});else{let j=`${i}/contains`,O=N.length,K=0;for(let J=0;J<B;J++){let ke=Se(e[J],wt,r,o,s,n,`${a}/${J}`,j);if(ke.valid)u[J]=!0,K++;else N.push(...ke.errors)}if(K>=(Oe||0))N.length=O;if(Oe===void 0&&Ue===void 0&&K===0)N.splice(O,0,{instanceLocation:a,keyword:"contains",keywordLocation:j,error:"Array does not contain item matching schema."});else if(Oe!==void 0&&K<Oe)N.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${i}/minContains`,error:`Array must contain at least ${Oe} items matching schema. Only ${K} items were found.`});else if(Ue!==void 0&&K>Ue)N.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${i}/maxContains`,error:`Array may contain at most ${Ue} items matching schema. ${K} items were found.`})}if(!Q&&Zt!==void 0){let j=`${i}/unevaluatedItems`;for(;U<B;U++){if(u[U])continue;let O=Se(e[U],Zt,r,o,s,n,`${a}/${U}`,j);if(u[U]=!0,!O.valid)N.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:j,error:"Items did not match unevaluated items schema."},...O.errors)}}if(Cr)for(let j=0;j<B;j++){let O=e[j],K=typeof O==="object"&&O!==null;for(let J=0;J<B;J++){if(j===J)continue;let ke=e[J];if(O===ke||K&&typeof ke==="object"&&ke!==null&&ui(O,ke))N.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${i}/uniqueItems`,error:`Duplicate items at indexes ${j} and ${J}.`}),j=Number.MAX_SAFE_INTEGER,J=Number.MAX_SAFE_INTEGER}}}else if(d==="number"){if(r==="4"){if(Ye!==void 0&&(Ve===!0&&e<=Ye||e<Ye))N.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${Ve?"or equal to ":""} ${Ye}.`});if(Xe!==void 0&&(nt===!0&&e>=Xe||e>Xe))N.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${nt?"or equal to ":""} ${Xe}.`})}else{if(Ye!==void 0&&e<Ye)N.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${i}/minimum`,error:`${e} is less than ${Ye}.`});if(Xe!==void 0&&e>Xe)N.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${Xe}.`});if(Ve!==void 0&&e<=Ve)N.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${i}/exclusiveMinimum`,error:`${e} is less than ${Ve}.`});if(nt!==void 0&&e>=nt)N.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${i}/exclusiveMaximum`,error:`${e} is greater than or equal to ${nt}.`})}if(at!==void 0){let B=e%at;if(Math.abs(0-B)>=0.00000011920929&&Math.abs(at-B)>=0.00000011920929)N.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${i}/multipleOf`,error:`${e} is not a multiple of ${at}.`})}}else if(d==="string"){let B=zt===void 0&&Rt===void 0?0:Wz(e);if(zt!==void 0&&B<zt)N.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${i}/minLength`,error:`String is too short (${B} < ${zt}).`});if(Rt!==void 0&&B>Rt)N.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${i}/maxLength`,error:`String is too long (${B} > ${Rt}).`});if(or!==void 0&&!new RegExp(or,"u").test(e))N.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${i}/pattern`,error:"String does not match pattern."});if(X!==void 0&&Ig[X]&&!Ig[X](e))N.push({instanceLocation:a,keyword:"format",keywordLocation:`${i}/format`,error:`String does not match format "${X}".`})}return{valid:N.length===0,errors:N}}var Kz=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",r=!0){this.schema=e,this.draft=t,this.shortCircuit=r,this.lookup=fo(e)}validate(e){return Se(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};fo(e,this.lookup)}},Kc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=zm(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new Kz(e,this.draft??this._draftFor(e),this.shortcircuit);return(r)=>{let o=t.validate(r);return o.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map((s)=>`${s.instanceLocation}: ${s.error}`).join("; ")}}}};var Ng=!0;var pd;pd=globalThis.crypto;async function Gz(e){return(await pd).getRandomValues(new Uint8Array(e))}async function Yz(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let s=await Gz(e-o.length);for(let n of s)if(n<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[n%66]}return o}async function Xz(e){return await Yz(e)}async function Qz(e){let t=await(await pd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function hd(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Xz(e),r=await Qz(t);return{code_verifier:t,code_challenge:r}}var vs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return We(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 We(this,e)}constructor(e){super(e);this.name=new.target.name,vr(this,new.target)}},Qc=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`);this.kind=e,this.expected=t,this.received=r}},Vg=class extends vs{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}},Rd=class extends vs{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}},li=class extends vs{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}},xd=class extends vs{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}};function yd(e,t,r){if(!e)return;if(typeof e.issuer!=="string"){if(r?.canPersistStamp!==!1)console.warn("[mcp-sdk] SEP-2352: stored OAuth credential has no 'issuer' stamp (pre-upgrade storage or provider not round-tripping the value). SEP-2352 isolation is inactive for this read; ensure your provider round-trips the issuer field.");return e.issuer===void 0?e:{...e,issuer:void 0}}return Bg(e.issuer,t)?e:void 0}function Bg(e,t){return e===t||e.endsWith("/")&&e.slice(0,-1)===t||t.endsWith("/")&&t.slice(0,-1)===e}function Jg(e){if(e==null)return!1;let t=e;return typeof t.tokens==="function"&&typeof t.clientInformation==="function"}async function eR(e,t,r){let{resourceMetadataUrl:o,scope:s}=bs(t.response);if(await ru(e,{serverUrl:t.serverUrl,resourceMetadataUrl:o,scope:s,fetchFn:t.fetchFn,...r})!=="AUTHORIZED")throw new vt}function Wg(e,t){return{token:async()=>(await e.tokens())?.access_token,onUnauthorized:async(r)=>eR(e,r,t)}}var vt=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return We(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 We(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",vr(this,new.target)}};function kd(e){return e?.authorization_response_iss_parameter_supported===!0}function eu({iss:e,expectedIssuer:t,issParameterSupported:r}){if(t===void 0)return;if(e===void 0){if(r)throw new Qc("authorization_response",t,void 0);return}if(e!==t)throw new Qc("authorization_response",t,e)}function tu(...e){let t=new Set;for(let r of e){if(!r)continue;for(let o of r.split(/\s+/))if(o)t.add(o)}return t.size>0?[...t].join(" "):void 0}function Kg(e,t){if(!e)return!1;let r=new Set((t??"").split(/\s+/).filter(Boolean));for(let o of e.split(/\s+/))if(o&&!r.has(o))return!0;return!1}async function Gg(e,t,r,o,s){if(typeof e==="string")return{authorizationCode:e,iss:t};let n=e.get("iss")??void 0,a=e.get("code");if(a)return{authorizationCode:a,iss:n};let i=(await r.discoveryState?.())?.authorizationServerMetadata;if(!i)try{i=(await Ed(o,s)).authorizationServerMetadata}catch{i=void 0}if(!i)throw new vt("Authorization callback failed and the issuer could not be verified");eu({iss:n,expectedIssuer:i.issuer,issParameterSupported:kd(i)});let u=e.get("error");if(u)throw new br(u,e.get("error_description")??u,e.get("error_uri")??void 0);throw new vt("Authorization callback contained neither `code` nor `error`")}function tR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var fd="code",_d="S256";function Yg(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&tR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function Xg(e,t,r,o){let{client_id:s,client_secret:n}=t;switch(e){case"client_secret_basic":rR(s,n,r);return;case"client_secret_post":oR(s,n,o);return;case"none":sR(s,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function rR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function oR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function sR(e,t){t.set("client_id",e)}function Qg(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function eS(e){let t=new URL(String(e));if(t.protocol!=="https:"&&!Qg(t.hostname))throw new Rd(t.href);return t}function nR(e){for(let t of e??[]){let r;try{r=new URL(t)}catch{continue}if(r.protocol!=="http:"&&r.protocol!=="https:")return"native";if(Qg(r.hostname))return"native"}return"web"}function tS(e){let t=e.clientMetadata;return{...t,grant_types:t.grant_types??(e.redirectUrl===void 0?void 0:["authorization_code","refresh_token"]),application_type:t.application_type??nR(t.redirect_uris)}}async function wd(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=mo.parse(JSON.parse(r));return br.fromResponse(o)}catch(o){let s=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new br(Ot.ServerError,s)}}function jg(e,t,r){let o=e.invalidateCredentials===void 0?`retrying authorization without discarding the stored ${r} (provider implements no invalidateCredentials())`:`invalidating the stored ${r} and retrying authorization`;console.warn(`[mcp-sdk] OAuth ${JSON.stringify(t.code)} — ${o}. Cause: ${JSON.stringify(t.message)}`)}async function ru(e,t){try{return await gd(e,t)}catch(r){if(r instanceof br){if(r.code===Ot.InvalidClient||r.code===Ot.UnauthorizedClient)return jg(e,r,"client credentials and tokens"),await e.invalidateCredentials?.("client"),await e.invalidateCredentials?.("tokens"),await gd(e,t);else if(r.code===Ot.InvalidGrant||r.code===Ot.InvalidDpopProof)return jg(e,r,"tokens"),await e.invalidateCredentials?.("tokens"),await gd(e,t)}throw r}}function aR(e){let{requestedScope:t,resourceMetadata:r,authServerMetadata:o,clientMetadata:s}=e,n=t||r?.scopes_supported?.join(" ")||s.scope;if(n&&o?.scopes_supported?.includes("offline_access")&&!n.split(" ").includes("offline_access")&&s.grant_types?.includes("refresh_token"))n=`${n} offline_access`;return n}async function gd(e,{serverUrl:t,authorizationCode:r,iss:o,scope:s,resourceMetadataUrl:n,fetchFn:a,skipIssuerMetadataValidation:i,forceReauthorization:u}){let l=tS(e),d=await e.discoveryState?.(),f,h,g,b,_=n;if(!_&&d?.resourceMetadataUrl)_=new URL(d.resourceMetadataUrl);if(d?.authorizationServerUrl){if(h=d.authorizationServerUrl,f=d.resourceMetadata,g=d.authorizationServerMetadata??await Td(h,{fetchFn:a,skipIssuerValidation:i}),!f)try{f=await Pd(t,{resourceMetadataUrl:_},a)}catch(te){if(te instanceof TypeError)throw te}if(g!==d.authorizationServerMetadata||f!==d.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g})}else{let te=await Ed(t,{resourceMetadataUrl:_,fetchFn:a,skipIssuerMetadataValidation:i});h=te.authorizationServerUrl,g=te.authorizationServerMetadata,f=te.resourceMetadata,b={authorizationServerUrl:String(h),resourceMetadataUrl:_?.toString(),resourceMetadata:f,authorizationServerMetadata:g}}let w=g?.issuer??String(h),I={issuer:w};if(await e.saveAuthorizationServerUrl?.(w),r!==void 0){let te=d?.authorizationServerMetadata?.issuer??d?.authorizationServerUrl;if(te===void 0){if(e.saveDiscoveryState!==void 0)throw new li("discoveryState was not available on the callback leg; ensure your provider persists discoveryState alongside codeVerifier",w);console.warn("[mcp-sdk] OAuthClientProvider does not implement saveDiscoveryState()/discoveryState(); the SEP-2352 callback-leg authorization-server binding cannot be checked. Implement discoveryState (persist alongside codeVerifier) — see docs/migration/upgrade-to-v2.md §SEP-2352.")}else if(!Bg(te,w))throw new li(te,w)}if(b)await e.saveDiscoveryState?.(b);let A=await oS(t,e,f),z=A&&f&&!e.validateResourceURL?f.resource:A;if(z)await e.saveResourceUrl?.($d(z));let q=aR({requestedScope:s,resourceMetadata:f,authServerMetadata:g,clientMetadata:e.clientMetadata}),x=await Promise.resolve(e.clientInformation(I)),R=yd(x,w,{canPersistStamp:e.saveClientInformation!==void 0});if(R===void 0&&x?.issuer&&e.saveClientInformation===void 0)throw new li(x.issuer,w);if(R&&R.issuer===void 0)R={...R,issuer:w},await e.saveClientInformation?.(R,I);if(!R){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let te=g?.client_id_metadata_document_supported===!0,ae=e.clientMetadataUrl;if(ae&&!rS(ae))throw new br(Ot.InvalidClientMetadata,`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ae}`);if(te&&ae)R={client_id:ae,issuer:w},await e.saveClientInformation?.(R,I);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");R={...await dS(h,{metadata:g,clientMetadata:l,scope:q,fetchFn:a}),issuer:w},await e.saveClientInformation(R,I)}}let Z=!e.redirectUrl;if(r!==void 0||Z){if(r!==void 0)eu({iss:o,expectedIssuer:g?.issuer,issParameterSupported:kd(g)});let te=await lS(e,h,{metadata:g,resource:z,authorizationCode:r,iss:o,scope:q,fetchFn:a});return await e.saveTokens({...te,issuer:w},I),"AUTHORIZED"}let ee=yd(await e.tokens(I),w);if(ee&&ee.issuer===void 0)ee={...ee,issuer:w},await e.saveTokens(ee,I);if(ee?.refresh_token&&!u){let te=await e.scopeForRefresh?.(ee),ae;try{ae=await uS(h,{metadata:g,clientInformation:R,refreshToken:ee.refresh_token,scope:te,resource:z,addClientAuthentication:e.addClientAuthentication,dpop:await e.dpop?.(),fetchFn:a})}catch(re){if(re instanceof Rd)throw re;if(!(re instanceof br)||re.code===Ot.ServerError)console.warn(`[mcp-sdk] Could not refresh OAuth tokens; falling back to a new authorization request. Cause: ${JSON.stringify(re instanceof Error?re.message:String(re))}`);else throw re}if(ae)return await e.saveTokens({...ae,issuer:w},I),"AUTHORIZED"}let X=e.state?await e.state():void 0,{authorizationUrl:ne,codeVerifier:xe}=await aS(h,{metadata:g,clientInformation:R,state:X,redirectUrl:e.redirectUrl,scope:q,resource:z});return await e.saveCodeVerifier(xe),await e.redirectToAuthorization(ne),"REDIRECT"}function rS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function oS(e,t,r){let o=Yl(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!Xl({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}var iR=new Set(["bearer","dpop"]);function bs(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(!r||!iR.has(r.toLowerCase())||!o)return{};let s=Gc(e,"resource_metadata")||void 0,n;if(s)try{n=new URL(s)}catch{}let a=Gc(e,"scope")||void 0,i=Gc(e,"error")||void 0,u=Gc(e,"error_description")||void 0;return{resourceMetadataUrl:n,scope:a,error:i,errorDescription:u}}function Gc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(String.raw`${t}=(?:"([^"]+)"|([^\s,]+))`),s=r.match(o);if(s){let n=s[1]||s[2];if(n)return n}return null}async function Pd(e,t,r=fetch){let o=await lR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.text?.().catch(()=>{}),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.text?.().catch(()=>{}),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return hs.parse(await o.json())}async function sS(e,t,r=fetch){let o=Ss(r);try{return await o(e,{headers:t})}catch(s){if(!(s instanceof TypeError)||!Ng)throw s;if(t)try{return await o(e,{})}catch(n){if(!(n instanceof TypeError))throw n;return}return}}function cR(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Mg(e,t,r=fetch){return await sS(e,{"MCP-Protocol-Version":t},r)}function uR(e,t){if(!e)return!0;if(t==="/")return!1;return!e.ok&&e.status<500||e.status===502}async function lR(e,t,r,o){let s=new URL(e),n=o?.protocolVersion??Wr,a;if(o?.metadataUrl)a=new URL(o.metadataUrl);else{let u=cR(t,s.pathname);a=new URL(u,o?.metadataServerUrl??s),a.search=s.search}let i=await Mg(a,n,r);if(!o?.metadataUrl&&uR(i,s.pathname))i=await Mg(new URL(`/.well-known/${t}`,s),n,r);return i}function nS(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"},{url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let s=t.pathname;if(s.endsWith("/"))s=s.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,t.origin),type:"oauth"},{url:new URL(`/.well-known/openid-configuration${s}`,t.origin),type:"oidc"},{url:new URL(`${s}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Td(e,{fetchFn:t=fetch,protocolVersion:r=Wr,skipIssuerValidation:o=!1}={}){let s={"MCP-Protocol-Version":r,Accept:"application/json"},n=nS(e);for(let{url:a,type:i}of n){let u=await sS(a,s,t);if(!u)continue;if(!u.ok){if(await u.text?.().catch(()=>{}),u.status<500||u.status===502)continue;throw Error(`HTTP ${u.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${a}`)}let l=i==="oauth"?uo.parse(await u.json()):fs.parse(await u.json());if(!o){let d=typeof e==="string"?e:e.href;if(!(l.issuer===d||d.endsWith("/")&&l.issuer===d.slice(0,-1)))throw new Qc("metadata",d,l.issuer)}return l}}async function Ed(e,t){let r,o;try{if(r=await Pd(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch(n){if(n instanceof TypeError)throw n}if(!o)o=String(new URL("/",e));let s=await Td(o,{fetchFn:t?.fetchFn,skipIssuerValidation:t?.skipIssuerMetadataValidation});return{authorizationServerUrl:o,authorizationServerMetadata:s,resourceMetadata:r}}function $d(e){return typeof e==="string"?e:e.href}async function aS(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:s,state:n,resource:a}){let i;if(t){if(i=new URL(t.authorization_endpoint),!t.response_types_supported.includes(fd))throw Error(`Incompatible auth server: does not support response type ${fd}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(_d))throw Error(`Incompatible auth server: does not support code challenge method ${_d}`)}else i=new URL("/authorize",e);let u=await hd(),{code_verifier:l,code_challenge:d}=u;if(i.searchParams.set("response_type",fd),i.searchParams.set("client_id",r.client_id),i.searchParams.set("code_challenge",d),i.searchParams.set("code_challenge_method",_d),i.searchParams.set("redirect_uri",String(o)),n)i.searchParams.set("state",n);if(s)i.searchParams.set("scope",s);if(s?.split(" ").includes("offline_access"))i.searchParams.append("prompt","consent");if(a)i.searchParams.set("resource",$d(a));return{authorizationUrl:i,codeVerifier:l}}function iS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function cS(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:s,resource:n,dpop:a,fetchFn:i}){let u=eS(t?.token_endpoint??new URL("/token",e)),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(n)r.set("resource",$d(n));if(!s&&o)Xg(Yg(o,t?.token_endpoint_auth_methods_supported??[]),o,l,r);let d=async()=>{let g=new Headers(l);if(s)await s(g,r,u,t);if(a)g.set("DPoP",await a.buildProof({htm:"POST",htu:u}));return Ss(i??fetch)(u,{method:"POST",headers:g,body:r})},f=await d();if(a&&f.status===400){if((await f.clone().json().catch(()=>{}))?.error===Ot.UseDpopNonce)a.observeNonce(f,u),f=await d()}if(a?.observeNonce(f,u),!f.ok)throw await wd(f);let h=await f.json();try{return lo.parse(Bc(h))}catch(g){if(typeof h==="object"&&h!==null&&"error"in h)throw await wd(JSON.stringify(h));throw g}}async function uS(e,{metadata:t,clientInformation:r,refreshToken:o,scope:s,resource:n,addClientAuthentication:a,dpop:i,fetchFn:u}){let l=new URLSearchParams({grant_type:"refresh_token",refresh_token:o});if(s)l.set("scope",s);let d=await cS(e,{metadata:t,tokenRequestParams:l,clientInformation:r,addClientAuthentication:a,resource:n,dpop:i,fetchFn:u});return{refresh_token:o,...d,...s&&!d.scope&&{scope:s}}}async function lS(e,t,{metadata:r,resource:o,authorizationCode:s,iss:n,scope:a,fetchFn:i}={}){if(s!==void 0)eu({iss:n,expectedIssuer:r?.issuer,issParameterSupported:kd(r)});let u=r?.issuer??String(t),l=async()=>{let g=await e.clientInformation({issuer:u}),b=yd(g,u,{canPersistStamp:!1});if(g&&b===void 0)throw new li(String(g.issuer),u);return b},d=await l(),f=a??e.clientMetadata.scope,h;if(e.prepareTokenRequest)h=await e.prepareTokenRequest(f);if(!h){if(!s)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");h=iS(s,await e.codeVerifier(),e.redirectUrl)}return d??=await l(),cS(t,{metadata:r,tokenRequestParams:h,clientInformation:d,addClientAuthentication:e.addClientAuthentication,resource:o,dpop:await e.dpop?.(),fetchFn:i})}async function dS(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:s}){let n;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");n=new URL(t.registration_endpoint)}else n=new URL("/register",e);let a={...r,...o===void 0?{}:{scope:o}},i=await Ss(s??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok)throw new Vg({status:i.status,body:await i.text(),submittedMetadata:a});return _s.parse(Bc(await i.json()))}var Yc=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),mS=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(Sd(e))}set(e,t){let r=Sd(e),o=Yc.has(e.method),s=!this._entries.has(r);if(!o&&s&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let a of this._entries.keys())if(!Yc.has(a.slice(0,a.indexOf("\x00")))){this._entries.delete(a),this._cappedSize--;break}}let n=++this._stamp;if(this._entries.set(r,{...t,stamp:n}),s&&!o)this._cappedSize++;return n}delete(e){if(this._entries.delete(Sd(e))&&!Yc.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,r=Yc.has(e);for(let o of this._entries.keys())if(o.startsWith(t)){if(this._entries.delete(o),!r)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function Sd(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function vd(e,t){return t===void 0?e:`${e}\x00${t}`}var pS=86400000,dR=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",s=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=s}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 r={method:e,params:t??""},o=this._partitionFor("private"),s=await this._store.get({...r,partition:o});if(s!==void 0)return s;let n=this._partitionFor("public");if(n===o)return;let a=await this._store.get({...r,partition:n});return a?.scope==="public"?a:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(s){this._reportError(s)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(s){this._reportError(s)}}async evictKey(e,t){let r=vd(e,t),o=this._evictionGeneration.get(r);if(o!==void 0)this._evictionGeneration.set(r,o+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let r=vd(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(vd(e,o?.params))??0)!==r)return;let s=o?.params??"",n=this._partitionFor("private"),a=this._partitionFor("public"),i=(o?.scope??"private")==="public"?a:n;try{await this._store.set({method:e,params:s,partition:i},{value:mR(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(u){this._reportError(u)}if(a!==n)try{await this._store.delete({method:e,params:s,partition:i===n?a:n})}catch(u){this._reportError(u)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt===void 0||!(r.expiresAt>this.now()))return;try{let o=JSON.parse(r.value);if(typeof o!=="object"||o===null||Array.isArray(o))throw TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),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 r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let s of r.tools)o.set(s.name,s);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},s=new Map;for(let n of o.tools){let a=t(n);if(a!==void 0)s.set(n.name,a)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:s}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((r)=>r!==null&&typeof r==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function mR(e){let t;try{t=JSON.stringify(e)}catch(r){throw TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var hS=Symbol.for("mcp.authSeamEscape");function rt(e){if(typeof e==="object"&&e!==null||typeof e==="function")try{Object.defineProperty(e,hS,{value:!0,configurable:!0})}catch{}return e}function pR(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[hS]===!0}var hR=-32022,fR=new Set([-32001,-32020,-32021]);function _R(e,t){switch(e.kind){case"result":return gR(e.result,t);case"rpc-error":return fS(e,t);case"http-error":return SR(e,t);case"network-error":return Ag(e.error,t);case"unusable-reply":return{kind:"error",error:new L(M.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${_S(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 Ag(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new L(M.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function gR(e,t){let r=Xt(Jc).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,s=t.clientModernVersions.find((n)=>o.includes(n));if(s!==void 0)return{kind:"modern",version:s,discover:r.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new ai({supported:[...o],requested:t.requestedVersion})}}function fS(e,t){let{code:r,message:o,data:s}=e;if(r===hR){let n=bR(s);if(n===void 0)return{kind:"legacy"};let a=new ai({supported:n,requested:yR(s)??t.requestedVersion},o),i=ni(n),u=t.clientModernVersions.find((l)=>i.includes(l));if(u!==void 0)return{kind:"corrective",version:u,error:a};if(i.length>0)return{kind:"error",error:a};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:a}}if(fR.has(r))return{kind:"legacy"};return{kind:"legacy"}}function SR(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new gt(o?M.ClientHttpForbidden:M.ClientHttpAuthentication,`Version negotiation failed: ${o?"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 gt(M.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=wR(e.body);if(r!==void 0)return fS(r,t);return{kind:"legacy"}}function Ag(e,t){if(t.environment==="browser"&&vR(e))return{kind:"legacy"};return{kind:"error",error:new L(M.EraNegotiationFailed,`Version negotiation probe failed: ${_S(e)}`,{cause:e},{cause:e})}}function vR(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function _S(e){return e instanceof Error?e.message:String(e)}function bR(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((r)=>typeof r==="string"))return;return t}function yR(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function wR(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let r=t.error;if(typeof r!=="object"||r===null)return;let{code:o,message:s,data:n}=r;if(typeof o!=="number")return;return{code:o,message:typeof s==="string"?s:"",data:n}}var zR="legacy";function RR(e,t){let r=e?.mode??zR;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r==="object"){if(!Nt(r.pin))throw TypeError(`versionNegotiation: { pin: '${r.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:r.pin,probe:o}}let s=t?ni(t):[];return{kind:"auto",modernVersions:s.length>0?s:[...Ql],fallbackAvailable:t?ed(t).length>0:!0,probe:o}}function Lg(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function Ug(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var xR=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 r=new e(t);t.onmessage=(o)=>{let s=r._pending;if(s!==void 0&&(po(o)||ho(o))&&o.id===s.id){if(r._pending=void 0,po(o))s.resolve({kind:"response",result:o.result});else s.resolve({kind:"response",error:o.error});return}},t.onerror=(o)=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;if(o!==void 0)r._pending=void 0,o.resolve({kind:"closed"});r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise((s)=>{let n=!1,a=(u)=>{if(n)return;if(n=!0,clearTimeout(i),this._pending?.id===o)this._pending=void 0;s(u)},i=setTimeout(()=>a({kind:"timeout"}),r);this._pending={id:o,resolve:a},this._transport.send(t(o)).catch((u)=>a({kind:"send-error",error:u}))})}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,r=this._transport,o=!1,s=()=>{if(!o){o=!0;return}t()};r.onclose=s,zd.set(r,()=>{if(r.onclose===s)r.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},zd=new WeakMap;function Dg(e){let t=zd.get(e);zd.delete(e),t?.()}function kR(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Xt(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function PR(e){if(e instanceof L&&e.code===M.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function TR(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 r=e.error;if(pR(r)||r instanceof vt||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof gt){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o==="string"?o:void 0,statusText:r.data.statusText}}if(PR(r))return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function gS(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),s=e.kind==="pin"?[e.version]:e.modernVersions,n=e.kind==="auto"&&e.fallbackAvailable,a=await xR.open(t.transport),i=async()=>{let l=s[0],d=!1,f=o;for(;;){let h=await a.exchange((_)=>kR(_,l,t.clientInfo,t.capabilities),r);if(h.kind==="timeout"&&f>0){f--;continue}let g=TR(h,r),b=_R(g,{clientModernVersions:s,requestedVersion:l,fallbackAvailable:n,environment:t.environment,transportKind:t.transportKind});switch(b.kind){case"modern":return{era:"modern",version:b.version,discover:b.discover};case"corrective":if(d)throw b.error;d=!0,l=b.version;continue;case"legacy":{let _=g.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new L(M.EraNegotiationFailed,_===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: ${_} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new L(M.EraNegotiationFailed,_===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: ${_} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(_!==void 0&&t.disposableProbe!==!0)throw new L(M.EraNegotiationFailed,`Version negotiation failed: ${_} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw b.error}}},u;try{u=await i()}catch(l){throw a.detach(),l}return a.release(),u}function ER(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r==="object"&&r!==null&&typeof r.command==="string"?r:void 0}async function $R(e,t,r,o){let n=new t.constructor({...r,stderr:"ignore"}),a=t.close,i=!1,u,l=new Promise((f,h)=>{u=()=>h(Zg())});t.close=async function(){return i=!0,u?.(),a.call(t)};let d;try{let f=gS(e,{...o,transport:n,transportKind:"stdio",disposableProbe:!0});f.catch(()=>{}),d=await Promise.race([f,l])}finally{await CR(n),t.close=a}if(i)throw Zg();return d}function Zg(){return new L(M.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function CR(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function Hg(e){let t=e._meta?.[$t];return ld.Implementation(t)?t:void 0}function Xc(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let s of Object.keys(o)){let n=o[s];if(r[s]===void 0&&Object.prototype.hasOwnProperty.call(n,"default"))r[s]=n.default;if(r[s]!==void 0)Xc(n,r[s])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Xc(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Xc(r,t)}}function SS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function IR(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&fr.safeParse(e.discover).success)return e}throw new L(M.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var Fg={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},qR=64,bd={},Cd=class extends ci{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{bd.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,bd.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),bd.readResource=(e,t,r)=>e._readResource(t,r)}_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 L(M.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 Kc,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=yg(t?.inputRequired),this._cache=new dR(t?.responseCacheStore??new mS,t?.responseCacheStore!==void 0,(r)=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??qR,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Nt(this._negotiatedProtocolVersion)&&yr(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 L(M.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 xg({getRequestHandler:(r)=>this._getRequestHandler(r),buildContext:(r)=>this.buildContext(r,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=md(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(r,o)=>{let s=Xt(this._negotiatedProtocolVersion),n=s.validateRequest("elicitation/create",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("elicitation/create",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${n.message}`);let{params:a}=n.value;a.mode=a.mode??"form";let{supportsFormMode:i,supportsUrlMode:u}=SS(this._capabilities.elicitation);if(a.mode==="form"&&!i)throw new se(W.InvalidParams,"Client does not support form-mode elicitation requests");if(a.mode==="url"&&!u)throw new se(W.InvalidParams,"Client does not support URL-mode elicitation requests");let l=await t(r,o),d=s.validateResult("elicitation/create",l);if(!d.ok&&d.reason==="not-in-era")d=s.validateInputResponse("elicitation/create",l);if(!d.ok)throw new se(d.reason==="not-in-era"?W.InternalError:W.InvalidParams,d.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${d.message}`);let f=d.value,h=a.mode==="form"?a.requestedSchema:void 0;if(a.mode==="form"&&f.action==="accept"&&f.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{Xc(h,f.content)}catch{}return f};if(e==="sampling/createMessage")return async(r,o)=>{let s=Xt(this._negotiatedProtocolVersion),n=s.validateRequest("sampling/createMessage",r);if(!n.ok&&n.reason==="not-in-era")n=s.validateInputRequest("sampling/createMessage",r);if(!n.ok)throw new se(n.reason==="not-in-era"?W.InternalError:W.InvalidParams,n.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${n.message}`);let{params:a}=n.value,i=await t(r,o),u=Boolean(a.tools||a.toolChoice),l=s.samplingResultVariant(u,i);if(!l.ok&&l.reason==="not-in-era")l=s.validateInputResponse("sampling/createMessage",i);if(!l.ok)throw new se(l.reason==="not-in-era"?W.InternalError:W.InvalidParams,l.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${l.message}`);return l.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new L(M.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,IR(t.prior),t);let r=RR(this._versionNegotiation,this._supportedProtocolVersionsOption);if(r.kind!=="legacy")return this._connectNegotiated(e,r,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;if(r!==void 0)e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=ed(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new L(M.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let s=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(s===void 0)throw Error(`Server sent invalid initialize result: ${s}`);if(!r.includes(s.protocolVersion))throw Error(`Server's protocol version is not supported: ${s.protocolVersion}`);if(this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(s.protocolVersion);if(this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=s.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let s=this._negotiatedProtocolVersion;if(s!==void 0&&e.setProtocolVersion)e.setProtocolVersion(s);return}this._resetConnectionState();let o;try{let s=Ug(e),n={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:Lg(),defaultTimeoutMs:r?.timeout??ii},a=s==="stdio"?ER(e):void 0;o=a===void 0?await gS(t,{...n,transport:e,transportKind:s}):await $R(t,e,a,n)}catch(s){throw await e.close().catch(()=>{}),Dg(e),s}if(Dg(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=Hg(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion)e.setProtocolVersion(o.version);if(this._listChangedConfig){let s=this._listChangedConfig,n=this._serverCapabilities,a={...s.tools&&n?.tools?.listChanged&&{tools:s.tools},...s.prompts&&n?.prompts?.listChanged&&{prompts:s.prompts},...s.resources&&n?.resources?.listChanged&&{resources:s.resources}},i=!0;try{this._setupListChangedHandlers(a)}catch(l){i=!1,this.onerror?.(l instanceof Error?l:Error(String(l)))}let u=i?{...a.tools&&{toolsListChanged:!0},...a.prompts&&{promptsListChanged:!0},...a.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(u).length>0){let l=new AbortController,d=()=>l.abort(r?.signal?.reason);if(r?.signal?.aborted)d();r?.signal?.addEventListener("abort",d);try{this._autoOpenedSubscription=await this.listen(u,{timeout:r?.timeout,signal:l.signal})}catch(f){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),f;this.onerror?.(f instanceof Error?f:Error(String(f)))}finally{r?.signal?.removeEventListener("abort",d)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let s=this._supportedProtocolVersionsOption,n=(s&&ni(s).length>0?ni(s):Ql).find((a)=>o.supportedVersions.includes(a));if(n===void 0)throw new L(M.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=o,this._serverCapabilities=o.capabilities,this._serverVersion=Hg(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=n,e.setProtocolVersion?.(n),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(a){this.onerror?.(a instanceof Error?a:Error(String(a)))}}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 Nt(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new L(M.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new L(M.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 L(M.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new L(M.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new L(M.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new L(M.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 L(M.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 L(M.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new L(M.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new L(M.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"},fr,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 r=await this._serveFromCache("prompts/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("prompts/list",e,t,(o)=>o.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 r=await this._serveFromCache("resources/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/list",e,t,(o)=>o.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 r=await this._serveFromCache("resources/templates/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/templates/list",e,t,(o)=>o.resourceTemplates)}async _listAllPages(e,t,r,o,s){let n=r?.cacheMode==="bypass",a=this._cache.captureGeneration(e),i=(l)=>{let d=l===void 0?t&&{...t}:{...t,cursor:l};return this.request({method:e,...d&&{params:d}},r)},u=await this._walkPages(e,i,o);if(delete u.nextCursor,s?.(u),n)return u;return await this._cache.write(e,u,a,this._freshness(u)),u}async _walkPages(e,t,r){let o=await t(void 0),s=o.nextCursor,n=o,a=1;while(s!==void 0){if(this._listMaxPages!==0&&a>=this._listMaxPages)throw new L(M.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let i=await t(s);if(i.nextCursor===s&&JSON.stringify(r(i))===JSON.stringify(r(n)))break;r(o).push(...r(i)),n=i,s=i.nextCursor,a++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs==="number"?r.ttlMs:this._defaultCacheTtlMs,s=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),pS),scope:s,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch((s)=>void this._reportStoreError(s));if(o!==void 0){if(r?.signal?.aborted){let s=r.signal.reason;throw s instanceof L?s:new L(M.RequestTimeout,String(s))}return o.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 r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:id(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),s=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let n=this._freshness(s,e.uri);if(n.expiresAt>this._cache.now())await this._cache.write("resources/read",s,o,n);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:s,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 L(M.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Nt(r))throw new L(M.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let z=t.signal.reason;throw z instanceof L?z:new L(M.RequestTimeout,String(z))}let o=new AbortController,s=`listen:${this._nextListenId++}`,n="opening",a,i,u,l,d=new Promise((z,q)=>{u=z,l=q}),f,h=new Promise((z)=>{f=z}),g=(z)=>{if(n==="closed")return;let q=n==="opening";if(a!==void 0)clearTimeout(a),a=void 0;if("ack"in z){n="open",u(z.ack);return}if(n="closed",i!==void 0)t?.signal?.removeEventListener("abort",i);if(this._listenState.delete(s),o.abort(),f(z.cause),q)l(z.error??new L(M.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},b=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:s}}).catch(()=>{})},_=async()=>{if(n==="closed")return;g({cause:"local"}),await b()};this._listenState.set(s,{settle:g});let w=t?.timeout??ii;if(a=setTimeout(()=>{g({cause:"remote",error:new L(M.RequestTimeout,"subscriptions/listen ack timed out",{timeout:w})}),b().catch(()=>{})},w),t?.signal){let z=t.signal;i=()=>{if(n==="closed")return;let q=z.reason;g({cause:"local",error:q instanceof Error?q:Error(String(q??"Aborted"))}),b().catch(()=>{})},z.addEventListener("abort",i,{once:!0})}let I={jsonrpc:"2.0",id:s,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},A=(z)=>{g({cause:"remote",error:z instanceof Error?z:Error(String(z))})};try{this.transport.send(I,{requestSignal:o.signal,onRequestStreamEnd:()=>g({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(A)}catch(z){A(z)}return{honoredFilter:await d,close:_,closed:h}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(Fg,e.method)?Fg[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;if(typeof o==="string")this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[Do],s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){let n=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);s.settle({ack:n.ok?n.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,s=typeof o==="string"?this._listenState.get(o):void 0;if(s!==void 0){s.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t==="string"?this._listenState.get(t):void 0;if(r!==void 0){if(ho(e))r.settle({cause:"remote",error:se.fromError(e.error.code,e.error.message,e.error.data)});else r.settle({cause:"graceful",error:new L(M.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new L(M.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 r=this.getProtocolEra()==="modern"&&Lg()!=="browser",o=async()=>{if(!r)return t;let u;try{u=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(d){this._reportStoreError(d)}if(!u?.valid||u.declarations.length===0)return t;let l=Sg(u.declarations,e.arguments);return Object.keys(l).length===0?t:{...t,headers:{...t?.headers,...l}}},s=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(u)=>this._compileOutputValidator(u)).catch((u)=>void this._reportStoreError(u)):this._compileOutputValidator(t.toolDefinition),n=()=>{if(s===void 0||s.ok)return;let u=s.compileError,l=(u instanceof Error?u.message:String(u)).slice(0,200);throw new se(W.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${l}`)};n();let a;try{a=await this.request({method:"tools/call",params:e},await o())}catch(u){let l=u instanceof se&&u.code===gs;if(!r||!l||t?.toolDefinition!==void 0)throw u;let d={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,d).catch((f)=>this._reportStoreError(f)),s=await this._cache.outputValidator(e.name,(f)=>this._compileOutputValidator(f)).catch((f)=>void this._reportStoreError(f)),n(),a=await this.request({method:"tools/call",params:e},await o())}let i=s!==void 0&&s.ok?s.validator:void 0;if(i){if(a.structuredContent===void 0&&!a.isError)throw new se(W.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(a.structuredContent!==void 0&&!a.isError)try{let u=i(a.structuredContent);if(!u.valid)throw new se(W.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)}catch(u){if(u instanceof se)throw u;throw new se(W.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)}}return a}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 o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("tools/list",e,t,(o)=>o.tools,(o)=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||Ug(this.transport)==="stdio")return;let t=e.tools.filter((r)=>{let o=id(r.inputSchema);if(!o.valid)return console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration — ${o.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,r,o){let s=Wc(_a,r);if(!s.success)throw Error(`Invalid ${e} listChanged options: ${s.error.message}`);if(typeof r.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:n,debounceMs:a}=s.data,{onChanged:i}=r,u=async()=>{if(!n){i(null,null);return}try{i(null,await o())}catch(d){i(d instanceof Error?d:Error(String(d)),null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);if(d)clearTimeout(d);let f=setTimeout(u,a);this._listChangedDebounceTimers.set(e,f)}else u()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};class ou extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var vS=10,OR=13,_o=32;function Id(e){}function wS(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Id,onError:r=Id,onRetry:o=Id,onComment:s,maxBufferSize:n}=e,a=[],i=0,u=!0,l,d="",f=0,h,g=!1;function b(x){if(g)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,x.charCodeAt(0)===239&&x.charCodeAt(1)===187&&x.charCodeAt(2)===191&&(x=x.slice(3))),a.length===0){let ee=w(x);ee!==""&&(a.push(ee),i=ee.length),_();return}if(x.indexOf(`
|
|
73
|
+
`)===-1&&x.indexOf("\r")===-1){a.push(x),i+=x.length,_();return}a.push(x);let R=a.join("");a.length=0,i=0;let Z=w(R);Z!==""&&(a.push(Z),i=Z.length),_()}function _(){n!==void 0&&(i+d.length<=n||(g=!0,a.length=0,i=0,l=void 0,d="",f=0,h=void 0,r(new ou(`Buffered data exceeded max buffer size of ${n} characters`,{type:"max-buffer-size-exceeded"}))))}function w(x){let R=0;if(x.indexOf("\r")===-1){let Z=x.indexOf(`
|
|
74
|
+
`,R);for(;Z!==-1;){if(R===Z){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0,R=Z+1,Z=x.indexOf(`
|
|
75
|
+
`,R);continue}let ee=x.charCodeAt(R);if(bS(x,R,ee)){let X=x.charCodeAt(R+5)===_o?R+6:R+5,ne=x.slice(X,Z);if(f===0&&x.charCodeAt(Z+1)===vS){t({id:l,event:h,data:ne}),l=void 0,d="",h=void 0,R=Z+2,Z=x.indexOf(`
|
|
76
|
+
`,R);continue}d=f===0?ne:`${d}
|
|
77
|
+
${ne}`,f++}else yS(x,R,ee)?h=x.slice(x.charCodeAt(R+6)===_o?R+7:R+6,Z)||void 0:I(x,R,Z);R=Z+1,Z=x.indexOf(`
|
|
78
|
+
`,R)}return x.slice(R)}for(;R<x.length;){let Z=x.indexOf("\r",R),ee=x.indexOf(`
|
|
79
|
+
`,R),X=-1;if(Z!==-1&&ee!==-1?X=Z<ee?Z:ee:Z!==-1?Z===x.length-1?X=-1:X=Z:ee!==-1&&(X=ee),X===-1)break;I(x,R,X),R=X+1,x.charCodeAt(R-1)===OR&&x.charCodeAt(R)===vS&&R++}return x.slice(R)}function I(x,R,Z){if(R===Z){z();return}let ee=x.charCodeAt(R);if(bS(x,R,ee)){let re=x.charCodeAt(R+5)===_o?R+6:R+5,de=x.slice(re,Z);d=f===0?de:`${d}
|
|
80
|
+
${de}`,f++;return}if(yS(x,R,ee)){h=x.slice(x.charCodeAt(R+6)===_o?R+7:R+6,Z)||void 0;return}if(ee===105&&x.charCodeAt(R+1)===100&&x.charCodeAt(R+2)===58){let re=x.slice(x.charCodeAt(R+3)===_o?R+4:R+3,Z);re.includes("\x00")||(l=re);return}if(ee===58){if(s){let re=x.slice(R,Z);s(re.slice(x.charCodeAt(R+1)===_o?2:1))}return}let X=x.slice(R,Z),ne=X.indexOf(":");if(ne===-1){A(X,"",X);return}let xe=X.slice(0,ne),te=X.charCodeAt(ne+1)===_o?2:1,ae=X.slice(ne+te);A(xe,ae,X)}function A(x,R,Z){switch(x){case"event":h=R||void 0;break;case"data":d=f===0?R:`${d}
|
|
81
|
+
${R}`,f++;break;case"id":R.includes("\x00")||(l=R);break;case"retry":/^\d+$/.test(R)?o(parseInt(R,10)):r(new ou(`Invalid \`retry\` value: "${R}"`,{type:"invalid-retry",value:R,line:Z}));break;default:r(new ou(`Unknown field "${x.length>20?`${x.slice(0,20)}…`:x}"`,{type:"unknown-field",field:x,value:R,line:Z}));break}}function z(){f>0&&t({id:l,event:h,data:d}),l=void 0,d="",f=0,h=void 0}function q(x={}){if(x.consume&&a.length>0){let R=a.join("");I(R,0,R.length)}u=!0,l=void 0,d="",f=0,h=void 0,a.length=0,i=0,g=!1}return{feed:b,reset:q}}function bS(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function yS(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class qd extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let s;super({start(n){s=wS({onEvent:(a)=>{n.enqueue(a)},onError(a){typeof e=="function"&&e(a),(e==="terminate"||a.type==="max-buffer-size-exceeded")&&n.error(a)},onRetry:t,onComment:r,maxBufferSize:o})},transform(n){s.feed(n)}})}}function NR(e){return/(?:^|,)\s*dpop(?:\s|$|,)/i.test(e)}function jR(e){if(e.status!==401)return!1;let t=e.headers.get("www-authenticate")??"";return NR(t)&&/use_dpop_nonce/i.test(t)}var MR=(e,t)=>(r)=>{let o=typeof e==="function"?e:()=>e;return async(s,n)=>{let a=(n?.method??"GET").toUpperCase(),i=new URL(s.toString()),u=await o();if(!u)return r(s,n);let l=async()=>{let f=await t();if(!f)return r(s,n);let h=new Headers(n?.headers),g=await u.buildProof({htm:a,htu:i,accessToken:f});return h.set("Authorization",`DPoP ${f}`),h.set("DPoP",g),r(s,{...n,headers:h})},d=await l();if(jR(d)&&d.headers.has("dpop-nonce"))u.observeNonce(d,i),await d.text?.().catch(()=>{}),d=await l();return u.observeNonce(d,i),d}},AR=(e)=>MR(async()=>{try{return await e.dpop?.()}catch(t){throw rt(t)}},async()=>{let t;try{t=await e.tokens()}catch(r){throw rt(r)}return t?.token_type?.toLowerCase()==="dpop"?t.access_token:void 0});var XP=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return We(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 We(this,e)}constructor(e,t,r){super(`SSE error: ${t}`);this.code=e,this.event=r,vr(this,new.target)}};var LR=1,UR={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2},DR=new Set(["authorization","dpop","content-type","mcp-protocol-version","mcp-method","mcp-name","mcp-session-id"]);function zS(e,t){if(typeof AbortSignal.any==="function")return AbortSignal.any([e,t]);let r=new AbortController;if(e.aborted)return r.abort(e.reason),r.signal;if(t.aborted)return r.abort(t.reason),r.signal;let o=()=>{e.removeEventListener("abort",s),t.removeEventListener("abort",n)};function s(){o(),r.abort(e.reason)}function n(){o(),r.abort(t.reason)}return e.addEventListener("abort",s,{once:!0}),t.addEventListener("abort",n,{once:!0}),r.signal}var RS=class{_abortController;_url;_resourceMetadataUrl;_scope;_requestInit;_authProvider;_oauthProvider;_skipIssuerMetadataValidation;_fetch;_fetchWithInit;_redirectPolicy;_sessionId;_reconnectionOptions;_protocolVersion;_onInsufficientScope;_maxStepUpRetries;_serverRetryMs;_reconnectionScheduler;_cancelReconnection;onclose;onerror;onmessage;hasPerRequestStream=!0;constructor(e,t){if(this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._skipIssuerMetadataValidation=t?.skipIssuerMetadataValidation,this._fetch=t?.fetch,Jg(t?.authProvider)){if(this._oauthProvider=t.authProvider,this._authProvider=Wg(t.authProvider,{skipIssuerMetadataValidation:t.skipIssuerMetadataValidation}),t.authProvider.dpop)this._fetch=AR(t.authProvider)(t.fetch??fetch)}else this._authProvider=t?.authProvider;if(this._redirectPolicy=t?.redirectPolicy,this._fetchWithInit=Pg(t?.fetch,t?.requestInit),this._redirectPolicy==="follow")this._fetchWithInit=$g(this._fetchWithInit);this._sessionId=t?.sessionId,this._protocolVersion=t?.protocolVersion,this._reconnectionOptions=t?.reconnectionOptions??UR,this._reconnectionScheduler=t?.reconnectionScheduler,this._onInsufficientScope=t?.onInsufficientScope??"reauthorize",this._maxStepUpRetries=Math.max(0,t?.maxStepUpRetries??LR)}async _stepUpAuthorize(e,t){try{return await this._stepUpAuthorizeInner(e,t)}catch(r){throw rt(r)}}async _stepUpAuthorizeInner(e,t){if(this._onInsufficientScope==="throw")throw new xd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(!this._oauthProvider)throw new xd({requiredScope:e.scope,resourceMetadataUrl:e.resourceMetadataUrl,errorDescription:e.errorDescription});if(t>=this._maxStepUpRetries)throw new gt(M.ClientHttpForbidden,`Server returned 403 insufficient_scope after step-up re-authorization (retry limit ${this._maxStepUpRetries} reached)`,{status:403,statusText:e.statusText??"Forbidden",text:e.text});if(e.resourceMetadataUrl)this._resourceMetadataUrl=e.resourceMetadataUrl;let r=await this._oauthProvider.tokens(),o=tu(this._scope,r?.scope,e.scope);this._scope=o;let s=Kg(o,r?.scope);return ru(this._oauthProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:o,forceReauthorization:s,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})}_redirects(e){return this._redirectPolicy==="follow"?e:Ss(e)}_unfollowedRedirect(e,t){let r=this._redirectPolicy==="follow"?void 0:Cg(e,t);return r&&`${r} (redirectPolicy: 'same-origin')`}async _commonHeaders(){let e=new Headers(this._requestInit?.headers||void 0),t;try{t=await this._authProvider?.token()}catch(r){throw rt(r)}if(t)e.set("Authorization",`Bearer ${t}`);if(this._sessionId)e.set("mcp-session-id",this._sessionId);if(this._protocolVersion)e.set("mcp-protocol-version",this._protocolVersion);return e}_applyBodyDerivedHeaders(e,t){if(Array.isArray(t)||!yr(t))return;let r=t.params?._meta?.[Bt];if(typeof r!=="string")return;e.set("mcp-protocol-version",r),e.set("mcp-method",t.method);let o=vg(t.method,t.params);if(o?.value!==void 0)e.set("mcp-name",cd(o.value))}_isModernEnvelopedRequest(e){if(Array.isArray(e)||!yr(e))return!1;let t=e.params?._meta?.[Bt];return typeof t==="string"&&Nt(t)}async _startOrAuthSse(e,t=!1,r=0){let{resumptionToken:o,requestSignal:s}=e,n=()=>this._abortController?.signal.aborted===!0||s?.aborted===!0;try{let a=await this._commonHeaders(),i=[...a.get("accept")?.split(",").map((f)=>f.trim().toLowerCase())??[],"text/event-stream"];if(a.set("accept",[...new Set(i)].join(", ")),o)a.set("last-event-id",o);let u=this._abortController?.signal,l=s!==void 0&&u!==void 0?zS(u,s):s??u,d=await this._redirects(this._fetch??fetch)(this._url,{...this._requestInit,method:"GET",headers:a,signal:l});if(!d.ok){if(d.status===401&&this._authProvider){if(d.headers.has("www-authenticate")){let{resourceMetadataUrl:h,scope:g}=bs(d);this._resourceMetadataUrl=h,this._scope=tu(this._scope,g)}if(this._authProvider.onUnauthorized&&!t){try{await this._authProvider.onUnauthorized({response:d,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(h){throw rt(h)}return await d.text?.().catch(()=>{}),this._startOrAuthSse(e,!0,r)}if(await d.text?.().catch(()=>{}),t)throw rt(new gt(M.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:d.statusText}));throw rt(new vt)}if(d.status===403){let{resourceMetadataUrl:h,scope:g,error:b,errorDescription:_}=bs(d);if(b==="insufficient_scope"){let w=await d.text?.().catch(()=>null);if(await this._stepUpAuthorize({scope:g,resourceMetadataUrl:h,errorDescription:_,statusText:d.statusText,text:w},r)!=="AUTHORIZED")throw rt(new vt);return this._startOrAuthSse(e,t,r+1)}}if(await d.text?.().catch(()=>{}),d.status===405){e.onRequestStreamEnd?.();return}let f=this._unfollowedRedirect(this._url,d)??d.statusText;throw new gt(M.ClientHttpFailedToOpenStream,`Failed to open SSE stream: ${f}`,{status:d.status,statusText:d.statusText})}this._handleSseStream(d.body,e,!0)}catch(a){if(!n())this.onerror?.(a);throw a}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`)),e.onRequestStreamEnd?.();return}let o=this._getNextReconnectionDelay(t),s=()=>{if(this._cancelReconnection=void 0,this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this._startOrAuthSse(e).catch((n)=>{if(this._abortController?.signal.aborted||e.requestSignal?.aborted)return;this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`));try{this._scheduleReconnection(e,t+1)}catch(a){this.onerror?.(a instanceof Error?a:Error(String(a)))}})};if(this._reconnectionScheduler){let n=this._reconnectionScheduler(s,o,t);this._cancelReconnection=typeof n==="function"?n:void 0}else{let n=setTimeout(s,o);this._cancelReconnection=()=>clearTimeout(n)}}_handleSseStream(e,t,r){if(!e){t.onRequestStreamEnd?.();return}let{onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:a}=t,i=()=>this._abortController?.signal.aborted===!0||n?.aborted===!0,u,l=!1,d=!1;(async()=>{try{let h=e.pipeThrough(new TextDecoderStream).pipeThrough(new qd({onRetry:(g)=>{this._serverRetryMs=g}})).getReader();while(!0){let{value:g,done:b}=await h.read();if(b)break;if(g.id)u=g.id,l=!0,o?.(g.id);if(!g.data)continue;if(!g.event||g.event==="message")try{let _=_t.parse(JSON.parse(g.data));if(po(_)||ho(_)){if(d=!0,s!==void 0)_.id=s}this.onmessage?.(_)}catch(_){this.onerror?.(_)}}if((r||l)&&!d&&this._abortController&&!i())this._scheduleReconnection({resumptionToken:u,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:a},0);else if(!i())a?.()}catch(h){if(i())return;if(this.onerror?.(Error(`SSE stream disconnected: ${h}`)),(r||l)&&!d&&this._abortController&&!i())try{this._scheduleReconnection({resumptionToken:u,onresumptiontoken:o,replayMessageId:s,requestSignal:n,onRequestStreamEnd:a},0)}catch(g){this.onerror?.(Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`)),a?.()}else a?.()}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e,t){if(!this._oauthProvider)throw new vt("finishAuth requires an OAuthClientProvider");let{authorizationCode:r,iss:o}=await Gg(e,t,this._oauthProvider,this._url,{fetchFn:this._fetchWithInit,resourceMetadataUrl:this._resourceMetadataUrl});if(await ru(this._oauthProvider,{serverUrl:this._url,authorizationCode:r,iss:o,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit,skipIssuerMetadataValidation:this._skipIssuerMetadataValidation})!=="AUTHORIZED")throw new vt("Failed to authorize")}async close(){try{this._cancelReconnection?.()}finally{this._cancelReconnection=void 0,this._abortController?.abort(),this.onclose?.()}}async send(e,t){return this._send(e,t,!1)}async _send(e,t,r,o=0){try{let{resumptionToken:s,onresumptiontoken:n}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:yr(e)?e.id:void 0,requestSignal:t?.requestSignal}).catch((w)=>this.onerror?.(w));return}let a=await this._commonHeaders();this._applyBodyDerivedHeaders(a,e);let i=Array.isArray(e)?e.some((w)=>ad(w)):ad(e);if(i)a.delete("mcp-session-id");if(t?.headers!==void 0)for(let[w,I]of Object.entries(t.headers)){if(DR.has(w.toLowerCase()))continue;a.set(w,I)}a.set("content-type","application/json");let u=[...a.get("accept")?.split(",").map((w)=>w.trim().toLowerCase())??[],"application/json","text/event-stream"];a.set("accept",[...new Set(u)].join(", "));let l=this._abortController?.signal,d=t?.requestSignal!==void 0&&l!==void 0?zS(l,t.requestSignal):t?.requestSignal??l,f={...this._requestInit,method:"POST",headers:a,body:JSON.stringify(e),signal:d},h=await this._redirects(this._fetch??fetch)(this._url,f);if(i&&h.ok)this._sessionId=h.headers.get("mcp-session-id")||void 0;if(!h.ok){if(h.status===401&&this._authProvider){if(h.headers.has("www-authenticate")){let{resourceMetadataUrl:A,scope:z}=bs(h);this._resourceMetadataUrl=A,this._scope=tu(this._scope,z)}if(this._authProvider.onUnauthorized&&!r){try{await this._authProvider.onUnauthorized({response:h,serverUrl:this._url,fetchFn:this._fetchWithInit})}catch(A){throw rt(A)}return await h.text?.().catch(()=>{}),this._send(e,t,!0,o)}if(await h.text?.().catch(()=>{}),r)throw rt(new gt(M.ClientHttpAuthentication,"Server returned 401 after re-authentication",{status:401,statusText:h.statusText}));throw rt(new vt)}let w=await h.text?.().catch(()=>null);if(h.status===403){let{resourceMetadataUrl:A,scope:z,error:q,errorDescription:x}=bs(h);if(q==="insufficient_scope"){if(await this._stepUpAuthorize({scope:z,resourceMetadataUrl:A,errorDescription:x,statusText:h.statusText,text:w},o)!=="AUTHORIZED")throw rt(new vt);return this._send(e,t,r,o+1)}}if(h.status===400&&typeof w==="string"&&this._isModernEnvelopedRequest(e))try{let A=_t.parse(JSON.parse(w)),z=(Array.isArray(e)?e:[e]).filter((q)=>yr(q));if(ho(A)&&z.some((q)=>q.id===A.id)){this.onmessage?.(A);return}}catch{}let I=this._unfollowedRedirect(this._url,h)??w;throw new gt(M.ClientHttpNotImplemented,`Error POSTing to endpoint: ${I}`,{status:h.status,statusText:h.statusText,text:w})}if(h.status===202){if(await h.text?.().catch(()=>{}),fg(e))this._startOrAuthSse({resumptionToken:void 0}).catch((w)=>this.onerror?.(w));return}let g=(Array.isArray(e)?e:[e]).some((w)=>("method"in w)&&("id"in w)&&w.id!==void 0),b=h.headers.get("content-type"),_=kg(b);if(g)if(_==="text/event-stream")this._handleSseStream(h.body,{onresumptiontoken:n,requestSignal:t?.requestSignal,onRequestStreamEnd:t?.onRequestStreamEnd},!1);else if(_==="application/json"){let w=await h.json(),I=Array.isArray(w)?w.map((A)=>_t.parse(A)):[_t.parse(w)];for(let A of I)this.onmessage?.(A)}else throw await h.text?.().catch(()=>{}),new L(M.ClientHttpUnexpectedContent,`Unexpected content type: ${b}`,{contentType:b});else await h.text?.().catch(()=>{})}catch(s){if(t?.requestSignal?.aborted!==!0)this.onerror?.(s);throw s}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await this._redirects(this._fetch??fetch)(this._url,t);if(await r.text?.().catch(()=>{}),!r.ok&&r.status!==405)throw new gt(M.ClientHttpFailedToTerminateSession,`Failed to terminate session: ${this._unfollowedRedirect(this._url,r)??r.statusText}`,{status:r.status,statusText:r.statusText});this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class $S{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let o=r.listeners.indexOf(t);if(o!==-1)r.listeners.splice(o,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let o of[...r.listeners])o(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class CS{_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 xS=new Set;function kS(e,t){let[r,o]=t,s=r?.shape;if(typeof s?.method?.value!=="string")return;let n=s.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!xS.has(a))xS.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${n}", { params: Schema.shape.params }, handler).`);let i=o;return[n,{params:s.params},e==="request"?(u,l)=>i({method:n,params:u},ZR(l)):(u)=>i({method:n,params:u})]}function ZR(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 IS="2026-01-26";var HR="ui/notifications/tool-input-partial";var FR=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."),VR=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."),BR=T(VR.describe(`Style variables for theming MCP apps.
|
|
82
82
|
|
|
83
83
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
84
84
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
85
85
|
|
|
86
86
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
87
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
87
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),C([c(),Al()]).describe(`Style variables for theming MCP apps.
|
|
88
88
|
|
|
89
89
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
90
90
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -96,10 +96,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
96
96
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
97
97
|
|
|
98
98
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
99
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
99
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),JR=m({method:p("ui/open-link"),params:m({url:c().describe("URL to open in the host's browser")})}),WR=m({isError:E().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),KR=m({isError:E().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),GR=m({isError:E().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),YR=m({method:p("ui/notifications/sandbox-proxy-ready"),params:m({})}),Od=m({connectDomains:v(c()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
100
100
|
|
|
101
101
|
- Maps to CSP \`connect-src\` directive
|
|
102
|
-
- Empty or omitted → no network connections (secure default)`),resourceDomains:
|
|
102
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:v(c()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:v(c()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:v(c()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Nd=m({camera:m({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:m({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:m({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:m({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),XR=m({method:p("ui/notifications/size-changed"),params:m({width:k().optional().describe("New width in pixels."),height:k().optional().describe("New height in pixels.")})}),uT=m({method:p("ui/notifications/tool-input"),params:m({arguments:T(c(),D().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),lT=m({method:p("ui/notifications/tool-input-partial"),params:m({arguments:T(c(),D().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),dT=m({method:p("ui/notifications/tool-cancelled"),params:m({reason:c().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),QR=m({fonts:c().optional()}),ex=m({variables:BR.optional().describe("CSS variables for theming the app."),css:QR.optional().describe("CSS blocks that apps can inject.")}),mT=m({method:p("ui/resource-teardown"),params:m({})}),tx=T(c(),D()),PS=m({text:m({}).optional().describe("Host supports text content blocks."),image:m({}).optional().describe("Host supports image content blocks."),audio:m({}).optional().describe("Host supports audio content blocks."),resource:m({}).optional().describe("Host supports resource content blocks."),resourceLink:m({}).optional().describe("Host supports resource link content blocks."),structuredContent:m({}).optional().describe("Host supports structured content.")}),rx=m({method:p("ui/notifications/request-teardown"),params:m({}).optional()}),ox=m({experimental:T(c(),T(c(),pc()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:m({}).optional().describe("Host supports opening external URLs."),downloadFile:m({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:m({listChanged:E().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:m({listChanged:E().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:m({}).optional().describe("Host accepts log messages."),sandbox:m({permissions:Nd.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Od.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:PS.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:PS.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:m({tools:m({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),sx=m({experimental:T(c(),T(c(),pc()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:m({listChanged:E().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:v(di).optional().describe("Display modes the app supports.")}),nx=m({method:p("ui/notifications/initialized"),params:m({}).optional()}),pT=m({csp:Od.optional().describe("Content Security Policy configuration for UI resources."),permissions:Nd.optional().describe("Sandbox permissions requested by the UI resource."),domain:c().optional().describe(`Dedicated origin for view sandbox.
|
|
103
103
|
|
|
104
104
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
105
105
|
|
|
@@ -107,19 +107,20 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
|
|
|
107
107
|
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
108
108
|
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
109
109
|
|
|
110
|
-
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:
|
|
110
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:E().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
111
111
|
|
|
112
112
|
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
113
113
|
|
|
114
114
|
- \`true\`: request visible border + background
|
|
115
115
|
- \`false\`: request no visible border + background
|
|
116
|
-
- omitted: host decides border`)}),
|
|
116
|
+
- omitted: host decides border`)}),TS=m({method:p("ui/request-display-mode"),params:m({mode:di.describe("The display mode being requested.")})}),ES=m({mode:di.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),ax=C([p("model"),p("app")]).describe("Tool visibility scope - who can access the tool."),hT=m({resourceUri:c().optional(),visibility:v(ax).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
117
117
|
- "model": Tool visible to and callable by the agent
|
|
118
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
119
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:c().optional().describe("User's language and region preference in BCP 47 format."),timeZone:c().optional().describe("User's timezone in IANA format."),userAgent:c().optional().describe("Host application identifier."),platform:E([h("web"),h("desktop"),h("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p({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:p({top:z().describe("Top safe area inset in pixels."),right:z().describe("Right safe area inset in pixels."),bottom:z().describe("Bottom safe area inset in pixels."),left:z().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),CT=p({method:h("ui/notifications/host-context-changed"),params:DS.describe("Partial context update containing only changed fields.")}),zw=p({method:h("ui/update-model-context"),params:p({content:S(kt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:P(c(),q().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),ww=p({method:h("ui/initialize"),params:p({appInfo:Tt.describe("App identification (name and version)."),appCapabilities:Sw.describe("Features and capabilities this app provides."),protocolVersion:c().describe("Protocol version this app supports.")})}),Rw=p({protocolVersion:c().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Tt.describe("Host application identification and version."),hostCapabilities:gw.describe("Features and capabilities provided by the host."),hostContext:DS.describe("Rich context about the host environment.")}).passthrough();class Gi{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=ut.safeParse(r.data);if(o.success)console.debug("Parsed message",o.data),this.onmessage?.(o.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",o.error.message,r);else console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==rw)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var xw=[ZS];class Yi extends Ji{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new LS;_methods=new US;setRequestHandler=(...e)=>{let[t,...r]=AS("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=AS("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};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)};_wrapHandler(e,t){let r=super._wrapHandler(e,t);if(e==="ui/initialize"||e==="ping")return r;return async(o,n)=>{if(!this._initializedReceived)console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`);return r(o,n)}}eventSchemas={sizechange:dw,sandboxready:uw,initialized:_w,requestteardown:fw,loggingmessage:Br};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){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)}`);let r=(o)=>{if(e==="initialized")this._initializedReceived=!0;this._events.dispatch(e,o)};if(e==="loggingmessage")this.setNotificationHandler("notifications/message",(o)=>{r(o.params)});else this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>r(o));this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,r,o){super(o);this._client=e,this._hostInfo=t,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=o?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:ww.shape.params,result:Rw},(n)=>this._onAppsInitialize(n)),this.replaceRequestHandler("ping",(n,s)=>(this.onping?.(n.params,s),{})),this.replaceRequestHandler("ui/request-display-mode",{params:qS.shape.params,result:jS},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(e){this.setEventHandler("sizechange",e)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(e){this.setEventHandler("sandboxready",e)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(e){this.setEventHandler("initialized",e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,e),this._onmessage=e,this.replaceRequestHandler("ui/message",{params:vw.shape.params,result:lw},async(t,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(t,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:iw.shape.params,result:aw},async(t,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(t,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:yw.shape.params,result:cw},async(t,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(t,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(e){this.setEventHandler("requestteardown",e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler("ui/request-display-mode",{params:qS.shape.params,result:jS},async(t,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(t,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(e){this.setEventHandler("loggingmessage",e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler("ui/update-model-context",{params:zw.shape.params,result:cr},async(t,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(t,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(t.params,r)})}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler("resources/list",async(t,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(t.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(t,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(t.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(t,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(t.params,r)})}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler("prompts/list",async(t,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(t.params,r)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;if(this._appInfo!==void 0)console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.");return this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:xw.includes(t)?t:ZS,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},r=!1;for(let o of Object.keys(e)){let n=this._hostContext[o],s=e[o];if(Pw(n,s))continue;t[o]=s,r=!0}if(r)this._hostContext=e,this.sendHostContextChange(t)}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},mw,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:"tools/call",params:e},t)}listTools(e,t){return this.request({method:"tools/list",params:e},t)}async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let t=this._client.getServerCapabilities();if(!t)throw Error("Client server capabilities not available");if(t.tools){if(this.oncalltool=async(r,o)=>this._client.request({method:"tools/call",params:r},{signal:o.mcpReq.signal}),t.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(r)=>this.sendToolListChanged(r.params))}if(t.resources){if(this.onlistresources=async(r,o)=>this._client.request({method:"resources/list",params:r},{signal:o.mcpReq.signal}),this.onlistresourcetemplates=async(r,o)=>this._client.request({method:"resources/templates/list",params:r},{signal:o.mcpReq.signal}),this.onreadresource=async(r,o)=>this._client.request({method:"resources/read",params:r},{signal:o.mcpReq.signal}),t.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(r)=>this.sendResourceListChanged(r.params))}if(t.prompts){if(this.onlistprompts=async(r,o)=>this._client.request({method:"prompts/list",params:r},{signal:o.mcpReq.signal}),t.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(r)=>this.sendPromptListChanged(r.params))}}return super.connect(e)}}function Pw(e,t){return JSON.stringify(e)===JSON.stringify(t)}var FS=[200,800],Tw=(e)=>e?.name==="TypeError"&&/^(Failed to fetch|fetch failed|Load failed|NetworkError when attempting to fetch resource\.)$/.test(e.message);function Ew(e,t){return new Promise((r,o)=>{t?.throwIfAborted();let s=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(s),t.removeEventListener("abort",i),o(t.reason)};t?.addEventListener("abort",i,{once:!0})})}function HS(e,{signal:t,onDiagnostic:r,wait:o=Ew}={}){return async(n)=>{for(let s=1;;s++){t?.throwIfAborted();try{let i=await e(n);if(t?.throwIfAborted(),s>1)r?.({state:"recovered",uri:n.uri,attempt:s});return i}catch(i){if(t?.throwIfAborted(),!Tw(i))throw i;if(s>FS.length)throw r?.({state:"exhausted",uri:n.uri,attempt:s,message:i.message}),Object.assign(Error(`MCP resource transport failed for ${n.uri} after ${s} attempts: ${i.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:i}),{code:"ADS_RESOURCE_TRANSPORT"});let a=FS[s-1];r?.({state:"retry",uri:n.uri,attempt:s,nextAttempt:s+1,delayMs:a,message:i.message}),await o(a,t)}}}}function VS(e){let t=[],r=new Map;for(let o of e){if(!o.group){t.push(o);continue}if(!r.has(o.group))r.set(o.group,[]);r.get(o.group).push(o)}return[...t.length?[{label:null,entries:t}]:[],...[...r].sort(([o],[n])=>o.localeCompare(n)).map(([o,n])=>({label:o,entries:n}))]}async function BS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:n,readResource:s,callTool:i,context:a,onError:l,onState:u}){let d={slot:e,title:t,sandboxUrl:r,resourceUri:o,readResource:s,callTool:i,context:a,onError:l,onState:u},m=n,f,g,b,y=!1;function v(){if(y||b)return;u?.({state:"loading"}),b=Promise.resolve().then(async()=>{if(await g,await f?.close(),y)return;g=JS({...d,result:m,onReopen:v});try{f=await g}finally{g=void 0}}).catch((L)=>{if(!y)l(L)}).finally(()=>{b=void 0})}g=JS({...d,result:m,onReopen:v});try{f=await g}finally{g=void 0}return{async updateResult(L){if(m=L,await b,!y)await f.updateResult(m)},refreshContext(){if(!y&&!b)f.refreshContext()},async close(){y=!0,await b,await f?.close()}}}async function JS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:n,readResource:s,callTool:i,context:a,onError:l,onState:u,onReopen:d}){let m=!1,g=(await s({uri:o})).contents.find((x)=>x.mimeType==="text/html;profile=mcp-app"&&typeof x.text==="string");if(!g)throw Error("Comparison preview App is unavailable.");let b=document.createElement("iframe");b.title=t,b.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),b.src=r,e.append(b);let y=new Yi(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:a(b)});y.onreadresource=s,y.oncalltool=i,y.onerror=(x)=>{if(!m)l(x)},y.onloggingmessage=(x)=>{if(m||x.logger!=="ads-preview")return;if(x.data?.code==="ADS_PREVIEW_REOPEN"){d();return}if(u?.(x.data),x.data?.state==="error")l(Error(x.data.message))};let v,L=new Promise((x,Z)=>{v=setTimeout(()=>Z(Error("Comparison App initialization timed out.")),15000),y.oninitialized=()=>{clearTimeout(v),x()}});y.onsandboxready=()=>y.sendSandboxResourceReady({html:g.text,csp:g._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});let H=new ResizeObserver(()=>y.setHostContext(a(b)));try{await Promise.all([y.connect(new Gi(b.contentWindow,b.contentWindow)),L]),H.observe(b),await y.sendToolInput({arguments:{}}),await y.sendToolResult(n)}catch(x){throw H.disconnect(),b.remove(),await y.close(),x}finally{clearTimeout(v)}return{updateResult:(x)=>y.sendToolResult(x),refreshContext:()=>y.setHostContext(a(b)),async close(){m=!0,H.disconnect();try{await y.teardownResource({},{timeout:500})}catch{}await y.close(),b.remove()}}}function ad(e,t){return t===e||t.startsWith(e+"/")||t.startsWith(e+".")}function WS(e,t,r,o=new Map){let n=new Map(r.map(({id:l,title:u,revision:d,state:m,preview:f})=>[l,{id:l,title:u,revision:d,state:m,...f?{preview:f}:{}}])),s=new Map(e.map((l)=>[l.id,{...l,drafts:(l.drafts??[]).flatMap((u)=>n.has(u.id)?[n.get(u.id)]:[])}]));for(let l of t){let u=s.get(l.id);s.set(l.id,{...u,...l,kind:"tokens",drafts:u?.drafts??[]})}let i=(l,u)=>l==="tokens"&&u.kind==="tokens"||(u.unit?u.unit===l:ad(l,u.id)),a=(l,u)=>{if(!l.drafts.some((d)=>d.id===u.id))l.drafts.push(n.get(u.id))};for(let l of r){let u=o.get(l.id);for(let d of u?.scenarios??[]){if(!l.units.some((f)=>i(f,d)))continue;let m=s.get(d.id);if(!m)m={...d,draftOnly:!0,drafts:[]},s.set(d.id,m);a(m,l)}}for(let l of r)for(let u of l.units){let d=u.split("/")[0];if(!["brand","tokens","components","patterns","composition"].includes(d))continue;let m=[...s.values()].filter((f)=>i(u,f));if(m.length)for(let f of m)a(f,l);else s.set(u,{id:u,unit:u,title:u.split("/").at(-1),kind:d,draftOnly:!0,pendingDraftScenario:!0,drafts:[n.get(l.id)]})}return{scenarios:[...s.values()],categories:[...s.values()].filter((l)=>l.kind==="tokens")}}function KS(e,t,r){let o=e.drafts?.find((l)=>l.id===r)??e.drafts?.[0],n=o&&(t?.drafts?.find((l)=>l.id===o.id)??o.preview),s=o?n?.scenarios?.find((l)=>l.id===e.id)??n:t?.previews?.find((l)=>l.id===e.id)??e.build,i=s?.state==="error"?"error":s?.state==="checking"||s?.live?"checking":s?.building||["queued","building"].includes(s?.state)?"building":s?.current?"ready":s?.stale?"stale":"unreported",a={error:Ra(s),checking:"Preview compiled; checking changes",building:"Preview build in progress",ready:"Preview build complete",stale:"Previous preview; current source not built",unreported:"Preview not built"};return{state:i,label:`${o?"Draft · ":""}${a[i]}${o&&i==="ready"?" · unaccepted":""}`}}var GS={unreported:'<circle cx="8" cy="8" r="3"/>',building:'<circle cx="8" cy="8" r="5" stroke-dasharray="22 10"/>',checking:'<circle cx="8" cy="8" r="5" stroke-dasharray="3 3"/><path d="m6 8 1.5 1.5L10 6"/>',ready:'<circle cx="8" cy="8" r="5"/><path d="m5.5 8 1.7 1.7 3.3-3.4"/>',stale:'<circle cx="8" cy="8" r="5" stroke-dasharray="2 3"/>',error:'<circle cx="8" cy="8" r="5"/><path d="M8 5.5v3M8 10.5h.01"/>'};var Uc="ads://project/icons";function Q(e,t={},...r){let o=Object.assign(document.createElement(e),t);return o.append(...r.filter((n)=>n!==null&&n!==void 0&&n!==!1)),o}var kw={fill:"black",stroke:"none","stroke-width":"1","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"4","stroke-dasharray":"none","fill-opacity":"1","stroke-opacity":"1","fill-rule":"nonzero"};function $w(e){let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(t.namespaceURI!=="http://www.w3.org/2000/svg"||t.localName!=="svg")return null;for(let o of t.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(o.localName)||o.namespaceURI!=="http://www.w3.org/2000/svg")o.remove();for(let o of[t,...t.querySelectorAll("*")])for(let n of Array.from(o.attributes))if(/^on/i.test(n.name)||/href$/i.test(n.name)&&!n.value.trim().startsWith("#"))o.removeAttribute(n.name);let r=document.importNode(t,!0);for(let o of["width","height","class"])r.removeAttribute(o);for(let[o,n]of Object.entries(kw))if(!r.style.getPropertyValue(o))r.style.setProperty(o,r.getAttribute(o)??n);return r.setAttribute("aria-hidden","true"),r.setAttribute("focusable","false"),r}function cd(e,t,r){let o=Q("span",{className:"icons-glyph"});o.style.width=o.style.height=`${t}px`;let n=$w(e.svg);if(n)o.append(n);if(r)o.setAttribute("role","img"),o.setAttribute("aria-label",r),o.title=r;else o.setAttribute("aria-hidden","true");return o}function Cw(e){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","icons-grid"),t.setAttribute("aria-hidden","true"),t.setAttribute("viewBox",`${e.x} ${e.y} ${e.width} ${e.height}`),t.setAttribute("preserveAspectRatio","xMidYMid meet");let r=Math.max(1,Math.ceil(Math.max(e.width,e.height)/48)),o=(n,s,i,a,l)=>{let u=document.createElementNS("http://www.w3.org/2000/svg","line");for(let[d,m]of Object.entries({x1:n,y1:s,x2:i,y2:a}))u.setAttribute(d,m);if(l)u.setAttribute("class","mid");t.append(u)};for(let n=0;n<=e.width;n+=r)o(e.x+n,e.y,e.x+n,e.y+e.height,n*2===e.width);for(let n=0;n<=e.height;n+=r)o(e.x,e.y+n,e.x+e.width,e.y+n,n*2===e.height);if(e.width%2&&r===1)o(e.x+e.width/2,e.y,e.x+e.width/2,e.y+e.height,!0);if(e.height%2&&r===1)o(e.x,e.y+e.height/2,e.x+e.width,e.y+e.height/2,!0);return t}var ld=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function Iw(e){let t=e.filter((r)=>r.severity==="error").length;return t===e.length?ld(t,"error"):ld(e.length,"issue")}function YS(e){return Q("p",{className:"icons-finding",title:e.file??""},Q("strong",{textContent:e.rule})," ",e.message)}function Ow(e,t){let r=Q("article",{className:"icons-card"});if(r.dataset.glyph=e.name,e.findings.length)r.dataset.findings=String(e.findings.length);let o=Q("div",{className:"icons-card-head"},Q("h3",{textContent:e.name}),e.findings.length?Q("span",{className:"icons-badge",textContent:Iw(e.findings)}):null),n=Q("div",{className:"icons-mag"});if(e.grid)n.append(Cw(e.grid));n.append(cd(e,96));let s=Q("div",{className:"icons-sizes"},...t.map((i)=>Q("span",{className:"icons-size"},cd(e,i.px),Q("small",{textContent:String(i.px),title:i.token}))));return r.append(...[o,Q("p",{className:"icons-alias",textContent:e.aliases.length?`alias: ${e.aliases.join(", ")}`:"",title:e.aliases.join(", ")}),n,s,...e.findings.map(YS)].filter(Boolean)),r.setAttribute("aria-label",e.name),r}function Nw(e){let t=Q("figure",{className:"icons-logo"});if(t.dataset.logo=e.name,e.tooLarge)return t.append(Q("figcaption",{textContent:`${e.name} (over 1 MB; not shown)`})),t;return t.append(Q("span",{className:"icons-logo-tile"},Q("img",{src:e.src,alt:e.name,title:e.file})),Q("span",{className:"icons-logo-tile icons-logo-tile-black"},Q("img",{src:e.src,alt:""})),Q("figcaption",{textContent:e.name})),t}var Aw=(e,t)=>!t||[e.name,...e.aliases].some((r)=>r.toLowerCase().includes(t));function XS(e,t){let r=e.querySelector(":scope > .icons-view"),o=r?.querySelector("input[type=search]")?.value??"",n=r?.scrollTop??0;if(r=Q("div",{className:"icons-view"}),r.setAttribute("role","region"),r.setAttribute("aria-label","Icons"),!t?.configured)return r.append(Q("h1",{textContent:"Icons"}),Q("p",{className:"icons-summary",textContent:"The project configures no glyph set (assets.glyphs)."})),e.replaceChildren(r),r;let s=t.mixed?"mixed grids":t.grid?`${/^(?:8|11|18)(?!\d)|^8/.test(String(t.grid.width))?"an":"a"} ${t.grid.width}×${t.grid.height} grid`:"no viewBox",i=`${t.source} · ${ld(t.glyphs.length,"glyph")} on ${s} · ${t.aliasCount} ${t.aliasCount===1?"alias":"aliases"}`,a=Q("input",{type:"search",placeholder:"Search name or alias",value:o});a.setAttribute("aria-label","Search glyphs by name or alias");let l=Q("div",{className:"icons-set"});l.setAttribute("role","list"),l.setAttribute("aria-label","The set");let u=Q("div",{className:"icons-cards"}),d=Q("p",{className:"icons-empty",hidden:!0}),m=t.textSize;r.append(Q("div",{className:"icons-head"},Q("div",{},Q("h1",{textContent:"Icons"}),Q("p",{className:"icons-summary",textContent:i})),a),...t.findings.map(YS),Q("h2",{},"The set ",Q("small",{textContent:m?`every glyph at ${m.px} px, the size used beside text`:"every glyph"})),l,Q("h2",{},"Glyphs ",Q("small",{textContent:t.sizes.length?"each on its grid, at every icon size":"each on its grid"})),d,u);for(let g of t.glyphs){let b=Q("span",{className:"icons-set-item"},cd(g,m?.px??18,g.name));b.dataset.glyph=g.name,b.setAttribute("role","listitem"),l.append(b),u.append(Ow(g,t.sizes))}if(t.logos)r.append(Q("h2",{},"Other products' logos ",Q("small",{textContent:t.logos.source})),t.logos.files.length?Q("div",{className:"icons-logos"},...t.logos.files.map(Nw)):Q("p",{className:"icons-summary",textContent:"No images yet."}));let f=()=>{let g=a.value.trim().toLowerCase(),b=0;t.glyphs.forEach((y,v)=>{let L=Aw(y,g);l.children[v].hidden=u.children[v].hidden=!L,b+=L}),d.hidden=b>0,d.textContent=`No glyph matches “${a.value.trim()}”.`};if(a.addEventListener("input",f),f(),e.replaceChildren(r),r.scrollTop=n,o&&document.activeElement===document.body)a.focus();return r}var k=(e)=>document.getElementById(e),Fe=new URLSearchParams(location.search),QS=Fe.get("scenario")??Fe.get("category"),Mw=["brand","tokens","icons","components","patterns","composition"],Fc=!1,un=[],ye,Hc=Fe.get("draft"),gd=[],r_=[],Sd=new Map,hn=Fe.get("split")==="1",pd,_r=[],Ot=0,Kc;async function oa(){let e=_r;_r=[],await Promise.allSettled(e.map((t)=>t.close()))}var nt=document.createElement("button");nt.id="split-view";nt.setAttribute("aria-label","Split view");nt.setAttribute("aria-pressed","false");nt.disabled=!0;nt.title="Select a draft with an accepted version to compare";nt.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>';k("viewport").before(nt);var te="brand",De={},e_=new Map,Xi=!0,_d=[],Gc=[],Yc=[],rt,na,fe,ve,an,ea,dn,Vc,cn,Ye=0,pn=Fe.get("capture")!=="1"&&Fe.get("viewport")==="phone",ot=[{name:"light",scheme:"light"},{name:"dark",scheme:"dark"}],Kt=Fe.get("capture")==="1"&&Fe.get("theme")||"light";if(Fe.get("capture")==="1")document.documentElement.dataset.capture="true";var hd=()=>ot.find((e)=>e.name===Kt)?.scheme??"light";function o_(){document.documentElement.dataset.theme=hd();let e=ot[(ot.findIndex((r)=>r.name===Kt)+1)%ot.length],t=ot.length>1?`Use ${e.name} theme`:`Theme: ${Kt}`;k("theme").setAttribute("aria-label",t),k("theme").title=t,k("theme").disabled=ot.length<2,k("theme").querySelector("svg").innerHTML=hd()==="dark"?'<circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/>':'<path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/>'}document.documentElement.dataset.theme="light";var no=[],mt=Fe.get("capture")==="1"&&Fe.get("brand")||null;function n_(){let e=k("brand-select");if(e.hidden=!no.length,e.options.length!==no.length||no.some((t,r)=>e.options[r].value!==t.name))e.replaceChildren(...no.map((t)=>Object.assign(document.createElement("option"),{value:t.name,textContent:t.name})));if(mt)e.value=mt,e.title=`Brand: ${mt}`}var ud,s_=!0,Zc=!1,Jc,md,Xc=!1,ta=!1,gr,Bt,dd=0,Qi,so=new AbortController,Nt=new rd({name:"ads-showcase",version:"1.0.0"},{versionNegotiation:{mode:"auto"},capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}}}),i_=(e,t={},r={})=>Nt.callTool({name:e,arguments:t},{signal:so.signal,...r}),Bc=HS((e)=>Nt.readResource(e,{signal:so.signal}),{signal:so.signal,onDiagnostic:(e)=>{if(e.state==="retry")document.documentElement.dataset.adsResourceRetries=String(Number(document.documentElement.dataset.adsResourceRetries??0)+1);console.warn("ADS resource transport",e)}}),bd=async(e)=>JSON.parse((await Bc({uri:e})).contents.find((t)=>typeof t.text==="string").text);function a_(e){let t=Yc.find((r)=>r.name===e.name);if(!t||!(t._meta?.ui?.visibility??["model","app"]).includes("app"))throw Error("This tool is not callable from an App.");return Nt.callTool(e)}function Se(e,t=!1,r=t?"error":e?"checking":"ready"){let o=e||"Preview is up to date.";if(k("preview-error").hidden=!t,k("preview-error-message").textContent=t?o.split(`
|
|
120
|
-
`)[0]:"",
|
|
121
|
-
`)[0]}`),c_()}function c_(){let e=na?.warmup,t=e?`Background views: ${e.completed}/${e.total} compiled${e.failed?`; ${e.failed} failed`:""}.`:"";k("warmup-status").hidden=!e,k("warmup-status").textContent=t,k("preview-status").dataset.warmup=e?.state??"disabled",k("preview-status").title=[k("status").textContent,t].filter(Boolean).join(`
|
|
122
|
-
`)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
- "app": Tool callable by the app from this server only`),csp:Ll().optional(),permissions:Ll().optional()}),fT=m({mimeTypes:v(c()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),ix=m({method:p("ui/download-file"),params:m({contents:v(C([oo,so])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),cx=m({method:p("ui/message"),params:m({role:p("user").describe('Message role, currently only "user" is supported.'),content:v(qt).describe("Message content blocks (text, image, etc.).")})}),_T=m({method:p("ui/notifications/sandbox-resource-ready"),params:m({html:c().describe("HTML content to load into the inner iframe."),sandbox:c().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Od.optional().describe("CSP configuration from resource metadata."),permissions:Nd.optional().describe("Sandbox permissions from resource metadata.")})}),gT=m({method:p("ui/notifications/tool-result"),params:gr.describe("Standard MCP tool execution result.")}),qS=m({toolInfo:m({id:ft.optional().describe("JSON-RPC id of the tools/call request."),tool:_r.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:FR.optional().describe("Current color theme preference."),styles:ex.optional().describe("Style configuration for theming the app."),displayMode:di.optional().describe("How the UI is currently displayed."),availableDisplayModes:v(di).optional().describe("Display modes the host supports."),containerDimensions:C([m({height:k().describe("Fixed container height in pixels.")}),m({maxHeight:C([k(),Al()]).optional().describe("Maximum container height in pixels.")})]).and(C([m({width:k().describe("Fixed container width in pixels.")}),m({maxWidth:C([k(),Al()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
119
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:c().optional().describe("User's language and region preference in BCP 47 format."),timeZone:c().optional().describe("User's timezone in IANA format."),userAgent:c().optional().describe("Host application identifier."),platform:C([p("web"),p("desktop"),p("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:m({touch:E().optional().describe("Whether the device supports touch input."),hover:E().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:m({top:k().describe("Top safe area inset in pixels."),right:k().describe("Right safe area inset in pixels."),bottom:k().describe("Bottom safe area inset in pixels."),left:k().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),ST=m({method:p("ui/notifications/host-context-changed"),params:qS.describe("Partial context update containing only changed fields.")}),ux=m({method:p("ui/update-model-context"),params:m({content:v(qt).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:T(c(),D().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),lx=m({method:p("ui/initialize"),params:m({appInfo:Ct.describe("App identification (name and version)."),appCapabilities:sx.describe("Features and capabilities this app provides."),protocolVersion:c().describe("Protocol version this app supports.")})}),dx=m({protocolVersion:c().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ct.describe("Host application identification and version."),hostCapabilities:ox.describe("Features and capabilities provided by the host."),hostContext:qS.describe("Rich context about the host environment.")}).passthrough();class mi{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=_t.safeParse(r.data);if(o.success)console.debug("Parsed message",o.data),this.onmessage?.(o.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",o.error.message,r);else console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==HR)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var mx=[IS];class pi extends ci{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new $S;_methods=new CS;setRequestHandler=(...e)=>{let[t,...r]=kS("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=kS("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};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)};_wrapHandler(e,t){let r=super._wrapHandler(e,t);if(e==="ui/initialize"||e==="ping")return r;return async(o,s)=>{if(!this._initializedReceived)console.warn(`[ext-apps] AppBridge received '${e}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`);return r(o,s)}}eventSchemas={sizechange:XR,sandboxready:YR,initialized:nx,requestteardown:rx,loggingmessage:no};setEventHandler(e,t){this._ensureEventSlot(e),this._events.setHandler(e,t)}getEventHandler(e){return this._events.getHandler(e)}addEventListener(e,t){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)}`);let r=(o)=>{if(e==="initialized")this._initializedReceived=!0;this._events.dispatch(e,o)};if(e==="loggingmessage")this.setNotificationHandler("notifications/message",(o)=>{r(o.params)});else this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>r(o));this._registeredEvents.add(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t,r,o){super(o);this._client=e,this._hostInfo=t,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=o?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:lx.shape.params,result:dx},(s)=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,n)=>(this.onping?.(s.params,n),{})),this.replaceRequestHandler("ui/request-display-mode",{params:TS.shape.params,result:ES},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(e){return e}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(e){this.setEventHandler("sizechange",e)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(e){this.setEventHandler("sandboxready",e)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(e){this.setEventHandler("initialized",e)}_onmessage;get onmessage(){return this._onmessage}set onmessage(e){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,e),this._onmessage=e,this.replaceRequestHandler("ui/message",{params:cx.shape.params,result:GR},async(t,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(t,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(e){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,e),this._onopenlink=e,this.replaceRequestHandler("ui/open-link",{params:JR.shape.params,result:WR},async(t,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(t,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(e){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,e),this._ondownloadfile=e,this.replaceRequestHandler("ui/download-file",{params:ix.shape.params,result:KR},async(t,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(t,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(e){this.setEventHandler("requestteardown",e)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(e){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,e),this._onrequestdisplaymode=e,this.replaceRequestHandler("ui/request-display-mode",{params:TS.shape.params,result:ES},async(t,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(t,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(e){this.setEventHandler("loggingmessage",e)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(e){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,e),this._onupdatemodelcontext=e,this.replaceRequestHandler("ui/update-model-context",{params:ux.shape.params,result:hr},async(t,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",async(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(e){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,e),this._oncreatesamplingmessage=e,this.replaceRequestHandler("sampling/createMessage",async(t,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(t.params,r)})}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(e){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,e),this._onlistresources=e,this.replaceRequestHandler("resources/list",async(t,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(t.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(e){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,e),this._onlistresourcetemplates=e,this.replaceRequestHandler("resources/templates/list",async(t,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(t.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(e){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,e),this._onreadresource=e,this.replaceRequestHandler("resources/read",async(t,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(t.params,r)})}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(e){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,e),this._onlistprompts=e,this.replaceRequestHandler("prompts/list",async(t,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(t.params,r)})}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(e){let t=e.protocolVersion;if(this._appInfo!==void 0)console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values.");return this._appCapabilities=e.appCapabilities,this._appInfo=e.appInfo,{protocolVersion:mx.includes(t)?t:IS,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},r=!1;for(let o of Object.keys(e)){let s=this._hostContext[o],n=e[o];if(px(s,n))continue;t[o]=n,r=!0}if(r)this._hostContext=e,this.sendHostContextChange(t)}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},tx,t)}sendResourceTeardown=this.teardownResource;callTool(e,t){return this.request({method:"tools/call",params:e},t)}listTools(e,t){return this.request({method:"tools/list",params:e},t)}async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let t=this._client.getServerCapabilities();if(!t)throw Error("Client server capabilities not available");if(t.tools){if(this.oncalltool=async(r,o)=>this._client.request({method:"tools/call",params:r},{signal:o.mcpReq.signal}),t.tools.listChanged)this._client.setNotificationHandler("notifications/tools/list_changed",(r)=>this.sendToolListChanged(r.params))}if(t.resources){if(this.onlistresources=async(r,o)=>this._client.request({method:"resources/list",params:r},{signal:o.mcpReq.signal}),this.onlistresourcetemplates=async(r,o)=>this._client.request({method:"resources/templates/list",params:r},{signal:o.mcpReq.signal}),this.onreadresource=async(r,o)=>this._client.request({method:"resources/read",params:r},{signal:o.mcpReq.signal}),t.resources.listChanged)this._client.setNotificationHandler("notifications/resources/list_changed",(r)=>this.sendResourceListChanged(r.params))}if(t.prompts){if(this.onlistprompts=async(r,o)=>this._client.request({method:"prompts/list",params:r},{signal:o.mcpReq.signal}),t.prompts.listChanged)this._client.setNotificationHandler("notifications/prompts/list_changed",(r)=>this.sendPromptListChanged(r.params))}}return super.connect(e)}}function px(e,t){return JSON.stringify(e)===JSON.stringify(t)}var OS=[200,800],hx=(e)=>e?.name==="TypeError"&&/^(Failed to fetch|fetch failed|Load failed|NetworkError when attempting to fetch resource\.)$/.test(e.message);function fx(e,t){return new Promise((r,o)=>{t?.throwIfAborted();let n=setTimeout(()=>{t?.removeEventListener("abort",a),r()},e),a=()=>{clearTimeout(n),t.removeEventListener("abort",a),o(t.reason)};t?.addEventListener("abort",a,{once:!0})})}function NS(e,{signal:t,onDiagnostic:r,wait:o=fx}={}){return async(s)=>{for(let n=1;;n++){t?.throwIfAborted();try{let a=await e(s);if(t?.throwIfAborted(),n>1)r?.({state:"recovered",uri:s.uri,attempt:n});return a}catch(a){if(t?.throwIfAborted(),!hx(a))throw a;if(n>OS.length)throw r?.({state:"exhausted",uri:s.uri,attempt:n,message:a.message}),Object.assign(Error(`MCP resource transport failed for ${s.uri} after ${n} attempts: ${a.message}. Inspect the host connection and browser network diagnostics; this resource-loading error does not establish a component assertion failure.`,{cause:a}),{code:"ADS_RESOURCE_TRANSPORT"});let i=OS[n-1];r?.({state:"retry",uri:s.uri,attempt:n,nextAttempt:n+1,delayMs:i,message:a.message}),await o(i,t)}}}}function jS(e,{onError:t,delay:r=150,setTimer:o=setTimeout,clearTimer:s=clearTimeout}={}){let n=!1,a=!1,i=!1,u=!1,l=!1,d;function f(){if(!n||a||i||!u||d!==void 0)return;d=o(()=>{d=void 0,i=!0;let h=l;u=l=!1,Promise.resolve().then(()=>e(h)).catch((g)=>{if(!a)t?.(g)}).finally(()=>{i=!1,f()})},r)}return{schedule(h=!1){if(a)return;u=!0,l||=h,f()},start(){n=!0,f()},close(){a=!0,u=l=!1,s(d),d=void 0}}}function MS(e){let t=[],r=new Map;for(let o of e){if(!o.group){t.push(o);continue}if(!r.has(o.group))r.set(o.group,[]);r.get(o.group).push(o)}return[...t.length?[{label:null,entries:t}]:[],...[...r].sort(([o],[s])=>o.localeCompare(s)).map(([o,s])=>({label:o,entries:s}))]}async function LS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:s,readResource:n,callTool:a,context:i,onError:u,onState:l}){let d={slot:e,title:t,sandboxUrl:r,resourceUri:o,readResource:n,callTool:a,context:i,onError:u,onState:l},f=s,h,g,b,_=!1;function w(){if(_||b)return;l?.({state:"loading"}),b=Promise.resolve().then(async()=>{if(await g,await h?.close(),_)return;g=AS({...d,result:f,onReopen:w});try{h=await g}finally{g=void 0}}).catch((I)=>{if(!_)u(I)}).finally(()=>{b=void 0})}g=AS({...d,result:f,onReopen:w});try{h=await g}finally{g=void 0}return{async updateResult(I){if(f=I,await b,!_)await h.updateResult(f)},refreshContext(){if(!_&&!b)h.refreshContext()},async close(){_=!0,await b,await h?.close()}}}async function AS({slot:e,title:t,sandboxUrl:r,resourceUri:o,result:s,readResource:n,callTool:a,context:i,onError:u,onState:l,onReopen:d}){let f=!1,g=(await n({uri:o})).contents.find((z)=>z.mimeType==="text/html;profile=mcp-app"&&typeof z.text==="string");if(!g)throw Error("Comparison preview App is unavailable.");let b=document.createElement("iframe");b.title=t,b.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),b.src=r,e.append(b);let _=new pi(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:i(b)});_.onreadresource=n,_.oncalltool=a,_.onerror=(z)=>{if(!f)u(z)},_.onloggingmessage=(z)=>{if(f||z.logger!=="ads-preview")return;if(z.data?.code==="ADS_PREVIEW_REOPEN"){d();return}if(l?.(z.data),z.data?.state==="error")u(Error(z.data.message))};let w,I=new Promise((z,q)=>{w=setTimeout(()=>q(Error("Comparison App initialization timed out.")),15000),_.oninitialized=()=>{clearTimeout(w),z()}});_.onsandboxready=()=>_.sendSandboxResourceReady({html:g.text,csp:g._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});let A=new ResizeObserver(()=>_.setHostContext(i(b)));try{await Promise.all([_.connect(new mi(b.contentWindow,b.contentWindow)),I]),A.observe(b),await _.sendToolInput({arguments:{}}),await _.sendToolResult(s)}catch(z){throw A.disconnect(),b.remove(),await _.close(),z}finally{clearTimeout(w)}return{updateResult:(z)=>_.sendToolResult(z),refreshContext:()=>_.setHostContext(i(b)),async close(){f=!0,A.disconnect();try{await _.teardownResource({},{timeout:500})}catch{}await _.close(),b.remove()}}}function nu(e,t){return t===e||t.startsWith(e+"/")||t.startsWith(e+".")}function US(e,t,r,o=new Map){let s=new Map(r.map(({id:u,title:l,revision:d,state:f,preview:h})=>[u,{id:u,title:l,revision:d,state:f,...h?{preview:h}:{}}])),n=new Map(e.map((u)=>[u.id,{...u,drafts:(u.drafts??[]).flatMap((l)=>s.has(l.id)?[s.get(l.id)]:[])}]));for(let u of t){let l=n.get(u.id);n.set(u.id,{...l,...u,kind:"tokens",drafts:l?.drafts??[]})}let a=(u,l)=>u==="tokens"&&l.kind==="tokens"||(l.unit?l.unit===u:nu(u,l.id)),i=(u,l)=>{if(!u.drafts.some((d)=>d.id===l.id))u.drafts.push(s.get(l.id))};for(let u of r){let l=o.get(u.id);for(let d of l?.scenarios??[]){if(!u.units.some((h)=>a(h,d)))continue;let f=n.get(d.id);if(!f)f={...d,draftOnly:!0,drafts:[]},n.set(d.id,f);i(f,u)}}for(let u of r)for(let l of u.units){let d=l.split("/")[0];if(!["brand","tokens","components","patterns","composition"].includes(d))continue;let f=[...n.values()].filter((h)=>a(l,h));if(f.length)for(let h of f)i(h,u);else n.set(l,{id:l,unit:l,title:l.split("/").at(-1),kind:d,draftOnly:!0,pendingDraftScenario:!0,drafts:[s.get(u.id)]})}return{scenarios:[...n.values()],categories:[...n.values()].filter((u)=>u.kind==="tokens")}}var _x=(e)=>e==="assets/glyphs"||e==="assets/logos"?"icons":e==="assets/brand"?"brand":e==="foundation"?"tokens":["brand","tokens","icons","components","patterns","composition"].includes(e.split("/")[0])?e.split("/")[0]:"other",su={brand:"Brand",icons:"Icons",tokens:"Tokens",components:"Components",patterns:"Patterns",composition:"Compositions",other:"Other"};function DS(e,t){let r=[];for(let o of t){let s=e.filter((n)=>n.drafts?.some((a)=>a.id===o.id));for(let n of s)r.push({...n,id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n.id)}`,previewId:n.id,title:`${o.title||o.id} · ${n.title}`,group:su[n.kind]??"Other",drafts:[o]});for(let n of o.units??[]){if(s.some((i)=>n==="tokens"&&i.kind==="tokens"||i.unit===n||!i.unit&&nu(n,i.id)))continue;let a=_x(n);r.push({id:`drafts/${encodeURIComponent(o.id)}/${encodeURIComponent(n)}`,unit:n,kind:a,title:`${o.title||o.id} · ${n.split("/").at(-1)}`,group:su[a],drafts:[o]})}if(!s.length&&!o.units?.length)r.push({id:`drafts/${encodeURIComponent(o.id)}`,kind:"other",title:o.title||o.id,group:"Other",drafts:[o]})}return r}var gx=["off","hover","always"],Sx=["bounds","tracks","gaps","padding","margins","mini"],ZS=Object.freeze({mode:"off",bounds:!0,tracks:!1,gaps:!1,padding:!0,margins:!0,mini:!1});function hi(e){return{mode:gx.includes(e?.mode)?e.mode:e?.all===!0?"always":"off",...Object.fromEntries(Sx.map((r)=>[r,e?.[r]===!0]))}}function HS(e){let{mode:t,...r}=hi(e);return{all:t==="always",...r}}function FS(e){let{mode:t,...r}=hi(e);return t!=="off"&&Object.values(r).some(Boolean)}function jd(e,t,r){let o=e.drafts?.find((u)=>u.id===r)??e.drafts?.[0],s=o&&(t?.drafts?.find((u)=>u.id===o.id)??o.preview),n=o?s?.scenarios?.find((u)=>u.id===e.id)??s:t?.previews?.find((u)=>u.id===e.id)??e.build,a=n?.state==="error"?"error":n?.state==="checking"||n?.live?"checking":n?.building||["queued","building"].includes(n?.state)?"building":n?.current?"ready":n?.stale?"stale":"unreported",i={error:Zi(n),checking:"Preview compiled; checking changes",building:"Preview build in progress",ready:"Preview build complete",stale:"Previous preview; current source not built",unreported:"Preview not built"};return{state:a,label:`${o?"Draft · ":""}${i[a]}${o&&a==="ready"?" · unaccepted":""}`}}var le,cv,wr,VS,lu,uv,iu,lv,Fd,Ud,du={},mu=[],vx=/^m(i|n|o|s|text|space)$/,Vd=Array.isArray,dv=mu.slice,go=Object.assign;function pu(e){e&&e.parentNode&&e.remove()}function cu(e,t,r,o,s){var n={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s||++cv,__i:-1,__u:0};return!s&&le.vnode&&le.vnode(n),n}function Qt(e){return e.children}function uu(e,t){this.props=e,this.context=t,this.__g=0}function zr(e,t){if(t==null)return e.__?zr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])&&r.__e)return r.__e;return typeof e.type!="function"||e.props.__P?null:zr(e)}function mv(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),mv(e)}function BS(e){(8&e.__g||!(e.__g|=8)||!wr.push(e)||lu++)&&VS==le.debounceRendering||((VS=le.debounceRendering)||queueMicrotask)(bx)}function bx(){var e,t,r,o,s,n,a,i,u;try{for(t=1;wr.length;)wr.length>t&&wr.sort(uv),e=wr.shift(),t=wr.length,8&e.__g&&(o=void 0,s=void 0,n=(s=(r=e).__v).__e,a=[],i=[],(u=r.__P)&&((o=go({constructor:void 0},s)).__v=s.__v+1,le.vnode&&le.vnode(o),Bd(u,o,s,r.__n,u.namespaceURI,32&s.__u?[n]:null,a,n||zr(s),32&s.__u,i),o.__v=s.__v,o.__.__k[o.__i]=o,_v(a,o,i),s.__=s.__e=null,o.__e!=n&&mv(o)))}finally{wr.length=lu=0}}function pv(e,t,r,o,s,n,a,i,u,l,d){var f,h,g,b,_,w,I=o.__k||mu,A=t.length;for(u=yx(r,t,I,u,A),f=0;f<A;f++)(g=r.__k[f])!=null&&(h=~g.__i&&I[g.__i]||du,g.__i=f,w=Bd(e,g,h,s,n,a,i,u,l,d),b=g.__e,(h.ref!=g.ref||8&h.__u)&&(h.ref&&Jd(h.ref,null,g,h),g.ref&&d.push(g.ref,g.__c||b,g)),_=_||b,4&g.__u?(u=hv(g,u,e,!h.__v),h.__e&&(h.__e=null)):typeof g.type=="function"&&w!==void 0?u=w:b&&(u=b.nextSibling),g.__u&=-7);return r.__e=_,u}function yx(e,t,r,o,s){var n,a,i,u,l,d,f,h,g,b,_=r.length,w=_,I=0,A=!1,z=e.__k=Array(s);for(n=0;n<s;n++)(a=t[n])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a!="object"||a.constructor==String?a=z[n]=cu(null,a):Vd(a)?a=z[n]=cu(Qt,{children:a}):a.constructor===void 0&&a.__b?a=z[n]=cu(a.type,a.props,a.key,a.ref,a.__v):z[n]=a,u=n+I,a.__=e,a.__b=e.__b+1,i=null,~(l=a.__i=wx(a,r,u,w))&&(w--,(i=r[l])&&(i.__u|=2)),i&&i.__v?(a.__u|=2,l==u-1?I--:l==u+1?I++:l!=u&&(l>u?I--:I++,A=!0)):(~l||(s>_?I--:s<_&&I++),typeof a.type!="function"&&(a.__u|=4))):z[n]=null;if(A){for(d=[],f=[],n=0;n<s;n++)if((a=z[n])&&2&a.__u){for(h=0,g=d.length;h<g;)d[b=h+g>>1]<a.__i?h=b+1:g=b;d[h]=a.__i,f[n]=h+1}for(I=d.length;n--;)f[n]&&(f[n]==I?I--:z[n].__u|=4)}if(w)for(n=0;n<_;n++)!(i=r[n])||2&i.__u||(i.__e==o&&(o=zr(i)),Wd(i,i));return o}function hv(e,t,r,o){var s,n,a;if(typeof e.type=="function"){if(e.props.__P)return t;if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&(s[n].__=e,t=hv(s[n],t,r,!1));return t}for(t&&!t.parentNode&&(t=zr(e))&&!t.parentNode&&(t=null),a=t;a&&a.nodeType==8;)a=a.nextSibling;for(e.__e!=a&&(!o&&r.moveBefore&&e.__e.parentNode?r.moveBefore(e.__e,t):r.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function wx(e,t,r,o){var s,n,a,{key:i,type:u}=e,l=t[r],d=l&&!(2&l.__u);if(l===null&&i==null||d&&i==l.key&&u==l.type)return r;if(o>(d?1:0)){for(s=r-1,n=r+1;s>=0||n<t.length;)if((l=t[a=s>=0?s--:n++])&&!(2&l.__u)&&i==l.key&&u==l.type)return a}return-1}function JS(e,t,r){r==null&&(r=""),t[0]=="-"?e.setProperty(t,r):e[t]=r}function au(e,t,r,o,s){var n,a;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||JS(e.style,t,"");if(r)for(t in r)o&&r[t]==o[t]||JS(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=r,r&&o||(a=Ud[t]||(Ud[t]=zx(t)),(e.__a||(e.__a={}))[t]=Fd,n=t!=(t=t.replace(lv,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),r?e.addEventListener(t,a,n):e.removeEventListener(t,a,n));else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(i){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function zx(e){return function(t){if(this.__e){var r=this.__e[e];if(t[iu]==null)t[iu]=Fd++;else if(t[iu]<this.__a[e])return;return r(le.event?le.event(t):t)}}}function Bd(e,t,r,o,s,n,a,i,u,l){var d,f,h,g,b,_,w,I,A,z,q,x,R,Z,ee,X,ne,xe,te,ae,re=t.type;if(t.constructor!==void 0)return null;if(128&r.__u&&(u=32&r.__u,d=r.__c.__z)){if(t.__u|=u,f=n=[],d.nodeType==8)for(h=1,g=d.nextSibling;g;g=g.nextSibling){if(g.nodeType==8){if(g.data.startsWith("$s"))h++;else if(g.data.startsWith("/$s")&&!--h)break}n.push(g)}else n.push(d);i=n[0]}(d=le.__b)&&d(t);e:if(typeof re=="function"){b=a.length;try{if(z=t.props,q=(d=re.prototype)&&d.render,x=(d=re.contextType)&&o[d.__c],R=d?x?x.props.value:d.__:o,r.__c?2&(_=t.__c=r.__c).__g&&(_.__g|=1):(q?t.__c=_=new re(z,R):(t.__c=_=new uu(z,R),_.constructor=re,_.render=xx),x&&x.sub(_),_.state||(_.state={}),_.__n=o,_.__g|=8,_.__h=[],_.__k=[]),q&&(_.__s||(_.__s=_.state),re.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=go({},_.__s)),go(_.__s,re.getDerivedStateFromProps(z,_.__s)))),w=_.props,I=_.state,_.__v=t,r.__c){if(q&&!re.getDerivedStateFromProps&&z!==w&&_.componentWillReceiveProps&&_.componentWillReceiveProps(z,R),t.__v==r.__v&&!(8&_.__g)||!(4&_.__g)&&_.shouldComponentUpdate&&_.shouldComponentUpdate(z,_.__s,R)===!1){t.__v!=r.__v&&(_.props=z,_.state=_.__s,_.__g&=-9),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(de){de&&(de.__=t)}),mu.push.apply(_.__h,_.__k),_.__k=[],_.__h.length&&a.push(_),i=zr(r);break e}_.componentWillUpdate&&_.componentWillUpdate(z,_.__s,R),q&&_.componentDidUpdate&&_.__h.push(function(){_.componentDidUpdate(w,I,A)})}else q&&!re.getDerivedStateFromProps&&_.componentWillMount&&_.componentWillMount(),q&&_.componentDidMount&&_.__h.push(_.componentDidMount);if(_.context=R,_.props=z,_.__P=e,_.__g&=-5,Z=le.__r,ee=0,q)_.state=_.__s,_.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),mu.push.apply(_.__h,_.__k),_.__k=[];else do _.__g&=-9,Z&&Z(t),d=_.render(_.props,_.state,_.context),_.state=_.__s;while(8&_.__g&&++ee<25);_.state=_.__s,_.getChildContext&&(o=go({},o,_.getChildContext())),q&&r.__c&&_.getSnapshotBeforeUpdate&&(A=_.getSnapshotBeforeUpdate(w,I)),X=d&&d.type===Qt&&d.key==null?d.props.children:d,z.__P&&(d=i,s=(e=z.__P).namespaceURI,u=n=null,r.props&&r.props.__P!=e&&(r.__k.some(function(de){de&&Wd(de,de)}),r.__k=null),i=r.__k?zr(r,0):null),i=pv(e,Vd(X)?X:[X],t,r,o,s,n,a,i,u,l),z.__P&&(t.__e=null,i=d),t.__u&=-161,128&r.__u&&(_.__z=null),f&&f.some(pu),_.__h.length&&a.push(_),1&_.__g&&(_.__g&=-4)}catch(de){if(a.length=b,t.__v=null,u||n)if(de.then){if(ne=0,t.__u|=u?160:128,n){for(~(te=n.indexOf(i||void 0))||(te=n.length);(ae=n[te-1])&&ae.nodeType==8;)te--;for(;te<n.length;te++)if(ae=n[te]){if(n[te]=null,ae.nodeType==8){if(ae.data.startsWith("$s"))ne++||(xe=ae);else if(ne&&ae.data.startsWith("/$s")&&!--ne){i=ae;break}}else if(!ne)break}}if(!xe){for(;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;xe=i}t.__c.__z||(t.__c.__z=xe),t.__e=i}else n&&n.some(pu);else t.__e=r.__e;t.__k||(t.__k=r.__k||[]),de.then||fv(t),le.__e(de,t,r)}}else i=t.__e=Rx(r.__e,t,r,o,s,n,a,u,l,e);return(d=le.diffed)&&d(t),128&t.__u?void 0:i}function fv(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(fv))}function _v(e,t,r){for(var o=0;o<r.length;)Jd(r[o++],r[o++],r[o++]);le.__c&&le.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(n){n.call(s)})}catch(n){le.__e(n,s.__v)}})}function Rx(e,t,r,o,s,n,a,i,u,l){var d,f,h,g,b,_,w,I,A,z=r.props||du,{props:q,type:x}=t;if(x=="svg"?s="http://www.w3.org/2000/svg":x=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n){for(d=0;d<n.length;d++)if((b=n[d])&&(x?b.localName==x:b.nodeType==3)){e=b,n[d]=null;break}}if(!e){if(I=l.ownerDocument||document,!x)return I.createTextNode(q);e=I.createElementNS(s,x,q.is&&q),i&&(le.__m&&le.__m(t,n),i=!1),n=null}if(x){if(l=x=="template"?e.content:e,n=x=="textarea"&&q.defaultValue!=null?null:n&&dv.call(l.childNodes),!i&&n)for(z={},d=0;d<e.attributes.length;d++)z[(b=e.attributes[d]).name]=b.value;for(d in z)b=z[d],d=="dangerouslySetInnerHTML"?h=b:d=="children"||(d in q)||d=="value"&&("defaultValue"in q)||d=="checked"&&("defaultChecked"in q)||au(e,d,null,b,s);for(d in A=1&r.__u,q)b=q[d],d=="children"?g=b:d=="dangerouslySetInnerHTML"?f=b:d=="value"?_=b:d=="checked"?w=b:i&&typeof b!="function"||!(z[d]!==b||A&&b!=null)||au(e,d,b,z[d],s);f?(i||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[]):(h&&(e.textContent=""),(x=="foreignObject"||s=="http://www.w3.org/1998/Math/MathML"&&vx.test(x))&&(s="http://www.w3.org/1999/xhtml"),pv(l,Vd(g)?g:[g],t,r,o,s,n,a,n?n[0]:r.__k&&zr(r,0),i,u),n&&n.some(pu)),i&&x!="textarea"||(d="value",x=="progress"&&_==null?e.removeAttribute(d):_==null||_===e[d]&&(x!="progress"||_)||au(e,d,_,z[d],s),d="checked",w!=null&&w!=e[d]&&au(e,d,w,z[d],s))}else z===q||i&&e.data==q||(e.data=q);return e}function Jd(e,t,r,o){try{typeof e=="function"?t?t.__x=e(t)||1:o&&(o=o.__c||o.__e)&&(t=o.__x)&&(o.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(s){le.__e(s,r)}}function Wd(e,t,r){var o,s;if(le.unmount&&le.unmount(e),!(o=e.ref)||o.current&&o.current!=e.__e||Jd(o,null,t,e),o=e.__c){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){le.__e(n,t)}o.__P=o.__n=null}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&Wd(o[s],t,typeof e.type!="function"||r&&!e.props.__P);(o=e.__e)&&(r||pu(o),o.__e&&(o.__e=null)),e.__e=e.__c=e.__=null}function xx(e,t,r){return this.constructor(e,r)}function So(e,t){var r,o,s,n;le.__&&le.__(e,t),t.nodeType==9&&(t=t.documentElement),o=(r=e&&32&e.__u)?null:t.__k,t.__k=cu(Qt,{children:[e]}),s=[],n=[],Bd(t,t.__k,o||du,du,t.namespaceURI,o?null:t.firstChild?dv.call(t.childNodes):null,s,o?o.__e:t.firstChild,r,n),_v(s,t.__k,n),t.__k.props.children=null}le={__e:function(e,t,r,o){for(var s,n,a;t=t.__;)if((s=t.__c)&&!(1&s.__g)){s.__g|=4;try{if((n=s.constructor)&&n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),a=8&s.__g),s.componentDidCatch&&(s.componentDidCatch(e,o||{}),a=8&s.__g),a)return void(s.__g|=2)}catch(i){e=i,a=0}}throw lu=0,e}},cv=0,uu.prototype.setState=function(e,t){var r=this.__s;r&&r!=this.state||(r=this.__s=go({},this.state)),typeof e=="function"&&(e=e(go({},r),this.props)),e&&(go(r,e),this.__v&&(t&&this.__k.push(t),BS(this)))},uu.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),BS(this))},uu.prototype.render=Qt,wr=[],lu=0,uv=function(e,t){return e.__v.__b-t.__v.__b},iu=Symbol(),lv=/(PointerCapture)$|Capture$/i,Fd=0,Ud={};var kx=0;function S(e,t,r,o,s,n){t||(t={});var a,i,u=t;if("ref"in u&&typeof e!="function")for(i in u={},t)i=="ref"?a=t[i]:u[i]=t[i];var l={type:e,props:u,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--kx,__i:-1,__u:0};return le.vnode&&le.vnode(l),l}var Px=function(){let t=Array.prototype.slice.call(arguments).filter(Boolean),r={},o=[];t.forEach((n)=>{(n?n.split(" "):[]).forEach((i)=>{if(i.startsWith("atm_")){let[,u]=i.split("_");r[u]=i}else o.push(i)})});let s=[];for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n))s.push(r[n]);return s.push(...o),s.join(" ")},pe=Px,Tx="atm_adsuimk_stnw88 atm_adsuif3_idpfg4 atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Ex="atm_adsui9s_1ulexfb atm_adsuimj_glywfm atm_adsuiy1254f_icygq7 atm_adsui1s0cpq2_1y4oovw atm_adsui11bgp38_ltqb7t atm_adsuiylp9lw_1627y59 atm_adsuig6en28_1ohcsmr";function $x({box:e,preserveAspectRatio:t="xMidYMid meet",axes:r=!0,overlay:o=!1}){if(![e.x,e.y,e.width,e.height].every(Number.isFinite)||e.width<=0||e.height<=0)return null;let s=Math.max(1,Math.ceil(Math.max(e.width,e.height)/48)),n=(a)=>[...new Set([...Array.from({length:Math.floor(a/s)+1},(i,u)=>u*s),...r?[a/2]:[],a])].sort((i,u)=>i-u);return S("svg",{className:pe("ds-artwork-grid",Ex,o&&Tx),viewBox:`${e.x} ${e.y} ${e.width} ${e.height}`,"data-step":s,preserveAspectRatio:t,"aria-hidden":"true",focusable:"false",children:[n(e.width).map((a)=>S("line",{className:r&&a*2===e.width?"mid":void 0,x1:e.x+a,x2:e.x+a,y1:e.y,y2:e.y+e.height},`x${a}`)),n(e.height).map((a)=>S("line",{className:r&&a*2===e.height?"mid":void 0,x1:e.x,x2:e.x+e.width,y1:e.y+a,y2:e.y+a},`y${a}`))]})}var Cx="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%23b4b4b4'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23444444'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%23fafafa'/%3e%3c/svg%3e",Ix="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%20fill='%235c5c5c'%3e%3ctitle%3eADS%20—%20Eye%20in%20the%20grid,%20greyscale%20small%20size%3c/title%3e%3cpath%20d='M1%201h4v4H1zM6%201h4v4H6zM11%201h4v4H11zM1%206h4v4H1zM11%206h4v4H11zM1%2011h4v4H1zM6%2011h4v4H6zM11%2011h4v4H11z'/%3e%3cpath%20d='M6%206h4v4H6z'%20fill='%23dddddd'/%3e%3cpath%20d='M7%207h2v2H7z'%20fill='%231b1b1b'/%3e%3c/svg%3e",qx="atm_adsui9s_116y0ak atm_adsuibb_idpfg4 atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui1w_kb7nvz",WS="atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v",Ox="atm_adsui9s_o8hunj",Nx="atm_adsui9s_1a9ryah";function jx({label:e}){return S("span",{className:pe("ds-brand-mark",qx),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:[S("img",{className:pe(WS,Ox),loading:"eager",src:Cx,width:16,height:16,alt:""}),S("img",{className:pe(WS,Nx),loading:"eager",src:Ix,width:16,height:16,alt:""})]})}var Mx="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuilh_dcxj7s atm_adsuilb_tx1for atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuird_glywfm atm_adsui9j_tlke0l atm_adsuibb_idpfg4 atm_adsuiv6g6dd_pt45zb atm_adsuit4h5aw_1wskm3t atm_adsui15xrhy7_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj atm_adsui1tcisp7_glywfm",Ax="atm_adsui4b_1627y59 atm_adsui26_1u3842e atm_adsui7l_1r1dq30 atm_adsuics_1d1fc98 atm_adsuiv6g6dd_1wskm3t atm_adsui168r6ku_8o97w",Lx="atm_adsuivy_alpu0l atm_adsuie2_alpu0l atm_adsuij6_alpu0l atm_adsuilh_idpfg4 atm_adsuilb_idpfg4";function qe({id:e,label:t,iconOnly:r,children:o,disabled:s,hidden:n,pressed:a,current:i,expanded:u,controls:l,popoverTarget:d,section:f,phase:h,variant:g="quiet",onClick:b}){return S("button",{id:e,type:"button",className:pe("ds-toolbar-button",Mx,g==="outlined"&&Ax,r&&Lx),"aria-label":r?t:void 0,title:r?t:void 0,disabled:s,hidden:n,"aria-pressed":a,"aria-current":i?"page":void 0,"aria-expanded":u,"aria-controls":l,popovertarget:d,"data-section":f,"data-phase":h,onClick:b,children:[o,!r&&t]})}var Ux="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuicx_tx1for atm_adsuijb_idpfg4 atm_adsuil8_1lr73f0 atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1mqbmot atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_3szr2b atm_adsuir3_1h6ojuz atm_adsui9j_tlke0l atm_adsuiv6g6dd_pt45zb atm_adsui1qpv5ur_1r1dq30 atm_adsui1p5227w_pt45zb atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45 atm_adsui1jhk75u_1mfz0iu atm_adsui174zlj6_73adwj";function Dx({id:e,label:t,pressed:r=!1,disabled:o,children:s,onClick:n}){return S("button",{id:e,type:"button",className:pe("ds-toggle-tile",Ux),"aria-pressed":r,disabled:o,onClick:n,children:[s,S("span",{children:t})]})}var gv={brand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 1.5 9.9 5.6l4.4.5-3.3 3 .9 4.4L8 11.3l-3.9 2.2.9-4.4-3.3-3 4.4-.5L8 1.5Z"/></svg>',"chevron-left":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4l-4 4 4 4"/></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 4 4 4-4 4"/></svg>',"chevron-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 10 4-4 4 4"/></svg>',close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m4 4 8 8M12 4l-8 8"/></svg>',components:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>',composition:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>',drafts:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 1h7l3 3v11H3zM10 1v4h3M5 8h6M5 11h4"/></svg>',"guide-bounds":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3.5" width="12" height="9"/></svg>',"guide-gaps":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="3" width="3.5" height="10"/><rect x="6.25" y="3" width="3.5" height="10"/><rect x="11" y="3" width="3.5" height="10"/></svg>',"guide-margins":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11" stroke-dasharray="1.5 1.5"/><rect x="4.5" y="5.5" width="7" height="5"/></svg>',"guide-mini":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2 2v12M6 2v12M10 2v12M14 2v12M2 2h12M2 6h12M2 10h12M2 14h12" stroke-width="1"/></svg>',"guide-padding":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1.5" y="2.5" width="13" height="11"/><rect x="4.5" y="5.5" width="7" height="5" stroke-dasharray="1.5 1.5"/></svg>',"guide-tracks":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 2v12M6 2v12M10 2v12M13.5 2v12"/></svg>',icons:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="5" r="2.5"/><rect x="9.5" y="2.5" width="4" height="5" rx="1"/><path d="m2.5 13.5 2.5-4 2.5 4ZM9.5 11.5h4M11.5 9.5v4"/></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 2v12M6.5 2v12M9.5 2v12M13 2v12"/></svg>',moon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg>',patterns:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg>',source:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m5 4-4 4 4 4m6-8 4 4-4 4M9 2 7 14"/></svg>',split:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="2" width="14" height="12" rx="1"/><path d="M8 2v12"/></svg>',sun:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/></svg>',tokens:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 6 3-6 3-6-3 6-3Zm-6 6 6 3 6-3M2 11l6 3 6-3"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m8 2 7 12H1L8 2Z"/><path d="M8 6v3M8 11v.5"/></svg>'},KS={};Object.keys(gv).sort();var Zx="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivh_nkobfv atm_adsui7l_1kw7nm4 atm_adsuix4ub3y_1ulexfb atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v",Hx={sm:"atm_adsuivy_1aou828 atm_adsuie2_1aou828",md:"atm_adsuivy_fjcok3 atm_adsuie2_fjcok3",lg:"atm_adsuivy_14k5dlv atm_adsuie2_14k5dlv",xl:"atm_adsuivy_1j39cg3 atm_adsuie2_1j39cg3"};function Ae({name:e,size:t="sm",label:r}){let o=e in KS?KS[e]:e;return S("span",{className:pe("ds-icon",Zx,Hx[t]),...r?{role:"img","aria-label":r}:{"aria-hidden":!0},dangerouslySetInnerHTML:{__html:gv[o]}})}var Fx="atm_adsui9s_1txwivl atm_adsuih_1h6ojuz atm_adsuicx_tx1for atm_adsuij6_1wdkmbo atm_adsuil8_kr1xch atm_adsui3f_e8f45q atm_adsui5j_idpfg4 atm_adsui26_1j28jx2 atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuics_el7ql6 atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuird_glywfm atm_adsuikz_fg65tv atm_adsui1e7xapd_1wugsn5 atm_adsui1cc01an_1m800s6 atm_adsuiz89mj4_el7ql6 atm_adsui19izows_1mqbmot atm_adsui1a1iq7z_1q9ccgz atm_adsui18vqbco_pt45zb atm_adsuisrk7fl_pt45zb atm_adsui1dpiaj6_1wskm3t atm_adsuizrwyxp_1d1fc98 atm_adsui17yrrpa_16x0t2t atm_adsui6zeuib_15wi45";function Vx({label:e,href:t,current:r,previewState:o,previewLabel:s,draftLabel:n,draftDescription:a,onClick:i}){return S("a",{className:pe("ds-navigation-item",Fx),href:t,"aria-current":r?"page":void 0,"aria-description":s,onClick:i,children:[e,n&&S("span",{className:"draft-badge",title:a,children:[" ",n]}),o&&S(vv,{state:o})]})}var Bx="atm_adsuimk_1n9t6rb atm_adsuif3_aqos4q atm_adsui73_usvi9m atm_adsuigi_idpfg4 atm_adsuiiy_102o88r atm_adsuiks_1wugsn5 atm_adsuil8_1aqtv8w atm_adsui3f_m9afv7 atm_adsui5j_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsui70_1fjsgd1 atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsuiarf92d_1txwivl atm_adsui1qpaa0x_1bp4okc",Jx="atm_adsuil8_idpfg4",Wx={narrow:"atm_adsuivy_hvzi4f",wide:"atm_adsuivy_1risgsc atm_adsuij3_1y8qh3w"},Kx="atm_adsuimk_pfqszd atm_adsuiiy_glywfm atm_adsuij3_1osqo2v";function Sv({id:e,label:t,role:r,width:o="narrow",inline:s=!1,flush:n=!1,children:a}){return S("div",{id:e,className:pe("ds-popover",Bx,Wx[o],n&&Jx,s&&Kx),popover:s?void 0:"auto",role:r,"aria-label":t,children:a})}var Gx="atm_adsui9s_116y0ak atm_adsuiam_glywfm atm_adsuih_1h6ojuz atm_adsuifc_1h6ojuz atm_adsuivy_1aou828 atm_adsuie2_1aou828 atm_adsui7l_1mqbmot atm_adsuivskwj7_1osqo2v atm_adsui158k9f9_1osqo2v atm_adsuio2zchm_glywfm atm_adsuibupyu4_1r31cwp atm_adsui91z0ma_c484nn atm_adsuieyuh4p_glywfm atm_adsuis7vg1k_1ulexfb atm_adsui1a7gqnz_glywfm atm_adsui1ypv4g8_glywfm atm_adsuisc4h6w_116y0ak";function vv({state:e="unreported",variant:t="navigation",label:r}){return S("span",{className:pe("ds-preview-indicator",t==="navigation"&&"entry-preview",Gx),"data-state":e,"data-variant":t,role:r?"img":void 0,"aria-label":r,"aria-hidden":r?void 0:!0,title:r,children:[S("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[S("circle",{"data-mark":"unreported",cx:"8",cy:"8",r:"3"}),S("circle",{"data-mark":"building",cx:"8",cy:"8",r:"5","stroke-dasharray":"22 10"}),S("circle",{"data-mark":"checking",cx:"8",cy:"8",r:"5","stroke-dasharray":"3 3"}),S("circle",{"data-mark":"ready",cx:"8",cy:"8",r:"5"}),S("circle",{"data-mark":"stale",cx:"8",cy:"8",r:"5","stroke-dasharray":"2 3"}),S("circle",{"data-mark":"error",cx:"8",cy:"8",r:"5",fill:"currentColor",stroke:"none"})]}),t==="toolbar"&&S("span",{className:"preview-warning",children:S(Ae,{name:"warning"})})]})}var Yx="atm_adsuig1e7fr_1hh10yn atm_adsuina064p_1c8rstr atm_adsuibyi8sh_1d1fc98 atm_adsuit8tn60_1r1dq30 atm_adsui18xy9f7_1txwivl atm_adsui1kvotse_1xi6ry0 atm_adsui13bcc9y_q4j4l1 atm_adsui9ht5kt_1iwn3l9 atm_adsuiw49f19_1m800s6 atm_adsui1mb7f0m_1mqbmot atm_adsui1o7g9kp_sqnntc atm_adsuicsppdr_11p5wf0 atm_adsui156xhju_13mtsfm atm_adsui2uzat_iqvn5y atm_adsuizf04m1_1mfz0iu atm_adsuil2ckyf_1txwivl atm_adsuim3rxq9_1h6ojuz atm_adsuilfeyld_iqvn5y atm_adsuidl3q2m_ynj908 atm_adsui12er3fd_tx1for atm_adsui8e79fz_m9afv7 atm_adsui1qnfl3r_1m800s6 atm_adsui1sj4mjq_1mqbmot atm_adsui6ql2ro_iqvn5y",Md=[{name:"off",label:"Off",hint:"Guides are hidden. Your layer choice is kept."},{name:"hover",label:"Hover",hint:"Point at or focus an element to see the selected layers."},{name:"always",label:"Always",hint:"Every element shows the selected layers."}],bv=[{name:"bounds",label:"Bounds"},{name:"tracks",label:"Columns and rows"},{name:"gaps",label:"Gaps and gutters"},{name:"padding",label:"Padding"},{name:"margins",label:"Margins"},{name:"mini",label:"Mini-unit grid"}],yv=[{name:"spacing",label:"Spacing",layers:["padding","margins","gaps"]},{name:"grid",label:"Grid",layers:["tracks","mini"]},{name:"all",label:"All",layers:["bounds","tracks","gaps","padding","margins","mini"]}];function wv(e){var t;let r=((t=yv.find((o)=>o.name===e))==null?void 0:t.layers)??[];return Object.fromEntries(bv.map((o)=>[o.name,r.includes(o.name)]))}function Xx({id:e="grid-options",inline:t=!1,mode:r="off",layers:o={},onModeChange:s,onLayerChange:n,onPreset:a}){var i;let u=(i=Md.find((l)=>l.name===r))==null?void 0:i.hint;return S(Sv,{id:e,label:"Layout guides",role:"dialog",inline:t,children:S("div",{id:`${e}-content`,className:pe("ux-guide-options",Yx),"data-mode":r,children:[S("h2",{children:"Layout guides"}),S("div",{className:"ux-guide-modes",role:"group","aria-label":"Show guides",children:Md.map((l)=>S(qe,{id:`${e}-mode-${l.name}`,label:l.label,pressed:r===l.name,onClick:()=>s==null?void 0:s(l.name)},l.name))}),S("p",{id:`${e}-hint`,className:"ux-guide-hint","aria-live":"polite",...Object.fromEntries(Md.map((l)=>[`data-${l.name}`,l.hint])),children:u}),S("div",{className:"ux-guide-layers",role:"group","aria-label":"Layers",children:bv.map((l)=>S(Dx,{id:`${e}-layer-${l.name}`,label:l.label,pressed:o[l.name]===!0,onClick:()=>n==null?void 0:n(l.name,o[l.name]!==!0),children:S(Ae,{name:`guide-${l.name}`,size:"lg"})},l.name))}),S("div",{className:"ux-guide-presets",role:"group","aria-label":"Presets",children:[S("span",{children:"Presets"}),yv.map((l)=>S(qe,{id:`${e}-preset-${l.name}`,label:l.label,onClick:()=>a==null?void 0:a(l.name)},l.name))]})]})})}var _i,Pe,Ad,GS,Dd=Object.is,hu=0,zv=[],Zd=[],we=le,{__b:YS,__r:XS,diffed:QS,__c:ev,unmount:tv,__:rv}=we;function Kd(e,t){we.__h&&we.__h(Pe,e,hu||t),hu=0;var r=Pe.__H||(Pe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Qx(e){return hu=1,ek(xv,e)}function ek(e,t,r){var o=Kd(_i++,2);if(o.t=e,!o.__c&&(o.__=[xv(void 0,t),function(n){var a=o.__N?o.__N[0]:o.__[0],i=o.t(a,n);Dd(a,i)||(o.__N=[i,o.__[1]],o.__c.setState({}))}],o.__c=Pe,!Pe.__f)){Pe.__f=!0;var s=Pe.shouldComponentUpdate;Pe.shouldComponentUpdate=function(n,a,i){var u=this.__H;if(!u)return!0;var l=!1,d=this.props!=n;if(u.__.some(function(h){h.__N&&(l=!0,Dd(h.__[0],h.__N[0])||(d=!0))}),s){var f=s.call(this,n,a,i);return l?f||d:f}return!l||d}}return o.__}function tk(e,t){var r=Kd(_i++,4);!we.__s&&Rv(r.__H,t)&&(r.__P=!1,r.__=e,r.u=t,Pe.__h.push(r))}function rk(e){return hu=5,ok(function(){return{current:e}},[])}function ok(e,t){var r=Kd(_i++,7);return Rv(r.__H,t)&&(r.__=e(),r.__H=t),r.__}function sk(){var e;do{for(;e=Zd.shift();)try{fi(e)}catch(r){we.__e(r,{__:(e=e.__P)&&e.__v})}for(;e=zv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(fi),t.__h.some(Hd),t.__h=[]}catch(r){t.__h=[],we.__e(r,e.__v)}}}while(Zd.length)}we.__b=function(e){Pe=null,YS&&YS(e)},we.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),rv&&rv(e,t)},we.__r=function(e){XS&&XS(e),_i=0;var t=(Pe=e.__c).__H;t&&(Ad==Pe?Pe.__h=[]:(t.__h.some(fi),t.__h.some(Hd),_i=0),t.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})),Ad=Pe},we.diffed=function(e){QS&&QS(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&sv(zv.push(t)),t.__H.__.some(function(r){r.u&&(r.__H=r.u)})),Ad=Pe=null},we.__c=function(e,t){t.some(function(r){try{r.__h.some(fi),r.__h=r.__h.filter(function(o){return!o.__||Hd(o)})}catch(o){t.some(function(s){s.__h&&(s.__h=[])}),t=[],we.__e(o,r.__v)}}),ev&&ev(e,t)},we.unmount=function(e){tv&&tv(e);var t,r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{if(s.__P&&s.__c){if(r===void 0){for(r=e.__;r&&(!r.__c||!r.__c.__P);)r=r.__;r=r&&r.__c}s.__P=r,sv(Zd.push(s))}else fi(s)}catch(n){t=n}}),o.__H=void 0,t&&we.__e(t,o.__v))};var ov=typeof requestAnimationFrame=="function";function nk(e){var t,r=function(){clearTimeout(o),ov&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(r,35);ov&&(t=requestAnimationFrame(r))}function sv(e){e!=1&&GS==we.requestAnimationFrame||((GS=we.requestAnimationFrame)||nk)(sk)}function fi(e){var t=Pe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Pe=t}function Hd(e){var t=Pe;e.__c=e.__(),Pe=t}function Rv(e,t){return!e||e.length!=t.length||t.some(function(r,o){return!Dd(r,e[o])})}function xv(e,t){return typeof t=="function"?t(e):t}var nv="atm_adsuie2_1osqo2v atm_adsuiks_1wugsn5 atm_adsuil8_1ru0ig4 atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui7l_an4usv atm_adsui1s9zg6e_idpfg4 atm_adsui1y1itgh_1heflvk atm_adsui124toe7_1d1fc98 atm_adsui1ajpmqv_3szr2b atm_adsuig1e7fr_81zv9y atm_adsuina064p_1ye8rbs atm_adsuibyi8sh_1d1fc98 atm_adsui1t8i83k_1ulexfb atm_adsui1t4u5ad_iqvn5y atm_adsui1ucxlaq_1m800s6 atm_adsuicqysi0_el7ql6 atm_adsuiugp1nr_1mqbmot atm_adsuimzw80z_1txwivl atm_adsuims933x_v2br90 atm_adsuikqzblj_1yb4nlp atm_adsui157qtsd_1doep66 atm_adsuipps9nr_1g80g66 atm_adsui1696orj_6e9m65 atm_adsui1kwsnex_1mqbmot atm_adsui1749l82_1m800s6 atm_adsui1pm6vxp_fg65tv atm_adsui1985805_rhlbdi atm_adsuifgvpx0_1m800s6 atm_adsui1f7jbwv_1wdkmbo atm_adsui4v11ke_13r6pey atm_adsui1ph4l26_kr1xch atm_adsui1td1et_58tz3v atm_adsui16q9e9r_idpfg4 atm_adsui1e1cn77_1u3842e atm_adsui1ok557x_an4usv atm_adsui8oqreq_16x0t2t atm_adsuidogt2j_15wi45 atm_adsui1ha57is_1txwivl atm_adsui154gtli_1g80g66 atm_adsui1m0o9p4_1doep66 atm_adsuitul8sy_116y0ak atm_adsuid9rgyl_1h6ojuz atm_adsui1ew4plt_1h6ojuz atm_adsui44kz9m_tx1for atm_adsui1l2cw9c_116y0ak atm_adsui1p2daoe_glywfm atm_adsui1lrgcs0_1kw7nm4 atm_adsui21ajbm_1ulexfb atm_adsuiv4i7ad_glywfm atm_adsui18exmc6_11p5wf0 atm_adsuinrahr7_14kz4g7 atm_adsui1sapuqh_1ak2vn7 atm_adsuia9snxg_v2br90 atm_adsuic1efku_idpfg4 atm_adsui1s5glk1_1h6ojuz atm_adsui4zbjz7_1txwivl atm_adsui1nrl83w_1h6ojuz atm_adsuidcq6po_1h6ojuz atm_adsuiodevil_1g80g66 atm_adsui15luuzb_tx1for atm_adsuiy20kxr_idpfg4 atm_adsui1pfuy6w_l6f2xw atm_adsuifo0n28_1m800s6 atm_adsui1yka5lj_sqnntc atm_adsuiazx38y_19dj2kj atm_adsuildippw_fg65tv atm_adsui2kz6ah_177qeyn atm_adsui5go7c5_1m800s6 atm_adsui12ii74i_1q4684i atm_adsui1t756hg_1mqbmot atm_adsui1n1nucf_h2mmj6 atm_adsuis5orb_qpi3z3 atm_adsui1maakrc_qpi3z3 atm_adsui3jvufv_6g0xcp atm_adsui1a6bvuq_6lcubb atm_adsui7le0qg_stnw88 atm_adsuikc8k8m_idpfg4 atm_adsui10ojrnp_1le1gz4 atm_adsuimhax7p_moqrwa atm_adsui1eq72d_1txwivl atm_adsuitglio1_1g80g66 atm_adsui1uq2nym_1h6ojuz atm_adsui1g6vde0_esu3gu atm_adsui1lgf0nm_1aqtv8w atm_adsui1e184xh_1txwivl atm_adsuila89rv_1bp4okc atm_adsui3c75k5_1h6ojuz atm_adsuihmh6q_tx1for atm_adsui1gfpqoj_1m800s6 atm_adsui1lezx94_1mqbmot atm_adsui1fnmsk6_b6kj4x atm_adsuip4zrj7_1le1gz4 atm_adsui1lf327s_1m800s6 atm_adsui10hei5o_glywfm atm_adsui11ndfci_12j2sah atm_adsuiewnzgi_1r3tyjr atm_adsuincp59s_19dj2kj atm_adsui5aykc5_ynj908 atm_adsui1z5d1z_1vz6rot atm_adsui1w4ry55_mrub5a atm_adsuinfdfyh_fg65tv atm_adsui1d1ue3r_1mqbmot atm_adsui1m3cqh4_1txwivl atm_adsuijhqbse_1g80g66 atm_adsui1y90xlu_1doep66 atm_adsui1konks8_idpfg4 atm_adsuirgczd9_1txwivl atm_adsui1tv24b1_1h6ojuz atm_adsui1adwpcp_ynj908 atm_adsui61s2ls_1m800s6 atm_adsui7olkud_116y0ak atm_adsuiu2kdnu_tx1for atm_adsuiv7vy6e_qm87f6 atm_adsuin0y7c7_1ivmhas atm_adsui1mpi4sj_1ulexfb atm_adsuit6wwae_1f51e7f",av="http://www.w3.org/2000/svg";function Ld({item:e,size:t,label:r}){let o=rk(null);return tk(()=>{var s;let n=new DOMParser().parseFromString(e.svg,"image/svg+xml").documentElement;if(n.namespaceURI!==av||n.localName!=="svg")return;for(let i of n.querySelectorAll("*"))if(["script","foreignObject","iframe","image","a","animate","set","animateTransform","animateMotion"].includes(i.localName)||i.namespaceURI!==av)i.remove();for(let i of[n,...n.querySelectorAll("*")])for(let u of Array.from(i.attributes))if(/^on/i.test(u.name)||/href$/i.test(u.name)&&!u.value.trim().startsWith("#"))i.removeAttribute(u.name);let a=document.importNode(n,!0);return a.removeAttribute("class"),a.setAttribute("width",String(t)),a.setAttribute("height",String(t)),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),(s=o.current)==null||s.replaceChildren(a),()=>{var i;return(i=o.current)==null?void 0:i.replaceChildren()}},[e.svg,t]),S("span",{className:"icons-glyph",ref:o,role:r?"img":void 0,"aria-label":r,title:r,"aria-hidden":r?void 0:"true"})}function iv({finding:e}){return S("p",{className:"icons-finding",title:e.file,children:[S("strong",{children:e.rule})," ",e.message]})}function ak({data:e}){var t;let[r,o]=Qx("");if(!e.configured)return S("section",{className:pe("icons-view",nv),"aria-label":"Icons",children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:"The project configures no glyph set."})]});let s=e.glyphs.filter((n)=>[n.name,...n.aliases].some((a)=>a.toLowerCase().includes(r.trim().toLowerCase())));return S("section",{className:pe("icons-view",nv),"aria-label":"Icons",children:[S("div",{className:"icons-head",children:[S("div",{children:[S("h1",{children:"Icons"}),S("p",{className:"icons-summary",children:[e.source," · ",e.glyphs.length," glyphs",e.grid?` · ${e.grid.width} × ${e.grid.height} grid`:e.mixed?" · Mixed grids":""," · ",e.aliasCount," aliases"]})]}),S("input",{type:"search",value:r,onInput:(n)=>o(n.currentTarget.value),placeholder:"Search name or alias","aria-label":"Search glyphs by name or alias"})]}),e.findings.map((n,a)=>S(iv,{finding:n},a)),S("h2",{children:["The set",S("small",{children:["Every glyph at ",((t=e.textSize)==null?void 0:t.px)??16,"px, the size used beside text"]})]}),S("div",{className:"icons-set",role:"list","aria-label":"The set",children:s.map((n)=>{var a;return S("span",{className:"icons-set-item","data-glyph":n.name,role:"listitem",children:S(Ld,{item:n,size:((a=e.textSize)==null?void 0:a.px)??16,label:n.name})},n.name)})}),S("h2",{children:["Glyphs",S("small",{children:"Enlarged construction grid and actual icon sizes"})]}),!s.length&&S("p",{className:"icons-empty",children:e.glyphs.length?`No glyph matches “${r.trim()}”.`:"No glyphs in this set."}),S("div",{className:"icons-cards",children:s.map((n)=>S("article",{className:"icons-card","data-glyph":n.name,"data-findings":n.findings.length||void 0,"aria-label":n.name,children:[S("div",{className:"icons-card-head",children:[S("h3",{children:n.name}),n.findings.length>0&&S("span",{className:"icons-badge",children:[n.findings.length," ",n.findings.every((a)=>a.severity==="error")?"error":"issue",n.findings.length===1?"":"s"]})]}),S("p",{className:"icons-alias",children:n.aliases.length?`alias: ${n.aliases.join(", ")}`:""}),S("div",{className:"icons-mag",children:[n.grid&&S($x,{box:n.grid,overlay:!0}),S(Ld,{item:n,size:96})]}),S("div",{className:"icons-sizes",children:e.sizes.map((a)=>S("span",{className:"icons-size",children:[S(Ld,{item:n,size:a.px}),S("small",{title:a.token,children:a.px})]},a.token))}),n.findings.map((a,i)=>S(iv,{finding:a},i))]},n.name))}),e.logos&&S(Qt,{children:[S("h2",{children:["Other products’ logos",S("small",{children:e.logos.source})]}),S("div",{className:"icons-logos",children:e.logos.files.map((n)=>S("figure",{className:"icons-logo","data-logo":n.name,children:n.tooLarge?S("figcaption",{children:[n.name," (over 1 MB; not shown)"]}):S(Qt,{children:[S("span",{className:"icons-logo-tile",children:S("img",{src:n.src,alt:n.name,title:n.file,width:24,height:24,loading:"lazy",decoding:"async"})}),S("span",{className:"icons-logo-tile icons-logo-tile-black",children:S("img",{src:n.src,alt:"",width:24,height:24,loading:"lazy",decoding:"async"})}),S("figcaption",{children:n.name})]})},n.name))})]})]})}var ik="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuicx_idpfg4 atm_adsuijb_idpfg4",ck="atm_adsuijb_idpfg4 atm_adsui1pqo7b0_1txwivl atm_adsuiywbgd0_1h6ojuz atm_adsui1a6nw8z_tx1for atm_adsui1vu1bue_kr1xch atm_adsuiyzr3rh_1wdkmbo atm_adsuila54r4_glywfm atm_adsui10x1lus_tlke0l atm_adsui107eb71_1m800s6 atm_adsuir3v91m_1d1fc98 atm_adsui3vd9bk_1wskm3t atm_adsui1pvchle_glywfm atm_adsui93k5wf_1aou828 atm_adsui1jhtvjp_1aou828 atm_adsuixwcn1n_glywfm atm_adsuiaxt0xi_1r31cwp atm_adsuiu9ecgn_c484nn atm_adsui1rd1yp5_glywfm atm_adsuir4atoz_14w8a5s atm_adsuikwnb5l_16x0t2t atm_adsui1b3ry6x_xrd58z atm_adsui9abqyk_1txwivl atm_adsui152ylkv_1bp4okc atm_adsui4nxdgq_idpfg4 atm_adsui1jf9b6q_1aqtv8w";function uk({id:e,label:t,children:r}){return S("nav",{id:e,className:pe("ux-navigation-menu",ik),"aria-label":t,children:r})}function lk({label:e,open:t=!0,children:r}){return S("details",{className:pe("entry-group",ck),open:t,children:[S("summary",{children:[S(Ae,{name:"chevron-right"}),S("span",{children:e})]}),S("div",{role:"group","aria-label":e,"data-slot":"entries",children:r})]})}var dk="atm_adsui9s_116y0ak atm_adsuih_1h6ojuz",mk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1swzw65_glywfm atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsuilt2xkg_1txwivl atm_adsuicvgua_1bp4okc atm_adsuiibt2oz_idpfg4 atm_adsui13rscvo_kb7nvz atm_adsuifaj8v5_1txwivl atm_adsui1x9f3se_1h6ojuz atm_adsui7ff47s_1aqtv8w atm_adsui19ywhw4_5z7wz8 atm_adsuik8mrq7_m9afv7 atm_adsuitx6td0_glywfm atm_adsui24gkm1_kb7nvz atm_adsuibo9v2x_1mqbmot atm_adsuiof0hc7_1wugsn5",pk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuij6_idpfg4 atm_adsuiam_kb7nvz atm_adsui1n6gq6x_idpfg4 atm_adsui1ew16gs_fg65tv atm_adsui18hfcpa_5z7wz8 atm_adsui15kvw8j_1d1fc98 atm_adsuiput1jn_1r1dq30 atm_adsuiwst7e9_tx1for atm_adsuidds7x8_el7ql6 atm_adsuilhyqxr_1mqbmot atm_adsui10yw2xd_idpfg4 atm_adsui1womkjg_idpfg4 atm_adsui108aoln_glywfm atm_adsuirdnh25_1wugsn5 atm_adsuiiq3m8p_m9afv7 atm_adsui17tjeyp_5z7wz8 atm_adsui1s7p0pk_m9afv7 atm_adsuiq065rl_idpfg4 atm_adsui132u42p_1txwivl atm_adsuiy4slwo_1g80g66 atm_adsui41lbvx_1q9ycp6 atm_adsui1gu70gy_4baac9 atm_adsui3ffk06_iqvn5y atm_adsuiy5406h_l6f2xw atm_adsui1t4fsou_10of7rf atm_adsui1kdkncg_1mqbmot atm_adsuizdczfh_fg65tv atm_adsui1fkhvt8_1k2i9i8 atm_adsui1jjfms9_m9afv7 atm_adsuixcw6qj_l6f2xw atm_adsui1l7l6jv_10of7rf atm_adsui1n2a233_1wskm3t atm_adsui1gqwc3l_1r1dq30 atm_adsui1sox6pi_iqvn5y atm_adsuib4u3xt_1mqbmot atm_adsui14bm868_tlke0l atm_adsuiix7db5_1risgsc atm_adsui6nxdxv_16x0t2t atm_adsui1ouftwa_15wi45 atm_adsui1spa2l4_iqvn5y atm_adsui10ldf3v_ofj6oc atm_adsui167gjxu_1mqbmot";function hk(e){let[t="",...r]=e.split(`
|
|
120
|
+
`),o=/^(.+?\.)\s+(.+)$/.exec(t),s=o?o[1]:t,n=[],a=[];for(let i of[...o?[o[2]]:[],...r].map((u)=>u.trim()).filter(Boolean)){let u=/^(\S+?:\d+(?::\d+)?|[\w./-]+\.\w+):\s+(?:([a-z][a-z0-9-]*):\s+)?(.+)$/.exec(i);if(!u){a.push(i);continue}let l=u[3],d=/^(.+?[.!?])\s+(.+)$/.exec(l);n.push({location:u[1],rule:u[2],summary:d?d[1]:l,detail:d==null?void 0:d[2]})}return{title:s,problems:n,notes:a}}function kv({message:e}){let{title:t,problems:r,notes:o}=hk(e);return S("div",{className:pe("ux-status-content",pk),children:[S("p",{className:"ux-status-title",children:[t,r.length>1&&S("span",{className:"ux-status-count",children:[r.length," problems"]})]}),r.length>0&&S("ul",{className:"ux-status-problems",children:r.map((s,n)=>S("li",{className:"ux-status-problem",children:[S("div",{className:"ux-status-where",children:[s.location&&S("span",{className:"ux-status-file",children:s.location}),s.rule&&S("span",{className:"ux-status-rule",children:s.rule})]}),S("p",{className:"ux-status-summary",children:s.summary}),s.detail&&S("details",{children:[S("summary",{children:"Why and how to fix"}),S("p",{children:s.detail})]})]},n))}),o.map((s,n)=>S("p",{className:"ux-status-note",children:s},n))]})}function fk({idPrefix:e="",phase:t="ready",message:r="Preview is up to date.",warmup:o,onRetry:s}){let n=(a)=>e+a;return S("div",{className:pe("ux-preview-status",dk),children:[S(qe,{id:n("preview-status"),label:`Preview status: ${r.split(`
|
|
121
|
+
`)[0]}`,phase:t,iconOnly:!0,popoverTarget:n("status-details"),children:S(vv,{variant:"toolbar",state:t==="reloading"?"building":t})}),S(Sv,{id:n("status-details"),width:"wide",flush:!0,children:S("div",{className:pe("ux-status-details",mk),children:[S("div",{id:n("status"),className:"ux-status-message",role:t==="error"?"alert":"status",children:S(kv,{message:r})}),S("div",{className:"ux-status-footer",children:[S("p",{id:n("warmup-status"),className:"ux-status-warmup",hidden:!o,children:o}),S("div",{id:n("preview-error"),className:"preview-retry",hidden:t!=="error",children:S(qe,{id:n("retry-preview"),label:"Retry preview",variant:"outlined",onClick:s})})]})]})})]})}var _k="atm_adsuijb_idpfg4 atm_adsuij6_1osqo2v atm_adsuil8_1ru0ig4 atm_adsui7l_an4usv atm_adsuibx_rhlbdi atm_adsuic8_1c8rstr atm_adsuig3_sqnntc atm_adsui3z5xaq_d3l4uo atm_adsui1wgjgno_idpfg4 atm_adsuip5t3iw_glywfm atm_adsuixo4njo_uqc78k atm_adsui5o4a8h_rfutky atm_adsui1fodpaq_1g68hxi atm_adsuiw6dnwv_1j28jx2 atm_adsuigj0umz_1ru0ig4 atm_adsui12f0w6t_1txwivl atm_adsui1gdpbuc_1g80g66 atm_adsuiuqbam3_1h6ojuz atm_adsuio8ubsb_1aqtv8w atm_adsui5ug4ic_1wdkmbo atm_adsui1w6vi1x_13r6pey atm_adsuiz9prp4_kr1xch atm_adsuiwdfvbd_m9afv7 atm_adsui13fkfdg_idpfg4 atm_adsui1do7trk_1j28jx2 atm_adsui1rlis1a_an4usv atm_adsuizf9kzn_rhlbdi atm_adsuii5gv9h_1m800s6 atm_adsuindj6xq_16x0t2t atm_adsuitdd4i9_15wi45 atm_adsui11chkp6_irm9pb atm_adsui10tyobk_1heflvk atm_adsui1h392tq_3szr2b atm_adsuiatrpru_1d1fc98 atm_adsuiwv6oyq_1r1dq30 atm_adsui1wjk0g8_6e9m65 atm_adsui1bmpb92_cpeews atm_adsui1lgjzhx_1m800s6 atm_adsuijzdzyy_1mqbmot";function gk({title:e,description:t,onSearch:r,children:o}){return S("section",{className:pe("ux-specimen-page",_k),"aria-label":e,children:[S("header",{children:[S("div",{className:"ux-specimen-heading",children:[S("h1",{children:e}),r&&S("input",{type:"search","aria-label":"Find token",placeholder:"Find a token",onInput:(s)=>r(s.currentTarget.value)})]}),t&&S("p",{children:t})]}),S("div",{"data-slot":"content",children:o})]})}var Pv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_1210cad atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_107lskt atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_1ncjpb7",Tv="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_kyo2w3 atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsuimrwrxb_6s8zn8 atm_adsui165a258_idpfg4 atm_adsuindcbtc_idpfg4 atm_adsui1ywdvs7_idpfg4 atm_adsui7bg9zp_h3ouum atm_adsuiqjzyof_idpfg4 atm_adsui15n9hsn_idpfg4 atm_adsuigpq1w8_idpfg4 atm_adsui1ts7i44_kyo2w3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuilz7qdd_6s8zn8 atm_adsui134y5xe_h3ouum atm_adsui1nznzd5_kyo2w3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsui1iqqh5c_6s8zn8 atm_adsui1j124uw_h3ouum atm_adsui1qgxgro_kyo2w3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui8dg1eh_6s8zn8 atm_adsui1t5abo5_h3ouum atm_adsui1pcy8k9_kyo2w3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiv4wfzc_6s8zn8 atm_adsuiln2feu_h3ouum",Ev="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_1y3gjcq atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_1210cad atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_107lskt atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_1gr7bv3 atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_1ncjpb7 atm_adsui1nznzd5_1gr7bv3 atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_1ncjpb7 atm_adsui1qgxgro_1gr7bv3 atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_1ncjpb7 atm_adsui1pcy8k9_1gr7bv3 atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_1ncjpb7",$v="atm_adsuij7_idpfg4 atm_adsui9s_11p5wf0 atm_adsuin5_idpfg4 atm_adsui84_idpfg4 atm_adsuidz_dk28gj atm_adsuigw_1gem2g7 atm_adsuiiz_glywfm atm_adsui1xr9v27_6s8zn8 atm_adsuif3wayr_idpfg4 atm_adsuimgqw9w_idpfg4 atm_adsui8iopdn_idpfg4 atm_adsuix9z4xg_h3ouum atm_adsui1wohlm_idpfg4 atm_adsuiu9g1y7_idpfg4 atm_adsui1orm0qo_idpfg4 atm_adsuiskdtbx_15wbn57 atm_adsuip945hm_1pzsloo atm_adsui1ts7i44_dk28gj atm_adsui1xz6qul_1gem2g7 atm_adsui1pqqic1_glywfm atm_adsuizryume_6s8zn8 atm_adsui1ngmxnq_h3ouum atm_adsui1nznzd5_dk28gj atm_adsuiom2ku1_1gem2g7 atm_adsui9o08mg_glywfm atm_adsuin783i1_6s8zn8 atm_adsui1l75c4v_h3ouum atm_adsui1qgxgro_dk28gj atm_adsui1ol26gk_1gem2g7 atm_adsuifnju3y_glywfm atm_adsui1i44mqh_6s8zn8 atm_adsuivsouqh_h3ouum atm_adsui1pcy8k9_dk28gj atm_adsuiuzkx18_1gem2g7 atm_adsui1s22a1g_glywfm atm_adsuiehc6gd_6s8zn8 atm_adsuittpjm6_h3ouum",Sk="atm_adsui9s_116y0ak atm_adsuiar_vrvcex atm_adsuih_1h6ojuz atm_adsui1xk5jbi_1aou828 atm_adsui15ztyo3_1wugsn5 atm_adsuiya8ym_12336oc atm_adsuiou0xue_1h6ojuz atm_adsuip2cq0w_idpfg4 atm_adsui3y46a7_pfqszd atm_adsui1e8hxr8_1f51e7f atm_adsui1w4yjon_1wugsn5 atm_adsui1fm6vu0_1aou828 atm_adsuieb1l7_1wugsn5 atm_adsuiu4pov9_1f51e7f atm_adsuibd751w_1wugsn5 atm_adsuip12vv8_1aou828 atm_adsui119azkn_1wugsn5 atm_adsuidutd7r_1f51e7f atm_adsuivm5w66_1wugsn5 atm_adsui7msh7_116y0ak atm_adsuijq6hmp_1q9ycp6 atm_adsuiqu4bbn_1h6ojuz atm_adsui1450k7n_1ulexfb atm_adsui7bxzlg_h68d5v atm_adsuin2zkk7_24x154 atm_adsuicx_tx1for atm_adsuijb_idpfg4";function Cv(e=!1,t=!1){return{header:pe("ux-workspace-header",e?Tv:Pv),main:pe("ux-workspace-main",e||t?$v:Ev)}}var vk="atm_adsui9s_1txwivl atm_adsuiar_1bp4okc atm_adsuivy_1osqo2v atm_adsuie2_1osqo2v atm_adsuij6_idpfg4 atm_adsui26_1bplolx atm_adsui7l_1wskm3t atm_adsuibx_rhlbdi atm_adsuic8_1m800s6 atm_adsuig3_sqnntc atm_adsui1swzw65_glywfm atm_adsuitwidkn_1eorbtc atm_adsui9sygfm_idpfg4 atm_adsui12bw0u4_10rgqv3 atm_adsuilgsf2q_1bplolx atm_adsui1czrkxg_m9afv7 atm_adsui1xxn05p_1txwivl atm_adsuijvq3zr_tx1for atm_adsui192tkol_1h6ojuz atm_adsui1uphbw0_1aqtv8w atm_adsui18j3xf2_1txwivl atm_adsuiv4kl24_1fhbwtr atm_adsui7tg88j_116y0ak atm_adsui3hsxdi_116y0ak atm_adsuiw4isa_1q9ycp6 atm_adsui1e372br_tx1for atm_adsuiol208p_idpfg4 atm_adsui1hwqkvt_14k5dlv atm_adsui1brizz9_1d1fc98 atm_adsui1qytvf8_1r1dq30 atm_adsui1i52crn_idpfg4 atm_adsui1rva9te_15vqwwr atm_adsui1ux9w3e_1l2sidv atm_adsui16phkqt_1q9ccgz atm_adsui11e3yb3_1wugsn5 atm_adsui121hswv_1txwivl atm_adsuikokisn_iqvn5y atm_adsui1xmdvl_1h6ojuz atm_adsuidgi0se_idpfg4 atm_adsui1106ncu_1wugsn5 atm_adsuiu6bb7r_tx1for atm_adsui1nngew9_1txwivl atm_adsui1hijnjn_1h6ojuz atm_adsui14yqywo_idpfg4 atm_adsui1n3v6f3_1wugsn5 atm_adsuibmhjpv_tx1for atm_adsuitwhtux_idpfg4 atm_adsui1t7jlm4_kb7nvz atm_adsuigr19py_idpfg4 atm_adsui1r3dd4x_1txwivl atm_adsui1dr8vx7_1bp4okc atm_adsui12n32ac_idpfg4 atm_adsui15x0kgb_m9afv7 atm_adsuixqxvxy_15vqwwr atm_adsuivq6bgu_ynj908 atm_adsui1o135n7_1bplolx atm_adsui7r55s8_kb7nvz atm_adsuiwklih5_idpfg4 atm_adsuixjj1j1_1wugsn5 atm_adsuirae8ic_1txwivl atm_adsui16ywoy7_kb7nvz atm_adsui3zzzu1_1bp4okc atm_adsuioe3i46_idpfg4 atm_adsuigjcmck_h2mmj6 atm_adsui16iisfr_15vqwwr atm_adsui1jwmmnn_idpfg4 atm_adsuiobixd9_kb7nvz atm_adsui1bb1xke_idpfg4 atm_adsuivnahyn_idpfg4 atm_adsui1xr98ve_1bgihbq atm_adsui18tesp1_1ulexfb atm_adsui3im4ne_idpfg4 atm_adsui3aiucy_1osqo2v atm_adsui1rjdu20_1osqo2v atm_adsuitmy5t6_1txwivl atm_adsui1dgldxt_esu3gu atm_adsui1ggjjzu_iqvn5y atm_adsui138t24g_4baac9 atm_adsui1qnyawd_m9afv7 atm_adsui4v0vbm_1bplolx atm_adsui1jhz6h2_glywfm atm_adsui1chybqy_stnw88 atm_adsui1br56z7_idpfg4 atm_adsui888a6e_o2ms3 atm_adsui1xuvgmd_11p5wf0 atm_adsuirxsuh_1h6ojuz atm_adsui1mqap2g_1bplolx atm_adsui1xhqumc_14k5dlv atm_adsuirc18cp_14k5dlv atm_adsuirrx08l_moeofi atm_adsuiey7ewl_nqa18y atm_adsuigux95j_7uy8cq atm_adsui1fe4k5a_12j2sah atm_adsuig4uoah_1v7nmpu atm_adsui11rdqaw_1wdkmbo atm_adsui18vvlvy_19uah5m atm_adsui1cw8iwc_dcxj7s atm_adsui1x2b1m8_1kw7nm4 atm_adsuitbv4yw_1bplolx atm_adsuizgbt4v_1wskm3t atm_adsui17eejsz_m9afv7 atm_adsuid87q3_idpfg4 atm_adsuitcdkhm_glywfm atm_adsui1xeiopu_1h6ojuz atm_adsui1ggp9a3_idpfg4 atm_adsui1k34kje_glywfm atm_adsui1gdfntm_idpfg4 atm_adsuiz1ci95_1knmvda atm_adsuiiqm1lt_1wugsn5 atm_adsuiez3a21_15vqwwr atm_adsui8ru30r_glywfm atm_adsui1b3wxlc_1osqo2v atm_adsui129m0mj_11p5wf0 atm_adsui5w99fc_cmo227 atm_adsuirt32k7_idpfg4 atm_adsui1bb439o_1uq4mm2 atm_adsui1azndq0_1txwivl atm_adsui1ef74b0_1bp4okc atm_adsui1r8nml_idpfg4 atm_adsui1oioy44_idpfg4 atm_adsui4s98mp_m9afv7 atm_adsuipkg9do_1m800s6 atm_adsui805znv_19dj2kj atm_adsui1uyulxv_8p4f3e atm_adsuiwjjjyp_idpfg4 atm_adsuii2eazt_m9afv7 atm_adsui1gx3q7f_kb7nvz atm_adsui1adcp8o_idpfg4 atm_adsui3micw4_1txwivl atm_adsui1q69jt1_1h6ojuz atm_adsui12dg9uo_1osqo2v atm_adsuia71lpn_1knmvda atm_adsuim1gh36_glywfm atm_adsui10vojm5_glywfm";function bk({loading:e=!1,collapsed:t=!1,capture:r=!1,brand:o,sections:s,actions:n,navigation:a,overlays:i,previewOverlay:u,previewTools:l,children:d}){return S("div",{id:"workspace","data-loading":e,"data-collapsed":t,"data-capture":r,"aria-busy":e,className:pe("ux-workspace",vk),children:[S("header",{id:"header",className:pe("ux-workspace-header",t?Tv:Pv),children:[S("div",{id:"brand",className:"ux-workspace-brand",children:o}),S("div",{className:"ux-workspace-bar",children:[S("nav",{id:"sections",className:"ux-workspace-sections","aria-label":"Showcase sections",children:s}),S("div",{className:"ux-workspace-actions",children:n})]})]}),i,S("main",{className:pe("ux-workspace-main",t||r?$v:Ev),children:[S("aside",{id:"sidebar",className:"ux-workspace-sidebar",children:a}),S("section",{id:"preview-workspace",className:"ux-workspace-content","aria-label":"Preview workspace",children:S("section",{id:"preview",className:"ux-workspace-preview","aria-label":"Preview",children:[u,l&&S("div",{className:"ux-workspace-preview-tools",role:"toolbar","aria-label":"Preview tools",children:l}),S("div",{id:"frame-slot",className:"ux-workspace-slot",children:d})]})})]})]})}function yk({title:e="Design system",loading:t=!1,section:r="tokens",previewStatus:o,guidesAvailable:s=!1,guideOptions:n,navigation:a,children:i}){return S(bk,{loading:t,brand:S(Qt,{children:[S("span",{className:pe("ux-workspace-name",Sk),children:[S("span",{className:"ux-workspace-logo",children:S(jx,{})}),S("span",{className:"ux-workspace-name-text",children:[S("span",{className:"ux-workspace-mark",children:"ADS"}),S("span",{id:"title",className:"ux-workspace-title",children:e})]})]}),S(qe,{id:"pane-toggle",label:"Hide navigation pane",iconOnly:!0,expanded:!0,controls:"sidebar",children:S(Ae,{name:"chevron-left"})})]}),sections:S(Qt,{children:[S(qe,{label:"Brand",section:"brand",current:r==="brand",children:S(Ae,{name:"brand"})}),S(qe,{label:"Icons",section:"icons",current:r==="icons",children:S(Ae,{name:"icons"})}),S(qe,{label:"Tokens",section:"tokens",current:r==="tokens",children:S(Ae,{name:"tokens"})}),S(qe,{label:"Components",section:"components",current:r==="components",children:S(Ae,{name:"components"})}),S(qe,{label:"Patterns",section:"patterns",current:r==="patterns",children:S(Ae,{name:"patterns"})}),S(qe,{label:"Composition",section:"composition",current:r==="composition",children:S(Ae,{name:"composition"})}),S(qe,{label:"Drafts",section:"drafts",current:r==="drafts",children:S(Ae,{name:"drafts"})})]}),actions:S(Qt,{children:[S(fk,{...o}),S(qe,{id:"viewport",label:"Phone viewport",iconOnly:!0,pressed:!1,controls:"frame-slot",children:S(Ae,{name:"phone"})}),S(qe,{id:"grid-overlay",label:"Layout guides",iconOnly:!0,controls:"grid-options",popoverTarget:"grid-options",hidden:!s,children:S(Ae,{name:"layout"})}),S("select",{id:"brand-select",className:"ux-workspace-brand-select","aria-label":"Preview brand",hidden:!0}),S(qe,{id:"theme",label:"Use dark theme",iconOnly:!0,children:S(Ae,{name:"moon"})}),S(qe,{id:"minimize",label:"Minimize showcase menu",iconOnly:!0,children:S(Ae,{name:"chevron-up"})})]}),overlays:S(Xx,{...n}),navigation:S(uk,{id:"entries",label:"Entries",children:a}),previewTools:S(qe,{id:"split-view",label:"Split view",iconOnly:!0,pressed:!1,disabled:!0,hidden:!0,children:S(Ae,{name:"split"})}),previewOverlay:S("div",{id:"loader",className:"ux-workspace-loader",role:"status","aria-label":"Loading preview",hidden:!0,children:S("span",{className:"ux-workspace-spinner","aria-hidden":"true"})}),children:i})}function Gd(e,t){let r=document.createElement("div");return So(S(e,{...t}),r),r.firstElementChild}function Iv(e){return So(S(yk,{title:"",loading:!0}),e),()=>So(null,e)}var qv=(e)=>Gd(lk,e),Ov=(e)=>Gd(Vx,e),Nv=(e)=>Gd(gk,e);var gi=new WeakMap;function fu(e){let t=gi.get(e);return!!t&&t.parentNode===e&&!!t.firstElementChild}function Yd(e,t){let r=gi.get(e);if(!r||r.parentNode!==e){if(r)So(null,r);r=document.createElement("div"),r.className="ux-icons-mount",gi.set(e,r),e.replaceChildren(r)}return So(S(ak,{data:t}),r),r.firstElementChild}function Xd(e){let t=gi.get(e);if(!t)return;So(null,t),t.remove(),gi.delete(e)}function jv(e,t){So(S(kv,{message:t}),e)}var _u="ads://project/icons";Iv(document.getElementById("app"));var P=(e)=>document.getElementById(e),Ke=new URLSearchParams(location.search),Mv=Ke.get("scenario"),wk=["brand","icons","tokens","components","patterns","composition","drafts"],vu=!1,bo=[],ze,yo=Ke.get("draft"),nm=[],Uv=[],am=new Map,kr=Ke.get("split")==="1",tm,Pr=[],Mt=0,zu;async function Ri(){let e=Pr;Pr=[],await Promise.allSettled(e.map((t)=>t.close()))}var zs=P("split-view"),G="brand",$e={},Av=new Map,ys=!0,Ru=[],vi=[],xu=[],ct,Ts,Re,ve,ws,bi,xs,bu,Rs,ot=0,ks=Ke.get("capture")!=="1"&&Ke.get("viewport")==="phone",ut=[{name:"light",scheme:"light"},{name:"dark",scheme:"dark"}],Tr=Ke.get("capture")==="1"&&Ke.get("theme")||"light";if(Ke.get("capture")==="1")P("workspace").dataset.capture="true",rb();var rm=()=>ut.find((e)=>e.name===Tr)?.scheme??"light";function Dv(){document.documentElement.dataset.theme=rm();let e=ut[(ut.findIndex((r)=>r.name===Tr)+1)%ut.length],t=ut.length>1?`Use ${e.name} theme`:`Theme: ${Tr}`;P("theme").setAttribute("aria-label",t),P("theme").title=t,P("theme").disabled=ut.length<2,P("theme").querySelector("svg").innerHTML=rm()==="dark"?'<circle cx="8" cy="8" r="3"/><path d="M8 1v1M8 14v1M1 8h1M14 8h1M3 3l1 1M12 12l1 1M3 13l1-1M12 4l1-1"/>':'<path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/>'}document.documentElement.dataset.theme="light";var vo=[],tr=Ke.get("capture")==="1"&&Ke.get("brand")||null;function Zv(){let e=P("brand-select");if(e.hidden=!vo.length,e.options.length!==vo.length||vo.some((t,r)=>e.options[r].value!==t.name))e.replaceChildren(...vo.map((t)=>Object.assign(document.createElement("option"),{value:t.name,textContent:t.name})));if(tr)e.value=tr,e.title=`Brand: ${tr}`}var ku=jS(async(e)=>{if(e)await lm();await Ut(),await Tk()},{onError:lt}),om,Pu=!1,yi=!1,Rr,er,Qd=0,Si,wo=new AbortController;window.addEventListener("blur",()=>setTimeout(()=>{if(document.activeElement?.tagName==="IFRAME")for(let e of document.querySelectorAll(":popover-open"))e.hidePopover()},0));var At=new Cd({name:"ads-showcase",version:"1.0.0"},{versionNegotiation:{mode:"auto"},capabilities:{extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}}}),Hv=(e,t={},r={})=>At.callTool({name:e,arguments:t},{signal:wo.signal,...r}),yu=NS((e)=>At.readResource(e,{signal:wo.signal}),{signal:wo.signal,onDiagnostic:(e)=>{if(e.state==="retry")document.documentElement.dataset.adsResourceRetries=String(Number(document.documentElement.dataset.adsResourceRetries??0)+1);console.warn("ADS resource transport",e)}}),im=async(e)=>JSON.parse((await yu({uri:e})).contents.find((t)=>typeof t.text==="string").text);function Fv(e){let t=xu.find((r)=>r.name===e.name);if(!t||!(t._meta?.ui?.visibility??["model","app"]).includes("app"))throw Error("This tool is not callable from an App.");return At.callTool(e)}var Vv="";function be(e,t=!1,r=t?"error":e?"checking":"ready"){let o=e||"Preview is up to date.";if(P("preview-error").hidden=!t,jv(P("status"),o),Vv=o,P("status").dataset.error=String(t),!t)for(let s of["errorCategory","errorCode","resourceUri"])delete P("status").dataset[s];P("status").setAttribute("role",t?"alert":"status"),P("preview-status").dataset.phase=r,P("preview-status").querySelector(".ds-preview-indicator").dataset.state=["reloading","compiling","reverting"].includes(r)?"building":r,P("preview-status").title=o,P("preview-status").setAttribute("aria-label",`Preview status: ${o.split(`
|
|
122
|
+
`)[0]}`),Bv()}function Bv(){let e=Ts?.warmup,t=e?`Background views: ${e.completed}/${e.total} compiled${e.failed?`; ${e.failed} failed`:""}.`:"";P("warmup-status").hidden=!e,P("warmup-status").textContent=t,P("preview-status").dataset.warmup=e?.state??"disabled",P("preview-status").title=[Vv,t].filter(Boolean).join(`
|
|
123
|
+
`)}function Jv(){be(Re?"Updating preview…":"Opening preview…",!1,"reloading")}function Er(){return $r().find((e)=>e.id===$e[G])}function Es(e=Er()){let t=bo.find((r)=>r.id===yo&&am.get(r.id)?.scenario===e?.id);return e?.drafts?.find((r)=>r.id===yo)??t??e?.drafts?.[0]}function cm(){return Boolean(Es()&&(G==="drafts"||Er()?.draftOnly||kr))}function wi(){return G==="drafts"?Er()?.previewId:$e[G]}function zi(){return`${G}:${$e[G]}${cm()?`:draft:${Es().id}:split:${kr}`:""}`}function gu(e=Re){return e?.key===zi()}function Wv(e=Ts){if(cm()){let t=e?.drafts?.find((r)=>r.id===Es()?.id);return t?.scenarios?.find((r)=>r.id===wi())??t}return e?.previews?.find((t)=>t.id===wi())}var Kv=(e)=>JSON.stringify(e&&[e.session,e.revision,e.current,e.live]);function Gv(){({scenarios:vi,categories:Ru}=US(nm,Uv,bo,am))}function zk(e){am.set(e.structuredContent.id,e.structuredContent),Gv()}async function sm(e,t,r=wo.signal){let o=(ct?.compiler?.buildTimeoutMs??30000)+15000;try{return await Hv(e,t,{signal:AbortSignal.any([wo.signal,r]),timeout:o})}catch(s){if(s.code!=="REQUEST_TIMEOUT")throw s;throw Object.assign(Error(`The preview request timed out after ${Math.ceil(o/1000)} seconds. No preview result was received. Retry the preview.`,{cause:s}),{code:"ADS_PREVIEW_REQUEST_TIMEOUT",category:"transport"})}}async function um(e,t,r){let o=(Er()?.id===t||G==="drafts")&&Er()?.pendingDraftScenario||e.units?.includes(t)&&!nm.some((n)=>n.id===t),s=await sm("ads_show_draft",{id:e.id,...!o&&t?{scenario:t}:{}},r);if(s.isError)throw Error(s.content?.find((n)=>n.type==="text")?.text??"Draft preview failed.");if(o){let n=s.structuredContent.scenarios.find((a)=>t==="tokens"?a.kind==="tokens":a.unit?a.unit===t:nu(t,a.id));if(!n)throw Error("Draft owner has no scenario yet. Add an independently mountable scenario before previewing it.");if(n.id!==s.structuredContent.scenario)s=await sm("ads_show_draft",{id:e.id,scenario:n.id},r);if(s.isError)throw Error(s.content?.find((a)=>a.type==="text")?.text??"Draft preview failed.")}return zk(s),s}function rr(e=!1){if(e)Rs=Re?.key;xs=void 0,P("loader").hidden=!0,P("preview").setAttribute("aria-busy","false")}function em(e){let t=new URL(location.href);for(let s of["scenario","draft","split","section"])t.searchParams.delete(s);if(G==="icons")return t.searchParams.set("section","icons"),t.pathname+t.search+t.hash;if(G==="drafts"){t.searchParams.set("section","drafts");let s=$r().find((n)=>n.id===e);if(s?.drafts?.[0])t.searchParams.set("draft",s.drafts[0].id);if(s?.previewId)t.searchParams.set("scenario",s.previewId);if(kr)t.searchParams.set("split","1");return t.pathname+t.search+t.hash}if(e)t.searchParams.set("scenario",e);let r=$r().find((s)=>s.id===e),o=Es(r);if(o&&(r.draftOnly||kr)){if(t.searchParams.set("draft",o.id),!r.draftOnly)t.searchParams.set("split","1")}return t.pathname+t.search+t.hash}function $r(){return G==="drafts"?DS(vi,bo):G==="tokens"?Ru:G==="icons"?[{id:"icons",kind:"icons",title:"All icons"}]:vi.filter((e)=>e.kind===G)}function Yv(e,t){if(t.kind==="icons"&&G==="icons")return;let{state:r,label:o}=jd(t.previewId?{...t,id:t.previewId}:t,Ts,yo),s=e.querySelector(".entry-preview");if(!s)return;s.dataset.state=r,s.title=o,e.dataset.buildState=r,e.setAttribute("aria-description",o)}var Ps={...ZS},Lv=()=>G==="drafts"?Er()?.kind:G,Xv=()=>["components","patterns","composition"].includes(Lv())||Lv()==="tokens"&&wi()==="tokens/Layout";function xi(){return Ps}function Rk(){return HS(xi())}function Qv(){return FS(xi())}function eb(){let e=Xv(),t=xi(),r=Qv();P("grid-overlay").hidden=!e,P("grid-overlay").dataset.enabled=String(e&&r),P("grid-options-content").dataset.mode=t.mode;for(let o of P("grid-options").querySelectorAll('[id^="grid-options-mode-"]'))o.setAttribute("aria-pressed",String(o.id==="grid-options-mode-"+t.mode));for(let o of P("grid-options").querySelectorAll('[id^="grid-options-layer-"]'))o.setAttribute("aria-pressed",String(t[o.id.slice(19)]===!0));if(P("grid-options-hint").textContent=P("grid-options-hint").dataset[t.mode]??"",!e&&P("grid-options").matches(":popover-open"))P("grid-options").hidePopover()}var Su;function Lt(){return{...Su&&Su.target===wi()?{adsFocus:Su}:{},theme:rm(),adsTheme:Tr,...tr?{adsBrand:tr}:{},gridOverlay:Xv()&&Qv(),gridGuides:Rk(),gridGuideChoices:xi(),displayMode:"inline",containerDimensions:{width:P("frame-slot").clientWidth,height:P("frame-slot").clientHeight}}}function $s(){P("workspace").dataset.loading="false",P("workspace").setAttribute("aria-busy","false");let e=vi.some((n)=>n.kind==="brand");if(P("sections").querySelector('[data-section="brand"]').hidden=!e,G==="brand"&&!e)G="tokens";if(P("sections").querySelector('[data-section="icons"]').hidden=!ct?.icons,G==="icons"&&!ct?.icons)G="tokens";document.body.dataset.activeSection=G;let t=$r();if(!t.some((n)=>n.id===$e[G]))$e[G]=t[0]?.id??null;eb(),ve?.setHostContext(Lt()),history.replaceState(null,"",em($e[G]));let r=P("entries").scrollTop;P("entries").setAttribute("aria-label",G[0].toUpperCase()+G.slice(1));let o=(n)=>{let a=n.kind==="icons"&&G==="icons"?void 0:jd(n.previewId?{...n,id:n.previewId}:n,Ts,yo),i=n.drafts?.length&&G!=="drafts",u=Ov({label:n.title,href:em(n.id),current:n.id===$e[G],previewState:a?.state,previewLabel:a?.label,draftLabel:i?n.drafts.length>1?`Drafts ${n.drafts.length}`:"Draft":void 0,draftDescription:i?n.draftOnly?"Draft only; no accepted version yet":"Draft available; use Split view to compare":void 0});if(u.href=em(n.id),u.dataset.scenario=n.id,Yv(u,n),n.id===$e[G])u.setAttribute("aria-current","page");return u.addEventListener("click",(l)=>{if(l.button||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey)return;l.preventDefault(),$e[G]=n.id,$s(),Ut().catch(lt)}),u},s=MS(t);if(G==="drafts"){let n=Object.values(su);s.sort((a,i)=>n.indexOf(a.label)-n.indexOf(i.label))}P("entries").replaceChildren(...s.flatMap((n)=>{if(!n.label)return n.entries.map(o);let a=`${G}:${n.label}`,i=qv({label:n.label,open:Av.get(a)??!0});return i.querySelector('[data-slot="entries"]').append(...n.entries.map(o)),i.addEventListener("toggle",()=>{if(i.isConnected)Av.set(a,i.open)}),[i]})),P("entries").scrollTop=r;for(let n of P("sections").querySelectorAll("button"))if(n.dataset.section===G)n.setAttribute("aria-current","page");else n.removeAttribute("aria-current");wu()}function lt(e){if(!Pu&&!yi)rr(),P("status").dataset.errorCategory=e.category??(e.code==="ADS_RESOURCE_TRANSPORT"?"transport":"runner"),P("status").dataset.errorCode=e.code??"ADS_HOST_STARTUP",be(`${e.message}${Re?`
|
|
124
|
+
The retained preview is not verified against the current source.`:""}`,!0)}async function xr(e){if(!e)return;try{await e.teardownResource({},{timeout:500})}catch{}await e.close()}function tb(){if(Pu||yi)return;yi=!0,wo.abort(),++ot,ku.close(),rr(),be("MCP disconnected. The retained preview is stale. Refresh the page after restarting ADS.",!0);let e=ve;ve=void 0,xr(e),++Mt,Ri()}async function lm(){let e=await im("ads://project/explorer");if(ct=e.status,Ts=ct.build,xu=e.tools,ct.themes?.length){if(ut=ct.themes,!ut.some((n)=>n.name===Tr))Tr=ut[0].name;Dv(),ve?.setHostContext(Lt())}vo=ct.brands??[],tr=vo.some((n)=>n.name===tr)?tr:vo[0]?.name??null,Zv(),ve?.setHostContext(Lt()),Uv=e.categories,nm=e.scenarios,bo=e.drafts,P("title").textContent=(ct.drafts?.previewOnly?"Draft · ":"")+ct.project.showcase.title,P("title").title=ct.projectRoot,Gv();let t=ys?Mv:$e[G],r=ys&&bo.find((n)=>n.id===yo),o=Re?.draft&&bo.find((n)=>n.id===Re.draftId);if(r||o&&ze&&(o.revision!==ze.revision||ze.discovery?.state==="pending")){let n=await um(r||o,r?Mv:ze.scenario);if(r)t=n.structuredContent.scenario;if(Re?.draft&&o){ze=n.structuredContent,zu=n;for(let a of Pr)if(a.side==="draft")await a.updateResult(n)}}let s=vi.find((n)=>n.id===t);if(G==="drafts"||ys&&Ke.get("section")==="drafts"){G="drafts";let n=$r(),a=n.find((i)=>i.drafts?.[0].id===yo&&i.previewId===t)??n.find((i)=>i.id===$e.drafts)??n.find((i)=>i.drafts?.[0].id===yo);$e.drafts=a?.id??n[0]?.id}else if(s&&wk.includes(s.kind))G=s.kind,$e[G]=s.id;else if(ys&&Ru.some((n)=>n.id===t))G="tokens",$e.tokens=t;else if(ys&&Ke.get("section")==="icons"&&ct.icons)G="icons";ys=!1,$s()}function Ut({force:e=!1}={}){if(yi)return Promise.resolve();if(G==="icons")return kk(e);vu=!1,Xd(P("frame-slot"));let t=wi(),r=zi();if(ws?.key===r)return ws.promise;if(!e&&bi?.key===r)return Promise.resolve();if(!e&&!ws&&Re?.key===r)return Promise.resolve();bi=void 0;let o={key:r};return ws=o,o.promise=xk(t,r).finally(()=>{if(ws===o)ws=void 0}),o.promise}async function xk(e,t){bu?.abort();let r=bu=new AbortController,o=++ot;xs=!0,P("loader").hidden=t===Rs,P("preview").setAttribute("aria-busy","true");try{if(++Mt,await Ri(),o!==ot)return;if(cm()){await xr(ve),ve=void 0,Rr=void 0,er=void 0;let u=Es(),l=await um(u,e,r.signal);if(o!==ot)return;if(ze=l.structuredContent,zu=l,G==="drafts"){let d=$r().find((f)=>f.drafts?.[0].id===u.id&&f.previewId===ze.scenario);if(d)$e.drafts=d.id}else if(Er()?.pendingDraftScenario||!$r().some((d)=>d.id===e))$e[G]=ze.scenario;Re={key:zi(),id:ze.scenario,draftId:u.id,generation:o,draft:!0},wu(),await Ek(),$s(),rr(!0),be("Draft preview only. Acceptance checks have not run.",!1,"ready");return}if(ze=void 0,wu(),!e){if(await xr(ve),o!==ot)return;if(ve=void 0,Re=void 0,Rs=void 0,Rr=void 0,er=void 0,P("frame-slot").replaceChildren(),rr(),G==="drafts"){P("frame-slot").append(Nv({title:"Drafts",description:"No active drafts."})),be("");return}be("No scenarios discovered. Colocate an independently mountable scenario and fixture with the public implementation.");return}let s=xu.find((u)=>u.name==="ads_show_scenario");if(!s?._meta?.ui?.resourceUri)throw Error("The server did not expose a preview App tool.");let n={id:e};if(s.inputSchema?.properties?.waitFor)n.waitFor=Ke.get("capture")==="1"||Ke.get("waitFor")==="verified"?"verified":"compiled";Jv();let a=await sm(s.name,n,r.signal);if(o!==ot)return;if(a.isError)throw Object.assign(Error(a.content?.find((u)=>u.type==="text")?.text??"Preview build failed."),a.structuredContent?.failure);Re={key:t,id:e,generation:o,build:a.structuredContent?.build,manifestRevision:a.structuredContent?.manifestRevision};let i=await Pk(s._meta.ui.resourceUri);if(o!==ot)return;if(Rr==="ui://ads/preview"&&!Re.manifestRevision)throw Error("The resource preview has no manifest revision.");if(Rs!==t)Rs=void 0;if(await i.sendToolInput({arguments:n}),await i.sendToolResult(a),o===ot&&!a.structuredContent?.manifestUri)rr(!0),be("")}catch(s){if(o===ot)bi={key:zi(),build:Kv(Wv())},lt(s)}}async function kk(e){if(vu&&!e&&fu(P("frame-slot")))return;bu?.abort();let t=++ot;if(!fu(P("frame-slot"))){P("loader").hidden=!1,++Mt,await Ri();let r=ve;ve=void 0,Re=void 0,Rs=void 0,Rr=void 0,er=void 0,ze=void 0,await xr(r)}try{let r=await im(_u);if(t!==ot||G!=="icons")return;Yd(P("frame-slot"),r),vu=!0,rr(),be(""),wu()}catch(r){if(t===ot)lt(r)}}async function Pk(e){if(Rr===e&&er)return er;let t=++Qd,r=ve;ve=void 0,Rr=e,er=(async()=>{await xr(r);let o=await yu({uri:e});if(t!==Qd||Pu||yi)throw Error("Preview opening was superseded.");let s=o.contents.find((l)=>l.mimeType==="text/html;profile=mcp-app"&&typeof l.text==="string");if(!s)throw Error("The preview resource contains no MCP App.");let n=document.createElement("iframe");n.title="Design-system preview",n.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),n.src=Si,P("frame-slot").replaceChildren(n);let a=new pi(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:Lt()});ve=a,a.onreadresource=(l)=>yu(l),a.oncalltool=Fv,a.onloggingmessage=(l)=>{if(a!==ve||l.logger!=="ads-preview"||Re?.generation!==ot||!gu()||l.data?.id!==Re?.id)return;if(l.data.state==="guide-options"){Ps=hi(l.data.options),fm();return}if(l.data.state==="navigate"){let f=Ru.find((h)=>h.id===l.data.target);if(!f)return;if(Su={target:f.id,token:typeof l.data.token==="string"?l.data.token:void 0,nonce:Date.now()},$e.tokens===f.id&&G==="tokens"){ve?.setHostContext(Lt());return}G="tokens",$e.tokens=f.id,$s(),Ut().catch(lt);return}let d=l.data.revision===Re.manifestRevision||l.data.selectionRevision===Re.manifestRevision;if(l.data.state==="ready"&&d)Re.manifestRevision=l.data.revision,rr(!0),be("");else if(l.data.state==="checking"&&(!xs||d))rr(!0),be("Checking changes…");else if(l.data.state==="loading")be("Updating preview…",!1,"reloading");else if(l.data.state==="reverting")be("Restoring the last verified preview…",!1,"reverting");else if(l.data.code==="ADS_PREVIEW_REOPEN")ve=void 0,Rr=void 0,er=void 0,Jv(),xr(a).then(()=>Ut({force:!0})).catch(lt);else if(l.data.state==="error"){if(rr(),P("status").dataset.errorCategory=l.data.category??"build",P("status").dataset.errorCode=l.data.code??"ADS_PREVIEW_BUILD",l.data.resourceUri)P("status").dataset.resourceUri=l.data.resourceUri;else delete P("status").dataset.resourceUri;be([l.data.message,l.data.code,l.data.resourceUri].filter(Boolean).join(`
|
|
125
|
+
`),!0)}},a.onerror=lt;let i,u=new Promise((l,d)=>{i=setTimeout(()=>d(Error("MCP App initialization timed out.")),15000),a.oninitialized=()=>{clearTimeout(i),l()}});a.onsandboxready=()=>a.sendSandboxResourceReady({html:s.text,csp:s._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});try{await Promise.all([a.connect(new mi(n.contentWindow,n.contentWindow)),u])}catch(l){throw await xr(a),l}finally{clearTimeout(i)}return a})();try{return await er}catch(o){if(t===Qd)Rr=void 0,er=void 0;throw o}}async function Tk(){let e=Re,t=await im("ads://project/build");Ts=t,Bv();for(let o of P("entries").querySelectorAll("a[data-scenario]")){let s=$r().find((n)=>n.id===o.dataset.scenario);if(s)Yv(o,s)}if(bi?.key===zi()){let o=Wv(t);if(o&&(o.current||o.live)&&Kv(o)!==bi.build)await Ut({force:!0});return}if(!e||xs||!gu(e))return;if(e.draft){let o=t.drafts?.find((a)=>a.id===e.draftId),s=o?.scenarios?.find((a)=>a.id===ze?.scenario)??o,n=s&&JSON.stringify([o?.session,s.revision,s.live?.revision,s.current]);if(s&&(s.current||s.live)&&e.buildSignature!==n){e.buildSignature=n;let a=bo.find((i)=>i.id===e.draftId);if(a){let i=await um(a,ze.scenario);if(Re!==e||xs||!gu(e))return;ze=i.structuredContent,zu=i;for(let u of Pr)if(u.side==="draft")await u.updateResult(i)}}if(s?.state==="error")be("Draft preview build failed. Showing the previous preview.",!0);else if(s?.building)be(s.live||s.state==="checking"?"Draft preview compiled; checking changes…":"Building draft preview… Showing the previous preview.",!1,s.live||s.state==="checking"?"checking":"compiling");else if(s?.current&&tm?.state==="ready")be("Draft preview ready · unaccepted.");return}if(Re!==e||xs||!gu(e))return;let r=t.previews.find((o)=>o.id===e.id);if(!r){be("The selected scenario is no longer registered.",!0);return}if(["idle","building"].includes(r.state)&&e.build?.current&&r.session===e.build.session&&r.revision<=e.build.revision)return;if(r.state==="error"){be(`${Zi(r)}. Showing an earlier view.
|
|
126
|
+
${gm(r.diagnostics)}`,!0);return}if(["idle","building"].includes(r.state)){be(r.live?"Checking changes…":"Compiling changes… The current view is the previous preview.",!1,r.live?"checking":"compiling");return}if(r.current&&(r.revision!==e.build?.revision||r.session!==e.build?.session))await Ut({force:!0})}function dm(e=!1){ku.schedule(e)}async function Ek(){if(!ze)return;let e=ze,t=zu;tm=void 0;let r=++Mt;if(await Ri(),r!==Mt)return;let o=kr&&e.acceptedExists;zs.setAttribute("aria-pressed",String(o));let s=document.createElement("div");s.className="draft-comparison",s.dataset.split=String(o);for(let n of o?["accepted","draft"]:["draft"]){let a=document.createElement("section");a.className="draft-version";let i=document.createElement("h2");i.dataset.version=n,i.textContent=n==="accepted"?"Accepted":"Draft · unaccepted";let u=document.createElement("div");u.className="draft-stage",u.dataset.version=n,a.append(i,u),s.append(a)}P("frame-slot").replaceChildren(s),await Promise.all([...s.querySelectorAll(".draft-stage")].map(async(n)=>{let a=n.dataset.version,i=a==="draft"?t:await Hv("ads_show_scenario",{id:e.scenario,waitFor:"compiled"});if(i.isError)throw Error(i.content?.find((d)=>d.type==="text")?.text??"Comparison build failed.");if(r!==Mt)return;let u=xu.find((d)=>d.name===(a==="draft"?"ads_show_draft":"ads_show_scenario")),l=await LS({slot:n,title:a==="draft"?"Draft version":"Accepted version",sandboxUrl:Si,resourceUri:u._meta.ui.resourceUri,result:i,readResource:yu,callTool:Fv,context:(d)=>({...Lt(),containerDimensions:{width:d.clientWidth,height:d.clientHeight}}),onError:(d)=>{if(r===Mt)lt(d)},onState:(d)=>{if(r!==Mt)return;if(d.state==="guide-options"){Ps=hi(d.options),fm();return}if(a!=="draft")return;if(tm=d,d.state==="ready")be("Draft preview ready · unaccepted.");else if(d.state==="checking")be("Draft preview compiled; checking changes…",!1,"checking");else if(["loading","reverting"].includes(d.state))be("Updating draft preview…",!1,"reloading")}});if(r!==Mt)await l.close();else Pr.push({...l,side:a})}))}function wu(){let e=Er(),t=Boolean(Es(e))&&!e?.draftOnly;zs.disabled=!t,zs.hidden=!t,zs.title=e?.draftOnly?"No accepted version yet":t?"Compare accepted and draft versions":"No draft for this entry",zs.setAttribute("aria-pressed",String(t&&kr));let r=document.querySelector('.draft-version h2[data-version="draft"]');if(r&&ze){let o={draft:"unaccepted",checking:"checking acceptance",failed:"acceptance failed",conflict:"source conflict",interrupted:"acceptance interrupted","dependency-error":"dependency needs attention"};r.textContent=`Draft · ${o[ze.state]??ze.state}`,r.title=ze.dependencies?.length?`Draft dependencies: ${ze.dependencies.join(", ")}`:""}}zs.addEventListener("click",()=>{kr=!kr,$s(),Ut().catch(lt)});for(let e of P("sections").querySelectorAll("button"))e.addEventListener("click",()=>{G=e.dataset.section,$s(),Ut().catch(lt)});var mm=window.matchMedia("(max-width: 760px)");function rb(){let e=P("workspace"),t=Cv(e.dataset.collapsed==="true",e.dataset.capture==="true");P("header").className=t.header,e.querySelector(":scope > main").className=t.main}function pm(e){P("workspace").dataset.collapsed=String(e),rb(),P("pane-toggle").setAttribute("aria-expanded",String(!e)),P("pane-toggle").setAttribute("aria-label",e?"Show navigation pane":"Hide navigation pane"),P("pane-toggle").title=e?"Show navigation pane":"Hide navigation pane",P("pane-toggle").querySelector("path").setAttribute("d",e?"M6 4l4 4-4 4":"M10 4l-4 4 4 4")}var hm=()=>pm(mm.matches||P("header").hidden);hm();mm.addEventListener("change",hm);P("pane-toggle").addEventListener("click",()=>pm(P("workspace").dataset.collapsed!=="true"));function ob(){P("workspace").dataset.viewport=ks?"phone":"auto",P("viewport").setAttribute("aria-pressed",String(ks)),P("viewport").title=ks?"Use available preview width":"Preview at phone width (390 px)"}ob();P("viewport").addEventListener("click",()=>{ks=!ks,ob();let e=new URL(location.href);if(ks)e.searchParams.set("viewport","phone");else e.searchParams.delete("viewport");history.replaceState(null,"",e.pathname+e.search+e.hash)});P("theme").addEventListener("click",()=>{Tr=ut[(ut.findIndex((e)=>e.name===Tr)+1)%ut.length].name,Dv(),ve?.setHostContext(Lt())});P("theme").addEventListener("click",()=>{for(let e of Pr)e.refreshContext()});P("brand-select").addEventListener("change",()=>{tr=P("brand-select").value,Zv(),ve?.setHostContext(Lt());for(let e of Pr)e.refreshContext()});P("grid-options").addEventListener("click",(e)=>{let[,t,r]=/^grid-options-(mode|layer|preset)-(.+)$/.exec(e.target.closest("button")?.id??"")??[],o=xi();if(t==="mode")Ps={...o,mode:r};else if(t==="layer")Ps={...o,[r]:o[r]!==!0};else if(t==="preset")Ps={...o,...wv(r),mode:o.mode==="off"?"hover":o.mode};else return;fm()});function fm(){eb(),ve?.setHostContext(Lt());for(let e of Pr)e.refreshContext()}P("grid-options").addEventListener("toggle",(e)=>P("grid-overlay").setAttribute("aria-expanded",String(e.newState==="open")));P("minimize").addEventListener("click",()=>{P("header").hidden=!0,pm(!0)});var sb=new ResizeObserver(()=>ve?.setHostContext(Lt()));sb.observe(P("frame-slot"));P("retry-preview").addEventListener("click",()=>{(async()=>{await lm(),await Ut({force:!0})})().catch(lt)});window.addEventListener("pagehide",()=>{Pu=!0,bu?.abort(),wo.abort(),ku.close(),sb.disconnect(),mm.removeEventListener("change",hm),xr(ve),++Mt,Ri(),om?.close(),At.close()},{once:!0});At.onclose=tb;At.setNotificationHandler("notifications/resources/list_changed",()=>dm(!0));At.setNotificationHandler("notifications/tools/list_changed",()=>dm(!0));At.setNotificationHandler("notifications/resources/updated",({params:e})=>{if(e.uri===_u)vu=!1;dm(e.uri==="ads://project/explorer")});try{if(Si=(await fetch("host.json").then((e)=>e.json())).sandboxUrl,!Si||new URL(Si).origin===location.origin)throw Error("The separate-origin MCP App sandbox is unavailable.");await At.connect(new RS(new URL("mcp",location.href))),om=await At.listen({resourcesListChanged:!0,toolsListChanged:!0,resourceSubscriptions:["ads://project/build","ads://project/tokens","ads://project/explorer",_u]}),om.closed.then((e)=>{if(e!=="local")tb()}),await lm(),ku.start(),await Ut()}catch(e){lt(e)}
|