@opentiny/webmcp-cli 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;
@@ -3104,15 +3104,34 @@
3104
3104
  }
3105
3105
  });
3106
3106
 
3107
- // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js
3107
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
3108
3108
  var require_utils = __commonJS({
3109
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/utils.js"(exports, module) {
3109
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports, module) {
3110
3110
  "use strict";
3111
3111
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3112
3112
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3113
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
3113
3114
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3114
3115
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3115
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3116
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
3117
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
3118
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
3119
+ var BYTE_HEX = new Array(256);
3120
+ {
3121
+ const HEX_DIGITS = "0123456789ABCDEF";
3122
+ for (let i = 0; i < 256; i++) {
3123
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
3124
+ }
3125
+ }
3126
+ function percentEncodeNonAscii(cp) {
3127
+ if (cp < 2048) {
3128
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
3129
+ }
3130
+ if (cp < 65536) {
3131
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3132
+ }
3133
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3134
+ }
3116
3135
  function stringArrayToHexStripped(input) {
3117
3136
  let acc = "";
3118
3137
  let code = 0;
@@ -3137,91 +3156,105 @@
3137
3156
  }
3138
3157
  return acc;
3139
3158
  }
3159
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
3160
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
3161
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
3140
3162
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
3141
- function consumeIsZone(buffer) {
3142
- buffer.length = 0;
3143
- return true;
3144
- }
3145
- function consumeHextets(buffer, address, output) {
3146
- if (buffer.length) {
3147
- const hex = stringArrayToHexStripped(buffer);
3148
- if (hex !== "") {
3149
- address.push(hex);
3150
- } else {
3151
- output.error = true;
3152
- return false;
3163
+ function isZoneIdentifier(zone) {
3164
+ if (zone.length === 0) return false;
3165
+ for (let i = 0; i < zone.length; i++) {
3166
+ if (isZoneCharacter(zone[i])) continue;
3167
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
3168
+ i += 2;
3169
+ continue;
3153
3170
  }
3154
- buffer.length = 0;
3171
+ return false;
3155
3172
  }
3156
3173
  return true;
3157
3174
  }
3158
- function getIPV6(input) {
3159
- let tokenCount = 0;
3160
- const output = { error: false, address: "", zone: "" };
3161
- const address = [];
3162
- const buffer = [];
3163
- let endipv6Encountered = false;
3164
- let endIpv6 = false;
3165
- let consume = consumeHextets;
3166
- for (let i = 0; i < input.length; i++) {
3167
- const cursor = input[i];
3168
- if (cursor === "[" || cursor === "]") {
3169
- continue;
3170
- }
3171
- if (cursor === ":") {
3172
- if (endipv6Encountered === true) {
3173
- endIpv6 = true;
3174
- }
3175
- if (!consume(buffer, address, output)) {
3176
- break;
3175
+ function compressIPv6ZeroRun(hextets) {
3176
+ let bestStart = -1;
3177
+ let bestLength = 0;
3178
+ let runStart = -1;
3179
+ let runLength = 0;
3180
+ for (let i = 0; i < hextets.length; i++) {
3181
+ if (hextets[i] === "0") {
3182
+ if (runStart === -1) runStart = i;
3183
+ runLength++;
3184
+ if (runLength > bestLength) {
3185
+ bestLength = runLength;
3186
+ bestStart = runStart;
3177
3187
  }
3178
- if (++tokenCount > 7) {
3179
- output.error = true;
3180
- break;
3181
- }
3182
- if (i > 0 && input[i - 1] === ":") {
3183
- endipv6Encountered = true;
3184
- }
3185
- address.push(":");
3186
- continue;
3187
- } else if (cursor === "%") {
3188
- if (!consume(buffer, address, output)) {
3189
- break;
3190
- }
3191
- consume = consumeIsZone;
3192
3188
  } else {
3193
- buffer.push(cursor);
3189
+ runStart = -1;
3190
+ runLength = 0;
3191
+ }
3192
+ }
3193
+ if (bestLength < 2) return hextets.join(":");
3194
+ const head = hextets.slice(0, bestStart).join(":");
3195
+ const tail = hextets.slice(bestStart + bestLength).join(":");
3196
+ return head + "::" + tail;
3197
+ }
3198
+ function normalizeIPv6Address(input) {
3199
+ const compression = input.indexOf("::");
3200
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
3201
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
3202
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
3203
+ if (compression !== -1) {
3204
+ if (left.length === 1 && left[0] === "") left.length = 0;
3205
+ if (right.length === 1 && right[0] === "") right.length = 0;
3206
+ }
3207
+ const parts = left.concat(right);
3208
+ let hextetCount = 0;
3209
+ for (let i = 0; i < parts.length; i++) {
3210
+ const part = parts[i];
3211
+ if (part === "") return void 0;
3212
+ if (part.indexOf(".") !== -1) {
3213
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
3214
+ hextetCount += 2;
3194
3215
  continue;
3195
3216
  }
3217
+ if (!isHextet(part)) return void 0;
3218
+ parts[i] = parseInt(part, 16).toString(16);
3219
+ hextetCount++;
3196
3220
  }
3197
- if (buffer.length) {
3198
- if (consume === consumeIsZone) {
3199
- output.zone = buffer.join("");
3200
- } else if (endIpv6) {
3201
- address.push(buffer.join(""));
3202
- } else {
3203
- address.push(stringArrayToHexStripped(buffer));
3204
- }
3221
+ if (compression === -1) {
3222
+ if (hextetCount !== 8) return void 0;
3223
+ return compressIPv6ZeroRun(parts);
3205
3224
  }
3206
- output.address = address.join("");
3207
- return output;
3225
+ if (hextetCount >= 8) return void 0;
3226
+ const expanded = parts.slice(0, left.length);
3227
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
3228
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
3229
+ return compressIPv6ZeroRun(expanded);
3208
3230
  }
3209
3231
  function normalizeIPv6(host) {
3210
- if (findToken(host, ":") < 2) {
3211
- return { host, isIPV6: false };
3212
- }
3213
- const ipv62 = getIPV6(host);
3214
- if (!ipv62.error) {
3215
- let newHost = ipv62.address;
3216
- let escapedHost = ipv62.address;
3217
- if (ipv62.zone) {
3218
- newHost += "%" + ipv62.zone;
3219
- escapedHost += "%25" + ipv62.zone;
3220
- }
3221
- return { host: newHost, isIPV6: true, escapedHost };
3222
- } else {
3223
- return { host, isIPV6: false };
3224
- }
3232
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
3233
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
3234
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
3235
+ let input = bracketed ? host.slice(1, -1) : host;
3236
+ if (bracketed && isIPvFuture(input)) {
3237
+ input = input.toLowerCase();
3238
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
3239
+ }
3240
+ if (findToken(input, ":") < 2) {
3241
+ return { host, isIPV6: false, error: bracketed };
3242
+ }
3243
+ let zoneIdentifier = "";
3244
+ const zoneSeparator = input.indexOf("%");
3245
+ if (zoneSeparator !== -1) {
3246
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
3247
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
3248
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
3249
+ input = input.slice(0, zoneSeparator);
3250
+ }
3251
+ const address = normalizeIPv6Address(input);
3252
+ if (address === void 0) return { host, isIPV6: false, error: true };
3253
+ return {
3254
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
3255
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
3256
+ isIPV6: true
3257
+ };
3225
3258
  }
3226
3259
  function findToken(str, token) {
3227
3260
  let ind = 0;
@@ -3340,7 +3373,8 @@
3340
3373
  function normalizePathEncoding(input) {
3341
3374
  let output = "";
3342
3375
  for (let i = 0; i < input.length; i++) {
3343
- if (input[i] === "%" && i + 2 < input.length) {
3376
+ const ch = input[i];
3377
+ if (ch === "%" && i + 2 < input.length) {
3344
3378
  const hex = input.slice(i + 1, i + 3);
3345
3379
  if (isHexPair(hex)) {
3346
3380
  const normalizedHex = hex.toUpperCase();
@@ -3354,10 +3388,152 @@
3354
3388
  continue;
3355
3389
  }
3356
3390
  }
3357
- if (isPathCharacter(input[i])) {
3358
- output += input[i];
3391
+ if (isPathCharacter(ch)) {
3392
+ output += ch;
3393
+ } else {
3394
+ const code = input.charCodeAt(i);
3395
+ if (code < 128) {
3396
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3397
+ } else if (code < 55296 || code > 57343) {
3398
+ output += percentEncodeNonAscii(code);
3399
+ } else if (code <= 56319 && i + 1 < input.length) {
3400
+ const low = input.charCodeAt(i + 1);
3401
+ if (low >= 56320 && low <= 57343) {
3402
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3403
+ i++;
3404
+ } else {
3405
+ output += percentEncodeNonAscii(65533);
3406
+ }
3407
+ } else {
3408
+ output += percentEncodeNonAscii(65533);
3409
+ }
3410
+ }
3411
+ }
3412
+ return output;
3413
+ }
3414
+ function serializePathEncoding(input, pathNoScheme = false) {
3415
+ let output = "";
3416
+ let firstSegment = pathNoScheme && input[0] !== "/";
3417
+ for (let i = 0; i < input.length; i++) {
3418
+ const ch = input[i];
3419
+ if (ch === "%" && i + 2 < input.length) {
3420
+ const hex = input.slice(i + 1, i + 3);
3421
+ if (isHexPair(hex)) {
3422
+ output += "%" + hex.toUpperCase();
3423
+ i += 2;
3424
+ continue;
3425
+ }
3426
+ }
3427
+ if (ch === "/") {
3428
+ firstSegment = false;
3429
+ }
3430
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
3431
+ output += ch;
3432
+ } else {
3433
+ const code = input.charCodeAt(i);
3434
+ if (code < 128) {
3435
+ output += BYTE_HEX[code];
3436
+ } else if (code < 55296 || code > 57343) {
3437
+ output += percentEncodeNonAscii(code);
3438
+ } else if (code <= 56319 && i + 1 < input.length) {
3439
+ const low = input.charCodeAt(i + 1);
3440
+ if (low >= 56320 && low <= 57343) {
3441
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3442
+ i++;
3443
+ } else {
3444
+ output += percentEncodeNonAscii(65533);
3445
+ }
3446
+ } else {
3447
+ output += percentEncodeNonAscii(65533);
3448
+ }
3449
+ }
3450
+ }
3451
+ return output;
3452
+ }
3453
+ function encodeComponent(input, isAllowed) {
3454
+ let output = "";
3455
+ for (let i = 0; i < input.length; i++) {
3456
+ const ch = input[i];
3457
+ if (ch === "%" && i + 2 < input.length) {
3458
+ const hex = input.slice(i + 1, i + 3);
3459
+ if (isHexPair(hex)) {
3460
+ output += "%" + hex.toUpperCase();
3461
+ i += 2;
3462
+ continue;
3463
+ }
3464
+ }
3465
+ if (isAllowed(ch)) {
3466
+ output += ch;
3467
+ } else {
3468
+ const code = input.charCodeAt(i);
3469
+ if (code < 128) {
3470
+ output += BYTE_HEX[code];
3471
+ } else if (code < 55296 || code > 57343) {
3472
+ output += percentEncodeNonAscii(code);
3473
+ } else if (code <= 56319 && i + 1 < input.length) {
3474
+ const low = input.charCodeAt(i + 1);
3475
+ if (low >= 56320 && low <= 57343) {
3476
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3477
+ i++;
3478
+ } else {
3479
+ output += percentEncodeNonAscii(65533);
3480
+ }
3481
+ } else {
3482
+ output += percentEncodeNonAscii(65533);
3483
+ }
3484
+ }
3485
+ }
3486
+ return output;
3487
+ }
3488
+ function encodeUserinfo(input) {
3489
+ return encodeComponent(input, isUserinfoCharacter);
3490
+ }
3491
+ function encodeQuery(input) {
3492
+ return encodeComponent(input, isQueryFragmentCharacter);
3493
+ }
3494
+ function encodeFragment(input) {
3495
+ return encodeComponent(input, isQueryFragmentCharacter);
3496
+ }
3497
+ function isEscapeSafe(cp) {
3498
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
3499
+ }
3500
+ function normalizeQueryFragmentEncoding(input) {
3501
+ let output = "";
3502
+ for (let i = 0; i < input.length; i++) {
3503
+ const ch = input[i];
3504
+ if (ch === "%" && i + 2 < input.length) {
3505
+ const hex = input.slice(i + 1, i + 3);
3506
+ if (isHexPair(hex)) {
3507
+ const normalizedHex = hex.toUpperCase();
3508
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3509
+ if (isUnreserved(decoded)) {
3510
+ output += decoded;
3511
+ } else {
3512
+ output += "%" + normalizedHex;
3513
+ }
3514
+ i += 2;
3515
+ continue;
3516
+ }
3517
+ }
3518
+ if (isQueryFragmentCharacter(ch)) {
3519
+ output += ch;
3359
3520
  } else {
3360
- output += escape(input[i]);
3521
+ const code = input.charCodeAt(i);
3522
+ if (code < 128) {
3523
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3524
+ } else if (code < 55296 || code > 57343) {
3525
+ output += percentEncodeNonAscii(code);
3526
+ } else if (code <= 56319 && i + 1 < input.length) {
3527
+ const low = input.charCodeAt(i + 1);
3528
+ if (low >= 56320 && low <= 57343) {
3529
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3530
+ i++;
3531
+ } else {
3532
+ output += percentEncodeNonAscii(65533);
3533
+ }
3534
+ } else {
3535
+ output += percentEncodeNonAscii(65533);
3536
+ }
3361
3537
  }
3362
3538
  }
3363
3539
  return output;
@@ -3380,14 +3556,18 @@
3380
3556
  function recomposeAuthority(component) {
3381
3557
  const uriTokens = [];
3382
3558
  if (component.userinfo !== void 0) {
3383
- uriTokens.push(component.userinfo);
3559
+ uriTokens.push(encodeUserinfo(component.userinfo));
3384
3560
  uriTokens.push("@");
3385
3561
  }
3386
3562
  if (component.host !== void 0) {
3387
- let host = unescape(component.host);
3563
+ let host = component.host;
3388
3564
  if (!isIPv4(host)) {
3389
- const ipV6res = normalizeIPv6(host);
3390
- if (ipV6res.isIPV6 === true) {
3565
+ let ipV6res = normalizeIPv6(host);
3566
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
3567
+ host = normalizePercentEncoding(host, true);
3568
+ ipV6res = normalizeIPv6(host);
3569
+ }
3570
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
3391
3571
  host = `[${ipV6res.escapedHost}]`;
3392
3572
  } else {
3393
3573
  host = reescapeHostDelimiters(host, false);
@@ -3396,8 +3576,12 @@
3396
3576
  uriTokens.push(host);
3397
3577
  }
3398
3578
  if (typeof component.port === "number" || typeof component.port === "string") {
3579
+ const port = String(component.port);
3580
+ if (!isPort(port)) {
3581
+ throw new TypeError("URI port is malformed.");
3582
+ }
3399
3583
  uriTokens.push(":");
3400
- uriTokens.push(String(component.port));
3584
+ uriTokens.push(port);
3401
3585
  }
3402
3586
  return uriTokens.length ? uriTokens.join("") : void 0;
3403
3587
  }
@@ -3407,6 +3591,11 @@
3407
3591
  reescapeHostDelimiters,
3408
3592
  normalizePercentEncoding,
3409
3593
  normalizePathEncoding,
3594
+ serializePathEncoding,
3595
+ normalizeQueryFragmentEncoding,
3596
+ encodeUserinfo,
3597
+ encodeQuery,
3598
+ encodeFragment,
3410
3599
  escapePreservingEscapes,
3411
3600
  removeDotSegments,
3412
3601
  isIPv4,
@@ -3417,12 +3606,12 @@
3417
3606
  }
3418
3607
  });
3419
3608
 
3420
- // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js
3609
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
3421
3610
  var require_schemes = __commonJS({
3422
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3611
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3423
3612
  "use strict";
3424
3613
  var { isUUID } = require_utils();
3425
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
3614
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
3426
3615
  var supportedSchemeNames = (
3427
3616
  /** @type {const} */
3428
3617
  [
@@ -3483,9 +3672,10 @@
3483
3672
  wsComponent.secure = void 0;
3484
3673
  }
3485
3674
  if (wsComponent.resourceName) {
3486
- const [path, query] = wsComponent.resourceName.split("?");
3675
+ const queryIndex = wsComponent.resourceName.indexOf("?");
3676
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3487
3677
  wsComponent.path = path && path !== "/" ? path : void 0;
3488
- wsComponent.query = query;
3678
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3489
3679
  wsComponent.resourceName = void 0;
3490
3680
  }
3491
3681
  wsComponent.fragment = void 0;
@@ -3497,7 +3687,7 @@
3497
3687
  return urnComponent;
3498
3688
  }
3499
3689
  const matches = urnComponent.path.match(URN_REG);
3500
- if (matches) {
3690
+ if (matches && matches[0] === urnComponent.path) {
3501
3691
  const scheme = options.scheme || urnComponent.scheme || "urn";
3502
3692
  urnComponent.nid = matches[1].toLowerCase();
3503
3693
  urnComponent.nss = matches[2];
@@ -3627,30 +3817,61 @@
3627
3817
  }
3628
3818
  });
3629
3819
 
3630
- // ../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js
3820
+ // ../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
3631
3821
  var require_fast_uri = __commonJS({
3632
- "../../node_modules/.pnpm/fast-uri@3.1.5/node_modules/fast-uri/index.js"(exports, module) {
3822
+ "../../node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports, module) {
3633
3823
  "use strict";
3634
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3824
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3635
3825
  var { SCHEMES, getSchemeHandler } = require_schemes();
3636
- function normalize(uri2, options) {
3637
- if (typeof uri2 === "string") {
3638
- uri2 = /** @type {T} */
3639
- normalizeString(uri2, options);
3640
- } else if (typeof uri2 === "object") {
3641
- uri2 = /** @type {T} */
3642
- parse2(serialize(uri2, options), options);
3826
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3827
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3828
+ function decodeValidScheme(scheme) {
3829
+ const decodedScheme = unescape(String(scheme));
3830
+ if (!VALID_SCHEME.test(decodedScheme)) {
3831
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
3832
+ }
3833
+ return decodedScheme;
3834
+ }
3835
+ function normalize(uri, options) {
3836
+ if (typeof uri === "string") {
3837
+ uri = /** @type {T} */
3838
+ normalizeString(uri, options);
3839
+ } else if (typeof uri === "object") {
3840
+ uri = /** @type {T} */
3841
+ parse2(serialize(uri, options), options);
3643
3842
  }
3644
- return uri2;
3843
+ return uri;
3645
3844
  }
3646
3845
  function resolve(baseURI, relativeURI, options) {
3647
3846
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3648
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3649
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3650
- if (baseMalformed || relativeMalformed) {
3847
+ const {
3848
+ parsed: baseParsed,
3849
+ malformedAuthorityOrPort: baseMalformed,
3850
+ malformedPercentEncoding: baseMalformedPercentEncoding,
3851
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
3852
+ malformedHost: baseMalformedHost,
3853
+ malformedScheme: baseMalformedScheme
3854
+ } = parseWithStatus(baseURI, schemelessOptions);
3855
+ const {
3856
+ parsed: relativeParsed,
3857
+ malformedAuthorityOrPort: relativeMalformed,
3858
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
3859
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
3860
+ malformedHost: relativeMalformedHost,
3861
+ malformedScheme: relativeMalformedScheme
3862
+ } = parseWithStatus(relativeURI, schemelessOptions);
3863
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
3651
3864
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
3652
3865
  }
3653
3866
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3867
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3868
+ const resolvedHost = resolved.host;
3869
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3870
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3871
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3872
+ if (resolved.error && !encodedASCIIHost) {
3873
+ throw new Error(resolved.error);
3874
+ }
3654
3875
  schemelessOptions.skipEscape = true;
3655
3876
  return serialize(resolved, schemelessOptions);
3656
3877
  }
@@ -3710,7 +3931,7 @@
3710
3931
  function equal(uriA, uriB, options) {
3711
3932
  const normalizedA = normalizeComparableURI(uriA, options);
3712
3933
  const normalizedB = normalizeComparableURI(uriB, options);
3713
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3934
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
3714
3935
  }
3715
3936
  function serialize(cmpts, opts) {
3716
3937
  const component = {
@@ -3731,19 +3952,22 @@
3731
3952
  };
3732
3953
  const options = Object.assign({}, opts);
3733
3954
  const uriTokens = [];
3955
+ if (component.scheme) {
3956
+ component.scheme = decodeValidScheme(component.scheme);
3957
+ }
3734
3958
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3735
3959
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3960
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3961
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
3736
3962
  if (component.path !== void 0) {
3737
3963
  if (!options.skipEscape) {
3738
- component.path = escapePreservingEscapes(component.path);
3739
- if (component.scheme !== void 0) {
3740
- component.path = component.path.split("%3A").join(":");
3741
- }
3964
+ component.path = serializePathEncoding(component.path, pathNoScheme);
3742
3965
  } else {
3743
3966
  component.path = normalizePercentEncoding(component.path);
3744
3967
  }
3745
3968
  }
3746
3969
  if (options.reference !== "suffix" && component.scheme) {
3970
+ component.scheme = decodeValidScheme(component.scheme);
3747
3971
  uriTokens.push(component.scheme, ":");
3748
3972
  }
3749
3973
  const authority = recomposeAuthority(component);
@@ -3761,16 +3985,19 @@
3761
3985
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3762
3986
  s = removeDotSegments(s);
3763
3987
  }
3988
+ if (pathNoScheme) {
3989
+ s = serializePathEncoding(s, true);
3990
+ }
3764
3991
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
3765
3992
  s = "/%2F" + s.slice(2);
3766
3993
  }
3767
3994
  uriTokens.push(s);
3768
3995
  }
3769
3996
  if (component.query !== void 0) {
3770
- uriTokens.push("?", component.query);
3997
+ uriTokens.push("?", encodeQuery(component.query));
3771
3998
  }
3772
3999
  if (component.fragment !== void 0) {
3773
- uriTokens.push("#", component.fragment);
4000
+ uriTokens.push("#", encodeFragment(component.fragment));
3774
4001
  }
3775
4002
  return uriTokens.join("");
3776
4003
  }
@@ -3786,7 +4013,36 @@
3786
4013
  }
3787
4014
  return void 0;
3788
4015
  }
3789
- function parseWithStatus(uri2, opts) {
4016
+ function hasMalformedPercentEncoding(component) {
4017
+ if (component === void 0) return false;
4018
+ let percent = component.indexOf("%");
4019
+ while (percent !== -1) {
4020
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
4021
+ return true;
4022
+ }
4023
+ percent = component.indexOf("%", percent + 3);
4024
+ }
4025
+ return false;
4026
+ }
4027
+ function isIPLiteral(host) {
4028
+ return host[0] === "[" && host[host.length - 1] === "]";
4029
+ }
4030
+ function hasMalformedComponentPercentEncoding(matches) {
4031
+ const host = matches[4];
4032
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4033
+ }
4034
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4035
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4036
+ try {
4037
+ parsed.host = new URL("http://" + parsed.host).hostname;
4038
+ } catch (e) {
4039
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4040
+ return true;
4041
+ }
4042
+ }
4043
+ return false;
4044
+ }
4045
+ function parseWithStatus(uri, opts) {
3790
4046
  const options = Object.assign({}, opts);
3791
4047
  const parsed = {
3792
4048
  scheme: void 0,
@@ -3798,20 +4054,25 @@
3798
4054
  fragment: void 0
3799
4055
  };
3800
4056
  let malformedAuthorityOrPort = false;
4057
+ let malformedPercentEncoding = false;
4058
+ let malformedSchemeSpecific = false;
4059
+ let malformedHost = false;
4060
+ let malformedIPLiteral = false;
4061
+ let malformedScheme = false;
3801
4062
  let isIP = false;
3802
4063
  if (options.reference === "suffix") {
3803
4064
  if (options.scheme) {
3804
- uri2 = options.scheme + ":" + uri2;
4065
+ uri = options.scheme + ":" + uri;
3805
4066
  } else {
3806
- uri2 = "//" + uri2;
4067
+ uri = "//" + uri;
3807
4068
  }
3808
4069
  }
3809
- const authorityMatch = uri2.match(AUTHORITY_PREFIX);
4070
+ const authorityMatch = uri.match(AUTHORITY_PREFIX);
3810
4071
  if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
3811
4072
  parsed.error = "URI authority must not contain a literal backslash.";
3812
4073
  malformedAuthorityOrPort = true;
3813
4074
  }
3814
- const introducerMatch = uri2.match(AUTHORITY_INTRODUCER_REGION);
4075
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
3815
4076
  if (introducerMatch !== null) {
3816
4077
  const region = introducerMatch[1];
3817
4078
  const normalizedRegion = region.replace(/[\t\n\r]/g, "");
@@ -3825,7 +4086,7 @@
3825
4086
  }
3826
4087
  }
3827
4088
  }
3828
- const matches = uri2.match(URI_PARSE);
4089
+ const matches = uri.match(URI_PARSE);
3829
4090
  if (matches) {
3830
4091
  parsed.scheme = matches[1];
3831
4092
  parsed.userinfo = matches[3];
@@ -3834,6 +4095,19 @@
3834
4095
  parsed.path = matches[6] || "";
3835
4096
  parsed.query = matches[7];
3836
4097
  parsed.fragment = matches[8];
4098
+ if (parsed.scheme !== void 0) {
4099
+ const decodedScheme = unescape(parsed.scheme);
4100
+ if (VALID_SCHEME.test(decodedScheme)) {
4101
+ parsed.scheme = decodedScheme.toLowerCase();
4102
+ } else {
4103
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4104
+ malformedScheme = true;
4105
+ }
4106
+ }
4107
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
4108
+ if (malformedPercentEncoding) {
4109
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
4110
+ }
3837
4111
  if (isNaN(parsed.port)) {
3838
4112
  parsed.port = matches[5];
3839
4113
  }
@@ -3845,9 +4119,16 @@
3845
4119
  if (parsed.host) {
3846
4120
  const ipv4result = isIPv4(parsed.host);
3847
4121
  if (ipv4result === false) {
4122
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4123
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
3848
4124
  const ipv6result = normalizeIPv6(parsed.host);
3849
- parsed.host = ipv6result.host.toLowerCase();
3850
- isIP = ipv6result.isIPV6;
4125
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4126
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4127
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4128
+ if (malformedIPLiteral) {
4129
+ parsed.error = parsed.error || "URI host is malformed.";
4130
+ malformedAuthorityOrPort = true;
4131
+ }
3851
4132
  } else {
3852
4133
  isIP = true;
3853
4134
  }
@@ -3865,64 +4146,67 @@
3865
4146
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
3866
4147
  }
3867
4148
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
3868
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
3869
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
3870
- try {
3871
- parsed.host = new URL("http://" + parsed.host).hostname;
3872
- } catch (e) {
3873
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
3874
- }
4149
+ if (!malformedIPLiteral) {
4150
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4151
+ }
4152
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4153
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4154
+ if (!isIP) {
4155
+ host = normalizePercentEncoding(host.toLowerCase());
3875
4156
  }
4157
+ parsed.host = reescapeHostDelimiters(host, isIP);
3876
4158
  }
3877
4159
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
3878
- if (uri2.indexOf("%") !== -1) {
3879
- if (parsed.scheme !== void 0) {
3880
- parsed.scheme = unescape(parsed.scheme);
3881
- }
3882
- if (parsed.host !== void 0) {
3883
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3884
- }
3885
- }
3886
4160
  if (parsed.path) {
3887
4161
  parsed.path = normalizePathEncoding(parsed.path);
3888
4162
  }
4163
+ if (parsed.query) {
4164
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
4165
+ }
3889
4166
  if (parsed.fragment) {
3890
- try {
3891
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3892
- } catch {
3893
- parsed.error = parsed.error || "URI malformed";
3894
- }
4167
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
3895
4168
  }
3896
4169
  }
3897
4170
  if (schemeHandler && schemeHandler.parse) {
3898
4171
  schemeHandler.parse(parsed, options);
4172
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
4173
+ malformedSchemeSpecific = true;
4174
+ }
3899
4175
  }
3900
4176
  } else {
3901
4177
  parsed.error = parsed.error || "URI can not be parsed.";
3902
4178
  }
3903
- return { parsed, malformedAuthorityOrPort };
4179
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
3904
4180
  }
3905
- function parse2(uri2, opts) {
3906
- return parseWithStatus(uri2, opts).parsed;
4181
+ function parse2(uri, opts) {
4182
+ return parseWithStatus(uri, opts).parsed;
3907
4183
  }
3908
- function normalizeString(uri2, opts) {
3909
- return normalizeStringWithStatus(uri2, opts).normalized;
4184
+ function normalizeString(uri, opts) {
4185
+ return normalizeStringWithStatus(uri, opts).normalized;
3910
4186
  }
3911
- function normalizeStringWithStatus(uri2, opts) {
3912
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri2, opts);
4187
+ function normalizeStringWithStatus(uri, opts) {
4188
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
3913
4189
  return {
3914
- normalized: malformedAuthorityOrPort ? uri2 : serialize(parsed, opts),
3915
- malformedAuthorityOrPort
4190
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4191
+ malformedAuthorityOrPort,
4192
+ malformedPercentEncoding,
4193
+ malformedSchemeSpecific,
4194
+ malformedHost,
4195
+ malformedScheme
3916
4196
  };
3917
4197
  }
3918
- function normalizeComparableURI(uri2, opts) {
3919
- if (typeof uri2 === "string") {
3920
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri2, opts);
3921
- return malformedAuthorityOrPort ? void 0 : normalized;
4198
+ function normalizeComparableURI(uri, opts) {
4199
+ if (typeof uri !== "string" && typeof uri !== "object") {
4200
+ return void 0;
3922
4201
  }
3923
- if (typeof uri2 === "object") {
3924
- return serialize(uri2, opts);
4202
+ let value;
4203
+ try {
4204
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
4205
+ } catch {
4206
+ return void 0;
3925
4207
  }
4208
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
4209
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
3926
4210
  }
3927
4211
  var fastUri = {
3928
4212
  SCHEMES,
@@ -3944,9 +4228,9 @@
3944
4228
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js"(exports) {
3945
4229
  "use strict";
3946
4230
  Object.defineProperty(exports, "__esModule", { value: true });
3947
- var uri2 = require_fast_uri();
3948
- uri2.code = 'require("ajv/dist/runtime/uri").default';
3949
- exports.default = uri2;
4231
+ var uri = require_fast_uri();
4232
+ uri.code = 'require("ajv/dist/runtime/uri").default';
4233
+ exports.default = uri;
3950
4234
  }
3951
4235
  });
3952
4236
 
@@ -4333,10 +4617,10 @@
4333
4617
  return this;
4334
4618
  }
4335
4619
  // Add format
4336
- addFormat(name, format2) {
4337
- if (typeof format2 == "string")
4338
- format2 = new RegExp(format2);
4339
- this.formats[name] = format2;
4620
+ addFormat(name, format) {
4621
+ if (typeof format == "string")
4622
+ format = new RegExp(format);
4623
+ this.formats[name] = format;
4340
4624
  return this;
4341
4625
  }
4342
4626
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
@@ -4364,10 +4648,10 @@
4364
4648
  }
4365
4649
  return metaSchema;
4366
4650
  }
4367
- _removeAllSchemas(schemas, regex2) {
4651
+ _removeAllSchemas(schemas, regex) {
4368
4652
  for (const keyRef in schemas) {
4369
4653
  const sch = schemas[keyRef];
4370
- if (!regex2 || regex2.test(keyRef)) {
4654
+ if (!regex || regex.test(keyRef)) {
4371
4655
  if (typeof sch == "string") {
4372
4656
  delete schemas[keyRef];
4373
4657
  } else if (sch && !sch.meta) {
@@ -4454,9 +4738,9 @@
4454
4738
  }
4455
4739
  function addInitialFormats() {
4456
4740
  for (const name in this.opts.formats) {
4457
- const format2 = this.opts.formats[name];
4458
- if (format2)
4459
- this.addFormat(name, format2);
4741
+ const format = this.opts.formats[name];
4742
+ if (format)
4743
+ this.addFormat(name, format);
4460
4744
  }
4461
4745
  }
4462
4746
  function addInitialKeywords(defs) {
@@ -4784,7 +5068,7 @@
4784
5068
  "../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js"(exports) {
4785
5069
  "use strict";
4786
5070
  Object.defineProperty(exports, "__esModule", { value: true });
4787
- function ucs2length2(str) {
5071
+ function ucs2length(str) {
4788
5072
  const len = str.length;
4789
5073
  let length = 0;
4790
5074
  let pos = 0;
@@ -4800,8 +5084,8 @@
4800
5084
  }
4801
5085
  return length;
4802
5086
  }
4803
- exports.default = ucs2length2;
4804
- ucs2length2.code = 'require("ajv/dist/runtime/ucs2length").default';
5087
+ exports.default = ucs2length;
5088
+ ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
4805
5089
  }
4806
5090
  });
4807
5091
 
@@ -6139,18 +6423,18 @@
6139
6423
  });
6140
6424
  const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
6141
6425
  const fType = gen.let("fType");
6142
- const format2 = gen.let("format");
6143
- 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));
6426
+ const format = gen.let("format");
6427
+ 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));
6144
6428
  cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
6145
6429
  function unknownFmt() {
6146
6430
  if (opts.strictSchema === false)
6147
6431
  return codegen_1.nil;
6148
- return (0, codegen_1._)`${schemaCode} && !${format2}`;
6432
+ return (0, codegen_1._)`${schemaCode} && !${format}`;
6149
6433
  }
6150
6434
  function invalidFmt() {
6151
- const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format2}(${data}) : ${format2}(${data}))` : (0, codegen_1._)`${format2}(${data})`;
6152
- const validData = (0, codegen_1._)`(typeof ${format2} == "function" ? ${callFormat} : ${format2}.test(${data}))`;
6153
- return (0, codegen_1._)`${format2} && ${format2} !== true && ${fType} === ${ruleType} && !${validData}`;
6435
+ const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` : (0, codegen_1._)`${format}(${data})`;
6436
+ const validData = (0, codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`;
6437
+ return (0, codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`;
6154
6438
  }
6155
6439
  }
6156
6440
  function validateFormat() {
@@ -6161,7 +6445,7 @@
6161
6445
  }
6162
6446
  if (formatDef === true)
6163
6447
  return;
6164
- const [fmtType, format2, fmtRef] = getFormat(formatDef);
6448
+ const [fmtType, format, fmtRef] = getFormat(formatDef);
6165
6449
  if (fmtType === ruleType)
6166
6450
  cxt.pass(validCondition());
6167
6451
  function unknownFormat() {
@@ -6188,7 +6472,7 @@
6188
6472
  throw new Error("async format in sync schema");
6189
6473
  return (0, codegen_1._)`await ${fmtRef}(${data})`;
6190
6474
  }
6191
- return typeof format2 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6475
+ return typeof format == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
6192
6476
  }
6193
6477
  }
6194
6478
  }
@@ -6203,8 +6487,8 @@
6203
6487
  "use strict";
6204
6488
  Object.defineProperty(exports, "__esModule", { value: true });
6205
6489
  var format_1 = require_format();
6206
- var format2 = [format_1.default];
6207
- exports.default = format2;
6490
+ var format = [format_1.default];
6491
+ exports.default = format;
6208
6492
  }
6209
6493
  });
6210
6494
 
@@ -6605,12 +6889,12 @@
6605
6889
  "use strict";
6606
6890
  Object.defineProperty(exports, "__esModule", { value: true });
6607
6891
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
6608
- function fmtDef(validate2, compare) {
6609
- return { validate: validate2, compare };
6892
+ function fmtDef(validate, compare) {
6893
+ return { validate, compare };
6610
6894
  }
6611
6895
  exports.fullFormats = {
6612
6896
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
6613
- date: fmtDef(date5, compareDate),
6897
+ date: fmtDef(date4, compareDate),
6614
6898
  // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
6615
6899
  time: fmtDef(getTime(true), compareTime),
6616
6900
  "date-time": fmtDef(getDateTime(true), compareDateTime),
@@ -6618,7 +6902,7 @@
6618
6902
  "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
6619
6903
  // duration: https://tools.ietf.org/html/rfc3339#appendix-A
6620
6904
  duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
6621
- uri: uri2,
6905
+ uri,
6622
6906
  "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,
6623
6907
  // uri-template: https://tools.ietf.org/html/rfc6570
6624
6908
  "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,
@@ -6630,7 +6914,7 @@
6630
6914
  // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
6631
6915
  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)$/,
6632
6916
  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,
6633
- regex: regex2,
6917
+ regex,
6634
6918
  // uuid: http://tools.ietf.org/html/rfc4122
6635
6919
  uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
6636
6920
  // JSON-pointer: https://tools.ietf.org/html/rfc6901
@@ -6671,19 +6955,19 @@
6671
6955
  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
6672
6956
  };
6673
6957
  exports.formatNames = Object.keys(exports.fullFormats);
6674
- function isLeapYear2(year) {
6958
+ function isLeapYear(year) {
6675
6959
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
6676
6960
  }
6677
- var DATE2 = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6678
- var DAYS2 = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6679
- function date5(str) {
6680
- const matches = DATE2.exec(str);
6961
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
6962
+ var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
6963
+ function date4(str) {
6964
+ const matches = DATE.exec(str);
6681
6965
  if (!matches)
6682
6966
  return false;
6683
6967
  const year = +matches[1];
6684
6968
  const month = +matches[2];
6685
6969
  const day = +matches[3];
6686
- return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear2(year) ? 29 : DAYS2[month]);
6970
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
6687
6971
  }
6688
6972
  function compareDate(d1, d2) {
6689
6973
  if (!(d1 && d2))
@@ -6694,10 +6978,10 @@
6694
6978
  return -1;
6695
6979
  return 0;
6696
6980
  }
6697
- var TIME2 = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6981
+ var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
6698
6982
  function getTime(strictTimeZone) {
6699
- return function time4(str) {
6700
- const matches = TIME2.exec(str);
6983
+ return function time3(str) {
6984
+ const matches = TIME.exec(str);
6701
6985
  if (!matches)
6702
6986
  return false;
6703
6987
  const hr = +matches[1];
@@ -6728,8 +7012,8 @@
6728
7012
  function compareIsoTime(t1, t2) {
6729
7013
  if (!(t1 && t2))
6730
7014
  return void 0;
6731
- const a1 = TIME2.exec(t1);
6732
- const a2 = TIME2.exec(t2);
7015
+ const a1 = TIME.exec(t1);
7016
+ const a2 = TIME.exec(t2);
6733
7017
  if (!(a1 && a2))
6734
7018
  return void 0;
6735
7019
  t1 = a1[1] + a1[2] + a1[3];
@@ -6740,12 +7024,12 @@
6740
7024
  return -1;
6741
7025
  return 0;
6742
7026
  }
6743
- var DATE_TIME_SEPARATOR2 = /t|\s/i;
7027
+ var DATE_TIME_SEPARATOR = /t|\s/i;
6744
7028
  function getDateTime(strictTimeZone) {
6745
- const time4 = getTime(strictTimeZone);
6746
- return function date_time2(str) {
6747
- const dateTime = str.split(DATE_TIME_SEPARATOR2);
6748
- return dateTime.length === 2 && date5(dateTime[0]) && time4(dateTime[1]);
7029
+ const time3 = getTime(strictTimeZone);
7030
+ return function date_time(str) {
7031
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
7032
+ return dateTime.length === 2 && date4(dateTime[0]) && time3(dateTime[1]);
6749
7033
  };
6750
7034
  }
6751
7035
  function compareDateTime(dt1, dt2) {
@@ -6760,17 +7044,17 @@
6760
7044
  function compareIsoDateTime(dt1, dt2) {
6761
7045
  if (!(dt1 && dt2))
6762
7046
  return void 0;
6763
- const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR2);
6764
- const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR2);
7047
+ const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
7048
+ const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
6765
7049
  const res = compareDate(d1, d2);
6766
7050
  if (res === void 0)
6767
7051
  return void 0;
6768
7052
  return res || compareTime(t1, t2);
6769
7053
  }
6770
- var NOT_URI_FRAGMENT2 = /\/|:/;
7054
+ var NOT_URI_FRAGMENT = /\/|:/;
6771
7055
  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;
6772
- function uri2(str) {
6773
- return NOT_URI_FRAGMENT2.test(str) && URI.test(str);
7056
+ function uri(str) {
7057
+ return NOT_URI_FRAGMENT.test(str) && URI.test(str);
6774
7058
  }
6775
7059
  var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
6776
7060
  function byte(str) {
@@ -6788,9 +7072,9 @@
6788
7072
  function validateNumber() {
6789
7073
  return true;
6790
7074
  }
6791
- var Z_ANCHOR2 = /[^\\]\\Z/;
6792
- function regex2(str) {
6793
- if (Z_ANCHOR2.test(str))
7075
+ var Z_ANCHOR = /[^\\]\\Z/;
7076
+ function regex(str) {
7077
+ if (Z_ANCHOR.test(str))
6794
7078
  return false;
6795
7079
  try {
6796
7080
  new RegExp(str);
@@ -6846,17 +7130,17 @@
6846
7130
  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)));
6847
7131
  }
6848
7132
  function validateFormat() {
6849
- const format2 = fCxt.schema;
6850
- const fmtDef = self2.formats[format2];
7133
+ const format = fCxt.schema;
7134
+ const fmtDef = self2.formats[format];
6851
7135
  if (!fmtDef || fmtDef === true)
6852
7136
  return;
6853
7137
  if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
6854
- throw new Error(`"${keyword}": format "${format2}" does not define "compare" function`);
7138
+ throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
6855
7139
  }
6856
7140
  const fmt = gen.scopeValue("formats", {
6857
- key: format2,
7141
+ key: format,
6858
7142
  ref: fmtDef,
6859
- code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format2)}` : void 0
7143
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
6860
7144
  });
6861
7145
  cxt.fail$data(compareCode(fmt));
6862
7146
  }
@@ -8300,10 +8584,10 @@
8300
8584
  function getStringByteLength(str) {
8301
8585
  return unescape(encodeURIComponent(str)).length;
8302
8586
  }
8303
- function getSegments(regex2, mode, str) {
8587
+ function getSegments(regex, mode, str) {
8304
8588
  const segments = [];
8305
8589
  let result2;
8306
- while ((result2 = regex2.exec(str)) !== null) {
8590
+ while ((result2 = regex.exec(str)) !== null) {
8307
8591
  segments.push({
8308
8592
  data: result2[0],
8309
8593
  index: result2.index,
@@ -9595,9 +9879,9 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9595
9879
  }
9596
9880
  });
9597
9881
 
9598
- // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.2/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BHVXyogh.js
9599
- var SimulatorMask_BHVXyogh_exports = {};
9600
- __export(SimulatorMask_BHVXyogh_exports, {
9882
+ // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.4/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-Dq2GJqJc.js
9883
+ var SimulatorMask_Dq2GJqJc_exports = {};
9884
+ __export(SimulatorMask_Dq2GJqJc_exports, {
9601
9885
  SimulatorMask: () => SimulatorMask
9602
9886
  });
9603
9887
  function isPageDark() {
@@ -9698,8 +9982,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9698
9982
  return luminance !== null && luminance < threshold;
9699
9983
  }
9700
9984
  var SimulatorMask_module_default, cursor_module_default, SimulatorMask;
9701
- var init_SimulatorMask_BHVXyogh = __esm({
9702
- "../../node_modules/.pnpm/@page-agent+page-controller@1.12.2/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-BHVXyogh.js"() {
9985
+ var init_SimulatorMask_Dq2GJqJc = __esm({
9986
+ "../../node_modules/.pnpm/@page-agent+page-controller@1.12.4/node_modules/@page-agent/page-controller/dist/lib/SimulatorMask-Dq2GJqJc.js"() {
9703
9987
  init_Motion();
9704
9988
  (function() {
9705
9989
  try {
@@ -9778,99 +10062,6 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
9778
10062
  animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;
9779
10063
  }
9780
10064
 
9781
- @keyframes _cursor-ripple_1dgwb_1 {
9782
- 0% {
9783
- transform: scale(0);
9784
- opacity: 1;
9785
- }
9786
- 100% {
9787
- transform: scale(2);
9788
- opacity: 0;
9789
- }
9790
- }`));
9791
- document.head.appendChild(elementStyle);
9792
- }
9793
- } catch (e) {
9794
- console.error("vite-plugin-css-injected-by-js", e);
9795
- }
9796
- })();
9797
- (function() {
9798
- try {
9799
- if (typeof document != "undefined") {
9800
- var elementStyle = document.createElement("style");
9801
- elementStyle.appendChild(document.createTextNode(`._wrapper_1ooyb_1 {
9802
- position: fixed;
9803
- inset: 0;
9804
- z-index: 2147483641; /* \u786E\u4FDD\u5728\u6240\u6709\u5143\u7D20\u4E4B\u4E0A\uFF0C\u9664\u4E86 panel */
9805
- cursor: wait;
9806
- overflow: hidden;
9807
-
9808
- display: none;
9809
- }
9810
-
9811
- ._wrapper_1ooyb_1._visible_1ooyb_11 {
9812
- display: block;
9813
- }
9814
- /* AI \u5149\u6807\u6837\u5F0F */
9815
- ._cursor_1dgwb_2 {
9816
- position: absolute;
9817
- width: var(--cursor-size, 75px);
9818
- height: var(--cursor-size, 75px);
9819
- pointer-events: none;
9820
- z-index: 10000;
9821
- }
9822
-
9823
- ._cursorBorder_1dgwb_10 {
9824
- position: absolute;
9825
- width: 100%;
9826
- height: 100%;
9827
- background: linear-gradient(45deg, rgb(57, 182, 255), rgb(189, 69, 251));
9828
- mask-image: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20fill='none'%3e%3cg%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='none'%20stroke='%23000000'%20stroke-width='6'%20stroke-miterlimit='10'%20style='stroke:%20light-dark(rgb(0,%200,%200),%20rgb(255,%20255,%20255));'/%3e%3c/g%3e%3c/svg%3e");
9829
- mask-size: 100% 100%;
9830
- mask-repeat: no-repeat;
9831
-
9832
- transform-origin: center;
9833
- transform: rotate(-135deg) scale(1.2);
9834
- margin-left: -10px;
9835
- margin-top: -18px;
9836
- }
9837
-
9838
- ._cursorFilling_1dgwb_25 {
9839
- position: absolute;
9840
- width: 100%;
9841
- height: 100%;
9842
- background: url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%3e%3cdefs%3e%3c/defs%3e%3cg%20xmlns='http://www.w3.org/2000/svg'%20style='filter:%20drop-shadow(light-dark(rgba(0,%200,%200,%200.4),%20rgba(237,%20237,%20237,%200.4))%203px%204px%204px);'%3e%3cpath%20d='M%2015%2042%20L%2015%2036.99%20Q%2015%2031.99%2023.7%2031.99%20L%2028.05%2031.99%20Q%2032.41%2031.99%2032.41%2021.99%20L%2032.41%2017%20Q%2032.41%2012%2041.09%2016.95%20L%2076.31%2037.05%20Q%2085%2042%2076.31%2046.95%20L%2041.09%2067.05%20Q%2032.41%2072%2032.41%2062.01%20L%2032.41%2057.01%20Q%2032.41%2052.01%2023.7%2052.01%20L%2019.35%2052.01%20Q%2015%2052.01%2015%2047.01%20Z'%20fill='%23ffffff'%20stroke='none'%20style='fill:%20%23ffffff;'/%3e%3c/g%3e%3c/svg%3e");
9843
- background-size: 100% 100%;
9844
- background-repeat: no-repeat;
9845
-
9846
- transform-origin: center;
9847
- transform: rotate(-135deg) scale(1.2);
9848
- margin-left: -10px;
9849
- margin-top: -18px;
9850
- }
9851
-
9852
- ._cursorRipple_1dgwb_39 {
9853
- position: absolute;
9854
- width: 100%;
9855
- height: 100%;
9856
- pointer-events: none;
9857
- margin-left: -50%;
9858
- margin-top: -50%;
9859
-
9860
- &::after {
9861
- content: '';
9862
- opacity: 0;
9863
- position: absolute;
9864
- inset: 0;
9865
- border: 4px solid rgba(57, 182, 255, 1);
9866
- border-radius: 50%;
9867
- }
9868
- }
9869
-
9870
- ._cursor_1dgwb_2._clicking_1dgwb_57 ._cursorRipple_1dgwb_39::after {
9871
- animation: _cursor-ripple_1dgwb_1 300ms ease-out forwards;
9872
- }
9873
-
9874
10065
  @keyframes _cursor-ripple_1dgwb_1 {
9875
10066
  0% {
9876
10067
  transform: scale(0);
@@ -10023,7 +10214,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
10023
10214
  triggerClickAnimation() {
10024
10215
  if (this.#disposed) return;
10025
10216
  this.#cursor.classList.remove(cursor_module_default.clicking);
10026
- this.#cursor.offsetHeight;
10217
+ this.#cursor.getBoundingClientRect();
10027
10218
  this.#cursor.classList.add(cursor_module_default.clicking);
10028
10219
  }
10029
10220
  show() {
@@ -11029,13 +11220,13 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11029
11220
  return new RegExp(`^${timeRegexSource(args)}$`);
11030
11221
  }
11031
11222
  function datetimeRegex(args) {
11032
- let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
11223
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
11033
11224
  const opts = [];
11034
11225
  opts.push(args.local ? `Z?` : `Z`);
11035
11226
  if (args.offset)
11036
11227
  opts.push(`([+-]\\d{2}:?\\d{2})`);
11037
- regex2 = `${regex2}(${opts.join("|")})`;
11038
- return new RegExp(`^${regex2}$`);
11228
+ regex = `${regex}(${opts.join("|")})`;
11229
+ return new RegExp(`^${regex}$`);
11039
11230
  }
11040
11231
  function isValidIP(ip, version2) {
11041
11232
  if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
@@ -11281,8 +11472,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11281
11472
  status.dirty();
11282
11473
  }
11283
11474
  } else if (check2.kind === "datetime") {
11284
- const regex2 = datetimeRegex(check2);
11285
- if (!regex2.test(input.data)) {
11475
+ const regex = datetimeRegex(check2);
11476
+ if (!regex.test(input.data)) {
11286
11477
  ctx = this._getOrReturnCtx(input, ctx);
11287
11478
  addIssueToContext(ctx, {
11288
11479
  code: ZodIssueCode.invalid_string,
@@ -11292,8 +11483,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11292
11483
  status.dirty();
11293
11484
  }
11294
11485
  } else if (check2.kind === "date") {
11295
- const regex2 = dateRegex;
11296
- if (!regex2.test(input.data)) {
11486
+ const regex = dateRegex;
11487
+ if (!regex.test(input.data)) {
11297
11488
  ctx = this._getOrReturnCtx(input, ctx);
11298
11489
  addIssueToContext(ctx, {
11299
11490
  code: ZodIssueCode.invalid_string,
@@ -11303,8 +11494,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11303
11494
  status.dirty();
11304
11495
  }
11305
11496
  } else if (check2.kind === "time") {
11306
- const regex2 = timeRegex(check2);
11307
- if (!regex2.test(input.data)) {
11497
+ const regex = timeRegex(check2);
11498
+ if (!regex.test(input.data)) {
11308
11499
  ctx = this._getOrReturnCtx(input, ctx);
11309
11500
  addIssueToContext(ctx, {
11310
11501
  code: ZodIssueCode.invalid_string,
@@ -11379,8 +11570,8 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11379
11570
  }
11380
11571
  return { status: status.value, value: input.data };
11381
11572
  }
11382
- _regex(regex2, validation, message) {
11383
- return this.refinement((data) => regex2.test(data), {
11573
+ _regex(regex, validation, message) {
11574
+ return this.refinement((data) => regex.test(data), {
11384
11575
  validation,
11385
11576
  code: ZodIssueCode.invalid_string,
11386
11577
  ...errorUtil.errToObj(message)
@@ -11472,10 +11663,10 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
11472
11663
  duration(message) {
11473
11664
  return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
11474
11665
  }
11475
- regex(regex2, message) {
11666
+ regex(regex, message) {
11476
11667
  return this._addCheck({
11477
11668
  kind: "regex",
11478
- regex: regex2,
11669
+ regex,
11479
11670
  ...errorUtil.errToObj(message)
11480
11671
  });
11481
11672
  }
@@ -14837,25 +15028,25 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
14837
15028
  var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
14838
15029
  function timeSource(args) {
14839
15030
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
14840
- 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+)?)?`;
14841
- return regex2;
15031
+ 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+)?)?`;
15032
+ return regex;
14842
15033
  }
14843
15034
  function time(args) {
14844
15035
  return new RegExp(`^${timeSource(args)}$`);
14845
15036
  }
14846
15037
  function datetime(args) {
14847
- const time4 = timeSource({ precision: args.precision });
15038
+ const time3 = timeSource({ precision: args.precision });
14848
15039
  const opts = ["Z"];
14849
15040
  if (args.local)
14850
15041
  opts.push("");
14851
15042
  if (args.offset)
14852
15043
  opts.push(`([+-]\\d{2}:\\d{2})`);
14853
- const timeRegex2 = `${time4}(?:${opts.join("|")})`;
15044
+ const timeRegex2 = `${time3}(?:${opts.join("|")})`;
14854
15045
  return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
14855
15046
  }
14856
15047
  var string = (params) => {
14857
- const regex2 = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
14858
- return new RegExp(`^${regex2}$`);
15048
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
15049
+ return new RegExp(`^${regex}$`);
14859
15050
  };
14860
15051
  var bigint = /^\d+n?$/;
14861
15052
  var integer = /^\d+$/;
@@ -18002,7 +18193,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
18002
18193
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
18003
18194
  config(en_default2());
18004
18195
 
18005
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18196
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
18006
18197
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
18007
18198
  var JSONRPC_VERSION = "2.0";
18008
18199
  var AssertObjectSchema = custom2((v) => v !== null && (typeof v === "object" || typeof v === "function"));
@@ -19477,14 +19668,14 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19477
19668
  // ../../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
19478
19669
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
19479
19670
 
19480
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19671
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
19481
19672
  var import_ajv_formats = __toESM(require_dist(), 1);
19482
19673
 
19483
19674
  // ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.browser.js
19484
19675
  var crypto2;
19485
19676
  crypto2 = globalThis.crypto;
19486
19677
 
19487
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19678
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
19488
19679
  var SafeUrlSchema = url().superRefine((val, ctx) => {
19489
19680
  if (!URL.canParse(val)) {
19490
19681
  ctx.addIssue({
@@ -19628,7 +19819,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19628
19819
  token_type_hint: string2().optional()
19629
19820
  }).strip();
19630
19821
 
19631
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19822
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
19632
19823
  var OAuthError = class extends Error {
19633
19824
  constructor(message, errorUri) {
19634
19825
  super(message);
@@ -19723,7 +19914,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
19723
19914
  [InvalidTargetError.errorCode]: InvalidTargetError
19724
19915
  };
19725
19916
 
19726
- // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@opentiny/next/index.js
19917
+ // ../../node_modules/.pnpm/@opentiny+next@0.3.2_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@opentiny/next/index.js
19727
19918
  var _0x4f2826 = _0xad7a;
19728
19919
  (function(_0x5153c5, _0x3abbea) {
19729
19920
  const _0x5f186f = _0xad7a, _0x3f8155 = _0xad7a, _0x5ad68c = _0x5153c5();
@@ -20047,7 +20238,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20047
20238
  }, _0x275e(_0x25fced, _0x3ae797);
20048
20239
  }
20049
20240
 
20050
- // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20241
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.3_@cfworker+json-schema@4.1.1_hono@4.13.8_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
20051
20242
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
20052
20243
  var McpZodTypeKind;
20053
20244
  (function(McpZodTypeKind2) {
@@ -20134,1637 +20325,7 @@ gl_Position = vec4(aPosition, 0.0, 1.0);
20134
20325
  )
20135
20326
  });
20136
20327
 
20137
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
20138
- function deepCompareStrict(a, b) {
20139
- const typeofa = typeof a;
20140
- if (typeofa !== typeof b) {
20141
- return false;
20142
- }
20143
- if (Array.isArray(a)) {
20144
- if (!Array.isArray(b)) {
20145
- return false;
20146
- }
20147
- const length = a.length;
20148
- if (length !== b.length) {
20149
- return false;
20150
- }
20151
- for (let i = 0; i < length; i++) {
20152
- if (!deepCompareStrict(a[i], b[i])) {
20153
- return false;
20154
- }
20155
- }
20156
- return true;
20157
- }
20158
- if (typeofa === "object") {
20159
- if (!a || !b) {
20160
- return a === b;
20161
- }
20162
- const aKeys = Object.keys(a);
20163
- const bKeys = Object.keys(b);
20164
- const length = aKeys.length;
20165
- if (length !== bKeys.length) {
20166
- return false;
20167
- }
20168
- for (const k of aKeys) {
20169
- if (!deepCompareStrict(a[k], b[k])) {
20170
- return false;
20171
- }
20172
- }
20173
- return true;
20174
- }
20175
- return a === b;
20176
- }
20177
-
20178
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
20179
- function encodePointer(p) {
20180
- return encodeURI(escapePointer(p));
20181
- }
20182
- function escapePointer(p) {
20183
- return p.replace(/~/g, "~0").replace(/\//g, "~1");
20184
- }
20185
-
20186
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
20187
- var schemaArrayKeyword = {
20188
- prefixItems: true,
20189
- items: true,
20190
- allOf: true,
20191
- anyOf: true,
20192
- oneOf: true
20193
- };
20194
- var schemaMapKeyword = {
20195
- $defs: true,
20196
- definitions: true,
20197
- properties: true,
20198
- patternProperties: true,
20199
- dependentSchemas: true
20200
- };
20201
- var ignoredKeyword = {
20202
- id: true,
20203
- $id: true,
20204
- $ref: true,
20205
- $schema: true,
20206
- $anchor: true,
20207
- $vocabulary: true,
20208
- $comment: true,
20209
- default: true,
20210
- enum: true,
20211
- const: true,
20212
- required: true,
20213
- type: true,
20214
- maximum: true,
20215
- minimum: true,
20216
- exclusiveMaximum: true,
20217
- exclusiveMinimum: true,
20218
- multipleOf: true,
20219
- maxLength: true,
20220
- minLength: true,
20221
- pattern: true,
20222
- format: true,
20223
- maxItems: true,
20224
- minItems: true,
20225
- uniqueItems: true,
20226
- maxProperties: true,
20227
- minProperties: true
20228
- };
20229
- 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");
20230
- function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
20231
- if (schema && typeof schema === "object" && !Array.isArray(schema)) {
20232
- const id = schema.$id || schema.id;
20233
- if (id) {
20234
- const url2 = new URL(id, baseURI.href);
20235
- if (url2.hash.length > 1) {
20236
- lookup[url2.href] = schema;
20237
- } else {
20238
- url2.hash = "";
20239
- if (basePointer === "") {
20240
- baseURI = url2;
20241
- } else {
20242
- dereference(schema, lookup, baseURI);
20243
- }
20244
- }
20245
- }
20246
- } else if (schema !== true && schema !== false) {
20247
- return lookup;
20248
- }
20249
- const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
20250
- if (lookup[schemaURI] !== void 0) {
20251
- throw new Error(`Duplicate schema URI "${schemaURI}".`);
20252
- }
20253
- lookup[schemaURI] = schema;
20254
- if (schema === true || schema === false) {
20255
- return lookup;
20256
- }
20257
- if (schema.__absolute_uri__ === void 0) {
20258
- Object.defineProperty(schema, "__absolute_uri__", {
20259
- enumerable: false,
20260
- value: schemaURI
20261
- });
20262
- }
20263
- if (schema.$ref && schema.__absolute_ref__ === void 0) {
20264
- const url2 = new URL(schema.$ref, baseURI.href);
20265
- url2.hash = url2.hash;
20266
- Object.defineProperty(schema, "__absolute_ref__", {
20267
- enumerable: false,
20268
- value: url2.href
20269
- });
20270
- }
20271
- if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
20272
- const url2 = new URL(schema.$recursiveRef, baseURI.href);
20273
- url2.hash = url2.hash;
20274
- Object.defineProperty(schema, "__absolute_recursive_ref__", {
20275
- enumerable: false,
20276
- value: url2.href
20277
- });
20278
- }
20279
- if (schema.$anchor) {
20280
- const url2 = new URL("#" + schema.$anchor, baseURI.href);
20281
- lookup[url2.href] = schema;
20282
- }
20283
- for (let key in schema) {
20284
- if (ignoredKeyword[key]) {
20285
- continue;
20286
- }
20287
- const keyBase = `${basePointer}/${encodePointer(key)}`;
20288
- const subSchema = schema[key];
20289
- if (Array.isArray(subSchema)) {
20290
- if (schemaArrayKeyword[key]) {
20291
- const length = subSchema.length;
20292
- for (let i = 0; i < length; i++) {
20293
- dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
20294
- }
20295
- }
20296
- } else if (schemaMapKeyword[key]) {
20297
- for (let subKey in subSchema) {
20298
- dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
20299
- }
20300
- } else {
20301
- dereference(subSchema, lookup, baseURI, keyBase);
20302
- }
20303
- }
20304
- return lookup;
20305
- }
20306
-
20307
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
20308
- var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
20309
- var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
20310
- var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
20311
- 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;
20312
- 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;
20313
- 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;
20314
- 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;
20315
- var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
20316
- var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
20317
- var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
20318
- var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
20319
- var EMAIL = (input) => {
20320
- if (input[0] === '"')
20321
- return false;
20322
- const [name, host, ...rest] = input.split("@");
20323
- if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253)
20324
- return false;
20325
- if (name[0] === "." || name.endsWith(".") || name.includes(".."))
20326
- return false;
20327
- if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name))
20328
- return false;
20329
- return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
20330
- };
20331
- var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
20332
- 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;
20333
- 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));
20334
- function bind(r) {
20335
- return r.test.bind(r);
20336
- }
20337
- var format = {
20338
- date: date4,
20339
- time: time3.bind(void 0, false),
20340
- "date-time": date_time,
20341
- duration: DURATION,
20342
- uri,
20343
- "uri-reference": bind(URIREF),
20344
- "uri-template": bind(URITEMPLATE),
20345
- url: bind(URL_),
20346
- email: EMAIL,
20347
- hostname: bind(HOSTNAME),
20348
- ipv4: bind(IPV4),
20349
- ipv6: bind(IPV6),
20350
- regex,
20351
- uuid: bind(UUID),
20352
- "json-pointer": bind(JSON_POINTER),
20353
- "json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
20354
- "relative-json-pointer": bind(RELATIVE_JSON_POINTER)
20355
- };
20356
- function isLeapYear(year) {
20357
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
20358
- }
20359
- function date4(str) {
20360
- const matches = str.match(DATE);
20361
- if (!matches)
20362
- return false;
20363
- const year = +matches[1];
20364
- const month = +matches[2];
20365
- const day = +matches[3];
20366
- return month >= 1 && month <= 12 && day >= 1 && day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
20367
- }
20368
- function time3(full, str) {
20369
- const matches = str.match(TIME);
20370
- if (!matches)
20371
- return false;
20372
- const hour = +matches[1];
20373
- const minute = +matches[2];
20374
- const second = +matches[3];
20375
- const timeZone = !!matches[5];
20376
- return (hour <= 23 && minute <= 59 && second <= 59 || hour == 23 && minute == 59 && second == 60) && (!full || timeZone);
20377
- }
20378
- var DATE_TIME_SEPARATOR = /t|\s/i;
20379
- function date_time(str) {
20380
- const dateTime = str.split(DATE_TIME_SEPARATOR);
20381
- return dateTime.length == 2 && date4(dateTime[0]) && time3(true, dateTime[1]);
20382
- }
20383
- var NOT_URI_FRAGMENT = /\/|:/;
20384
- 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;
20385
- function uri(str) {
20386
- return NOT_URI_FRAGMENT.test(str) && URI_PATTERN.test(str);
20387
- }
20388
- var Z_ANCHOR = /[^\\]\\Z/;
20389
- function regex(str) {
20390
- if (Z_ANCHOR.test(str))
20391
- return false;
20392
- try {
20393
- new RegExp(str, "u");
20394
- return true;
20395
- } catch (e) {
20396
- return false;
20397
- }
20398
- }
20399
-
20400
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/types.js
20401
- var OutputFormat;
20402
- (function(OutputFormat2) {
20403
- OutputFormat2[OutputFormat2["Flag"] = 1] = "Flag";
20404
- OutputFormat2[OutputFormat2["Basic"] = 2] = "Basic";
20405
- OutputFormat2[OutputFormat2["Detailed"] = 4] = "Detailed";
20406
- })(OutputFormat || (OutputFormat = {}));
20407
-
20408
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
20409
- function ucs2length(s) {
20410
- let result2 = 0;
20411
- let length = s.length;
20412
- let index = 0;
20413
- let charCode;
20414
- while (index < length) {
20415
- result2++;
20416
- charCode = s.charCodeAt(index++);
20417
- if (charCode >= 55296 && charCode <= 56319 && index < length) {
20418
- charCode = s.charCodeAt(index);
20419
- if ((charCode & 64512) == 56320) {
20420
- index++;
20421
- }
20422
- }
20423
- }
20424
- return result2;
20425
- }
20426
-
20427
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validate.js
20428
- function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = /* @__PURE__ */ Object.create(null)) {
20429
- if (schema === true) {
20430
- return { valid: true, errors: [] };
20431
- }
20432
- if (schema === false) {
20433
- return {
20434
- valid: false,
20435
- errors: [
20436
- {
20437
- instanceLocation,
20438
- keyword: "false",
20439
- keywordLocation: instanceLocation,
20440
- error: "False boolean schema."
20441
- }
20442
- ]
20443
- };
20444
- }
20445
- const rawInstanceType = typeof instance;
20446
- let instanceType;
20447
- switch (rawInstanceType) {
20448
- case "boolean":
20449
- case "number":
20450
- case "string":
20451
- instanceType = rawInstanceType;
20452
- break;
20453
- case "object":
20454
- if (instance === null) {
20455
- instanceType = "null";
20456
- } else if (Array.isArray(instance)) {
20457
- instanceType = "array";
20458
- } else {
20459
- instanceType = "object";
20460
- }
20461
- break;
20462
- default:
20463
- throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
20464
- }
20465
- 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;
20466
- const errors = [];
20467
- if ($recursiveAnchor === true && recursiveAnchor === null) {
20468
- recursiveAnchor = schema;
20469
- }
20470
- if ($recursiveRef === "#") {
20471
- const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
20472
- const keywordLocation = `${schemaLocation}/$recursiveRef`;
20473
- const result2 = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
20474
- if (!result2.valid) {
20475
- errors.push({
20476
- instanceLocation,
20477
- keyword: "$recursiveRef",
20478
- keywordLocation,
20479
- error: "A subschema had errors."
20480
- }, ...result2.errors);
20481
- }
20482
- }
20483
- if ($ref !== void 0) {
20484
- const uri2 = __absolute_ref__ || $ref;
20485
- const refSchema = lookup[uri2];
20486
- if (refSchema === void 0) {
20487
- let message = `Unresolved $ref "${$ref}".`;
20488
- if (__absolute_ref__ && __absolute_ref__ !== $ref) {
20489
- message += ` Absolute URI "${__absolute_ref__}".`;
20490
- }
20491
- message += `
20492
- Known schemas:
20493
- - ${Object.keys(lookup).join("\n- ")}`;
20494
- throw new Error(message);
20495
- }
20496
- const keywordLocation = `${schemaLocation}/$ref`;
20497
- const result2 = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
20498
- if (!result2.valid) {
20499
- errors.push({
20500
- instanceLocation,
20501
- keyword: "$ref",
20502
- keywordLocation,
20503
- error: "A subschema had errors."
20504
- }, ...result2.errors);
20505
- }
20506
- if (draft === "4" || draft === "7") {
20507
- return { valid: errors.length === 0, errors };
20508
- }
20509
- }
20510
- if (Array.isArray($type)) {
20511
- let length = $type.length;
20512
- let valid = false;
20513
- for (let i = 0; i < length; i++) {
20514
- if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
20515
- valid = true;
20516
- break;
20517
- }
20518
- }
20519
- if (!valid) {
20520
- errors.push({
20521
- instanceLocation,
20522
- keyword: "type",
20523
- keywordLocation: `${schemaLocation}/type`,
20524
- error: `Instance type "${instanceType}" is invalid. Expected "${$type.join('", "')}".`
20525
- });
20526
- }
20527
- } else if ($type === "integer") {
20528
- if (instanceType !== "number" || instance % 1 || instance !== instance) {
20529
- errors.push({
20530
- instanceLocation,
20531
- keyword: "type",
20532
- keywordLocation: `${schemaLocation}/type`,
20533
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20534
- });
20535
- }
20536
- } else if ($type !== void 0 && instanceType !== $type) {
20537
- errors.push({
20538
- instanceLocation,
20539
- keyword: "type",
20540
- keywordLocation: `${schemaLocation}/type`,
20541
- error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
20542
- });
20543
- }
20544
- if ($const !== void 0) {
20545
- if (instanceType === "object" || instanceType === "array") {
20546
- if (!deepCompareStrict(instance, $const)) {
20547
- errors.push({
20548
- instanceLocation,
20549
- keyword: "const",
20550
- keywordLocation: `${schemaLocation}/const`,
20551
- error: `Instance does not match ${JSON.stringify($const)}.`
20552
- });
20553
- }
20554
- } else if (instance !== $const) {
20555
- errors.push({
20556
- instanceLocation,
20557
- keyword: "const",
20558
- keywordLocation: `${schemaLocation}/const`,
20559
- error: `Instance does not match ${JSON.stringify($const)}.`
20560
- });
20561
- }
20562
- }
20563
- if ($enum !== void 0) {
20564
- if (instanceType === "object" || instanceType === "array") {
20565
- if (!$enum.some((value) => deepCompareStrict(instance, value))) {
20566
- errors.push({
20567
- instanceLocation,
20568
- keyword: "enum",
20569
- keywordLocation: `${schemaLocation}/enum`,
20570
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
20571
- });
20572
- }
20573
- } else if (!$enum.some((value) => instance === value)) {
20574
- errors.push({
20575
- instanceLocation,
20576
- keyword: "enum",
20577
- keywordLocation: `${schemaLocation}/enum`,
20578
- error: `Instance does not match any of ${JSON.stringify($enum)}.`
20579
- });
20580
- }
20581
- }
20582
- if ($not !== void 0) {
20583
- const keywordLocation = `${schemaLocation}/not`;
20584
- const result2 = validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation);
20585
- if (result2.valid) {
20586
- errors.push({
20587
- instanceLocation,
20588
- keyword: "not",
20589
- keywordLocation,
20590
- error: 'Instance matched "not" schema.'
20591
- });
20592
- }
20593
- }
20594
- let subEvaluateds = [];
20595
- if ($anyOf !== void 0) {
20596
- const keywordLocation = `${schemaLocation}/anyOf`;
20597
- const errorsLength = errors.length;
20598
- let anyValid = false;
20599
- for (let i = 0; i < $anyOf.length; i++) {
20600
- const subSchema = $anyOf[i];
20601
- const subEvaluated = Object.create(evaluated);
20602
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20603
- errors.push(...result2.errors);
20604
- anyValid = anyValid || result2.valid;
20605
- if (result2.valid) {
20606
- subEvaluateds.push(subEvaluated);
20607
- }
20608
- }
20609
- if (anyValid) {
20610
- errors.length = errorsLength;
20611
- } else {
20612
- errors.splice(errorsLength, 0, {
20613
- instanceLocation,
20614
- keyword: "anyOf",
20615
- keywordLocation,
20616
- error: "Instance does not match any subschemas."
20617
- });
20618
- }
20619
- }
20620
- if ($allOf !== void 0) {
20621
- const keywordLocation = `${schemaLocation}/allOf`;
20622
- const errorsLength = errors.length;
20623
- let allValid = true;
20624
- for (let i = 0; i < $allOf.length; i++) {
20625
- const subSchema = $allOf[i];
20626
- const subEvaluated = Object.create(evaluated);
20627
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20628
- errors.push(...result2.errors);
20629
- allValid = allValid && result2.valid;
20630
- if (result2.valid) {
20631
- subEvaluateds.push(subEvaluated);
20632
- }
20633
- }
20634
- if (allValid) {
20635
- errors.length = errorsLength;
20636
- } else {
20637
- errors.splice(errorsLength, 0, {
20638
- instanceLocation,
20639
- keyword: "allOf",
20640
- keywordLocation,
20641
- error: `Instance does not match every subschema.`
20642
- });
20643
- }
20644
- }
20645
- if ($oneOf !== void 0) {
20646
- const keywordLocation = `${schemaLocation}/oneOf`;
20647
- const errorsLength = errors.length;
20648
- const matches = $oneOf.filter((subSchema, i) => {
20649
- const subEvaluated = Object.create(evaluated);
20650
- const result2 = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
20651
- errors.push(...result2.errors);
20652
- if (result2.valid) {
20653
- subEvaluateds.push(subEvaluated);
20654
- }
20655
- return result2.valid;
20656
- }).length;
20657
- if (matches === 1) {
20658
- errors.length = errorsLength;
20659
- } else {
20660
- errors.splice(errorsLength, 0, {
20661
- instanceLocation,
20662
- keyword: "oneOf",
20663
- keywordLocation,
20664
- error: `Instance does not match exactly one subschema (${matches} matches).`
20665
- });
20666
- }
20667
- }
20668
- if (instanceType === "object" || instanceType === "array") {
20669
- Object.assign(evaluated, ...subEvaluateds);
20670
- }
20671
- if ($if !== void 0) {
20672
- const keywordLocation = `${schemaLocation}/if`;
20673
- const conditionResult = validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid;
20674
- if (conditionResult) {
20675
- if ($then !== void 0) {
20676
- const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
20677
- if (!thenResult.valid) {
20678
- errors.push({
20679
- instanceLocation,
20680
- keyword: "if",
20681
- keywordLocation,
20682
- error: `Instance does not match "then" schema.`
20683
- }, ...thenResult.errors);
20684
- }
20685
- }
20686
- } else if ($else !== void 0) {
20687
- const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
20688
- if (!elseResult.valid) {
20689
- errors.push({
20690
- instanceLocation,
20691
- keyword: "if",
20692
- keywordLocation,
20693
- error: `Instance does not match "else" schema.`
20694
- }, ...elseResult.errors);
20695
- }
20696
- }
20697
- }
20698
- if (instanceType === "object") {
20699
- if ($required !== void 0) {
20700
- for (const key of $required) {
20701
- if (!(key in instance)) {
20702
- errors.push({
20703
- instanceLocation,
20704
- keyword: "required",
20705
- keywordLocation: `${schemaLocation}/required`,
20706
- error: `Instance does not have required property "${key}".`
20707
- });
20708
- }
20709
- }
20710
- }
20711
- const keys = Object.keys(instance);
20712
- if ($minProperties !== void 0 && keys.length < $minProperties) {
20713
- errors.push({
20714
- instanceLocation,
20715
- keyword: "minProperties",
20716
- keywordLocation: `${schemaLocation}/minProperties`,
20717
- error: `Instance does not have at least ${$minProperties} properties.`
20718
- });
20719
- }
20720
- if ($maxProperties !== void 0 && keys.length > $maxProperties) {
20721
- errors.push({
20722
- instanceLocation,
20723
- keyword: "maxProperties",
20724
- keywordLocation: `${schemaLocation}/maxProperties`,
20725
- error: `Instance does not have at least ${$maxProperties} properties.`
20726
- });
20727
- }
20728
- if ($propertyNames !== void 0) {
20729
- const keywordLocation = `${schemaLocation}/propertyNames`;
20730
- for (const key in instance) {
20731
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
20732
- const result2 = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
20733
- if (!result2.valid) {
20734
- errors.push({
20735
- instanceLocation,
20736
- keyword: "propertyNames",
20737
- keywordLocation,
20738
- error: `Property name "${key}" does not match schema.`
20739
- }, ...result2.errors);
20740
- }
20741
- }
20742
- }
20743
- if ($dependentRequired !== void 0) {
20744
- const keywordLocation = `${schemaLocation}/dependantRequired`;
20745
- for (const key in $dependentRequired) {
20746
- if (key in instance) {
20747
- const required2 = $dependentRequired[key];
20748
- for (const dependantKey of required2) {
20749
- if (!(dependantKey in instance)) {
20750
- errors.push({
20751
- instanceLocation,
20752
- keyword: "dependentRequired",
20753
- keywordLocation,
20754
- error: `Instance has "${key}" but does not have "${dependantKey}".`
20755
- });
20756
- }
20757
- }
20758
- }
20759
- }
20760
- }
20761
- if ($dependentSchemas !== void 0) {
20762
- for (const key in $dependentSchemas) {
20763
- const keywordLocation = `${schemaLocation}/dependentSchemas`;
20764
- if (key in instance) {
20765
- const result2 = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
20766
- if (!result2.valid) {
20767
- errors.push({
20768
- instanceLocation,
20769
- keyword: "dependentSchemas",
20770
- keywordLocation,
20771
- error: `Instance has "${key}" but does not match dependant schema.`
20772
- }, ...result2.errors);
20773
- }
20774
- }
20775
- }
20776
- }
20777
- if ($dependencies !== void 0) {
20778
- const keywordLocation = `${schemaLocation}/dependencies`;
20779
- for (const key in $dependencies) {
20780
- if (key in instance) {
20781
- const propsOrSchema = $dependencies[key];
20782
- if (Array.isArray(propsOrSchema)) {
20783
- for (const dependantKey of propsOrSchema) {
20784
- if (!(dependantKey in instance)) {
20785
- errors.push({
20786
- instanceLocation,
20787
- keyword: "dependencies",
20788
- keywordLocation,
20789
- error: `Instance has "${key}" but does not have "${dependantKey}".`
20790
- });
20791
- }
20792
- }
20793
- } else {
20794
- const result2 = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
20795
- if (!result2.valid) {
20796
- errors.push({
20797
- instanceLocation,
20798
- keyword: "dependencies",
20799
- keywordLocation,
20800
- error: `Instance has "${key}" but does not match dependant schema.`
20801
- }, ...result2.errors);
20802
- }
20803
- }
20804
- }
20805
- }
20806
- }
20807
- const thisEvaluated = /* @__PURE__ */ Object.create(null);
20808
- let stop = false;
20809
- if ($properties !== void 0) {
20810
- const keywordLocation = `${schemaLocation}/properties`;
20811
- for (const key in $properties) {
20812
- if (!(key in instance)) {
20813
- continue;
20814
- }
20815
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
20816
- const result2 = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
20817
- if (result2.valid) {
20818
- evaluated[key] = thisEvaluated[key] = true;
20819
- } else {
20820
- stop = shortCircuit;
20821
- errors.push({
20822
- instanceLocation,
20823
- keyword: "properties",
20824
- keywordLocation,
20825
- error: `Property "${key}" does not match schema.`
20826
- }, ...result2.errors);
20827
- if (stop)
20828
- break;
20829
- }
20830
- }
20831
- }
20832
- if (!stop && $patternProperties !== void 0) {
20833
- const keywordLocation = `${schemaLocation}/patternProperties`;
20834
- for (const pattern in $patternProperties) {
20835
- const regex2 = new RegExp(pattern, "u");
20836
- const subSchema = $patternProperties[pattern];
20837
- for (const key in instance) {
20838
- if (!regex2.test(key)) {
20839
- continue;
20840
- }
20841
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
20842
- const result2 = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
20843
- if (result2.valid) {
20844
- evaluated[key] = thisEvaluated[key] = true;
20845
- } else {
20846
- stop = shortCircuit;
20847
- errors.push({
20848
- instanceLocation,
20849
- keyword: "patternProperties",
20850
- keywordLocation,
20851
- error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
20852
- }, ...result2.errors);
20853
- }
20854
- }
20855
- }
20856
- }
20857
- if (!stop && $additionalProperties !== void 0) {
20858
- const keywordLocation = `${schemaLocation}/additionalProperties`;
20859
- for (const key in instance) {
20860
- if (thisEvaluated[key]) {
20861
- continue;
20862
- }
20863
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
20864
- const result2 = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
20865
- if (result2.valid) {
20866
- evaluated[key] = true;
20867
- } else {
20868
- stop = shortCircuit;
20869
- errors.push({
20870
- instanceLocation,
20871
- keyword: "additionalProperties",
20872
- keywordLocation,
20873
- error: `Property "${key}" does not match additional properties schema.`
20874
- }, ...result2.errors);
20875
- }
20876
- }
20877
- } else if (!stop && $unevaluatedProperties !== void 0) {
20878
- const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
20879
- for (const key in instance) {
20880
- if (!evaluated[key]) {
20881
- const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
20882
- const result2 = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
20883
- if (result2.valid) {
20884
- evaluated[key] = true;
20885
- } else {
20886
- errors.push({
20887
- instanceLocation,
20888
- keyword: "unevaluatedProperties",
20889
- keywordLocation,
20890
- error: `Property "${key}" does not match unevaluated properties schema.`
20891
- }, ...result2.errors);
20892
- }
20893
- }
20894
- }
20895
- }
20896
- } else if (instanceType === "array") {
20897
- if ($maxItems !== void 0 && instance.length > $maxItems) {
20898
- errors.push({
20899
- instanceLocation,
20900
- keyword: "maxItems",
20901
- keywordLocation: `${schemaLocation}/maxItems`,
20902
- error: `Array has too many items (${instance.length} > ${$maxItems}).`
20903
- });
20904
- }
20905
- if ($minItems !== void 0 && instance.length < $minItems) {
20906
- errors.push({
20907
- instanceLocation,
20908
- keyword: "minItems",
20909
- keywordLocation: `${schemaLocation}/minItems`,
20910
- error: `Array has too few items (${instance.length} < ${$minItems}).`
20911
- });
20912
- }
20913
- const length = instance.length;
20914
- let i = 0;
20915
- let stop = false;
20916
- if ($prefixItems !== void 0) {
20917
- const keywordLocation = `${schemaLocation}/prefixItems`;
20918
- const length2 = Math.min($prefixItems.length, length);
20919
- for (; i < length2; i++) {
20920
- const result2 = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
20921
- evaluated[i] = true;
20922
- if (!result2.valid) {
20923
- stop = shortCircuit;
20924
- errors.push({
20925
- instanceLocation,
20926
- keyword: "prefixItems",
20927
- keywordLocation,
20928
- error: `Items did not match schema.`
20929
- }, ...result2.errors);
20930
- if (stop)
20931
- break;
20932
- }
20933
- }
20934
- }
20935
- if ($items !== void 0) {
20936
- const keywordLocation = `${schemaLocation}/items`;
20937
- if (Array.isArray($items)) {
20938
- const length2 = Math.min($items.length, length);
20939
- for (; i < length2; i++) {
20940
- const result2 = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
20941
- evaluated[i] = true;
20942
- if (!result2.valid) {
20943
- stop = shortCircuit;
20944
- errors.push({
20945
- instanceLocation,
20946
- keyword: "items",
20947
- keywordLocation,
20948
- error: `Items did not match schema.`
20949
- }, ...result2.errors);
20950
- if (stop)
20951
- break;
20952
- }
20953
- }
20954
- } else {
20955
- for (; i < length; i++) {
20956
- const result2 = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
20957
- evaluated[i] = true;
20958
- if (!result2.valid) {
20959
- stop = shortCircuit;
20960
- errors.push({
20961
- instanceLocation,
20962
- keyword: "items",
20963
- keywordLocation,
20964
- error: `Items did not match schema.`
20965
- }, ...result2.errors);
20966
- if (stop)
20967
- break;
20968
- }
20969
- }
20970
- }
20971
- if (!stop && $additionalItems !== void 0) {
20972
- const keywordLocation2 = `${schemaLocation}/additionalItems`;
20973
- for (; i < length; i++) {
20974
- const result2 = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation2);
20975
- evaluated[i] = true;
20976
- if (!result2.valid) {
20977
- stop = shortCircuit;
20978
- errors.push({
20979
- instanceLocation,
20980
- keyword: "additionalItems",
20981
- keywordLocation: keywordLocation2,
20982
- error: `Items did not match additional items schema.`
20983
- }, ...result2.errors);
20984
- }
20985
- }
20986
- }
20987
- }
20988
- if ($contains !== void 0) {
20989
- if (length === 0 && $minContains === void 0) {
20990
- errors.push({
20991
- instanceLocation,
20992
- keyword: "contains",
20993
- keywordLocation: `${schemaLocation}/contains`,
20994
- error: `Array is empty. It must contain at least one item matching the schema.`
20995
- });
20996
- } else if ($minContains !== void 0 && length < $minContains) {
20997
- errors.push({
20998
- instanceLocation,
20999
- keyword: "minContains",
21000
- keywordLocation: `${schemaLocation}/minContains`,
21001
- error: `Array has less items (${length}) than minContains (${$minContains}).`
21002
- });
21003
- } else {
21004
- const keywordLocation = `${schemaLocation}/contains`;
21005
- const errorsLength = errors.length;
21006
- let contained = 0;
21007
- for (let j = 0; j < length; j++) {
21008
- const result2 = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
21009
- if (result2.valid) {
21010
- evaluated[j] = true;
21011
- contained++;
21012
- } else {
21013
- errors.push(...result2.errors);
21014
- }
21015
- }
21016
- if (contained >= ($minContains || 0)) {
21017
- errors.length = errorsLength;
21018
- }
21019
- if ($minContains === void 0 && $maxContains === void 0 && contained === 0) {
21020
- errors.splice(errorsLength, 0, {
21021
- instanceLocation,
21022
- keyword: "contains",
21023
- keywordLocation,
21024
- error: `Array does not contain item matching schema.`
21025
- });
21026
- } else if ($minContains !== void 0 && contained < $minContains) {
21027
- errors.push({
21028
- instanceLocation,
21029
- keyword: "minContains",
21030
- keywordLocation: `${schemaLocation}/minContains`,
21031
- error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
21032
- });
21033
- } else if ($maxContains !== void 0 && contained > $maxContains) {
21034
- errors.push({
21035
- instanceLocation,
21036
- keyword: "maxContains",
21037
- keywordLocation: `${schemaLocation}/maxContains`,
21038
- error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
21039
- });
21040
- }
21041
- }
21042
- }
21043
- if (!stop && $unevaluatedItems !== void 0) {
21044
- const keywordLocation = `${schemaLocation}/unevaluatedItems`;
21045
- for (i; i < length; i++) {
21046
- if (evaluated[i]) {
21047
- continue;
21048
- }
21049
- const result2 = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
21050
- evaluated[i] = true;
21051
- if (!result2.valid) {
21052
- errors.push({
21053
- instanceLocation,
21054
- keyword: "unevaluatedItems",
21055
- keywordLocation,
21056
- error: `Items did not match unevaluated items schema.`
21057
- }, ...result2.errors);
21058
- }
21059
- }
21060
- }
21061
- if ($uniqueItems) {
21062
- for (let j = 0; j < length; j++) {
21063
- const a = instance[j];
21064
- const ao = typeof a === "object" && a !== null;
21065
- for (let k = 0; k < length; k++) {
21066
- if (j === k) {
21067
- continue;
21068
- }
21069
- const b = instance[k];
21070
- const bo = typeof b === "object" && b !== null;
21071
- if (a === b || ao && bo && deepCompareStrict(a, b)) {
21072
- errors.push({
21073
- instanceLocation,
21074
- keyword: "uniqueItems",
21075
- keywordLocation: `${schemaLocation}/uniqueItems`,
21076
- error: `Duplicate items at indexes ${j} and ${k}.`
21077
- });
21078
- j = Number.MAX_SAFE_INTEGER;
21079
- k = Number.MAX_SAFE_INTEGER;
21080
- }
21081
- }
21082
- }
21083
- }
21084
- } else if (instanceType === "number") {
21085
- if (draft === "4") {
21086
- if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) {
21087
- errors.push({
21088
- instanceLocation,
21089
- keyword: "minimum",
21090
- keywordLocation: `${schemaLocation}/minimum`,
21091
- error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
21092
- });
21093
- }
21094
- if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) {
21095
- errors.push({
21096
- instanceLocation,
21097
- keyword: "maximum",
21098
- keywordLocation: `${schemaLocation}/maximum`,
21099
- error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
21100
- });
21101
- }
21102
- } else {
21103
- if ($minimum !== void 0 && instance < $minimum) {
21104
- errors.push({
21105
- instanceLocation,
21106
- keyword: "minimum",
21107
- keywordLocation: `${schemaLocation}/minimum`,
21108
- error: `${instance} is less than ${$minimum}.`
21109
- });
21110
- }
21111
- if ($maximum !== void 0 && instance > $maximum) {
21112
- errors.push({
21113
- instanceLocation,
21114
- keyword: "maximum",
21115
- keywordLocation: `${schemaLocation}/maximum`,
21116
- error: `${instance} is greater than ${$maximum}.`
21117
- });
21118
- }
21119
- if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) {
21120
- errors.push({
21121
- instanceLocation,
21122
- keyword: "exclusiveMinimum",
21123
- keywordLocation: `${schemaLocation}/exclusiveMinimum`,
21124
- error: `${instance} is less than ${$exclusiveMinimum}.`
21125
- });
21126
- }
21127
- if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) {
21128
- errors.push({
21129
- instanceLocation,
21130
- keyword: "exclusiveMaximum",
21131
- keywordLocation: `${schemaLocation}/exclusiveMaximum`,
21132
- error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
21133
- });
21134
- }
21135
- }
21136
- if ($multipleOf !== void 0) {
21137
- const remainder = instance % $multipleOf;
21138
- if (Math.abs(0 - remainder) >= 11920929e-14 && Math.abs($multipleOf - remainder) >= 11920929e-14) {
21139
- errors.push({
21140
- instanceLocation,
21141
- keyword: "multipleOf",
21142
- keywordLocation: `${schemaLocation}/multipleOf`,
21143
- error: `${instance} is not a multiple of ${$multipleOf}.`
21144
- });
21145
- }
21146
- }
21147
- } else if (instanceType === "string") {
21148
- const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
21149
- if ($minLength !== void 0 && length < $minLength) {
21150
- errors.push({
21151
- instanceLocation,
21152
- keyword: "minLength",
21153
- keywordLocation: `${schemaLocation}/minLength`,
21154
- error: `String is too short (${length} < ${$minLength}).`
21155
- });
21156
- }
21157
- if ($maxLength !== void 0 && length > $maxLength) {
21158
- errors.push({
21159
- instanceLocation,
21160
- keyword: "maxLength",
21161
- keywordLocation: `${schemaLocation}/maxLength`,
21162
- error: `String is too long (${length} > ${$maxLength}).`
21163
- });
21164
- }
21165
- if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) {
21166
- errors.push({
21167
- instanceLocation,
21168
- keyword: "pattern",
21169
- keywordLocation: `${schemaLocation}/pattern`,
21170
- error: `String does not match pattern.`
21171
- });
21172
- }
21173
- if ($format !== void 0 && format[$format] && !format[$format](instance)) {
21174
- errors.push({
21175
- instanceLocation,
21176
- keyword: "format",
21177
- keywordLocation: `${schemaLocation}/format`,
21178
- error: `String does not match format "${$format}".`
21179
- });
21180
- }
21181
- }
21182
- return { valid: errors.length === 0, errors };
21183
- }
21184
-
21185
- // ../../node_modules/.pnpm/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validator.js
21186
- var Validator = class {
21187
- schema;
21188
- draft;
21189
- shortCircuit;
21190
- lookup;
21191
- constructor(schema, draft = "2019-09", shortCircuit = true) {
21192
- this.schema = schema;
21193
- this.draft = draft;
21194
- this.shortCircuit = shortCircuit;
21195
- this.lookup = dereference(schema);
21196
- }
21197
- validate(instance) {
21198
- return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
21199
- }
21200
- addSchema(schema, id) {
21201
- if (id) {
21202
- schema = { ...schema, $id: id };
21203
- }
21204
- dereference(schema, this.lookup);
21205
- }
21206
- };
21207
-
21208
- // ../../node_modules/.pnpm/@mcp-b+webmcp-polyfill@3.0.0/node_modules/@mcp-b/webmcp-polyfill/dist/index.js
21209
- var FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE = "Failed to parse input arguments";
21210
- var TOOL_INVOCATION_FAILED_MESSAGE = "Tool was executed but the invocation failed. For example, the script function threw an error";
21211
- var TOOL_CANCELLED_MESSAGE = "Tool was cancelled";
21212
- var DEFAULT_INPUT_SCHEMA = {
21213
- type: "object",
21214
- properties: {}
21215
- };
21216
- var STANDARD_JSON_SCHEMA_TARGETS = ["draft-2020-12", "draft-07"];
21217
- var POLYFILL_MARKER_PROPERTY = "__isWebMCPPolyfill";
21218
- var STANDARD_VALIDATOR_SYMBOL = Symbol("standardValidator");
21219
- var installState = {
21220
- installed: false,
21221
- previousNavigatorModelContextDescriptor: void 0,
21222
- previousNavigatorModelContextTestingDescriptor: void 0,
21223
- previousDocumentModelContextDescriptor: void 0,
21224
- installedNavigatorModelContext: false,
21225
- installedNavigatorModelContextTesting: false,
21226
- installedDocumentModelContext: false
21227
- };
21228
- var StrictWebMCPContext = class extends EventTarget {
21229
- tools = /* @__PURE__ */ new Map();
21230
- testingShim = null;
21231
- _ontoolchange = null;
21232
- unregisterToolDeprecationWarned = false;
21233
- get ontoolchange() {
21234
- return this._ontoolchange;
21235
- }
21236
- set ontoolchange(handler) {
21237
- this._ontoolchange = handler;
21238
- }
21239
- registerTool(tool, options) {
21240
- const signal2 = options?.signal;
21241
- if (signal2?.aborted) {
21242
- console.warn(`[WebMCPPolyfill] registerTool("${tool?.name ?? "<unknown>"}") skipped: options.signal was already aborted.`);
21243
- return;
21244
- }
21245
- const normalized = normalizeToolDescriptor(tool, this.tools);
21246
- this.tools.set(normalized.name, normalized);
21247
- this.notifyToolsChanged();
21248
- if (signal2) signal2.addEventListener("abort", () => {
21249
- if (this.tools.delete(normalized.name)) this.notifyToolsChanged();
21250
- }, { once: true });
21251
- }
21252
- unregisterTool(nameOrTool) {
21253
- this.warnUnregisterToolDeprecationOnce();
21254
- const name = getToolNameForUnregister(nameOrTool);
21255
- if (this.tools.delete(name)) this.notifyToolsChanged();
21256
- }
21257
- getTools() {
21258
- return Promise.resolve(this.getRegisteredToolInfos());
21259
- }
21260
- executeTool(tool, inputArgsJson, options) {
21261
- return this.executeToolByName(tool.name, inputArgsJson, options, false);
21262
- }
21263
- getTestingShim() {
21264
- if (!this.testingShim) this.testingShim = new PolyfillTestingShim(this);
21265
- return this.testingShim;
21266
- }
21267
- /** @internal Used by PolyfillTestingShim */
21268
- getToolInfos() {
21269
- return [...this.tools.values()].map((tool) => {
21270
- let inputSchema2;
21271
- try {
21272
- inputSchema2 = JSON.stringify(tool.inputSchema ?? { type: "object" });
21273
- } catch {
21274
- inputSchema2 = '{"type":"object"}';
21275
- }
21276
- return {
21277
- name: tool.name,
21278
- description: tool.description,
21279
- inputSchema: inputSchema2
21280
- };
21281
- });
21282
- }
21283
- /** @internal Used by getTools() */
21284
- getRegisteredToolInfos() {
21285
- return this.getToolInfos().map((toolInfo) => {
21286
- const tool = this.tools.get(toolInfo.name);
21287
- return {
21288
- ...toolInfo,
21289
- title: tool?.title ?? "",
21290
- origin: globalThis.location?.origin ?? "",
21291
- window: globalThis.window
21292
- };
21293
- });
21294
- }
21295
- /** @internal Used by PolyfillTestingShim */
21296
- async executeToolForTesting(toolName, inputArgsJson, options) {
21297
- return this.executeToolByName(toolName, inputArgsJson, options, true);
21298
- }
21299
- async executeToolByName(toolName, inputArgsJson, options, normalizeResult) {
21300
- if (options?.signal?.aborted) throw createUnknownError(TOOL_CANCELLED_MESSAGE);
21301
- const tool = this.tools.get(toolName);
21302
- if (!tool) throw createUnknownError(`Tool not found: ${toolName}`);
21303
- const args = parseInputArgsJson(inputArgsJson);
21304
- const validationError = await validateArgsForTool(args, tool);
21305
- if (validationError) throw createUnknownError(validationError);
21306
- let contextActive = true;
21307
- const client = { requestUserInteraction: async (callback) => {
21308
- if (!contextActive) throw new Error(`ModelContextClient for tool "${toolName}" is no longer active after execute() resolved`);
21309
- if (typeof callback !== "function") throw new TypeError("requestUserInteraction(callback) requires a function callback");
21310
- return callback();
21311
- } };
21312
- try {
21313
- const execution = tool.execute(args, client);
21314
- const rawResult = await withAbortSignal(Promise.resolve(execution), options?.signal);
21315
- if (normalizeResult) return toSerializedTestingResult(normalizeToolResponse(rawResult));
21316
- const serialized = JSON.stringify(rawResult);
21317
- return serialized === void 0 ? null : serialized;
21318
- } catch (error2) {
21319
- throw createUnknownError(error2 instanceof Error ? `${TOOL_INVOCATION_FAILED_MESSAGE}: ${error2.message}` : TOOL_INVOCATION_FAILED_MESSAGE);
21320
- } finally {
21321
- contextActive = false;
21322
- }
21323
- }
21324
- notifyToolsChanged() {
21325
- queueMicrotask(() => {
21326
- const event = new Event("toolchange");
21327
- try {
21328
- this._ontoolchange?.call(this, event);
21329
- } catch (error2) {
21330
- console.warn("[WebMCPPolyfill] navigator.modelContext.ontoolchange handler threw:", error2);
21331
- }
21332
- this.dispatchEvent(event);
21333
- this.testingShim?.dispatchToolChange();
21334
- });
21335
- }
21336
- warnUnregisterToolDeprecationOnce() {
21337
- if (this.unregisterToolDeprecationWarned) return;
21338
- this.unregisterToolDeprecationWarned = true;
21339
- 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.");
21340
- }
21341
- };
21342
- var PolyfillTestingShim = class extends EventTarget {
21343
- context;
21344
- _ontoolchange = null;
21345
- constructor(context) {
21346
- super();
21347
- this.context = context;
21348
- }
21349
- listTools() {
21350
- return this.context.getToolInfos();
21351
- }
21352
- executeTool(toolName, inputArgsJson, options) {
21353
- return this.context.executeToolForTesting(toolName, inputArgsJson, options);
21354
- }
21355
- getCrossDocumentScriptToolResult() {
21356
- return Promise.resolve("[]");
21357
- }
21358
- get ontoolchange() {
21359
- return this._ontoolchange;
21360
- }
21361
- set ontoolchange(handler) {
21362
- this._ontoolchange = handler;
21363
- }
21364
- /**
21365
- * @deprecated Use `addEventListener('toolchange', callback)` instead.
21366
- * Kept for backward compatibility with older polyfill consumers.
21367
- */
21368
- registerToolsChangedCallback(callback) {
21369
- if (typeof callback !== "function") throw new TypeError("Failed to execute 'registerToolsChangedCallback' on 'ModelContextTesting': parameter 1 is not of type 'Function'.");
21370
- this.addEventListener("toolchange", callback);
21371
- }
21372
- /** @internal Called by StrictWebMCPContext when tools change. */
21373
- dispatchToolChange() {
21374
- const event = new Event("toolchange");
21375
- try {
21376
- this._ontoolchange?.call(this, event);
21377
- } catch (error2) {
21378
- console.warn("[WebMCPPolyfill] ontoolchange handler threw:", error2);
21379
- }
21380
- this.dispatchEvent(event);
21381
- this.dispatchEvent(new Event("toolschanged"));
21382
- }
21383
- };
21384
- function createUnknownError(message) {
21385
- try {
21386
- return new DOMException(message, "UnknownError");
21387
- } catch {
21388
- const error2 = new Error(message);
21389
- error2.name = "UnknownError";
21390
- return error2;
21391
- }
21392
- }
21393
- function parseInputArgsJson(inputArgsJson) {
21394
- let parsed;
21395
- try {
21396
- parsed = JSON.parse(inputArgsJson);
21397
- } catch {
21398
- throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21399
- }
21400
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw createUnknownError(FAILED_TO_PARSE_INPUT_ARGUMENTS_MESSAGE);
21401
- return parsed;
21402
- }
21403
- function getToolNameForUnregister(nameOrTool) {
21404
- if (typeof nameOrTool === "string") return nameOrTool;
21405
- if (isPlainObject2(nameOrTool) && typeof nameOrTool.name === "string") return nameOrTool.name;
21406
- throw new TypeError("Failed to execute 'unregisterTool' on 'ModelContext': parameter 1 must be a string or an object with a string name.");
21407
- }
21408
- function isPlainObject2(value) {
21409
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
21410
- }
21411
- function getStandardProps(value) {
21412
- if (!isPlainObject2(value)) return null;
21413
- const standard = value["~standard"];
21414
- if (!isPlainObject2(standard)) return null;
21415
- return standard;
21416
- }
21417
- function isStandardInputValidatorSchema(value) {
21418
- const standard = getStandardProps(value);
21419
- return Boolean(standard && standard.version === 1 && typeof standard.validate === "function");
21420
- }
21421
- function isStandardInputJsonSchema(value) {
21422
- const standard = getStandardProps(value);
21423
- if (!standard || standard.version !== 1 || !isPlainObject2(standard.jsonSchema)) return false;
21424
- return typeof standard.jsonSchema.input === "function";
21425
- }
21426
- function createStandardValidatorFromJsonSchema(schema) {
21427
- return { "~standard": {
21428
- version: 1,
21429
- vendor: "@mcp-b/webmcp-polyfill-json-schema",
21430
- validate(value) {
21431
- if (!isPlainObject2(value)) return { issues: [{ message: "expected object arguments" }] };
21432
- const issue2 = validateArgsWithSchema(value, schema);
21433
- if (issue2) return { issues: [issue2] };
21434
- return { value };
21435
- }
21436
- } };
21437
- }
21438
- function convertStandardInputSchema(schema) {
21439
- for (const target of STANDARD_JSON_SCHEMA_TARGETS) try {
21440
- const converted = schema["~standard"].jsonSchema.input({ target });
21441
- validateInputSchema(converted);
21442
- return converted;
21443
- } catch (error2) {
21444
- console.warn(`[WebMCPPolyfill] Standard JSON Schema conversion failed for target "${target}":`, error2);
21445
- }
21446
- throw new Error("Failed to convert Standard JSON Schema inputSchema to a JSON Schema object");
21447
- }
21448
- function normalizeInputSchema(inputSchema2) {
21449
- if (inputSchema2 === void 0) {
21450
- const normalized = DEFAULT_INPUT_SCHEMA;
21451
- return {
21452
- inputSchema: normalized,
21453
- standardValidator: createStandardValidatorFromJsonSchema(normalized)
21454
- };
21455
- }
21456
- if (isStandardInputJsonSchema(inputSchema2)) {
21457
- const converted = convertStandardInputSchema(inputSchema2);
21458
- return {
21459
- inputSchema: converted,
21460
- standardValidator: createStandardValidatorFromJsonSchema(converted)
21461
- };
21462
- }
21463
- if (isStandardInputValidatorSchema(inputSchema2)) return {
21464
- inputSchema: DEFAULT_INPUT_SCHEMA,
21465
- standardValidator: inputSchema2
21466
- };
21467
- validateInputSchema(inputSchema2);
21468
- if (Object.keys(inputSchema2).length === 0) return {
21469
- inputSchema: DEFAULT_INPUT_SCHEMA,
21470
- standardValidator: createStandardValidatorFromJsonSchema(DEFAULT_INPUT_SCHEMA)
21471
- };
21472
- const normalizedSchema = inputSchema2.type === void 0 ? {
21473
- type: "object",
21474
- ...inputSchema2
21475
- } : inputSchema2;
21476
- return {
21477
- inputSchema: normalizedSchema,
21478
- standardValidator: createStandardValidatorFromJsonSchema(normalizedSchema)
21479
- };
21480
- }
21481
- function validateInputSchema(schema) {
21482
- if (!isPlainObject2(schema)) throw new Error("inputSchema must be a JSON Schema object");
21483
- validateJsonSchemaNode(schema, "$");
21484
- }
21485
- function validateJsonSchemaNode(node, path) {
21486
- const typeValue = node.type;
21487
- 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[]`);
21488
- const requiredValue = node.required;
21489
- 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`);
21490
- const propertiesValue = node.properties;
21491
- if (propertiesValue !== void 0) {
21492
- if (!isPlainObject2(propertiesValue)) throw new Error(`Invalid JSON Schema at ${path}: "properties" must be an object`);
21493
- for (const [key, value] of Object.entries(propertiesValue)) {
21494
- if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.properties.${key}: expected object schema`);
21495
- validateJsonSchemaNode(value, `${path}.properties.${key}`);
21496
- }
21497
- }
21498
- const itemsValue = node.items;
21499
- if (itemsValue !== void 0) if (Array.isArray(itemsValue)) for (const [index, value] of itemsValue.entries()) {
21500
- if (!isPlainObject2(value)) throw new Error(`Invalid JSON Schema at ${path}.items[${index}]: expected object schema`);
21501
- validateJsonSchemaNode(value, `${path}.items[${index}]`);
21502
- }
21503
- else if (isPlainObject2(itemsValue)) validateJsonSchemaNode(itemsValue, `${path}.items`);
21504
- else throw new Error(`Invalid JSON Schema at ${path}: "items" must be an object or object[]`);
21505
- for (const keyword of [
21506
- "allOf",
21507
- "anyOf",
21508
- "oneOf"
21509
- ]) {
21510
- const value = node[keyword];
21511
- if (value === void 0) continue;
21512
- if (!Array.isArray(value)) throw new Error(`Invalid JSON Schema at ${path}: "${keyword}" must be an array`);
21513
- for (const [index, entry] of value.entries()) {
21514
- if (!isPlainObject2(entry)) throw new Error(`Invalid JSON Schema at ${path}.${keyword}[${index}]: expected object schema`);
21515
- validateJsonSchemaNode(entry, `${path}.${keyword}[${index}]`);
21516
- }
21517
- }
21518
- const notValue = node.not;
21519
- if (notValue !== void 0) {
21520
- if (!isPlainObject2(notValue)) throw new Error(`Invalid JSON Schema at ${path}: "not" must be an object schema`);
21521
- validateJsonSchemaNode(notValue, `${path}.not`);
21522
- }
21523
- try {
21524
- JSON.stringify(node);
21525
- } catch {
21526
- throw new Error(`Invalid JSON Schema at ${path}: schema must be JSON-serializable`);
21527
- }
21528
- }
21529
- function normalizeToolDescriptor(tool, existing) {
21530
- if (!tool || typeof tool !== "object") throw new TypeError("registerTool(tool) requires a tool object");
21531
- if (typeof tool.name !== "string" || tool.name.length === 0) throw new TypeError('Tool "name" must be a non-empty string');
21532
- if (typeof tool.description !== "string" || tool.description.length === 0) throw new TypeError('Tool "description" must be a non-empty string');
21533
- if (typeof tool.execute !== "function") throw new TypeError('Tool "execute" must be a function');
21534
- if (existing.has(tool.name)) throw new Error(`Tool already registered: ${tool.name}`);
21535
- const normalizedInputSchema = normalizeInputSchema(tool.inputSchema);
21536
- const annotations = tool.annotations;
21537
- const normalizedAnnotations = annotations ? {
21538
- ...annotations,
21539
- ...annotations.readOnlyHint === "true" ? { readOnlyHint: true } : annotations.readOnlyHint === "false" ? { readOnlyHint: false } : {},
21540
- ...annotations.destructiveHint === "true" ? { destructiveHint: true } : annotations.destructiveHint === "false" ? { destructiveHint: false } : {},
21541
- ...annotations.idempotentHint === "true" ? { idempotentHint: true } : annotations.idempotentHint === "false" ? { idempotentHint: false } : {},
21542
- ...annotations.openWorldHint === "true" ? { openWorldHint: true } : annotations.openWorldHint === "false" ? { openWorldHint: false } : {}
21543
- } : void 0;
21544
- return {
21545
- ...tool,
21546
- ...normalizedAnnotations ? { annotations: normalizedAnnotations } : {},
21547
- inputSchema: normalizedInputSchema.inputSchema,
21548
- [STANDARD_VALIDATOR_SYMBOL]: normalizedInputSchema.standardValidator
21549
- };
21550
- }
21551
- function validateArgsWithSchema(args, schema) {
21552
- const result2 = new Validator(schema, "2020-12", true).validate(args);
21553
- if (result2.valid) return null;
21554
- const error2 = result2.errors[result2.errors.length - 1];
21555
- if (!error2) return { message: "Input validation failed" };
21556
- return { message: error2.error };
21557
- }
21558
- function formatStandardIssuePath(path) {
21559
- if (!path || path.length === 0) return null;
21560
- const segments = path.map((segment) => {
21561
- if (isPlainObject2(segment) && "key" in segment) return segment.key;
21562
- return segment;
21563
- }).map((segment) => String(segment)).filter((segment) => segment.length > 0);
21564
- if (segments.length === 0) return null;
21565
- return segments.join(".");
21566
- }
21567
- async function validateArgsWithStandardSchema(args, schema) {
21568
- let result2;
21569
- try {
21570
- result2 = await Promise.resolve(schema["~standard"].validate(args));
21571
- } catch (error2) {
21572
- const detail = error2 instanceof Error ? `: ${error2.message}` : "";
21573
- console.error("[WebMCPPolyfill] Standard Schema validation threw unexpectedly:", error2);
21574
- return `Input validation error: schema validation failed${detail}`;
21575
- }
21576
- if (!result2.issues || result2.issues.length === 0) return null;
21577
- const firstIssue = result2.issues[0];
21578
- if (!firstIssue) return "Input validation error";
21579
- const path = formatStandardIssuePath(firstIssue?.path);
21580
- if (path) return `Input validation error: ${firstIssue.message} at ${path}`;
21581
- return `Input validation error: ${firstIssue.message}`;
21582
- }
21583
- async function validateArgsForTool(args, tool) {
21584
- return validateArgsWithStandardSchema(args, tool[STANDARD_VALIDATOR_SYMBOL]);
21585
- }
21586
- function isCallToolResult(value) {
21587
- return isPlainObject2(value) && Array.isArray(value.content);
21588
- }
21589
- function isJsonPrimitive(value) {
21590
- return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
21591
- }
21592
- function isJsonValue(value) {
21593
- if (isJsonPrimitive(value)) return Number.isFinite(value) || typeof value !== "number";
21594
- if (Array.isArray(value)) return value.every((entry) => isJsonValue(entry));
21595
- if (!isPlainObject2(value)) return false;
21596
- return Object.values(value).every((entry) => isJsonValue(entry));
21597
- }
21598
- function toStructuredContent(value) {
21599
- if (!isPlainObject2(value) || !isJsonValue(value)) return;
21600
- return value;
21601
- }
21602
- function serializeTextContent(value) {
21603
- if (typeof value === "string") return value;
21604
- try {
21605
- return JSON.stringify(value) ?? String(value);
21606
- } catch {
21607
- return String(value);
21608
- }
21609
- }
21610
- function normalizeToolResponse(value) {
21611
- if (isCallToolResult(value)) return value;
21612
- const structuredContent = toStructuredContent(value);
21613
- return {
21614
- content: [{
21615
- type: "text",
21616
- text: serializeTextContent(value)
21617
- }],
21618
- ...structuredContent ? { structuredContent } : {},
21619
- isError: false
21620
- };
21621
- }
21622
- function getFirstTextBlock(result2) {
21623
- for (const block of result2.content ?? []) if (block.type === "text" && "text" in block && typeof block.text === "string") return block.text;
21624
- return null;
21625
- }
21626
- function toSerializedTestingResult(result2) {
21627
- if (result2.isError) throw createUnknownError(getFirstTextBlock(result2)?.replace(/^Error:\s*/i, "").trim() || TOOL_INVOCATION_FAILED_MESSAGE);
21628
- const metadata = result2.metadata;
21629
- if (metadata && typeof metadata === "object" && metadata.willNavigate) return null;
21630
- try {
21631
- return JSON.stringify(result2);
21632
- } catch {
21633
- throw createUnknownError(TOOL_INVOCATION_FAILED_MESSAGE);
21634
- }
21635
- }
21636
- function withAbortSignal(operation, signal2) {
21637
- if (!signal2) return operation;
21638
- if (signal2.aborted) return Promise.reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21639
- return new Promise((resolve, reject) => {
21640
- const onAbort = () => {
21641
- cleanup();
21642
- reject(createUnknownError(TOOL_CANCELLED_MESSAGE));
21643
- };
21644
- const cleanup = () => {
21645
- signal2.removeEventListener("abort", onAbort);
21646
- };
21647
- signal2.addEventListener("abort", onAbort, { once: true });
21648
- operation.then((value) => {
21649
- cleanup();
21650
- resolve(value);
21651
- }, (error2) => {
21652
- cleanup();
21653
- reject(error2);
21654
- });
21655
- });
21656
- }
21657
- function getNavigator() {
21658
- if (typeof navigator !== "undefined") return navigator;
21659
- return null;
21660
- }
21661
- function getDocument() {
21662
- if (typeof document !== "undefined") return document;
21663
- return null;
21664
- }
21665
- function defineNavigatorProperty(target, key, value) {
21666
- Object.defineProperty(target, key, {
21667
- configurable: true,
21668
- enumerable: true,
21669
- writable: false,
21670
- value
21671
- });
21672
- }
21673
- function defineDocumentModelContextProperty(target, value) {
21674
- Object.defineProperty(target, "modelContext", {
21675
- configurable: true,
21676
- enumerable: true,
21677
- writable: false,
21678
- value
21679
- });
21680
- }
21681
- var navigatorModelContextDeprecationWarned = false;
21682
- function defineDeprecatedNavigatorModelContext(target, value) {
21683
- Object.defineProperty(target, "modelContext", {
21684
- configurable: true,
21685
- enumerable: true,
21686
- get() {
21687
- if (!navigatorModelContextDeprecationWarned) {
21688
- navigatorModelContextDeprecationWarned = true;
21689
- 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.");
21690
- }
21691
- return value;
21692
- }
21693
- });
21694
- }
21695
- function initializeWebMCPPolyfill(options) {
21696
- const nav = getNavigator();
21697
- const doc = getDocument();
21698
- if (!nav && !doc) return;
21699
- const documentModelContext = doc?.modelContext;
21700
- if (Boolean(documentModelContext)) return;
21701
- const navigatorModelContext = nav?.modelContext;
21702
- const hasNavigatorModelContext = Boolean(navigatorModelContext);
21703
- if (installState.installed) cleanupWebMCPPolyfill();
21704
- if (doc && navigatorModelContext) {
21705
- installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21706
- defineDocumentModelContextProperty(doc, navigatorModelContext);
21707
- installState.installedDocumentModelContext = true;
21708
- installState.installed = true;
21709
- return;
21710
- }
21711
- if (hasNavigatorModelContext) return;
21712
- const context = new StrictWebMCPContext();
21713
- const modelContext = context;
21714
- modelContext[POLYFILL_MARKER_PROPERTY] = true;
21715
- if (doc) {
21716
- installState.previousDocumentModelContextDescriptor = Object.getOwnPropertyDescriptor(doc, "modelContext");
21717
- defineDocumentModelContextProperty(doc, modelContext);
21718
- installState.installedDocumentModelContext = true;
21719
- }
21720
- if (nav) {
21721
- installState.previousNavigatorModelContextDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContext");
21722
- installState.previousNavigatorModelContextTestingDescriptor = Object.getOwnPropertyDescriptor(nav, "modelContextTesting");
21723
- navigatorModelContextDeprecationWarned = false;
21724
- defineDeprecatedNavigatorModelContext(nav, modelContext);
21725
- installState.installedNavigatorModelContext = true;
21726
- const installTestingShim = options?.installTestingShim ?? "if-missing";
21727
- const hasModelContextTesting = Boolean(nav.modelContextTesting);
21728
- if (installTestingShim === "always" || (installTestingShim === true || installTestingShim === "if-missing") && !hasModelContextTesting) {
21729
- defineNavigatorProperty(nav, "modelContextTesting", context.getTestingShim());
21730
- installState.installedNavigatorModelContextTesting = true;
21731
- }
21732
- }
21733
- installState.installed = true;
21734
- }
21735
- function cleanupWebMCPPolyfill() {
21736
- if (!installState.installed) return;
21737
- const restore = (target, key, previousDescriptor) => {
21738
- if (previousDescriptor) {
21739
- Object.defineProperty(target, key, previousDescriptor);
21740
- return;
21741
- }
21742
- delete target[key];
21743
- };
21744
- const nav = getNavigator();
21745
- const doc = getDocument();
21746
- if (doc && installState.installedDocumentModelContext) restore(doc, "modelContext", installState.previousDocumentModelContextDescriptor);
21747
- if (nav && installState.installedNavigatorModelContext) restore(nav, "modelContext", installState.previousNavigatorModelContextDescriptor);
21748
- if (nav && installState.installedNavigatorModelContextTesting) restore(nav, "modelContextTesting", installState.previousNavigatorModelContextTestingDescriptor);
21749
- installState.installed = false;
21750
- installState.previousDocumentModelContextDescriptor = void 0;
21751
- installState.previousNavigatorModelContextDescriptor = void 0;
21752
- installState.previousNavigatorModelContextTestingDescriptor = void 0;
21753
- installState.installedDocumentModelContext = false;
21754
- installState.installedNavigatorModelContext = false;
21755
- installState.installedNavigatorModelContextTesting = false;
21756
- navigatorModelContextDeprecationWarned = false;
21757
- }
21758
- if (typeof window !== "undefined" && typeof document !== "undefined") {
21759
- const options = window.__webMCPPolyfillOptions;
21760
- if (options?.autoInitialize !== false) try {
21761
- initializeWebMCPPolyfill(options);
21762
- } catch (error2) {
21763
- console.error("[WebMCPPolyfill] Auto-initialization failed:", error2);
21764
- }
21765
- }
21766
-
21767
- // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.2/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
20328
+ // ../../node_modules/.pnpm/@page-agent+page-controller@1.12.4/node_modules/@page-agent/page-controller/dist/lib/page-controller.js
21768
20329
  var __defProp2 = Object.defineProperty;
21769
20330
  var __exportAll = (all, no_symbols) => {
21770
20331
  let target = {};
@@ -21938,7 +20499,6 @@ Known schemas:
21938
20499
  } else getNativeValueSetter(element).call(element, text);
21939
20500
  if (!isContentEditable) element.dispatchEvent(new Event("input", { bubbles: true }));
21940
20501
  await waitFor(0.1);
21941
- blurLastClickedElement();
21942
20502
  }
21943
20503
  async function selectOptionElement(selectElement, optionText) {
21944
20504
  if (!isSelectElement(selectElement)) throw new Error("Element is not a select element");
@@ -22962,19 +21522,19 @@ Known schemas:
22962
21522
  }
22963
21523
  var globRegexCache = /* @__PURE__ */ new Map();
22964
21524
  function globToRegex(pattern) {
22965
- let regex2 = globRegexCache.get(pattern);
22966
- if (!regex2) {
21525
+ let regex = globRegexCache.get(pattern);
21526
+ if (!regex) {
22967
21527
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&");
22968
- regex2 = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
22969
- globRegexCache.set(pattern, regex2);
21528
+ regex = new RegExp(`^${escaped.replace(/\*/g, ".*")}$`);
21529
+ globRegexCache.set(pattern, regex);
22970
21530
  }
22971
- return regex2;
21531
+ return regex;
22972
21532
  }
22973
21533
  function matchAttributes(attrs, patterns) {
22974
21534
  const result2 = {};
22975
21535
  for (const pattern of patterns) if (pattern.includes("*")) {
22976
- const regex2 = globToRegex(pattern);
22977
- for (const key of Object.keys(attrs)) if (regex2.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
21536
+ const regex = globToRegex(pattern);
21537
+ for (const key of Object.keys(attrs)) if (regex.test(key) && attrs[key].trim()) result2[key] = attrs[key].trim();
22978
21538
  } else {
22979
21539
  const value = attrs[pattern];
22980
21540
  if (value && value.trim()) result2[pattern] = value.trim();
@@ -23078,8 +21638,10 @@ Known schemas:
23078
21638
  const seenValues = {};
23079
21639
  for (const key of keys) {
23080
21640
  const value = attributesToInclude[key];
23081
- if (value.length > 5) if (value in seenValues) keysToRemove.add(key);
23082
- else seenValues[value] = key;
21641
+ if (value.length > 5) {
21642
+ if (value in seenValues) keysToRemove.add(key);
21643
+ else seenValues[value] = key;
21644
+ }
23083
21645
  }
23084
21646
  for (const key of keysToRemove) delete attributesToInclude[key];
23085
21647
  }
@@ -23118,8 +21680,10 @@ Known schemas:
23118
21680
  nextDepth += 1;
23119
21681
  }
23120
21682
  for (const child of node.children) processNode(child, nextDepth, result3);
23121
- if (emitSemantic) if (result3.length === mark + 1) result3.pop();
23122
- else result3.push(`${depthStr}</${node.tagName}>`);
21683
+ if (emitSemantic) {
21684
+ if (result3.length === mark + 1) result3.pop();
21685
+ else result3.push(`${depthStr}</${node.tagName}>`);
21686
+ }
23123
21687
  } else if (node.type === "text") {
23124
21688
  if (hasParentWithHighlightIndex(node)) return;
23125
21689
  if (node.parent && node.parent.type === "element" && node.parent.isVisible && node.parent.isTopElement) result3.push(`${depthStr}${node.text ?? ""}`);
@@ -23253,7 +21817,7 @@ Known schemas:
23253
21817
  initMask() {
23254
21818
  if (this.maskReady !== null) return;
23255
21819
  this.maskReady = (async () => {
23256
- const { SimulatorMask: SimulatorMask3 } = await Promise.resolve().then(() => (init_SimulatorMask_BHVXyogh(), SimulatorMask_BHVXyogh_exports));
21820
+ const { SimulatorMask: SimulatorMask3 } = await Promise.resolve().then(() => (init_SimulatorMask_Dq2GJqJc(), SimulatorMask_Dq2GJqJc_exports));
23257
21821
  this.mask = new SimulatorMask3();
23258
21822
  })();
23259
21823
  }
@@ -23617,6 +22181,8 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23617
22181
  var DEFAULT_PAGE_AGENT_TOOL_CONFIG = {
23618
22182
  enableHighlight: false,
23619
22183
  removeMaskAfterToolCall: true,
22184
+ enableExecuteJavascript: true,
22185
+ cursorMode: "actionOnly",
23620
22186
  a11yConfig: DEFAULT_A11Y_CONFIG
23621
22187
  };
23622
22188
  function getPageAgentToolConfig() {
@@ -23626,6 +22192,8 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23626
22192
  return {
23627
22193
  enableHighlight: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableHighlight,
23628
22194
  removeMaskAfterToolCall: DEFAULT_PAGE_AGENT_TOOL_CONFIG.removeMaskAfterToolCall,
22195
+ enableExecuteJavascript: DEFAULT_PAGE_AGENT_TOOL_CONFIG.enableExecuteJavascript,
22196
+ cursorMode: DEFAULT_PAGE_AGENT_TOOL_CONFIG.cursorMode,
23629
22197
  a11yConfig: mergeA11yConfig()
23630
22198
  };
23631
22199
  }
@@ -23633,13 +22201,24 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
23633
22201
  return {
23634
22202
  enableHighlight: patch.enableHighlight ?? base.enableHighlight,
23635
22203
  removeMaskAfterToolCall: patch.removeMaskAfterToolCall ?? base.removeMaskAfterToolCall,
22204
+ enableExecuteJavascript: patch.enableExecuteJavascript ?? base.enableExecuteJavascript,
22205
+ cursorMode: patch.cursorMode ?? base.cursorMode,
23636
22206
  a11yConfig: mergeA11yConfigs(base.a11yConfig, patch.a11yConfig ?? {})
23637
22207
  };
23638
22208
  }
22209
+ function resolveFunctionPatch(fnPatch, current) {
22210
+ return {
22211
+ enableHighlight: fnPatch.enableHighlight ?? current.enableHighlight,
22212
+ removeMaskAfterToolCall: fnPatch.removeMaskAfterToolCall ?? current.removeMaskAfterToolCall,
22213
+ enableExecuteJavascript: fnPatch.enableExecuteJavascript ?? current.enableExecuteJavascript,
22214
+ cursorMode: fnPatch.cursorMode ?? current.cursorMode,
22215
+ a11yConfig: fnPatch.a11yConfig !== void 0 ? mergeA11yConfigs(DEFAULT_PAGE_AGENT_TOOL_CONFIG.a11yConfig, fnPatch.a11yConfig) : current.a11yConfig
22216
+ };
22217
+ }
23639
22218
  function setPageAgentToolConfig(patch, options) {
23640
22219
  const mode = options?.mode ?? "merge";
23641
22220
  const current = getPageAgentToolConfig();
23642
- const next = typeof patch === "function" ? resolvePatch(patch(current), DEFAULT_PAGE_AGENT_TOOL_CONFIG) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
22221
+ const next = typeof patch === "function" ? resolveFunctionPatch(patch(current), current) : resolvePatch(patch, mode === "replace" ? DEFAULT_PAGE_AGENT_TOOL_CONFIG : current);
23643
22222
  if (typeof window !== "undefined") {
23644
22223
  window.__webmcpcli_toolConfig = next;
23645
22224
  }
@@ -24106,8 +22685,8 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
24106
22685
  }
24107
22686
  var wordWithSpaceDiff = new Diff();
24108
22687
  wordWithSpaceDiff.tokenize = function(value) {
24109
- var regex2 = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
24110
- return value.match(regex2) || [];
22688
+ var regex = new RegExp("(\\r?\\n)|[".concat(extendedWordChars, "]+|[^\\S\\n\\r]+|[^").concat(extendedWordChars, "]"), "ug");
22689
+ return value.match(regex) || [];
24111
22690
  };
24112
22691
  var lineDiff = new Diff();
24113
22692
  lineDiff.tokenize = function(value, options) {
@@ -24233,18 +22812,32 @@ ${pi.pixels_above > 4 && viewportExpansion !== -1 ? `... ${pi.pixels_above} pixe
24233
22812
 
24234
22813
  // ../next-sdk/page-tools/schema.ts
24235
22814
  var inputSchema = external_exports.object({
24236
- action: external_exports.enum(["browserState", "click", "fill", "select", "scroll", "executeJavascript", "searchTree", "hover"]).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
22815
+ action: external_exports.enum([
22816
+ "browserState",
22817
+ "click",
22818
+ "fill",
22819
+ "select",
22820
+ "scroll",
22821
+ "executeJavascript",
22822
+ "searchTree",
22823
+ "hover",
22824
+ "clipboard"
22825
+ ]).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
24237
22826
  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',
24238
22827
  click: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u70B9\u51FB;',
24239
- fill: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u586B\u5199\u6587\u672C;';
22828
+ 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;';
24240
22829
  select: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u9009\u62E9\u4E0B\u62C9\u6846\u9009\u9879;';
24241
22830
  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'
24242
22831
  executeJavascript: '\u6267\u884Cjavascript\u4EE3\u7801'
24243
22832
  searchTree: '\u6309\u5173\u952E\u8BCD\u641C\u7D22\u65E0\u969C\u788D\u6811\uFF0C\u8FD4\u56DE\u5E26\u884C\u53F7\u7684\u5339\u914D\u8282\u70B9\u53CA\u4E0A\u4E0B\u6587\uFF0C\u65E0\u9700\u83B7\u53D6\u5168\u91CF\u6811\u3002\u9002\u5408\u5FEB\u901F\u5B9A\u4F4D\u7279\u5B9A\u5143\u7D20\uFF08\u5982\u6240\u6709\u6309\u94AE\u3001\u7279\u5B9A\u540D\u79F0\u7684\u94FE\u63A5\u7B49\uFF09\uFF0C\u663E\u8457\u51CF\u5C11\u4E0A\u4E0B\u6587\u6D88\u8017\u3002\u5FC5\u987B\u63D0\u4F9B query \u53C2\u6570\u3002'
24244
- hover: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u60AC\u6D6E\uFF08hover\uFF09\u76EE\u6807\u5143\u7D20; \u89E6\u53D1 mouseover/mouseenter \u7B49\u4E8B\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A tooltip\u3001\u5C55\u5F00\u60AC\u6D6E\u83DC\u5355\u7B49\u4EA4\u4E92; \u64CD\u4F5C\u540E\u81EA\u52A8\u8FD4\u56DE\u6700\u65B0\u9875\u9762\u72B6\u6001\u3002'
22833
+ hover: '\u6839\u636E\u5143\u7D20\u7D22\u5F15\u60AC\u6D6E\uFF08hover\uFF09\u76EE\u6807\u5143\u7D20; \u89E6\u53D1 mouseover/mouseenter \u7B49\u4E8B\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A tooltip\u3001\u5C55\u5F00\u60AC\u6D6E\u83DC\u5355\u7B49\u4EA4\u4E92; \u64CD\u4F5C\u540E\u81EA\u52A8\u8FD4\u56DE\u6700\u65B0\u9875\u9762\u72B6\u6001\u3002
22834
+ clipboard: '\u8BFB\u53D6\u7CFB\u7EDF\u526A\u5207\u677F\u6216\u590D\u5236\u5230\u526A\u5207\u677F\uFF0C \u4F9D\u8D56 text \u53C2\u6570\uFF0C text\u6709\u5185\u5BB9\u5219\u4E3A\u5199\u5165\u526A\u5207\u677F\uFF0C\u6CA1\u6709\u5185\u5BB9\u5219\u4E3A\u8BFB\u53D6\u526A\u5207\u677F\u3002
22835
+ '
24245
22836
  `),
24246
22837
  index: external_exports.number().min(0).optional().describe("\u6267\u884C\u52A8\u4F5C of the element index, \u52A8\u4F5C\u4E3A click,fill,select,hover\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u5143\u7D20\u7D22\u5F15"),
24247
- text: external_exports.string().optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u6587\u672C\u5185\u5BB9, \u52A8\u4F5C\u4E3A fill,select \u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u6587\u672C\u5185\u5BB9"),
22838
+ text: external_exports.string().optional().describe(
22839
+ "\u6267\u884C\u52A8\u4F5C\u7684\u6587\u672C\u5185\u5BB9, \u52A8\u4F5C\u4E3A fill,select \u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9B\u6587\u672C\u5185\u5BB9\uFF1B\u52A8\u4F5C\u4E3A clipboard\u65F6\uFF0C text\u6709\u5185\u5BB9\u5219\u4E3A\u5199\u5165\u526A\u5207\u677F\uFF0C\u6CA1\u6709\u5185\u5BB9\u5219\u4E3A\u8BFB\u53D6\u526A\u5207\u677F"
22840
+ ),
24248
22841
  down: external_exports.boolean().optional().describe("\u6267\u884C\u4E0A\u4E0B\u6EDA\u52A8\u65F6\uFF0C\u5FC5\u987B\u63D0\u4F9Bdown\u53C2\u6570"),
24249
22842
  right: external_exports.boolean().optional().describe("\u6267\u884C\u6C34\u5E73\u6EDA\u52A8\u65B9\u5411, \u5FC5\u987B\u63D0\u4F9Bright\u53C2\u6570"),
24250
22843
  numPages: external_exports.number().optional().describe("\u6267\u884C\u52A8\u4F5C\u7684\u6EDA\u52A8\u9875\u6570, \u52A8\u4F5C\u4E3A scroll\u65F6\uFF0C\u53EF\u4EE5\u63D0\u4F9B\u6EDA\u52A8\u9875\u6570\uFF0C\u5EFA\u8BAE\u6BCF\u6B21\u6EDA\u52A80.1\u9875\uFF0C\u8BE5\u503C\u4E0D\u8981\u5927\u4E8E5."),