@opentiny/webmcp-cli 0.1.1-alpha.1 → 0.1.1

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.
@@ -1871,8 +1871,8 @@
1871
1871
  var _a;
1872
1872
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
1873
1873
  checkAsyncKeyword(it, def);
1874
- const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1875
- const validateRef = useKeyword(gen, keyword, validate2);
1874
+ const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
1875
+ const validateRef = useKeyword(gen, keyword, validate);
1876
1876
  const valid = gen.let("valid");
1877
1877
  cxt.block$data(valid, validateKeyword);
1878
1878
  cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
@@ -2782,20 +2782,20 @@
2782
2782
  (0, keyword_1.funcKeywordCode)(cxt, def);
2783
2783
  }
2784
2784
  }
2785
- var JSON_POINTER2 = /^\/(?:[^~]|~0|~1)*$/;
2786
- var RELATIVE_JSON_POINTER2 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2785
+ var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
2786
+ var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
2787
2787
  function getData($data, { dataLevel, dataNames, dataPathArr }) {
2788
2788
  let jsonPointer;
2789
2789
  let data;
2790
2790
  if ($data === "")
2791
2791
  return names_1.default.rootData;
2792
2792
  if ($data[0] === "/") {
2793
- if (!JSON_POINTER2.test($data))
2793
+ if (!JSON_POINTER.test($data))
2794
2794
  throw new Error(`Invalid JSON-pointer: ${$data}`);
2795
2795
  jsonPointer = $data;
2796
2796
  data = names_1.default.rootData;
2797
2797
  } else {
2798
- const matches = RELATIVE_JSON_POINTER2.exec($data);
2798
+ const matches = RELATIVE_JSON_POINTER.exec($data);
2799
2799
  if (!matches)
2800
2800
  throw new Error(`Invalid JSON-pointer: ${$data}`);
2801
2801
  const up = +matches[1];
@@ -2945,28 +2945,28 @@
2945
2945
  if (this.opts.code.process)
2946
2946
  sourceCode = this.opts.code.process(sourceCode, sch);
2947
2947
  const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
2948
- const validate2 = makeValidate(this, this.scope.get());
2949
- this.scope.value(validateName, { ref: validate2 });
2950
- validate2.errors = null;
2951
- validate2.schema = sch.schema;
2952
- validate2.schemaEnv = sch;
2948
+ const validate = makeValidate(this, this.scope.get());
2949
+ this.scope.value(validateName, { ref: validate });
2950
+ validate.errors = null;
2951
+ validate.schema = sch.schema;
2952
+ validate.schemaEnv = sch;
2953
2953
  if (sch.$async)
2954
- validate2.$async = true;
2954
+ validate.$async = true;
2955
2955
  if (this.opts.code.source === true) {
2956
- validate2.source = { validateName, validateCode, scopeValues: gen._values };
2956
+ validate.source = { validateName, validateCode, scopeValues: gen._values };
2957
2957
  }
2958
2958
  if (this.opts.unevaluated) {
2959
2959
  const { props, items } = schemaCxt;
2960
- validate2.evaluated = {
2960
+ validate.evaluated = {
2961
2961
  props: props instanceof codegen_1.Name ? void 0 : props,
2962
2962
  items: items instanceof codegen_1.Name ? void 0 : items,
2963
2963
  dynamicProps: props instanceof codegen_1.Name,
2964
2964
  dynamicItems: items instanceof codegen_1.Name
2965
2965
  };
2966
- if (validate2.source)
2967
- validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated);
2966
+ if (validate.source)
2967
+ validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
2968
2968
  }
2969
- sch.validate = validate2;
2969
+ sch.validate = validate;
2970
2970
  return sch;
2971
2971
  } catch (e) {
2972
2972
  delete sch.validate;
@@ -3866,15 +3866,15 @@
3866
3866
  }
3867
3867
  return stringScheme;
3868
3868
  }
3869
- function normalize(uri2, options) {
3870
- if (typeof uri2 === "string") {
3871
- uri2 = /** @type {T} */
3872
- normalizeString(uri2, options);
3873
- } else if (typeof uri2 === "object") {
3874
- uri2 = /** @type {T} */
3875
- parse2(serialize(uri2, options), options);
3869
+ function normalize(uri, options) {
3870
+ if (typeof uri === "string") {
3871
+ uri = /** @type {T} */
3872
+ normalizeString(uri, options);
3873
+ } else if (typeof uri === "object") {
3874
+ uri = /** @type {T} */
3875
+ parse2(serialize(uri, options), options);
3876
3876
  }
3877
- return uri2;
3877
+ return uri;
3878
3878
  }
3879
3879
  function resolve(baseURI, relativeURI, options) {
3880
3880
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
@@ -4099,7 +4099,7 @@
4099
4099
  function isHostOnlyURL(url2) {
4100
4100
  return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
4101
4101
  }
4102
- function parseWithStatus(uri2, opts) {
4102
+ function parseWithStatus(uri, opts) {
4103
4103
  const options = Object.assign({}, opts);
4104
4104
  const parsed = {
4105
4105
  scheme: void 0,
@@ -4119,17 +4119,17 @@
4119
4119
  let isIP = false;
4120
4120
  if (options.reference === "suffix") {
4121
4121
  if (options.scheme) {
4122
- uri2 = options.scheme + ":" + uri2;
4122
+ uri = options.scheme + ":" + uri;
4123
4123
  } else {
4124
- uri2 = "//" + uri2;
4124
+ uri = "//" + uri;
4125
4125
  }
4126
4126
  }
4127
- const authorityMatch = uri2.match(AUTHORITY_PREFIX);
4127
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
4128
4128
  if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
4129
4129
  parsed.error = "URI authority must not contain a literal backslash.";
4130
4130
  malformedAuthorityOrPort = true;
4131
4131
  }
4132
- const introducerMatch = uri2.match(AUTHORITY_INTRODUCER_REGION);
4132
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
4133
4133
  if (introducerMatch !== null) {
4134
4134
  const region = introducerMatch[1];
4135
4135
  const normalizedRegion = region.replace(/[\t\n\r]/g, "");
@@ -4143,7 +4143,7 @@
4143
4143
  }
4144
4144
  }
4145
4145
  }
4146
- const matches = uri2.match(URI_PARSE);
4146
+ const matches = uri.match(URI_PARSE);
4147
4147
  if (matches) {
4148
4148
  parsed.scheme = matches[1];
4149
4149
  parsed.userinfo = matches[3];
@@ -4205,7 +4205,7 @@
4205
4205
  if (!malformedIPLiteral) {
4206
4206
  malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4207
4207
  }
4208
- if (uri2.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4208
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4209
4209
  let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4210
4210
  if (!isIP) {
4211
4211
  host = normalizePercentEncoding(host.toLowerCase());
@@ -4234,16 +4234,16 @@
4234
4234
  }
4235
4235
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
4236
4236
  }
4237
- function parse2(uri2, opts) {
4238
- return parseWithStatus(uri2, opts).parsed;
4237
+ function parse2(uri, opts) {
4238
+ return parseWithStatus(uri, opts).parsed;
4239
4239
  }
4240
- function normalizeString(uri2, opts) {
4241
- return normalizeStringWithStatus(uri2, opts).normalized;
4240
+ function normalizeString(uri, opts) {
4241
+ return normalizeStringWithStatus(uri, opts).normalized;
4242
4242
  }
4243
- function normalizeStringWithStatus(uri2, opts) {
4244
- const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri2, opts);
4243
+ function normalizeStringWithStatus(uri, opts) {
4244
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
4245
4245
  return {
4246
- normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri2 : serialize(parsed, opts),
4246
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4247
4247
  malformedAuthorityOrPort,
4248
4248
  malformedPercentEncoding,
4249
4249
  malformedSchemeSpecific,
@@ -4251,13 +4251,13 @@
4251
4251
  malformedScheme
4252
4252
  };
4253
4253
  }
4254
- function normalizeComparableURI(uri2, opts) {
4255
- if (typeof uri2 !== "string" && typeof uri2 !== "object") {
4254
+ function normalizeComparableURI(uri, opts) {
4255
+ if (typeof uri !== "string" && typeof uri !== "object") {
4256
4256
  return void 0;
4257
4257
  }
4258
4258
  let value;
4259
4259
  try {
4260
- value = typeof uri2 === "string" ? uri2 : serialize(uri2, opts);
4260
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
4261
4261
  } catch {
4262
4262
  return void 0;
4263
4263
  }
@@ -4284,9 +4284,9 @@
4284
4284
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js"(exports) {
4285
4285
  "use strict";
4286
4286
  Object.defineProperty(exports, "__esModule", { value: true });
4287
- var uri2 = require_fast_uri();
4288
- uri2.code = 'require("ajv/dist/runtime/uri").default';
4289
- exports.default = uri2;
4287
+ var uri = require_fast_uri();
4288
+ uri.code = 'require("ajv/dist/runtime/uri").default';
4289
+ exports.default = uri;
4290
4290
  }
4291
4291
  });
4292
4292
 
@@ -4673,10 +4673,10 @@
4673
4673
  return this;
4674
4674
  }
4675
4675
  // Add format
4676
- addFormat(name, format2) {
4677
- if (typeof format2 == "string")
4678
- format2 = new RegExp(format2);
4679
- this.formats[name] = format2;
4676
+ addFormat(name, format) {
4677
+ if (typeof format == "string")
4678
+ format = new RegExp(format);
4679
+ this.formats[name] = format;
4680
4680
  return this;
4681
4681
  }
4682
4682
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
@@ -4704,10 +4704,10 @@
4704
4704
  }
4705
4705
  return metaSchema;
4706
4706
  }
4707
- _removeAllSchemas(schemas, regex2) {
4707
+ _removeAllSchemas(schemas, regex) {
4708
4708
  for (const keyRef in schemas) {
4709
4709
  const sch = schemas[keyRef];
4710
- if (!regex2 || regex2.test(keyRef)) {
4710
+ if (!regex || regex.test(keyRef)) {
4711
4711
  if (typeof sch == "string") {
4712
4712
  delete schemas[keyRef];
4713
4713
  } else if (sch && !sch.meta) {
@@ -4794,9 +4794,9 @@
4794
4794
  }
4795
4795
  function addInitialFormats() {
4796
4796
  for (const name in this.opts.formats) {
4797
- const format2 = this.opts.formats[name];
4798
- if (format2)
4799
- this.addFormat(name, format2);
4797
+ const format = this.opts.formats[name];
4798
+ if (format)
4799
+ this.addFormat(name, format);
4800
4800
  }
4801
4801
  }
4802
4802
  function addInitialKeywords(defs) {
@@ -5124,7 +5124,7 @@
5124
5124
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
5125
5125
  "use strict";
5126
5126
  Object.defineProperty(exports, "__esModule", { value: true });
5127
- function ucs2length2(str) {
5127
+ function ucs2length(str) {
5128
5128
  const len = str.length;
5129
5129
  let length = 0;
5130
5130
  let pos = 0;
@@ -5140,8 +5140,8 @@
5140
5140
  }
5141
5141
  return length;
5142
5142
  }
5143
- exports.default = ucs2length2;
5144
- ucs2length2.code = 'require("ajv/dist/runtime/ucs2length").default';
5143
+ exports.default = ucs2length;
5144
+ ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
5145
5145
  }
5146
5146
  });
5147
5147
 
@@ -6479,18 +6479,18 @@
6479
6479
  });
6480
6480
  const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
6481
6481
  const fType = gen.let("fType");
6482
- const format2 = gen.let("format");
6483
- gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format2, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format2, fDef));
6482
+ const format = gen.let("format");
6483
+ 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));
6484
6484
  cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
6485
6485
  function unknownFmt() {
6486
6486
  if (opts.strictSchema === false)
6487
6487
  return codegen_1.nil;
6488
- return (0, codegen_1._)`${schemaCode} && !${format2}`;
6488
+ return (0, codegen_1._)`${schemaCode} && !${format}`;
6489
6489
  }
6490
6490
  function invalidFmt() {
6491
- const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format2}(${data}) : ${format2}(${data}))` : (0, codegen_1._)`${format2}(${data})`;
6492
- const validData = (0, codegen_1._)`(typeof ${format2} == "function" ? ${callFormat} : ${format2}.test(${data}))`;
6493
- return (0, codegen_1._)`${format2} && ${format2} !== true && ${fType} === ${ruleType} && !${validData}`;
6491
+ const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`;
6492
+ const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
6493
+ return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
6494
6494
  }
6495
6495
  }
6496
6496
  function validateFormat() {
@@ -6501,7 +6501,7 @@
6501
6501
  }
6502
6502
  if (formatDef === true)
6503
6503
  return;
6504
- const [fmtType, format2, fmtRef] = getFormat(formatDef);
6504
+ const [fmtType, format, fmtRef] = getFormat(formatDef);
6505
6505
  if (fmtType === ruleType)
6506
6506
  cxt.pass(validCondition());
6507
6507
  function unknownFormat() {
@@ -6528,7 +6528,7 @@
6528
6528
  throw new Error("async format in sync schema");
6529
6529
  return (0, codegen_1._)`await ${fmtRef}(${data})`;
6530
6530
  }
6531
- return typeof format2 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6531
+ return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6532
6532
  }
6533
6533
  }
6534
6534
  }
@@ -6543,8 +6543,8 @@
6543
6543
  "use strict";
6544
6544
  Object.defineProperty(exports, "__esModule", { value: true });
6545
6545
  var format_1 = require_format();
6546
- var format2 = [format_1.default];
6547
- exports.default = format2;
6546
+ var format = [format_1.default];
6547
+ exports.default = format;
6548
6548
  }
6549
6549
  });
6550
6550
 
@@ -6945,12 +6945,12 @@
6945
6945
  "use strict";
6946
6946
  Object.defineProperty(exports, "__esModule", { value: true });
6947
6947
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
6948
- function fmtDef(validate2, compare) {
6949
- return { validate: validate2, compare };
6948
+ function fmtDef(validate, compare) {
6949
+ return { validate, compare };
6950
6950
  }
6951
6951
  exports.fullFormats = {
6952
6952
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
6953
- date: fmtDef(date5, compareDate),
6953
+ date: fmtDef(date4, compareDate),
6954
6954
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
6955
6955
  time: fmtDef(getTime(true), compareTime),
6956
6956
  "date-time": fmtDef(getDateTime(true), compareDateTime),
@@ -6958,7 +6958,7 @@
6958
6958
  "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
6959
6959
  // duration: https://tools.ietf.org/html/rfc3339#appendix-A
6960
6960
  duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
6961
- uri: uri2,
6961
+ uri,
6962
6962
  "uri-reference": /^(?:[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,
6963
6963
  // uri-template: https://tools.ietf.org/html/rfc6570
6964
6964
  "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,
@@ -6970,7 +6970,7 @@
6970
6970
  // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
6971
6971
  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)$/,
6972
6972
  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,
6973
- regex: regex2,
6973
+ regex,
6974
6974
  // uuid: http://tools.ietf.org/html/rfc4122
6975
6975
  uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
6976
6976
  // JSON-pointer: https://tools.ietf.org/html/rfc6901
@@ -7011,19 +7011,19 @@
7011
7011
  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
7012
7012
  };
7013
7013
  exports.formatNames = Object.keys(exports.fullFormats);
7014
- function isLeapYear2(year) {
7014
+ function isLeapYear(year) {
7015
7015
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
7016
7016
  }
7017
- var DATE2 = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
7018
- var DAYS2 = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7019
- function date5(str) {
7020
- const matches = DATE2.exec(str);
7017
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
7018
+ var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7019
+ function date4(str) {
7020
+ const matches = DATE.exec(str);
7021
7021
  if (!matches)
7022
7022
  return false;
7023
7023
  const year = +matches[1];
7024
7024
  const month = +matches[2];
7025
7025
  const day = +matches[3];
7026
- return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear2(year) ? 29 : DAYS2[month]);
7026
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
7027
7027
  }
7028
7028
  function compareDate(d1, d2) {
7029
7029
  if (!(d1 && d2))
@@ -7034,10 +7034,10 @@
7034
7034
  return -1;
7035
7035
  return 0;
7036
7036
  }
7037
- var TIME2 = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
7037
+ var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
7038
7038
  function getTime(strictTimeZone) {
7039
- return function time4(str) {
7040
- const matches = TIME2.exec(str);
7039
+ return function time3(str) {
7040
+ const matches = TIME.exec(str);
7041
7041
  if (!matches)
7042
7042
  return false;
7043
7043
  const hr = +matches[1];
@@ -7068,8 +7068,8 @@
7068
7068
  function compareIsoTime(t1, t2) {
7069
7069
  if (!(t1 && t2))
7070
7070
  return void 0;
7071
- const a1 = TIME2.exec(t1);
7072
- const a2 = TIME2.exec(t2);
7071
+ const a1 = TIME.exec(t1);
7072
+ const a2 = TIME.exec(t2);
7073
7073
  if (!(a1 && a2))
7074
7074
  return void 0;
7075
7075
  t1 = a1[1] + a1[2] + a1[3];
@@ -7080,12 +7080,12 @@
7080
7080
  return -1;
7081
7081
  return 0;
7082
7082
  }
7083
- var DATE_TIME_SEPARATOR2 = /t|\s/i;
7083
+ var DATE_TIME_SEPARATOR = /t|\s/i;
7084
7084
  function getDateTime(strictTimeZone) {
7085
- const time4 = getTime(strictTimeZone);
7086
- return function date_time2(str) {
7087
- const dateTime = str.split(DATE_TIME_SEPARATOR2);
7088
- return dateTime.length === 2 && date5(dateTime[0]) && time4(dateTime[1]);
7085
+ const time3 = getTime(strictTimeZone);
7086
+ return function date_time(str) {
7087
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
7088
+ return dateTime.length === 2 && date4(dateTime[0]) && time3(dateTime[1]);
7089
7089
  };
7090
7090
  }
7091
7091
  function compareDateTime(dt1, dt2) {
@@ -7100,17 +7100,17 @@
7100
7100
  function compareIsoDateTime(dt1, dt2) {
7101
7101
  if (!(dt1 && dt2))
7102
7102
  return void 0;
7103
- const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR2);
7104
- const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR2);
7103
+ const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
7104
+ const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
7105
7105
  const res = compareDate(d1, d2);
7106
7106
  if (res === void 0)
7107
7107
  return void 0;
7108
7108
  return res || compareTime(t1, t2);
7109
7109
  }
7110
- var NOT_URI_FRAGMENT2 = /\/|:/;
7110
+ var NOT_URI_FRAGMENT = /\/|:/;
7111
7111
  var 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;
7112
- function uri2(str) {
7113
- return NOT_URI_FRAGMENT2.test(str) && URI.test(str);
7112
+ function uri(str) {
7113
+ return NOT_URI_FRAGMENT.test(str) && URI.test(str);
7114
7114
  }
7115
7115
  var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
7116
7116
  function byte(str) {
@@ -7128,9 +7128,9 @@
7128
7128
  function validateNumber() {
7129
7129
  return true;
7130
7130
  }
7131
- var Z_ANCHOR2 = /[^\\]\\Z/;
7132
- function regex2(str) {
7133
- if (Z_ANCHOR2.test(str))
7131
+ var Z_ANCHOR = /[^\\]\\Z/;
7132
+ function regex(str) {
7133
+ if (Z_ANCHOR.test(str))
7134
7134
  return false;
7135
7135
  try {
7136
7136
  new RegExp(str);
@@ -7186,17 +7186,17 @@
7186
7186
  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)));
7187
7187
  }
7188
7188
  function validateFormat() {
7189
- const format2 = fCxt.schema;
7190
- const fmtDef = self2.formats[format2];
7189
+ const format = fCxt.schema;
7190
+ const fmtDef = self2.formats[format];
7191
7191
  if (!fmtDef || fmtDef === true)
7192
7192
  return;
7193
7193
  if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
7194
- throw new Error(`"${keyword}": format "${format2}" does not define "compare" function`);
7194
+ throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
7195
7195
  }
7196
7196
  const fmt = gen.scopeValue("formats", {
7197
- key: format2,
7197
+ key: format,
7198
7198
  ref: fmtDef,
7199
- code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format2)}` : void 0
7199
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
7200
7200
  });
7201
7201
  cxt.fail$data(compareCode(fmt));
7202
7202
  }
@@ -8640,10 +8640,10 @@
8640
8640
  function getStringByteLength(str) {
8641
8641
  return unescape(encodeURIComponent(str)).length;
8642
8642
  }
8643
- function getSegments(regex2, mode, str) {
8643
+ function getSegments(regex, mode, str) {
8644
8644
  const segments = [];
8645
8645
  let result2;
8646
- while ((result2 = regex2.exec(str)) !== null) {
8646
+ while ((result2 = regex.exec(str)) !== null) {
8647
8647
  segments.push({
8648
8648
  data: result2[0],
8649
8649
  index: result2.index,
@@ -11276,13 +11276,13 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11276
11276
  return new RegExp(`^${timeRegexSource(args)}$`);
11277
11277
  }
11278
11278
  function datetimeRegex(args) {
11279
- let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
11279
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
11280
11280
  const opts = [];
11281
11281
  opts.push(args.local ? `Z?` : `Z`);
11282
11282
  if (args.offset)
11283
11283
  opts.push(`([+-]\\d{2}:?\\d{2})`);
11284
- regex2 = `${regex2}(${opts.join("|")})`;
11285
- return new RegExp(`^${regex2}$`);
11284
+ regex = `${regex}(${opts.join("|")})`;
11285
+ return new RegExp(`^${regex}$`);
11286
11286
  }
11287
11287
  function isValidIP(ip, version2) {
11288
11288
  if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
@@ -11528,8 +11528,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11528
11528
  status.dirty();
11529
11529
  }
11530
11530
  } else if (check2.kind === "datetime") {
11531
- const regex2 = datetimeRegex(check2);
11532
- if (!regex2.test(input.data)) {
11531
+ const regex = datetimeRegex(check2);
11532
+ if (!regex.test(input.data)) {
11533
11533
  ctx = this._getOrReturnCtx(input, ctx);
11534
11534
  addIssueToContext(ctx, {
11535
11535
  code: ZodIssueCode.invalid_string,
@@ -11539,8 +11539,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11539
11539
  status.dirty();
11540
11540
  }
11541
11541
  } else if (check2.kind === "date") {
11542
- const regex2 = dateRegex;
11543
- if (!regex2.test(input.data)) {
11542
+ const regex = dateRegex;
11543
+ if (!regex.test(input.data)) {
11544
11544
  ctx = this._getOrReturnCtx(input, ctx);
11545
11545
  addIssueToContext(ctx, {
11546
11546
  code: ZodIssueCode.invalid_string,
@@ -11550,8 +11550,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11550
11550
  status.dirty();
11551
11551
  }
11552
11552
  } else if (check2.kind === "time") {
11553
- const regex2 = timeRegex(check2);
11554
- if (!regex2.test(input.data)) {
11553
+ const regex = timeRegex(check2);
11554
+ if (!regex.test(input.data)) {
11555
11555
  ctx = this._getOrReturnCtx(input, ctx);
11556
11556
  addIssueToContext(ctx, {
11557
11557
  code: ZodIssueCode.invalid_string,
@@ -11626,8 +11626,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11626
11626
  }
11627
11627
  return { status: status.value, value: input.data };
11628
11628
  }
11629
- _regex(regex2, validation, message) {
11630
- return this.refinement((data) => regex2.test(data), {
11629
+ _regex(regex, validation, message) {
11630
+ return this.refinement((data) => regex.test(data), {
11631
11631
  validation,
11632
11632
  code: ZodIssueCode.invalid_string,
11633
11633
  ...errorUtil.errToObj(message)
@@ -11719,10 +11719,10 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11719
11719
  duration(message) {
11720
11720
  return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
11721
11721
  }
11722
- regex(regex2, message) {
11722
+ regex(regex, message) {
11723
11723
  return this._addCheck({
11724
11724
  kind: "regex",
11725
- regex: regex2,
11725
+ regex,
11726
11726
  ...errorUtil.errToObj(message)
11727
11727
  });
11728
11728
  }
@@ -15084,25 +15084,25 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
15084
15084
  var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
15085
15085
  function timeSource(args) {
15086
15086
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
15087
- const regex2 = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
15088
- return regex2;
15087
+ const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
15088
+ return regex;
15089
15089
  }
15090
15090
  function time(args) {
15091
15091
  return new RegExp(`^${timeSource(args)}$`);
15092
15092
  }
15093
15093
  function datetime(args) {
15094
- const time4 = timeSource({ precision: args.precision });
15094
+ const time3 = timeSource({ precision: args.precision });
15095
15095
  const opts = ["Z"];
15096
15096
  if (args.local)
15097
15097
  opts.push("");
15098
15098
  if (args.offset)
15099
15099
  opts.push(`([+-]\\d{2}:\\d{2})`);
15100
- const timeRegex2 = `${time4}(?:${opts.join("|")})`;
15100
+ const timeRegex2 = `${time3}(?:${opts.join("|")})`;
15101
15101
  return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
15102
15102
  }
15103
15103
  var string = (params) => {
15104
- const regex2 = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
15105
- return new RegExp(`^${regex2}$`);
15104
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
15105
+ return new RegExp(`^${regex}$`);
15106
15106
  };
15107
15107
  var bigint = /^\d+n?$/;
15108
15108
  var integer = /^\d+$/;
@@ -18249,7 +18249,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
18249
18249
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
18250
18250
  config(en_default2());
18251
18251
 
18252
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18252
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18253
18253
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
18254
18254
  var JSONRPC_VERSION = "2.0";
18255
18255
  var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
@@ -19724,14 +19724,14 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19724
19724
  // ../../node_modules/.pnpm/zod-to-json-schema@3.25.2_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
19725
19725
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
19726
19726
 
19727
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19727
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19728
19728
  var import_ajv_formats = __toESM(require_dist(), 1);
19729
19729
 
19730
19730
  // ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
19731
19731
  var crypto2;
19732
19732
  crypto2 = globalThis.crypto;
19733
19733
 
19734
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19734
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19735
19735
  var SafeUrlSchema = url().superRefine((val, ctx) => {
19736
19736
  if (!URL.canParse(val)) {
19737
19737
  ctx.addIssue({
@@ -19875,7 +19875,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19875
19875
  token_type_hint: string2().optional()
19876
19876
  }).strip();
19877
19877
 
19878
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19878
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19879
19879
  var OAuthError = class extends Error {
19880
19880
  constructor(message, errorUri) {
19881
19881
  super(message);
@@ -19970,7 +19970,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19970
19970
  [InvalidTargetError.errorCode]: InvalidTargetError
19971
19971
  };
19972
19972
 
19973
- // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@opentiny/next/index.js
19973
+ // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@opentiny/next/index.js
19974
19974
  var _0x4f2826 = _0xad7a;
19975
19975
  (function(_0x5153c5, _0x3abbea) {
19976
19976
  const _0x5f186f = _0xad7a, _0x3f8155 = _0xad7a, _0x5ad68c = _0x5153c5();
@@ -20294,7 +20294,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20294
20294
  }, _0x275e(_0x25fced, _0x3ae797);
20295
20295
  }
20296
20296
 
20297
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.4_hono@4.13.16_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20297
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.6_hono@4.13.17_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20298
20298
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
20299
20299
  var McpZodTypeKind;
20300
20300
  (function(McpZodTypeKind2) {
@@ -20381,1669 +20381,6 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20381
20381
  )
20382
20382
  });
20383
20383
 
20384
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
20385
- function deepCompareStrict(a, b) {
20386
- const typeofa = typeof a;
20387
- if (typeofa !== typeof b) {
20388
- return false;
20389
- }
20390
- const aIsArray = Array.isArray(a);
20391
- const bIsArray = Array.isArray(b);
20392
- if (aIsArray !== bIsArray) {
20393
- return false;
20394
- }
20395
- if (aIsArray) {
20396
- const length = a.length;
20397
- if (length !== b.length) {
20398
- return false;
20399
- }
20400
- for (let i = 0; i < length; i++) {
20401
- if (!deepCompareStrict(a[i], b[i])) {
20402
- return false;
20403
- }
20404
- }
20405
- return true;
20406
- }
20407
- if (typeofa === "object") {
20408
- if (!a || !b) {
20409
- return a === b;
20410
- }
20411
- const aKeys = Object.keys(a);
20412
- const bKeys = Object.keys(b);
20413
- const length = aKeys.length;
20414
- if (length !== bKeys.length) {
20415
- return false;
20416
- }
20417
- for (const k of aKeys) {
20418
- if (!Object.prototype.hasOwnProperty.call(b, k)) {
20419
- return false;
20420
- }
20421
- if (!deepCompareStrict(a[k], b[k])) {
20422
- return false;
20423
- }
20424
- }
20425
- return true;
20426
- }
20427
- return a === b;
20428
- }
20429
-
20430
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/pointer.js
20431
- function encodePointer(p) {
20432
- return encodeURI(escapePointer(p));
20433
- }
20434
- function escapePointer(p) {
20435
- return p.replace(/~/g, "~0").replace(/\//g, "~1");
20436
- }
20437
-
20438
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/dereference.js
20439
- var schemaArrayKeyword = {
20440
- prefixItems: true,
20441
- items: true,
20442
- allOf: true,
20443
- anyOf: true,
20444
- oneOf: true
20445
- };
20446
- var schemaMapKeyword = {
20447
- $defs: true,
20448
- definitions: true,
20449
- properties: true,
20450
- patternProperties: true,
20451
- dependentSchemas: true
20452
- };
20453
- var ignoredKeyword = {
20454
- id: true,
20455
- $id: true,
20456
- $ref: true,
20457
- $schema: true,
20458
- $anchor: true,
20459
- $vocabulary: true,
20460
- $comment: true,
20461
- default: true,
20462
- enum: true,
20463
- const: true,
20464
- required: true,
20465
- dependentRequired: true,
20466
- type: true,
20467
- maximum: true,
20468
- minimum: true,
20469
- exclusiveMaximum: true,
20470
- exclusiveMinimum: true,
20471
- multipleOf: true,
20472
- maxLength: true,
20473
- minLength: true,
20474
- pattern: true,
20475
- format: true,
20476
- maxItems: true,
20477
- minItems: true,
20478
- uniqueItems: true,
20479
- maxProperties: true,
20480
- minProperties: true
20481
- };
20482
- var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
20483
- function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
20484
- if (schema && typeof schema === "object" && !Array.isArray(schema)) {
20485
- const id = schema.$id || schema["id"];
20486
- if (id) {
20487
- const url2 = new URL(id, baseURI.href);
20488
- if (url2.hash.length > 1) {
20489
- lookup[url2.href] = schema;
20490
- } else {
20491
- url2.hash = "";
20492
- if (basePointer === "") {
20493
- baseURI = url2;
20494
- } else {
20495
- dereference(schema, lookup, baseURI);
20496
- }
20497
- }
20498
- }
20499
- } else if (schema !== true && schema !== false) {
20500
- return lookup;
20501
- }
20502
- const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
20503
- if (lookup[schemaURI] !== void 0 && lookup[schemaURI] !== schema) {
20504
- throw new Error(`Duplicate schema URI "${schemaURI}".`);
20505
- }
20506
- lookup[schemaURI] = schema;
20507
- if (schema === true || schema === false) {
20508
- return lookup;
20509
- }
20510
- if (schema.__absolute_uri__ === void 0) {
20511
- Object.defineProperty(schema, "__absolute_uri__", {
20512
- enumerable: false,
20513
- value: schemaURI
20514
- });
20515
- }
20516
- if (schema.$ref && schema.__absolute_ref__ === void 0) {
20517
- const url2 = new URL(schema.$ref, baseURI.href);
20518
- url2.hash = url2.hash;
20519
- Object.defineProperty(schema, "__absolute_ref__", {
20520
- enumerable: false,
20521
- value: url2.href
20522
- });
20523
- }
20524
- if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
20525
- const url2 = new URL(schema.$recursiveRef, baseURI.href);
20526
- url2.hash = url2.hash;
20527
- Object.defineProperty(schema, "__absolute_recursive_ref__", {
20528
- enumerable: false,
20529
- value: url2.href
20530
- });
20531
- }
20532
- if (schema.$anchor) {
20533
- const url2 = new URL("#" + schema.$anchor, baseURI.href);
20534
- lookup[url2.href] = schema;
20535
- }
20536
- for (let key in schema) {
20537
- if (ignoredKeyword[key]) {
20538
- continue;
20539
- }
20540
- const keyBase = `${basePointer}/${encodePointer(key)}`;
20541
- const subSchema = schema[key];
20542
- if (Array.isArray(subSchema)) {
20543
- if (schemaArrayKeyword[key]) {
20544
- const length = subSchema.length;
20545
- for (let i = 0; i < length; i++) {
20546
- dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
20547
- }
20548
- }
20549
- } else if (schemaMapKeyword[key]) {
20550
- for (let subKey in subSchema) {
20551
- dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
20552
- }
20553
- } else {
20554
- dereference(subSchema, lookup, baseURI, keyBase);
20555
- }
20556
- }
20557
- return lookup;
20558
- }
20559
-
20560
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/format.js
20561
- var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
20562
- var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
20563
- var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
20564
- var 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;
20565
- var URIREF = /^(?:[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;
20566
- var URITEMPLATE = /^(?:(?:[^\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;
20567
- var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
20568
- var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
20569
- var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20570
- var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
20571
- var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
20572
- var EMAIL = (input) => {
20573
- if (input[0] === '"')
20574
- return false;
20575
- const [name, host, ...rest] = input.split("@");
20576
- if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253)
20577
- return false;
20578
- if (name[0] === "." || name.endsWith(".") || name.includes(".."))
20579
- return false;
20580
- if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
20581
- return false;
20582
- return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
20583
- };
20584
- var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
20585
- var 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;
20586
- var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
20587
- function bind(r) {
20588
- return r.test.bind(r);
20589
- }
20590
- var format = {
20591
- date: date4,
20592
- time: time3.bind(void 0, false),
20593
- "date-time": date_time,
20594
- duration: DURATION,
20595
- uri,
20596
- "uri-reference": bind(URIREF),
20597
- "uri-template": bind(URITEMPLATE),
20598
- url: bind(URL_),
20599
- email: EMAIL,
20600
- hostname: bind(HOSTNAME),
20601
- ipv4: bind(IPV4),
20602
- ipv6: bind(IPV6),
20603
- regex,
20604
- uuid: bind(UUID),
20605
- "json-pointer": bind(JSON_POINTER),
20606
- "json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
20607
- "relative-json-pointer": bind(RELATIVE_JSON_POINTER)
20608
- };
20609
- function isLeapYear(year) {
20610
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
20611
- }
20612
- function date4(str) {
20613
- const matches = str.match(DATE);
20614
- if (!matches)
20615
- return false;
20616
- const yearPart = matches[1];
20617
- const monthPart = matches[2];
20618
- const dayPart = matches[3];
20619
- if (!yearPart || !monthPart || !dayPart)
20620
- return false;
20621
- const year = +yearPart;
20622
- const month = +monthPart;
20623
- const day = +dayPart;
20624
- const maxDay = month == 2 && isLeapYear(year) ? 29 : DAYS[month];
20625
- return month >= 1 && month <= 12 && day >= 1 && maxDay !== void 0 && day <= maxDay;
20626
- }
20627
- function time3(full, str) {
20628
- const matches = str.match(TIME);
20629
- if (!matches)
20630
- return false;
20631
- const hourPart = matches[1];
20632
- const minutePart = matches[2];
20633
- const secondPart = matches[3];
20634
- if (!hourPart || !minutePart || !secondPart)
20635
- return false;
20636
- const hour = +hourPart;
20637
- const minute = +minutePart;
20638
- const second = +secondPart;
20639
- const timeZone = !!matches[5];
20640
- return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
20641
- }
20642
- var DATE_TIME_SEPARATOR = /t|\s/i;
20643
- function date_time(str) {
20644
- const [datePart, timePart, extra] = str.split(DATE_TIME_SEPARATOR);
20645
- return datePart !== void 0 && timePart !== void 0 && extra === void 0 && date4(datePart) && time3(true, timePart);
20646
- }
20647
- var NOT_URI_FRAGMENT = /\/|:/;
20648
- var URI_PATTERN = /^(?:[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;
20649
- function uri(str) {
20650
- return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
20651
- }
20652
- var Z_ANCHOR = /[^\\]\\Z/;
20653
- function regex(str) {
20654
- if (Z_ANCHOR.test(str))
20655
- return false;
20656
- try {
20657
- new RegExp(str, "u");
20658
- return true;
20659
- } catch (e) {
20660
- return false;
20661
- }
20662
- }
20663
-
20664
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
20665
- function ucs2length(s) {
20666
- let result2 = 0;
20667
- let length = s.length;
20668
- let index = 0;
20669
- let charCode;
20670
- while (index < length) {
20671
- result2++;
20672
- charCode = s.charCodeAt(index++);
20673
- if (charCode >= 55296 && charCode <= 56319 && index < length) {
20674
- charCode = s.charCodeAt(index);
20675
- if ((charCode & 64512) == 56320) {
20676
- index++;
20677
- }
20678
- }
20679
- }
20680
- return result2;
20681
- }
20682
-
20683
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/validate.js
20684
- function hasOwnProperty(instance, key) {
20685
- return Object.prototype.hasOwnProperty.call(instance, key);
20686
- }
20687
- function decimalInteger(value) {
20688
- const coefficientAndExponent = Math.abs(value).toString().split("e");
20689
- const coefficient = coefficientAndExponent[0];
20690
- const exponent = coefficientAndExponent[1] ?? "0";
20691
- const point = coefficient.indexOf(".");
20692
- const fractionLength = point === -1 ? 0 : coefficient.length - point - 1;
20693
- return [
20694
- BigInt(coefficient.replace(".", "")),
20695
- Number(exponent) - fractionLength
20696
- ];
20697
- }
20698
- function isMultipleOf(instance, divisor) {
20699
- if (!Number.isFinite(instance) || !Number.isFinite(divisor) || divisor <= 0) {
20700
- return false;
20701
- }
20702
- const [instanceCoefficient, instanceExponent] = decimalInteger(instance);
20703
- const [divisorCoefficient, divisorExponent] = decimalInteger(divisor);
20704
- const exponentDifference = instanceExponent - divisorExponent;
20705
- if (exponentDifference >= 0) {
20706
- return instanceCoefficient * 10n ** BigInt(exponentDifference) % divisorCoefficient === 0n;
20707
- }
20708
- return instanceCoefficient % (divisorCoefficient * 10n ** BigInt(-exponentDifference)) === 0n;
20709
- }
20710
- function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = /* @__PURE__ */ Object.create(null)) {
20711
- if (schema === true) {
20712
- return { valid: true, errors: [] };
20713
- }
20714
- if (schema === false) {
20715
- return {
20716
- valid: false,
20717
- errors: [
20718
- {
20719
- instanceLocation,
20720
- keyword: "false",
20721
- keywordLocation: instanceLocation,
20722
- error: "False boolean schema."
20723
- }
20724
- ]
20725
- };
20726
- }
20727
- const rawInstanceType = typeof instance;
20728
- let instanceType;
20729
- switch (rawInstanceType) {
20730
- case "boolean":
20731
- case "number":
20732
- case "string":
20733
- instanceType = rawInstanceType;
20734
- break;
20735
- case "object":
20736
- if (instance === null) {
20737
- instanceType = "null";
20738
- } else if (Array.isArray(instance)) {
20739
- instanceType = "array";
20740
- } else {
20741
- instanceType = "object";
20742
- }
20743
- break;
20744
- default:
20745
- throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
20746
- }
20747
- const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;
20748
- const errors = [];
20749
- if ($recursiveAnchor === true && recursiveAnchor === null) {
20750
- recursiveAnchor = schema;
20751
- }
20752
- if ($recursiveRef === "#") {
20753
- const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
20754
- const keywordLocation = `${schemaLocation}/$recursiveRef`;
20755
- const result2 = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
20756
- if (!result2.valid) {
20757
- errors.push({
20758
- instanceLocation,
20759
- keyword: "$recursiveRef",
20760
- keywordLocation,
20761
- error: "A subschema had errors."
20762
- }, ...result2.errors);
20763
- }
20764
- }
20765
- if ($ref !== void 0) {
20766
- const uri2 = __absolute_ref__ || $ref;
20767
- const refSchema = lookup[uri2];
20768
- if (refSchema === void 0) {
20769
- let message = `Unresolved $ref "${$ref}".`;
20770
- if (__absolute_ref__ && __absolute_ref__ !== $ref) {
20771
- message += ` Absolute URI "${__absolute_ref__}".`;
20772
- }
20773
- message += `
20774
- Known schemas:
20775
- - ${Object.keys(lookup).join("\n- ")}`;
20776
- throw new Error(message);
20777
- }
20778
- const keywordLocation = `${schemaLocation}/$ref`;
20779
- const result2 = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
20780
- if (!result2.valid) {
20781
- errors.push({
20782
- instanceLocation,
20783
- keyword: "$ref",
20784
- keywordLocation,
20785
- error: "A subschema had errors."
20786
- }, ...result2.errors);
20787
- }
20788
- if (draft === "4" || draft === "7") {
20789
- return { valid: errors.length === 0, errors };
20790
- }
20791
- }
20792
- if (Array.isArray($type)) {
20793
- let length = $type.length;
20794
- let valid = false;
20795
- for (let i = 0; i < length; i++) {
20796
- if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
20797
- valid = true;
20798
- break;
20799
- }
20800
- }
20801
- if (!valid) {
20802
- errors.push({
20803
- instanceLocation,
20804
- keyword: "type",
20805
- keywordLocation: `${schemaLocation}/type`,
20806
- error: `Instance type "${instanceType}" is invalid. Expected "${$type.join('", "')}".`
20807
- });
20808
- }
20809
- } else if ($type === "integer") {
20810
- if (instanceType !== "number" || instance % 1 || instance !== instance) {
20811
- errors.push({
20812
- instanceLocation,
20813
- keyword: "type",
20814
- keywordLocation: `${schemaLocation}/type`,
20815
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20816
- });
20817
- }
20818
- } else if ($type !== void 0 && instanceType !== $type) {
20819
- errors.push({
20820
- instanceLocation,
20821
- keyword: "type",
20822
- keywordLocation: `${schemaLocation}/type`,
20823
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20824
- });
20825
- }
20826
- if ($const !== void 0) {
20827
- if (instanceType === "object" || instanceType === "array") {
20828
- if (!deepCompareStrict(instance, $const)) {
20829
- errors.push({
20830
- instanceLocation,
20831
- keyword: "const",
20832
- keywordLocation: `${schemaLocation}/const`,
20833
- error: `Instance does not match ${JSON.stringify($const)}.`
20834
- });
20835
- }
20836
- } else if (instance !== $const) {
20837
- errors.push({
20838
- instanceLocation,
20839
- keyword: "const",
20840
- keywordLocation: `${schemaLocation}/const`,
20841
- error: `Instance does not match ${JSON.stringify($const)}.`
20842
- });
20843
- }
20844
- }
20845
- if ($enum !== void 0) {
20846
- if (instanceType === "object" || instanceType === "array") {
20847
- if (!$enum.some((value) => deepCompareStrict(instance, value))) {
20848
- errors.push({
20849
- instanceLocation,
20850
- keyword: "enum",
20851
- keywordLocation: `${schemaLocation}/enum`,
20852
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
20853
- });
20854
- }
20855
- } else if (!$enum.some((value) => instance === value)) {
20856
- errors.push({
20857
- instanceLocation,
20858
- keyword: "enum",
20859
- keywordLocation: `${schemaLocation}/enum`,
20860
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
20861
- });
20862
- }
20863
- }
20864
- if ($not !== void 0) {
20865
- const keywordLocation = `${schemaLocation}/not`;
20866
- const result2 = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);
20867
- if (result2.valid) {
20868
- errors.push({
20869
- instanceLocation,
20870
- keyword: "not",
20871
- keywordLocation,
20872
- error: 'Instance matched "not" schema.'
20873
- });
20874
- }
20875
- }
20876
- let subEvaluateds = [];
20877
- if ($anyOf !== void 0) {
20878
- const keywordLocation = `${schemaLocation}/anyOf`;
20879
- const errorsLength = errors.length;
20880
- let anyValid = false;
20881
- for (const [i, subSchema] of $anyOf.entries()) {
20882
- const subEvaluated = Object.create(evaluated);
20883
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20884
- errors.push(...result2.errors);
20885
- anyValid = anyValid || result2.valid;
20886
- if (result2.valid) {
20887
- subEvaluateds.push(subEvaluated);
20888
- }
20889
- }
20890
- if (anyValid) {
20891
- errors.length = errorsLength;
20892
- } else {
20893
- errors.splice(errorsLength, 0, {
20894
- instanceLocation,
20895
- keyword: "anyOf",
20896
- keywordLocation,
20897
- error: "Instance does not match any subschemas."
20898
- });
20899
- }
20900
- }
20901
- if ($allOf !== void 0) {
20902
- const keywordLocation = `${schemaLocation}/allOf`;
20903
- const errorsLength = errors.length;
20904
- let allValid = true;
20905
- for (const [i, subSchema] of $allOf.entries()) {
20906
- const subEvaluated = Object.create(evaluated);
20907
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20908
- errors.push(...result2.errors);
20909
- allValid = allValid && result2.valid;
20910
- if (result2.valid) {
20911
- subEvaluateds.push(subEvaluated);
20912
- }
20913
- }
20914
- if (allValid) {
20915
- errors.length = errorsLength;
20916
- } else {
20917
- errors.splice(errorsLength, 0, {
20918
- instanceLocation,
20919
- keyword: "allOf",
20920
- keywordLocation,
20921
- error: `Instance does not match every subschema.`
20922
- });
20923
- }
20924
- }
20925
- if ($oneOf !== void 0) {
20926
- const keywordLocation = `${schemaLocation}/oneOf`;
20927
- const errorsLength = errors.length;
20928
- const matches = $oneOf.filter((subSchema, i) => {
20929
- const subEvaluated = Object.create(evaluated);
20930
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20931
- errors.push(...result2.errors);
20932
- if (result2.valid) {
20933
- subEvaluateds.push(subEvaluated);
20934
- }
20935
- return result2.valid;
20936
- }).length;
20937
- if (matches === 1) {
20938
- errors.length = errorsLength;
20939
- } else {
20940
- errors.splice(errorsLength, 0, {
20941
- instanceLocation,
20942
- keyword: "oneOf",
20943
- keywordLocation,
20944
- error: `Instance does not match exactly one subschema (${matches} matches).`
20945
- });
20946
- }
20947
- }
20948
- if (instanceType === "object" || instanceType === "array") {
20949
- Object.assign(evaluated, ...subEvaluateds);
20950
- }
20951
- if ($if !== void 0) {
20952
- const keywordLocation = `${schemaLocation}/if`;
20953
- const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;
20954
- if (conditionResult) {
20955
- if ($then !== void 0) {
20956
- const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
20957
- if (!thenResult.valid) {
20958
- errors.push({
20959
- instanceLocation,
20960
- keyword: "if",
20961
- keywordLocation,
20962
- error: `Instance does not match "then" schema.`
20963
- }, ...thenResult.errors);
20964
- }
20965
- }
20966
- } else if ($else !== void 0) {
20967
- const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
20968
- if (!elseResult.valid) {
20969
- errors.push({
20970
- instanceLocation,
20971
- keyword: "if",
20972
- keywordLocation,
20973
- error: `Instance does not match "else" schema.`
20974
- }, ...elseResult.errors);
20975
- }
20976
- }
20977
- }
20978
- if (instanceType === "object") {
20979
- if ($required !== void 0) {
20980
- for (const key of $required) {
20981
- if (!hasOwnProperty(instance, key)) {
20982
- errors.push({
20983
- instanceLocation,
20984
- keyword: "required",
20985
- keywordLocation: `${schemaLocation}/required`,
20986
- error: `Instance does not have required property "${key}".`
20987
- });
20988
- }
20989
- }
20990
- }
20991
- const keys = Object.keys(instance);
20992
- if ($minProperties !== void 0 && keys.length < $minProperties) {
20993
- errors.push({
20994
- instanceLocation,
20995
- keyword: "minProperties",
20996
- keywordLocation: `${schemaLocation}/minProperties`,
20997
- error: `Instance does not have at least ${$minProperties} properties.`
20998
- });
20999
- }
21000
- if ($maxProperties !== void 0 && keys.length > $maxProperties) {
21001
- errors.push({
21002
- instanceLocation,
21003
- keyword: "maxProperties",
21004
- keywordLocation: `${schemaLocation}/maxProperties`,
21005
- error: `Instance does not have at least ${$maxProperties} properties.`
21006
- });
21007
- }
21008
- if ($propertyNames !== void 0) {
21009
- const keywordLocation = `${schemaLocation}/propertyNames`;
21010
- for (const key in instance) {
21011
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21012
- const result2 = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21013
- if (!result2.valid) {
21014
- errors.push({
21015
- instanceLocation,
21016
- keyword: "propertyNames",
21017
- keywordLocation,
21018
- error: `Property name "${key}" does not match schema.`
21019
- }, ...result2.errors);
21020
- }
21021
- }
21022
- }
21023
- if ($dependentRequired !== void 0) {
21024
- const keywordLocation = `${schemaLocation}/dependantRequired`;
21025
- for (const key in $dependentRequired) {
21026
- if (hasOwnProperty(instance, key)) {
21027
- const required2 = $dependentRequired[key];
21028
- for (const dependantKey of required2) {
21029
- if (!hasOwnProperty(instance, dependantKey)) {
21030
- errors.push({
21031
- instanceLocation,
21032
- keyword: "dependentRequired",
21033
- keywordLocation,
21034
- error: `Instance has "${key}" but does not have "${dependantKey}".`
21035
- });
21036
- }
21037
- }
21038
- }
21039
- }
21040
- }
21041
- if ($dependentSchemas !== void 0) {
21042
- for (const [key, dependentSchema] of Object.entries($dependentSchemas)) {
21043
- const keywordLocation = `${schemaLocation}/dependentSchemas`;
21044
- if (hasOwnProperty(instance, key)) {
21045
- const result2 = validate(instance, dependentSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
21046
- if (!result2.valid) {
21047
- errors.push({
21048
- instanceLocation,
21049
- keyword: "dependentSchemas",
21050
- keywordLocation,
21051
- error: `Instance has "${key}" but does not match dependant schema.`
21052
- }, ...result2.errors);
21053
- }
21054
- }
21055
- }
21056
- }
21057
- if ($dependencies !== void 0) {
21058
- const keywordLocation = `${schemaLocation}/dependencies`;
21059
- for (const key in $dependencies) {
21060
- if (hasOwnProperty(instance, key)) {
21061
- const propsOrSchema = $dependencies[key];
21062
- if (Array.isArray(propsOrSchema)) {
21063
- for (const dependantKey of propsOrSchema) {
21064
- if (!hasOwnProperty(instance, dependantKey)) {
21065
- errors.push({
21066
- instanceLocation,
21067
- keyword: "dependencies",
21068
- keywordLocation,
21069
- error: `Instance has "${key}" but does not have "${dependantKey}".`
21070
- });
21071
- }
21072
- }
21073
- } else {
21074
- const result2 = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
21075
- if (!result2.valid) {
21076
- errors.push({
21077
- instanceLocation,
21078
- keyword: "dependencies",
21079
- keywordLocation,
21080
- error: `Instance has "${key}" but does not match dependant schema.`
21081
- }, ...result2.errors);
21082
- }
21083
- }
21084
- }
21085
- }
21086
- }
21087
- const thisEvaluated = /* @__PURE__ */ Object.create(null);
21088
- let stop = false;
21089
- if ($properties !== void 0) {
21090
- const keywordLocation = `${schemaLocation}/properties`;
21091
- for (const [key, propertySchema] of Object.entries($properties)) {
21092
- if (!hasOwnProperty(instance, key)) {
21093
- continue;
21094
- }
21095
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21096
- const result2 = validate(instance[key], propertySchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
21097
- thisEvaluated[key] = true;
21098
- if (result2.valid) {
21099
- evaluated[key] = true;
21100
- } else {
21101
- stop = shortCircuit;
21102
- errors.push({
21103
- instanceLocation,
21104
- keyword: "properties",
21105
- keywordLocation,
21106
- error: `Property "${key}" does not match schema.`
21107
- }, ...result2.errors);
21108
- if (stop)
21109
- break;
21110
- }
21111
- }
21112
- }
21113
- if (!stop && $patternProperties !== void 0) {
21114
- const keywordLocation = `${schemaLocation}/patternProperties`;
21115
- for (const [pattern, subSchema] of Object.entries($patternProperties)) {
21116
- const regex2 = new RegExp(pattern, "u");
21117
- for (const key in instance) {
21118
- if (!regex2.test(key)) {
21119
- continue;
21120
- }
21121
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21122
- const result2 = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
21123
- thisEvaluated[key] = true;
21124
- if (result2.valid) {
21125
- evaluated[key] = true;
21126
- } else {
21127
- stop = shortCircuit;
21128
- errors.push({
21129
- instanceLocation,
21130
- keyword: "patternProperties",
21131
- keywordLocation,
21132
- error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
21133
- }, ...result2.errors);
21134
- }
21135
- }
21136
- }
21137
- }
21138
- if (!stop && $additionalProperties !== void 0) {
21139
- const keywordLocation = `${schemaLocation}/additionalProperties`;
21140
- for (const key in instance) {
21141
- if (thisEvaluated[key]) {
21142
- continue;
21143
- }
21144
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21145
- const result2 = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21146
- if (result2.valid) {
21147
- evaluated[key] = true;
21148
- } else {
21149
- stop = shortCircuit;
21150
- errors.push({
21151
- instanceLocation,
21152
- keyword: "additionalProperties",
21153
- keywordLocation,
21154
- error: `Property "${key}" does not match additional properties schema.`
21155
- }, ...result2.errors);
21156
- }
21157
- }
21158
- } else if (!stop && $unevaluatedProperties !== void 0) {
21159
- const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
21160
- for (const key in instance) {
21161
- if (!evaluated[key]) {
21162
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
21163
- const result2 = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
21164
- if (result2.valid) {
21165
- evaluated[key] = true;
21166
- } else {
21167
- errors.push({
21168
- instanceLocation,
21169
- keyword: "unevaluatedProperties",
21170
- keywordLocation,
21171
- error: `Property "${key}" does not match unevaluated properties schema.`
21172
- }, ...result2.errors);
21173
- }
21174
- }
21175
- }
21176
- }
21177
- } else if (instanceType === "array") {
21178
- if ($maxItems !== void 0 && instance.length > $maxItems) {
21179
- errors.push({
21180
- instanceLocation,
21181
- keyword: "maxItems",
21182
- keywordLocation: `${schemaLocation}/maxItems`,
21183
- error: `Array has too many items (${instance.length} > ${$maxItems}).`
21184
- });
21185
- }
21186
- if ($minItems !== void 0 && instance.length < $minItems) {
21187
- errors.push({
21188
- instanceLocation,
21189
- keyword: "minItems",
21190
- keywordLocation: `${schemaLocation}/minItems`,
21191
- error: `Array has too few items (${instance.length} < ${$minItems}).`
21192
- });
21193
- }
21194
- const length = instance.length;
21195
- let i = 0;
21196
- let stop = false;
21197
- if ($prefixItems !== void 0) {
21198
- const keywordLocation = `${schemaLocation}/prefixItems`;
21199
- const length2 = Math.min($prefixItems.length, length);
21200
- for (; i < length2; i++) {
21201
- const result2 = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
21202
- evaluated[i] = true;
21203
- if (!result2.valid) {
21204
- stop = shortCircuit;
21205
- errors.push({
21206
- instanceLocation,
21207
- keyword: "prefixItems",
21208
- keywordLocation,
21209
- error: `Items did not match schema.`
21210
- }, ...result2.errors);
21211
- if (stop)
21212
- break;
21213
- }
21214
- }
21215
- }
21216
- if ($items !== void 0) {
21217
- const keywordLocation = `${schemaLocation}/items`;
21218
- if (Array.isArray($items)) {
21219
- const length2 = Math.min($items.length, length);
21220
- for (; i < length2; i++) {
21221
- const result2 = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
21222
- evaluated[i] = true;
21223
- if (!result2.valid) {
21224
- stop = shortCircuit;
21225
- errors.push({
21226
- instanceLocation,
21227
- keyword: "items",
21228
- keywordLocation,
21229
- error: `Items did not match schema.`
21230
- }, ...result2.errors);
21231
- if (stop)
21232
- break;
21233
- }
21234
- }
21235
- } else {
21236
- for (; i < length; i++) {
21237
- const result2 = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
21238
- evaluated[i] = true;
21239
- if (!result2.valid) {
21240
- stop = shortCircuit;
21241
- errors.push({
21242
- instanceLocation,
21243
- keyword: "items",
21244
- keywordLocation,
21245
- error: `Items did not match schema.`
21246
- }, ...result2.errors);
21247
- if (stop)
21248
- break;
21249
- }
21250
- }
21251
- }
21252
- if (!stop && $additionalItems !== void 0) {
21253
- const keywordLocation2 = `${schemaLocation}/additionalItems`;
21254
- for (; i < length; i++) {
21255
- const result2 = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation2);
21256
- evaluated[i] = true;
21257
- if (!result2.valid) {
21258
- stop = shortCircuit;
21259
- errors.push({
21260
- instanceLocation,
21261
- keyword: "additionalItems",
21262
- keywordLocation: keywordLocation2,
21263
- error: `Items did not match additional items schema.`
21264
- }, ...result2.errors);
21265
- }
21266
- }
21267
- }
21268
- }
21269
- if ($contains !== void 0) {
21270
- if (length === 0 && $minContains === void 0) {
21271
- errors.push({
21272
- instanceLocation,
21273
- keyword: "contains",
21274
- keywordLocation: `${schemaLocation}/contains`,
21275
- error: `Array is empty. It must contain at least one item matching the schema.`
21276
- });
21277
- } else if ($minContains !== void 0 && length < $minContains) {
21278
- errors.push({
21279
- instanceLocation,
21280
- keyword: "minContains",
21281
- keywordLocation: `${schemaLocation}/minContains`,
21282
- error: `Array has less items (${length}) than minContains (${$minContains}).`
21283
- });
21284
- } else {
21285
- const keywordLocation = `${schemaLocation}/contains`;
21286
- const errorsLength = errors.length;
21287
- let contained = 0;
21288
- for (let j = 0; j < length; j++) {
21289
- const result2 = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
21290
- if (result2.valid) {
21291
- evaluated[j] = true;
21292
- contained++;
21293
- } else {
21294
- errors.push(...result2.errors);
21295
- }
21296
- }
21297
- if (contained >= ($minContains || 0)) {
21298
- errors.length = errorsLength;
21299
- }
21300
- if ($minContains === void 0 && contained === 0) {
21301
- errors.splice(errorsLength, 0, {
21302
- instanceLocation,
21303
- keyword: "contains",
21304
- keywordLocation,
21305
- error: `Array does not contain item matching schema.`
21306
- });
21307
- } else if ($minContains !== void 0 && contained < $minContains) {
21308
- errors.push({
21309
- instanceLocation,
21310
- keyword: "minContains",
21311
- keywordLocation: `${schemaLocation}/minContains`,
21312
- error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
21313
- });
21314
- } else if ($maxContains !== void 0 && contained > $maxContains) {
21315
- errors.push({
21316
- instanceLocation,
21317
- keyword: "maxContains",
21318
- keywordLocation: `${schemaLocation}/maxContains`,
21319
- error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
21320
- });
21321
- }
21322
- }
21323
- }
21324
- if (!stop && $unevaluatedItems !== void 0) {
21325
- const keywordLocation = `${schemaLocation}/unevaluatedItems`;
21326
- for (i; i < length; i++) {
21327
- if (evaluated[i]) {
21328
- continue;
21329
- }
21330
- const result2 = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
21331
- evaluated[i] = true;
21332
- if (!result2.valid) {
21333
- errors.push({
21334
- instanceLocation,
21335
- keyword: "unevaluatedItems",
21336
- keywordLocation,
21337
- error: `Items did not match unevaluated items schema.`
21338
- }, ...result2.errors);
21339
- }
21340
- }
21341
- }
21342
- if ($uniqueItems) {
21343
- for (let j = 0; j < length; j++) {
21344
- const a = instance[j];
21345
- const ao = typeof a === "object" && a !== null;
21346
- for (let k = 0; k < length; k++) {
21347
- if (j === k) {
21348
- continue;
21349
- }
21350
- const b = instance[k];
21351
- const bo = typeof b === "object" && b !== null;
21352
- if (a === b || ao && bo && deepCompareStrict(a, b)) {
21353
- errors.push({
21354
- instanceLocation,
21355
- keyword: "uniqueItems",
21356
- keywordLocation: `${schemaLocation}/uniqueItems`,
21357
- error: `Duplicate items at indexes ${j} and ${k}.`
21358
- });
21359
- j = Number.MAX_SAFE_INTEGER;
21360
- k = Number.MAX_SAFE_INTEGER;
21361
- }
21362
- }
21363
- }
21364
- }
21365
- } else if (instanceType === "number") {
21366
- if (draft === "4") {
21367
- if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) {
21368
- errors.push({
21369
- instanceLocation,
21370
- keyword: "minimum",
21371
- keywordLocation: `${schemaLocation}/minimum`,
21372
- error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
21373
- });
21374
- }
21375
- if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) {
21376
- errors.push({
21377
- instanceLocation,
21378
- keyword: "maximum",
21379
- keywordLocation: `${schemaLocation}/maximum`,
21380
- error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
21381
- });
21382
- }
21383
- } else {
21384
- if ($minimum !== void 0 && instance < $minimum) {
21385
- errors.push({
21386
- instanceLocation,
21387
- keyword: "minimum",
21388
- keywordLocation: `${schemaLocation}/minimum`,
21389
- error: `${instance} is less than ${$minimum}.`
21390
- });
21391
- }
21392
- if ($maximum !== void 0 && instance > $maximum) {
21393
- errors.push({
21394
- instanceLocation,
21395
- keyword: "maximum",
21396
- keywordLocation: `${schemaLocation}/maximum`,
21397
- error: `${instance} is greater than ${$maximum}.`
21398
- });
21399
- }
21400
- if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) {
21401
- errors.push({
21402
- instanceLocation,
21403
- keyword: "exclusiveMinimum",
21404
- keywordLocation: `${schemaLocation}/exclusiveMinimum`,
21405
- error: `${instance} is less than ${$exclusiveMinimum}.`
21406
- });
21407
- }
21408
- if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) {
21409
- errors.push({
21410
- instanceLocation,
21411
- keyword: "exclusiveMaximum",
21412
- keywordLocation: `${schemaLocation}/exclusiveMaximum`,
21413
- error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
21414
- });
21415
- }
21416
- }
21417
- if ($multipleOf !== void 0) {
21418
- if (!isMultipleOf(instance, $multipleOf)) {
21419
- errors.push({
21420
- instanceLocation,
21421
- keyword: "multipleOf",
21422
- keywordLocation: `${schemaLocation}/multipleOf`,
21423
- error: `${instance} is not a multiple of ${$multipleOf}.`
21424
- });
21425
- }
21426
- }
21427
- } else if (instanceType === "string") {
21428
- const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
21429
- if ($minLength !== void 0 && length < $minLength) {
21430
- errors.push({
21431
- instanceLocation,
21432
- keyword: "minLength",
21433
- keywordLocation: `${schemaLocation}/minLength`,
21434
- error: `String is too short (${length} < ${$minLength}).`
21435
- });
21436
- }
21437
- if ($maxLength !== void 0 && length > $maxLength) {
21438
- errors.push({
21439
- instanceLocation,
21440
- keyword: "maxLength",
21441
- keywordLocation: `${schemaLocation}/maxLength`,
21442
- error: `String is too long (${length} > ${$maxLength}).`
21443
- });
21444
- }
21445
- if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) {
21446
- errors.push({
21447
- instanceLocation,
21448
- keyword: "pattern",
21449
- keywordLocation: `${schemaLocation}/pattern`,
21450
- error: `String does not match pattern.`
21451
- });
21452
- }
21453
- if ($format !== void 0 && format[$format] && !format[$format](instance)) {
21454
- errors.push({
21455
- instanceLocation,
21456
- keyword: "format",
21457
- keywordLocation: `${schemaLocation}/format`,
21458
- error: `String does not match format "${$format}".`
21459
- });
21460
- }
21461
- }
21462
- return { valid: errors.length === 0, errors };
21463
- }
21464
-
21465
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.4/node_modules/@cfworker/json-schema/dist/esm/validator.js
21466
- var Validator = class {
21467
- schema;
21468
- draft;
21469
- shortCircuit;
21470
- lookup;
21471
- constructor(schema, draft = "2019-09", shortCircuit = true) {
21472
- this.schema = schema;
21473
- this.draft = draft;
21474
- this.shortCircuit = shortCircuit;
21475
- this.lookup = dereference(schema);
21476
- }
21477
- validate(instance) {
21478
- return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
21479
- }
21480
- addSchema(schema, id) {
21481
- if (id) {
21482
- schema = { ...schema, $id: id };
21483
- }
21484
- dereference(schema, this.lookup);
21485
- }
21486
- };
21487
-
21488
- // ../../node_modules/.pnpm/@mcp-b+webmcp-polyfill@3.0.0/node_modules/@mcp-b/webmcp-polyfill/dist/index.js
21489
- var FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE = "Failed to parse input arguments";
21490
- var TOOL_INVOCATION_FAILED_MESSAGE = "Tool was executed but the invocation failed. For example, the script function threw an error";
21491
- var TOOL_CANCELLED_MESSAGE = "Tool was cancelled";
21492
- var DEFAULT_INPUT_SCHEMA = {
21493
- type: "object",
21494
- properties: {}
21495
- };
21496
- var STANDARD_JSON_SCHEMA_TARGETS = ["draft-2020-12", "draft-07"];
21497
- var POLYFILL_MARKER_PROPERTY = "__isWebMCPPolyfill";
21498
- var STANDARD_VALIDATOR_SYMBOL = Symbol("standardValidator");
21499
- var installState = {
21500
- installed: false,
21501
- previousNavigatorModelContextDescriptor: void 0,
21502
- previousNavigatorModelContextTestingDescriptor: void 0,
21503
- previousDocumentModelContextDescriptor: void 0,
21504
- installedNavigatorModelContext: false,
21505
- installedNavigatorModelContextTesting: false,
21506
- installedDocumentModelContext: false
21507
- };
21508
- var StrictWebMCPContext = class extends EventTarget {
21509
- tools = /* @__PURE__ */ new Map();
21510
- testingShim = null;
21511
- _ontoolchange = null;
21512
- unregisterToolDeprecationWarned = false;
21513
- get ontoolchange() {
21514
- return this._ontoolchange;
21515
- }
21516
- set ontoolchange(handler) {
21517
- this._ontoolchange = handler;
21518
- }
21519
- registerTool(tool, options) {
21520
- const signal2 = options?.signal;
21521
- if (signal2?.aborted) {
21522
- console.warn(`[WebMCPPolyfill] registerTool("${tool?.name ?? "<unknown>"}") skipped: options.signal was already aborted.`);
21523
- return;
21524
- }
21525
- const normalized = normalizeToolDescriptor(tool, this.tools);
21526
- this.tools.set(normalized.name, normalized);
21527
- this.notifyToolsChanged();
21528
- if (signal2) signal2.addEventListener("abort", () => {
21529
- if (this.tools.delete(normalized.name)) this.notifyToolsChanged();
21530
- }, { once: true });
21531
- }
21532
- unregisterTool(nameOrTool) {
21533
- this.warnUnregisterToolDeprecationOnce();
21534
- const name = getToolNameForUnregister(nameOrTool);
21535
- if (this.tools.delete(name)) this.notifyToolsChanged();
21536
- }
21537
- getTools() {
21538
- return Promise.resolve(this.getRegisteredToolInfos());
21539
- }
21540
- executeTool(tool, inputArgsJson, options) {
21541
- return this.executeToolByName(tool.name, inputArgsJson, options, false);
21542
- }
21543
- getTestingShim() {
21544
- if (!this.testingShim) this.testingShim = new PolyfillTestingShim(this);
21545
- return this.testingShim;
21546
- }
21547
- /** @internal Used by PolyfillTestingShim */
21548
- getToolInfos() {
21549
- return [...this.tools.values()].map((tool) => {
21550
- let inputSchema2;
21551
- try {
21552
- inputSchema2 = JSON.stringify(tool.inputSchema ?? { type: "object" });
21553
- } catch {
21554
- inputSchema2 = '{"type":"object"}';
21555
- }
21556
- return {
21557
- name: tool.name,
21558
- description: tool.description,
21559
- inputSchema: inputSchema2
21560
- };
21561
- });
21562
- }
21563
- /** @internal Used by getTools() */
21564
- getRegisteredToolInfos() {
21565
- return this.getToolInfos().map((toolInfo) => {
21566
- const tool = this.tools.get(toolInfo.name);
21567
- return {
21568
- ...toolInfo,
21569
- title: tool?.title ?? "",
21570
- origin: globalThis.location?.origin ?? "",
21571
- window: globalThis.window
21572
- };
21573
- });
21574
- }
21575
- /** @internal Used by PolyfillTestingShim */
21576
- async executeToolForTesting(toolName, inputArgsJson, options) {
21577
- return this.executeToolByName(toolName, inputArgsJson, options, true);
21578
- }
21579
- async executeToolByName(toolName, inputArgsJson, options, normalizeResult) {
21580
- if (options?.signal?.aborted) throw createUnknownError(TOOL_CANCELLED_MESSAGE);
21581
- const tool = this.tools.get(toolName);
21582
- if (!tool) throw createUnknownError(`Tool not found: ${toolName}`);
21583
- const args = parseInputArgsJson(inputArgsJson);
21584
- const validationError = await validateArgsForTool(args, tool);
21585
- if (validationError) throw createUnknownError(validationError);
21586
- let contextActive = true;
21587
- const client = { requestUserInteraction: async (callback) => {
21588
- if (!contextActive) throw new Error(`ModelContextClient for tool "${toolName}" is no longer active after execute() resolved`);
21589
- if (typeof callback !== "function") throw new TypeError("requestUserInteraction(callback) requires a function callback");
21590
- return callback();
21591
- } };
21592
- try {
21593
- const execution = tool.execute(args, client);
21594
- const rawResult = await withAbortSignal(Promise.resolve(execution), options?.signal);
21595
- if (normalizeResult) return toSerializedTestingResult(normalizeToolResponse(rawResult));
21596
- const serialized = JSON.stringify(rawResult);
21597
- return serialized === void 0 ? null : serialized;
21598
- } catch (error2) {
21599
- throw createUnknownError(error2 instanceof Error ? `${TOOL_INVOCATION_FAILED_MESSAGE}: ${error2.message}` : TOOL_INVOCATION_FAILED_MESSAGE);
21600
- } finally {
21601
- contextActive = false;
21602
- }
21603
- }
21604
- notifyToolsChanged() {
21605
- queueMicrotask(() => {
21606
- const event = new Event("toolchange");
21607
- try {
21608
- this._ontoolchange?.call(this, event);
21609
- } catch (error2) {
21610
- console.warn("[WebMCPPolyfill] navigator.modelContext.ontoolchange handler threw:", error2);
21611
- }
21612
- this.dispatchEvent(event);
21613
- this.testingShim?.dispatchToolChange();
21614
- });
21615
- }
21616
- warnUnregisterToolDeprecationOnce() {
21617
- if (this.unregisterToolDeprecationWarned) return;
21618
- this.unregisterToolDeprecationWarned = true;
21619
- console.warn("[WebMCPPolyfill] navigator.modelContext.unregisterTool() is deprecated. The April 23, 2026 WebMCP draft removed it in favor of registerTool(tool, { signal }) \u2014 pass an AbortSignal and abort it to unregister.");
21620
- }
21621
- };
21622
- var PolyfillTestingShim = class extends EventTarget {
21623
- context;
21624
- _ontoolchange = null;
21625
- constructor(context) {
21626
- super();
21627
- this.context = context;
21628
- }
21629
- listTools() {
21630
- return this.context.getToolInfos();
21631
- }
21632
- executeTool(toolName, inputArgsJson, options) {
21633
- return this.context.executeToolForTesting(toolName, inputArgsJson, options);
21634
- }
21635
- getCrossDocumentScriptToolResult() {
21636
- return Promise.resolve("[]");
21637
- }
21638
- get ontoolchange() {
21639
- return this._ontoolchange;
21640
- }
21641
- set ontoolchange(handler) {
21642
- this._ontoolchange = handler;
21643
- }
21644
- /**
21645
- * @deprecated Use `addEventListener('toolchange', callback)` instead.
21646
- * Kept for backward compatibility with older polyfill consumers.
21647
- */
21648
- registerToolsChangedCallback(callback) {
21649
- if (typeof callback !== "function") throw new TypeError("Failed to execute 'registerToolsChangedCallback' on 'ModelContextTesting': parameter 1 is not of type 'Function'.");
21650
- this.addEventListener("toolchange", callback);
21651
- }
21652
- /** @internal Called by StrictWebMCPContext when tools change. */
21653
- dispatchToolChange() {
21654
- const event = new Event("toolchange");
21655
- try {
21656
- this._ontoolchange?.call(this, event);
21657
- } catch (error2) {
21658
- console.warn("[WebMCPPolyfill] ontoolchange handler threw:", error2);
21659
- }
21660
- this.dispatchEvent(event);
21661
- this.dispatchEvent(new Event("toolschanged"));
21662
- }
21663
- };
21664
- function createUnknownError(message) {
21665
- try {
21666
- return new DOMException(message, "UnknownError");
21667
- } catch {
21668
- const error2 = new Error(message);
21669
- error2.name = "UnknownError";
21670
- return error2;
21671
- }
21672
- }
21673
- function parseInputArgsJson(inputArgsJson) {
21674
- let parsed;
21675
- try {
21676
- parsed = JSON.parse(inputArgsJson);
21677
- } catch {
21678
- throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21679
- }
21680
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21681
- return parsed;
21682
- }
21683
- function getToolNameForUnregister(nameOrTool) {
21684
- if (typeof nameOrTool === "string") return nameOrTool;
21685
- if (isPlainObject2(nameOrTool) && typeof nameOrTool.name === "string") return nameOrTool.name;
21686
- throw new TypeError("Failed to execute 'unregisterTool' on 'ModelContext': parameter 1 must be a string or an object with a string name.");
21687
- }
21688
- function isPlainObject2(value) {
21689
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
21690
- }
21691
- function getStandardProps(value) {
21692
- if (!isPlainObject2(value)) return null;
21693
- const standard = value["~standard"];
21694
- if (!isPlainObject2(standard)) return null;
21695
- return standard;
21696
- }
21697
- function isStandardInputValidatorSchema(value) {
21698
- const standard = getStandardProps(value);
21699
- return Boolean(standard && standard.version === 1 && typeof standard.validate === "function");
21700
- }
21701
- function isStandardInputJsonSchema(value) {
21702
- const standard = getStandardProps(value);
21703
- if (!standard || standard.version !== 1 || !isPlainObject2(standard.jsonSchema)) return false;
21704
- return typeof standard.jsonSchema.input === "function";
21705
- }
21706
- function createStandardValidatorFromJsonSchema(schema) {
21707
- return { "~standard": {
21708
- version: 1,
21709
- vendor: "@mcp-b/webmcp-polyfill-json-schema",
21710
- validate(value) {
21711
- if (!isPlainObject2(value)) return { issues: [{ message: "expected object arguments" }] };
21712
- const issue2 = validateArgsWithSchema(value, schema);
21713
- if (issue2) return { issues: [issue2] };
21714
- return { value };
21715
- }
21716
- } };
21717
- }
21718
- function convertStandardInputSchema(schema) {
21719
- for (const target of STANDARD_JSON_SCHEMA_TARGETS) try {
21720
- const converted = schema["~standard"].jsonSchema.input({ target });
21721
- validateInputSchema(converted);
21722
- return converted;
21723
- } catch (error2) {
21724
- console.warn(`[WebMCPPolyfill] Standard JSON Schema conversion failed for target "${target}":`, error2);
21725
- }
21726
- throw new Error("Failed to convert Standard JSON Schema inputSchema to a JSON Schema object");
21727
- }
21728
- function normalizeInputSchema(inputSchema2) {
21729
- if (inputSchema2 === void 0) {
21730
- const normalized = DEFAULT_INPUT_SCHEMA;
21731
- return {
21732
- inputSchema: normalized,
21733
- standardValidator: createStandardValidatorFromJsonSchema(normalized)
21734
- };
21735
- }
21736
- if (isStandardInputJsonSchema(inputSchema2)) {
21737
- const converted = convertStandardInputSchema(inputSchema2);
21738
- return {
21739
- inputSchema: converted,
21740
- standardValidator: createStandardValidatorFromJsonSchema(converted)
21741
- };
21742
- }
21743
- if (isStandardInputValidatorSchema(inputSchema2)) return {
21744
- inputSchema: DEFAULT_INPUT_SCHEMA,
21745
- standardValidator: inputSchema2
21746
- };
21747
- validateInputSchema(inputSchema2);
21748
- if (Object.keys(inputSchema2).length === 0) return {
21749
- inputSchema: DEFAULT_INPUT_SCHEMA,
21750
- standardValidator: createStandardValidatorFromJsonSchema(DEFAULT_INPUT_SCHEMA)
21751
- };
21752
- const normalizedSchema = inputSchema2.type === void 0 ? {
21753
- type: "object",
21754
- ...inputSchema2
21755
- } : inputSchema2;
21756
- return {
21757
- inputSchema: normalizedSchema,
21758
- standardValidator: createStandardValidatorFromJsonSchema(normalizedSchema)
21759
- };
21760
- }
21761
- function validateInputSchema(schema) {
21762
- if (!isPlainObject2(schema)) throw new Error("inputSchema must be a JSON Schema object");
21763
- validateJsonSchemaNode(schema, "$");
21764
- }
21765
- function validateJsonSchemaNode(node, path) {
21766
- const typeValue = node.type;
21767
- if (typeValue !== void 0 && typeof typeValue !== "string" && !(Array.isArray(typeValue) && typeValue.every((entry) => typeof entry === "string" && entry.length > 0))) throw new Error(`Invalid JSON Schema at ${path}: "type" must be a string or string[]`);
21768
- const requiredValue = node.required;
21769
- if (requiredValue !== void 0 && !(Array.isArray(requiredValue) && requiredValue.every((entry) => typeof entry === "string"))) throw new Error(`Invalid JSON Schema at ${path}: "required" must be an array of strings`);
21770
- const propertiesValue = node.properties;
21771
- if (propertiesValue !== void 0) {
21772
- if (!isPlainObject2(propertiesValue)) throw new Error(`Invalid JSON Schema at ${path}: "properties" must be an object`);
21773
- for (const [key, value] of Object.entries(propertiesValue)) {
21774
- if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.properties.${key}: expected object schema`);
21775
- validateJsonSchemaNode(value, `${path}.properties.${key}`);
21776
- }
21777
- }
21778
- const itemsValue = node.items;
21779
- if (itemsValue !== void 0) if (Array.isArray(itemsValue)) for (const [index, value] of itemsValue.entries()) {
21780
- if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.items[${index}]: expected object schema`);
21781
- validateJsonSchemaNode(value, `${path}.items[${index}]`);
21782
- }
21783
- else if (isPlainObject2(itemsValue)) validateJsonSchemaNode(itemsValue, `${path}.items`);
21784
- else throw new Error(`Invalid JSON Schema at ${path}: "items" must be an object or object[]`);
21785
- for (const keyword of [
21786
- "allOf",
21787
- "anyOf",
21788
- "oneOf"
21789
- ]) {
21790
- const value = node[keyword];
21791
- if (value === void 0) continue;
21792
- if (!Array.isArray(value)) throw new Error(`Invalid JSON Schema at ${path}: "${keyword}" must be an array`);
21793
- for (const [index, entry] of value.entries()) {
21794
- if (!isPlainObject2(entry)) throw new Error(`Invalid JSON Schema at ${path}.${keyword}[${index}]: expected object schema`);
21795
- validateJsonSchemaNode(entry, `${path}.${keyword}[${index}]`);
21796
- }
21797
- }
21798
- const notValue = node.not;
21799
- if (notValue !== void 0) {
21800
- if (!isPlainObject2(notValue)) throw new Error(`Invalid JSON Schema at ${path}: "not" must be an object schema`);
21801
- validateJsonSchemaNode(notValue, `${path}.not`);
21802
- }
21803
- try {
21804
- JSON.stringify(node);
21805
- } catch {
21806
- throw new Error(`Invalid JSON Schema at ${path}: schema must be JSON-serializable`);
21807
- }
21808
- }
21809
- function normalizeToolDescriptor(tool, existing) {
21810
- if (!tool || typeof tool !== "object") throw new TypeError("registerTool(tool) requires a tool object");
21811
- if (typeof tool.name !== "string" || tool.name.length === 0) throw new TypeError('Tool "name" must be a non-empty string');
21812
- if (typeof tool.description !== "string" || tool.description.length === 0) throw new TypeError('Tool "description" must be a non-empty string');
21813
- if (typeof tool.execute !== "function") throw new TypeError('Tool "execute" must be a function');
21814
- if (existing.has(tool.name)) throw new Error(`Tool already registered: ${tool.name}`);
21815
- const normalizedInputSchema = normalizeInputSchema(tool.inputSchema);
21816
- const annotations = tool.annotations;
21817
- const normalizedAnnotations = annotations ? {
21818
- ...annotations,
21819
- ...annotations.readOnlyHint === "true" ? { readOnlyHint: true } : annotations.readOnlyHint === "false" ? { readOnlyHint: false } : {},
21820
- ...annotations.destructiveHint === "true" ? { destructiveHint: true } : annotations.destructiveHint === "false" ? { destructiveHint: false } : {},
21821
- ...annotations.idempotentHint === "true" ? { idempotentHint: true } : annotations.idempotentHint === "false" ? { idempotentHint: false } : {},
21822
- ...annotations.openWorldHint === "true" ? { openWorldHint: true } : annotations.openWorldHint === "false" ? { openWorldHint: false } : {}
21823
- } : void 0;
21824
- return {
21825
- ...tool,
21826
- ...normalizedAnnotations ? { annotations: normalizedAnnotations } : {},
21827
- inputSchema: normalizedInputSchema.inputSchema,
21828
- [STANDARD_VALIDATOR_SYMBOL]: normalizedInputSchema.standardValidator
21829
- };
21830
- }
21831
- function validateArgsWithSchema(args, schema) {
21832
- const result2 = new Validator(schema, "2020-12", true).validate(args);
21833
- if (result2.valid) return null;
21834
- const error2 = result2.errors[result2.errors.length - 1];
21835
- if (!error2) return { message: "Input validation failed" };
21836
- return { message: error2.error };
21837
- }
21838
- function formatStandardIssuePath(path) {
21839
- if (!path || path.length === 0) return null;
21840
- const segments = path.map((segment) => {
21841
- if (isPlainObject2(segment) && "key" in segment) return segment.key;
21842
- return segment;
21843
- }).map((segment) => String(segment)).filter((segment) => segment.length > 0);
21844
- if (segments.length === 0) return null;
21845
- return segments.join(".");
21846
- }
21847
- async function validateArgsWithStandardSchema(args, schema) {
21848
- let result2;
21849
- try {
21850
- result2 = await Promise.resolve(schema["~standard"].validate(args));
21851
- } catch (error2) {
21852
- const detail = error2 instanceof Error ? `: ${error2.message}` : "";
21853
- console.error("[WebMCPPolyfill] Standard Schema validation threw unexpectedly:", error2);
21854
- return `Input validation error: schema validation failed${detail}`;
21855
- }
21856
- if (!result2.issues || result2.issues.length === 0) return null;
21857
- const firstIssue = result2.issues[0];
21858
- if (!firstIssue) return "Input validation error";
21859
- const path = formatStandardIssuePath(firstIssue?.path);
21860
- if (path) return `Input validation error: ${firstIssue.message} at ${path}`;
21861
- return `Input validation error: ${firstIssue.message}`;
21862
- }
21863
- async function validateArgsForTool(args, tool) {
21864
- return validateArgsWithStandardSchema(args, tool[STANDARD_VALIDATOR_SYMBOL]);
21865
- }
21866
- function isCallToolResult(value) {
21867
- return isPlainObject2(value) && Array.isArray(value.content);
21868
- }
21869
- function isJsonPrimitive(value) {
21870
- return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
21871
- }
21872
- function isJsonValue(value) {
21873
- if (isJsonPrimitive(value)) return Number.isFinite(value) || typeof value !== "number";
21874
- if (Array.isArray(value)) return value.every((entry) => isJsonValue(entry));
21875
- if (!isPlainObject2(value)) return false;
21876
- return Object.values(value).every((entry) => isJsonValue(entry));
21877
- }
21878
- function toStructuredContent(value) {
21879
- if (!isPlainObject2(value) || !isJsonValue(value)) return;
21880
- return value;
21881
- }
21882
- function serializeTextContent(value) {
21883
- if (typeof value === "string") return value;
21884
- try {
21885
- return JSON.stringify(value) ?? String(value);
21886
- } catch {
21887
- return String(value);
21888
- }
21889
- }
21890
- function normalizeToolResponse(value) {
21891
- if (isCallToolResult(value)) return value;
21892
- const structuredContent = toStructuredContent(value);
21893
- return {
21894
- content: [{
21895
- type: "text",
21896
- text: serializeTextContent(value)
21897
- }],
21898
- ...structuredContent ? { structuredContent } : {},
21899
- isError: false
21900
- };
21901
- }
21902
- function getFirstTextBlock(result2) {
21903
- for (const block of result2.content ?? []) if (block.type === "text" && "text" in block && typeof block.text === "string") return block.text;
21904
- return null;
21905
- }
21906
- function toSerializedTestingResult(result2) {
21907
- if (result2.isError) throw createUnknownError(getFirstTextBlock(result2)?.replace(/^Error:\s*/i, "").trim() || TOOL_INVOCATION_FAILED_MESSAGE);
21908
- const metadata = result2.metadata;
21909
- if (metadata && typeof metadata === "object" && metadata.willNavigate) return null;
21910
- try {
21911
- return JSON.stringify(result2);
21912
- } catch {
21913
- throw createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);
21914
- }
21915
- }
21916
- function withAbortSignal(operation, signal2) {
21917
- if (!signal2) return operation;
21918
- if (signal2.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21919
- return new Promise((resolve, reject) => {
21920
- const onAbort = () => {
21921
- cleanup();
21922
- reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21923
- };
21924
- const cleanup = () => {
21925
- signal2.removeEventListener("abort", onAbort);
21926
- };
21927
- signal2.addEventListener("abort", onAbort, { once: true });
21928
- operation.then((value) => {
21929
- cleanup();
21930
- resolve(value);
21931
- }, (error2) => {
21932
- cleanup();
21933
- reject(error2);
21934
- });
21935
- });
21936
- }
21937
- function getNavigator() {
21938
- if (typeof navigator !== "undefined") return navigator;
21939
- return null;
21940
- }
21941
- function getDocument() {
21942
- if (typeof document !== "undefined") return document;
21943
- return null;
21944
- }
21945
- function defineNavigatorProperty(target, key, value) {
21946
- Object.defineProperty(target, key, {
21947
- configurable: true,
21948
- enumerable: true,
21949
- writable: false,
21950
- value
21951
- });
21952
- }
21953
- function defineDocumentModelContextProperty(target, value) {
21954
- Object.defineProperty(target, "modelContext", {
21955
- configurable: true,
21956
- enumerable: true,
21957
- writable: false,
21958
- value
21959
- });
21960
- }
21961
- var navigatorModelContextDeprecationWarned = false;
21962
- function defineDeprecatedNavigatorModelContext(target, value) {
21963
- Object.defineProperty(target, "modelContext", {
21964
- configurable: true,
21965
- enumerable: true,
21966
- get() {
21967
- if (!navigatorModelContextDeprecationWarned) {
21968
- navigatorModelContextDeprecationWarned = true;
21969
- console.warn("[WebMCPPolyfill] navigator.modelContext is deprecated. The May 27, 2026 WebMCP draft moved the modelContext getter from Navigator to Document \u2014 use document.modelContext instead. See https://github.com/webmachinelearning/webmcp/pull/184.");
21970
- }
21971
- return value;
21972
- }
21973
- });
21974
- }
21975
- function initializeWebMCPPolyfill(options) {
21976
- const nav = getNavigator();
21977
- const doc = getDocument();
21978
- if (!nav && !doc) return;
21979
- const documentModelContext = doc?.modelContext;
21980
- if (Boolean(documentModelContext)) return;
21981
- const navigatorModelContext = nav?.modelContext;
21982
- const hasNavigatorModelContext = Boolean(navigatorModelContext);
21983
- if (installState.installed) cleanupWebMCPPolyfill();
21984
- if (doc && navigatorModelContext) {
21985
- installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21986
- defineDocumentModelContextProperty(doc, navigatorModelContext);
21987
- installState.installedDocumentModelContext = true;
21988
- installState.installed = true;
21989
- return;
21990
- }
21991
- if (hasNavigatorModelContext) return;
21992
- const context = new StrictWebMCPContext();
21993
- const modelContext = context;
21994
- modelContext[POLYFILL_MARKER_PROPERTY] = true;
21995
- if (doc) {
21996
- installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21997
- defineDocumentModelContextProperty(doc, modelContext);
21998
- installState.installedDocumentModelContext = true;
21999
- }
22000
- if (nav) {
22001
- installState.previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContext");
22002
- installState.previousNavigatorModelContextTestingDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContextTesting");
22003
- navigatorModelContextDeprecationWarned = false;
22004
- defineDeprecatedNavigatorModelContext(nav, modelContext);
22005
- installState.installedNavigatorModelContext = true;
22006
- const installTestingShim = options?.installTestingShim ?? "if-missing";
22007
- const hasModelContextTesting = Boolean(nav.modelContextTesting);
22008
- if (installTestingShim === "always" || (installTestingShim === true || installTestingShim === "if-missing") && !hasModelContextTesting) {
22009
- defineNavigatorProperty(nav, "modelContextTesting", context.getTestingShim());
22010
- installState.installedNavigatorModelContextTesting = true;
22011
- }
22012
- }
22013
- installState.installed = true;
22014
- }
22015
- function cleanupWebMCPPolyfill() {
22016
- if (!installState.installed) return;
22017
- const restore = (target, key, previousDescriptor) => {
22018
- if (previousDescriptor) {
22019
- Object.defineProperty(target, key, previousDescriptor);
22020
- return;
22021
- }
22022
- delete target[key];
22023
- };
22024
- const nav = getNavigator();
22025
- const doc = getDocument();
22026
- if (doc && installState.installedDocumentModelContext) restore(doc, "modelContext", installState.previousDocumentModelContextDescriptor);
22027
- if (nav && installState.installedNavigatorModelContext) restore(nav, "modelContext", installState.previousNavigatorModelContextDescriptor);
22028
- if (nav && installState.installedNavigatorModelContextTesting) restore(nav, "modelContextTesting", installState.previousNavigatorModelContextTestingDescriptor);
22029
- installState.installed = false;
22030
- installState.previousDocumentModelContextDescriptor = void 0;
22031
- installState.previousNavigatorModelContextDescriptor = void 0;
22032
- installState.previousNavigatorModelContextTestingDescriptor = void 0;
22033
- installState.installedDocumentModelContext = false;
22034
- installState.installedNavigatorModelContext = false;
22035
- installState.installedNavigatorModelContextTesting = false;
22036
- navigatorModelContextDeprecationWarned = false;
22037
- }
22038
- if (typeof window !== "undefined" && typeof document !== "undefined") {
22039
- const options = window.__webMCPPolyfillOptions;
22040
- if (options?.autoInitialize !== false) try {
22041
- initializeWebMCPPolyfill(options);
22042
- } catch (error2) {
22043
- console.error("[WebMCPPolyfill] Auto-initialization failed:", error2);
22044
- }
22045
- }
22046
-
22047
20384
  // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.4/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
22048
20385
  var __defProp2 = Object.defineProperty;
22049
20386
  var __exportAll = (all, no_symbols) => {
@@ -23241,19 +21578,19 @@ Known schemas:
23241
21578
  }
23242
21579
  var globRegexCache = /* @__PURE__ */ new Map();
23243
21580
  function globToRegex(pattern) {
23244
- let regex2 = globRegexCache.get(pattern);
23245
- if (!regex2) {
21581
+ let regex = globRegexCache.get(pattern);
21582
+ if (!regex) {
23246
21583
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&");
23247
- regex2 = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
23248
- globRegexCache.set(pattern, regex2);
21584
+ regex = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
21585
+ globRegexCache.set(pattern, regex);
23249
21586
  }
23250
- return regex2;
21587
+ return regex;
23251
21588
  }
23252
21589
  function matchAttributes(attrs, patterns) {
23253
21590
  const result2 = {};
23254
21591
  for (const pattern of patterns) if (pattern.includes("*")) {
23255
- const regex2 = globToRegex(pattern);
23256
- for (const key of Object.keys(attrs)) if (regex2.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
21592
+ const regex = globToRegex(pattern);
21593
+ for (const key of Object.keys(attrs)) if (regex.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
23257
21594
  } else {
23258
21595
  const value = attrs[pattern];
23259
21596
  if (value && value.trim()) result2[pattern] = value.trim();
@@ -23901,6 +22238,7 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23901
22238
  enableHighlight: false,
23902
22239
  removeMaskAfterToolCall: true,
23903
22240
  enableExecuteJavascript: true,
22241
+ cursorMode: "actionOnly",
23904
22242
  a11yConfig: DEFAULT_A11Y_CONFIG
23905
22243
  };
23906
22244
  function getPageAgentToolConfig() {
@@ -23911,6 +22249,7 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23911
22249
  enableHighlight: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableHighlight,
23912
22250
  removeMaskAfterToolCall: DEFAULT_PAGE_AGENT_TOOL_CONFIG.removeMaskAfterToolCall,
23913
22251
  enableExecuteJavascript: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableExecuteJavascript,
22252
+ cursorMode: DEFAULT_PAGE_AGENT_TOOL_CONFIG.cursorMode,
23914
22253
  a11yConfig: mergeA11yConfig()
23915
22254
  };
23916
22255
  }
@@ -23919,13 +22258,23 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23919
22258
  enableHighlight: patch.enableHighlight ?? base.enableHighlight,
23920
22259
  removeMaskAfterToolCall: patch.removeMaskAfterToolCall ?? base.removeMaskAfterToolCall,
23921
22260
  enableExecuteJavascript: patch.enableExecuteJavascript ?? base.enableExecuteJavascript,
22261
+ cursorMode: patch.cursorMode ?? base.cursorMode,
23922
22262
  a11yConfig: mergeA11yConfigs(base.a11yConfig, patch.a11yConfig ?? {})
23923
22263
  };
23924
22264
  }
22265
+ function resolveFunctionPatch(fnPatch, current) {
22266
+ return {
22267
+ enableHighlight: fnPatch.enableHighlight ?? current.enableHighlight,
22268
+ removeMaskAfterToolCall: fnPatch.removeMaskAfterToolCall ?? current.removeMaskAfterToolCall,
22269
+ enableExecuteJavascript: fnPatch.enableExecuteJavascript ?? current.enableExecuteJavascript,
22270
+ cursorMode: fnPatch.cursorMode ?? current.cursorMode,
22271
+ a11yConfig: fnPatch.a11yConfig !== void 0 ? mergeA11yConfigs(DEFAULT_PAGE_AGENT_TOOL_CONFIG.a11yConfig, fnPatch.a11yConfig) : current.a11yConfig
22272
+ };
22273
+ }
23925
22274
  function setPageAgentToolConfig(patch, options) {
23926
22275
  const mode = options?.mode ?? "merge";
23927
22276
  const current = getPageAgentToolConfig();
23928
- const next = typeof patch === "function" ? resolvePatch(patch(current), DEFAULT_PAGE_AGENT_TOOL_CONFIG) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
22277
+ const next = typeof patch === "function" ? resolveFunctionPatch(patch(current), current) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
23929
22278
  if (typeof window !== "undefined") {
23930
22279
  window.__webmcpcli_toolConfig = next;
23931
22280
  }
@@ -24392,8 +22741,8 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
24392
22741
  }
24393
22742
  var wordWithSpaceDiff = new Diff();
24394
22743
  wordWithSpaceDiff.tokenize = function(value) {
24395
- var regex2 = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
24396
- return value.match(regex2) || [];
22744
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
22745
+ return value.match(regex) || [];
24397
22746
  };
24398
22747
  var lineDiff = new Diff();
24399
22748
  lineDiff.tokenize = function(value, options) {
@@ -24532,7 +22881,7 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
24532
22881
  ]).describe(`\u6267\u884C\u7684\u52A8\u4F5C\u540D\u79F0, \u6BCF\u4E00\u6B21\u6267\u884C 'click', 'fill', 'select', 'hover'\u52A8\u4F5C\u4E4B\u524D\uFF0C**\u5FC5\u987B**\u8981\u5148\u8C03\u7528 'browserState' \u53BB\u83B7\u53D6\u9875\u9762\u7684\u6700\u65B0\u72B6\u6001\u3002
24533
22882
  browserState: '\u67E5\u8BE2\u6574\u4E2A\u9875\u9762\u7684\u6D4F\u89C8\u5668\u72B6\u6001;\u8FD4\u56DE\u9875\u9762\u7684\u6807\u9898\u3001URL\u3001YAML\u683C\u5F0F\u7684\u8BED\u4E49\u5316\u9875\u9762\u6811',
24534
22883
  click: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u70B9\u51FB;',
24535
- fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C;';
22884
+ fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C\uFF08\u76EE\u6807\u4E3A input\u3001textarea \u6216 contenteditable \u7F16\u8F91\u5BBF\u4E3B\uFF0C\u7D22\u5F15\u6765\u81EA browserState YAML \u4E2D\u7684 #N\uFF09;';
24536
22885
  select: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u9009\u62E9\u4E0B\u62C9\u6846\u9009\u9879;';
24537
22886
  scroll: '\u6EDA\u52A8\u9875\u9762\u7684\u52A8\u4F5C\uFF0C\u53EF\u4EE5\u6307\u5B9A\u6C34\u5E73\u6EDA\u52A8\u8FD8\u662F\u4E0A\u4E0B\u6EDA\u52A8; \u4E0D\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u6574\u4E2A\u6587\u6863\u3002\u5E26\u5143\u7D20\u7D22\u5F15\u65F6\uFF1A\u6EDA\u52A8\u8BE5\u7D22\u5F15\u5904\u7684\u5BB9\u5668\uFF08\u6216\u5176\u6700\u8FD1\u7684\u53EF\u6EDA\u52A8\u7956\u5148\u5143\u7D20\uFF09'
24538
22887
  executeJavascript: '\u6267\u884Cjavascript\u4EE3\u7801'