@umbraco-cms/mcp-dev 18.1.4 → 18.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3087,9 +3087,28 @@ var require_utils = __commonJS({
3087
3087
  "use strict";
3088
3088
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3089
3089
  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);
3090
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
3090
3091
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3091
3092
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3092
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3093
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
3094
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
3095
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
3096
+ var BYTE_HEX = new Array(256);
3097
+ {
3098
+ const HEX_DIGITS = "0123456789ABCDEF";
3099
+ for (let i = 0; i < 256; i++) {
3100
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
3101
+ }
3102
+ }
3103
+ function percentEncodeNonAscii(cp) {
3104
+ if (cp < 2048) {
3105
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
3106
+ }
3107
+ if (cp < 65536) {
3108
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3109
+ }
3110
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3111
+ }
3093
3112
  function stringArrayToHexStripped(input) {
3094
3113
  let acc = "";
3095
3114
  let code = 0;
@@ -3114,91 +3133,105 @@ var require_utils = __commonJS({
3114
3133
  }
3115
3134
  return acc;
3116
3135
  }
3136
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
3137
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
3138
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
3117
3139
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
3118
- function consumeIsZone(buffer) {
3119
- buffer.length = 0;
3120
- return true;
3121
- }
3122
- function consumeHextets(buffer, address, output) {
3123
- if (buffer.length) {
3124
- const hex = stringArrayToHexStripped(buffer);
3125
- if (hex !== "") {
3126
- address.push(hex);
3127
- } else {
3128
- output.error = true;
3129
- return false;
3140
+ function isZoneIdentifier(zone) {
3141
+ if (zone.length === 0) return false;
3142
+ for (let i = 0; i < zone.length; i++) {
3143
+ if (isZoneCharacter(zone[i])) continue;
3144
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
3145
+ i += 2;
3146
+ continue;
3130
3147
  }
3131
- buffer.length = 0;
3148
+ return false;
3132
3149
  }
3133
3150
  return true;
3134
3151
  }
3135
- function getIPV6(input) {
3136
- let tokenCount = 0;
3137
- const output = { error: false, address: "", zone: "" };
3138
- const address = [];
3139
- const buffer = [];
3140
- let endipv6Encountered = false;
3141
- let endIpv6 = false;
3142
- let consume = consumeHextets;
3143
- for (let i = 0; i < input.length; i++) {
3144
- const cursor = input[i];
3145
- if (cursor === "[" || cursor === "]") {
3146
- continue;
3147
- }
3148
- if (cursor === ":") {
3149
- if (endipv6Encountered === true) {
3150
- endIpv6 = true;
3151
- }
3152
- if (!consume(buffer, address, output)) {
3153
- break;
3152
+ function compressIPv6ZeroRun(hextets) {
3153
+ let bestStart = -1;
3154
+ let bestLength = 0;
3155
+ let runStart = -1;
3156
+ let runLength = 0;
3157
+ for (let i = 0; i < hextets.length; i++) {
3158
+ if (hextets[i] === "0") {
3159
+ if (runStart === -1) runStart = i;
3160
+ runLength++;
3161
+ if (runLength > bestLength) {
3162
+ bestLength = runLength;
3163
+ bestStart = runStart;
3154
3164
  }
3155
- if (++tokenCount > 7) {
3156
- output.error = true;
3157
- break;
3158
- }
3159
- if (i > 0 && input[i - 1] === ":") {
3160
- endipv6Encountered = true;
3161
- }
3162
- address.push(":");
3163
- continue;
3164
- } else if (cursor === "%") {
3165
- if (!consume(buffer, address, output)) {
3166
- break;
3167
- }
3168
- consume = consumeIsZone;
3169
3165
  } else {
3170
- buffer.push(cursor);
3166
+ runStart = -1;
3167
+ runLength = 0;
3168
+ }
3169
+ }
3170
+ if (bestLength < 2) return hextets.join(":");
3171
+ const head = hextets.slice(0, bestStart).join(":");
3172
+ const tail = hextets.slice(bestStart + bestLength).join(":");
3173
+ return head + "::" + tail;
3174
+ }
3175
+ function normalizeIPv6Address(input) {
3176
+ const compression = input.indexOf("::");
3177
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
3178
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
3179
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
3180
+ if (compression !== -1) {
3181
+ if (left.length === 1 && left[0] === "") left.length = 0;
3182
+ if (right.length === 1 && right[0] === "") right.length = 0;
3183
+ }
3184
+ const parts = left.concat(right);
3185
+ let hextetCount = 0;
3186
+ for (let i = 0; i < parts.length; i++) {
3187
+ const part = parts[i];
3188
+ if (part === "") return void 0;
3189
+ if (part.indexOf(".") !== -1) {
3190
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
3191
+ hextetCount += 2;
3171
3192
  continue;
3172
3193
  }
3194
+ if (!isHextet(part)) return void 0;
3195
+ parts[i] = parseInt(part, 16).toString(16);
3196
+ hextetCount++;
3173
3197
  }
3174
- if (buffer.length) {
3175
- if (consume === consumeIsZone) {
3176
- output.zone = buffer.join("");
3177
- } else if (endIpv6) {
3178
- address.push(buffer.join(""));
3179
- } else {
3180
- address.push(stringArrayToHexStripped(buffer));
3181
- }
3198
+ if (compression === -1) {
3199
+ if (hextetCount !== 8) return void 0;
3200
+ return compressIPv6ZeroRun(parts);
3182
3201
  }
3183
- output.address = address.join("");
3184
- return output;
3202
+ if (hextetCount >= 8) return void 0;
3203
+ const expanded = parts.slice(0, left.length);
3204
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
3205
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
3206
+ return compressIPv6ZeroRun(expanded);
3185
3207
  }
3186
3208
  function normalizeIPv6(host) {
3187
- if (findToken(host, ":") < 2) {
3188
- return { host, isIPV6: false };
3189
- }
3190
- const ipv6 = getIPV6(host);
3191
- if (!ipv6.error) {
3192
- let newHost = ipv6.address;
3193
- let escapedHost = ipv6.address;
3194
- if (ipv6.zone) {
3195
- newHost += "%" + ipv6.zone;
3196
- escapedHost += "%25" + ipv6.zone;
3197
- }
3198
- return { host: newHost, isIPV6: true, escapedHost };
3199
- } else {
3200
- return { host, isIPV6: false };
3201
- }
3209
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
3210
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
3211
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
3212
+ let input = bracketed ? host.slice(1, -1) : host;
3213
+ if (bracketed && isIPvFuture(input)) {
3214
+ input = input.toLowerCase();
3215
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
3216
+ }
3217
+ if (findToken(input, ":") < 2) {
3218
+ return { host, isIPV6: false, error: bracketed };
3219
+ }
3220
+ let zoneIdentifier = "";
3221
+ const zoneSeparator = input.indexOf("%");
3222
+ if (zoneSeparator !== -1) {
3223
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
3224
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
3225
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
3226
+ input = input.slice(0, zoneSeparator);
3227
+ }
3228
+ const address = normalizeIPv6Address(input);
3229
+ if (address === void 0) return { host, isIPV6: false, error: true };
3230
+ return {
3231
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
3232
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
3233
+ isIPV6: true
3234
+ };
3202
3235
  }
3203
3236
  function findToken(str, token) {
3204
3237
  let ind = 0;
@@ -3317,7 +3350,8 @@ var require_utils = __commonJS({
3317
3350
  function normalizePathEncoding(input) {
3318
3351
  let output = "";
3319
3352
  for (let i = 0; i < input.length; i++) {
3320
- if (input[i] === "%" && i + 2 < input.length) {
3353
+ const ch = input[i];
3354
+ if (ch === "%" && i + 2 < input.length) {
3321
3355
  const hex = input.slice(i + 1, i + 3);
3322
3356
  if (isHexPair(hex)) {
3323
3357
  const normalizedHex = hex.toUpperCase();
@@ -3331,10 +3365,152 @@ var require_utils = __commonJS({
3331
3365
  continue;
3332
3366
  }
3333
3367
  }
3334
- if (isPathCharacter(input[i])) {
3335
- output += input[i];
3368
+ if (isPathCharacter(ch)) {
3369
+ output += ch;
3370
+ } else {
3371
+ const code = input.charCodeAt(i);
3372
+ if (code < 128) {
3373
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3374
+ } else if (code < 55296 || code > 57343) {
3375
+ output += percentEncodeNonAscii(code);
3376
+ } else if (code <= 56319 && i + 1 < input.length) {
3377
+ const low = input.charCodeAt(i + 1);
3378
+ if (low >= 56320 && low <= 57343) {
3379
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3380
+ i++;
3381
+ } else {
3382
+ output += percentEncodeNonAscii(65533);
3383
+ }
3384
+ } else {
3385
+ output += percentEncodeNonAscii(65533);
3386
+ }
3387
+ }
3388
+ }
3389
+ return output;
3390
+ }
3391
+ function serializePathEncoding(input, pathNoScheme = false) {
3392
+ let output = "";
3393
+ let firstSegment = pathNoScheme && input[0] !== "/";
3394
+ for (let i = 0; i < input.length; i++) {
3395
+ const ch = input[i];
3396
+ if (ch === "%" && i + 2 < input.length) {
3397
+ const hex = input.slice(i + 1, i + 3);
3398
+ if (isHexPair(hex)) {
3399
+ output += "%" + hex.toUpperCase();
3400
+ i += 2;
3401
+ continue;
3402
+ }
3403
+ }
3404
+ if (ch === "/") {
3405
+ firstSegment = false;
3406
+ }
3407
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
3408
+ output += ch;
3409
+ } else {
3410
+ const code = input.charCodeAt(i);
3411
+ if (code < 128) {
3412
+ output += BYTE_HEX[code];
3413
+ } else if (code < 55296 || code > 57343) {
3414
+ output += percentEncodeNonAscii(code);
3415
+ } else if (code <= 56319 && i + 1 < input.length) {
3416
+ const low = input.charCodeAt(i + 1);
3417
+ if (low >= 56320 && low <= 57343) {
3418
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3419
+ i++;
3420
+ } else {
3421
+ output += percentEncodeNonAscii(65533);
3422
+ }
3423
+ } else {
3424
+ output += percentEncodeNonAscii(65533);
3425
+ }
3426
+ }
3427
+ }
3428
+ return output;
3429
+ }
3430
+ function encodeComponent(input, isAllowed) {
3431
+ let output = "";
3432
+ for (let i = 0; i < input.length; i++) {
3433
+ const ch = input[i];
3434
+ if (ch === "%" && i + 2 < input.length) {
3435
+ const hex = input.slice(i + 1, i + 3);
3436
+ if (isHexPair(hex)) {
3437
+ output += "%" + hex.toUpperCase();
3438
+ i += 2;
3439
+ continue;
3440
+ }
3441
+ }
3442
+ if (isAllowed(ch)) {
3443
+ output += ch;
3444
+ } else {
3445
+ const code = input.charCodeAt(i);
3446
+ if (code < 128) {
3447
+ output += BYTE_HEX[code];
3448
+ } else if (code < 55296 || code > 57343) {
3449
+ output += percentEncodeNonAscii(code);
3450
+ } else if (code <= 56319 && i + 1 < input.length) {
3451
+ const low = input.charCodeAt(i + 1);
3452
+ if (low >= 56320 && low <= 57343) {
3453
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3454
+ i++;
3455
+ } else {
3456
+ output += percentEncodeNonAscii(65533);
3457
+ }
3458
+ } else {
3459
+ output += percentEncodeNonAscii(65533);
3460
+ }
3461
+ }
3462
+ }
3463
+ return output;
3464
+ }
3465
+ function encodeUserinfo(input) {
3466
+ return encodeComponent(input, isUserinfoCharacter);
3467
+ }
3468
+ function encodeQuery(input) {
3469
+ return encodeComponent(input, isQueryFragmentCharacter);
3470
+ }
3471
+ function encodeFragment(input) {
3472
+ return encodeComponent(input, isQueryFragmentCharacter);
3473
+ }
3474
+ function isEscapeSafe(cp) {
3475
+ 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;
3476
+ }
3477
+ function normalizeQueryFragmentEncoding(input) {
3478
+ let output = "";
3479
+ for (let i = 0; i < input.length; i++) {
3480
+ const ch = input[i];
3481
+ if (ch === "%" && i + 2 < input.length) {
3482
+ const hex = input.slice(i + 1, i + 3);
3483
+ if (isHexPair(hex)) {
3484
+ const normalizedHex = hex.toUpperCase();
3485
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3486
+ if (isUnreserved(decoded)) {
3487
+ output += decoded;
3488
+ } else {
3489
+ output += "%" + normalizedHex;
3490
+ }
3491
+ i += 2;
3492
+ continue;
3493
+ }
3494
+ }
3495
+ if (isQueryFragmentCharacter(ch)) {
3496
+ output += ch;
3336
3497
  } else {
3337
- output += escape(input[i]);
3498
+ const code = input.charCodeAt(i);
3499
+ if (code < 128) {
3500
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3501
+ } else if (code < 55296 || code > 57343) {
3502
+ output += percentEncodeNonAscii(code);
3503
+ } else if (code <= 56319 && i + 1 < input.length) {
3504
+ const low = input.charCodeAt(i + 1);
3505
+ if (low >= 56320 && low <= 57343) {
3506
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3507
+ i++;
3508
+ } else {
3509
+ output += percentEncodeNonAscii(65533);
3510
+ }
3511
+ } else {
3512
+ output += percentEncodeNonAscii(65533);
3513
+ }
3338
3514
  }
3339
3515
  }
3340
3516
  return output;
@@ -3357,14 +3533,18 @@ var require_utils = __commonJS({
3357
3533
  function recomposeAuthority(component) {
3358
3534
  const uriTokens = [];
3359
3535
  if (component.userinfo !== void 0) {
3360
- uriTokens.push(component.userinfo);
3536
+ uriTokens.push(encodeUserinfo(component.userinfo));
3361
3537
  uriTokens.push("@");
3362
3538
  }
3363
3539
  if (component.host !== void 0) {
3364
- let host = unescape(component.host);
3540
+ let host = component.host;
3365
3541
  if (!isIPv4(host)) {
3366
- const ipV6res = normalizeIPv6(host);
3367
- if (ipV6res.isIPV6 === true) {
3542
+ let ipV6res = normalizeIPv6(host);
3543
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
3544
+ host = normalizePercentEncoding(host, true);
3545
+ ipV6res = normalizeIPv6(host);
3546
+ }
3547
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
3368
3548
  host = `[${ipV6res.escapedHost}]`;
3369
3549
  } else {
3370
3550
  host = reescapeHostDelimiters(host, false);
@@ -3373,8 +3553,12 @@ var require_utils = __commonJS({
3373
3553
  uriTokens.push(host);
3374
3554
  }
3375
3555
  if (typeof component.port === "number" || typeof component.port === "string") {
3556
+ const port = String(component.port);
3557
+ if (!isPort(port)) {
3558
+ throw new TypeError("URI port is malformed.");
3559
+ }
3376
3560
  uriTokens.push(":");
3377
- uriTokens.push(String(component.port));
3561
+ uriTokens.push(port);
3378
3562
  }
3379
3563
  return uriTokens.length ? uriTokens.join("") : void 0;
3380
3564
  }
@@ -3384,6 +3568,11 @@ var require_utils = __commonJS({
3384
3568
  reescapeHostDelimiters,
3385
3569
  normalizePercentEncoding,
3386
3570
  normalizePathEncoding,
3571
+ serializePathEncoding,
3572
+ normalizeQueryFragmentEncoding,
3573
+ encodeUserinfo,
3574
+ encodeQuery,
3575
+ encodeFragment,
3387
3576
  escapePreservingEscapes,
3388
3577
  removeDotSegments,
3389
3578
  isIPv4,
@@ -3399,7 +3588,7 @@ var require_schemes = __commonJS({
3399
3588
  "node_modules/fast-uri/lib/schemes.js"(exports, module) {
3400
3589
  "use strict";
3401
3590
  var { isUUID } = require_utils();
3402
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
3591
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
3403
3592
  var supportedSchemeNames = (
3404
3593
  /** @type {const} */
3405
3594
  [
@@ -3460,9 +3649,10 @@ var require_schemes = __commonJS({
3460
3649
  wsComponent.secure = void 0;
3461
3650
  }
3462
3651
  if (wsComponent.resourceName) {
3463
- const [path, query] = wsComponent.resourceName.split("?");
3652
+ const queryIndex = wsComponent.resourceName.indexOf("?");
3653
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3464
3654
  wsComponent.path = path && path !== "/" ? path : void 0;
3465
- wsComponent.query = query;
3655
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3466
3656
  wsComponent.resourceName = void 0;
3467
3657
  }
3468
3658
  wsComponent.fragment = void 0;
@@ -3474,7 +3664,7 @@ var require_schemes = __commonJS({
3474
3664
  return urnComponent;
3475
3665
  }
3476
3666
  const matches = urnComponent.path.match(URN_REG);
3477
- if (matches) {
3667
+ if (matches && matches[0] === urnComponent.path) {
3478
3668
  const scheme = options.scheme || urnComponent.scheme || "urn";
3479
3669
  urnComponent.nid = matches[1].toLowerCase();
3480
3670
  urnComponent.nss = matches[2];
@@ -3608,8 +3798,17 @@ var require_schemes = __commonJS({
3608
3798
  var require_fast_uri = __commonJS({
3609
3799
  "node_modules/fast-uri/index.js"(exports, module) {
3610
3800
  "use strict";
3611
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3801
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3612
3802
  var { SCHEMES, getSchemeHandler } = require_schemes();
3803
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3804
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3805
+ function decodeValidScheme(scheme) {
3806
+ const decodedScheme = unescape(String(scheme));
3807
+ if (!VALID_SCHEME.test(decodedScheme)) {
3808
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
3809
+ }
3810
+ return decodedScheme;
3811
+ }
3613
3812
  function normalize(uri, options) {
3614
3813
  if (typeof uri === "string") {
3615
3814
  uri = /** @type {T} */
@@ -3622,12 +3821,34 @@ var require_fast_uri = __commonJS({
3622
3821
  }
3623
3822
  function resolve(baseURI, relativeURI, options) {
3624
3823
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3625
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3626
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3627
- if (baseMalformed || relativeMalformed) {
3824
+ const {
3825
+ parsed: baseParsed,
3826
+ malformedAuthorityOrPort: baseMalformed,
3827
+ malformedPercentEncoding: baseMalformedPercentEncoding,
3828
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
3829
+ malformedHost: baseMalformedHost,
3830
+ malformedScheme: baseMalformedScheme
3831
+ } = parseWithStatus(baseURI, schemelessOptions);
3832
+ const {
3833
+ parsed: relativeParsed,
3834
+ malformedAuthorityOrPort: relativeMalformed,
3835
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
3836
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
3837
+ malformedHost: relativeMalformedHost,
3838
+ malformedScheme: relativeMalformedScheme
3839
+ } = parseWithStatus(relativeURI, schemelessOptions);
3840
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
3628
3841
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
3629
3842
  }
3630
3843
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3844
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3845
+ const resolvedHost = resolved.host;
3846
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3847
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3848
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3849
+ if (resolved.error && !encodedASCIIHost) {
3850
+ throw new Error(resolved.error);
3851
+ }
3631
3852
  schemelessOptions.skipEscape = true;
3632
3853
  return serialize(resolved, schemelessOptions);
3633
3854
  }
@@ -3687,7 +3908,7 @@ var require_fast_uri = __commonJS({
3687
3908
  function equal(uriA, uriB, options) {
3688
3909
  const normalizedA = normalizeComparableURI(uriA, options);
3689
3910
  const normalizedB = normalizeComparableURI(uriB, options);
3690
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3911
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
3691
3912
  }
3692
3913
  function serialize(cmpts, opts) {
3693
3914
  const component = {
@@ -3708,19 +3929,22 @@ var require_fast_uri = __commonJS({
3708
3929
  };
3709
3930
  const options = Object.assign({}, opts);
3710
3931
  const uriTokens = [];
3932
+ if (component.scheme) {
3933
+ component.scheme = decodeValidScheme(component.scheme);
3934
+ }
3711
3935
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3712
3936
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3937
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3938
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
3713
3939
  if (component.path !== void 0) {
3714
3940
  if (!options.skipEscape) {
3715
- component.path = escapePreservingEscapes(component.path);
3716
- if (component.scheme !== void 0) {
3717
- component.path = component.path.split("%3A").join(":");
3718
- }
3941
+ component.path = serializePathEncoding(component.path, pathNoScheme);
3719
3942
  } else {
3720
3943
  component.path = normalizePercentEncoding(component.path);
3721
3944
  }
3722
3945
  }
3723
3946
  if (options.reference !== "suffix" && component.scheme) {
3947
+ component.scheme = decodeValidScheme(component.scheme);
3724
3948
  uriTokens.push(component.scheme, ":");
3725
3949
  }
3726
3950
  const authority = recomposeAuthority(component);
@@ -3738,16 +3962,19 @@ var require_fast_uri = __commonJS({
3738
3962
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3739
3963
  s = removeDotSegments(s);
3740
3964
  }
3965
+ if (pathNoScheme) {
3966
+ s = serializePathEncoding(s, true);
3967
+ }
3741
3968
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
3742
3969
  s = "/%2F" + s.slice(2);
3743
3970
  }
3744
3971
  uriTokens.push(s);
3745
3972
  }
3746
3973
  if (component.query !== void 0) {
3747
- uriTokens.push("?", component.query);
3974
+ uriTokens.push("?", encodeQuery(component.query));
3748
3975
  }
3749
3976
  if (component.fragment !== void 0) {
3750
- uriTokens.push("#", component.fragment);
3977
+ uriTokens.push("#", encodeFragment(component.fragment));
3751
3978
  }
3752
3979
  return uriTokens.join("");
3753
3980
  }
@@ -3763,6 +3990,35 @@ var require_fast_uri = __commonJS({
3763
3990
  }
3764
3991
  return void 0;
3765
3992
  }
3993
+ function hasMalformedPercentEncoding(component) {
3994
+ if (component === void 0) return false;
3995
+ let percent = component.indexOf("%");
3996
+ while (percent !== -1) {
3997
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
3998
+ return true;
3999
+ }
4000
+ percent = component.indexOf("%", percent + 3);
4001
+ }
4002
+ return false;
4003
+ }
4004
+ function isIPLiteral(host) {
4005
+ return host[0] === "[" && host[host.length - 1] === "]";
4006
+ }
4007
+ function hasMalformedComponentPercentEncoding(matches) {
4008
+ const host = matches[4];
4009
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4010
+ }
4011
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4012
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4013
+ try {
4014
+ parsed.host = new URL("http://" + parsed.host).hostname;
4015
+ } catch (e) {
4016
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4017
+ return true;
4018
+ }
4019
+ }
4020
+ return false;
4021
+ }
3766
4022
  function parseWithStatus(uri, opts) {
3767
4023
  const options = Object.assign({}, opts);
3768
4024
  const parsed = {
@@ -3775,6 +4031,11 @@ var require_fast_uri = __commonJS({
3775
4031
  fragment: void 0
3776
4032
  };
3777
4033
  let malformedAuthorityOrPort = false;
4034
+ let malformedPercentEncoding = false;
4035
+ let malformedSchemeSpecific = false;
4036
+ let malformedHost = false;
4037
+ let malformedIPLiteral = false;
4038
+ let malformedScheme = false;
3778
4039
  let isIP = false;
3779
4040
  if (options.reference === "suffix") {
3780
4041
  if (options.scheme) {
@@ -3811,6 +4072,19 @@ var require_fast_uri = __commonJS({
3811
4072
  parsed.path = matches[6] || "";
3812
4073
  parsed.query = matches[7];
3813
4074
  parsed.fragment = matches[8];
4075
+ if (parsed.scheme !== void 0) {
4076
+ const decodedScheme = unescape(parsed.scheme);
4077
+ if (VALID_SCHEME.test(decodedScheme)) {
4078
+ parsed.scheme = decodedScheme.toLowerCase();
4079
+ } else {
4080
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4081
+ malformedScheme = true;
4082
+ }
4083
+ }
4084
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
4085
+ if (malformedPercentEncoding) {
4086
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
4087
+ }
3814
4088
  if (isNaN(parsed.port)) {
3815
4089
  parsed.port = matches[5];
3816
4090
  }
@@ -3822,9 +4096,16 @@ var require_fast_uri = __commonJS({
3822
4096
  if (parsed.host) {
3823
4097
  const ipv4result = isIPv4(parsed.host);
3824
4098
  if (ipv4result === false) {
4099
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4100
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
3825
4101
  const ipv6result = normalizeIPv6(parsed.host);
3826
- parsed.host = ipv6result.host.toLowerCase();
3827
- isIP = ipv6result.isIPV6;
4102
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4103
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4104
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4105
+ if (malformedIPLiteral) {
4106
+ parsed.error = parsed.error || "URI host is malformed.";
4107
+ malformedAuthorityOrPort = true;
4108
+ }
3828
4109
  } else {
3829
4110
  isIP = true;
3830
4111
  }
@@ -3842,42 +4123,36 @@ var require_fast_uri = __commonJS({
3842
4123
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
3843
4124
  }
3844
4125
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
3845
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
3846
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
3847
- try {
3848
- parsed.host = new URL("http://" + parsed.host).hostname;
3849
- } catch (e) {
3850
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
3851
- }
3852
- }
4126
+ if (!malformedIPLiteral) {
4127
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
3853
4128
  }
3854
4129
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
3855
4130
  if (uri.indexOf("%") !== -1) {
3856
- if (parsed.scheme !== void 0) {
3857
- parsed.scheme = unescape(parsed.scheme);
3858
- }
3859
- if (parsed.host !== void 0) {
3860
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
4131
+ if (parsed.host !== void 0 && !malformedIPLiteral) {
4132
+ const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4133
+ parsed.host = reescapeHostDelimiters(host, isIP);
3861
4134
  }
3862
4135
  }
3863
4136
  if (parsed.path) {
3864
4137
  parsed.path = normalizePathEncoding(parsed.path);
3865
4138
  }
4139
+ if (parsed.query) {
4140
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
4141
+ }
3866
4142
  if (parsed.fragment) {
3867
- try {
3868
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3869
- } catch {
3870
- parsed.error = parsed.error || "URI malformed";
3871
- }
4143
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
3872
4144
  }
3873
4145
  }
3874
4146
  if (schemeHandler && schemeHandler.parse) {
3875
4147
  schemeHandler.parse(parsed, options);
4148
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
4149
+ malformedSchemeSpecific = true;
4150
+ }
3876
4151
  }
3877
4152
  } else {
3878
4153
  parsed.error = parsed.error || "URI can not be parsed.";
3879
4154
  }
3880
- return { parsed, malformedAuthorityOrPort };
4155
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
3881
4156
  }
3882
4157
  function parse(uri, opts) {
3883
4158
  return parseWithStatus(uri, opts).parsed;
@@ -3886,20 +4161,28 @@ var require_fast_uri = __commonJS({
3886
4161
  return normalizeStringWithStatus(uri, opts).normalized;
3887
4162
  }
3888
4163
  function normalizeStringWithStatus(uri, opts) {
3889
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
4164
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
3890
4165
  return {
3891
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3892
- malformedAuthorityOrPort
4166
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4167
+ malformedAuthorityOrPort,
4168
+ malformedPercentEncoding,
4169
+ malformedSchemeSpecific,
4170
+ malformedHost,
4171
+ malformedScheme
3893
4172
  };
3894
4173
  }
3895
4174
  function normalizeComparableURI(uri, opts) {
3896
- if (typeof uri === "string") {
3897
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3898
- return malformedAuthorityOrPort ? void 0 : normalized;
4175
+ if (typeof uri !== "string" && typeof uri !== "object") {
4176
+ return void 0;
3899
4177
  }
3900
- if (typeof uri === "object") {
3901
- return serialize(uri, opts);
4178
+ let value;
4179
+ try {
4180
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
4181
+ } catch {
4182
+ return void 0;
3902
4183
  }
4184
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
4185
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
3903
4186
  }
3904
4187
  var fastUri = {
3905
4188
  SCHEMES,
@@ -12537,7 +12820,7 @@ var StdioServerTransport = class {
12537
12820
  // package.json
12538
12821
  var package_default = {
12539
12822
  name: "@umbraco-cms/mcp-dev",
12540
- version: "18.1.4",
12823
+ version: "18.1.6",
12541
12824
  type: "module",
12542
12825
  description: "A model context protocol (MCP) server for Umbraco CMS",
12543
12826
  main: "dist/index.js",
@@ -12609,8 +12892,8 @@ var package_default = {
12609
12892
  "@modelcontextprotocol/sdk": "^1.28.0",
12610
12893
  "@types/uuid": "^10.0.0",
12611
12894
  "@types/yargs": "^17.0.33",
12612
- "@umbraco-cms/mcp-hosted": "^1.0.0-beta.39",
12613
- "@umbraco-cms/mcp-server-sdk": "^1.0.0-beta.39",
12895
+ "@umbraco-cms/mcp-hosted": "^1.0.0-beta.40",
12896
+ "@umbraco-cms/mcp-server-sdk": "^1.0.0-beta.40",
12614
12897
  dotenv: "^16.5.0",
12615
12898
  "form-data": "^4.0.4",
12616
12899
  "mime-types": "^3.0.1",