From d275715974f5a021b0774ca261aa2402b6517f8e Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Tue, 21 Oct 2025 01:07:56 -0400 Subject: [PATCH] Release v4.1.0 - Graceful session cleanup and MCP search server restoration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Changed - Graceful session cleanup: Cleanup hook now marks sessions as completed instead of sending DELETE requests to worker - Natural worker shutdown: Workers now finish pending operations (like summary generation) before terminating - Restored MCP search server: Re-enabled full-text search capabilities from backup ### Fixed - Session summaries no longer interrupted by aggressive cleanup during session end - Workers can now complete final operations before shutdown ### Dependencies - Updated @anthropic-ai/claude-agent-sdk to ^0.1.23 - Added @modelcontextprotocol/sdk ^1.20.1 - Added zod-to-json-schema ^3.24.6 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude-plugin/marketplace.json | 2 +- CHANGELOG.md | 12 + package-lock.json | 526 +++++++++++++++++++++++++++++++- package.json | 8 +- plugin/scripts/search-server.js | 91 +++--- 5 files changed, 593 insertions(+), 46 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 9c22528a..207720a9 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ "plugins": [ { "name": "claude-mem", - "version": "4.0.6", + "version": "4.1.0", "source": "./plugin", "description": "Persistent memory system for Claude Code - context compression across sessions" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7676a57b..e649db74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [4.1.0] - 2025-10-21 + +### Changed +- **Graceful session cleanup**: Cleanup hook now marks sessions as completed instead of sending DELETE requests to worker +- **Natural worker shutdown**: Workers now finish pending operations (like summary generation) before terminating +- **Restored MCP search server**: Re-enabled full-text search capabilities from backup + +### Fixed +- Session summaries no longer interrupted by aggressive cleanup during session end +- Workers can now complete final operations before shutdown + + ## [4.0.2] - 2025-10-19 ### Changed diff --git a/package-lock.json b/package-lock.json index 832ee58d..3bdb0894 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,22 @@ { "name": "claude-mem", - "version": "4.0.4", + "version": "4.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "claude-mem", - "version": "4.0.4", + "version": "4.1.0", "license": "SEE LICENSE IN LICENSE", "dependencies": { - "@anthropic-ai/claude-agent-sdk": "^0.1.0", + "@anthropic-ai/claude-agent-sdk": "^0.1.23", + "@modelcontextprotocol/sdk": "^1.20.1", "better-sqlite3": "^11.0.0", "express": "^4.18.2", "glob": "^11.0.3", "handlebars": "^4.7.8", - "pm2": "^5.3.0" + "pm2": "^5.3.0", + "zod-to-json-schema": "^3.24.6" }, "devDependencies": { "@types/better-sqlite3": "^7.6.8", @@ -28,7 +30,9 @@ } }, "node_modules/@anthropic-ai/claude-agent-sdk": { - "version": "0.1.15", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.1.23.tgz", + "integrity": "sha512-DktXOjzS2hOuuj2Zpo7fEooONfMa5bm09pt1/Vt4vn30YugELoezn/ZQ/TG5uSQ7+Zl/ElxAvi4vGDorj1Tirg==", "license": "SEE LICENSE IN README.md", "engines": { "node": ">=18.0.0" @@ -707,6 +711,334 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.20.1.tgz", + "integrity": "sha512-j/P+yuxXfgxb+mW7OEoRCM3G47zCTDqUPivJo/VzpjbG8I9csTXtOprCf5FfOfHK4whOJny0aHuBEON+kS7CCA==", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.6", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.0.1", + "express-rate-limit": "^7.5.0", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.23.8", + "zod-to-json-schema": "^3.24.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/mime-types": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz", + "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/raw-body": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.1.tgz", + "integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.7.0", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@modelcontextprotocol/sdk/node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/@pm2/agent": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-2.0.4.tgz", @@ -1144,6 +1476,22 @@ "node": ">= 14" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/amp": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/amp/-/amp-0.3.1.tgz", @@ -1544,6 +1892,19 @@ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", "license": "MIT" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/croner": { "version": "4.1.97", "resolved": "https://registry.npmjs.org/croner/-/croner-4.1.97.tgz", @@ -1858,6 +2219,27 @@ "integrity": "sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg==", "license": "MIT" }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/expand-template": { "version": "2.0.3", "license": "(MIT OR WTFPL)", @@ -1870,6 +2252,7 @@ "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "license": "MIT", + "peer": true, "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -1911,6 +2294,21 @@ "url": "https://opencollective.com/express" } }, + "node_modules/express-rate-limit": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", + "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, "node_modules/extrareqp2": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/extrareqp2/-/extrareqp2-1.0.0.tgz", @@ -1920,12 +2318,24 @@ "follow-redirects": "^1.14.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, "node_modules/fast-json-patch": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", "license": "MIT" }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT" + }, "node_modules/fclone": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/fclone/-/fclone-1.0.11.tgz", @@ -2440,6 +2850,12 @@ "node": ">=0.12.0" } }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, "node_modules/isexe": { "version": "2.0.0", "license": "ISC" @@ -2481,6 +2897,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -2746,6 +3168,15 @@ "integrity": "sha512-K7J4xq5xAD5jHsGM5ReWXRTFa3JRGofHiMcVgQ8PRwgWxzjHpMWCIzsmyf60+mh8KLsqYPcjUMa0AC4hd6lPyQ==", "license": "MIT" }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -2908,6 +3339,15 @@ "node": ">=10" } }, + "node_modules/pkce-challenge": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.0.tgz", + "integrity": "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/pm2": { "version": "5.4.3", "resolved": "https://registry.npmjs.org/pm2/-/pm2-5.4.3.tgz", @@ -3272,6 +3712,15 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", @@ -3417,6 +3866,55 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/router/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/router/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/router/node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/run-series": { "version": "1.1.9", "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.9.tgz", @@ -4049,6 +4547,15 @@ "node": ">= 0.8" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "license": "MIT" @@ -4212,6 +4719,15 @@ "funding": { "url": "https://github.com/sponsors/colinhacks" } + }, + "node_modules/zod-to-json-schema": { + "version": "3.24.6", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.6.tgz", + "integrity": "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" + } } } } diff --git a/package.json b/package.json index 23b1d19a..43c6731f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claude-mem", - "version": "4.0.6", + "version": "4.1.0", "description": "Memory compression system for Claude Code - persist context across sessions", "keywords": [ "claude", @@ -50,12 +50,14 @@ "worker:status": "npx pm2 status claude-mem-worker" }, "dependencies": { - "@anthropic-ai/claude-agent-sdk": "^0.1.0", + "@anthropic-ai/claude-agent-sdk": "^0.1.23", + "@modelcontextprotocol/sdk": "^1.20.1", "better-sqlite3": "^11.0.0", "express": "^4.18.2", "glob": "^11.0.3", "handlebars": "^4.7.8", - "pm2": "^5.3.0" + "pm2": "^5.3.0", + "zod-to-json-schema": "^3.24.6" }, "devDependencies": { "@types/better-sqlite3": "^7.6.8", diff --git a/plugin/scripts/search-server.js b/plugin/scripts/search-server.js index 964f4742..9781bcd3 100755 --- a/plugin/scripts/search-server.js +++ b/plugin/scripts/search-server.js @@ -1,11 +1,11 @@ #!/usr/bin/env node -var El=Object.create;var Oa=Object.defineProperty;var bl=Object.getOwnPropertyDescriptor;var Sl=Object.getOwnPropertyNames;var xl=Object.getPrototypeOf,Pl=Object.prototype.hasOwnProperty;var X=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Rl=(a,e)=>{for(var t in e)Oa(a,t,{get:e[t],enumerable:!0})},Tl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sl(e))!Pl.call(a,r)&&r!==t&&Oa(a,r,{get:()=>e[r],enumerable:!(s=bl(e,r))||s.enumerable});return a};var Ol=(a,e,t)=>(t=a!=null?El(xl(a)):{},Tl(e||!a||!a.__esModule?Oa(t,"default",{value:a,enumerable:!0}):t,a));var mn=X((Xt,hn)=>{(function(a,e){typeof Xt=="object"&&typeof hn<"u"?e(Xt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Xt,function(a){"use strict";function e(){for(var h=arguments.length,f=Array(h),y=0;y1){f[0]=f[0].slice(0,-1);for(var b=f.length-1,x=1;x= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=u-g,U=Math.floor,M=String.fromCharCode;function j(h){throw new RangeError(q[h])}function A(h,f){for(var y=[],b=h.length;b--;)y[b]=f(h[b]);return y}function C(h,f){var y=h.split("@"),b="";y.length>1&&(b=y[0]+"@",h=y[1]),h=h.replace(V,".");var x=h.split("."),L=A(x,f).join(".");return b+L}function F(h){for(var f=[],y=0,b=h.length;y=55296&&x<=56319&&y>1,f+=U(f/y);f>D*_>>1;x+=u)f=U(f/D);return U(x+(D+1)*f/(f+v))},H=function(f){var y=[],b=f.length,x=0,L=P,G=T,ae=f.lastIndexOf(R);ae<0&&(ae=0);for(var oe=0;oe=128&&j("not-basic"),y.push(f.charCodeAt(oe));for(var Ee=ae>0?ae+1:0;Ee=b&&j("invalid-input");var de=J(f.charCodeAt(Ee++));(de>=u||de>U((E-x)/pe))&&j("overflow"),x+=de*pe;var ne=be<=G?g:be>=G+_?_:be-G;if(deU(E/he)&&j("overflow"),pe*=he}var ce=y.length+1;G=W(x-te,ce,te==0),U(x/ce)>E-L&&j("overflow"),L+=U(x/ce),x%=ce,y.splice(x++,0,L)}return String.fromCodePoint.apply(String,y)},me=function(f){var y=[];f=F(f);var b=f.length,x=P,L=0,G=T,ae=!0,oe=!1,Ee=void 0;try{for(var te=f[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var be=pe.value;be<128&&y.push(M(be))}}catch(Nr){oe=!0,Ee=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw Ee}}var de=y.length,ne=de;for(de&&y.push(R);ne=x&&FeU((E-L)/Ue)&&j("overflow"),L+=(he-x)*Ue,x=he;var tr=!0,Ar=!1,ur=void 0;try{for(var ht=f[Symbol.iterator](),At;!(tr=(At=ht.next()).done);tr=!0){var Nt=At.value;if(NtE&&j("overflow"),Nt==x){for(var Jr=L,Yr=u;;Yr+=u){var dr=Yr<=G?g:Yr>=G+_?_:Yr-G;if(Jr>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():y="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),y}function Ie(h){for(var f="",y=0,b=h.length;y=194&&x<224){if(b-y>=6){var L=parseInt(h.substr(y+4,2),16);f+=String.fromCharCode((x&31)<<6|L&63)}else f+=h.substr(y,6);y+=6}else if(x>=224){if(b-y>=9){var G=parseInt(h.substr(y+4,2),16),ae=parseInt(h.substr(y+7,2),16);f+=String.fromCharCode((x&15)<<12|(G&63)<<6|ae&63)}else f+=h.substr(y,9);y+=9}else f+=h.substr(y,3),y+=3}return f}function gr(h,f){function y(b){var x=Ie(b);return x.match(f.UNRESERVED)?x:b}return h.scheme&&(h.scheme=String(h.scheme).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(f.PCT_ENCODED,y).replace(f.NOT_USERINFO,Se).replace(f.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_HOST,Se).replace(f.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(f.PCT_ENCODED,y).replace(h.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,Se).replace(f.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(f.PCT_ENCODED,y).replace(f.NOT_QUERY,Se).replace(f.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(f.PCT_ENCODED,y).replace(f.NOT_FRAGMENT,Se).replace(f.PCT_ENCODED,r)),h}function lr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,f){var y=h.match(f.IPV4ADDRESS)||[],b=p(y,2),x=b[1];return x?x.split(".").map(lr).join("."):h}function ve(h,f){var y=h.match(f.IPV6ADDRESS)||[],b=p(y,3),x=b[1],L=b[2];if(x){for(var G=x.toLowerCase().split("::").reverse(),ae=p(G,2),oe=ae[0],Ee=ae[1],te=Ee?Ee.split(":").map(lr):[],pe=oe.split(":").map(lr),be=f.IPV4ADDRESS.test(pe[pe.length-1]),de=be?7:8,ne=pe.length-de,he=Array(de),ce=0;ce1){var ue=he.slice(0,je.index),Fe=he.slice(je.index+je.length);qe=ue.join(":")+"::"+Fe.join(":")}else qe=he.join(":");return L&&(qe+="%"+L),qe}else return h}var Tr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Te="".match(/(){0}/)[1]===void 0;function ie(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},b=f.iri!==!1?d:c;f.reference==="suffix"&&(h=(f.scheme?f.scheme+":":"")+"//"+h);var x=h.match(Tr);if(x){Te?(y.scheme=x[1],y.userinfo=x[3],y.host=x[4],y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=x[7],y.fragment=x[8],isNaN(y.port)&&(y.port=x[5])):(y.scheme=x[1]||void 0,y.userinfo=h.indexOf("@")!==-1?x[3]:void 0,y.host=h.indexOf("//")!==-1?x[4]:void 0,y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=h.indexOf("?")!==-1?x[7]:void 0,y.fragment=h.indexOf("#")!==-1?x[8]:void 0,isNaN(y.port)&&(y.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?x[4]:void 0)),y.host&&(y.host=ve(_e(y.host,b),b)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==y.reference&&(y.error=y.error||"URI is not a "+f.reference+" reference.");var L=ye[(f.scheme||y.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!L||!L.unicodeSupport)){if(y.host&&(f.domainHost||L&&L.domainHost))try{y.host=se.toASCII(y.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(G){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+G}gr(y,c)}else gr(y,b);L&&L.parse&&L.parse(y,f)}else y.error=y.error||"URI can not be parsed.";return y}function yr(h,f){var y=f.iri!==!1?d:c,b=[];return h.userinfo!==void 0&&(b.push(h.userinfo),b.push("@")),h.host!==void 0&&b.push(ve(_e(String(h.host),y),y).replace(y.IPV6ADDRESS,function(x,L,G){return"["+L+(G?"%25"+G:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(b.push(":"),b.push(String(h.port))),b.length?b.join(""):void 0}var cr=/^\.\.?\//,Or=/^\/\.(\/|$)/,wr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(h){for(var f=[];h.length;)if(h.match(cr))h=h.replace(cr,"");else if(h.match(Or))h=h.replace(Or,"/");else if(h.match(wr))h=h.replace(wr,"/"),f.pop();else if(h==="."||h==="..")h="";else{var y=h.match(xe);if(y){var b=y[0];h=h.slice(b.length),f.push(b)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function De(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=f.iri?d:c,b=[],x=ye[(f.scheme||h.scheme||"").toLowerCase()];if(x&&x.serialize&&x.serialize(h,f),h.host&&!y.IPV6ADDRESS.test(h.host)){if(f.domainHost||x&&x.domainHost)try{h.host=f.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(y.PCT_ENCODED,Ie).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+ae}}gr(h,y),f.reference!=="suffix"&&h.scheme&&(b.push(h.scheme),b.push(":"));var L=yr(h,f);if(L!==void 0&&(f.reference!=="suffix"&&b.push("//"),b.push(L),h.path&&h.path.charAt(0)!=="/"&&b.push("/")),h.path!==void 0){var G=h.path;!f.absolutePath&&(!x||!x.absolutePath)&&(G=Me(G)),L===void 0&&(G=G.replace(/^\/\//,"/%2F")),b.push(G)}return h.query!==void 0&&(b.push("?"),b.push(h.query)),h.fragment!==void 0&&(b.push("#"),b.push(h.fragment)),b.join("")}function Ae(h,f){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},b=arguments[3],x={};return b||(h=ie(De(h,y),y),f=ie(De(f,y),y)),y=y||{},!y.tolerant&&f.scheme?(x.scheme=f.scheme,x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.path?(f.path.charAt(0)==="/"?x.path=Me(f.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?x.path="/"+f.path:h.path?x.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+f.path:x.path=f.path,x.path=Me(x.path)),x.query=f.query):(x.path=h.path,f.query!==void 0?x.query=f.query:x.query=h.query),x.userinfo=h.userinfo,x.host=h.host,x.port=h.port),x.scheme=h.scheme),x.fragment=f.fragment,x}function er(h,f,y){var b=i({scheme:"null"},y);return De(Ae(ie(h,b),ie(f,b),b,!0),b)}function Le(h,f){return typeof h=="string"?h=De(ie(h,f),f):s(h)==="object"&&(h=ie(De(h,f),f)),h}function It(h,f,y){return typeof h=="string"?h=De(ie(h,y),y):s(h)==="object"&&(h=De(h,y)),typeof f=="string"?f=De(ie(f,y),y):s(f)==="object"&&(f=De(f,y)),h===f}function xa(h,f){return h&&h.toString().replace(!f||!f.iri?c.ESCAPE:d.ESCAPE,Se)}function Xe(h,f){return h&&h.toString().replace(!f||!f.iri?c.PCT_ENCODED:d.PCT_ENCODED,Ie)}var ft={scheme:"http",domainHost:!0,parse:function(f,y){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,y){var b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},Rs={scheme:"https",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize};function Ts(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var pt={scheme:"ws",domainHost:!0,parse:function(f,y){var b=f;return b.secure=Ts(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b},serialize:function(f,y){if((f.port===(Ts(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var b=f.resourceName.split("?"),x=p(b,2),L=x[0],G=x[1];f.path=L&&L!=="/"?L:void 0,f.query=G,f.resourceName=void 0}return f.fragment=void 0,f}},Os={scheme:"wss",domainHost:pt.domainHost,parse:pt.parse,serialize:pt.serialize},rl={},tl=!0,ws="[A-Za-z0-9\\-\\.\\_\\~"+(tl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",al=t(t("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+t("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+t("%"+rr+rr)),sl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",nl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",il=e(nl,'[\\"\\\\]'),ol="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ll=new RegExp(ws,"g"),Wr=new RegExp(al,"g"),cl=new RegExp(e("[^]",sl,"[\\.]",'[\\"]',il),"g"),Is=new RegExp(e("[^]",ws,ol),"g"),ul=Is;function Pa(h){var f=Ie(h);return f.match(ll)?f:h}var As={scheme:"mailto",parse:function(f,y){var b=f,x=b.to=b.path?b.path.split(","):[];if(b.path=void 0,b.query){for(var L=!1,G={},ae=b.query.split("&"),oe=0,Ee=ae.length;oe{"use strict";vn.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var yn=X((xp,gn)=>{"use strict";gn.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";bn.exports={copy:$u,checkDataType:Ba,checkDataTypes:ku,coerceToTypes:Lu,toHash:Xa,getProperty:Qa,escapeQuotes:Ga,equal:Qt(),ucs2length:yn(),varOccurences:Mu,varReplace:qu,schemaHasRules:Uu,schemaHasRulesExcept:zu,schemaUnknownRules:Vu,toQuotedString:Za,getPathExpr:Hu,getPath:Bu,getData:Qu,unescapeFragment:Gu,unescapeJsonPointer:Wa,escapeFragment:Ku,escapeJsonPointer:Ka};function $u(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Ba(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",l=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+l+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+l+"("+e+" % 1)"+n+e+r+e+(t?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function ku(a,e,t){switch(a.length){case 1:return Ba(a[0],e,t,!0);default:var s="",r=Xa(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Ba(n,e,t,!0);return s}}var _n=Xa(["string","number","integer","boolean","null"]);function Lu(a,e){if(Array.isArray(e)){for(var t=[],s=0;s=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var l=n,c=r.split("/"),d=0;d{"use strict";var Wu=Qr();Sn.exports=Ju;function Ju(a){Wu.copy(a,this)}});var Pn=X((Tp,xn)=>{"use strict";var xr=xn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Gt(e,s,r,a,"",a)};xr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};xr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xr.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Gt(a,e,t,s,r,n,i,l,c,d){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,l,c,d);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in xr.arrayKeywords)for(var E=0;E{"use strict";var Tt=mn(),Rn=Qt(),Yt=Qr(),Kt=Ja(),ed=Pn();wn.exports=Rr;Rr.normalizeId=Pr;Rr.fullPath=Wt;Rr.url=Jt;Rr.ids=nd;Rr.inlineRef=Ya;Rr.schema=ea;function Rr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Rr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Kt)return Ya(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=ea.call(this,e,t),n,i,l;return r&&(n=r.schema,e=r.root,l=r.baseId),n instanceof Kt?i=n.validate||a.call(this,n.schema,e,void 0,l):n!==void 0&&(i=Ya(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,l)),i}function ea(a,e){var t=Tt.parse(e),s=On(t),r=Wt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Pr(s),i=this._refs[n];if(typeof i=="string")return rd.call(this,a,i,t);if(i instanceof Kt)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof Kt){if(i.validate||this._compile(i),n==Pr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Wt(this._getId(a.schema))}return Tn.call(this,t,r,a.schema,a)}function rd(a,e,t){var s=ea.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=Jt(n,i)),Tn.call(this,t,n,r,a)}}var td=Yt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Tn(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n{"use strict";var ts=ra();An.exports={Validation:In(id),MissingRef:In(as)};function id(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}as.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function as(a,e,t){this.message=t||as.message(a,e),this.missingRef=ts.url(a,e),this.missingSchema=ts.normalizeId(ts.fullPath(this.missingRef))}function In(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var ss=X((Ip,Nn)=>{"use strict";Nn.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(l,c){var d={key:l,value:i[l]},p={key:c,value:i[c]};return n(d,p)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var l,c;if(Array.isArray(i)){for(c="[",l=0;l{"use strict";Dn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var d="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(d);else throw new Error(d)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,E=e.schema[t],u=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,I=!e.opts.allErrors,q,_="data"+(m||""),R="valid"+p;if(e.schema===!1){e.isTop?I=!0:r+=" var "+R+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+R+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var T=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,_="data"+(m||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+p+" = errors;"}var R="valid"+p,I=!e.opts.allErrors,N="",V="",q,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),D){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,D);var j=e.RULES.types[D];if(M||U||j===!0||j&&!xe(j)){var u=e.schemaPath+".type",g=e.errSchemaPath+"/type",u=e.schemaPath+".type",g=e.errSchemaPath+"/type",A=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](D,_,e.opts.strictNumbers,!0)+") { ",M){var C="dataType"+p,F="coerced"+p;r+=" var "+C+" = typeof "+_+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+C+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+F+" = "+_+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=M;if(le)for(var J,re=-1,W=le.length-1;re{"use strict";var aa=ra(),na=Qr(),$n=ta(),od=ss(),Cn=ns(),ld=na.ucs2length,cd=Qt(),ud=$n.Validation;Ln.exports=is;function is(a,e,t,s){var r=this,n=this._opts,i=[void 0],l={},c=[],d={},p=[],m={},E=[];e=e||{schema:a,refVal:i,refs:l};var u=dd.call(this,a,e,s),g=this._compilations[u.index];if(u.compiling)return g.callValidate=P;var _=this._formats,v=this.RULES;try{var S=R(a,e,t,s);g.validate=S;var T=g.callValidate;return T&&(T.schema=S.schema,T.errors=null,T.refs=S.refs,T.refVal=S.refVal,T.root=S.root,T.$async=S.$async,n.sourceCode&&(T.source=S.source)),S}finally{fd.call(this,a,e,s)}function P(){var A=g.validate,C=A.apply(this,arguments);return P.errors=A.errors,C}function R(A,C,F,le){var J=!C||C&&C.schema==A;if(C.schema!=e.schema)return is.call(r,A,C,F,le);var re=A.$async===!0,W=Cn({isTop:!0,schema:A,isRoot:J,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:$n.MissingRef,RULES:v,validate:Cn,util:na,resolve:aa,resolveRef:I,usePattern:U,useDefault:M,useCustomRule:j,opts:n,formats:_,logger:r.logger,self:r});W=sa(i,md)+sa(c,pd)+sa(p,hd)+sa(E,vd)+W,n.processCode&&(W=n.processCode(W,A));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",W);H=me(r,v,_,e,i,p,E,cd,ld,ud),i[0]=H}catch(Re){throw r.logger.error("Error compiling schema, function code:",W),Re}return H.schema=A,H.errors=null,H.refs=l,H.refVal=i,H.root=J?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:W,patterns:c,defaults:p}),H}function I(A,C,F){C=aa.url(A,C);var le=l[C],J,re;if(le!==void 0)return J=i[le],re="refVal["+le+"]",D(J,re);if(!F&&e.refs){var W=e.refs[C];if(W!==void 0)return J=e.refVal[W],re=N(C,J),D(J,re)}re=N(C);var H=aa.call(r,R,e,C);if(H===void 0){var me=t&&t[C];me&&(H=aa.inlineRef(me,n.inlineRefs)?me:is.call(r,me,e,t,A))}if(H===void 0)V(C);else return q(C,H),D(H,re)}function N(A,C){var F=i.length;return i[F]=C,l[A]=F,"refVal"+F}function V(A){delete l[A]}function q(A,C){var F=l[A];i[F]=C}function D(A,C){return typeof A=="object"||typeof A=="boolean"?{code:C,schema:A,inline:!0}:{code:C,$async:A&&!!A.$async}}function U(A){var C=d[A];return C===void 0&&(C=d[A]=c.length,c[C]=A),"pattern"+C}function M(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return na.toQuotedString(A);case"object":if(A===null)return"null";var C=od(A),F=m[C];return F===void 0&&(F=m[C]=p.length,p[F]=A),"default"+F}}function j(A,C,F,le){if(r._opts.validateSchema!==!1){var J=A.definition.dependencies;if(J&&!J.every(function(Se){return Object.prototype.hasOwnProperty.call(F,Se)}))throw new Error("parent schema must have all required keywords: "+J.join(","));var re=A.definition.validateSchema;if(re){var W=re(C);if(!W){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=A.definition.compile,Re=A.definition.inline,we=A.definition.macro,se;if(me)se=me.call(r,C,F,le);else if(we)se=we.call(r,C,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Re)se=Re.call(r,le,A.keyword,C,F);else if(se=A.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var ye=E.length;return E[ye]=se,{code:"customRule"+ye,validate:se}}}function dd(a,e,t){var s=kn.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function fd(a,e,t){var s=kn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function kn(a,e,t){for(var s=0;s{"use strict";var ia=Fn.exports=function(){this._cache={}};ia.prototype.put=function(e,t){this._cache[e]=t};ia.prototype.get=function(e){return this._cache[e]};ia.prototype.del=function(e){delete this._cache[e]};ia.prototype.clear=function(){this._cache={}}});var Wn=X((Cp,Kn)=>{"use strict";var gd=Qr(),yd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_d=[0,31,28,31,30,31,30,31,31,30,31,30,31],Ed=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,qn=/^(?=.{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,bd=/^(?:[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,Sd=/^(?:[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,Un=/^(?:(?:[^\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,zn=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Vn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Hn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Bn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Zn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Kn.exports=oa;function oa(a){return a=a=="full"?"full":"fast",gd.copy(oa[a])}oa.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Un,url:zn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:qn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gn,uuid:Vn,"json-pointer":Hn,"json-pointer-uri-fragment":Bn,"relative-json-pointer":Zn};oa.full={date:Xn,time:Qn,"date-time":Rd,uri:Od,"uri-reference":Sd,"uri-template":Un,url:zn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:qn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gn,uuid:Vn,"json-pointer":Hn,"json-pointer-uri-fragment":Bn,"relative-json-pointer":Zn};function xd(a){return a%4===0&&(a%100!==0||a%400===0)}function Xn(a){var e=a.match(yd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&xd(t)?29:_d[s])}function Qn(a,e){var t=a.match(Ed);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var Pd=/t|\s/i;function Rd(a){var e=a.split(Pd);return e.length==2&&Xn(e[0])&&Qn(e[1],!0)}var Td=/\/|:/;function Od(a){return Td.test(a)&&bd.test(a)}var wd=/[^\\]\\Z/;function Gn(a){if(wd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Yn=X(($p,Jn)=>{"use strict";Jn.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,p="data"+(i||""),m="valid"+n,E,u;if(l=="#"||l=="#/")e.isRoot?(E=e.async,u="validate"):(E=e.root.schema.$async===!0,u="root.refVal[0]");else{var g=e.resolveRef(e.baseId,l,e.isRoot);if(g===void 0){var _=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(_);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&d?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),d&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,_)}else if(g.inline){var T=e.util.copy(e);T.level++;var P="valid"+T.level;T.schema=g.schema,T.schemaPath="",T.errSchemaPath=l;var R=e.validate(T).replace(/validate\.schema/g,g.code);r+=" "+R+" ",d&&(r+=" if ("+P+") { ")}else E=g.$async===!0||e.async&&g.$async!==!1,u=g.code}if(u){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+u+".call(this, ":r+=" "+u+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var I=i?"data"+(i-1||""):"parentData",N=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+I+" , "+N+", rootData) ";var V=r;if(r=v.pop(),E){if(!e.async)throw new Error("async schema referenced by sync schema");d&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",d&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",d&&(r+=" "+m+" = false; "),r+=" } ",d&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+u+".errors; else vErrors = vErrors.concat("+u+".errors); errors = vErrors.length; } ",d&&(r+=" else { ")}return r}});var ri=X((kp,ei)=>{"use strict";ei.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d=e.util.copy(e),p="";d.level++;var m="valid"+d.level,E=d.baseId,u=!0,g=n;if(g)for(var _,v=-1,S=g.length-1;v0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(u=!1,d.schema=_,d.schemaPath=i+"["+v+"]",d.errSchemaPath=l+"/"+v,r+=" "+e.validate(d)+" ",d.baseId=E,c&&(r+=" if ("+m+") { ",p+="}"));return c&&(u?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ai=X((Lp,ti)=>{"use strict";ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=l.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(S){var T=g.baseId;r+=" var "+u+" = errors; var "+E+" = false; ";var P=e.compositeRule;e.compositeRule=g.compositeRule=!0;var R=l;if(R)for(var I,N=-1,V=R.length-1;N{"use strict";si.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var oi=X((Fp,ii)=>{"use strict";ii.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l,u||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+E+" = equal("+m+", schema"+n+"); if (!"+E+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var ci=X((Mp,li)=>{"use strict";li.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,T=g.dataLevel=e.dataLevel+1,P="data"+T,R=e.baseId,I=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(r+="var "+u+" = errors;var "+E+";",I){var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" var "+v+" = false; for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var V=m+"["+S+"]";g.dataPathArr[T]=S;var q=e.validate(g);g.baseId=R,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,V)+" ":r+=" var "+P+" = "+V+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=g.compositeRule=N,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=D.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",I&&(r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var di=X((qp,ui)=>{"use strict";ui.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level,v={},S={},T=e.opts.ownProperties;for(N in l)if(N!="__proto__"){var P=l[N],R=Array.isArray(P)?S:v;R[N]=P}r+="var "+E+" = errors;";var I=e.errorPath;r+="var missing"+n+";";for(var N in S)if(R=S[N],R.length){if(r+=" if ( "+m+e.util.getProperty(N)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),p){r+=" && ( ";var V=R;if(V)for(var q,D=-1,U=V.length-1;D0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(N)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),r+=") { ",u.schema=P,u.schemaPath=c+e.util.getProperty(N),u.errSchemaPath=d+"/"+e.util.escapeFragment(N),r+=" "+e.validate(u)+" ",u.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",g+="}"))}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var pi=X((Up,fi)=>{"use strict";fi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l;var _="i"+n,v="schema"+n;u||(r+=" var "+v+" = validate.schema"+c+";"),r+="var "+E+";",u&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=""+E+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+E+" = true; break; }",u&&(r+=" } "),r+=" if (!"+E+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;return r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var mi=X((zp,hi)=>{"use strict";hi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=e.opts.unknownFormats,_=Array.isArray(g);if(E){var v="format"+n,S="isObject"+n,T="formatType"+n;r+=" var "+v+" = formats["+u+"]; var "+S+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+T+" = "+S+" && "+v+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" (",g!="ignore"&&(r+=" ("+u+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),r+=") || "),r+=" ("+v+" && "+T+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+m+") : "+v+"("+m+")) ":r+=" "+v+"("+m+") ",r+=" : "+v+".test("+m+"))))) {"}else{var v=e.formats[l];if(!v){if(g=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(_&&g.indexOf(l)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,T=S&&v.type||"string";if(S){var P=v.async===!0;v=v.validate}if(T!=s)return p&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var R="formats"+e.util.getProperty(l)+".validate";r+=" if (!(await "+R+"("+m+"))) { "}else{r+=" if (! ";var R="formats"+e.util.getProperty(l);S&&(R+=".validate"),typeof v=="function"?r+=" "+R+"("+m+") ":r+=" "+R+".test("+m+") ",r+=") { "}}var I=I||[];I.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { format: ",E?r+=""+u:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,E?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var N=r;return r=I.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+N+"]); ":r+=" validate.errors = ["+N+"]; return false; ":r+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var gi=X((Vp,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e);g.level++;var _="valid"+g.level,v=e.schema.then,S=e.schema.else,T=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),R=g.baseId;if(T||P){var I;g.createErrors=!1,g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" var "+u+" = errors; var "+E+" = true; ";var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,r+=" "+e.validate(g)+" ",g.baseId=R,g.createErrors=!0,r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=N,T?(r+=" if ("+_+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(g)+" ",g.baseId=R,r+=" "+E+" = "+_+"; ",T&&P?(I="ifClause"+n,r+=" var "+I+" = 'then'; "):I="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+_+") { ",P&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(g)+" ",g.baseId=R,r+=" "+E+" = "+_+"; ",T&&P?(I="ifClause"+n,r+=" var "+I+" = 'else'; "):I="'else'",r+=" } "),r+=" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { failingKeyword: "+I+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+I+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var _i=X((Hp,yi)=>{"use strict";yi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,T=g.dataLevel=e.dataLevel+1,P="data"+T,R=e.baseId;if(r+="var "+u+" = errors;var "+E+";",Array.isArray(l)){var I=e.schema.additionalItems;if(I===!1){r+=" "+E+" = "+m+".length <= "+l.length+"; ";var N=d;d=e.errSchemaPath+"/additionalItems",r+=" if (!"+E+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",d=N,p&&(_+="}",r+=" else { ")}var D=l;if(D){for(var U,M=-1,j=D.length-1;M0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+M+") { ";var A=m+"["+M+"]";g.schema=U,g.schemaPath=c+"["+M+"]",g.errSchemaPath=d+"/"+M,g.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),g.dataPathArr[T]=M;var C=e.validate(g);g.baseId=R,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof I=="object"&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))){g.schema=I,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+l.length+") { for (var "+S+" = "+l.length+"; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=m+"["+S+"]";g.dataPathArr[T]=S;var C=e.validate(g);g.baseId=R,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" } } ",p&&(r+=" if ("+v+") { ",_+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var A=m+"["+S+"]";g.dataPathArr[T]=S;var C=e.validate(g);g.baseId=R,e.util.varOccurences(C,P)<2?r+=" "+e.util.varReplace(C,P,A)+" ":r+=" var "+P+" = "+A+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+u+" == errors) {"),r}});var os=X((Bp,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,R,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=t=="maximum",_=g?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],S=e.opts.$data&&v&&v.$data,T=g?"<":">",P=g?">":"<",R=void 0;if(!(E||typeof l=="number"||l===void 0))throw new Error(t+" must be number");if(!(S||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(S){var I=e.util.getData(v.$data,i,e.dataPathArr),N="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,D="op"+n,U="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+I+"; ",I="schemaExcl"+n,r+=" var "+N+"; var "+V+" = typeof "+I+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var R=_,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+N+" = "+u+" === undefined || "+I+" "+T+"= "+u+") ? "+m+" "+P+"= "+I+" : "+m+" "+P+" "+u+" ) : ( ("+N+" = "+I+" === true) ? "+m+" "+P+"= "+u+" : "+m+" "+P+" "+u+" ) || "+m+" !== "+m+") { var op"+n+" = "+N+" ? '"+T+"' : '"+T+"='; ",l===void 0&&(R=_,d=e.errSchemaPath+"/"+_,u=I,E=S)}else{var q=typeof v=="number",U=T;if(q&&E){var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" ( "+u+" === undefined || "+v+" "+T+"= "+u+" ? "+m+" "+P+"= "+v+" : "+m+" "+P+" "+u+" ) || "+m+" !== "+m+") { "}else{q&&l===void 0?(N=!0,R=_,d=e.errSchemaPath+"/"+_,u=v,P+="="):(q&&(u=Math[g?"min":"max"](v,l)),v===(q?u:!0)?(N=!0,R=_,d=e.errSchemaPath+"/"+_,P+="="):(N=!1,U+="="));var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+" "+P+" "+u+" || "+m+" !== "+m+") { "}}R=R||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(R||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { comparison: "+D+", limit: "+u+", exclusive: "+N+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",E?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;return r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var ls=X((Zp,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+".length "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var cs=X((Xp,Si)=>{"use strict";Si.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var us=X((Qp,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" Object.keys("+m+").length "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ri=X((Gp,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",E&&(r+=" "+u+" !== undefined && ( typeof "+u+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+u+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",E&&(r+=" ) "),r+=" ) { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { multipleOf: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",E?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=g.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Oi=X((Kp,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e);u.level++;var g="valid"+u.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){u.schema=l,u.schemaPath=c,u.errSchemaPath=d,r+=" var "+E+" = errors; ";var _=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var v;u.opts.allErrors&&(v=u.opts.allErrors,u.opts.allErrors=!1),r+=" "+e.validate(u)+" ",u.createErrors=!0,v&&(u.opts.allErrors=v),e.compositeRule=u.compositeRule=_,r+=" if ("+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var Ii=X((Wp,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=g.baseId,T="prevValid"+n,P="passingSchemas"+n;r+="var "+u+" = errors , "+T+" = false , "+E+" = false , "+P+" = null; ";var R=e.compositeRule;e.compositeRule=g.compositeRule=!0;var I=l;if(I)for(var N,V=-1,q=I.length-1;V0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(g.schema=N,g.schemaPath=c+"["+V+"]",g.errSchemaPath=d+"/"+V,r+=" "+e.validate(g)+" ",g.baseId=S):r+=" var "+v+" = true; ",V&&(r+=" if ("+v+" && "+T+") { "+E+" = false; "+P+" = ["+P+", "+V+"]; } else { ",_+="}"),r+=" if ("+v+") { "+E+" = "+T+" = true; "+P+" = "+V+"; }";return e.compositeRule=g.compositeRule=R,r+=""+_+"if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Ni=X((Jp,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=E?"(new RegExp("+u+"))":e.usePattern(l);r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" !"+g+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { pattern: ",E?r+=""+u:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,E?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ci=X((Yp,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level,v="key"+n,S="idx"+n,T=u.dataLevel=e.dataLevel+1,P="data"+T,R="dataProperties"+n,I=Object.keys(l||{}).filter(re),N=e.schema.patternProperties||{},V=Object.keys(N).filter(re),q=e.schema.additionalProperties,D=I.length||V.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,j=e.opts.removeAdditional,A=U||M||j,C=e.opts.ownProperties,F=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var W=I;if(W)for(var H,me=-1,Re=W.length-1;me0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Me=e.util.getProperty(H),Te=m+Me,De=yr&&xe.default!==void 0;u.schema=xe,u.schemaPath=c+Me,u.errSchemaPath=d+"/"+e.util.escapeFragment(H),u.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),u.dataPathArr[T]=e.util.toQuotedString(H);var ie=e.validate(u);if(u.baseId=F,e.util.varOccurences(ie,P)<2){ie=e.util.varReplace(ie,P,Te);var Ae=Te}else{var Ae=P;r+=" var "+P+" = "+Te+"; "}if(De)r+=" "+ie+" ";else{if(J&&J[H]){r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ie=e.errorPath,lr=d,er=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,H,e.opts.jsonPointers)),d=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+er+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=lr,e.errorPath=Ie,r+=" } else { "}else p?(r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+Ae+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",g+="}")}}if(V.length){var Le=V;if(Le)for(var se,It=-1,xa=Le.length-1;It0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){u.schema=xe,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+R+" = "+R+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+R+".length; "+S+"++) { var "+v+" = "+R+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Te=m+"["+v+"]";u.dataPathArr[T]=v;var ie=e.validate(u);u.baseId=F,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Te)+" ":r+=" var "+P+" = "+Te+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",g+="}")}}}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var ki=X((eh,$i)=>{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level;if(r+="var "+E+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){u.schema=l,u.schemaPath=c,u.errSchemaPath=d;var v="key"+n,S="idx"+n,T="i"+n,P="' + "+v+" + '",R=u.dataLevel=e.dataLevel+1,I="data"+R,N="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+N+" = undefined; "),V?r+=" "+N+" = "+N+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+N+".length; "+S+"++) { var "+v+" = "+N+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var D=v,U=e.compositeRule;e.compositeRule=u.compositeRule=!0;var M=e.validate(u);u.baseId=q,e.util.varOccurences(M,I)<2?r+=" "+e.util.varReplace(M,I,D)+" ":r+=" var "+I+" = "+D+"; "+M+" ",e.compositeRule=u.compositeRule=U,r+=" if (!"+_+") { for (var "+T+"=startErrs"+n+"; "+T+"{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l;var _="schema"+n;if(!u)if(l.length0||I===!1:e.util.schemaHasRules(I,e.RULES.all))||(v[v.length]=T)}}else var v=l;if(u||v.length){var N=e.errorPath,V=u||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",V){u||(r+=" var "+_+" = validate.schema"+c+"; ");var D="i"+n,U="schema"+n+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,U,e.opts.jsonPointers)),r+=" var "+E+" = true; ",u&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=" for (var "+D+" = 0; "+D+" < "+_+".length; "+D+"++) { "+E+" = "+m+"["+_+"["+D+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+D+"]) "),r+="; if (!"+E+") break; } ",u&&(r+=" } "),r+=" if (!"+E+") { ";var j=j||[];j.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=j.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var F,D=-1,le=C.length-1;D{"use strict";Fi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;if(u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l,(l||u)&&e.opts.uniqueItems!==!1){u&&(r+=" var "+E+"; if ("+g+" === false || "+g+" === undefined) "+E+" = true; else if (typeof "+g+" != 'boolean') "+E+" = false; else { "),r+=" var i = "+m+".length , "+E+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+E+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var S="checkDataType"+(v?"s":"");r+=" if ("+e.util[S](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+E+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",u&&(r+=" } "),r+=" if (!"+E+") { ";var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",u?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;r=T.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Ui=X((ah,qi)=>{"use strict";qi.exports={$ref:Yn(),allOf:ri(),anyOf:ai(),$comment:ni(),const:oi(),contains:ci(),dependencies:di(),enum:pi(),format:mi(),if:gi(),items:_i(),maximum:os(),minimum:os(),maxItems:ls(),minItems:ls(),maxLength:cs(),minLength:cs(),maxProperties:us(),minProperties:us(),multipleOf:Ri(),not:Oi(),oneOf:Ii(),pattern:Ni(),properties:Ci(),propertyNames:ki(),required:ji(),uniqueItems:Mi(),validate:ns()}});var Hi=X((sh,Vi)=>{"use strict";var zi=Ui(),ds=Qr().toHash;Vi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=ds(t),e.types=ds(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var l;if(typeof i=="object"){var c=Object.keys(i)[0];l=i[c],i=c,l.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(i);var d=e.all[i]={keyword:i,code:zi[i],implements:l};return d}),e.all.$comment={keyword:"$comment",code:zi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ds(t.concat(s)),e.custom={},e}});var Xi=X((nh,Zi)=>{"use strict";var Bi=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Zi.exports=function(a,e){for(var t=0;t{"use strict";var Id=ta().MissingRef;Gi.exports=Qi;function Qi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var l=s._addSchema(a,void 0,e);return l.validate||i(l)});return t&&r.then(function(l){t(null,l)},t),r;function n(l){var c=l.$schema;return c&&!s.getSchema(c)?Qi.call(s,{$ref:c},!0):Promise.resolve()}function i(l){try{return s._compile(l)}catch(d){if(d instanceof Id)return c(d);throw d}function c(d){var p=d.missingSchema;if(u(p))throw new Error("Schema "+p+" is loaded but "+d.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(E,E)),m.then(function(g){if(!u(p))return n(g).then(function(){u(p)||s.addSchema(g,p,void 0,e)})}).then(function(){return i(l)});function E(){delete s._loadingSchemas[p]}function u(g){return s._refs[g]||s._schemas[g]}}}}});var Ji=X((oh,Wi)=>{"use strict";Wi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,E="data"+(i||""),u="valid"+n,g="errs__"+n,_=e.opts.$data&&l&&l.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=l;var S=this,T="definition"+n,P=S.definition,R="",I,N,V,q,D;if(_&&P.$data){D="keywordValidate"+n;var U=P.validateSchema;r+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+D+" = "+T+".validate;"}else{if(q=e.useCustomRule(S,l,e.schema,e),!q)return;v="validate.schema"+c,D=q.code,I=P.compile,N=P.inline,V=P.macro}var M=D+".errors",j="i"+n,A="ruleErr"+n,C=P.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||V||(r+=""+M+" = null;"),r+="var "+g+" = errors;var "+u+";",_&&P.$data&&(R+="}",r+=" if ("+v+" === undefined) { "+u+" = true; } else { ",U&&(R+="}",r+=" "+u+" = "+T+".validateSchema("+v+"); if ("+u+") { ")),N)P.statements?r+=" "+q.validate+" ":r+=" "+u+" = "+q.validate+"; ";else if(V){var F=e.util.copy(e),R="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var J=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,D);e.compositeRule=F.compositeRule=J,r+=" "+re}else{var W=W||[];W.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",I||P.schema===!1?r+=" , "+E+" ":r+=" , "+v+" , "+E+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",me=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Re=r;r=W.pop(),P.errors===!1?(r+=" "+u+" = ",C&&(r+="await "),r+=""+Re+"; "):C?(M="customErrors"+n,r+=" var "+M+" = null; try { "+u+" = await "+Re+"; } catch (e) { "+u+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+u+" = "+Re+"; "}if(P.modifying&&(r+=" if ("+H+") "+E+" = "+H+"["+me+"];"),r+=""+R,P.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",V?r+=""+le:r+=""+u):r+=" "+!P.valid+" ",r+=") { ",m=S.keyword;var W=W||[];W.push(r),r="";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ";var we=r;r=W.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=W.pop(),N?P.errors?P.errors!="full"&&(r+=" for (var "+j+"="+g+"; "+j+"{Ad.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var ro=X((ch,eo)=>{"use strict";var Yi=fs();eo.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Yi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Yi.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var ao=X((uh,to)=>{"use strict";var Nd=/^[a-z_$][a-z0-9_$-]*$/i,Dd=Ji(),Cd=ro();to.exports={add:$d,get:kd,remove:Ld,validate:ps};function $d(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Nd.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r{jd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var mo=X((fh,ho)=>{"use strict";var io=jn(),Gr=ra(),Fd=Mn(),oo=Ja(),Md=ss(),qd=Wn(),Ud=Hi(),lo=Xi(),co=Qr();ho.exports=ge;ge.prototype.validate=Vd;ge.prototype.compile=Hd;ge.prototype.addSchema=Bd;ge.prototype.addMetaSchema=Zd;ge.prototype.validateSchema=Xd;ge.prototype.getSchema=Gd;ge.prototype.removeSchema=Wd;ge.prototype.addFormat=nf;ge.prototype.errorsText=sf;ge.prototype._addSchema=Jd;ge.prototype._compile=Yd;ge.prototype.compileAsync=Ki();var ua=ao();ge.prototype.addKeyword=ua.add;ge.prototype.getKeyword=ua.get;ge.prototype.removeKeyword=ua.remove;ge.prototype.validateKeyword=ua.validate;var uo=ta();ge.ValidationError=uo.Validation;ge.MissingRefError=uo.MissingRef;ge.$dataMetaSchema=lo;var ca="http://json-schema.org/draft-07/schema",no=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],zd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=co.copy(a)||{},ff(this),this._schemas={},this._refs={},this._fragments={},this._formats=qd(a.format),this._cache=a.cache||new Fd,this._loadingSchemas={},this._compilations=[],this.RULES=Ud(),this._getId=ef(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Md),this._metaOpts=df(this),a.formats&&cf(this),a.keywords&&uf(this),of(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),lf(this)}function Vd(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Hd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Bd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rYl,DIRTY:()=>Dr,EMPTY_PATH:()=>Nl,INVALID:()=>B,NEVER:()=>jc,OK:()=>Oe,ParseStatus:()=>Pe,Schema:()=>K,ZodAny:()=>br,ZodArray:()=>vr,ZodBigInt:()=>$r,ZodBoolean:()=>kr,ZodBranded:()=>Et,ZodCatch:()=>Zr,ZodDate:()=>Lr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>kt,ZodEffects:()=>He,ZodEnum:()=>Vr,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>w,ZodFunction:()=>jt,ZodIntersection:()=>qr,ZodIssueCode:()=>O,ZodLazy:()=>Ur,ZodLiteral:()=>zr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>Qe,ZodNull:()=>Fr,ZodNullable:()=>nr,ZodNumber:()=>Cr,ZodObject:()=>$e,ZodOptional:()=>ze,ZodParsedType:()=>k,ZodPipeline:()=>bt,ZodPromise:()=>Sr,ZodReadonly:()=>Xr,ZodRecord:()=>Lt,ZodSchema:()=>K,ZodSet:()=>ut,ZodString:()=>Er,ZodSymbol:()=>ot,ZodTransformer:()=>He,ZodTuple:()=>sr,ZodType:()=>K,ZodUndefined:()=>jr,ZodUnion:()=>Mr,ZodUnknown:()=>mr,ZodVoid:()=>lt,addIssueToContext:()=>$,any:()=>lc,array:()=>fc,bigint:()=>ac,boolean:()=>Xs,coerce:()=>Lc,custom:()=>Hs,date:()=>sc,datetimeRegex:()=>zs,defaultErrorMap:()=>pr,discriminatedUnion:()=>vc,effect:()=>wc,enum:()=>Rc,function:()=>Sc,getErrorMap:()=>st,getParsedType:()=>ar,instanceof:()=>rc,intersection:()=>gc,isAborted:()=>Ct,isAsync:()=>nt,isDirty:()=>$t,isValid:()=>_r,late:()=>ec,lazy:()=>xc,literal:()=>Pc,makeIssue:()=>_t,map:()=>Ec,nan:()=>tc,nativeEnum:()=>Tc,never:()=>uc,null:()=>oc,nullable:()=>Ac,number:()=>Zs,object:()=>pc,objectUtil:()=>wa,oboolean:()=>kc,onumber:()=>$c,optional:()=>Ic,ostring:()=>Cc,pipeline:()=>Dc,preprocess:()=>Nc,promise:()=>Oc,quotelessJson:()=>wl,record:()=>_c,set:()=>bc,setErrorMap:()=>Al,strictObject:()=>hc,string:()=>Bs,symbol:()=>nc,transformer:()=>wc,tuple:()=>yc,undefined:()=>ic,union:()=>mc,unknown:()=>cc,util:()=>Y,void:()=>dc});var Y;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(l=>typeof r[r[l]]!="number"),i={};for(let l of n)i[l]=r[l];return a.objectValues(i)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Y||(Y={}));var wa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(wa||(wa={}));var k=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=a=>{switch(typeof a){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(a)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(a)?k.array:a===null?k.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?k.promise:typeof Map<"u"&&a instanceof Map?k.map:typeof Set<"u"&&a instanceof Set?k.set:typeof Date<"u"&&a instanceof Date?k.date:k.object;default:return k.unknown}};var O=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let l=s,c=0;for(;ct.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=a=>new Ce(a);var Il=(a,e)=>{let t;switch(a.code){case O.invalid_type:a.received===k.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case O.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,Y.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(a.keys,", ")}`;break;case O.invalid_union:t="Invalid input";break;case O.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(a.options)}`;break;case O.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(a.options)}, received '${a.received}'`;break;case O.invalid_arguments:t="Invalid function arguments";break;case O.invalid_return_type:t="Invalid function return type";break;case O.invalid_date:t="Invalid date";break;case O.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:Y.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case O.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case O.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case O.custom:t="Invalid input";break;case O.invalid_intersection_types:t="Intersection results could not be merged";break;case O.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case O.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(a)}return{message:t}},pr=Il;var js=pr;function Al(a){js=a}function st(){return js}var _t=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let l="",c=s.filter(d=>!!d).slice().reverse();for(let d of c)l=d(i,{data:e,defaultError:l}).message;return{...r,path:n,message:l}},Nl=[];function $(a,e){let t=st(),s=_t({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Pe=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return B;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Dr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),Ct=a=>a.status==="aborted",$t=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var z;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Ve=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fs=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,l)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??s??l.defaultError}:i.code!=="invalid_type"?{message:l.defaultError}:{message:c??t??l.defaultError}},description:r}}var K=class{get description(){return this._def.description}_getType(e){return ar(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pe,ctx:{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Fs(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>_r(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Fs(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let i=e(r),l=()=>n.addIssue({code:O.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(l(),!1)):i?!0:(l(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new He({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ze.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Mr.create([this,e],this._def)}and(e){return qr.create(this,e,this._def)}transform(e){return new He({...Q(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...Q(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Et({typeName:w.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bt.create(this,e)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dl=/^c[^\s-]{8,}$/i,Cl=/^[0-9a-z]+$/,$l=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ll=/^[a-z0-9_-]{21}$/i,jl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ml=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ql="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ia,Ul=/^(?:(?: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])$/,zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Vl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Hl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qs="((\\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])))",Xl=new RegExp(`^${qs}$`);function Us(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ql(a){return new RegExp(`^${Us(a)}$`)}function zs(a){let e=`${qs}T${Us(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Gl(a,e){return!!((e==="v4"||!e)&&Ul.test(a)||(e==="v6"||!e)&&Vl.test(a))}function Kl(a,e){if(!jl.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Wl(a,e){return!!((e==="v4"||!e)&&zl.test(a)||(e==="v6"||!e)&&Hl.test(a))}var Er=class a extends K{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.string,received:n.parsedType}),B}let s=new Pe,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:O.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,l=e.data.lengthe.test(r),{validation:t,code:O.invalid_string,...z.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Er({checks:[],typeName:w.ZodString,coerce:a?.coerce??!1,...Q(a)});function Jl(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Cr=class a extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.number,received:n.parsedType}),B}let s,r=new Pe;for(let n of this._def.checks)n.kind==="int"?Y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:O.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Jl(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:O.not_finite,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew Cr({checks:[],typeName:w.ZodNumber,coerce:a?.coerce||!1,...Q(a)});var $r=class a extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==k.bigint)return this._getInvalidInput(e);let s,r=new Pe;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return $(t,{code:O.invalid_type,expected:k.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew $r({checks:[],typeName:w.ZodBigInt,coerce:a?.coerce??!1,...Q(a)});var kr=class extends K{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.boolean,received:s.parsedType}),B}return Oe(e.data)}};kr.create=a=>new kr({typeName:w.ZodBoolean,coerce:a?.coerce||!1,...Q(a)});var Lr=class a extends K{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_date}),B}let s=new Pe,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:O.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Y.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Lr({checks:[],coerce:a?.coerce||!1,typeName:w.ZodDate,...Q(a)});var ot=class extends K{_parse(e){if(this._getType(e)!==k.symbol){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.symbol,received:s.parsedType}),B}return Oe(e.data)}};ot.create=a=>new ot({typeName:w.ZodSymbol,...Q(a)});var jr=class extends K{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.undefined,received:s.parsedType}),B}return Oe(e.data)}};jr.create=a=>new jr({typeName:w.ZodUndefined,...Q(a)});var Fr=class extends K{_parse(e){if(this._getType(e)!==k.null){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.null,received:s.parsedType}),B}return Oe(e.data)}};Fr.create=a=>new Fr({typeName:w.ZodNull,...Q(a)});var br=class extends K{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};br.create=a=>new br({typeName:w.ZodAny,...Q(a)});var mr=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};mr.create=a=>new mr({typeName:w.ZodUnknown,...Q(a)});var Qe=class extends K{_parse(e){let t=this._getOrReturnCtx(e);return $(t,{code:O.invalid_type,expected:k.never,received:t.parsedType}),B}};Qe.create=a=>new Qe({typeName:w.ZodNever,...Q(a)});var lt=class extends K{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.void,received:s.parsedType}),B}return Oe(e.data)}};lt.create=a=>new lt({typeName:w.ZodVoid,...Q(a)});var vr=class a extends K{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==k.array)return $(t,{code:O.invalid_type,expected:k.array,received:t.parsedType}),B;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,l=t.data.lengthr.maxLength.value&&($(t,{code:O.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,l)=>r.type._parseAsync(new Ve(t,i,t.path,l)))).then(i=>Pe.mergeArray(s,i));let n=[...t.data].map((i,l)=>r.type._parseSync(new Ve(t,i,t.path,l)));return Pe.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}};vr.create=(a,e)=>new vr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...Q(e)});function it(a){if(a instanceof $e){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=ze.create(it(s))}return new $e({...a._def,shape:()=>e})}else return a instanceof vr?new vr({...a._def,type:it(a.element)}):a instanceof ze?ze.create(it(a.unwrap())):a instanceof nr?nr.create(it(a.unwrap())):a instanceof sr?sr.create(a.items.map(e=>it(e))):a}var $e=class a extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==k.object){let d=this._getOrReturnCtx(e);return $(d,{code:O.invalid_type,expected:k.object,received:d.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),l=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(let d in r.data)i.includes(d)||l.push(d);let c=[];for(let d of i){let p=n[d],m=r.data[d];c.push({key:{status:"valid",value:d},value:p._parse(new Ve(r,m,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof Qe){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of l)c.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(d==="strict")l.length>0&&($(r,{code:O.unrecognized_keys,keys:l}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of l){let m=r.data[p];c.push({key:{status:"valid",value:p},value:d._parse(new Ve(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of c){let m=await p.key,E=await p.value;d.push({key:m,value:E,alwaysSet:p.alwaysSet})}return d}).then(d=>Pe.mergeObjectSync(s,d)):Pe.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:z.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of Y.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of Y.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of Y.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of Y.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Vs(Y.objectKeys(this.shape))}};$e.create=(a,e)=>new $e({shape:()=>a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.strictCreate=(a,e)=>new $e({shape:()=>a,unknownKeys:"strict",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.lazycreate=(a,e)=>new $e({shape:a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});var Mr=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let l of n)if(l.result.status==="valid")return l.result;for(let l of n)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let i=n.map(l=>new Ce(l.ctx.common.issues));return $(t,{code:O.invalid_union,unionErrors:i}),B}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let d={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let l=i.map(c=>new Ce(c));return $(t,{code:O.invalid_union,unionErrors:l}),B}}get options(){return this._def.options}};Mr.create=(a,e)=>new Mr({options:a,typeName:w.ZodUnion,...Q(e)});var hr=a=>a instanceof Ur?hr(a.schema):a instanceof He?hr(a.innerType()):a instanceof zr?[a.value]:a instanceof Vr?a.options:a instanceof Hr?Y.objectValues(a.enum):a instanceof Br?hr(a._def.innerType):a instanceof jr?[void 0]:a instanceof Fr?[null]:a instanceof ze?[void 0,...hr(a.unwrap())]:a instanceof nr?[null,...hr(a.unwrap())]:a instanceof Et||a instanceof Xr?hr(a.unwrap()):a instanceof Zr?hr(a._def.innerType):[],kt=class a extends K{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.object)return $(t,{code:O.invalid_type,expected:k.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):($(t,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=hr(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of i){if(r.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);r.set(l,n)}}return new a({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function Aa(a,e){let t=ar(a),s=ar(e);if(a===e)return{valid:!0,data:a};if(t===k.object&&s===k.object){let r=Y.objectKeys(e),n=Y.objectKeys(a).filter(l=>r.indexOf(l)!==-1),i={...a,...e};for(let l of n){let c=Aa(a[l],e[l]);if(!c.valid)return{valid:!1};i[l]=c.data}return{valid:!0,data:i}}else if(t===k.array&&s===k.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(Ct(n)||Ct(i))return B;let l=Aa(n.value,i.value);return l.valid?(($t(n)||$t(i))&&t.dirty(),{status:t.value,value:l.data}):($(s,{code:O.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};qr.create=(a,e,t)=>new qr({left:a,right:e,typeName:w.ZodIntersection,...Q(t)});var sr=class a extends K{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.array)return $(s,{code:O.invalid_type,expected:k.array,received:s.parsedType}),B;if(s.data.lengththis._def.items.length&&($(s,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new Ve(s,i,s.path,l)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Pe.mergeArray(t,i)):Pe.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};sr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sr({items:a,typeName:w.ZodTuple,rest:null,...Q(e)})};var Lt=class a extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.object)return $(s,{code:O.invalid_type,expected:k.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,i=this._def.valueType;for(let l in s.data)r.push({key:n._parse(new Ve(s,l,s.path,l)),value:i._parse(new Ve(s,s.data[l],s.path,l)),alwaysSet:l in s.data});return s.common.async?Pe.mergeObjectAsync(t,r):Pe.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof K?new a({keyType:e,valueType:t,typeName:w.ZodRecord,...Q(s)}):new a({keyType:Er.create(),valueType:e,typeName:w.ZodRecord,...Q(t)})}},ct=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.map)return $(s,{code:O.invalid_type,expected:k.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([l,c],d)=>({key:r._parse(new Ve(s,l,s.path,[d,"key"])),value:n._parse(new Ve(s,c,s.path,[d,"value"]))}));if(s.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of i){let d=await c.key,p=await c.value;if(d.status==="aborted"||p.status==="aborted")return B;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),l.set(d.value,p.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let c of i){let d=c.key,p=c.value;if(d.status==="aborted"||p.status==="aborted")return B;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),l.set(d.value,p.value)}return{status:t.value,value:l}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:w.ZodMap,...Q(t)});var ut=class a extends K{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.set)return $(s,{code:O.invalid_type,expected:k.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&($(s,{code:O.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let d=new Set;for(let p of c){if(p.status==="aborted")return B;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}let l=[...s.data.values()].map((c,d)=>n._parse(new Ve(s,c,s.path,d)));return s.common.async?Promise.all(l).then(c=>i(c)):i(l)}min(e,t){return new a({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:w.ZodSet,...Q(e)});var jt=class a extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.function)return $(t,{code:O.invalid_type,expected:k.function,received:t.parsedType}),B;function s(l,c){return _t({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(d=>!!d),issueData:{code:O.invalid_arguments,argumentsError:c}})}function r(l,c){return _t({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(d=>!!d),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Sr){let l=this;return Oe(async function(...c){let d=new Ce([]),p=await l._def.args.parseAsync(c,n).catch(u=>{throw d.addIssue(s(c,u)),d}),m=await Reflect.apply(i,this,p);return await l._def.returns._def.type.parseAsync(m,n).catch(u=>{throw d.addIssue(r(m,u)),d})})}else{let l=this;return Oe(function(...c){let d=l._def.args.safeParse(c,n);if(!d.success)throw new Ce([s(c,d.error)]);let p=Reflect.apply(i,this,d.data),m=l._def.returns.safeParse(p,n);if(!m.success)throw new Ce([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:sr.create(e).rest(mr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||sr.create([]).rest(mr.create()),returns:t||mr.create(),typeName:w.ZodFunction,...Q(s)})}},Ur=class extends K{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:w.ZodLazy,...Q(e)});var zr=class extends K{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $(t,{received:t.data,code:O.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};zr.create=(a,e)=>new zr({value:a,typeName:w.ZodLiteral,...Q(e)});function Vs(a,e){return new Vr({values:a,typeName:w.ZodEnum,...Q(e)})}var Vr=class a extends K{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{expected:Y.joinValues(s),received:t.parsedType,code:O.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{received:t.data,code:O.invalid_enum_value,options:s}),B}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Vr.create=Vs;var Hr=class extends K{_parse(e){let t=Y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==k.string&&s.parsedType!==k.number){let r=Y.objectValues(t);return $(s,{expected:Y.joinValues(r),received:s.parsedType,code:O.invalid_type}),B}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Y.objectValues(t);return $(s,{received:s.data,code:O.invalid_enum_value,options:r}),B}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:w.ZodNativeEnum,...Q(e)});var Sr=class extends K{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.promise&&t.common.async===!1)return $(t,{code:O.invalid_type,expected:k.promise,received:t.parsedType}),B;let s=t.parsedType===k.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Sr.create=(a,e)=>new Sr({type:a,typeName:w.ZodPromise,...Q(e)});var He=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{$(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async l=>{if(t.value==="aborted")return B;let c=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return c.status==="aborted"?B:c.status==="dirty"?Dr(c.value):t.value==="dirty"?Dr(c.value):c});{if(t.value==="aborted")return B;let l=this._def.schema._parseSync({data:i,path:s.path,parent:s});return l.status==="aborted"?B:l.status==="dirty"?Dr(l.value):t.value==="dirty"?Dr(l.value):l}}if(r.type==="refinement"){let i=l=>{let c=r.refinement(l,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),i(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),i(l.value).then(()=>({status:t.value,value:l.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(i))return B;let l=r.transform(i.value,n);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>_r(i)?Promise.resolve(r.transform(i.value,n)).then(l=>({status:t.value,value:l})):B);Y.assertNever(r)}};He.create=(a,e,t)=>new He({schema:a,typeName:w.ZodEffects,effect:e,...Q(t)});He.createWithPreprocess=(a,e,t)=>new He({schema:e,effect:{type:"preprocess",transform:a},typeName:w.ZodEffects,...Q(t)});var ze=class extends K{_parse(e){return this._getType(e)===k.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(a,e)=>new ze({innerType:a,typeName:w.ZodOptional,...Q(e)});var nr=class extends K{_parse(e){return this._getType(e)===k.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(a,e)=>new nr({innerType:a,typeName:w.ZodNullable,...Q(e)});var Br=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===k.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Zr=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Zr.create=(a,e)=>new Zr({innerType:a,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var dt=class extends K{_parse(e){if(this._getType(e)!==k.nan){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:w.ZodNaN,...Q(a)});var Yl=Symbol("zod_brand"),Et=class extends K{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},bt=class a extends K{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Dr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:w.ZodPipeline})}},Xr=class extends K{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:w.ZodReadonly,...Q(e)});function Ms(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Hs(a,e={},t){return a?br.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let l=Ms(e,s),c=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:c})}});if(!n){let i=Ms(e,s),l=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:l})}}):br.create()}var ec={object:$e.lazycreate},w;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(w||(w={}));var rc=(a,e={message:`Input not instance of ${a.name}`})=>Hs(t=>t instanceof a,e),Bs=Er.create,Zs=Cr.create,tc=dt.create,ac=$r.create,Xs=kr.create,sc=Lr.create,nc=ot.create,ic=jr.create,oc=Fr.create,lc=br.create,cc=mr.create,uc=Qe.create,dc=lt.create,fc=vr.create,pc=$e.create,hc=$e.strictCreate,mc=Mr.create,vc=kt.create,gc=qr.create,yc=sr.create,_c=Lt.create,Ec=ct.create,bc=ut.create,Sc=jt.create,xc=Ur.create,Pc=zr.create,Rc=Vr.create,Tc=Hr.create,Oc=Sr.create,wc=He.create,Ic=ze.create,Ac=nr.create,Nc=He.createWithPreprocess,Dc=bt.create,Cc=()=>Bs().optional(),$c=()=>Zs().optional(),kc=()=>Xs().optional(),Lc={string:a=>Er.create({...a,coerce:!0}),number:a=>Cr.create({...a,coerce:!0}),boolean:a=>kr.create({...a,coerce:!0}),bigint:a=>$r.create({...a,coerce:!0}),date:a=>Lr.create({...a,coerce:!0})};var jc=B;var Na="2025-06-18";var Qs=[Na,"2025-03-26","2024-11-05","2024-10-07"],Ft="2.0",Gs=o.union([o.string(),o.number().int()]),Ks=o.string(),Fc=o.object({progressToken:o.optional(Gs)}).passthrough(),Be=o.object({_meta:o.optional(Fc)}).passthrough(),ke=o.object({method:o.string(),params:o.optional(Be)}),St=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),ir=o.object({method:o.string(),params:o.optional(St)}),Ze=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),Mt=o.union([o.string(),o.number().int()]),Ws=o.object({jsonrpc:o.literal(Ft),id:Mt}).merge(ke).strict(),Js=a=>Ws.safeParse(a).success,Ys=o.object({jsonrpc:o.literal(Ft)}).merge(ir).strict(),en=a=>Ys.safeParse(a).success,rn=o.object({jsonrpc:o.literal(Ft),id:Mt,result:Ze}).strict(),Da=a=>rn.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var tn=o.object({jsonrpc:o.literal(Ft),id:Mt,error:o.object({code:o.number().int(),message:o.string(),data:o.optional(o.unknown())})}).strict(),an=a=>tn.safeParse(a).success,sn=o.union([Ws,Ys,rn,tn]),qt=Ze.strict(),Ut=ir.extend({method:o.literal("notifications/cancelled"),params:St.extend({requestId:Mt,reason:o.string().optional()})}),Mc=o.object({src:o.string(),mimeType:o.optional(o.string()),sizes:o.optional(o.array(o.string()))}).passthrough(),xt=o.object({icons:o.array(Mc).optional()}).passthrough(),Pt=o.object({name:o.string(),title:o.optional(o.string())}).passthrough(),nn=Pt.extend({version:o.string(),websiteUrl:o.optional(o.string())}).merge(xt),qc=o.object({experimental:o.optional(o.object({}).passthrough()),sampling:o.optional(o.object({}).passthrough()),elicitation:o.optional(o.object({}).passthrough()),roots:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),Ca=ke.extend({method:o.literal("initialize"),params:Be.extend({protocolVersion:o.string(),capabilities:qc,clientInfo:nn})});var Uc=o.object({experimental:o.optional(o.object({}).passthrough()),logging:o.optional(o.object({}).passthrough()),completions:o.optional(o.object({}).passthrough()),prompts:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough()),resources:o.optional(o.object({subscribe:o.optional(o.boolean()),listChanged:o.optional(o.boolean())}).passthrough()),tools:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),zc=Ze.extend({protocolVersion:o.string(),capabilities:Uc,serverInfo:nn,instructions:o.optional(o.string())}),$a=ir.extend({method:o.literal("notifications/initialized")});var zt=ke.extend({method:o.literal("ping")}),Vc=o.object({progress:o.number(),total:o.optional(o.number()),message:o.optional(o.string())}).passthrough(),Vt=ir.extend({method:o.literal("notifications/progress"),params:St.merge(Vc).extend({progressToken:Gs})}),Ht=ke.extend({params:Be.extend({cursor:o.optional(Ks)}).optional()}),Bt=Ze.extend({nextCursor:o.optional(Ks)}),on=o.object({uri:o.string(),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ln=on.extend({text:o.string()}),ka=o.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),cn=on.extend({blob:ka}),un=Pt.extend({uri:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Hc=Pt.extend({uriTemplate:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Bc=Ht.extend({method:o.literal("resources/list")}),Zc=Bt.extend({resources:o.array(un)}),Xc=Ht.extend({method:o.literal("resources/templates/list")}),Qc=Bt.extend({resourceTemplates:o.array(Hc)}),Gc=ke.extend({method:o.literal("resources/read"),params:Be.extend({uri:o.string()})}),Kc=Ze.extend({contents:o.array(o.union([ln,cn]))}),Wc=ir.extend({method:o.literal("notifications/resources/list_changed")}),Jc=ke.extend({method:o.literal("resources/subscribe"),params:Be.extend({uri:o.string()})}),Yc=ke.extend({method:o.literal("resources/unsubscribe"),params:Be.extend({uri:o.string()})}),eu=ir.extend({method:o.literal("notifications/resources/updated"),params:St.extend({uri:o.string()})}),ru=o.object({name:o.string(),description:o.optional(o.string()),required:o.optional(o.boolean())}).passthrough(),tu=Pt.extend({description:o.optional(o.string()),arguments:o.optional(o.array(ru)),_meta:o.optional(o.object({}).passthrough())}).merge(xt),au=Ht.extend({method:o.literal("prompts/list")}),su=Bt.extend({prompts:o.array(tu)}),nu=ke.extend({method:o.literal("prompts/get"),params:Be.extend({name:o.string(),arguments:o.optional(o.record(o.string()))})}),La=o.object({type:o.literal("text"),text:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ja=o.object({type:o.literal("image"),data:ka,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),Fa=o.object({type:o.literal("audio"),data:ka,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),iu=o.object({type:o.literal("resource"),resource:o.union([ln,cn]),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ou=un.extend({type:o.literal("resource_link")}),dn=o.union([La,ja,Fa,ou,iu]),lu=o.object({role:o.enum(["user","assistant"]),content:dn}).passthrough(),cu=Ze.extend({description:o.optional(o.string()),messages:o.array(lu)}),uu=ir.extend({method:o.literal("notifications/prompts/list_changed")}),du=o.object({title:o.optional(o.string()),readOnlyHint:o.optional(o.boolean()),destructiveHint:o.optional(o.boolean()),idempotentHint:o.optional(o.boolean()),openWorldHint:o.optional(o.boolean())}).passthrough(),fu=Pt.extend({description:o.optional(o.string()),inputSchema:o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough(),outputSchema:o.optional(o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough()),annotations:o.optional(du),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Ma=Ht.extend({method:o.literal("tools/list")}),pu=Bt.extend({tools:o.array(fu)}),fn=Ze.extend({content:o.array(dn).default([]),structuredContent:o.object({}).passthrough().optional(),isError:o.optional(o.boolean())}),fp=fn.or(Ze.extend({toolResult:o.unknown()})),qa=ke.extend({method:o.literal("tools/call"),params:Be.extend({name:o.string(),arguments:o.optional(o.record(o.unknown()))})}),hu=ir.extend({method:o.literal("notifications/tools/list_changed")}),Rt=o.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Ua=ke.extend({method:o.literal("logging/setLevel"),params:Be.extend({level:Rt})}),mu=ir.extend({method:o.literal("notifications/message"),params:St.extend({level:Rt,logger:o.optional(o.string()),data:o.unknown()})}),vu=o.object({name:o.string().optional()}).passthrough(),gu=o.object({hints:o.optional(o.array(vu)),costPriority:o.optional(o.number().min(0).max(1)),speedPriority:o.optional(o.number().min(0).max(1)),intelligencePriority:o.optional(o.number().min(0).max(1))}).passthrough(),yu=o.object({role:o.enum(["user","assistant"]),content:o.union([La,ja,Fa])}).passthrough(),_u=ke.extend({method:o.literal("sampling/createMessage"),params:Be.extend({messages:o.array(yu),systemPrompt:o.optional(o.string()),includeContext:o.optional(o.enum(["none","thisServer","allServers"])),temperature:o.optional(o.number()),maxTokens:o.number().int(),stopSequences:o.optional(o.array(o.string())),metadata:o.optional(o.object({}).passthrough()),modelPreferences:o.optional(gu)})}),za=Ze.extend({model:o.string(),stopReason:o.optional(o.enum(["endTurn","stopSequence","maxTokens"]).or(o.string())),role:o.enum(["user","assistant"]),content:o.discriminatedUnion("type",[La,ja,Fa])}),Eu=o.object({type:o.literal("boolean"),title:o.optional(o.string()),description:o.optional(o.string()),default:o.optional(o.boolean())}).passthrough(),bu=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),minLength:o.optional(o.number()),maxLength:o.optional(o.number()),format:o.optional(o.enum(["email","uri","date","date-time"]))}).passthrough(),Su=o.object({type:o.enum(["number","integer"]),title:o.optional(o.string()),description:o.optional(o.string()),minimum:o.optional(o.number()),maximum:o.optional(o.number())}).passthrough(),xu=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),enum:o.array(o.string()),enumNames:o.optional(o.array(o.string()))}).passthrough(),Pu=o.union([Eu,bu,Su,xu]),Ru=ke.extend({method:o.literal("elicitation/create"),params:Be.extend({message:o.string(),requestedSchema:o.object({type:o.literal("object"),properties:o.record(o.string(),Pu),required:o.optional(o.array(o.string()))}).passthrough()})}),Va=Ze.extend({action:o.enum(["accept","decline","cancel"]),content:o.optional(o.record(o.string(),o.unknown()))}),Tu=o.object({type:o.literal("ref/resource"),uri:o.string()}).passthrough();var Ou=o.object({type:o.literal("ref/prompt"),name:o.string()}).passthrough(),wu=ke.extend({method:o.literal("completion/complete"),params:Be.extend({ref:o.union([Ou,Tu]),argument:o.object({name:o.string(),value:o.string()}).passthrough(),context:o.optional(o.object({arguments:o.optional(o.record(o.string(),o.string()))}))})}),Iu=Ze.extend({completion:o.object({values:o.array(o.string()).max(100),total:o.optional(o.number().int()),hasMore:o.optional(o.boolean())}).passthrough()}),Au=o.object({uri:o.string().startsWith("file://"),name:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),Nu=ke.extend({method:o.literal("roots/list")}),Ha=Ze.extend({roots:o.array(Au)}),Du=ir.extend({method:o.literal("notifications/roots/list_changed")}),pp=o.union([zt,Ca,wu,Ua,nu,au,Bc,Xc,Gc,Jc,Yc,qa,Ma]),hp=o.union([Ut,Vt,$a,Du]),mp=o.union([qt,za,Va,Ha]),vp=o.union([zt,_u,Ru,Nu]),gp=o.union([Ut,Vt,mu,eu,Wc,hu,uu]),yp=o.union([qt,zc,Iu,cu,su,Zc,Qc,Kc,fn,pu]),Ke=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Cu=6e4,Zt=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Ut,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Vt,t=>{this._onprogress(t)}),this.setRequestHandler(zt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ke(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let l=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,d)=>{l?.(c,d),Da(c)||an(c)?this._onresponse(c):Js(c)?this._onrequest(c,d):en(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Ke(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:d=>this.notification(d,{relatedRequestId:e.id}),sendRequest:(d,p,m)=>this.request(d,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(d=>{if(!l.signal.aborted)return i?.send({result:d,jsonrpc:"2.0",id:e.id})},d=>{var p;if(!l.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:Ge.InternalError,message:(p=d.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),l=this._timeoutInfo.get(r);if(l&&i&&l.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Da(e))s(e);else{let r=new Ke(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((l,c)=>{var d,p,m,E,u,g;if(!this._transport){c(new Error("Not connected"));return}((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let _=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),v.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});let S=R=>{var I;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(I=this._transport)===null||I===void 0||I.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(R)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(R)};this._responseHandlers.set(_,R=>{var I;if(!(!((I=s?.signal)===null||I===void 0)&&I.aborted)){if(R instanceof Error)return c(R);try{let N=t.parse(R.result);l(N)}catch(N){c(N)}}}),(E=s?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var R;S((R=s?.signal)===null||R===void 0?void 0:R.reason)});let T=(u=s?.timeout)!==null&&u!==void 0?u:Cu,P=()=>S(new Ke(Ge.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(_,T,s?.maxTotalTimeout,P,(g=s?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(R=>{this._cleanupTimeout(_),c(R)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let d={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(d,t).catch(p=>this._onerror(p))});return}let l={...e,jsonrpc:"2.0"};await this._transport.send(l,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function pn(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var vo=Ol(mo(),1),da=class extends Zt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Rt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler($a,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ua,async(r,n)=>{var i;let l=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,d=Rt.safeParse(c);return d.success&&this._loggingLevels.set(l,d.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=pn(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Qs.includes(t)?t:Na,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},qt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},za,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Va,t);if(s.action==="accept"&&s.content)try{let r=new vo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ke(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ke?r:new Ke(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ha,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import yo from"node:process";var fa=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` +var El=Object.create;var Oa=Object.defineProperty;var bl=Object.getOwnPropertyDescriptor;var Sl=Object.getOwnPropertyNames;var xl=Object.getPrototypeOf,Rl=Object.prototype.hasOwnProperty;var X=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Pl=(a,e)=>{for(var t in e)Oa(a,t,{get:e[t],enumerable:!0})},Tl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Sl(e))!Rl.call(a,r)&&r!==t&&Oa(a,r,{get:()=>e[r],enumerable:!(s=bl(e,r))||s.enumerable});return a};var Ol=(a,e,t)=>(t=a!=null?El(xl(a)):{},Tl(e||!a||!a.__esModule?Oa(t,"default",{value:a,enumerable:!0}):t,a));var mn=X((Xt,hn)=>{(function(a,e){typeof Xt=="object"&&typeof hn<"u"?e(Xt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Xt,function(a){"use strict";function e(){for(var h=arguments.length,f=Array(h),y=0;y1){f[0]=f[0].slice(0,-1);for(var b=f.length-1,x=1;x= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=u-g,U=Math.floor,M=String.fromCharCode;function j(h){throw new RangeError(q[h])}function I(h,f){for(var y=[],b=h.length;b--;)y[b]=f(h[b]);return y}function C(h,f){var y=h.split("@"),b="";y.length>1&&(b=y[0]+"@",h=y[1]),h=h.replace(V,".");var x=h.split("."),L=I(x,f).join(".");return b+L}function F(h){for(var f=[],y=0,b=h.length;y=55296&&x<=56319&&y>1,f+=U(f/y);f>D*_>>1;x+=u)f=U(f/D);return U(x+(D+1)*f/(f+v))},H=function(f){var y=[],b=f.length,x=0,L=R,G=O,ae=f.lastIndexOf(T);ae<0&&(ae=0);for(var oe=0;oe=128&&j("not-basic"),y.push(f.charCodeAt(oe));for(var Ee=ae>0?ae+1:0;Ee=b&&j("invalid-input");var de=J(f.charCodeAt(Ee++));(de>=u||de>U((E-x)/pe))&&j("overflow"),x+=de*pe;var ne=be<=G?g:be>=G+_?_:be-G;if(deU(E/he)&&j("overflow"),pe*=he}var ce=y.length+1;G=K(x-te,ce,te==0),U(x/ce)>E-L&&j("overflow"),L+=U(x/ce),x%=ce,y.splice(x++,0,L)}return String.fromCodePoint.apply(String,y)},me=function(f){var y=[];f=F(f);var b=f.length,x=R,L=0,G=O,ae=!0,oe=!1,Ee=void 0;try{for(var te=f[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var be=pe.value;be<128&&y.push(M(be))}}catch(Nr){oe=!0,Ee=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw Ee}}var de=y.length,ne=de;for(de&&y.push(T);ne=x&&FeU((E-L)/Ue)&&j("overflow"),L+=(he-x)*Ue,x=he;var tr=!0,Ar=!1,ur=void 0;try{for(var ht=f[Symbol.iterator](),At;!(tr=(At=ht.next()).done);tr=!0){var Nt=At.value;if(NtE&&j("overflow"),Nt==x){for(var Jr=L,Yr=u;;Yr+=u){var dr=Yr<=G?g:Yr>=G+_?_:Yr-G;if(Jr>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():y="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),y}function Ie(h){for(var f="",y=0,b=h.length;y=194&&x<224){if(b-y>=6){var L=parseInt(h.substr(y+4,2),16);f+=String.fromCharCode((x&31)<<6|L&63)}else f+=h.substr(y,6);y+=6}else if(x>=224){if(b-y>=9){var G=parseInt(h.substr(y+4,2),16),ae=parseInt(h.substr(y+7,2),16);f+=String.fromCharCode((x&15)<<12|(G&63)<<6|ae&63)}else f+=h.substr(y,9);y+=9}else f+=h.substr(y,3),y+=3}return f}function gr(h,f){function y(b){var x=Ie(b);return x.match(f.UNRESERVED)?x:b}return h.scheme&&(h.scheme=String(h.scheme).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(f.PCT_ENCODED,y).replace(f.NOT_USERINFO,Se).replace(f.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_HOST,Se).replace(f.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(f.PCT_ENCODED,y).replace(h.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,Se).replace(f.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(f.PCT_ENCODED,y).replace(f.NOT_QUERY,Se).replace(f.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(f.PCT_ENCODED,y).replace(f.NOT_FRAGMENT,Se).replace(f.PCT_ENCODED,r)),h}function lr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,f){var y=h.match(f.IPV4ADDRESS)||[],b=p(y,2),x=b[1];return x?x.split(".").map(lr).join("."):h}function ve(h,f){var y=h.match(f.IPV6ADDRESS)||[],b=p(y,3),x=b[1],L=b[2];if(x){for(var G=x.toLowerCase().split("::").reverse(),ae=p(G,2),oe=ae[0],Ee=ae[1],te=Ee?Ee.split(":").map(lr):[],pe=oe.split(":").map(lr),be=f.IPV4ADDRESS.test(pe[pe.length-1]),de=be?7:8,ne=pe.length-de,he=Array(de),ce=0;ce1){var ue=he.slice(0,je.index),Fe=he.slice(je.index+je.length);qe=ue.join(":")+"::"+Fe.join(":")}else qe=he.join(":");return L&&(qe+="%"+L),qe}else return h}var Tr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Te="".match(/(){0}/)[1]===void 0;function ie(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},b=f.iri!==!1?d:c;f.reference==="suffix"&&(h=(f.scheme?f.scheme+":":"")+"//"+h);var x=h.match(Tr);if(x){Te?(y.scheme=x[1],y.userinfo=x[3],y.host=x[4],y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=x[7],y.fragment=x[8],isNaN(y.port)&&(y.port=x[5])):(y.scheme=x[1]||void 0,y.userinfo=h.indexOf("@")!==-1?x[3]:void 0,y.host=h.indexOf("//")!==-1?x[4]:void 0,y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=h.indexOf("?")!==-1?x[7]:void 0,y.fragment=h.indexOf("#")!==-1?x[8]:void 0,isNaN(y.port)&&(y.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?x[4]:void 0)),y.host&&(y.host=ve(_e(y.host,b),b)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==y.reference&&(y.error=y.error||"URI is not a "+f.reference+" reference.");var L=ye[(f.scheme||y.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!L||!L.unicodeSupport)){if(y.host&&(f.domainHost||L&&L.domainHost))try{y.host=se.toASCII(y.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(G){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+G}gr(y,c)}else gr(y,b);L&&L.parse&&L.parse(y,f)}else y.error=y.error||"URI can not be parsed.";return y}function yr(h,f){var y=f.iri!==!1?d:c,b=[];return h.userinfo!==void 0&&(b.push(h.userinfo),b.push("@")),h.host!==void 0&&b.push(ve(_e(String(h.host),y),y).replace(y.IPV6ADDRESS,function(x,L,G){return"["+L+(G?"%25"+G:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(b.push(":"),b.push(String(h.port))),b.length?b.join(""):void 0}var cr=/^\.\.?\//,Or=/^\/\.(\/|$)/,wr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(h){for(var f=[];h.length;)if(h.match(cr))h=h.replace(cr,"");else if(h.match(Or))h=h.replace(Or,"/");else if(h.match(wr))h=h.replace(wr,"/"),f.pop();else if(h==="."||h==="..")h="";else{var y=h.match(xe);if(y){var b=y[0];h=h.slice(b.length),f.push(b)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function De(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=f.iri?d:c,b=[],x=ye[(f.scheme||h.scheme||"").toLowerCase()];if(x&&x.serialize&&x.serialize(h,f),h.host&&!y.IPV6ADDRESS.test(h.host)){if(f.domainHost||x&&x.domainHost)try{h.host=f.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(y.PCT_ENCODED,Ie).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+ae}}gr(h,y),f.reference!=="suffix"&&h.scheme&&(b.push(h.scheme),b.push(":"));var L=yr(h,f);if(L!==void 0&&(f.reference!=="suffix"&&b.push("//"),b.push(L),h.path&&h.path.charAt(0)!=="/"&&b.push("/")),h.path!==void 0){var G=h.path;!f.absolutePath&&(!x||!x.absolutePath)&&(G=Me(G)),L===void 0&&(G=G.replace(/^\/\//,"/%2F")),b.push(G)}return h.query!==void 0&&(b.push("?"),b.push(h.query)),h.fragment!==void 0&&(b.push("#"),b.push(h.fragment)),b.join("")}function Ae(h,f){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},b=arguments[3],x={};return b||(h=ie(De(h,y),y),f=ie(De(f,y),y)),y=y||{},!y.tolerant&&f.scheme?(x.scheme=f.scheme,x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.path?(f.path.charAt(0)==="/"?x.path=Me(f.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?x.path="/"+f.path:h.path?x.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+f.path:x.path=f.path,x.path=Me(x.path)),x.query=f.query):(x.path=h.path,f.query!==void 0?x.query=f.query:x.query=h.query),x.userinfo=h.userinfo,x.host=h.host,x.port=h.port),x.scheme=h.scheme),x.fragment=f.fragment,x}function er(h,f,y){var b=i({scheme:"null"},y);return De(Ae(ie(h,b),ie(f,b),b,!0),b)}function Le(h,f){return typeof h=="string"?h=De(ie(h,f),f):s(h)==="object"&&(h=ie(De(h,f),f)),h}function It(h,f,y){return typeof h=="string"?h=De(ie(h,y),y):s(h)==="object"&&(h=De(h,y)),typeof f=="string"?f=De(ie(f,y),y):s(f)==="object"&&(f=De(f,y)),h===f}function xa(h,f){return h&&h.toString().replace(!f||!f.iri?c.ESCAPE:d.ESCAPE,Se)}function Xe(h,f){return h&&h.toString().replace(!f||!f.iri?c.PCT_ENCODED:d.PCT_ENCODED,Ie)}var ft={scheme:"http",domainHost:!0,parse:function(f,y){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,y){var b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},Ps={scheme:"https",domainHost:ft.domainHost,parse:ft.parse,serialize:ft.serialize};function Ts(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var pt={scheme:"ws",domainHost:!0,parse:function(f,y){var b=f;return b.secure=Ts(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b},serialize:function(f,y){if((f.port===(Ts(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var b=f.resourceName.split("?"),x=p(b,2),L=x[0],G=x[1];f.path=L&&L!=="/"?L:void 0,f.query=G,f.resourceName=void 0}return f.fragment=void 0,f}},Os={scheme:"wss",domainHost:pt.domainHost,parse:pt.parse,serialize:pt.serialize},rl={},tl=!0,ws="[A-Za-z0-9\\-\\.\\_\\~"+(tl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",al=t(t("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+t("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+t("%"+rr+rr)),sl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",nl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",il=e(nl,'[\\"\\\\]'),ol="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ll=new RegExp(ws,"g"),Kr=new RegExp(al,"g"),cl=new RegExp(e("[^]",sl,"[\\.]",'[\\"]',il),"g"),Is=new RegExp(e("[^]",ws,ol),"g"),ul=Is;function Ra(h){var f=Ie(h);return f.match(ll)?f:h}var As={scheme:"mailto",parse:function(f,y){var b=f,x=b.to=b.path?b.path.split(","):[];if(b.path=void 0,b.query){for(var L=!1,G={},ae=b.query.split("&"),oe=0,Ee=ae.length;oe{"use strict";vn.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var yn=X((xp,gn)=>{"use strict";gn.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";bn.exports={copy:$u,checkDataType:Ba,checkDataTypes:ku,coerceToTypes:Lu,toHash:Xa,getProperty:Qa,escapeQuotes:Ga,equal:Qt(),ucs2length:yn(),varOccurences:Mu,varReplace:qu,schemaHasRules:Uu,schemaHasRulesExcept:zu,schemaUnknownRules:Vu,toQuotedString:Za,getPathExpr:Hu,getPath:Bu,getData:Qu,unescapeFragment:Gu,unescapeJsonPointer:Ka,escapeFragment:Wu,escapeJsonPointer:Wa};function $u(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Ba(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",l=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+l+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+l+"("+e+" % 1)"+n+e+r+e+(t?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function ku(a,e,t){switch(a.length){case 1:return Ba(a[0],e,t,!0);default:var s="",r=Xa(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Ba(n,e,t,!0);return s}}var _n=Xa(["string","number","integer","boolean","null"]);function Lu(a,e){if(Array.isArray(e)){for(var t=[],s=0;s=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var l=n,c=r.split("/"),d=0;d{"use strict";var Ku=Qr();Sn.exports=Ju;function Ju(a){Ku.copy(a,this)}});var Rn=X((Tp,xn)=>{"use strict";var xr=xn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Gt(e,s,r,a,"",a)};xr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};xr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xr.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Gt(a,e,t,s,r,n,i,l,c,d){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,l,c,d);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in xr.arrayKeywords)for(var E=0;E{"use strict";var Tt=mn(),Pn=Qt(),Yt=Qr(),Wt=Ja(),ed=Rn();wn.exports=Pr;Pr.normalizeId=Rr;Pr.fullPath=Kt;Pr.url=Jt;Pr.ids=nd;Pr.inlineRef=Ya;Pr.schema=ea;function Pr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Pr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Wt)return Ya(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=ea.call(this,e,t),n,i,l;return r&&(n=r.schema,e=r.root,l=r.baseId),n instanceof Wt?i=n.validate||a.call(this,n.schema,e,void 0,l):n!==void 0&&(i=Ya(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,l)),i}function ea(a,e){var t=Tt.parse(e),s=On(t),r=Kt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Rr(s),i=this._refs[n];if(typeof i=="string")return rd.call(this,a,i,t);if(i instanceof Wt)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof Wt){if(i.validate||this._compile(i),n==Rr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Kt(this._getId(a.schema))}return Tn.call(this,t,r,a.schema,a)}function rd(a,e,t){var s=ea.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=Jt(n,i)),Tn.call(this,t,n,r,a)}}var td=Yt.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Tn(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n{"use strict";var ts=ra();An.exports={Validation:In(id),MissingRef:In(as)};function id(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}as.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function as(a,e,t){this.message=t||as.message(a,e),this.missingRef=ts.url(a,e),this.missingSchema=ts.normalizeId(ts.fullPath(this.missingRef))}function In(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var ss=X((Ip,Nn)=>{"use strict";Nn.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(i){return function(l,c){var d={key:l,value:i[l]},p={key:c,value:i[c]};return n(d,p)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var l,c;if(Array.isArray(i)){for(c="[",l=0;l{"use strict";Dn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var d="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(d);else throw new Error(d)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,E=e.schema[t],u=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,_="data"+(m||""),T="valid"+p;if(e.schema===!1){e.isTop?A=!0:r+=" var "+T+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+T+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var O=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var R="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(R);else throw new Error(R)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,_="data"+(m||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+p+" = errors;"}var T="valid"+p,A=!e.opts.allErrors,N="",V="",q,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),D){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,D);var j=e.RULES.types[D];if(M||U||j===!0||j&&!xe(j)){var u=e.schemaPath+".type",g=e.errSchemaPath+"/type",u=e.schemaPath+".type",g=e.errSchemaPath+"/type",I=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[I](D,_,e.opts.strictNumbers,!0)+") { ",M){var C="dataType"+p,F="coerced"+p;r+=" var "+C+" = typeof "+_+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+C+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+F+" = "+_+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=M;if(le)for(var J,re=-1,K=le.length-1;re{"use strict";var aa=ra(),na=Qr(),$n=ta(),od=ss(),Cn=ns(),ld=na.ucs2length,cd=Qt(),ud=$n.Validation;Ln.exports=is;function is(a,e,t,s){var r=this,n=this._opts,i=[void 0],l={},c=[],d={},p=[],m={},E=[];e=e||{schema:a,refVal:i,refs:l};var u=dd.call(this,a,e,s),g=this._compilations[u.index];if(u.compiling)return g.callValidate=R;var _=this._formats,v=this.RULES;try{var S=T(a,e,t,s);g.validate=S;var O=g.callValidate;return O&&(O.schema=S.schema,O.errors=null,O.refs=S.refs,O.refVal=S.refVal,O.root=S.root,O.$async=S.$async,n.sourceCode&&(O.source=S.source)),S}finally{fd.call(this,a,e,s)}function R(){var I=g.validate,C=I.apply(this,arguments);return R.errors=I.errors,C}function T(I,C,F,le){var J=!C||C&&C.schema==I;if(C.schema!=e.schema)return is.call(r,I,C,F,le);var re=I.$async===!0,K=Cn({isTop:!0,schema:I,isRoot:J,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:$n.MissingRef,RULES:v,validate:Cn,util:na,resolve:aa,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:j,opts:n,formats:_,logger:r.logger,self:r});K=sa(i,md)+sa(c,pd)+sa(p,hd)+sa(E,vd)+K,n.processCode&&(K=n.processCode(K,I));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);H=me(r,v,_,e,i,p,E,cd,ld,ud),i[0]=H}catch(Pe){throw r.logger.error("Error compiling schema, function code:",K),Pe}return H.schema=I,H.errors=null,H.refs=l,H.refVal=i,H.root=J?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:K,patterns:c,defaults:p}),H}function A(I,C,F){C=aa.url(I,C);var le=l[C],J,re;if(le!==void 0)return J=i[le],re="refVal["+le+"]",D(J,re);if(!F&&e.refs){var K=e.refs[C];if(K!==void 0)return J=e.refVal[K],re=N(C,J),D(J,re)}re=N(C);var H=aa.call(r,T,e,C);if(H===void 0){var me=t&&t[C];me&&(H=aa.inlineRef(me,n.inlineRefs)?me:is.call(r,me,e,t,I))}if(H===void 0)V(C);else return q(C,H),D(H,re)}function N(I,C){var F=i.length;return i[F]=C,l[I]=F,"refVal"+F}function V(I){delete l[I]}function q(I,C){var F=l[I];i[F]=C}function D(I,C){return typeof I=="object"||typeof I=="boolean"?{code:C,schema:I,inline:!0}:{code:C,$async:I&&!!I.$async}}function U(I){var C=d[I];return C===void 0&&(C=d[I]=c.length,c[C]=I),"pattern"+C}function M(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return na.toQuotedString(I);case"object":if(I===null)return"null";var C=od(I),F=m[C];return F===void 0&&(F=m[C]=p.length,p[F]=I),"default"+F}}function j(I,C,F,le){if(r._opts.validateSchema!==!1){var J=I.definition.dependencies;if(J&&!J.every(function(Se){return Object.prototype.hasOwnProperty.call(F,Se)}))throw new Error("parent schema must have all required keywords: "+J.join(","));var re=I.definition.validateSchema;if(re){var K=re(C);if(!K){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=I.definition.compile,Pe=I.definition.inline,we=I.definition.macro,se;if(me)se=me.call(r,C,F,le);else if(we)se=we.call(r,C,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Pe)se=Pe.call(r,le,I.keyword,C,F);else if(se=I.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var ye=E.length;return E[ye]=se,{code:"customRule"+ye,validate:se}}}function dd(a,e,t){var s=kn.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function fd(a,e,t){var s=kn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function kn(a,e,t){for(var s=0;s{"use strict";var ia=Fn.exports=function(){this._cache={}};ia.prototype.put=function(e,t){this._cache[e]=t};ia.prototype.get=function(e){return this._cache[e]};ia.prototype.del=function(e){delete this._cache[e]};ia.prototype.clear=function(){this._cache={}}});var Kn=X((Cp,Wn)=>{"use strict";var gd=Qr(),yd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,_d=[0,31,28,31,30,31,30,31,31,30,31,30,31],Ed=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,qn=/^(?=.{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,bd=/^(?:[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,Sd=/^(?:[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,Un=/^(?:(?:[^\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,zn=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Vn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Hn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Bn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Zn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Wn.exports=oa;function oa(a){return a=a=="full"?"full":"fast",gd.copy(oa[a])}oa.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Un,url:zn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:qn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gn,uuid:Vn,"json-pointer":Hn,"json-pointer-uri-fragment":Bn,"relative-json-pointer":Zn};oa.full={date:Xn,time:Qn,"date-time":Pd,uri:Od,"uri-reference":Sd,"uri-template":Un,url:zn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:qn,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:Gn,uuid:Vn,"json-pointer":Hn,"json-pointer-uri-fragment":Bn,"relative-json-pointer":Zn};function xd(a){return a%4===0&&(a%100!==0||a%400===0)}function Xn(a){var e=a.match(yd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&xd(t)?29:_d[s])}function Qn(a,e){var t=a.match(Ed);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var Rd=/t|\s/i;function Pd(a){var e=a.split(Rd);return e.length==2&&Xn(e[0])&&Qn(e[1],!0)}var Td=/\/|:/;function Od(a){return Td.test(a)&&bd.test(a)}var wd=/[^\\]\\Z/;function Gn(a){if(wd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Yn=X(($p,Jn)=>{"use strict";Jn.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,p="data"+(i||""),m="valid"+n,E,u;if(l=="#"||l=="#/")e.isRoot?(E=e.async,u="validate"):(E=e.root.schema.$async===!0,u="root.refVal[0]");else{var g=e.resolveRef(e.baseId,l,e.isRoot);if(g===void 0){var _=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(_);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=v.pop(),!e.compositeRule&&d?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),d&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,_)}else if(g.inline){var O=e.util.copy(e);O.level++;var R="valid"+O.level;O.schema=g.schema,O.schemaPath="",O.errSchemaPath=l;var T=e.validate(O).replace(/validate\.schema/g,g.code);r+=" "+T+" ",d&&(r+=" if ("+R+") { ")}else E=g.$async===!0||e.async&&g.$async!==!1,u=g.code}if(u){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+u+".call(this, ":r+=" "+u+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=i?"data"+(i-1||""):"parentData",N=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+A+" , "+N+", rootData) ";var V=r;if(r=v.pop(),E){if(!e.async)throw new Error("async schema referenced by sync schema");d&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",d&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",d&&(r+=" "+m+" = false; "),r+=" } ",d&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+u+".errors; else vErrors = vErrors.concat("+u+".errors); errors = vErrors.length; } ",d&&(r+=" else { ")}return r}});var ri=X((kp,ei)=>{"use strict";ei.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,d=e.util.copy(e),p="";d.level++;var m="valid"+d.level,E=d.baseId,u=!0,g=n;if(g)for(var _,v=-1,S=g.length-1;v0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(u=!1,d.schema=_,d.schemaPath=i+"["+v+"]",d.errSchemaPath=l+"/"+v,r+=" "+e.validate(d)+" ",d.baseId=E,c&&(r+=" if ("+m+") { ",p+="}"));return c&&(u?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ai=X((Lp,ti)=>{"use strict";ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=l.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(S){var O=g.baseId;r+=" var "+u+" = errors; var "+E+" = false; ";var R=e.compositeRule;e.compositeRule=g.compositeRule=!0;var T=l;if(T)for(var A,N=-1,V=T.length-1;N{"use strict";si.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var oi=X((Fp,ii)=>{"use strict";ii.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l,u||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+E+" = equal("+m+", schema"+n+"); if (!"+E+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var ci=X((Mp,li)=>{"use strict";li.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,O=g.dataLevel=e.dataLevel+1,R="data"+O,T=e.baseId,A=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(r+="var "+u+" = errors;var "+E+";",A){var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" var "+v+" = false; for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var V=m+"["+S+"]";g.dataPathArr[O]=S;var q=e.validate(g);g.baseId=T,e.util.varOccurences(q,R)<2?r+=" "+e.util.varReplace(q,R,V)+" ":r+=" var "+R+" = "+V+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=g.compositeRule=N,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=D.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",A&&(r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var di=X((qp,ui)=>{"use strict";ui.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level,v={},S={},O=e.opts.ownProperties;for(N in l)if(N!="__proto__"){var R=l[N],T=Array.isArray(R)?S:v;T[N]=R}r+="var "+E+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var N in S)if(T=S[N],T.length){if(r+=" if ( "+m+e.util.getProperty(N)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),p){r+=" && ( ";var V=T;if(V)for(var q,D=-1,U=V.length-1;D0||R===!1:e.util.schemaHasRules(R,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(N)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),r+=") { ",u.schema=R,u.schemaPath=c+e.util.getProperty(N),u.errSchemaPath=d+"/"+e.util.escapeFragment(N),r+=" "+e.validate(u)+" ",u.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",g+="}"))}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var pi=X((Up,fi)=>{"use strict";fi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l;var _="i"+n,v="schema"+n;u||(r+=" var "+v+" = validate.schema"+c+";"),r+="var "+E+";",u&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=""+E+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+E+" = true; break; }",u&&(r+=" } "),r+=" if (!"+E+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;return r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var mi=X((zp,hi)=>{"use strict";hi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=e.opts.unknownFormats,_=Array.isArray(g);if(E){var v="format"+n,S="isObject"+n,O="formatType"+n;r+=" var "+v+" = formats["+u+"]; var "+S+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+O+" = "+S+" && "+v+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" (",g!="ignore"&&(r+=" ("+u+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),r+=") || "),r+=" ("+v+" && "+O+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+m+") : "+v+"("+m+")) ":r+=" "+v+"("+m+") ",r+=" : "+v+".test("+m+"))))) {"}else{var v=e.formats[l];if(!v){if(g=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(_&&g.indexOf(l)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,O=S&&v.type||"string";if(S){var R=v.async===!0;v=v.validate}if(O!=s)return p&&(r+=" if (true) { "),r;if(R){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(l)+".validate";r+=" if (!(await "+T+"("+m+"))) { "}else{r+=" if (! ";var T="formats"+e.util.getProperty(l);S&&(T+=".validate"),typeof v=="function"?r+=" "+T+"("+m+") ":r+=" "+T+".test("+m+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { format: ",E?r+=""+u:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,E?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var N=r;return r=A.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+N+"]); ":r+=" validate.errors = ["+N+"]; return false; ":r+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var gi=X((Vp,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e);g.level++;var _="valid"+g.level,v=e.schema.then,S=e.schema.else,O=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),R=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),T=g.baseId;if(O||R){var A;g.createErrors=!1,g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" var "+u+" = errors; var "+E+" = true; ";var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,r+=" "+e.validate(g)+" ",g.baseId=T,g.createErrors=!0,r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=N,O?(r+=" if ("+_+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(g)+" ",g.baseId=T,r+=" "+E+" = "+_+"; ",O&&R?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",R&&(r+=" else { ")):r+=" if (!"+_+") { ",R&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(g)+" ",g.baseId=T,r+=" "+E+" = "+_+"; ",O&&R?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var _i=X((Hp,yi)=>{"use strict";yi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,O=g.dataLevel=e.dataLevel+1,R="data"+O,T=e.baseId;if(r+="var "+u+" = errors;var "+E+";",Array.isArray(l)){var A=e.schema.additionalItems;if(A===!1){r+=" "+E+" = "+m+".length <= "+l.length+"; ";var N=d;d=e.errSchemaPath+"/additionalItems",r+=" if (!"+E+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;r=V.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",d=N,p&&(_+="}",r+=" else { ")}var D=l;if(D){for(var U,M=-1,j=D.length-1;M0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+M+") { ";var I=m+"["+M+"]";g.schema=U,g.schemaPath=c+"["+M+"]",g.errSchemaPath=d+"/"+M,g.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),g.dataPathArr[O]=M;var C=e.validate(g);g.baseId=T,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){g.schema=A,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+l.length+") { for (var "+S+" = "+l.length+"; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[O]=S;var C=e.validate(g);g.baseId=T,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" } } ",p&&(r+=" if ("+v+") { ",_+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){g.schema=l,g.schemaPath=c,g.errSchemaPath=d,r+=" for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[O]=S;var C=e.validate(g);g.baseId=T,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+u+" == errors) {"),r}});var os=X((Bp,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,T,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=t=="maximum",_=g?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],S=e.opts.$data&&v&&v.$data,O=g?"<":">",R=g?">":"<",T=void 0;if(!(E||typeof l=="number"||l===void 0))throw new Error(t+" must be number");if(!(S||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(S){var A=e.util.getData(v.$data,i,e.dataPathArr),N="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,D="op"+n,U="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+N+"; var "+V+" = typeof "+A+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var T=_,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+N+" = "+u+" === undefined || "+A+" "+O+"= "+u+") ? "+m+" "+R+"= "+A+" : "+m+" "+R+" "+u+" ) : ( ("+N+" = "+A+" === true) ? "+m+" "+R+"= "+u+" : "+m+" "+R+" "+u+" ) || "+m+" !== "+m+") { var op"+n+" = "+N+" ? '"+O+"' : '"+O+"='; ",l===void 0&&(T=_,d=e.errSchemaPath+"/"+_,u=A,E=S)}else{var q=typeof v=="number",U=O;if(q&&E){var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" ( "+u+" === undefined || "+v+" "+O+"= "+u+" ? "+m+" "+R+"= "+v+" : "+m+" "+R+" "+u+" ) || "+m+" !== "+m+") { "}else{q&&l===void 0?(N=!0,T=_,d=e.errSchemaPath+"/"+_,u=v,R+="="):(q&&(u=Math[g?"min":"max"](v,l)),v===(q?u:!0)?(N=!0,T=_,d=e.errSchemaPath+"/"+_,R+="="):(N=!1,U+="="));var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+" "+R+" "+u+" || "+m+" !== "+m+") { "}}T=T||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { comparison: "+D+", limit: "+u+", exclusive: "+N+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",E?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;return r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var ls=X((Zp,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+m+".length "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var cs=X((Xp,Si)=>{"use strict";Si.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var us=X((Qp,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" Object.keys("+m+").length "+g+" "+u+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+u+" + '":r+=""+l,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Pi=X((Gp,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;if(E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l,!(E||typeof l=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",E&&(r+=" "+u+" !== undefined && ( typeof "+u+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+u+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",E&&(r+=" ) "),r+=" ) { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { multipleOf: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",E?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=g.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Oi=X((Wp,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e);u.level++;var g="valid"+u.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){u.schema=l,u.schemaPath=c,u.errSchemaPath=d,r+=" var "+E+" = errors; ";var _=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var v;u.opts.allErrors&&(v=u.opts.allErrors,u.opts.allErrors=!1),r+=" "+e.validate(u)+" ",u.createErrors=!0,v&&(u.opts.allErrors=v),e.compositeRule=u.compositeRule=_,r+=" if ("+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var Ii=X((Kp,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=g.baseId,O="prevValid"+n,R="passingSchemas"+n;r+="var "+u+" = errors , "+O+" = false , "+E+" = false , "+R+" = null; ";var T=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=l;if(A)for(var N,V=-1,q=A.length-1;V0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(g.schema=N,g.schemaPath=c+"["+V+"]",g.errSchemaPath=d+"/"+V,r+=" "+e.validate(g)+" ",g.baseId=S):r+=" var "+v+" = true; ",V&&(r+=" if ("+v+" && "+O+") { "+E+" = false; "+R+" = ["+R+", "+V+"]; } else { ",_+="}"),r+=" if ("+v+") { "+E+" = "+O+" = true; "+R+" = "+V+"; }";return e.compositeRule=g.compositeRule=T,r+=""+_+"if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { passingSchemas: "+R+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Ni=X((Jp,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&l&&l.$data,u;E?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",u="schema"+n):u=l;var g=E?"(new RegExp("+u+"))":e.usePattern(l);r+="if ( ",E&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" !"+g+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { pattern: ",E?r+=""+u:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,E?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ci=X((Yp,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level,v="key"+n,S="idx"+n,O=u.dataLevel=e.dataLevel+1,R="data"+O,T="dataProperties"+n,A=Object.keys(l||{}).filter(re),N=e.schema.patternProperties||{},V=Object.keys(N).filter(re),q=e.schema.additionalProperties,D=A.length||V.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,j=e.opts.removeAdditional,I=U||M||j,C=e.opts.ownProperties,F=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var K=A;if(K)for(var H,me=-1,Pe=K.length-1;me0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Me=e.util.getProperty(H),Te=m+Me,De=yr&&xe.default!==void 0;u.schema=xe,u.schemaPath=c+Me,u.errSchemaPath=d+"/"+e.util.escapeFragment(H),u.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),u.dataPathArr[O]=e.util.toQuotedString(H);var ie=e.validate(u);if(u.baseId=F,e.util.varOccurences(ie,R)<2){ie=e.util.varReplace(ie,R,Te);var Ae=Te}else{var Ae=R;r+=" var "+R+" = "+Te+"; "}if(De)r+=" "+ie+" ";else{if(J&&J[H]){r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ie=e.errorPath,lr=d,er=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,H,e.opts.jsonPointers)),d=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+er+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=lr,e.errorPath=Ie,r+=" } else { "}else p?(r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+Ae+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",g+="}")}}if(V.length){var Le=V;if(Le)for(var se,It=-1,xa=Le.length-1;It0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){u.schema=xe,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+T+" = "+T+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+T+".length; "+S+"++) { var "+v+" = "+T+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Te=m+"["+v+"]";u.dataPathArr[O]=v;var ie=e.validate(u);u.baseId=F,e.util.varOccurences(ie,R)<2?r+=" "+e.util.varReplace(ie,R,Te)+" ":r+=" var "+R+" = "+Te+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",g+="}")}}}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var ki=X((eh,$i)=>{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,u=e.util.copy(e),g="";u.level++;var _="valid"+u.level;if(r+="var "+E+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){u.schema=l,u.schemaPath=c,u.errSchemaPath=d;var v="key"+n,S="idx"+n,O="i"+n,R="' + "+v+" + '",T=u.dataLevel=e.dataLevel+1,A="data"+T,N="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+N+" = undefined; "),V?r+=" "+N+" = "+N+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+N+".length; "+S+"++) { var "+v+" = "+N+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var D=v,U=e.compositeRule;e.compositeRule=u.compositeRule=!0;var M=e.validate(u);u.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,D)+" ":r+=" var "+A+" = "+D+"; "+M+" ",e.compositeRule=u.compositeRule=U,r+=" if (!"+_+") { for (var "+O+"=startErrs"+n+"; "+O+"{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l;var _="schema"+n;if(!u)if(l.length0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=O)}}else var v=l;if(u||v.length){var N=e.errorPath,V=u||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",V){u||(r+=" var "+_+" = validate.schema"+c+"; ");var D="i"+n,U="schema"+n+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,U,e.opts.jsonPointers)),r+=" var "+E+" = true; ",u&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=" for (var "+D+" = 0; "+D+" < "+_+".length; "+D+"++) { "+E+" = "+m+"["+_+"["+D+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+D+"]) "),r+="; if (!"+E+") break; } ",u&&(r+=" } "),r+=" if (!"+E+") { ";var j=j||[];j.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;r=j.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var F,D=-1,le=C.length-1;D{"use strict";Fi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,u=e.opts.$data&&l&&l.$data,g;if(u?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=l,(l||u)&&e.opts.uniqueItems!==!1){u&&(r+=" var "+E+"; if ("+g+" === false || "+g+" === undefined) "+E+" = true; else if (typeof "+g+" != 'boolean') "+E+" = false; else { "),r+=" var i = "+m+".length , "+E+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+E+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var S="checkDataType"+(v?"s":"");r+=" if ("+e.util[S](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+E+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",u&&(r+=" } "),r+=" if (!"+E+") { ";var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",u?r+="validate.schema"+c:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var R=r;r=O.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Ui=X((ah,qi)=>{"use strict";qi.exports={$ref:Yn(),allOf:ri(),anyOf:ai(),$comment:ni(),const:oi(),contains:ci(),dependencies:di(),enum:pi(),format:mi(),if:gi(),items:_i(),maximum:os(),minimum:os(),maxItems:ls(),minItems:ls(),maxLength:cs(),minLength:cs(),maxProperties:us(),minProperties:us(),multipleOf:Pi(),not:Oi(),oneOf:Ii(),pattern:Ni(),properties:Ci(),propertyNames:ki(),required:ji(),uniqueItems:Mi(),validate:ns()}});var Hi=X((sh,Vi)=>{"use strict";var zi=Ui(),ds=Qr().toHash;Vi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=ds(t),e.types=ds(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var l;if(typeof i=="object"){var c=Object.keys(i)[0];l=i[c],i=c,l.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(i);var d=e.all[i]={keyword:i,code:zi[i],implements:l};return d}),e.all.$comment={keyword:"$comment",code:zi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ds(t.concat(s)),e.custom={},e}});var Xi=X((nh,Zi)=>{"use strict";var Bi=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Zi.exports=function(a,e){for(var t=0;t{"use strict";var Id=ta().MissingRef;Gi.exports=Qi;function Qi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var l=s._addSchema(a,void 0,e);return l.validate||i(l)});return t&&r.then(function(l){t(null,l)},t),r;function n(l){var c=l.$schema;return c&&!s.getSchema(c)?Qi.call(s,{$ref:c},!0):Promise.resolve()}function i(l){try{return s._compile(l)}catch(d){if(d instanceof Id)return c(d);throw d}function c(d){var p=d.missingSchema;if(u(p))throw new Error("Schema "+p+" is loaded but "+d.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(E,E)),m.then(function(g){if(!u(p))return n(g).then(function(){u(p)||s.addSchema(g,p,void 0,e)})}).then(function(){return i(l)});function E(){delete s._loadingSchemas[p]}function u(g){return s._refs[g]||s._schemas[g]}}}}});var Ji=X((oh,Ki)=>{"use strict";Ki.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,l=e.schema[t],c=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,E="data"+(i||""),u="valid"+n,g="errs__"+n,_=e.opts.$data&&l&&l.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(l.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=l;var S=this,O="definition"+n,R=S.definition,T="",A,N,V,q,D;if(_&&R.$data){D="keywordValidate"+n;var U=R.validateSchema;r+=" var "+O+" = RULES.custom['"+t+"'].definition; var "+D+" = "+O+".validate;"}else{if(q=e.useCustomRule(S,l,e.schema,e),!q)return;v="validate.schema"+c,D=q.code,A=R.compile,N=R.inline,V=R.macro}var M=D+".errors",j="i"+n,I="ruleErr"+n,C=R.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||V||(r+=""+M+" = null;"),r+="var "+g+" = errors;var "+u+";",_&&R.$data&&(T+="}",r+=" if ("+v+" === undefined) { "+u+" = true; } else { ",U&&(T+="}",r+=" "+u+" = "+O+".validateSchema("+v+"); if ("+u+") { ")),N)R.statements?r+=" "+q.validate+" ":r+=" "+u+" = "+q.validate+"; ";else if(V){var F=e.util.copy(e),T="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var J=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,D);e.compositeRule=F.compositeRule=J,r+=" "+re}else{var K=K||[];K.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",A||R.schema===!1?r+=" , "+E+" ":r+=" , "+v+" , "+E+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",me=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Pe=r;r=K.pop(),R.errors===!1?(r+=" "+u+" = ",C&&(r+="await "),r+=""+Pe+"; "):C?(M="customErrors"+n,r+=" var "+M+" = null; try { "+u+" = await "+Pe+"; } catch (e) { "+u+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+u+" = "+Pe+"; "}if(R.modifying&&(r+=" if ("+H+") "+E+" = "+H+"["+me+"];"),r+=""+T,R.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",R.valid===void 0?(r+=" !",V?r+=""+le:r+=""+u):r+=" "+!R.valid+" ",r+=") { ",m=S.keyword;var K=K||[];K.push(r),r="";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ";var we=r;r=K.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=K.pop(),N?R.errors?R.errors!="full"&&(r+=" for (var "+j+"="+g+"; "+j+"{Ad.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var ro=X((ch,eo)=>{"use strict";var Yi=fs();eo.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Yi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Yi.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var ao=X((uh,to)=>{"use strict";var Nd=/^[a-z_$][a-z0-9_$-]*$/i,Dd=Ji(),Cd=ro();to.exports={add:$d,get:kd,remove:Ld,validate:ps};function $d(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Nd.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r{jd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var mo=X((fh,ho)=>{"use strict";var io=jn(),Gr=ra(),Fd=Mn(),oo=Ja(),Md=ss(),qd=Kn(),Ud=Hi(),lo=Xi(),co=Qr();ho.exports=ge;ge.prototype.validate=Vd;ge.prototype.compile=Hd;ge.prototype.addSchema=Bd;ge.prototype.addMetaSchema=Zd;ge.prototype.validateSchema=Xd;ge.prototype.getSchema=Gd;ge.prototype.removeSchema=Kd;ge.prototype.addFormat=nf;ge.prototype.errorsText=sf;ge.prototype._addSchema=Jd;ge.prototype._compile=Yd;ge.prototype.compileAsync=Wi();var ua=ao();ge.prototype.addKeyword=ua.add;ge.prototype.getKeyword=ua.get;ge.prototype.removeKeyword=ua.remove;ge.prototype.validateKeyword=ua.validate;var uo=ta();ge.ValidationError=uo.Validation;ge.MissingRefError=uo.MissingRef;ge.$dataMetaSchema=lo;var ca="http://json-schema.org/draft-07/schema",no=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],zd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=co.copy(a)||{},ff(this),this._schemas={},this._refs={},this._fragments={},this._formats=qd(a.format),this._cache=a.cache||new Fd,this._loadingSchemas={},this._compilations=[],this.RULES=Ud(),this._getId=ef(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Md),this._metaOpts=df(this),a.formats&&cf(this),a.keywords&&uf(this),of(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),lf(this)}function Vd(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Hd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Bd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rYl,DIRTY:()=>Dr,EMPTY_PATH:()=>Nl,INVALID:()=>B,NEVER:()=>jc,OK:()=>Oe,ParseStatus:()=>Re,Schema:()=>W,ZodAny:()=>br,ZodArray:()=>vr,ZodBigInt:()=>$r,ZodBoolean:()=>kr,ZodBranded:()=>Et,ZodCatch:()=>Zr,ZodDate:()=>Lr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>kt,ZodEffects:()=>He,ZodEnum:()=>Vr,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>w,ZodFunction:()=>jt,ZodIntersection:()=>qr,ZodIssueCode:()=>P,ZodLazy:()=>Ur,ZodLiteral:()=>zr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>Qe,ZodNull:()=>Fr,ZodNullable:()=>nr,ZodNumber:()=>Cr,ZodObject:()=>$e,ZodOptional:()=>ze,ZodParsedType:()=>k,ZodPipeline:()=>bt,ZodPromise:()=>Sr,ZodReadonly:()=>Xr,ZodRecord:()=>Lt,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>Er,ZodSymbol:()=>ot,ZodTransformer:()=>He,ZodTuple:()=>sr,ZodType:()=>W,ZodUndefined:()=>jr,ZodUnion:()=>Mr,ZodUnknown:()=>mr,ZodVoid:()=>lt,addIssueToContext:()=>$,any:()=>lc,array:()=>fc,bigint:()=>ac,boolean:()=>Xs,coerce:()=>Lc,custom:()=>Hs,date:()=>sc,datetimeRegex:()=>zs,defaultErrorMap:()=>pr,discriminatedUnion:()=>vc,effect:()=>wc,enum:()=>Pc,function:()=>Sc,getErrorMap:()=>st,getParsedType:()=>ar,instanceof:()=>rc,intersection:()=>gc,isAborted:()=>Ct,isAsync:()=>nt,isDirty:()=>$t,isValid:()=>_r,late:()=>ec,lazy:()=>xc,literal:()=>Rc,makeIssue:()=>_t,map:()=>Ec,nan:()=>tc,nativeEnum:()=>Tc,never:()=>uc,null:()=>oc,nullable:()=>Ac,number:()=>Zs,object:()=>pc,objectUtil:()=>wa,oboolean:()=>kc,onumber:()=>$c,optional:()=>Ic,ostring:()=>Cc,pipeline:()=>Dc,preprocess:()=>Nc,promise:()=>Oc,quotelessJson:()=>wl,record:()=>_c,set:()=>bc,setErrorMap:()=>Al,strictObject:()=>hc,string:()=>Bs,symbol:()=>nc,transformer:()=>wc,tuple:()=>yc,undefined:()=>ic,union:()=>mc,unknown:()=>cc,util:()=>Y,void:()=>dc});var Y;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(l=>typeof r[r[l]]!="number"),i={};for(let l of n)i[l]=r[l];return a.objectValues(i)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Y||(Y={}));var wa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(wa||(wa={}));var k=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=a=>{switch(typeof a){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(a)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(a)?k.array:a===null?k.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?k.promise:typeof Map<"u"&&a instanceof Map?k.map:typeof Set<"u"&&a instanceof Set?k.set:typeof Date<"u"&&a instanceof Date?k.date:k.object;default:return k.unknown}};var P=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let l=s,c=0;for(;ct.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=a=>new Ce(a);var Il=(a,e)=>{let t;switch(a.code){case P.invalid_type:a.received===k.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case P.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,Y.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(a.keys,", ")}`;break;case P.invalid_union:t="Invalid input";break;case P.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(a.options)}`;break;case P.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(a.options)}, received '${a.received}'`;break;case P.invalid_arguments:t="Invalid function arguments";break;case P.invalid_return_type:t="Invalid function return type";break;case P.invalid_date:t="Invalid date";break;case P.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:Y.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case P.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case P.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case P.custom:t="Invalid input";break;case P.invalid_intersection_types:t="Intersection results could not be merged";break;case P.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case P.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(a)}return{message:t}},pr=Il;var js=pr;function Al(a){js=a}function st(){return js}var _t=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let l="",c=s.filter(d=>!!d).slice().reverse();for(let d of c)l=d(i,{data:e,defaultError:l}).message;return{...r,path:n,message:l}},Nl=[];function $(a,e){let t=st(),s=_t({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Re=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return B;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Dr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),Ct=a=>a.status==="aborted",$t=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var z;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Ve=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Fs=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,l)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??s??l.defaultError}:i.code!=="invalid_type"?{message:l.defaultError}:{message:c??t??l.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return ar(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Re,ctx:{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Fs(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>_r(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Fs(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let i=e(r),l=()=>n.addIssue({code:P.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(l(),!1)):i?!0:(l(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new He({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ze.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Mr.create([this,e],this._def)}and(e){return qr.create(this,e,this._def)}transform(e){return new He({...Q(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...Q(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Et({typeName:w.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bt.create(this,e)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Dl=/^c[^\s-]{8,}$/i,Cl=/^[0-9a-z]+$/,$l=/^[0-9A-HJKMNP-TV-Z]{26}$/i,kl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ll=/^[a-z0-9_-]{21}$/i,jl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ml=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ql="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ia,Ul=/^(?:(?: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])$/,zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Vl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Hl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qs="((\\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])))",Xl=new RegExp(`^${qs}$`);function Us(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ql(a){return new RegExp(`^${Us(a)}$`)}function zs(a){let e=`${qs}T${Us(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Gl(a,e){return!!((e==="v4"||!e)&&Ul.test(a)||(e==="v6"||!e)&&Vl.test(a))}function Wl(a,e){if(!jl.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Kl(a,e){return!!((e==="v4"||!e)&&zl.test(a)||(e==="v6"||!e)&&Hl.test(a))}var Er=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_type,expected:k.string,received:n.parsedType}),B}let s=new Re,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,l=e.data.lengthe.test(r),{validation:t,code:P.invalid_string,...z.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Er({checks:[],typeName:w.ZodString,coerce:a?.coerce??!1,...Q(a)});function Jl(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Cr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){let n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_type,expected:k.number,received:n.parsedType}),B}let s,r=new Re;for(let n of this._def.checks)n.kind==="int"?Y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Jl(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:P.not_finite,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew Cr({checks:[],typeName:w.ZodNumber,coerce:a?.coerce||!1,...Q(a)});var $r=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==k.bigint)return this._getInvalidInput(e);let s,r=new Re;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),$(s,{code:P.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return $(t,{code:P.invalid_type,expected:k.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew $r({checks:[],typeName:w.ZodBigInt,coerce:a?.coerce??!1,...Q(a)});var kr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.boolean,received:s.parsedType}),B}return Oe(e.data)}};kr.create=a=>new kr({typeName:w.ZodBoolean,coerce:a?.coerce||!1,...Q(a)});var Lr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_type,expected:k.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return $(n,{code:P.invalid_date}),B}let s=new Re,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:P.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Y.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Lr({checks:[],coerce:a?.coerce||!1,typeName:w.ZodDate,...Q(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==k.symbol){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.symbol,received:s.parsedType}),B}return Oe(e.data)}};ot.create=a=>new ot({typeName:w.ZodSymbol,...Q(a)});var jr=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.undefined,received:s.parsedType}),B}return Oe(e.data)}};jr.create=a=>new jr({typeName:w.ZodUndefined,...Q(a)});var Fr=class extends W{_parse(e){if(this._getType(e)!==k.null){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.null,received:s.parsedType}),B}return Oe(e.data)}};Fr.create=a=>new Fr({typeName:w.ZodNull,...Q(a)});var br=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};br.create=a=>new br({typeName:w.ZodAny,...Q(a)});var mr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};mr.create=a=>new mr({typeName:w.ZodUnknown,...Q(a)});var Qe=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return $(t,{code:P.invalid_type,expected:k.never,received:t.parsedType}),B}};Qe.create=a=>new Qe({typeName:w.ZodNever,...Q(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.void,received:s.parsedType}),B}return Oe(e.data)}};lt.create=a=>new lt({typeName:w.ZodVoid,...Q(a)});var vr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==k.array)return $(t,{code:P.invalid_type,expected:k.array,received:t.parsedType}),B;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,l=t.data.lengthr.maxLength.value&&($(t,{code:P.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,l)=>r.type._parseAsync(new Ve(t,i,t.path,l)))).then(i=>Re.mergeArray(s,i));let n=[...t.data].map((i,l)=>r.type._parseSync(new Ve(t,i,t.path,l)));return Re.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}};vr.create=(a,e)=>new vr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...Q(e)});function it(a){if(a instanceof $e){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=ze.create(it(s))}return new $e({...a._def,shape:()=>e})}else return a instanceof vr?new vr({...a._def,type:it(a.element)}):a instanceof ze?ze.create(it(a.unwrap())):a instanceof nr?nr.create(it(a.unwrap())):a instanceof sr?sr.create(a.items.map(e=>it(e))):a}var $e=class a extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==k.object){let d=this._getOrReturnCtx(e);return $(d,{code:P.invalid_type,expected:k.object,received:d.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),l=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(let d in r.data)i.includes(d)||l.push(d);let c=[];for(let d of i){let p=n[d],m=r.data[d];c.push({key:{status:"valid",value:d},value:p._parse(new Ve(r,m,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof Qe){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of l)c.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(d==="strict")l.length>0&&($(r,{code:P.unrecognized_keys,keys:l}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of l){let m=r.data[p];c.push({key:{status:"valid",value:p},value:d._parse(new Ve(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of c){let m=await p.key,E=await p.value;d.push({key:m,value:E,alwaysSet:p.alwaysSet})}return d}).then(d=>Re.mergeObjectSync(s,d)):Re.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:z.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of Y.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of Y.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of Y.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of Y.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Vs(Y.objectKeys(this.shape))}};$e.create=(a,e)=>new $e({shape:()=>a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.strictCreate=(a,e)=>new $e({shape:()=>a,unknownKeys:"strict",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.lazycreate=(a,e)=>new $e({shape:a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});var Mr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let l of n)if(l.result.status==="valid")return l.result;for(let l of n)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let i=n.map(l=>new Ce(l.ctx.common.issues));return $(t,{code:P.invalid_union,unionErrors:i}),B}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let d={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let l=i.map(c=>new Ce(c));return $(t,{code:P.invalid_union,unionErrors:l}),B}}get options(){return this._def.options}};Mr.create=(a,e)=>new Mr({options:a,typeName:w.ZodUnion,...Q(e)});var hr=a=>a instanceof Ur?hr(a.schema):a instanceof He?hr(a.innerType()):a instanceof zr?[a.value]:a instanceof Vr?a.options:a instanceof Hr?Y.objectValues(a.enum):a instanceof Br?hr(a._def.innerType):a instanceof jr?[void 0]:a instanceof Fr?[null]:a instanceof ze?[void 0,...hr(a.unwrap())]:a instanceof nr?[null,...hr(a.unwrap())]:a instanceof Et||a instanceof Xr?hr(a.unwrap()):a instanceof Zr?hr(a._def.innerType):[],kt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.object)return $(t,{code:P.invalid_type,expected:k.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):($(t,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=hr(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of i){if(r.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);r.set(l,n)}}return new a({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function Aa(a,e){let t=ar(a),s=ar(e);if(a===e)return{valid:!0,data:a};if(t===k.object&&s===k.object){let r=Y.objectKeys(e),n=Y.objectKeys(a).filter(l=>r.indexOf(l)!==-1),i={...a,...e};for(let l of n){let c=Aa(a[l],e[l]);if(!c.valid)return{valid:!1};i[l]=c.data}return{valid:!0,data:i}}else if(t===k.array&&s===k.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(Ct(n)||Ct(i))return B;let l=Aa(n.value,i.value);return l.valid?(($t(n)||$t(i))&&t.dirty(),{status:t.value,value:l.data}):($(s,{code:P.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};qr.create=(a,e,t)=>new qr({left:a,right:e,typeName:w.ZodIntersection,...Q(t)});var sr=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.array)return $(s,{code:P.invalid_type,expected:k.array,received:s.parsedType}),B;if(s.data.lengththis._def.items.length&&($(s,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,l)=>{let c=this._def.items[l]||this._def.rest;return c?c._parse(new Ve(s,i,s.path,l)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Re.mergeArray(t,i)):Re.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};sr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sr({items:a,typeName:w.ZodTuple,rest:null,...Q(e)})};var Lt=class a extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.object)return $(s,{code:P.invalid_type,expected:k.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,i=this._def.valueType;for(let l in s.data)r.push({key:n._parse(new Ve(s,l,s.path,l)),value:i._parse(new Ve(s,s.data[l],s.path,l)),alwaysSet:l in s.data});return s.common.async?Re.mergeObjectAsync(t,r):Re.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:w.ZodRecord,...Q(s)}):new a({keyType:Er.create(),valueType:e,typeName:w.ZodRecord,...Q(t)})}},ct=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.map)return $(s,{code:P.invalid_type,expected:k.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([l,c],d)=>({key:r._parse(new Ve(s,l,s.path,[d,"key"])),value:n._parse(new Ve(s,c,s.path,[d,"value"]))}));if(s.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let c of i){let d=await c.key,p=await c.value;if(d.status==="aborted"||p.status==="aborted")return B;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),l.set(d.value,p.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let c of i){let d=c.key,p=c.value;if(d.status==="aborted"||p.status==="aborted")return B;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),l.set(d.value,p.value)}return{status:t.value,value:l}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:w.ZodMap,...Q(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.set)return $(s,{code:P.invalid_type,expected:k.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&($(s,{code:P.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let d=new Set;for(let p of c){if(p.status==="aborted")return B;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}let l=[...s.data.values()].map((c,d)=>n._parse(new Ve(s,c,s.path,d)));return s.common.async?Promise.all(l).then(c=>i(c)):i(l)}min(e,t){return new a({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:w.ZodSet,...Q(e)});var jt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.function)return $(t,{code:P.invalid_type,expected:k.function,received:t.parsedType}),B;function s(l,c){return _t({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(d=>!!d),issueData:{code:P.invalid_arguments,argumentsError:c}})}function r(l,c){return _t({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(d=>!!d),issueData:{code:P.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Sr){let l=this;return Oe(async function(...c){let d=new Ce([]),p=await l._def.args.parseAsync(c,n).catch(u=>{throw d.addIssue(s(c,u)),d}),m=await Reflect.apply(i,this,p);return await l._def.returns._def.type.parseAsync(m,n).catch(u=>{throw d.addIssue(r(m,u)),d})})}else{let l=this;return Oe(function(...c){let d=l._def.args.safeParse(c,n);if(!d.success)throw new Ce([s(c,d.error)]);let p=Reflect.apply(i,this,d.data),m=l._def.returns.safeParse(p,n);if(!m.success)throw new Ce([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:sr.create(e).rest(mr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||sr.create([]).rest(mr.create()),returns:t||mr.create(),typeName:w.ZodFunction,...Q(s)})}},Ur=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:w.ZodLazy,...Q(e)});var zr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $(t,{received:t.data,code:P.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};zr.create=(a,e)=>new zr({value:a,typeName:w.ZodLiteral,...Q(e)});function Vs(a,e){return new Vr({values:a,typeName:w.ZodEnum,...Q(e)})}var Vr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{expected:Y.joinValues(s),received:t.parsedType,code:P.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{received:t.data,code:P.invalid_enum_value,options:s}),B}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Vr.create=Vs;var Hr=class extends W{_parse(e){let t=Y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==k.string&&s.parsedType!==k.number){let r=Y.objectValues(t);return $(s,{expected:Y.joinValues(r),received:s.parsedType,code:P.invalid_type}),B}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Y.objectValues(t);return $(s,{received:s.data,code:P.invalid_enum_value,options:r}),B}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:w.ZodNativeEnum,...Q(e)});var Sr=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.promise&&t.common.async===!1)return $(t,{code:P.invalid_type,expected:k.promise,received:t.parsedType}),B;let s=t.parsedType===k.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Sr.create=(a,e)=>new Sr({type:a,typeName:w.ZodPromise,...Q(e)});var He=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{$(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async l=>{if(t.value==="aborted")return B;let c=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return c.status==="aborted"?B:c.status==="dirty"?Dr(c.value):t.value==="dirty"?Dr(c.value):c});{if(t.value==="aborted")return B;let l=this._def.schema._parseSync({data:i,path:s.path,parent:s});return l.status==="aborted"?B:l.status==="dirty"?Dr(l.value):t.value==="dirty"?Dr(l.value):l}}if(r.type==="refinement"){let i=l=>{let c=r.refinement(l,n);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),i(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),i(l.value).then(()=>({status:t.value,value:l.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(i))return B;let l=r.transform(i.value,n);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>_r(i)?Promise.resolve(r.transform(i.value,n)).then(l=>({status:t.value,value:l})):B);Y.assertNever(r)}};He.create=(a,e,t)=>new He({schema:a,typeName:w.ZodEffects,effect:e,...Q(t)});He.createWithPreprocess=(a,e,t)=>new He({schema:e,effect:{type:"preprocess",transform:a},typeName:w.ZodEffects,...Q(t)});var ze=class extends W{_parse(e){return this._getType(e)===k.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(a,e)=>new ze({innerType:a,typeName:w.ZodOptional,...Q(e)});var nr=class extends W{_parse(e){return this._getType(e)===k.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(a,e)=>new nr({innerType:a,typeName:w.ZodNullable,...Q(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===k.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Zr=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Zr.create=(a,e)=>new Zr({innerType:a,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==k.nan){let s=this._getOrReturnCtx(e);return $(s,{code:P.invalid_type,expected:k.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:w.ZodNaN,...Q(a)});var Yl=Symbol("zod_brand"),Et=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},bt=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Dr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:w.ZodPipeline})}},Xr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:w.ZodReadonly,...Q(e)});function Ms(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Hs(a,e={},t){return a?br.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let l=Ms(e,s),c=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:c})}});if(!n){let i=Ms(e,s),l=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:l})}}):br.create()}var ec={object:$e.lazycreate},w;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(w||(w={}));var rc=(a,e={message:`Input not instance of ${a.name}`})=>Hs(t=>t instanceof a,e),Bs=Er.create,Zs=Cr.create,tc=dt.create,ac=$r.create,Xs=kr.create,sc=Lr.create,nc=ot.create,ic=jr.create,oc=Fr.create,lc=br.create,cc=mr.create,uc=Qe.create,dc=lt.create,fc=vr.create,pc=$e.create,hc=$e.strictCreate,mc=Mr.create,vc=kt.create,gc=qr.create,yc=sr.create,_c=Lt.create,Ec=ct.create,bc=ut.create,Sc=jt.create,xc=Ur.create,Rc=zr.create,Pc=Vr.create,Tc=Hr.create,Oc=Sr.create,wc=He.create,Ic=ze.create,Ac=nr.create,Nc=He.createWithPreprocess,Dc=bt.create,Cc=()=>Bs().optional(),$c=()=>Zs().optional(),kc=()=>Xs().optional(),Lc={string:a=>Er.create({...a,coerce:!0}),number:a=>Cr.create({...a,coerce:!0}),boolean:a=>kr.create({...a,coerce:!0}),bigint:a=>$r.create({...a,coerce:!0}),date:a=>Lr.create({...a,coerce:!0})};var jc=B;var Na="2025-06-18";var Qs=[Na,"2025-03-26","2024-11-05","2024-10-07"],Ft="2.0",Gs=o.union([o.string(),o.number().int()]),Ws=o.string(),Fc=o.object({progressToken:o.optional(Gs)}).passthrough(),Be=o.object({_meta:o.optional(Fc)}).passthrough(),ke=o.object({method:o.string(),params:o.optional(Be)}),St=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),ir=o.object({method:o.string(),params:o.optional(St)}),Ze=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),Mt=o.union([o.string(),o.number().int()]),Ks=o.object({jsonrpc:o.literal(Ft),id:Mt}).merge(ke).strict(),Js=a=>Ks.safeParse(a).success,Ys=o.object({jsonrpc:o.literal(Ft)}).merge(ir).strict(),en=a=>Ys.safeParse(a).success,rn=o.object({jsonrpc:o.literal(Ft),id:Mt,result:Ze}).strict(),Da=a=>rn.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var tn=o.object({jsonrpc:o.literal(Ft),id:Mt,error:o.object({code:o.number().int(),message:o.string(),data:o.optional(o.unknown())})}).strict(),an=a=>tn.safeParse(a).success,sn=o.union([Ks,Ys,rn,tn]),qt=Ze.strict(),Ut=ir.extend({method:o.literal("notifications/cancelled"),params:St.extend({requestId:Mt,reason:o.string().optional()})}),Mc=o.object({src:o.string(),mimeType:o.optional(o.string()),sizes:o.optional(o.array(o.string()))}).passthrough(),xt=o.object({icons:o.array(Mc).optional()}).passthrough(),Rt=o.object({name:o.string(),title:o.optional(o.string())}).passthrough(),nn=Rt.extend({version:o.string(),websiteUrl:o.optional(o.string())}).merge(xt),qc=o.object({experimental:o.optional(o.object({}).passthrough()),sampling:o.optional(o.object({}).passthrough()),elicitation:o.optional(o.object({}).passthrough()),roots:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),Ca=ke.extend({method:o.literal("initialize"),params:Be.extend({protocolVersion:o.string(),capabilities:qc,clientInfo:nn})});var Uc=o.object({experimental:o.optional(o.object({}).passthrough()),logging:o.optional(o.object({}).passthrough()),completions:o.optional(o.object({}).passthrough()),prompts:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough()),resources:o.optional(o.object({subscribe:o.optional(o.boolean()),listChanged:o.optional(o.boolean())}).passthrough()),tools:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),zc=Ze.extend({protocolVersion:o.string(),capabilities:Uc,serverInfo:nn,instructions:o.optional(o.string())}),$a=ir.extend({method:o.literal("notifications/initialized")});var zt=ke.extend({method:o.literal("ping")}),Vc=o.object({progress:o.number(),total:o.optional(o.number()),message:o.optional(o.string())}).passthrough(),Vt=ir.extend({method:o.literal("notifications/progress"),params:St.merge(Vc).extend({progressToken:Gs})}),Ht=ke.extend({params:Be.extend({cursor:o.optional(Ws)}).optional()}),Bt=Ze.extend({nextCursor:o.optional(Ws)}),on=o.object({uri:o.string(),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ln=on.extend({text:o.string()}),ka=o.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),cn=on.extend({blob:ka}),un=Rt.extend({uri:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Hc=Rt.extend({uriTemplate:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Bc=Ht.extend({method:o.literal("resources/list")}),Zc=Bt.extend({resources:o.array(un)}),Xc=Ht.extend({method:o.literal("resources/templates/list")}),Qc=Bt.extend({resourceTemplates:o.array(Hc)}),Gc=ke.extend({method:o.literal("resources/read"),params:Be.extend({uri:o.string()})}),Wc=Ze.extend({contents:o.array(o.union([ln,cn]))}),Kc=ir.extend({method:o.literal("notifications/resources/list_changed")}),Jc=ke.extend({method:o.literal("resources/subscribe"),params:Be.extend({uri:o.string()})}),Yc=ke.extend({method:o.literal("resources/unsubscribe"),params:Be.extend({uri:o.string()})}),eu=ir.extend({method:o.literal("notifications/resources/updated"),params:St.extend({uri:o.string()})}),ru=o.object({name:o.string(),description:o.optional(o.string()),required:o.optional(o.boolean())}).passthrough(),tu=Rt.extend({description:o.optional(o.string()),arguments:o.optional(o.array(ru)),_meta:o.optional(o.object({}).passthrough())}).merge(xt),au=Ht.extend({method:o.literal("prompts/list")}),su=Bt.extend({prompts:o.array(tu)}),nu=ke.extend({method:o.literal("prompts/get"),params:Be.extend({name:o.string(),arguments:o.optional(o.record(o.string()))})}),La=o.object({type:o.literal("text"),text:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ja=o.object({type:o.literal("image"),data:ka,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),Fa=o.object({type:o.literal("audio"),data:ka,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),iu=o.object({type:o.literal("resource"),resource:o.union([ln,cn]),_meta:o.optional(o.object({}).passthrough())}).passthrough(),ou=un.extend({type:o.literal("resource_link")}),dn=o.union([La,ja,Fa,ou,iu]),lu=o.object({role:o.enum(["user","assistant"]),content:dn}).passthrough(),cu=Ze.extend({description:o.optional(o.string()),messages:o.array(lu)}),uu=ir.extend({method:o.literal("notifications/prompts/list_changed")}),du=o.object({title:o.optional(o.string()),readOnlyHint:o.optional(o.boolean()),destructiveHint:o.optional(o.boolean()),idempotentHint:o.optional(o.boolean()),openWorldHint:o.optional(o.boolean())}).passthrough(),fu=Rt.extend({description:o.optional(o.string()),inputSchema:o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough(),outputSchema:o.optional(o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough()),annotations:o.optional(du),_meta:o.optional(o.object({}).passthrough())}).merge(xt),Ma=Ht.extend({method:o.literal("tools/list")}),pu=Bt.extend({tools:o.array(fu)}),fn=Ze.extend({content:o.array(dn).default([]),structuredContent:o.object({}).passthrough().optional(),isError:o.optional(o.boolean())}),fp=fn.or(Ze.extend({toolResult:o.unknown()})),qa=ke.extend({method:o.literal("tools/call"),params:Be.extend({name:o.string(),arguments:o.optional(o.record(o.unknown()))})}),hu=ir.extend({method:o.literal("notifications/tools/list_changed")}),Pt=o.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Ua=ke.extend({method:o.literal("logging/setLevel"),params:Be.extend({level:Pt})}),mu=ir.extend({method:o.literal("notifications/message"),params:St.extend({level:Pt,logger:o.optional(o.string()),data:o.unknown()})}),vu=o.object({name:o.string().optional()}).passthrough(),gu=o.object({hints:o.optional(o.array(vu)),costPriority:o.optional(o.number().min(0).max(1)),speedPriority:o.optional(o.number().min(0).max(1)),intelligencePriority:o.optional(o.number().min(0).max(1))}).passthrough(),yu=o.object({role:o.enum(["user","assistant"]),content:o.union([La,ja,Fa])}).passthrough(),_u=ke.extend({method:o.literal("sampling/createMessage"),params:Be.extend({messages:o.array(yu),systemPrompt:o.optional(o.string()),includeContext:o.optional(o.enum(["none","thisServer","allServers"])),temperature:o.optional(o.number()),maxTokens:o.number().int(),stopSequences:o.optional(o.array(o.string())),metadata:o.optional(o.object({}).passthrough()),modelPreferences:o.optional(gu)})}),za=Ze.extend({model:o.string(),stopReason:o.optional(o.enum(["endTurn","stopSequence","maxTokens"]).or(o.string())),role:o.enum(["user","assistant"]),content:o.discriminatedUnion("type",[La,ja,Fa])}),Eu=o.object({type:o.literal("boolean"),title:o.optional(o.string()),description:o.optional(o.string()),default:o.optional(o.boolean())}).passthrough(),bu=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),minLength:o.optional(o.number()),maxLength:o.optional(o.number()),format:o.optional(o.enum(["email","uri","date","date-time"]))}).passthrough(),Su=o.object({type:o.enum(["number","integer"]),title:o.optional(o.string()),description:o.optional(o.string()),minimum:o.optional(o.number()),maximum:o.optional(o.number())}).passthrough(),xu=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),enum:o.array(o.string()),enumNames:o.optional(o.array(o.string()))}).passthrough(),Ru=o.union([Eu,bu,Su,xu]),Pu=ke.extend({method:o.literal("elicitation/create"),params:Be.extend({message:o.string(),requestedSchema:o.object({type:o.literal("object"),properties:o.record(o.string(),Ru),required:o.optional(o.array(o.string()))}).passthrough()})}),Va=Ze.extend({action:o.enum(["accept","decline","cancel"]),content:o.optional(o.record(o.string(),o.unknown()))}),Tu=o.object({type:o.literal("ref/resource"),uri:o.string()}).passthrough();var Ou=o.object({type:o.literal("ref/prompt"),name:o.string()}).passthrough(),wu=ke.extend({method:o.literal("completion/complete"),params:Be.extend({ref:o.union([Ou,Tu]),argument:o.object({name:o.string(),value:o.string()}).passthrough(),context:o.optional(o.object({arguments:o.optional(o.record(o.string(),o.string()))}))})}),Iu=Ze.extend({completion:o.object({values:o.array(o.string()).max(100),total:o.optional(o.number().int()),hasMore:o.optional(o.boolean())}).passthrough()}),Au=o.object({uri:o.string().startsWith("file://"),name:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),Nu=ke.extend({method:o.literal("roots/list")}),Ha=Ze.extend({roots:o.array(Au)}),Du=ir.extend({method:o.literal("notifications/roots/list_changed")}),pp=o.union([zt,Ca,wu,Ua,nu,au,Bc,Xc,Gc,Jc,Yc,qa,Ma]),hp=o.union([Ut,Vt,$a,Du]),mp=o.union([qt,za,Va,Ha]),vp=o.union([zt,_u,Pu,Nu]),gp=o.union([Ut,Vt,mu,eu,Kc,hu,uu]),yp=o.union([qt,zc,Iu,cu,su,Zc,Qc,Wc,fn,pu]),We=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Cu=6e4,Zt=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Ut,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Vt,t=>{this._onprogress(t)}),this.setRequestHandler(zt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new We(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let l=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,d)=>{l?.(c,d),Da(c)||an(c)?this._onresponse(c):Js(c)?this._onrequest(c,d):en(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new We(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let c={signal:l.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:d=>this.notification(d,{relatedRequestId:e.id}),sendRequest:(d,p,m)=>this.request(d,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(d=>{if(!l.signal.aborted)return i?.send({result:d,jsonrpc:"2.0",id:e.id})},d=>{var p;if(!l.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:Ge.InternalError,message:(p=d.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),l=this._timeoutInfo.get(r);if(l&&i&&l.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Da(e))s(e);else{let r=new We(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s??{};return new Promise((l,c)=>{var d,p,m,E,u,g;if(!this._transport){c(new Error("Not connected"));return}((d=this._options)===null||d===void 0?void 0:d.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let _=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),v.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});let S=T=>{var A;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(T)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(T)};this._responseHandlers.set(_,T=>{var A;if(!(!((A=s?.signal)===null||A===void 0)&&A.aborted)){if(T instanceof Error)return c(T);try{let N=t.parse(T.result);l(N)}catch(N){c(N)}}}),(E=s?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var T;S((T=s?.signal)===null||T===void 0?void 0:T.reason)});let O=(u=s?.timeout)!==null&&u!==void 0?u:Cu,R=()=>S(new We(Ge.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(_,O,s?.maxTotalTimeout,R,(g=s?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(T=>{this._cleanupTimeout(_),c(T)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let d={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(d,t).catch(p=>this._onerror(p))});return}let l={...e,jsonrpc:"2.0"};await this._transport.send(l,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function pn(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var vo=Ol(mo(),1),da=class extends Zt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Pt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler($a,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ua,async(r,n)=>{var i;let l=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,d=Pt.safeParse(c);return d.success&&this._loggingLevels.set(l,d.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=pn(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Qs.includes(t)?t:Na,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},qt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},za,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Va,t);if(s.action==="accept"&&s.content)try{let r=new vo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new We(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof We?r:new We(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ha,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import yo from"node:process";var fa=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),pf(t)}clear(){this._buffer=void 0}};function pf(a){return sn.parse(JSON.parse(a))}function go(a){return JSON.stringify(a)+` -`}var pa=class{constructor(e=yo.stdin,t=yo.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new fa,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=go(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var Eo=Symbol("Let zodToJsonSchema decide on which parser to use");var _o={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},bo=a=>typeof a=="string"?{..._o,name:a}:{..._o,...a};var So=a=>{let e=bo(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function ms(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ms(a,e,s,r)}var ha=(a,e)=>{let t=0;for(;tZ(a.innerType._def,e);function vs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>vs(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hf(a,e)}}var hf=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Oo(a,e){return{...Z(a.innerType._def,e),default:a.defaultValue()}}function wo(a,e){return e.effectStrategy==="input"?Z(a.schema._def,e):fe(e)}function Io(a){return{type:"string",enum:Array.from(a.values)}}var mf=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Ao(a,e){let t=[Z(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Z(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(mf(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:l,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function No(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var gs,We={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(gs===void 0&&(gs=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),gs),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function va(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Je(t,"email",s.message,e);break;case"format:idn-email":Je(t,"idn-email",s.message,e);break;case"pattern:zod":Ne(t,We.email,s.message,e);break}break;case"url":Je(t,"uri",s.message,e);break;case"uuid":Je(t,"uuid",s.message,e);break;case"regex":Ne(t,s.regex,s.message,e);break;case"cuid":Ne(t,We.cuid,s.message,e);break;case"cuid2":Ne(t,We.cuid2,s.message,e);break;case"startsWith":Ne(t,RegExp(`^${ys(s.value,e)}`),s.message,e);break;case"endsWith":Ne(t,RegExp(`${ys(s.value,e)}$`),s.message,e);break;case"datetime":Je(t,"date-time",s.message,e);break;case"date":Je(t,"date",s.message,e);break;case"time":Je(t,"time",s.message,e);break;case"duration":Je(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ne(t,RegExp(ys(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Je(t,"ipv4",s.message,e),s.version!=="v4"&&Je(t,"ipv6",s.message,e);break}case"base64url":Ne(t,We.base64url,s.message,e);break;case"jwt":Ne(t,We.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ne(t,We.ipv4Cidr,s.message,e),s.version!=="v4"&&Ne(t,We.ipv6Cidr,s.message,e);break}case"emoji":Ne(t,We.emoji(),s.message,e);break;case"ulid":{Ne(t,We.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Je(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ne(t,We.base64,s.message,e);break}}break}case"nanoid":Ne(t,We.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function ys(a,e){return e.patternStrategy==="escape"?gf(a):a}var vf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function gf(a){let e="";for(let t=0;tr.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function Ne(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Do(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Do(e,s),t,s)}function Do(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,i=!1,l=!1;for(let c=0;c{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=go(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var Eo=Symbol("Let zodToJsonSchema decide on which parser to use");var _o={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},bo=a=>typeof a=="string"?{..._o,name:a}:{..._o,...a};var So=a=>{let e=bo(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function ms(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,ms(a,e,s,r)}var ha=(a,e)=>{let t=0;for(;tZ(a.innerType._def,e);function vs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>vs(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return hf(a,e)}}var hf=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Oo(a,e){return{...Z(a.innerType._def,e),default:a.defaultValue()}}function wo(a,e){return e.effectStrategy==="input"?Z(a.schema._def,e):fe(e)}function Io(a){return{type:"string",enum:Array.from(a.values)}}var mf=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Ao(a,e){let t=[Z(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Z(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(mf(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:l,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function No(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var gs,Ke={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(gs===void 0&&(gs=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),gs),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function va(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Je(t,"email",s.message,e);break;case"format:idn-email":Je(t,"idn-email",s.message,e);break;case"pattern:zod":Ne(t,Ke.email,s.message,e);break}break;case"url":Je(t,"uri",s.message,e);break;case"uuid":Je(t,"uuid",s.message,e);break;case"regex":Ne(t,s.regex,s.message,e);break;case"cuid":Ne(t,Ke.cuid,s.message,e);break;case"cuid2":Ne(t,Ke.cuid2,s.message,e);break;case"startsWith":Ne(t,RegExp(`^${ys(s.value,e)}`),s.message,e);break;case"endsWith":Ne(t,RegExp(`${ys(s.value,e)}$`),s.message,e);break;case"datetime":Je(t,"date-time",s.message,e);break;case"date":Je(t,"date",s.message,e);break;case"time":Je(t,"time",s.message,e);break;case"duration":Je(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ne(t,RegExp(ys(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Je(t,"ipv4",s.message,e),s.version!=="v4"&&Je(t,"ipv6",s.message,e);break}case"base64url":Ne(t,Ke.base64url,s.message,e);break;case"jwt":Ne(t,Ke.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ne(t,Ke.ipv4Cidr,s.message,e),s.version!=="v4"&&Ne(t,Ke.ipv6Cidr,s.message,e);break}case"emoji":Ne(t,Ke.emoji(),s.message,e);break;case"ulid":{Ne(t,Ke.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Je(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ne(t,Ke.base64,s.message,e);break}}break}case"nanoid":Ne(t,Ke.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function ys(a,e){return e.patternStrategy==="escape"?gf(a):a}var vf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function gf(a){let e="";for(let t=0;tr.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function Ne(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Do(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Do(e,s),t,s)}function Do(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,i=!1,l=!1;for(let c=0;c({...s,[r]:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===w.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=va(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===w.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===w.ZodBranded&&a.keyType._def.type._def.typeName===w.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ma(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Co(a,e){if(e.mapStrategy==="record")return ga(a,e);let t=Z(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function $o(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function ko(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Lo(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ot={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Fo(a,e){if(e.target==="openApi3")return jo(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ot&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=Ot[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,l)=>l.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return jo(a,e)}var jo=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>Z(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Mo(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ot[a.innerType._def.typeName],nullable:!0}:{type:[Ot[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=Z(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=Z(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function qo(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ms(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Uo(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let l in n){let c=n[l];if(c===void 0||c._def===void 0)continue;let d=_f(c);d&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),d=!1);let p=Z(c._def,{...e,currentPath:[...e.currentPath,"properties",l],propertyPath:[...e.currentPath,"properties",l]});p!==void 0&&(s.properties[l]=p,d||r.push(l))}r.length&&(s.required=r);let i=yf(a,e);return i!==void 0&&(s.additionalProperties=i),s}function yf(a,e){if(a.catchall._def.typeName!=="ZodNever")return Z(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function _f(a){try{return a.isOptional()}catch{return!0}}var zo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Z(a.innerType._def,e);let t=Z(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Vo=(a,e)=>{if(e.pipeStrategy==="input")return Z(a.in._def,e);if(e.pipeStrategy==="output")return Z(a.out._def,e);let t=Z(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Z(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Ho(a,e){return Z(a.type._def,e)}function Bo(a,e){let s={type:"array",uniqueItems:!0,items:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Zo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>Z(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:Z(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>Z(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Xo(a){return{not:fe(a)}}function Qo(a){return fe(a)}var Go=(a,e)=>Z(a.innerType._def,e);var Ko=(a,e,t)=>{switch(e){case w.ZodString:return va(a,t);case w.ZodNumber:return qo(a,t);case w.ZodObject:return Uo(a,t);case w.ZodBigInt:return Po(a,t);case w.ZodBoolean:return Ro();case w.ZodDate:return vs(a,t);case w.ZodUndefined:return Xo(t);case w.ZodNull:return Lo(t);case w.ZodArray:return xo(a,t);case w.ZodUnion:case w.ZodDiscriminatedUnion:return Fo(a,t);case w.ZodIntersection:return Ao(a,t);case w.ZodTuple:return Zo(a,t);case w.ZodRecord:return ga(a,t);case w.ZodLiteral:return No(a,t);case w.ZodEnum:return Io(a);case w.ZodNativeEnum:return $o(a);case w.ZodNullable:return Mo(a,t);case w.ZodOptional:return zo(a,t);case w.ZodMap:return Co(a,t);case w.ZodSet:return Bo(a,t);case w.ZodLazy:return()=>a.getter()._def;case w.ZodPromise:return Ho(a,t);case w.ZodNaN:case w.ZodNever:return ko(t);case w.ZodEffects:return wo(a,t);case w.ZodAny:return fe(t);case w.ZodUnknown:return Qo(t);case w.ZodDefault:return Oo(a,t);case w.ZodBranded:return ma(a,t);case w.ZodReadonly:return Go(a,t);case w.ZodCatch:return To(a,t);case w.ZodPipeline:return Vo(a,t);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})(e)}};function Z(a,e,t=!1){let s=e.seen.get(a);if(e.override){let l=e.override?.(a,e,s,t);if(l!==Eo)return l}if(s&&!t){let l=Ef(s,e);if(l!==void 0)return l}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Ko(a,a.typeName,e),i=typeof n=="function"?Z(n(),e):n;if(i&&bf(a,e,i),e.postProcess){let l=e.postProcess(i,a,e);return r.jsonSchema=i,l}return r.jsonSchema=i,i}var Ef=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:ha(e.currentPath,a.path)};case"none":case"seen":return a.path.lengthe.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},bf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var _s=(a,e)=>{let t=So(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[d,p])=>({...c,[d]:Z(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,d]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=Z(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let l=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l};import{basename as wf}from"path";import Tf from"better-sqlite3";import{join as Ye,dirname as Sf,basename as pg}from"path";import{homedir as Wo}from"os";import{existsSync as gg,mkdirSync as xf}from"fs";import{fileURLToPath as Pf}from"url";function Rf(){return typeof __dirname<"u"?__dirname:Sf(Pf(import.meta.url))}var _g=Rf(),or=process.env.CLAUDE_MEM_DATA_DIR||Ye(Wo(),".claude-mem"),Es=process.env.CLAUDE_CONFIG_DIR||Ye(Wo(),".claude"),Eg=Ye(or,"archives"),bg=Ye(or,"logs"),Sg=Ye(or,"trash"),xg=Ye(or,"backups"),Pg=Ye(or,"settings.json"),ya=Ye(or,"claude-mem.db"),Rg=Ye(Es,"settings.json"),Tg=Ye(Es,"commands"),Og=Ye(Es,"CLAUDE.md");function _a(a){xf(a,{recursive:!0})}var Ea=class{db;constructor(e){e||(_a(or),e=ya),this.db=new Tf(e),this.db.pragma("journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(s=>s.name==="observations_fts"||s.name==="session_summaries_fts"))return;console.error("[SessionSearch] Creating FTS5 tables..."),this.db.exec(` +]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(i=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function ga(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===w.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===w.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=va(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===w.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===w.ZodBranded&&a.keyType._def.type._def.typeName===w.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ma(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Co(a,e){if(e.mapStrategy==="record")return ga(a,e);let t=Z(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function $o(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function ko(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Lo(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ot={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Fo(a,e){if(e.target==="openApi3")return jo(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ot&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=Ot[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,l)=>l.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return jo(a,e)}var jo=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>Z(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Mo(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ot[a.innerType._def.typeName],nullable:!0}:{type:[Ot[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=Z(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=Z(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function qo(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ms(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Uo(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let l in n){let c=n[l];if(c===void 0||c._def===void 0)continue;let d=_f(c);d&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),d=!1);let p=Z(c._def,{...e,currentPath:[...e.currentPath,"properties",l],propertyPath:[...e.currentPath,"properties",l]});p!==void 0&&(s.properties[l]=p,d||r.push(l))}r.length&&(s.required=r);let i=yf(a,e);return i!==void 0&&(s.additionalProperties=i),s}function yf(a,e){if(a.catchall._def.typeName!=="ZodNever")return Z(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function _f(a){try{return a.isOptional()}catch{return!0}}var zo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Z(a.innerType._def,e);let t=Z(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Vo=(a,e)=>{if(e.pipeStrategy==="input")return Z(a.in._def,e);if(e.pipeStrategy==="output")return Z(a.out._def,e);let t=Z(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=Z(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Ho(a,e){return Z(a.type._def,e)}function Bo(a,e){let s={type:"array",uniqueItems:!0,items:Z(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Zo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>Z(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:Z(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>Z(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Xo(a){return{not:fe(a)}}function Qo(a){return fe(a)}var Go=(a,e)=>Z(a.innerType._def,e);var Wo=(a,e,t)=>{switch(e){case w.ZodString:return va(a,t);case w.ZodNumber:return qo(a,t);case w.ZodObject:return Uo(a,t);case w.ZodBigInt:return Ro(a,t);case w.ZodBoolean:return Po();case w.ZodDate:return vs(a,t);case w.ZodUndefined:return Xo(t);case w.ZodNull:return Lo(t);case w.ZodArray:return xo(a,t);case w.ZodUnion:case w.ZodDiscriminatedUnion:return Fo(a,t);case w.ZodIntersection:return Ao(a,t);case w.ZodTuple:return Zo(a,t);case w.ZodRecord:return ga(a,t);case w.ZodLiteral:return No(a,t);case w.ZodEnum:return Io(a);case w.ZodNativeEnum:return $o(a);case w.ZodNullable:return Mo(a,t);case w.ZodOptional:return zo(a,t);case w.ZodMap:return Co(a,t);case w.ZodSet:return Bo(a,t);case w.ZodLazy:return()=>a.getter()._def;case w.ZodPromise:return Ho(a,t);case w.ZodNaN:case w.ZodNever:return ko(t);case w.ZodEffects:return wo(a,t);case w.ZodAny:return fe(t);case w.ZodUnknown:return Qo(t);case w.ZodDefault:return Oo(a,t);case w.ZodBranded:return ma(a,t);case w.ZodReadonly:return Go(a,t);case w.ZodCatch:return To(a,t);case w.ZodPipeline:return Vo(a,t);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})(e)}};function Z(a,e,t=!1){let s=e.seen.get(a);if(e.override){let l=e.override?.(a,e,s,t);if(l!==Eo)return l}if(s&&!t){let l=Ef(s,e);if(l!==void 0)return l}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Wo(a,a.typeName,e),i=typeof n=="function"?Z(n(),e):n;if(i&&bf(a,e,i),e.postProcess){let l=e.postProcess(i,a,e);return r.jsonSchema=i,l}return r.jsonSchema=i,i}var Ef=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:ha(e.currentPath,a.path)};case"none":case"seen":return a.path.lengthe.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},bf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var _s=(a,e)=>{let t=So(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[d,p])=>({...c,[d]:Z(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,d]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=Z(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let l=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l};import{basename as wf}from"path";import Tf from"better-sqlite3";import{join as Ye,dirname as Sf,basename as pg}from"path";import{homedir as Ko}from"os";import{existsSync as gg,mkdirSync as xf}from"fs";import{fileURLToPath as Rf}from"url";function Pf(){return typeof __dirname<"u"?__dirname:Sf(Rf(import.meta.url))}var _g=Pf(),or=process.env.CLAUDE_MEM_DATA_DIR||Ye(Ko(),".claude-mem"),Es=process.env.CLAUDE_CONFIG_DIR||Ye(Ko(),".claude"),Eg=Ye(or,"archives"),bg=Ye(or,"logs"),Sg=Ye(or,"trash"),xg=Ye(or,"backups"),Rg=Ye(or,"settings.json"),ya=Ye(or,"claude-mem.db"),Pg=Ye(Es,"settings.json"),Tg=Ye(Es,"commands"),Og=Ye(Es,"CLAUDE.md");function _a(a){xf(a,{recursive:!0})}var Ea=class{db;constructor(e){e||(_a(or),e=ya),this.db=new Tf(e),this.db.pragma("journal_mode = WAL"),this.ensureFTSTables()}ensureFTSTables(){try{if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'").all().some(s=>s.name==="observations_fts"||s.name==="session_summaries_fts"))return;console.error("[SessionSearch] Creating FTS5 tables..."),this.db.exec(` CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5( title, subtitle, @@ -92,34 +92,30 @@ var El=Object.create;var Oa=Object.defineProperty;var bl=Object.getOwnPropertyDe ${(p?`AND ${p}`:"").replace(/files_read/g,"files_read").replace(/files_modified/g,"files_edited")} ${i==="relevance"?"ORDER BY session_summaries_fts.rank ASC":i==="date_asc"?"ORDER BY s.created_at_epoch ASC":"ORDER BY s.created_at_epoch DESC"} LIMIT ? OFFSET ? - `;s.push(r,n);let _=this.db.prepare(g).all(...s);if(_.length>0){let v=Math.min(..._.map(P=>P.rank||0)),T=Math.max(..._.map(P=>P.rank||0))-v||1;_.forEach(P=>{P.rank!==void 0&&(P.score=1-(P.rank-v)/T)})}return _}findByConcept(e,t={}){let s=[],{limit:r=20,offset:n=0,orderBy:i="date_desc",...l}=t,c={...l,concepts:e},d=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` + `;s.push(r,n);let _=this.db.prepare(g).all(...s);if(_.length>0){let v=Math.min(..._.map(R=>R.rank||0)),O=Math.max(..._.map(R=>R.rank||0))-v||1;_.forEach(R=>{R.rank!==void 0&&(R.score=1-(R.rank-v)/O)})}return _}findByConcept(e,t={}){let s=[],r={...t,concepts:e},i=` SELECT o.* FROM observations o - WHERE ${d} - ${p} - LIMIT ? OFFSET ? - `;return s.push(r,n),this.db.prepare(m).all(...s)}findByFile(e,t={}){let s=[],{limit:r=20,offset:n=0,orderBy:i="date_desc",...l}=t,c={...l,files:e},d=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` + WHERE ${this.buildFilterClause(r,s,"o")} + ORDER BY o.created_at_epoch DESC + `;return this.db.prepare(i).all(...s)}findByFile(e,t={}){let s=[],r={...t,files:e},i=` SELECT o.* FROM observations o - WHERE ${d} - ${p} - LIMIT ? OFFSET ? - `;s.push(r,n);let E=this.db.prepare(m).all(...s),u=[],g={...l};delete g.type;let _=[];if(g.project&&(_.push("s.project = ?"),u.push(g.project)),g.dateRange){let{start:P,end:R}=g.dateRange;if(P){let I=typeof P=="number"?P:new Date(P).getTime();_.push("s.created_at_epoch >= ?"),u.push(I)}if(R){let I=typeof R=="number"?R:new Date(R).getTime();_.push("s.created_at_epoch <= ?"),u.push(I)}}_.push(`( + WHERE ${this.buildFilterClause(r,s,"o")} + ORDER BY o.created_at_epoch DESC + `,l=this.db.prepare(i).all(...s),c=[],d={...t};delete d.type;let p=[];if(d.project&&(p.push("s.project = ?"),c.push(d.project)),d.dateRange){let{start:u,end:g}=d.dateRange;if(u){let _=typeof u=="number"?u:new Date(u).getTime();p.push("s.created_at_epoch >= ?"),c.push(_)}if(g){let _=typeof g=="number"?g:new Date(g).getTime();p.push("s.created_at_epoch <= ?"),c.push(_)}}p.push(`( EXISTS (SELECT 1 FROM json_each(s.files_read) WHERE value LIKE ?) OR EXISTS (SELECT 1 FROM json_each(s.files_edited) WHERE value LIKE ?) - )`),u.push(`%${e}%`,`%${e}%`);let v=i==="date_desc"?"ORDER BY s.created_at_epoch DESC":i==="date_asc"?"ORDER BY s.created_at_epoch ASC":"ORDER BY s.created_at_epoch DESC",S=` + )`),c.push(`%${e}%`,`%${e}%`);let m=` SELECT s.* FROM session_summaries s - WHERE ${_.join(" AND ")} - ${v} - LIMIT ? OFFSET ? - `;u.push(r,n);let T=this.db.prepare(S).all(...u);return{observations:E,sessions:T}}findByType(e,t={}){let s=[],{limit:r=20,offset:n=0,orderBy:i="date_desc",...l}=t,c={...l,type:e},d=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` + WHERE ${p.join(" AND ")} + ORDER BY s.created_at_epoch DESC + `,E=this.db.prepare(m).all(...c);return{observations:l,sessions:E}}findByType(e,t={}){let s=[],r={...t,type:e},i=` SELECT o.* FROM observations o - WHERE ${d} - ${p} - LIMIT ? OFFSET ? - `;return s.push(r,n),this.db.prepare(m).all(...s)}advancedSearch(e){let{textQuery:t,searchSessions:s=!0,...r}=e,n=[],i=[];if(t)n=this.searchObservations(t,r),s&&(i=this.searchSessions(t,r));else{let l=[],c=this.buildFilterClause(r,l,"o");if(c){let d=` + WHERE ${this.buildFilterClause(r,s,"o")} + ORDER BY o.created_at_epoch DESC + `;return this.db.prepare(i).all(...s)}advancedSearch(e){let{textQuery:t,searchSessions:s=!0,...r}=e,n=[],i=[];if(t)n=this.searchObservations(t,r),s&&(i=this.searchSessions(t,r));else{let l=[],c=this.buildFilterClause(r,l,"o");if(c){let d=` SELECT o.* FROM observations o WHERE ${c} @@ -133,7 +129,7 @@ var El=Object.create;var Oa=Object.defineProperty;var bl=Object.getOwnPropertyDe LIMIT ? OFFSET ? `;d.push(r.limit||50,r.offset||0),i=this.db.prepare(E).all(...d)}}}return{observations:n,sessions:i}}close(){this.db.close()}};import Of from"better-sqlite3";var bs=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.SILENT=4]="SILENT",n))(bs||{}),Ss=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=bs[e]??1,this.useColor=process.stdout.isTTY??!1}correlationId(e,t){return`obs-${e}-${t}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.level===0?`${e.message} ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Object.keys(e);return t.length===0?"{}":t.length<=3?JSON.stringify(e):`{${t.length} keys: ${t.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,t){if(!t)return e;try{let s=typeof t=="string"?JSON.parse(t):t;if(e==="Bash"&&s.command){let r=s.command.length>50?s.command.substring(0,50)+"...":s.command;return`${e}(${r})`}if(e==="Read"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Edit"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Write"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}return e}catch{return e}}log(e,t,s,r,n){if(e0&&(m=` {${Object.entries(v).map(([T,P])=>`${T}=${P}`).join(", ")}}`)}let E=`[${i}] [${l}] [${c}] ${d}${s}${m}${p}`;e===3?console.error(E):console.log(E)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}},Jo=new Ss;var ba=class{db;constructor(){_a(or),this.db=new Of(ya),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` +`+JSON.stringify(n,null,2):p=" "+this.formatData(n));let m="";if(r){let{sessionId:u,sdkSessionId:g,correlationId:_,...v}=r;Object.keys(v).length>0&&(m=` {${Object.entries(v).map(([O,R])=>`${O}=${R}`).join(", ")}}`)}let E=`[${i}] [${l}] [${c}] ${d}${s}${m}${p}`;e===3?console.error(E):console.log(E)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}},Jo=new Ss;var ba=class{db;constructor(){_a(or),this.db=new Of(ya),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -283,16 +279,15 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Obje s.started_at, s.started_at_epoch, s.user_prompt, - CASE WHEN EXISTS(SELECT 1 FROM session_summaries WHERE sdk_session_id = s.sdk_session_id) THEN 1 ELSE 0 END as has_summary, - COALESCE(MAX(ss.created_at_epoch), s.started_at_epoch) as latest_activity_epoch + CASE WHEN sum.sdk_session_id IS NOT NULL THEN 1 ELSE 0 END as has_summary FROM sdk_sessions s - LEFT JOIN session_summaries ss ON s.sdk_session_id = ss.sdk_session_id + LEFT JOIN session_summaries sum ON s.sdk_session_id = sum.sdk_session_id WHERE s.project = ? AND s.sdk_session_id IS NOT NULL GROUP BY s.sdk_session_id - ORDER BY latest_activity_epoch DESC + ORDER BY s.started_at_epoch DESC LIMIT ? ) - ORDER BY latest_activity_epoch ASC + ORDER BY started_at_epoch ASC `).all(e,t)}getObservationsForSession(e){return this.db.prepare(` SELECT title, subtitle, type, prompt_number FROM observations @@ -311,11 +306,21 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Obje FROM sdk_sessions WHERE id = ? LIMIT 1 - `).get(e)||null}findSDKSession(e){return this.db.prepare(` + `).get(e)||null}findActiveSDKSession(e){return this.db.prepare(` SELECT id, sdk_session_id, project, worker_port FROM sdk_sessions + WHERE claude_session_id = ? AND status = 'active' + LIMIT 1 + `).get(e)||null}findAnySDKSession(e){return this.db.prepare(` + SELECT id + FROM sdk_sessions WHERE claude_session_id = ? - `).get(e)||null}incrementPromptCounter(e){return this.db.prepare(` + LIMIT 1 + `).get(e)||null}reactivateSession(e,t){this.db.prepare(` + UPDATE sdk_sessions + SET status = 'active', user_prompt = ?, worker_port = NULL + WHERE id = ? + `).run(t,e)}incrementPromptCounter(e){return this.db.prepare(` UPDATE sdk_sessions SET prompt_counter = COALESCE(prompt_counter, 0) + 1 WHERE id = ? @@ -350,36 +355,48 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Obje (sdk_session_id, project, request, investigated, learned, completed, next_steps, notes, prompt_number, created_at, created_at_epoch) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - `).run(e,t,s.request,s.investigated,s.learned,s.completed,s.next_steps,s.notes,r||null,n.toISOString(),i)}close(){this.db.close()}};var Kr,Sa;try{Kr=new Ea,Sa=new ba}catch(a){console.error("[search-server] Failed to initialize search:",a.message),process.exit(1)}function wt(a,e){let t=a.title||`Observation #${a.id}`,s=[];s.push(`## ${t}`),s.push(`*Source: claude-mem://observation/${a.id}*`),s.push(""),a.subtitle&&(s.push(`**${a.subtitle}**`),s.push("")),a.narrative&&(s.push(a.narrative),s.push("")),a.text&&(s.push(a.text),s.push(""));let r=[];if(r.push(`Type: ${a.type}`),a.facts)try{let n=JSON.parse(a.facts);n.length>0&&r.push(`Facts: ${n.join("; ")}`)}catch{}if(a.concepts)try{let n=JSON.parse(a.concepts);n.length>0&&r.push(`Concepts: ${n.join(", ")}`)}catch{}if(a.files_read||a.files_modified){let n=[];if(a.files_read)try{n.push(...JSON.parse(a.files_read))}catch{}if(a.files_modified)try{n.push(...JSON.parse(a.files_modified))}catch{}n.length>0&&r.push(`Files: ${[...new Set(n)].join(", ")}`)}return r.length>0&&(s.push("---"),s.push(r.join(" | "))),s.join(` + `).run(e,t,s.request,s.investigated,s.learned,s.completed,s.next_steps,s.notes,r||null,n.toISOString(),i)}markSessionCompleted(e){let t=new Date,s=t.getTime();this.db.prepare(` + UPDATE sdk_sessions + SET status = 'completed', completed_at = ?, completed_at_epoch = ? + WHERE id = ? + `).run(t.toISOString(),s,e)}markSessionFailed(e){let t=new Date,s=t.getTime();this.db.prepare(` + UPDATE sdk_sessions + SET status = 'failed', completed_at = ?, completed_at_epoch = ? + WHERE id = ? + `).run(t.toISOString(),s,e)}cleanupOrphanedSessions(){let e=new Date,t=e.getTime();return this.db.prepare(` + UPDATE sdk_sessions + SET status = 'failed', completed_at = ?, completed_at_epoch = ? + WHERE status = 'active' + `).run(e.toISOString(),t).changes}close(){this.db.close()}};var Wr,Sa;try{Wr=new Ea,Sa=new ba}catch(a){console.error("[search-server] Failed to initialize search:",a.message),process.exit(1)}function wt(a,e){let t=a.title||`Observation #${a.id}`,s=[];s.push(`## ${t}`),s.push(`*Source: claude-mem://observation/${a.id}*`),s.push(""),a.subtitle&&(s.push(`**${a.subtitle}**`),s.push("")),a.narrative&&(s.push(a.narrative),s.push("")),a.text&&(s.push(a.text),s.push(""));let r=[];if(r.push(`Type: ${a.type}`),a.facts)try{let n=JSON.parse(a.facts);n.length>0&&r.push(`Facts: ${n.join("; ")}`)}catch{}if(a.concepts)try{let n=JSON.parse(a.concepts);n.length>0&&r.push(`Concepts: ${n.join(", ")}`)}catch{}if(a.files_read||a.files_modified){let n=[];if(a.files_read)try{n.push(...JSON.parse(a.files_read))}catch{}if(a.files_modified)try{n.push(...JSON.parse(a.files_modified))}catch{}n.length>0&&r.push(`Files: ${[...new Set(n)].join(", ")}`)}return r.length>0&&(s.push("---"),s.push(r.join(" | "))),s.join(` `)}function xs(a,e){let t=a.request||`Session ${a.sdk_session_id.substring(0,8)}`,s=[];s.push(`## ${t}`),s.push(`*Source: claude-mem://session/${a.sdk_session_id}*`),s.push(""),a.completed&&(s.push(`**Completed:** ${a.completed}`),s.push("")),a.learned&&(s.push(`**Learned:** ${a.learned}`),s.push("")),a.investigated&&(s.push(`**Investigated:** ${a.investigated}`),s.push("")),a.next_steps&&(s.push(`**Next Steps:** ${a.next_steps}`),s.push("")),a.notes&&(s.push(`**Notes:** ${a.notes}`),s.push(""));let r=[];if(a.files_read||a.files_edited){let i=[];if(a.files_read)try{i.push(...JSON.parse(a.files_read))}catch{}if(a.files_edited)try{i.push(...JSON.parse(a.files_edited))}catch{}i.length>0&&r.push(`Files: ${[...new Set(i)].join(", ")}`)}let n=new Date(a.created_at_epoch).toLocaleDateString();return r.push(`Date: ${n}`),r.length>0&&(s.push("---"),s.push(r.join(" | "))),s.join(` -`)}var Yo=o.object({project:o.string().optional().describe("Filter by project name"),type:o.union([o.enum(["decision","bugfix","feature","refactor","discovery","change"]),o.array(o.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).optional().describe("Filter by observation type"),concepts:o.union([o.string(),o.array(o.string())]).optional().describe("Filter by concept tags"),files:o.union([o.string(),o.array(o.string())]).optional().describe("Filter by file paths (partial match)"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional().describe("Start date (ISO string or epoch)"),end:o.union([o.string(),o.number()]).optional().describe("End date (ISO string or epoch)")}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")}),el=[{name:"search_observations",description:"Search observations using full-text search across titles, narratives, facts, and concepts",inputSchema:o.object({query:o.string().describe("Search query for FTS5 full-text search"),...Yo.shape}),handler:async a=>{try{let{query:e,...t}=a,s=Kr.searchObservations(e,t);return s.length===0?{content:[{type:"text",text:`No observations found matching "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` +`)}var Yo=o.object({project:o.string().optional().describe("Filter by project name"),type:o.union([o.enum(["decision","bugfix","feature","refactor","discovery","change"]),o.array(o.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).optional().describe("Filter by observation type"),concepts:o.union([o.string(),o.array(o.string())]).optional().describe("Filter by concept tags"),files:o.union([o.string(),o.array(o.string())]).optional().describe("Filter by file paths (partial match)"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional().describe("Start date (ISO string or epoch)"),end:o.union([o.string(),o.number()]).optional().describe("End date (ISO string or epoch)")}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")}),el=[{name:"search_observations",description:"Search observations using full-text search across titles, narratives, facts, and concepts",inputSchema:o.object({query:o.string().describe("Search query for FTS5 full-text search"),...Yo.shape}),handler:async a=>{try{let{query:e,...t}=a,s=Wr.searchObservations(e,t);return s.length===0?{content:[{type:"text",text:`No observations found matching "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` --- -`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"search_sessions",description:"Search session summaries using full-text search across requests, completions, learnings, and notes",inputSchema:o.object({query:o.string().describe("Search query for FTS5 full-text search"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")}),handler:async a=>{try{let{query:e,...t}=a,s=Kr.searchSessions(e,t);return s.length===0?{content:[{type:"text",text:`No sessions found matching "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>xs(i,l)).join(` +`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"search_sessions",description:"Search session summaries using full-text search across requests, completions, learnings, and notes",inputSchema:o.object({query:o.string().describe("Search query for FTS5 full-text search"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order")}),handler:async a=>{try{let{query:e,...t}=a,s=Wr.searchSessions(e,t);return s.length===0?{content:[{type:"text",text:`No sessions found matching "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>xs(i,l)).join(` --- -`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_concept",description:"Find observations tagged with a specific concept",inputSchema:o.object({concept:o.string().describe("Concept tag to search for"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{concept:e,...t}=a,s=Kr.findByConcept(e,t);return s.length===0?{content:[{type:"text",text:`No observations found with concept "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` +`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_concept",description:"Find observations tagged with a specific concept",inputSchema:o.object({concept:o.string().describe("Concept tag to search for"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{concept:e,...t}=a,s=Wr.findByConcept(e,t);return s.length===0?{content:[{type:"text",text:`No observations found with concept "${e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` --- -`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_file",description:"Find observations and sessions that reference a specific file path",inputSchema:o.object({filePath:o.string().describe("File path to search for (supports partial matching)"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{filePath:e,...t}=a,s=Kr.findByFile(e,t);if(s.observations.length+s.sessions.length===0)return{content:[{type:"text",text:`No results found for file "${e}"`}]};let n=[];return s.observations.forEach((l,c)=>{n.push(wt(l,c))}),s.sessions.forEach((l,c)=>{n.push(xs(l,c+s.observations.length))}),{content:[{type:"text",text:n.join(` +`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_file",description:"Find observations and sessions that reference a specific file path",inputSchema:o.object({filePath:o.string().describe("File path to search for (supports partial matching)"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{filePath:e,...t}=a,s=Wr.findByFile(e,t);if(s.observations.length+s.sessions.length===0)return{content:[{type:"text",text:`No results found for file "${e}"`}]};let n=[];return s.observations.forEach((l,c)=>{n.push(wt(l,c))}),s.sessions.forEach((l,c)=>{n.push(xs(l,c+s.observations.length))}),{content:[{type:"text",text:n.join(` --- -`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_type",description:"Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change)",inputSchema:o.object({type:o.union([o.enum(["decision","bugfix","feature","refactor","discovery","change"]),o.array(o.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).describe("Observation type(s) to filter by"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{type:e,...t}=a,s=Kr.findByType(e,t);return s.length===0?{content:[{type:"text",text:`No observations found with type "${Array.isArray(e)?e.join(", "):e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` +`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_type",description:"Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change)",inputSchema:o.object({type:o.union([o.enum(["decision","bugfix","feature","refactor","discovery","change"]),o.array(o.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).describe("Observation type(s) to filter by"),project:o.string().optional().describe("Filter by project name"),dateRange:o.object({start:o.union([o.string(),o.number()]).optional(),end:o.union([o.string(),o.number()]).optional()}).optional().describe("Filter by date range"),limit:o.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:o.number().min(0).default(0).describe("Number of results to skip"),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{type:e,...t}=a,s=Wr.findByType(e,t);return s.length===0?{content:[{type:"text",text:`No observations found with type "${Array.isArray(e)?e.join(", "):e}"`}]}:{content:[{type:"text",text:s.map((i,l)=>wt(i,l)).join(` --- `)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"get_recent_context",description:"Get recent session context including summaries and observations for a project",inputSchema:o.object({project:o.string().optional().describe("Project name (defaults to current working directory basename)"),limit:o.number().min(1).max(10).default(3).describe("Number of recent sessions to retrieve")}),handler:async a=>{try{let e=a.project||wf(process.cwd()),t=a.limit||3,s=Sa.getRecentSessionsWithStatus(e,t);if(s.length===0)return{content:[{type:"text",text:`# Recent Session Context No previous sessions found for project "${e}".`}]};let r=[];r.push("# Recent Session Context"),r.push(""),r.push(`Showing last ${s.length} session(s) for **${e}**:`),r.push("");for(let n of s)if(n.sdk_session_id){if(r.push("---"),r.push(""),n.has_summary){let i=Sa.getSummaryForSession(n.sdk_session_id);if(i){let l=i.prompt_number?` (Prompt #${i.prompt_number})`:"";if(r.push(`**Summary${l}**`),r.push(""),i.request&&r.push(`**Request:** ${i.request}`),i.completed&&r.push(`**Completed:** ${i.completed}`),i.learned&&r.push(`**Learned:** ${i.learned}`),i.next_steps&&r.push(`**Next Steps:** ${i.next_steps}`),i.files_read)try{let d=JSON.parse(i.files_read);Array.isArray(d)&&d.length>0&&r.push(`**Files Read:** ${d.join(", ")}`)}catch{i.files_read.trim()&&r.push(`**Files Read:** ${i.files_read}`)}if(i.files_edited)try{let d=JSON.parse(i.files_edited);Array.isArray(d)&&d.length>0&&r.push(`**Files Edited:** ${d.join(", ")}`)}catch{i.files_edited.trim()&&r.push(`**Files Edited:** ${i.files_edited}`)}let c=new Date(i.created_at).toLocaleString();r.push(`**Date:** ${c}`)}}else if(n.status==="active"){r.push("**In Progress**"),r.push(""),n.user_prompt&&r.push(`**Request:** ${n.user_prompt}`);let i=Sa.getObservationsForSession(n.sdk_session_id);if(i.length>0){r.push(""),r.push(`**Observations (${i.length}):**`);for(let c of i)r.push(`- ${c.title}`)}else r.push(""),r.push("*No observations yet*");r.push(""),r.push("**Status:** Active - summary pending");let l=new Date(n.started_at).toLocaleString();r.push(`**Date:** ${l}`)}else{r.push(`**${n.status.charAt(0).toUpperCase()+n.status.slice(1)}**`),r.push(""),n.user_prompt&&r.push(`**Request:** ${n.user_prompt}`),r.push(""),r.push(`**Status:** ${n.status} - no summary available`);let i=new Date(n.started_at).toLocaleString();r.push(`**Date:** ${i}`)}r.push("")}return{content:[{type:"text",text:r.join(` -`)}]}}catch(e){return{content:[{type:"text",text:`Failed to get recent context: ${e.message}`}],isError:!0}}}},{name:"advanced_search",description:"Advanced search combining full-text search with structured filters across both observations and sessions",inputSchema:o.object({textQuery:o.string().optional().describe("Optional text query for FTS5 search"),searchSessions:o.boolean().default(!0).describe("Include session summaries in results"),...Yo.shape}),handler:async a=>{try{let e=Kr.advancedSearch(a);if(e.observations.length+e.sessions.length===0)return{content:[{type:"text",text:"No results found matching the search criteria"}]};let s=[];return e.observations.forEach((n,i)=>{s.push(wt(n,i))}),e.sessions.forEach((n,i)=>{s.push(xs(n,i+e.observations.length))}),{content:[{type:"text",text:s.join(` +`)}]}}catch(e){return{content:[{type:"text",text:`Failed to get recent context: ${e.message}`}],isError:!0}}}},{name:"advanced_search",description:"Advanced search combining full-text search with structured filters across both observations and sessions",inputSchema:o.object({textQuery:o.string().optional().describe("Optional text query for FTS5 search"),searchSessions:o.boolean().default(!0).describe("Include session summaries in results"),...Yo.shape}),handler:async a=>{try{let e=Wr.advancedSearch(a);if(e.observations.length+e.sessions.length===0)return{content:[{type:"text",text:"No results found matching the search criteria"}]};let s=[];return e.observations.forEach((n,i)=>{s.push(wt(n,i))}),e.sessions.forEach((n,i)=>{s.push(xs(n,i+e.observations.length))}),{content:[{type:"text",text:s.join(` --- -`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}}],Ps=new da({name:"claude-mem-search",version:"1.0.0"},{capabilities:{tools:{}}});Ps.setRequestHandler(Ma,async()=>({tools:el.map(a=>({name:a.name,description:a.description,inputSchema:_s(a.inputSchema)}))}));Ps.setRequestHandler(qa,async a=>{let e=el.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function If(){let a=new pa;await Ps.connect(a),console.error("[search-server] Claude-mem search server started")}If().catch(a=>{console.error("[search-server] Fatal error:",a),process.exit(1)}); +`)}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}}],Rs=new da({name:"claude-mem-search",version:"1.0.0"},{capabilities:{tools:{}}});Rs.setRequestHandler(Ma,async()=>({tools:el.map(a=>({name:a.name,description:a.description,inputSchema:_s(a.inputSchema)}))}));Rs.setRequestHandler(qa,async a=>{let e=el.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function If(){let a=new pa;await Rs.connect(a),console.error("[search-server] Claude-mem search server started")}If().catch(a=>{console.error("[search-server] Fatal error:",a),process.exit(1)}); /*! Bundled license information: uri-js/dist/es5/uri.all.js: