expect-cli 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-mcp.js +1 -1
- package/dist/browser-mcp.js.map +1 -1
- package/dist/index.js +44 -46
- package/dist/index.js.map +1 -1
- package/dist/server-D8tFfvqo.js +171 -0
- package/dist/server-D8tFfvqo.js.map +1 -0
- package/package.json +5 -4
- package/dist/server-DsSVRZK1.js +0 -193
- package/dist/server-DsSVRZK1.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-D8tFfvqo.js","names":["Browser","FileSystem","getPort","Arr","FileSystem","chromium","MS_PER_SECOND","SAME_SITE_NONE","SAME_SITE_LAX","SAME_SITE_STRICT","ChildProcessSpawner","FileSystem","os","FileSystem","execFileAsync","process","execFileAsync","process","execFileAsync","defaultBrowser","process","windows","Arr","getDefaultBrowser","os","ChildProcessSpawner","FileSystem","Arr","os","FileSystem","FileSystem","os","os","Arr","FileSystem","FileSystem","z","Ajv","process","z"],"sources":["../../../packages/browser/src/mcp/constants.ts","../../../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js","../../../packages/cookies/src/errors.ts","../../../packages/cookies/src/types.ts","../../../packages/cookies/src/cdp-client.ts","../../../packages/cookies/src/sqlite-client.ts","../../../packages/cookies/src/browser-config.ts","../../../packages/cookies/src/utils/crypto.ts","../../../packages/cookies/src/utils/chromium-normalize.ts","../../../packages/cookies/src/chromium-sqlite.ts","../../../packages/cookies/src/utils/binary-cookies.ts","../../../packages/cookies/src/cookies.ts","../../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js","../../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js","../../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js","../../../packages/cookies/src/browser-detector.ts","../../../packages/cookies/src/chromium.ts","../../../node_modules/.pnpm/ini@6.0.0/node_modules/ini/lib/ini.js","../../../packages/cookies/src/firefox.ts","../../../packages/cookies/src/safari.ts","../../../packages/cookies/src/layers.ts","../../../packages/browser/src/constants.ts","../../../packages/browser/src/errors.ts","../../../packages/browser/src/utils/action-error.ts","../../../packages/browser/src/utils/get-indent-level.ts","../../../packages/browser/src/utils/compact-tree.ts","../../../packages/browser/src/utils/resolve-locator.ts","../../../packages/browser/src/utils/create-locator.ts","../../../packages/browser/src/utils/evaluate-runtime.ts","../../../packages/browser/src/utils/find-cursor-interactive.ts","../../../packages/browser/src/utils/parse-aria-line.ts","../../../packages/browser/src/utils/resolve-nth-duplicates.ts","../../../packages/browser/src/utils/snapshot-stats.ts","../../../packages/browser/src/generated/runtime-script.ts","../../../packages/browser/src/browser.ts","../../../packages/browser/src/recorder.ts","../../../packages/browser/src/replay-viewer.ts","../../../packages/browser/src/mcp/errors.ts","../../../packages/browser/src/mcp/live-view-server.ts","../../../packages/browser/src/mcp/mcp-session.ts","../../../packages/browser/src/mcp/runtime.ts","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/Options.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/Refs.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/errorMessages.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/any.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/array.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/date.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/default.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/string.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/record.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/map.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/never.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/null.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/union.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/number.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/object.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/set.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/selectParser.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parseDef.js","../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js","../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../../../node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js","../../../node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json","../../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js","../../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js","../../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js","../../../node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js","../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js","../../../packages/browser/src/mcp/server.ts"],"sourcesContent":["export const EXPECT_LIVE_VIEW_URL_ENV_NAME = \"EXPECT_LIVE_VIEW_URL\";\nexport const EXPECT_REPLAY_OUTPUT_ENV_NAME = \"EXPECT_REPLAY_OUTPUT_PATH\";\nexport const LIVE_VIEW_PAGE_POLL_INTERVAL_MS = 500;\n","import net from 'node:net';\nimport os from 'node:os';\n\nclass Locked extends Error {\n\tconstructor(port) {\n\t\tsuper(`${port} is locked`);\n\t}\n}\n\nconst lockedPorts = {\n\told: new Set(),\n\tyoung: new Set(),\n};\n\n// On this interval, the old locked ports are discarded,\n// the young locked ports are moved to old locked ports,\n// and a new young set for locked ports are created.\nconst releaseOldLockedPortsIntervalMs = 1000 * 15;\n\nconst minPort = 1024;\nconst maxPort = 65_535;\n\n// Lazily create timeout on first use\nlet timeout;\n\nconst getLocalHosts = () => {\n\tconst interfaces = os.networkInterfaces();\n\n\t// Add undefined value for createServer function to use default host,\n\t// and default IPv4 host in case createServer defaults to IPv6.\n\tconst results = new Set([undefined, '0.0.0.0']);\n\n\tfor (const _interface of Object.values(interfaces)) {\n\t\tfor (const config of _interface) {\n\t\t\tresults.add(config.address);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nconst checkAvailablePort = options =>\n\tnew Promise((resolve, reject) => {\n\t\tconst server = net.createServer();\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.listen(options, () => {\n\t\t\tconst {port} = server.address();\n\t\t\tserver.close(() => {\n\t\t\t\tresolve(port);\n\t\t\t});\n\t\t});\n\t});\n\nconst getAvailablePort = async (options, hosts) => {\n\tif (options.host || options.port === 0) {\n\t\treturn checkAvailablePort(options);\n\t}\n\n\tfor (const host of hosts) {\n\t\ttry {\n\t\t\tawait checkAvailablePort({port: options.port, host}); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tif (!['EADDRNOTAVAIL', 'EINVAL'].includes(error.code)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn options.port;\n};\n\nconst portCheckSequence = function * (ports) {\n\tif (ports) {\n\t\tyield * ports;\n\t}\n\n\tyield 0; // Fall back to 0 if anything else failed\n};\n\nexport default async function getPorts(options) {\n\tlet ports;\n\tlet exclude = new Set();\n\n\tif (options) {\n\t\tif (options.port) {\n\t\t\tports = typeof options.port === 'number' ? [options.port] : options.port;\n\t\t}\n\n\t\tif (options.exclude) {\n\t\t\tconst excludeIterable = options.exclude;\n\n\t\t\tif (typeof excludeIterable[Symbol.iterator] !== 'function') {\n\t\t\t\tthrow new TypeError('The `exclude` option must be an iterable.');\n\t\t\t}\n\n\t\t\tfor (const element of excludeIterable) {\n\t\t\t\tif (typeof element !== 'number') {\n\t\t\t\t\tthrow new TypeError('Each item in the `exclude` option must be a number corresponding to the port you want excluded.');\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isSafeInteger(element)) {\n\t\t\t\t\tthrow new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texclude = new Set(excludeIterable);\n\t\t}\n\t}\n\n\tif (timeout === undefined) {\n\t\ttimeout = setTimeout(() => {\n\t\t\ttimeout = undefined;\n\n\t\t\tlockedPorts.old = lockedPorts.young;\n\t\t\tlockedPorts.young = new Set();\n\t\t}, releaseOldLockedPortsIntervalMs);\n\n\t\t// Does not exist in some environments (Electron, Jest jsdom env, browser, etc).\n\t\tif (timeout.unref) {\n\t\t\ttimeout.unref();\n\t\t}\n\t}\n\n\tconst hosts = getLocalHosts();\n\n\tfor (const port of portCheckSequence(ports)) {\n\t\ttry {\n\t\t\tif (exclude.has(port)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet availablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\twhile (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {\n\t\t\t\tif (port !== 0) {\n\t\t\t\t\tthrow new Locked(port);\n\t\t\t\t}\n\n\t\t\t\tavailablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\t}\n\n\t\t\tlockedPorts.young.add(availablePort);\n\n\t\t\treturn availablePort;\n\t\t} catch (error) {\n\t\t\tif (!['EADDRINUSE', 'EACCES'].includes(error.code) && !(error instanceof Locked)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('No available ports found');\n}\n\nexport function portNumbers(from, to) {\n\tif (!Number.isInteger(from) || !Number.isInteger(to)) {\n\t\tthrow new TypeError('`from` and `to` must be integer numbers');\n\t}\n\n\tif (from < minPort || from > maxPort) {\n\t\tthrow new RangeError(`'from' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (to < minPort || to > maxPort) {\n\t\tthrow new RangeError(`'to' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (from > to) {\n\t\tthrow new RangeError('`to` must be greater than or equal to `from`');\n\t}\n\n\tconst generator = function * (from, to) {\n\t\tfor (let port = from; port <= to; port++) {\n\t\t\tyield port;\n\t\t}\n\t};\n\n\treturn generator(from, to);\n}\n\nexport function clearLockedPorts() {\n\tlockedPorts.old.clear();\n\tlockedPorts.young.clear();\n}\n","import { Cause, Schema } from \"effect\";\n\nexport class CookieDatabaseNotFoundError extends Schema.ErrorClass<CookieDatabaseNotFoundError>(\n \"CookieDatabaseNotFoundError\",\n)({\n _tag: Schema.tag(\"CookieDatabaseNotFoundError\"),\n browser: Schema.String,\n}) {\n message = `Cookie database not found for ${this.browser}`;\n}\n\nexport class CpdInvalidResponsePayload extends Schema.ErrorClass<CpdInvalidResponsePayload>(\n \"CpdInvalidResponsePayload\",\n)({\n _tag: Schema.tag(\"CpdInvalidResponsePayload\"),\n code: Schema.Number,\n errorMessage: Schema.String,\n}) {\n message = `Network.getAllCookies responded with #${this.code}: ${this.errorMessage}`;\n}\n\nexport class DebuggerUrlNotFoundError extends Schema.ErrorClass<DebuggerUrlNotFoundError>(\n \"DebuggerUrlNotFoundError\",\n)({\n _tag: Schema.tag(\"DebuggerUrlNotFoundError\"),\n}) {\n message = `Debugger URL not found`;\n}\n\nexport class UnknownError extends Schema.ErrorClass<UnknownError>(\"UnknownError\")({\n _tag: Schema.tag(\"UnknownError\"),\n cause: Schema.Unknown,\n}) {\n message = `An unexpected error occurred. ${\n Cause.isCause(this.cause) ? Cause.pretty(this.cause) : String(this.cause)\n }`;\n}\n\nexport class RequiresFullDiskAccess extends Schema.ErrorClass<RequiresFullDiskAccess>(\n \"RequiresFullDiskAccess\",\n)({\n _tag: Schema.tag(\"RequiresFullDiskAccess\"),\n}) {\n message = `Safari cookie extraction requires Full Disk Access`;\n}\n\nexport class ExtractionError extends Schema.ErrorClass<ExtractionError>(\"ExtractionError\")({\n _tag: Schema.tag(\"ExtractionError\"),\n reason: Schema.Union([\n CpdInvalidResponsePayload,\n DebuggerUrlNotFoundError,\n RequiresFullDiskAccess,\n UnknownError,\n ]),\n}) {\n message = `Extracting cookies failed. Error: ${this.reason.message}`;\n}\n\nexport class CookieDatabaseCopyError extends Schema.ErrorClass<CookieDatabaseCopyError>(\n \"CookieDatabaseCopyError\",\n)({\n _tag: Schema.tag(\"CookieDatabaseCopyError\"),\n browser: Schema.String,\n databasePath: Schema.String,\n cause: Schema.String,\n}) {\n message = `Failed to copy cookie database for ${this.browser}: ${this.cause}`;\n}\n\nexport class CookieDecryptionKeyError extends Schema.ErrorClass<CookieDecryptionKeyError>(\n \"CookieDecryptionKeyError\",\n)({\n _tag: Schema.tag(\"CookieDecryptionKeyError\"),\n browser: Schema.String,\n platform: Schema.String,\n}) {\n message = `Decryption key not found for ${this.browser} on ${this.platform}`;\n}\n\nexport class CookieReadError extends Schema.ErrorClass<CookieReadError>(\"CookieReadError\")({\n _tag: Schema.tag(\"CookieReadError\"),\n browser: Schema.String,\n cause: Schema.String,\n}) {\n message = `Failed to read cookies for ${this.browser}: ${this.cause}`;\n}\n\nexport class BinaryParseError extends Schema.ErrorClass<BinaryParseError>(\"BinaryParseError\")({\n _tag: Schema.tag(\"BinaryParseError\"),\n filePath: Schema.String,\n cause: Schema.String,\n}) {\n message = `Failed to parse binary cookies at ${this.filePath}: ${this.cause}`;\n}\n\nexport class CdpConnectionError extends Schema.ErrorClass<CdpConnectionError>(\"CdpConnectionError\")(\n {\n _tag: Schema.tag(\"CdpConnectionError\"),\n port: Schema.Number,\n cause: Schema.String,\n },\n) {\n message = `CDP connection failed on port ${this.port}: ${this.cause}`;\n}\n\nexport class BrowserSpawnError extends Schema.ErrorClass<BrowserSpawnError>(\"BrowserSpawnError\")({\n _tag: Schema.tag(\"BrowserSpawnError\"),\n executablePath: Schema.String,\n cause: Schema.String,\n}) {\n message = `Failed to spawn browser at ${this.executablePath}: ${this.cause}`;\n}\n\nexport class UnsupportedPlatformError extends Schema.ErrorClass<UnsupportedPlatformError>(\n \"UnsupportedPlatformError\",\n)({\n _tag: Schema.tag(\"UnsupportedPlatformError\"),\n platform: Schema.String,\n}) {\n message = `Unsupported platform: ${this.platform}`;\n}\n\nexport class UnsupportedBrowserError extends Schema.ErrorClass<UnsupportedBrowserError>(\n \"UnsupportedBrowserError\",\n)({\n _tag: Schema.tag(\"UnsupportedBrowserError\"),\n browser: Schema.String,\n}) {\n message = `Unsupported browser: ${this.browser}`;\n}\n\nexport class ListBrowsersError extends Schema.ErrorClass<ListBrowsersError>(\"ListBrowsersError\")({\n _tag: Schema.tag(\"ListBrowsersError\"),\n cause: Schema.String,\n}) {\n message = `Failed to list browsers: ${this.cause}`;\n}\n","import { Order, Schema, SchemaGetter } from \"effect\";\n\nexport const SameSitePolicy = Schema.Literals([\"Strict\", \"Lax\", \"None\"] as const);\nexport type SameSitePolicy = typeof SameSitePolicy.Type;\n\nexport const BrowserKey = Schema.Literals([\n \"chrome\",\n \"edge\",\n \"brave\",\n \"arc\",\n \"dia\",\n \"helium\",\n \"chromium\",\n \"vivaldi\",\n \"opera\",\n \"ghost\",\n \"sidekick\",\n \"yandex\",\n \"iridium\",\n \"thorium\",\n \"sigmaos\",\n \"wavebox\",\n \"comet\",\n \"blisk\",\n \"firefox\",\n \"safari\",\n] as const);\nexport type BrowserKey = typeof BrowserKey.Type;\n\nexport const ChromiumBrowserKey = Schema.Literals([\n \"chrome\",\n \"edge\",\n \"brave\",\n \"arc\",\n \"dia\",\n \"helium\",\n \"chromium\",\n \"vivaldi\",\n \"opera\",\n \"ghost\",\n \"sidekick\",\n \"yandex\",\n \"iridium\",\n \"thorium\",\n \"sigmaos\",\n \"wavebox\",\n \"comet\",\n \"blisk\",\n] as const);\nexport type ChromiumBrowserKey = typeof ChromiumBrowserKey.Type;\n\nconst DotlessDomain = Schema.String.pipe(\n Schema.decodeTo(Schema.String, {\n decode: SchemaGetter.transform((domain) => (domain.startsWith(\".\") ? domain.slice(1) : domain)),\n encode: SchemaGetter.transform((domain) => domain),\n }),\n);\n\nexport class Cookie extends Schema.Class<Cookie>(\"@cookies/Cookie\")({\n name: Schema.String,\n value: Schema.String,\n domain: DotlessDomain,\n path: Schema.String,\n expires: Schema.optional(\n Schema.Number.pipe(\n Schema.decodeTo(Schema.Number, {\n decode: SchemaGetter.transform((value) => Math.floor(value)),\n encode: SchemaGetter.transform((value) => value),\n }),\n ),\n ),\n secure: Schema.Boolean,\n httpOnly: Schema.Boolean,\n sameSite: Schema.optional(SameSitePolicy),\n}) {\n static make = Schema.decodeUnknownSync(this);\n\n get playwrightFormat() {\n const SESSION_EXPIRES = -1;\n const domain = this.name.startsWith(\"__Host-\")\n ? this.domain\n : this.domain.startsWith(\".\")\n ? this.domain\n : `.${this.domain}`;\n\n return {\n name: this.name,\n value: this.value,\n domain,\n path: this.path,\n expires: this.expires ?? SESSION_EXPIRES,\n secure: this.secure,\n httpOnly: this.httpOnly,\n sameSite: this.sameSite,\n };\n }\n}\n\nexport class ChromiumBrowser extends Schema.Class<ChromiumBrowser>(\"@cookies/ChromiumBrowser\")({\n _tag: Schema.tag(\"ChromiumBrowser\"),\n key: ChromiumBrowserKey,\n profileName: Schema.String,\n profilePath: Schema.String,\n executablePath: Schema.String,\n locale: Schema.optional(Schema.String),\n}) {\n static orderBy = (lastUsedProfileName: string | undefined) =>\n Order.combine(\n Order.mapInput(\n Order.Boolean,\n (profile: ChromiumBrowser) => profile.profileName === lastUsedProfileName,\n ),\n Order.mapInput(\n Order.make(\n (left: string, right: string) =>\n left.localeCompare(right, undefined, { numeric: true }) as -1 | 0 | 1,\n ),\n (profile: ChromiumBrowser) => profile.profileName,\n ),\n );\n}\n\nexport class FirefoxBrowser extends Schema.Class<FirefoxBrowser>(\"@cookies/FirefoxBrowser\")({\n _tag: Schema.tag(\"FirefoxBrowser\"),\n profileName: Schema.String,\n profilePath: Schema.String,\n}) {}\n\nexport class SafariBrowser extends Schema.Class<SafariBrowser>(\"@cookies/SafariBrowser\")({\n _tag: Schema.tag(\"SafariBrowser\"),\n cookieFilePath: Schema.OptionFromNullishOr(Schema.String),\n}) {}\n\nexport const Browser = Schema.Union([ChromiumBrowser, FirefoxBrowser, SafariBrowser]);\nexport type Browser = typeof Browser.Type;\n\nexport interface ExtractOptions {\n url: string;\n browsers?: BrowserKey[];\n names?: string[];\n includeExpired?: boolean;\n}\n","import os from \"node:os\";\nimport path from \"node:path\";\nimport {\n Effect,\n Layer,\n Schedule,\n Schema,\n ServiceMap,\n Array as Arr,\n Option,\n Deferred,\n Duration,\n} from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { NodeHttpClient, NodeServices } from \"@effect/platform-node\";\nimport getPort from \"get-port\";\nimport {\n CpdInvalidResponsePayload,\n DebuggerUrlNotFoundError,\n ExtractionError,\n UnknownError,\n} from \"./errors\";\nimport { Cookie } from \"./types\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/unstable/process\";\nimport { HttpClient } from \"effect/unstable/http/HttpClient\";\nimport { HttpClientResponse } from \"effect/unstable/http\";\nimport { Socket } from \"effect/unstable/socket/Socket\";\nimport * as NodeSocket from \"@effect/platform-node/NodeSocket\";\n\nconst CDP_RETRY_COUNT = 15;\nconst CPD_COOKIE_READ_TIMEOUT: Duration.Input = \"10 seconds\";\nconst HEADLESS_CHROME_ARGS = [\n \"--headless=new\",\n \"--disable-gpu\",\n \"--no-first-run\",\n \"--no-default-browser-check\",\n \"--remote-debugging-address=127.0.0.1\",\n] as const;\n\nconst CdpCookieResponse = Schema.Struct({\n id: Schema.Number,\n error: Schema.optionalKey(\n Schema.Struct({\n code: Schema.Number,\n message: Schema.String,\n }),\n ),\n result: Schema.optionalKey(\n Schema.Struct({\n cookies: Schema.Array(Cookie),\n }),\n ),\n});\n\nexport class CdpClient extends ServiceMap.Service<CdpClient>()(\"@cookies/CdpClient\", {\n make: Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const httpClient = yield* HttpClient;\n\n const tempBasePath = os.tmpdir();\n const tempEntries = yield* fs\n .readDirectory(tempBasePath)\n .pipe(Effect.catchTag(\"PlatformError\", () => Effect.succeed([] as readonly string[])));\n const staleCdpDirectories = tempEntries.filter((entry) => entry.startsWith(\"cookies-cdp-\"));\n if (staleCdpDirectories.length > 0) {\n yield* Effect.logInfo(\"Cleaning up stale CDP temp directories\", {\n count: staleCdpDirectories.length,\n });\n yield* Effect.forEach(\n staleCdpDirectories,\n (entry) =>\n fs\n .remove(path.join(tempBasePath, entry), { recursive: true })\n .pipe(Effect.catchTag(\"PlatformError\", () => Effect.void)),\n { concurrency: \"unbounded\" },\n );\n }\n\n const getAllCookies = Effect.fn(\"CdpClient.getAllCookies\")(function* () {\n const socket = yield* Socket;\n const write = yield* socket.writer;\n const cookiesDeferred = yield* Deferred.make<readonly Cookie[], ExtractionError>();\n\n /** setup handler */\n yield* socket\n .runRaw((payload) =>\n Effect.gen(function* () {\n const decoded = yield* Schema.decodeEffect(Schema.fromJsonString(CdpCookieResponse))(\n payload.toString(),\n );\n\n if (decoded.error) {\n return yield* Deferred.fail(\n cookiesDeferred,\n new ExtractionError({\n reason: new CpdInvalidResponsePayload({\n code: decoded.error.code,\n errorMessage: decoded.error.message,\n }),\n }),\n );\n }\n\n if (decoded.result) {\n yield* Deferred.succeed(cookiesDeferred, decoded.result.cookies);\n }\n }),\n )\n .pipe(\n Effect.tapCause((cause) =>\n Deferred.fail(\n cookiesDeferred,\n new ExtractionError({\n reason: new UnknownError({ cause }),\n }),\n ),\n ),\n Effect.forkScoped,\n );\n\n /** send payload */\n yield* write(JSON.stringify({ id: 1, method: \"Network.getAllCookies\" }));\n\n return yield* Deferred.await(cookiesDeferred).pipe(Effect.timeout(CPD_COOKIE_READ_TIMEOUT));\n });\n\n const extractCookies = Effect.fn(\"CdpClient.extractCookies\")(function* ({\n key,\n profilePath,\n executablePath,\n }: {\n key: string;\n profilePath: string;\n executablePath: string;\n }) {\n const port = yield* Effect.promise(() => getPort());\n\n yield* Effect.annotateCurrentSpan({\n profilePath,\n executablePath,\n });\n\n const tempUserDataDirPath = yield* fs.makeTempDirectoryScoped({\n prefix: \"cookies-cdp-\",\n });\n\n const profileDirectoryName = path.basename(profilePath);\n const tempProfilePath = path.join(tempUserDataDirPath, profileDirectoryName);\n\n yield* fs.copy(profilePath, tempProfilePath);\n const localStatePath = path.join(path.dirname(profilePath), \"Local State\");\n if (yield* fs.exists(localStatePath)) {\n yield* fs.copyFile(localStatePath, path.join(tempUserDataDirPath, \"Local State\"));\n }\n\n yield* fs.writeFile(path.join(tempUserDataDirPath, \"First Run\"), new Uint8Array(0));\n\n const chromeArgs = [\n `--remote-debugging-port=${port}`,\n ...(key === \"dia\" ? [] : [`--user-data-dir=${tempUserDataDirPath}`]),\n `--profile-directory=${profileDirectoryName}`,\n ...HEADLESS_CHROME_ARGS,\n ];\n\n yield* ChildProcess.make(executablePath, chromeArgs, {\n stdin: \"ignore\",\n }).pipe(spawner.spawn, Effect.forkScoped);\n\n const debuggerUrl = yield* httpClient.get(`http://localhost:${port}/json`).pipe(\n Effect.flatMap(\n HttpClientResponse.schemaBodyJson(\n Schema.Array(\n Schema.Struct({\n type: Schema.String,\n webSocketDebuggerUrl: Schema.optionalKey(Schema.String),\n }),\n ),\n ),\n ),\n Effect.map(Arr.findFirst((target) => target.type === \"page\")),\n Effect.map(Option.flatMap((target) => Option.fromNullishOr(target.webSocketDebuggerUrl))),\n Effect.flatMap((debuggerUrlOption) => debuggerUrlOption.asEffect()),\n Effect.catchTag(\"NoSuchElementError\", () =>\n new ExtractionError({\n reason: new DebuggerUrlNotFoundError(),\n }).asEffect(),\n ),\n Effect.retry({\n times: CDP_RETRY_COUNT,\n schedule: Schedule.exponential(\"100 millis\"),\n }),\n );\n\n const cookies = yield* getAllCookies().pipe(\n Effect.provide(NodeSocket.layerWebSocket(debuggerUrl), {\n local: true,\n }),\n );\n yield* Effect.logInfo(\"CDP cookies extracted\", {\n profile: profilePath,\n count: cookies.length,\n });\n return cookies;\n }, Effect.scoped);\n\n return { extractCookies } as const;\n }),\n}) {\n static layer = Layer.effect(this)(this.make).pipe(\n Layer.provide(NodeServices.layer),\n /** @note(rasmus): unidici is more performant than fetch API on Node.js */\n Layer.provide(NodeHttpClient.layerUndici),\n );\n\n static layerTest = Layer.mock(this)({\n extractCookies: () => Effect.succeed([] as Cookie[]),\n });\n}\n","import path from \"node:path\";\nimport { Effect, Layer, Scope, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { CookieDatabaseCopyError, CookieReadError } from \"./errors\";\n\nconst IS_BUN = \"Bun\" in globalThis;\nconst BUN_SQLITE_MODULE = \"bun:sqlite\";\nconst NODE_SQLITE_MODULE = \"node:sqlite\";\n\ninterface SqliteDatabase {\n prepare(sql: string): { all(): Record<string, unknown>[] };\n close(): void;\n}\n\nexport class SqliteEngine extends ServiceMap.Service<\n SqliteEngine,\n {\n readonly open: (\n databasePath: string,\n ) => Effect.Effect<SqliteDatabase, CookieReadError, Scope.Scope>;\n }\n>()(\"@cookies/SqliteEngine\") {\n static layerBun = Layer.succeed(this, {\n open: (databasePath: string) =>\n Effect.acquireRelease(\n Effect.tryPromise({\n try: async () => {\n const { Database } = await import(BUN_SQLITE_MODULE);\n return new Database(databasePath, {\n readonly: true,\n }) as SqliteDatabase;\n },\n catch: (cause) => new CookieReadError({ browser: \"unknown\", cause: String(cause) }),\n }),\n (database) => Effect.sync(() => database.close()),\n ),\n });\n\n static layerNodeJs = Layer.succeed(this, {\n open: (databasePath: string) =>\n Effect.acquireRelease(\n Effect.tryPromise({\n try: async () => {\n const { DatabaseSync } = await import(NODE_SQLITE_MODULE);\n return new DatabaseSync(databasePath, {\n readOnly: true,\n readBigInts: true,\n }) as unknown as SqliteDatabase;\n },\n catch: (cause) => new CookieReadError({ browser: \"unknown\", cause: String(cause) }),\n }),\n (database) => Effect.sync(() => database.close()),\n ),\n });\n\n static layerLibSql = Layer.succeed(this, {\n open: (databasePath: string) =>\n Effect.acquireRelease(\n Effect.tryPromise({\n try: async () => {\n const { default: LibsqlDatabase } = await import(\"libsql\");\n return new LibsqlDatabase(databasePath, {\n readonly: true,\n }) as unknown as SqliteDatabase;\n },\n catch: (cause) => new CookieReadError({ browser: \"unknown\", cause: String(cause) }),\n }),\n (database) => Effect.sync(() => database.close()),\n ),\n });\n}\n\nexport class SqliteClient extends ServiceMap.Service<SqliteClient>()(\"@cookies/SqliteClient\", {\n make: Effect.gen(function* () {\n const engine = yield* SqliteEngine;\n const fileSystem = yield* FileSystem.FileSystem;\n\n const query = Effect.fn(\"SqliteClient.query\")(function* (\n databasePath: string,\n sqlQuery: string,\n browser: string,\n ) {\n yield* Effect.annotateCurrentSpan({ browser, databasePath });\n const database = yield* engine\n .open(databasePath)\n .pipe(Effect.mapError((error) => new CookieReadError({ browser, cause: error.cause })));\n return yield* Effect.try({\n try: () => database.prepare(sqlQuery).all(),\n catch: (cause) => new CookieReadError({ browser, cause: String(cause) }),\n });\n }, Effect.scoped);\n\n const copyToTemp = Effect.fn(\"SqliteClient.copyToTemp\")(function* (\n databasePath: string,\n prefix: string,\n filename: string,\n browser: string,\n ) {\n const tempDir = yield* fileSystem.makeTempDirectory({ prefix });\n yield* Effect.addFinalizer(() =>\n fileSystem.remove(tempDir, { recursive: true }).pipe(Effect.catch(() => Effect.void)),\n );\n\n const tempDatabasePath = path.join(tempDir, filename);\n yield* fileSystem.copyFile(databasePath, tempDatabasePath).pipe(\n Effect.catchTag(\"PlatformError\", (cause) =>\n new CookieDatabaseCopyError({\n browser,\n databasePath,\n cause: String(cause),\n }).asEffect(),\n ),\n );\n yield* fileSystem\n .copyFile(`${databasePath}-wal`, `${tempDatabasePath}-wal`)\n .pipe(Effect.catch(() => Effect.void));\n yield* fileSystem\n .copyFile(`${databasePath}-shm`, `${tempDatabasePath}-shm`)\n .pipe(Effect.catch(() => Effect.void));\n\n return { tempDir, tempDatabasePath };\n });\n\n return { query, copyToTemp } as const;\n }),\n}) {\n static layerBun = Layer.effect(this, this.make).pipe(\n Layer.provide(SqliteEngine.layerBun),\n Layer.provide(NodeServices.layer),\n );\n\n static layerNodeJs = Layer.effect(this, this.make).pipe(\n Layer.provide(SqliteEngine.layerNodeJs),\n Layer.provide(NodeServices.layer),\n );\n\n static layer = IS_BUN ? this.layerBun : this.layerNodeJs;\n}\n","import type { BrowserKey, ChromiumBrowserKey } from \"./types\";\n\ninterface PlatformPaths {\n readonly darwin: string;\n readonly linux: string;\n readonly win32: string;\n}\n\nexport interface ChromiumConfig {\n readonly kind: \"chromium\";\n readonly key: ChromiumBrowserKey;\n readonly displayName: string;\n readonly bundleId: string;\n readonly desktopFiles: readonly string[];\n readonly registryKey: string;\n readonly executable: {\n readonly darwin: string;\n readonly linux: readonly string[];\n readonly win32: readonly string[];\n };\n readonly userData: PlatformPaths;\n readonly cookieRelativePath: PlatformPaths;\n readonly keychainService: string;\n readonly linuxSecretLabel: string;\n readonly localStatePath: string;\n}\n\nexport interface FirefoxConfig {\n readonly kind: \"firefox\";\n readonly key: \"firefox\";\n readonly displayName: string;\n readonly bundleId: string;\n readonly desktopFiles: readonly string[];\n readonly executable: {\n readonly darwin: string;\n readonly linux: readonly string[];\n readonly win32: readonly string[];\n };\n readonly dataDir: PlatformPaths;\n}\n\nexport interface SafariConfig {\n readonly kind: \"safari\";\n readonly key: \"safari\";\n readonly displayName: string;\n readonly bundleId: string;\n readonly executable: string;\n readonly cookieRelativePaths: readonly string[];\n}\n\nexport type BrowserConfig = ChromiumConfig | FirefoxConfig | SafariConfig;\n\nconst chromium = (\n key: ChromiumBrowserKey,\n displayName: string,\n bundleId: string,\n desktopFiles: readonly string[],\n registryKey: string,\n darwinExe: string,\n linuxExe: readonly string[],\n win32Exe: readonly string[],\n userData: PlatformPaths,\n cookieRelativePath: PlatformPaths,\n keychainService: string,\n linuxSecretLabel: string,\n localStatePath: string,\n): ChromiumConfig => ({\n kind: \"chromium\",\n key,\n displayName,\n bundleId,\n desktopFiles,\n registryKey,\n executable: { darwin: darwinExe, linux: linuxExe, win32: win32Exe },\n userData,\n cookieRelativePath,\n keychainService,\n linuxSecretLabel,\n localStatePath,\n});\n\nexport const CHROMIUM_CONFIGS: readonly ChromiumConfig[] = [\n chromium(\n \"chrome\",\n \"Google Chrome\",\n \"com.google.chrome\",\n [\"google-chrome\"],\n \"chrome.exe\",\n \"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\",\n [\"/usr/bin/google-chrome\", \"/usr/local/bin/google-chrome\", \"/snap/bin/google-chrome\"],\n [\"Google\\\\Chrome\\\\Application\\\\chrome.exe\"],\n { darwin: \"Google/Chrome\", linux: \"google-chrome\", win32: \"Google\\\\Chrome\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Google/Chrome/Default\",\n linux: \".config/google-chrome/Default\",\n win32: \"AppData/Local/Google/Chrome/User Data/Default\",\n },\n \"Chrome Safe Storage\",\n \"chrome\",\n \"AppData/Local/Google/Chrome/User Data/Local State\",\n ),\n chromium(\n \"brave\",\n \"Brave Browser\",\n \"com.brave.browser\",\n [\"brave-browser\"],\n \"brave.exe\",\n \"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser\",\n [\"/usr/bin/brave-browser\", \"/usr/local/bin/brave-browser\", \"/snap/bin/brave-browser\"],\n [\"BraveSoftware\\\\Brave-Browser\\\\Application\\\\brave.exe\"],\n {\n darwin: \"BraveSoftware/Brave-Browser\",\n linux: \"BraveSoftware/Brave-Browser\",\n win32: \"BraveSoftware\\\\Brave-Browser\\\\User Data\",\n },\n {\n darwin: \"Library/Application Support/BraveSoftware/Brave-Browser/Default\",\n linux: \".config/BraveSoftware/Brave-Browser/Default\",\n win32: \"AppData/Local/BraveSoftware/Brave-Browser/User Data/Default\",\n },\n \"Brave Safe Storage\",\n \"brave\",\n \"AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State\",\n ),\n chromium(\n \"edge\",\n \"Microsoft Edge\",\n \"com.microsoft.edgemac\",\n [\"microsoft-edge\"],\n \"msedge.exe\",\n \"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge\",\n [\"/usr/bin/microsoft-edge\", \"/usr/local/bin/microsoft-edge\", \"/snap/bin/microsoft-edge\"],\n [\"Microsoft\\\\Edge\\\\Application\\\\msedge.exe\"],\n { darwin: \"Microsoft Edge\", linux: \"microsoft-edge\", win32: \"Microsoft\\\\Edge\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Microsoft Edge/Default\",\n linux: \".config/microsoft-edge/Default\",\n win32: \"AppData/Local/Microsoft/Edge/User Data/Default\",\n },\n \"Microsoft Edge Safe Storage\",\n \"microsoft-edge\",\n \"AppData/Local/Microsoft/Edge/User Data/Local State\",\n ),\n chromium(\n \"arc\",\n \"Arc\",\n \"company.thebrowser.browser\",\n [\"arc\"],\n \"arc.exe\",\n \"/Applications/Arc.app/Contents/MacOS/Arc\",\n [\"/usr/bin/arc\", \"/usr/local/bin/arc\", \"/snap/bin/arc\"],\n [\"Arc\\\\Application\\\\arc.exe\"],\n { darwin: \"Arc/User Data\", linux: \"arc\", win32: \"Arc\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Arc/User Data/Default\",\n linux: \".config/arc/Default\",\n win32: \"AppData/Local/Arc/User Data/Default\",\n },\n \"Arc Safe Storage\",\n \"arc\",\n \"AppData/Local/Arc/User Data/Local State\",\n ),\n chromium(\n \"dia\",\n \"Dia\",\n \"company.thebrowser.dia\",\n [\"dia\"],\n \"dia.exe\",\n \"/Applications/Dia.app/Contents/MacOS/Dia\",\n [\"/usr/bin/dia\", \"/usr/local/bin/dia\", \"/snap/bin/dia\"],\n [\"Dia\\\\Application\\\\dia.exe\"],\n { darwin: \"Dia/User Data\", linux: \"dia\", win32: \"Dia\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Dia/User Data/Default\",\n linux: \".config/dia/Default\",\n win32: \"AppData/Local/Dia/User Data/Default\",\n },\n \"Dia Safe Storage\",\n \"dia\",\n \"AppData/Local/Dia/User Data/Local State\",\n ),\n chromium(\n \"helium\",\n \"Helium\",\n \"net.imput.helium\",\n [\"helium\"],\n \"helium.exe\",\n \"/Applications/Helium.app/Contents/MacOS/Helium\",\n [\"/usr/bin/helium\", \"/usr/local/bin/helium\", \"/snap/bin/helium\"],\n [\"Helium\\\\Application\\\\helium.exe\"],\n { darwin: \"net.imput.helium\", linux: \"helium\", win32: \"Helium\\\\User Data\" },\n {\n darwin: \"Library/Application Support/net.imput.helium/Default\",\n linux: \".config/helium/Default\",\n win32: \"AppData/Local/Helium/User Data/Default\",\n },\n \"Helium Storage Key\",\n \"helium\",\n \"AppData/Local/Helium/User Data/Local State\",\n ),\n chromium(\n \"chromium\",\n \"Chromium\",\n \"org.chromium.chromium\",\n [\"chromium\", \"chromium-browser\"],\n \"chromium.exe\",\n \"/Applications/Chromium.app/Contents/MacOS/Chromium\",\n [\"/usr/bin/chromium\", \"/usr/local/bin/chromium\", \"/snap/bin/chromium\"],\n [\"Chromium\\\\Application\\\\chrome.exe\"],\n { darwin: \"Chromium\", linux: \"chromium\", win32: \"Chromium\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Chromium/Default\",\n linux: \".config/chromium/Default\",\n win32: \"AppData/Local/Chromium/User Data/Default\",\n },\n \"Chromium Safe Storage\",\n \"chromium\",\n \"AppData/Local/Chromium/User Data/Local State\",\n ),\n chromium(\n \"vivaldi\",\n \"Vivaldi\",\n \"com.vivaldi.vivaldi\",\n [\"vivaldi\", \"vivaldi-stable\"],\n \"vivaldi.exe\",\n \"/Applications/Vivaldi.app/Contents/MacOS/Vivaldi\",\n [\"/usr/bin/vivaldi\", \"/usr/local/bin/vivaldi\", \"/snap/bin/vivaldi\"],\n [\"Vivaldi\\\\Application\\\\vivaldi.exe\"],\n { darwin: \"Vivaldi\", linux: \"vivaldi\", win32: \"Vivaldi\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Vivaldi/Default\",\n linux: \".config/vivaldi/Default\",\n win32: \"AppData/Local/Vivaldi/User Data/Default\",\n },\n \"Vivaldi Safe Storage\",\n \"vivaldi\",\n \"AppData/Local/Vivaldi/User Data/Local State\",\n ),\n chromium(\n \"opera\",\n \"Opera\",\n \"com.operasoftware.opera\",\n [\"opera\", \"opera-stable\"],\n \"opera.exe\",\n \"/Applications/Opera.app/Contents/MacOS/Opera\",\n [\"/usr/bin/opera\", \"/usr/local/bin/opera\", \"/snap/bin/opera\"],\n [\"Opera\\\\launcher.exe\"],\n { darwin: \"com.operasoftware.Opera\", linux: \"opera\", win32: \"Opera Software\\\\Opera Stable\" },\n {\n darwin: \"Library/Application Support/com.operasoftware.Opera\",\n linux: \".config/opera\",\n win32: \"AppData/Roaming/Opera Software/Opera Stable\",\n },\n \"Opera Safe Storage\",\n \"opera\",\n \"AppData/Roaming/Opera Software/Opera Stable/Local State\",\n ),\n chromium(\n \"ghost\",\n \"Ghost Browser\",\n \"com.nickvision.ghost\",\n [\"ghost-browser\"],\n \"ghost.exe\",\n \"/Applications/Ghost Browser.app/Contents/MacOS/Ghost Browser\",\n [\"/usr/bin/ghost-browser\", \"/usr/local/bin/ghost-browser\", \"/snap/bin/ghost-browser\"],\n [\"Ghost Browser\\\\Application\\\\ghost.exe\"],\n { darwin: \"Ghost Browser\", linux: \"ghost-browser\", win32: \"Ghost Browser\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Ghost Browser/Default\",\n linux: \".config/ghost-browser/Default\",\n win32: \"AppData/Local/Ghost Browser/User Data/Default\",\n },\n \"Ghost Browser Safe Storage\",\n \"ghost-browser\",\n \"AppData/Local/Ghost Browser/User Data/Local State\",\n ),\n chromium(\n \"sidekick\",\n \"Sidekick\",\n \"pushplaylabs.sidekick\",\n [\"sidekick\"],\n \"sidekick.exe\",\n \"/Applications/Sidekick.app/Contents/MacOS/Sidekick\",\n [\"/usr/bin/sidekick\", \"/usr/local/bin/sidekick\", \"/snap/bin/sidekick\"],\n [\"Sidekick\\\\Application\\\\sidekick.exe\"],\n { darwin: \"Sidekick\", linux: \"sidekick\", win32: \"Sidekick\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Sidekick/Default\",\n linux: \".config/sidekick/Default\",\n win32: \"AppData/Local/Sidekick/User Data/Default\",\n },\n \"Sidekick Safe Storage\",\n \"sidekick\",\n \"AppData/Local/Sidekick/User Data/Local State\",\n ),\n chromium(\n \"yandex\",\n \"Yandex\",\n \"ru.yandex.desktop.yandex-browser\",\n [\"yandex-browser\"],\n \"browser.exe\",\n \"/Applications/Yandex.app/Contents/MacOS/Yandex\",\n [\"/usr/bin/yandex-browser\", \"/usr/local/bin/yandex-browser\", \"/snap/bin/yandex-browser\"],\n [\"Yandex\\\\YandexBrowser\\\\Application\\\\browser.exe\"],\n { darwin: \"YandexBrowser\", linux: \"yandex-browser\", win32: \"Yandex\\\\YandexBrowser\\\\User Data\" },\n {\n darwin: \"Library/Application Support/YandexBrowser/Default\",\n linux: \".config/yandex-browser/Default\",\n win32: \"AppData/Local/Yandex/YandexBrowser/User Data/Default\",\n },\n \"Yandex Safe Storage\",\n \"yandex-browser\",\n \"AppData/Local/Yandex/YandexBrowser/User Data/Local State\",\n ),\n chromium(\n \"iridium\",\n \"Iridium\",\n \"de.nickvision.iridium\",\n [\"iridium\"],\n \"iridium.exe\",\n \"/Applications/Iridium.app/Contents/MacOS/Iridium\",\n [\"/usr/bin/iridium\", \"/usr/local/bin/iridium\", \"/snap/bin/iridium\"],\n [\"Iridium\\\\Application\\\\iridium.exe\"],\n { darwin: \"Iridium\", linux: \"iridium\", win32: \"Iridium\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Iridium/Default\",\n linux: \".config/iridium/Default\",\n win32: \"AppData/Local/Iridium/User Data/Default\",\n },\n \"Iridium Safe Storage\",\n \"iridium\",\n \"AppData/Local/Iridium/User Data/Local State\",\n ),\n chromium(\n \"thorium\",\n \"Thorium\",\n \"nickvision.thorium\",\n [\"thorium\"],\n \"thorium.exe\",\n \"/Applications/Thorium.app/Contents/MacOS/Thorium\",\n [\"/usr/bin/thorium\", \"/usr/local/bin/thorium\", \"/snap/bin/thorium\"],\n [\"Thorium\\\\Application\\\\thorium.exe\"],\n { darwin: \"Thorium\", linux: \"thorium\", win32: \"Thorium\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Thorium/Default\",\n linux: \".config/thorium/Default\",\n win32: \"AppData/Local/Thorium/User Data/Default\",\n },\n \"Thorium Safe Storage\",\n \"thorium\",\n \"AppData/Local/Thorium/User Data/Local State\",\n ),\n chromium(\n \"sigmaos\",\n \"SigmaOS\",\n \"com.nickvision.sigmaos\",\n [\"sigmaos\"],\n \"sigmaos.exe\",\n \"/Applications/SigmaOS.app/Contents/MacOS/SigmaOS\",\n [\"/usr/bin/sigmaos\", \"/usr/local/bin/sigmaos\", \"/snap/bin/sigmaos\"],\n [\"SigmaOS\\\\Application\\\\sigmaos.exe\"],\n { darwin: \"SigmaOS\", linux: \"sigmaos\", win32: \"SigmaOS\\\\User Data\" },\n {\n darwin: \"Library/Application Support/SigmaOS/Default\",\n linux: \".config/sigmaos/Default\",\n win32: \"AppData/Local/SigmaOS/User Data/Default\",\n },\n \"SigmaOS Safe Storage\",\n \"sigmaos\",\n \"AppData/Local/SigmaOS/User Data/Local State\",\n ),\n chromium(\n \"wavebox\",\n \"Wavebox\",\n \"io.wavebox.wavebox\",\n [\"wavebox\"],\n \"wavebox.exe\",\n \"/Applications/Wavebox.app/Contents/MacOS/Wavebox\",\n [\"/usr/bin/wavebox\", \"/usr/local/bin/wavebox\", \"/snap/bin/wavebox\"],\n [\"Wavebox\\\\Application\\\\wavebox.exe\"],\n { darwin: \"Wavebox\", linux: \"wavebox\", win32: \"Wavebox\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Wavebox/Default\",\n linux: \".config/wavebox/Default\",\n win32: \"AppData/Local/Wavebox/User Data/Default\",\n },\n \"Wavebox Safe Storage\",\n \"wavebox\",\n \"AppData/Local/Wavebox/User Data/Local State\",\n ),\n chromium(\n \"comet\",\n \"Comet\",\n \"com.nickvision.comet\",\n [\"comet\"],\n \"comet.exe\",\n \"/Applications/Comet.app/Contents/MacOS/Comet\",\n [\"/usr/bin/comet\", \"/usr/local/bin/comet\", \"/snap/bin/comet\"],\n [\"Comet\\\\Application\\\\comet.exe\"],\n { darwin: \"Comet\", linux: \"comet\", win32: \"Comet\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Comet/Default\",\n linux: \".config/comet/Default\",\n win32: \"AppData/Local/Comet/User Data/Default\",\n },\n \"Comet Safe Storage\",\n \"comet\",\n \"AppData/Local/Comet/User Data/Local State\",\n ),\n chromium(\n \"blisk\",\n \"Blisk\",\n \"com.nickvision.blisk\",\n [\"blisk\"],\n \"blisk.exe\",\n \"/Applications/Blisk.app/Contents/MacOS/Blisk\",\n [\"/usr/bin/blisk\", \"/usr/local/bin/blisk\", \"/snap/bin/blisk\"],\n [\"Blisk\\\\Application\\\\blisk.exe\"],\n { darwin: \"Blisk\", linux: \"blisk\", win32: \"Blisk\\\\User Data\" },\n {\n darwin: \"Library/Application Support/Blisk/Default\",\n linux: \".config/blisk/Default\",\n win32: \"AppData/Local/Blisk/User Data/Default\",\n },\n \"Blisk Safe Storage\",\n \"blisk\",\n \"AppData/Local/Blisk/User Data/Local State\",\n ),\n];\n\nexport const FIREFOX_CONFIG: FirefoxConfig = {\n kind: \"firefox\",\n key: \"firefox\",\n displayName: \"Firefox\",\n bundleId: \"org.mozilla.firefox\",\n desktopFiles: [\"firefox\"],\n executable: {\n darwin: \"/Applications/Firefox.app/Contents/MacOS/firefox\",\n linux: [\"/usr/bin/firefox\", \"/usr/local/bin/firefox\", \"/snap/bin/firefox\"],\n win32: [\"Mozilla Firefox\\\\firefox.exe\"],\n },\n dataDir: {\n darwin: \"Library/Application Support/Firefox\",\n linux: \".mozilla/firefox\",\n win32: \"AppData/Roaming/Mozilla/Firefox\",\n },\n};\n\nexport const SAFARI_CONFIG: SafariConfig = {\n kind: \"safari\",\n key: \"safari\",\n displayName: \"Safari\",\n bundleId: \"com.apple.safari\",\n executable: \"/Applications/Safari.app/Contents/MacOS/Safari\",\n cookieRelativePaths: [\n \"Library/Cookies\",\n \"Library/Containers/com.apple.Safari/Data/Library/Cookies\",\n ],\n};\n\nexport const BROWSER_CONFIGS: readonly BrowserConfig[] = [\n ...CHROMIUM_CONFIGS,\n FIREFOX_CONFIG,\n SAFARI_CONFIG,\n];\n\nconst bundleIdMap = new Map<string, BrowserConfig>();\nconst desktopFileMap = new Map<string, BrowserConfig>();\nconst displayNameMap = new Map<string, BrowserConfig>();\nconst keyMap = new Map<BrowserKey, BrowserConfig>();\n\nfor (const config of BROWSER_CONFIGS) {\n keyMap.set(config.key, config);\n bundleIdMap.set(config.bundleId.toLowerCase(), config);\n displayNameMap.set(config.displayName, config);\n if (\"desktopFiles\" in config) {\n for (const desktopFile of config.desktopFiles) {\n desktopFileMap.set(desktopFile, config);\n }\n }\n}\n\n// HACK: Edge has two bundle IDs\nbundleIdMap.set(\"com.microsoft.edge\", keyMap.get(\"edge\")!);\n\nexport const configByKey = (key: BrowserKey): BrowserConfig | undefined => keyMap.get(key);\n\nexport const configByBundleId = (identifier: string): BrowserConfig | undefined =>\n bundleIdMap.get(identifier.toLowerCase());\n\nexport const configByDesktopFile = (name: string): BrowserConfig | undefined =>\n desktopFileMap.get(name.replace(/\\.desktop$/, \"\"));\n\nexport const configByDisplayName = (name: string): BrowserConfig | undefined =>\n displayNameMap.get(name);\n\nexport const chromiumConfig = (key: ChromiumBrowserKey): ChromiumConfig =>\n CHROMIUM_CONFIGS.find((config) => config.key === key)!;\n","import * as crypto from \"node:crypto\";\n\nconst PBKDF2_SALT = \"saltysalt\";\nconst PBKDF2_KEY_LENGTH_BYTES = 16;\nconst PBKDF2_IV_FILL = 0x20;\nconst CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES = 3;\nconst AES_HASH_PREFIX_LENGTH_BYTES = 32;\nconst GCM_NONCE_LENGTH_BYTES = 12;\nconst GCM_TAG_LENGTH_BYTES = 16;\nconst GCM_MIN_PAYLOAD_BYTES = 28;\n\nconst COOKIE_PREFIX_PATTERN = /^v\\d\\d$/;\n\nexport const deriveKey = (password: string, iterations: number): Buffer =>\n crypto.pbkdf2Sync(password, PBKDF2_SALT, iterations, PBKDF2_KEY_LENGTH_BYTES, \"sha1\");\n\nexport const decryptAes128Cbc = (\n encryptedValue: Uint8Array,\n keyCandidates: readonly Buffer[],\n stripHashPrefix: boolean,\n): string | undefined => {\n const buffer = Buffer.from(encryptedValue);\n if (buffer.length < CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES) return undefined;\n\n const prefix = buffer.subarray(0, CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES).toString(\"utf8\");\n if (!COOKIE_PREFIX_PATTERN.test(prefix)) {\n return decodeCookieBytes(buffer, false);\n }\n\n const ciphertext = buffer.subarray(CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES);\n if (!ciphertext.length) return \"\";\n\n for (const decryptionKey of keyCandidates) {\n const decrypted = tryAes128Cbc(ciphertext, decryptionKey);\n if (!decrypted) continue;\n const decoded = decodeCookieBytes(decrypted, stripHashPrefix);\n if (decoded !== undefined) return decoded;\n }\n\n return undefined;\n};\n\nexport const decryptAes256Gcm = (\n encryptedValue: Uint8Array,\n masterKey: Buffer,\n stripHashPrefix: boolean,\n): string | undefined => {\n const buffer = Buffer.from(encryptedValue);\n if (buffer.length < CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES) return undefined;\n\n const prefix = buffer.subarray(0, CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES).toString(\"utf8\");\n if (!COOKIE_PREFIX_PATTERN.test(prefix)) return undefined;\n\n const payload = buffer.subarray(CHROMIUM_COOKIE_PREFIX_LENGTH_BYTES);\n if (payload.length < GCM_MIN_PAYLOAD_BYTES) return undefined;\n\n const nonce = payload.subarray(0, GCM_NONCE_LENGTH_BYTES);\n const authTag = payload.subarray(payload.length - GCM_TAG_LENGTH_BYTES);\n const ciphertext = payload.subarray(\n GCM_NONCE_LENGTH_BYTES,\n payload.length - GCM_TAG_LENGTH_BYTES,\n );\n\n try {\n const decipher = crypto.createDecipheriv(\"aes-256-gcm\", masterKey, nonce);\n decipher.setAuthTag(authTag);\n const plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n return decodeCookieBytes(plaintext, stripHashPrefix);\n } catch {\n return undefined;\n }\n};\n\nconst tryAes128Cbc = (ciphertext: Buffer, key: Buffer): Buffer | undefined => {\n try {\n const initVector = Buffer.alloc(PBKDF2_KEY_LENGTH_BYTES, PBKDF2_IV_FILL);\n const decipher = crypto.createDecipheriv(\"aes-128-cbc\", key, initVector);\n decipher.setAutoPadding(false);\n const plaintext = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n return removePkcs7Padding(plaintext);\n } catch {\n return undefined;\n }\n};\n\nconst removePkcs7Padding = (paddedBuffer: Buffer): Buffer => {\n if (!paddedBuffer.length) return paddedBuffer;\n const padding = paddedBuffer[paddedBuffer.length - 1];\n if (!padding || padding > PBKDF2_KEY_LENGTH_BYTES) return paddedBuffer;\n return paddedBuffer.subarray(0, paddedBuffer.length - padding);\n};\n\nconst UTF8_DECODER = new TextDecoder(\"utf-8\", { fatal: true });\n\nconst decodeCookieBytes = (\n plaintextBytes: Buffer,\n stripHashPrefix: boolean,\n): string | undefined => {\n const bytes =\n stripHashPrefix && plaintextBytes.length >= AES_HASH_PREFIX_LENGTH_BYTES\n ? plaintextBytes.subarray(AES_HASH_PREFIX_LENGTH_BYTES)\n : plaintextBytes;\n try {\n const decoded = UTF8_DECODER.decode(bytes);\n let index = 0;\n while (index < decoded.length && decoded.charCodeAt(index) < PBKDF2_IV_FILL) {\n index += 1;\n }\n return decoded.slice(index);\n } catch {\n return undefined;\n }\n};\n","const MAX_UNIX_EPOCH_SECONDS = 253_402_300_799;\nconst CHROME_EPOCH_THRESHOLD = 10_000_000_000_000;\nconst CHROME_EPOCH_MICROSECONDS = 1_000_000;\nconst CHROME_EPOCH_OFFSET_SECONDS = 11_644_473_600;\nconst MILLISECOND_THRESHOLD = 10_000_000_000;\nconst MS_PER_SECOND = 1000;\n\nconst SAME_SITE_NONE = 0;\nconst SAME_SITE_LAX = 1;\nconst SAME_SITE_STRICT = 2;\n\nconst clampExpiration = (value: number): number | undefined =>\n value > 0 && value <= MAX_UNIX_EPOCH_SECONDS ? Math.round(value) : undefined;\n\nexport const normalizeChromiumExpiration = (\n expires?: number | bigint | string,\n): number | undefined => {\n if (expires === undefined) return undefined;\n\n if (typeof expires === \"string\") {\n const parsed = Number(expires);\n if (!Number.isFinite(parsed)) return undefined;\n return normalizeChromiumExpiration(parsed);\n }\n\n if (typeof expires === \"bigint\") {\n if (expires <= 0n) return undefined;\n if (expires > BigInt(CHROME_EPOCH_THRESHOLD)) {\n return clampExpiration(\n Number(expires / BigInt(CHROME_EPOCH_MICROSECONDS) - BigInt(CHROME_EPOCH_OFFSET_SECONDS)),\n );\n }\n if (expires > BigInt(MILLISECOND_THRESHOLD))\n return clampExpiration(Number(expires / BigInt(MS_PER_SECOND)));\n return clampExpiration(Number(expires));\n }\n\n if (!expires || Number.isNaN(expires)) return undefined;\n if (expires <= 0) return undefined;\n\n if (expires > CHROME_EPOCH_THRESHOLD) {\n return clampExpiration(expires / CHROME_EPOCH_MICROSECONDS - CHROME_EPOCH_OFFSET_SECONDS);\n }\n if (expires > MILLISECOND_THRESHOLD) return clampExpiration(expires / MS_PER_SECOND);\n return clampExpiration(expires);\n};\n\nexport const normalizeChromiumSameSite = (\n value: unknown,\n): \"Strict\" | \"Lax\" | \"None\" | undefined => {\n const numeric =\n typeof value === \"bigint\" ? Number(value) : typeof value === \"number\" ? value : undefined;\n if (numeric === undefined) return undefined;\n if (numeric === SAME_SITE_STRICT) return \"Strict\";\n if (numeric === SAME_SITE_LAX) return \"Lax\";\n if (numeric === SAME_SITE_NONE) return \"None\";\n return undefined;\n};\n","// HACK: Fallback for Chromium cookie extraction when CDP (headless browser) fails.\n// Reads the SQLite cookie database directly and decrypts values using\n// platform-specific key retrieval (macOS Keychain, Linux secret-tool, Windows DPAPI).\nimport path from \"node:path\";\nimport * as os from \"node:os\";\nimport { Effect, Layer, Schema, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { ChildProcess } from \"effect/unstable/process\";\nimport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { chromiumConfig } from \"./browser-config\";\nimport { deriveKey, decryptAes128Cbc, decryptAes256Gcm } from \"./utils/crypto\";\nimport { normalizeChromiumExpiration, normalizeChromiumSameSite } from \"./utils/chromium-normalize\";\nimport {\n CookieDatabaseNotFoundError,\n CookieDecryptionKeyError,\n ExtractionError,\n UnknownError,\n} from \"./errors\";\nimport { SqliteClient } from \"./sqlite-client\";\nimport { Cookie, type ChromiumBrowser, type ChromiumBrowserKey } from \"./types\";\n\nconst CHROMIUM_META_VERSION_HASH_PREFIX = 24;\nconst PBKDF2_ITERATIONS_DARWIN = 1003;\nconst PBKDF2_ITERATIONS_LINUX = 1;\nconst DPAPI_PREFIX_LENGTH_BYTES = 5;\n\nconst ChromiumLocalStateSchema = Schema.Struct({\n os_crypt: Schema.Struct({\n encrypted_key: Schema.String,\n }),\n});\n\ninterface DecryptFn {\n (encrypted: Uint8Array): string | undefined;\n}\n\nexport class ChromiumKeyProvider extends ServiceMap.Service<\n ChromiumKeyProvider,\n {\n readonly buildDecryptor: (\n browserKey: ChromiumBrowserKey,\n stripHashPrefix: boolean,\n ) => Effect.Effect<DecryptFn, CookieDecryptionKeyError>;\n }\n>()(\"@cookies/ChromiumKeyProvider\") {\n static layerDarwin = Layer.effect(this)(\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner;\n\n const buildDecryptor = Effect.fn(\"ChromiumKeyProvider.buildDecryptor\")(function* (\n browserKey: ChromiumBrowserKey,\n stripHashPrefix: boolean,\n ) {\n const config = chromiumConfig(browserKey);\n const password = yield* spawner\n .string(\n ChildProcess.make(\"security\", [\n \"find-generic-password\",\n \"-w\",\n \"-s\",\n config.keychainService,\n ]),\n )\n .pipe(\n Effect.map((output) => output.trim()),\n Effect.catchTag(\"PlatformError\", () =>\n new CookieDecryptionKeyError({\n browser: browserKey,\n platform: \"darwin\",\n }).asEffect(),\n ),\n );\n\n if (!password) {\n return yield* new CookieDecryptionKeyError({\n browser: browserKey,\n platform: \"darwin\",\n }).asEffect();\n }\n\n const key = deriveKey(password, PBKDF2_ITERATIONS_DARWIN);\n return ((encrypted: Uint8Array) =>\n decryptAes128Cbc(encrypted, [key], stripHashPrefix)) satisfies DecryptFn;\n });\n\n return { buildDecryptor } as const;\n }),\n ).pipe(Layer.provide(NodeServices.layer));\n\n static layerLinux = Layer.effect(this)(\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner;\n\n const buildDecryptor = Effect.fn(\"ChromiumKeyProvider.buildDecryptor\")(function* (\n browserKey: ChromiumBrowserKey,\n stripHashPrefix: boolean,\n ) {\n const config = chromiumConfig(browserKey);\n const lookups = [\n [\"secret-tool\", \"lookup\", \"application\", config.linuxSecretLabel],\n [\"secret-tool\", \"lookup\", \"xdg:schema\", \"chrome_libsecret_os_crypt_password_v2\"],\n [\"secret-tool\", \"lookup\", \"xdg:schema\", \"chrome_libsecret_os_crypt_password_v1\"],\n ];\n\n let password = \"\";\n for (const args of lookups) {\n const command = args[0]!;\n const commandArgs = args.slice(1);\n const result = yield* spawner.string(ChildProcess.make(command, commandArgs)).pipe(\n Effect.map((output) => output.trim()),\n Effect.catchTag(\"PlatformError\", () => Effect.succeed(\"\")),\n );\n if (result) {\n password = result;\n break;\n }\n }\n\n if (!password) password = \"peanuts\";\n\n const keys = new Set<string>([password, \"peanuts\", \"\"]);\n const candidates = Array.from(keys).map((candidateKey) =>\n deriveKey(candidateKey, PBKDF2_ITERATIONS_LINUX),\n );\n return ((encrypted: Uint8Array) =>\n decryptAes128Cbc(encrypted, candidates, stripHashPrefix)) satisfies DecryptFn;\n });\n\n return { buildDecryptor } as const;\n }),\n ).pipe(Layer.provide(NodeServices.layer));\n\n static layerWin32 = Layer.effect(this)(\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner;\n const fileSystem = yield* FileSystem.FileSystem;\n\n const buildDecryptor = Effect.fn(\"ChromiumKeyProvider.buildDecryptor\")(function* (\n browserKey: ChromiumBrowserKey,\n stripHashPrefix: boolean,\n ) {\n const config = chromiumConfig(browserKey);\n const localStatePath = path.join(os.homedir(), config.localStatePath);\n\n const localStateContent = yield* fileSystem.readFileString(localStatePath).pipe(\n Effect.catchTag(\"PlatformError\", () =>\n new CookieDecryptionKeyError({\n browser: browserKey,\n platform: \"win32\",\n }).asEffect(),\n ),\n );\n\n const localState = yield* Effect.try({\n try: () =>\n Schema.decodeUnknownSync(ChromiumLocalStateSchema)(JSON.parse(localStateContent)),\n catch: () => new CookieDecryptionKeyError({ browser: browserKey, platform: \"win32\" }),\n });\n\n const encodedKey = localState.os_crypt.encrypted_key;\n\n const encryptedKey = Buffer.from(encodedKey, \"base64\");\n const base64Key = encryptedKey.subarray(DPAPI_PREFIX_LENGTH_BYTES).toString(\"base64\");\n\n const psCommand = `Add-Type -AssemblyName System.Security; $encrypted = [Convert]::FromBase64String('${base64Key}'); $decrypted = [System.Security.Cryptography.ProtectedData]::Unprotect($encrypted, $null, 'CurrentUser'); [Convert]::ToBase64String($decrypted)`;\n const result = yield* spawner\n .string(ChildProcess.make(\"powershell\", [\"-Command\", psCommand]))\n .pipe(\n Effect.map((output) => output.trim()),\n Effect.catchTag(\"PlatformError\", () =>\n new CookieDecryptionKeyError({\n browser: browserKey,\n platform: \"win32\",\n }).asEffect(),\n ),\n );\n\n if (!result) {\n return yield* new CookieDecryptionKeyError({\n browser: browserKey,\n platform: \"win32\",\n }).asEffect();\n }\n\n const masterKey = Buffer.from(result, \"base64\");\n return ((encrypted: Uint8Array) =>\n decryptAes256Gcm(encrypted, masterKey, stripHashPrefix)) satisfies DecryptFn;\n });\n\n return { buildDecryptor } as const;\n }),\n ).pipe(Layer.provide(NodeServices.layer));\n}\n\nexport class ChromiumSqliteFallback extends ServiceMap.Service<ChromiumSqliteFallback>()(\n \"@cookies/ChromiumSqliteFallback\",\n {\n make: Effect.gen(function* () {\n const sqliteClient = yield* SqliteClient;\n const fileSystem = yield* FileSystem.FileSystem;\n const keyProvider = yield* ChromiumKeyProvider;\n\n const resolveCookieDbPath = Effect.fn(\"ChromiumSqliteFallback.resolveCookieDbPath\")(\n function* (profilePath: string, browserKey: string) {\n const networkPath = path.join(profilePath, \"Network\", \"Cookies\");\n if (yield* fileSystem.exists(networkPath)) return networkPath;\n\n const legacyPath = path.join(profilePath, \"Cookies\");\n if (yield* fileSystem.exists(legacyPath)) return legacyPath;\n\n return yield* new CookieDatabaseNotFoundError({ browser: browserKey }).asEffect();\n },\n );\n\n const readMetaVersion = Effect.fn(\"ChromiumSqliteFallback.readMetaVersion\")(function* (\n databasePath: string,\n ) {\n const rows = yield* sqliteClient\n .query(databasePath, \"SELECT value FROM meta WHERE key = 'version'\", \"chromium\")\n .pipe(\n Effect.catchTag(\"CookieReadError\", () =>\n Effect.succeed([] as Array<Record<string, unknown>>),\n ),\n );\n\n const value = rows[0]?.value;\n if (typeof value === \"number\") return Math.floor(value);\n if (typeof value === \"bigint\") return Math.floor(Number(value));\n if (typeof value === \"string\") {\n const parsed = Number.parseInt(value, 10);\n return Number.isFinite(parsed) ? parsed : 0;\n }\n return 0;\n });\n\n const extractImpl = Effect.fn(\"ChromiumSqliteFallback.extract\")(function* (\n browser: ChromiumBrowser,\n ) {\n yield* Effect.annotateCurrentSpan({ browser: browser.key });\n\n const databasePath = yield* resolveCookieDbPath(browser.profilePath, browser.key);\n const { tempDatabasePath } = yield* sqliteClient.copyToTemp(\n databasePath,\n `cookies-sqlite-${browser.key}-`,\n \"Cookies\",\n browser.key,\n );\n\n const metaVersion = yield* readMetaVersion(tempDatabasePath);\n const stripHashPrefix = metaVersion >= CHROMIUM_META_VERSION_HASH_PREFIX;\n const decryptValue = yield* keyProvider.buildDecryptor(browser.key, stripHashPrefix);\n\n const cookieRows = yield* sqliteClient.query(\n tempDatabasePath,\n `SELECT name, value, host_key, path, expires_utc, samesite, encrypted_value, is_secure, is_httponly FROM cookies ORDER BY expires_utc DESC`,\n browser.key,\n );\n\n const cookies: Cookie[] = [];\n for (const row of cookieRows) {\n const cookieName = typeof row.name === \"string\" ? row.name : undefined;\n if (!cookieName) continue;\n\n const hostKey = typeof row.host_key === \"string\" ? row.host_key : undefined;\n if (!hostKey) continue;\n\n let cookieValue = typeof row.value === \"string\" ? row.value : undefined;\n if (!cookieValue || cookieValue.length === 0) {\n const encrypted =\n row.encrypted_value instanceof Uint8Array ? row.encrypted_value : undefined;\n if (!encrypted) continue;\n const decrypted = decryptValue(encrypted);\n if (decrypted === undefined) continue;\n cookieValue = decrypted;\n }\n\n const rawExpiry = row.expires_utc;\n const expires = normalizeChromiumExpiration(\n typeof rawExpiry === \"number\" ||\n typeof rawExpiry === \"bigint\" ||\n typeof rawExpiry === \"string\"\n ? rawExpiry\n : undefined,\n );\n\n cookies.push(\n Cookie.make({\n name: cookieName,\n value: cookieValue,\n domain: hostKey,\n path: typeof row.path === \"string\" ? row.path : \"/\",\n ...(expires !== undefined ? { expires } : {}),\n secure: Number(row.is_secure) !== 0,\n httpOnly: Number(row.is_httponly) !== 0,\n sameSite: normalizeChromiumSameSite(row.samesite),\n }),\n );\n }\n\n yield* Effect.logInfo(\"Chromium SQLite fallback cookies extracted\", {\n browser: browser.key,\n count: cookies.length,\n });\n\n return cookies;\n }, Effect.scoped);\n\n const extract = (browser: ChromiumBrowser) =>\n extractImpl(browser).pipe(\n Effect.catchTags({\n CookieDatabaseNotFoundError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n CookieDatabaseCopyError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n CookieReadError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n CookieDecryptionKeyError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n PlatformError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n }),\n );\n\n return { extract } as const;\n }),\n },\n) {\n static layer = Layer.effect(this)(this.make).pipe(\n Layer.provide(SqliteClient.layer),\n Layer.provide(\n Layer.unwrap(\n Effect.sync(() => {\n const currentPlatform = os.platform();\n if (currentPlatform === \"darwin\") return ChromiumKeyProvider.layerDarwin;\n if (currentPlatform === \"win32\") return ChromiumKeyProvider.layerWin32;\n return ChromiumKeyProvider.layerLinux;\n }),\n ),\n ),\n Layer.provide(NodeServices.layer),\n );\n}\n","import { Cookie } from \"../types\";\n\nconst MAC_EPOCH_DELTA_SECONDS = 978_307_200;\nconst BINARY_COOKIE_PAGE_HEADER = 0x00000100;\nconst BINARY_COOKIE_MAGIC = \"cook\";\nconst UINT32_SIZE_BYTES = 4;\nconst DOUBLE_SIZE_BYTES = 8;\nconst BINARY_COOKIE_MIN_HEADER_BYTES = 8;\nconst BINARY_COOKIE_MIN_PAGE_BYTES = 16;\nconst BINARY_COOKIE_MIN_RECORD_BYTES = 48;\nconst BINARY_COOKIE_SECURE_FLAG = 0x1;\nconst BINARY_COOKIE_HTTP_ONLY_FLAG = 0x4;\nconst BINARY_COOKIE_FLAGS_OFFSET = 8;\nconst BINARY_COOKIE_URL_OFFSET = 16;\nconst BINARY_COOKIE_NAME_OFFSET = 20;\nconst BINARY_COOKIE_PATH_OFFSET = 24;\nconst BINARY_COOKIE_VALUE_OFFSET = 28;\nconst BINARY_COOKIE_EXPIRATION_OFFSET = 40;\n\nexport const parseBinaryCookies = (buffer: Buffer): Cookie[] => {\n if (buffer.length < BINARY_COOKIE_MIN_HEADER_BYTES) return [];\n if (buffer.subarray(0, UINT32_SIZE_BYTES).toString(\"utf8\") !== BINARY_COOKIE_MAGIC) return [];\n\n const pageCount = buffer.readUInt32BE(UINT32_SIZE_BYTES);\n let cursor = BINARY_COOKIE_MIN_HEADER_BYTES;\n const pageSizes: number[] = [];\n\n for (let index = 0; index < pageCount; index += 1) {\n pageSizes.push(buffer.readUInt32BE(cursor));\n cursor += UINT32_SIZE_BYTES;\n }\n\n const cookies: Cookie[] = [];\n for (const pageSize of pageSizes) {\n const page = buffer.subarray(cursor, cursor + pageSize);\n cursor += pageSize;\n cookies.push(...decodePage(page));\n }\n return cookies;\n};\n\nconst decodePage = (page: Buffer): Cookie[] => {\n if (page.length < BINARY_COOKIE_MIN_PAGE_BYTES) return [];\n\n const header = page.readUInt32BE(0);\n if (header !== BINARY_COOKIE_PAGE_HEADER) return [];\n\n const cookieCount = page.readUInt32LE(UINT32_SIZE_BYTES);\n const offsets: number[] = [];\n let cursor = BINARY_COOKIE_MIN_HEADER_BYTES;\n\n for (let index = 0; index < cookieCount; index += 1) {\n offsets.push(page.readUInt32LE(cursor));\n cursor += UINT32_SIZE_BYTES;\n }\n\n const cookies: Cookie[] = [];\n for (const offset of offsets) {\n const cookie = decodeCookieRecord(page.subarray(offset));\n if (cookie) cookies.push(cookie);\n }\n return cookies;\n};\n\nconst decodeCookieRecord = (record: Buffer): Cookie | undefined => {\n if (record.length < BINARY_COOKIE_MIN_RECORD_BYTES) return undefined;\n\n const size = record.readUInt32LE(0);\n if (size < BINARY_COOKIE_MIN_RECORD_BYTES || size > record.length) return undefined;\n\n const flags = record.readUInt32LE(BINARY_COOKIE_FLAGS_OFFSET);\n const isSecure = (flags & BINARY_COOKIE_SECURE_FLAG) !== 0;\n const isHttpOnly = (flags & BINARY_COOKIE_HTTP_ONLY_FLAG) !== 0;\n\n const urlOffset = record.readUInt32LE(BINARY_COOKIE_URL_OFFSET);\n const nameOffset = record.readUInt32LE(BINARY_COOKIE_NAME_OFFSET);\n const pathOffset = record.readUInt32LE(BINARY_COOKIE_PATH_OFFSET);\n const valueOffset = record.readUInt32LE(BINARY_COOKIE_VALUE_OFFSET);\n\n const expiration = readDoubleLE(record, BINARY_COOKIE_EXPIRATION_OFFSET);\n\n const rawUrl = readCString(record, urlOffset, size);\n const name = readCString(record, nameOffset, size);\n const cookiePath = readCString(record, pathOffset, size) ?? \"/\";\n const value = readCString(record, valueOffset, size) ?? \"\";\n\n if (!name) return undefined;\n\n const domain = rawUrl ? safeHostname(rawUrl) : undefined;\n const expires =\n expiration && expiration > 0 ? Math.round(expiration + MAC_EPOCH_DELTA_SECONDS) : undefined;\n\n return Cookie.make({\n name,\n value,\n domain: domain ?? \"\",\n path: cookiePath,\n expires,\n secure: isSecure,\n httpOnly: isHttpOnly,\n });\n};\n\nconst readDoubleLE = (buffer: Buffer, offset: number): number => {\n if (offset + DOUBLE_SIZE_BYTES > buffer.length) return 0;\n return buffer.subarray(offset, offset + DOUBLE_SIZE_BYTES).readDoubleLE(0);\n};\n\nconst readCString = (buffer: Buffer, offset: number, end: number): string | undefined => {\n if (offset <= 0 || offset >= end) return undefined;\n\n let cursor = offset;\n while (cursor < end && buffer[cursor] !== 0) {\n cursor += 1;\n }\n if (cursor >= end) return undefined;\n return buffer.toString(\"utf8\", offset, cursor);\n};\n\nconst safeHostname = (raw: string): string | undefined => {\n try {\n const url = raw.includes(\"://\") ? raw : `https://${raw}`;\n return new URL(url).hostname;\n } catch {\n const cleaned = raw.trim();\n if (cleaned === \"\") return undefined;\n return cleaned;\n }\n};\n","import path from \"node:path\";\nimport { Effect, Layer, Match, Option, Schema, SchemaGetter, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { CdpClient } from \"./cdp-client\";\nimport { SqliteClient } from \"./sqlite-client\";\nimport { ChromiumSqliteFallback } from \"./chromium-sqlite\";\nimport { ExtractionError, RequiresFullDiskAccess, UnknownError } from \"./errors\";\nimport { parseBinaryCookies } from \"./utils/binary-cookies\";\nimport { SameSitePolicy, Cookie, type Browser } from \"./types\";\n\nconst SAME_SITE_NONE = 0;\nconst SAME_SITE_LAX = 1;\nconst SAME_SITE_STRICT = 2;\nconst MS_PER_SECOND = 1000;\n\nconst SqliteBool = Schema.Union([Schema.Number, Schema.BigInt]).pipe(\n Schema.decodeTo(Schema.Boolean, {\n decode: SchemaGetter.transform((value) => Number(value) !== 0),\n encode: SchemaGetter.transform((value) => (value ? 1 : 0)),\n }),\n);\n\nconst FirefoxExpiry = Schema.Union([Schema.Number, Schema.BigInt, Schema.String]).pipe(\n Schema.decodeTo(Schema.optional(Schema.Number), {\n decode: SchemaGetter.transform((value) => {\n const milliseconds = Number(value);\n if (Number.isNaN(milliseconds) || milliseconds <= 0) return undefined;\n return Math.floor(milliseconds / MS_PER_SECOND);\n }),\n encode: SchemaGetter.transform((value) => (value ?? 0) * MS_PER_SECOND),\n }),\n);\n\nconst FirefoxSameSite = Schema.Union([Schema.Number, Schema.BigInt, Schema.String]).pipe(\n Schema.decodeTo(Schema.optional(SameSitePolicy), {\n decode: SchemaGetter.transform((value) => {\n const numeric = Number(value);\n if (numeric === SAME_SITE_STRICT) return \"Strict\" as const;\n if (numeric === SAME_SITE_LAX) return \"Lax\" as const;\n if (numeric === SAME_SITE_NONE) return \"None\" as const;\n return undefined;\n }),\n encode: SchemaGetter.transform((value) => {\n if (value === \"Strict\") return SAME_SITE_STRICT;\n if (value === \"Lax\") return SAME_SITE_LAX;\n return SAME_SITE_NONE;\n }),\n }),\n);\n\nconst FirefoxCookieRow = Schema.Struct({\n name: Schema.String,\n value: Schema.String,\n host: Schema.String,\n path: Schema.String,\n expiry: FirefoxExpiry,\n isSecure: SqliteBool,\n isHttpOnly: SqliteBool,\n sameSite: FirefoxSameSite,\n});\n\nconst firefoxRowToCookie = (row: typeof FirefoxCookieRow.Type) =>\n Cookie.make({\n name: row.name,\n value: row.value,\n domain: row.host,\n path: row.path || \"/\",\n expires: row.expiry,\n secure: row.isSecure,\n httpOnly: row.isHttpOnly,\n sameSite: row.sameSite,\n });\n\nexport class Cookies extends ServiceMap.Service<Cookies>()(\"@cookies/Cookies\", {\n make: Effect.gen(function* () {\n const cdpClient = yield* CdpClient;\n const sqliteClient = yield* SqliteClient;\n const sqliteFallback = yield* ChromiumSqliteFallback;\n const fs = yield* FileSystem.FileSystem;\n\n const extractChromium = (browser: Extract<Browser, { _tag: \"ChromiumBrowser\" }>) =>\n cdpClient\n .extractCookies({\n key: browser.key,\n profilePath: browser.profilePath,\n executablePath: browser.executablePath,\n })\n .pipe(\n Effect.catchTags({\n TimeoutError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n SchemaError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n SocketError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n HttpClientError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n PlatformError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n }),\n Effect.catchTag(\"ExtractionError\", (cdpError) =>\n Effect.gen(function* () {\n yield* Effect.logWarning(\"CDP extraction failed, trying SQLite fallback\", {\n browser: browser.key,\n error: cdpError.message,\n });\n return yield* sqliteFallback.extract(browser);\n }).pipe(Effect.catchTag(\"ExtractionError\", () => cdpError.asEffect())),\n ),\n );\n\n const extractFirefox = (browser: Extract<Browser, { _tag: \"FirefoxBrowser\" }>) =>\n Effect.gen(function* () {\n const cookieDbPath = path.join(browser.profilePath, \"cookies.sqlite\");\n const { tempDatabasePath } = yield* sqliteClient.copyToTemp(\n cookieDbPath,\n \"cookies-firefox-\",\n \"cookies.sqlite\",\n \"firefox\",\n );\n\n const rows = yield* sqliteClient.query(\n tempDatabasePath,\n `SELECT name, value, host, path, expiry, isSecure, isHttpOnly, sameSite FROM moz_cookies ORDER BY expiry DESC`,\n \"firefox\",\n );\n\n return yield* Effect.forEach(rows, (row) =>\n Schema.decodeUnknownEffect(FirefoxCookieRow)(row).pipe(Effect.map(firefoxRowToCookie)),\n );\n }).pipe(\n Effect.scoped,\n Effect.catchTags({\n CookieReadError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n CookieDatabaseCopyError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n SchemaError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n }),\n );\n\n const extractSafari = (browser: Extract<Browser, { _tag: \"SafariBrowser\" }>) =>\n Effect.gen(function* () {\n if (Option.isNone(browser.cookieFilePath)) {\n return yield* new ExtractionError({\n reason: new RequiresFullDiskAccess(),\n }).asEffect();\n }\n\n const data = yield* fs.readFile(browser.cookieFilePath.value);\n return parseBinaryCookies(Buffer.from(data)).filter(\n (cookie) => Boolean(cookie.name) && Boolean(cookie.domain),\n );\n }).pipe(\n Effect.catchTags({\n PlatformError: (cause) =>\n new ExtractionError({ reason: new UnknownError({ cause }) }).asEffect(),\n }),\n );\n\n const extract = (browser: Browser) =>\n Match.valueTags(browser, {\n ChromiumBrowser: extractChromium,\n FirefoxBrowser: extractFirefox,\n SafariBrowser: extractSafari,\n });\n\n return { extract } as const;\n }),\n}) {\n static layer = Layer.effect(this, this.make).pipe(\n Layer.provide(CdpClient.layer),\n Layer.provide(SqliteClient.layer),\n Layer.provide(ChromiumSqliteFallback.layer),\n Layer.provide(NodeServices.layer),\n );\n\n static layerTest = Layer.effect(this, this.make).pipe(\n Layer.provide(CdpClient.layerTest),\n Layer.provide(SqliteClient.layer),\n Layer.provide(ChromiumSqliteFallback.layer),\n Layer.provide(NodeServices.layer),\n );\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\tconst browserId = match?.groups.id ?? 'com.apple.Safari';\n\n\t// Correct the case for Safari's bundle identifier\n\tif (browserId === 'com.apple.safari') {\n\t\treturn 'com.apple.Safari';\n\t}\n\n\treturn browserId;\n}\n","import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst execOptions = {};\n\tif (signal) {\n\t\texecOptions.signal = signal;\n\t}\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments], execOptions);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n","import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n","import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// TODO: Fix the casing of bundle identifiers in the next major version.\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.\n\tMSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},\n\tMSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},\n\tChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},\n\tChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tOperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},\n\tVivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n};\n\nexport const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\t// Windows can append a hash suffix to ProgIds using a dot or hyphen\n\t// (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).\n\t// Try exact match first, then try without the suffix.\n\tconst dotIndex = id.lastIndexOf('.');\n\tconst hyphenIndex = id.lastIndexOf('-');\n\tconst baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);\n\tconst baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);\n\n\treturn windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nexport {_windowsBrowserProgIdMap} from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n","import { Effect, identity, Layer, Option, ServiceMap, Array as Arr } from \"effect\";\nimport getDefaultBrowser from \"default-browser\";\nimport { configByBundleId, configByDesktopFile } from \"./browser-config\";\nimport { ListBrowsersError } from \"./errors\";\nimport type { Browser } from \"./types\";\n\nexport class Browsers extends ServiceMap.Service<Browsers>()(\"@cookies/Browsers\", {\n make: Effect.gen(function* () {\n const sources = new Set<Effect.Effect<Browser[], ListBrowsersError>>();\n\n const register = (source: Effect.Effect<Browser[], ListBrowsersError>) =>\n Effect.sync(() => {\n sources.add(source);\n });\n\n const list = Effect.forEach(sources, identity, {\n concurrency: \"unbounded\",\n }).pipe(Effect.map(Arr.flatten), Effect.withSpan(\"Browsers.list\"));\n\n const defaultBrowser = Effect.fn(\"Browsers.defaultBrowser\")(function* () {\n const result = yield* Effect.tryPromise({\n try: () => getDefaultBrowser(),\n catch: (cause) => new ListBrowsersError({ cause: String(cause) }),\n });\n\n const normalizedId = result.id.toLowerCase();\n const desktopKey = normalizedId.replace(/\\.desktop$/, \"\");\n const config = configByBundleId(normalizedId) ?? configByDesktopFile(desktopKey);\n if (!config) return Option.none<Browser>();\n\n const browsers = yield* list;\n return Option.fromNullishOr(\n browsers.find((browser) => {\n if (browser._tag === \"ChromiumBrowser\") return browser.key === config.key;\n if (browser._tag === \"FirefoxBrowser\") return config.key === \"firefox\";\n if (browser._tag === \"SafariBrowser\") return config.key === \"safari\";\n return false;\n }),\n );\n });\n\n return { register, list, defaultBrowser };\n }),\n}) {\n static layer = Layer.effect(this, this.make);\n}\n","import path from \"node:path\";\nimport * as os from \"node:os\";\nimport { Array as Arr, Effect, Layer, Option, Predicate, Schema, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { ChildProcess } from \"effect/unstable/process\";\nimport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { ChromiumBrowser, type ChromiumBrowserKey } from \"./types\";\nimport { CHROMIUM_CONFIGS, type ChromiumConfig } from \"./browser-config\";\nimport { ListBrowsersError } from \"./errors\";\nimport { Browsers } from \"./browser-detector\";\n\nconst CONCURRENCY_PROFILE_SCAN = 10;\n\nconst LocalStateSchema = Schema.Struct({\n profile: Schema.optional(\n Schema.Struct({\n last_used: Schema.optional(Schema.String),\n }),\n ),\n});\n\nconst PreferencesSchema = Schema.Struct({\n intl: Schema.optional(\n Schema.Struct({\n selected_languages: Schema.optional(Schema.String),\n accept_languages: Schema.optional(Schema.String),\n }),\n ),\n});\n\nexport class ChromiumPlatform extends ServiceMap.Service<\n ChromiumPlatform,\n {\n executableCandidates: (config: ChromiumConfig) => readonly string[];\n userDataDir: (config: ChromiumConfig) => string;\n }\n>()(\"@cookies/ChromiumPlatform\") {\n static layerDarwin = Layer.succeed(this, {\n executableCandidates: (config: ChromiumConfig) => [config.executable.darwin],\n userDataDir: (config: ChromiumConfig) =>\n path.join(os.homedir(), \"Library\", \"Application Support\", config.userData.darwin),\n });\n\n static layerLinux = Layer.succeed(this, {\n executableCandidates: (config: ChromiumConfig) => config.executable.linux,\n userDataDir: (config: ChromiumConfig) =>\n path.join(\n process.env[\"XDG_CONFIG_HOME\"] ?? path.join(os.homedir(), \".config\"),\n config.userData.linux,\n ),\n });\n\n static layerWin32 = Layer.effect(this)(\n Effect.gen(function* () {\n const spawner = yield* ChildProcessSpawner;\n const registryPaths = new Map<string, string>();\n\n for (const config of CHROMIUM_CONFIGS) {\n const regPath = `HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\App Paths\\\\${config.registryKey}`;\n const output = yield* spawner\n .string(ChildProcess.make(\"reg\", [\"query\", regPath, \"/ve\"]))\n .pipe(\n Effect.map((result) => result.trim()),\n Effect.catch(() => Effect.succeed(\"\")),\n );\n if (output) {\n const match = output.match(/REG_SZ\\s+(.+)/);\n const registryExePath = match?.[1]?.trim();\n if (registryExePath) registryPaths.set(config.key, registryExePath);\n }\n }\n\n const programFiles = process.env[\"ProgramFiles\"] ?? \"C:\\\\Program Files\";\n const programFilesX86 = process.env[\"ProgramFiles(x86)\"] ?? \"C:\\\\Program Files (x86)\";\n const localAppData =\n process.env[\"LOCALAPPDATA\"] ?? path.join(os.homedir(), \"AppData\", \"Local\");\n\n return {\n executableCandidates: (config: ChromiumConfig) => {\n const candidates: string[] = [];\n const regPath = registryPaths.get(config.key);\n if (regPath) candidates.push(regPath);\n for (const relative of config.executable.win32) {\n candidates.push(\n path.join(programFiles, relative),\n path.join(programFilesX86, relative),\n path.join(localAppData, relative),\n );\n }\n return candidates;\n },\n userDataDir: (config: ChromiumConfig) => path.join(localAppData, config.userData.win32),\n };\n }),\n ).pipe(Layer.provide(NodeServices.layer));\n}\n\nexport class ChromiumSource extends ServiceMap.Service<ChromiumSource>()(\n \"@cookies/ChromiumSource\",\n {\n make: Effect.gen(function* () {\n const browsers = yield* Browsers;\n const config = yield* ChromiumPlatform;\n const fs = yield* FileSystem.FileSystem;\n\n const getLastUsedProfile = (userDataDir: string) =>\n fs.readFileString(path.join(userDataDir, \"Local State\")).pipe(\n Effect.flatMap((content) =>\n Schema.decodeEffect(Schema.fromJsonString(LocalStateSchema))(content),\n ),\n Effect.map((localState) => Option.fromNullishOr(localState.profile?.last_used)),\n Effect.catchReason(\"PlatformError\", \"NotFound\", () =>\n Effect.succeed(Option.none<string>()),\n ),\n );\n\n const loadProfileLocale = (profilePath: string) =>\n fs.readFileString(path.join(profilePath, \"Preferences\")).pipe(\n Effect.flatMap((content) =>\n Schema.decodeEffect(Schema.fromJsonString(PreferencesSchema))(content),\n ),\n Effect.map((preferences) => {\n const languages =\n preferences.intl?.selected_languages ?? preferences.intl?.accept_languages;\n if (!languages) return undefined;\n return languages\n .split(\",\")\n .map((language) => language.trim())\n .find((language) => language.length > 0);\n }),\n Effect.catch(() => Effect.succeed(undefined)),\n );\n\n const detectProfiles = (\n key: ChromiumBrowserKey,\n executablePath: string,\n userDataDir: string,\n ) =>\n Effect.gen(function* () {\n if (!(yield* fs.exists(userDataDir))) return [];\n\n const lastUsedProfileName = yield* getLastUsedProfile(userDataDir);\n const entries = yield* fs\n .readDirectory(userDataDir)\n .pipe(\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed([] as string[])),\n );\n\n const hasPreferences = (profileEntryPath: string) =>\n fs\n .exists(path.join(profileEntryPath, \"Preferences\"))\n .pipe(\n Effect.catchReason(\"PlatformError\", \"BadResource\", () => Effect.succeed(false)),\n );\n\n return yield* Effect.forEach(\n entries,\n (entry) =>\n Effect.gen(function* () {\n const profileEntryPath = path.join(userDataDir, entry);\n if (!(yield* hasPreferences(profileEntryPath))) return undefined;\n\n const locale = yield* loadProfileLocale(profileEntryPath);\n\n return new ChromiumBrowser({\n key,\n profileName: entry,\n profilePath: profileEntryPath,\n executablePath,\n ...(locale ? { locale } : {}),\n });\n }),\n { concurrency: CONCURRENCY_PROFILE_SCAN },\n ).pipe(\n Effect.map(Arr.filter(Predicate.isNotUndefined)),\n Effect.map(\n Arr.sort(ChromiumBrowser.orderBy(Option.getOrUndefined(lastUsedProfileName))),\n ),\n );\n });\n\n yield* browsers.register(\n Effect.forEach(\n CHROMIUM_CONFIGS,\n (chromiumConfig) =>\n Effect.gen(function* () {\n let executablePath: string | undefined;\n for (const candidate of config.executableCandidates(chromiumConfig)) {\n if (yield* fs.exists(candidate)) {\n executablePath = candidate;\n break;\n }\n }\n if (!executablePath) return [];\n\n return yield* detectProfiles(\n chromiumConfig.key,\n executablePath,\n config.userDataDir(chromiumConfig),\n );\n }),\n { concurrency: \"unbounded\" },\n ).pipe(\n Effect.map(Arr.flatten),\n Effect.catch((cause) => new ListBrowsersError({ cause: String(cause) }).asEffect()),\n ),\n );\n }),\n },\n) {\n static layer = Layer.effectDiscard(this.make).pipe(Layer.provide(NodeServices.layer));\n}\n","const { hasOwnProperty } = Object.prototype\n\nconst encode = (obj, opt = {}) => {\n if (typeof opt === 'string') {\n opt = { section: opt }\n }\n opt.align = opt.align === true\n opt.newline = opt.newline === true\n opt.sort = opt.sort === true\n opt.whitespace = opt.whitespace === true || opt.align === true\n // The `typeof` check is required because accessing the `process` directly fails on browsers.\n /* istanbul ignore next */\n opt.platform = opt.platform || (typeof process !== 'undefined' && process.platform)\n opt.bracketedArray = opt.bracketedArray !== false\n\n /* istanbul ignore next */\n const eol = opt.platform === 'win32' ? '\\r\\n' : '\\n'\n const separator = opt.whitespace ? ' = ' : '='\n const children = []\n\n const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj)\n\n let padToChars = 0\n // If aligning on the separator, then padToChars is determined as follows:\n // 1. Get the keys\n // 2. Exclude keys pointing to objects unless the value is null or an array\n // 3. Add `[]` to array keys\n // 4. Ensure non empty set of keys\n // 5. Reduce the set to the longest `safe` key\n // 6. Get the `safe` length\n if (opt.align) {\n padToChars = safe(\n (\n keys\n .filter(k => obj[k] === null || Array.isArray(obj[k]) || typeof obj[k] !== 'object')\n .map(k => Array.isArray(obj[k]) ? `${k}[]` : k)\n )\n .concat([''])\n .reduce((a, b) => safe(a).length >= safe(b).length ? a : b)\n ).length\n }\n\n let out = ''\n const arraySuffix = opt.bracketedArray ? '[]' : ''\n\n for (const k of keys) {\n const val = obj[k]\n if (val && Array.isArray(val)) {\n for (const item of val) {\n out += safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + separator + safe(item) + eol\n }\n } else if (val && typeof val === 'object') {\n children.push(k)\n } else {\n out += safe(k).padEnd(padToChars, ' ') + separator + safe(val) + eol\n }\n }\n\n if (opt.section && out.length) {\n out = '[' + safe(opt.section) + ']' + (opt.newline ? eol + eol : eol) + out\n }\n\n for (const k of children) {\n const nk = splitSections(k, '.').join('\\\\.')\n const section = (opt.section ? opt.section + '.' : '') + nk\n const child = encode(obj[k], {\n ...opt,\n section,\n })\n if (out.length && child.length) {\n out += eol\n }\n\n out += child\n }\n\n return out\n}\n\nfunction splitSections (str, separator) {\n var lastMatchIndex = 0\n var lastSeparatorIndex = 0\n var nextIndex = 0\n var sections = []\n\n do {\n nextIndex = str.indexOf(separator, lastMatchIndex)\n\n if (nextIndex !== -1) {\n lastMatchIndex = nextIndex + separator.length\n\n if (nextIndex > 0 && str[nextIndex - 1] === '\\\\') {\n continue\n }\n\n sections.push(str.slice(lastSeparatorIndex, nextIndex))\n lastSeparatorIndex = nextIndex + separator.length\n }\n } while (nextIndex !== -1)\n\n sections.push(str.slice(lastSeparatorIndex))\n\n return sections\n}\n\nconst decode = (str, opt = {}) => {\n opt.bracketedArray = opt.bracketedArray !== false\n const out = Object.create(null)\n let p = out\n let section = null\n // section |key = value\n const re = /^\\[([^\\]]*)\\]\\s*$|^([^=]+)(=(.*))?$/i\n const lines = str.split(/[\\r\\n]+/g)\n const duplicates = {}\n\n for (const line of lines) {\n if (!line || line.match(/^\\s*[;#]/) || line.match(/^\\s*$/)) {\n continue\n }\n const match = line.match(re)\n if (!match) {\n continue\n }\n if (match[1] !== undefined) {\n section = unsafe(match[1])\n if (section === '__proto__') {\n // not allowed\n // keep parsing the section, but don't attach it.\n p = Object.create(null)\n continue\n }\n p = out[section] = out[section] || Object.create(null)\n continue\n }\n const keyRaw = unsafe(match[2])\n let isArray\n if (opt.bracketedArray) {\n isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'\n } else {\n duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1\n isArray = duplicates[keyRaw] > 1\n }\n const key = isArray && keyRaw.endsWith('[]')\n ? keyRaw.slice(0, -2) : keyRaw\n\n if (key === '__proto__') {\n continue\n }\n const valueRaw = match[3] ? unsafe(match[4]) : true\n const value = valueRaw === 'true' ||\n valueRaw === 'false' ||\n valueRaw === 'null' ? JSON.parse(valueRaw)\n : valueRaw\n\n // Convert keys with '[]' suffix to an array\n if (isArray) {\n if (!hasOwnProperty.call(p, key)) {\n p[key] = []\n } else if (!Array.isArray(p[key])) {\n p[key] = [p[key]]\n }\n }\n\n // safeguard against resetting a previously defined\n // array by accidentally forgetting the brackets\n if (Array.isArray(p[key])) {\n p[key].push(value)\n } else {\n p[key] = value\n }\n }\n\n // {a:{y:1},\"a.b\":{x:2}} --> {a:{y:1,b:{x:2}}}\n // use a filter to return the keys that have to be deleted.\n const remove = []\n for (const k of Object.keys(out)) {\n if (!hasOwnProperty.call(out, k) ||\n typeof out[k] !== 'object' ||\n Array.isArray(out[k])) {\n continue\n }\n\n // see if the parent section is also an object.\n // if so, add it to that, and mark this one for deletion\n const parts = splitSections(k, '.')\n p = out\n const l = parts.pop()\n const nl = l.replace(/\\\\\\./g, '.')\n for (const part of parts) {\n if (part === '__proto__') {\n continue\n }\n if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {\n p[part] = Object.create(null)\n }\n p = p[part]\n }\n if (p === out && nl === l) {\n continue\n }\n\n p[nl] = out[k]\n remove.push(k)\n }\n for (const del of remove) {\n delete out[del]\n }\n\n return out\n}\n\nconst isQuoted = val => {\n return (val.startsWith('\"') && val.endsWith('\"')) ||\n (val.startsWith(\"'\") && val.endsWith(\"'\"))\n}\n\nconst safe = val => {\n if (\n typeof val !== 'string' ||\n val.match(/[=\\r\\n]/) ||\n val.match(/^\\[/) ||\n (val.length > 1 && isQuoted(val)) ||\n val !== val.trim()\n ) {\n return JSON.stringify(val)\n }\n return val.split(';').join('\\\\;').split('#').join('\\\\#')\n}\n\nconst unsafe = val => {\n val = (val || '').trim()\n if (isQuoted(val)) {\n // remove the single quotes before calling JSON.parse\n if (val.charAt(0) === \"'\") {\n val = val.slice(1, -1)\n }\n try {\n val = JSON.parse(val)\n } catch {\n // ignore errors\n }\n } else {\n // walk the val to find the first not-escaped ; character\n let esc = false\n let unesc = ''\n for (let i = 0, l = val.length; i < l; i++) {\n const c = val.charAt(i)\n if (esc) {\n if ('\\\\;#'.indexOf(c) !== -1) {\n unesc += c\n } else {\n unesc += '\\\\' + c\n }\n\n esc = false\n } else if (';#'.indexOf(c) !== -1) {\n break\n } else if (c === '\\\\') {\n esc = true\n } else {\n unesc += c\n }\n }\n if (esc) {\n unesc += '\\\\'\n }\n\n return unesc.trim()\n }\n return val\n}\n\nmodule.exports = {\n parse: decode,\n decode,\n stringify: encode,\n encode,\n safe,\n unsafe,\n}\n","import path from \"node:path\";\nimport * as os from \"node:os\";\nimport { parse } from \"ini\";\nimport { Effect, Layer, Predicate, Schema, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { FirefoxBrowser } from \"./types\";\nimport { FIREFOX_CONFIG } from \"./browser-config\";\nimport { ListBrowsersError } from \"./errors\";\nimport { Browsers } from \"./browser-detector\";\n\nconst ProfileSection = Schema.Struct({\n Name: Schema.String,\n Path: Schema.String,\n IsRelative: Schema.optional(Schema.String),\n});\n\nconst parseProfilesIni = (content: string) =>\n Object.values(parse(content))\n .map((section) => Schema.decodeUnknownOption(ProfileSection)(section))\n .filter((option) => option._tag === \"Some\")\n .map((option) => ({\n name: option.value.Name,\n path: option.value.Path,\n isRelative: option.value.IsRelative !== \"0\",\n }));\n\nexport class FirefoxPlatform extends ServiceMap.Service<\n FirefoxPlatform,\n { dataDir: string; executablePaths: readonly string[] }\n>()(\"@cookies/FirefoxPlatform\") {\n static layerDarwin = Layer.succeed(this, {\n dataDir: path.join(os.homedir(), FIREFOX_CONFIG.dataDir.darwin),\n executablePaths: [FIREFOX_CONFIG.executable.darwin],\n });\n\n static layerLinux = Layer.succeed(this, {\n dataDir: path.join(os.homedir(), FIREFOX_CONFIG.dataDir.linux),\n executablePaths: FIREFOX_CONFIG.executable.linux,\n });\n\n static layerWin32 = Layer.succeed(this, {\n dataDir: path.join(os.homedir(), FIREFOX_CONFIG.dataDir.win32),\n executablePaths: FIREFOX_CONFIG.executable.win32.flatMap((relative) => {\n const programFiles = process.env[\"ProgramFiles\"] ?? \"C:\\\\Program Files\";\n const programFilesX86 = process.env[\"ProgramFiles(x86)\"] ?? \"C:\\\\Program Files (x86)\";\n return [path.join(programFiles, relative), path.join(programFilesX86, relative)];\n }),\n });\n}\n\nexport class FirefoxSource extends ServiceMap.Service<FirefoxSource>()(\"@cookies/FirefoxSource\", {\n make: Effect.gen(function* () {\n const browsers = yield* Browsers;\n const config = yield* FirefoxPlatform;\n const fileSystem = yield* FileSystem.FileSystem;\n\n yield* browsers.register(\n Effect.gen(function* () {\n let executablePath: string | undefined;\n for (const candidate of config.executablePaths) {\n if (yield* fileSystem.exists(candidate)) {\n executablePath = candidate;\n break;\n }\n }\n if (!executablePath) return [];\n\n const iniPath = path.join(config.dataDir, \"profiles.ini\");\n const iniContent = yield* fileSystem.readFileString(iniPath);\n\n const parsedProfiles = parseProfilesIni(iniContent);\n\n return yield* Effect.forEach(\n parsedProfiles,\n (parsed) =>\n Effect.gen(function* () {\n const profileEntryPath = parsed.isRelative\n ? path.join(config.dataDir, parsed.path)\n : parsed.path;\n const cookiesPath = path.join(profileEntryPath, \"cookies.sqlite\");\n if (!(yield* fileSystem.exists(cookiesPath))) return undefined;\n\n return new FirefoxBrowser({\n profileName: path.basename(profileEntryPath),\n profilePath: profileEntryPath,\n });\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter(Predicate.isNotUndefined)));\n }).pipe(Effect.catch((cause) => new ListBrowsersError({ cause: String(cause) }).asEffect())),\n );\n }),\n}) {\n static layer = Layer.effectDiscard(this.make);\n}\n","import path from \"node:path\";\nimport * as os from \"node:os\";\nimport { Effect, Layer, Option, ServiceMap } from \"effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport { SafariBrowser } from \"./types\";\nimport { SAFARI_CONFIG } from \"./browser-config\";\nimport { ListBrowsersError } from \"./errors\";\nimport { Browsers } from \"./browser-detector\";\n\nexport class SafariPlatform extends ServiceMap.Service<\n SafariPlatform,\n { executable: string; cookieRelativePaths: readonly string[] }\n>()(\"@cookies/SafariPlatform\") {\n static layerDarwin = Layer.succeed(this, {\n executable: SAFARI_CONFIG.executable,\n cookieRelativePaths: SAFARI_CONFIG.cookieRelativePaths,\n });\n}\n\nexport class SafariSource extends ServiceMap.Service<SafariSource>()(\"@cookies/SafariSource\", {\n make: Effect.gen(function* () {\n const browsers = yield* Browsers;\n const config = yield* SafariPlatform;\n const fileSystem = yield* FileSystem.FileSystem;\n\n yield* browsers.register(\n Effect.gen(function* () {\n if (!(yield* fileSystem.exists(config.executable))) return [];\n\n let cookieFilePath = Option.none<string>();\n for (const relativePath of config.cookieRelativePaths) {\n const candidate = path.join(os.homedir(), relativePath, \"Cookies.binarycookies\");\n if (yield* fileSystem.exists(candidate)) {\n cookieFilePath = Option.some(candidate);\n break;\n }\n }\n\n return [new SafariBrowser({ cookieFilePath })];\n }).pipe(\n Effect.catchTag(\"PlatformError\", (cause) =>\n new ListBrowsersError({ cause: String(cause) }).asEffect(),\n ),\n ),\n );\n }),\n}) {\n static layer = Layer.effectDiscard(this.make);\n}\n","import * as os from \"node:os\";\nimport { Effect, Layer } from \"effect\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { Browsers } from \"./browser-detector\";\nimport { ChromiumSource, ChromiumPlatform } from \"./chromium\";\nimport { FirefoxSource, FirefoxPlatform } from \"./firefox\";\nimport { SafariSource, SafariPlatform } from \"./safari\";\n\nconst base = Browsers.layer;\n\nconst layerLiveDarwin = Layer.mergeAll(\n base,\n ChromiumSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(ChromiumPlatform.layerDarwin),\n Layer.provide(NodeServices.layer),\n ),\n FirefoxSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(FirefoxPlatform.layerDarwin),\n Layer.provide(NodeServices.layer),\n ),\n SafariSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(SafariPlatform.layerDarwin),\n Layer.provide(NodeServices.layer),\n ),\n);\n\nconst layerLiveLinux = Layer.mergeAll(\n base,\n ChromiumSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(ChromiumPlatform.layerLinux),\n Layer.provide(NodeServices.layer),\n ),\n FirefoxSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(FirefoxPlatform.layerLinux),\n Layer.provide(NodeServices.layer),\n ),\n);\n\nconst layerLiveWin32 = Layer.mergeAll(\n base,\n ChromiumSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(ChromiumPlatform.layerWin32),\n Layer.provide(NodeServices.layer),\n ),\n FirefoxSource.layer.pipe(\n Layer.provide(base),\n Layer.provide(FirefoxPlatform.layerWin32),\n Layer.provide(NodeServices.layer),\n ),\n);\n\nexport const layerLive = Layer.unwrap(\n Effect.sync(() => {\n const currentPlatform = os.platform();\n if (currentPlatform === \"darwin\") return layerLiveDarwin;\n if (currentPlatform === \"win32\") return layerLiveWin32;\n return layerLiveLinux;\n }),\n);\n","export const SNAPSHOT_TIMEOUT_MS = 30_000;\nexport const REF_PREFIX = \"e\";\nexport const EXCLUDED_ARIA_ROLE = \"text\";\nexport const HEADLESS_CHROMIUM_ARGS = [\n \"--enable-webgl\",\n \"--use-gl=angle\",\n \"--use-angle=swiftshader\",\n \"--ignore-gpu-blocklist\",\n];\n\nexport const INTERACTIVE_ROLES = new Set([\n \"button\",\n \"link\",\n \"textbox\",\n \"checkbox\",\n \"radio\",\n \"combobox\",\n \"listbox\",\n \"menuitem\",\n \"menuitemcheckbox\",\n \"menuitemradio\",\n \"option\",\n \"searchbox\",\n \"slider\",\n \"spinbutton\",\n \"switch\",\n \"tab\",\n \"treeitem\",\n]);\n\nexport const CONTENT_ROLES = new Set([\n \"heading\",\n \"cell\",\n \"gridcell\",\n \"columnheader\",\n \"rowheader\",\n \"listitem\",\n \"article\",\n \"region\",\n \"main\",\n \"navigation\",\n]);\n\nexport const NAVIGATION_DETECT_DELAY_MS = 1_000;\nexport const POST_NAVIGATION_SETTLE_MS = 500;\n\nexport const ESTIMATED_CHARS_PER_TOKEN = 4;\nexport const MAX_ELEMENT_TEXT_LENGTH = 100;\nexport const MAX_CURSOR_INTERACTIVE_ELEMENTS = 100;\nexport const OVERLAY_CONTAINER_ID = \"__expect_annotation_overlay__\";\nexport const EVENT_COLLECT_INTERVAL_MS = 250;\nexport const RRWEB_CHECKOUT_INTERVAL_MS = 10_000;\n\nexport const REPLAY_PLAYER_WIDTH_PX = 960;\nexport const REPLAY_PLAYER_HEIGHT_PX = 540;\n","import { Schema } from \"effect\";\n\nexport class BrowserLaunchError extends Schema.ErrorClass<BrowserLaunchError>(\"BrowserLaunchError\")(\n {\n _tag: Schema.tag(\"BrowserLaunchError\"),\n cause: Schema.String,\n },\n) {\n message = `Failed to launch browser: ${this.cause}`;\n}\n\nexport class SnapshotTimeoutError extends Schema.ErrorClass<SnapshotTimeoutError>(\n \"SnapshotTimeoutError\",\n)({\n _tag: Schema.tag(\"SnapshotTimeoutError\"),\n selector: Schema.String,\n timeoutMs: Schema.Number,\n cause: Schema.String,\n}) {\n message = `Snapshot timed out after ${this.timeoutMs}ms on selector \"${this.selector}\": ${this.cause}`;\n}\n\nexport class RefNotFoundError extends Schema.ErrorClass<RefNotFoundError>(\"RefNotFoundError\")({\n _tag: Schema.tag(\"RefNotFoundError\"),\n ref: Schema.String,\n availableRefs: Schema.Array(Schema.String),\n}) {\n message =\n this.availableRefs.length === 0\n ? `Unknown ref \"${this.ref}\" (no refs available — page may be empty)`\n : `Unknown ref \"${this.ref}\" (available refs: ${this.availableRefs.join(\", \")})`;\n}\n\nexport class RefAmbiguousError extends Schema.ErrorClass<RefAmbiguousError>(\"RefAmbiguousError\")({\n _tag: Schema.tag(\"RefAmbiguousError\"),\n ref: Schema.String,\n matchCount: Schema.String,\n}) {\n message = `Ref \"${this.ref}\" matched ${this.matchCount} elements. Run snapshot to get updated refs.`;\n}\n\nexport class RefBlockedError extends Schema.ErrorClass<RefBlockedError>(\"RefBlockedError\")({\n _tag: Schema.tag(\"RefBlockedError\"),\n ref: Schema.String,\n}) {\n message = `Ref \"${this.ref}\" is blocked by an overlay. Dismiss any modals or banners first.`;\n}\n\nexport class RefNotVisibleError extends Schema.ErrorClass<RefNotVisibleError>(\"RefNotVisibleError\")(\n {\n _tag: Schema.tag(\"RefNotVisibleError\"),\n ref: Schema.String,\n },\n) {\n message = `Ref \"${this.ref}\" is not visible. Try scrolling it into view.`;\n}\n\nexport class ActionTimeoutError extends Schema.ErrorClass<ActionTimeoutError>(\"ActionTimeoutError\")(\n {\n _tag: Schema.tag(\"ActionTimeoutError\"),\n ref: Schema.String,\n },\n) {\n message = `Action on \"${this.ref}\" timed out. The element may be blocked or still loading. Run snapshot to check.`;\n}\n\nexport class ActionUnknownError extends Schema.ErrorClass<ActionUnknownError>(\"ActionUnknownError\")(\n {\n _tag: Schema.tag(\"ActionUnknownError\"),\n ref: Schema.String,\n cause: Schema.String,\n },\n) {\n message = `Action on \"${this.ref}\" failed: ${this.cause}`;\n}\n\nexport class NavigationError extends Schema.ErrorClass<NavigationError>(\"NavigationError\")({\n _tag: Schema.tag(\"NavigationError\"),\n url: Schema.String,\n cause: Schema.String,\n}) {\n message = `Navigation to \"${this.url}\" failed: ${this.cause}`;\n}\n\nexport class RecorderInjectionError extends Schema.ErrorClass<RecorderInjectionError>(\n \"RecorderInjectionError\",\n)({\n _tag: Schema.tag(\"RecorderInjectionError\"),\n cause: Schema.String,\n}) {\n message = `Failed to inject rrweb recorder: ${this.cause}`;\n}\n\nexport class SessionLoadError extends Schema.ErrorClass<SessionLoadError>(\"SessionLoadError\")({\n _tag: Schema.tag(\"SessionLoadError\"),\n path: Schema.String,\n cause: Schema.String,\n}) {\n message = `Failed to load session from ${this.path}: ${this.cause}`;\n}\n\nexport type ActionError =\n | RefAmbiguousError\n | RefBlockedError\n | RefNotVisibleError\n | ActionTimeoutError\n | ActionUnknownError;\n","import {\n ActionTimeoutError,\n ActionUnknownError,\n RefAmbiguousError,\n RefBlockedError,\n RefNotVisibleError,\n} from \"../errors\";\nimport type { ActionError } from \"../errors\";\n\n// HACK: Playwright only exports `errors.TimeoutError` publicly. All other failure\n// modes are thrown as plain `Error` with descriptive messages — internal classes\n// like `NonRecoverableDOMError` are serialized away by the client/server protocol\n// boundary (client/connection.ts:172-173 calls parseError → rewriteErrorMessage),\n// so consumers can only pattern-match on message strings.\n//\n// Complete list of error messages thrown by Playwright (@ ef45dd4):\n//\n// ── TimeoutError (server/progress.ts:100) ──────────────────────────────────────\n// \"Timeout {N}ms exceeded.\"\n// + appended call log via formatCallLog (client/connection.ts:345-351):\n// \"Call log:\\n waiting for locator(...) to be visible\\n element is not visible\"\n//\n// ── Strict mode (injected/injectedScript.ts:1258) ──────────────────────────────\n// \"strict mode violation: locator(...) resolved to {N} elements:\\n ...\"\n//\n// ── NonRecoverableDOMError (server/dom.ts) ──────────────────────────────────────\n// \"Element is not visible\" (line 322)\n// \"Element is outside of the viewport\" (line 328)\n// \"Did not find some options\" (line 334)\n// \"Option being selected is not enabled\" (line 340)\n// \"{desc} intercepts pointer events\" (line 346)\n// \"Element is not {state}\" (state = stable|enabled|editable|visible) (line 352)\n// \"Cannot uncheck radio button. Radio buttons can only be unchecked\n// by selecting another radio button in the same group.\" (line 750)\n// \"Clicking the checkbox did not change its state\" (line 758)\n// \"Element(s) not found\" (frames.ts:1115,1139)\n// \"Element is not attached to the DOM\" (frames.ts:1149)\n//\n// ── createStacklessError (injected/injectedScript.ts) ──────────────────────────\n// 'Unknown engine \"{name}\" while parsing selector {sel}' (line 262)\n// \"Can only capture aria snapshot of Element nodes.\" (line 311)\n// \"Can't query n-th element in a request with the capture.\" (line 338)\n// \"Node is not queryable.\" (line 349)\n// \"Internal error: there should not be a capture in the selector.\" (line 353)\n// \"Expected a Node but got {type}\" (line 396)\n// \"Element is not an <input>, <textarea>, <select> or [contenteditable]\n// and does not have a role allowing [aria-readonly]\" (line 745)\n// \"Not a checkbox or radio button\" (line 756,768)\n// 'Unexpected element state \"{state}\"' (line 774)\n// \"Element is not a <select> element\" (line 782)\n// 'Input of type \"{type}\" cannot be filled' (line 834)\n// \"Cannot type text into input[type=number]\" (line 838)\n// \"Malformed value\" (line 847)\n// \"Element is not an <input>, <textarea> or [contenteditable] element\" (line 855)\n// \"Node is not an element\" (line 899,927)\n// \"Element is not connected\" (line 1481)\n// \"Not a select element with a multiple attribute\" (line 1514)\n// 'Expected text is not provided for {expr}' (line 1543,1589)\n// \"Not an input element\" (line 1565)\n// 'Unknown expect matcher: {expr}' (line 1575,1606)\n// \"Node is not an HTMLElement\" (frames.ts:1254)\n// \"Node is not an <input>, <textarea> or <select> element\" (frames.ts:1271)\n//\n// ── Plain Error (server/frames.ts) ──────────────────────────────────────────────\n// \"Element is not attached to the DOM\" (dom.ts:881)\n// \"Frame is currently attempting a navigation\" (frames.ts:549)\n// \"Open JavaScript dialog prevents evaluation\" (frames.ts:551)\n// 'Failed to find element matching selector \"{sel}\"' (frames.ts:836)\n// \"The page does not support tap.\" (frames.ts:1201)\n// 'No element matching {sel}' (frames.ts:1220)\n\nconst ELEMENT_COUNT_REGEX = /resolved to (\\d+) elements/;\nconst TIMEOUT_REGEX = /Timeout \\d+ms exceeded/;\n\nconst AMBIGUOUS_PATTERNS = [\"strict mode violation\"] as const;\n\nconst BLOCKED_PATTERNS = [\"intercepts pointer events\"] as const;\n\nconst NOT_VISIBLE_PATTERNS = [\n \"Element is not visible\",\n \"Element is outside of the viewport\",\n \"element is not visible\",\n \"element is outside of the viewport\",\n \"to be visible\",\n \"Element is not stable\",\n \"element is not stable\",\n \"Element(s) not found\",\n \"Element is not attached to the DOM\",\n \"Element is not connected\",\n \"No element matching\",\n \"Failed to find element matching selector\",\n \"not attached\",\n] as const;\n\nconst matchesAny = (message: string, patterns: readonly string[]): boolean =>\n patterns.some((pattern) => message.includes(pattern));\n\nexport const toActionError = (error: unknown, ref: string): ActionError => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n\n if (matchesAny(errorMessage, AMBIGUOUS_PATTERNS)) {\n const countMatch = ELEMENT_COUNT_REGEX.exec(errorMessage);\n return new RefAmbiguousError({ matchCount: countMatch ? countMatch[1] : \"multiple\", ref });\n }\n\n if (matchesAny(errorMessage, BLOCKED_PATTERNS)) {\n return new RefBlockedError({ ref });\n }\n\n if (matchesAny(errorMessage, NOT_VISIBLE_PATTERNS)) {\n return new RefNotVisibleError({ ref });\n }\n\n if (TIMEOUT_REGEX.test(errorMessage)) {\n return new ActionTimeoutError({ ref });\n }\n\n return new ActionUnknownError({ ref, cause: errorMessage });\n};\n","const INDENT_SIZE = 2;\n\nexport const getIndentLevel = (line: string): number => {\n let spaces = 0;\n while (spaces < line.length && line[spaces] === \" \") spaces++;\n return Math.floor(spaces / INDENT_SIZE);\n};\n","import { getIndentLevel } from \"./get-indent-level\";\n\nconst REF_MARKER = \"[ref=\";\n\nconst isContentLine = (line: string): boolean =>\n line.includes(REF_MARKER) || (line.includes(\":\") && !line.endsWith(\":\"));\n\nexport const compactTree = (tree: string): string => {\n const lines = tree.split(\"\\n\");\n const indents = lines.map(getIndentLevel);\n const retained = new Array<boolean>(lines.length).fill(false);\n const parentStack: number[] = [];\n\n for (let index = lines.length - 1; index >= 0; index--) {\n if (!isContentLine(lines[index])) continue;\n\n retained[index] = true;\n\n parentStack.length = 0;\n for (let ancestor = index - 1; ancestor >= 0; ancestor--) {\n if (indents[ancestor] >= indents[index]) continue;\n if (retained[ancestor]) break;\n retained[ancestor] = true;\n parentStack.push(ancestor);\n }\n }\n\n return lines.filter((_, index) => retained[index]).join(\"\\n\");\n};\n","import type { Locator, Page } from \"playwright\";\nimport type { AriaRole, RefEntry } from \"../types\";\n\n// HACK: role is `string` throughout the ref system because it comes from Playwright's\n// aria snapshot output. This is the only place we narrow it back for `getByRole`.\nexport const resolveLocator = (page: Page, entry: RefEntry): Locator => {\n if (entry.selector) return page.locator(entry.selector);\n const locator = page.getByRole(entry.role as AriaRole, { name: entry.name, exact: true });\n return entry.nth !== undefined ? locator.nth(entry.nth) : locator;\n};\n","import { Effect } from \"effect\";\nimport type { Page } from \"playwright\";\nimport { RefNotFoundError } from \"../errors\";\nimport type { RefMap } from \"../types\";\nimport { resolveLocator } from \"./resolve-locator\";\n\nexport const createLocator = (page: Page, refs: RefMap) =>\n Effect.fn(\"Browser.resolveRef\")(function* (ref: string) {\n const entry = refs[ref];\n if (!entry) {\n return yield* new RefNotFoundError({ ref, availableRefs: Object.keys(refs) });\n }\n return resolveLocator(page, entry);\n });\n","import type { Page } from \"playwright\";\nimport { Effect } from \"effect\";\nimport type { ExpectRuntime } from \"../generated/runtime-types\";\n\n// HACK: page.evaluate erases types across the serialization boundary; casts are confined here\nexport const evaluateRuntime = <K extends keyof ExpectRuntime>(\n page: Page,\n method: K,\n ...args: Parameters<ExpectRuntime[K]>\n) =>\n Effect.promise(\n () =>\n page.evaluate(\n ({ method, args }: { method: string; args: unknown[] }) => {\n const runtime = Reflect.get(globalThis, \"__EXPECT_RUNTIME__\");\n if (!runtime || typeof runtime !== \"object\") {\n throw new Error(\"Browser runtime is not initialized\");\n }\n\n const fn = Reflect.get(runtime, method);\n if (typeof fn !== \"function\") {\n throw new Error(`Browser runtime method not found: ${method}`);\n }\n\n return fn(...args);\n },\n { method, args: args as unknown[] },\n ) as Promise<ReturnType<ExpectRuntime[K]>>,\n );\n","import { Effect } from \"effect\";\nimport {\n INTERACTIVE_ROLES,\n MAX_CURSOR_INTERACTIVE_ELEMENTS,\n MAX_ELEMENT_TEXT_LENGTH,\n} from \"../constants\";\nimport type { Page } from \"playwright\";\nimport { evaluateRuntime } from \"./evaluate-runtime\";\n\nconst INTERACTIVE_HTML_TAGS = [\"a\", \"button\", \"input\", \"select\", \"textarea\", \"details\", \"summary\"];\n\nexport const findCursorInteractive = Effect.fn(\"findCursorInteractive\")(function* (\n page: Page,\n rootSelector?: string,\n) {\n return yield* evaluateRuntime(\n page,\n \"findCursorInteractiveElements\",\n rootSelector || \"body\",\n MAX_ELEMENT_TEXT_LENGTH,\n [...INTERACTIVE_ROLES],\n INTERACTIVE_HTML_TAGS,\n MAX_CURSOR_INTERACTIVE_ELEMENTS,\n );\n});\n","import { Option } from \"effect\";\nimport { EXCLUDED_ARIA_ROLE } from \"../constants\";\n\nexport interface ParsedAriaLine {\n role: string;\n name: string;\n}\n\nconst ARIA_LINE_REGEX = /- (\\w+)\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\")?/;\n\nexport const parseAriaLine = (line: string): Option.Option<ParsedAriaLine> => {\n const match = ARIA_LINE_REGEX.exec(line);\n if (!match) return Option.none();\n\n const role = match[1];\n if (role === EXCLUDED_ARIA_ROLE) return Option.none();\n\n const name = match[2]?.replace(/\\\\(.)/g, \"$1\") ?? \"\";\n return Option.some({ role, name });\n};\n","import type { RefMap } from \"../types\";\n\nconst groupKey = (role: string, name: string): string => `${role}|${name}`;\n\nexport const resolveNthDuplicates = (refs: RefMap): void => {\n const groups = new Map<string, string[]>();\n\n for (const [ref, entry] of Object.entries(refs)) {\n const key = groupKey(entry.role, entry.name);\n const existing = groups.get(key);\n if (existing) existing.push(ref);\n else groups.set(key, [ref]);\n }\n\n for (const refIds of groups.values()) {\n if (refIds.length <= 1) continue;\n for (let nthIndex = 0; nthIndex < refIds.length; nthIndex++) {\n refs[refIds[nthIndex]].nth = nthIndex;\n }\n }\n};\n","import { ESTIMATED_CHARS_PER_TOKEN, INTERACTIVE_ROLES } from \"../constants\";\nimport type { RefMap, SnapshotStats } from \"../types\";\n\nexport const computeSnapshotStats = (tree: string, refs: RefMap): SnapshotStats => {\n const entries = Object.values(refs);\n return {\n lines: tree.split(\"\\n\").length,\n characters: tree.length,\n estimatedTokens: Math.ceil(tree.length / ESTIMATED_CHARS_PER_TOKEN),\n totalRefs: entries.length,\n interactiveRefs: entries.filter((entry) => INTERACTIVE_ROLES.has(entry.role)).length,\n };\n};\n","export const RUNTIME_SCRIPT = \"\\\"use strict\\\";var __EXPECT_RUNTIME__=(()=>{var Cr=Object.defineProperty;var ra=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ia=Object.prototype.hasOwnProperty;var na=(s,e)=>{for(var t in e)Cr(s,t,{get:e[t],enumerable:!0})},oa=(s,e,t,r)=>{if(e&&typeof e==\\\"object\\\"||typeof e==\\\"function\\\")for(let i of sa(e))!ia.call(s,i)&&i!==t&&Cr(s,i,{get:()=>e[i],enumerable:!(r=ra(e,i))||r.enumerable});return s};var aa=s=>oa(Cr({},\\\"__esModule\\\",{value:!0}),s);var od={};na(od,{findCursorInteractiveElements:()=>ed,getAllEvents:()=>id,getEventCount:()=>nd,getEvents:()=>sd,getPerformanceMetrics:()=>Kf,injectOverlayLabels:()=>Qf,removeOverlay:()=>qf,startRecording:()=>td,stopRecording:()=>rd});var la=new Set([\\\"role\\\",\\\"name\\\",\\\"aria-label\\\",\\\"rel\\\",\\\"href\\\"]);function ua(s,e){let t=la.has(s);t||(t=s.startsWith(\\\"data-\\\")&&Be(s));let r=Be(e)&&e.length<100;return r||(r=e.startsWith(\\\"#\\\")&&Be(e.slice(1))),t&&r}function ca(s){return Be(s)}function ha(s){return Be(s)}function fa(s){return!0}function si(s,e){if(s.nodeType!==Node.ELEMENT_NODE)throw new Error(\\\"Can't generate CSS selector for non-element node type.\\\");if(s.tagName.toLowerCase()===\\\"html\\\")return\\\"html\\\";let t={root:document.body,idName:ca,className:ha,tagName:fa,attr:ua,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,i={...t,...e},n=ya(i.root,t),o,l=0;for(let u of da(s,i,n)){if(new Date().getTime()-r.getTime()>i.timeoutMs||l>=i.maxNumberOfPathChecks){let h=ma(s,n);if(!h)throw new Error(`Timeout: Can't find a unique selector after ${i.timeoutMs}ms`);return We(h)}if(l++,xr(u,n)){o=u;break}}if(!o)throw new Error(\\\"Selector was not found.\\\");let a=[...oi(o,s,i,n,r)];return a.sort(Er),a.length>0?We(a[0]):We(o)}function*da(s,e,t){let r=[],i=[],n=s,o=0;for(;n&&n!==t;){let l=pa(n,e);for(let a of l)a.level=o;if(r.push(l),n=n.parentElement,o++,i.push(...ni(r)),o>=e.seedMinLength){i.sort(Er);for(let a of i)yield a;i=[]}}i.sort(Er);for(let l of i)yield l}function Be(s){if(/^[a-z\\\\-]{3,}$/i.test(s)){let e=s.split(/-|[A-Z]/);for(let t of e)if(t.length<=2||/[^aeiou]{4,}/i.test(t))return!1;return!0}return!1}function pa(s,e){let t=[],r=s.getAttribute(\\\"id\\\");r&&e.idName(r)&&t.push({name:\\\"#\\\"+CSS.escape(r),penalty:0});for(let o=0;o<s.classList.length;o++){let l=s.classList[o];e.className(l)&&t.push({name:\\\".\\\"+CSS.escape(l),penalty:1})}for(let o=0;o<s.attributes.length;o++){let l=s.attributes[o];e.attr(l.name,l.value)&&t.push({name:`[${CSS.escape(l.name)}=\\\"${CSS.escape(l.value)}\\\"]`,penalty:2})}let i=s.tagName.toLowerCase();if(e.tagName(i)){t.push({name:i,penalty:5});let o=Ir(s,i);o!==void 0&&t.push({name:ii(i,o),penalty:10})}let n=Ir(s);return n!==void 0&&t.push({name:ga(i,n),penalty:50}),t}function We(s){let e=s[0],t=e.name;for(let r=1;r<s.length;r++){let i=s[r].level||0;e.level===i-1?t=`${s[r].name} > ${t}`:t=`${s[r].name} ${t}`,e=s[r]}return t}function ri(s){return s.map(e=>e.penalty).reduce((e,t)=>e+t,0)}function Er(s,e){return ri(s)-ri(e)}function Ir(s,e){let t=s.parentNode;if(!t)return;let r=t.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(e===void 0||r.tagName.toLowerCase()===e)&&i++,r!==s);)r=r.nextSibling;return i}function ma(s,e){let t=0,r=s,i=[];for(;r&&r!==e;){let n=r.tagName.toLowerCase(),o=Ir(r,n);if(o===void 0)return;i.push({name:ii(n,o),penalty:NaN,level:t}),r=r.parentElement,t++}if(xr(i,e))return i}function ga(s,e){return s===\\\"html\\\"?\\\"html\\\":`${s}:nth-child(${e})`}function ii(s,e){return s===\\\"html\\\"?\\\"html\\\":`${s}:nth-of-type(${e})`}function*ni(s,e=[]){if(s.length>0)for(let t of s[0])yield*ni(s.slice(1,s.length),e.concat(t));else yield e}function ya(s,e){return s.nodeType===Node.DOCUMENT_NODE?s:s===e.root?s.ownerDocument:s}function xr(s,e){let t=We(s);switch(e.querySelectorAll(t).length){case 0:throw new Error(`Can't select any node with this selector: ${t}`);case 1:return!0;default:return!1}}function*oi(s,e,t,r,i){if(s.length>2&&s.length>t.optimizedMinLength)for(let n=1;n<s.length-1;n++){if(new Date().getTime()-i.getTime()>t.timeoutMs)return;let l=[...s];l.splice(n,1),xr(l,r)&&r.querySelector(We(l))===e&&(yield l,yield*oi(l,e,t,r,i))}}var wa=Object.defineProperty,ba=(s,e,t)=>e in s?wa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>ba(s,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,t),ai,Sa=Object.defineProperty,va=(s,e,t)=>e in s?Sa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,li=(s,e,t)=>va(s,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,t),j=(s=>(s[s.Document=0]=\\\"Document\\\",s[s.DocumentType=1]=\\\"DocumentType\\\",s[s.Element=2]=\\\"Element\\\",s[s.Text=3]=\\\"Text\\\",s[s.CDATA=4]=\\\"CDATA\\\",s[s.Comment=5]=\\\"Comment\\\",s))(j||{}),ui={Node:[\\\"childNodes\\\",\\\"parentNode\\\",\\\"parentElement\\\",\\\"textContent\\\",\\\"ownerDocument\\\"],ShadowRoot:[\\\"host\\\",\\\"styleSheets\\\"],Element:[\\\"shadowRoot\\\",\\\"querySelector\\\",\\\"querySelectorAll\\\"],MutationObserver:[]},ci={Node:[\\\"contains\\\",\\\"getRootNode\\\"],ShadowRoot:[\\\"getSelection\\\"],Element:[],MutationObserver:[\\\"constructor\\\"]},pt={},Ca=()=>!!globalThis.Zone;function As(s){if(pt[s])return pt[s];let e=globalThis[s],t=e.prototype,r=s in ui?ui[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes(\\\"[native code]\\\"))})),n=s in ci?ci[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]==\\\"function\\\"&&((a=t[l])==null?void 0:a.toString().includes(\\\"[native code]\\\"))}));if(i&&o&&!Ca())return pt[s]=e.prototype,e.prototype;try{let l=document.createElement(\\\"iframe\\\");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?pt[s]=u:t}catch{return t}}var Mr={};function fe(s,e,t){var r;let i=`${s}.${String(t)}`;if(Mr[i])return Mr[i].call(e);let n=As(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Mr[i]=o,o.call(e)):e[t]}var Nr={};function on(s,e,t){let r=`${s}.${String(t)}`;if(Nr[r])return Nr[r].bind(e);let n=As(s)[t];return typeof n!=\\\"function\\\"?e[t]:(Nr[r]=n,n.bind(e))}function Ea(s){return fe(\\\"Node\\\",s,\\\"ownerDocument\\\")}function Ia(s){return fe(\\\"Node\\\",s,\\\"childNodes\\\")}function xa(s){return fe(\\\"Node\\\",s,\\\"parentNode\\\")}function Ma(s){return fe(\\\"Node\\\",s,\\\"parentElement\\\")}function Na(s){return fe(\\\"Node\\\",s,\\\"textContent\\\")}function Ra(s,e){return on(\\\"Node\\\",s,\\\"contains\\\")(e)}function Aa(s){return on(\\\"Node\\\",s,\\\"getRootNode\\\")()}function Oa(s){return!s||!(\\\"host\\\"in s)?null:fe(\\\"ShadowRoot\\\",s,\\\"host\\\")}function Da(s){return s.styleSheets}function Ta(s){return!s||!(\\\"shadowRoot\\\"in s)?null:fe(\\\"Element\\\",s,\\\"shadowRoot\\\")}function _a(s,e){return fe(\\\"Element\\\",s,\\\"querySelector\\\")(e)}function ka(s,e){return fe(\\\"Element\\\",s,\\\"querySelectorAll\\\")(e)}function Pa(){return As(\\\"MutationObserver\\\").constructor}function $a(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i==\\\"function\\\"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var Y={ownerDocument:Ea,childNodes:Ia,parentNode:xa,parentElement:Ma,textContent:Na,contains:Ra,getRootNode:Aa,host:Oa,styleSheets:Da,shadowRoot:Ta,querySelector:_a,querySelectorAll:ka,mutationObserver:Pa,patch:$a};function an(s){return s.nodeType===s.ELEMENT_NODE}function Ye(s){let e=s&&\\\"host\\\"in s&&\\\"mode\\\"in s&&Y.host(s)||null;return!!(e&&\\\"shadowRoot\\\"in e&&Y.shadowRoot(e)===s)}function Ze(s){return Object.prototype.toString.call(s)===\\\"[object ShadowRoot]\\\"}function La(s){return s.includes(\\\" background-clip: text;\\\")&&!s.includes(\\\" -webkit-background-clip: text;\\\")&&(s=s.replace(/\\\\sbackground-clip:\\\\s*text;/g,\\\" -webkit-background-clip: text; background-clip: text;\\\")),s}function Fa(s){let{cssText:e}=s;if(e.split('\\\"').length<3)return e;let t=[\\\"@import\\\",`url(${JSON.stringify(s.href)})`];return s.layerName===\\\"\\\"?t.push(\\\"layer\\\"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(\\\" \\\")+\\\";\\\"}function Br(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);let r=Array.from(e,i=>ln(i,t)).join(\\\"\\\");return La(r)}catch{return null}}function ln(s,e){if(Ba(s)){let t;try{t=Br(s.styleSheet)||Fa(s)}catch{t=s.cssText}return s.styleSheet.href?Ht(t,s.styleSheet.href):t}else{let t=s.cssText;return Wa(s)&&s.selectorText.includes(\\\":\\\")&&(t=Ua(t)),e?Ht(t,e):t}}function Ua(s){let e=/(\\\\[(?:[\\\\w-]+)[^\\\\\\\\])(:(?:[\\\\w-]+)\\\\])/gm;return s.replace(e,\\\"$1\\\\\\\\$2\\\")}function Ba(s){return\\\"styleSheet\\\"in s}function Wa(s){return\\\"selectorText\\\"in s}var Vt=class{constructor(){li(this,\\\"idNodeMap\\\",new Map),li(this,\\\"nodeMetaMap\\\",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function za(){return new Vt}function Gt({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||\\\"\\\",l=r&&Se(r);return(e[t.toLowerCase()]||l&&e[l])&&(n?o=n(o,s):o=\\\"*\\\".repeat(o.length)),o}function Se(s){return s.toLowerCase()}var hi=\\\"__rrweb_original__\\\";function Va(s){let e=s.getContext(\\\"2d\\\");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){let n=e.getImageData,o=hi in n?n[hi]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function jt(s){let e=s.type;return s.hasAttribute(\\\"data-rr-is-password\\\")?\\\"password\\\":e?Se(e):null}function un(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\\\\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return i?.[1]??null}function Ga(s){let e=\\\"\\\";return s.indexOf(\\\"//\\\")>-1?e=s.split(\\\"/\\\").slice(0,3).join(\\\"/\\\"):e=s.split(\\\"/\\\")[0],e=e.split(\\\"?\\\")[0],e}var ja=/url\\\\((?:(')([^']*)'|(\\\")(.*?)\\\"|([^)]*))\\\\)/gm,Ha=/^(?:[a-z+]+:)?\\\\/\\\\//i,Ya=/^www\\\\..*/i,Za=/^(data:)([^,]*),(.*)/i;function Ht(s,e){return(s||\\\"\\\").replace(ja,(t,r,i,n,o,l)=>{let a=i||o||l,u=r||n||\\\"\\\";if(!a)return t;if(Ha.test(a)||Ya.test(a))return`url(${u}${a}${u})`;if(Za.test(a))return`url(${u}${a}${u})`;if(a[0]===\\\"/\\\")return`url(${u}${Ga(e)+a}${u})`;let c=e.split(\\\"/\\\"),h=a.split(\\\"/\\\");c.pop();for(let p of h)p!==\\\".\\\"&&(p===\\\"..\\\"?c.pop():c.push(p));return`url(${u}${c.join(\\\"/\\\")}${u})`})}function mt(s,e=!1){return e?s.replace(/(\\\\/\\\\*[^*]*\\\\*\\\\/)|[\\\\s;]/g,\\\"\\\"):s.replace(/(\\\\/\\\\*[^*]*\\\\*\\\\/)|[\\\\s;]/g,\\\"\\\").replace(/0px/g,\\\"0\\\")}function Xa(s,e,t=!1){let r=Array.from(e.childNodes),i=[],n=0;if(r.length>1&&s&&typeof s==\\\"string\\\"){let o=mt(s,t),l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent==\\\"string\\\"){let u=mt(r[a].textContent,t),c=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),g=o.split(p),m=-1;if(g.length===2)m=g[0].length;else if(g.length>2&&g[0]===\\\"\\\"&&r[a-1].textContent!==\\\"\\\")m=o.indexOf(p,1);else if(g.length===1){if(p=p.substring(0,p.length-1),g=o.split(p),g.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(m=o.indexOf(p));if(g.length>=2&&h>c){let d=r[a-1].textContent;if(d&&typeof d==\\\"string\\\"){let f=mt(d).length;m=o.indexOf(p,f)}m===-1&&(m=g[0].length)}if(m!==-1){let d=Math.floor(m/l);for(;d>0&&d<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;let f=mt(s.substring(0,d),t);if(f.length===m){i.push(s.substring(0,d)),s=s.substring(d),o=o.substring(m);break}else f.length<m?d+=Math.max(1,Math.floor((m-f.length)/l)):d-=Math.max(1,Math.floor((f.length-m)*l))}break}}}}return i.push(s),i}function Ja(s,e){return Xa(s,e).join(\\\"/* rr_split */\\\")}var Ka=1,Qa=new RegExp(\\\"[^a-z0-9-_:]\\\"),Je=-2;function cn(){return Ka++}function qa(s){if(s instanceof HTMLFormElement)return\\\"form\\\";let e=Se(s.tagName);return Qa.test(e)?\\\"div\\\":e}var Ie,fi,el=/^[^ \\\\t\\\\n\\\\r\\\\u000c]+/,tl=/^[, \\\\t\\\\n\\\\r\\\\u000c]+/;function rl(s,e){if(e.trim()===\\\"\\\")return e;let t=0;function r(n){let o,l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):\\\"\\\"}let i=[];for(;r(tl),!(t>=e.length);){let n=r(el);if(n.slice(-1)===\\\",\\\")n=Ne(s,n.substring(0,n.length-1)),i.push(n);else{let o=\\\"\\\";n=Ne(s,n);let l=!1;for(;;){let a=e.charAt(t);if(a===\\\"\\\"){i.push((n+o).trim());break}else if(l)a===\\\")\\\"&&(l=!1);else if(a===\\\",\\\"){t+=1,i.push((n+o).trim());break}else a===\\\"(\\\"&&(l=!0);o+=a,t+=1}}}return i.join(\\\", \\\")}var di=new WeakMap;function Ne(s,e){return!e||e.trim()===\\\"\\\"?e:Os(s,e)}function sl(s){return!!(s.tagName===\\\"svg\\\"||s.ownerSVGElement)}function Os(s,e){let t=di.get(s);if(t||(t=s.createElement(\\\"a\\\"),di.set(s,t)),!e)e=\\\"\\\";else if(e.startsWith(\\\"blob:\\\")||e.startsWith(\\\"data:\\\"))return e;return t.setAttribute(\\\"href\\\",e),t.href}function hn(s,e,t,r){return r&&(t===\\\"src\\\"||t===\\\"href\\\"&&!(e===\\\"use\\\"&&r[0]===\\\"#\\\")||t===\\\"xlink:href\\\"&&r[0]!==\\\"#\\\"||t===\\\"background\\\"&&[\\\"table\\\",\\\"td\\\",\\\"th\\\"].includes(e)?Ne(s,r):t===\\\"srcset\\\"?rl(s,r):t===\\\"style\\\"?Ht(r,Os(s)):e===\\\"object\\\"&&t===\\\"data\\\"?Ne(s,r):r)}function fn(s,e,t){return[\\\"video\\\",\\\"audio\\\"].includes(s)&&e===\\\"autoplay\\\"}function il(s,e,t){try{if(typeof e==\\\"string\\\"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Yt(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Yt(Y.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}return t?Yt(Y.parentNode(s),e,t):!1}function dn(s,e,t,r){let i;if(an(s)){if(i=s,!Y.childNodes(i).length)return!1}else{if(Y.parentElement(s)===null)return!1;i=Y.parentElement(s)}try{if(typeof e==\\\"string\\\"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Yt(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function nl(s,e,t){let r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!==\\\"complete\\\"){let l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener(\\\"load\\\",()=>{clearTimeout(l),i=!0,e()});return}let o=\\\"about:blank\\\";if(r.location.href!==o||s.src===o||s.src===\\\"\\\")return setTimeout(e,0),s.addEventListener(\\\"load\\\",e);s.addEventListener(\\\"load\\\",e)}function ol(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;let n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener(\\\"load\\\",()=>{clearTimeout(n),r=!0,e()})}function al(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d=!1,cssCaptured:f=!1}=e,b=ll(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!==\\\"CSS1Compat\\\"?{type:j.Document,childNodes:[],compatMode:s.compatMode}:{type:j.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:j.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:b};case s.ELEMENT_NODE:return cl(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d,rootId:b});case s.TEXT_NODE:return ul(s,{doc:t,needsMask:o,maskTextFn:u,rootId:b,cssCaptured:f});case s.CDATA_SECTION_NODE:return{type:j.CDATA,textContent:\\\"\\\",rootId:b};case s.COMMENT_NODE:return{type:j.Comment,textContent:Y.textContent(s)||\\\"\\\",rootId:b};default:return!1}}function ll(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function ul(s,e){let{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=Y.parentNode(s),l=o&&o.tagName,a=\\\"\\\",u=l===\\\"STYLE\\\"?!0:void 0,c=l===\\\"SCRIPT\\\"?!0:void 0;return c?a=\\\"SCRIPT_PLACEHOLDER\\\":n||(a=Y.textContent(s),u&&a&&(a=Ht(a,Os(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,Y.parentElement(s)):a.replace(/[\\\\S]/g,\\\"*\\\")),{type:j.Text,textContent:a||\\\"\\\",rootId:i}}function cl(s,e){let{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:g}=e,m=il(s,r,i),d=qa(s),f={},b=s.attributes.length;for(let y=0;y<b;y++){let v=s.attributes[y];fn(d,v.name,v.value)||(f[v.name]=hn(t,d,Se(v.name),v.value))}if(d===\\\"link\\\"&&n){let y=Array.from(t.styleSheets).find(N=>N.href===s.href),v=null;y&&(v=Br(y)),v&&(delete f.rel,delete f.href,f._cssText=v)}if(d===\\\"style\\\"&&s.sheet){let y=Br(s.sheet);y&&(s.childNodes.length>1&&(y=Ja(y,s)),f._cssText=y)}if([\\\"input\\\",\\\"textarea\\\",\\\"select\\\"].includes(d)){let y=s.value,v=s.checked;f.type!==\\\"radio\\\"&&f.type!==\\\"checkbox\\\"&&f.type!==\\\"submit\\\"&&f.type!==\\\"button\\\"&&y?f.value=Gt({element:s,type:jt(s),tagName:d,value:y,maskInputOptions:o,maskInputFn:l}):v&&(f.checked=v)}if(d===\\\"option\\\"&&(s.selected&&!o.select?f.selected=!0:delete f.selected),d===\\\"dialog\\\"&&s.open&&(f.rr_open_mode=s.matches(\\\"dialog:modal\\\")?\\\"modal\\\":\\\"non-modal\\\"),d===\\\"canvas\\\"&&c){if(s.__context===\\\"2d\\\")Va(s)||(f.rr_dataURL=s.toDataURL(a.type,a.quality));else if(!(\\\"__context\\\"in s)){let y=s.toDataURL(a.type,a.quality),v=t.createElement(\\\"canvas\\\");v.width=s.width,v.height=s.height;let N=v.toDataURL(a.type,a.quality);y!==N&&(f.rr_dataURL=y)}}if(d===\\\"img\\\"&&u){Ie||(Ie=t.createElement(\\\"canvas\\\"),fi=Ie.getContext(\\\"2d\\\"));let y=s,v=y.currentSrc||y.getAttribute(\\\"src\\\")||\\\"<unknown-src>\\\",N=y.crossOrigin,T=()=>{y.removeEventListener(\\\"load\\\",T);try{Ie.width=y.naturalWidth,Ie.height=y.naturalHeight,fi.drawImage(y,0,0),f.rr_dataURL=Ie.toDataURL(a.type,a.quality)}catch(V){if(y.crossOrigin!==\\\"anonymous\\\"){y.crossOrigin=\\\"anonymous\\\",y.complete&&y.naturalWidth!==0?T():y.addEventListener(\\\"load\\\",T);return}else console.warn(`Cannot inline img src=${v}! Error: ${V}`)}y.crossOrigin===\\\"anonymous\\\"&&(N?f.crossOrigin=N:y.removeAttribute(\\\"crossorigin\\\"))};y.complete&&y.naturalWidth!==0?T():y.addEventListener(\\\"load\\\",T)}if([\\\"audio\\\",\\\"video\\\"].includes(d)){let y=f;y.rr_mediaState=s.paused?\\\"paused\\\":\\\"played\\\",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(p||(s.scrollLeft&&(f.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(f.rr_scrollTop=s.scrollTop)),m){let{width:y,height:v}=s.getBoundingClientRect();f={class:f.class,rr_width:`${y}px`,rr_height:`${v}px`}}d===\\\"iframe\\\"&&!h(f.src)&&(s.contentDocument||(f.rr_src=f.src),delete f.src);let S;try{customElements.get(d)&&(S=!0)}catch{}return{type:j.Element,tagName:d,attributes:f,childNodes:[],isSVG:sl(s)||void 0,needBlock:m,rootId:g,isCustom:S}}function _(s){return s==null?\\\"\\\":s.toLowerCase()}function pn(s){return s===!0||s===\\\"all\\\"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s===\\\"all\\\",headMetaDescKeywords:s===\\\"all\\\",headTitleMutations:s===\\\"all\\\"}:s||{}}function hl(s,e){if(e.comment&&s.type===j.Comment)return!0;if(s.type===j.Element){if(e.script&&(s.tagName===\\\"script\\\"||s.tagName===\\\"link\\\"&&(s.attributes.rel===\\\"preload\\\"&&s.attributes.as===\\\"script\\\"||s.attributes.rel===\\\"modulepreload\\\")||s.tagName===\\\"link\\\"&&s.attributes.rel===\\\"prefetch\\\"&&typeof s.attributes.href==\\\"string\\\"&&un(s.attributes.href)===\\\"js\\\"))return!0;if(e.headFavicon&&(s.tagName===\\\"link\\\"&&s.attributes.rel===\\\"shortcut icon\\\"||s.tagName===\\\"meta\\\"&&(_(s.attributes.name).match(/^msapplication-tile(image|color)$/)||_(s.attributes.name)===\\\"application-name\\\"||_(s.attributes.rel)===\\\"icon\\\"||_(s.attributes.rel)===\\\"apple-touch-icon\\\"||_(s.attributes.rel)===\\\"shortcut icon\\\")))return!0;if(s.tagName===\\\"meta\\\"){if(e.headMetaDescKeywords&&_(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(_(s.attributes.property).match(/^(og|twitter|fb):/)||_(s.attributes.name).match(/^(og|twitter):/)||_(s.attributes.name)===\\\"pinterest\\\"))return!0;if(e.headMetaRobots&&(_(s.attributes.name)===\\\"robots\\\"||_(s.attributes.name)===\\\"googlebot\\\"||_(s.attributes.name)===\\\"bingbot\\\"))return!0;if(e.headMetaHttpEquiv&&s.attributes[\\\"http-equiv\\\"]!==void 0)return!0;if(e.headMetaAuthorship&&(_(s.attributes.name)===\\\"author\\\"||_(s.attributes.name)===\\\"generator\\\"||_(s.attributes.name)===\\\"framework\\\"||_(s.attributes.name)===\\\"publisher\\\"||_(s.attributes.name)===\\\"progid\\\"||_(s.attributes.property).match(/^article:/)||_(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(_(s.attributes.name)===\\\"google-site-verification\\\"||_(s.attributes.name)===\\\"yandex-verification\\\"||_(s.attributes.name)===\\\"csrf-token\\\"||_(s.attributes.name)===\\\"p:domain_verify\\\"||_(s.attributes.name)===\\\"verify-v1\\\"||_(s.attributes.name)===\\\"verification\\\"||_(s.attributes.name)===\\\"shopify-checkout-api-token\\\"))return!0}}return!1}function Re(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m={},inlineImages:d=!1,recordCanvas:f=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:V=!1,cssCaptured:$=!1}=e,{needsMask:z}=e,{preserveWhiteSpace:H=!0}=e;z||(z=dn(s,o,l,z===void 0));let Q=al(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,dataURLOptions:m,inlineImages:d,recordCanvas:f,keepIframeSrcFn:T,newlyAddedElement:V,cssCaptured:$});if(!Q)return console.warn(s,\\\"not serialized\\\"),null;let ne;r.hasNode(s)?ne=r.getId(s):hl(Q,g)||!H&&Q.type===j.Text&&!Q.textContent.replace(/^\\\\s+|\\\\s+$/gm,\\\"\\\").length?ne=Je:ne=cn();let M=Object.assign(Q,{id:ne});if(r.add(s,M),ne===Je)return null;b&&b(s);let Fe=!a;if(M.type===j.Element){Fe=Fe&&!M.needBlock,delete M.needBlock;let G=Y.shadowRoot(s);G&&Ze(G)&&(M.isShadowHost=!0)}if((M.type===j.Document||M.type===j.Element)&&Fe){g.headWhitespace&&M.type===j.Element&&M.tagName===\\\"head\\\"&&(H=!1);let G={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T,cssCaptured:!1};if(!(M.type===j.Element&&M.tagName===\\\"textarea\\\"&&M.attributes.value!==void 0)){M.type===j.Element&&M.attributes._cssText!==void 0&&typeof M.attributes._cssText==\\\"string\\\"&&(G.cssCaptured=!0);for(let ge of Array.from(Y.childNodes(s))){let oe=Re(ge,G);oe&&M.childNodes.push(oe)}}let q=null;if(an(s)&&(q=Y.shadowRoot(s)))for(let ge of Array.from(Y.childNodes(q))){let oe=Re(ge,G);oe&&(Ze(q)&&(oe.isShadow=!0),M.childNodes.push(oe))}}let Ue=Y.parentNode(s);return Ue&&Ye(Ue)&&Ze(Ue)&&(M.isShadow=!0),M.type===j.Element&&M.tagName===\\\"iframe\\\"&&nl(s,()=>{let G=s.contentDocument;if(G&&S){let q=Re(G,{doc:G,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});q&&S(s,q)}},y),M.type===j.Element&&M.tagName===\\\"link\\\"&&typeof M.attributes.rel==\\\"string\\\"&&(M.attributes.rel===\\\"stylesheet\\\"||M.attributes.rel===\\\"preload\\\"&&typeof M.attributes.href==\\\"string\\\"&&un(M.attributes.href)===\\\"css\\\")&&ol(s,()=>{if(v){let G=Re(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});G&&v(s,G)}},N),M}function fl(s,e){let{mirror:t=new Vt,blockClass:r=\\\"rr-block\\\",blockSelector:i=null,maskTextClass:n=\\\"rr-mask\\\",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N=()=>!1}=e||{},T=c===!0?{color:!0,date:!0,\\\"datetime-local\\\":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,V=pn(g);return Re(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:T,maskTextFn:h,maskInputFn:p,slimDOMOptions:V,dataURLOptions:m,inlineImages:a,recordCanvas:u,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N,newlyAddedElement:!1})}var dl=/(max|min)-device-(width|height)/,ud=new RegExp(dl.source,\\\"g\\\");function pl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,\\\"default\\\")?s.default:s}function ml(s){if(s.__esModule)return s;var e=s.default;if(typeof e==\\\"function\\\"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,\\\"__esModule\\\",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ds={exports:{}},k=String,mn=function(){return{isColorSupported:!1,reset:k,bold:k,dim:k,italic:k,underline:k,inverse:k,hidden:k,strikethrough:k,black:k,red:k,green:k,yellow:k,blue:k,magenta:k,cyan:k,white:k,gray:k,bgBlack:k,bgRed:k,bgGreen:k,bgYellow:k,bgBlue:k,bgMagenta:k,bgCyan:k,bgWhite:k}};Ds.exports=mn();Ds.exports.createColors=mn;var gl=Ds.exports,yl={},wl=Object.freeze(Object.defineProperty({__proto__:null,default:yl},Symbol.toStringTag,{value:\\\"Module\\\"})),se=ml(wl),pi=gl,mi=se,Wr=class gn extends Error{constructor(e,t,r,i,n,o){super(e),this.name=\\\"CssSyntaxError\\\",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<\\\"u\\\"&&typeof r<\\\"u\\\"&&(typeof t==\\\"number\\\"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,gn)}setMessage(){this.message=this.plugin?this.plugin+\\\": \\\":\\\"\\\",this.message+=this.file?this.file:\\\"<css input>\\\",typeof this.line<\\\"u\\\"&&(this.message+=\\\":\\\"+this.line+\\\":\\\"+this.column),this.message+=\\\": \\\"+this.reason}showSourceCode(e){if(!this.source)return\\\"\\\";let t=this.source;e==null&&(e=pi.isColorSupported),mi&&e&&(t=mi(t));let r=t.split(/\\\\r?\\\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=pi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=\\\" \\\"+(\\\" \\\"+h).slice(-o)+\\\" | \\\";if(h===this.line){let g=a(p.replace(/\\\\d/g,\\\" \\\"))+u.slice(0,this.column-1).replace(/[^\\\\t]/g,\\\" \\\");return l(\\\">\\\")+a(p)+u+`\\n `+g+l(\\\"^\\\")}return\\\" \\\"+a(p)+u}).join(`\\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\\n\\n`+e+`\\n`),this.name+\\\": \\\"+this.message+e}},Ts=Wr;Wr.default=Wr;var ot={};ot.isClean=Symbol(\\\"isClean\\\");ot.my=Symbol(\\\"my\\\");var gi={after:`\\n`,beforeClose:`\\n`,beforeComment:`\\n`,beforeDecl:`\\n`,beforeOpen:\\\" \\\",beforeRule:`\\n`,colon:\\\": \\\",commentLeft:\\\" \\\",commentRight:\\\" \\\",emptyBody:\\\"\\\",indent:\\\" \\\",semicolon:!1};function bl(s){return s[0].toUpperCase()+s.slice(1)}var zr=class{constructor(e){this.builder=e}atrule(e,t){let r=\\\"@\\\"+e.name,i=e.params?this.rawValue(e,\\\"params\\\"):\\\"\\\";if(typeof e.raws.afterName<\\\"u\\\"?r+=e.raws.afterName:i&&(r+=\\\" \\\"),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||\\\"\\\")+(t?\\\";\\\":\\\"\\\");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type===\\\"decl\\\"?r=this.raw(e,null,\\\"beforeDecl\\\"):e.type===\\\"comment\\\"?r=this.raw(e,null,\\\"beforeComment\\\"):t===\\\"before\\\"?r=this.raw(e,null,\\\"beforeRule\\\"):r=this.raw(e,null,\\\"beforeClose\\\");let i=e.parent,n=0;for(;i&&i.type!==\\\"root\\\";)n+=1,i=i.parent;if(r.includes(`\\n`)){let o=this.raw(e,null,\\\"indent\\\");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,\\\"between\\\",\\\"beforeOpen\\\");this.builder(t+r+\\\"{\\\",e,\\\"start\\\");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,\\\"after\\\")):i=this.raw(e,\\\"after\\\",\\\"emptyBody\\\"),i&&this.builder(i),this.builder(\\\"}\\\",e,\\\"end\\\")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type===\\\"comment\\\";)t-=1;let r=this.raw(e,\\\"semicolon\\\");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,\\\"before\\\");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,\\\"left\\\",\\\"commentLeft\\\"),r=this.raw(e,\\\"right\\\",\\\"commentRight\\\");this.builder(\\\"/*\\\"+t+e.text+r+\\\"*/\\\",e)}decl(e,t){let r=this.raw(e,\\\"between\\\",\\\"colon\\\"),i=e.prop+r+this.rawValue(e,\\\"value\\\");e.important&&(i+=e.raws.important||\\\" !important\\\"),t&&(i+=\\\";\\\"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<\\\"u\\\"))return i;let n=e.parent;if(r===\\\"before\\\"&&(!n||n.type===\\\"root\\\"&&n.first===e||n&&n.type===\\\"document\\\"))return\\\"\\\";if(!n)return gi[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<\\\"u\\\")return o.rawCache[r];if(r===\\\"before\\\"||r===\\\"after\\\")return this.beforeAfter(e,r);{let l=\\\"raw\\\"+bl(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<\\\"u\\\")return!1})}return typeof i>\\\"u\\\"&&(i=gi[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<\\\"u\\\")return t=r.raws.after,t.includes(`\\n`)&&(t=t.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),t&&(t=t.replace(/\\\\S/g,\\\"\\\")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<\\\"u\\\")return r=i.raws.before,r.includes(`\\n`)&&(r=r.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),typeof r>\\\"u\\\"?r=this.raw(t,null,\\\"beforeDecl\\\"):r&&(r=r.replace(/\\\\S/g,\\\"\\\")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<\\\"u\\\")return r=i.raws.before,r.includes(`\\n`)&&(r=r.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),typeof r>\\\"u\\\"?r=this.raw(t,null,\\\"beforeRule\\\"):r&&(r=r.replace(/\\\\S/g,\\\"\\\")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!==\\\"decl\\\"&&(t=r.raws.between,typeof t<\\\"u\\\"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<\\\"u\\\")return t=r.raws.before,t.includes(`\\n`)&&(t=t.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),t&&(t=t.replace(/\\\\S/g,\\\"\\\")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<\\\"u\\\")return t=r.raws.between.replace(/[^\\\\s:]/g,\\\"\\\"),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<\\\"u\\\"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<\\\"u\\\"){let n=r.raws.before.split(`\\n`);return t=n[n.length-1],t=t.replace(/\\\\S/g,\\\"\\\"),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type===\\\"decl\\\"&&(t=r.raws.semicolon,typeof t<\\\"u\\\"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,\\\"selector\\\")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,\\\"end\\\")}stringify(e,t){if(!this[e.type])throw new Error(\\\"Unknown AST node type \\\"+e.type+\\\". Maybe you need to change PostCSS stringifier.\\\");this[e.type](e,t)}},yn=zr;zr.default=zr;var Sl=yn;function Vr(s,e){new Sl(e).stringify(s)}var or=Vr;Vr.default=Vr;var{isClean:gt,my:vl}=ot,Cl=Ts,El=yn,Il=or;function Gr(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r===\\\"proxyCache\\\")continue;let i=s[r],n=typeof i;r===\\\"parent\\\"&&n===\\\"object\\\"?e&&(t[r]=e):r===\\\"source\\\"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Gr(o,t)):(n===\\\"object\\\"&&i!==null&&(i=Gr(i)),t[r]=i)}return t}var jr=class{constructor(e={}){this.raws={},this[gt]=!1,this[vl]=!0;for(let t in e)if(t===\\\"nodes\\\"){this.nodes=[];for(let r of e[t])typeof r.clone==\\\"function\\\"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\\\n\\\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\\\n\\\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Gr(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Cl(e)}getProxyProcessor(){return{get(e,t){return t===\\\"proxyOf\\\"?e:t===\\\"root\\\"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t===\\\"prop\\\"||t===\\\"value\\\"||t===\\\"name\\\"||t===\\\"params\\\"||t===\\\"important\\\"||t===\\\"text\\\")&&e.markDirty()),!0}}}markDirty(){if(this[gt]){this[gt]=!1;let e=this;for(;e=e.parent;)e[gt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex==\\\"number\\\"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new El().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!==\\\"document\\\";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o===\\\"parent\\\"||o===\\\"proxyCache\\\")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a==\\\"object\\\"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l==\\\"object\\\"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o===\\\"source\\\"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Il){e.stringify&&(e=e.stringify);let t=\\\"\\\";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},ar=jr;jr.default=jr;var xl=ar,Hr=class extends xl{constructor(e){e&&typeof e.value<\\\"u\\\"&&typeof e.value!=\\\"string\\\"&&(e={...e,value:String(e.value)}),super(e),this.type=\\\"decl\\\"}get variable(){return this.prop.startsWith(\\\"--\\\")||this.prop[0]===\\\"$\\\"}},lr=Hr;Hr.default=Hr;var Ml=\\\"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\\\",Nl=(s,e=21)=>(t=e)=>{let r=\\\"\\\",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},Rl=(s=21)=>{let e=\\\"\\\",t=s;for(;t--;)e+=Ml[Math.random()*64|0];return e},Al={nanoid:Rl,customAlphabet:Nl},{SourceMapConsumer:yi,SourceMapGenerator:wi}=se,{existsSync:Ol,readFileSync:Dl}=se,{dirname:Rr,join:Tl}=se;function _l(s){return Buffer?Buffer.from(s,\\\"base64\\\").toString():window.atob(s)}var Yr=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,\\\"data:\\\");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Rr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new yi(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\\\/json;charset=utf-?8;base64,/,r=/^data:application\\\\/json;base64,/,i=/^data:application\\\\/json;charset=utf-?8,/,n=/^data:application\\\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return _l(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\\\/json;([^,]+),/)[1];throw new Error(\\\"Unsupported source map encoding \\\"+o)}getAnnotationURL(e){return e.replace(/^\\\\/\\\\*\\\\s*# sourceMappingURL=/,\\\"\\\").trim()}isMap(e){return typeof e!=\\\"object\\\"?!1:typeof e.mappings==\\\"string\\\"||typeof e._mappings==\\\"string\\\"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\\\/\\\\*\\\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf(\\\"*/\\\",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Rr(e),Ol(e))return this.mapFile=e,Dl(e,\\\"utf-8\\\").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t==\\\"string\\\")return t;if(typeof t==\\\"function\\\"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error(\\\"Unable to load previous source map: \\\"+r.toString());return i}}else{if(t instanceof yi)return wi.fromSourceMap(t).toString();if(t instanceof wi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error(\\\"Unsupported previous source map format: \\\"+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Tl(Rr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},wn=Yr;Yr.default=Yr;var{SourceMapConsumer:kl,SourceMapGenerator:Pl}=se,{fileURLToPath:bi,pathToFileURL:yt}=se,{isAbsolute:Zr,resolve:Xr}=se,{nanoid:$l}=Al,Ar=se,Si=Ts,Ll=wn,Or=Symbol(\\\"fromOffsetCache\\\"),Fl=!!(kl&&Pl),vi=!!(Xr&&Zr),Zt=class{constructor(e,t={}){if(e===null||typeof e>\\\"u\\\"||typeof e==\\\"object\\\"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]===\\\"\\\\uFEFF\\\"||this.css[0]===\\\"\\\\uFFFE\\\"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!vi||/^\\\\w+:\\\\/\\\\//.test(t.from)||Zr(t.from)?this.file=t.from:this.file=Xr(t.from)),vi&&Fl){let r=new Ll(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id=\\\"<input css \\\"+$l(6)+\\\">\\\"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t==\\\"object\\\"){let u=t,c=r;if(typeof u.offset==\\\"number\\\"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset==\\\"number\\\"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new Si(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new Si(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(yt&&(n.input.url=yt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[Or])r=this[Or];else{let n=this.css.split(`\\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[Or]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\\\w+:\\\\/\\\\//.test(e)?e:Xr(this.map.consumer().sourceRoot||this.map.root||\\\".\\\",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r==\\\"number\\\"&&(l=n.originalPositionFor({column:i,line:r}));let a;Zr(o.source)?a=yt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||yt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol===\\\"file:\\\")if(bi)u.file=bi(a);else throw new Error(\\\"file: protocol is not available in this PostCSS build\\\");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of[\\\"hasBOM\\\",\\\"css\\\",\\\"file\\\",\\\"id\\\"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},ur=Zt;Zt.default=Zt;Ar&&Ar.registerInput&&Ar.registerInput(Zt);var{SourceMapConsumer:bn,SourceMapGenerator:Lt}=se,{dirname:Ft,relative:Sn,resolve:vn,sep:Cn}=se,{pathToFileURL:Ci}=se,Ul=ur,Bl=!!(bn&&Lt),Wl=!!(Ft&&vn&&Sn&&Cn),zl=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e=\\\"data:application/json;base64,\\\"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==\\\"string\\\"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation==\\\"function\\\"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+\\\".map\\\";let t=`\\n`;this.css.includes(`\\\\r\\n`)&&(t=`\\\\r\\n`),this.css+=t+\\\"/*# sourceMappingURL=\\\"+e+\\\" */\\\"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Ft(e.file),i;this.mapOpts.sourcesContent===!1?(i=new bn(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type===\\\"comment\\\"&&e.text.indexOf(\\\"# sourceMappingURL=\\\")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\\\n*?\\\\/\\\\*#[\\\\S\\\\s]*?\\\\*\\\\/$/gm,\\\"\\\"))}generate(){if(this.clearAnnotation(),Wl&&Bl&&this.isMap())return this.generateMap();{let e=\\\"\\\";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Lt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):\\\"<no source>\\\"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css=\\\"\\\",this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r=\\\"<no source>\\\",i={generated:{column:0,line:0},original:{column:0,line:0},source:\\\"\\\"},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!==\\\"end\\\"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\\n`),t=l.length-o):t+=l.length,a&&u!==\\\"start\\\"){let c=a.parent||{raws:{}};(!(a.type===\\\"decl\\\"||a.type===\\\"atrule\\\"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<\\\"u\\\"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<\\\"u\\\")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<\\\"u\\\"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<\\\"u\\\"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<\\\"u\\\"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):\\\"to.css\\\"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\\\w+:\\\\/\\\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Ft(this.opts.to):\\\".\\\";typeof this.mapOpts.annotation==\\\"string\\\"&&(r=Ft(vn(r,this.mapOpts.annotation)));let i=Sn(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ul(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):\\\"<no source>\\\";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString(\\\"base64\\\"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Ci){let r=Ci(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error(\\\"`map.absolute` option is not available in this PostCSS build\\\")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Cn===\\\"\\\\\\\\\\\"&&(e=e.replace(/\\\\\\\\/g,\\\"/\\\"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},En=zl,Vl=ar,Jr=class extends Vl{constructor(e){super(e),this.type=\\\"comment\\\"}},cr=Jr;Jr.default=Jr;var{isClean:In,my:xn}=ot,Mn=lr,Nn=cr,Gl=ar,Rn,_s,ks,An;function On(s){return s.map(e=>(e.nodes&&(e.nodes=On(e.nodes)),delete e.source,e))}function Dn(s){if(s[In]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Dn(e)}var ce=class Tn extends Gl{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t===\\\"proxyOf\\\"?e:e[t]?t===\\\"each\\\"||typeof t==\\\"string\\\"&&t.startsWith(\\\"walk\\\")?(...r)=>e[t](...r.map(i=>typeof i==\\\"function\\\"?(n,o)=>i(n.toProxy(),o):i)):t===\\\"every\\\"||t===\\\"some\\\"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t===\\\"root\\\"?()=>e.root().toProxy():t===\\\"nodes\\\"?e.nodes.map(r=>r.toProxy()):t===\\\"first\\\"||t===\\\"last\\\"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t===\\\"name\\\"||t===\\\"params\\\"||t===\\\"selector\\\")&&e.markDirty()),!0}}}index(e){return typeof e==\\\"number\\\"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?\\\"prepend\\\":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e==\\\"string\\\")e=On(Rn(e).nodes);else if(typeof e>\\\"u\\\")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,\\\"ignore\\\")}else if(e.type===\\\"root\\\"&&this.type!==\\\"document\\\"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,\\\"ignore\\\")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>\\\"u\\\")throw new Error(\\\"Value field is missed in node creation\\\");typeof e.value!=\\\"string\\\"&&(e.value=String(e.value)),e=[new Mn(e)]}else if(e.selector)e=[new _s(e)];else if(e.name)e=[new ks(e)];else if(e.text)e=[new Nn(e)];else throw new Error(\\\"Unknown node type in node creation\\\");return e.map(i=>(i[xn]||Tn.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[In]&&Dn(i),typeof i.raws.before>\\\"u\\\"&&t&&typeof t.raws.before<\\\"u\\\"&&(i.raws.before=t.raws.before.replace(/\\\\S/g,\\\"\\\")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,\\\"prepend\\\").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"atrule\\\"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"atrule\\\"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"atrule\\\")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type===\\\"comment\\\")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"decl\\\"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"decl\\\"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"decl\\\")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"rule\\\"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"rule\\\"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"rule\\\")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};ce.registerParse=s=>{Rn=s};ce.registerRule=s=>{_s=s};ce.registerAtRule=s=>{ks=s};ce.registerRoot=s=>{An=s};var ve=ce;ce.default=ce;ce.rebuild=s=>{s.type===\\\"atrule\\\"?Object.setPrototypeOf(s,ks.prototype):s.type===\\\"rule\\\"?Object.setPrototypeOf(s,_s.prototype):s.type===\\\"decl\\\"?Object.setPrototypeOf(s,Mn.prototype):s.type===\\\"comment\\\"?Object.setPrototypeOf(s,Nn.prototype):s.type===\\\"root\\\"&&Object.setPrototypeOf(s,An.prototype),s[xn]=!0,s.nodes&&s.nodes.forEach(e=>{ce.rebuild(e)})};var jl=ve,_n,kn,Ke=class extends jl{constructor(e){super({type:\\\"document\\\",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new _n(new kn,this,e).stringify()}};Ke.registerLazyResult=s=>{_n=s};Ke.registerProcessor=s=>{kn=s};var Ps=Ke;Ke.default=Ke;var Kr=class{constructor(e,t={}){if(this.type=\\\"warning\\\",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+\\\": \\\"+this.text:this.text}},Pn=Kr;Kr.default=Kr;var Hl=Pn,Qr=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Hl(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type===\\\"warning\\\")}get content(){return this.css}},$s=Qr;Qr.default=Qr;var Dr=39,Ei=34,wt=92,Ii=47,bt=10,ze=32,St=12,vt=9,Ct=13,Yl=91,Zl=93,Xl=40,Jl=41,Kl=123,Ql=125,ql=59,eu=42,tu=58,ru=64,Et=/[\\\\t\\\\n\\\\f\\\\r \\\"#'()/;[\\\\\\\\\\\\]{}]/g,It=/[\\\\t\\\\n\\\\f\\\\r !\\\"#'():;@[\\\\\\\\\\\\]{}]|\\\\/(?=\\\\*)/g,su=/.[\\\\r\\\\n\\\"'(/\\\\\\\\]/,xi=/[\\\\da-f]/i,iu=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error(\\\"Unclosed \\\"+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case bt:case ze:case vt:case Ct:case St:{o=f;do o+=1,n=r.charCodeAt(o);while(n===ze||n===bt||n===vt||n===Ct||n===St);m=[\\\"space\\\",r.slice(f,o)],f=o-1;break}case Yl:case Zl:case Kl:case Ql:case tu:case ql:case Jl:{let H=String.fromCharCode(n);m=[H,H,f];break}case Xl:{if(p=b.length?b.pop()[1]:\\\"\\\",g=r.charCodeAt(f+1),p===\\\"url\\\"&&g!==Dr&&g!==Ei&&g!==ze&&g!==bt&&g!==vt&&g!==St&&g!==Ct){o=f;do{if(c=!1,o=r.indexOf(\\\")\\\",o+1),o===-1)if(i||z){o=f;break}else v(\\\"bracket\\\");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=[\\\"brackets\\\",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(\\\")\\\",f+1),a=r.slice(f,o+1),o===-1||su.test(a)?m=[\\\"(\\\",\\\"(\\\",f]:(m=[\\\"brackets\\\",a,f,o],f=o);break}case Dr:case Ei:{l=n===Dr?\\\"'\\\":'\\\"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v(\\\"string\\\");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=[\\\"string\\\",r.slice(f,o+1),f,o],f=o;break}case ru:{Et.lastIndex=f+1,Et.test(r),Et.lastIndex===0?o=r.length-1:o=Et.lastIndex-2,m=[\\\"at-word\\\",r.slice(f,o+1),f,o],f=o;break}case wt:{for(o=f,u=!0;r.charCodeAt(o+1)===wt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Ii&&n!==ze&&n!==bt&&n!==vt&&n!==Ct&&n!==St&&(o+=1,xi.test(r.charAt(o)))){for(;xi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===ze&&(o+=1)}m=[\\\"word\\\",r.slice(f,o+1),f,o],f=o;break}default:{n===Ii&&r.charCodeAt(f+1)===eu?(o=r.indexOf(\\\"*/\\\",f+2)+1,o===0&&(i||z?o=r.length:v(\\\"comment\\\")),m=[\\\"comment\\\",r.slice(f,o+1),f,o],f=o):(It.lastIndex=f+1,It.test(r),It.lastIndex===0?o=r.length-1:o=It.lastIndex-2,m=[\\\"word\\\",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},$n=ve,Xt=class extends $n{constructor(e){super(e),this.type=\\\"atrule\\\"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ls=Xt;Xt.default=Xt;$n.registerAtRule(Xt);var Ln=ve,Fn,Un,Oe=class extends Ln{constructor(e){super(e),this.type=\\\"root\\\",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r===\\\"prepend\\\")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Fn(new Un,this,e).stringify()}};Oe.registerLazyResult=s=>{Fn=s};Oe.registerProcessor=s=>{Un=s};var at=Oe;Oe.default=Oe;Ln.registerRoot(Oe);var Qe={comma(s){return Qe.split(s,[\\\",\\\"],!0)},space(s){let e=[\\\" \\\",`\\n`,\\\"\\t\\\"];return Qe.split(s,e)},split(s,e,t){let r=[],i=\\\"\\\",n=!1,o=0,l=!1,a=\\\"\\\",u=!1;for(let c of s)u?u=!1:c===\\\"\\\\\\\\\\\"?u=!0:l?c===a&&(l=!1):c==='\\\"'||c===\\\"'\\\"?(l=!0,a=c):c===\\\"(\\\"?o+=1:c===\\\")\\\"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==\\\"\\\"&&r.push(i.trim()),i=\\\"\\\",n=!1):i+=c;return(t||i!==\\\"\\\")&&r.push(i.trim()),r}},Bn=Qe;Qe.default=Qe;var Wn=ve,nu=Bn,Jt=class extends Wn{constructor(e){super(e),this.type=\\\"rule\\\",this.nodes||(this.nodes=[])}get selectors(){return nu.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\\\s*/):null,r=t?t[0]:\\\",\\\"+this.raw(\\\"between\\\",\\\"beforeOpen\\\");this.selector=e.join(r)}},Fs=Jt;Jt.default=Jt;Wn.registerRule(Jt);var ou=lr,au=iu,lu=cr,uu=Ls,cu=at,Mi=Fs,Ni={empty:!0,space:!0};function hu(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var fu=class{constructor(e){this.input=e,this.root=new cu,this.current=this.root,this.spaces=\\\"\\\",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new uu;t.name=e[1].slice(1),t.name===\\\"\\\"&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r===\\\"(\\\"||r===\\\"[\\\"?u.push(r===\\\"(\\\"?\\\")\\\":\\\"]\\\"):r===\\\"{\\\"&&u.length>0?u.push(\\\"}\\\"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===\\\";\\\"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r===\\\"{\\\"){l=!0;break}else if(r===\\\"}\\\"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]===\\\"space\\\";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,\\\"params\\\",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between=\\\"\\\")):(t.raws.afterName=\\\"\\\",t.params=\\\"\\\"),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!==\\\"space\\\"&&(r+=1,r===2)));n--);throw this.input.error(\\\"Missed semicolon\\\",i[0]===\\\"word\\\"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i===\\\"(\\\"&&(t+=1),i===\\\")\\\"&&(t-=1),t===0&&i===\\\":\\\")if(!n)this.doubleColon(r);else{if(n[0]===\\\"word\\\"&&n[1]===\\\"progid\\\")continue;return o}n=r}return!1}comment(e){let t=new lu;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\\\s*$/.test(r))t.text=\\\"\\\",t.raws.left=r,t.raws.right=\\\"\\\";else{let i=r.match(/^(\\\\s*)([^]*\\\\S)(\\\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=au(this.input)}decl(e,t){let r=new ou;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===\\\";\\\"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||hu(e)),r.source.end.offset++;e[0][0]!==\\\"word\\\";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop=\\\"\\\";e.length;){let u=e[0][0];if(u===\\\":\\\"||u===\\\"space\\\"||u===\\\"comment\\\")break;r.prop+=e.shift()[1]}r.raws.between=\\\"\\\";let n;for(;e.length;)if(n=e.shift(),n[0]===\\\":\\\"){r.raws.between+=n[1];break}else n[0]===\\\"word\\\"&&/\\\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]===\\\"_\\\"||r.prop[0]===\\\"*\\\")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!==\\\"space\\\"&&l!==\\\"comment\\\"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()===\\\"!important\\\"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==\\\" !important\\\"&&(r.raws.important=c);break}else if(n[1].toLowerCase()===\\\"important\\\"){let c=e.slice(0),h=\\\"\\\";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf(\\\"!\\\")===0&&g!==\\\"space\\\")break;h=c.pop()[1]+h}h.trim().indexOf(\\\"!\\\")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!==\\\"space\\\"&&n[0]!==\\\"comment\\\")break}e.some(u=>u[0]!==\\\"space\\\"&&u[0]!==\\\"comment\\\")&&(r.raws.between+=o.map(u=>u[1]).join(\\\"\\\"),o=[]),this.raw(r,\\\"value\\\",o.concat(e),t),r.value.includes(\\\":\\\")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error(\\\"Double colon\\\",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Mi;this.init(t,e[2]),t.selector=\\\"\\\",t.raws.between=\\\"\\\",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||\\\"\\\")+this.spaces,this.spaces=\\\"\\\",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||\\\"\\\")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type===\\\"rule\\\"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces=\\\"\\\")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces=\\\"\\\",e.type!==\\\"comment\\\"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith(\\\"--\\\"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r===\\\"(\\\"||r===\\\"[\\\")n||(n=u),o.push(r===\\\"(\\\"?\\\")\\\":\\\"]\\\");else if(l&&i&&r===\\\"{\\\")n||(n=u),o.push(\\\"}\\\");else if(o.length===0)if(r===\\\";\\\")if(i){this.decl(a,l);return}else break;else if(r===\\\"{\\\"){this.rule(a);return}else if(r===\\\"}\\\"){this.tokenizer.back(a.pop()),t=!0;break}else r===\\\":\\\"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!==\\\"space\\\"&&u!==\\\"comment\\\"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case\\\"space\\\":this.spaces+=e[1];break;case\\\";\\\":this.freeSemicolon(e);break;case\\\"}\\\":this.end(e);break;case\\\"comment\\\":this.comment(e);break;case\\\"at-word\\\":this.atrule(e);break;case\\\"{\\\":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a=\\\"\\\",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o===\\\"space\\\"&&p===l-1&&!i?u=!1:o===\\\"comment\\\"?(h=r[p-1]?r[p-1][0]:\\\"empty\\\",c=r[p+1]?r[p+1][0]:\\\"empty\\\",!Ni[h]&&!Ni[c]?a.slice(-1)===\\\",\\\"?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],\\\"\\\");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new Mi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,\\\"selector\\\",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r=\\\"\\\";for(;e.length&&(t=e[e.length-1][0],!(t!==\\\"space\\\"&&t!==\\\"comment\\\"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r=\\\"\\\";for(;e.length&&(t=e[0][0],!(t!==\\\"space\\\"&&t!==\\\"comment\\\"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r=\\\"\\\";for(;e.length&&(t=e[e.length-1][0],t===\\\"space\\\");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r=\\\"\\\";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error(\\\"Unclosed block\\\",e.line,e.column)}unclosedBracket(e){throw this.input.error(\\\"Unclosed bracket\\\",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error(\\\"Unexpected }\\\",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error(\\\"Unknown word\\\",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error(\\\"At-rule without name\\\",{offset:t[2]},{offset:t[2]+t[1].length})}},du=fu,pu=ve,mu=du,gu=ur;function Kt(s,e){let t=new gu(s,e),r=new mu(t);try{r.parse()}catch(i){throw i}return r.root}var Us=Kt;Kt.default=Kt;pu.registerParse(Kt);var{isClean:ae,my:yu}=ot,wu=En,bu=or,Su=ve,vu=Ps;var Ri=$s,Cu=Us,Eu=at,Iu={atrule:\\\"AtRule\\\",comment:\\\"Comment\\\",decl:\\\"Declaration\\\",document:\\\"Document\\\",root:\\\"Root\\\",rule:\\\"Rule\\\"},xu={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Mu={Once:!0,postcssPlugin:!0,prepare:!0},De=0;function Ve(s){return typeof s==\\\"object\\\"&&typeof s.then==\\\"function\\\"}function zn(s){let e=!1,t=Iu[s.type];return s.type===\\\"decl\\\"?e=s.prop.toLowerCase():s.type===\\\"atrule\\\"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+\\\"-\\\"+e,De,t+\\\"Exit\\\",t+\\\"Exit-\\\"+e]:e?[t,t+\\\"-\\\"+e,t+\\\"Exit\\\",t+\\\"Exit-\\\"+e]:s.append?[t,De,t+\\\"Exit\\\"]:[t,t+\\\"Exit\\\"]}function Ai(s){let e;return s.type===\\\"document\\\"?e=[\\\"Document\\\",De,\\\"DocumentExit\\\"]:s.type===\\\"root\\\"?e=[\\\"Root\\\",De,\\\"RootExit\\\"]:e=zn(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function qr(s){return s[ae]=!1,s.nodes&&s.nodes.forEach(e=>qr(e)),s}var es={},Te=class Vn{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t==\\\"object\\\"&&t!==null&&(t.type===\\\"root\\\"||t.type===\\\"document\\\"))i=qr(t);else if(t instanceof Vn||t instanceof Ri)i=qr(t.root),t.map&&(typeof r.map>\\\"u\\\"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Cu;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[yu]&&Su.rebuild(i)}this.result=new Ri(e,i,r),this.helpers={...es,postcss:es,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n==\\\"object\\\"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error(\\\"Use process(css).then(cb) to work with async plugins\\\")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name===\\\"CssSyntaxError\\\"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t==\\\"object\\\")for(let r in t){if(!xu[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Mu[r])if(typeof t[r]==\\\"object\\\")for(let i in t[r])i===\\\"*\\\"?e(t,r,t[r][i]):e(t,r+\\\"-\\\"+i.toLowerCase(),t[r][i]);else typeof t[r]==\\\"function\\\"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(Ve(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];){e[ae]=!0;let t=[Ai(e)];for(;t.length>0;){let r=this.visitTick(t);if(Ve(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type===\\\"document\\\"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e==\\\"object\\\"&&e.Once){if(this.result.root.type===\\\"document\\\"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return Ve(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e==\\\"function\\\")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=bu;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new wu(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(Ve(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];)e[ae]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type===\\\"document\\\")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!==\\\"root\\\"&&t.type!==\\\"document\\\"&&!t.parent)return!0;if(Ve(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!==\\\"root\\\"&&r.type!==\\\"document\\\"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[ae]){l[ae]=!0,e.push(Ai(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===De){r.nodes&&r.nodes.length&&(r[ae]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[ae]=!0;let t=zn(e);for(let r of t)if(r===De)e.nodes&&e.each(i=>{i[ae]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return\\\"LazyResult\\\"}};Te.registerPostcss=s=>{es=s};var Gn=Te;Te.default=Te;Eu.registerLazyResult(Te);vu.registerLazyResult(Te);var Nu=En,Ru=or;var Au=Us,Ou=$s,ts=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=Ru;this.result=new Ou(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,\\\"root\\\",{get(){return o.root}});let l=new Nu(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Au;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return\\\"NoWorkResult\\\"}},Du=ts;ts.default=ts;var Tu=Du,_u=Gn,ku=Ps,Pu=at,qe=class{constructor(e=[]){this.version=\\\"8.4.38\\\",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r==\\\"object\\\"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r==\\\"object\\\"&&r.postcssPlugin)t.push(r);else if(typeof r==\\\"function\\\")t.push(r);else if(!(typeof r==\\\"object\\\"&&(r.parse||r.stringify)))throw new Error(r+\\\" is not a PostCSS plugin\\\");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Tu(this,e,t):new _u(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},$u=qe;qe.default=qe;Pu.registerProcessor(qe);ku.registerProcessor(qe);var Lu=lr,Fu=wn,Uu=cr,Bu=Ls,Wu=ur,zu=at,Vu=Fs;function et(s,e){if(Array.isArray(s))return s.map(i=>et(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Wu.prototype};n.map&&(n.map={...n.map,__proto__:Fu.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>et(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type===\\\"root\\\")return new zu(r);if(r.type===\\\"decl\\\")return new Lu(r);if(r.type===\\\"rule\\\")return new Vu(r);if(r.type===\\\"comment\\\")return new Uu(r);if(r.type===\\\"atrule\\\")return new Bu(r);throw new Error(\\\"Unknown node type: \\\"+s.type)}var Gu=et;et.default=et;var ju=Ts,jn=lr,Hu=Gn,Yu=ve,Bs=$u,Zu=or,Xu=Gu,Hn=Ps,Ju=Pn,Yn=cr,Zn=Ls,Ku=$s,Qu=ur,qu=Us,ec=Bn,Xn=Fs,Jn=at,tc=ar;function A(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Bs(s)}A.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith(\\\"cn\\\")&&console.warn(e+`: \\\\u91CC\\\\u9762 postcss.plugin \\\\u88AB\\\\u5F03\\\\u7528. \\\\u8FC1\\\\u79FB\\\\u6307\\\\u5357:\\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Bs().version,l}let n;return Object.defineProperty(i,\\\"postcss\\\",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return A([i(a)]).process(o,l)},i};A.stringify=Zu;A.parse=qu;A.fromJSON=Xu;A.list=ec;A.comment=s=>new Yn(s);A.atRule=s=>new Zn(s);A.decl=s=>new jn(s);A.rule=s=>new Xn(s);A.root=s=>new Jn(s);A.document=s=>new Hn(s);A.CssSyntaxError=ju;A.Declaration=jn;A.Container=Yu;A.Processor=Bs;A.Document=Hn;A.Comment=Yn;A.Warning=Ju;A.AtRule=Zn;A.Result=Ku;A.Input=Qu;A.Rule=Xn;A.Root=Jn;A.Node=tc;Hu.registerPostcss(A);var rc=A;A.default=A;var L=pl(rc);L.stringify;L.fromJSON;L.plugin;L.parse;L.list;L.document;L.comment;L.atRule;L.rule;L.decl;L.root;L.CssSyntaxError;L.Declaration;L.Container;L.Processor;L.Document;L.Comment;L.Warning;L.AtRule;L.Result;L.Input;L.Rule;L.Root;L.Node;var sc=Object.defineProperty,ic=(s,e,t)=>e in s?sc(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ee=(s,e,t)=>ic(s,typeof e!=\\\"symbol\\\"?e+\\\"\\\":e,t);function nc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,\\\"default\\\")?s.default:s}function oc(s){if(s.__esModule)return s;var e=s.default;if(typeof e==\\\"function\\\"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,\\\"__esModule\\\",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ws={exports:{}},P=String,Kn=function(){return{isColorSupported:!1,reset:P,bold:P,dim:P,italic:P,underline:P,inverse:P,hidden:P,strikethrough:P,black:P,red:P,green:P,yellow:P,blue:P,magenta:P,cyan:P,white:P,gray:P,bgBlack:P,bgRed:P,bgGreen:P,bgYellow:P,bgBlue:P,bgMagenta:P,bgCyan:P,bgWhite:P}};Ws.exports=Kn();Ws.exports.createColors=Kn;var ac=Ws.exports,lc={},uc=Object.freeze(Object.defineProperty({__proto__:null,default:lc},Symbol.toStringTag,{value:\\\"Module\\\"})),ie=oc(uc),Oi=ac,Di=ie,rs=class Qn extends Error{constructor(e,t,r,i,n,o){super(e),this.name=\\\"CssSyntaxError\\\",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<\\\"u\\\"&&typeof r<\\\"u\\\"&&(typeof t==\\\"number\\\"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}setMessage(){this.message=this.plugin?this.plugin+\\\": \\\":\\\"\\\",this.message+=this.file?this.file:\\\"<css input>\\\",typeof this.line<\\\"u\\\"&&(this.message+=\\\":\\\"+this.line+\\\":\\\"+this.column),this.message+=\\\": \\\"+this.reason}showSourceCode(e){if(!this.source)return\\\"\\\";let t=this.source;e==null&&(e=Oi.isColorSupported),Di&&e&&(t=Di(t));let r=t.split(/\\\\r?\\\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=Oi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=\\\" \\\"+(\\\" \\\"+h).slice(-o)+\\\" | \\\";if(h===this.line){let g=a(p.replace(/\\\\d/g,\\\" \\\"))+u.slice(0,this.column-1).replace(/[^\\\\t]/g,\\\" \\\");return l(\\\">\\\")+a(p)+u+`\\n `+g+l(\\\"^\\\")}return\\\" \\\"+a(p)+u}).join(`\\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\\n\\n`+e+`\\n`),this.name+\\\": \\\"+this.message+e}},zs=rs;rs.default=rs;var lt={};lt.isClean=Symbol(\\\"isClean\\\");lt.my=Symbol(\\\"my\\\");var Ti={after:`\\n`,beforeClose:`\\n`,beforeComment:`\\n`,beforeDecl:`\\n`,beforeOpen:\\\" \\\",beforeRule:`\\n`,colon:\\\": \\\",commentLeft:\\\" \\\",commentRight:\\\" \\\",emptyBody:\\\"\\\",indent:\\\" \\\",semicolon:!1};function cc(s){return s[0].toUpperCase()+s.slice(1)}var ss=class{constructor(e){this.builder=e}atrule(e,t){let r=\\\"@\\\"+e.name,i=e.params?this.rawValue(e,\\\"params\\\"):\\\"\\\";if(typeof e.raws.afterName<\\\"u\\\"?r+=e.raws.afterName:i&&(r+=\\\" \\\"),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||\\\"\\\")+(t?\\\";\\\":\\\"\\\");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type===\\\"decl\\\"?r=this.raw(e,null,\\\"beforeDecl\\\"):e.type===\\\"comment\\\"?r=this.raw(e,null,\\\"beforeComment\\\"):t===\\\"before\\\"?r=this.raw(e,null,\\\"beforeRule\\\"):r=this.raw(e,null,\\\"beforeClose\\\");let i=e.parent,n=0;for(;i&&i.type!==\\\"root\\\";)n+=1,i=i.parent;if(r.includes(`\\n`)){let o=this.raw(e,null,\\\"indent\\\");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,\\\"between\\\",\\\"beforeOpen\\\");this.builder(t+r+\\\"{\\\",e,\\\"start\\\");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,\\\"after\\\")):i=this.raw(e,\\\"after\\\",\\\"emptyBody\\\"),i&&this.builder(i),this.builder(\\\"}\\\",e,\\\"end\\\")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type===\\\"comment\\\";)t-=1;let r=this.raw(e,\\\"semicolon\\\");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,\\\"before\\\");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,\\\"left\\\",\\\"commentLeft\\\"),r=this.raw(e,\\\"right\\\",\\\"commentRight\\\");this.builder(\\\"/*\\\"+t+e.text+r+\\\"*/\\\",e)}decl(e,t){let r=this.raw(e,\\\"between\\\",\\\"colon\\\"),i=e.prop+r+this.rawValue(e,\\\"value\\\");e.important&&(i+=e.raws.important||\\\" !important\\\"),t&&(i+=\\\";\\\"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<\\\"u\\\"))return i;let n=e.parent;if(r===\\\"before\\\"&&(!n||n.type===\\\"root\\\"&&n.first===e||n&&n.type===\\\"document\\\"))return\\\"\\\";if(!n)return Ti[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<\\\"u\\\")return o.rawCache[r];if(r===\\\"before\\\"||r===\\\"after\\\")return this.beforeAfter(e,r);{let l=\\\"raw\\\"+cc(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<\\\"u\\\")return!1})}return typeof i>\\\"u\\\"&&(i=Ti[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<\\\"u\\\")return t=r.raws.after,t.includes(`\\n`)&&(t=t.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),t&&(t=t.replace(/\\\\S/g,\\\"\\\")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<\\\"u\\\")return r=i.raws.before,r.includes(`\\n`)&&(r=r.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),typeof r>\\\"u\\\"?r=this.raw(t,null,\\\"beforeDecl\\\"):r&&(r=r.replace(/\\\\S/g,\\\"\\\")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<\\\"u\\\")return r=i.raws.before,r.includes(`\\n`)&&(r=r.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),typeof r>\\\"u\\\"?r=this.raw(t,null,\\\"beforeRule\\\"):r&&(r=r.replace(/\\\\S/g,\\\"\\\")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!==\\\"decl\\\"&&(t=r.raws.between,typeof t<\\\"u\\\"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<\\\"u\\\")return t=r.raws.before,t.includes(`\\n`)&&(t=t.replace(/[^\\\\n]+$/,\\\"\\\")),!1}),t&&(t=t.replace(/\\\\S/g,\\\"\\\")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<\\\"u\\\")return t=r.raws.between.replace(/[^\\\\s:]/g,\\\"\\\"),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<\\\"u\\\"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<\\\"u\\\"){let n=r.raws.before.split(`\\n`);return t=n[n.length-1],t=t.replace(/\\\\S/g,\\\"\\\"),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type===\\\"decl\\\"&&(t=r.raws.semicolon,typeof t<\\\"u\\\"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,\\\"selector\\\")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,\\\"end\\\")}stringify(e,t){if(!this[e.type])throw new Error(\\\"Unknown AST node type \\\"+e.type+\\\". Maybe you need to change PostCSS stringifier.\\\");this[e.type](e,t)}},qn=ss;ss.default=ss;var hc=qn;function is(s,e){new hc(e).stringify(s)}var hr=is;is.default=is;var{isClean:xt,my:fc}=lt,dc=zs,pc=qn,mc=hr;function ns(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r===\\\"proxyCache\\\")continue;let i=s[r],n=typeof i;r===\\\"parent\\\"&&n===\\\"object\\\"?e&&(t[r]=e):r===\\\"source\\\"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>ns(o,t)):(n===\\\"object\\\"&&i!==null&&(i=ns(i)),t[r]=i)}return t}var os=class{constructor(e={}){this.raws={},this[xt]=!1,this[fc]=!0;for(let t in e)if(t===\\\"nodes\\\"){this.nodes=[];for(let r of e[t])typeof r.clone==\\\"function\\\"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\\\n\\\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\\\n\\\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=ns(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new dc(e)}getProxyProcessor(){return{get(e,t){return t===\\\"proxyOf\\\"?e:t===\\\"root\\\"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t===\\\"prop\\\"||t===\\\"value\\\"||t===\\\"name\\\"||t===\\\"params\\\"||t===\\\"important\\\"||t===\\\"text\\\")&&e.markDirty()),!0}}}markDirty(){if(this[xt]){this[xt]=!1;let e=this;for(;e=e.parent;)e[xt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex==\\\"number\\\"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new pc().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!==\\\"document\\\";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o===\\\"parent\\\"||o===\\\"proxyCache\\\")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a==\\\"object\\\"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l==\\\"object\\\"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o===\\\"source\\\"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=mc){e.stringify&&(e=e.stringify);let t=\\\"\\\";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},fr=os;os.default=os;var gc=fr,as=class extends gc{constructor(e){e&&typeof e.value<\\\"u\\\"&&typeof e.value!=\\\"string\\\"&&(e={...e,value:String(e.value)}),super(e),this.type=\\\"decl\\\"}get variable(){return this.prop.startsWith(\\\"--\\\")||this.prop[0]===\\\"$\\\"}},dr=as;as.default=as;var yc=\\\"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\\\",wc=(s,e=21)=>(t=e)=>{let r=\\\"\\\",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},bc=(s=21)=>{let e=\\\"\\\",t=s;for(;t--;)e+=yc[Math.random()*64|0];return e},Sc={nanoid:bc,customAlphabet:wc},{SourceMapConsumer:_i,SourceMapGenerator:ki}=ie,{existsSync:vc,readFileSync:Cc}=ie,{dirname:Tr,join:Ec}=ie;function Ic(s){return Buffer?Buffer.from(s,\\\"base64\\\").toString():window.atob(s)}var ls=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,\\\"data:\\\");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Tr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new _i(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\\\/json;charset=utf-?8;base64,/,r=/^data:application\\\\/json;base64,/,i=/^data:application\\\\/json;charset=utf-?8,/,n=/^data:application\\\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return Ic(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\\\/json;([^,]+),/)[1];throw new Error(\\\"Unsupported source map encoding \\\"+o)}getAnnotationURL(e){return e.replace(/^\\\\/\\\\*\\\\s*# sourceMappingURL=/,\\\"\\\").trim()}isMap(e){return typeof e!=\\\"object\\\"?!1:typeof e.mappings==\\\"string\\\"||typeof e._mappings==\\\"string\\\"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\\\/\\\\*\\\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf(\\\"*/\\\",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Tr(e),vc(e))return this.mapFile=e,Cc(e,\\\"utf-8\\\").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t==\\\"string\\\")return t;if(typeof t==\\\"function\\\"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error(\\\"Unable to load previous source map: \\\"+r.toString());return i}}else{if(t instanceof _i)return ki.fromSourceMap(t).toString();if(t instanceof ki)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error(\\\"Unsupported previous source map format: \\\"+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Ec(Tr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},eo=ls;ls.default=ls;var{SourceMapConsumer:xc,SourceMapGenerator:Mc}=ie,{fileURLToPath:Pi,pathToFileURL:Mt}=ie,{isAbsolute:us,resolve:cs}=ie,{nanoid:Nc}=Sc,_r=ie,$i=zs,Rc=eo,kr=Symbol(\\\"fromOffsetCache\\\"),Ac=!!(xc&&Mc),Li=!!(cs&&us),Qt=class{constructor(e,t={}){if(e===null||typeof e>\\\"u\\\"||typeof e==\\\"object\\\"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]===\\\"\\\\uFEFF\\\"||this.css[0]===\\\"\\\\uFFFE\\\"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Li||/^\\\\w+:\\\\/\\\\//.test(t.from)||us(t.from)?this.file=t.from:this.file=cs(t.from)),Li&&Ac){let r=new Rc(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id=\\\"<input css \\\"+Nc(6)+\\\">\\\"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t==\\\"object\\\"){let u=t,c=r;if(typeof u.offset==\\\"number\\\"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset==\\\"number\\\"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new $i(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new $i(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Mt&&(n.input.url=Mt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[kr])r=this[kr];else{let n=this.css.split(`\\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[kr]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\\\w+:\\\\/\\\\//.test(e)?e:cs(this.map.consumer().sourceRoot||this.map.root||\\\".\\\",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r==\\\"number\\\"&&(l=n.originalPositionFor({column:i,line:r}));let a;us(o.source)?a=Mt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Mt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol===\\\"file:\\\")if(Pi)u.file=Pi(a);else throw new Error(\\\"file: protocol is not available in this PostCSS build\\\");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of[\\\"hasBOM\\\",\\\"css\\\",\\\"file\\\",\\\"id\\\"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},pr=Qt;Qt.default=Qt;_r&&_r.registerInput&&_r.registerInput(Qt);var{SourceMapConsumer:to,SourceMapGenerator:Ut}=ie,{dirname:Bt,relative:ro,resolve:so,sep:io}=ie,{pathToFileURL:Fi}=ie,Oc=pr,Dc=!!(to&&Ut),Tc=!!(Bt&&so&&ro&&io),_c=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e=\\\"data:application/json;base64,\\\"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation==\\\"string\\\"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation==\\\"function\\\"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+\\\".map\\\";let t=`\\n`;this.css.includes(`\\\\r\\n`)&&(t=`\\\\r\\n`),this.css+=t+\\\"/*# sourceMappingURL=\\\"+e+\\\" */\\\"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Bt(e.file),i;this.mapOpts.sourcesContent===!1?(i=new to(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type===\\\"comment\\\"&&e.text.indexOf(\\\"# sourceMappingURL=\\\")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\\\n*?\\\\/\\\\*#[\\\\S\\\\s]*?\\\\*\\\\/$/gm,\\\"\\\"))}generate(){if(this.clearAnnotation(),Tc&&Dc&&this.isMap())return this.generateMap();{let e=\\\"\\\";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Ut.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):\\\"<no source>\\\"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css=\\\"\\\",this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r=\\\"<no source>\\\",i={generated:{column:0,line:0},original:{column:0,line:0},source:\\\"\\\"},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!==\\\"end\\\"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\\n`),t=l.length-o):t+=l.length,a&&u!==\\\"start\\\"){let c=a.parent||{raws:{}};(!(a.type===\\\"decl\\\"||a.type===\\\"atrule\\\"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<\\\"u\\\"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<\\\"u\\\")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<\\\"u\\\"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<\\\"u\\\"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<\\\"u\\\"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):\\\"to.css\\\"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\\\w+:\\\\/\\\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Bt(this.opts.to):\\\".\\\";typeof this.mapOpts.annotation==\\\"string\\\"&&(r=Bt(so(r,this.mapOpts.annotation)));let i=ro(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Oc(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):\\\"<no source>\\\";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString(\\\"base64\\\"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Fi){let r=Fi(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error(\\\"`map.absolute` option is not available in this PostCSS build\\\")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;io===\\\"\\\\\\\\\\\"&&(e=e.replace(/\\\\\\\\/g,\\\"/\\\"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},no=_c,kc=fr,hs=class extends kc{constructor(e){super(e),this.type=\\\"comment\\\"}},mr=hs;hs.default=hs;var{isClean:oo,my:ao}=lt,lo=dr,uo=mr,Pc=fr,co,Vs,Gs,ho;function fo(s){return s.map(e=>(e.nodes&&(e.nodes=fo(e.nodes)),delete e.source,e))}function po(s){if(s[oo]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)po(e)}var he=class mo extends Pc{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t===\\\"proxyOf\\\"?e:e[t]?t===\\\"each\\\"||typeof t==\\\"string\\\"&&t.startsWith(\\\"walk\\\")?(...r)=>e[t](...r.map(i=>typeof i==\\\"function\\\"?(n,o)=>i(n.toProxy(),o):i)):t===\\\"every\\\"||t===\\\"some\\\"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t===\\\"root\\\"?()=>e.root().toProxy():t===\\\"nodes\\\"?e.nodes.map(r=>r.toProxy()):t===\\\"first\\\"||t===\\\"last\\\"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t===\\\"name\\\"||t===\\\"params\\\"||t===\\\"selector\\\")&&e.markDirty()),!0}}}index(e){return typeof e==\\\"number\\\"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?\\\"prepend\\\":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e==\\\"string\\\")e=fo(co(e).nodes);else if(typeof e>\\\"u\\\")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,\\\"ignore\\\")}else if(e.type===\\\"root\\\"&&this.type!==\\\"document\\\"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,\\\"ignore\\\")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>\\\"u\\\")throw new Error(\\\"Value field is missed in node creation\\\");typeof e.value!=\\\"string\\\"&&(e.value=String(e.value)),e=[new lo(e)]}else if(e.selector)e=[new Vs(e)];else if(e.name)e=[new Gs(e)];else if(e.text)e=[new uo(e)];else throw new Error(\\\"Unknown node type in node creation\\\");return e.map(i=>(i[ao]||mo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[oo]&&po(i),typeof i.raws.before>\\\"u\\\"&&t&&typeof t.raws.before<\\\"u\\\"&&(i.raws.before=t.raws.before.replace(/\\\\S/g,\\\"\\\")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,\\\"prepend\\\").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"atrule\\\"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"atrule\\\"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"atrule\\\")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type===\\\"comment\\\")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"decl\\\"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"decl\\\"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"decl\\\")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type===\\\"rule\\\"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type===\\\"rule\\\"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type===\\\"rule\\\")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};he.registerParse=s=>{co=s};he.registerRule=s=>{Vs=s};he.registerAtRule=s=>{Gs=s};he.registerRoot=s=>{ho=s};var Ce=he;he.default=he;he.rebuild=s=>{s.type===\\\"atrule\\\"?Object.setPrototypeOf(s,Gs.prototype):s.type===\\\"rule\\\"?Object.setPrototypeOf(s,Vs.prototype):s.type===\\\"decl\\\"?Object.setPrototypeOf(s,lo.prototype):s.type===\\\"comment\\\"?Object.setPrototypeOf(s,uo.prototype):s.type===\\\"root\\\"&&Object.setPrototypeOf(s,ho.prototype),s[ao]=!0,s.nodes&&s.nodes.forEach(e=>{he.rebuild(e)})};var $c=Ce,go,yo,tt=class extends $c{constructor(e){super({type:\\\"document\\\",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new go(new yo,this,e).stringify()}};tt.registerLazyResult=s=>{go=s};tt.registerProcessor=s=>{yo=s};var js=tt;tt.default=tt;var fs=class{constructor(e,t={}){if(this.type=\\\"warning\\\",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+\\\": \\\"+this.text:this.text}},wo=fs;fs.default=fs;var Lc=wo,ds=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Lc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type===\\\"warning\\\")}get content(){return this.css}},Hs=ds;ds.default=ds;var Pr=39,Ui=34,Nt=92,Bi=47,Rt=10,Ge=32,At=12,Ot=9,Dt=13,Fc=91,Uc=93,Bc=40,Wc=41,zc=123,Vc=125,Gc=59,jc=42,Hc=58,Yc=64,Tt=/[\\\\t\\\\n\\\\f\\\\r \\\"#'()/;[\\\\\\\\\\\\]{}]/g,_t=/[\\\\t\\\\n\\\\f\\\\r !\\\"#'():;@[\\\\\\\\\\\\]{}]|\\\\/(?=\\\\*)/g,Zc=/.[\\\\r\\\\n\\\"'(/\\\\\\\\]/,Wi=/[\\\\da-f]/i,Xc=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error(\\\"Unclosed \\\"+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case Rt:case Ge:case Ot:case Dt:case At:{o=f;do o+=1,n=r.charCodeAt(o);while(n===Ge||n===Rt||n===Ot||n===Dt||n===At);m=[\\\"space\\\",r.slice(f,o)],f=o-1;break}case Fc:case Uc:case zc:case Vc:case Hc:case Gc:case Wc:{let H=String.fromCharCode(n);m=[H,H,f];break}case Bc:{if(p=b.length?b.pop()[1]:\\\"\\\",g=r.charCodeAt(f+1),p===\\\"url\\\"&&g!==Pr&&g!==Ui&&g!==Ge&&g!==Rt&&g!==Ot&&g!==At&&g!==Dt){o=f;do{if(c=!1,o=r.indexOf(\\\")\\\",o+1),o===-1)if(i||z){o=f;break}else v(\\\"bracket\\\");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=[\\\"brackets\\\",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(\\\")\\\",f+1),a=r.slice(f,o+1),o===-1||Zc.test(a)?m=[\\\"(\\\",\\\"(\\\",f]:(m=[\\\"brackets\\\",a,f,o],f=o);break}case Pr:case Ui:{l=n===Pr?\\\"'\\\":'\\\"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v(\\\"string\\\");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=[\\\"string\\\",r.slice(f,o+1),f,o],f=o;break}case Yc:{Tt.lastIndex=f+1,Tt.test(r),Tt.lastIndex===0?o=r.length-1:o=Tt.lastIndex-2,m=[\\\"at-word\\\",r.slice(f,o+1),f,o],f=o;break}case Nt:{for(o=f,u=!0;r.charCodeAt(o+1)===Nt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Bi&&n!==Ge&&n!==Rt&&n!==Ot&&n!==Dt&&n!==At&&(o+=1,Wi.test(r.charAt(o)))){for(;Wi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===Ge&&(o+=1)}m=[\\\"word\\\",r.slice(f,o+1),f,o],f=o;break}default:{n===Bi&&r.charCodeAt(f+1)===jc?(o=r.indexOf(\\\"*/\\\",f+2)+1,o===0&&(i||z?o=r.length:v(\\\"comment\\\")),m=[\\\"comment\\\",r.slice(f,o+1),f,o],f=o):(_t.lastIndex=f+1,_t.test(r),_t.lastIndex===0?o=r.length-1:o=_t.lastIndex-2,m=[\\\"word\\\",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},bo=Ce,qt=class extends bo{constructor(e){super(e),this.type=\\\"atrule\\\"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ys=qt;qt.default=qt;bo.registerAtRule(qt);var So=Ce,vo,Co,_e=class extends So{constructor(e){super(e),this.type=\\\"root\\\",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r===\\\"prepend\\\")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new vo(new Co,this,e).stringify()}};_e.registerLazyResult=s=>{vo=s};_e.registerProcessor=s=>{Co=s};var ut=_e;_e.default=_e;So.registerRoot(_e);var rt={comma(s){return rt.split(s,[\\\",\\\"],!0)},space(s){let e=[\\\" \\\",`\\n`,\\\"\\t\\\"];return rt.split(s,e)},split(s,e,t){let r=[],i=\\\"\\\",n=!1,o=0,l=!1,a=\\\"\\\",u=!1;for(let c of s)u?u=!1:c===\\\"\\\\\\\\\\\"?u=!0:l?c===a&&(l=!1):c==='\\\"'||c===\\\"'\\\"?(l=!0,a=c):c===\\\"(\\\"?o+=1:c===\\\")\\\"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==\\\"\\\"&&r.push(i.trim()),i=\\\"\\\",n=!1):i+=c;return(t||i!==\\\"\\\")&&r.push(i.trim()),r}},Eo=rt;rt.default=rt;var Io=Ce,Jc=Eo,er=class extends Io{constructor(e){super(e),this.type=\\\"rule\\\",this.nodes||(this.nodes=[])}get selectors(){return Jc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\\\s*/):null,r=t?t[0]:\\\",\\\"+this.raw(\\\"between\\\",\\\"beforeOpen\\\");this.selector=e.join(r)}},Zs=er;er.default=er;Io.registerRule(er);var Kc=dr,Qc=Xc,qc=mr,eh=Ys,th=ut,zi=Zs,Vi={empty:!0,space:!0};function rh(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var sh=class{constructor(e){this.input=e,this.root=new th,this.current=this.root,this.spaces=\\\"\\\",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new eh;t.name=e[1].slice(1),t.name===\\\"\\\"&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r===\\\"(\\\"||r===\\\"[\\\"?u.push(r===\\\"(\\\"?\\\")\\\":\\\"]\\\"):r===\\\"{\\\"&&u.length>0?u.push(\\\"}\\\"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===\\\";\\\"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r===\\\"{\\\"){l=!0;break}else if(r===\\\"}\\\"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]===\\\"space\\\";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,\\\"params\\\",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between=\\\"\\\")):(t.raws.afterName=\\\"\\\",t.params=\\\"\\\"),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!==\\\"space\\\"&&(r+=1,r===2)));n--);throw this.input.error(\\\"Missed semicolon\\\",i[0]===\\\"word\\\"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i===\\\"(\\\"&&(t+=1),i===\\\")\\\"&&(t-=1),t===0&&i===\\\":\\\")if(!n)this.doubleColon(r);else{if(n[0]===\\\"word\\\"&&n[1]===\\\"progid\\\")continue;return o}n=r}return!1}comment(e){let t=new qc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\\\s*$/.test(r))t.text=\\\"\\\",t.raws.left=r,t.raws.right=\\\"\\\";else{let i=r.match(/^(\\\\s*)([^]*\\\\S)(\\\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Qc(this.input)}decl(e,t){let r=new Kc;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===\\\";\\\"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||rh(e)),r.source.end.offset++;e[0][0]!==\\\"word\\\";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop=\\\"\\\";e.length;){let u=e[0][0];if(u===\\\":\\\"||u===\\\"space\\\"||u===\\\"comment\\\")break;r.prop+=e.shift()[1]}r.raws.between=\\\"\\\";let n;for(;e.length;)if(n=e.shift(),n[0]===\\\":\\\"){r.raws.between+=n[1];break}else n[0]===\\\"word\\\"&&/\\\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]===\\\"_\\\"||r.prop[0]===\\\"*\\\")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!==\\\"space\\\"&&l!==\\\"comment\\\"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()===\\\"!important\\\"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==\\\" !important\\\"&&(r.raws.important=c);break}else if(n[1].toLowerCase()===\\\"important\\\"){let c=e.slice(0),h=\\\"\\\";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf(\\\"!\\\")===0&&g!==\\\"space\\\")break;h=c.pop()[1]+h}h.trim().indexOf(\\\"!\\\")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!==\\\"space\\\"&&n[0]!==\\\"comment\\\")break}e.some(u=>u[0]!==\\\"space\\\"&&u[0]!==\\\"comment\\\")&&(r.raws.between+=o.map(u=>u[1]).join(\\\"\\\"),o=[]),this.raw(r,\\\"value\\\",o.concat(e),t),r.value.includes(\\\":\\\")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error(\\\"Double colon\\\",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zi;this.init(t,e[2]),t.selector=\\\"\\\",t.raws.between=\\\"\\\",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||\\\"\\\")+this.spaces,this.spaces=\\\"\\\",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||\\\"\\\")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type===\\\"rule\\\"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces=\\\"\\\")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces=\\\"\\\",e.type!==\\\"comment\\\"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith(\\\"--\\\"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r===\\\"(\\\"||r===\\\"[\\\")n||(n=u),o.push(r===\\\"(\\\"?\\\")\\\":\\\"]\\\");else if(l&&i&&r===\\\"{\\\")n||(n=u),o.push(\\\"}\\\");else if(o.length===0)if(r===\\\";\\\")if(i){this.decl(a,l);return}else break;else if(r===\\\"{\\\"){this.rule(a);return}else if(r===\\\"}\\\"){this.tokenizer.back(a.pop()),t=!0;break}else r===\\\":\\\"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!==\\\"space\\\"&&u!==\\\"comment\\\"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case\\\"space\\\":this.spaces+=e[1];break;case\\\";\\\":this.freeSemicolon(e);break;case\\\"}\\\":this.end(e);break;case\\\"comment\\\":this.comment(e);break;case\\\"at-word\\\":this.atrule(e);break;case\\\"{\\\":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a=\\\"\\\",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o===\\\"space\\\"&&p===l-1&&!i?u=!1:o===\\\"comment\\\"?(h=r[p-1]?r[p-1][0]:\\\"empty\\\",c=r[p+1]?r[p+1][0]:\\\"empty\\\",!Vi[h]&&!Vi[c]?a.slice(-1)===\\\",\\\"?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],\\\"\\\");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new zi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,\\\"selector\\\",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r=\\\"\\\";for(;e.length&&(t=e[e.length-1][0],!(t!==\\\"space\\\"&&t!==\\\"comment\\\"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r=\\\"\\\";for(;e.length&&(t=e[0][0],!(t!==\\\"space\\\"&&t!==\\\"comment\\\"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r=\\\"\\\";for(;e.length&&(t=e[e.length-1][0],t===\\\"space\\\");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r=\\\"\\\";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error(\\\"Unclosed block\\\",e.line,e.column)}unclosedBracket(e){throw this.input.error(\\\"Unclosed bracket\\\",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error(\\\"Unexpected }\\\",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error(\\\"Unknown word\\\",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error(\\\"At-rule without name\\\",{offset:t[2]},{offset:t[2]+t[1].length})}},ih=sh,nh=Ce,oh=ih,ah=pr;function tr(s,e){let t=new ah(s,e),r=new oh(t);try{r.parse()}catch(i){throw i}return r.root}var Xs=tr;tr.default=tr;nh.registerParse(tr);var{isClean:le,my:lh}=lt,uh=no,ch=hr,hh=Ce,fh=js;var Gi=Hs,dh=Xs,ph=ut,mh={atrule:\\\"AtRule\\\",comment:\\\"Comment\\\",decl:\\\"Declaration\\\",document:\\\"Document\\\",root:\\\"Root\\\",rule:\\\"Rule\\\"},gh={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},yh={Once:!0,postcssPlugin:!0,prepare:!0},ke=0;function je(s){return typeof s==\\\"object\\\"&&typeof s.then==\\\"function\\\"}function xo(s){let e=!1,t=mh[s.type];return s.type===\\\"decl\\\"?e=s.prop.toLowerCase():s.type===\\\"atrule\\\"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+\\\"-\\\"+e,ke,t+\\\"Exit\\\",t+\\\"Exit-\\\"+e]:e?[t,t+\\\"-\\\"+e,t+\\\"Exit\\\",t+\\\"Exit-\\\"+e]:s.append?[t,ke,t+\\\"Exit\\\"]:[t,t+\\\"Exit\\\"]}function ji(s){let e;return s.type===\\\"document\\\"?e=[\\\"Document\\\",ke,\\\"DocumentExit\\\"]:s.type===\\\"root\\\"?e=[\\\"Root\\\",ke,\\\"RootExit\\\"]:e=xo(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function ps(s){return s[le]=!1,s.nodes&&s.nodes.forEach(e=>ps(e)),s}var ms={},Pe=class Mo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t==\\\"object\\\"&&t!==null&&(t.type===\\\"root\\\"||t.type===\\\"document\\\"))i=ps(t);else if(t instanceof Mo||t instanceof Gi)i=ps(t.root),t.map&&(typeof r.map>\\\"u\\\"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=dh;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[lh]&&hh.rebuild(i)}this.result=new Gi(e,i,r),this.helpers={...ms,postcss:ms,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n==\\\"object\\\"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error(\\\"Use process(css).then(cb) to work with async plugins\\\")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name===\\\"CssSyntaxError\\\"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t==\\\"object\\\")for(let r in t){if(!gh[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!yh[r])if(typeof t[r]==\\\"object\\\")for(let i in t[r])i===\\\"*\\\"?e(t,r,t[r][i]):e(t,r+\\\"-\\\"+i.toLowerCase(),t[r][i]);else typeof t[r]==\\\"function\\\"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(je(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];){e[le]=!0;let t=[ji(e)];for(;t.length>0;){let r=this.visitTick(t);if(je(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type===\\\"document\\\"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e==\\\"object\\\"&&e.Once){if(this.result.root.type===\\\"document\\\"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return je(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e==\\\"function\\\")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ch;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new uh(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(je(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];)e[le]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type===\\\"document\\\")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!==\\\"root\\\"&&t.type!==\\\"document\\\"&&!t.parent)return!0;if(je(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!==\\\"root\\\"&&r.type!==\\\"document\\\"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[le]){l[le]=!0,e.push(ji(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===ke){r.nodes&&r.nodes.length&&(r[le]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[le]=!0;let t=xo(e);for(let r of t)if(r===ke)e.nodes&&e.each(i=>{i[le]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return\\\"LazyResult\\\"}};Pe.registerPostcss=s=>{ms=s};var No=Pe;Pe.default=Pe;ph.registerLazyResult(Pe);fh.registerLazyResult(Pe);var wh=no,bh=hr;var Sh=Xs,vh=Hs,gs=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=bh;this.result=new vh(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,\\\"root\\\",{get(){return o.root}});let l=new wh(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Sh;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return\\\"NoWorkResult\\\"}},Ch=gs;gs.default=gs;var Eh=Ch,Ih=No,xh=js,Mh=ut,st=class{constructor(e=[]){this.version=\\\"8.4.38\\\",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r==\\\"object\\\"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r==\\\"object\\\"&&r.postcssPlugin)t.push(r);else if(typeof r==\\\"function\\\")t.push(r);else if(!(typeof r==\\\"object\\\"&&(r.parse||r.stringify)))throw new Error(r+\\\" is not a PostCSS plugin\\\");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Eh(this,e,t):new Ih(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Nh=st;st.default=st;Mh.registerProcessor(st);xh.registerProcessor(st);var Rh=dr,Ah=eo,Oh=mr,Dh=Ys,Th=pr,_h=ut,kh=Zs;function it(s,e){if(Array.isArray(s))return s.map(i=>it(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Th.prototype};n.map&&(n.map={...n.map,__proto__:Ah.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>it(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type===\\\"root\\\")return new _h(r);if(r.type===\\\"decl\\\")return new Rh(r);if(r.type===\\\"rule\\\")return new kh(r);if(r.type===\\\"comment\\\")return new Oh(r);if(r.type===\\\"atrule\\\")return new Dh(r);throw new Error(\\\"Unknown node type: \\\"+s.type)}var Ph=it;it.default=it;var $h=zs,Ro=dr,Lh=No,Fh=Ce,Js=Nh,Uh=hr,Bh=Ph,Ao=js,Wh=wo,Oo=mr,Do=Ys,zh=Hs,Vh=pr,Gh=Xs,jh=Eo,To=Zs,_o=ut,Hh=fr;function O(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Js(s)}O.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith(\\\"cn\\\")&&console.warn(e+`: \\\\u91CC\\\\u9762 postcss.plugin \\\\u88AB\\\\u5F03\\\\u7528. \\\\u8FC1\\\\u79FB\\\\u6307\\\\u5357:\\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Js().version,l}let n;return Object.defineProperty(i,\\\"postcss\\\",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return O([i(a)]).process(o,l)},i};O.stringify=Uh;O.parse=Gh;O.fromJSON=Bh;O.list=jh;O.comment=s=>new Oo(s);O.atRule=s=>new Do(s);O.decl=s=>new Ro(s);O.rule=s=>new To(s);O.root=s=>new _o(s);O.document=s=>new Ao(s);O.CssSyntaxError=$h;O.Declaration=Ro;O.Container=Fh;O.Processor=Js;O.Document=Ao;O.Comment=Oo;O.Warning=Wh;O.AtRule=Do;O.Result=zh;O.Input=Vh;O.Rule=To;O.Root=_o;O.Node=Hh;Lh.registerPostcss(O);var Yh=O;O.default=O;var F=nc(Yh);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;var ys=class s{constructor(...e){ee(this,\\\"parentElement\\\",null),ee(this,\\\"parentNode\\\",null),ee(this,\\\"ownerDocument\\\"),ee(this,\\\"firstChild\\\",null),ee(this,\\\"lastChild\\\",null),ee(this,\\\"previousSibling\\\",null),ee(this,\\\"nextSibling\\\",null),ee(this,\\\"ELEMENT_NODE\\\",1),ee(this,\\\"TEXT_NODE\\\",3),ee(this,\\\"nodeType\\\"),ee(this,\\\"nodeName\\\"),ee(this,\\\"RRNodeType\\\")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error(\\\"RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.\\\")}insertBefore(e,t){throw new Error(\\\"RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.\\\")}removeChild(e){throw new Error(\\\"RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.\\\")}toString(){return\\\"RRNode\\\"}};var Hi={Node:[\\\"childNodes\\\",\\\"parentNode\\\",\\\"parentElement\\\",\\\"textContent\\\",\\\"ownerDocument\\\"],ShadowRoot:[\\\"host\\\",\\\"styleSheets\\\"],Element:[\\\"shadowRoot\\\",\\\"querySelector\\\",\\\"querySelectorAll\\\"],MutationObserver:[]},Yi={Node:[\\\"contains\\\",\\\"getRootNode\\\"],ShadowRoot:[\\\"getSelection\\\"],Element:[],MutationObserver:[\\\"constructor\\\"]},kt={},Zh=()=>!!globalThis.Zone;function Ks(s){if(kt[s])return kt[s];let e=globalThis[s],t=e.prototype,r=s in Hi?Hi[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes(\\\"[native code]\\\"))})),n=s in Yi?Yi[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]==\\\"function\\\"&&((a=t[l])==null?void 0:a.toString().includes(\\\"[native code]\\\"))}));if(i&&o&&!Zh())return kt[s]=e.prototype,e.prototype;try{let l=document.createElement(\\\"iframe\\\");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?kt[s]=u:t}catch{return t}}var $r={};function de(s,e,t){var r;let i=`${s}.${String(t)}`;if($r[i])return $r[i].call(e);let n=Ks(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?($r[i]=o,o.call(e)):e[t]}var Lr={};function ko(s,e,t){let r=`${s}.${String(t)}`;if(Lr[r])return Lr[r].bind(e);let n=Ks(s)[t];return typeof n!=\\\"function\\\"?e[t]:(Lr[r]=n,n.bind(e))}function Xh(s){return de(\\\"Node\\\",s,\\\"ownerDocument\\\")}function Jh(s){return de(\\\"Node\\\",s,\\\"childNodes\\\")}function Kh(s){return de(\\\"Node\\\",s,\\\"parentNode\\\")}function Qh(s){return de(\\\"Node\\\",s,\\\"parentElement\\\")}function qh(s){return de(\\\"Node\\\",s,\\\"textContent\\\")}function ef(s,e){return ko(\\\"Node\\\",s,\\\"contains\\\")(e)}function tf(s){return ko(\\\"Node\\\",s,\\\"getRootNode\\\")()}function rf(s){return!s||!(\\\"host\\\"in s)?null:de(\\\"ShadowRoot\\\",s,\\\"host\\\")}function sf(s){return s.styleSheets}function nf(s){return!s||!(\\\"shadowRoot\\\"in s)?null:de(\\\"Element\\\",s,\\\"shadowRoot\\\")}function of(s,e){return de(\\\"Element\\\",s,\\\"querySelector\\\")(e)}function af(s,e){return de(\\\"Element\\\",s,\\\"querySelectorAll\\\")(e)}function Po(){return Ks(\\\"MutationObserver\\\").constructor}function Ee(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i==\\\"function\\\"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var C={ownerDocument:Xh,childNodes:Jh,parentNode:Kh,parentElement:Qh,textContent:qh,contains:ef,getRootNode:tf,host:rf,styleSheets:sf,shadowRoot:nf,querySelector:of,querySelectorAll:af,mutationObserver:Po,patch:Ee};function Z(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var xe=`Please stop import mirror directly. Instead of that,\\\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\\\r\\nor you can use record.mirror to access the mirror instance during recording.`,Zi={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<\\\"u\\\"&&window.Proxy&&window.Reflect&&(Zi=new Proxy(Zi,{get(s,e,t){return e===\\\"map\\\"&&console.error(xe),Reflect.get(s,e,t)}}));function nt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function gr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>gr(s,e,n||{},!0)}var rr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(rr=()=>new Date().getTime());function $o(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Lo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Fo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Uo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=Uo(s);if(!i)return!1;try{if(typeof e==\\\"string\\\"){if(i.classList.contains(e)||r&&i.closest(\\\".\\\"+e)!==null)return!0}else if(Yt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function lf(s,e){return e.getId(s)!==-1}function Fr(s,e,t){return s.tagName===\\\"TITLE\\\"&&t.headTitleMutations?!0:e.getId(s)===Je}function Bo(s,e){if(Ye(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Bo(r,e):!0}function ws(s){return!!s.changedTouches}function uf(s=window){\\\"NodeList\\\"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),\\\"DOMTokenList\\\"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Wo(s,e){return!!(s.nodeName===\\\"IFRAME\\\"&&e.getMeta(s))}function zo(s,e){return!!(s.nodeName===\\\"LINK\\\"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute(\\\"rel\\\")===\\\"stylesheet\\\"&&e.getMeta(s))}function bs(s){return s?s instanceof ys&&\\\"shadowRoot\\\"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var Ss=class{constructor(){w(this,\\\"id\\\",1),w(this,\\\"styleIDMap\\\",new WeakMap),w(this,\\\"idStyleMap\\\",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Vo(s){var e;let t=null;return\\\"getRootNode\\\"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function cf(s){let e=s,t;for(;t=Vo(e);)e=t;return e}function hf(s){let e=C.ownerDocument(s);if(!e)return!1;let t=cf(s);return C.contains(e,t)}function Go(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||hf(s):!1}var x=(s=>(s[s.DomContentLoaded=0]=\\\"DomContentLoaded\\\",s[s.Load=1]=\\\"Load\\\",s[s.FullSnapshot=2]=\\\"FullSnapshot\\\",s[s.IncrementalSnapshot=3]=\\\"IncrementalSnapshot\\\",s[s.Meta=4]=\\\"Meta\\\",s[s.Custom=5]=\\\"Custom\\\",s[s.Plugin=6]=\\\"Plugin\\\",s))(x||{}),E=(s=>(s[s.Mutation=0]=\\\"Mutation\\\",s[s.MouseMove=1]=\\\"MouseMove\\\",s[s.MouseInteraction=2]=\\\"MouseInteraction\\\",s[s.Scroll=3]=\\\"Scroll\\\",s[s.ViewportResize=4]=\\\"ViewportResize\\\",s[s.Input=5]=\\\"Input\\\",s[s.TouchMove=6]=\\\"TouchMove\\\",s[s.MediaInteraction=7]=\\\"MediaInteraction\\\",s[s.StyleSheetRule=8]=\\\"StyleSheetRule\\\",s[s.CanvasMutation=9]=\\\"CanvasMutation\\\",s[s.Font=10]=\\\"Font\\\",s[s.Log=11]=\\\"Log\\\",s[s.Drag=12]=\\\"Drag\\\",s[s.StyleDeclaration=13]=\\\"StyleDeclaration\\\",s[s.Selection=14]=\\\"Selection\\\",s[s.AdoptedStyleSheet=15]=\\\"AdoptedStyleSheet\\\",s[s.CustomElement=16]=\\\"CustomElement\\\",s))(E||{}),J=(s=>(s[s.MouseUp=0]=\\\"MouseUp\\\",s[s.MouseDown=1]=\\\"MouseDown\\\",s[s.Click=2]=\\\"Click\\\",s[s.ContextMenu=3]=\\\"ContextMenu\\\",s[s.DblClick=4]=\\\"DblClick\\\",s[s.Focus=5]=\\\"Focus\\\",s[s.Blur=6]=\\\"Blur\\\",s[s.TouchStart=7]=\\\"TouchStart\\\",s[s.TouchMove_Departed=8]=\\\"TouchMove_Departed\\\",s[s.TouchEnd=9]=\\\"TouchEnd\\\",s[s.TouchCancel=10]=\\\"TouchCancel\\\",s))(J||{}),ue=(s=>(s[s.Mouse=0]=\\\"Mouse\\\",s[s.Pen=1]=\\\"Pen\\\",s[s.Touch=2]=\\\"Touch\\\",s))(ue||{}),$e=(s=>(s[s[\\\"2D\\\"]=0]=\\\"2D\\\",s[s.WebGL=1]=\\\"WebGL\\\",s[s.WebGL2=2]=\\\"WebGL2\\\",s))($e||{}),Me=(s=>(s[s.Play=0]=\\\"Play\\\",s[s.Pause=1]=\\\"Pause\\\",s[s.Seeked=2]=\\\"Seeked\\\",s[s.VolumeChange=3]=\\\"VolumeChange\\\",s[s.RateChange=4]=\\\"RateChange\\\",s))(Me||{});var jo=(s=>(s[s.Document=0]=\\\"Document\\\",s[s.DocumentType=1]=\\\"DocumentType\\\",s[s.Element=2]=\\\"Element\\\",s[s.Text=3]=\\\"Text\\\",s[s.CDATA=4]=\\\"CDATA\\\",s[s.Comment=5]=\\\"Comment\\\",s))(jo||{});function Xi(s){return\\\"__ln\\\"in s}var vs=class{constructor(){w(this,\\\"length\\\",0),w(this,\\\"head\\\",null),w(this,\\\"tail\\\",null)}get(e){if(e>=this.length)throw new Error(\\\"Position outside of list range\\\");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Xi(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Xi(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Ji=(s,e)=>`${s}@${e}`,Cs=class{constructor(){w(this,\\\"frozen\\\",!1),w(this,\\\"locked\\\",!1),w(this,\\\"texts\\\",[]),w(this,\\\"attributes\\\",[]),w(this,\\\"attributeMap\\\",new WeakMap),w(this,\\\"removes\\\",[]),w(this,\\\"mapRemoves\\\",[]),w(this,\\\"movedMap\\\",{}),w(this,\\\"addedSet\\\",new Set),w(this,\\\"movedSet\\\",new Set),w(this,\\\"droppedSet\\\",new Set),w(this,\\\"removesSubTreeCache\\\",new Set),w(this,\\\"mutationCb\\\"),w(this,\\\"blockClass\\\"),w(this,\\\"blockSelector\\\"),w(this,\\\"maskTextClass\\\"),w(this,\\\"maskTextSelector\\\"),w(this,\\\"inlineStylesheet\\\"),w(this,\\\"maskInputOptions\\\"),w(this,\\\"maskTextFn\\\"),w(this,\\\"maskInputFn\\\"),w(this,\\\"keepIframeSrcFn\\\"),w(this,\\\"recordCanvas\\\"),w(this,\\\"inlineImages\\\"),w(this,\\\"slimDOMOptions\\\"),w(this,\\\"dataURLOptions\\\"),w(this,\\\"doc\\\"),w(this,\\\"mirror\\\"),w(this,\\\"iframeManager\\\"),w(this,\\\"stylesheetManager\\\"),w(this,\\\"shadowDomManager\\\"),w(this,\\\"canvasManager\\\"),w(this,\\\"processedNodeManager\\\"),w(this,\\\"unattachedDoc\\\"),w(this,\\\"processMutations\\\",e=>{e.forEach(this.processMutation),this.emit()}),w(this,\\\"emit\\\",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new vs,i=a=>{let u=a,c=Je;for(;c===Je;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Go(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m===\\\"TEXTAREA\\\")return;m===\\\"STYLE\\\"&&this.addedSet.has(u)&&(c=!0)}let h=Ye(u)?this.mirror.getId(Vo(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Re(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{Wo(m,this.mirror)&&this.iframeManager.addIframe(m),zo(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),bs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Ki(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Qi(this.droppedSet,a)&&!Ki(this.removesSubTreeCache,a,this.mirror)||Qi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName===\\\"TEXTAREA\\\"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style==\\\"string\\\"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split(\\\"var(\\\").length===u.style.split(\\\"var(\\\").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),w(this,\\\"genTextAreaValueMutation\\\",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||\\\"\\\").join(\\\"\\\");t.attributes.value=Gt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:jt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,\\\"processMutation\\\",e=>{if(!Fr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case\\\"characterData\\\":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:dn(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Uo(e.target)):t.replace(/[\\\\S]/g,\\\"*\\\"):t,node:e.target});break}case\\\"attributes\\\":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r===\\\"value\\\"){let o=jt(t);i=Gt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName===\\\"IFRAME\\\"&&r===\\\"src\\\"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r=\\\"rr_src\\\";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r===\\\"type\\\"&&t.tagName===\\\"INPUT\\\"&&(e.oldValue||\\\"\\\").toLowerCase()===\\\"password\\\"&&t.setAttribute(\\\"data-rr-is-password\\\",\\\"true\\\"),!fn(t.tagName,r))if(n.attributes[r]=hn(this.doc,Se(t.tagName),Se(r),i),r===\\\"style\\\"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement(\\\"span\\\");e.oldValue&&o.setAttribute(\\\"style\\\",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===\\\"\\\"?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===\\\"\\\"&&(n.styleDiff[l]=!1)}else r===\\\"open\\\"&&t.tagName===\\\"DIALOG\\\"&&(t.matches(\\\"dialog:modal\\\")?n.attributes.rr_open_mode=\\\"modal\\\":n.attributes.rr_open_mode=\\\"non-modal\\\");break}case\\\"childList\\\":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName===\\\"TEXTAREA\\\"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ye(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Fr(t,this.mirror,this.slimDOMOptions)||!lf(t,this.mirror)||(this.addedSet.has(t)?(Es(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||Bo(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ji(r,i)]?Es(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ye(e.target)&&Ze(e.target)?!0:void 0}),ff(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,\\\"genAdds\\\",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Ji(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),bs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){[\\\"mutationCb\\\",\\\"blockClass\\\",\\\"blockSelector\\\",\\\"maskTextClass\\\",\\\"maskTextSelector\\\",\\\"inlineStylesheet\\\",\\\"maskInputOptions\\\",\\\"maskTextFn\\\",\\\"maskInputFn\\\",\\\"keepIframeSrcFn\\\",\\\"recordCanvas\\\",\\\"inlineImages\\\",\\\"slimDOMOptions\\\",\\\"dataURLOptions\\\",\\\"doc\\\",\\\"mirror\\\",\\\"iframeManager\\\",\\\"stylesheetManager\\\",\\\"shadowDomManager\\\",\\\"canvasManager\\\",\\\"processedNodeManager\\\"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Es(s,e){s.delete(e),C.childNodes(e).forEach(t=>Es(s,t))}function ff(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Ki(s,e,t){return s.size===0?!1:df(s,e)}function df(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Qi(s,e){return s.size===0?!1:Ho(s,e)}function Ho(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:Ho(s,t):!1}var Xe;function pf(s){Xe=s}function mf(){Xe=void 0}var I=s=>Xe?(...t)=>{try{return s(...t)}catch(r){if(Xe&&Xe(r)===!0)return;throw r}}:s,be=[];function ct(s){try{if(\\\"composedPath\\\"in s){let e=s.composedPath();if(e.length)return e[0]}else if(\\\"path\\\"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function Yo(s,e){let t=new Cs;be.push(t),t.init(s);let r=new(Po())(I(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function gf({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove==\\\"number\\\"?e.mousemove:50,n=typeof e.mousemoveCallback==\\\"number\\\"?e.mousemoveCallback:500,o=[],l,a=nt(I(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=I(nt(I(h=>{let p=ct(h),{clientX:g,clientY:m}=ws(h)?h.changedTouches[0]:h;l||(l=rr()),o.push({x:g,y:m,id:r.getId(p),timeOffset:rr()-l}),a(typeof DragEvent<\\\"u\\\"&&h instanceof DragEvent?E.Drag:h instanceof MouseEvent?E.MouseMove:E.TouchMove)}),i,{trailing:!1})),c=[Z(\\\"mousemove\\\",u,t),Z(\\\"touchmove\\\",u,t),Z(\\\"drag\\\",u,t)];return I(()=>{c.forEach(h=>h())})}function yf({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=ct(h);if(X(p,r,i,!0))return;let g=null,m=c;if(\\\"pointerType\\\"in h){switch(h.pointerType){case\\\"mouse\\\":g=ue.Mouse;break;case\\\"touch\\\":g=ue.Touch;break;case\\\"pen\\\":g=ue.Pen;break}g===ue.Touch?J[c]===J.MouseDown?m=\\\"TouchStart\\\":J[c]===J.MouseUp&&(m=\\\"TouchEnd\\\"):ue.Pen}else ws(h)&&(g=ue.Touch);g!==null?(a=g,(m.startsWith(\\\"Touch\\\")&&g===ue.Touch||m.startsWith(\\\"Mouse\\\")&&g===ue.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=ws(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;I(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith(\\\"_Departed\\\")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace(\\\"mouse\\\",\\\"pointer\\\");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),I(()=>{l.forEach(c=>c())})}function Zo({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=I(nt(I(l=>{let a=ct(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=$o(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z(\\\"scroll\\\",o,e)}function wf({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=I(nt(I(()=>{let n=Lo(),o=Fo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z(\\\"resize\\\",i,e)}var bf=[\\\"INPUT\\\",\\\"TEXTAREA\\\",\\\"SELECT\\\"],qi=new WeakMap;function Sf({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=ct(S),v=S.isTrusted,N=y&&y.tagName;if(y&&N===\\\"OPTION\\\"&&(y=C.parentElement(y)),!y||!N||bf.indexOf(N)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,$=jt(y)||\\\"\\\";$===\\\"radio\\\"||$===\\\"checkbox\\\"?V=y.checked:(l[N.toLowerCase()]||l[$])&&(T=Gt({element:y,maskInputOptions:l,tagName:N,type:$,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;$===\\\"radio\\\"&&z&&V&&e.querySelectorAll(`input[type=\\\"radio\\\"][name=\\\"${z}\\\"]`).forEach(H=>{if(H!==y){let Q=H.value;p(H,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=qi.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){qi.set(S,y);let N=t.getId(S);I(s)({...y,id:N})}}let m=(u.input===\\\"last\\\"?[\\\"change\\\"]:[\\\"input\\\",\\\"change\\\"]).map(S=>Z(S,I(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,\\\"value\\\"),b=[[d.HTMLInputElement.prototype,\\\"value\\\"],[d.HTMLInputElement.prototype,\\\"checked\\\"],[d.HTMLSelectElement.prototype,\\\"value\\\"],[d.HTMLTextAreaElement.prototype,\\\"value\\\"],[d.HTMLSelectElement.prototype,\\\"selectedIndex\\\"],[d.HTMLOptionElement.prototype,\\\"selected\\\"]];return f&&f.set&&m.push(...b.map(S=>gr(S[0],S[1],{set(){I(h)({target:this,isTrusted:!1})}},!1,d))),I(()=>{m.forEach(S=>S())})}function sr(s){let e=[];function t(r,i){if(Pt(\\\"CSSGroupingRule\\\")&&r.parentRule instanceof CSSGroupingRule||Pt(\\\"CSSMediaRule\\\")&&r.parentRule instanceof CSSMediaRule||Pt(\\\"CSSSupportsRule\\\")&&r.parentRule instanceof CSSSupportsRule||Pt(\\\"CSSConditionRule\\\")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function vf({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:I((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};$t(\\\"CSSGroupingRule\\\")?a.CSSGroupingRule=r.CSSGroupingRule:($t(\\\"CSSMediaRule\\\")&&(a.CSSMediaRule=r.CSSMediaRule),$t(\\\"CSSConditionRule\\\")&&(a.CSSConditionRule=r.CSSConditionRule),$t(\\\"CSSSupportsRule\\\")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:I((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...sr(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:I((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...sr(g),d]}]}),p.apply(g,m)})})}),I(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function Xo({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName===\\\"#document\\\"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName===\\\"#document\\\"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,\\\"adoptedStyleSheets\\\"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,\\\"adoptedStyleSheets\\\",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),I(()=>{Object.defineProperty(t,\\\"adoptedStyleSheets\\\",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Cf({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:I((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:sr(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:I((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:sr(a.parentRule)}),l.apply(a,u)})}),I(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Ef({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=I(a=>nt(I(u=>{let c=ct(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z(\\\"play\\\",o(Me.Play),n),Z(\\\"pause\\\",o(Me.Pause),n),Z(\\\"seeked\\\",o(Me.Seeked),n),Z(\\\"volumechange\\\",o(Me.VolumeChange),n),Z(\\\"ratechange\\\",o(Me.RateChange),n)];return I(()=>{l.forEach(a=>a())})}function If({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!=\\\"string\\\",descriptors:c,fontSource:typeof u==\\\"string\\\"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ee(e.fonts,\\\"add\\\",function(l){return function(a){return setTimeout(I(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),I(()=>{r.forEach(l=>l())})}function xf(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=I(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z(\\\"selectionchange\\\",l)}function Mf({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ee(t.customElements,\\\"define\\\",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Nf(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Rf(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Nf(s,e);let r;s.recordDOM&&(r=Yo(s,s.doc));let i=gf(s),n=yf(s),o=Zo(s),l=wf(s,{win:t}),a=Sf(s),u=Ef(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=vf(s,{win:t}),h=Xo(s,s.doc),p=Cf(s,{win:t}),s.collectFonts&&(g=If(s)));let m=xf(s),d=Mf(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return I(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Pt(s){return typeof window[s]<\\\"u\\\"}function $t(s){return!!(typeof window[s]<\\\"u\\\"&&window[s].prototype&&\\\"insertRule\\\"in window[s].prototype&&\\\"deleteRule\\\"in window[s].prototype)}var ir=class{constructor(e){w(this,\\\"iframeIdToRemoteIdMap\\\",new WeakMap),w(this,\\\"iframeRemoteIdToIdMap\\\",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!=\\\"number\\\")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Is=class{constructor(e){w(this,\\\"iframes\\\",new WeakMap),w(this,\\\"crossOriginIframeMap\\\",new WeakMap),w(this,\\\"crossOriginIframeMirror\\\",new ir(cn)),w(this,\\\"crossOriginIframeStyleMirror\\\"),w(this,\\\"crossOriginIframeRootIdMap\\\",new WeakMap),w(this,\\\"mirror\\\"),w(this,\\\"mutationCb\\\"),w(this,\\\"wrappedEmit\\\"),w(this,\\\"loadListener\\\"),w(this,\\\"stylesheetManager\\\"),w(this,\\\"recordCrossOriginIframes\\\"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ir(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener(\\\"message\\\",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener(\\\"message\\\",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!==\\\"rrweb\\\"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,[\\\"id\\\",\\\"parentId\\\",\\\"previousId\\\",\\\"nextId\\\"]),t;case x.IncrementalSnapshot:switch(t.data.source){case E.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,[\\\"parentId\\\",\\\"nextId\\\",\\\"previousId\\\"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,[\\\"parentId\\\",\\\"id\\\"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,[\\\"id\\\"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,[\\\"id\\\"])}),t;case E.Drag:case E.TouchMove:case E.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,[\\\"id\\\"])}),t;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(t.data,e,[\\\"id\\\"]),t;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(t.data,e,[\\\"id\\\"]),this.replaceStyleIds(t.data,e,[\\\"styleId\\\"]),t;case E.Font:return t;case E.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,[\\\"start\\\",\\\"end\\\"])}),t;case E.AdoptedStyleSheet:return this.replaceIds(t.data,e,[\\\"id\\\"]),this.replaceStyleIds(t.data,e,[\\\"styleIds\\\"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,[\\\"styleId\\\"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!=\\\"number\\\"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,[\\\"id\\\",\\\"rootId\\\"]),\\\"childNodes\\\"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==jo.Document&&!e.rootId&&(e.rootId=t),\\\"childNodes\\\"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},xs=class{constructor(e){w(this,\\\"shadowDoms\\\",new WeakSet),w(this,\\\"mutationCb\\\"),w(this,\\\"scrollCb\\\"),w(this,\\\"bypassOptions\\\"),w(this,\\\"mirror\\\"),w(this,\\\"restoreHandlers\\\",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ze(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=Yo({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Zo({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push(Xo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ee(e.prototype,\\\"attachShadow\\\",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Go(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Ae=\\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\\\",Af=typeof Uint8Array>\\\"u\\\"?[]:new Uint8Array(256);for(He=0;He<Ae.length;He++)Af[Ae.charCodeAt(He)]=He;var He,Of=function(s){var e=new Uint8Array(s),t,r=e.length,i=\\\"\\\";for(t=0;t<r;t+=3)i+=Ae[e[t]>>2],i+=Ae[(e[t]&3)<<4|e[t+1]>>4],i+=Ae[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ae[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+\\\"=\\\":r%3===1&&(i=i.substring(0,i.length-2)+\\\"==\\\"),i};var en=new Map;function Df(s,e){let t=en.get(s);return t||(t=new Map,en.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Jo=(s,e,t)=>{if(!s||!(Qo(s,e)||typeof s==\\\"object\\\"))return;let r=s.constructor.name,i=Df(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Wt(s,e,t){if(s instanceof Array)return s.map(r=>Wt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=Of(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Wt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r=\\\"HTMLImageElement\\\",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Wt(s.data,e,t),s.width,s.height]};if(Qo(s,e)||typeof s==\\\"object\\\"){let r=s.constructor.name,i=Jo(s,e,t);return{rr_type:r,index:i}}}}return s}var Ko=(s,e,t)=>s.map(r=>Wt(r,e,t)),Qo=(s,e)=>!![\\\"WebGLActiveInfo\\\",\\\"WebGLBuffer\\\",\\\"WebGLFramebuffer\\\",\\\"WebGLProgram\\\",\\\"WebGLRenderbuffer\\\",\\\"WebGLShader\\\",\\\"WebGLShaderPrecisionFormat\\\",\\\"WebGLTexture\\\",\\\"WebGLUniformLocation\\\",\\\"WebGLVertexArrayObject\\\",\\\"WebGLVertexArrayObjectOES\\\"].filter(i=>typeof e[i]==\\\"function\\\").find(i=>s instanceof e[i]);function Tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!=\\\"function\\\")continue;let l=Ee(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Ko(u,e,this);s(this.canvas,{type:$e[\\\"2D\\\"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=gr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:$e[\\\"2D\\\"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function _f(s){return s===\\\"experimental-webgl\\\"?\\\"webgl\\\":s}function tn(s,e,t,r){let i=[];try{let n=Ee(s.HTMLCanvasElement.prototype,\\\"getContext\\\",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=_f(l);if(\\\"__context\\\"in this||(this.__context=u),r&&[\\\"webgl\\\",\\\"webgl2\\\"].includes(u))if(a[0]&&typeof a[0]==\\\"object\\\"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error(\\\"failed to patch HTMLCanvasElement.prototype.getContext\\\")}return()=>{i.forEach(n=>n())}}function rn(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(![\\\"isContextLost\\\",\\\"canvas\\\",\\\"drawingBufferWidth\\\",\\\"drawingBufferHeight\\\"].includes(a))try{if(typeof s[a]!=\\\"function\\\")continue;let u=Ee(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Jo(p,n,this),\\\"tagName\\\"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Ko(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=gr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function kf(s,e,t,r){let i=[];return i.push(...rn(e.WebGLRenderingContext.prototype,$e.W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ogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=\\\",Pf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),sn=typeof window<\\\"u\\\"&&window.Blob&&new Blob([Pf(qo)],{type:\\\"text/javascript;charset=utf-8\\\"});function $f(s){let e;try{if(e=sn&&(window.URL||window.webkitURL).createObjectURL(sn),!e)throw\\\"\\\";let t=new Worker(e,{name:s?.name});return t.addEventListener(\\\"error\\\",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker(\\\"data:text/javascript;base64,\\\"+qo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var Ms=class{constructor(e){w(this,\\\"pendingCanvasMutations\\\",new Map),w(this,\\\"rafStamps\\\",{latestId:0,invokeId:null}),w(this,\\\"mirror\\\"),w(this,\\\"mutationCb\\\"),w(this,\\\"resetObservers\\\"),w(this,\\\"frozen\\\",!1),w(this,\\\"locked\\\",!1),w(this,\\\"processMutation\\\",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t=\\\"all\\\",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t===\\\"all\\\"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t==\\\"number\\\"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=tn(t,r,i,!0),l=new Map,a=new $f;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!(\\\"base64\\\"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:$e[\\\"2D\\\"],commands:[{property:\\\"clearRect\\\",args:[0,0,S,y]},{property:\\\"drawImage\\\",args:[{rr_type:\\\"ImageBitmap\\\",args:[{rr_type:\\\"Blob\\\",data:[{rr_type:\\\"ArrayBuffer\\\",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll(\\\"canvas\\\").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),[\\\"webgl\\\",\\\"webgl2\\\"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=tn(e,t,r,!1),n=Tf(this.processMutation.bind(this),e,t,r),o=kf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},Ns=class{constructor(e){w(this,\\\"trackedLinkElements\\\",new WeakSet),w(this,\\\"mutationCb\\\"),w(this,\\\"adoptedStyleSheetCb\\\"),w(this,\\\"styleMirror\\\",new Ss),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){\\\"_cssText\\\"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:ln(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Rs=class{constructor(){w(this,\\\"nodeMap\\\",new WeakMap),w(this,\\\"active\\\",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,zt,Ur,nr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement(\\\"iframe\\\");document.body.appendChild(s),Array.from=((ai=s.contentWindow)==null?void 0:ai.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug(\\\"Unable to override Array.from\\\",s)}var re=za();function pe(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i=\\\"rr-block\\\",blockSelector:n=null,ignoreClass:o=\\\"rr-ignore\\\",ignoreSelector:l=null,maskTextClass:a=\\\"rr-mask\\\",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:N=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:$=s.recordAfter===\\\"DOMContentLoaded\\\"?s.recordAfter:\\\"load\\\",userTriggeredOnInput:z=!1,collectFonts:H=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:Fe=new Set([]),errorHandler:Ue}=s;pf(Ue);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error(\\\"emit function is required\\\");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,\\\"datetime-local\\\":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=pn(g);uf();let Qs,br=0,qs=R=>{for(let te of ne||[])te.eventProcessor&&(R=te.eventProcessor(R));return b&&!q&&(R=b(R)),R};W=(R,te)=>{var U;let B=R;if(B.timestamp=rr(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===E.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(qs(B),te);else if(q){let K={type:\\\"rrweb\\\",event:qs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,\\\"*\\\")}if(B.type===x.FullSnapshot)Qs=B,br=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===E.Mutation&&B.data.isAttachIframe)return;br++;let K=r&&br>=r,D=t&&B.timestamp-Qs.timestamp>t;(K||D)&&zt(!0)}};let ft=R=>{W({type:x.IncrementalSnapshot,data:{source:E.Mutation,...R}})},ei=R=>W({type:x.IncrementalSnapshot,data:{source:E.Scroll,...R}}),ti=R=>W({type:x.IncrementalSnapshot,data:{source:E.CanvasMutation,...R}}),ta=R=>W({type:x.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...R}}),ye=new Ns({mutationCb:ft,adoptedStyleSheetCb:ta}),we=new Is({mirror:re,mutationCb:ft,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let R of ne||[])R.getMirror&&R.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let Sr=new Rs;Ur=new Ms({recordCanvas:T,mutationCb:ti,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let dt=new xs({mutationCb:ft,scrollCb:ei,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Ur,keepIframeSrcFn:M,processedNodeManager:Sr},mirror:re});zt=(R=!1)=>{if(!N)return;W({type:x.Meta,data:{href:window.location.href,width:Fo(),height:Lo()}},R),ye.reset(),dt.init(),be.forEach(U=>U.lock());let te=fl(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Wo(U,re)&&we.addIframe(U),zo(U,re)&&ye.trackLinkElement(U),bs(U)&&dt.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),dt.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:M});if(!te)return console.warn(\\\"Failed to snapshot the document\\\");W({type:x.FullSnapshot,data:{node:te,initialOffset:$o(window)}},R),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let R=[],te=B=>{var K;return I(Rf)({mutationCb:ft,mousemoveCb:(D,vr)=>W({type:x.IncrementalSnapshot,data:{source:vr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MouseInteraction,...D}}),scrollCb:ei,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleDeclaration,...D}}),canvasMutationCb:ti,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:N,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:H,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:M,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:dt,processedNodeManager:Sr,canvasManager:Ur,ignoreCSSAttributes:Fe,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:vr=>W({type:x.Plugin,data:{plugin:D.name,payload:vr}})})))||[]},f)};we.addLoadListener(B=>{try{R.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{zt(),R.push(te(document)),nr=!0};return[\\\"interactive\\\",\\\"complete\\\"].includes(document.readyState)?U():(R.push(Z(\\\"DOMContentLoaded\\\",()=>{W({type:x.DomContentLoaded,data:{}}),$===\\\"DOMContentLoaded\\\"&&U()})),R.push(Z(\\\"load\\\",()=>{W({type:x.Load,data:{}}),$===\\\"load\\\"&&U()},window))),()=>{R.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes(\\\"cross-origin\\\")||console.warn(K)}}),Sr.destroy(),nr=!1,mf()}}catch(R){console.warn(R)}}pe.addCustomEvent=(s,e)=>{if(!nr)throw new Error(\\\"please add custom event after start recording\\\");W({type:x.Custom,data:{tag:s,payload:e}})};pe.freezePage=()=>{be.forEach(s=>s.freeze())};pe.takeFullSnapshot=s=>{if(!nr)throw new Error(\\\"please take full snapshot after start recording\\\");zt(s)};pe.mirror=re;var nn;(function(s){s[s.NotStarted=0]=\\\"NotStarted\\\",s[s.Running=1]=\\\"Running\\\",s[s.Stopped=2]=\\\"Stopped\\\"})(nn||(nn={}));var zd=5*1e3;var{addCustomEvent:Vd}=pe,{freezePage:Gd}=pe,{takeFullSnapshot:jd}=pe;var Lf=1e4,Ff=1800,Uf=3e3,Bf=2500,Wf=4e3,zf=.1,Vf=.25,Gf=200,jf=500,Hf=1e3,Yf=5e3,Zf=16,ea=1e3,Le={fcp:null,lcp:null,cls:0,interactionDurations:new Map},Xf={FCP:[Ff,Uf],LCP:[Bf,Wf],CLS:[zf,Vf],INP:[Gf,jf]},Jf=(s,e)=>{let t=Xf[s];return t?e<t[0]?\\\"good\\\":e<t[1]?\\\"needs-improvement\\\":\\\"poor\\\":\\\"unknown\\\"};try{new PerformanceObserver(s=>{for(let e of s.getEntries())e.name===\\\"first-contentful-paint\\\"&&(Le.fcp=e.startTime)}).observe({type:\\\"paint\\\",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries())Le.lcp=e.startTime}).observe({type:\\\"largest-contentful-paint\\\",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries()){let{interactionId:t}=e;if(t&&t>0){let r=Le.interactionDurations.get(t)??0;Le.interactionDurations.set(t,Math.max(r,e.duration))}}}).observe({type:\\\"event\\\",buffered:!0,durationThreshold:Zf})}catch{}try{let s=[];new PerformanceObserver(e=>{for(let o of e.getEntries()){let l=o;l.hadRecentInput||s.push(l)}let t=0,r=0,i=0,n=0;for(let o of s)(o.startTime-n>Hf||o.startTime-i>Yf)&&(r=0,i=o.startTime),r+=o.value,n=o.startTime+o.duration,r>t&&(t=r);Le.cls=t}).observe({type:\\\"layout-shift\\\",buffered:!0})}catch{}var yr=(s,e)=>e===null?null:{value:s===\\\"CLS\\\"?Math.round(e*ea)/ea:Math.round(e),rating:Jf(s,e)},Kf=()=>{let{fcp:s,lcp:e,cls:t,interactionDurations:r}=Le,i=null;return r.size>0&&(i=[...r.values()].sort((o,l)=>l-o)[0]),{fcp:yr(\\\"FCP\\\",s),lcp:yr(\\\"LCP\\\",e),cls:yr(\\\"CLS\\\",t),inp:yr(\\\"INP\\\",i)}},Qf=(s,e)=>{let t=document.createElement(\\\"div\\\");t.id=s,t.style.position=\\\"absolute\\\",t.style.top=\\\"0\\\",t.style.left=\\\"0\\\",t.style.zIndex=\\\"2147483647\\\",t.style.pointerEvents=\\\"none\\\";for(let r of e){let i=document.createElement(\\\"div\\\");i.textContent=`[${r.label}]`,i.style.position=\\\"absolute\\\",i.style.left=`${r.x}px`,i.style.top=`${r.y}px`,i.style.background=\\\"rgba(255, 0, 0, 0.85)\\\",i.style.color=\\\"white\\\",i.style.fontSize=\\\"11px\\\",i.style.fontFamily=\\\"monospace\\\",i.style.fontWeight=\\\"bold\\\",i.style.padding=\\\"1px 3px\\\",i.style.borderRadius=\\\"3px\\\",i.style.lineHeight=\\\"1.2\\\",i.style.whiteSpace=\\\"nowrap\\\",t.appendChild(i)}document.body.appendChild(t)},qf=s=>{document.getElementById(s)?.remove()},ed=(s,e,t,r,i)=>{let n=new Set(t),o=new Set(r),l=document.querySelector(s)||document.body,a=l.querySelectorAll(\\\"*\\\"),u=[];for(let c of a){let h=c.tagName.toLowerCase();if(o.has(h))continue;let p=c.getAttribute(\\\"role\\\");if(p&&n.has(p.toLowerCase()))continue;let m=getComputedStyle(c).cursor===\\\"pointer\\\",d=c.hasAttribute(\\\"onclick\\\")||c instanceof HTMLElement&&c.onclick!==null,f=c.getAttribute(\\\"tabindex\\\"),b=f!==null&&f!==\\\"-1\\\";if(!m&&!d&&!b)continue;if(m&&!d&&!b){let N=c.parentElement;if(N&&getComputedStyle(N).cursor===\\\"pointer\\\")continue}let S=(c.textContent||\\\"\\\").trim().slice(0,e);if(!S)continue;let y=c.getBoundingClientRect();if(y.width===0||y.height===0)continue;let v=[];if(m&&v.push(\\\"cursor:pointer\\\"),d&&v.push(\\\"onclick\\\"),b&&v.push(\\\"tabindex\\\"),u.push({selector:si(c,{root:l}),text:S,reason:v.join(\\\", \\\")}),u.length>=i)break}return u},ht=[],wr,td=()=>{wr||(ht.length=0,wr=pe({checkoutEveryNms:Lf,sampling:{input:\\\"last\\\"},emit(s){ht.push(s)}})??void 0)},rd=()=>{wr?.(),wr=void 0},sd=()=>ht.splice(0),id=()=>[...ht],nd=()=>ht.length;return aa(od);})();\\n/*! Bundled license information:\\n\\nrrweb/dist/rrweb.js:\\n (*! *****************************************************************************\\n Copyright (c) Microsoft Corporation.\\n \\n Permission to use, copy, modify, and/or distribute this software for any\\n purpose with or without fee is hereby granted.\\n \\n THE SOFTWARE IS PROVIDED \\\"AS IS\\\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\\n PERFORMANCE OF THIS SOFTWARE.\\n ***************************************************************************** *)\\n*/\\n\\nglobalThis.__EXPECT_RUNTIME__ = __EXPECT_RUNTIME__;\\n\";\n","import { Browsers, Cookies, layerLive } from \"@expect/cookies\";\nimport type { Browser as BrowserProfile } from \"@expect/cookies\";\nimport { chromium } from \"playwright\";\nimport type { Locator, Page } from \"playwright\";\nimport { Array as Arr, Effect, Layer, Option, ServiceMap } from \"effect\";\n\nconst cookiesLayer = Layer.mergeAll(layerLive, Cookies.layer);\nimport {\n CONTENT_ROLES,\n HEADLESS_CHROMIUM_ARGS,\n INTERACTIVE_ROLES,\n NAVIGATION_DETECT_DELAY_MS,\n OVERLAY_CONTAINER_ID,\n POST_NAVIGATION_SETTLE_MS,\n REPLAY_PLAYER_HEIGHT_PX,\n REPLAY_PLAYER_WIDTH_PX,\n REF_PREFIX,\n SNAPSHOT_TIMEOUT_MS,\n} from \"./constants\";\nimport { BrowserLaunchError, NavigationError, SnapshotTimeoutError } from \"./errors\";\nimport { toActionError } from \"./utils/action-error\";\nimport { compactTree } from \"./utils/compact-tree\";\nimport { createLocator } from \"./utils/create-locator\";\nimport { evaluateRuntime } from \"./utils/evaluate-runtime\";\nimport { findCursorInteractive } from \"./utils/find-cursor-interactive\";\nimport { getIndentLevel } from \"./utils/get-indent-level\";\nimport { parseAriaLine } from \"./utils/parse-aria-line\";\nimport { resolveNthDuplicates } from \"./utils/resolve-nth-duplicates\";\nimport { computeSnapshotStats } from \"./utils/snapshot-stats\";\nimport { RUNTIME_SCRIPT } from \"./generated/runtime-script\";\nimport type {\n AnnotatedScreenshotOptions,\n Annotation,\n CreatePageOptions,\n RefMap,\n SnapshotOptions,\n} from \"./types\";\n\nconst shouldAssignRef = (role: string, name: string, interactive?: boolean): boolean => {\n if (INTERACTIVE_ROLES.has(role)) return true;\n if (interactive) return false;\n return CONTENT_ROLES.has(role) && name.length > 0;\n};\n\nconst toBrowserLaunchError = (cause: unknown) =>\n new BrowserLaunchError({\n cause: cause instanceof Error ? cause.message : String(cause),\n });\n\nconst resolveDefaultBrowserContext = Effect.fn(\"Browser.resolveDefaultBrowserContext\")(\n function* () {\n const browsers = yield* Browsers;\n const maybeDefault = yield* browsers\n .defaultBrowser()\n .pipe(\n Effect.catchTag(\"ListBrowsersError\", () => Effect.succeed(Option.none<BrowserProfile>())),\n );\n\n return { preferredProfile: Option.getOrUndefined(maybeDefault) };\n },\n Effect.provide(layerLive),\n);\n\nconst extractCookiesForProfile = Effect.fn(\"Browser.extractCookiesForProfile\")(\n function* (cookiesService: typeof Cookies.Service, profile: BrowserProfile) {\n return yield* cookiesService.extract(profile);\n },\n Effect.catchTags({\n ExtractionError: () => Effect.succeed([]),\n PlatformError: Effect.die,\n }),\n);\n\nconst isSiblingProfile = (profile: BrowserProfile, reference: BrowserProfile) => {\n if (profile._tag !== reference._tag) return false;\n if (profile._tag === \"ChromiumBrowser\" && reference._tag === \"ChromiumBrowser\") {\n return profile.key === reference.key && profile.profilePath !== reference.profilePath;\n }\n if (profile._tag === \"FirefoxBrowser\" && reference._tag === \"FirefoxBrowser\") {\n return profile.profilePath !== reference.profilePath;\n }\n return false;\n};\n\nconst extractDefaultBrowserCookies = Effect.fn(\"Browser.extractDefaultBrowserCookies\")(function* (\n url: string,\n preferredProfile: BrowserProfile | undefined,\n) {\n if (!preferredProfile) return [];\n\n const cookiesService = yield* Cookies;\n const browsers = yield* Browsers;\n\n const allProfiles = yield* browsers.list.pipe(\n Effect.catchTag(\"ListBrowsersError\", () => Effect.succeed<BrowserProfile[]>([])),\n );\n\n const results = yield* Effect.forEach(\n [\n preferredProfile,\n ...allProfiles.filter((profile) => isSiblingProfile(profile, preferredProfile)),\n ],\n (profile) => extractCookiesForProfile(cookiesService, profile),\n { concurrency: \"unbounded\" },\n );\n\n // Preferred profile is first, so its cookies win when multiple profiles share the same cookie identity.\n return Arr.dedupeWith(\n results.flat(),\n (cookieA, cookieB) =>\n cookieA.name === cookieB.name &&\n cookieA.domain === cookieB.domain &&\n cookieA.path === cookieB.path,\n );\n}, Effect.provide(cookiesLayer));\n\nconst appendCursorInteractiveElements = Effect.fn(\"Browser.appendCursorInteractive\")(function* (\n page: Page,\n filteredLines: string[],\n refs: RefMap,\n refCount: number,\n options: SnapshotOptions,\n) {\n const cursorElements = yield* findCursorInteractive(page, options.selector);\n if (cursorElements.length === 0) return refCount;\n\n const existingNames = new Set(Object.values(refs).map((entry) => entry.name.toLowerCase()));\n const newLines: string[] = [];\n\n for (const element of cursorElements) {\n if (existingNames.has(element.text.toLowerCase())) continue;\n existingNames.add(element.text.toLowerCase());\n\n const ref = `${REF_PREFIX}${++refCount}`;\n refs[ref] = {\n role: \"clickable\",\n name: element.text,\n selector: element.selector,\n };\n newLines.push(`- clickable \"${element.text}\" [ref=${ref}] [${element.reason}]`);\n }\n\n if (newLines.length > 0) {\n filteredLines.push(\"# Cursor-interactive elements:\");\n filteredLines.push(...newLines);\n }\n\n return refCount;\n});\n\nconst injectOverlayLabels = (page: Page, labels: Array<{ label: number; x: number; y: number }>) =>\n evaluateRuntime(page, \"injectOverlayLabels\", OVERLAY_CONTAINER_ID, labels);\n\nexport class Browser extends ServiceMap.Service<Browser>()(\"@browser/Browser\", {\n make: Effect.gen(function* () {\n const createPage = Effect.fn(\"Browser.createPage\")(function* (\n url: string | undefined,\n options: CreatePageOptions = {},\n ) {\n yield* Effect.annotateCurrentSpan({ url: url ?? \"about:blank\" });\n\n const browser = yield* Effect.tryPromise({\n try: () =>\n chromium.launch({\n headless: !options.headed,\n executablePath: options.executablePath,\n args: options.headed ? [] : HEADLESS_CHROMIUM_ARGS,\n }),\n catch: toBrowserLaunchError,\n });\n\n const setupPage = Effect.gen(function* () {\n const defaultBrowserContext =\n options.cookies === true\n ? yield* resolveDefaultBrowserContext()\n : { preferredProfile: undefined };\n\n const profileLocale =\n defaultBrowserContext.preferredProfile?._tag === \"ChromiumBrowser\"\n ? defaultBrowserContext.preferredProfile.locale\n : undefined;\n\n const contextOptions: Parameters<typeof browser.newContext>[0] = {};\n if (profileLocale) {\n contextOptions.locale = profileLocale;\n }\n if (options.videoOutputDir) {\n contextOptions.recordVideo = {\n dir: options.videoOutputDir,\n size: { width: REPLAY_PLAYER_WIDTH_PX, height: REPLAY_PLAYER_HEIGHT_PX },\n };\n }\n\n const context = yield* Effect.tryPromise({\n try: () => browser.newContext(contextOptions),\n catch: toBrowserLaunchError,\n });\n\n yield* Effect.tryPromise({\n try: () => context.addInitScript(RUNTIME_SCRIPT),\n catch: toBrowserLaunchError,\n });\n\n if (options.cookies) {\n const cookies = Array.isArray(options.cookies)\n ? options.cookies\n : yield* extractDefaultBrowserCookies(\n url ?? \"\",\n defaultBrowserContext.preferredProfile,\n );\n yield* Effect.tryPromise({\n try: () => context.addCookies(cookies.map((cookie) => cookie.playwrightFormat)),\n catch: toBrowserLaunchError,\n });\n }\n\n const page = yield* Effect.tryPromise({\n try: () => context.newPage(),\n catch: toBrowserLaunchError,\n });\n\n if (url) {\n yield* Effect.tryPromise({\n try: () => page.goto(url, { waitUntil: options.waitUntil ?? \"load\" }),\n catch: (cause) =>\n new NavigationError({\n url,\n cause: cause instanceof Error ? cause.message : String(cause),\n }),\n });\n }\n\n return { browser, context, page };\n });\n\n return yield* setupPage.pipe(\n Effect.tapError(() =>\n Effect.tryPromise(() => browser.close()).pipe(\n Effect.catchTag(\"UnknownError\", () => Effect.void),\n ),\n ),\n );\n });\n\n const snapshot = Effect.fn(\"Browser.snapshot\")(function* (\n page: Page,\n options: SnapshotOptions = {},\n ) {\n const timeout = options.timeout ?? SNAPSHOT_TIMEOUT_MS;\n const selector = options.selector ?? \"body\";\n yield* Effect.annotateCurrentSpan({ selector });\n\n const rawTree = yield* Effect.tryPromise({\n try: () => page.locator(selector).ariaSnapshot({ timeout }),\n catch: (cause) =>\n new SnapshotTimeoutError({\n selector,\n timeoutMs: timeout,\n cause: cause instanceof Error ? cause.message : String(cause),\n }),\n });\n\n const refs: RefMap = {};\n const filteredLines: string[] = [];\n let refCount = 0;\n\n for (const line of rawTree.split(\"\\n\")) {\n if (options.maxDepth !== undefined && getIndentLevel(line) > options.maxDepth) continue;\n\n const parsed = parseAriaLine(line);\n if (Option.isNone(parsed)) {\n if (!options.interactive) filteredLines.push(line);\n continue;\n }\n\n const { role, name } = parsed.value;\n if (options.interactive && !INTERACTIVE_ROLES.has(role)) continue;\n\n if (shouldAssignRef(role, name, options.interactive)) {\n const ref = `${REF_PREFIX}${++refCount}`;\n refs[ref] = { role, name };\n filteredLines.push(`${line} [ref=${ref}]`);\n } else {\n filteredLines.push(line);\n }\n }\n\n if (options.cursor) {\n refCount = yield* appendCursorInteractiveElements(\n page,\n filteredLines,\n refs,\n refCount,\n options,\n );\n }\n\n resolveNthDuplicates(refs);\n\n let tree = filteredLines.join(\"\\n\");\n if (options.interactive && refCount === 0) tree = \"(no interactive elements)\";\n if (options.compact) tree = compactTree(tree);\n\n const stats = computeSnapshotStats(tree, refs);\n\n return { tree, refs, stats, locator: createLocator(page, refs) };\n });\n\n const act = Effect.fn(\"Browser.act\")(function* (\n page: Page,\n ref: string,\n action: (locator: Locator) => Promise<void>,\n options?: SnapshotOptions,\n ) {\n yield* Effect.annotateCurrentSpan({ ref });\n const before = yield* snapshot(page, options);\n const locator = yield* before.locator(ref);\n yield* Effect.tryPromise({\n try: () => action(locator),\n catch: (error) => toActionError(error, ref),\n });\n return yield* snapshot(page, options);\n });\n\n const annotatedScreenshot = Effect.fn(\"Browser.annotatedScreenshot\")(function* (\n page: Page,\n options: AnnotatedScreenshotOptions = {},\n ) {\n const snapshotResult = yield* snapshot(page, options);\n const annotations: Annotation[] = [];\n const labelPositions: Array<{ label: number; x: number; y: number }> = [];\n\n let labelCounter = 0;\n\n for (const [ref, entry] of Object.entries(snapshotResult.refs)) {\n const locator = yield* snapshotResult.locator(ref);\n const box = yield* Effect.tryPromise(() => locator.boundingBox()).pipe(\n Effect.catchTag(\"UnknownError\", () => Effect.succeed(undefined)),\n );\n if (!box) continue;\n\n labelCounter++;\n annotations.push({ label: labelCounter, ref, role: entry.role, name: entry.name });\n labelPositions.push({ label: labelCounter, x: box.x, y: box.y });\n }\n\n yield* injectOverlayLabels(page, labelPositions);\n return yield* Effect.ensuring(\n Effect.tryPromise({\n try: () => page.screenshot({ fullPage: options.fullPage }),\n catch: toBrowserLaunchError,\n }).pipe(Effect.map((screenshotBuffer) => ({ screenshot: screenshotBuffer, annotations }))),\n // HACK: overlay removal is best-effort cleanup — evaluateRuntime uses Effect.promise which defects on failure\n evaluateRuntime(page, \"removeOverlay\", OVERLAY_CONTAINER_ID).pipe(\n Effect.catchCause(() => Effect.void),\n ),\n );\n });\n\n const waitForNavigationSettle = Effect.fn(\"Browser.waitForNavigationSettle\")(function* (\n page: Page,\n urlBefore: string,\n ) {\n yield* Effect.tryPromise({\n try: () =>\n page.waitForURL((url) => url.toString() !== urlBefore, {\n timeout: NAVIGATION_DETECT_DELAY_MS,\n waitUntil: \"commit\",\n }),\n catch: toBrowserLaunchError,\n }).pipe(Effect.catchTag(\"BrowserLaunchError\", () => Effect.void));\n if (page.url() !== urlBefore) {\n yield* Effect.tryPromise(() => page.waitForLoadState(\"domcontentloaded\")).pipe(\n Effect.catchTag(\"UnknownError\", () => Effect.void),\n );\n yield* Effect.tryPromise({\n try: () => page.waitForTimeout(POST_NAVIGATION_SETTLE_MS),\n catch: toBrowserLaunchError,\n });\n }\n });\n\n const preExtractCookies = Effect.fn(\"Browser.preExtractCookies\")(function* () {\n const { preferredProfile } = yield* resolveDefaultBrowserContext();\n const cookies = yield* extractDefaultBrowserCookies(\"\", preferredProfile);\n return cookies;\n });\n\n return {\n createPage,\n snapshot,\n act,\n annotatedScreenshot,\n waitForNavigationSettle,\n preExtractCookies,\n } as const;\n }),\n}) {\n static layer = Layer.effect(this)(this.make);\n}\n\nexport const runBrowser = <A>(\n effect: (browser: typeof Browser.Service) => Effect.Effect<A, unknown>,\n): Promise<A> =>\n Effect.runPromise(\n Effect.gen(function* () {\n const browser = yield* Browser;\n return yield* effect(browser);\n }).pipe(Effect.provide(Browser.layer)),\n );\n","import type { Page } from \"playwright\";\nimport type { eventWithTime } from \"@rrweb/types\";\nimport { Effect, Predicate } from \"effect\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport { evaluateRuntime } from \"./utils/evaluate-runtime\";\nimport { RecorderInjectionError, SessionLoadError } from \"./errors\";\nimport type { CollectResult } from \"./types\";\n\nexport const collectEvents = Effect.fn(\"Recorder.collectEvents\")(function* (page: Page) {\n const events = yield* evaluateRuntime(page, \"getEvents\").pipe(\n Effect.catchCause((cause) => new RecorderInjectionError({ cause: String(cause) }).asEffect()),\n );\n const total = yield* evaluateRuntime(page, \"getEventCount\").pipe(\n Effect.catchCause((cause) => new RecorderInjectionError({ cause: String(cause) }).asEffect()),\n );\n\n return { events, total: total + events.length } satisfies CollectResult;\n});\n\nexport const collectAllEvents = Effect.fn(\"Recorder.collectAllEvents\")(function* (page: Page) {\n return yield* evaluateRuntime(page, \"getAllEvents\").pipe(\n Effect.catchCause((cause) => new RecorderInjectionError({ cause: String(cause) }).asEffect()),\n );\n});\n\nconst isRrwebEvent = (value: unknown): value is eventWithTime =>\n Predicate.isObject(value) && \"type\" in value && \"timestamp\" in value;\n\nexport const loadSession = Effect.fn(\"Recorder.loadSession\")(function* (sessionPath: string) {\n const fileSystem = yield* FileSystem;\n const content = yield* fileSystem\n .readFileString(sessionPath)\n .pipe(\n Effect.catchTag(\"PlatformError\", (error) =>\n new SessionLoadError({ path: sessionPath, cause: String(error) }).asEffect(),\n ),\n );\n\n const lines = content.trim().split(\"\\n\");\n const events = yield* Effect.forEach(lines, (line, index) =>\n Effect.try({\n try: () => {\n const parsed: unknown = JSON.parse(line);\n if (!isRrwebEvent(parsed)) {\n throw new Error(\"Missing required 'type' and 'timestamp' fields\");\n }\n return parsed;\n },\n catch: (cause) =>\n new SessionLoadError({\n path: sessionPath,\n cause: `Invalid rrweb event at line ${index + 1}: ${String(cause)}`,\n }),\n }),\n );\n\n return events;\n});\n","import { REPLAY_PLAYER_HEIGHT_PX, REPLAY_PLAYER_WIDTH_PX } from \"./constants\";\nimport type { ViewerRunState } from \"./mcp/viewer-events\";\n\nconst escapeHtml = (text: string): string =>\n text.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\");\n\nconst RRWEB_PLAYER_VERSION = \"2.0.0-alpha.18\";\nconst RRWEB_PLAYER_CSS = `https://cdn.jsdelivr.net/npm/rrweb-player@${RRWEB_PLAYER_VERSION}/dist/style.css`;\nconst RRWEB_PLAYER_JS = `https://cdn.jsdelivr.net/npm/rrweb-player@${RRWEB_PLAYER_VERSION}/dist/rrweb-player.js`;\n\ntype EventsSource = \"sse\" | { ndjsonPath: string };\n\ninterface ReplayViewerOptions {\n title: string;\n bodyHtml?: string;\n eventsSource?: EventsSource;\n steps?: ViewerRunState;\n}\n\nconst buildLoadEventsScript = (source: EventsSource): string => {\n if (source === \"sse\") {\n return `\n const res = await fetch('/latest.json');\n if (res.ok) { allEvents = await res.json(); if (allEvents.length >= 2) initPlayer(allEvents); }\n const es = new EventSource('/events');\n es.addEventListener('replay', (msg) => { try { for (const e of JSON.parse(msg.data)) { allEvents.push(e); if (player) player.getReplayer().addEvent(e); } if (!player && allEvents.length >= 2) initPlayer(allEvents); } catch {} });\n es.addEventListener('steps', (msg) => { try { updateSteps(JSON.parse(msg.data)); } catch {} });\n es.onerror = () => { if (statusEl) statusEl.textContent = 'Connection lost. Retrying...'; };`;\n }\n\n const escapedPath = source.ndjsonPath.replaceAll(\"'\", \"\\\\'\");\n return `\n if (window.__EXPECT_REPLAY_NDJSON__) {\n allEvents = window.__EXPECT_REPLAY_NDJSON__.trim().split('\\\\n').map(l => JSON.parse(l));\n if (allEvents.length >= 2) initPlayer(allEvents);\n else if (statusEl) statusEl.textContent = 'No replay events recorded.';\n } else {\n const res = await fetch('${escapedPath}');\n if (res.ok) {\n allEvents = (await res.text()).trim().split('\\\\n').map(l => JSON.parse(l));\n if (allEvents.length >= 2) initPlayer(allEvents);\n else if (statusEl) statusEl.textContent = 'No replay events recorded.';\n } else if (statusEl) statusEl.textContent = 'Failed to load replay.';\n }`;\n};\n\nconst buildStepsScript = (steps?: ViewerRunState): string => {\n const initialData = steps ? JSON.stringify(steps) : \"null\";\n return `\n const stepsPanel = document.getElementById('steps-panel');\n const runTitle = document.getElementById('run-title');\n const runStatus = document.getElementById('run-status');\n const runSummary = document.getElementById('run-summary');\n const stepsList = document.getElementById('steps-list');\n let initialSteps = ${initialData};\n if (initialSteps) updateSteps(initialSteps);\n\n function updateSteps(state) {\n if (!stepsPanel || !state) return;\n stepsPanel.style.display = 'block';\n if (runTitle) runTitle.textContent = state.title || 'Test Run';\n if (runStatus) {\n runStatus.textContent = state.status;\n runStatus.className = 'run-status status-' + state.status;\n }\n if (runSummary) {\n runSummary.textContent = state.summary || '';\n runSummary.style.display = state.summary ? 'block' : 'none';\n }\n if (stepsList && state.steps) {\n stepsList.innerHTML = '';\n for (const step of state.steps) {\n const li = document.createElement('li');\n li.className = 'step-item step-' + step.status;\n const badge = document.createElement('span');\n badge.className = 'step-badge';\n badge.textContent = step.status === 'passed' ? '\\\\u2713'\n : step.status === 'failed' ? '\\\\u2717'\n : step.status === 'active' ? '\\\\u25CF'\n : '\\\\u25CB';\n const title = document.createElement('span');\n title.className = 'step-title';\n title.textContent = step.title;\n li.appendChild(badge);\n li.appendChild(title);\n if (step.summary) {\n const summary = document.createElement('span');\n summary.className = 'step-summary';\n summary.textContent = step.summary;\n li.appendChild(summary);\n }\n stepsList.appendChild(li);\n }\n }\n }`;\n};\n\nconst stepsStyles = `\n #steps-panel { display: none; margin-bottom: 24px; background: #1e293b; border-radius: 8px; padding: 20px; border: 1px solid #334155 }\n #steps-panel h2 { margin: 0 0 4px 0; font-size: 16px; font-weight: 600 }\n .run-status { display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 4px; margin-bottom: 12px }\n .status-running { background: #1e3a5f; color: #60a5fa }\n .status-passed { background: #14532d; color: #4ade80 }\n .status-failed { background: #7f1d1d; color: #f87171 }\n #run-summary { font-size: 13px; color: #94a3b8; margin-bottom: 16px }\n #steps-list { list-style: none; padding: 0; margin: 0 }\n .step-item { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 14px; border-top: 1px solid #1e293b }\n .step-item:first-child { border-top: none }\n .step-badge { flex-shrink: 0; width: 16px; text-align: center; font-size: 13px }\n .step-pending .step-badge { color: #64748b }\n .step-active .step-badge { color: #60a5fa; animation: pulse 1.5s infinite }\n .step-passed .step-badge { color: #4ade80 }\n .step-failed .step-badge { color: #f87171 }\n .step-title { color: #e2e8f0 }\n .step-summary { color: #94a3b8; font-size: 12px; margin-left: auto; max-width: 50%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }\n @keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.4 } }`;\n\nexport const buildReplayViewerHtml = (options: ReplayViewerOptions): string => {\n const source = options.eventsSource;\n const isLive = source === \"sse\";\n\n const ndjsonLoaderScript =\n source !== undefined && source !== \"sse\"\n ? `\n <script>\n (function(){var b=location.pathname.split('/').pop().replace(/\\\\.html$/,'');document.write('<scr'+'ipt src=\"'+b+'.ndjson.js\"></scr'+'ipt>');})();\n </script>`\n : \"\";\n\n const replaySection =\n source !== undefined\n ? `\n <div id=\"replay-container\"><div class=\"status\" id=\"status\">Loading replay…</div></div>\n ${ndjsonLoaderScript}\n <script type=\"module\">\n import rrwebPlayer from '${RRWEB_PLAYER_JS}';\n const container = document.getElementById('replay-container');\n const statusEl = document.getElementById('status');\n let player = null, allEvents = [];\n const initPlayer = (events) => {\n if (player) { player.getReplayer().addEvent(events.at(-1)); return; }\n if (events.length < 2) return;\n statusEl?.remove();\n player = new rrwebPlayer({ target: container, props: {\n events, width: ${REPLAY_PLAYER_WIDTH_PX}, height: ${REPLAY_PLAYER_HEIGHT_PX},\n autoPlay: ${isLive}, showController: ${!isLive}, ${isLive ? \"liveMode: true,\" : \"\"}\n }});\n ${isLive ? \"player.getReplayer().startLive();\" : \"\"}\n };\n ${buildLoadEventsScript(source)}\n </script>`\n : \"\";\n\n const stepsSection = `\n <div id=\"steps-panel\">\n <h2 id=\"run-title\">Test Run</h2>\n <div id=\"run-status\" class=\"run-status status-running\">running</div>\n <div id=\"run-summary\" style=\"display:none\"></div>\n <ul id=\"steps-list\"></ul>\n </div>\n <script>${buildStepsScript(options.steps)}</script>`;\n\n return `<!doctype html>\n<html>\n<head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>${escapeHtml(options.title)}</title>\n ${source !== undefined ? `<link rel=\"stylesheet\" href=\"${RRWEB_PLAYER_CSS}\" />` : \"\"}\n <style>\n :root { color-scheme: dark }\n body { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; background: #0f172a; color: #e2e8f0 }\n h1, h2 { color: #f8fafc } a { color: #93c5fd }\n #replay-container { margin: 16px 0; border-radius: 8px; overflow: hidden }\n .status { text-align: center; padding: 16px; font-size: 14px; color: #9ca3af }\n ${stepsStyles}\n .replayer-mouse {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nMzInIGhlaWdodD0nMzUnIHZpZXdCb3g9JzAgMCAzMiAzNScgZmlsbD0nbm9uZScgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz48ZGVmcz48ZmlsdGVyIGlkPSdjcycgeD0nLTQnIHk9Jy00JyB3aWR0aD0nNDAnIGhlaWdodD0nNDAnIGZpbHRlclVuaXRzPSd1c2VyU3BhY2VPblVzZScgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSdzUkdCJz48ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PScwJyByZXN1bHQ9J2JnJy8+PGZlQ29sb3JNYXRyaXggaW49J1NvdXJjZUFscGhhJyB0eXBlPSdtYXRyaXgnIHZhbHVlcz0nMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAnIHJlc3VsdD0naGEnLz48ZmVPZmZzZXQvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249JzInLz48ZmVDb21wb3NpdGUgaW4yPSdoYScgb3BlcmF0b3I9J291dCcvPjxmZUNvbG9yTWF0cml4IHR5cGU9J21hdHJpeCcgdmFsdWVzPScwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI1IDAnLz48ZmVCbGVuZCBtb2RlPSdub3JtYWwnIGluMj0nYmcnIHJlc3VsdD0nZHMnLz48ZmVCbGVuZCBtb2RlPSdub3JtYWwnIGluPSdTb3VyY2VHcmFwaGljJyBpbjI9J2RzJyByZXN1bHQ9J3NoYXBlJy8+PC9maWx0ZXI+PC9kZWZzPjxn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wMDcgMjYuMTI3TDE1Ljk5OSAyNi4wMjZWMTUuMTI5WicgZmlsbD0nJTIzMDAwMDAwJy8+PC9nPjwvc3ZnPg==') !important;\n background-size: contain !important;\n background-position: top left !important;\n width: 54px !important;\n height: 59px !important;\n transition: left 0.15s cubic-bezier(0.25, 1, 0.5, 1), top 0.15s cubic-bezier(0.25, 1, 0.5, 1), width 0.2s ease-out, height 0.2s ease-out !important;\n }\n .replayer-mouse::after { display: none !important }\n .replayer-mouse.active { animation: macos-click 0.2s ease-out 1 !important }\n @keyframes macos-click { 0% { transform: scale(1) } 40% { transform: scale(0.7) } 100% { transform: scale(1) } }\n </style>\n</head>\n<body>\n <main style=\"max-width:${REPLAY_PLAYER_WIDTH_PX}px;margin:0 auto;padding:32px\">\n ${options.bodyHtml ?? \"\"}\n ${stepsSection}\n ${replaySection}\n </main>\n</body>\n</html>`;\n};\n","import { Schema } from \"effect\";\n\nexport class McpSessionNotOpenError extends Schema.ErrorClass<McpSessionNotOpenError>(\n \"McpSessionNotOpenError\",\n)({\n _tag: Schema.tag(\"McpSessionNotOpenError\"),\n}) {\n message = \"No browser open. Call the 'open' tool first.\";\n}\n\nexport class McpVideoSaveError extends Schema.ErrorClass<McpVideoSaveError>(\"McpVideoSaveError\")({\n _tag: Schema.tag(\"McpVideoSaveError\"),\n cause: Schema.String,\n}) {\n message = `Failed to save video: ${this.cause}`;\n}\n","import { createServer, type IncomingMessage, type Server, type ServerResponse } from \"node:http\";\nimport type { Page } from \"playwright\";\nimport type { eventWithTime } from \"@rrweb/types\";\nimport { Effect, Fiber, Predicate, PubSub, Schedule, Stream } from \"effect\";\nimport { EVENT_COLLECT_INTERVAL_MS } from \"../constants\";\nimport { buildReplayViewerHtml } from \"../replay-viewer\";\nimport { evaluateRuntime } from \"../utils/evaluate-runtime\";\nimport type { ViewerRunState } from \"./viewer-events\";\n\nconst isViewerRunState = (value: unknown): value is ViewerRunState =>\n Predicate.isObject(value) &&\n \"status\" in value &&\n \"steps\" in value &&\n Array.isArray((value as Record<string, unknown>).steps);\n\nexport interface LiveViewHandle {\n readonly url: string;\n readonly pushRunState: (state: ViewerRunState) => void;\n readonly getLatestRunState: () => ViewerRunState | undefined;\n readonly close: Effect.Effect<void>;\n}\n\nexport interface StartLiveViewServerOptions {\n readonly liveViewUrl: string;\n readonly getPage: () => Page | undefined;\n readonly onEventsCollected: (events: eventWithTime[]) => void;\n}\n\ntype SseClient = ServerResponse<IncomingMessage>;\n\nconst CORS_HEADERS = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"Content-Type\",\n} as const;\n\nconst NO_CACHE_HEADERS = { \"Cache-Control\": \"no-store\" } as const;\n\nconst listenServer = (server: Server, host: string, port: number) =>\n Effect.callback<void, Error>((resume) => {\n const onError = (error: Error) => resume(Effect.fail(error));\n server.once(\"error\", onError);\n server.listen({ host, port }, () => {\n server.off(\"error\", onError);\n resume(Effect.void);\n });\n });\n\nconst closeServer = (server: Server) =>\n Effect.callback<void>((resume) => {\n server.close(() => resume(Effect.void));\n });\n\nexport const startLiveViewServer = Effect.fn(\"LiveViewServer.start\")(function* (\n options: StartLiveViewServerOptions,\n) {\n const parsedUrl = new URL(options.liveViewUrl);\n const sseClients = new Set<SseClient>();\n const accumulatedReplayEvents: eventWithTime[] = [];\n let latestRunState: ViewerRunState | undefined;\n\n const stepsPubSub = yield* PubSub.unbounded<ViewerRunState>();\n\n const viewerHtml = buildReplayViewerHtml({\n title: \"Expect Live View\",\n eventsSource: \"sse\",\n });\n\n const broadcastSse = (eventType: string, data: string): void => {\n const message = `event: ${eventType}\\ndata: ${data}\\n\\n`;\n for (const client of sseClients) {\n if (client.destroyed) {\n sseClients.delete(client);\n continue;\n }\n try {\n client.write(message);\n } catch {\n sseClients.delete(client);\n client.end();\n }\n }\n };\n\n const broadcastReplayEvents = (events: eventWithTime[]): void => {\n if (events.length === 0) return;\n accumulatedReplayEvents.push(...events);\n options.onEventsCollected(events);\n broadcastSse(\"replay\", JSON.stringify(events));\n };\n\n const broadcastRunState = (state: ViewerRunState): void => {\n latestRunState = state;\n broadcastSse(\"steps\", JSON.stringify(state));\n };\n\n const handleSseRequest = (request: IncomingMessage, response: SseClient): void => {\n response.writeHead(200, {\n \"Content-Type\": \"text/event-stream\",\n Connection: \"keep-alive\",\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.flushHeaders();\n sseClients.add(response);\n request.on(\"close\", () => sseClients.delete(response));\n };\n\n const handleStepsPost = (request: IncomingMessage, response: SseClient): void => {\n const chunks: Buffer[] = [];\n request.on(\"data\", (chunk: Buffer) => chunks.push(chunk));\n request.on(\"end\", () => {\n try {\n const body = Buffer.concat(chunks).toString(\"utf-8\");\n const parsed: unknown = JSON.parse(body);\n if (!isViewerRunState(parsed)) {\n response.writeHead(400, {\n \"Content-Type\": \"text/plain\",\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(\"Invalid step state: missing status or steps\");\n return;\n }\n broadcastRunState(parsed);\n response.writeHead(204, { ...CORS_HEADERS, ...NO_CACHE_HEADERS });\n response.end();\n } catch {\n response.writeHead(400, {\n \"Content-Type\": \"text/plain\",\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(\"Invalid JSON\");\n }\n });\n };\n\n const routeRequest = (request: IncomingMessage, response: SseClient): void => {\n if (request.method === \"OPTIONS\") {\n response.writeHead(204, CORS_HEADERS);\n response.end();\n return;\n }\n\n const pathname = new URL(request.url ?? \"/\", parsedUrl).pathname;\n\n if (pathname === \"/\") {\n response.writeHead(200, {\n \"Content-Type\": \"text/html; charset=utf-8\",\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(viewerHtml);\n return;\n }\n\n if (pathname === \"/events\") {\n handleSseRequest(request, response);\n return;\n }\n\n if (pathname === \"/latest.json\") {\n const body = JSON.stringify(accumulatedReplayEvents);\n response.writeHead(200, {\n \"Content-Type\": \"application/json\",\n \"Content-Length\": Buffer.byteLength(body),\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(body);\n return;\n }\n\n if (pathname === \"/steps\") {\n if (request.method === \"POST\") {\n handleStepsPost(request, response);\n return;\n }\n const body = JSON.stringify(latestRunState ?? { title: \"\", status: \"running\", steps: [] });\n response.writeHead(200, {\n \"Content-Type\": \"application/json\",\n \"Content-Length\": Buffer.byteLength(body),\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(body);\n return;\n }\n\n response.writeHead(404, {\n \"Content-Type\": \"text/plain; charset=utf-8\",\n ...CORS_HEADERS,\n ...NO_CACHE_HEADERS,\n });\n response.end(\"Not found\");\n };\n\n const server = createServer(routeRequest);\n\n yield* listenServer(server, parsedUrl.hostname, Number(parsedUrl.port));\n\n const pollPage = Effect.sync(() => options.getPage()).pipe(\n Effect.flatMap((page) => {\n if (!page || page.isClosed()) return Effect.void;\n return evaluateRuntime(page, \"startRecording\").pipe(\n Effect.catchCause(() => Effect.void),\n Effect.flatMap(() => evaluateRuntime(page, \"getEvents\")),\n Effect.tap((events) =>\n Effect.sync(() => {\n if (Array.isArray(events) && events.length > 0) {\n broadcastReplayEvents(events);\n }\n }),\n ),\n Effect.catchCause((cause) => Effect.logDebug(\"Replay event collection failed\", { cause })),\n );\n }),\n );\n\n const replayPollFiber = yield* pollPage.pipe(\n Effect.repeat(Schedule.spaced(EVENT_COLLECT_INTERVAL_MS)),\n Effect.forkDetach,\n );\n\n const stepsBroadcastFiber = yield* Stream.fromPubSub(stepsPubSub).pipe(\n Stream.tap((state) => Effect.sync(() => broadcastRunState(state))),\n Stream.runDrain,\n Effect.forkDetach,\n );\n\n return {\n url: parsedUrl.toString(),\n pushRunState: (state: ViewerRunState) => {\n PubSub.publishUnsafe(stepsPubSub, state);\n },\n getLatestRunState: () => latestRunState,\n close: Effect.gen(function* () {\n yield* Fiber.interrupt(replayPollFiber);\n yield* Fiber.interrupt(stepsBroadcastFiber);\n for (const client of sseClients) client.end();\n sseClients.clear();\n yield* closeServer(server);\n }),\n } satisfies LiveViewHandle;\n});\n","import path from \"node:path\";\nimport type { Browser as PlaywrightBrowser, BrowserContext, Page } from \"playwright\";\nimport type { eventWithTime } from \"@rrweb/types\";\nimport { Config, Effect, Fiber, Layer, Option, Ref, Schedule, ServiceMap } from \"effect\";\nimport type { Cookie } from \"@expect/cookies\";\nimport { FileSystem } from \"effect/FileSystem\";\nimport { Browser } from \"../browser\";\nimport { NavigationError } from \"../errors\";\nimport { collectAllEvents } from \"../recorder\";\nimport { evaluateRuntime } from \"../utils/evaluate-runtime\";\nimport { EVENT_COLLECT_INTERVAL_MS } from \"../constants\";\nimport { buildReplayViewerHtml } from \"../replay-viewer\";\nimport type { AnnotatedScreenshotOptions, SnapshotOptions, SnapshotResult } from \"../types\";\nimport { EXPECT_LIVE_VIEW_URL_ENV_NAME, EXPECT_REPLAY_OUTPUT_ENV_NAME } from \"./constants\";\nimport { McpSessionNotOpenError } from \"./errors\";\nimport { startLiveViewServer, type LiveViewHandle } from \"./live-view-server\";\nimport type { ViewerRunState } from \"./viewer-events\";\n\ninterface ConsoleEntry {\n readonly type: string;\n readonly text: string;\n readonly timestamp: number;\n}\n\ninterface NetworkEntry {\n readonly url: string;\n readonly method: string;\n status: number | undefined;\n readonly resourceType: string;\n readonly timestamp: number;\n}\n\nexport interface BrowserSessionData {\n readonly browser: PlaywrightBrowser;\n readonly context: BrowserContext;\n readonly page: Page;\n readonly consoleMessages: ConsoleEntry[];\n readonly networkRequests: NetworkEntry[];\n readonly replayOutputPath: string | undefined;\n readonly accumulatedReplayEvents: eventWithTime[];\n readonly trackedPages: Set<Page>;\n lastSnapshot: SnapshotResult | undefined;\n}\n\nexport interface OpenOptions {\n headed?: boolean;\n cookies?: boolean;\n waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" | \"commit\";\n}\n\nexport interface OpenResult {\n readonly injectedCookieCount: number;\n}\n\nexport interface CloseResult {\n readonly replaySessionPath: string | undefined;\n readonly reportPath: string | undefined;\n readonly videoPath: string | undefined;\n readonly tmpReplaySessionPath: string | undefined;\n readonly tmpReportPath: string | undefined;\n readonly tmpVideoPath: string | undefined;\n}\n\nconst TMP_ARTIFACT_OUTPUT_DIRECTORY = \"/tmp/expect-replays\";\nconst PLAYWRIGHT_VIDEO_SUBDIRECTORY = \"playwright\";\n\nconst setupPageTracking = (page: Page, sessionData: BrowserSessionData) => {\n if (sessionData.trackedPages.has(page)) return;\n sessionData.trackedPages.add(page);\n\n page.on(\"console\", (message) => {\n sessionData.consoleMessages.push({\n type: message.type(),\n text: message.text(),\n timestamp: Date.now(),\n });\n });\n\n page.on(\"request\", (request) => {\n sessionData.networkRequests.push({\n url: request.url(),\n method: request.method(),\n status: undefined,\n resourceType: request.resourceType(),\n timestamp: Date.now(),\n });\n });\n\n page.on(\"response\", (response) => {\n const entry = sessionData.networkRequests.find(\n (networkEntry) => networkEntry.url === response.url() && networkEntry.status === undefined,\n );\n if (entry) entry.status = response.status();\n });\n};\n\nexport class McpSession extends ServiceMap.Service<McpSession>()(\"@browser/McpSession\", {\n make: Effect.gen(function* () {\n const browserService = yield* Browser;\n const fileSystem = yield* FileSystem;\n const replayOutputPath = yield* Config.option(Config.string(EXPECT_REPLAY_OUTPUT_ENV_NAME));\n const liveViewUrl = yield* Config.option(Config.string(EXPECT_LIVE_VIEW_URL_ENV_NAME));\n\n const sessionRef = yield* Ref.make<BrowserSessionData | undefined>(undefined);\n const liveViewRef = yield* Ref.make<LiveViewHandle | undefined>(undefined);\n const pollingFiberRef = yield* Ref.make<Fiber.Fiber<unknown> | undefined>(undefined);\n const latestRunStateRef = yield* Ref.make<ViewerRunState | undefined>(undefined);\n const preExtractedCookiesRef = yield* Ref.make<Cookie[] | undefined>(undefined);\n\n yield* browserService.preExtractCookies().pipe(\n Effect.tap((cookies) => Ref.set(preExtractedCookiesRef, cookies)),\n Effect.tap((cookies) => Effect.logInfo(\"Cookies pre-extracted\", { count: cookies.length })),\n Effect.catchCause(() => Effect.void),\n Effect.forkDetach,\n );\n\n const requireSession = Effect.fn(\"McpSession.requireSession\")(function* () {\n const session = yield* Ref.get(sessionRef);\n if (!session) return yield* new McpSessionNotOpenError();\n return session;\n });\n\n const requirePage = Effect.fn(\"McpSession.requirePage\")(function* () {\n return (yield* requireSession()).page;\n });\n\n const navigate = Effect.fn(\"McpSession.navigate\")(function* (\n url: string,\n options: { waitUntil?: \"load\" | \"domcontentloaded\" | \"networkidle\" | \"commit\" } = {},\n ) {\n const sessionData = yield* requireSession();\n yield* Effect.tryPromise({\n try: () => sessionData.page.goto(url, { waitUntil: options.waitUntil ?? \"load\" }),\n catch: (cause) =>\n new NavigationError({\n url,\n cause: cause instanceof Error ? cause.message : String(cause),\n }),\n });\n });\n\n const pushStepEvent = Effect.fn(\"McpSession.pushStepEvent\")(function* (state: ViewerRunState) {\n yield* Ref.set(latestRunStateRef, state);\n const liveView = yield* Ref.get(liveViewRef);\n if (liveView) {\n liveView.pushRunState(state);\n }\n });\n\n const open = Effect.fn(\"McpSession.open\")(function* (url: string, options: OpenOptions = {}) {\n yield* Effect.annotateCurrentSpan({ url });\n\n const preExtracted = options.cookies ? yield* Ref.get(preExtractedCookiesRef) : undefined;\n const cookiesOption =\n preExtracted && preExtracted.length > 0 ? preExtracted : options.cookies;\n const videoOutputDir = path.join(\n TMP_ARTIFACT_OUTPUT_DIRECTORY,\n PLAYWRIGHT_VIDEO_SUBDIRECTORY,\n );\n\n yield* fileSystem\n .makeDirectory(videoOutputDir, { recursive: true })\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to create Playwright video directory\", { cause }),\n ),\n );\n\n const pageResult = yield* browserService.createPage(url, {\n headed: options.headed,\n cookies: cookiesOption,\n waitUntil: options.waitUntil,\n videoOutputDir,\n });\n\n const sessionData: BrowserSessionData = {\n browser: pageResult.browser,\n context: pageResult.context,\n page: pageResult.page,\n consoleMessages: [],\n networkRequests: [],\n replayOutputPath: Option.getOrUndefined(replayOutputPath),\n accumulatedReplayEvents: [],\n trackedPages: new Set(),\n lastSnapshot: undefined,\n };\n setupPageTracking(pageResult.page, sessionData);\n yield* Ref.set(sessionRef, sessionData);\n\n yield* evaluateRuntime(pageResult.page, \"startRecording\").pipe(\n Effect.catchCause((cause) => Effect.logDebug(\"rrweb recording failed to start\", { cause })),\n );\n\n const existingLiveView = yield* Ref.get(liveViewRef);\n if (Option.isSome(liveViewUrl) && !existingLiveView) {\n const handle = yield* startLiveViewServer({\n liveViewUrl: liveViewUrl.value,\n getPage: () => Ref.getUnsafe(sessionRef)?.page,\n onEventsCollected: (events) => {\n Ref.getUnsafe(sessionRef)?.accumulatedReplayEvents.push(...events);\n },\n }).pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Live view server failed to start\", { cause }).pipe(\n Effect.as(undefined),\n ),\n ),\n );\n if (handle) {\n yield* Ref.set(liveViewRef, handle);\n }\n }\n\n const hasLiveView = Boolean(yield* Ref.get(liveViewRef));\n if (!hasLiveView) {\n const pollPage = Effect.sync(() => Ref.getUnsafe(sessionRef)?.page).pipe(\n Effect.flatMap((page) => {\n if (!page || page.isClosed()) return Effect.void;\n return evaluateRuntime(page, \"startRecording\").pipe(\n Effect.catchCause(() => Effect.void),\n Effect.flatMap(() => evaluateRuntime(page, \"getEvents\")),\n Effect.tap((events) =>\n Effect.sync(() => {\n if (Array.isArray(events) && events.length > 0) {\n Ref.getUnsafe(sessionRef)?.accumulatedReplayEvents.push(...events);\n }\n }),\n ),\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Replay event collection failed\", { cause }),\n ),\n );\n }),\n );\n\n const fiber = yield* pollPage.pipe(\n Effect.repeat(Schedule.spaced(EVENT_COLLECT_INTERVAL_MS)),\n Effect.forkDetach,\n );\n yield* Ref.set(pollingFiberRef, fiber);\n }\n\n const injectedCookieCount = yield* Effect.tryPromise(() => pageResult.context.cookies()).pipe(\n Effect.map((cookies) => cookies.length),\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to count cookies\", { cause }).pipe(Effect.as(0)),\n ),\n );\n\n return { injectedCookieCount } satisfies OpenResult;\n });\n\n const snapshot = Effect.fn(\"McpSession.snapshot\")(function* (\n page: Page,\n options?: SnapshotOptions,\n ) {\n return yield* browserService.snapshot(page, options);\n });\n\n const annotatedScreenshot = Effect.fn(\"McpSession.annotatedScreenshot\")(function* (\n page: Page,\n options?: AnnotatedScreenshotOptions,\n ) {\n return yield* browserService.annotatedScreenshot(page, options);\n });\n\n const updateLastSnapshot = Effect.fn(\"McpSession.updateLastSnapshot\")(function* (\n snapshotResult: SnapshotResult,\n ) {\n const sessionData = yield* requireSession();\n sessionData.lastSnapshot = snapshotResult;\n });\n\n const close = Effect.fn(\"McpSession.close\")(function* () {\n const activeSession = yield* Ref.get(sessionRef);\n if (!activeSession) return undefined;\n\n yield* Ref.set(sessionRef, undefined);\n\n const pollingFiber = yield* Ref.get(pollingFiberRef);\n if (pollingFiber) {\n yield* Fiber.interrupt(pollingFiber);\n yield* Ref.set(pollingFiberRef, undefined);\n }\n\n const liveView = yield* Ref.get(liveViewRef);\n if (liveView) {\n yield* liveView.close.pipe(\n Effect.catchCause((cause) => Effect.logDebug(\"Failed to close live view\", { cause })),\n );\n yield* Ref.set(liveViewRef, undefined);\n }\n\n let replaySessionPath: string | undefined;\n let reportPath: string | undefined;\n let videoPath: string | undefined;\n let tmpReplaySessionPath: string | undefined;\n let tmpReportPath: string | undefined;\n let tmpVideoPath: string | undefined;\n const pageVideo = activeSession.page.video();\n const artifactBaseName = activeSession.replayOutputPath\n ? path.basename(\n activeSession.replayOutputPath,\n path.extname(activeSession.replayOutputPath),\n )\n : `session-${Date.now()}`;\n\n yield* Effect.gen(function* () {\n if (!activeSession.page.isClosed()) {\n const finalEvents = yield* collectAllEvents(activeSession.page).pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to collect final replay events\", { cause }).pipe(\n Effect.as([] as ReadonlyArray<eventWithTime>),\n ),\n ),\n );\n if (finalEvents.length > 0) {\n activeSession.accumulatedReplayEvents.push(...finalEvents);\n }\n }\n\n const resolvedReplayOutputPath = activeSession.replayOutputPath;\n if (resolvedReplayOutputPath && activeSession.accumulatedReplayEvents.length > 0) {\n const ndjson =\n activeSession.accumulatedReplayEvents.map((event) => JSON.stringify(event)).join(\"\\n\") +\n \"\\n\";\n\n yield* fileSystem\n .makeDirectory(path.dirname(resolvedReplayOutputPath), { recursive: true })\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to create replay output directory\", { cause }),\n ),\n );\n yield* fileSystem\n .writeFileString(resolvedReplayOutputPath, ndjson)\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to write replay file\", { cause }),\n ),\n );\n replaySessionPath = resolvedReplayOutputPath;\n\n const runState = yield* Ref.get(latestRunStateRef);\n const replayFileName = path.basename(resolvedReplayOutputPath);\n const replayBaseName = path.basename(\n resolvedReplayOutputPath,\n path.extname(resolvedReplayOutputPath),\n );\n const htmlReportPath = path.join(\n path.dirname(resolvedReplayOutputPath),\n `${replayBaseName}.html`,\n );\n const reportHtml = buildReplayViewerHtml({\n title: runState ? `Test Report: ${runState.title}` : \"Expect Report\",\n eventsSource: { ndjsonPath: replayFileName },\n steps: runState,\n });\n\n yield* fileSystem\n .writeFileString(htmlReportPath, reportHtml)\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to write HTML report\", { cause }),\n ),\n );\n reportPath = htmlReportPath;\n\n const ndjsonJsPath = `${resolvedReplayOutputPath}.js`;\n const ndjsonJsContent = `window.__EXPECT_REPLAY_NDJSON__ = ${JSON.stringify(ndjson)};\\n`;\n yield* fileSystem\n .writeFileString(ndjsonJsPath, ndjsonJsContent)\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to write ndjson.js wrapper\", { cause }),\n ),\n );\n\n const tmpReplayPath = path.join(\n TMP_ARTIFACT_OUTPUT_DIRECTORY,\n `${replayBaseName}.ndjson`,\n );\n const tmpReportFilePath = path.join(\n TMP_ARTIFACT_OUTPUT_DIRECTORY,\n `${replayBaseName}.html`,\n );\n const tmpNdjsonJsPath = `${tmpReplayPath}.js`;\n\n yield* fileSystem\n .makeDirectory(TMP_ARTIFACT_OUTPUT_DIRECTORY, { recursive: true })\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to create /tmp artifact directory\", { cause }),\n ),\n );\n yield* fileSystem.copyFile(resolvedReplayOutputPath, tmpReplayPath).pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n tmpReplaySessionPath = tmpReplayPath;\n }),\n ),\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to copy replay to /tmp\", { cause }),\n ),\n );\n yield* fileSystem.copyFile(htmlReportPath, tmpReportFilePath).pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n tmpReportPath = tmpReportFilePath;\n }),\n ),\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to copy report to /tmp\", { cause }),\n ),\n );\n yield* fileSystem\n .copyFile(ndjsonJsPath, tmpNdjsonJsPath)\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to copy ndjson.js to /tmp\", { cause }),\n ),\n );\n }\n }).pipe(\n Effect.catchCause((cause) => Effect.logDebug(\"Failed during close cleanup\", { cause })),\n );\n\n yield* Effect.tryPromise(() => activeSession.browser.close()).pipe(\n Effect.catchCause((cause) => Effect.logDebug(\"Failed to close browser\", { cause })),\n );\n\n if (pageVideo) {\n videoPath = yield* Effect.tryPromise(() => pageVideo.path()).pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to resolve Playwright video path\", { cause }).pipe(\n Effect.as(undefined),\n ),\n ),\n );\n\n if (videoPath) {\n const tmpVideoFilePath = path.join(\n TMP_ARTIFACT_OUTPUT_DIRECTORY,\n `${artifactBaseName}.webm`,\n );\n yield* fileSystem\n .makeDirectory(TMP_ARTIFACT_OUTPUT_DIRECTORY, { recursive: true })\n .pipe(\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to create /tmp artifact directory\", { cause }),\n ),\n );\n yield* fileSystem.copyFile(videoPath, tmpVideoFilePath).pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n tmpVideoPath = tmpVideoFilePath;\n }),\n ),\n Effect.catchCause((cause) =>\n Effect.logDebug(\"Failed to copy Playwright video to /tmp\", { cause }),\n ),\n );\n }\n }\n\n return {\n replaySessionPath,\n reportPath,\n videoPath,\n tmpReplaySessionPath,\n tmpReportPath,\n tmpVideoPath,\n } satisfies CloseResult;\n });\n\n return {\n open,\n navigate,\n hasSession: () => Boolean(Ref.getUnsafe(sessionRef)),\n requirePage,\n requireSession,\n snapshot,\n annotatedScreenshot,\n updateLastSnapshot,\n pushStepEvent,\n close,\n } as const;\n }),\n}) {\n static layer = Layer.effect(this)(this.make).pipe(Layer.provide(Browser.layer));\n}\n","import { Layer, Logger, ManagedRuntime } from \"effect\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { McpSession } from \"./mcp-session\";\n\nconst StderrLoggerLayer = Layer.succeed(Logger.LogToStderr, true);\n\nexport const McpRuntime = ManagedRuntime.make(\n McpSession.layer.pipe(Layer.provide(StderrLoggerLayer), Layer.provide(NodeServices.layer)),\n);\n","// zod-compat.ts\n// ----------------------------------------------------\n// Unified types + helpers to accept Zod v3 and v4 (Mini)\n// ----------------------------------------------------\nimport * as z3rt from 'zod/v3';\nimport * as z4mini from 'zod/v4-mini';\n// --- Runtime detection ---\nexport function isZ4Schema(s) {\n // Present on Zod 4 (Classic & Mini) schemas; absent on Zod 3\n const schema = s;\n return !!schema._zod;\n}\n// --- Schema construction ---\nexport function objectFromShape(shape) {\n const values = Object.values(shape);\n if (values.length === 0)\n return z4mini.object({}); // default to v4 Mini\n const allV4 = values.every(isZ4Schema);\n const allV3 = values.every(s => !isZ4Schema(s));\n if (allV4)\n return z4mini.object(shape);\n if (allV3)\n return z3rt.object(shape);\n throw new Error('Mixed Zod versions detected in object shape.');\n}\n// --- Unified parsing ---\nexport function safeParse(schema, data) {\n if (isZ4Schema(schema)) {\n // Mini exposes top-level safeParse\n const result = z4mini.safeParse(schema, data);\n return result;\n }\n const v3Schema = schema;\n const result = v3Schema.safeParse(data);\n return result;\n}\nexport async function safeParseAsync(schema, data) {\n if (isZ4Schema(schema)) {\n // Mini exposes top-level safeParseAsync\n const result = await z4mini.safeParseAsync(schema, data);\n return result;\n }\n const v3Schema = schema;\n const result = await v3Schema.safeParseAsync(data);\n return result;\n}\n// --- Shape extraction ---\nexport function getObjectShape(schema) {\n if (!schema)\n return undefined;\n // Zod v3 exposes `.shape`; Zod v4 keeps the shape on `_zod.def.shape`\n let rawShape;\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n rawShape = v4Schema._zod?.def?.shape;\n }\n else {\n const v3Schema = schema;\n rawShape = v3Schema.shape;\n }\n if (!rawShape)\n return undefined;\n if (typeof rawShape === 'function') {\n try {\n return rawShape();\n }\n catch {\n return undefined;\n }\n }\n return rawShape;\n}\n// --- Schema normalization ---\n/**\n * Normalizes a schema to an object schema. Handles both:\n * - Already-constructed object schemas (v3 or v4)\n * - Raw shapes that need to be wrapped into object schemas\n */\nexport function normalizeObjectSchema(schema) {\n if (!schema)\n return undefined;\n // First check if it's a raw shape (Record<string, AnySchema>)\n // Raw shapes don't have _def or _zod properties and aren't schemas themselves\n if (typeof schema === 'object') {\n // Check if it's actually a ZodRawShapeCompat (not a schema instance)\n // by checking if it lacks schema-like internal properties\n const asV3 = schema;\n const asV4 = schema;\n // If it's not a schema instance (no _def or _zod), it might be a raw shape\n if (!asV3._def && !asV4._zod) {\n // Check if all values are schemas (heuristic to confirm it's a raw shape)\n const values = Object.values(schema);\n if (values.length > 0 &&\n values.every(v => typeof v === 'object' &&\n v !== null &&\n (v._def !== undefined ||\n v._zod !== undefined ||\n typeof v.parse === 'function'))) {\n return objectFromShape(schema);\n }\n }\n }\n // If we get here, it should be an AnySchema (not a raw shape)\n // Check if it's already an object schema\n if (isZ4Schema(schema)) {\n // Check if it's a v4 object\n const v4Schema = schema;\n const def = v4Schema._zod?.def;\n if (def && (def.type === 'object' || def.shape !== undefined)) {\n return schema;\n }\n }\n else {\n // Check if it's a v3 object\n const v3Schema = schema;\n if (v3Schema.shape !== undefined) {\n return schema;\n }\n }\n return undefined;\n}\n// --- Error message extraction ---\n/**\n * Safely extracts an error message from a parse result error.\n * Zod errors can have different structures, so we handle various cases.\n */\nexport function getParseErrorMessage(error) {\n if (error && typeof error === 'object') {\n // Try common error structures\n if ('message' in error && typeof error.message === 'string') {\n return error.message;\n }\n if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) {\n const firstIssue = error.issues[0];\n if (firstIssue && typeof firstIssue === 'object' && 'message' in firstIssue) {\n return String(firstIssue.message);\n }\n }\n // Fallback: try to stringify the error\n try {\n return JSON.stringify(error);\n }\n catch {\n return String(error);\n }\n }\n return String(error);\n}\n// --- Schema metadata access ---\n/**\n * Gets the description from a schema, if available.\n * Works with both Zod v3 and v4.\n *\n * Both versions expose a `.description` getter that returns the description\n * from their respective internal storage (v3: _def, v4: globalRegistry).\n */\nexport function getSchemaDescription(schema) {\n return schema.description;\n}\n/**\n * Checks if a schema is optional.\n * Works with both Zod v3 and v4.\n */\nexport function isSchemaOptional(schema) {\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n return v4Schema._zod?.def?.type === 'optional';\n }\n const v3Schema = schema;\n // v3 has isOptional() method\n if (typeof schema.isOptional === 'function') {\n return schema.isOptional();\n }\n return v3Schema._def?.typeName === 'ZodOptional';\n}\n/**\n * Gets the literal value from a schema, if it's a literal schema.\n * Works with both Zod v3 and v4.\n * Returns undefined if the schema is not a literal or the value cannot be determined.\n */\nexport function getLiteralValue(schema) {\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n const def = v4Schema._zod?.def;\n if (def) {\n // Try various ways to get the literal value\n if (def.value !== undefined)\n return def.value;\n if (Array.isArray(def.values) && def.values.length > 0) {\n return def.values[0];\n }\n }\n }\n const v3Schema = schema;\n const def = v3Schema._def;\n if (def) {\n if (def.value !== undefined)\n return def.value;\n if (Array.isArray(def.values) && def.values.length > 0) {\n return def.values[0];\n }\n }\n // Fallback: check for direct value property (some Zod versions)\n const directValue = schema.value;\n if (directValue !== undefined)\n return directValue;\n return undefined;\n}\n//# sourceMappingURL=zod-compat.js.map","import * as z from 'zod/v4';\nexport const LATEST_PROTOCOL_VERSION = '2025-11-25';\nexport const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';\nexport const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-06-18', '2025-03-26', '2024-11-05', '2024-10-07'];\nexport const RELATED_TASK_META_KEY = 'io.modelcontextprotocol/related-task';\n/* JSON-RPC types */\nexport const JSONRPC_VERSION = '2.0';\n/**\n * Assert 'object' type schema.\n *\n * @internal\n */\nconst AssertObjectSchema = z.custom((v) => v !== null && (typeof v === 'object' || typeof v === 'function'));\n/**\n * A progress token, used to associate progress notifications with the original request.\n */\nexport const ProgressTokenSchema = z.union([z.string(), z.number().int()]);\n/**\n * An opaque token used to represent a cursor for pagination.\n */\nexport const CursorSchema = z.string();\n/**\n * Task creation parameters, used to ask that the server create a task to represent a request.\n */\nexport const TaskCreationParamsSchema = z.looseObject({\n /**\n * Time in milliseconds to keep task results available after completion.\n * If null, the task has unlimited lifetime until manually cleaned up.\n */\n ttl: z.union([z.number(), z.null()]).optional(),\n /**\n * Time in milliseconds to wait between task status requests.\n */\n pollInterval: z.number().optional()\n});\nexport const TaskMetadataSchema = z.object({\n ttl: z.number().optional()\n});\n/**\n * Metadata for associating messages with a task.\n * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.\n */\nexport const RelatedTaskMetadataSchema = z.object({\n taskId: z.string()\n});\nconst RequestMetaSchema = z.looseObject({\n /**\n * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\n */\n progressToken: ProgressTokenSchema.optional(),\n /**\n * If specified, this request is related to the provided task.\n */\n [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()\n});\n/**\n * Common params for any request.\n */\nconst BaseRequestParamsSchema = z.object({\n /**\n * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.\n */\n _meta: RequestMetaSchema.optional()\n});\n/**\n * Common params for any task-augmented request.\n */\nexport const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * If specified, the caller is requesting task-augmented execution for this request.\n * The request will return a CreateTaskResult immediately, and the actual result can be\n * retrieved later via tasks/result.\n *\n * Task augmentation is subject to capability negotiation - receivers MUST declare support\n * for task augmentation of specific request types in their capabilities.\n */\n task: TaskMetadataSchema.optional()\n});\n/**\n * Checks if a value is a valid TaskAugmentedRequestParams.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid TaskAugmentedRequestParams, false otherwise.\n */\nexport const isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success;\nexport const RequestSchema = z.object({\n method: z.string(),\n params: BaseRequestParamsSchema.loose().optional()\n});\nconst NotificationsParamsSchema = z.object({\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: RequestMetaSchema.optional()\n});\nexport const NotificationSchema = z.object({\n method: z.string(),\n params: NotificationsParamsSchema.loose().optional()\n});\nexport const ResultSchema = z.looseObject({\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: RequestMetaSchema.optional()\n});\n/**\n * A uniquely identifying ID for a request in JSON-RPC.\n */\nexport const RequestIdSchema = z.union([z.string(), z.number().int()]);\n/**\n * A request that expects a response.\n */\nexport const JSONRPCRequestSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: RequestIdSchema,\n ...RequestSchema.shape\n})\n .strict();\nexport const isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success;\n/**\n * A notification which does not expect a response.\n */\nexport const JSONRPCNotificationSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n ...NotificationSchema.shape\n})\n .strict();\nexport const isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success;\n/**\n * A successful (non-error) response to a request.\n */\nexport const JSONRPCResultResponseSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: RequestIdSchema,\n result: ResultSchema\n})\n .strict();\n/**\n * Checks if a value is a valid JSONRPCResultResponse.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid JSONRPCResultResponse, false otherwise.\n */\nexport const isJSONRPCResultResponse = (value) => JSONRPCResultResponseSchema.safeParse(value).success;\n/**\n * @deprecated Use {@link isJSONRPCResultResponse} instead.\n *\n * Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse})\n */\nexport const isJSONRPCResponse = isJSONRPCResultResponse;\n/**\n * Error codes defined by the JSON-RPC specification.\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n // SDK error codes\n ErrorCode[ErrorCode[\"ConnectionClosed\"] = -32000] = \"ConnectionClosed\";\n ErrorCode[ErrorCode[\"RequestTimeout\"] = -32001] = \"RequestTimeout\";\n // Standard JSON-RPC error codes\n ErrorCode[ErrorCode[\"ParseError\"] = -32700] = \"ParseError\";\n ErrorCode[ErrorCode[\"InvalidRequest\"] = -32600] = \"InvalidRequest\";\n ErrorCode[ErrorCode[\"MethodNotFound\"] = -32601] = \"MethodNotFound\";\n ErrorCode[ErrorCode[\"InvalidParams\"] = -32602] = \"InvalidParams\";\n ErrorCode[ErrorCode[\"InternalError\"] = -32603] = \"InternalError\";\n // MCP-specific error codes\n ErrorCode[ErrorCode[\"UrlElicitationRequired\"] = -32042] = \"UrlElicitationRequired\";\n})(ErrorCode || (ErrorCode = {}));\n/**\n * A response to a request that indicates an error occurred.\n */\nexport const JSONRPCErrorResponseSchema = z\n .object({\n jsonrpc: z.literal(JSONRPC_VERSION),\n id: RequestIdSchema.optional(),\n error: z.object({\n /**\n * The error type that occurred.\n */\n code: z.number().int(),\n /**\n * A short description of the error. The message SHOULD be limited to a concise single sentence.\n */\n message: z.string(),\n /**\n * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\n */\n data: z.unknown().optional()\n })\n})\n .strict();\n/**\n * @deprecated Use {@link JSONRPCErrorResponseSchema} instead.\n */\nexport const JSONRPCErrorSchema = JSONRPCErrorResponseSchema;\n/**\n * Checks if a value is a valid JSONRPCErrorResponse.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid JSONRPCErrorResponse, false otherwise.\n */\nexport const isJSONRPCErrorResponse = (value) => JSONRPCErrorResponseSchema.safeParse(value).success;\n/**\n * @deprecated Use {@link isJSONRPCErrorResponse} instead.\n */\nexport const isJSONRPCError = isJSONRPCErrorResponse;\nexport const JSONRPCMessageSchema = z.union([\n JSONRPCRequestSchema,\n JSONRPCNotificationSchema,\n JSONRPCResultResponseSchema,\n JSONRPCErrorResponseSchema\n]);\nexport const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);\n/* Empty result */\n/**\n * A response that indicates success but carries no data.\n */\nexport const EmptyResultSchema = ResultSchema.strict();\nexport const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({\n /**\n * The ID of the request to cancel.\n *\n * This MUST correspond to the ID of a request previously issued in the same direction.\n */\n requestId: RequestIdSchema.optional(),\n /**\n * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\n */\n reason: z.string().optional()\n});\n/* Cancellation */\n/**\n * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n *\n * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n *\n * This notification indicates that the result will be unused, so any associated processing SHOULD cease.\n *\n * A client MUST NOT attempt to cancel its `initialize` request.\n */\nexport const CancelledNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/cancelled'),\n params: CancelledNotificationParamsSchema\n});\n/* Base Metadata */\n/**\n * Icon schema for use in tools, prompts, resources, and implementations.\n */\nexport const IconSchema = z.object({\n /**\n * URL or data URI for the icon.\n */\n src: z.string(),\n /**\n * Optional MIME type for the icon.\n */\n mimeType: z.string().optional(),\n /**\n * Optional array of strings that specify sizes at which the icon can be used.\n * Each string should be in WxH format (e.g., `\"48x48\"`, `\"96x96\"`) or `\"any\"` for scalable formats like SVG.\n *\n * If not provided, the client should assume that the icon can be used at any size.\n */\n sizes: z.array(z.string()).optional(),\n /**\n * Optional specifier for the theme this icon is designed for. `light` indicates\n * the icon is designed to be used with a light background, and `dark` indicates\n * the icon is designed to be used with a dark background.\n *\n * If not provided, the client should assume the icon can be used with any theme.\n */\n theme: z.enum(['light', 'dark']).optional()\n});\n/**\n * Base schema to add `icons` property.\n *\n */\nexport const IconsSchema = z.object({\n /**\n * Optional set of sized icons that the client can display in a user interface.\n *\n * Clients that support rendering icons MUST support at least the following MIME types:\n * - `image/png` - PNG images (safe, universal compatibility)\n * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)\n *\n * Clients that support rendering icons SHOULD also support:\n * - `image/svg+xml` - SVG images (scalable but requires security precautions)\n * - `image/webp` - WebP images (modern, efficient format)\n */\n icons: z.array(IconSchema).optional()\n});\n/**\n * Base metadata interface for common properties across resources, tools, prompts, and implementations.\n */\nexport const BaseMetadataSchema = z.object({\n /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */\n name: z.string(),\n /**\n * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\n * even by those unfamiliar with domain-specific terminology.\n *\n * If not provided, the name should be used for display (except for Tool,\n * where `annotations.title` should be given precedence over using `name`,\n * if present).\n */\n title: z.string().optional()\n});\n/* Initialization */\n/**\n * Describes the name and version of an MCP implementation.\n */\nexport const ImplementationSchema = BaseMetadataSchema.extend({\n ...BaseMetadataSchema.shape,\n ...IconsSchema.shape,\n version: z.string(),\n /**\n * An optional URL of the website for this implementation.\n */\n websiteUrl: z.string().optional(),\n /**\n * An optional human-readable description of what this implementation does.\n *\n * This can be used by clients or servers to provide context about their purpose\n * and capabilities. For example, a server might describe the types of resources\n * or tools it provides, while a client might describe its intended use case.\n */\n description: z.string().optional()\n});\nconst FormElicitationCapabilitySchema = z.intersection(z.object({\n applyDefaults: z.boolean().optional()\n}), z.record(z.string(), z.unknown()));\nconst ElicitationCapabilitySchema = z.preprocess(value => {\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n if (Object.keys(value).length === 0) {\n return { form: {} };\n }\n }\n return value;\n}, z.intersection(z.object({\n form: FormElicitationCapabilitySchema.optional(),\n url: AssertObjectSchema.optional()\n}), z.record(z.string(), z.unknown()).optional()));\n/**\n * Task capabilities for clients, indicating which request types support task creation.\n */\nexport const ClientTasksCapabilitySchema = z.looseObject({\n /**\n * Present if the client supports listing tasks.\n */\n list: AssertObjectSchema.optional(),\n /**\n * Present if the client supports cancelling tasks.\n */\n cancel: AssertObjectSchema.optional(),\n /**\n * Capabilities for task creation on specific request types.\n */\n requests: z\n .looseObject({\n /**\n * Task support for sampling requests.\n */\n sampling: z\n .looseObject({\n createMessage: AssertObjectSchema.optional()\n })\n .optional(),\n /**\n * Task support for elicitation requests.\n */\n elicitation: z\n .looseObject({\n create: AssertObjectSchema.optional()\n })\n .optional()\n })\n .optional()\n});\n/**\n * Task capabilities for servers, indicating which request types support task creation.\n */\nexport const ServerTasksCapabilitySchema = z.looseObject({\n /**\n * Present if the server supports listing tasks.\n */\n list: AssertObjectSchema.optional(),\n /**\n * Present if the server supports cancelling tasks.\n */\n cancel: AssertObjectSchema.optional(),\n /**\n * Capabilities for task creation on specific request types.\n */\n requests: z\n .looseObject({\n /**\n * Task support for tool requests.\n */\n tools: z\n .looseObject({\n call: AssertObjectSchema.optional()\n })\n .optional()\n })\n .optional()\n});\n/**\n * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.\n */\nexport const ClientCapabilitiesSchema = z.object({\n /**\n * Experimental, non-standard capabilities that the client supports.\n */\n experimental: z.record(z.string(), AssertObjectSchema).optional(),\n /**\n * Present if the client supports sampling from an LLM.\n */\n sampling: z\n .object({\n /**\n * Present if the client supports context inclusion via includeContext parameter.\n * If not declared, servers SHOULD only use `includeContext: \"none\"` (or omit it).\n */\n context: AssertObjectSchema.optional(),\n /**\n * Present if the client supports tool use via tools and toolChoice parameters.\n */\n tools: AssertObjectSchema.optional()\n })\n .optional(),\n /**\n * Present if the client supports eliciting user input.\n */\n elicitation: ElicitationCapabilitySchema.optional(),\n /**\n * Present if the client supports listing roots.\n */\n roots: z\n .object({\n /**\n * Whether the client supports issuing notifications for changes to the roots list.\n */\n listChanged: z.boolean().optional()\n })\n .optional(),\n /**\n * Present if the client supports task creation.\n */\n tasks: ClientTasksCapabilitySchema.optional()\n});\nexport const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\n */\n protocolVersion: z.string(),\n capabilities: ClientCapabilitiesSchema,\n clientInfo: ImplementationSchema\n});\n/**\n * This request is sent from the client to the server when it first connects, asking it to begin initialization.\n */\nexport const InitializeRequestSchema = RequestSchema.extend({\n method: z.literal('initialize'),\n params: InitializeRequestParamsSchema\n});\nexport const isInitializeRequest = (value) => InitializeRequestSchema.safeParse(value).success;\n/**\n * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.\n */\nexport const ServerCapabilitiesSchema = z.object({\n /**\n * Experimental, non-standard capabilities that the server supports.\n */\n experimental: z.record(z.string(), AssertObjectSchema).optional(),\n /**\n * Present if the server supports sending log messages to the client.\n */\n logging: AssertObjectSchema.optional(),\n /**\n * Present if the server supports sending completions to the client.\n */\n completions: AssertObjectSchema.optional(),\n /**\n * Present if the server offers any prompt templates.\n */\n prompts: z\n .object({\n /**\n * Whether this server supports issuing notifications for changes to the prompt list.\n */\n listChanged: z.boolean().optional()\n })\n .optional(),\n /**\n * Present if the server offers any resources to read.\n */\n resources: z\n .object({\n /**\n * Whether this server supports clients subscribing to resource updates.\n */\n subscribe: z.boolean().optional(),\n /**\n * Whether this server supports issuing notifications for changes to the resource list.\n */\n listChanged: z.boolean().optional()\n })\n .optional(),\n /**\n * Present if the server offers any tools to call.\n */\n tools: z\n .object({\n /**\n * Whether this server supports issuing notifications for changes to the tool list.\n */\n listChanged: z.boolean().optional()\n })\n .optional(),\n /**\n * Present if the server supports task creation.\n */\n tasks: ServerTasksCapabilitySchema.optional()\n});\n/**\n * After receiving an initialize request from the client, the server sends this response.\n */\nexport const InitializeResultSchema = ResultSchema.extend({\n /**\n * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.\n */\n protocolVersion: z.string(),\n capabilities: ServerCapabilitiesSchema,\n serverInfo: ImplementationSchema,\n /**\n * Instructions describing how to use the server and its features.\n *\n * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.\n */\n instructions: z.string().optional()\n});\n/**\n * This notification is sent from the client to the server after initialization has finished.\n */\nexport const InitializedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/initialized'),\n params: NotificationsParamsSchema.optional()\n});\nexport const isInitializedNotification = (value) => InitializedNotificationSchema.safeParse(value).success;\n/* Ping */\n/**\n * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.\n */\nexport const PingRequestSchema = RequestSchema.extend({\n method: z.literal('ping'),\n params: BaseRequestParamsSchema.optional()\n});\n/* Progress notifications */\nexport const ProgressSchema = z.object({\n /**\n * The progress thus far. This should increase every time progress is made, even if the total is unknown.\n */\n progress: z.number(),\n /**\n * Total number of items to process (or total progress required), if known.\n */\n total: z.optional(z.number()),\n /**\n * An optional message describing the current progress.\n */\n message: z.optional(z.string())\n});\nexport const ProgressNotificationParamsSchema = z.object({\n ...NotificationsParamsSchema.shape,\n ...ProgressSchema.shape,\n /**\n * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\n */\n progressToken: ProgressTokenSchema\n});\n/**\n * An out-of-band notification used to inform the receiver of a progress update for a long-running request.\n *\n * @category notifications/progress\n */\nexport const ProgressNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/progress'),\n params: ProgressNotificationParamsSchema\n});\nexport const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * An opaque token representing the current pagination position.\n * If provided, the server should return results starting after this cursor.\n */\n cursor: CursorSchema.optional()\n});\n/* Pagination */\nexport const PaginatedRequestSchema = RequestSchema.extend({\n params: PaginatedRequestParamsSchema.optional()\n});\nexport const PaginatedResultSchema = ResultSchema.extend({\n /**\n * An opaque token representing the pagination position after the last returned result.\n * If present, there may be more results available.\n */\n nextCursor: CursorSchema.optional()\n});\n/**\n * The status of a task.\n * */\nexport const TaskStatusSchema = z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']);\n/* Tasks */\n/**\n * A pollable state object associated with a request.\n */\nexport const TaskSchema = z.object({\n taskId: z.string(),\n status: TaskStatusSchema,\n /**\n * Time in milliseconds to keep task results available after completion.\n * If null, the task has unlimited lifetime until manually cleaned up.\n */\n ttl: z.union([z.number(), z.null()]),\n /**\n * ISO 8601 timestamp when the task was created.\n */\n createdAt: z.string(),\n /**\n * ISO 8601 timestamp when the task was last updated.\n */\n lastUpdatedAt: z.string(),\n pollInterval: z.optional(z.number()),\n /**\n * Optional diagnostic message for failed tasks or other status information.\n */\n statusMessage: z.optional(z.string())\n});\n/**\n * Result returned when a task is created, containing the task data wrapped in a task field.\n */\nexport const CreateTaskResultSchema = ResultSchema.extend({\n task: TaskSchema\n});\n/**\n * Parameters for task status notification.\n */\nexport const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);\n/**\n * A notification sent when a task's status changes.\n */\nexport const TaskStatusNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/tasks/status'),\n params: TaskStatusNotificationParamsSchema\n});\n/**\n * A request to get the state of a specific task.\n */\nexport const GetTaskRequestSchema = RequestSchema.extend({\n method: z.literal('tasks/get'),\n params: BaseRequestParamsSchema.extend({\n taskId: z.string()\n })\n});\n/**\n * The response to a tasks/get request.\n */\nexport const GetTaskResultSchema = ResultSchema.merge(TaskSchema);\n/**\n * A request to get the result of a specific task.\n */\nexport const GetTaskPayloadRequestSchema = RequestSchema.extend({\n method: z.literal('tasks/result'),\n params: BaseRequestParamsSchema.extend({\n taskId: z.string()\n })\n});\n/**\n * The response to a tasks/result request.\n * The structure matches the result type of the original request.\n * For example, a tools/call task would return the CallToolResult structure.\n *\n */\nexport const GetTaskPayloadResultSchema = ResultSchema.loose();\n/**\n * A request to list tasks.\n */\nexport const ListTasksRequestSchema = PaginatedRequestSchema.extend({\n method: z.literal('tasks/list')\n});\n/**\n * The response to a tasks/list request.\n */\nexport const ListTasksResultSchema = PaginatedResultSchema.extend({\n tasks: z.array(TaskSchema)\n});\n/**\n * A request to cancel a specific task.\n */\nexport const CancelTaskRequestSchema = RequestSchema.extend({\n method: z.literal('tasks/cancel'),\n params: BaseRequestParamsSchema.extend({\n taskId: z.string()\n })\n});\n/**\n * The response to a tasks/cancel request.\n */\nexport const CancelTaskResultSchema = ResultSchema.merge(TaskSchema);\n/* Resources */\n/**\n * The contents of a specific resource or sub-resource.\n */\nexport const ResourceContentsSchema = z.object({\n /**\n * The URI of this resource.\n */\n uri: z.string(),\n /**\n * The MIME type of this resource, if known.\n */\n mimeType: z.optional(z.string()),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\nexport const TextResourceContentsSchema = ResourceContentsSchema.extend({\n /**\n * The text of the item. This must only be set if the item can actually be represented as text (not binary data).\n */\n text: z.string()\n});\n/**\n * A Zod schema for validating Base64 strings that is more performant and\n * robust for very large inputs than the default regex-based check. It avoids\n * stack overflows by using the native `atob` function for validation.\n */\nconst Base64Schema = z.string().refine(val => {\n try {\n // atob throws a DOMException if the string contains characters\n // that are not part of the Base64 character set.\n atob(val);\n return true;\n }\n catch {\n return false;\n }\n}, { message: 'Invalid Base64 string' });\nexport const BlobResourceContentsSchema = ResourceContentsSchema.extend({\n /**\n * A base64-encoded string representing the binary data of the item.\n */\n blob: Base64Schema\n});\n/**\n * The sender or recipient of messages and data in a conversation.\n */\nexport const RoleSchema = z.enum(['user', 'assistant']);\n/**\n * Optional annotations providing clients additional context about a resource.\n */\nexport const AnnotationsSchema = z.object({\n /**\n * Intended audience(s) for the resource.\n */\n audience: z.array(RoleSchema).optional(),\n /**\n * Importance hint for the resource, from 0 (least) to 1 (most).\n */\n priority: z.number().min(0).max(1).optional(),\n /**\n * ISO 8601 timestamp for the most recent modification.\n */\n lastModified: z.iso.datetime({ offset: true }).optional()\n});\n/**\n * A known resource that the server is capable of reading.\n */\nexport const ResourceSchema = z.object({\n ...BaseMetadataSchema.shape,\n ...IconsSchema.shape,\n /**\n * The URI of this resource.\n */\n uri: z.string(),\n /**\n * A description of what this resource represents.\n *\n * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n */\n description: z.optional(z.string()),\n /**\n * The MIME type of this resource, if known.\n */\n mimeType: z.optional(z.string()),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.optional(z.looseObject({}))\n});\n/**\n * A template description for resources available on the server.\n */\nexport const ResourceTemplateSchema = z.object({\n ...BaseMetadataSchema.shape,\n ...IconsSchema.shape,\n /**\n * A URI template (according to RFC 6570) that can be used to construct resource URIs.\n */\n uriTemplate: z.string(),\n /**\n * A description of what this template is for.\n *\n * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n */\n description: z.optional(z.string()),\n /**\n * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.\n */\n mimeType: z.optional(z.string()),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.optional(z.looseObject({}))\n});\n/**\n * Sent from the client to request a list of resources the server has.\n */\nexport const ListResourcesRequestSchema = PaginatedRequestSchema.extend({\n method: z.literal('resources/list')\n});\n/**\n * The server's response to a resources/list request from the client.\n */\nexport const ListResourcesResultSchema = PaginatedResultSchema.extend({\n resources: z.array(ResourceSchema)\n});\n/**\n * Sent from the client to request a list of resource templates the server has.\n */\nexport const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({\n method: z.literal('resources/templates/list')\n});\n/**\n * The server's response to a resources/templates/list request from the client.\n */\nexport const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({\n resourceTemplates: z.array(ResourceTemplateSchema)\n});\nexport const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\n *\n * @format uri\n */\n uri: z.string()\n});\n/**\n * Parameters for a `resources/read` request.\n */\nexport const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;\n/**\n * Sent from the client to the server, to read a specific resource URI.\n */\nexport const ReadResourceRequestSchema = RequestSchema.extend({\n method: z.literal('resources/read'),\n params: ReadResourceRequestParamsSchema\n});\n/**\n * The server's response to a resources/read request from the client.\n */\nexport const ReadResourceResultSchema = ResultSchema.extend({\n contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema]))\n});\n/**\n * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const ResourceListChangedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/resources/list_changed'),\n params: NotificationsParamsSchema.optional()\n});\nexport const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;\n/**\n * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.\n */\nexport const SubscribeRequestSchema = RequestSchema.extend({\n method: z.literal('resources/subscribe'),\n params: SubscribeRequestParamsSchema\n});\nexport const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;\n/**\n * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.\n */\nexport const UnsubscribeRequestSchema = RequestSchema.extend({\n method: z.literal('resources/unsubscribe'),\n params: UnsubscribeRequestParamsSchema\n});\n/**\n * Parameters for a `notifications/resources/updated` notification.\n */\nexport const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({\n /**\n * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\n */\n uri: z.string()\n});\n/**\n * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.\n */\nexport const ResourceUpdatedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/resources/updated'),\n params: ResourceUpdatedNotificationParamsSchema\n});\n/* Prompts */\n/**\n * Describes an argument that a prompt can accept.\n */\nexport const PromptArgumentSchema = z.object({\n /**\n * The name of the argument.\n */\n name: z.string(),\n /**\n * A human-readable description of the argument.\n */\n description: z.optional(z.string()),\n /**\n * Whether this argument must be provided.\n */\n required: z.optional(z.boolean())\n});\n/**\n * A prompt or prompt template that the server offers.\n */\nexport const PromptSchema = z.object({\n ...BaseMetadataSchema.shape,\n ...IconsSchema.shape,\n /**\n * An optional description of what this prompt provides\n */\n description: z.optional(z.string()),\n /**\n * A list of arguments to use for templating the prompt.\n */\n arguments: z.optional(z.array(PromptArgumentSchema)),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.optional(z.looseObject({}))\n});\n/**\n * Sent from the client to request a list of prompts and prompt templates the server has.\n */\nexport const ListPromptsRequestSchema = PaginatedRequestSchema.extend({\n method: z.literal('prompts/list')\n});\n/**\n * The server's response to a prompts/list request from the client.\n */\nexport const ListPromptsResultSchema = PaginatedResultSchema.extend({\n prompts: z.array(PromptSchema)\n});\n/**\n * Parameters for a `prompts/get` request.\n */\nexport const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * The name of the prompt or prompt template.\n */\n name: z.string(),\n /**\n * Arguments to use for templating the prompt.\n */\n arguments: z.record(z.string(), z.string()).optional()\n});\n/**\n * Used by the client to get a prompt provided by the server.\n */\nexport const GetPromptRequestSchema = RequestSchema.extend({\n method: z.literal('prompts/get'),\n params: GetPromptRequestParamsSchema\n});\n/**\n * Text provided to or from an LLM.\n */\nexport const TextContentSchema = z.object({\n type: z.literal('text'),\n /**\n * The text content of the message.\n */\n text: z.string(),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * An image provided to or from an LLM.\n */\nexport const ImageContentSchema = z.object({\n type: z.literal('image'),\n /**\n * The base64-encoded image data.\n */\n data: Base64Schema,\n /**\n * The MIME type of the image. Different providers may support different image types.\n */\n mimeType: z.string(),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * An Audio provided to or from an LLM.\n */\nexport const AudioContentSchema = z.object({\n type: z.literal('audio'),\n /**\n * The base64-encoded audio data.\n */\n data: Base64Schema,\n /**\n * The MIME type of the audio. Different providers may support different audio types.\n */\n mimeType: z.string(),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * A tool call request from an assistant (LLM).\n * Represents the assistant's request to use a tool.\n */\nexport const ToolUseContentSchema = z.object({\n type: z.literal('tool_use'),\n /**\n * The name of the tool to invoke.\n * Must match a tool name from the request's tools array.\n */\n name: z.string(),\n /**\n * Unique identifier for this tool call.\n * Used to correlate with ToolResultContent in subsequent messages.\n */\n id: z.string(),\n /**\n * Arguments to pass to the tool.\n * Must conform to the tool's inputSchema.\n */\n input: z.record(z.string(), z.unknown()),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * The contents of a resource, embedded into a prompt or tool call result.\n */\nexport const EmbeddedResourceSchema = z.object({\n type: z.literal('resource'),\n resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),\n /**\n * Optional annotations for the client.\n */\n annotations: AnnotationsSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * A resource that the server is capable of reading, included in a prompt or tool call result.\n *\n * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.\n */\nexport const ResourceLinkSchema = ResourceSchema.extend({\n type: z.literal('resource_link')\n});\n/**\n * A content block that can be used in prompts and tool results.\n */\nexport const ContentBlockSchema = z.union([\n TextContentSchema,\n ImageContentSchema,\n AudioContentSchema,\n ResourceLinkSchema,\n EmbeddedResourceSchema\n]);\n/**\n * Describes a message returned as part of a prompt.\n */\nexport const PromptMessageSchema = z.object({\n role: RoleSchema,\n content: ContentBlockSchema\n});\n/**\n * The server's response to a prompts/get request from the client.\n */\nexport const GetPromptResultSchema = ResultSchema.extend({\n /**\n * An optional description for the prompt.\n */\n description: z.string().optional(),\n messages: z.array(PromptMessageSchema)\n});\n/**\n * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const PromptListChangedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/prompts/list_changed'),\n params: NotificationsParamsSchema.optional()\n});\n/* Tools */\n/**\n * Additional properties describing a Tool to clients.\n *\n * NOTE: all properties in ToolAnnotations are **hints**.\n * They are not guaranteed to provide a faithful description of\n * tool behavior (including descriptive properties like `title`).\n *\n * Clients should never make tool use decisions based on ToolAnnotations\n * received from untrusted servers.\n */\nexport const ToolAnnotationsSchema = z.object({\n /**\n * A human-readable title for the tool.\n */\n title: z.string().optional(),\n /**\n * If true, the tool does not modify its environment.\n *\n * Default: false\n */\n readOnlyHint: z.boolean().optional(),\n /**\n * If true, the tool may perform destructive updates to its environment.\n * If false, the tool performs only additive updates.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: true\n */\n destructiveHint: z.boolean().optional(),\n /**\n * If true, calling the tool repeatedly with the same arguments\n * will have no additional effect on the its environment.\n *\n * (This property is meaningful only when `readOnlyHint == false`)\n *\n * Default: false\n */\n idempotentHint: z.boolean().optional(),\n /**\n * If true, this tool may interact with an \"open world\" of external\n * entities. If false, the tool's domain of interaction is closed.\n * For example, the world of a web search tool is open, whereas that\n * of a memory tool is not.\n *\n * Default: true\n */\n openWorldHint: z.boolean().optional()\n});\n/**\n * Execution-related properties for a tool.\n */\nexport const ToolExecutionSchema = z.object({\n /**\n * Indicates the tool's preference for task-augmented execution.\n * - \"required\": Clients MUST invoke the tool as a task\n * - \"optional\": Clients MAY invoke the tool as a task or normal request\n * - \"forbidden\": Clients MUST NOT attempt to invoke the tool as a task\n *\n * If not present, defaults to \"forbidden\".\n */\n taskSupport: z.enum(['required', 'optional', 'forbidden']).optional()\n});\n/**\n * Definition for a tool the client can call.\n */\nexport const ToolSchema = z.object({\n ...BaseMetadataSchema.shape,\n ...IconsSchema.shape,\n /**\n * A human-readable description of the tool.\n */\n description: z.string().optional(),\n /**\n * A JSON Schema 2020-12 object defining the expected parameters for the tool.\n * Must have type: 'object' at the root level per MCP spec.\n */\n inputSchema: z\n .object({\n type: z.literal('object'),\n properties: z.record(z.string(), AssertObjectSchema).optional(),\n required: z.array(z.string()).optional()\n })\n .catchall(z.unknown()),\n /**\n * An optional JSON Schema 2020-12 object defining the structure of the tool's output\n * returned in the structuredContent field of a CallToolResult.\n * Must have type: 'object' at the root level per MCP spec.\n */\n outputSchema: z\n .object({\n type: z.literal('object'),\n properties: z.record(z.string(), AssertObjectSchema).optional(),\n required: z.array(z.string()).optional()\n })\n .catchall(z.unknown())\n .optional(),\n /**\n * Optional additional tool information.\n */\n annotations: ToolAnnotationsSchema.optional(),\n /**\n * Execution-related properties for this tool.\n */\n execution: ToolExecutionSchema.optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * Sent from the client to request a list of tools the server has.\n */\nexport const ListToolsRequestSchema = PaginatedRequestSchema.extend({\n method: z.literal('tools/list')\n});\n/**\n * The server's response to a tools/list request from the client.\n */\nexport const ListToolsResultSchema = PaginatedResultSchema.extend({\n tools: z.array(ToolSchema)\n});\n/**\n * The server's response to a tool call.\n */\nexport const CallToolResultSchema = ResultSchema.extend({\n /**\n * A list of content objects that represent the result of the tool call.\n *\n * If the Tool does not define an outputSchema, this field MUST be present in the result.\n * For backwards compatibility, this field is always present, but it may be empty.\n */\n content: z.array(ContentBlockSchema).default([]),\n /**\n * An object containing structured tool output.\n *\n * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.\n */\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n /**\n * Whether the tool call ended in an error.\n *\n * If not set, this is assumed to be false (the call was successful).\n *\n * Any errors that originate from the tool SHOULD be reported inside the result\n * object, with `isError` set to true, _not_ as an MCP protocol-level error\n * response. Otherwise, the LLM would not be able to see that an error occurred\n * and self-correct.\n *\n * However, any errors in _finding_ the tool, an error indicating that the\n * server does not support tool calls, or any other exceptional conditions,\n * should be reported as an MCP error response.\n */\n isError: z.boolean().optional()\n});\n/**\n * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.\n */\nexport const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({\n toolResult: z.unknown()\n}));\n/**\n * Parameters for a `tools/call` request.\n */\nexport const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n /**\n * The name of the tool to call.\n */\n name: z.string(),\n /**\n * Arguments to pass to the tool.\n */\n arguments: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * Used by the client to invoke a tool provided by the server.\n */\nexport const CallToolRequestSchema = RequestSchema.extend({\n method: z.literal('tools/call'),\n params: CallToolRequestParamsSchema\n});\n/**\n * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const ToolListChangedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/tools/list_changed'),\n params: NotificationsParamsSchema.optional()\n});\n/**\n * Base schema for list changed subscription options (without callback).\n * Used internally for Zod validation of autoRefresh and debounceMs.\n */\nexport const ListChangedOptionsBaseSchema = z.object({\n /**\n * If true, the list will be refreshed automatically when a list changed notification is received.\n * The callback will be called with the updated list.\n *\n * If false, the callback will be called with null items, allowing manual refresh.\n *\n * @default true\n */\n autoRefresh: z.boolean().default(true),\n /**\n * Debounce time in milliseconds for list changed notification processing.\n *\n * Multiple notifications received within this timeframe will only trigger one refresh.\n * Set to 0 to disable debouncing.\n *\n * @default 300\n */\n debounceMs: z.number().int().nonnegative().default(300)\n});\n/* Logging */\n/**\n * The severity of a log message.\n */\nexport const LoggingLevelSchema = z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']);\n/**\n * Parameters for a `logging/setLevel` request.\n */\nexport const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({\n /**\n * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message.\n */\n level: LoggingLevelSchema\n});\n/**\n * A request from the client to the server, to enable or adjust logging.\n */\nexport const SetLevelRequestSchema = RequestSchema.extend({\n method: z.literal('logging/setLevel'),\n params: SetLevelRequestParamsSchema\n});\n/**\n * Parameters for a `notifications/message` notification.\n */\nexport const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({\n /**\n * The severity of this log message.\n */\n level: LoggingLevelSchema,\n /**\n * An optional name of the logger issuing this message.\n */\n logger: z.string().optional(),\n /**\n * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\n */\n data: z.unknown()\n});\n/**\n * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.\n */\nexport const LoggingMessageNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/message'),\n params: LoggingMessageNotificationParamsSchema\n});\n/* Sampling */\n/**\n * Hints to use for model selection.\n */\nexport const ModelHintSchema = z.object({\n /**\n * A hint for a model name.\n */\n name: z.string().optional()\n});\n/**\n * The server's preferences for model selection, requested of the client during sampling.\n */\nexport const ModelPreferencesSchema = z.object({\n /**\n * Optional hints to use for model selection.\n */\n hints: z.array(ModelHintSchema).optional(),\n /**\n * How much to prioritize cost when selecting a model.\n */\n costPriority: z.number().min(0).max(1).optional(),\n /**\n * How much to prioritize sampling speed (latency) when selecting a model.\n */\n speedPriority: z.number().min(0).max(1).optional(),\n /**\n * How much to prioritize intelligence and capabilities when selecting a model.\n */\n intelligencePriority: z.number().min(0).max(1).optional()\n});\n/**\n * Controls tool usage behavior in sampling requests.\n */\nexport const ToolChoiceSchema = z.object({\n /**\n * Controls when tools are used:\n * - \"auto\": Model decides whether to use tools (default)\n * - \"required\": Model MUST use at least one tool before completing\n * - \"none\": Model MUST NOT use any tools\n */\n mode: z.enum(['auto', 'required', 'none']).optional()\n});\n/**\n * The result of a tool execution, provided by the user (server).\n * Represents the outcome of invoking a tool requested via ToolUseContent.\n */\nexport const ToolResultContentSchema = z.object({\n type: z.literal('tool_result'),\n toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'),\n content: z.array(ContentBlockSchema).default([]),\n structuredContent: z.object({}).loose().optional(),\n isError: z.boolean().optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * Basic content types for sampling responses (without tool use).\n * Used for backwards-compatible CreateMessageResult when tools are not used.\n */\nexport const SamplingContentSchema = z.discriminatedUnion('type', [TextContentSchema, ImageContentSchema, AudioContentSchema]);\n/**\n * Content block types allowed in sampling messages.\n * This includes text, image, audio, tool use requests, and tool results.\n */\nexport const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [\n TextContentSchema,\n ImageContentSchema,\n AudioContentSchema,\n ToolUseContentSchema,\n ToolResultContentSchema\n]);\n/**\n * Describes a message issued to or received from an LLM API.\n */\nexport const SamplingMessageSchema = z.object({\n role: RoleSchema,\n content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * Parameters for a `sampling/createMessage` request.\n */\nexport const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n messages: z.array(SamplingMessageSchema),\n /**\n * The server's preferences for which model to select. The client MAY modify or omit this request.\n */\n modelPreferences: ModelPreferencesSchema.optional(),\n /**\n * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\n */\n systemPrompt: z.string().optional(),\n /**\n * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.\n * The client MAY ignore this request.\n *\n * Default is \"none\". Values \"thisServer\" and \"allServers\" are soft-deprecated. Servers SHOULD only use these values if the client\n * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.\n */\n includeContext: z.enum(['none', 'thisServer', 'allServers']).optional(),\n temperature: z.number().optional(),\n /**\n * The requested maximum number of tokens to sample (to prevent runaway completions).\n *\n * The client MAY choose to sample fewer tokens than the requested maximum.\n */\n maxTokens: z.number().int(),\n stopSequences: z.array(z.string()).optional(),\n /**\n * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\n */\n metadata: AssertObjectSchema.optional(),\n /**\n * Tools that the model may use during generation.\n * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.\n */\n tools: z.array(ToolSchema).optional(),\n /**\n * Controls how the model uses tools.\n * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.\n * Default is `{ mode: \"auto\" }`.\n */\n toolChoice: ToolChoiceSchema.optional()\n});\n/**\n * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.\n */\nexport const CreateMessageRequestSchema = RequestSchema.extend({\n method: z.literal('sampling/createMessage'),\n params: CreateMessageRequestParamsSchema\n});\n/**\n * The client's response to a sampling/create_message request from the server.\n * This is the backwards-compatible version that returns single content (no arrays).\n * Used when the request does not include tools.\n */\nexport const CreateMessageResultSchema = ResultSchema.extend({\n /**\n * The name of the model that generated the message.\n */\n model: z.string(),\n /**\n * The reason why sampling stopped, if known.\n *\n * Standard values:\n * - \"endTurn\": Natural end of the assistant's turn\n * - \"stopSequence\": A stop sequence was encountered\n * - \"maxTokens\": Maximum token limit was reached\n *\n * This field is an open string to allow for provider-specific stop reasons.\n */\n stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())),\n role: RoleSchema,\n /**\n * Response content. Single content block (text, image, or audio).\n */\n content: SamplingContentSchema\n});\n/**\n * The client's response to a sampling/create_message request when tools were provided.\n * This version supports array content for tool use flows.\n */\nexport const CreateMessageResultWithToolsSchema = ResultSchema.extend({\n /**\n * The name of the model that generated the message.\n */\n model: z.string(),\n /**\n * The reason why sampling stopped, if known.\n *\n * Standard values:\n * - \"endTurn\": Natural end of the assistant's turn\n * - \"stopSequence\": A stop sequence was encountered\n * - \"maxTokens\": Maximum token limit was reached\n * - \"toolUse\": The model wants to use one or more tools\n *\n * This field is an open string to allow for provider-specific stop reasons.\n */\n stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens', 'toolUse']).or(z.string())),\n role: RoleSchema,\n /**\n * Response content. May be a single block or array. May include ToolUseContent if stopReason is \"toolUse\".\n */\n content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)])\n});\n/* Elicitation */\n/**\n * Primitive schema definition for boolean fields.\n */\nexport const BooleanSchemaSchema = z.object({\n type: z.literal('boolean'),\n title: z.string().optional(),\n description: z.string().optional(),\n default: z.boolean().optional()\n});\n/**\n * Primitive schema definition for string fields.\n */\nexport const StringSchemaSchema = z.object({\n type: z.literal('string'),\n title: z.string().optional(),\n description: z.string().optional(),\n minLength: z.number().optional(),\n maxLength: z.number().optional(),\n format: z.enum(['email', 'uri', 'date', 'date-time']).optional(),\n default: z.string().optional()\n});\n/**\n * Primitive schema definition for number fields.\n */\nexport const NumberSchemaSchema = z.object({\n type: z.enum(['number', 'integer']),\n title: z.string().optional(),\n description: z.string().optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional(),\n default: z.number().optional()\n});\n/**\n * Schema for single-selection enumeration without display titles for options.\n */\nexport const UntitledSingleSelectEnumSchemaSchema = z.object({\n type: z.literal('string'),\n title: z.string().optional(),\n description: z.string().optional(),\n enum: z.array(z.string()),\n default: z.string().optional()\n});\n/**\n * Schema for single-selection enumeration with display titles for each option.\n */\nexport const TitledSingleSelectEnumSchemaSchema = z.object({\n type: z.literal('string'),\n title: z.string().optional(),\n description: z.string().optional(),\n oneOf: z.array(z.object({\n const: z.string(),\n title: z.string()\n })),\n default: z.string().optional()\n});\n/**\n * Use TitledSingleSelectEnumSchema instead.\n * This interface will be removed in a future version.\n */\nexport const LegacyTitledEnumSchemaSchema = z.object({\n type: z.literal('string'),\n title: z.string().optional(),\n description: z.string().optional(),\n enum: z.array(z.string()),\n enumNames: z.array(z.string()).optional(),\n default: z.string().optional()\n});\n// Combined single selection enumeration\nexport const SingleSelectEnumSchemaSchema = z.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);\n/**\n * Schema for multiple-selection enumeration without display titles for options.\n */\nexport const UntitledMultiSelectEnumSchemaSchema = z.object({\n type: z.literal('array'),\n title: z.string().optional(),\n description: z.string().optional(),\n minItems: z.number().optional(),\n maxItems: z.number().optional(),\n items: z.object({\n type: z.literal('string'),\n enum: z.array(z.string())\n }),\n default: z.array(z.string()).optional()\n});\n/**\n * Schema for multiple-selection enumeration with display titles for each option.\n */\nexport const TitledMultiSelectEnumSchemaSchema = z.object({\n type: z.literal('array'),\n title: z.string().optional(),\n description: z.string().optional(),\n minItems: z.number().optional(),\n maxItems: z.number().optional(),\n items: z.object({\n anyOf: z.array(z.object({\n const: z.string(),\n title: z.string()\n }))\n }),\n default: z.array(z.string()).optional()\n});\n/**\n * Combined schema for multiple-selection enumeration\n */\nexport const MultiSelectEnumSchemaSchema = z.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);\n/**\n * Primitive schema definition for enum fields.\n */\nexport const EnumSchemaSchema = z.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);\n/**\n * Union of all primitive schema definitions.\n */\nexport const PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);\n/**\n * Parameters for an `elicitation/create` request for form-based elicitation.\n */\nexport const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n /**\n * The elicitation mode.\n *\n * Optional for backward compatibility. Clients MUST treat missing mode as \"form\".\n */\n mode: z.literal('form').optional(),\n /**\n * The message to present to the user describing what information is being requested.\n */\n message: z.string(),\n /**\n * A restricted subset of JSON Schema.\n * Only top-level properties are allowed, without nesting.\n */\n requestedSchema: z.object({\n type: z.literal('object'),\n properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),\n required: z.array(z.string()).optional()\n })\n});\n/**\n * Parameters for an `elicitation/create` request for URL-based elicitation.\n */\nexport const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n /**\n * The elicitation mode.\n */\n mode: z.literal('url'),\n /**\n * The message to present to the user explaining why the interaction is needed.\n */\n message: z.string(),\n /**\n * The ID of the elicitation, which must be unique within the context of the server.\n * The client MUST treat this ID as an opaque value.\n */\n elicitationId: z.string(),\n /**\n * The URL that the user should navigate to.\n */\n url: z.string().url()\n});\n/**\n * The parameters for a request to elicit additional information from the user via the client.\n */\nexport const ElicitRequestParamsSchema = z.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);\n/**\n * A request from the server to elicit user input via the client.\n * The client should present the message and form fields to the user (form mode)\n * or navigate to a URL (URL mode).\n */\nexport const ElicitRequestSchema = RequestSchema.extend({\n method: z.literal('elicitation/create'),\n params: ElicitRequestParamsSchema\n});\n/**\n * Parameters for a `notifications/elicitation/complete` notification.\n *\n * @category notifications/elicitation/complete\n */\nexport const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({\n /**\n * The ID of the elicitation that completed.\n */\n elicitationId: z.string()\n});\n/**\n * A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.\n *\n * @category notifications/elicitation/complete\n */\nexport const ElicitationCompleteNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/elicitation/complete'),\n params: ElicitationCompleteNotificationParamsSchema\n});\n/**\n * The client's response to an elicitation/create request from the server.\n */\nexport const ElicitResultSchema = ResultSchema.extend({\n /**\n * The user action in response to the elicitation.\n * - \"accept\": User submitted the form/confirmed the action\n * - \"decline\": User explicitly decline the action\n * - \"cancel\": User dismissed without making an explicit choice\n */\n action: z.enum(['accept', 'decline', 'cancel']),\n /**\n * The submitted form data, only present when action is \"accept\".\n * Contains values matching the requested schema.\n * Per MCP spec, content is \"typically omitted\" for decline/cancel actions.\n * We normalize null to undefined for leniency while maintaining type compatibility.\n */\n content: z.preprocess(val => (val === null ? undefined : val), z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional())\n});\n/* Autocomplete */\n/**\n * A reference to a resource or resource template definition.\n */\nexport const ResourceTemplateReferenceSchema = z.object({\n type: z.literal('ref/resource'),\n /**\n * The URI or URI template of the resource.\n */\n uri: z.string()\n});\n/**\n * @deprecated Use ResourceTemplateReferenceSchema instead\n */\nexport const ResourceReferenceSchema = ResourceTemplateReferenceSchema;\n/**\n * Identifies a prompt.\n */\nexport const PromptReferenceSchema = z.object({\n type: z.literal('ref/prompt'),\n /**\n * The name of the prompt or prompt template\n */\n name: z.string()\n});\n/**\n * Parameters for a `completion/complete` request.\n */\nexport const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({\n ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),\n /**\n * The argument's information\n */\n argument: z.object({\n /**\n * The name of the argument\n */\n name: z.string(),\n /**\n * The value of the argument to use for completion matching.\n */\n value: z.string()\n }),\n context: z\n .object({\n /**\n * Previously-resolved variables in a URI template or prompt.\n */\n arguments: z.record(z.string(), z.string()).optional()\n })\n .optional()\n});\n/**\n * A request from the client to the server, to ask for completion options.\n */\nexport const CompleteRequestSchema = RequestSchema.extend({\n method: z.literal('completion/complete'),\n params: CompleteRequestParamsSchema\n});\nexport function assertCompleteRequestPrompt(request) {\n if (request.params.ref.type !== 'ref/prompt') {\n throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);\n }\n void request;\n}\nexport function assertCompleteRequestResourceTemplate(request) {\n if (request.params.ref.type !== 'ref/resource') {\n throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);\n }\n void request;\n}\n/**\n * The server's response to a completion/complete request\n */\nexport const CompleteResultSchema = ResultSchema.extend({\n completion: z.looseObject({\n /**\n * An array of completion values. Must not exceed 100 items.\n */\n values: z.array(z.string()).max(100),\n /**\n * The total number of completion options available. This can exceed the number of values actually sent in the response.\n */\n total: z.optional(z.number().int()),\n /**\n * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\n */\n hasMore: z.optional(z.boolean())\n })\n});\n/* Roots */\n/**\n * Represents a root directory or file that the server can operate on.\n */\nexport const RootSchema = z.object({\n /**\n * The URI identifying the root. This *must* start with file:// for now.\n */\n uri: z.string().startsWith('file://'),\n /**\n * An optional name for the root.\n */\n name: z.string().optional(),\n /**\n * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n * for notes on _meta usage.\n */\n _meta: z.record(z.string(), z.unknown()).optional()\n});\n/**\n * Sent from the server to request a list of root URIs from the client.\n */\nexport const ListRootsRequestSchema = RequestSchema.extend({\n method: z.literal('roots/list'),\n params: BaseRequestParamsSchema.optional()\n});\n/**\n * The client's response to a roots/list request from the server.\n */\nexport const ListRootsResultSchema = ResultSchema.extend({\n roots: z.array(RootSchema)\n});\n/**\n * A notification from the client to the server, informing it that the list of roots has changed.\n */\nexport const RootsListChangedNotificationSchema = NotificationSchema.extend({\n method: z.literal('notifications/roots/list_changed'),\n params: NotificationsParamsSchema.optional()\n});\n/* Client messages */\nexport const ClientRequestSchema = z.union([\n PingRequestSchema,\n InitializeRequestSchema,\n CompleteRequestSchema,\n SetLevelRequestSchema,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListResourceTemplatesRequestSchema,\n ReadResourceRequestSchema,\n SubscribeRequestSchema,\n UnsubscribeRequestSchema,\n CallToolRequestSchema,\n ListToolsRequestSchema,\n GetTaskRequestSchema,\n GetTaskPayloadRequestSchema,\n ListTasksRequestSchema,\n CancelTaskRequestSchema\n]);\nexport const ClientNotificationSchema = z.union([\n CancelledNotificationSchema,\n ProgressNotificationSchema,\n InitializedNotificationSchema,\n RootsListChangedNotificationSchema,\n TaskStatusNotificationSchema\n]);\nexport const ClientResultSchema = z.union([\n EmptyResultSchema,\n CreateMessageResultSchema,\n CreateMessageResultWithToolsSchema,\n ElicitResultSchema,\n ListRootsResultSchema,\n GetTaskResultSchema,\n ListTasksResultSchema,\n CreateTaskResultSchema\n]);\n/* Server messages */\nexport const ServerRequestSchema = z.union([\n PingRequestSchema,\n CreateMessageRequestSchema,\n ElicitRequestSchema,\n ListRootsRequestSchema,\n GetTaskRequestSchema,\n GetTaskPayloadRequestSchema,\n ListTasksRequestSchema,\n CancelTaskRequestSchema\n]);\nexport const ServerNotificationSchema = z.union([\n CancelledNotificationSchema,\n ProgressNotificationSchema,\n LoggingMessageNotificationSchema,\n ResourceUpdatedNotificationSchema,\n ResourceListChangedNotificationSchema,\n ToolListChangedNotificationSchema,\n PromptListChangedNotificationSchema,\n TaskStatusNotificationSchema,\n ElicitationCompleteNotificationSchema\n]);\nexport const ServerResultSchema = z.union([\n EmptyResultSchema,\n InitializeResultSchema,\n CompleteResultSchema,\n GetPromptResultSchema,\n ListPromptsResultSchema,\n ListResourcesResultSchema,\n ListResourceTemplatesResultSchema,\n ReadResourceResultSchema,\n CallToolResultSchema,\n ListToolsResultSchema,\n GetTaskResultSchema,\n ListTasksResultSchema,\n CreateTaskResultSchema\n]);\nexport class McpError extends Error {\n constructor(code, message, data) {\n super(`MCP error ${code}: ${message}`);\n this.code = code;\n this.data = data;\n this.name = 'McpError';\n }\n /**\n * Factory method to create the appropriate error type based on the error code and data\n */\n static fromError(code, message, data) {\n // Check for specific error types\n if (code === ErrorCode.UrlElicitationRequired && data) {\n const errorData = data;\n if (errorData.elicitations) {\n return new UrlElicitationRequiredError(errorData.elicitations, message);\n }\n }\n // Default to generic McpError\n return new McpError(code, message, data);\n }\n}\n/**\n * Specialized error type when a tool requires a URL mode elicitation.\n * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.\n */\nexport class UrlElicitationRequiredError extends McpError {\n constructor(elicitations, message = `URL elicitation${elicitations.length > 1 ? 's' : ''} required`) {\n super(ErrorCode.UrlElicitationRequired, message, {\n elicitations: elicitations\n });\n }\n get elicitations() {\n return this.data?.elicitations ?? [];\n }\n}\n//# sourceMappingURL=types.js.map","/**\n * Experimental task interfaces for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n */\n/**\n * Checks if a task status represents a terminal state.\n * Terminal states are those where the task has finished and will not change.\n *\n * @param status - The task status to check\n * @returns True if the status is terminal (completed, failed, or cancelled)\n * @experimental\n */\nexport function isTerminal(status) {\n return status === 'completed' || status === 'failed' || status === 'cancelled';\n}\n//# sourceMappingURL=interfaces.js.map","export const ignoreOverride = Symbol(\"Let zodToJsonSchema decide on which parser to use\");\nexport const jsonDescription = (jsonSchema, def) => {\n if (def.description) {\n try {\n return {\n ...jsonSchema,\n ...JSON.parse(def.description),\n };\n }\n catch { }\n }\n return jsonSchema;\n};\nexport const defaultOptions = {\n name: undefined,\n $refStrategy: \"root\",\n basePath: [\"#\"],\n effectStrategy: \"input\",\n pipeStrategy: \"all\",\n dateStrategy: \"format:date-time\",\n mapStrategy: \"entries\",\n removeAdditionalStrategy: \"passthrough\",\n allowedAdditionalProperties: true,\n rejectedAdditionalProperties: false,\n definitionPath: \"definitions\",\n target: \"jsonSchema7\",\n strictUnions: false,\n definitions: {},\n errorMessages: false,\n markdownDescription: false,\n patternStrategy: \"escape\",\n applyRegexFlags: false,\n emailStrategy: \"format:email\",\n base64Strategy: \"contentEncoding:base64\",\n nameStrategy: \"ref\",\n openAiAnyTypeName: \"OpenAiAnyType\"\n};\nexport const getDefaultOptions = (options) => (typeof options === \"string\"\n ? {\n ...defaultOptions,\n name: options,\n }\n : {\n ...defaultOptions,\n ...options,\n });\n","import { getDefaultOptions } from \"./Options.js\";\nexport const getRefs = (options) => {\n const _options = getDefaultOptions(options);\n const currentPath = _options.name !== undefined\n ? [..._options.basePath, _options.definitionPath, _options.name]\n : _options.basePath;\n return {\n ..._options,\n flags: { hasReferencedOpenAiAnyType: false },\n currentPath: currentPath,\n propertyPath: undefined,\n seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [\n def._def,\n {\n def: def._def,\n path: [..._options.basePath, _options.definitionPath, name],\n // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.\n jsonSchema: undefined,\n },\n ])),\n };\n};\n","export function addErrorMessage(res, key, errorMessage, refs) {\n if (!refs?.errorMessages)\n return;\n if (errorMessage) {\n res.errorMessage = {\n ...res.errorMessage,\n [key]: errorMessage,\n };\n }\n}\nexport function setResponseValueAndErrors(res, key, value, errorMessage, refs) {\n res[key] = value;\n addErrorMessage(res, key, errorMessage, refs);\n}\n","export const getRelativePath = (pathA, pathB) => {\n let i = 0;\n for (; i < pathA.length && i < pathB.length; i++) {\n if (pathA[i] !== pathB[i])\n break;\n }\n return [(pathA.length - i).toString(), ...pathB.slice(i)].join(\"/\");\n};\n","import { getRelativePath } from \"../getRelativePath.js\";\nexport function parseAnyDef(refs) {\n if (refs.target !== \"openAi\") {\n return {};\n }\n const anyDefinitionPath = [\n ...refs.basePath,\n refs.definitionPath,\n refs.openAiAnyTypeName,\n ];\n refs.flags.hasReferencedOpenAiAnyType = true;\n return {\n $ref: refs.$refStrategy === \"relative\"\n ? getRelativePath(anyDefinitionPath, refs.currentPath)\n : anyDefinitionPath.join(\"/\"),\n };\n}\n","import { ZodFirstPartyTypeKind } from \"zod/v3\";\nimport { setResponseValueAndErrors } from \"../errorMessages.js\";\nimport { parseDef } from \"../parseDef.js\";\nexport function parseArrayDef(def, refs) {\n const res = {\n type: \"array\",\n };\n if (def.type?._def &&\n def.type?._def?.typeName !== ZodFirstPartyTypeKind.ZodAny) {\n res.items = parseDef(def.type._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\"],\n });\n }\n if (def.minLength) {\n setResponseValueAndErrors(res, \"minItems\", def.minLength.value, def.minLength.message, refs);\n }\n if (def.maxLength) {\n setResponseValueAndErrors(res, \"maxItems\", def.maxLength.value, def.maxLength.message, refs);\n }\n if (def.exactLength) {\n setResponseValueAndErrors(res, \"minItems\", def.exactLength.value, def.exactLength.message, refs);\n setResponseValueAndErrors(res, \"maxItems\", def.exactLength.value, def.exactLength.message, refs);\n }\n return res;\n}\n","import { setResponseValueAndErrors } from \"../errorMessages.js\";\nexport function parseBigintDef(def, refs) {\n const res = {\n type: \"integer\",\n format: \"int64\",\n };\n if (!def.checks)\n return res;\n for (const check of def.checks) {\n switch (check.kind) {\n case \"min\":\n if (refs.target === \"jsonSchema7\") {\n if (check.inclusive) {\n setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n }\n else {\n setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n }\n }\n else {\n if (!check.inclusive) {\n res.exclusiveMinimum = true;\n }\n setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n }\n break;\n case \"max\":\n if (refs.target === \"jsonSchema7\") {\n if (check.inclusive) {\n setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n }\n else {\n setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n }\n }\n else {\n if (!check.inclusive) {\n res.exclusiveMaximum = true;\n }\n setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n }\n break;\n case \"multipleOf\":\n setResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n break;\n }\n }\n return res;\n}\n","export function parseBooleanDef() {\n return {\n type: \"boolean\",\n };\n}\n","import { parseDef } from \"../parseDef.js\";\nexport function parseBrandedDef(_def, refs) {\n return parseDef(_def.type._def, refs);\n}\n","import { parseDef } from \"../parseDef.js\";\nexport const parseCatchDef = (def, refs) => {\n return parseDef(def.innerType._def, refs);\n};\n","import { setResponseValueAndErrors } from \"../errorMessages.js\";\nexport function parseDateDef(def, refs, overrideDateStrategy) {\n const strategy = overrideDateStrategy ?? refs.dateStrategy;\n if (Array.isArray(strategy)) {\n return {\n anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)),\n };\n }\n switch (strategy) {\n case \"string\":\n case \"format:date-time\":\n return {\n type: \"string\",\n format: \"date-time\",\n };\n case \"format:date\":\n return {\n type: \"string\",\n format: \"date\",\n };\n case \"integer\":\n return integerDateParser(def, refs);\n }\n}\nconst integerDateParser = (def, refs) => {\n const res = {\n type: \"integer\",\n format: \"unix-time\",\n };\n if (refs.target === \"openApi3\") {\n return res;\n }\n for (const check of def.checks) {\n switch (check.kind) {\n case \"min\":\n setResponseValueAndErrors(res, \"minimum\", check.value, // This is in milliseconds\n check.message, refs);\n break;\n case \"max\":\n setResponseValueAndErrors(res, \"maximum\", check.value, // This is in milliseconds\n check.message, refs);\n break;\n }\n }\n return res;\n};\n","import { parseDef } from \"../parseDef.js\";\nexport function parseDefaultDef(_def, refs) {\n return {\n ...parseDef(_def.innerType._def, refs),\n default: _def.defaultValue(),\n };\n}\n","import { parseDef } from \"../parseDef.js\";\nimport { parseAnyDef } from \"./any.js\";\nexport function parseEffectsDef(_def, refs) {\n return refs.effectStrategy === \"input\"\n ? parseDef(_def.schema._def, refs)\n : parseAnyDef(refs);\n}\n","export function parseEnumDef(def) {\n return {\n type: \"string\",\n enum: Array.from(def.values),\n };\n}\n","import { parseDef } from \"../parseDef.js\";\nconst isJsonSchema7AllOfType = (type) => {\n if (\"type\" in type && type.type === \"string\")\n return false;\n return \"allOf\" in type;\n};\nexport function parseIntersectionDef(def, refs) {\n const allOf = [\n parseDef(def.left._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"0\"],\n }),\n parseDef(def.right._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"1\"],\n }),\n ].filter((x) => !!x);\n let unevaluatedProperties = refs.target === \"jsonSchema2019-09\"\n ? { unevaluatedProperties: false }\n : undefined;\n const mergedAllOf = [];\n // If either of the schemas is an allOf, merge them into a single allOf\n allOf.forEach((schema) => {\n if (isJsonSchema7AllOfType(schema)) {\n mergedAllOf.push(...schema.allOf);\n if (schema.unevaluatedProperties === undefined) {\n // If one of the schemas has no unevaluatedProperties set,\n // the merged schema should also have no unevaluatedProperties set\n unevaluatedProperties = undefined;\n }\n }\n else {\n let nestedSchema = schema;\n if (\"additionalProperties\" in schema &&\n schema.additionalProperties === false) {\n const { additionalProperties, ...rest } = schema;\n nestedSchema = rest;\n }\n else {\n // As soon as one of the schemas has additionalProperties set not to false, we allow unevaluatedProperties\n unevaluatedProperties = undefined;\n }\n mergedAllOf.push(nestedSchema);\n }\n });\n return mergedAllOf.length\n ? {\n allOf: mergedAllOf,\n ...unevaluatedProperties,\n }\n : undefined;\n}\n","export function parseLiteralDef(def, refs) {\n const parsedType = typeof def.value;\n if (parsedType !== \"bigint\" &&\n parsedType !== \"number\" &&\n parsedType !== \"boolean\" &&\n parsedType !== \"string\") {\n return {\n type: Array.isArray(def.value) ? \"array\" : \"object\",\n };\n }\n if (refs.target === \"openApi3\") {\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n enum: [def.value],\n };\n }\n return {\n type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n const: def.value,\n };\n}\n","import { setResponseValueAndErrors } from \"../errorMessages.js\";\nlet emojiRegex = undefined;\n/**\n * Generated from the regular expressions found here as of 2024-05-22:\n * https://github.com/colinhacks/zod/blob/master/src/types.ts.\n *\n * Expressions with /i flag have been changed accordingly.\n */\nexport const zodPatterns = {\n /**\n * `c` was changed to `[cC]` to replicate /i flag\n */\n cuid: /^[cC][^\\s-]{8,}$/,\n cuid2: /^[0-9a-z]+$/,\n ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n /**\n * `a-z` was added to replicate /i flag\n */\n email: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n /**\n * Constructed a valid Unicode RegExp\n *\n * Lazily instantiate since this type of regex isn't supported\n * in all envs (e.g. React Native).\n *\n * See:\n * https://github.com/colinhacks/zod/issues/2433\n * Fix in Zod:\n * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b\n */\n emoji: () => {\n if (emojiRegex === undefined) {\n emojiRegex = RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\", \"u\");\n }\n return emojiRegex;\n },\n /**\n * Unused\n */\n 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}$/,\n /**\n * Unused\n */\n 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])$/,\n 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])$/,\n /**\n * Unused\n */\n 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})))$/,\n 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])$/,\n base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n nanoid: /^[a-zA-Z0-9_-]{21}$/,\n jwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n};\nexport function parseStringDef(def, refs) {\n const res = {\n type: \"string\",\n };\n if (def.checks) {\n for (const check of def.checks) {\n switch (check.kind) {\n case \"min\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"max\":\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"email\":\n switch (refs.emailStrategy) {\n case \"format:email\":\n addFormat(res, \"email\", check.message, refs);\n break;\n case \"format:idn-email\":\n addFormat(res, \"idn-email\", check.message, refs);\n break;\n case \"pattern:zod\":\n addPattern(res, zodPatterns.email, check.message, refs);\n break;\n }\n break;\n case \"url\":\n addFormat(res, \"uri\", check.message, refs);\n break;\n case \"uuid\":\n addFormat(res, \"uuid\", check.message, refs);\n break;\n case \"regex\":\n addPattern(res, check.regex, check.message, refs);\n break;\n case \"cuid\":\n addPattern(res, zodPatterns.cuid, check.message, refs);\n break;\n case \"cuid2\":\n addPattern(res, zodPatterns.cuid2, check.message, refs);\n break;\n case \"startsWith\":\n addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);\n break;\n case \"endsWith\":\n addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);\n break;\n case \"datetime\":\n addFormat(res, \"date-time\", check.message, refs);\n break;\n case \"date\":\n addFormat(res, \"date\", check.message, refs);\n break;\n case \"time\":\n addFormat(res, \"time\", check.message, refs);\n break;\n case \"duration\":\n addFormat(res, \"duration\", check.message, refs);\n break;\n case \"length\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"includes\": {\n addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);\n break;\n }\n case \"ip\": {\n if (check.version !== \"v6\") {\n addFormat(res, \"ipv4\", check.message, refs);\n }\n if (check.version !== \"v4\") {\n addFormat(res, \"ipv6\", check.message, refs);\n }\n break;\n }\n case \"base64url\":\n addPattern(res, zodPatterns.base64url, check.message, refs);\n break;\n case \"jwt\":\n addPattern(res, zodPatterns.jwt, check.message, refs);\n break;\n case \"cidr\": {\n if (check.version !== \"v6\") {\n addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);\n }\n if (check.version !== \"v4\") {\n addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);\n }\n break;\n }\n case \"emoji\":\n addPattern(res, zodPatterns.emoji(), check.message, refs);\n break;\n case \"ulid\": {\n addPattern(res, zodPatterns.ulid, check.message, refs);\n break;\n }\n case \"base64\": {\n switch (refs.base64Strategy) {\n case \"format:binary\": {\n addFormat(res, \"binary\", check.message, refs);\n break;\n }\n case \"contentEncoding:base64\": {\n setResponseValueAndErrors(res, \"contentEncoding\", \"base64\", check.message, refs);\n break;\n }\n case \"pattern:zod\": {\n addPattern(res, zodPatterns.base64, check.message, refs);\n break;\n }\n }\n break;\n }\n case \"nanoid\": {\n addPattern(res, zodPatterns.nanoid, check.message, refs);\n }\n case \"toLowerCase\":\n case \"toUpperCase\":\n case \"trim\":\n break;\n default:\n ((_) => { })(check);\n }\n }\n }\n return res;\n}\nfunction escapeLiteralCheckValue(literal, refs) {\n return refs.patternStrategy === \"escape\"\n ? escapeNonAlphaNumeric(literal)\n : literal;\n}\nconst ALPHA_NUMERIC = new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");\nfunction escapeNonAlphaNumeric(source) {\n let result = \"\";\n for (let i = 0; i < source.length; i++) {\n if (!ALPHA_NUMERIC.has(source[i])) {\n result += \"\\\\\";\n }\n result += source[i];\n }\n return result;\n}\n// Adds a \"format\" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.\nfunction addFormat(schema, value, message, refs) {\n if (schema.format || schema.anyOf?.some((x) => x.format)) {\n if (!schema.anyOf) {\n schema.anyOf = [];\n }\n if (schema.format) {\n schema.anyOf.push({\n format: schema.format,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { format: schema.errorMessage.format },\n }),\n });\n delete schema.format;\n if (schema.errorMessage) {\n delete schema.errorMessage.format;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.anyOf.push({\n format: value,\n ...(message &&\n refs.errorMessages && { errorMessage: { format: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"format\", value, message, refs);\n }\n}\n// Adds a \"pattern\" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.\nfunction addPattern(schema, regex, message, refs) {\n if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {\n if (!schema.allOf) {\n schema.allOf = [];\n }\n if (schema.pattern) {\n schema.allOf.push({\n pattern: schema.pattern,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { pattern: schema.errorMessage.pattern },\n }),\n });\n delete schema.pattern;\n if (schema.errorMessage) {\n delete schema.errorMessage.pattern;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.allOf.push({\n pattern: stringifyRegExpWithFlags(regex, refs),\n ...(message &&\n refs.errorMessages && { errorMessage: { pattern: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"pattern\", stringifyRegExpWithFlags(regex, refs), message, refs);\n }\n}\n// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true\nfunction stringifyRegExpWithFlags(regex, refs) {\n if (!refs.applyRegexFlags || !regex.flags) {\n return regex.source;\n }\n // Currently handled flags\n const flags = {\n i: regex.flags.includes(\"i\"),\n m: regex.flags.includes(\"m\"),\n s: regex.flags.includes(\"s\"), // `.` matches newlines\n };\n // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!\n const source = flags.i ? regex.source.toLowerCase() : regex.source;\n let pattern = \"\";\n let isEscaped = false;\n let inCharGroup = false;\n let inCharRange = false;\n for (let i = 0; i < source.length; i++) {\n if (isEscaped) {\n pattern += source[i];\n isEscaped = false;\n continue;\n }\n if (flags.i) {\n if (inCharGroup) {\n if (source[i].match(/[a-z]/)) {\n if (inCharRange) {\n pattern += source[i];\n pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();\n inCharRange = false;\n }\n else if (source[i + 1] === \"-\" && source[i + 2]?.match(/[a-z]/)) {\n pattern += source[i];\n inCharRange = true;\n }\n else {\n pattern += `${source[i]}${source[i].toUpperCase()}`;\n }\n continue;\n }\n }\n else if (source[i].match(/[a-z]/)) {\n pattern += `[${source[i]}${source[i].toUpperCase()}]`;\n continue;\n }\n }\n if (flags.m) {\n if (source[i] === \"^\") {\n pattern += `(^|(?<=[\\r\\n]))`;\n continue;\n }\n else if (source[i] === \"$\") {\n pattern += `($|(?=[\\r\\n]))`;\n continue;\n }\n }\n if (flags.s && source[i] === \".\") {\n pattern += inCharGroup ? `${source[i]}\\r\\n` : `[${source[i]}\\r\\n]`;\n continue;\n }\n pattern += source[i];\n if (source[i] === \"\\\\\") {\n isEscaped = true;\n }\n else if (inCharGroup && source[i] === \"]\") {\n inCharGroup = false;\n }\n else if (!inCharGroup && source[i] === \"[\") {\n inCharGroup = true;\n }\n }\n try {\n new RegExp(pattern);\n }\n catch {\n console.warn(`Could not convert regex pattern at ${refs.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`);\n return regex.source;\n }\n return pattern;\n}\n","import { ZodFirstPartyTypeKind, } from \"zod/v3\";\nimport { parseDef } from \"../parseDef.js\";\nimport { parseStringDef } from \"./string.js\";\nimport { parseBrandedDef } from \"./branded.js\";\nimport { parseAnyDef } from \"./any.js\";\nexport function parseRecordDef(def, refs) {\n if (refs.target === \"openAi\") {\n console.warn(\"Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.\");\n }\n if (refs.target === \"openApi3\" &&\n def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {\n return {\n type: \"object\",\n required: def.keyType._def.values,\n properties: def.keyType._def.values.reduce((acc, key) => ({\n ...acc,\n [key]: parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"properties\", key],\n }) ?? parseAnyDef(refs),\n }), {}),\n additionalProperties: refs.rejectedAdditionalProperties,\n };\n }\n const schema = {\n type: \"object\",\n additionalProperties: parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"additionalProperties\"],\n }) ?? refs.allowedAdditionalProperties,\n };\n if (refs.target === \"openApi3\") {\n return schema;\n }\n if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString &&\n def.keyType._def.checks?.length) {\n const { type, ...keyType } = parseStringDef(def.keyType._def, refs);\n return {\n ...schema,\n propertyNames: keyType,\n };\n }\n else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) {\n return {\n ...schema,\n propertyNames: {\n enum: def.keyType._def.values,\n },\n };\n }\n else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded &&\n def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString &&\n def.keyType._def.type._def.checks?.length) {\n const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);\n return {\n ...schema,\n propertyNames: keyType,\n };\n }\n return schema;\n}\n","import { parseDef } from \"../parseDef.js\";\nimport { parseRecordDef } from \"./record.js\";\nimport { parseAnyDef } from \"./any.js\";\nexport function parseMapDef(def, refs) {\n if (refs.mapStrategy === \"record\") {\n return parseRecordDef(def, refs);\n }\n const keys = parseDef(def.keyType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"0\"],\n }) || parseAnyDef(refs);\n const values = parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", \"items\", \"1\"],\n }) || parseAnyDef(refs);\n return {\n type: \"array\",\n maxItems: 125,\n items: {\n type: \"array\",\n items: [keys, values],\n minItems: 2,\n maxItems: 2,\n },\n };\n}\n","export function parseNativeEnumDef(def) {\n const object = def.values;\n const actualKeys = Object.keys(def.values).filter((key) => {\n return typeof object[object[key]] !== \"number\";\n });\n const actualValues = actualKeys.map((key) => object[key]);\n const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));\n return {\n type: parsedTypes.length === 1\n ? parsedTypes[0] === \"string\"\n ? \"string\"\n : \"number\"\n : [\"string\", \"number\"],\n enum: actualValues,\n };\n}\n","import { parseAnyDef } from \"./any.js\";\nexport function parseNeverDef(refs) {\n return refs.target === \"openAi\"\n ? undefined\n : {\n not: parseAnyDef({\n ...refs,\n currentPath: [...refs.currentPath, \"not\"],\n }),\n };\n}\n","export function parseNullDef(refs) {\n return refs.target === \"openApi3\"\n ? {\n enum: [\"null\"],\n nullable: true,\n }\n : {\n type: \"null\",\n };\n}\n","import { parseDef } from \"../parseDef.js\";\nexport const primitiveMappings = {\n ZodString: \"string\",\n ZodNumber: \"number\",\n ZodBigInt: \"integer\",\n ZodBoolean: \"boolean\",\n ZodNull: \"null\",\n};\nexport function parseUnionDef(def, refs) {\n if (refs.target === \"openApi3\")\n return asAnyOf(def, refs);\n const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;\n // This blocks tries to look ahead a bit to produce nicer looking schemas with type array instead of anyOf.\n if (options.every((x) => x._def.typeName in primitiveMappings &&\n (!x._def.checks || !x._def.checks.length))) {\n // all types in union are primitive and lack checks, so might as well squash into {type: [...]}\n const types = options.reduce((types, x) => {\n const type = primitiveMappings[x._def.typeName]; //Can be safely casted due to row 43\n return type && !types.includes(type) ? [...types, type] : types;\n }, []);\n return {\n type: types.length > 1 ? types : types[0],\n };\n }\n else if (options.every((x) => x._def.typeName === \"ZodLiteral\" && !x.description)) {\n // all options literals\n const types = options.reduce((acc, x) => {\n const type = typeof x._def.value;\n switch (type) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n return [...acc, type];\n case \"bigint\":\n return [...acc, \"integer\"];\n case \"object\":\n if (x._def.value === null)\n return [...acc, \"null\"];\n case \"symbol\":\n case \"undefined\":\n case \"function\":\n default:\n return acc;\n }\n }, []);\n if (types.length === options.length) {\n // all the literals are primitive, as far as null can be considered primitive\n const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);\n return {\n type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],\n enum: options.reduce((acc, x) => {\n return acc.includes(x._def.value) ? acc : [...acc, x._def.value];\n }, []),\n };\n }\n }\n else if (options.every((x) => x._def.typeName === \"ZodEnum\")) {\n return {\n type: \"string\",\n enum: options.reduce((acc, x) => [\n ...acc,\n ...x._def.values.filter((x) => !acc.includes(x)),\n ], []),\n };\n }\n return asAnyOf(def, refs);\n}\nconst asAnyOf = (def, refs) => {\n const anyOf = (def.options instanceof Map\n ? Array.from(def.options.values())\n : def.options)\n .map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"anyOf\", `${i}`],\n }))\n .filter((x) => !!x &&\n (!refs.strictUnions ||\n (typeof x === \"object\" && Object.keys(x).length > 0)));\n return anyOf.length ? { anyOf } : undefined;\n};\n","import { parseDef } from \"../parseDef.js\";\nimport { primitiveMappings } from \"./union.js\";\nexport function parseNullableDef(def, refs) {\n if ([\"ZodString\", \"ZodNumber\", \"ZodBigInt\", \"ZodBoolean\", \"ZodNull\"].includes(def.innerType._def.typeName) &&\n (!def.innerType._def.checks || !def.innerType._def.checks.length)) {\n if (refs.target === \"openApi3\") {\n return {\n type: primitiveMappings[def.innerType._def.typeName],\n nullable: true,\n };\n }\n return {\n type: [\n primitiveMappings[def.innerType._def.typeName],\n \"null\",\n ],\n };\n }\n if (refs.target === \"openApi3\") {\n const base = parseDef(def.innerType._def, {\n ...refs,\n currentPath: [...refs.currentPath],\n });\n if (base && \"$ref\" in base)\n return { allOf: [base], nullable: true };\n return base && { ...base, nullable: true };\n }\n const base = parseDef(def.innerType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"anyOf\", \"0\"],\n });\n return base && { anyOf: [base, { type: \"null\" }] };\n}\n","import { addErrorMessage, setResponseValueAndErrors, } from \"../errorMessages.js\";\nexport function parseNumberDef(def, refs) {\n const res = {\n type: \"number\",\n };\n if (!def.checks)\n return res;\n for (const check of def.checks) {\n switch (check.kind) {\n case \"int\":\n res.type = \"integer\";\n addErrorMessage(res, \"type\", check.message, refs);\n break;\n case \"min\":\n if (refs.target === \"jsonSchema7\") {\n if (check.inclusive) {\n setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n }\n else {\n setResponseValueAndErrors(res, \"exclusiveMinimum\", check.value, check.message, refs);\n }\n }\n else {\n if (!check.inclusive) {\n res.exclusiveMinimum = true;\n }\n setResponseValueAndErrors(res, \"minimum\", check.value, check.message, refs);\n }\n break;\n case \"max\":\n if (refs.target === \"jsonSchema7\") {\n if (check.inclusive) {\n setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n }\n else {\n setResponseValueAndErrors(res, \"exclusiveMaximum\", check.value, check.message, refs);\n }\n }\n else {\n if (!check.inclusive) {\n res.exclusiveMaximum = true;\n }\n setResponseValueAndErrors(res, \"maximum\", check.value, check.message, refs);\n }\n break;\n case \"multipleOf\":\n setResponseValueAndErrors(res, \"multipleOf\", check.value, check.message, refs);\n break;\n }\n }\n return res;\n}\n","import { parseDef } from \"../parseDef.js\";\nexport function parseObjectDef(def, refs) {\n const forceOptionalIntoNullable = refs.target === \"openAi\";\n const result = {\n type: \"object\",\n properties: {},\n };\n const required = [];\n const shape = def.shape();\n for (const propName in shape) {\n let propDef = shape[propName];\n if (propDef === undefined || propDef._def === undefined) {\n continue;\n }\n let propOptional = safeIsOptional(propDef);\n if (propOptional && forceOptionalIntoNullable) {\n if (propDef._def.typeName === \"ZodOptional\") {\n propDef = propDef._def.innerType;\n }\n if (!propDef.isNullable()) {\n propDef = propDef.nullable();\n }\n propOptional = false;\n }\n const parsedDef = parseDef(propDef._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"properties\", propName],\n propertyPath: [...refs.currentPath, \"properties\", propName],\n });\n if (parsedDef === undefined) {\n continue;\n }\n result.properties[propName] = parsedDef;\n if (!propOptional) {\n required.push(propName);\n }\n }\n if (required.length) {\n result.required = required;\n }\n const additionalProperties = decideAdditionalProperties(def, refs);\n if (additionalProperties !== undefined) {\n result.additionalProperties = additionalProperties;\n }\n return result;\n}\nfunction decideAdditionalProperties(def, refs) {\n if (def.catchall._def.typeName !== \"ZodNever\") {\n return parseDef(def.catchall._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"additionalProperties\"],\n });\n }\n switch (def.unknownKeys) {\n case \"passthrough\":\n return refs.allowedAdditionalProperties;\n case \"strict\":\n return refs.rejectedAdditionalProperties;\n case \"strip\":\n return refs.removeAdditionalStrategy === \"strict\"\n ? refs.allowedAdditionalProperties\n : refs.rejectedAdditionalProperties;\n }\n}\nfunction safeIsOptional(schema) {\n try {\n return schema.isOptional();\n }\n catch {\n return true;\n }\n}\n","import { parseDef } from \"../parseDef.js\";\nimport { parseAnyDef } from \"./any.js\";\nexport const parseOptionalDef = (def, refs) => {\n if (refs.currentPath.toString() === refs.propertyPath?.toString()) {\n return parseDef(def.innerType._def, refs);\n }\n const innerSchema = parseDef(def.innerType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"anyOf\", \"1\"],\n });\n return innerSchema\n ? {\n anyOf: [\n {\n not: parseAnyDef(refs),\n },\n innerSchema,\n ],\n }\n : parseAnyDef(refs);\n};\n","import { parseDef } from \"../parseDef.js\";\nexport const parsePipelineDef = (def, refs) => {\n if (refs.pipeStrategy === \"input\") {\n return parseDef(def.in._def, refs);\n }\n else if (refs.pipeStrategy === \"output\") {\n return parseDef(def.out._def, refs);\n }\n const a = parseDef(def.in._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", \"0\"],\n });\n const b = parseDef(def.out._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"allOf\", a ? \"1\" : \"0\"],\n });\n return {\n allOf: [a, b].filter((x) => x !== undefined),\n };\n};\n","import { parseDef } from \"../parseDef.js\";\nexport function parsePromiseDef(def, refs) {\n return parseDef(def.type._def, refs);\n}\n","import { setResponseValueAndErrors } from \"../errorMessages.js\";\nimport { parseDef } from \"../parseDef.js\";\nexport function parseSetDef(def, refs) {\n const items = parseDef(def.valueType._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\"],\n });\n const schema = {\n type: \"array\",\n uniqueItems: true,\n items,\n };\n if (def.minSize) {\n setResponseValueAndErrors(schema, \"minItems\", def.minSize.value, def.minSize.message, refs);\n }\n if (def.maxSize) {\n setResponseValueAndErrors(schema, \"maxItems\", def.maxSize.value, def.maxSize.message, refs);\n }\n return schema;\n}\n","import { parseDef } from \"../parseDef.js\";\nexport function parseTupleDef(def, refs) {\n if (def.rest) {\n return {\n type: \"array\",\n minItems: def.items.length,\n items: def.items\n .map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`],\n }))\n .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),\n additionalItems: parseDef(def.rest._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"additionalItems\"],\n }),\n };\n }\n else {\n return {\n type: \"array\",\n minItems: def.items.length,\n maxItems: def.items.length,\n items: def.items\n .map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`],\n }))\n .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),\n };\n }\n}\n","import { parseAnyDef } from \"./any.js\";\nexport function parseUndefinedDef(refs) {\n return {\n not: parseAnyDef(refs),\n };\n}\n","import { parseAnyDef } from \"./any.js\";\nexport function parseUnknownDef(refs) {\n return parseAnyDef(refs);\n}\n","import { parseDef } from \"../parseDef.js\";\nexport const parseReadonlyDef = (def, refs) => {\n return parseDef(def.innerType._def, refs);\n};\n","import { ZodFirstPartyTypeKind } from \"zod/v3\";\nimport { parseAnyDef } from \"./parsers/any.js\";\nimport { parseArrayDef } from \"./parsers/array.js\";\nimport { parseBigintDef } from \"./parsers/bigint.js\";\nimport { parseBooleanDef } from \"./parsers/boolean.js\";\nimport { parseBrandedDef } from \"./parsers/branded.js\";\nimport { parseCatchDef } from \"./parsers/catch.js\";\nimport { parseDateDef } from \"./parsers/date.js\";\nimport { parseDefaultDef } from \"./parsers/default.js\";\nimport { parseEffectsDef } from \"./parsers/effects.js\";\nimport { parseEnumDef } from \"./parsers/enum.js\";\nimport { parseIntersectionDef } from \"./parsers/intersection.js\";\nimport { parseLiteralDef } from \"./parsers/literal.js\";\nimport { parseMapDef } from \"./parsers/map.js\";\nimport { parseNativeEnumDef } from \"./parsers/nativeEnum.js\";\nimport { parseNeverDef } from \"./parsers/never.js\";\nimport { parseNullDef } from \"./parsers/null.js\";\nimport { parseNullableDef } from \"./parsers/nullable.js\";\nimport { parseNumberDef } from \"./parsers/number.js\";\nimport { parseObjectDef } from \"./parsers/object.js\";\nimport { parseOptionalDef } from \"./parsers/optional.js\";\nimport { parsePipelineDef } from \"./parsers/pipeline.js\";\nimport { parsePromiseDef } from \"./parsers/promise.js\";\nimport { parseRecordDef } from \"./parsers/record.js\";\nimport { parseSetDef } from \"./parsers/set.js\";\nimport { parseStringDef } from \"./parsers/string.js\";\nimport { parseTupleDef } from \"./parsers/tuple.js\";\nimport { parseUndefinedDef } from \"./parsers/undefined.js\";\nimport { parseUnionDef } from \"./parsers/union.js\";\nimport { parseUnknownDef } from \"./parsers/unknown.js\";\nimport { parseReadonlyDef } from \"./parsers/readonly.js\";\nexport const selectParser = (def, typeName, refs) => {\n switch (typeName) {\n case ZodFirstPartyTypeKind.ZodString:\n return parseStringDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNumber:\n return parseNumberDef(def, refs);\n case ZodFirstPartyTypeKind.ZodObject:\n return parseObjectDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBigInt:\n return parseBigintDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBoolean:\n return parseBooleanDef();\n case ZodFirstPartyTypeKind.ZodDate:\n return parseDateDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUndefined:\n return parseUndefinedDef(refs);\n case ZodFirstPartyTypeKind.ZodNull:\n return parseNullDef(refs);\n case ZodFirstPartyTypeKind.ZodArray:\n return parseArrayDef(def, refs);\n case ZodFirstPartyTypeKind.ZodUnion:\n case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:\n return parseUnionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodIntersection:\n return parseIntersectionDef(def, refs);\n case ZodFirstPartyTypeKind.ZodTuple:\n return parseTupleDef(def, refs);\n case ZodFirstPartyTypeKind.ZodRecord:\n return parseRecordDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLiteral:\n return parseLiteralDef(def, refs);\n case ZodFirstPartyTypeKind.ZodEnum:\n return parseEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNativeEnum:\n return parseNativeEnumDef(def);\n case ZodFirstPartyTypeKind.ZodNullable:\n return parseNullableDef(def, refs);\n case ZodFirstPartyTypeKind.ZodOptional:\n return parseOptionalDef(def, refs);\n case ZodFirstPartyTypeKind.ZodMap:\n return parseMapDef(def, refs);\n case ZodFirstPartyTypeKind.ZodSet:\n return parseSetDef(def, refs);\n case ZodFirstPartyTypeKind.ZodLazy:\n return () => def.getter()._def;\n case ZodFirstPartyTypeKind.ZodPromise:\n return parsePromiseDef(def, refs);\n case ZodFirstPartyTypeKind.ZodNaN:\n case ZodFirstPartyTypeKind.ZodNever:\n return parseNeverDef(refs);\n case ZodFirstPartyTypeKind.ZodEffects:\n return parseEffectsDef(def, refs);\n case ZodFirstPartyTypeKind.ZodAny:\n return parseAnyDef(refs);\n case ZodFirstPartyTypeKind.ZodUnknown:\n return parseUnknownDef(refs);\n case ZodFirstPartyTypeKind.ZodDefault:\n return parseDefaultDef(def, refs);\n case ZodFirstPartyTypeKind.ZodBranded:\n return parseBrandedDef(def, refs);\n case ZodFirstPartyTypeKind.ZodReadonly:\n return parseReadonlyDef(def, refs);\n case ZodFirstPartyTypeKind.ZodCatch:\n return parseCatchDef(def, refs);\n case ZodFirstPartyTypeKind.ZodPipeline:\n return parsePipelineDef(def, refs);\n case ZodFirstPartyTypeKind.ZodFunction:\n case ZodFirstPartyTypeKind.ZodVoid:\n case ZodFirstPartyTypeKind.ZodSymbol:\n return undefined;\n default:\n return ((_) => undefined)(typeName);\n }\n};\n","import { ignoreOverride } from \"./Options.js\";\nimport { selectParser } from \"./selectParser.js\";\nimport { getRelativePath } from \"./getRelativePath.js\";\nimport { parseAnyDef } from \"./parsers/any.js\";\nexport function parseDef(def, refs, forceResolution = false) {\n const seenItem = refs.seen.get(def);\n if (refs.override) {\n const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);\n if (overrideResult !== ignoreOverride) {\n return overrideResult;\n }\n }\n if (seenItem && !forceResolution) {\n const seenSchema = get$ref(seenItem, refs);\n if (seenSchema !== undefined) {\n return seenSchema;\n }\n }\n const newItem = { def, path: refs.currentPath, jsonSchema: undefined };\n refs.seen.set(def, newItem);\n const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);\n // If the return was a function, then the inner definition needs to be extracted before a call to parseDef (recursive)\n const jsonSchema = typeof jsonSchemaOrGetter === \"function\"\n ? parseDef(jsonSchemaOrGetter(), refs)\n : jsonSchemaOrGetter;\n if (jsonSchema) {\n addMeta(def, refs, jsonSchema);\n }\n if (refs.postProcess) {\n const postProcessResult = refs.postProcess(jsonSchema, def, refs);\n newItem.jsonSchema = jsonSchema;\n return postProcessResult;\n }\n newItem.jsonSchema = jsonSchema;\n return jsonSchema;\n}\nconst get$ref = (item, refs) => {\n switch (refs.$refStrategy) {\n case \"root\":\n return { $ref: item.path.join(\"/\") };\n case \"relative\":\n return { $ref: getRelativePath(refs.currentPath, item.path) };\n case \"none\":\n case \"seen\": {\n if (item.path.length < refs.currentPath.length &&\n item.path.every((value, index) => refs.currentPath[index] === value)) {\n console.warn(`Recursive reference detected at ${refs.currentPath.join(\"/\")}! Defaulting to any`);\n return parseAnyDef(refs);\n }\n return refs.$refStrategy === \"seen\" ? parseAnyDef(refs) : undefined;\n }\n }\n};\nconst addMeta = (def, refs, jsonSchema) => {\n if (def.description) {\n jsonSchema.description = def.description;\n if (refs.markdownDescription) {\n jsonSchema.markdownDescription = def.description;\n }\n }\n return jsonSchema;\n};\n","import { parseDef } from \"./parseDef.js\";\nimport { getRefs } from \"./Refs.js\";\nimport { parseAnyDef } from \"./parsers/any.js\";\nconst zodToJsonSchema = (schema, options) => {\n const refs = getRefs(options);\n let definitions = typeof options === \"object\" && options.definitions\n ? Object.entries(options.definitions).reduce((acc, [name, schema]) => ({\n ...acc,\n [name]: parseDef(schema._def, {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n }, true) ?? parseAnyDef(refs),\n }), {})\n : undefined;\n const name = typeof options === \"string\"\n ? options\n : options?.nameStrategy === \"title\"\n ? undefined\n : options?.name;\n const main = parseDef(schema._def, name === undefined\n ? refs\n : {\n ...refs,\n currentPath: [...refs.basePath, refs.definitionPath, name],\n }, false) ?? parseAnyDef(refs);\n const title = typeof options === \"object\" &&\n options.name !== undefined &&\n options.nameStrategy === \"title\"\n ? options.name\n : undefined;\n if (title !== undefined) {\n main.title = title;\n }\n if (refs.flags.hasReferencedOpenAiAnyType) {\n if (!definitions) {\n definitions = {};\n }\n if (!definitions[refs.openAiAnyTypeName]) {\n definitions[refs.openAiAnyTypeName] = {\n // Skipping \"object\" as no properties can be defined and additionalProperties must be \"false\"\n type: [\"string\", \"number\", \"integer\", \"boolean\", \"array\", \"null\"],\n items: {\n $ref: refs.$refStrategy === \"relative\"\n ? \"1\"\n : [\n ...refs.basePath,\n refs.definitionPath,\n refs.openAiAnyTypeName,\n ].join(\"/\"),\n },\n };\n }\n }\n const combined = name === undefined\n ? definitions\n ? {\n ...main,\n [refs.definitionPath]: definitions,\n }\n : main\n : {\n $ref: [\n ...(refs.$refStrategy === \"relative\" ? [] : refs.basePath),\n refs.definitionPath,\n name,\n ].join(\"/\"),\n [refs.definitionPath]: {\n ...definitions,\n [name]: main,\n },\n };\n if (refs.target === \"jsonSchema7\") {\n combined.$schema = \"http://json-schema.org/draft-07/schema#\";\n }\n else if (refs.target === \"jsonSchema2019-09\" || refs.target === \"openAi\") {\n combined.$schema = \"https://json-schema.org/draft/2019-09/schema#\";\n }\n if (refs.target === \"openAi\" &&\n (\"anyOf\" in combined ||\n \"oneOf\" in combined ||\n \"allOf\" in combined ||\n (\"type\" in combined && Array.isArray(combined.type)))) {\n console.warn(\"Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.\");\n }\n return combined;\n};\nexport { zodToJsonSchema };\n","// zod-json-schema-compat.ts\n// ----------------------------------------------------\n// JSON Schema conversion for both Zod v3 and Zod v4 (Mini)\n// v3 uses your vendored converter; v4 uses Mini's toJSONSchema\n// ----------------------------------------------------\nimport * as z4mini from 'zod/v4-mini';\nimport { getObjectShape, safeParse, isZ4Schema, getLiteralValue } from './zod-compat.js';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\nfunction mapMiniTarget(t) {\n if (!t)\n return 'draft-7';\n if (t === 'jsonSchema7' || t === 'draft-7')\n return 'draft-7';\n if (t === 'jsonSchema2019-09' || t === 'draft-2020-12')\n return 'draft-2020-12';\n return 'draft-7'; // fallback\n}\nexport function toJsonSchemaCompat(schema, opts) {\n if (isZ4Schema(schema)) {\n // v4 branch — use Mini's built-in toJSONSchema\n return z4mini.toJSONSchema(schema, {\n target: mapMiniTarget(opts?.target),\n io: opts?.pipeStrategy ?? 'input'\n });\n }\n // v3 branch — use vendored converter\n return zodToJsonSchema(schema, {\n strictUnions: opts?.strictUnions ?? true,\n pipeStrategy: opts?.pipeStrategy ?? 'input'\n });\n}\nexport function getMethodLiteral(schema) {\n const shape = getObjectShape(schema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n const value = getLiteralValue(methodSchema);\n if (typeof value !== 'string') {\n throw new Error('Schema method literal must be a string');\n }\n return value;\n}\nexport function parseWithCompat(schema, data) {\n const result = safeParse(schema, data);\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n}\n//# sourceMappingURL=zod-json-schema-compat.js.map","import { safeParse } from '../server/zod-compat.js';\nimport { CancelledNotificationSchema, CreateTaskResultSchema, ErrorCode, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, isJSONRPCErrorResponse, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCNotification, McpError, PingRequestSchema, ProgressNotificationSchema, RELATED_TASK_META_KEY, TaskStatusNotificationSchema, isTaskAugmentedRequestParams } from '../types.js';\nimport { isTerminal } from '../experimental/tasks/interfaces.js';\nimport { getMethodLiteral, parseWithCompat } from '../server/zod-json-schema-compat.js';\n/**\n * The default request timeout, in miliseconds.\n */\nexport const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;\n/**\n * Implements MCP protocol framing on top of a pluggable transport, including\n * features like request/response linking, notifications, and progress.\n */\nexport class Protocol {\n constructor(_options) {\n this._options = _options;\n this._requestMessageId = 0;\n this._requestHandlers = new Map();\n this._requestHandlerAbortControllers = new Map();\n this._notificationHandlers = new Map();\n this._responseHandlers = new Map();\n this._progressHandlers = new Map();\n this._timeoutInfo = new Map();\n this._pendingDebouncedNotifications = new Set();\n // Maps task IDs to progress tokens to keep handlers alive after CreateTaskResult\n this._taskProgressTokens = new Map();\n this._requestResolvers = new Map();\n this.setNotificationHandler(CancelledNotificationSchema, notification => {\n this._oncancel(notification);\n });\n this.setNotificationHandler(ProgressNotificationSchema, notification => {\n this._onprogress(notification);\n });\n this.setRequestHandler(PingRequestSchema, \n // Automatic pong by default.\n _request => ({}));\n // Install task handlers if TaskStore is provided\n this._taskStore = _options?.taskStore;\n this._taskMessageQueue = _options?.taskMessageQueue;\n if (this._taskStore) {\n this.setRequestHandler(GetTaskRequestSchema, async (request, extra) => {\n const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);\n if (!task) {\n throw new McpError(ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found');\n }\n // Per spec: tasks/get responses SHALL NOT include related-task metadata\n // as the taskId parameter is the source of truth\n // @ts-expect-error SendResultT cannot contain GetTaskResult, but we include it in our derived types everywhere else\n return {\n ...task\n };\n });\n this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {\n const handleTaskResult = async () => {\n const taskId = request.params.taskId;\n // Deliver queued messages\n if (this._taskMessageQueue) {\n let queuedMessage;\n while ((queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId))) {\n // Handle response and error messages by routing them to the appropriate resolver\n if (queuedMessage.type === 'response' || queuedMessage.type === 'error') {\n const message = queuedMessage.message;\n const requestId = message.id;\n // Lookup resolver in _requestResolvers map\n const resolver = this._requestResolvers.get(requestId);\n if (resolver) {\n // Remove resolver from map after invocation\n this._requestResolvers.delete(requestId);\n // Invoke resolver with response or error\n if (queuedMessage.type === 'response') {\n resolver(message);\n }\n else {\n // Convert JSONRPCError to McpError\n const errorMessage = message;\n const error = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);\n resolver(error);\n }\n }\n else {\n // Handle missing resolver gracefully with error logging\n const messageType = queuedMessage.type === 'response' ? 'Response' : 'Error';\n this._onerror(new Error(`${messageType} handler missing for request ${requestId}`));\n }\n // Continue to next message\n continue;\n }\n // Send the message on the response stream by passing the relatedRequestId\n // This tells the transport to write the message to the tasks/result response stream\n await this._transport?.send(queuedMessage.message, { relatedRequestId: extra.requestId });\n }\n }\n // Now check task status\n const task = await this._taskStore.getTask(taskId, extra.sessionId);\n if (!task) {\n throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);\n }\n // Block if task is not terminal (we've already delivered all queued messages above)\n if (!isTerminal(task.status)) {\n // Wait for status change or new messages\n await this._waitForTaskUpdate(taskId, extra.signal);\n // After waking up, recursively call to deliver any new messages or result\n return await handleTaskResult();\n }\n // If task is terminal, return the result\n if (isTerminal(task.status)) {\n const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);\n this._clearTaskQueue(taskId);\n return {\n ...result,\n _meta: {\n ...result._meta,\n [RELATED_TASK_META_KEY]: {\n taskId: taskId\n }\n }\n };\n }\n return await handleTaskResult();\n };\n return await handleTaskResult();\n });\n this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => {\n try {\n const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId);\n // @ts-expect-error SendResultT cannot contain ListTasksResult, but we include it in our derived types everywhere else\n return {\n tasks,\n nextCursor,\n _meta: {}\n };\n }\n catch (error) {\n throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error instanceof Error ? error.message : String(error)}`);\n }\n });\n this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => {\n try {\n // Get the current task to check if it's in a terminal state, in case the implementation is not atomic\n const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId);\n if (!task) {\n throw new McpError(ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`);\n }\n // Reject cancellation of terminal tasks\n if (isTerminal(task.status)) {\n throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);\n }\n await this._taskStore.updateTaskStatus(request.params.taskId, 'cancelled', 'Client cancelled task execution.', extra.sessionId);\n this._clearTaskQueue(request.params.taskId);\n const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);\n if (!cancelledTask) {\n // Task was deleted during cancellation (e.g., cleanup happened)\n throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);\n }\n return {\n _meta: {},\n ...cancelledTask\n };\n }\n catch (error) {\n // Re-throw McpError as-is\n if (error instanceof McpError) {\n throw error;\n }\n throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error instanceof Error ? error.message : String(error)}`);\n }\n });\n }\n }\n async _oncancel(notification) {\n if (!notification.params.requestId) {\n return;\n }\n // Handle request cancellation\n const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);\n controller?.abort(notification.params.reason);\n }\n _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {\n this._timeoutInfo.set(messageId, {\n timeoutId: setTimeout(onTimeout, timeout),\n startTime: Date.now(),\n timeout,\n maxTotalTimeout,\n resetTimeoutOnProgress,\n onTimeout\n });\n }\n _resetTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (!info)\n return false;\n const totalElapsed = Date.now() - info.startTime;\n if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {\n this._timeoutInfo.delete(messageId);\n throw McpError.fromError(ErrorCode.RequestTimeout, 'Maximum total timeout exceeded', {\n maxTotalTimeout: info.maxTotalTimeout,\n totalElapsed\n });\n }\n clearTimeout(info.timeoutId);\n info.timeoutId = setTimeout(info.onTimeout, info.timeout);\n return true;\n }\n _cleanupTimeout(messageId) {\n const info = this._timeoutInfo.get(messageId);\n if (info) {\n clearTimeout(info.timeoutId);\n this._timeoutInfo.delete(messageId);\n }\n }\n /**\n * Attaches to the given transport, starts it, and starts listening for messages.\n *\n * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n */\n async connect(transport) {\n if (this._transport) {\n throw new Error('Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.');\n }\n this._transport = transport;\n const _onclose = this.transport?.onclose;\n this._transport.onclose = () => {\n _onclose?.();\n this._onclose();\n };\n const _onerror = this.transport?.onerror;\n this._transport.onerror = (error) => {\n _onerror?.(error);\n this._onerror(error);\n };\n const _onmessage = this._transport?.onmessage;\n this._transport.onmessage = (message, extra) => {\n _onmessage?.(message, extra);\n if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {\n this._onresponse(message);\n }\n else if (isJSONRPCRequest(message)) {\n this._onrequest(message, extra);\n }\n else if (isJSONRPCNotification(message)) {\n this._onnotification(message);\n }\n else {\n this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));\n }\n };\n await this._transport.start();\n }\n _onclose() {\n const responseHandlers = this._responseHandlers;\n this._responseHandlers = new Map();\n this._progressHandlers.clear();\n this._taskProgressTokens.clear();\n this._pendingDebouncedNotifications.clear();\n // Abort all in-flight request handlers so they stop sending messages\n for (const controller of this._requestHandlerAbortControllers.values()) {\n controller.abort();\n }\n this._requestHandlerAbortControllers.clear();\n const error = McpError.fromError(ErrorCode.ConnectionClosed, 'Connection closed');\n this._transport = undefined;\n this.onclose?.();\n for (const handler of responseHandlers.values()) {\n handler(error);\n }\n }\n _onerror(error) {\n this.onerror?.(error);\n }\n _onnotification(notification) {\n const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;\n // Ignore notifications not being subscribed to.\n if (handler === undefined) {\n return;\n }\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => handler(notification))\n .catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));\n }\n _onrequest(request, extra) {\n const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;\n // Capture the current transport at request time to ensure responses go to the correct client\n const capturedTransport = this._transport;\n // Extract taskId from request metadata if present (needed early for method not found case)\n const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;\n if (handler === undefined) {\n const errorResponse = {\n jsonrpc: '2.0',\n id: request.id,\n error: {\n code: ErrorCode.MethodNotFound,\n message: 'Method not found'\n }\n };\n // Queue or send the error response based on whether this is a task-related request\n if (relatedTaskId && this._taskMessageQueue) {\n this._enqueueTaskMessage(relatedTaskId, {\n type: 'error',\n message: errorResponse,\n timestamp: Date.now()\n }, capturedTransport?.sessionId).catch(error => this._onerror(new Error(`Failed to enqueue error response: ${error}`)));\n }\n else {\n capturedTransport\n ?.send(errorResponse)\n .catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`)));\n }\n return;\n }\n const abortController = new AbortController();\n this._requestHandlerAbortControllers.set(request.id, abortController);\n const taskCreationParams = isTaskAugmentedRequestParams(request.params) ? request.params.task : undefined;\n const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport?.sessionId) : undefined;\n const fullExtra = {\n signal: abortController.signal,\n sessionId: capturedTransport?.sessionId,\n _meta: request.params?._meta,\n sendNotification: async (notification) => {\n if (abortController.signal.aborted)\n return;\n // Include related-task metadata if this request is part of a task\n const notificationOptions = { relatedRequestId: request.id };\n if (relatedTaskId) {\n notificationOptions.relatedTask = { taskId: relatedTaskId };\n }\n await this.notification(notification, notificationOptions);\n },\n sendRequest: async (r, resultSchema, options) => {\n if (abortController.signal.aborted) {\n throw new McpError(ErrorCode.ConnectionClosed, 'Request was cancelled');\n }\n // Include related-task metadata if this request is part of a task\n const requestOptions = { ...options, relatedRequestId: request.id };\n if (relatedTaskId && !requestOptions.relatedTask) {\n requestOptions.relatedTask = { taskId: relatedTaskId };\n }\n // Set task status to input_required when sending a request within a task context\n // Use the taskId from options (explicit) or fall back to relatedTaskId (inherited)\n const effectiveTaskId = requestOptions.relatedTask?.taskId ?? relatedTaskId;\n if (effectiveTaskId && taskStore) {\n await taskStore.updateTaskStatus(effectiveTaskId, 'input_required');\n }\n return await this.request(r, resultSchema, requestOptions);\n },\n authInfo: extra?.authInfo,\n requestId: request.id,\n requestInfo: extra?.requestInfo,\n taskId: relatedTaskId,\n taskStore: taskStore,\n taskRequestedTtl: taskCreationParams?.ttl,\n closeSSEStream: extra?.closeSSEStream,\n closeStandaloneSSEStream: extra?.closeStandaloneSSEStream\n };\n // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n Promise.resolve()\n .then(() => {\n // If this request asked for task creation, check capability first\n if (taskCreationParams) {\n // Check if the request method supports task creation\n this.assertTaskHandlerCapability(request.method);\n }\n })\n .then(() => handler(request, fullExtra))\n .then(async (result) => {\n if (abortController.signal.aborted) {\n // Request was cancelled\n return;\n }\n const response = {\n result,\n jsonrpc: '2.0',\n id: request.id\n };\n // Queue or send the response based on whether this is a task-related request\n if (relatedTaskId && this._taskMessageQueue) {\n await this._enqueueTaskMessage(relatedTaskId, {\n type: 'response',\n message: response,\n timestamp: Date.now()\n }, capturedTransport?.sessionId);\n }\n else {\n await capturedTransport?.send(response);\n }\n }, async (error) => {\n if (abortController.signal.aborted) {\n // Request was cancelled\n return;\n }\n const errorResponse = {\n jsonrpc: '2.0',\n id: request.id,\n error: {\n code: Number.isSafeInteger(error['code']) ? error['code'] : ErrorCode.InternalError,\n message: error.message ?? 'Internal error',\n ...(error['data'] !== undefined && { data: error['data'] })\n }\n };\n // Queue or send the error response based on whether this is a task-related request\n if (relatedTaskId && this._taskMessageQueue) {\n await this._enqueueTaskMessage(relatedTaskId, {\n type: 'error',\n message: errorResponse,\n timestamp: Date.now()\n }, capturedTransport?.sessionId);\n }\n else {\n await capturedTransport?.send(errorResponse);\n }\n })\n .catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))\n .finally(() => {\n this._requestHandlerAbortControllers.delete(request.id);\n });\n }\n _onprogress(notification) {\n const { progressToken, ...params } = notification.params;\n const messageId = Number(progressToken);\n const handler = this._progressHandlers.get(messageId);\n if (!handler) {\n this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));\n return;\n }\n const responseHandler = this._responseHandlers.get(messageId);\n const timeoutInfo = this._timeoutInfo.get(messageId);\n if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {\n try {\n this._resetTimeout(messageId);\n }\n catch (error) {\n // Clean up if maxTotalTimeout was exceeded\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n responseHandler(error);\n return;\n }\n }\n handler(params);\n }\n _onresponse(response) {\n const messageId = Number(response.id);\n // Check if this is a response to a queued request\n const resolver = this._requestResolvers.get(messageId);\n if (resolver) {\n this._requestResolvers.delete(messageId);\n if (isJSONRPCResultResponse(response)) {\n resolver(response);\n }\n else {\n const error = new McpError(response.error.code, response.error.message, response.error.data);\n resolver(error);\n }\n return;\n }\n const handler = this._responseHandlers.get(messageId);\n if (handler === undefined) {\n this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));\n return;\n }\n this._responseHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n // Keep progress handler alive for CreateTaskResult responses\n let isTaskResponse = false;\n if (isJSONRPCResultResponse(response) && response.result && typeof response.result === 'object') {\n const result = response.result;\n if (result.task && typeof result.task === 'object') {\n const task = result.task;\n if (typeof task.taskId === 'string') {\n isTaskResponse = true;\n this._taskProgressTokens.set(task.taskId, messageId);\n }\n }\n }\n if (!isTaskResponse) {\n this._progressHandlers.delete(messageId);\n }\n if (isJSONRPCResultResponse(response)) {\n handler(response);\n }\n else {\n const error = McpError.fromError(response.error.code, response.error.message, response.error.data);\n handler(error);\n }\n }\n get transport() {\n return this._transport;\n }\n /**\n * Closes the connection.\n */\n async close() {\n await this._transport?.close();\n }\n /**\n * Sends a request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * @example\n * ```typescript\n * const stream = protocol.requestStream(request, resultSchema, options);\n * for await (const message of stream) {\n * switch (message.type) {\n * case 'taskCreated':\n * console.log('Task created:', message.task.taskId);\n * break;\n * case 'taskStatus':\n * console.log('Task status:', message.task.status);\n * break;\n * case 'result':\n * console.log('Final result:', message.result);\n * break;\n * case 'error':\n * console.error('Error:', message.error);\n * break;\n * }\n * }\n * ```\n *\n * @experimental Use `client.experimental.tasks.requestStream()` to access this method.\n */\n async *requestStream(request, resultSchema, options) {\n const { task } = options ?? {};\n // For non-task requests, just yield the result\n if (!task) {\n try {\n const result = await this.request(request, resultSchema, options);\n yield { type: 'result', result };\n }\n catch (error) {\n yield {\n type: 'error',\n error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error))\n };\n }\n return;\n }\n // For task-augmented requests, we need to poll for status\n // First, make the request to create the task\n let taskId;\n try {\n // Send the request and get the CreateTaskResult\n const createResult = await this.request(request, CreateTaskResultSchema, options);\n // Extract taskId from the result\n if (createResult.task) {\n taskId = createResult.task.taskId;\n yield { type: 'taskCreated', task: createResult.task };\n }\n else {\n throw new McpError(ErrorCode.InternalError, 'Task creation did not return a task');\n }\n // Poll for task completion\n while (true) {\n // Get current task status\n const task = await this.getTask({ taskId }, options);\n yield { type: 'taskStatus', task };\n // Check if task is terminal\n if (isTerminal(task.status)) {\n if (task.status === 'completed') {\n // Get the final result\n const result = await this.getTaskResult({ taskId }, resultSchema, options);\n yield { type: 'result', result };\n }\n else if (task.status === 'failed') {\n yield {\n type: 'error',\n error: new McpError(ErrorCode.InternalError, `Task ${taskId} failed`)\n };\n }\n else if (task.status === 'cancelled') {\n yield {\n type: 'error',\n error: new McpError(ErrorCode.InternalError, `Task ${taskId} was cancelled`)\n };\n }\n return;\n }\n // When input_required, call tasks/result to deliver queued messages\n // (elicitation, sampling) via SSE and block until terminal\n if (task.status === 'input_required') {\n const result = await this.getTaskResult({ taskId }, resultSchema, options);\n yield { type: 'result', result };\n return;\n }\n // Wait before polling again\n const pollInterval = task.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n // Check if cancelled\n options?.signal?.throwIfAborted();\n }\n }\n catch (error) {\n yield {\n type: 'error',\n error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error))\n };\n }\n }\n /**\n * Sends a request and waits for a response.\n *\n * Do not use this method to emit notifications! Use notification() instead.\n */\n request(request, resultSchema, options) {\n const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};\n // Send the request\n return new Promise((resolve, reject) => {\n const earlyReject = (error) => {\n reject(error);\n };\n if (!this._transport) {\n earlyReject(new Error('Not connected'));\n return;\n }\n if (this._options?.enforceStrictCapabilities === true) {\n try {\n this.assertCapabilityForMethod(request.method);\n // If task creation is requested, also check task capabilities\n if (task) {\n this.assertTaskCapability(request.method);\n }\n }\n catch (e) {\n earlyReject(e);\n return;\n }\n }\n options?.signal?.throwIfAborted();\n const messageId = this._requestMessageId++;\n const jsonrpcRequest = {\n ...request,\n jsonrpc: '2.0',\n id: messageId\n };\n if (options?.onprogress) {\n this._progressHandlers.set(messageId, options.onprogress);\n jsonrpcRequest.params = {\n ...request.params,\n _meta: {\n ...(request.params?._meta || {}),\n progressToken: messageId\n }\n };\n }\n // Augment with task creation parameters if provided\n if (task) {\n jsonrpcRequest.params = {\n ...jsonrpcRequest.params,\n task: task\n };\n }\n // Augment with related task metadata if relatedTask is provided\n if (relatedTask) {\n jsonrpcRequest.params = {\n ...jsonrpcRequest.params,\n _meta: {\n ...(jsonrpcRequest.params?._meta || {}),\n [RELATED_TASK_META_KEY]: relatedTask\n }\n };\n }\n const cancel = (reason) => {\n this._responseHandlers.delete(messageId);\n this._progressHandlers.delete(messageId);\n this._cleanupTimeout(messageId);\n this._transport\n ?.send({\n jsonrpc: '2.0',\n method: 'notifications/cancelled',\n params: {\n requestId: messageId,\n reason: String(reason)\n }\n }, { relatedRequestId, resumptionToken, onresumptiontoken })\n .catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`)));\n // Wrap the reason in an McpError if it isn't already\n const error = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason));\n reject(error);\n };\n this._responseHandlers.set(messageId, response => {\n if (options?.signal?.aborted) {\n return;\n }\n if (response instanceof Error) {\n return reject(response);\n }\n try {\n const parseResult = safeParse(resultSchema, response.result);\n if (!parseResult.success) {\n // Type guard: if success is false, error is guaranteed to exist\n reject(parseResult.error);\n }\n else {\n resolve(parseResult.data);\n }\n }\n catch (error) {\n reject(error);\n }\n });\n options?.signal?.addEventListener('abort', () => {\n cancel(options?.signal?.reason);\n });\n const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;\n const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, 'Request timed out', { timeout }));\n this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);\n // Queue request if related to a task\n const relatedTaskId = relatedTask?.taskId;\n if (relatedTaskId) {\n // Store the response resolver for this request so responses can be routed back\n const responseResolver = (response) => {\n const handler = this._responseHandlers.get(messageId);\n if (handler) {\n handler(response);\n }\n else {\n // Log error when resolver is missing, but don't fail\n this._onerror(new Error(`Response handler missing for side-channeled request ${messageId}`));\n }\n };\n this._requestResolvers.set(messageId, responseResolver);\n this._enqueueTaskMessage(relatedTaskId, {\n type: 'request',\n message: jsonrpcRequest,\n timestamp: Date.now()\n }).catch(error => {\n this._cleanupTimeout(messageId);\n reject(error);\n });\n // Don't send through transport - queued messages are delivered via tasks/result only\n // This prevents duplicate delivery for bidirectional transports\n }\n else {\n // No related task - send through transport normally\n this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => {\n this._cleanupTimeout(messageId);\n reject(error);\n });\n }\n });\n }\n /**\n * Gets the current status of a task.\n *\n * @experimental Use `client.experimental.tasks.getTask()` to access this method.\n */\n async getTask(params, options) {\n // @ts-expect-error SendRequestT cannot directly contain GetTaskRequest, but we ensure all type instantiations contain it anyways\n return this.request({ method: 'tasks/get', params }, GetTaskResultSchema, options);\n }\n /**\n * Retrieves the result of a completed task.\n *\n * @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.\n */\n async getTaskResult(params, resultSchema, options) {\n // @ts-expect-error SendRequestT cannot directly contain GetTaskPayloadRequest, but we ensure all type instantiations contain it anyways\n return this.request({ method: 'tasks/result', params }, resultSchema, options);\n }\n /**\n * Lists tasks, optionally starting from a pagination cursor.\n *\n * @experimental Use `client.experimental.tasks.listTasks()` to access this method.\n */\n async listTasks(params, options) {\n // @ts-expect-error SendRequestT cannot directly contain ListTasksRequest, but we ensure all type instantiations contain it anyways\n return this.request({ method: 'tasks/list', params }, ListTasksResultSchema, options);\n }\n /**\n * Cancels a specific task.\n *\n * @experimental Use `client.experimental.tasks.cancelTask()` to access this method.\n */\n async cancelTask(params, options) {\n // @ts-expect-error SendRequestT cannot directly contain CancelTaskRequest, but we ensure all type instantiations contain it anyways\n return this.request({ method: 'tasks/cancel', params }, CancelTaskResultSchema, options);\n }\n /**\n * Emits a notification, which is a one-way message that does not expect a response.\n */\n async notification(notification, options) {\n if (!this._transport) {\n throw new Error('Not connected');\n }\n this.assertNotificationCapability(notification.method);\n // Queue notification if related to a task\n const relatedTaskId = options?.relatedTask?.taskId;\n if (relatedTaskId) {\n // Build the JSONRPC notification with metadata\n const jsonrpcNotification = {\n ...notification,\n jsonrpc: '2.0',\n params: {\n ...notification.params,\n _meta: {\n ...(notification.params?._meta || {}),\n [RELATED_TASK_META_KEY]: options.relatedTask\n }\n }\n };\n await this._enqueueTaskMessage(relatedTaskId, {\n type: 'notification',\n message: jsonrpcNotification,\n timestamp: Date.now()\n });\n // Don't send through transport - queued messages are delivered via tasks/result only\n // This prevents duplicate delivery for bidirectional transports\n return;\n }\n const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];\n // A notification can only be debounced if it's in the list AND it's \"simple\"\n // (i.e., has no parameters and no related request ID or related task that could be lost).\n const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask;\n if (canDebounce) {\n // If a notification of this type is already scheduled, do nothing.\n if (this._pendingDebouncedNotifications.has(notification.method)) {\n return;\n }\n // Mark this notification type as pending.\n this._pendingDebouncedNotifications.add(notification.method);\n // Schedule the actual send to happen in the next microtask.\n // This allows all synchronous calls in the current event loop tick to be coalesced.\n Promise.resolve().then(() => {\n // Un-mark the notification so the next one can be scheduled.\n this._pendingDebouncedNotifications.delete(notification.method);\n // SAFETY CHECK: If the connection was closed while this was pending, abort.\n if (!this._transport) {\n return;\n }\n let jsonrpcNotification = {\n ...notification,\n jsonrpc: '2.0'\n };\n // Augment with related task metadata if relatedTask is provided\n if (options?.relatedTask) {\n jsonrpcNotification = {\n ...jsonrpcNotification,\n params: {\n ...jsonrpcNotification.params,\n _meta: {\n ...(jsonrpcNotification.params?._meta || {}),\n [RELATED_TASK_META_KEY]: options.relatedTask\n }\n }\n };\n }\n // Send the notification, but don't await it here to avoid blocking.\n // Handle potential errors with a .catch().\n this._transport?.send(jsonrpcNotification, options).catch(error => this._onerror(error));\n });\n // Return immediately.\n return;\n }\n let jsonrpcNotification = {\n ...notification,\n jsonrpc: '2.0'\n };\n // Augment with related task metadata if relatedTask is provided\n if (options?.relatedTask) {\n jsonrpcNotification = {\n ...jsonrpcNotification,\n params: {\n ...jsonrpcNotification.params,\n _meta: {\n ...(jsonrpcNotification.params?._meta || {}),\n [RELATED_TASK_META_KEY]: options.relatedTask\n }\n }\n };\n }\n await this._transport.send(jsonrpcNotification, options);\n }\n /**\n * Registers a handler to invoke when this protocol object receives a request with the given method.\n *\n * Note that this will replace any previous request handler for the same method.\n */\n setRequestHandler(requestSchema, handler) {\n const method = getMethodLiteral(requestSchema);\n this.assertRequestHandlerCapability(method);\n this._requestHandlers.set(method, (request, extra) => {\n const parsed = parseWithCompat(requestSchema, request);\n return Promise.resolve(handler(parsed, extra));\n });\n }\n /**\n * Removes the request handler for the given method.\n */\n removeRequestHandler(method) {\n this._requestHandlers.delete(method);\n }\n /**\n * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.\n */\n assertCanSetRequestHandler(method) {\n if (this._requestHandlers.has(method)) {\n throw new Error(`A request handler for ${method} already exists, which would be overridden`);\n }\n }\n /**\n * Registers a handler to invoke when this protocol object receives a notification with the given method.\n *\n * Note that this will replace any previous notification handler for the same method.\n */\n setNotificationHandler(notificationSchema, handler) {\n const method = getMethodLiteral(notificationSchema);\n this._notificationHandlers.set(method, notification => {\n const parsed = parseWithCompat(notificationSchema, notification);\n return Promise.resolve(handler(parsed));\n });\n }\n /**\n * Removes the notification handler for the given method.\n */\n removeNotificationHandler(method) {\n this._notificationHandlers.delete(method);\n }\n /**\n * Cleans up the progress handler associated with a task.\n * This should be called when a task reaches a terminal status.\n */\n _cleanupTaskProgressHandler(taskId) {\n const progressToken = this._taskProgressTokens.get(taskId);\n if (progressToken !== undefined) {\n this._progressHandlers.delete(progressToken);\n this._taskProgressTokens.delete(taskId);\n }\n }\n /**\n * Enqueues a task-related message for side-channel delivery via tasks/result.\n * @param taskId The task ID to associate the message with\n * @param message The message to enqueue\n * @param sessionId Optional session ID for binding the operation to a specific session\n * @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow)\n *\n * Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle\n * the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer\n * simply propagates the error.\n */\n async _enqueueTaskMessage(taskId, message, sessionId) {\n // Task message queues are only used when taskStore is configured\n if (!this._taskStore || !this._taskMessageQueue) {\n throw new Error('Cannot enqueue task message: taskStore and taskMessageQueue are not configured');\n }\n const maxQueueSize = this._options?.maxTaskQueueSize;\n await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);\n }\n /**\n * Clears the message queue for a task and rejects any pending request resolvers.\n * @param taskId The task ID whose queue should be cleared\n * @param sessionId Optional session ID for binding the operation to a specific session\n */\n async _clearTaskQueue(taskId, sessionId) {\n if (this._taskMessageQueue) {\n // Reject any pending request resolvers\n const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId);\n for (const message of messages) {\n if (message.type === 'request' && isJSONRPCRequest(message.message)) {\n // Extract request ID from the message\n const requestId = message.message.id;\n const resolver = this._requestResolvers.get(requestId);\n if (resolver) {\n resolver(new McpError(ErrorCode.InternalError, 'Task cancelled or completed'));\n this._requestResolvers.delete(requestId);\n }\n else {\n // Log error when resolver is missing during cleanup for better observability\n this._onerror(new Error(`Resolver missing for request ${requestId} during task ${taskId} cleanup`));\n }\n }\n }\n }\n }\n /**\n * Waits for a task update (new messages or status change) with abort signal support.\n * Uses polling to check for updates at the task's configured poll interval.\n * @param taskId The task ID to wait for\n * @param signal Abort signal to cancel the wait\n * @returns Promise that resolves when an update occurs or rejects if aborted\n */\n async _waitForTaskUpdate(taskId, signal) {\n // Get the task's poll interval, falling back to default\n let interval = this._options?.defaultTaskPollInterval ?? 1000;\n try {\n const task = await this._taskStore?.getTask(taskId);\n if (task?.pollInterval) {\n interval = task.pollInterval;\n }\n }\n catch {\n // Use default interval if task lookup fails\n }\n return new Promise((resolve, reject) => {\n if (signal.aborted) {\n reject(new McpError(ErrorCode.InvalidRequest, 'Request cancelled'));\n return;\n }\n // Wait for the poll interval, then resolve so caller can check for updates\n const timeoutId = setTimeout(resolve, interval);\n // Clean up timeout and reject if aborted\n signal.addEventListener('abort', () => {\n clearTimeout(timeoutId);\n reject(new McpError(ErrorCode.InvalidRequest, 'Request cancelled'));\n }, { once: true });\n });\n }\n requestTaskStore(request, sessionId) {\n const taskStore = this._taskStore;\n if (!taskStore) {\n throw new Error('No task store configured');\n }\n return {\n createTask: async (taskParams) => {\n if (!request) {\n throw new Error('No request provided');\n }\n return await taskStore.createTask(taskParams, request.id, {\n method: request.method,\n params: request.params\n }, sessionId);\n },\n getTask: async (taskId) => {\n const task = await taskStore.getTask(taskId, sessionId);\n if (!task) {\n throw new McpError(ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found');\n }\n return task;\n },\n storeTaskResult: async (taskId, status, result) => {\n await taskStore.storeTaskResult(taskId, status, result, sessionId);\n // Get updated task state and send notification\n const task = await taskStore.getTask(taskId, sessionId);\n if (task) {\n const notification = TaskStatusNotificationSchema.parse({\n method: 'notifications/tasks/status',\n params: task\n });\n await this.notification(notification);\n if (isTerminal(task.status)) {\n this._cleanupTaskProgressHandler(taskId);\n // Don't clear queue here - it will be cleared after delivery via tasks/result\n }\n }\n },\n getTaskResult: taskId => {\n return taskStore.getTaskResult(taskId, sessionId);\n },\n updateTaskStatus: async (taskId, status, statusMessage) => {\n // Check if task exists\n const task = await taskStore.getTask(taskId, sessionId);\n if (!task) {\n throw new McpError(ErrorCode.InvalidParams, `Task \"${taskId}\" not found - it may have been cleaned up`);\n }\n // Don't allow transitions from terminal states\n if (isTerminal(task.status)) {\n throw new McpError(ErrorCode.InvalidParams, `Cannot update task \"${taskId}\" from terminal status \"${task.status}\" to \"${status}\". Terminal states (completed, failed, cancelled) cannot transition to other states.`);\n }\n await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId);\n // Get updated task state and send notification\n const updatedTask = await taskStore.getTask(taskId, sessionId);\n if (updatedTask) {\n const notification = TaskStatusNotificationSchema.parse({\n method: 'notifications/tasks/status',\n params: updatedTask\n });\n await this.notification(notification);\n if (isTerminal(updatedTask.status)) {\n this._cleanupTaskProgressHandler(taskId);\n // Don't clear queue here - it will be cleared after delivery via tasks/result\n }\n }\n },\n listTasks: cursor => {\n return taskStore.listTasks(cursor, sessionId);\n }\n };\n }\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nexport function mergeCapabilities(base, additional) {\n const result = { ...base };\n for (const key in additional) {\n const k = key;\n const addValue = additional[k];\n if (addValue === undefined)\n continue;\n const baseValue = result[k];\n if (isPlainObject(baseValue) && isPlainObject(addValue)) {\n result[k] = { ...baseValue, ...addValue };\n }\n else {\n result[k] = addValue;\n }\n }\n return result;\n}\n//# sourceMappingURL=protocol.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nclass _CodeOrName {\n}\nexports._CodeOrName = _CodeOrName;\nexports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;\nclass Name extends _CodeOrName {\n constructor(s) {\n super();\n if (!exports.IDENTIFIER.test(s))\n throw new Error(\"CodeGen: name must be a valid identifier\");\n this.str = s;\n }\n toString() {\n return this.str;\n }\n emptyStr() {\n return false;\n }\n get names() {\n return { [this.str]: 1 };\n }\n}\nexports.Name = Name;\nclass _Code extends _CodeOrName {\n constructor(code) {\n super();\n this._items = typeof code === \"string\" ? [code] : code;\n }\n toString() {\n return this.str;\n }\n emptyStr() {\n if (this._items.length > 1)\n return false;\n const item = this._items[0];\n return item === \"\" || item === '\"\"';\n }\n get str() {\n var _a;\n return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, \"\")));\n }\n get names() {\n var _a;\n return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => {\n if (c instanceof Name)\n names[c.str] = (names[c.str] || 0) + 1;\n return names;\n }, {})));\n }\n}\nexports._Code = _Code;\nexports.nil = new _Code(\"\");\nfunction _(strs, ...args) {\n const code = [strs[0]];\n let i = 0;\n while (i < args.length) {\n addCodeArg(code, args[i]);\n code.push(strs[++i]);\n }\n return new _Code(code);\n}\nexports._ = _;\nconst plus = new _Code(\"+\");\nfunction str(strs, ...args) {\n const expr = [safeStringify(strs[0])];\n let i = 0;\n while (i < args.length) {\n expr.push(plus);\n addCodeArg(expr, args[i]);\n expr.push(plus, safeStringify(strs[++i]));\n }\n optimize(expr);\n return new _Code(expr);\n}\nexports.str = str;\nfunction addCodeArg(code, arg) {\n if (arg instanceof _Code)\n code.push(...arg._items);\n else if (arg instanceof Name)\n code.push(arg);\n else\n code.push(interpolate(arg));\n}\nexports.addCodeArg = addCodeArg;\nfunction optimize(expr) {\n let i = 1;\n while (i < expr.length - 1) {\n if (expr[i] === plus) {\n const res = mergeExprItems(expr[i - 1], expr[i + 1]);\n if (res !== undefined) {\n expr.splice(i - 1, 3, res);\n continue;\n }\n expr[i++] = \"+\";\n }\n i++;\n }\n}\nfunction mergeExprItems(a, b) {\n if (b === '\"\"')\n return a;\n if (a === '\"\"')\n return b;\n if (typeof a == \"string\") {\n if (b instanceof Name || a[a.length - 1] !== '\"')\n return;\n if (typeof b != \"string\")\n return `${a.slice(0, -1)}${b}\"`;\n if (b[0] === '\"')\n return a.slice(0, -1) + b.slice(1);\n return;\n }\n if (typeof b == \"string\" && b[0] === '\"' && !(a instanceof Name))\n return `\"${a}${b.slice(1)}`;\n return;\n}\nfunction strConcat(c1, c2) {\n return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;\n}\nexports.strConcat = strConcat;\n// TODO do not allow arrays here\nfunction interpolate(x) {\n return typeof x == \"number\" || typeof x == \"boolean\" || x === null\n ? x\n : safeStringify(Array.isArray(x) ? x.join(\",\") : x);\n}\nfunction stringify(x) {\n return new _Code(safeStringify(x));\n}\nexports.stringify = stringify;\nfunction safeStringify(x) {\n return JSON.stringify(x)\n .replace(/\\u2028/g, \"\\\\u2028\")\n .replace(/\\u2029/g, \"\\\\u2029\");\n}\nexports.safeStringify = safeStringify;\nfunction getProperty(key) {\n return typeof key == \"string\" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;\n}\nexports.getProperty = getProperty;\n//Does best effort to format the name properly\nfunction getEsmExportName(key) {\n if (typeof key == \"string\" && exports.IDENTIFIER.test(key)) {\n return new _Code(`${key}`);\n }\n throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);\n}\nexports.getEsmExportName = getEsmExportName;\nfunction regexpCode(rx) {\n return new _Code(rx.toString());\n}\nexports.regexpCode = regexpCode;\n//# sourceMappingURL=code.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;\nconst code_1 = require(\"./code\");\nclass ValueError extends Error {\n constructor(name) {\n super(`CodeGen: \"code\" for ${name} not defined`);\n this.value = name.value;\n }\n}\nvar UsedValueState;\n(function (UsedValueState) {\n UsedValueState[UsedValueState[\"Started\"] = 0] = \"Started\";\n UsedValueState[UsedValueState[\"Completed\"] = 1] = \"Completed\";\n})(UsedValueState || (exports.UsedValueState = UsedValueState = {}));\nexports.varKinds = {\n const: new code_1.Name(\"const\"),\n let: new code_1.Name(\"let\"),\n var: new code_1.Name(\"var\"),\n};\nclass Scope {\n constructor({ prefixes, parent } = {}) {\n this._names = {};\n this._prefixes = prefixes;\n this._parent = parent;\n }\n toName(nameOrPrefix) {\n return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);\n }\n name(prefix) {\n return new code_1.Name(this._newName(prefix));\n }\n _newName(prefix) {\n const ng = this._names[prefix] || this._nameGroup(prefix);\n return `${prefix}${ng.index++}`;\n }\n _nameGroup(prefix) {\n var _a, _b;\n if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) {\n throw new Error(`CodeGen: prefix \"${prefix}\" is not allowed in this scope`);\n }\n return (this._names[prefix] = { prefix, index: 0 });\n }\n}\nexports.Scope = Scope;\nclass ValueScopeName extends code_1.Name {\n constructor(prefix, nameStr) {\n super(nameStr);\n this.prefix = prefix;\n }\n setValue(value, { property, itemIndex }) {\n this.value = value;\n this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;\n }\n}\nexports.ValueScopeName = ValueScopeName;\nconst line = (0, code_1._) `\\n`;\nclass ValueScope extends Scope {\n constructor(opts) {\n super(opts);\n this._values = {};\n this._scope = opts.scope;\n this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };\n }\n get() {\n return this._scope;\n }\n name(prefix) {\n return new ValueScopeName(prefix, this._newName(prefix));\n }\n value(nameOrPrefix, value) {\n var _a;\n if (value.ref === undefined)\n throw new Error(\"CodeGen: ref must be passed in value\");\n const name = this.toName(nameOrPrefix);\n const { prefix } = name;\n const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;\n let vs = this._values[prefix];\n if (vs) {\n const _name = vs.get(valueKey);\n if (_name)\n return _name;\n }\n else {\n vs = this._values[prefix] = new Map();\n }\n vs.set(valueKey, name);\n const s = this._scope[prefix] || (this._scope[prefix] = []);\n const itemIndex = s.length;\n s[itemIndex] = value.ref;\n name.setValue(value, { property: prefix, itemIndex });\n return name;\n }\n getValue(prefix, keyOrRef) {\n const vs = this._values[prefix];\n if (!vs)\n return;\n return vs.get(keyOrRef);\n }\n scopeRefs(scopeName, values = this._values) {\n return this._reduceValues(values, (name) => {\n if (name.scopePath === undefined)\n throw new Error(`CodeGen: name \"${name}\" has no value`);\n return (0, code_1._) `${scopeName}${name.scopePath}`;\n });\n }\n scopeCode(values = this._values, usedValues, getCode) {\n return this._reduceValues(values, (name) => {\n if (name.value === undefined)\n throw new Error(`CodeGen: name \"${name}\" has no value`);\n return name.value.code;\n }, usedValues, getCode);\n }\n _reduceValues(values, valueCode, usedValues = {}, getCode) {\n let code = code_1.nil;\n for (const prefix in values) {\n const vs = values[prefix];\n if (!vs)\n continue;\n const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map());\n vs.forEach((name) => {\n if (nameSet.has(name))\n return;\n nameSet.set(name, UsedValueState.Started);\n let c = valueCode(name);\n if (c) {\n const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;\n code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;\n }\n else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {\n code = (0, code_1._) `${code}${c}${this.opts._n}`;\n }\n else {\n throw new ValueError(name);\n }\n nameSet.set(name, UsedValueState.Completed);\n });\n }\n return code;\n }\n}\nexports.ValueScope = ValueScope;\n//# sourceMappingURL=scope.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;\nconst code_1 = require(\"./code\");\nconst scope_1 = require(\"./scope\");\nvar code_2 = require(\"./code\");\nObject.defineProperty(exports, \"_\", { enumerable: true, get: function () { return code_2._; } });\nObject.defineProperty(exports, \"str\", { enumerable: true, get: function () { return code_2.str; } });\nObject.defineProperty(exports, \"strConcat\", { enumerable: true, get: function () { return code_2.strConcat; } });\nObject.defineProperty(exports, \"nil\", { enumerable: true, get: function () { return code_2.nil; } });\nObject.defineProperty(exports, \"getProperty\", { enumerable: true, get: function () { return code_2.getProperty; } });\nObject.defineProperty(exports, \"stringify\", { enumerable: true, get: function () { return code_2.stringify; } });\nObject.defineProperty(exports, \"regexpCode\", { enumerable: true, get: function () { return code_2.regexpCode; } });\nObject.defineProperty(exports, \"Name\", { enumerable: true, get: function () { return code_2.Name; } });\nvar scope_2 = require(\"./scope\");\nObject.defineProperty(exports, \"Scope\", { enumerable: true, get: function () { return scope_2.Scope; } });\nObject.defineProperty(exports, \"ValueScope\", { enumerable: true, get: function () { return scope_2.ValueScope; } });\nObject.defineProperty(exports, \"ValueScopeName\", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });\nObject.defineProperty(exports, \"varKinds\", { enumerable: true, get: function () { return scope_2.varKinds; } });\nexports.operators = {\n GT: new code_1._Code(\">\"),\n GTE: new code_1._Code(\">=\"),\n LT: new code_1._Code(\"<\"),\n LTE: new code_1._Code(\"<=\"),\n EQ: new code_1._Code(\"===\"),\n NEQ: new code_1._Code(\"!==\"),\n NOT: new code_1._Code(\"!\"),\n OR: new code_1._Code(\"||\"),\n AND: new code_1._Code(\"&&\"),\n ADD: new code_1._Code(\"+\"),\n};\nclass Node {\n optimizeNodes() {\n return this;\n }\n optimizeNames(_names, _constants) {\n return this;\n }\n}\nclass Def extends Node {\n constructor(varKind, name, rhs) {\n super();\n this.varKind = varKind;\n this.name = name;\n this.rhs = rhs;\n }\n render({ es5, _n }) {\n const varKind = es5 ? scope_1.varKinds.var : this.varKind;\n const rhs = this.rhs === undefined ? \"\" : ` = ${this.rhs}`;\n return `${varKind} ${this.name}${rhs};` + _n;\n }\n optimizeNames(names, constants) {\n if (!names[this.name.str])\n return;\n if (this.rhs)\n this.rhs = optimizeExpr(this.rhs, names, constants);\n return this;\n }\n get names() {\n return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};\n }\n}\nclass Assign extends Node {\n constructor(lhs, rhs, sideEffects) {\n super();\n this.lhs = lhs;\n this.rhs = rhs;\n this.sideEffects = sideEffects;\n }\n render({ _n }) {\n return `${this.lhs} = ${this.rhs};` + _n;\n }\n optimizeNames(names, constants) {\n if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)\n return;\n this.rhs = optimizeExpr(this.rhs, names, constants);\n return this;\n }\n get names() {\n const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };\n return addExprNames(names, this.rhs);\n }\n}\nclass AssignOp extends Assign {\n constructor(lhs, op, rhs, sideEffects) {\n super(lhs, rhs, sideEffects);\n this.op = op;\n }\n render({ _n }) {\n return `${this.lhs} ${this.op}= ${this.rhs};` + _n;\n }\n}\nclass Label extends Node {\n constructor(label) {\n super();\n this.label = label;\n this.names = {};\n }\n render({ _n }) {\n return `${this.label}:` + _n;\n }\n}\nclass Break extends Node {\n constructor(label) {\n super();\n this.label = label;\n this.names = {};\n }\n render({ _n }) {\n const label = this.label ? ` ${this.label}` : \"\";\n return `break${label};` + _n;\n }\n}\nclass Throw extends Node {\n constructor(error) {\n super();\n this.error = error;\n }\n render({ _n }) {\n return `throw ${this.error};` + _n;\n }\n get names() {\n return this.error.names;\n }\n}\nclass AnyCode extends Node {\n constructor(code) {\n super();\n this.code = code;\n }\n render({ _n }) {\n return `${this.code};` + _n;\n }\n optimizeNodes() {\n return `${this.code}` ? this : undefined;\n }\n optimizeNames(names, constants) {\n this.code = optimizeExpr(this.code, names, constants);\n return this;\n }\n get names() {\n return this.code instanceof code_1._CodeOrName ? this.code.names : {};\n }\n}\nclass ParentNode extends Node {\n constructor(nodes = []) {\n super();\n this.nodes = nodes;\n }\n render(opts) {\n return this.nodes.reduce((code, n) => code + n.render(opts), \"\");\n }\n optimizeNodes() {\n const { nodes } = this;\n let i = nodes.length;\n while (i--) {\n const n = nodes[i].optimizeNodes();\n if (Array.isArray(n))\n nodes.splice(i, 1, ...n);\n else if (n)\n nodes[i] = n;\n else\n nodes.splice(i, 1);\n }\n return nodes.length > 0 ? this : undefined;\n }\n optimizeNames(names, constants) {\n const { nodes } = this;\n let i = nodes.length;\n while (i--) {\n // iterating backwards improves 1-pass optimization\n const n = nodes[i];\n if (n.optimizeNames(names, constants))\n continue;\n subtractNames(names, n.names);\n nodes.splice(i, 1);\n }\n return nodes.length > 0 ? this : undefined;\n }\n get names() {\n return this.nodes.reduce((names, n) => addNames(names, n.names), {});\n }\n}\nclass BlockNode extends ParentNode {\n render(opts) {\n return \"{\" + opts._n + super.render(opts) + \"}\" + opts._n;\n }\n}\nclass Root extends ParentNode {\n}\nclass Else extends BlockNode {\n}\nElse.kind = \"else\";\nclass If extends BlockNode {\n constructor(condition, nodes) {\n super(nodes);\n this.condition = condition;\n }\n render(opts) {\n let code = `if(${this.condition})` + super.render(opts);\n if (this.else)\n code += \"else \" + this.else.render(opts);\n return code;\n }\n optimizeNodes() {\n super.optimizeNodes();\n const cond = this.condition;\n if (cond === true)\n return this.nodes; // else is ignored here\n let e = this.else;\n if (e) {\n const ns = e.optimizeNodes();\n e = this.else = Array.isArray(ns) ? new Else(ns) : ns;\n }\n if (e) {\n if (cond === false)\n return e instanceof If ? e : e.nodes;\n if (this.nodes.length)\n return this;\n return new If(not(cond), e instanceof If ? [e] : e.nodes);\n }\n if (cond === false || !this.nodes.length)\n return undefined;\n return this;\n }\n optimizeNames(names, constants) {\n var _a;\n this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);\n if (!(super.optimizeNames(names, constants) || this.else))\n return;\n this.condition = optimizeExpr(this.condition, names, constants);\n return this;\n }\n get names() {\n const names = super.names;\n addExprNames(names, this.condition);\n if (this.else)\n addNames(names, this.else.names);\n return names;\n }\n}\nIf.kind = \"if\";\nclass For extends BlockNode {\n}\nFor.kind = \"for\";\nclass ForLoop extends For {\n constructor(iteration) {\n super();\n this.iteration = iteration;\n }\n render(opts) {\n return `for(${this.iteration})` + super.render(opts);\n }\n optimizeNames(names, constants) {\n if (!super.optimizeNames(names, constants))\n return;\n this.iteration = optimizeExpr(this.iteration, names, constants);\n return this;\n }\n get names() {\n return addNames(super.names, this.iteration.names);\n }\n}\nclass ForRange extends For {\n constructor(varKind, name, from, to) {\n super();\n this.varKind = varKind;\n this.name = name;\n this.from = from;\n this.to = to;\n }\n render(opts) {\n const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;\n const { name, from, to } = this;\n return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);\n }\n get names() {\n const names = addExprNames(super.names, this.from);\n return addExprNames(names, this.to);\n }\n}\nclass ForIter extends For {\n constructor(loop, varKind, name, iterable) {\n super();\n this.loop = loop;\n this.varKind = varKind;\n this.name = name;\n this.iterable = iterable;\n }\n render(opts) {\n return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);\n }\n optimizeNames(names, constants) {\n if (!super.optimizeNames(names, constants))\n return;\n this.iterable = optimizeExpr(this.iterable, names, constants);\n return this;\n }\n get names() {\n return addNames(super.names, this.iterable.names);\n }\n}\nclass Func extends BlockNode {\n constructor(name, args, async) {\n super();\n this.name = name;\n this.args = args;\n this.async = async;\n }\n render(opts) {\n const _async = this.async ? \"async \" : \"\";\n return `${_async}function ${this.name}(${this.args})` + super.render(opts);\n }\n}\nFunc.kind = \"func\";\nclass Return extends ParentNode {\n render(opts) {\n return \"return \" + super.render(opts);\n }\n}\nReturn.kind = \"return\";\nclass Try extends BlockNode {\n render(opts) {\n let code = \"try\" + super.render(opts);\n if (this.catch)\n code += this.catch.render(opts);\n if (this.finally)\n code += this.finally.render(opts);\n return code;\n }\n optimizeNodes() {\n var _a, _b;\n super.optimizeNodes();\n (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();\n (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();\n return this;\n }\n optimizeNames(names, constants) {\n var _a, _b;\n super.optimizeNames(names, constants);\n (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);\n (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);\n return this;\n }\n get names() {\n const names = super.names;\n if (this.catch)\n addNames(names, this.catch.names);\n if (this.finally)\n addNames(names, this.finally.names);\n return names;\n }\n}\nclass Catch extends BlockNode {\n constructor(error) {\n super();\n this.error = error;\n }\n render(opts) {\n return `catch(${this.error})` + super.render(opts);\n }\n}\nCatch.kind = \"catch\";\nclass Finally extends BlockNode {\n render(opts) {\n return \"finally\" + super.render(opts);\n }\n}\nFinally.kind = \"finally\";\nclass CodeGen {\n constructor(extScope, opts = {}) {\n this._values = {};\n this._blockStarts = [];\n this._constants = {};\n this.opts = { ...opts, _n: opts.lines ? \"\\n\" : \"\" };\n this._extScope = extScope;\n this._scope = new scope_1.Scope({ parent: extScope });\n this._nodes = [new Root()];\n }\n toString() {\n return this._root.render(this.opts);\n }\n // returns unique name in the internal scope\n name(prefix) {\n return this._scope.name(prefix);\n }\n // reserves unique name in the external scope\n scopeName(prefix) {\n return this._extScope.name(prefix);\n }\n // reserves unique name in the external scope and assigns value to it\n scopeValue(prefixOrName, value) {\n const name = this._extScope.value(prefixOrName, value);\n const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set());\n vs.add(name);\n return name;\n }\n getScopeValue(prefix, keyOrRef) {\n return this._extScope.getValue(prefix, keyOrRef);\n }\n // return code that assigns values in the external scope to the names that are used internally\n // (same names that were returned by gen.scopeName or gen.scopeValue)\n scopeRefs(scopeName) {\n return this._extScope.scopeRefs(scopeName, this._values);\n }\n scopeCode() {\n return this._extScope.scopeCode(this._values);\n }\n _def(varKind, nameOrPrefix, rhs, constant) {\n const name = this._scope.toName(nameOrPrefix);\n if (rhs !== undefined && constant)\n this._constants[name.str] = rhs;\n this._leafNode(new Def(varKind, name, rhs));\n return name;\n }\n // `const` declaration (`var` in es5 mode)\n const(nameOrPrefix, rhs, _constant) {\n return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);\n }\n // `let` declaration with optional assignment (`var` in es5 mode)\n let(nameOrPrefix, rhs, _constant) {\n return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);\n }\n // `var` declaration with optional assignment\n var(nameOrPrefix, rhs, _constant) {\n return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);\n }\n // assignment code\n assign(lhs, rhs, sideEffects) {\n return this._leafNode(new Assign(lhs, rhs, sideEffects));\n }\n // `+=` code\n add(lhs, rhs) {\n return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs));\n }\n // appends passed SafeExpr to code or executes Block\n code(c) {\n if (typeof c == \"function\")\n c();\n else if (c !== code_1.nil)\n this._leafNode(new AnyCode(c));\n return this;\n }\n // returns code for object literal for the passed argument list of key-value pairs\n object(...keyValues) {\n const code = [\"{\"];\n for (const [key, value] of keyValues) {\n if (code.length > 1)\n code.push(\",\");\n code.push(key);\n if (key !== value || this.opts.es5) {\n code.push(\":\");\n (0, code_1.addCodeArg)(code, value);\n }\n }\n code.push(\"}\");\n return new code_1._Code(code);\n }\n // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)\n if(condition, thenBody, elseBody) {\n this._blockNode(new If(condition));\n if (thenBody && elseBody) {\n this.code(thenBody).else().code(elseBody).endIf();\n }\n else if (thenBody) {\n this.code(thenBody).endIf();\n }\n else if (elseBody) {\n throw new Error('CodeGen: \"else\" body without \"then\" body');\n }\n return this;\n }\n // `else if` clause - invalid without `if` or after `else` clauses\n elseIf(condition) {\n return this._elseNode(new If(condition));\n }\n // `else` clause - only valid after `if` or `else if` clauses\n else() {\n return this._elseNode(new Else());\n }\n // end `if` statement (needed if gen.if was used only with condition)\n endIf() {\n return this._endBlockNode(If, Else);\n }\n _for(node, forBody) {\n this._blockNode(node);\n if (forBody)\n this.code(forBody).endFor();\n return this;\n }\n // a generic `for` clause (or statement if `forBody` is passed)\n for(iteration, forBody) {\n return this._for(new ForLoop(iteration), forBody);\n }\n // `for` statement for a range of values\n forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {\n const name = this._scope.toName(nameOrPrefix);\n return this._for(new ForRange(varKind, name, from, to), () => forBody(name));\n }\n // `for-of` statement (in es5 mode replace with a normal for loop)\n forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {\n const name = this._scope.toName(nameOrPrefix);\n if (this.opts.es5) {\n const arr = iterable instanceof code_1.Name ? iterable : this.var(\"_arr\", iterable);\n return this.forRange(\"_i\", 0, (0, code_1._) `${arr}.length`, (i) => {\n this.var(name, (0, code_1._) `${arr}[${i}]`);\n forBody(name);\n });\n }\n return this._for(new ForIter(\"of\", varKind, name, iterable), () => forBody(name));\n }\n // `for-in` statement.\n // With option `ownProperties` replaced with a `for-of` loop for object keys\n forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {\n if (this.opts.ownProperties) {\n return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody);\n }\n const name = this._scope.toName(nameOrPrefix);\n return this._for(new ForIter(\"in\", varKind, name, obj), () => forBody(name));\n }\n // end `for` loop\n endFor() {\n return this._endBlockNode(For);\n }\n // `label` statement\n label(label) {\n return this._leafNode(new Label(label));\n }\n // `break` statement\n break(label) {\n return this._leafNode(new Break(label));\n }\n // `return` statement\n return(value) {\n const node = new Return();\n this._blockNode(node);\n this.code(value);\n if (node.nodes.length !== 1)\n throw new Error('CodeGen: \"return\" should have one node');\n return this._endBlockNode(Return);\n }\n // `try` statement\n try(tryBody, catchCode, finallyCode) {\n if (!catchCode && !finallyCode)\n throw new Error('CodeGen: \"try\" without \"catch\" and \"finally\"');\n const node = new Try();\n this._blockNode(node);\n this.code(tryBody);\n if (catchCode) {\n const error = this.name(\"e\");\n this._currNode = node.catch = new Catch(error);\n catchCode(error);\n }\n if (finallyCode) {\n this._currNode = node.finally = new Finally();\n this.code(finallyCode);\n }\n return this._endBlockNode(Catch, Finally);\n }\n // `throw` statement\n throw(error) {\n return this._leafNode(new Throw(error));\n }\n // start self-balancing block\n block(body, nodeCount) {\n this._blockStarts.push(this._nodes.length);\n if (body)\n this.code(body).endBlock(nodeCount);\n return this;\n }\n // end the current self-balancing block\n endBlock(nodeCount) {\n const len = this._blockStarts.pop();\n if (len === undefined)\n throw new Error(\"CodeGen: not in self-balancing block\");\n const toClose = this._nodes.length - len;\n if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {\n throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);\n }\n this._nodes.length = len;\n return this;\n }\n // `function` heading (or definition if funcBody is passed)\n func(name, args = code_1.nil, async, funcBody) {\n this._blockNode(new Func(name, args, async));\n if (funcBody)\n this.code(funcBody).endFunc();\n return this;\n }\n // end function definition\n endFunc() {\n return this._endBlockNode(Func);\n }\n optimize(n = 1) {\n while (n-- > 0) {\n this._root.optimizeNodes();\n this._root.optimizeNames(this._root.names, this._constants);\n }\n }\n _leafNode(node) {\n this._currNode.nodes.push(node);\n return this;\n }\n _blockNode(node) {\n this._currNode.nodes.push(node);\n this._nodes.push(node);\n }\n _endBlockNode(N1, N2) {\n const n = this._currNode;\n if (n instanceof N1 || (N2 && n instanceof N2)) {\n this._nodes.pop();\n return this;\n }\n throw new Error(`CodeGen: not in block \"${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}\"`);\n }\n _elseNode(node) {\n const n = this._currNode;\n if (!(n instanceof If)) {\n throw new Error('CodeGen: \"else\" without \"if\"');\n }\n this._currNode = n.else = node;\n return this;\n }\n get _root() {\n return this._nodes[0];\n }\n get _currNode() {\n const ns = this._nodes;\n return ns[ns.length - 1];\n }\n set _currNode(node) {\n const ns = this._nodes;\n ns[ns.length - 1] = node;\n }\n}\nexports.CodeGen = CodeGen;\nfunction addNames(names, from) {\n for (const n in from)\n names[n] = (names[n] || 0) + (from[n] || 0);\n return names;\n}\nfunction addExprNames(names, from) {\n return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;\n}\nfunction optimizeExpr(expr, names, constants) {\n if (expr instanceof code_1.Name)\n return replaceName(expr);\n if (!canOptimize(expr))\n return expr;\n return new code_1._Code(expr._items.reduce((items, c) => {\n if (c instanceof code_1.Name)\n c = replaceName(c);\n if (c instanceof code_1._Code)\n items.push(...c._items);\n else\n items.push(c);\n return items;\n }, []));\n function replaceName(n) {\n const c = constants[n.str];\n if (c === undefined || names[n.str] !== 1)\n return n;\n delete names[n.str];\n return c;\n }\n function canOptimize(e) {\n return (e instanceof code_1._Code &&\n e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined));\n }\n}\nfunction subtractNames(names, from) {\n for (const n in from)\n names[n] = (names[n] || 0) - (from[n] || 0);\n}\nfunction not(x) {\n return typeof x == \"boolean\" || typeof x == \"number\" || x === null ? !x : (0, code_1._) `!${par(x)}`;\n}\nexports.not = not;\nconst andCode = mappend(exports.operators.AND);\n// boolean AND (&&) expression with the passed arguments\nfunction and(...args) {\n return args.reduce(andCode);\n}\nexports.and = and;\nconst orCode = mappend(exports.operators.OR);\n// boolean OR (||) expression with the passed arguments\nfunction or(...args) {\n return args.reduce(orCode);\n}\nexports.or = or;\nfunction mappend(op) {\n return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);\n}\nfunction par(x) {\n return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;\nconst codegen_1 = require(\"./codegen\");\nconst code_1 = require(\"./codegen/code\");\n// TODO refactor to use Set\nfunction toHash(arr) {\n const hash = {};\n for (const item of arr)\n hash[item] = true;\n return hash;\n}\nexports.toHash = toHash;\nfunction alwaysValidSchema(it, schema) {\n if (typeof schema == \"boolean\")\n return schema;\n if (Object.keys(schema).length === 0)\n return true;\n checkUnknownRules(it, schema);\n return !schemaHasRules(schema, it.self.RULES.all);\n}\nexports.alwaysValidSchema = alwaysValidSchema;\nfunction checkUnknownRules(it, schema = it.schema) {\n const { opts, self } = it;\n if (!opts.strictSchema)\n return;\n if (typeof schema === \"boolean\")\n return;\n const rules = self.RULES.keywords;\n for (const key in schema) {\n if (!rules[key])\n checkStrictMode(it, `unknown keyword: \"${key}\"`);\n }\n}\nexports.checkUnknownRules = checkUnknownRules;\nfunction schemaHasRules(schema, rules) {\n if (typeof schema == \"boolean\")\n return !schema;\n for (const key in schema)\n if (rules[key])\n return true;\n return false;\n}\nexports.schemaHasRules = schemaHasRules;\nfunction schemaHasRulesButRef(schema, RULES) {\n if (typeof schema == \"boolean\")\n return !schema;\n for (const key in schema)\n if (key !== \"$ref\" && RULES.all[key])\n return true;\n return false;\n}\nexports.schemaHasRulesButRef = schemaHasRulesButRef;\nfunction schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {\n if (!$data) {\n if (typeof schema == \"number\" || typeof schema == \"boolean\")\n return schema;\n if (typeof schema == \"string\")\n return (0, codegen_1._) `${schema}`;\n }\n return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;\n}\nexports.schemaRefOrVal = schemaRefOrVal;\nfunction unescapeFragment(str) {\n return unescapeJsonPointer(decodeURIComponent(str));\n}\nexports.unescapeFragment = unescapeFragment;\nfunction escapeFragment(str) {\n return encodeURIComponent(escapeJsonPointer(str));\n}\nexports.escapeFragment = escapeFragment;\nfunction escapeJsonPointer(str) {\n if (typeof str == \"number\")\n return `${str}`;\n return str.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nexports.escapeJsonPointer = escapeJsonPointer;\nfunction unescapeJsonPointer(str) {\n return str.replace(/~1/g, \"/\").replace(/~0/g, \"~\");\n}\nexports.unescapeJsonPointer = unescapeJsonPointer;\nfunction eachItem(xs, f) {\n if (Array.isArray(xs)) {\n for (const x of xs)\n f(x);\n }\n else {\n f(xs);\n }\n}\nexports.eachItem = eachItem;\nfunction makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) {\n return (gen, from, to, toName) => {\n const res = to === undefined\n ? from\n : to instanceof codegen_1.Name\n ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to)\n : from instanceof codegen_1.Name\n ? (mergeToName(gen, to, from), from)\n : mergeValues(from, to);\n return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;\n };\n}\nexports.mergeEvaluated = {\n props: makeMergeEvaluated({\n mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => {\n gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`));\n }),\n mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => {\n if (from === true) {\n gen.assign(to, true);\n }\n else {\n gen.assign(to, (0, codegen_1._) `${to} || {}`);\n setEvaluated(gen, to, from);\n }\n }),\n mergeValues: (from, to) => (from === true ? true : { ...from, ...to }),\n resultToName: evaluatedPropsToName,\n }),\n items: makeMergeEvaluated({\n mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),\n mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)),\n mergeValues: (from, to) => (from === true ? true : Math.max(from, to)),\n resultToName: (gen, items) => gen.var(\"items\", items),\n }),\n};\nfunction evaluatedPropsToName(gen, ps) {\n if (ps === true)\n return gen.var(\"props\", true);\n const props = gen.var(\"props\", (0, codegen_1._) `{}`);\n if (ps !== undefined)\n setEvaluated(gen, props, ps);\n return props;\n}\nexports.evaluatedPropsToName = evaluatedPropsToName;\nfunction setEvaluated(gen, props, ps) {\n Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true));\n}\nexports.setEvaluated = setEvaluated;\nconst snippets = {};\nfunction useFunc(gen, f) {\n return gen.scopeValue(\"func\", {\n ref: f,\n code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)),\n });\n}\nexports.useFunc = useFunc;\nvar Type;\n(function (Type) {\n Type[Type[\"Num\"] = 0] = \"Num\";\n Type[Type[\"Str\"] = 1] = \"Str\";\n})(Type || (exports.Type = Type = {}));\nfunction getErrorPath(dataProp, dataPropType, jsPropertySyntax) {\n // let path\n if (dataProp instanceof codegen_1.Name) {\n const isNumber = dataPropType === Type.Num;\n return jsPropertySyntax\n ? isNumber\n ? (0, codegen_1._) `\"[\" + ${dataProp} + \"]\"`\n : (0, codegen_1._) `\"['\" + ${dataProp} + \"']\"`\n : isNumber\n ? (0, codegen_1._) `\"/\" + ${dataProp}`\n : (0, codegen_1._) `\"/\" + ${dataProp}.replace(/~/g, \"~0\").replace(/\\\\//g, \"~1\")`; // TODO maybe use global escapePointer\n }\n return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : \"/\" + escapeJsonPointer(dataProp);\n}\nexports.getErrorPath = getErrorPath;\nfunction checkStrictMode(it, msg, mode = it.opts.strictSchema) {\n if (!mode)\n return;\n msg = `strict mode: ${msg}`;\n if (mode === true)\n throw new Error(msg);\n it.self.logger.warn(msg);\n}\nexports.checkStrictMode = checkStrictMode;\n//# sourceMappingURL=util.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"./codegen\");\nconst names = {\n // validation function arguments\n data: new codegen_1.Name(\"data\"), // data passed to validation function\n // args passed from referencing schema\n valCxt: new codegen_1.Name(\"valCxt\"), // validation/data context - should not be used directly, it is destructured to the names below\n instancePath: new codegen_1.Name(\"instancePath\"),\n parentData: new codegen_1.Name(\"parentData\"),\n parentDataProperty: new codegen_1.Name(\"parentDataProperty\"),\n rootData: new codegen_1.Name(\"rootData\"), // root data - same as the data passed to the first/top validation function\n dynamicAnchors: new codegen_1.Name(\"dynamicAnchors\"), // used to support recursiveRef and dynamicRef\n // function scoped variables\n vErrors: new codegen_1.Name(\"vErrors\"), // null or array of validation errors\n errors: new codegen_1.Name(\"errors\"), // counter of validation errors\n this: new codegen_1.Name(\"this\"),\n // \"globals\"\n self: new codegen_1.Name(\"self\"),\n scope: new codegen_1.Name(\"scope\"),\n // JTD serialize/parse name for JSON string and position\n json: new codegen_1.Name(\"json\"),\n jsonPos: new codegen_1.Name(\"jsonPos\"),\n jsonLen: new codegen_1.Name(\"jsonLen\"),\n jsonPart: new codegen_1.Name(\"jsonPart\"),\n};\nexports.default = names;\n//# sourceMappingURL=names.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;\nconst codegen_1 = require(\"./codegen\");\nconst util_1 = require(\"./util\");\nconst names_1 = require(\"./names\");\nexports.keywordError = {\n message: ({ keyword }) => (0, codegen_1.str) `must pass \"${keyword}\" keyword validation`,\n};\nexports.keyword$DataError = {\n message: ({ keyword, schemaType }) => schemaType\n ? (0, codegen_1.str) `\"${keyword}\" keyword must be ${schemaType} ($data)`\n : (0, codegen_1.str) `\"${keyword}\" keyword is invalid ($data)`,\n};\nfunction reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) {\n const { it } = cxt;\n const { gen, compositeRule, allErrors } = it;\n const errObj = errorObjectCode(cxt, error, errorPaths);\n if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) {\n addError(gen, errObj);\n }\n else {\n returnErrors(it, (0, codegen_1._) `[${errObj}]`);\n }\n}\nexports.reportError = reportError;\nfunction reportExtraError(cxt, error = exports.keywordError, errorPaths) {\n const { it } = cxt;\n const { gen, compositeRule, allErrors } = it;\n const errObj = errorObjectCode(cxt, error, errorPaths);\n addError(gen, errObj);\n if (!(compositeRule || allErrors)) {\n returnErrors(it, names_1.default.vErrors);\n }\n}\nexports.reportExtraError = reportExtraError;\nfunction resetErrorsCount(gen, errsCount) {\n gen.assign(names_1.default.errors, errsCount);\n gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));\n}\nexports.resetErrorsCount = resetErrorsCount;\nfunction extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) {\n /* istanbul ignore if */\n if (errsCount === undefined)\n throw new Error(\"ajv implementation error\");\n const err = gen.name(\"err\");\n gen.forRange(\"i\", errsCount, names_1.default.errors, (i) => {\n gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`);\n gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath)));\n gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`);\n if (it.opts.verbose) {\n gen.assign((0, codegen_1._) `${err}.schema`, schemaValue);\n gen.assign((0, codegen_1._) `${err}.data`, data);\n }\n });\n}\nexports.extendErrors = extendErrors;\nfunction addError(gen, errObj) {\n const err = gen.const(\"err\", errObj);\n gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`);\n gen.code((0, codegen_1._) `${names_1.default.errors}++`);\n}\nfunction returnErrors(it, errs) {\n const { gen, validateName, schemaEnv } = it;\n if (schemaEnv.$async) {\n gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`);\n }\n else {\n gen.assign((0, codegen_1._) `${validateName}.errors`, errs);\n gen.return(false);\n }\n}\nconst E = {\n keyword: new codegen_1.Name(\"keyword\"),\n schemaPath: new codegen_1.Name(\"schemaPath\"), // also used in JTD errors\n params: new codegen_1.Name(\"params\"),\n propertyName: new codegen_1.Name(\"propertyName\"),\n message: new codegen_1.Name(\"message\"),\n schema: new codegen_1.Name(\"schema\"),\n parentSchema: new codegen_1.Name(\"parentSchema\"),\n};\nfunction errorObjectCode(cxt, error, errorPaths) {\n const { createErrors } = cxt.it;\n if (createErrors === false)\n return (0, codegen_1._) `{}`;\n return errorObject(cxt, error, errorPaths);\n}\nfunction errorObject(cxt, error, errorPaths = {}) {\n const { gen, it } = cxt;\n const keyValues = [\n errorInstancePath(it, errorPaths),\n errorSchemaPath(cxt, errorPaths),\n ];\n extraErrorProps(cxt, error, keyValues);\n return gen.object(...keyValues);\n}\nfunction errorInstancePath({ errorPath }, { instancePath }) {\n const instPath = instancePath\n ? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}`\n : errorPath;\n return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)];\n}\nfunction errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {\n let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`;\n if (schemaPath) {\n schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;\n }\n return [E.schemaPath, schPath];\n}\nfunction extraErrorProps(cxt, { params, message }, keyValues) {\n const { keyword, data, schemaValue, it } = cxt;\n const { opts, propertyName, topSchemaRef, schemaPath } = it;\n keyValues.push([E.keyword, keyword], [E.params, typeof params == \"function\" ? params(cxt) : params || (0, codegen_1._) `{}`]);\n if (opts.messages) {\n keyValues.push([E.message, typeof message == \"function\" ? message(cxt) : message]);\n }\n if (opts.verbose) {\n keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);\n }\n if (propertyName)\n keyValues.push([E.propertyName, propertyName]);\n}\n//# sourceMappingURL=errors.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0;\nconst errors_1 = require(\"../errors\");\nconst codegen_1 = require(\"../codegen\");\nconst names_1 = require(\"../names\");\nconst boolError = {\n message: \"boolean schema is false\",\n};\nfunction topBoolOrEmptySchema(it) {\n const { gen, schema, validateName } = it;\n if (schema === false) {\n falseSchemaError(it, false);\n }\n else if (typeof schema == \"object\" && schema.$async === true) {\n gen.return(names_1.default.data);\n }\n else {\n gen.assign((0, codegen_1._) `${validateName}.errors`, null);\n gen.return(true);\n }\n}\nexports.topBoolOrEmptySchema = topBoolOrEmptySchema;\nfunction boolOrEmptySchema(it, valid) {\n const { gen, schema } = it;\n if (schema === false) {\n gen.var(valid, false); // TODO var\n falseSchemaError(it);\n }\n else {\n gen.var(valid, true); // TODO var\n }\n}\nexports.boolOrEmptySchema = boolOrEmptySchema;\nfunction falseSchemaError(it, overrideAllErrors) {\n const { gen, data } = it;\n // TODO maybe some other interface should be used for non-keyword validation errors...\n const cxt = {\n gen,\n keyword: \"false schema\",\n data,\n schema: false,\n schemaCode: false,\n schemaValue: false,\n params: {},\n it,\n };\n (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors);\n}\n//# sourceMappingURL=boolSchema.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getRules = exports.isJSONType = void 0;\nconst _jsonTypes = [\"string\", \"number\", \"integer\", \"boolean\", \"null\", \"object\", \"array\"];\nconst jsonTypes = new Set(_jsonTypes);\nfunction isJSONType(x) {\n return typeof x == \"string\" && jsonTypes.has(x);\n}\nexports.isJSONType = isJSONType;\nfunction getRules() {\n const groups = {\n number: { type: \"number\", rules: [] },\n string: { type: \"string\", rules: [] },\n array: { type: \"array\", rules: [] },\n object: { type: \"object\", rules: [] },\n };\n return {\n types: { ...groups, integer: true, boolean: true, null: true },\n rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object],\n post: { rules: [] },\n all: {},\n keywords: {},\n };\n}\nexports.getRules = getRules;\n//# sourceMappingURL=rules.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0;\nfunction schemaHasRulesForType({ schema, self }, type) {\n const group = self.RULES.types[type];\n return group && group !== true && shouldUseGroup(schema, group);\n}\nexports.schemaHasRulesForType = schemaHasRulesForType;\nfunction shouldUseGroup(schema, group) {\n return group.rules.some((rule) => shouldUseRule(schema, rule));\n}\nexports.shouldUseGroup = shouldUseGroup;\nfunction shouldUseRule(schema, rule) {\n var _a;\n return (schema[rule.keyword] !== undefined ||\n ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));\n}\nexports.shouldUseRule = shouldUseRule;\n//# sourceMappingURL=applicability.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;\nconst rules_1 = require(\"../rules\");\nconst applicability_1 = require(\"./applicability\");\nconst errors_1 = require(\"../errors\");\nconst codegen_1 = require(\"../codegen\");\nconst util_1 = require(\"../util\");\nvar DataType;\n(function (DataType) {\n DataType[DataType[\"Correct\"] = 0] = \"Correct\";\n DataType[DataType[\"Wrong\"] = 1] = \"Wrong\";\n})(DataType || (exports.DataType = DataType = {}));\nfunction getSchemaTypes(schema) {\n const types = getJSONTypes(schema.type);\n const hasNull = types.includes(\"null\");\n if (hasNull) {\n if (schema.nullable === false)\n throw new Error(\"type: null contradicts nullable: false\");\n }\n else {\n if (!types.length && schema.nullable !== undefined) {\n throw new Error('\"nullable\" cannot be used without \"type\"');\n }\n if (schema.nullable === true)\n types.push(\"null\");\n }\n return types;\n}\nexports.getSchemaTypes = getSchemaTypes;\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nfunction getJSONTypes(ts) {\n const types = Array.isArray(ts) ? ts : ts ? [ts] : [];\n if (types.every(rules_1.isJSONType))\n return types;\n throw new Error(\"type must be JSONType or JSONType[]: \" + types.join(\",\"));\n}\nexports.getJSONTypes = getJSONTypes;\nfunction coerceAndCheckDataType(it, types) {\n const { gen, data, opts } = it;\n const coerceTo = coerceToTypes(types, opts.coerceTypes);\n const checkTypes = types.length > 0 &&\n !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));\n if (checkTypes) {\n const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);\n gen.if(wrongType, () => {\n if (coerceTo.length)\n coerceData(it, types, coerceTo);\n else\n reportTypeError(it);\n });\n }\n return checkTypes;\n}\nexports.coerceAndCheckDataType = coerceAndCheckDataType;\nconst COERCIBLE = new Set([\"string\", \"number\", \"integer\", \"boolean\", \"null\"]);\nfunction coerceToTypes(types, coerceTypes) {\n return coerceTypes\n ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === \"array\" && t === \"array\"))\n : [];\n}\nfunction coerceData(it, types, coerceTo) {\n const { gen, data, opts } = it;\n const dataType = gen.let(\"dataType\", (0, codegen_1._) `typeof ${data}`);\n const coerced = gen.let(\"coerced\", (0, codegen_1._) `undefined`);\n if (opts.coerceTypes === \"array\") {\n gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen\n .assign(data, (0, codegen_1._) `${data}[0]`)\n .assign(dataType, (0, codegen_1._) `typeof ${data}`)\n .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));\n }\n gen.if((0, codegen_1._) `${coerced} !== undefined`);\n for (const t of coerceTo) {\n if (COERCIBLE.has(t) || (t === \"array\" && opts.coerceTypes === \"array\")) {\n coerceSpecificType(t);\n }\n }\n gen.else();\n reportTypeError(it);\n gen.endIf();\n gen.if((0, codegen_1._) `${coerced} !== undefined`, () => {\n gen.assign(data, coerced);\n assignParentData(it, coerced);\n });\n function coerceSpecificType(t) {\n switch (t) {\n case \"string\":\n gen\n .elseIf((0, codegen_1._) `${dataType} == \"number\" || ${dataType} == \"boolean\"`)\n .assign(coerced, (0, codegen_1._) `\"\" + ${data}`)\n .elseIf((0, codegen_1._) `${data} === null`)\n .assign(coerced, (0, codegen_1._) `\"\"`);\n return;\n case \"number\":\n gen\n .elseIf((0, codegen_1._) `${dataType} == \"boolean\" || ${data} === null\n || (${dataType} == \"string\" && ${data} && ${data} == +${data})`)\n .assign(coerced, (0, codegen_1._) `+${data}`);\n return;\n case \"integer\":\n gen\n .elseIf((0, codegen_1._) `${dataType} === \"boolean\" || ${data} === null\n || (${dataType} === \"string\" && ${data} && ${data} == +${data} && !(${data} % 1))`)\n .assign(coerced, (0, codegen_1._) `+${data}`);\n return;\n case \"boolean\":\n gen\n .elseIf((0, codegen_1._) `${data} === \"false\" || ${data} === 0 || ${data} === null`)\n .assign(coerced, false)\n .elseIf((0, codegen_1._) `${data} === \"true\" || ${data} === 1`)\n .assign(coerced, true);\n return;\n case \"null\":\n gen.elseIf((0, codegen_1._) `${data} === \"\" || ${data} === 0 || ${data} === false`);\n gen.assign(coerced, null);\n return;\n case \"array\":\n gen\n .elseIf((0, codegen_1._) `${dataType} === \"string\" || ${dataType} === \"number\"\n || ${dataType} === \"boolean\" || ${data} === null`)\n .assign(coerced, (0, codegen_1._) `[${data}]`);\n }\n }\n}\nfunction assignParentData({ gen, parentData, parentDataProperty }, expr) {\n // TODO use gen.property\n gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr));\n}\nfunction checkDataType(dataType, data, strictNums, correct = DataType.Correct) {\n const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;\n let cond;\n switch (dataType) {\n case \"null\":\n return (0, codegen_1._) `${data} ${EQ} null`;\n case \"array\":\n cond = (0, codegen_1._) `Array.isArray(${data})`;\n break;\n case \"object\":\n cond = (0, codegen_1._) `${data} && typeof ${data} == \"object\" && !Array.isArray(${data})`;\n break;\n case \"integer\":\n cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`);\n break;\n case \"number\":\n cond = numCond();\n break;\n default:\n return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`;\n }\n return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);\n function numCond(_cond = codegen_1.nil) {\n return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == \"number\"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil);\n }\n}\nexports.checkDataType = checkDataType;\nfunction checkDataTypes(dataTypes, data, strictNums, correct) {\n if (dataTypes.length === 1) {\n return checkDataType(dataTypes[0], data, strictNums, correct);\n }\n let cond;\n const types = (0, util_1.toHash)(dataTypes);\n if (types.array && types.object) {\n const notObj = (0, codegen_1._) `typeof ${data} != \"object\"`;\n cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`;\n delete types.null;\n delete types.array;\n delete types.object;\n }\n else {\n cond = codegen_1.nil;\n }\n if (types.number)\n delete types.integer;\n for (const t in types)\n cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));\n return cond;\n}\nexports.checkDataTypes = checkDataTypes;\nconst typeError = {\n message: ({ schema }) => `must be ${schema}`,\n params: ({ schema, schemaValue }) => typeof schema == \"string\" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`,\n};\nfunction reportTypeError(it) {\n const cxt = getTypeErrorContext(it);\n (0, errors_1.reportError)(cxt, typeError);\n}\nexports.reportTypeError = reportTypeError;\nfunction getTypeErrorContext(it) {\n const { gen, data, schema } = it;\n const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, \"type\");\n return {\n gen,\n keyword: \"type\",\n data,\n schema: schema.type,\n schemaCode,\n schemaValue: schemaCode,\n parentSchema: schema,\n params: {},\n it,\n };\n}\n//# sourceMappingURL=dataType.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assignDefaults = void 0;\nconst codegen_1 = require(\"../codegen\");\nconst util_1 = require(\"../util\");\nfunction assignDefaults(it, ty) {\n const { properties, items } = it.schema;\n if (ty === \"object\" && properties) {\n for (const key in properties) {\n assignDefault(it, key, properties[key].default);\n }\n }\n else if (ty === \"array\" && Array.isArray(items)) {\n items.forEach((sch, i) => assignDefault(it, i, sch.default));\n }\n}\nexports.assignDefaults = assignDefaults;\nfunction assignDefault(it, prop, defaultValue) {\n const { gen, compositeRule, data, opts } = it;\n if (defaultValue === undefined)\n return;\n const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`;\n if (compositeRule) {\n (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);\n return;\n }\n let condition = (0, codegen_1._) `${childData} === undefined`;\n if (opts.useDefaults === \"empty\") {\n condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === \"\"`;\n }\n // `${childData} === undefined` +\n // (opts.useDefaults === \"empty\" ? ` || ${childData} === null || ${childData} === \"\"` : \"\")\n gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);\n}\n//# sourceMappingURL=defaults.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0;\nconst codegen_1 = require(\"../compile/codegen\");\nconst util_1 = require(\"../compile/util\");\nconst names_1 = require(\"../compile/names\");\nconst util_2 = require(\"../compile/util\");\nfunction checkReportMissingProp(cxt, prop) {\n const { gen, data, it } = cxt;\n gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {\n cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true);\n cxt.error();\n });\n}\nexports.checkReportMissingProp = checkReportMissingProp;\nfunction checkMissingProp({ gen, data, it: { opts } }, properties, missing) {\n return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`)));\n}\nexports.checkMissingProp = checkMissingProp;\nfunction reportMissingProp(cxt, missing) {\n cxt.setParams({ missingProperty: missing }, true);\n cxt.error();\n}\nexports.reportMissingProp = reportMissingProp;\nfunction hasPropFunc(gen) {\n return gen.scopeValue(\"func\", {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ref: Object.prototype.hasOwnProperty,\n code: (0, codegen_1._) `Object.prototype.hasOwnProperty`,\n });\n}\nexports.hasPropFunc = hasPropFunc;\nfunction isOwnProperty(gen, data, property) {\n return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`;\n}\nexports.isOwnProperty = isOwnProperty;\nfunction propertyInData(gen, data, property, ownProperties) {\n const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`;\n return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond;\n}\nexports.propertyInData = propertyInData;\nfunction noPropertyInData(gen, data, property, ownProperties) {\n const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`;\n return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond;\n}\nexports.noPropertyInData = noPropertyInData;\nfunction allSchemaProperties(schemaMap) {\n return schemaMap ? Object.keys(schemaMap).filter((p) => p !== \"__proto__\") : [];\n}\nexports.allSchemaProperties = allSchemaProperties;\nfunction schemaProperties(it, schemaMap) {\n return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));\n}\nexports.schemaProperties = schemaProperties;\nfunction callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {\n const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;\n const valCxt = [\n [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],\n [names_1.default.parentData, it.parentData],\n [names_1.default.parentDataProperty, it.parentDataProperty],\n [names_1.default.rootData, names_1.default.rootData],\n ];\n if (it.opts.dynamicRef)\n valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);\n const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`;\n return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`;\n}\nexports.callValidateCode = callValidateCode;\nconst newRegExp = (0, codegen_1._) `new RegExp`;\nfunction usePattern({ gen, it: { opts } }, pattern) {\n const u = opts.unicodeRegExp ? \"u\" : \"\";\n const { regExp } = opts.code;\n const rx = regExp(pattern, u);\n return gen.scopeValue(\"pattern\", {\n key: rx.toString(),\n ref: rx,\n code: (0, codegen_1._) `${regExp.code === \"new RegExp\" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`,\n });\n}\nexports.usePattern = usePattern;\nfunction validateArray(cxt) {\n const { gen, data, keyword, it } = cxt;\n const valid = gen.name(\"valid\");\n if (it.allErrors) {\n const validArr = gen.let(\"valid\", true);\n validateItems(() => gen.assign(validArr, false));\n return validArr;\n }\n gen.var(valid, true);\n validateItems(() => gen.break());\n return valid;\n function validateItems(notValid) {\n const len = gen.const(\"len\", (0, codegen_1._) `${data}.length`);\n gen.forRange(\"i\", 0, len, (i) => {\n cxt.subschema({\n keyword,\n dataProp: i,\n dataPropType: util_1.Type.Num,\n }, valid);\n gen.if((0, codegen_1.not)(valid), notValid);\n });\n }\n}\nexports.validateArray = validateArray;\nfunction validateUnion(cxt) {\n const { gen, schema, keyword, it } = cxt;\n /* istanbul ignore if */\n if (!Array.isArray(schema))\n throw new Error(\"ajv implementation error\");\n const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));\n if (alwaysValid && !it.opts.unevaluated)\n return;\n const valid = gen.let(\"valid\", false);\n const schValid = gen.name(\"_valid\");\n gen.block(() => schema.forEach((_sch, i) => {\n const schCxt = cxt.subschema({\n keyword,\n schemaProp: i,\n compositeRule: true,\n }, schValid);\n gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`);\n const merged = cxt.mergeValidEvaluated(schCxt, schValid);\n // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true)\n // or if all properties and items were evaluated (it.props === true && it.items === true)\n if (!merged)\n gen.if((0, codegen_1.not)(valid));\n }));\n cxt.result(valid, () => cxt.reset(), () => cxt.error(true));\n}\nexports.validateUnion = validateUnion;\n//# sourceMappingURL=code.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0;\nconst codegen_1 = require(\"../codegen\");\nconst names_1 = require(\"../names\");\nconst code_1 = require(\"../../vocabularies/code\");\nconst errors_1 = require(\"../errors\");\nfunction macroKeywordCode(cxt, def) {\n const { gen, keyword, schema, parentSchema, it } = cxt;\n const macroSchema = def.macro.call(it.self, schema, parentSchema, it);\n const schemaRef = useKeyword(gen, keyword, macroSchema);\n if (it.opts.validateSchema !== false)\n it.self.validateSchema(macroSchema, true);\n const valid = gen.name(\"valid\");\n cxt.subschema({\n schema: macroSchema,\n schemaPath: codegen_1.nil,\n errSchemaPath: `${it.errSchemaPath}/${keyword}`,\n topSchemaRef: schemaRef,\n compositeRule: true,\n }, valid);\n cxt.pass(valid, () => cxt.error(true));\n}\nexports.macroKeywordCode = macroKeywordCode;\nfunction funcKeywordCode(cxt, def) {\n var _a;\n const { gen, keyword, schema, parentSchema, $data, it } = cxt;\n checkAsyncKeyword(it, def);\n const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;\n const validateRef = useKeyword(gen, keyword, validate);\n const valid = gen.let(\"valid\");\n cxt.block$data(valid, validateKeyword);\n cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);\n function validateKeyword() {\n if (def.errors === false) {\n assignValid();\n if (def.modifying)\n modifyData(cxt);\n reportErrs(() => cxt.error());\n }\n else {\n const ruleErrs = def.async ? validateAsync() : validateSync();\n if (def.modifying)\n modifyData(cxt);\n reportErrs(() => addErrs(cxt, ruleErrs));\n }\n }\n function validateAsync() {\n const ruleErrs = gen.let(\"ruleErrs\", null);\n gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e)));\n return ruleErrs;\n }\n function validateSync() {\n const validateErrs = (0, codegen_1._) `${validateRef}.errors`;\n gen.assign(validateErrs, null);\n assignValid(codegen_1.nil);\n return validateErrs;\n }\n function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) {\n const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;\n const passSchema = !((\"compile\" in def && !$data) || def.schema === false);\n gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);\n }\n function reportErrs(errors) {\n var _a;\n gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors);\n }\n}\nexports.funcKeywordCode = funcKeywordCode;\nfunction modifyData(cxt) {\n const { gen, data, it } = cxt;\n gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`));\n}\nfunction addErrs(cxt, errs) {\n const { gen } = cxt;\n gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => {\n gen\n .assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`)\n .assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`);\n (0, errors_1.extendErrors)(cxt);\n }, () => cxt.error());\n}\nfunction checkAsyncKeyword({ schemaEnv }, def) {\n if (def.async && !schemaEnv.$async)\n throw new Error(\"async keyword in sync schema\");\n}\nfunction useKeyword(gen, keyword, result) {\n if (result === undefined)\n throw new Error(`keyword \"${keyword}\" failed to compile`);\n return gen.scopeValue(\"keyword\", typeof result == \"function\" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });\n}\nfunction validSchemaType(schema, schemaType, allowUndefined = false) {\n // TODO add tests\n return (!schemaType.length ||\n schemaType.some((st) => st === \"array\"\n ? Array.isArray(schema)\n : st === \"object\"\n ? schema && typeof schema == \"object\" && !Array.isArray(schema)\n : typeof schema == st || (allowUndefined && typeof schema == \"undefined\")));\n}\nexports.validSchemaType = validSchemaType;\nfunction validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) {\n /* istanbul ignore if */\n if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {\n throw new Error(\"ajv implementation error\");\n }\n const deps = def.dependencies;\n if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {\n throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(\",\")}`);\n }\n if (def.validateSchema) {\n const valid = def.validateSchema(schema[keyword]);\n if (!valid) {\n const msg = `keyword \"${keyword}\" value is invalid at path \"${errSchemaPath}\": ` +\n self.errorsText(def.validateSchema.errors);\n if (opts.validateSchema === \"log\")\n self.logger.error(msg);\n else\n throw new Error(msg);\n }\n }\n}\nexports.validateKeywordUsage = validateKeywordUsage;\n//# sourceMappingURL=keyword.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0;\nconst codegen_1 = require(\"../codegen\");\nconst util_1 = require(\"../util\");\nfunction getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {\n if (keyword !== undefined && schema !== undefined) {\n throw new Error('both \"keyword\" and \"schema\" passed, only one allowed');\n }\n if (keyword !== undefined) {\n const sch = it.schema[keyword];\n return schemaProp === undefined\n ? {\n schema: sch,\n schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,\n errSchemaPath: `${it.errSchemaPath}/${keyword}`,\n }\n : {\n schema: sch[schemaProp],\n schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,\n errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`,\n };\n }\n if (schema !== undefined) {\n if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) {\n throw new Error('\"schemaPath\", \"errSchemaPath\" and \"topSchemaRef\" are required with \"schema\"');\n }\n return {\n schema,\n schemaPath,\n topSchemaRef,\n errSchemaPath,\n };\n }\n throw new Error('either \"keyword\" or \"schema\" must be passed');\n}\nexports.getSubschema = getSubschema;\nfunction extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {\n if (data !== undefined && dataProp !== undefined) {\n throw new Error('both \"data\" and \"dataProp\" passed, only one allowed');\n }\n const { gen } = it;\n if (dataProp !== undefined) {\n const { errorPath, dataPathArr, opts } = it;\n const nextData = gen.let(\"data\", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true);\n dataContextProps(nextData);\n subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;\n subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`;\n subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];\n }\n if (data !== undefined) {\n const nextData = data instanceof codegen_1.Name ? data : gen.let(\"data\", data, true); // replaceable if used once?\n dataContextProps(nextData);\n if (propertyName !== undefined)\n subschema.propertyName = propertyName;\n // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr\n }\n if (dataTypes)\n subschema.dataTypes = dataTypes;\n function dataContextProps(_nextData) {\n subschema.data = _nextData;\n subschema.dataLevel = it.dataLevel + 1;\n subschema.dataTypes = [];\n it.definedProperties = new Set();\n subschema.parentData = it.data;\n subschema.dataNames = [...it.dataNames, _nextData];\n }\n}\nexports.extendSubschemaData = extendSubschemaData;\nfunction extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {\n if (compositeRule !== undefined)\n subschema.compositeRule = compositeRule;\n if (createErrors !== undefined)\n subschema.createErrors = createErrors;\n if (allErrors !== undefined)\n subschema.allErrors = allErrors;\n subschema.jtdDiscriminator = jtdDiscriminator; // not inherited\n subschema.jtdMetadata = jtdMetadata; // not inherited\n}\nexports.extendSubschemaMode = extendSubschemaMode;\n//# sourceMappingURL=subschema.js.map","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict';\n\nvar traverse = module.exports = function (schema, opts, cb) {\n // Legacy support for v0.3.1 and earlier.\n if (typeof opts == 'function') {\n cb = opts;\n opts = {};\n }\n\n cb = opts.cb || cb;\n var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};\n var post = cb.post || function() {};\n\n _traverse(opts, pre, post, schema, '', schema);\n};\n\n\ntraverse.keywords = {\n additionalItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\n\ntraverse.arrayKeywords = {\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\n\ntraverse.propsKeywords = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependencies: true\n};\n\ntraverse.skipKeywords = {\n default: true,\n enum: true,\n const: true,\n required: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\n\n\nfunction _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {\n if (schema && typeof schema == 'object' && !Array.isArray(schema)) {\n pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n for (var key in schema) {\n var sch = schema[key];\n if (Array.isArray(sch)) {\n if (key in traverse.arrayKeywords) {\n for (var i=0; i<sch.length; i++)\n _traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);\n }\n } else if (key in traverse.propsKeywords) {\n if (sch && typeof sch == 'object') {\n for (var prop in sch)\n _traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);\n }\n } else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {\n _traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);\n }\n }\n post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n }\n}\n\n\nfunction escapeJsonPtr(str) {\n return str.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0;\nconst util_1 = require(\"./util\");\nconst equal = require(\"fast-deep-equal\");\nconst traverse = require(\"json-schema-traverse\");\n// TODO refactor to use keyword definitions\nconst SIMPLE_INLINED = new Set([\n \"type\",\n \"format\",\n \"pattern\",\n \"maxLength\",\n \"minLength\",\n \"maxProperties\",\n \"minProperties\",\n \"maxItems\",\n \"minItems\",\n \"maximum\",\n \"minimum\",\n \"uniqueItems\",\n \"multipleOf\",\n \"required\",\n \"enum\",\n \"const\",\n]);\nfunction inlineRef(schema, limit = true) {\n if (typeof schema == \"boolean\")\n return true;\n if (limit === true)\n return !hasRef(schema);\n if (!limit)\n return false;\n return countKeys(schema) <= limit;\n}\nexports.inlineRef = inlineRef;\nconst REF_KEYWORDS = new Set([\n \"$ref\",\n \"$recursiveRef\",\n \"$recursiveAnchor\",\n \"$dynamicRef\",\n \"$dynamicAnchor\",\n]);\nfunction hasRef(schema) {\n for (const key in schema) {\n if (REF_KEYWORDS.has(key))\n return true;\n const sch = schema[key];\n if (Array.isArray(sch) && sch.some(hasRef))\n return true;\n if (typeof sch == \"object\" && hasRef(sch))\n return true;\n }\n return false;\n}\nfunction countKeys(schema) {\n let count = 0;\n for (const key in schema) {\n if (key === \"$ref\")\n return Infinity;\n count++;\n if (SIMPLE_INLINED.has(key))\n continue;\n if (typeof schema[key] == \"object\") {\n (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch)));\n }\n if (count === Infinity)\n return Infinity;\n }\n return count;\n}\nfunction getFullPath(resolver, id = \"\", normalize) {\n if (normalize !== false)\n id = normalizeId(id);\n const p = resolver.parse(id);\n return _getFullPath(resolver, p);\n}\nexports.getFullPath = getFullPath;\nfunction _getFullPath(resolver, p) {\n const serialized = resolver.serialize(p);\n return serialized.split(\"#\")[0] + \"#\";\n}\nexports._getFullPath = _getFullPath;\nconst TRAILING_SLASH_HASH = /#\\/?$/;\nfunction normalizeId(id) {\n return id ? id.replace(TRAILING_SLASH_HASH, \"\") : \"\";\n}\nexports.normalizeId = normalizeId;\nfunction resolveUrl(resolver, baseId, id) {\n id = normalizeId(id);\n return resolver.resolve(baseId, id);\n}\nexports.resolveUrl = resolveUrl;\nconst ANCHOR = /^[a-z_][-a-z0-9._]*$/i;\nfunction getSchemaRefs(schema, baseId) {\n if (typeof schema == \"boolean\")\n return {};\n const { schemaId, uriResolver } = this.opts;\n const schId = normalizeId(schema[schemaId] || baseId);\n const baseIds = { \"\": schId };\n const pathPrefix = getFullPath(uriResolver, schId, false);\n const localRefs = {};\n const schemaRefs = new Set();\n traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {\n if (parentJsonPtr === undefined)\n return;\n const fullPath = pathPrefix + jsonPtr;\n let innerBaseId = baseIds[parentJsonPtr];\n if (typeof sch[schemaId] == \"string\")\n innerBaseId = addRef.call(this, sch[schemaId]);\n addAnchor.call(this, sch.$anchor);\n addAnchor.call(this, sch.$dynamicAnchor);\n baseIds[jsonPtr] = innerBaseId;\n function addRef(ref) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _resolve = this.opts.uriResolver.resolve;\n ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref);\n if (schemaRefs.has(ref))\n throw ambiguos(ref);\n schemaRefs.add(ref);\n let schOrRef = this.refs[ref];\n if (typeof schOrRef == \"string\")\n schOrRef = this.refs[schOrRef];\n if (typeof schOrRef == \"object\") {\n checkAmbiguosRef(sch, schOrRef.schema, ref);\n }\n else if (ref !== normalizeId(fullPath)) {\n if (ref[0] === \"#\") {\n checkAmbiguosRef(sch, localRefs[ref], ref);\n localRefs[ref] = sch;\n }\n else {\n this.refs[ref] = fullPath;\n }\n }\n return ref;\n }\n function addAnchor(anchor) {\n if (typeof anchor == \"string\") {\n if (!ANCHOR.test(anchor))\n throw new Error(`invalid anchor \"${anchor}\"`);\n addRef.call(this, `#${anchor}`);\n }\n }\n });\n return localRefs;\n function checkAmbiguosRef(sch1, sch2, ref) {\n if (sch2 !== undefined && !equal(sch1, sch2))\n throw ambiguos(ref);\n }\n function ambiguos(ref) {\n return new Error(`reference \"${ref}\" resolves to more than one schema`);\n }\n}\nexports.getSchemaRefs = getSchemaRefs;\n//# sourceMappingURL=resolve.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0;\nconst boolSchema_1 = require(\"./boolSchema\");\nconst dataType_1 = require(\"./dataType\");\nconst applicability_1 = require(\"./applicability\");\nconst dataType_2 = require(\"./dataType\");\nconst defaults_1 = require(\"./defaults\");\nconst keyword_1 = require(\"./keyword\");\nconst subschema_1 = require(\"./subschema\");\nconst codegen_1 = require(\"../codegen\");\nconst names_1 = require(\"../names\");\nconst resolve_1 = require(\"../resolve\");\nconst util_1 = require(\"../util\");\nconst errors_1 = require(\"../errors\");\n// schema compilation - generates validation function, subschemaCode (below) is used for subschemas\nfunction validateFunctionCode(it) {\n if (isSchemaObj(it)) {\n checkKeywords(it);\n if (schemaCxtHasRules(it)) {\n topSchemaObjCode(it);\n return;\n }\n }\n validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));\n}\nexports.validateFunctionCode = validateFunctionCode;\nfunction validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {\n if (opts.code.es5) {\n gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {\n gen.code((0, codegen_1._) `\"use strict\"; ${funcSourceUrl(schema, opts)}`);\n destructureValCxtES5(gen, opts);\n gen.code(body);\n });\n }\n else {\n gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));\n }\n}\nfunction destructureValCxt(opts) {\n return (0, codegen_1._) `{${names_1.default.instancePath}=\"\", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;\n}\nfunction destructureValCxtES5(gen, opts) {\n gen.if(names_1.default.valCxt, () => {\n gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`);\n gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`);\n gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);\n gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`);\n if (opts.dynamicRef)\n gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);\n }, () => {\n gen.var(names_1.default.instancePath, (0, codegen_1._) `\"\"`);\n gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`);\n gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`);\n gen.var(names_1.default.rootData, names_1.default.data);\n if (opts.dynamicRef)\n gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`);\n });\n}\nfunction topSchemaObjCode(it) {\n const { schema, opts, gen } = it;\n validateFunction(it, () => {\n if (opts.$comment && schema.$comment)\n commentKeyword(it);\n checkNoDefault(it);\n gen.let(names_1.default.vErrors, null);\n gen.let(names_1.default.errors, 0);\n if (opts.unevaluated)\n resetEvaluated(it);\n typeAndKeywords(it);\n returnResults(it);\n });\n return;\n}\nfunction resetEvaluated(it) {\n // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated\n const { gen, validateName } = it;\n it.evaluated = gen.const(\"evaluated\", (0, codegen_1._) `${validateName}.evaluated`);\n gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`));\n gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`));\n}\nfunction funcSourceUrl(schema, opts) {\n const schId = typeof schema == \"object\" && schema[opts.schemaId];\n return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil;\n}\n// schema compilation - this function is used recursively to generate code for sub-schemas\nfunction subschemaCode(it, valid) {\n if (isSchemaObj(it)) {\n checkKeywords(it);\n if (schemaCxtHasRules(it)) {\n subSchemaObjCode(it, valid);\n return;\n }\n }\n (0, boolSchema_1.boolOrEmptySchema)(it, valid);\n}\nfunction schemaCxtHasRules({ schema, self }) {\n if (typeof schema == \"boolean\")\n return !schema;\n for (const key in schema)\n if (self.RULES.all[key])\n return true;\n return false;\n}\nfunction isSchemaObj(it) {\n return typeof it.schema != \"boolean\";\n}\nfunction subSchemaObjCode(it, valid) {\n const { schema, gen, opts } = it;\n if (opts.$comment && schema.$comment)\n commentKeyword(it);\n updateContext(it);\n checkAsyncSchema(it);\n const errsCount = gen.const(\"_errs\", names_1.default.errors);\n typeAndKeywords(it, errsCount);\n // TODO var\n gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);\n}\nfunction checkKeywords(it) {\n (0, util_1.checkUnknownRules)(it);\n checkRefsAndKeywords(it);\n}\nfunction typeAndKeywords(it, errsCount) {\n if (it.opts.jtd)\n return schemaKeywords(it, [], false, errsCount);\n const types = (0, dataType_1.getSchemaTypes)(it.schema);\n const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types);\n schemaKeywords(it, types, !checkedTypes, errsCount);\n}\nfunction checkRefsAndKeywords(it) {\n const { schema, errSchemaPath, opts, self } = it;\n if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) {\n self.logger.warn(`$ref: keywords ignored in schema at path \"${errSchemaPath}\"`);\n }\n}\nfunction checkNoDefault(it) {\n const { schema, opts } = it;\n if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) {\n (0, util_1.checkStrictMode)(it, \"default is ignored in the schema root\");\n }\n}\nfunction updateContext(it) {\n const schId = it.schema[it.opts.schemaId];\n if (schId)\n it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);\n}\nfunction checkAsyncSchema(it) {\n if (it.schema.$async && !it.schemaEnv.$async)\n throw new Error(\"async schema in sync schema\");\n}\nfunction commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {\n const msg = schema.$comment;\n if (opts.$comment === true) {\n gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`);\n }\n else if (typeof opts.$comment == \"function\") {\n const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`;\n const rootName = gen.scopeValue(\"root\", { ref: schemaEnv.root });\n gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);\n }\n}\nfunction returnResults(it) {\n const { gen, schemaEnv, validateName, ValidationError, opts } = it;\n if (schemaEnv.$async) {\n // TODO assign unevaluated\n gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`));\n }\n else {\n gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors);\n if (opts.unevaluated)\n assignEvaluated(it);\n gen.return((0, codegen_1._) `${names_1.default.errors} === 0`);\n }\n}\nfunction assignEvaluated({ gen, evaluated, props, items }) {\n if (props instanceof codegen_1.Name)\n gen.assign((0, codegen_1._) `${evaluated}.props`, props);\n if (items instanceof codegen_1.Name)\n gen.assign((0, codegen_1._) `${evaluated}.items`, items);\n}\nfunction schemaKeywords(it, types, typeErrors, errsCount) {\n const { gen, schema, data, allErrors, opts, self } = it;\n const { RULES } = self;\n if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) {\n gen.block(() => keywordCode(it, \"$ref\", RULES.all.$ref.definition)); // TODO typecast\n return;\n }\n if (!opts.jtd)\n checkStrictTypes(it, types);\n gen.block(() => {\n for (const group of RULES.rules)\n groupKeywords(group);\n groupKeywords(RULES.post);\n });\n function groupKeywords(group) {\n if (!(0, applicability_1.shouldUseGroup)(schema, group))\n return;\n if (group.type) {\n gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));\n iterateKeywords(it, group);\n if (types.length === 1 && types[0] === group.type && typeErrors) {\n gen.else();\n (0, dataType_2.reportTypeError)(it);\n }\n gen.endIf();\n }\n else {\n iterateKeywords(it, group);\n }\n // TODO make it \"ok\" call?\n if (!allErrors)\n gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`);\n }\n}\nfunction iterateKeywords(it, group) {\n const { gen, schema, opts: { useDefaults }, } = it;\n if (useDefaults)\n (0, defaults_1.assignDefaults)(it, group.type);\n gen.block(() => {\n for (const rule of group.rules) {\n if ((0, applicability_1.shouldUseRule)(schema, rule)) {\n keywordCode(it, rule.keyword, rule.definition, group.type);\n }\n }\n });\n}\nfunction checkStrictTypes(it, types) {\n if (it.schemaEnv.meta || !it.opts.strictTypes)\n return;\n checkContextTypes(it, types);\n if (!it.opts.allowUnionTypes)\n checkMultipleTypes(it, types);\n checkKeywordTypes(it, it.dataTypes);\n}\nfunction checkContextTypes(it, types) {\n if (!types.length)\n return;\n if (!it.dataTypes.length) {\n it.dataTypes = types;\n return;\n }\n types.forEach((t) => {\n if (!includesType(it.dataTypes, t)) {\n strictTypesError(it, `type \"${t}\" not allowed by context \"${it.dataTypes.join(\",\")}\"`);\n }\n });\n narrowSchemaTypes(it, types);\n}\nfunction checkMultipleTypes(it, ts) {\n if (ts.length > 1 && !(ts.length === 2 && ts.includes(\"null\"))) {\n strictTypesError(it, \"use allowUnionTypes to allow union type keyword\");\n }\n}\nfunction checkKeywordTypes(it, ts) {\n const rules = it.self.RULES.all;\n for (const keyword in rules) {\n const rule = rules[keyword];\n if (typeof rule == \"object\" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {\n const { type } = rule.definition;\n if (type.length && !type.some((t) => hasApplicableType(ts, t))) {\n strictTypesError(it, `missing type \"${type.join(\",\")}\" for keyword \"${keyword}\"`);\n }\n }\n }\n}\nfunction hasApplicableType(schTs, kwdT) {\n return schTs.includes(kwdT) || (kwdT === \"number\" && schTs.includes(\"integer\"));\n}\nfunction includesType(ts, t) {\n return ts.includes(t) || (t === \"integer\" && ts.includes(\"number\"));\n}\nfunction narrowSchemaTypes(it, withTypes) {\n const ts = [];\n for (const t of it.dataTypes) {\n if (includesType(withTypes, t))\n ts.push(t);\n else if (withTypes.includes(\"integer\") && t === \"number\")\n ts.push(\"integer\");\n }\n it.dataTypes = ts;\n}\nfunction strictTypesError(it, msg) {\n const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;\n msg += ` at \"${schemaPath}\" (strictTypes)`;\n (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);\n}\nclass KeywordCxt {\n constructor(it, def, keyword) {\n (0, keyword_1.validateKeywordUsage)(it, def, keyword);\n this.gen = it.gen;\n this.allErrors = it.allErrors;\n this.keyword = keyword;\n this.data = it.data;\n this.schema = it.schema[keyword];\n this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;\n this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);\n this.schemaType = def.schemaType;\n this.parentSchema = it.schema;\n this.params = {};\n this.it = it;\n this.def = def;\n if (this.$data) {\n this.schemaCode = it.gen.const(\"vSchema\", getData(this.$data, it));\n }\n else {\n this.schemaCode = this.schemaValue;\n if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) {\n throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);\n }\n }\n if (\"code\" in def ? def.trackErrors : def.errors !== false) {\n this.errsCount = it.gen.const(\"_errs\", names_1.default.errors);\n }\n }\n result(condition, successAction, failAction) {\n this.failResult((0, codegen_1.not)(condition), successAction, failAction);\n }\n failResult(condition, successAction, failAction) {\n this.gen.if(condition);\n if (failAction)\n failAction();\n else\n this.error();\n if (successAction) {\n this.gen.else();\n successAction();\n if (this.allErrors)\n this.gen.endIf();\n }\n else {\n if (this.allErrors)\n this.gen.endIf();\n else\n this.gen.else();\n }\n }\n pass(condition, failAction) {\n this.failResult((0, codegen_1.not)(condition), undefined, failAction);\n }\n fail(condition) {\n if (condition === undefined) {\n this.error();\n if (!this.allErrors)\n this.gen.if(false); // this branch will be removed by gen.optimize\n return;\n }\n this.gen.if(condition);\n this.error();\n if (this.allErrors)\n this.gen.endIf();\n else\n this.gen.else();\n }\n fail$data(condition) {\n if (!this.$data)\n return this.fail(condition);\n const { schemaCode } = this;\n this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);\n }\n error(append, errorParams, errorPaths) {\n if (errorParams) {\n this.setParams(errorParams);\n this._error(append, errorPaths);\n this.setParams({});\n return;\n }\n this._error(append, errorPaths);\n }\n _error(append, errorPaths) {\n ;\n (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);\n }\n $dataError() {\n (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);\n }\n reset() {\n if (this.errsCount === undefined)\n throw new Error('add \"trackErrors\" to keyword definition');\n (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);\n }\n ok(cond) {\n if (!this.allErrors)\n this.gen.if(cond);\n }\n setParams(obj, assign) {\n if (assign)\n Object.assign(this.params, obj);\n else\n this.params = obj;\n }\n block$data(valid, codeBlock, $dataValid = codegen_1.nil) {\n this.gen.block(() => {\n this.check$data(valid, $dataValid);\n codeBlock();\n });\n }\n check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {\n if (!this.$data)\n return;\n const { gen, schemaCode, schemaType, def } = this;\n gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid));\n if (valid !== codegen_1.nil)\n gen.assign(valid, true);\n if (schemaType.length || def.validateSchema) {\n gen.elseIf(this.invalid$data());\n this.$dataError();\n if (valid !== codegen_1.nil)\n gen.assign(valid, false);\n }\n gen.else();\n }\n invalid$data() {\n const { gen, schemaCode, schemaType, def, it } = this;\n return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());\n function wrong$DataType() {\n if (schemaType.length) {\n /* istanbul ignore if */\n if (!(schemaCode instanceof codegen_1.Name))\n throw new Error(\"ajv implementation error\");\n const st = Array.isArray(schemaType) ? schemaType : [schemaType];\n return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;\n }\n return codegen_1.nil;\n }\n function invalid$DataSchema() {\n if (def.validateSchema) {\n const validateSchemaRef = gen.scopeValue(\"validate$data\", { ref: def.validateSchema }); // TODO value.code for standalone\n return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`;\n }\n return codegen_1.nil;\n }\n }\n subschema(appl, valid) {\n const subschema = (0, subschema_1.getSubschema)(this.it, appl);\n (0, subschema_1.extendSubschemaData)(subschema, this.it, appl);\n (0, subschema_1.extendSubschemaMode)(subschema, appl);\n const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined };\n subschemaCode(nextContext, valid);\n return nextContext;\n }\n mergeEvaluated(schemaCxt, toName) {\n const { it, gen } = this;\n if (!it.opts.unevaluated)\n return;\n if (it.props !== true && schemaCxt.props !== undefined) {\n it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);\n }\n if (it.items !== true && schemaCxt.items !== undefined) {\n it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);\n }\n }\n mergeValidEvaluated(schemaCxt, valid) {\n const { it, gen } = this;\n if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {\n gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));\n return true;\n }\n }\n}\nexports.KeywordCxt = KeywordCxt;\nfunction keywordCode(it, keyword, def, ruleType) {\n const cxt = new KeywordCxt(it, def, keyword);\n if (\"code\" in def) {\n def.code(cxt, ruleType);\n }\n else if (cxt.$data && def.validate) {\n (0, keyword_1.funcKeywordCode)(cxt, def);\n }\n else if (\"macro\" in def) {\n (0, keyword_1.macroKeywordCode)(cxt, def);\n }\n else if (def.compile || def.validate) {\n (0, keyword_1.funcKeywordCode)(cxt, def);\n }\n}\nconst JSON_POINTER = /^\\/(?:[^~]|~0|~1)*$/;\nconst RELATIVE_JSON_POINTER = /^([0-9]+)(#|\\/(?:[^~]|~0|~1)*)?$/;\nfunction getData($data, { dataLevel, dataNames, dataPathArr }) {\n let jsonPointer;\n let data;\n if ($data === \"\")\n return names_1.default.rootData;\n if ($data[0] === \"/\") {\n if (!JSON_POINTER.test($data))\n throw new Error(`Invalid JSON-pointer: ${$data}`);\n jsonPointer = $data;\n data = names_1.default.rootData;\n }\n else {\n const matches = RELATIVE_JSON_POINTER.exec($data);\n if (!matches)\n throw new Error(`Invalid JSON-pointer: ${$data}`);\n const up = +matches[1];\n jsonPointer = matches[2];\n if (jsonPointer === \"#\") {\n if (up >= dataLevel)\n throw new Error(errorMsg(\"property/index\", up));\n return dataPathArr[dataLevel - up];\n }\n if (up > dataLevel)\n throw new Error(errorMsg(\"data\", up));\n data = dataNames[dataLevel - up];\n if (!jsonPointer)\n return data;\n }\n let expr = data;\n const segments = jsonPointer.split(\"/\");\n for (const segment of segments) {\n if (segment) {\n data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;\n expr = (0, codegen_1._) `${expr} && ${data}`;\n }\n }\n return expr;\n function errorMsg(pointerType, up) {\n return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;\n }\n}\nexports.getData = getData;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass ValidationError extends Error {\n constructor(errors) {\n super(\"validation failed\");\n this.errors = errors;\n this.ajv = this.validation = true;\n }\n}\nexports.default = ValidationError;\n//# sourceMappingURL=validation_error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst resolve_1 = require(\"./resolve\");\nclass MissingRefError extends Error {\n constructor(resolver, baseId, ref, msg) {\n super(msg || `can't resolve reference ${ref} from id ${baseId}`);\n this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);\n this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));\n }\n}\nexports.default = MissingRefError;\n//# sourceMappingURL=ref_error.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0;\nconst codegen_1 = require(\"./codegen\");\nconst validation_error_1 = require(\"../runtime/validation_error\");\nconst names_1 = require(\"./names\");\nconst resolve_1 = require(\"./resolve\");\nconst util_1 = require(\"./util\");\nconst validate_1 = require(\"./validate\");\nclass SchemaEnv {\n constructor(env) {\n var _a;\n this.refs = {};\n this.dynamicAnchors = {};\n let schema;\n if (typeof env.schema == \"object\")\n schema = env.schema;\n this.schema = env.schema;\n this.schemaId = env.schemaId;\n this.root = env.root || this;\n this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || \"$id\"]);\n this.schemaPath = env.schemaPath;\n this.localRefs = env.localRefs;\n this.meta = env.meta;\n this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;\n this.refs = {};\n }\n}\nexports.SchemaEnv = SchemaEnv;\n// let codeSize = 0\n// let nodeCount = 0\n// Compiles schema in SchemaEnv\nfunction compileSchema(sch) {\n // TODO refactor - remove compilations\n const _sch = getCompilingSchema.call(this, sch);\n if (_sch)\n return _sch;\n const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails\n const { es5, lines } = this.opts.code;\n const { ownProperties } = this.opts;\n const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });\n let _ValidationError;\n if (sch.$async) {\n _ValidationError = gen.scopeValue(\"Error\", {\n ref: validation_error_1.default,\n code: (0, codegen_1._) `require(\"ajv/dist/runtime/validation_error\").default`,\n });\n }\n const validateName = gen.scopeName(\"validate\");\n sch.validateName = validateName;\n const schemaCxt = {\n gen,\n allErrors: this.opts.allErrors,\n data: names_1.default.data,\n parentData: names_1.default.parentData,\n parentDataProperty: names_1.default.parentDataProperty,\n dataNames: [names_1.default.data],\n dataPathArr: [codegen_1.nil], // TODO can its length be used as dataLevel if nil is removed?\n dataLevel: 0,\n dataTypes: [],\n definedProperties: new Set(),\n topSchemaRef: gen.scopeValue(\"schema\", this.opts.code.source === true\n ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) }\n : { ref: sch.schema }),\n validateName,\n ValidationError: _ValidationError,\n schema: sch.schema,\n schemaEnv: sch,\n rootId,\n baseId: sch.baseId || rootId,\n schemaPath: codegen_1.nil,\n errSchemaPath: sch.schemaPath || (this.opts.jtd ? \"\" : \"#\"),\n errorPath: (0, codegen_1._) `\"\"`,\n opts: this.opts,\n self: this,\n };\n let sourceCode;\n try {\n this._compilations.add(sch);\n (0, validate_1.validateFunctionCode)(schemaCxt);\n gen.optimize(this.opts.code.optimize);\n // gen.optimize(1)\n const validateCode = gen.toString();\n sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;\n // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))\n if (this.opts.code.process)\n sourceCode = this.opts.code.process(sourceCode, sch);\n // console.log(\"\\n\\n\\n *** \\n\", sourceCode)\n const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);\n const validate = makeValidate(this, this.scope.get());\n this.scope.value(validateName, { ref: validate });\n validate.errors = null;\n validate.schema = sch.schema;\n validate.schemaEnv = sch;\n if (sch.$async)\n validate.$async = true;\n if (this.opts.code.source === true) {\n validate.source = { validateName, validateCode, scopeValues: gen._values };\n }\n if (this.opts.unevaluated) {\n const { props, items } = schemaCxt;\n validate.evaluated = {\n props: props instanceof codegen_1.Name ? undefined : props,\n items: items instanceof codegen_1.Name ? undefined : items,\n dynamicProps: props instanceof codegen_1.Name,\n dynamicItems: items instanceof codegen_1.Name,\n };\n if (validate.source)\n validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);\n }\n sch.validate = validate;\n return sch;\n }\n catch (e) {\n delete sch.validate;\n delete sch.validateName;\n if (sourceCode)\n this.logger.error(\"Error compiling schema, function code:\", sourceCode);\n // console.log(\"\\n\\n\\n *** \\n\", sourceCode, this.opts)\n throw e;\n }\n finally {\n this._compilations.delete(sch);\n }\n}\nexports.compileSchema = compileSchema;\nfunction resolveRef(root, baseId, ref) {\n var _a;\n ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);\n const schOrFunc = root.refs[ref];\n if (schOrFunc)\n return schOrFunc;\n let _sch = resolve.call(this, root, ref);\n if (_sch === undefined) {\n const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv\n const { schemaId } = this.opts;\n if (schema)\n _sch = new SchemaEnv({ schema, schemaId, root, baseId });\n }\n if (_sch === undefined)\n return;\n return (root.refs[ref] = inlineOrCompile.call(this, _sch));\n}\nexports.resolveRef = resolveRef;\nfunction inlineOrCompile(sch) {\n if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))\n return sch.schema;\n return sch.validate ? sch : compileSchema.call(this, sch);\n}\n// Index of schema compilation in the currently compiled list\nfunction getCompilingSchema(schEnv) {\n for (const sch of this._compilations) {\n if (sameSchemaEnv(sch, schEnv))\n return sch;\n }\n}\nexports.getCompilingSchema = getCompilingSchema;\nfunction sameSchemaEnv(s1, s2) {\n return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;\n}\n// resolve and compile the references ($ref)\n// TODO returns AnySchemaObject (if the schema can be inlined) or validation function\nfunction resolve(root, // information about the root schema for the current schema\nref // reference to resolve\n) {\n let sch;\n while (typeof (sch = this.refs[ref]) == \"string\")\n ref = sch;\n return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);\n}\n// Resolve schema, its root and baseId\nfunction resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it\nref // reference to resolve\n) {\n const p = this.opts.uriResolver.parse(ref);\n const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);\n let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined);\n // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests\n if (Object.keys(root.schema).length > 0 && refPath === baseId) {\n return getJsonPointer.call(this, p, root);\n }\n const id = (0, resolve_1.normalizeId)(refPath);\n const schOrRef = this.refs[id] || this.schemas[id];\n if (typeof schOrRef == \"string\") {\n const sch = resolveSchema.call(this, root, schOrRef);\n if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== \"object\")\n return;\n return getJsonPointer.call(this, p, sch);\n }\n if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== \"object\")\n return;\n if (!schOrRef.validate)\n compileSchema.call(this, schOrRef);\n if (id === (0, resolve_1.normalizeId)(ref)) {\n const { schema } = schOrRef;\n const { schemaId } = this.opts;\n const schId = schema[schemaId];\n if (schId)\n baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);\n return new SchemaEnv({ schema, schemaId, root, baseId });\n }\n return getJsonPointer.call(this, p, schOrRef);\n}\nexports.resolveSchema = resolveSchema;\nconst PREVENT_SCOPE_CHANGE = new Set([\n \"properties\",\n \"patternProperties\",\n \"enum\",\n \"dependencies\",\n \"definitions\",\n]);\nfunction getJsonPointer(parsedRef, { baseId, schema, root }) {\n var _a;\n if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== \"/\")\n return;\n for (const part of parsedRef.fragment.slice(1).split(\"/\")) {\n if (typeof schema === \"boolean\")\n return;\n const partSchema = schema[(0, util_1.unescapeFragment)(part)];\n if (partSchema === undefined)\n return;\n schema = partSchema;\n // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?\n const schId = typeof schema === \"object\" && schema[this.opts.schemaId];\n if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {\n baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);\n }\n }\n let env;\n if (typeof schema != \"boolean\" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {\n const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);\n env = resolveSchema.call(this, root, $ref);\n }\n // even though resolution failed we need to return SchemaEnv to throw exception\n // so that compileAsync loads missing schema.\n const { schemaId } = this.opts;\n env = env || new SchemaEnv({ schema, schemaId, root, baseId });\n if (env.schema !== env.root.schema)\n return env;\n return undefined;\n}\n//# sourceMappingURL=index.js.map","","'use strict'\n\n/** @type {(value: string) => boolean} */\nconst isUUID = RegExp.prototype.test.bind(/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/iu)\n\n/** @type {(value: string) => boolean} */\nconst isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)$/u)\n\n/**\n * @param {Array<string>} input\n * @returns {string}\n */\nfunction stringArrayToHexStripped (input) {\n let acc = ''\n let code = 0\n let i = 0\n\n for (i = 0; i < input.length; i++) {\n code = input[i].charCodeAt(0)\n if (code === 48) {\n continue\n }\n if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {\n return ''\n }\n acc += input[i]\n break\n }\n\n for (i += 1; i < input.length; i++) {\n code = input[i].charCodeAt(0)\n if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {\n return ''\n }\n acc += input[i]\n }\n return acc\n}\n\n/**\n * @typedef {Object} GetIPV6Result\n * @property {boolean} error - Indicates if there was an error parsing the IPv6 address.\n * @property {string} address - The parsed IPv6 address.\n * @property {string} [zone] - The zone identifier, if present.\n */\n\n/**\n * @param {string} value\n * @returns {boolean}\n */\nconst nonSimpleDomain = RegExp.prototype.test.bind(/[^!\"$&'()*+,\\-.;=_`a-z{}~]/u)\n\n/**\n * @param {Array<string>} buffer\n * @returns {boolean}\n */\nfunction consumeIsZone (buffer) {\n buffer.length = 0\n return true\n}\n\n/**\n * @param {Array<string>} buffer\n * @param {Array<string>} address\n * @param {GetIPV6Result} output\n * @returns {boolean}\n */\nfunction consumeHextets (buffer, address, output) {\n if (buffer.length) {\n const hex = stringArrayToHexStripped(buffer)\n if (hex !== '') {\n address.push(hex)\n } else {\n output.error = true\n return false\n }\n buffer.length = 0\n }\n return true\n}\n\n/**\n * @param {string} input\n * @returns {GetIPV6Result}\n */\nfunction getIPV6 (input) {\n let tokenCount = 0\n const output = { error: false, address: '', zone: '' }\n /** @type {Array<string>} */\n const address = []\n /** @type {Array<string>} */\n const buffer = []\n let endipv6Encountered = false\n let endIpv6 = false\n\n let consume = consumeHextets\n\n for (let i = 0; i < input.length; i++) {\n const cursor = input[i]\n if (cursor === '[' || cursor === ']') { continue }\n if (cursor === ':') {\n if (endipv6Encountered === true) {\n endIpv6 = true\n }\n if (!consume(buffer, address, output)) { break }\n if (++tokenCount > 7) {\n // not valid\n output.error = true\n break\n }\n if (i > 0 && input[i - 1] === ':') {\n endipv6Encountered = true\n }\n address.push(':')\n continue\n } else if (cursor === '%') {\n if (!consume(buffer, address, output)) { break }\n // switch to zone detection\n consume = consumeIsZone\n } else {\n buffer.push(cursor)\n continue\n }\n }\n if (buffer.length) {\n if (consume === consumeIsZone) {\n output.zone = buffer.join('')\n } else if (endIpv6) {\n address.push(buffer.join(''))\n } else {\n address.push(stringArrayToHexStripped(buffer))\n }\n }\n output.address = address.join('')\n return output\n}\n\n/**\n * @typedef {Object} NormalizeIPv6Result\n * @property {string} host - The normalized host.\n * @property {string} [escapedHost] - The escaped host.\n * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.\n */\n\n/**\n * @param {string} host\n * @returns {NormalizeIPv6Result}\n */\nfunction normalizeIPv6 (host) {\n if (findToken(host, ':') < 2) { return { host, isIPV6: false } }\n const ipv6 = getIPV6(host)\n\n if (!ipv6.error) {\n let newHost = ipv6.address\n let escapedHost = ipv6.address\n if (ipv6.zone) {\n newHost += '%' + ipv6.zone\n escapedHost += '%25' + ipv6.zone\n }\n return { host: newHost, isIPV6: true, escapedHost }\n } else {\n return { host, isIPV6: false }\n }\n}\n\n/**\n * @param {string} str\n * @param {string} token\n * @returns {number}\n */\nfunction findToken (str, token) {\n let ind = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] === token) ind++\n }\n return ind\n}\n\n/**\n * @param {string} path\n * @returns {string}\n *\n * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n */\nfunction removeDotSegments (path) {\n let input = path\n const output = []\n let nextSlash = -1\n let len = 0\n\n // eslint-disable-next-line no-cond-assign\n while (len = input.length) {\n if (len === 1) {\n if (input === '.') {\n break\n } else if (input === '/') {\n output.push('/')\n break\n } else {\n output.push(input)\n break\n }\n } else if (len === 2) {\n if (input[0] === '.') {\n if (input[1] === '.') {\n break\n } else if (input[1] === '/') {\n input = input.slice(2)\n continue\n }\n } else if (input[0] === '/') {\n if (input[1] === '.' || input[1] === '/') {\n output.push('/')\n break\n }\n }\n } else if (len === 3) {\n if (input === '/..') {\n if (output.length !== 0) {\n output.pop()\n }\n output.push('/')\n break\n }\n }\n if (input[0] === '.') {\n if (input[1] === '.') {\n if (input[2] === '/') {\n input = input.slice(3)\n continue\n }\n } else if (input[1] === '/') {\n input = input.slice(2)\n continue\n }\n } else if (input[0] === '/') {\n if (input[1] === '.') {\n if (input[2] === '/') {\n input = input.slice(2)\n continue\n } else if (input[2] === '.') {\n if (input[3] === '/') {\n input = input.slice(3)\n if (output.length !== 0) {\n output.pop()\n }\n continue\n }\n }\n }\n }\n\n // Rule 2E: Move normal path segment to output\n if ((nextSlash = input.indexOf('/', 1)) === -1) {\n output.push(input)\n break\n } else {\n output.push(input.slice(0, nextSlash))\n input = input.slice(nextSlash)\n }\n }\n\n return output.join('')\n}\n\n/**\n * @param {import('../types/index').URIComponent} component\n * @param {boolean} esc\n * @returns {import('../types/index').URIComponent}\n */\nfunction normalizeComponentEncoding (component, esc) {\n const func = esc !== true ? escape : unescape\n if (component.scheme !== undefined) {\n component.scheme = func(component.scheme)\n }\n if (component.userinfo !== undefined) {\n component.userinfo = func(component.userinfo)\n }\n if (component.host !== undefined) {\n component.host = func(component.host)\n }\n if (component.path !== undefined) {\n component.path = func(component.path)\n }\n if (component.query !== undefined) {\n component.query = func(component.query)\n }\n if (component.fragment !== undefined) {\n component.fragment = func(component.fragment)\n }\n return component\n}\n\n/**\n * @param {import('../types/index').URIComponent} component\n * @returns {string|undefined}\n */\nfunction recomposeAuthority (component) {\n const uriTokens = []\n\n if (component.userinfo !== undefined) {\n uriTokens.push(component.userinfo)\n uriTokens.push('@')\n }\n\n if (component.host !== undefined) {\n let host = unescape(component.host)\n if (!isIPv4(host)) {\n const ipV6res = normalizeIPv6(host)\n if (ipV6res.isIPV6 === true) {\n host = `[${ipV6res.escapedHost}]`\n } else {\n host = component.host\n }\n }\n uriTokens.push(host)\n }\n\n if (typeof component.port === 'number' || typeof component.port === 'string') {\n uriTokens.push(':')\n uriTokens.push(String(component.port))\n }\n\n return uriTokens.length ? uriTokens.join('') : undefined\n};\n\nmodule.exports = {\n nonSimpleDomain,\n recomposeAuthority,\n normalizeComponentEncoding,\n removeDotSegments,\n isIPv4,\n isUUID,\n normalizeIPv6,\n stringArrayToHexStripped\n}\n","'use strict'\n\nconst { isUUID } = require('./utils')\nconst URN_REG = /([\\da-z][\\d\\-a-z]{0,31}):((?:[\\w!$'()*+,\\-.:;=@]|%[\\da-f]{2})+)/iu\n\nconst supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws',\n 'wss', 'urn', 'urn:uuid'])\n\n/** @typedef {supportedSchemeNames[number]} SchemeName */\n\n/**\n * @param {string} name\n * @returns {name is SchemeName}\n */\nfunction isValidSchemeName (name) {\n return supportedSchemeNames.indexOf(/** @type {*} */ (name)) !== -1\n}\n\n/**\n * @callback SchemeFn\n * @param {import('../types/index').URIComponent} component\n * @param {import('../types/index').Options} options\n * @returns {import('../types/index').URIComponent}\n */\n\n/**\n * @typedef {Object} SchemeHandler\n * @property {SchemeName} scheme - The scheme name.\n * @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts.\n * @property {SchemeFn} parse - Function to parse the URI component for this scheme.\n * @property {SchemeFn} serialize - Function to serialize the URI component for this scheme.\n * @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme.\n * @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths.\n * @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode.\n */\n\n/**\n * @param {import('../types/index').URIComponent} wsComponent\n * @returns {boolean}\n */\nfunction wsIsSecure (wsComponent) {\n if (wsComponent.secure === true) {\n return true\n } else if (wsComponent.secure === false) {\n return false\n } else if (wsComponent.scheme) {\n return (\n wsComponent.scheme.length === 3 &&\n (wsComponent.scheme[0] === 'w' || wsComponent.scheme[0] === 'W') &&\n (wsComponent.scheme[1] === 's' || wsComponent.scheme[1] === 'S') &&\n (wsComponent.scheme[2] === 's' || wsComponent.scheme[2] === 'S')\n )\n } else {\n return false\n }\n}\n\n/** @type {SchemeFn} */\nfunction httpParse (component) {\n if (!component.host) {\n component.error = component.error || 'HTTP URIs must have a host.'\n }\n\n return component\n}\n\n/** @type {SchemeFn} */\nfunction httpSerialize (component) {\n const secure = String(component.scheme).toLowerCase() === 'https'\n\n // normalize the default port\n if (component.port === (secure ? 443 : 80) || component.port === '') {\n component.port = undefined\n }\n\n // normalize the empty path\n if (!component.path) {\n component.path = '/'\n }\n\n // NOTE: We do not parse query strings for HTTP URIs\n // as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n // and not the HTTP spec.\n\n return component\n}\n\n/** @type {SchemeFn} */\nfunction wsParse (wsComponent) {\n// indicate if the secure flag is set\n wsComponent.secure = wsIsSecure(wsComponent)\n\n // construct resouce name\n wsComponent.resourceName = (wsComponent.path || '/') + (wsComponent.query ? '?' + wsComponent.query : '')\n wsComponent.path = undefined\n wsComponent.query = undefined\n\n return wsComponent\n}\n\n/** @type {SchemeFn} */\nfunction wsSerialize (wsComponent) {\n// normalize the default port\n if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === '') {\n wsComponent.port = undefined\n }\n\n // ensure scheme matches secure flag\n if (typeof wsComponent.secure === 'boolean') {\n wsComponent.scheme = (wsComponent.secure ? 'wss' : 'ws')\n wsComponent.secure = undefined\n }\n\n // reconstruct path from resource name\n if (wsComponent.resourceName) {\n const [path, query] = wsComponent.resourceName.split('?')\n wsComponent.path = (path && path !== '/' ? path : undefined)\n wsComponent.query = query\n wsComponent.resourceName = undefined\n }\n\n // forbid fragment component\n wsComponent.fragment = undefined\n\n return wsComponent\n}\n\n/** @type {SchemeFn} */\nfunction urnParse (urnComponent, options) {\n if (!urnComponent.path) {\n urnComponent.error = 'URN can not be parsed'\n return urnComponent\n }\n const matches = urnComponent.path.match(URN_REG)\n if (matches) {\n const scheme = options.scheme || urnComponent.scheme || 'urn'\n urnComponent.nid = matches[1].toLowerCase()\n urnComponent.nss = matches[2]\n const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`\n const schemeHandler = getSchemeHandler(urnScheme)\n urnComponent.path = undefined\n\n if (schemeHandler) {\n urnComponent = schemeHandler.parse(urnComponent, options)\n }\n } else {\n urnComponent.error = urnComponent.error || 'URN can not be parsed.'\n }\n\n return urnComponent\n}\n\n/** @type {SchemeFn} */\nfunction urnSerialize (urnComponent, options) {\n if (urnComponent.nid === undefined) {\n throw new Error('URN without nid cannot be serialized')\n }\n const scheme = options.scheme || urnComponent.scheme || 'urn'\n const nid = urnComponent.nid.toLowerCase()\n const urnScheme = `${scheme}:${options.nid || nid}`\n const schemeHandler = getSchemeHandler(urnScheme)\n\n if (schemeHandler) {\n urnComponent = schemeHandler.serialize(urnComponent, options)\n }\n\n const uriComponent = urnComponent\n const nss = urnComponent.nss\n uriComponent.path = `${nid || options.nid}:${nss}`\n\n options.skipEscape = true\n return uriComponent\n}\n\n/** @type {SchemeFn} */\nfunction urnuuidParse (urnComponent, options) {\n const uuidComponent = urnComponent\n uuidComponent.uuid = uuidComponent.nss\n uuidComponent.nss = undefined\n\n if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {\n uuidComponent.error = uuidComponent.error || 'UUID is not valid.'\n }\n\n return uuidComponent\n}\n\n/** @type {SchemeFn} */\nfunction urnuuidSerialize (uuidComponent) {\n const urnComponent = uuidComponent\n // normalize UUID\n urnComponent.nss = (uuidComponent.uuid || '').toLowerCase()\n return urnComponent\n}\n\nconst http = /** @type {SchemeHandler} */ ({\n scheme: 'http',\n domainHost: true,\n parse: httpParse,\n serialize: httpSerialize\n})\n\nconst https = /** @type {SchemeHandler} */ ({\n scheme: 'https',\n domainHost: http.domainHost,\n parse: httpParse,\n serialize: httpSerialize\n})\n\nconst ws = /** @type {SchemeHandler} */ ({\n scheme: 'ws',\n domainHost: true,\n parse: wsParse,\n serialize: wsSerialize\n})\n\nconst wss = /** @type {SchemeHandler} */ ({\n scheme: 'wss',\n domainHost: ws.domainHost,\n parse: ws.parse,\n serialize: ws.serialize\n})\n\nconst urn = /** @type {SchemeHandler} */ ({\n scheme: 'urn',\n parse: urnParse,\n serialize: urnSerialize,\n skipNormalize: true\n})\n\nconst urnuuid = /** @type {SchemeHandler} */ ({\n scheme: 'urn:uuid',\n parse: urnuuidParse,\n serialize: urnuuidSerialize,\n skipNormalize: true\n})\n\nconst SCHEMES = /** @type {Record<SchemeName, SchemeHandler>} */ ({\n http,\n https,\n ws,\n wss,\n urn,\n 'urn:uuid': urnuuid\n})\n\nObject.setPrototypeOf(SCHEMES, null)\n\n/**\n * @param {string|undefined} scheme\n * @returns {SchemeHandler|undefined}\n */\nfunction getSchemeHandler (scheme) {\n return (\n scheme && (\n SCHEMES[/** @type {SchemeName} */ (scheme)] ||\n SCHEMES[/** @type {SchemeName} */(scheme.toLowerCase())])\n ) ||\n undefined\n}\n\nmodule.exports = {\n wsIsSecure,\n SCHEMES,\n isValidSchemeName,\n getSchemeHandler,\n}\n","'use strict'\n\nconst { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require('./lib/utils')\nconst { SCHEMES, getSchemeHandler } = require('./lib/schemes')\n\n/**\n * @template {import('./types/index').URIComponent|string} T\n * @param {T} uri\n * @param {import('./types/index').Options} [options]\n * @returns {T}\n */\nfunction normalize (uri, options) {\n if (typeof uri === 'string') {\n uri = /** @type {T} */ (serialize(parse(uri, options), options))\n } else if (typeof uri === 'object') {\n uri = /** @type {T} */ (parse(serialize(uri, options), options))\n }\n return uri\n}\n\n/**\n * @param {string} baseURI\n * @param {string} relativeURI\n * @param {import('./types/index').Options} [options]\n * @returns {string}\n */\nfunction resolve (baseURI, relativeURI, options) {\n const schemelessOptions = options ? Object.assign({ scheme: 'null' }, options) : { scheme: 'null' }\n const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)\n schemelessOptions.skipEscape = true\n return serialize(resolved, schemelessOptions)\n}\n\n/**\n * @param {import ('./types/index').URIComponent} base\n * @param {import ('./types/index').URIComponent} relative\n * @param {import('./types/index').Options} [options]\n * @param {boolean} [skipNormalization=false]\n * @returns {import ('./types/index').URIComponent}\n */\nfunction resolveComponent (base, relative, options, skipNormalization) {\n /** @type {import('./types/index').URIComponent} */\n const target = {}\n if (!skipNormalization) {\n base = parse(serialize(base, options), options) // normalize base component\n relative = parse(serialize(relative, options), options) // normalize relative component\n }\n options = options || {}\n\n if (!options.tolerant && relative.scheme) {\n target.scheme = relative.scheme\n // target.authority = relative.authority;\n target.userinfo = relative.userinfo\n target.host = relative.host\n target.port = relative.port\n target.path = removeDotSegments(relative.path || '')\n target.query = relative.query\n } else {\n if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {\n // target.authority = relative.authority;\n target.userinfo = relative.userinfo\n target.host = relative.host\n target.port = relative.port\n target.path = removeDotSegments(relative.path || '')\n target.query = relative.query\n } else {\n if (!relative.path) {\n target.path = base.path\n if (relative.query !== undefined) {\n target.query = relative.query\n } else {\n target.query = base.query\n }\n } else {\n if (relative.path[0] === '/') {\n target.path = removeDotSegments(relative.path)\n } else {\n if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {\n target.path = '/' + relative.path\n } else if (!base.path) {\n target.path = relative.path\n } else {\n target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path\n }\n target.path = removeDotSegments(target.path)\n }\n target.query = relative.query\n }\n // target.authority = base.authority;\n target.userinfo = base.userinfo\n target.host = base.host\n target.port = base.port\n }\n target.scheme = base.scheme\n }\n\n target.fragment = relative.fragment\n\n return target\n}\n\n/**\n * @param {import ('./types/index').URIComponent|string} uriA\n * @param {import ('./types/index').URIComponent|string} uriB\n * @param {import ('./types/index').Options} options\n * @returns {boolean}\n */\nfunction equal (uriA, uriB, options) {\n if (typeof uriA === 'string') {\n uriA = unescape(uriA)\n uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true })\n } else if (typeof uriA === 'object') {\n uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true })\n }\n\n if (typeof uriB === 'string') {\n uriB = unescape(uriB)\n uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true })\n } else if (typeof uriB === 'object') {\n uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true })\n }\n\n return uriA.toLowerCase() === uriB.toLowerCase()\n}\n\n/**\n * @param {Readonly<import('./types/index').URIComponent>} cmpts\n * @param {import('./types/index').Options} [opts]\n * @returns {string}\n */\nfunction serialize (cmpts, opts) {\n const component = {\n host: cmpts.host,\n scheme: cmpts.scheme,\n userinfo: cmpts.userinfo,\n port: cmpts.port,\n path: cmpts.path,\n query: cmpts.query,\n nid: cmpts.nid,\n nss: cmpts.nss,\n uuid: cmpts.uuid,\n fragment: cmpts.fragment,\n reference: cmpts.reference,\n resourceName: cmpts.resourceName,\n secure: cmpts.secure,\n error: ''\n }\n const options = Object.assign({}, opts)\n const uriTokens = []\n\n // find scheme handler\n const schemeHandler = getSchemeHandler(options.scheme || component.scheme)\n\n // perform scheme specific serialization\n if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options)\n\n if (component.path !== undefined) {\n if (!options.skipEscape) {\n component.path = escape(component.path)\n\n if (component.scheme !== undefined) {\n component.path = component.path.split('%3A').join(':')\n }\n } else {\n component.path = unescape(component.path)\n }\n }\n\n if (options.reference !== 'suffix' && component.scheme) {\n uriTokens.push(component.scheme, ':')\n }\n\n const authority = recomposeAuthority(component)\n if (authority !== undefined) {\n if (options.reference !== 'suffix') {\n uriTokens.push('//')\n }\n\n uriTokens.push(authority)\n\n if (component.path && component.path[0] !== '/') {\n uriTokens.push('/')\n }\n }\n if (component.path !== undefined) {\n let s = component.path\n\n if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {\n s = removeDotSegments(s)\n }\n\n if (\n authority === undefined &&\n s[0] === '/' &&\n s[1] === '/'\n ) {\n // don't allow the path to start with \"//\"\n s = '/%2F' + s.slice(2)\n }\n\n uriTokens.push(s)\n }\n\n if (component.query !== undefined) {\n uriTokens.push('?', component.query)\n }\n\n if (component.fragment !== undefined) {\n uriTokens.push('#', component.fragment)\n }\n return uriTokens.join('')\n}\n\nconst URI_PARSE = /^(?:([^#/:?]+):)?(?:\\/\\/((?:([^#/?@]*)@)?(\\[[^#/?\\]]+\\]|[^#/:?]*)(?::(\\d*))?))?([^#?]*)(?:\\?([^#]*))?(?:#((?:.|[\\n\\r])*))?/u\n\n/**\n * @param {string} uri\n * @param {import('./types/index').Options} [opts]\n * @returns\n */\nfunction parse (uri, opts) {\n const options = Object.assign({}, opts)\n /** @type {import('./types/index').URIComponent} */\n const parsed = {\n scheme: undefined,\n userinfo: undefined,\n host: '',\n port: undefined,\n path: '',\n query: undefined,\n fragment: undefined\n }\n\n let isIP = false\n if (options.reference === 'suffix') {\n if (options.scheme) {\n uri = options.scheme + ':' + uri\n } else {\n uri = '//' + uri\n }\n }\n\n const matches = uri.match(URI_PARSE)\n\n if (matches) {\n // store each component\n parsed.scheme = matches[1]\n parsed.userinfo = matches[3]\n parsed.host = matches[4]\n parsed.port = parseInt(matches[5], 10)\n parsed.path = matches[6] || ''\n parsed.query = matches[7]\n parsed.fragment = matches[8]\n\n // fix port number\n if (isNaN(parsed.port)) {\n parsed.port = matches[5]\n }\n if (parsed.host) {\n const ipv4result = isIPv4(parsed.host)\n if (ipv4result === false) {\n const ipv6result = normalizeIPv6(parsed.host)\n parsed.host = ipv6result.host.toLowerCase()\n isIP = ipv6result.isIPV6\n } else {\n isIP = true\n }\n }\n if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {\n parsed.reference = 'same-document'\n } else if (parsed.scheme === undefined) {\n parsed.reference = 'relative'\n } else if (parsed.fragment === undefined) {\n parsed.reference = 'absolute'\n } else {\n parsed.reference = 'uri'\n }\n\n // check for reference errors\n if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {\n parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'\n }\n\n // find scheme handler\n const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme)\n\n // check if scheme can't handle IRIs\n if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n // if host component is a domain name\n if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {\n // convert Unicode IDN -> ASCII IDN\n try {\n parsed.host = URL.domainToASCII(parsed.host.toLowerCase())\n } catch (e) {\n parsed.error = parsed.error || \"Host's domain name can not be converted to ASCII: \" + e\n }\n }\n // convert IRI -> URI\n }\n\n if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {\n if (uri.indexOf('%') !== -1) {\n if (parsed.scheme !== undefined) {\n parsed.scheme = unescape(parsed.scheme)\n }\n if (parsed.host !== undefined) {\n parsed.host = unescape(parsed.host)\n }\n }\n if (parsed.path) {\n parsed.path = escape(unescape(parsed.path))\n }\n if (parsed.fragment) {\n parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment))\n }\n }\n\n // perform scheme specific parsing\n if (schemeHandler && schemeHandler.parse) {\n schemeHandler.parse(parsed, options)\n }\n } else {\n parsed.error = parsed.error || 'URI can not be parsed.'\n }\n return parsed\n}\n\nconst fastUri = {\n SCHEMES,\n normalize,\n resolve,\n resolveComponent,\n equal,\n serialize,\n parse\n}\n\nmodule.exports = fastUri\nmodule.exports.default = fastUri\nmodule.exports.fastUri = fastUri\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst uri = require(\"fast-uri\");\nuri.code = 'require(\"ajv/dist/runtime/uri\").default';\nexports.default = uri;\n//# sourceMappingURL=uri.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;\nvar validate_1 = require(\"./compile/validate\");\nObject.defineProperty(exports, \"KeywordCxt\", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });\nvar codegen_1 = require(\"./compile/codegen\");\nObject.defineProperty(exports, \"_\", { enumerable: true, get: function () { return codegen_1._; } });\nObject.defineProperty(exports, \"str\", { enumerable: true, get: function () { return codegen_1.str; } });\nObject.defineProperty(exports, \"stringify\", { enumerable: true, get: function () { return codegen_1.stringify; } });\nObject.defineProperty(exports, \"nil\", { enumerable: true, get: function () { return codegen_1.nil; } });\nObject.defineProperty(exports, \"Name\", { enumerable: true, get: function () { return codegen_1.Name; } });\nObject.defineProperty(exports, \"CodeGen\", { enumerable: true, get: function () { return codegen_1.CodeGen; } });\nconst validation_error_1 = require(\"./runtime/validation_error\");\nconst ref_error_1 = require(\"./compile/ref_error\");\nconst rules_1 = require(\"./compile/rules\");\nconst compile_1 = require(\"./compile\");\nconst codegen_2 = require(\"./compile/codegen\");\nconst resolve_1 = require(\"./compile/resolve\");\nconst dataType_1 = require(\"./compile/validate/dataType\");\nconst util_1 = require(\"./compile/util\");\nconst $dataRefSchema = require(\"./refs/data.json\");\nconst uri_1 = require(\"./runtime/uri\");\nconst defaultRegExp = (str, flags) => new RegExp(str, flags);\ndefaultRegExp.code = \"new RegExp\";\nconst META_IGNORE_OPTIONS = [\"removeAdditional\", \"useDefaults\", \"coerceTypes\"];\nconst EXT_SCOPE_NAMES = new Set([\n \"validate\",\n \"serialize\",\n \"parse\",\n \"wrapper\",\n \"root\",\n \"schema\",\n \"keyword\",\n \"pattern\",\n \"formats\",\n \"validate$data\",\n \"func\",\n \"obj\",\n \"Error\",\n]);\nconst removedOptions = {\n errorDataPath: \"\",\n format: \"`validateFormats: false` can be used instead.\",\n nullable: '\"nullable\" keyword is supported by default.',\n jsonPointers: \"Deprecated jsPropertySyntax can be used instead.\",\n extendRefs: \"Deprecated ignoreKeywordsWithRef can be used instead.\",\n missingRefs: \"Pass empty schema with $id that should be ignored to ajv.addSchema.\",\n processCode: \"Use option `code: {process: (code, schemaEnv: object) => string}`\",\n sourceCode: \"Use option `code: {source: true}`\",\n strictDefaults: \"It is default now, see option `strict`.\",\n strictKeywords: \"It is default now, see option `strict`.\",\n uniqueItems: '\"uniqueItems\" keyword is always validated.',\n unknownFormats: \"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).\",\n cache: \"Map is used as cache, schema object as key.\",\n serialize: \"Map is used as cache, schema object as key.\",\n ajvErrors: \"It is default now.\",\n};\nconst deprecatedOptions = {\n ignoreKeywordsWithRef: \"\",\n jsPropertySyntax: \"\",\n unicode: '\"minLength\"/\"maxLength\" account for unicode characters by default.',\n};\nconst MAX_EXPRESSION = 200;\n// eslint-disable-next-line complexity\nfunction requiredOptions(o) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;\n const s = o.strict;\n const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;\n const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0;\n const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;\n const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;\n return {\n strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,\n strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,\n strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : \"log\",\n strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : \"log\",\n strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,\n code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },\n loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,\n loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,\n meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,\n messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,\n inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,\n schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : \"$id\",\n addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,\n validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,\n validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,\n unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,\n int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,\n uriResolver: uriResolver,\n };\n}\nclass Ajv {\n constructor(opts = {}) {\n this.schemas = {};\n this.refs = {};\n this.formats = {};\n this._compilations = new Set();\n this._loading = {};\n this._cache = new Map();\n opts = this.opts = { ...opts, ...requiredOptions(opts) };\n const { es5, lines } = this.opts.code;\n this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });\n this.logger = getLogger(opts.logger);\n const formatOpt = opts.validateFormats;\n opts.validateFormats = false;\n this.RULES = (0, rules_1.getRules)();\n checkOptions.call(this, removedOptions, opts, \"NOT SUPPORTED\");\n checkOptions.call(this, deprecatedOptions, opts, \"DEPRECATED\", \"warn\");\n this._metaOpts = getMetaSchemaOptions.call(this);\n if (opts.formats)\n addInitialFormats.call(this);\n this._addVocabularies();\n this._addDefaultMetaSchema();\n if (opts.keywords)\n addInitialKeywords.call(this, opts.keywords);\n if (typeof opts.meta == \"object\")\n this.addMetaSchema(opts.meta);\n addInitialSchemas.call(this);\n opts.validateFormats = formatOpt;\n }\n _addVocabularies() {\n this.addKeyword(\"$async\");\n }\n _addDefaultMetaSchema() {\n const { $data, meta, schemaId } = this.opts;\n let _dataRefSchema = $dataRefSchema;\n if (schemaId === \"id\") {\n _dataRefSchema = { ...$dataRefSchema };\n _dataRefSchema.id = _dataRefSchema.$id;\n delete _dataRefSchema.$id;\n }\n if (meta && $data)\n this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);\n }\n defaultMeta() {\n const { meta, schemaId } = this.opts;\n return (this.opts.defaultMeta = typeof meta == \"object\" ? meta[schemaId] || meta : undefined);\n }\n validate(schemaKeyRef, // key, ref or schema object\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n data // to be validated\n ) {\n let v;\n if (typeof schemaKeyRef == \"string\") {\n v = this.getSchema(schemaKeyRef);\n if (!v)\n throw new Error(`no schema with key or ref \"${schemaKeyRef}\"`);\n }\n else {\n v = this.compile(schemaKeyRef);\n }\n const valid = v(data);\n if (!(\"$async\" in v))\n this.errors = v.errors;\n return valid;\n }\n compile(schema, _meta) {\n const sch = this._addSchema(schema, _meta);\n return (sch.validate || this._compileSchemaEnv(sch));\n }\n compileAsync(schema, meta) {\n if (typeof this.opts.loadSchema != \"function\") {\n throw new Error(\"options.loadSchema should be a function\");\n }\n const { loadSchema } = this.opts;\n return runCompileAsync.call(this, schema, meta);\n async function runCompileAsync(_schema, _meta) {\n await loadMetaSchema.call(this, _schema.$schema);\n const sch = this._addSchema(_schema, _meta);\n return sch.validate || _compileAsync.call(this, sch);\n }\n async function loadMetaSchema($ref) {\n if ($ref && !this.getSchema($ref)) {\n await runCompileAsync.call(this, { $ref }, true);\n }\n }\n async function _compileAsync(sch) {\n try {\n return this._compileSchemaEnv(sch);\n }\n catch (e) {\n if (!(e instanceof ref_error_1.default))\n throw e;\n checkLoaded.call(this, e);\n await loadMissingSchema.call(this, e.missingSchema);\n return _compileAsync.call(this, sch);\n }\n }\n function checkLoaded({ missingSchema: ref, missingRef }) {\n if (this.refs[ref]) {\n throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);\n }\n }\n async function loadMissingSchema(ref) {\n const _schema = await _loadSchema.call(this, ref);\n if (!this.refs[ref])\n await loadMetaSchema.call(this, _schema.$schema);\n if (!this.refs[ref])\n this.addSchema(_schema, ref, meta);\n }\n async function _loadSchema(ref) {\n const p = this._loading[ref];\n if (p)\n return p;\n try {\n return await (this._loading[ref] = loadSchema(ref));\n }\n finally {\n delete this._loading[ref];\n }\n }\n }\n // Adds schema to the instance\n addSchema(schema, // If array is passed, `key` will be ignored\n key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.\n _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.\n _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead.\n ) {\n if (Array.isArray(schema)) {\n for (const sch of schema)\n this.addSchema(sch, undefined, _meta, _validateSchema);\n return this;\n }\n let id;\n if (typeof schema === \"object\") {\n const { schemaId } = this.opts;\n id = schema[schemaId];\n if (id !== undefined && typeof id != \"string\") {\n throw new Error(`schema ${schemaId} must be string`);\n }\n }\n key = (0, resolve_1.normalizeId)(key || id);\n this._checkUnique(key);\n this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);\n return this;\n }\n // Add schema that will be used to validate other schemas\n // options in META_IGNORE_OPTIONS are alway set to false\n addMetaSchema(schema, key, // schema key\n _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema\n ) {\n this.addSchema(schema, key, true, _validateSchema);\n return this;\n }\n // Validate schema against its meta-schema\n validateSchema(schema, throwOrLogError) {\n if (typeof schema == \"boolean\")\n return true;\n let $schema;\n $schema = schema.$schema;\n if ($schema !== undefined && typeof $schema != \"string\") {\n throw new Error(\"$schema must be a string\");\n }\n $schema = $schema || this.opts.defaultMeta || this.defaultMeta();\n if (!$schema) {\n this.logger.warn(\"meta-schema not available\");\n this.errors = null;\n return true;\n }\n const valid = this.validate($schema, schema);\n if (!valid && throwOrLogError) {\n const message = \"schema is invalid: \" + this.errorsText();\n if (this.opts.validateSchema === \"log\")\n this.logger.error(message);\n else\n throw new Error(message);\n }\n return valid;\n }\n // Get compiled schema by `key` or `ref`.\n // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)\n getSchema(keyRef) {\n let sch;\n while (typeof (sch = getSchEnv.call(this, keyRef)) == \"string\")\n keyRef = sch;\n if (sch === undefined) {\n const { schemaId } = this.opts;\n const root = new compile_1.SchemaEnv({ schema: {}, schemaId });\n sch = compile_1.resolveSchema.call(this, root, keyRef);\n if (!sch)\n return;\n this.refs[keyRef] = sch;\n }\n return (sch.validate || this._compileSchemaEnv(sch));\n }\n // Remove cached schema(s).\n // If no parameter is passed all schemas but meta-schemas are removed.\n // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.\n // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.\n removeSchema(schemaKeyRef) {\n if (schemaKeyRef instanceof RegExp) {\n this._removeAllSchemas(this.schemas, schemaKeyRef);\n this._removeAllSchemas(this.refs, schemaKeyRef);\n return this;\n }\n switch (typeof schemaKeyRef) {\n case \"undefined\":\n this._removeAllSchemas(this.schemas);\n this._removeAllSchemas(this.refs);\n this._cache.clear();\n return this;\n case \"string\": {\n const sch = getSchEnv.call(this, schemaKeyRef);\n if (typeof sch == \"object\")\n this._cache.delete(sch.schema);\n delete this.schemas[schemaKeyRef];\n delete this.refs[schemaKeyRef];\n return this;\n }\n case \"object\": {\n const cacheKey = schemaKeyRef;\n this._cache.delete(cacheKey);\n let id = schemaKeyRef[this.opts.schemaId];\n if (id) {\n id = (0, resolve_1.normalizeId)(id);\n delete this.schemas[id];\n delete this.refs[id];\n }\n return this;\n }\n default:\n throw new Error(\"ajv.removeSchema: invalid parameter\");\n }\n }\n // add \"vocabulary\" - a collection of keywords\n addVocabulary(definitions) {\n for (const def of definitions)\n this.addKeyword(def);\n return this;\n }\n addKeyword(kwdOrDef, def // deprecated\n ) {\n let keyword;\n if (typeof kwdOrDef == \"string\") {\n keyword = kwdOrDef;\n if (typeof def == \"object\") {\n this.logger.warn(\"these parameters are deprecated, see docs for addKeyword\");\n def.keyword = keyword;\n }\n }\n else if (typeof kwdOrDef == \"object\" && def === undefined) {\n def = kwdOrDef;\n keyword = def.keyword;\n if (Array.isArray(keyword) && !keyword.length) {\n throw new Error(\"addKeywords: keyword must be string or non-empty array\");\n }\n }\n else {\n throw new Error(\"invalid addKeywords parameters\");\n }\n checkKeyword.call(this, keyword, def);\n if (!def) {\n (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));\n return this;\n }\n keywordMetaschema.call(this, def);\n const definition = {\n ...def,\n type: (0, dataType_1.getJSONTypes)(def.type),\n schemaType: (0, dataType_1.getJSONTypes)(def.schemaType),\n };\n (0, util_1.eachItem)(keyword, definition.type.length === 0\n ? (k) => addRule.call(this, k, definition)\n : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));\n return this;\n }\n getKeyword(keyword) {\n const rule = this.RULES.all[keyword];\n return typeof rule == \"object\" ? rule.definition : !!rule;\n }\n // Remove keyword\n removeKeyword(keyword) {\n // TODO return type should be Ajv\n const { RULES } = this;\n delete RULES.keywords[keyword];\n delete RULES.all[keyword];\n for (const group of RULES.rules) {\n const i = group.rules.findIndex((rule) => rule.keyword === keyword);\n if (i >= 0)\n group.rules.splice(i, 1);\n }\n return this;\n }\n // Add format\n addFormat(name, format) {\n if (typeof format == \"string\")\n format = new RegExp(format);\n this.formats[name] = format;\n return this;\n }\n errorsText(errors = this.errors, // optional array of validation errors\n { separator = \", \", dataVar = \"data\" } = {} // optional options with properties `separator` and `dataVar`\n ) {\n if (!errors || errors.length === 0)\n return \"No errors\";\n return errors\n .map((e) => `${dataVar}${e.instancePath} ${e.message}`)\n .reduce((text, msg) => text + separator + msg);\n }\n $dataMetaSchema(metaSchema, keywordsJsonPointers) {\n const rules = this.RULES.all;\n metaSchema = JSON.parse(JSON.stringify(metaSchema));\n for (const jsonPointer of keywordsJsonPointers) {\n const segments = jsonPointer.split(\"/\").slice(1); // first segment is an empty string\n let keywords = metaSchema;\n for (const seg of segments)\n keywords = keywords[seg];\n for (const key in rules) {\n const rule = rules[key];\n if (typeof rule != \"object\")\n continue;\n const { $data } = rule.definition;\n const schema = keywords[key];\n if ($data && schema)\n keywords[key] = schemaOrData(schema);\n }\n }\n return metaSchema;\n }\n _removeAllSchemas(schemas, regex) {\n for (const keyRef in schemas) {\n const sch = schemas[keyRef];\n if (!regex || regex.test(keyRef)) {\n if (typeof sch == \"string\") {\n delete schemas[keyRef];\n }\n else if (sch && !sch.meta) {\n this._cache.delete(sch.schema);\n delete schemas[keyRef];\n }\n }\n }\n }\n _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {\n let id;\n const { schemaId } = this.opts;\n if (typeof schema == \"object\") {\n id = schema[schemaId];\n }\n else {\n if (this.opts.jtd)\n throw new Error(\"schema must be object\");\n else if (typeof schema != \"boolean\")\n throw new Error(\"schema must be object or boolean\");\n }\n let sch = this._cache.get(schema);\n if (sch !== undefined)\n return sch;\n baseId = (0, resolve_1.normalizeId)(id || baseId);\n const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);\n sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });\n this._cache.set(sch.schema, sch);\n if (addSchema && !baseId.startsWith(\"#\")) {\n // TODO atm it is allowed to overwrite schemas without id (instead of not adding them)\n if (baseId)\n this._checkUnique(baseId);\n this.refs[baseId] = sch;\n }\n if (validateSchema)\n this.validateSchema(schema, true);\n return sch;\n }\n _checkUnique(id) {\n if (this.schemas[id] || this.refs[id]) {\n throw new Error(`schema with key or id \"${id}\" already exists`);\n }\n }\n _compileSchemaEnv(sch) {\n if (sch.meta)\n this._compileMetaSchema(sch);\n else\n compile_1.compileSchema.call(this, sch);\n /* istanbul ignore if */\n if (!sch.validate)\n throw new Error(\"ajv implementation error\");\n return sch.validate;\n }\n _compileMetaSchema(sch) {\n const currentOpts = this.opts;\n this.opts = this._metaOpts;\n try {\n compile_1.compileSchema.call(this, sch);\n }\n finally {\n this.opts = currentOpts;\n }\n }\n}\nAjv.ValidationError = validation_error_1.default;\nAjv.MissingRefError = ref_error_1.default;\nexports.default = Ajv;\nfunction checkOptions(checkOpts, options, msg, log = \"error\") {\n for (const key in checkOpts) {\n const opt = key;\n if (opt in options)\n this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);\n }\n}\nfunction getSchEnv(keyRef) {\n keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line\n return this.schemas[keyRef] || this.refs[keyRef];\n}\nfunction addInitialSchemas() {\n const optsSchemas = this.opts.schemas;\n if (!optsSchemas)\n return;\n if (Array.isArray(optsSchemas))\n this.addSchema(optsSchemas);\n else\n for (const key in optsSchemas)\n this.addSchema(optsSchemas[key], key);\n}\nfunction addInitialFormats() {\n for (const name in this.opts.formats) {\n const format = this.opts.formats[name];\n if (format)\n this.addFormat(name, format);\n }\n}\nfunction addInitialKeywords(defs) {\n if (Array.isArray(defs)) {\n this.addVocabulary(defs);\n return;\n }\n this.logger.warn(\"keywords option as map is deprecated, pass array\");\n for (const keyword in defs) {\n const def = defs[keyword];\n if (!def.keyword)\n def.keyword = keyword;\n this.addKeyword(def);\n }\n}\nfunction getMetaSchemaOptions() {\n const metaOpts = { ...this.opts };\n for (const opt of META_IGNORE_OPTIONS)\n delete metaOpts[opt];\n return metaOpts;\n}\nconst noLogs = { log() { }, warn() { }, error() { } };\nfunction getLogger(logger) {\n if (logger === false)\n return noLogs;\n if (logger === undefined)\n return console;\n if (logger.log && logger.warn && logger.error)\n return logger;\n throw new Error(\"logger must implement log, warn and error methods\");\n}\nconst KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;\nfunction checkKeyword(keyword, def) {\n const { RULES } = this;\n (0, util_1.eachItem)(keyword, (kwd) => {\n if (RULES.keywords[kwd])\n throw new Error(`Keyword ${kwd} is already defined`);\n if (!KEYWORD_NAME.test(kwd))\n throw new Error(`Keyword ${kwd} has invalid name`);\n });\n if (!def)\n return;\n if (def.$data && !(\"code\" in def || \"validate\" in def)) {\n throw new Error('$data keyword must have \"code\" or \"validate\" function');\n }\n}\nfunction addRule(keyword, definition, dataType) {\n var _a;\n const post = definition === null || definition === void 0 ? void 0 : definition.post;\n if (dataType && post)\n throw new Error('keyword with \"post\" flag cannot have \"type\"');\n const { RULES } = this;\n let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);\n if (!ruleGroup) {\n ruleGroup = { type: dataType, rules: [] };\n RULES.rules.push(ruleGroup);\n }\n RULES.keywords[keyword] = true;\n if (!definition)\n return;\n const rule = {\n keyword,\n definition: {\n ...definition,\n type: (0, dataType_1.getJSONTypes)(definition.type),\n schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType),\n },\n };\n if (definition.before)\n addBeforeRule.call(this, ruleGroup, rule, definition.before);\n else\n ruleGroup.rules.push(rule);\n RULES.all[keyword] = rule;\n (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));\n}\nfunction addBeforeRule(ruleGroup, rule, before) {\n const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);\n if (i >= 0) {\n ruleGroup.rules.splice(i, 0, rule);\n }\n else {\n ruleGroup.rules.push(rule);\n this.logger.warn(`rule ${before} is not defined`);\n }\n}\nfunction keywordMetaschema(def) {\n let { metaSchema } = def;\n if (metaSchema === undefined)\n return;\n if (def.$data && this.opts.$data)\n metaSchema = schemaOrData(metaSchema);\n def.validateSchema = this.compile(metaSchema, true);\n}\nconst $dataRef = {\n $ref: \"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#\",\n};\nfunction schemaOrData(schema) {\n return { anyOf: [schema, $dataRef] };\n}\n//# sourceMappingURL=core.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst def = {\n keyword: \"id\",\n code() {\n throw new Error('NOT SUPPORTED: keyword \"id\", use \"$id\" for schema ID');\n },\n};\nexports.default = def;\n//# sourceMappingURL=id.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.callRef = exports.getValidate = void 0;\nconst ref_error_1 = require(\"../../compile/ref_error\");\nconst code_1 = require(\"../code\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst names_1 = require(\"../../compile/names\");\nconst compile_1 = require(\"../../compile\");\nconst util_1 = require(\"../../compile/util\");\nconst def = {\n keyword: \"$ref\",\n schemaType: \"string\",\n code(cxt) {\n const { gen, schema: $ref, it } = cxt;\n const { baseId, schemaEnv: env, validateName, opts, self } = it;\n const { root } = env;\n if (($ref === \"#\" || $ref === \"#/\") && baseId === root.baseId)\n return callRootRef();\n const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);\n if (schOrEnv === undefined)\n throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);\n if (schOrEnv instanceof compile_1.SchemaEnv)\n return callValidate(schOrEnv);\n return inlineRefSchema(schOrEnv);\n function callRootRef() {\n if (env === root)\n return callRef(cxt, validateName, env, env.$async);\n const rootName = gen.scopeValue(\"root\", { ref: root });\n return callRef(cxt, (0, codegen_1._) `${rootName}.validate`, root, root.$async);\n }\n function callValidate(sch) {\n const v = getValidate(cxt, sch);\n callRef(cxt, v, sch, sch.$async);\n }\n function inlineRefSchema(sch) {\n const schName = gen.scopeValue(\"schema\", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });\n const valid = gen.name(\"valid\");\n const schCxt = cxt.subschema({\n schema: sch,\n dataTypes: [],\n schemaPath: codegen_1.nil,\n topSchemaRef: schName,\n errSchemaPath: $ref,\n }, valid);\n cxt.mergeEvaluated(schCxt);\n cxt.ok(valid);\n }\n },\n};\nfunction getValidate(cxt, sch) {\n const { gen } = cxt;\n return sch.validate\n ? gen.scopeValue(\"validate\", { ref: sch.validate })\n : (0, codegen_1._) `${gen.scopeValue(\"wrapper\", { ref: sch })}.validate`;\n}\nexports.getValidate = getValidate;\nfunction callRef(cxt, v, sch, $async) {\n const { gen, it } = cxt;\n const { allErrors, schemaEnv: env, opts } = it;\n const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;\n if ($async)\n callAsyncRef();\n else\n callSyncRef();\n function callAsyncRef() {\n if (!env.$async)\n throw new Error(\"async schema referenced by sync schema\");\n const valid = gen.let(\"valid\");\n gen.try(() => {\n gen.code((0, codegen_1._) `await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);\n addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result\n if (!allErrors)\n gen.assign(valid, true);\n }, (e) => {\n gen.if((0, codegen_1._) `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e));\n addErrorsFrom(e);\n if (!allErrors)\n gen.assign(valid, false);\n });\n cxt.ok(valid);\n }\n function callSyncRef() {\n cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));\n }\n function addErrorsFrom(source) {\n const errs = (0, codegen_1._) `${source}.errors`;\n gen.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged\n gen.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`);\n }\n function addEvaluatedFrom(source) {\n var _a;\n if (!it.opts.unevaluated)\n return;\n const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;\n // TODO refactor\n if (it.props !== true) {\n if (schEvaluated && !schEvaluated.dynamicProps) {\n if (schEvaluated.props !== undefined) {\n it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);\n }\n }\n else {\n const props = gen.var(\"props\", (0, codegen_1._) `${source}.evaluated.props`);\n it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);\n }\n }\n if (it.items !== true) {\n if (schEvaluated && !schEvaluated.dynamicItems) {\n if (schEvaluated.items !== undefined) {\n it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);\n }\n }\n else {\n const items = gen.var(\"items\", (0, codegen_1._) `${source}.evaluated.items`);\n it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);\n }\n }\n }\n}\nexports.callRef = callRef;\nexports.default = def;\n//# sourceMappingURL=ref.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst id_1 = require(\"./id\");\nconst ref_1 = require(\"./ref\");\nconst core = [\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"$vocabulary\",\n { keyword: \"$comment\" },\n \"definitions\",\n id_1.default,\n ref_1.default,\n];\nexports.default = core;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst ops = codegen_1.operators;\nconst KWDs = {\n maximum: { okStr: \"<=\", ok: ops.LTE, fail: ops.GT },\n minimum: { okStr: \">=\", ok: ops.GTE, fail: ops.LT },\n exclusiveMaximum: { okStr: \"<\", ok: ops.LT, fail: ops.GTE },\n exclusiveMinimum: { okStr: \">\", ok: ops.GT, fail: ops.LTE },\n};\nconst error = {\n message: ({ keyword, schemaCode }) => (0, codegen_1.str) `must be ${KWDs[keyword].okStr} ${schemaCode}`,\n params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,\n};\nconst def = {\n keyword: Object.keys(KWDs),\n type: \"number\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt) {\n const { keyword, data, schemaCode } = cxt;\n cxt.fail$data((0, codegen_1._) `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=limitNumber.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst error = {\n message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`,\n params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`,\n};\nconst def = {\n keyword: \"multipleOf\",\n type: \"number\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, schemaCode, it } = cxt;\n // const bdt = bad$DataType(schemaCode, <string>def.schemaType, $data)\n const prec = it.opts.multipleOfPrecision;\n const res = gen.let(\"res\");\n const invalid = prec\n ? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}`\n : (0, codegen_1._) `${res} !== parseInt(${res})`;\n cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=multipleOf.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// https://mathiasbynens.be/notes/javascript-encoding\n// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode\nfunction ucs2length(str) {\n const len = str.length;\n let length = 0;\n let pos = 0;\n let value;\n while (pos < len) {\n length++;\n value = str.charCodeAt(pos++);\n if (value >= 0xd800 && value <= 0xdbff && pos < len) {\n // high surrogate, and there is a next character\n value = str.charCodeAt(pos);\n if ((value & 0xfc00) === 0xdc00)\n pos++; // low surrogate\n }\n }\n return length;\n}\nexports.default = ucs2length;\nucs2length.code = 'require(\"ajv/dist/runtime/ucs2length\").default';\n//# sourceMappingURL=ucs2length.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst ucs2length_1 = require(\"../../runtime/ucs2length\");\nconst error = {\n message({ keyword, schemaCode }) {\n const comp = keyword === \"maxLength\" ? \"more\" : \"fewer\";\n return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`;\n },\n params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,\n};\nconst def = {\n keyword: [\"maxLength\", \"minLength\"],\n type: \"string\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt) {\n const { keyword, data, schemaCode, it } = cxt;\n const op = keyword === \"maxLength\" ? codegen_1.operators.GT : codegen_1.operators.LT;\n const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`;\n cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=limitLength.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst code_1 = require(\"../code\");\nconst util_1 = require(\"../../compile/util\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst error = {\n message: ({ schemaCode }) => (0, codegen_1.str) `must match pattern \"${schemaCode}\"`,\n params: ({ schemaCode }) => (0, codegen_1._) `{pattern: ${schemaCode}}`,\n};\nconst def = {\n keyword: \"pattern\",\n type: \"string\",\n schemaType: \"string\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, $data, schema, schemaCode, it } = cxt;\n const u = it.opts.unicodeRegExp ? \"u\" : \"\";\n if ($data) {\n const { regExp } = it.opts.code;\n const regExpCode = regExp.code === \"new RegExp\" ? (0, codegen_1._) `new RegExp` : (0, util_1.useFunc)(gen, regExp);\n const valid = gen.let(\"valid\");\n gen.try(() => gen.assign(valid, (0, codegen_1._) `${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));\n cxt.fail$data((0, codegen_1._) `!${valid}`);\n }\n else {\n const regExp = (0, code_1.usePattern)(cxt, schema);\n cxt.fail$data((0, codegen_1._) `!${regExp}.test(${data})`);\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=pattern.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst error = {\n message({ keyword, schemaCode }) {\n const comp = keyword === \"maxProperties\" ? \"more\" : \"fewer\";\n return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`;\n },\n params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,\n};\nconst def = {\n keyword: [\"maxProperties\", \"minProperties\"],\n type: \"object\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt) {\n const { keyword, data, schemaCode } = cxt;\n const op = keyword === \"maxProperties\" ? codegen_1.operators.GT : codegen_1.operators.LT;\n cxt.fail$data((0, codegen_1._) `Object.keys(${data}).length ${op} ${schemaCode}`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=limitProperties.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst code_1 = require(\"../code\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: ({ params: { missingProperty } }) => (0, codegen_1.str) `must have required property '${missingProperty}'`,\n params: ({ params: { missingProperty } }) => (0, codegen_1._) `{missingProperty: ${missingProperty}}`,\n};\nconst def = {\n keyword: \"required\",\n type: \"object\",\n schemaType: \"array\",\n $data: true,\n error,\n code(cxt) {\n const { gen, schema, schemaCode, data, $data, it } = cxt;\n const { opts } = it;\n if (!$data && schema.length === 0)\n return;\n const useLoop = schema.length >= opts.loopRequired;\n if (it.allErrors)\n allErrorsMode();\n else\n exitOnErrorMode();\n if (opts.strictRequired) {\n const props = cxt.parentSchema.properties;\n const { definedProperties } = cxt.it;\n for (const requiredKey of schema) {\n if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === undefined && !definedProperties.has(requiredKey)) {\n const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;\n const msg = `required property \"${requiredKey}\" is not defined at \"${schemaPath}\" (strictRequired)`;\n (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired);\n }\n }\n }\n function allErrorsMode() {\n if (useLoop || $data) {\n cxt.block$data(codegen_1.nil, loopAllRequired);\n }\n else {\n for (const prop of schema) {\n (0, code_1.checkReportMissingProp)(cxt, prop);\n }\n }\n }\n function exitOnErrorMode() {\n const missing = gen.let(\"missing\");\n if (useLoop || $data) {\n const valid = gen.let(\"valid\", true);\n cxt.block$data(valid, () => loopUntilMissing(missing, valid));\n cxt.ok(valid);\n }\n else {\n gen.if((0, code_1.checkMissingProp)(cxt, schema, missing));\n (0, code_1.reportMissingProp)(cxt, missing);\n gen.else();\n }\n }\n function loopAllRequired() {\n gen.forOf(\"prop\", schemaCode, (prop) => {\n cxt.setParams({ missingProperty: prop });\n gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error());\n });\n }\n function loopUntilMissing(missing, valid) {\n cxt.setParams({ missingProperty: missing });\n gen.forOf(missing, schemaCode, () => {\n gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties));\n gen.if((0, codegen_1.not)(valid), () => {\n cxt.error();\n gen.break();\n });\n }, codegen_1.nil);\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=required.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst error = {\n message({ keyword, schemaCode }) {\n const comp = keyword === \"maxItems\" ? \"more\" : \"fewer\";\n return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`;\n },\n params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,\n};\nconst def = {\n keyword: [\"maxItems\", \"minItems\"],\n type: \"array\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt) {\n const { keyword, data, schemaCode } = cxt;\n const op = keyword === \"maxItems\" ? codegen_1.operators.GT : codegen_1.operators.LT;\n cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=limitItems.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// https://github.com/ajv-validator/ajv/issues/889\nconst equal = require(\"fast-deep-equal\");\nequal.code = 'require(\"ajv/dist/runtime/equal\").default';\nexports.default = equal;\n//# sourceMappingURL=equal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst dataType_1 = require(\"../../compile/validate/dataType\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst equal_1 = require(\"../../runtime/equal\");\nconst error = {\n message: ({ params: { i, j } }) => (0, codegen_1.str) `must NOT have duplicate items (items ## ${j} and ${i} are identical)`,\n params: ({ params: { i, j } }) => (0, codegen_1._) `{i: ${i}, j: ${j}}`,\n};\nconst def = {\n keyword: \"uniqueItems\",\n type: \"array\",\n schemaType: \"boolean\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt;\n if (!$data && !schema)\n return;\n const valid = gen.let(\"valid\");\n const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];\n cxt.block$data(valid, validateUniqueItems, (0, codegen_1._) `${schemaCode} === false`);\n cxt.ok(valid);\n function validateUniqueItems() {\n const i = gen.let(\"i\", (0, codegen_1._) `${data}.length`);\n const j = gen.let(\"j\");\n cxt.setParams({ i, j });\n gen.assign(valid, true);\n gen.if((0, codegen_1._) `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j));\n }\n function canOptimize() {\n return itemTypes.length > 0 && !itemTypes.some((t) => t === \"object\" || t === \"array\");\n }\n function loopN(i, j) {\n const item = gen.name(\"item\");\n const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);\n const indices = gen.const(\"indices\", (0, codegen_1._) `{}`);\n gen.for((0, codegen_1._) `;${i}--;`, () => {\n gen.let(item, (0, codegen_1._) `${data}[${i}]`);\n gen.if(wrongType, (0, codegen_1._) `continue`);\n if (itemTypes.length > 1)\n gen.if((0, codegen_1._) `typeof ${item} == \"string\"`, (0, codegen_1._) `${item} += \"_\"`);\n gen\n .if((0, codegen_1._) `typeof ${indices}[${item}] == \"number\"`, () => {\n gen.assign(j, (0, codegen_1._) `${indices}[${item}]`);\n cxt.error();\n gen.assign(valid, false).break();\n })\n .code((0, codegen_1._) `${indices}[${item}] = ${i}`);\n });\n }\n function loopN2(i, j) {\n const eql = (0, util_1.useFunc)(gen, equal_1.default);\n const outer = gen.name(\"outer\");\n gen.label(outer).for((0, codegen_1._) `;${i}--;`, () => gen.for((0, codegen_1._) `${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._) `${eql}(${data}[${i}], ${data}[${j}])`, () => {\n cxt.error();\n gen.assign(valid, false).break(outer);\n })));\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=uniqueItems.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst equal_1 = require(\"../../runtime/equal\");\nconst error = {\n message: \"must be equal to constant\",\n params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`,\n};\nconst def = {\n keyword: \"const\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, $data, schemaCode, schema } = cxt;\n if ($data || (schema && typeof schema == \"object\")) {\n cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);\n }\n else {\n cxt.fail((0, codegen_1._) `${schema} !== ${data}`);\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=const.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst equal_1 = require(\"../../runtime/equal\");\nconst error = {\n message: \"must be equal to one of the allowed values\",\n params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`,\n};\nconst def = {\n keyword: \"enum\",\n schemaType: \"array\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, $data, schema, schemaCode, it } = cxt;\n if (!$data && schema.length === 0)\n throw new Error(\"enum must have non-empty array\");\n const useLoop = schema.length >= it.opts.loopEnum;\n let eql;\n const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default)));\n let valid;\n if (useLoop || $data) {\n valid = gen.let(\"valid\");\n cxt.block$data(valid, loopEnum);\n }\n else {\n /* istanbul ignore if */\n if (!Array.isArray(schema))\n throw new Error(\"ajv implementation error\");\n const vSchema = gen.const(\"vSchema\", schemaCode);\n valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i)));\n }\n cxt.pass(valid);\n function loopEnum() {\n gen.assign(valid, false);\n gen.forOf(\"v\", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));\n }\n function equalCode(vSchema, i) {\n const sch = schema[i];\n return typeof sch === \"object\" && sch !== null\n ? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])`\n : (0, codegen_1._) `${data} === ${sch}`;\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=enum.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst limitNumber_1 = require(\"./limitNumber\");\nconst multipleOf_1 = require(\"./multipleOf\");\nconst limitLength_1 = require(\"./limitLength\");\nconst pattern_1 = require(\"./pattern\");\nconst limitProperties_1 = require(\"./limitProperties\");\nconst required_1 = require(\"./required\");\nconst limitItems_1 = require(\"./limitItems\");\nconst uniqueItems_1 = require(\"./uniqueItems\");\nconst const_1 = require(\"./const\");\nconst enum_1 = require(\"./enum\");\nconst validation = [\n // number\n limitNumber_1.default,\n multipleOf_1.default,\n // string\n limitLength_1.default,\n pattern_1.default,\n // object\n limitProperties_1.default,\n required_1.default,\n // array\n limitItems_1.default,\n uniqueItems_1.default,\n // any\n { keyword: \"type\", schemaType: [\"string\", \"array\"] },\n { keyword: \"nullable\", schemaType: \"boolean\" },\n const_1.default,\n enum_1.default,\n];\nexports.default = validation;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateAdditionalItems = void 0;\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`,\n params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`,\n};\nconst def = {\n keyword: \"additionalItems\",\n type: \"array\",\n schemaType: [\"boolean\", \"object\"],\n before: \"uniqueItems\",\n error,\n code(cxt) {\n const { parentSchema, it } = cxt;\n const { items } = parentSchema;\n if (!Array.isArray(items)) {\n (0, util_1.checkStrictMode)(it, '\"additionalItems\" is ignored when \"items\" is not an array of schemas');\n return;\n }\n validateAdditionalItems(cxt, items);\n },\n};\nfunction validateAdditionalItems(cxt, items) {\n const { gen, schema, data, keyword, it } = cxt;\n it.items = true;\n const len = gen.const(\"len\", (0, codegen_1._) `${data}.length`);\n if (schema === false) {\n cxt.setParams({ len: items.length });\n cxt.pass((0, codegen_1._) `${len} <= ${items.length}`);\n }\n else if (typeof schema == \"object\" && !(0, util_1.alwaysValidSchema)(it, schema)) {\n const valid = gen.var(\"valid\", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var\n gen.if((0, codegen_1.not)(valid), () => validateItems(valid));\n cxt.ok(valid);\n }\n function validateItems(valid) {\n gen.forRange(\"i\", items.length, len, (i) => {\n cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);\n if (!it.allErrors)\n gen.if((0, codegen_1.not)(valid), () => gen.break());\n });\n }\n}\nexports.validateAdditionalItems = validateAdditionalItems;\nexports.default = def;\n//# sourceMappingURL=additionalItems.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateTuple = void 0;\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst code_1 = require(\"../code\");\nconst def = {\n keyword: \"items\",\n type: \"array\",\n schemaType: [\"object\", \"array\", \"boolean\"],\n before: \"uniqueItems\",\n code(cxt) {\n const { schema, it } = cxt;\n if (Array.isArray(schema))\n return validateTuple(cxt, \"additionalItems\", schema);\n it.items = true;\n if ((0, util_1.alwaysValidSchema)(it, schema))\n return;\n cxt.ok((0, code_1.validateArray)(cxt));\n },\n};\nfunction validateTuple(cxt, extraItems, schArr = cxt.schema) {\n const { gen, parentSchema, data, keyword, it } = cxt;\n checkStrictTuple(parentSchema);\n if (it.opts.unevaluated && schArr.length && it.items !== true) {\n it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);\n }\n const valid = gen.name(\"valid\");\n const len = gen.const(\"len\", (0, codegen_1._) `${data}.length`);\n schArr.forEach((sch, i) => {\n if ((0, util_1.alwaysValidSchema)(it, sch))\n return;\n gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({\n keyword,\n schemaProp: i,\n dataProp: i,\n }, valid));\n cxt.ok(valid);\n });\n function checkStrictTuple(sch) {\n const { opts, errSchemaPath } = it;\n const l = schArr.length;\n const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);\n if (opts.strictTuples && !fullTuple) {\n const msg = `\"${keyword}\" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path \"${errSchemaPath}\"`;\n (0, util_1.checkStrictMode)(it, msg, opts.strictTuples);\n }\n }\n}\nexports.validateTuple = validateTuple;\nexports.default = def;\n//# sourceMappingURL=items.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst items_1 = require(\"./items\");\nconst def = {\n keyword: \"prefixItems\",\n type: \"array\",\n schemaType: [\"array\"],\n before: \"uniqueItems\",\n code: (cxt) => (0, items_1.validateTuple)(cxt, \"items\"),\n};\nexports.default = def;\n//# sourceMappingURL=prefixItems.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst code_1 = require(\"../code\");\nconst additionalItems_1 = require(\"./additionalItems\");\nconst error = {\n message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`,\n params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`,\n};\nconst def = {\n keyword: \"items\",\n type: \"array\",\n schemaType: [\"object\", \"boolean\"],\n before: \"uniqueItems\",\n error,\n code(cxt) {\n const { schema, parentSchema, it } = cxt;\n const { prefixItems } = parentSchema;\n it.items = true;\n if ((0, util_1.alwaysValidSchema)(it, schema))\n return;\n if (prefixItems)\n (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);\n else\n cxt.ok((0, code_1.validateArray)(cxt));\n },\n};\nexports.default = def;\n//# sourceMappingURL=items2020.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: ({ params: { min, max } }) => max === undefined\n ? (0, codegen_1.str) `must contain at least ${min} valid item(s)`\n : (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`,\n params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`,\n};\nconst def = {\n keyword: \"contains\",\n type: \"array\",\n schemaType: [\"object\", \"boolean\"],\n before: \"uniqueItems\",\n trackErrors: true,\n error,\n code(cxt) {\n const { gen, schema, parentSchema, data, it } = cxt;\n let min;\n let max;\n const { minContains, maxContains } = parentSchema;\n if (it.opts.next) {\n min = minContains === undefined ? 1 : minContains;\n max = maxContains;\n }\n else {\n min = 1;\n }\n const len = gen.const(\"len\", (0, codegen_1._) `${data}.length`);\n cxt.setParams({ min, max });\n if (max === undefined && min === 0) {\n (0, util_1.checkStrictMode)(it, `\"minContains\" == 0 without \"maxContains\": \"contains\" keyword ignored`);\n return;\n }\n if (max !== undefined && min > max) {\n (0, util_1.checkStrictMode)(it, `\"minContains\" > \"maxContains\" is always invalid`);\n cxt.fail();\n return;\n }\n if ((0, util_1.alwaysValidSchema)(it, schema)) {\n let cond = (0, codegen_1._) `${len} >= ${min}`;\n if (max !== undefined)\n cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`;\n cxt.pass(cond);\n return;\n }\n it.items = true;\n const valid = gen.name(\"valid\");\n if (max === undefined && min === 1) {\n validateItems(valid, () => gen.if(valid, () => gen.break()));\n }\n else if (min === 0) {\n gen.let(valid, true);\n if (max !== undefined)\n gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount);\n }\n else {\n gen.let(valid, false);\n validateItemsWithCount();\n }\n cxt.result(valid, () => cxt.reset());\n function validateItemsWithCount() {\n const schValid = gen.name(\"_valid\");\n const count = gen.let(\"count\", 0);\n validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));\n }\n function validateItems(_valid, block) {\n gen.forRange(\"i\", 0, len, (i) => {\n cxt.subschema({\n keyword: \"contains\",\n dataProp: i,\n dataPropType: util_1.Type.Num,\n compositeRule: true,\n }, _valid);\n block();\n });\n }\n function checkLimits(count) {\n gen.code((0, codegen_1._) `${count}++`);\n if (max === undefined) {\n gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break());\n }\n else {\n gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break());\n if (min === 1)\n gen.assign(valid, true);\n else\n gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true));\n }\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=contains.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst code_1 = require(\"../code\");\nexports.error = {\n message: ({ params: { property, depsCount, deps } }) => {\n const property_ies = depsCount === 1 ? \"property\" : \"properties\";\n return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`;\n },\n params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property},\n missingProperty: ${missingProperty},\n depsCount: ${depsCount},\n deps: ${deps}}`, // TODO change to reference\n};\nconst def = {\n keyword: \"dependencies\",\n type: \"object\",\n schemaType: \"object\",\n error: exports.error,\n code(cxt) {\n const [propDeps, schDeps] = splitDependencies(cxt);\n validatePropertyDeps(cxt, propDeps);\n validateSchemaDeps(cxt, schDeps);\n },\n};\nfunction splitDependencies({ schema }) {\n const propertyDeps = {};\n const schemaDeps = {};\n for (const key in schema) {\n if (key === \"__proto__\")\n continue;\n const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;\n deps[key] = schema[key];\n }\n return [propertyDeps, schemaDeps];\n}\nfunction validatePropertyDeps(cxt, propertyDeps = cxt.schema) {\n const { gen, data, it } = cxt;\n if (Object.keys(propertyDeps).length === 0)\n return;\n const missing = gen.let(\"missing\");\n for (const prop in propertyDeps) {\n const deps = propertyDeps[prop];\n if (deps.length === 0)\n continue;\n const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties);\n cxt.setParams({\n property: prop,\n depsCount: deps.length,\n deps: deps.join(\", \"),\n });\n if (it.allErrors) {\n gen.if(hasProperty, () => {\n for (const depProp of deps) {\n (0, code_1.checkReportMissingProp)(cxt, depProp);\n }\n });\n }\n else {\n gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`);\n (0, code_1.reportMissingProp)(cxt, missing);\n gen.else();\n }\n }\n}\nexports.validatePropertyDeps = validatePropertyDeps;\nfunction validateSchemaDeps(cxt, schemaDeps = cxt.schema) {\n const { gen, data, keyword, it } = cxt;\n const valid = gen.name(\"valid\");\n for (const prop in schemaDeps) {\n if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop]))\n continue;\n gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => {\n const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid);\n cxt.mergeValidEvaluated(schCxt, valid);\n }, () => gen.var(valid, true) // TODO var\n );\n cxt.ok(valid);\n }\n}\nexports.validateSchemaDeps = validateSchemaDeps;\nexports.default = def;\n//# sourceMappingURL=dependencies.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: \"property name must be valid\",\n params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`,\n};\nconst def = {\n keyword: \"propertyNames\",\n type: \"object\",\n schemaType: [\"object\", \"boolean\"],\n error,\n code(cxt) {\n const { gen, schema, data, it } = cxt;\n if ((0, util_1.alwaysValidSchema)(it, schema))\n return;\n const valid = gen.name(\"valid\");\n gen.forIn(\"key\", data, (key) => {\n cxt.setParams({ propertyName: key });\n cxt.subschema({\n keyword: \"propertyNames\",\n data: key,\n dataTypes: [\"string\"],\n propertyName: key,\n compositeRule: true,\n }, valid);\n gen.if((0, codegen_1.not)(valid), () => {\n cxt.error(true);\n if (!it.allErrors)\n gen.break();\n });\n });\n cxt.ok(valid);\n },\n};\nexports.default = def;\n//# sourceMappingURL=propertyNames.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst code_1 = require(\"../code\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst names_1 = require(\"../../compile/names\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: \"must NOT have additional properties\",\n params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`,\n};\nconst def = {\n keyword: \"additionalProperties\",\n type: [\"object\"],\n schemaType: [\"boolean\", \"object\"],\n allowUndefined: true,\n trackErrors: true,\n error,\n code(cxt) {\n const { gen, schema, parentSchema, data, errsCount, it } = cxt;\n /* istanbul ignore if */\n if (!errsCount)\n throw new Error(\"ajv implementation error\");\n const { allErrors, opts } = it;\n it.props = true;\n if (opts.removeAdditional !== \"all\" && (0, util_1.alwaysValidSchema)(it, schema))\n return;\n const props = (0, code_1.allSchemaProperties)(parentSchema.properties);\n const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);\n checkAdditionalProperties();\n cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`);\n function checkAdditionalProperties() {\n gen.forIn(\"key\", data, (key) => {\n if (!props.length && !patProps.length)\n additionalPropertyCode(key);\n else\n gen.if(isAdditional(key), () => additionalPropertyCode(key));\n });\n }\n function isAdditional(key) {\n let definedProp;\n if (props.length > 8) {\n // TODO maybe an option instead of hard-coded 8?\n const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, \"properties\");\n definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);\n }\n else if (props.length) {\n definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`));\n }\n else {\n definedProp = codegen_1.nil;\n }\n if (patProps.length) {\n definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`));\n }\n return (0, codegen_1.not)(definedProp);\n }\n function deleteAdditional(key) {\n gen.code((0, codegen_1._) `delete ${data}[${key}]`);\n }\n function additionalPropertyCode(key) {\n if (opts.removeAdditional === \"all\" || (opts.removeAdditional && schema === false)) {\n deleteAdditional(key);\n return;\n }\n if (schema === false) {\n cxt.setParams({ additionalProperty: key });\n cxt.error();\n if (!allErrors)\n gen.break();\n return;\n }\n if (typeof schema == \"object\" && !(0, util_1.alwaysValidSchema)(it, schema)) {\n const valid = gen.name(\"valid\");\n if (opts.removeAdditional === \"failing\") {\n applyAdditionalSchema(key, valid, false);\n gen.if((0, codegen_1.not)(valid), () => {\n cxt.reset();\n deleteAdditional(key);\n });\n }\n else {\n applyAdditionalSchema(key, valid);\n if (!allErrors)\n gen.if((0, codegen_1.not)(valid), () => gen.break());\n }\n }\n }\n function applyAdditionalSchema(key, valid, errors) {\n const subschema = {\n keyword: \"additionalProperties\",\n dataProp: key,\n dataPropType: util_1.Type.Str,\n };\n if (errors === false) {\n Object.assign(subschema, {\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n });\n }\n cxt.subschema(subschema, valid);\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=additionalProperties.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst validate_1 = require(\"../../compile/validate\");\nconst code_1 = require(\"../code\");\nconst util_1 = require(\"../../compile/util\");\nconst additionalProperties_1 = require(\"./additionalProperties\");\nconst def = {\n keyword: \"properties\",\n type: \"object\",\n schemaType: \"object\",\n code(cxt) {\n const { gen, schema, parentSchema, data, it } = cxt;\n if (it.opts.removeAdditional === \"all\" && parentSchema.additionalProperties === undefined) {\n additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, \"additionalProperties\"));\n }\n const allProps = (0, code_1.allSchemaProperties)(schema);\n for (const prop of allProps) {\n it.definedProperties.add(prop);\n }\n if (it.opts.unevaluated && allProps.length && it.props !== true) {\n it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);\n }\n const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));\n if (properties.length === 0)\n return;\n const valid = gen.name(\"valid\");\n for (const prop of properties) {\n if (hasDefault(prop)) {\n applyPropertySchema(prop);\n }\n else {\n gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));\n applyPropertySchema(prop);\n if (!it.allErrors)\n gen.else().var(valid, true);\n gen.endIf();\n }\n cxt.it.definedProperties.add(prop);\n cxt.ok(valid);\n }\n function hasDefault(prop) {\n return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined;\n }\n function applyPropertySchema(prop) {\n cxt.subschema({\n keyword: \"properties\",\n schemaProp: prop,\n dataProp: prop,\n }, valid);\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=properties.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst code_1 = require(\"../code\");\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst util_2 = require(\"../../compile/util\");\nconst def = {\n keyword: \"patternProperties\",\n type: \"object\",\n schemaType: \"object\",\n code(cxt) {\n const { gen, schema, data, parentSchema, it } = cxt;\n const { opts } = it;\n const patterns = (0, code_1.allSchemaProperties)(schema);\n const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p]));\n if (patterns.length === 0 ||\n (alwaysValidPatterns.length === patterns.length &&\n (!it.opts.unevaluated || it.props === true))) {\n return;\n }\n const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties;\n const valid = gen.name(\"valid\");\n if (it.props !== true && !(it.props instanceof codegen_1.Name)) {\n it.props = (0, util_2.evaluatedPropsToName)(gen, it.props);\n }\n const { props } = it;\n validatePatternProperties();\n function validatePatternProperties() {\n for (const pat of patterns) {\n if (checkProperties)\n checkMatchingProperties(pat);\n if (it.allErrors) {\n validateProperties(pat);\n }\n else {\n gen.var(valid, true); // TODO var\n validateProperties(pat);\n gen.if(valid);\n }\n }\n }\n function checkMatchingProperties(pat) {\n for (const prop in checkProperties) {\n if (new RegExp(pat).test(prop)) {\n (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);\n }\n }\n }\n function validateProperties(pat) {\n gen.forIn(\"key\", data, (key) => {\n gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {\n const alwaysValid = alwaysValidPatterns.includes(pat);\n if (!alwaysValid) {\n cxt.subschema({\n keyword: \"patternProperties\",\n schemaProp: pat,\n dataProp: key,\n dataPropType: util_2.Type.Str,\n }, valid);\n }\n if (it.opts.unevaluated && props !== true) {\n gen.assign((0, codegen_1._) `${props}[${key}]`, true);\n }\n else if (!alwaysValid && !it.allErrors) {\n // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)\n // or if all properties were evaluated (props === true)\n gen.if((0, codegen_1.not)(valid), () => gen.break());\n }\n });\n });\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=patternProperties.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"../../compile/util\");\nconst def = {\n keyword: \"not\",\n schemaType: [\"object\", \"boolean\"],\n trackErrors: true,\n code(cxt) {\n const { gen, schema, it } = cxt;\n if ((0, util_1.alwaysValidSchema)(it, schema)) {\n cxt.fail();\n return;\n }\n const valid = gen.name(\"valid\");\n cxt.subschema({\n keyword: \"not\",\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n }, valid);\n cxt.failResult(valid, () => cxt.reset(), () => cxt.error());\n },\n error: { message: \"must NOT be valid\" },\n};\nexports.default = def;\n//# sourceMappingURL=not.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst code_1 = require(\"../code\");\nconst def = {\n keyword: \"anyOf\",\n schemaType: \"array\",\n trackErrors: true,\n code: code_1.validateUnion,\n error: { message: \"must match a schema in anyOf\" },\n};\nexports.default = def;\n//# sourceMappingURL=anyOf.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: \"must match exactly one schema in oneOf\",\n params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`,\n};\nconst def = {\n keyword: \"oneOf\",\n schemaType: \"array\",\n trackErrors: true,\n error,\n code(cxt) {\n const { gen, schema, parentSchema, it } = cxt;\n /* istanbul ignore if */\n if (!Array.isArray(schema))\n throw new Error(\"ajv implementation error\");\n if (it.opts.discriminator && parentSchema.discriminator)\n return;\n const schArr = schema;\n const valid = gen.let(\"valid\", false);\n const passing = gen.let(\"passing\", null);\n const schValid = gen.name(\"_valid\");\n cxt.setParams({ passing });\n // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas\n gen.block(validateOneOf);\n cxt.result(valid, () => cxt.reset(), () => cxt.error(true));\n function validateOneOf() {\n schArr.forEach((sch, i) => {\n let schCxt;\n if ((0, util_1.alwaysValidSchema)(it, sch)) {\n gen.var(schValid, true);\n }\n else {\n schCxt = cxt.subschema({\n keyword: \"oneOf\",\n schemaProp: i,\n compositeRule: true,\n }, schValid);\n }\n if (i > 0) {\n gen\n .if((0, codegen_1._) `${schValid} && ${valid}`)\n .assign(valid, false)\n .assign(passing, (0, codegen_1._) `[${passing}, ${i}]`)\n .else();\n }\n gen.if(schValid, () => {\n gen.assign(valid, true);\n gen.assign(passing, i);\n if (schCxt)\n cxt.mergeEvaluated(schCxt, codegen_1.Name);\n });\n });\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=oneOf.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"../../compile/util\");\nconst def = {\n keyword: \"allOf\",\n schemaType: \"array\",\n code(cxt) {\n const { gen, schema, it } = cxt;\n /* istanbul ignore if */\n if (!Array.isArray(schema))\n throw new Error(\"ajv implementation error\");\n const valid = gen.name(\"valid\");\n schema.forEach((sch, i) => {\n if ((0, util_1.alwaysValidSchema)(it, sch))\n return;\n const schCxt = cxt.subschema({ keyword: \"allOf\", schemaProp: i }, valid);\n cxt.ok(valid);\n cxt.mergeEvaluated(schCxt);\n });\n },\n};\nexports.default = def;\n//# sourceMappingURL=allOf.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: ({ params }) => (0, codegen_1.str) `must match \"${params.ifClause}\" schema`,\n params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`,\n};\nconst def = {\n keyword: \"if\",\n schemaType: [\"object\", \"boolean\"],\n trackErrors: true,\n error,\n code(cxt) {\n const { gen, parentSchema, it } = cxt;\n if (parentSchema.then === undefined && parentSchema.else === undefined) {\n (0, util_1.checkStrictMode)(it, '\"if\" without \"then\" and \"else\" is ignored');\n }\n const hasThen = hasSchema(it, \"then\");\n const hasElse = hasSchema(it, \"else\");\n if (!hasThen && !hasElse)\n return;\n const valid = gen.let(\"valid\", true);\n const schValid = gen.name(\"_valid\");\n validateIf();\n cxt.reset();\n if (hasThen && hasElse) {\n const ifClause = gen.let(\"ifClause\");\n cxt.setParams({ ifClause });\n gen.if(schValid, validateClause(\"then\", ifClause), validateClause(\"else\", ifClause));\n }\n else if (hasThen) {\n gen.if(schValid, validateClause(\"then\"));\n }\n else {\n gen.if((0, codegen_1.not)(schValid), validateClause(\"else\"));\n }\n cxt.pass(valid, () => cxt.error(true));\n function validateIf() {\n const schCxt = cxt.subschema({\n keyword: \"if\",\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n }, schValid);\n cxt.mergeEvaluated(schCxt);\n }\n function validateClause(keyword, ifClause) {\n return () => {\n const schCxt = cxt.subschema({ keyword }, schValid);\n gen.assign(valid, schValid);\n cxt.mergeValidEvaluated(schCxt, valid);\n if (ifClause)\n gen.assign(ifClause, (0, codegen_1._) `${keyword}`);\n else\n cxt.setParams({ ifClause: keyword });\n };\n }\n },\n};\nfunction hasSchema(it, keyword) {\n const schema = it.schema[keyword];\n return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema);\n}\nexports.default = def;\n//# sourceMappingURL=if.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"../../compile/util\");\nconst def = {\n keyword: [\"then\", \"else\"],\n schemaType: [\"object\", \"boolean\"],\n code({ keyword, parentSchema, it }) {\n if (parentSchema.if === undefined)\n (0, util_1.checkStrictMode)(it, `\"${keyword}\" without \"if\" is ignored`);\n },\n};\nexports.default = def;\n//# sourceMappingURL=thenElse.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst additionalItems_1 = require(\"./additionalItems\");\nconst prefixItems_1 = require(\"./prefixItems\");\nconst items_1 = require(\"./items\");\nconst items2020_1 = require(\"./items2020\");\nconst contains_1 = require(\"./contains\");\nconst dependencies_1 = require(\"./dependencies\");\nconst propertyNames_1 = require(\"./propertyNames\");\nconst additionalProperties_1 = require(\"./additionalProperties\");\nconst properties_1 = require(\"./properties\");\nconst patternProperties_1 = require(\"./patternProperties\");\nconst not_1 = require(\"./not\");\nconst anyOf_1 = require(\"./anyOf\");\nconst oneOf_1 = require(\"./oneOf\");\nconst allOf_1 = require(\"./allOf\");\nconst if_1 = require(\"./if\");\nconst thenElse_1 = require(\"./thenElse\");\nfunction getApplicator(draft2020 = false) {\n const applicator = [\n // any\n not_1.default,\n anyOf_1.default,\n oneOf_1.default,\n allOf_1.default,\n if_1.default,\n thenElse_1.default,\n // object\n propertyNames_1.default,\n additionalProperties_1.default,\n dependencies_1.default,\n properties_1.default,\n patternProperties_1.default,\n ];\n // array\n if (draft2020)\n applicator.push(prefixItems_1.default, items2020_1.default);\n else\n applicator.push(additionalItems_1.default, items_1.default);\n applicator.push(contains_1.default);\n return applicator;\n}\nexports.default = getApplicator;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst error = {\n message: ({ schemaCode }) => (0, codegen_1.str) `must match format \"${schemaCode}\"`,\n params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`,\n};\nconst def = {\n keyword: \"format\",\n type: [\"number\", \"string\"],\n schemaType: \"string\",\n $data: true,\n error,\n code(cxt, ruleType) {\n const { gen, data, $data, schema, schemaCode, it } = cxt;\n const { opts, errSchemaPath, schemaEnv, self } = it;\n if (!opts.validateFormats)\n return;\n if ($data)\n validate$DataFormat();\n else\n validateFormat();\n function validate$DataFormat() {\n const fmts = gen.scopeValue(\"formats\", {\n ref: self.formats,\n code: opts.code.formats,\n });\n const fDef = gen.const(\"fDef\", (0, codegen_1._) `${fmts}[${schemaCode}]`);\n const fType = gen.let(\"fType\");\n const format = gen.let(\"format\");\n // TODO simplify\n gen.if((0, codegen_1._) `typeof ${fDef} == \"object\" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || \"string\"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `\"string\"`).assign(format, fDef));\n cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));\n function unknownFmt() {\n if (opts.strictSchema === false)\n return codegen_1.nil;\n return (0, codegen_1._) `${schemaCode} && !${format}`;\n }\n function invalidFmt() {\n const callFormat = schemaEnv.$async\n ? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))`\n : (0, codegen_1._) `${format}(${data})`;\n const validData = (0, codegen_1._) `(typeof ${format} == \"function\" ? ${callFormat} : ${format}.test(${data}))`;\n return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;\n }\n }\n function validateFormat() {\n const formatDef = self.formats[schema];\n if (!formatDef) {\n unknownFormat();\n return;\n }\n if (formatDef === true)\n return;\n const [fmtType, format, fmtRef] = getFormat(formatDef);\n if (fmtType === ruleType)\n cxt.pass(validCondition());\n function unknownFormat() {\n if (opts.strictSchema === false) {\n self.logger.warn(unknownMsg());\n return;\n }\n throw new Error(unknownMsg());\n function unknownMsg() {\n return `unknown format \"${schema}\" ignored in schema at path \"${errSchemaPath}\"`;\n }\n }\n function getFormat(fmtDef) {\n const code = fmtDef instanceof RegExp\n ? (0, codegen_1.regexpCode)(fmtDef)\n : opts.code.formats\n ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}`\n : undefined;\n const fmt = gen.scopeValue(\"formats\", { key: schema, ref: fmtDef, code });\n if (typeof fmtDef == \"object\" && !(fmtDef instanceof RegExp)) {\n return [fmtDef.type || \"string\", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`];\n }\n return [\"string\", fmtDef, fmt];\n }\n function validCondition() {\n if (typeof formatDef == \"object\" && !(formatDef instanceof RegExp) && formatDef.async) {\n if (!schemaEnv.$async)\n throw new Error(\"async format in sync schema\");\n return (0, codegen_1._) `await ${fmtRef}(${data})`;\n }\n return typeof format == \"function\" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`;\n }\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=format.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst format_1 = require(\"./format\");\nconst format = [format_1.default];\nexports.default = format;\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.contentVocabulary = exports.metadataVocabulary = void 0;\nexports.metadataVocabulary = [\n \"title\",\n \"description\",\n \"default\",\n \"deprecated\",\n \"readOnly\",\n \"writeOnly\",\n \"examples\",\n];\nexports.contentVocabulary = [\n \"contentMediaType\",\n \"contentEncoding\",\n \"contentSchema\",\n];\n//# sourceMappingURL=metadata.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst core_1 = require(\"./core\");\nconst validation_1 = require(\"./validation\");\nconst applicator_1 = require(\"./applicator\");\nconst format_1 = require(\"./format\");\nconst metadata_1 = require(\"./metadata\");\nconst draft7Vocabularies = [\n core_1.default,\n validation_1.default,\n (0, applicator_1.default)(),\n format_1.default,\n metadata_1.metadataVocabulary,\n metadata_1.contentVocabulary,\n];\nexports.default = draft7Vocabularies;\n//# sourceMappingURL=draft7.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DiscrError = void 0;\nvar DiscrError;\n(function (DiscrError) {\n DiscrError[\"Tag\"] = \"tag\";\n DiscrError[\"Mapping\"] = \"mapping\";\n})(DiscrError || (exports.DiscrError = DiscrError = {}));\n//# sourceMappingURL=types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst codegen_1 = require(\"../../compile/codegen\");\nconst types_1 = require(\"../discriminator/types\");\nconst compile_1 = require(\"../../compile\");\nconst ref_error_1 = require(\"../../compile/ref_error\");\nconst util_1 = require(\"../../compile/util\");\nconst error = {\n message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag\n ? `tag \"${tagName}\" must be string`\n : `value of tag \"${tagName}\" must be in oneOf`,\n params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`,\n};\nconst def = {\n keyword: \"discriminator\",\n type: \"object\",\n schemaType: \"object\",\n error,\n code(cxt) {\n const { gen, data, schema, parentSchema, it } = cxt;\n const { oneOf } = parentSchema;\n if (!it.opts.discriminator) {\n throw new Error(\"discriminator: requires discriminator option\");\n }\n const tagName = schema.propertyName;\n if (typeof tagName != \"string\")\n throw new Error(\"discriminator: requires propertyName\");\n if (schema.mapping)\n throw new Error(\"discriminator: mapping is not supported\");\n if (!oneOf)\n throw new Error(\"discriminator: requires oneOf keyword\");\n const valid = gen.let(\"valid\", false);\n const tag = gen.const(\"tag\", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`);\n gen.if((0, codegen_1._) `typeof ${tag} == \"string\"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName }));\n cxt.ok(valid);\n function validateMapping() {\n const mapping = getMapping();\n gen.if(false);\n for (const tagValue in mapping) {\n gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`);\n gen.assign(valid, applyTagSchema(mapping[tagValue]));\n }\n gen.else();\n cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });\n gen.endIf();\n }\n function applyTagSchema(schemaProp) {\n const _valid = gen.name(\"valid\");\n const schCxt = cxt.subschema({ keyword: \"oneOf\", schemaProp }, _valid);\n cxt.mergeEvaluated(schCxt, codegen_1.Name);\n return _valid;\n }\n function getMapping() {\n var _a;\n const oneOfMapping = {};\n const topRequired = hasRequired(parentSchema);\n let tagRequired = true;\n for (let i = 0; i < oneOf.length; i++) {\n let sch = oneOf[i];\n if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {\n const ref = sch.$ref;\n sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);\n if (sch instanceof compile_1.SchemaEnv)\n sch = sch.schema;\n if (sch === undefined)\n throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);\n }\n const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];\n if (typeof propSch != \"object\") {\n throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have \"properties/${tagName}\"`);\n }\n tagRequired = tagRequired && (topRequired || hasRequired(sch));\n addMappings(propSch, i);\n }\n if (!tagRequired)\n throw new Error(`discriminator: \"${tagName}\" must be required`);\n return oneOfMapping;\n function hasRequired({ required }) {\n return Array.isArray(required) && required.includes(tagName);\n }\n function addMappings(sch, i) {\n if (sch.const) {\n addMapping(sch.const, i);\n }\n else if (sch.enum) {\n for (const tagValue of sch.enum) {\n addMapping(tagValue, i);\n }\n }\n else {\n throw new Error(`discriminator: \"properties/${tagName}\" must have \"const\" or \"enum\"`);\n }\n }\n function addMapping(tagValue, i) {\n if (typeof tagValue != \"string\" || tagValue in oneOfMapping) {\n throw new Error(`discriminator: \"${tagName}\" values must be unique strings`);\n }\n oneOfMapping[tagValue] = i;\n }\n }\n },\n};\nexports.default = def;\n//# sourceMappingURL=index.js.map","","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;\nconst core_1 = require(\"./core\");\nconst draft7_1 = require(\"./vocabularies/draft7\");\nconst discriminator_1 = require(\"./vocabularies/discriminator\");\nconst draft7MetaSchema = require(\"./refs/json-schema-draft-07.json\");\nconst META_SUPPORT_DATA = [\"/properties\"];\nconst META_SCHEMA_ID = \"http://json-schema.org/draft-07/schema\";\nclass Ajv extends core_1.default {\n _addVocabularies() {\n super._addVocabularies();\n draft7_1.default.forEach((v) => this.addVocabulary(v));\n if (this.opts.discriminator)\n this.addKeyword(discriminator_1.default);\n }\n _addDefaultMetaSchema() {\n super._addDefaultMetaSchema();\n if (!this.opts.meta)\n return;\n const metaSchema = this.opts.$data\n ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)\n : draft7MetaSchema;\n this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);\n this.refs[\"http://json-schema.org/schema\"] = META_SCHEMA_ID;\n }\n defaultMeta() {\n return (this.opts.defaultMeta =\n super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));\n }\n}\nexports.Ajv = Ajv;\nmodule.exports = exports = Ajv;\nmodule.exports.Ajv = Ajv;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = Ajv;\nvar validate_1 = require(\"./compile/validate\");\nObject.defineProperty(exports, \"KeywordCxt\", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });\nvar codegen_1 = require(\"./compile/codegen\");\nObject.defineProperty(exports, \"_\", { enumerable: true, get: function () { return codegen_1._; } });\nObject.defineProperty(exports, \"str\", { enumerable: true, get: function () { return codegen_1.str; } });\nObject.defineProperty(exports, \"stringify\", { enumerable: true, get: function () { return codegen_1.stringify; } });\nObject.defineProperty(exports, \"nil\", { enumerable: true, get: function () { return codegen_1.nil; } });\nObject.defineProperty(exports, \"Name\", { enumerable: true, get: function () { return codegen_1.Name; } });\nObject.defineProperty(exports, \"CodeGen\", { enumerable: true, get: function () { return codegen_1.CodeGen; } });\nvar validation_error_1 = require(\"./runtime/validation_error\");\nObject.defineProperty(exports, \"ValidationError\", { enumerable: true, get: function () { return validation_error_1.default; } });\nvar ref_error_1 = require(\"./compile/ref_error\");\nObject.defineProperty(exports, \"MissingRefError\", { enumerable: true, get: function () { return ref_error_1.default; } });\n//# sourceMappingURL=ajv.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatNames = exports.fastFormats = exports.fullFormats = void 0;\nfunction fmtDef(validate, compare) {\n return { validate, compare };\n}\nexports.fullFormats = {\n // date: http://tools.ietf.org/html/rfc3339#section-5.6\n date: fmtDef(date, compareDate),\n // date-time: http://tools.ietf.org/html/rfc3339#section-5.6\n time: fmtDef(getTime(true), compareTime),\n \"date-time\": fmtDef(getDateTime(true), compareDateTime),\n \"iso-time\": fmtDef(getTime(), compareIsoTime),\n \"iso-date-time\": fmtDef(getDateTime(), compareIsoDateTime),\n // duration: https://tools.ietf.org/html/rfc3339#appendix-A\n duration: /^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/,\n uri,\n \"uri-reference\": /^(?:[a-z][a-z0-9+\\-.]*:)?(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\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=:@/?]|%[0-9a-f]{2})*)?$/i,\n // uri-template: https://tools.ietf.org/html/rfc6570\n \"uri-template\": /^(?:(?:[^\\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,\n // For the source: https://gist.github.com/dperini/729294\n // For test cases: https://mathiasbynens.be/demo/url-regex\n url: /^(?:https?|ftp):\\/\\/(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)(?:\\.(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu,\n 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,\n hostname: /^(?=.{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,\n // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html\n ipv4: /^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/,\n ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))$/i,\n regex,\n // uuid: http://tools.ietf.org/html/rfc4122\n uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,\n // JSON-pointer: https://tools.ietf.org/html/rfc6901\n // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A\n \"json-pointer\": /^(?:\\/(?:[^~/]|~0|~1)*)*$/,\n \"json-pointer-uri-fragment\": /^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,\n // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00\n \"relative-json-pointer\": /^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,\n // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types\n // byte: https://github.com/miguelmota/is-base64\n byte,\n // signed 32 bit integer\n int32: { type: \"number\", validate: validateInt32 },\n // signed 64 bit integer\n int64: { type: \"number\", validate: validateInt64 },\n // C-type float\n float: { type: \"number\", validate: validateNumber },\n // C-type double\n double: { type: \"number\", validate: validateNumber },\n // hint to the UI to hide input strings\n password: true,\n // unchecked string payload\n binary: true,\n};\nexports.fastFormats = {\n ...exports.fullFormats,\n date: fmtDef(/^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d$/, compareDate),\n time: fmtDef(/^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)$/i, compareTime),\n \"date-time\": fmtDef(/^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\dt(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)$/i, compareDateTime),\n \"iso-time\": fmtDef(/^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)?$/i, compareIsoTime),\n \"iso-date-time\": fmtDef(/^\\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, compareIsoDateTime),\n // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js\n uri: /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/)?[^\\s]*$/i,\n \"uri-reference\": /^(?:(?:[a-z][a-z0-9+\\-.]*:)?\\/?\\/)?(?:[^\\\\\\s#][^\\s#]*)?(?:#[^\\\\\\s]*)?$/i,\n // email (sources from jsen validator):\n // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363\n // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')\n 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,\n};\nexports.formatNames = Object.keys(exports.fullFormats);\nfunction isLeapYear(year) {\n // https://tools.ietf.org/html/rfc3339#appendix-C\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\nconst DATE = /^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/;\nconst DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nfunction date(str) {\n // full-date from http://tools.ietf.org/html/rfc3339#section-5.6\n const matches = DATE.exec(str);\n if (!matches)\n return false;\n const year = +matches[1];\n const month = +matches[2];\n const day = +matches[3];\n return (month >= 1 &&\n month <= 12 &&\n day >= 1 &&\n day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]));\n}\nfunction compareDate(d1, d2) {\n if (!(d1 && d2))\n return undefined;\n if (d1 > d2)\n return 1;\n if (d1 < d2)\n return -1;\n return 0;\n}\nconst TIME = /^(\\d\\d):(\\d\\d):(\\d\\d(?:\\.\\d+)?)(z|([+-])(\\d\\d)(?::?(\\d\\d))?)?$/i;\nfunction getTime(strictTimeZone) {\n return function time(str) {\n const matches = TIME.exec(str);\n if (!matches)\n return false;\n const hr = +matches[1];\n const min = +matches[2];\n const sec = +matches[3];\n const tz = matches[4];\n const tzSign = matches[5] === \"-\" ? -1 : 1;\n const tzH = +(matches[6] || 0);\n const tzM = +(matches[7] || 0);\n if (tzH > 23 || tzM > 59 || (strictTimeZone && !tz))\n return false;\n if (hr <= 23 && min <= 59 && sec < 60)\n return true;\n // leap second\n const utcMin = min - tzM * tzSign;\n const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);\n return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;\n };\n}\nfunction compareTime(s1, s2) {\n if (!(s1 && s2))\n return undefined;\n const t1 = new Date(\"2020-01-01T\" + s1).valueOf();\n const t2 = new Date(\"2020-01-01T\" + s2).valueOf();\n if (!(t1 && t2))\n return undefined;\n return t1 - t2;\n}\nfunction compareIsoTime(t1, t2) {\n if (!(t1 && t2))\n return undefined;\n const a1 = TIME.exec(t1);\n const a2 = TIME.exec(t2);\n if (!(a1 && a2))\n return undefined;\n t1 = a1[1] + a1[2] + a1[3];\n t2 = a2[1] + a2[2] + a2[3];\n if (t1 > t2)\n return 1;\n if (t1 < t2)\n return -1;\n return 0;\n}\nconst DATE_TIME_SEPARATOR = /t|\\s/i;\nfunction getDateTime(strictTimeZone) {\n const time = getTime(strictTimeZone);\n return function date_time(str) {\n // http://tools.ietf.org/html/rfc3339#section-5.6\n const dateTime = str.split(DATE_TIME_SEPARATOR);\n return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);\n };\n}\nfunction compareDateTime(dt1, dt2) {\n if (!(dt1 && dt2))\n return undefined;\n const d1 = new Date(dt1).valueOf();\n const d2 = new Date(dt2).valueOf();\n if (!(d1 && d2))\n return undefined;\n return d1 - d2;\n}\nfunction compareIsoDateTime(dt1, dt2) {\n if (!(dt1 && dt2))\n return undefined;\n const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);\n const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);\n const res = compareDate(d1, d2);\n if (res === undefined)\n return undefined;\n return res || compareTime(t1, t2);\n}\nconst NOT_URI_FRAGMENT = /\\/|:/;\nconst URI = /^(?:[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;\nfunction uri(str) {\n // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required \".\"\n return NOT_URI_FRAGMENT.test(str) && URI.test(str);\n}\nconst BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;\nfunction byte(str) {\n BYTE.lastIndex = 0;\n return BYTE.test(str);\n}\nconst MIN_INT32 = -(2 ** 31);\nconst MAX_INT32 = 2 ** 31 - 1;\nfunction validateInt32(value) {\n return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;\n}\nfunction validateInt64(value) {\n // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64\n return Number.isInteger(value);\n}\nfunction validateNumber() {\n return true;\n}\nconst Z_ANCHOR = /[^\\\\]\\\\Z/;\nfunction regex(str) {\n if (Z_ANCHOR.test(str))\n return false;\n try {\n new RegExp(str);\n return true;\n }\n catch (e) {\n return false;\n }\n}\n//# sourceMappingURL=formats.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.formatLimitDefinition = void 0;\nconst ajv_1 = require(\"ajv\");\nconst codegen_1 = require(\"ajv/dist/compile/codegen\");\nconst ops = codegen_1.operators;\nconst KWDs = {\n formatMaximum: { okStr: \"<=\", ok: ops.LTE, fail: ops.GT },\n formatMinimum: { okStr: \">=\", ok: ops.GTE, fail: ops.LT },\n formatExclusiveMaximum: { okStr: \"<\", ok: ops.LT, fail: ops.GTE },\n formatExclusiveMinimum: { okStr: \">\", ok: ops.GT, fail: ops.LTE },\n};\nconst error = {\n message: ({ keyword, schemaCode }) => (0, codegen_1.str) `should be ${KWDs[keyword].okStr} ${schemaCode}`,\n params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`,\n};\nexports.formatLimitDefinition = {\n keyword: Object.keys(KWDs),\n type: \"string\",\n schemaType: \"string\",\n $data: true,\n error,\n code(cxt) {\n const { gen, data, schemaCode, keyword, it } = cxt;\n const { opts, self } = it;\n if (!opts.validateFormats)\n return;\n const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, \"format\");\n if (fCxt.$data)\n validate$DataFormat();\n else\n validateFormat();\n function validate$DataFormat() {\n const fmts = gen.scopeValue(\"formats\", {\n ref: self.formats,\n code: opts.code.formats,\n });\n const fmt = gen.const(\"fmt\", (0, codegen_1._) `${fmts}[${fCxt.schemaCode}]`);\n cxt.fail$data((0, codegen_1.or)((0, codegen_1._) `typeof ${fmt} != \"object\"`, (0, codegen_1._) `${fmt} instanceof RegExp`, (0, codegen_1._) `typeof ${fmt}.compare != \"function\"`, compareCode(fmt)));\n }\n function validateFormat() {\n const format = fCxt.schema;\n const fmtDef = self.formats[format];\n if (!fmtDef || fmtDef === true)\n return;\n if (typeof fmtDef != \"object\" ||\n fmtDef instanceof RegExp ||\n typeof fmtDef.compare != \"function\") {\n throw new Error(`\"${keyword}\": format \"${format}\" does not define \"compare\" function`);\n }\n const fmt = gen.scopeValue(\"formats\", {\n key: format,\n ref: fmtDef,\n code: opts.code.formats ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : undefined,\n });\n cxt.fail$data(compareCode(fmt));\n }\n function compareCode(fmt) {\n return (0, codegen_1._) `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;\n }\n },\n dependencies: [\"format\"],\n};\nconst formatLimitPlugin = (ajv) => {\n ajv.addKeyword(exports.formatLimitDefinition);\n return ajv;\n};\nexports.default = formatLimitPlugin;\n//# sourceMappingURL=limit.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst formats_1 = require(\"./formats\");\nconst limit_1 = require(\"./limit\");\nconst codegen_1 = require(\"ajv/dist/compile/codegen\");\nconst fullName = new codegen_1.Name(\"fullFormats\");\nconst fastName = new codegen_1.Name(\"fastFormats\");\nconst formatsPlugin = (ajv, opts = { keywords: true }) => {\n if (Array.isArray(opts)) {\n addFormats(ajv, opts, formats_1.fullFormats, fullName);\n return ajv;\n }\n const [formats, exportName] = opts.mode === \"fast\" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];\n const list = opts.formats || formats_1.formatNames;\n addFormats(ajv, list, formats, exportName);\n if (opts.keywords)\n (0, limit_1.default)(ajv);\n return ajv;\n};\nformatsPlugin.get = (name, mode = \"full\") => {\n const formats = mode === \"fast\" ? formats_1.fastFormats : formats_1.fullFormats;\n const f = formats[name];\n if (!f)\n throw new Error(`Unknown format \"${name}\"`);\n return f;\n};\nfunction addFormats(ajv, list, fs, exportName) {\n var _a;\n var _b;\n (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = (0, codegen_1._) `require(\"ajv-formats/dist/formats\").${exportName}`);\n for (const f of list)\n ajv.addFormat(f, fs[f]);\n}\nmodule.exports = exports = formatsPlugin;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = formatsPlugin;\n//# sourceMappingURL=index.js.map","/**\n * AJV-based JSON Schema validator provider\n */\nimport Ajv from 'ajv';\nimport _addFormats from 'ajv-formats';\nfunction createDefaultAjvInstance() {\n const ajv = new Ajv({\n strict: false,\n validateFormats: true,\n validateSchema: false,\n allErrors: true\n });\n const addFormats = _addFormats;\n addFormats(ajv);\n return ajv;\n}\n/**\n * @example\n * ```typescript\n * // Use with default AJV instance (recommended)\n * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';\n * const validator = new AjvJsonSchemaValidator();\n *\n * // Use with custom AJV instance\n * import { Ajv } from 'ajv';\n * const ajv = new Ajv({ strict: true, allErrors: true });\n * const validator = new AjvJsonSchemaValidator(ajv);\n * ```\n */\nexport class AjvJsonSchemaValidator {\n /**\n * Create an AJV validator\n *\n * @param ajv - Optional pre-configured AJV instance. If not provided, a default instance will be created.\n *\n * @example\n * ```typescript\n * // Use default configuration (recommended for most cases)\n * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';\n * const validator = new AjvJsonSchemaValidator();\n *\n * // Or provide custom AJV instance for advanced configuration\n * import { Ajv } from 'ajv';\n * import addFormats from 'ajv-formats';\n *\n * const ajv = new Ajv({ validateFormats: true });\n * addFormats(ajv);\n * const validator = new AjvJsonSchemaValidator(ajv);\n * ```\n */\n constructor(ajv) {\n this._ajv = ajv ?? createDefaultAjvInstance();\n }\n /**\n * Create a validator for the given JSON Schema\n *\n * The validator is compiled once and can be reused multiple times.\n * If the schema has an $id, it will be cached by AJV automatically.\n *\n * @param schema - Standard JSON Schema object\n * @returns A validator function that validates input data\n */\n getValidator(schema) {\n // Check if schema has $id and is already compiled/cached\n const ajvValidator = '$id' in schema && typeof schema.$id === 'string'\n ? (this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema))\n : this._ajv.compile(schema);\n return (input) => {\n const valid = ajvValidator(input);\n if (valid) {\n return {\n valid: true,\n data: input,\n errorMessage: undefined\n };\n }\n else {\n return {\n valid: false,\n data: undefined,\n errorMessage: this._ajv.errorsText(ajvValidator.errors)\n };\n }\n };\n }\n}\n//# sourceMappingURL=ajv-provider.js.map","/**\n * Experimental server task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\nimport { CreateMessageResultSchema, ElicitResultSchema } from '../../types.js';\n/**\n * Experimental task features for low-level MCP servers.\n *\n * Access via `server.experimental.tasks`:\n * ```typescript\n * const stream = server.experimental.tasks.requestStream(request, schema, options);\n * ```\n *\n * For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.\n *\n * @experimental\n */\nexport class ExperimentalServerTasks {\n constructor(_server) {\n this._server = _server;\n }\n /**\n * Sends a request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * This method provides streaming access to request processing, allowing you to\n * observe intermediate task status updates for task-augmented requests.\n *\n * @param request - The request to send\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options (timeout, signal, task creation params, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n requestStream(request, resultSchema, options) {\n return this._server.requestStream(request, resultSchema, options);\n }\n /**\n * Sends a sampling request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages\n * before the final result.\n *\n * @example\n * ```typescript\n * const stream = server.experimental.tasks.createMessageStream({\n * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],\n * maxTokens: 100\n * }, {\n * onprogress: (progress) => {\n * // Handle streaming tokens via progress notifications\n * console.log('Progress:', progress.message);\n * }\n * });\n *\n * for await (const message of stream) {\n * switch (message.type) {\n * case 'taskCreated':\n * console.log('Task created:', message.task.taskId);\n * break;\n * case 'taskStatus':\n * console.log('Task status:', message.task.status);\n * break;\n * case 'result':\n * console.log('Final result:', message.result);\n * break;\n * case 'error':\n * console.error('Error:', message.error);\n * break;\n * }\n * }\n * ```\n *\n * @param params - The sampling request parameters\n * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n createMessageStream(params, options) {\n // Access client capabilities via the server\n const clientCapabilities = this._server.getClientCapabilities();\n // Capability check - only required when tools/toolChoice are provided\n if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {\n throw new Error('Client does not support sampling tools capability.');\n }\n // Message structure validation - always validate tool_use/tool_result pairs.\n // These may appear even without tools/toolChoice in the current request when\n // a previous sampling request returned tool_use and this is a follow-up with results.\n if (params.messages.length > 0) {\n const lastMessage = params.messages[params.messages.length - 1];\n const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];\n const hasToolResults = lastContent.some(c => c.type === 'tool_result');\n const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;\n const previousContent = previousMessage\n ? Array.isArray(previousMessage.content)\n ? previousMessage.content\n : [previousMessage.content]\n : [];\n const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');\n if (hasToolResults) {\n if (lastContent.some(c => c.type !== 'tool_result')) {\n throw new Error('The last message must contain only tool_result content if any is present');\n }\n if (!hasPreviousToolUse) {\n throw new Error('tool_result blocks are not matching any tool_use from the previous message');\n }\n }\n if (hasPreviousToolUse) {\n // Extract tool_use IDs from previous message and tool_result IDs from current message\n const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));\n const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));\n if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {\n throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');\n }\n }\n }\n return this.requestStream({\n method: 'sampling/createMessage',\n params\n }, CreateMessageResultSchema, options);\n }\n /**\n * Sends an elicitation request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'\n * and 'taskStatus' messages before the final result.\n *\n * @example\n * ```typescript\n * const stream = server.experimental.tasks.elicitInputStream({\n * mode: 'url',\n * message: 'Please authenticate',\n * elicitationId: 'auth-123',\n * url: 'https://example.com/auth'\n * }, {\n * task: { ttl: 300000 } // Task-augmented for long-running auth flow\n * });\n *\n * for await (const message of stream) {\n * switch (message.type) {\n * case 'taskCreated':\n * console.log('Task created:', message.task.taskId);\n * break;\n * case 'taskStatus':\n * console.log('Task status:', message.task.status);\n * break;\n * case 'result':\n * console.log('User action:', message.result.action);\n * break;\n * case 'error':\n * console.error('Error:', message.error);\n * break;\n * }\n * }\n * ```\n *\n * @param params - The elicitation request parameters\n * @param options - Optional request options (timeout, signal, task creation params, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n elicitInputStream(params, options) {\n // Access client capabilities via the server\n const clientCapabilities = this._server.getClientCapabilities();\n const mode = params.mode ?? 'form';\n // Capability check based on mode\n switch (mode) {\n case 'url': {\n if (!clientCapabilities?.elicitation?.url) {\n throw new Error('Client does not support url elicitation.');\n }\n break;\n }\n case 'form': {\n if (!clientCapabilities?.elicitation?.form) {\n throw new Error('Client does not support form elicitation.');\n }\n break;\n }\n }\n // Normalize params to ensure mode is set for form mode (defaults to 'form' per spec)\n const normalizedParams = mode === 'form' && params.mode === undefined ? { ...params, mode: 'form' } : params;\n // Cast to ServerRequest needed because TypeScript can't narrow the union type\n // based on the discriminated 'method' field when constructing the object literal\n return this.requestStream({\n method: 'elicitation/create',\n params: normalizedParams\n }, ElicitResultSchema, options);\n }\n /**\n * Gets the current status of a task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n * @returns The task status\n *\n * @experimental\n */\n async getTask(taskId, options) {\n return this._server.getTask({ taskId }, options);\n }\n /**\n * Retrieves the result of a completed task.\n *\n * @param taskId - The task identifier\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options\n * @returns The task result\n *\n * @experimental\n */\n async getTaskResult(taskId, resultSchema, options) {\n return this._server.getTaskResult({ taskId }, resultSchema, options);\n }\n /**\n * Lists tasks with optional pagination.\n *\n * @param cursor - Optional pagination cursor\n * @param options - Optional request options\n * @returns List of tasks with optional next cursor\n *\n * @experimental\n */\n async listTasks(cursor, options) {\n return this._server.listTasks(cursor ? { cursor } : undefined, options);\n }\n /**\n * Cancels a running task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n *\n * @experimental\n */\n async cancelTask(taskId, options) {\n return this._server.cancelTask({ taskId }, options);\n }\n}\n//# sourceMappingURL=server.js.map","/**\n * Experimental task capability assertion helpers.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Asserts that task creation is supported for tools/call.\n * Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability.\n *\n * @param requests - The task requests capability object\n * @param method - The method being checked\n * @param entityName - 'Server' or 'Client' for error messages\n * @throws Error if the capability is not supported\n *\n * @experimental\n */\nexport function assertToolsCallTaskCapability(requests, method, entityName) {\n if (!requests) {\n throw new Error(`${entityName} does not support task creation (required for ${method})`);\n }\n switch (method) {\n case 'tools/call':\n if (!requests.tools?.call) {\n throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);\n }\n break;\n default:\n // Method doesn't support tasks, which is fine - no error\n break;\n }\n}\n/**\n * Asserts that task creation is supported for sampling/createMessage or elicitation/create.\n * Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability.\n *\n * @param requests - The task requests capability object\n * @param method - The method being checked\n * @param entityName - 'Server' or 'Client' for error messages\n * @throws Error if the capability is not supported\n *\n * @experimental\n */\nexport function assertClientRequestTaskCapability(requests, method, entityName) {\n if (!requests) {\n throw new Error(`${entityName} does not support task creation (required for ${method})`);\n }\n switch (method) {\n case 'sampling/createMessage':\n if (!requests.sampling?.createMessage) {\n throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);\n }\n break;\n case 'elicitation/create':\n if (!requests.elicitation?.create) {\n throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);\n }\n break;\n default:\n // Method doesn't support tasks, which is fine - no error\n break;\n }\n}\n//# sourceMappingURL=helpers.js.map","import { mergeCapabilities, Protocol } from '../shared/protocol.js';\nimport { CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitResultSchema, EmptyResultSchema, ErrorCode, InitializedNotificationSchema, InitializeRequestSchema, LATEST_PROTOCOL_VERSION, ListRootsResultSchema, LoggingLevelSchema, McpError, SetLevelRequestSchema, SUPPORTED_PROTOCOL_VERSIONS, CallToolRequestSchema, CallToolResultSchema, CreateTaskResultSchema } from '../types.js';\nimport { AjvJsonSchemaValidator } from '../validation/ajv-provider.js';\nimport { getObjectShape, isZ4Schema, safeParse } from './zod-compat.js';\nimport { ExperimentalServerTasks } from '../experimental/tasks/server.js';\nimport { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js';\n/**\n * An MCP server on top of a pluggable transport.\n *\n * This server will automatically respond to the initialization flow as initiated from the client.\n *\n * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:\n *\n * ```typescript\n * // Custom schemas\n * const CustomRequestSchema = RequestSchema.extend({...})\n * const CustomNotificationSchema = NotificationSchema.extend({...})\n * const CustomResultSchema = ResultSchema.extend({...})\n *\n * // Type aliases\n * type CustomRequest = z.infer<typeof CustomRequestSchema>\n * type CustomNotification = z.infer<typeof CustomNotificationSchema>\n * type CustomResult = z.infer<typeof CustomResultSchema>\n *\n * // Create typed server\n * const server = new Server<CustomRequest, CustomNotification, CustomResult>({\n * name: \"CustomServer\",\n * version: \"1.0.0\"\n * })\n * ```\n * @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases.\n */\nexport class Server extends Protocol {\n /**\n * Initializes this server with the given name and version information.\n */\n constructor(_serverInfo, options) {\n super(options);\n this._serverInfo = _serverInfo;\n // Map log levels by session id\n this._loggingLevels = new Map();\n // Map LogLevelSchema to severity index\n this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));\n // Is a message with the given level ignored in the log level set for the given session id?\n this.isMessageIgnored = (level, sessionId) => {\n const currentLevel = this._loggingLevels.get(sessionId);\n return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;\n };\n this._capabilities = options?.capabilities ?? {};\n this._instructions = options?.instructions;\n this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();\n this.setRequestHandler(InitializeRequestSchema, request => this._oninitialize(request));\n this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());\n if (this._capabilities.logging) {\n this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {\n const transportSessionId = extra.sessionId || extra.requestInfo?.headers['mcp-session-id'] || undefined;\n const { level } = request.params;\n const parseResult = LoggingLevelSchema.safeParse(level);\n if (parseResult.success) {\n this._loggingLevels.set(transportSessionId, parseResult.data);\n }\n return {};\n });\n }\n }\n /**\n * Access experimental features.\n *\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n get experimental() {\n if (!this._experimental) {\n this._experimental = {\n tasks: new ExperimentalServerTasks(this)\n };\n }\n return this._experimental;\n }\n /**\n * Registers new capabilities. This can only be called before connecting to a transport.\n *\n * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).\n */\n registerCapabilities(capabilities) {\n if (this.transport) {\n throw new Error('Cannot register capabilities after connecting to transport');\n }\n this._capabilities = mergeCapabilities(this._capabilities, capabilities);\n }\n /**\n * Override request handler registration to enforce server-side validation for tools/call.\n */\n setRequestHandler(requestSchema, handler) {\n const shape = getObjectShape(requestSchema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n // Extract literal value using type-safe property access\n let methodValue;\n if (isZ4Schema(methodSchema)) {\n const v4Schema = methodSchema;\n const v4Def = v4Schema._zod?.def;\n methodValue = v4Def?.value ?? v4Schema.value;\n }\n else {\n const v3Schema = methodSchema;\n const legacyDef = v3Schema._def;\n methodValue = legacyDef?.value ?? v3Schema.value;\n }\n if (typeof methodValue !== 'string') {\n throw new Error('Schema method literal must be a string');\n }\n const method = methodValue;\n if (method === 'tools/call') {\n const wrappedHandler = async (request, extra) => {\n const validatedRequest = safeParse(CallToolRequestSchema, request);\n if (!validatedRequest.success) {\n const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);\n }\n const { params } = validatedRequest.data;\n const result = await Promise.resolve(handler(request, extra));\n // When task creation is requested, validate and return CreateTaskResult\n if (params.task) {\n const taskValidationResult = safeParse(CreateTaskResultSchema, result);\n if (!taskValidationResult.success) {\n const errorMessage = taskValidationResult.error instanceof Error\n ? taskValidationResult.error.message\n : String(taskValidationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);\n }\n return taskValidationResult.data;\n }\n // For non-task requests, validate against CallToolResultSchema\n const validationResult = safeParse(CallToolResultSchema, result);\n if (!validationResult.success) {\n const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);\n }\n return validationResult.data;\n };\n // Install the wrapped handler\n return super.setRequestHandler(requestSchema, wrappedHandler);\n }\n // Other handlers use default behavior\n return super.setRequestHandler(requestSchema, handler);\n }\n assertCapabilityForMethod(method) {\n switch (method) {\n case 'sampling/createMessage':\n if (!this._clientCapabilities?.sampling) {\n throw new Error(`Client does not support sampling (required for ${method})`);\n }\n break;\n case 'elicitation/create':\n if (!this._clientCapabilities?.elicitation) {\n throw new Error(`Client does not support elicitation (required for ${method})`);\n }\n break;\n case 'roots/list':\n if (!this._clientCapabilities?.roots) {\n throw new Error(`Client does not support listing roots (required for ${method})`);\n }\n break;\n case 'ping':\n // No specific capability required for ping\n break;\n }\n }\n assertNotificationCapability(method) {\n switch (method) {\n case 'notifications/message':\n if (!this._capabilities.logging) {\n throw new Error(`Server does not support logging (required for ${method})`);\n }\n break;\n case 'notifications/resources/updated':\n case 'notifications/resources/list_changed':\n if (!this._capabilities.resources) {\n throw new Error(`Server does not support notifying about resources (required for ${method})`);\n }\n break;\n case 'notifications/tools/list_changed':\n if (!this._capabilities.tools) {\n throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);\n }\n break;\n case 'notifications/prompts/list_changed':\n if (!this._capabilities.prompts) {\n throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);\n }\n break;\n case 'notifications/elicitation/complete':\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error(`Client does not support URL elicitation (required for ${method})`);\n }\n break;\n case 'notifications/cancelled':\n // Cancellation notifications are always allowed\n break;\n case 'notifications/progress':\n // Progress notifications are always allowed\n break;\n }\n }\n assertRequestHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n switch (method) {\n case 'completion/complete':\n if (!this._capabilities.completions) {\n throw new Error(`Server does not support completions (required for ${method})`);\n }\n break;\n case 'logging/setLevel':\n if (!this._capabilities.logging) {\n throw new Error(`Server does not support logging (required for ${method})`);\n }\n break;\n case 'prompts/get':\n case 'prompts/list':\n if (!this._capabilities.prompts) {\n throw new Error(`Server does not support prompts (required for ${method})`);\n }\n break;\n case 'resources/list':\n case 'resources/templates/list':\n case 'resources/read':\n if (!this._capabilities.resources) {\n throw new Error(`Server does not support resources (required for ${method})`);\n }\n break;\n case 'tools/call':\n case 'tools/list':\n if (!this._capabilities.tools) {\n throw new Error(`Server does not support tools (required for ${method})`);\n }\n break;\n case 'tasks/get':\n case 'tasks/list':\n case 'tasks/result':\n case 'tasks/cancel':\n if (!this._capabilities.tasks) {\n throw new Error(`Server does not support tasks capability (required for ${method})`);\n }\n break;\n case 'ping':\n case 'initialize':\n // No specific capability required for these methods\n break;\n }\n }\n assertTaskCapability(method) {\n assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, 'Client');\n }\n assertTaskHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, 'Server');\n }\n async _oninitialize(request) {\n const requestedVersion = request.params.protocolVersion;\n this._clientCapabilities = request.params.capabilities;\n this._clientVersion = request.params.clientInfo;\n const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;\n return {\n protocolVersion,\n capabilities: this.getCapabilities(),\n serverInfo: this._serverInfo,\n ...(this._instructions && { instructions: this._instructions })\n };\n }\n /**\n * After initialization has completed, this will be populated with the client's reported capabilities.\n */\n getClientCapabilities() {\n return this._clientCapabilities;\n }\n /**\n * After initialization has completed, this will be populated with information about the client's name and version.\n */\n getClientVersion() {\n return this._clientVersion;\n }\n getCapabilities() {\n return this._capabilities;\n }\n async ping() {\n return this.request({ method: 'ping' }, EmptyResultSchema);\n }\n // Implementation\n async createMessage(params, options) {\n // Capability check - only required when tools/toolChoice are provided\n if (params.tools || params.toolChoice) {\n if (!this._clientCapabilities?.sampling?.tools) {\n throw new Error('Client does not support sampling tools capability.');\n }\n }\n // Message structure validation - always validate tool_use/tool_result pairs.\n // These may appear even without tools/toolChoice in the current request when\n // a previous sampling request returned tool_use and this is a follow-up with results.\n if (params.messages.length > 0) {\n const lastMessage = params.messages[params.messages.length - 1];\n const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];\n const hasToolResults = lastContent.some(c => c.type === 'tool_result');\n const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;\n const previousContent = previousMessage\n ? Array.isArray(previousMessage.content)\n ? previousMessage.content\n : [previousMessage.content]\n : [];\n const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');\n if (hasToolResults) {\n if (lastContent.some(c => c.type !== 'tool_result')) {\n throw new Error('The last message must contain only tool_result content if any is present');\n }\n if (!hasPreviousToolUse) {\n throw new Error('tool_result blocks are not matching any tool_use from the previous message');\n }\n }\n if (hasPreviousToolUse) {\n const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));\n const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));\n if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {\n throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');\n }\n }\n }\n // Use different schemas based on whether tools are provided\n if (params.tools) {\n return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultWithToolsSchema, options);\n }\n return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultSchema, options);\n }\n /**\n * Creates an elicitation request for the given parameters.\n * For backwards compatibility, `mode` may be omitted for form requests and will default to `'form'`.\n * @param params The parameters for the elicitation request.\n * @param options Optional request options.\n * @returns The result of the elicitation request.\n */\n async elicitInput(params, options) {\n const mode = (params.mode ?? 'form');\n switch (mode) {\n case 'url': {\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error('Client does not support url elicitation.');\n }\n const urlParams = params;\n return this.request({ method: 'elicitation/create', params: urlParams }, ElicitResultSchema, options);\n }\n case 'form': {\n if (!this._clientCapabilities?.elicitation?.form) {\n throw new Error('Client does not support form elicitation.');\n }\n const formParams = params.mode === 'form' ? params : { ...params, mode: 'form' };\n const result = await this.request({ method: 'elicitation/create', params: formParams }, ElicitResultSchema, options);\n if (result.action === 'accept' && result.content && formParams.requestedSchema) {\n try {\n const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);\n const validationResult = validator(result.content);\n if (!validationResult.valid) {\n throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);\n }\n }\n catch (error) {\n if (error instanceof McpError) {\n throw error;\n }\n throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n return result;\n }\n }\n }\n /**\n * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete`\n * notification for the specified elicitation ID.\n *\n * @param elicitationId The ID of the elicitation to mark as complete.\n * @param options Optional notification options. Useful when the completion notification should be related to a prior request.\n * @returns A function that emits the completion notification when awaited.\n */\n createElicitationCompletionNotifier(elicitationId, options) {\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error('Client does not support URL elicitation (required for notifications/elicitation/complete)');\n }\n return () => this.notification({\n method: 'notifications/elicitation/complete',\n params: {\n elicitationId\n }\n }, options);\n }\n async listRoots(params, options) {\n return this.request({ method: 'roots/list', params }, ListRootsResultSchema, options);\n }\n /**\n * Sends a logging message to the client, if connected.\n * Note: You only need to send the parameters object, not the entire JSON RPC message\n * @see LoggingMessageNotification\n * @param params\n * @param sessionId optional for stateless and backward compatibility\n */\n async sendLoggingMessage(params, sessionId) {\n if (this._capabilities.logging) {\n if (!this.isMessageIgnored(params.level, sessionId)) {\n return this.notification({ method: 'notifications/message', params });\n }\n }\n }\n async sendResourceUpdated(params) {\n return this.notification({\n method: 'notifications/resources/updated',\n params\n });\n }\n async sendResourceListChanged() {\n return this.notification({\n method: 'notifications/resources/list_changed'\n });\n }\n async sendToolListChanged() {\n return this.notification({ method: 'notifications/tools/list_changed' });\n }\n async sendPromptListChanged() {\n return this.notification({ method: 'notifications/prompts/list_changed' });\n }\n}\n//# sourceMappingURL=index.js.map","export const COMPLETABLE_SYMBOL = Symbol.for('mcp.completable');\n/**\n * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP.\n * Works with both Zod v3 and v4 schemas.\n */\nexport function completable(schema, complete) {\n Object.defineProperty(schema, COMPLETABLE_SYMBOL, {\n value: { complete },\n enumerable: false,\n writable: false,\n configurable: false\n });\n return schema;\n}\n/**\n * Checks if a schema is completable (has completion metadata).\n */\nexport function isCompletable(schema) {\n return !!schema && typeof schema === 'object' && COMPLETABLE_SYMBOL in schema;\n}\n/**\n * Gets the completer callback from a completable schema, if it exists.\n */\nexport function getCompleter(schema) {\n const meta = schema[COMPLETABLE_SYMBOL];\n return meta?.complete;\n}\n/**\n * Unwraps a completable schema to get the underlying schema.\n * For backward compatibility with code that called `.unwrap()`.\n */\nexport function unwrapCompletable(schema) {\n return schema;\n}\n// Legacy exports for backward compatibility\n// These types are deprecated but kept for existing code\nexport var McpZodTypeKind;\n(function (McpZodTypeKind) {\n McpZodTypeKind[\"Completable\"] = \"McpCompletable\";\n})(McpZodTypeKind || (McpZodTypeKind = {}));\n//# sourceMappingURL=completable.js.map","/**\n * Tool name validation utilities according to SEP: Specify Format for Tool Names\n *\n * Tool names SHOULD be between 1 and 128 characters in length (inclusive).\n * Tool names are case-sensitive.\n * Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits\n * (0-9), underscore (_), dash (-), and dot (.).\n * Tool names SHOULD NOT contain spaces, commas, or other special characters.\n */\n/**\n * Regular expression for valid tool names according to SEP-986 specification\n */\nconst TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;\n/**\n * Validates a tool name according to the SEP specification\n * @param name - The tool name to validate\n * @returns An object containing validation result and any warnings\n */\nexport function validateToolName(name) {\n const warnings = [];\n // Check length\n if (name.length === 0) {\n return {\n isValid: false,\n warnings: ['Tool name cannot be empty']\n };\n }\n if (name.length > 128) {\n return {\n isValid: false,\n warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]\n };\n }\n // Check for specific problematic patterns (these are warnings, not validation failures)\n if (name.includes(' ')) {\n warnings.push('Tool name contains spaces, which may cause parsing issues');\n }\n if (name.includes(',')) {\n warnings.push('Tool name contains commas, which may cause parsing issues');\n }\n // Check for potentially confusing patterns (leading/trailing dashes, dots, slashes)\n if (name.startsWith('-') || name.endsWith('-')) {\n warnings.push('Tool name starts or ends with a dash, which may cause parsing issues in some contexts');\n }\n if (name.startsWith('.') || name.endsWith('.')) {\n warnings.push('Tool name starts or ends with a dot, which may cause parsing issues in some contexts');\n }\n // Check for invalid characters\n if (!TOOL_NAME_REGEX.test(name)) {\n const invalidChars = name\n .split('')\n .filter(char => !/[A-Za-z0-9._-]/.test(char))\n .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates\n warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `\"${c}\"`).join(', ')}`, 'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)');\n return {\n isValid: false,\n warnings\n };\n }\n return {\n isValid: true,\n warnings\n };\n}\n/**\n * Issues warnings for non-conforming tool names\n * @param name - The tool name that triggered the warnings\n * @param warnings - Array of warning messages\n */\nexport function issueToolNameWarning(name, warnings) {\n if (warnings.length > 0) {\n console.warn(`Tool name validation warning for \"${name}\":`);\n for (const warning of warnings) {\n console.warn(` - ${warning}`);\n }\n console.warn('Tool registration will proceed, but this may cause compatibility issues.');\n console.warn('Consider updating the tool name to conform to the MCP tool naming standard.');\n console.warn('See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.');\n }\n}\n/**\n * Validates a tool name and issues warnings for non-conforming names\n * @param name - The tool name to validate\n * @returns true if the name is valid, false otherwise\n */\nexport function validateAndWarnToolName(name) {\n const result = validateToolName(name);\n // Always issue warnings for any validation issues (both invalid names and warnings)\n issueToolNameWarning(name, result.warnings);\n return result.isValid;\n}\n//# sourceMappingURL=toolNameValidation.js.map","/**\n * Experimental McpServer task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Experimental task features for McpServer.\n *\n * Access via `server.experimental.tasks`:\n * ```typescript\n * server.experimental.tasks.registerToolTask('long-running', config, handler);\n * ```\n *\n * @experimental\n */\nexport class ExperimentalMcpServerTasks {\n constructor(_mcpServer) {\n this._mcpServer = _mcpServer;\n }\n registerToolTask(name, config, handler) {\n // Validate that taskSupport is not 'forbidden' for task-based tools\n const execution = { taskSupport: 'required', ...config.execution };\n if (execution.taskSupport === 'forbidden') {\n throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);\n }\n // Access McpServer's internal _createRegisteredTool method\n const mcpServerInternal = this._mcpServer;\n return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler);\n }\n}\n//# sourceMappingURL=mcp-server.js.map","import { Server } from './index.js';\nimport { normalizeObjectSchema, safeParseAsync, getObjectShape, objectFromShape, getParseErrorMessage, getSchemaDescription, isSchemaOptional, getLiteralValue } from './zod-compat.js';\nimport { toJsonSchemaCompat } from './zod-json-schema-compat.js';\nimport { McpError, ErrorCode, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CompleteRequestSchema, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate } from '../types.js';\nimport { isCompletable, getCompleter } from './completable.js';\nimport { UriTemplate } from '../shared/uriTemplate.js';\nimport { validateAndWarnToolName } from '../shared/toolNameValidation.js';\nimport { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js';\nimport { ZodOptional } from 'zod';\n/**\n * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.\n * For advanced usage (like sending notifications or setting custom request handlers), use the underlying\n * Server instance available via the `server` property.\n */\nexport class McpServer {\n constructor(serverInfo, options) {\n this._registeredResources = {};\n this._registeredResourceTemplates = {};\n this._registeredTools = {};\n this._registeredPrompts = {};\n this._toolHandlersInitialized = false;\n this._completionHandlerInitialized = false;\n this._resourceHandlersInitialized = false;\n this._promptHandlersInitialized = false;\n this.server = new Server(serverInfo, options);\n }\n /**\n * Access experimental features.\n *\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n get experimental() {\n if (!this._experimental) {\n this._experimental = {\n tasks: new ExperimentalMcpServerTasks(this)\n };\n }\n return this._experimental;\n }\n /**\n * Attaches to the given transport, starts it, and starts listening for messages.\n *\n * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n */\n async connect(transport) {\n return await this.server.connect(transport);\n }\n /**\n * Closes the connection.\n */\n async close() {\n await this.server.close();\n }\n setToolRequestHandlers() {\n if (this._toolHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema));\n this.server.registerCapabilities({\n tools: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: Object.entries(this._registeredTools)\n .filter(([, tool]) => tool.enabled)\n .map(([name, tool]) => {\n const toolDefinition = {\n name,\n title: tool.title,\n description: tool.description,\n inputSchema: (() => {\n const obj = normalizeObjectSchema(tool.inputSchema);\n return obj\n ? toJsonSchemaCompat(obj, {\n strictUnions: true,\n pipeStrategy: 'input'\n })\n : EMPTY_OBJECT_JSON_SCHEMA;\n })(),\n annotations: tool.annotations,\n execution: tool.execution,\n _meta: tool._meta\n };\n if (tool.outputSchema) {\n const obj = normalizeObjectSchema(tool.outputSchema);\n if (obj) {\n toolDefinition.outputSchema = toJsonSchemaCompat(obj, {\n strictUnions: true,\n pipeStrategy: 'output'\n });\n }\n }\n return toolDefinition;\n })\n }));\n this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n try {\n const tool = this._registeredTools[request.params.name];\n if (!tool) {\n throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);\n }\n if (!tool.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);\n }\n const isTaskRequest = !!request.params.task;\n const taskSupport = tool.execution?.taskSupport;\n const isTaskHandler = 'createTask' in tool.handler;\n // Validate task hint configuration\n if ((taskSupport === 'required' || taskSupport === 'optional') && !isTaskHandler) {\n throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`);\n }\n // Handle taskSupport 'required' without task augmentation\n if (taskSupport === 'required' && !isTaskRequest) {\n throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`);\n }\n // Handle taskSupport 'optional' without task augmentation - automatic polling\n if (taskSupport === 'optional' && !isTaskRequest && isTaskHandler) {\n return await this.handleAutomaticTaskPolling(tool, request, extra);\n }\n // Normal execution path\n const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n const result = await this.executeToolHandler(tool, args, extra);\n // Return CreateTaskResult immediately for task requests\n if (isTaskRequest) {\n return result;\n }\n // Validate output schema for non-task requests\n await this.validateToolOutput(tool, result, request.params.name);\n return result;\n }\n catch (error) {\n if (error instanceof McpError) {\n if (error.code === ErrorCode.UrlElicitationRequired) {\n throw error; // Return the error to the caller without wrapping in CallToolResult\n }\n }\n return this.createToolError(error instanceof Error ? error.message : String(error));\n }\n });\n this._toolHandlersInitialized = true;\n }\n /**\n * Creates a tool error result.\n *\n * @param errorMessage - The error message.\n * @returns The tool error result.\n */\n createToolError(errorMessage) {\n return {\n content: [\n {\n type: 'text',\n text: errorMessage\n }\n ],\n isError: true\n };\n }\n /**\n * Validates tool input arguments against the tool's input schema.\n */\n async validateToolInput(tool, args, toolName) {\n if (!tool.inputSchema) {\n return undefined;\n }\n // Try to normalize to object schema first (for raw shapes and object schemas)\n // If that fails, use the schema directly (for union/intersection/etc)\n const inputObj = normalizeObjectSchema(tool.inputSchema);\n const schemaToParse = inputObj ?? tool.inputSchema;\n const parseResult = await safeParseAsync(schemaToParse, args);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);\n }\n return parseResult.data;\n }\n /**\n * Validates tool output against the tool's output schema.\n */\n async validateToolOutput(tool, result, toolName) {\n if (!tool.outputSchema) {\n return;\n }\n // Only validate CallToolResult, not CreateTaskResult\n if (!('content' in result)) {\n return;\n }\n if (result.isError) {\n return;\n }\n if (!result.structuredContent) {\n throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`);\n }\n // if the tool has an output schema, validate structured content\n const outputObj = normalizeObjectSchema(tool.outputSchema);\n const parseResult = await safeParseAsync(outputObj, result.structuredContent);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);\n }\n }\n /**\n * Executes a tool handler (either regular or task-based).\n */\n async executeToolHandler(tool, args, extra) {\n const handler = tool.handler;\n const isTaskHandler = 'createTask' in handler;\n if (isTaskHandler) {\n if (!extra.taskStore) {\n throw new Error('No task store provided.');\n }\n const taskExtra = { ...extra, taskStore: extra.taskStore };\n if (tool.inputSchema) {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler.createTask(args, taskExtra));\n }\n else {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler.createTask(taskExtra));\n }\n }\n if (tool.inputSchema) {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler(args, extra));\n }\n else {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler(extra));\n }\n }\n /**\n * Handles automatic task polling for tools with taskSupport 'optional'.\n */\n async handleAutomaticTaskPolling(tool, request, extra) {\n if (!extra.taskStore) {\n throw new Error('No task store provided for task-capable tool.');\n }\n // Validate input and create task\n const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n const handler = tool.handler;\n const taskExtra = { ...extra, taskStore: extra.taskStore };\n const createTaskResult = args // undefined only if tool.inputSchema is undefined\n ? await Promise.resolve(handler.createTask(args, taskExtra))\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await Promise.resolve(handler.createTask(taskExtra));\n // Poll until completion\n const taskId = createTaskResult.task.taskId;\n let task = createTaskResult.task;\n const pollInterval = task.pollInterval ?? 5000;\n while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n const updatedTask = await extra.taskStore.getTask(taskId);\n if (!updatedTask) {\n throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);\n }\n task = updatedTask;\n }\n // Return the final result\n return (await extra.taskStore.getTaskResult(taskId));\n }\n setCompletionRequestHandler() {\n if (this._completionHandlerInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(CompleteRequestSchema));\n this.server.registerCapabilities({\n completions: {}\n });\n this.server.setRequestHandler(CompleteRequestSchema, async (request) => {\n switch (request.params.ref.type) {\n case 'ref/prompt':\n assertCompleteRequestPrompt(request);\n return this.handlePromptCompletion(request, request.params.ref);\n case 'ref/resource':\n assertCompleteRequestResourceTemplate(request);\n return this.handleResourceCompletion(request, request.params.ref);\n default:\n throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`);\n }\n });\n this._completionHandlerInitialized = true;\n }\n async handlePromptCompletion(request, ref) {\n const prompt = this._registeredPrompts[ref.name];\n if (!prompt) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);\n }\n if (!prompt.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);\n }\n if (!prompt.argsSchema) {\n return EMPTY_COMPLETION_RESULT;\n }\n const promptShape = getObjectShape(prompt.argsSchema);\n const field = promptShape?.[request.params.argument.name];\n if (!isCompletable(field)) {\n return EMPTY_COMPLETION_RESULT;\n }\n const completer = getCompleter(field);\n if (!completer) {\n return EMPTY_COMPLETION_RESULT;\n }\n const suggestions = await completer(request.params.argument.value, request.params.context);\n return createCompletionResult(suggestions);\n }\n async handleResourceCompletion(request, ref) {\n const template = Object.values(this._registeredResourceTemplates).find(t => t.resourceTemplate.uriTemplate.toString() === ref.uri);\n if (!template) {\n if (this._registeredResources[ref.uri]) {\n // Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be).\n return EMPTY_COMPLETION_RESULT;\n }\n throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`);\n }\n const completer = template.resourceTemplate.completeCallback(request.params.argument.name);\n if (!completer) {\n return EMPTY_COMPLETION_RESULT;\n }\n const suggestions = await completer(request.params.argument.value, request.params.context);\n return createCompletionResult(suggestions);\n }\n setResourceRequestHandlers() {\n if (this._resourceHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListResourcesRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(ListResourceTemplatesRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(ReadResourceRequestSchema));\n this.server.registerCapabilities({\n resources: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {\n const resources = Object.entries(this._registeredResources)\n .filter(([_, resource]) => resource.enabled)\n .map(([uri, resource]) => ({\n uri,\n name: resource.name,\n ...resource.metadata\n }));\n const templateResources = [];\n for (const template of Object.values(this._registeredResourceTemplates)) {\n if (!template.resourceTemplate.listCallback) {\n continue;\n }\n const result = await template.resourceTemplate.listCallback(extra);\n for (const resource of result.resources) {\n templateResources.push({\n ...template.metadata,\n // the defined resource metadata should override the template metadata if present\n ...resource\n });\n }\n }\n return { resources: [...resources, ...templateResources] };\n });\n this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {\n const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({\n name,\n uriTemplate: template.resourceTemplate.uriTemplate.toString(),\n ...template.metadata\n }));\n return { resourceTemplates };\n });\n this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {\n const uri = new URL(request.params.uri);\n // First check for exact resource match\n const resource = this._registeredResources[uri.toString()];\n if (resource) {\n if (!resource.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);\n }\n return resource.readCallback(uri, extra);\n }\n // Then check templates\n for (const template of Object.values(this._registeredResourceTemplates)) {\n const variables = template.resourceTemplate.uriTemplate.match(uri.toString());\n if (variables) {\n return template.readCallback(uri, variables, extra);\n }\n }\n throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`);\n });\n this._resourceHandlersInitialized = true;\n }\n setPromptRequestHandlers() {\n if (this._promptHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema));\n this.server.registerCapabilities({\n prompts: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListPromptsRequestSchema, () => ({\n prompts: Object.entries(this._registeredPrompts)\n .filter(([, prompt]) => prompt.enabled)\n .map(([name, prompt]) => {\n return {\n name,\n title: prompt.title,\n description: prompt.description,\n arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined\n };\n })\n }));\n this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => {\n const prompt = this._registeredPrompts[request.params.name];\n if (!prompt) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);\n }\n if (!prompt.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);\n }\n if (prompt.argsSchema) {\n const argsObj = normalizeObjectSchema(prompt.argsSchema);\n const parseResult = await safeParseAsync(argsObj, request.params.arguments);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);\n }\n const args = parseResult.data;\n const cb = prompt.callback;\n return await Promise.resolve(cb(args, extra));\n }\n else {\n const cb = prompt.callback;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(cb(extra));\n }\n });\n this._promptHandlersInitialized = true;\n }\n resource(name, uriOrTemplate, ...rest) {\n let metadata;\n if (typeof rest[0] === 'object') {\n metadata = rest.shift();\n }\n const readCallback = rest[0];\n if (typeof uriOrTemplate === 'string') {\n if (this._registeredResources[uriOrTemplate]) {\n throw new Error(`Resource ${uriOrTemplate} is already registered`);\n }\n const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResource;\n }\n else {\n if (this._registeredResourceTemplates[name]) {\n throw new Error(`Resource template ${name} is already registered`);\n }\n const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResourceTemplate;\n }\n }\n registerResource(name, uriOrTemplate, config, readCallback) {\n if (typeof uriOrTemplate === 'string') {\n if (this._registeredResources[uriOrTemplate]) {\n throw new Error(`Resource ${uriOrTemplate} is already registered`);\n }\n const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResource;\n }\n else {\n if (this._registeredResourceTemplates[name]) {\n throw new Error(`Resource template ${name} is already registered`);\n }\n const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResourceTemplate;\n }\n }\n _createRegisteredResource(name, title, uri, metadata, readCallback) {\n const registeredResource = {\n name,\n title,\n metadata,\n readCallback,\n enabled: true,\n disable: () => registeredResource.update({ enabled: false }),\n enable: () => registeredResource.update({ enabled: true }),\n remove: () => registeredResource.update({ uri: null }),\n update: updates => {\n if (typeof updates.uri !== 'undefined' && updates.uri !== uri) {\n delete this._registeredResources[uri];\n if (updates.uri)\n this._registeredResources[updates.uri] = registeredResource;\n }\n if (typeof updates.name !== 'undefined')\n registeredResource.name = updates.name;\n if (typeof updates.title !== 'undefined')\n registeredResource.title = updates.title;\n if (typeof updates.metadata !== 'undefined')\n registeredResource.metadata = updates.metadata;\n if (typeof updates.callback !== 'undefined')\n registeredResource.readCallback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredResource.enabled = updates.enabled;\n this.sendResourceListChanged();\n }\n };\n this._registeredResources[uri] = registeredResource;\n return registeredResource;\n }\n _createRegisteredResourceTemplate(name, title, template, metadata, readCallback) {\n const registeredResourceTemplate = {\n resourceTemplate: template,\n title,\n metadata,\n readCallback,\n enabled: true,\n disable: () => registeredResourceTemplate.update({ enabled: false }),\n enable: () => registeredResourceTemplate.update({ enabled: true }),\n remove: () => registeredResourceTemplate.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n delete this._registeredResourceTemplates[name];\n if (updates.name)\n this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;\n }\n if (typeof updates.title !== 'undefined')\n registeredResourceTemplate.title = updates.title;\n if (typeof updates.template !== 'undefined')\n registeredResourceTemplate.resourceTemplate = updates.template;\n if (typeof updates.metadata !== 'undefined')\n registeredResourceTemplate.metadata = updates.metadata;\n if (typeof updates.callback !== 'undefined')\n registeredResourceTemplate.readCallback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredResourceTemplate.enabled = updates.enabled;\n this.sendResourceListChanged();\n }\n };\n this._registeredResourceTemplates[name] = registeredResourceTemplate;\n // If the resource template has any completion callbacks, enable completions capability\n const variableNames = template.uriTemplate.variableNames;\n const hasCompleter = Array.isArray(variableNames) && variableNames.some(v => !!template.completeCallback(v));\n if (hasCompleter) {\n this.setCompletionRequestHandler();\n }\n return registeredResourceTemplate;\n }\n _createRegisteredPrompt(name, title, description, argsSchema, callback) {\n const registeredPrompt = {\n title,\n description,\n argsSchema: argsSchema === undefined ? undefined : objectFromShape(argsSchema),\n callback,\n enabled: true,\n disable: () => registeredPrompt.update({ enabled: false }),\n enable: () => registeredPrompt.update({ enabled: true }),\n remove: () => registeredPrompt.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n delete this._registeredPrompts[name];\n if (updates.name)\n this._registeredPrompts[updates.name] = registeredPrompt;\n }\n if (typeof updates.title !== 'undefined')\n registeredPrompt.title = updates.title;\n if (typeof updates.description !== 'undefined')\n registeredPrompt.description = updates.description;\n if (typeof updates.argsSchema !== 'undefined')\n registeredPrompt.argsSchema = objectFromShape(updates.argsSchema);\n if (typeof updates.callback !== 'undefined')\n registeredPrompt.callback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredPrompt.enabled = updates.enabled;\n this.sendPromptListChanged();\n }\n };\n this._registeredPrompts[name] = registeredPrompt;\n // If any argument uses a Completable schema, enable completions capability\n if (argsSchema) {\n const hasCompletable = Object.values(argsSchema).some(field => {\n const inner = field instanceof ZodOptional ? field._def?.innerType : field;\n return isCompletable(inner);\n });\n if (hasCompletable) {\n this.setCompletionRequestHandler();\n }\n }\n return registeredPrompt;\n }\n _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {\n // Validate tool name according to SEP specification\n validateAndWarnToolName(name);\n const registeredTool = {\n title,\n description,\n inputSchema: getZodSchemaObject(inputSchema),\n outputSchema: getZodSchemaObject(outputSchema),\n annotations,\n execution,\n _meta,\n handler: handler,\n enabled: true,\n disable: () => registeredTool.update({ enabled: false }),\n enable: () => registeredTool.update({ enabled: true }),\n remove: () => registeredTool.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n if (typeof updates.name === 'string') {\n validateAndWarnToolName(updates.name);\n }\n delete this._registeredTools[name];\n if (updates.name)\n this._registeredTools[updates.name] = registeredTool;\n }\n if (typeof updates.title !== 'undefined')\n registeredTool.title = updates.title;\n if (typeof updates.description !== 'undefined')\n registeredTool.description = updates.description;\n if (typeof updates.paramsSchema !== 'undefined')\n registeredTool.inputSchema = objectFromShape(updates.paramsSchema);\n if (typeof updates.outputSchema !== 'undefined')\n registeredTool.outputSchema = objectFromShape(updates.outputSchema);\n if (typeof updates.callback !== 'undefined')\n registeredTool.handler = updates.callback;\n if (typeof updates.annotations !== 'undefined')\n registeredTool.annotations = updates.annotations;\n if (typeof updates._meta !== 'undefined')\n registeredTool._meta = updates._meta;\n if (typeof updates.enabled !== 'undefined')\n registeredTool.enabled = updates.enabled;\n this.sendToolListChanged();\n }\n };\n this._registeredTools[name] = registeredTool;\n this.setToolRequestHandlers();\n this.sendToolListChanged();\n return registeredTool;\n }\n /**\n * tool() implementation. Parses arguments passed to overrides defined above.\n */\n tool(name, ...rest) {\n if (this._registeredTools[name]) {\n throw new Error(`Tool ${name} is already registered`);\n }\n let description;\n let inputSchema;\n let outputSchema;\n let annotations;\n // Tool properties are passed as separate arguments, with omissions allowed.\n // Support for this style is frozen as of protocol version 2025-03-26. Future additions\n // to tool definition should *NOT* be added.\n if (typeof rest[0] === 'string') {\n description = rest.shift();\n }\n // Handle the different overload combinations\n if (rest.length > 1) {\n // We have at least one more arg before the callback\n const firstArg = rest[0];\n if (isZodRawShapeCompat(firstArg)) {\n // We have a params schema as the first arg\n inputSchema = rest.shift();\n // Check if the next arg is potentially annotations\n if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null && !isZodRawShapeCompat(rest[0])) {\n // Case: tool(name, paramsSchema, annotations, cb)\n // Or: tool(name, description, paramsSchema, annotations, cb)\n annotations = rest.shift();\n }\n }\n else if (typeof firstArg === 'object' && firstArg !== null) {\n // Not a ZodRawShapeCompat, so must be annotations in this position\n // Case: tool(name, annotations, cb)\n // Or: tool(name, description, annotations, cb)\n annotations = rest.shift();\n }\n }\n const callback = rest[0];\n return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback);\n }\n /**\n * Registers a tool with a config object and callback.\n */\n registerTool(name, config, cb) {\n if (this._registeredTools[name]) {\n throw new Error(`Tool ${name} is already registered`);\n }\n const { title, description, inputSchema, outputSchema, annotations, _meta } = config;\n return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb);\n }\n prompt(name, ...rest) {\n if (this._registeredPrompts[name]) {\n throw new Error(`Prompt ${name} is already registered`);\n }\n let description;\n if (typeof rest[0] === 'string') {\n description = rest.shift();\n }\n let argsSchema;\n if (rest.length > 1) {\n argsSchema = rest.shift();\n }\n const cb = rest[0];\n const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb);\n this.setPromptRequestHandlers();\n this.sendPromptListChanged();\n return registeredPrompt;\n }\n /**\n * Registers a prompt with a config object and callback.\n */\n registerPrompt(name, config, cb) {\n if (this._registeredPrompts[name]) {\n throw new Error(`Prompt ${name} is already registered`);\n }\n const { title, description, argsSchema } = config;\n const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb);\n this.setPromptRequestHandlers();\n this.sendPromptListChanged();\n return registeredPrompt;\n }\n /**\n * Checks if the server is connected to a transport.\n * @returns True if the server is connected\n */\n isConnected() {\n return this.server.transport !== undefined;\n }\n /**\n * Sends a logging message to the client, if connected.\n * Note: You only need to send the parameters object, not the entire JSON RPC message\n * @see LoggingMessageNotification\n * @param params\n * @param sessionId optional for stateless and backward compatibility\n */\n async sendLoggingMessage(params, sessionId) {\n return this.server.sendLoggingMessage(params, sessionId);\n }\n /**\n * Sends a resource list changed event to the client, if connected.\n */\n sendResourceListChanged() {\n if (this.isConnected()) {\n this.server.sendResourceListChanged();\n }\n }\n /**\n * Sends a tool list changed event to the client, if connected.\n */\n sendToolListChanged() {\n if (this.isConnected()) {\n this.server.sendToolListChanged();\n }\n }\n /**\n * Sends a prompt list changed event to the client, if connected.\n */\n sendPromptListChanged() {\n if (this.isConnected()) {\n this.server.sendPromptListChanged();\n }\n }\n}\n/**\n * A resource template combines a URI pattern with optional functionality to enumerate\n * all resources matching that pattern.\n */\nexport class ResourceTemplate {\n constructor(uriTemplate, _callbacks) {\n this._callbacks = _callbacks;\n this._uriTemplate = typeof uriTemplate === 'string' ? new UriTemplate(uriTemplate) : uriTemplate;\n }\n /**\n * Gets the URI template pattern.\n */\n get uriTemplate() {\n return this._uriTemplate;\n }\n /**\n * Gets the list callback, if one was provided.\n */\n get listCallback() {\n return this._callbacks.list;\n }\n /**\n * Gets the callback for completing a specific URI template variable, if one was provided.\n */\n completeCallback(variable) {\n return this._callbacks.complete?.[variable];\n }\n}\nconst EMPTY_OBJECT_JSON_SCHEMA = {\n type: 'object',\n properties: {}\n};\n/**\n * Checks if a value looks like a Zod schema by checking for parse/safeParse methods.\n */\nfunction isZodTypeLike(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'parse' in value &&\n typeof value.parse === 'function' &&\n 'safeParse' in value &&\n typeof value.safeParse === 'function');\n}\n/**\n * Checks if an object is a Zod schema instance (v3 or v4).\n *\n * Zod schemas have internal markers:\n * - v3: `_def` property\n * - v4: `_zod` property\n *\n * This includes transformed schemas like z.preprocess(), z.transform(), z.pipe().\n */\nfunction isZodSchemaInstance(obj) {\n return '_def' in obj || '_zod' in obj || isZodTypeLike(obj);\n}\n/**\n * Checks if an object is a \"raw shape\" - a plain object where values are Zod schemas.\n *\n * Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`.\n *\n * IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe),\n * which have internal properties that could be mistaken for schema values.\n */\nfunction isZodRawShapeCompat(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // If it's already a Zod schema instance, it's NOT a raw shape\n if (isZodSchemaInstance(obj)) {\n return false;\n }\n // Empty objects are valid raw shapes (tools with no parameters)\n if (Object.keys(obj).length === 0) {\n return true;\n }\n // A raw shape has at least one property that is a Zod schema\n return Object.values(obj).some(isZodTypeLike);\n}\n/**\n * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,\n * otherwise returns the schema as is.\n */\nfunction getZodSchemaObject(schema) {\n if (!schema) {\n return undefined;\n }\n if (isZodRawShapeCompat(schema)) {\n return objectFromShape(schema);\n }\n return schema;\n}\nfunction promptArgumentsFromSchema(schema) {\n const shape = getObjectShape(schema);\n if (!shape)\n return [];\n return Object.entries(shape).map(([name, field]) => {\n // Get description - works for both v3 and v4\n const description = getSchemaDescription(field);\n // Check if optional - works for both v3 and v4\n const isOptional = isSchemaOptional(field);\n return {\n name,\n description,\n required: !isOptional\n };\n });\n}\nfunction getMethodValue(schema) {\n const shape = getObjectShape(schema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n // Extract literal value - works for both v3 and v4\n const value = getLiteralValue(methodSchema);\n if (typeof value === 'string') {\n return value;\n }\n throw new Error('Schema method literal must be a string');\n}\nfunction createCompletionResult(suggestions) {\n return {\n completion: {\n values: suggestions.slice(0, 100),\n total: suggestions.length,\n hasMore: suggestions.length > 100\n }\n };\n}\nconst EMPTY_COMPLETION_RESULT = {\n completion: {\n values: [],\n hasMore: false\n }\n};\n//# sourceMappingURL=mcp.js.map","import { JSONRPCMessageSchema } from '../types.js';\n/**\n * Buffers a continuous stdio stream into discrete JSON-RPC messages.\n */\nexport class ReadBuffer {\n append(chunk) {\n this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;\n }\n readMessage() {\n if (!this._buffer) {\n return null;\n }\n const index = this._buffer.indexOf('\\n');\n if (index === -1) {\n return null;\n }\n const line = this._buffer.toString('utf8', 0, index).replace(/\\r$/, '');\n this._buffer = this._buffer.subarray(index + 1);\n return deserializeMessage(line);\n }\n clear() {\n this._buffer = undefined;\n }\n}\nexport function deserializeMessage(line) {\n return JSONRPCMessageSchema.parse(JSON.parse(line));\n}\nexport function serializeMessage(message) {\n return JSON.stringify(message) + '\\n';\n}\n//# sourceMappingURL=stdio.js.map","import process from 'node:process';\nimport { ReadBuffer, serializeMessage } from '../shared/stdio.js';\n/**\n * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.\n *\n * This transport is only available in Node.js environments.\n */\nexport class StdioServerTransport {\n constructor(_stdin = process.stdin, _stdout = process.stdout) {\n this._stdin = _stdin;\n this._stdout = _stdout;\n this._readBuffer = new ReadBuffer();\n this._started = false;\n // Arrow functions to bind `this` properly, while maintaining function identity.\n this._ondata = (chunk) => {\n this._readBuffer.append(chunk);\n this.processReadBuffer();\n };\n this._onerror = (error) => {\n this.onerror?.(error);\n };\n }\n /**\n * Starts listening for messages on stdin.\n */\n async start() {\n if (this._started) {\n throw new Error('StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.');\n }\n this._started = true;\n this._stdin.on('data', this._ondata);\n this._stdin.on('error', this._onerror);\n }\n processReadBuffer() {\n while (true) {\n try {\n const message = this._readBuffer.readMessage();\n if (message === null) {\n break;\n }\n this.onmessage?.(message);\n }\n catch (error) {\n this.onerror?.(error);\n }\n }\n }\n async close() {\n // Remove our event listeners first\n this._stdin.off('data', this._ondata);\n this._stdin.off('error', this._onerror);\n // Check if we were the only data listener\n const remainingDataListeners = this._stdin.listenerCount('data');\n if (remainingDataListeners === 0) {\n // Only pause stdin if we were the only listener\n // This prevents interfering with other parts of the application that might be using stdin\n this._stdin.pause();\n }\n // Clear the buffer and notify closure\n this._readBuffer.clear();\n this.onclose?.();\n }\n send(message) {\n return new Promise(resolve => {\n const json = serializeMessage(message);\n if (this._stdout.write(json)) {\n resolve();\n }\n else {\n this._stdout.once('drain', resolve);\n }\n });\n }\n}\n//# sourceMappingURL=stdio.js.map","import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod/v4\";\nimport { Effect, type ManagedRuntime } from \"effect\";\nimport { evaluateRuntime } from \"../utils/evaluate-runtime\";\nimport { McpSession } from \"./mcp-session\";\n\nconst textResult = (text: string) => ({\n content: [{ type: \"text\" as const, text }],\n});\n\nconst safeJsonStringify = (data: unknown): string => {\n const seen = new WeakSet();\n return JSON.stringify(\n data,\n (_key, value) => {\n if (typeof value === \"object\" && value !== null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n return value;\n },\n 2,\n );\n};\n\nconst jsonResult = (data: unknown) => textResult(safeJsonStringify(data));\n\nconst imageResult = (base64: string) => ({\n content: [{ type: \"image\" as const, data: base64, mimeType: \"image/png\" }],\n});\n\nconst AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;\n\n// Tool annotations (readOnlyHint, destructiveHint) enable parallel execution in the Claude Agent SDK.\n// See: https://platform.claude.com/docs/en/agent-sdk/agent-loop#parallel-tool-execution\nexport const createBrowserMcpServer = <E>(\n runtime: ManagedRuntime.ManagedRuntime<McpSession, E>,\n) => {\n const runMcp = <A>(effect: Effect.Effect<A, unknown, McpSession>) => runtime.runPromise(effect);\n\n const server = new McpServer({\n name: \"expect\",\n version: \"0.0.1\",\n });\n\n server.registerTool(\n \"open\",\n {\n title: \"Open URL\",\n description: \"Navigate to a URL, launching a browser if needed.\",\n inputSchema: {\n url: z.string().describe(\"URL to navigate to\"),\n headed: z.boolean().optional().describe(\"Show browser window\"),\n cookies: z\n .boolean()\n .optional()\n .describe(\"Reuse local browser cookies for the target URL when available\"),\n waitUntil: z\n .enum([\"load\", \"domcontentloaded\", \"networkidle\", \"commit\"])\n .optional()\n .describe(\"Wait strategy\"),\n },\n },\n ({ url, headed, cookies, waitUntil }) =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n if (session.hasSession()) {\n yield* session.navigate(url, { waitUntil });\n return textResult(`Navigated to ${url}`);\n }\n const result = yield* session.open(url, { headed, cookies, waitUntil });\n return textResult(\n `Opened ${url}` +\n (result.injectedCookieCount > 0\n ? ` (${result.injectedCookieCount} cookies synced from local browser)`\n : \"\"),\n );\n }),\n ),\n );\n\n server.registerTool(\n \"playwright\",\n {\n title: \"Execute Playwright\",\n description:\n \"Execute Playwright code in the Node.js context. Available globals: page (Page), context (BrowserContext), browser (Browser), ref (function: ref ID from snapshot → Playwright Locator). Use `return` to send a value back as JSON. Supports await.\",\n inputSchema: {\n code: z.string().describe(\"Playwright code to execute\"),\n },\n },\n ({ code }) =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const sessionData = yield* session.requireSession();\n\n const ref = (refId: string) => {\n if (!sessionData.lastSnapshot)\n throw new Error(\"No snapshot taken yet. Call screenshot with mode 'snapshot' first.\");\n return Effect.runSync(sessionData.lastSnapshot.locator(refId));\n };\n\n return yield* Effect.promise(async () => {\n try {\n const userFunction = new AsyncFunction(\"page\", \"context\", \"browser\", \"ref\", code);\n const result = await userFunction(\n sessionData.page,\n sessionData.context,\n sessionData.browser,\n ref,\n );\n if (result === undefined) return textResult(\"OK\");\n return jsonResult(result);\n } catch (error) {\n return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);\n }\n });\n }),\n ),\n );\n\n server.registerTool(\n \"screenshot\",\n {\n title: \"Screenshot\",\n description:\n \"Capture the current page state. Modes: 'screenshot' (default, PNG image), 'snapshot' (ARIA accessibility tree with element refs), 'annotated' (screenshot with numbered labels on interactive elements).\",\n annotations: { readOnlyHint: true },\n inputSchema: {\n mode: z\n .enum([\"screenshot\", \"snapshot\", \"annotated\"])\n .optional()\n .describe(\"Capture mode (default: screenshot)\"),\n fullPage: z.boolean().optional().describe(\"Capture the full scrollable page\"),\n },\n },\n ({ mode, fullPage }) =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const page = yield* session.requirePage();\n const resolvedMode = mode ?? \"screenshot\";\n\n if (resolvedMode === \"snapshot\") {\n const result = yield* session.snapshot(page);\n yield* session.updateLastSnapshot(result);\n return jsonResult({ tree: result.tree, refs: result.refs, stats: result.stats });\n }\n\n if (resolvedMode === \"annotated\") {\n const result = yield* session.annotatedScreenshot(page, { fullPage });\n return {\n content: [\n {\n type: \"image\" as const,\n data: result.screenshot.toString(\"base64\"),\n mimeType: \"image/png\",\n },\n {\n type: \"text\" as const,\n text: result.annotations\n .map(\n (annotation) =>\n `[${annotation.label}] @${annotation.ref} ${annotation.role} \"${annotation.name}\"`,\n )\n .join(\"\\n\"),\n },\n ],\n };\n }\n\n const buffer = yield* Effect.tryPromise(() => page.screenshot({ fullPage }));\n return imageResult(buffer.toString(\"base64\"));\n }),\n ),\n );\n\n server.registerTool(\n \"console_logs\",\n {\n title: \"Console Logs\",\n description:\n \"Get browser console log messages. Optionally filter by log type (log, warning, error, info, debug).\",\n annotations: { readOnlyHint: true },\n inputSchema: {\n type: z\n .string()\n .optional()\n .describe(\"Filter by console message type (e.g. 'error', 'warning', 'log')\"),\n clear: z.boolean().optional().describe(\"Clear the collected messages after reading\"),\n },\n },\n ({ type, clear }) =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const sessionData = yield* session.requireSession();\n const entries = type\n ? sessionData.consoleMessages.filter((entry) => entry.type === type)\n : sessionData.consoleMessages;\n if (clear) sessionData.consoleMessages.length = 0;\n return entries.length === 0\n ? textResult(\"No console messages captured.\")\n : jsonResult(entries);\n }),\n ),\n );\n\n server.registerTool(\n \"network_requests\",\n {\n title: \"Network Requests\",\n description:\n \"Get captured network requests. Optionally filter by HTTP method, URL substring, or resource type (document, script, stylesheet, image, xhr, fetch, etc.).\",\n annotations: { readOnlyHint: true },\n inputSchema: {\n method: z.string().optional().describe(\"Filter by HTTP method (e.g. 'GET', 'POST')\"),\n url: z.string().optional().describe(\"Filter by URL substring match\"),\n resourceType: z\n .string()\n .optional()\n .describe(\"Filter by resource type (e.g. 'xhr', 'fetch', 'document', 'script')\"),\n clear: z.boolean().optional().describe(\"Clear the collected requests after reading\"),\n },\n },\n ({ method, url, resourceType, clear }) =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const sessionData = yield* session.requireSession();\n const normalizedMethod = method?.toUpperCase();\n const normalizedResourceType = resourceType?.toLowerCase();\n const entries = sessionData.networkRequests.filter(\n (entry) =>\n (!normalizedMethod || entry.method === normalizedMethod) &&\n (!url || entry.url.includes(url)) &&\n (!normalizedResourceType || entry.resourceType === normalizedResourceType),\n );\n if (clear) sessionData.networkRequests.length = 0;\n return entries.length === 0\n ? textResult(\"No network requests captured.\")\n : jsonResult(entries);\n }),\n ),\n );\n\n server.registerTool(\n \"performance_metrics\",\n {\n title: \"Performance Metrics\",\n description:\n \"Get Core Web Vitals performance metrics (FCP, LCP, CLS, INP) for the current page. Each metric includes a value (milliseconds for FCP/LCP/INP, unitless score for CLS) and a rating (good, needs-improvement, poor). Metrics are collected automatically from page load and user interactions.\",\n annotations: { readOnlyHint: true },\n inputSchema: {},\n },\n () =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const page = yield* session.requirePage();\n const metrics = yield* evaluateRuntime(page, \"getPerformanceMetrics\");\n const hasMetrics = metrics.fcp || metrics.lcp || metrics.inp;\n if (!hasMetrics) return textResult(\"No performance metrics available yet.\");\n return jsonResult(metrics);\n }),\n ),\n );\n\n server.registerTool(\n \"close\",\n {\n title: \"Close Browser\",\n description: \"Close the browser and end the session.\",\n annotations: { destructiveHint: true },\n inputSchema: {},\n },\n () =>\n runMcp(\n Effect.gen(function* () {\n const session = yield* McpSession;\n const result = yield* session.close();\n if (!result) return textResult(\"No browser open.\");\n const lines = [\"Browser closed.\"];\n if (result.tmpReplaySessionPath) {\n lines.push(`rrweb replay: ${result.tmpReplaySessionPath}`);\n }\n if (result.tmpReportPath) {\n lines.push(`rrweb report: ${result.tmpReportPath}`);\n }\n if (result.tmpVideoPath) {\n lines.push(`Playwright video: ${result.tmpVideoPath}`);\n } else if (result.videoPath) {\n lines.push(`Playwright video: ${result.videoPath}`);\n }\n return textResult(lines.join(\"\\n\"));\n }),\n ),\n );\n\n return server;\n};\n\nexport const startBrowserMcpServer = async <E>(\n runtime: ManagedRuntime.ManagedRuntime<McpSession, E>,\n) => {\n const server = createBrowserMcpServer(runtime);\n const transport = new StdioServerTransport();\n await server.connect(transport);\n};\n"],"x_google_ignoreList":[1,12,13,14,15,16,19,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,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