@testgorilla/tgo-ui 11.17.0 → 11.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs +7 -7
  2. package/fesm2022/testgorilla-tgo-ui-components-accordion.mjs.map +1 -1
  3. package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs +7 -7
  4. package/fesm2022/testgorilla-tgo-ui-components-ai-audio-circle.mjs.map +1 -1
  5. package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs +7 -7
  6. package/fesm2022/testgorilla-tgo-ui-components-ai-caveat.mjs.map +1 -1
  7. package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs +7 -7
  8. package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs.map +1 -1
  9. package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs +7 -7
  10. package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs.map +1 -1
  11. package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs +10 -10
  12. package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs.map +1 -1
  13. package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs +15 -15
  14. package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs.map +1 -1
  15. package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs +19 -19
  16. package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs.map +1 -1
  17. package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs +10 -10
  18. package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs.map +1 -1
  19. package/fesm2022/testgorilla-tgo-ui-components-badge.mjs +7 -7
  20. package/fesm2022/testgorilla-tgo-ui-components-badge.mjs.map +1 -1
  21. package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs +7 -7
  22. package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs.map +1 -1
  23. package/fesm2022/testgorilla-tgo-ui-components-button.mjs +11 -9
  24. package/fesm2022/testgorilla-tgo-ui-components-button.mjs.map +1 -1
  25. package/fesm2022/testgorilla-tgo-ui-components-card.mjs +7 -7
  26. package/fesm2022/testgorilla-tgo-ui-components-card.mjs.map +1 -1
  27. package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs +10 -10
  28. package/fesm2022/testgorilla-tgo-ui-components-checkbox.mjs.map +1 -1
  29. package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs +3 -3
  30. package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs.map +1 -1
  31. package/fesm2022/testgorilla-tgo-ui-components-core.mjs +42 -42
  32. package/fesm2022/testgorilla-tgo-ui-components-core.mjs.map +1 -1
  33. package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs +19 -19
  34. package/fesm2022/testgorilla-tgo-ui-components-datepicker.mjs.map +1 -1
  35. package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs +7 -7
  36. package/fesm2022/testgorilla-tgo-ui-components-device-control.mjs.map +1 -1
  37. package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs +24 -24
  38. package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs.map +1 -1
  39. package/fesm2022/testgorilla-tgo-ui-components-divider.mjs +7 -7
  40. package/fesm2022/testgorilla-tgo-ui-components-divider.mjs.map +1 -1
  41. package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs +7 -7
  42. package/fesm2022/testgorilla-tgo-ui-components-donut-chart.mjs.map +1 -1
  43. package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs +7 -7
  44. package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs.map +1 -1
  45. package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs +7 -7
  46. package/fesm2022/testgorilla-tgo-ui-components-elevation-shadow.mjs.map +1 -1
  47. package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs +7 -7
  48. package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs.map +1 -1
  49. package/fesm2022/testgorilla-tgo-ui-components-field.mjs +7 -7
  50. package/fesm2022/testgorilla-tgo-ui-components-field.mjs.map +1 -1
  51. package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs +10 -10
  52. package/fesm2022/testgorilla-tgo-ui-components-file-upload.mjs.map +1 -1
  53. package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs +7 -7
  54. package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs.map +1 -1
  55. package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs +7 -7
  56. package/fesm2022/testgorilla-tgo-ui-components-gaussian-chart.mjs.map +1 -1
  57. package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs +7 -7
  58. package/fesm2022/testgorilla-tgo-ui-components-icon-label.mjs.map +1 -1
  59. package/fesm2022/testgorilla-tgo-ui-components-icon.mjs +10 -10
  60. package/fesm2022/testgorilla-tgo-ui-components-icon.mjs.map +1 -1
  61. package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs +7 -7
  62. package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs.map +1 -1
  63. package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs +7 -7
  64. package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs.map +1 -1
  65. package/fesm2022/testgorilla-tgo-ui-components-logo.mjs +7 -7
  66. package/fesm2022/testgorilla-tgo-ui-components-logo.mjs.map +1 -1
  67. package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs +3 -3
  68. package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs.map +1 -1
  69. package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs +3 -3
  70. package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs.map +1 -1
  71. package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs +7 -7
  72. package/fesm2022/testgorilla-tgo-ui-components-multi-input.mjs.map +1 -1
  73. package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs +10 -10
  74. package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs.map +1 -1
  75. package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs +7 -7
  76. package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs.map +1 -1
  77. package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs +7 -7
  78. package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs.map +1 -1
  79. package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs +7 -7
  80. package/fesm2022/testgorilla-tgo-ui-components-paginator.mjs.map +1 -1
  81. package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs +7 -7
  82. package/fesm2022/testgorilla-tgo-ui-components-password-criteria.mjs.map +1 -1
  83. package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs +7 -7
  84. package/fesm2022/testgorilla-tgo-ui-components-password-strength.mjs.map +1 -1
  85. package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs +10 -10
  86. package/fesm2022/testgorilla-tgo-ui-components-phone-input.mjs.map +1 -1
  87. package/fesm2022/testgorilla-tgo-ui-components-popover.mjs +6 -6
  88. package/fesm2022/testgorilla-tgo-ui-components-popover.mjs.map +1 -1
  89. package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs +7 -7
  90. package/fesm2022/testgorilla-tgo-ui-components-popup-tip.mjs.map +1 -1
  91. package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs +7 -7
  92. package/fesm2022/testgorilla-tgo-ui-components-progress-bar.mjs.map +1 -1
  93. package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs +7 -7
  94. package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs.map +1 -1
  95. package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs +7 -7
  96. package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs.map +1 -1
  97. package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs +7 -7
  98. package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs.map +1 -1
  99. package/fesm2022/testgorilla-tgo-ui-components-rating.mjs +10 -10
  100. package/fesm2022/testgorilla-tgo-ui-components-rating.mjs.map +1 -1
  101. package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs +3 -3
  102. package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs.map +1 -1
  103. package/fesm2022/testgorilla-tgo-ui-components-scale.mjs +7 -7
  104. package/fesm2022/testgorilla-tgo-ui-components-scale.mjs.map +1 -1
  105. package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs +7 -7
  106. package/fesm2022/testgorilla-tgo-ui-components-segmented-bar.mjs.map +1 -1
  107. package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs +7 -7
  108. package/fesm2022/testgorilla-tgo-ui-components-segmented-button.mjs.map +1 -1
  109. package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs +3 -3
  110. package/fesm2022/testgorilla-tgo-ui-components-segmented-toggle.mjs.map +1 -1
  111. package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs +7 -7
  112. package/fesm2022/testgorilla-tgo-ui-components-selectable-card.mjs.map +1 -1
  113. package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs +7 -7
  114. package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs.map +1 -1
  115. package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs +12 -12
  116. package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs.map +1 -1
  117. package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs +10 -10
  118. package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs.map +1 -1
  119. package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs +3 -3
  120. package/fesm2022/testgorilla-tgo-ui-components-skeleton.mjs.map +1 -1
  121. package/fesm2022/testgorilla-tgo-ui-components-slider.mjs +7 -7
  122. package/fesm2022/testgorilla-tgo-ui-components-slider.mjs.map +1 -1
  123. package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs +10 -10
  124. package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs.map +1 -1
  125. package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs +7 -7
  126. package/fesm2022/testgorilla-tgo-ui-components-spider-chart.mjs.map +1 -1
  127. package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs +7 -7
  128. package/fesm2022/testgorilla-tgo-ui-components-spinner.mjs.map +1 -1
  129. package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs +17 -17
  130. package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs.map +1 -1
  131. package/fesm2022/testgorilla-tgo-ui-components-table.mjs +10 -10
  132. package/fesm2022/testgorilla-tgo-ui-components-table.mjs.map +1 -1
  133. package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs +10 -10
  134. package/fesm2022/testgorilla-tgo-ui-components-tabs.mjs.map +1 -1
  135. package/fesm2022/testgorilla-tgo-ui-components-tag.mjs +7 -7
  136. package/fesm2022/testgorilla-tgo-ui-components-tag.mjs.map +1 -1
  137. package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs +7 -7
  138. package/fesm2022/testgorilla-tgo-ui-components-toggle.mjs.map +1 -1
  139. package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs +10 -10
  140. package/fesm2022/testgorilla-tgo-ui-components-tooltip.mjs.map +1 -1
  141. package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs +17 -17
  142. package/fesm2022/testgorilla-tgo-ui-components-universal-skills.mjs.map +1 -1
  143. package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs +7 -7
  144. package/fesm2022/testgorilla-tgo-ui-components-validation-error.mjs.map +1 -1
  145. package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs +10 -10
  146. package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs.map +1 -1
  147. package/fesm2022/testgorilla-tgo-ui.mjs +7 -7
  148. package/fesm2022/testgorilla-tgo-ui.mjs.map +1 -1
  149. package/mcp/catalog.json +1 -1
  150. package/mcp/server.mjs +412 -128
  151. package/package.json +9 -9
  152. package/types/testgorilla-tgo-ui-components-button.d.ts +3 -1
  153. package/projects/tgo-canopy-ui/assets/images/premium.svg +0 -5
package/mcp/server.mjs CHANGED
@@ -3108,9 +3108,28 @@ var require_utils = __commonJS({
3108
3108
  "use strict";
3109
3109
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3110
3110
  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);
3111
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
3111
3112
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3112
3113
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3113
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3114
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
3115
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
3116
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
3117
+ var BYTE_HEX = new Array(256);
3118
+ {
3119
+ const HEX_DIGITS = "0123456789ABCDEF";
3120
+ for (let i = 0; i < 256; i++) {
3121
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
3122
+ }
3123
+ }
3124
+ function percentEncodeNonAscii(cp) {
3125
+ if (cp < 2048) {
3126
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
3127
+ }
3128
+ if (cp < 65536) {
3129
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3130
+ }
3131
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
3132
+ }
3114
3133
  function stringArrayToHexStripped(input) {
3115
3134
  let acc = "";
3116
3135
  let code = 0;
@@ -3135,91 +3154,105 @@ var require_utils = __commonJS({
3135
3154
  }
3136
3155
  return acc;
3137
3156
  }
3157
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
3158
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
3159
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
3138
3160
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
3139
- function consumeIsZone(buffer) {
3140
- buffer.length = 0;
3141
- return true;
3142
- }
3143
- function consumeHextets(buffer, address, output) {
3144
- if (buffer.length) {
3145
- const hex = stringArrayToHexStripped(buffer);
3146
- if (hex !== "") {
3147
- address.push(hex);
3148
- } else {
3149
- output.error = true;
3150
- return false;
3161
+ function isZoneIdentifier(zone) {
3162
+ if (zone.length === 0) return false;
3163
+ for (let i = 0; i < zone.length; i++) {
3164
+ if (isZoneCharacter(zone[i])) continue;
3165
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
3166
+ i += 2;
3167
+ continue;
3151
3168
  }
3152
- buffer.length = 0;
3169
+ return false;
3153
3170
  }
3154
3171
  return true;
3155
3172
  }
3156
- function getIPV6(input) {
3157
- let tokenCount = 0;
3158
- const output = { error: false, address: "", zone: "" };
3159
- const address = [];
3160
- const buffer = [];
3161
- let endipv6Encountered = false;
3162
- let endIpv6 = false;
3163
- let consume = consumeHextets;
3164
- for (let i = 0; i < input.length; i++) {
3165
- const cursor = input[i];
3166
- if (cursor === "[" || cursor === "]") {
3167
- continue;
3168
- }
3169
- if (cursor === ":") {
3170
- if (endipv6Encountered === true) {
3171
- endIpv6 = true;
3172
- }
3173
- if (!consume(buffer, address, output)) {
3174
- break;
3175
- }
3176
- if (++tokenCount > 7) {
3177
- output.error = true;
3178
- break;
3179
- }
3180
- if (i > 0 && input[i - 1] === ":") {
3181
- endipv6Encountered = true;
3182
- }
3183
- address.push(":");
3184
- continue;
3185
- } else if (cursor === "%") {
3186
- if (!consume(buffer, address, output)) {
3187
- break;
3173
+ function compressIPv6ZeroRun(hextets) {
3174
+ let bestStart = -1;
3175
+ let bestLength = 0;
3176
+ let runStart = -1;
3177
+ let runLength = 0;
3178
+ for (let i = 0; i < hextets.length; i++) {
3179
+ if (hextets[i] === "0") {
3180
+ if (runStart === -1) runStart = i;
3181
+ runLength++;
3182
+ if (runLength > bestLength) {
3183
+ bestLength = runLength;
3184
+ bestStart = runStart;
3188
3185
  }
3189
- consume = consumeIsZone;
3190
3186
  } else {
3191
- buffer.push(cursor);
3187
+ runStart = -1;
3188
+ runLength = 0;
3189
+ }
3190
+ }
3191
+ if (bestLength < 2) return hextets.join(":");
3192
+ const head = hextets.slice(0, bestStart).join(":");
3193
+ const tail = hextets.slice(bestStart + bestLength).join(":");
3194
+ return head + "::" + tail;
3195
+ }
3196
+ function normalizeIPv6Address(input) {
3197
+ const compression = input.indexOf("::");
3198
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
3199
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
3200
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
3201
+ if (compression !== -1) {
3202
+ if (left.length === 1 && left[0] === "") left.length = 0;
3203
+ if (right.length === 1 && right[0] === "") right.length = 0;
3204
+ }
3205
+ const parts = left.concat(right);
3206
+ let hextetCount = 0;
3207
+ for (let i = 0; i < parts.length; i++) {
3208
+ const part = parts[i];
3209
+ if (part === "") return void 0;
3210
+ if (part.indexOf(".") !== -1) {
3211
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
3212
+ hextetCount += 2;
3192
3213
  continue;
3193
3214
  }
3215
+ if (!isHextet(part)) return void 0;
3216
+ parts[i] = parseInt(part, 16).toString(16);
3217
+ hextetCount++;
3194
3218
  }
3195
- if (buffer.length) {
3196
- if (consume === consumeIsZone) {
3197
- output.zone = buffer.join("");
3198
- } else if (endIpv6) {
3199
- address.push(buffer.join(""));
3200
- } else {
3201
- address.push(stringArrayToHexStripped(buffer));
3202
- }
3219
+ if (compression === -1) {
3220
+ if (hextetCount !== 8) return void 0;
3221
+ return compressIPv6ZeroRun(parts);
3203
3222
  }
3204
- output.address = address.join("");
3205
- return output;
3223
+ if (hextetCount >= 8) return void 0;
3224
+ const expanded = parts.slice(0, left.length);
3225
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
3226
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
3227
+ return compressIPv6ZeroRun(expanded);
3206
3228
  }
3207
3229
  function normalizeIPv6(host) {
3208
- if (findToken(host, ":") < 2) {
3209
- return { host, isIPV6: false };
3210
- }
3211
- const ipv62 = getIPV6(host);
3212
- if (!ipv62.error) {
3213
- let newHost = ipv62.address;
3214
- let escapedHost = ipv62.address;
3215
- if (ipv62.zone) {
3216
- newHost += "%" + ipv62.zone;
3217
- escapedHost += "%25" + ipv62.zone;
3218
- }
3219
- return { host: newHost, isIPV6: true, escapedHost };
3220
- } else {
3221
- return { host, isIPV6: false };
3222
- }
3230
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
3231
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
3232
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
3233
+ let input = bracketed ? host.slice(1, -1) : host;
3234
+ if (bracketed && isIPvFuture(input)) {
3235
+ input = input.toLowerCase();
3236
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
3237
+ }
3238
+ if (findToken(input, ":") < 2) {
3239
+ return { host, isIPV6: false, error: bracketed };
3240
+ }
3241
+ let zoneIdentifier = "";
3242
+ const zoneSeparator = input.indexOf("%");
3243
+ if (zoneSeparator !== -1) {
3244
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
3245
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
3246
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
3247
+ input = input.slice(0, zoneSeparator);
3248
+ }
3249
+ const address = normalizeIPv6Address(input);
3250
+ if (address === void 0) return { host, isIPV6: false, error: true };
3251
+ return {
3252
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
3253
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
3254
+ isIPV6: true
3255
+ };
3223
3256
  }
3224
3257
  function findToken(str, token) {
3225
3258
  let ind = 0;
@@ -3338,7 +3371,8 @@ var require_utils = __commonJS({
3338
3371
  function normalizePathEncoding(input) {
3339
3372
  let output = "";
3340
3373
  for (let i = 0; i < input.length; i++) {
3341
- if (input[i] === "%" && i + 2 < input.length) {
3374
+ const ch = input[i];
3375
+ if (ch === "%" && i + 2 < input.length) {
3342
3376
  const hex = input.slice(i + 1, i + 3);
3343
3377
  if (isHexPair(hex)) {
3344
3378
  const normalizedHex = hex.toUpperCase();
@@ -3352,10 +3386,152 @@ var require_utils = __commonJS({
3352
3386
  continue;
3353
3387
  }
3354
3388
  }
3355
- if (isPathCharacter(input[i])) {
3356
- output += input[i];
3389
+ if (isPathCharacter(ch)) {
3390
+ output += ch;
3391
+ } else {
3392
+ const code = input.charCodeAt(i);
3393
+ if (code < 128) {
3394
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3395
+ } else if (code < 55296 || code > 57343) {
3396
+ output += percentEncodeNonAscii(code);
3397
+ } else if (code <= 56319 && i + 1 < input.length) {
3398
+ const low = input.charCodeAt(i + 1);
3399
+ if (low >= 56320 && low <= 57343) {
3400
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3401
+ i++;
3402
+ } else {
3403
+ output += percentEncodeNonAscii(65533);
3404
+ }
3405
+ } else {
3406
+ output += percentEncodeNonAscii(65533);
3407
+ }
3408
+ }
3409
+ }
3410
+ return output;
3411
+ }
3412
+ function serializePathEncoding(input, pathNoScheme = false) {
3413
+ let output = "";
3414
+ let firstSegment = pathNoScheme && input[0] !== "/";
3415
+ for (let i = 0; i < input.length; i++) {
3416
+ const ch = input[i];
3417
+ if (ch === "%" && i + 2 < input.length) {
3418
+ const hex = input.slice(i + 1, i + 3);
3419
+ if (isHexPair(hex)) {
3420
+ output += "%" + hex.toUpperCase();
3421
+ i += 2;
3422
+ continue;
3423
+ }
3424
+ }
3425
+ if (ch === "/") {
3426
+ firstSegment = false;
3427
+ }
3428
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
3429
+ output += ch;
3430
+ } else {
3431
+ const code = input.charCodeAt(i);
3432
+ if (code < 128) {
3433
+ output += BYTE_HEX[code];
3434
+ } else if (code < 55296 || code > 57343) {
3435
+ output += percentEncodeNonAscii(code);
3436
+ } else if (code <= 56319 && i + 1 < input.length) {
3437
+ const low = input.charCodeAt(i + 1);
3438
+ if (low >= 56320 && low <= 57343) {
3439
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3440
+ i++;
3441
+ } else {
3442
+ output += percentEncodeNonAscii(65533);
3443
+ }
3444
+ } else {
3445
+ output += percentEncodeNonAscii(65533);
3446
+ }
3447
+ }
3448
+ }
3449
+ return output;
3450
+ }
3451
+ function encodeComponent(input, isAllowed) {
3452
+ let output = "";
3453
+ for (let i = 0; i < input.length; i++) {
3454
+ const ch = input[i];
3455
+ if (ch === "%" && i + 2 < input.length) {
3456
+ const hex = input.slice(i + 1, i + 3);
3457
+ if (isHexPair(hex)) {
3458
+ output += "%" + hex.toUpperCase();
3459
+ i += 2;
3460
+ continue;
3461
+ }
3462
+ }
3463
+ if (isAllowed(ch)) {
3464
+ output += ch;
3465
+ } else {
3466
+ const code = input.charCodeAt(i);
3467
+ if (code < 128) {
3468
+ output += BYTE_HEX[code];
3469
+ } else if (code < 55296 || code > 57343) {
3470
+ output += percentEncodeNonAscii(code);
3471
+ } else if (code <= 56319 && i + 1 < input.length) {
3472
+ const low = input.charCodeAt(i + 1);
3473
+ if (low >= 56320 && low <= 57343) {
3474
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3475
+ i++;
3476
+ } else {
3477
+ output += percentEncodeNonAscii(65533);
3478
+ }
3479
+ } else {
3480
+ output += percentEncodeNonAscii(65533);
3481
+ }
3482
+ }
3483
+ }
3484
+ return output;
3485
+ }
3486
+ function encodeUserinfo(input) {
3487
+ return encodeComponent(input, isUserinfoCharacter);
3488
+ }
3489
+ function encodeQuery(input) {
3490
+ return encodeComponent(input, isQueryFragmentCharacter);
3491
+ }
3492
+ function encodeFragment(input) {
3493
+ return encodeComponent(input, isQueryFragmentCharacter);
3494
+ }
3495
+ function isEscapeSafe(cp) {
3496
+ 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;
3497
+ }
3498
+ function normalizeQueryFragmentEncoding(input) {
3499
+ let output = "";
3500
+ for (let i = 0; i < input.length; i++) {
3501
+ const ch = input[i];
3502
+ if (ch === "%" && i + 2 < input.length) {
3503
+ const hex = input.slice(i + 1, i + 3);
3504
+ if (isHexPair(hex)) {
3505
+ const normalizedHex = hex.toUpperCase();
3506
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3507
+ if (isUnreserved(decoded)) {
3508
+ output += decoded;
3509
+ } else {
3510
+ output += "%" + normalizedHex;
3511
+ }
3512
+ i += 2;
3513
+ continue;
3514
+ }
3515
+ }
3516
+ if (isQueryFragmentCharacter(ch)) {
3517
+ output += ch;
3357
3518
  } else {
3358
- output += escape(input[i]);
3519
+ const code = input.charCodeAt(i);
3520
+ if (code < 128) {
3521
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
3522
+ } else if (code < 55296 || code > 57343) {
3523
+ output += percentEncodeNonAscii(code);
3524
+ } else if (code <= 56319 && i + 1 < input.length) {
3525
+ const low = input.charCodeAt(i + 1);
3526
+ if (low >= 56320 && low <= 57343) {
3527
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3528
+ i++;
3529
+ } else {
3530
+ output += percentEncodeNonAscii(65533);
3531
+ }
3532
+ } else {
3533
+ output += percentEncodeNonAscii(65533);
3534
+ }
3359
3535
  }
3360
3536
  }
3361
3537
  return output;
@@ -3378,14 +3554,18 @@ var require_utils = __commonJS({
3378
3554
  function recomposeAuthority(component) {
3379
3555
  const uriTokens = [];
3380
3556
  if (component.userinfo !== void 0) {
3381
- uriTokens.push(component.userinfo);
3557
+ uriTokens.push(encodeUserinfo(component.userinfo));
3382
3558
  uriTokens.push("@");
3383
3559
  }
3384
3560
  if (component.host !== void 0) {
3385
- let host = unescape(component.host);
3561
+ let host = component.host;
3386
3562
  if (!isIPv4(host)) {
3387
- const ipV6res = normalizeIPv6(host);
3388
- if (ipV6res.isIPV6 === true) {
3563
+ let ipV6res = normalizeIPv6(host);
3564
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
3565
+ host = normalizePercentEncoding(host, true);
3566
+ ipV6res = normalizeIPv6(host);
3567
+ }
3568
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
3389
3569
  host = `[${ipV6res.escapedHost}]`;
3390
3570
  } else {
3391
3571
  host = reescapeHostDelimiters(host, false);
@@ -3394,8 +3574,12 @@ var require_utils = __commonJS({
3394
3574
  uriTokens.push(host);
3395
3575
  }
3396
3576
  if (typeof component.port === "number" || typeof component.port === "string") {
3577
+ const port = String(component.port);
3578
+ if (!isPort(port)) {
3579
+ throw new TypeError("URI port is malformed.");
3580
+ }
3397
3581
  uriTokens.push(":");
3398
- uriTokens.push(String(component.port));
3582
+ uriTokens.push(port);
3399
3583
  }
3400
3584
  return uriTokens.length ? uriTokens.join("") : void 0;
3401
3585
  }
@@ -3405,6 +3589,11 @@ var require_utils = __commonJS({
3405
3589
  reescapeHostDelimiters,
3406
3590
  normalizePercentEncoding,
3407
3591
  normalizePathEncoding,
3592
+ serializePathEncoding,
3593
+ normalizeQueryFragmentEncoding,
3594
+ encodeUserinfo,
3595
+ encodeQuery,
3596
+ encodeFragment,
3408
3597
  escapePreservingEscapes,
3409
3598
  removeDotSegments,
3410
3599
  isIPv4,
@@ -3420,7 +3609,7 @@ var require_schemes = __commonJS({
3420
3609
  "node_modules/fast-uri/lib/schemes.js"(exports, module) {
3421
3610
  "use strict";
3422
3611
  var { isUUID } = require_utils();
3423
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
3612
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
3424
3613
  var supportedSchemeNames = (
3425
3614
  /** @type {const} */
3426
3615
  [
@@ -3481,9 +3670,10 @@ var require_schemes = __commonJS({
3481
3670
  wsComponent.secure = void 0;
3482
3671
  }
3483
3672
  if (wsComponent.resourceName) {
3484
- const [path3, query] = wsComponent.resourceName.split("?");
3673
+ const queryIndex = wsComponent.resourceName.indexOf("?");
3674
+ const path3 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
3485
3675
  wsComponent.path = path3 && path3 !== "/" ? path3 : void 0;
3486
- wsComponent.query = query;
3676
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
3487
3677
  wsComponent.resourceName = void 0;
3488
3678
  }
3489
3679
  wsComponent.fragment = void 0;
@@ -3495,7 +3685,7 @@ var require_schemes = __commonJS({
3495
3685
  return urnComponent;
3496
3686
  }
3497
3687
  const matches = urnComponent.path.match(URN_REG);
3498
- if (matches) {
3688
+ if (matches && matches[0] === urnComponent.path) {
3499
3689
  const scheme = options.scheme || urnComponent.scheme || "urn";
3500
3690
  urnComponent.nid = matches[1].toLowerCase();
3501
3691
  urnComponent.nss = matches[2];
@@ -3629,8 +3819,17 @@ var require_schemes = __commonJS({
3629
3819
  var require_fast_uri = __commonJS({
3630
3820
  "node_modules/fast-uri/index.js"(exports, module) {
3631
3821
  "use strict";
3632
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3822
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3633
3823
  var { SCHEMES, getSchemeHandler } = require_schemes();
3824
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3825
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3826
+ function decodeValidScheme(scheme) {
3827
+ const decodedScheme = unescape(String(scheme));
3828
+ if (!VALID_SCHEME.test(decodedScheme)) {
3829
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
3830
+ }
3831
+ return decodedScheme;
3832
+ }
3634
3833
  function normalize2(uri, options) {
3635
3834
  if (typeof uri === "string") {
3636
3835
  uri = /** @type {T} */
@@ -3643,12 +3842,34 @@ var require_fast_uri = __commonJS({
3643
3842
  }
3644
3843
  function resolve(baseURI, relativeURI, options) {
3645
3844
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3646
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3647
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3648
- if (baseMalformed || relativeMalformed) {
3845
+ const {
3846
+ parsed: baseParsed,
3847
+ malformedAuthorityOrPort: baseMalformed,
3848
+ malformedPercentEncoding: baseMalformedPercentEncoding,
3849
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
3850
+ malformedHost: baseMalformedHost,
3851
+ malformedScheme: baseMalformedScheme
3852
+ } = parseWithStatus(baseURI, schemelessOptions);
3853
+ const {
3854
+ parsed: relativeParsed,
3855
+ malformedAuthorityOrPort: relativeMalformed,
3856
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
3857
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
3858
+ malformedHost: relativeMalformedHost,
3859
+ malformedScheme: relativeMalformedScheme
3860
+ } = parseWithStatus(relativeURI, schemelessOptions);
3861
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
3649
3862
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
3650
3863
  }
3651
3864
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3865
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
3866
+ const resolvedHost = resolved.host;
3867
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3868
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3869
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3870
+ if (resolved.error && !encodedASCIIHost) {
3871
+ throw new Error(resolved.error);
3872
+ }
3652
3873
  schemelessOptions.skipEscape = true;
3653
3874
  return serialize(resolved, schemelessOptions);
3654
3875
  }
@@ -3708,7 +3929,7 @@ var require_fast_uri = __commonJS({
3708
3929
  function equal(uriA, uriB, options) {
3709
3930
  const normalizedA = normalizeComparableURI(uriA, options);
3710
3931
  const normalizedB = normalizeComparableURI(uriB, options);
3711
- return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase();
3932
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
3712
3933
  }
3713
3934
  function serialize(cmpts, opts) {
3714
3935
  const component = {
@@ -3729,19 +3950,22 @@ var require_fast_uri = __commonJS({
3729
3950
  };
3730
3951
  const options = Object.assign({}, opts);
3731
3952
  const uriTokens = [];
3953
+ if (component.scheme) {
3954
+ component.scheme = decodeValidScheme(component.scheme);
3955
+ }
3732
3956
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3733
3957
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3958
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3959
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
3734
3960
  if (component.path !== void 0) {
3735
3961
  if (!options.skipEscape) {
3736
- component.path = escapePreservingEscapes(component.path);
3737
- if (component.scheme !== void 0) {
3738
- component.path = component.path.split("%3A").join(":");
3739
- }
3962
+ component.path = serializePathEncoding(component.path, pathNoScheme);
3740
3963
  } else {
3741
3964
  component.path = normalizePercentEncoding(component.path);
3742
3965
  }
3743
3966
  }
3744
3967
  if (options.reference !== "suffix" && component.scheme) {
3968
+ component.scheme = decodeValidScheme(component.scheme);
3745
3969
  uriTokens.push(component.scheme, ":");
3746
3970
  }
3747
3971
  const authority = recomposeAuthority(component);
@@ -3759,16 +3983,19 @@ var require_fast_uri = __commonJS({
3759
3983
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3760
3984
  s = removeDotSegments(s);
3761
3985
  }
3986
+ if (pathNoScheme) {
3987
+ s = serializePathEncoding(s, true);
3988
+ }
3762
3989
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
3763
3990
  s = "/%2F" + s.slice(2);
3764
3991
  }
3765
3992
  uriTokens.push(s);
3766
3993
  }
3767
3994
  if (component.query !== void 0) {
3768
- uriTokens.push("?", component.query);
3995
+ uriTokens.push("?", encodeQuery(component.query));
3769
3996
  }
3770
3997
  if (component.fragment !== void 0) {
3771
- uriTokens.push("#", component.fragment);
3998
+ uriTokens.push("#", encodeFragment(component.fragment));
3772
3999
  }
3773
4000
  return uriTokens.join("");
3774
4001
  }
@@ -3784,6 +4011,35 @@ var require_fast_uri = __commonJS({
3784
4011
  }
3785
4012
  return void 0;
3786
4013
  }
4014
+ function hasMalformedPercentEncoding(component) {
4015
+ if (component === void 0) return false;
4016
+ let percent = component.indexOf("%");
4017
+ while (percent !== -1) {
4018
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
4019
+ return true;
4020
+ }
4021
+ percent = component.indexOf("%", percent + 3);
4022
+ }
4023
+ return false;
4024
+ }
4025
+ function isIPLiteral(host) {
4026
+ return host[0] === "[" && host[host.length - 1] === "]";
4027
+ }
4028
+ function hasMalformedComponentPercentEncoding(matches) {
4029
+ const host = matches[4];
4030
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4031
+ }
4032
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4033
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4034
+ try {
4035
+ parsed.host = new URL("http://" + parsed.host).hostname;
4036
+ } catch (e) {
4037
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4038
+ return true;
4039
+ }
4040
+ }
4041
+ return false;
4042
+ }
3787
4043
  function parseWithStatus(uri, opts) {
3788
4044
  const options = Object.assign({}, opts);
3789
4045
  const parsed = {
@@ -3796,6 +4052,11 @@ var require_fast_uri = __commonJS({
3796
4052
  fragment: void 0
3797
4053
  };
3798
4054
  let malformedAuthorityOrPort = false;
4055
+ let malformedPercentEncoding = false;
4056
+ let malformedSchemeSpecific = false;
4057
+ let malformedHost = false;
4058
+ let malformedIPLiteral = false;
4059
+ let malformedScheme = false;
3799
4060
  let isIP = false;
3800
4061
  if (options.reference === "suffix") {
3801
4062
  if (options.scheme) {
@@ -3832,6 +4093,19 @@ var require_fast_uri = __commonJS({
3832
4093
  parsed.path = matches[6] || "";
3833
4094
  parsed.query = matches[7];
3834
4095
  parsed.fragment = matches[8];
4096
+ if (parsed.scheme !== void 0) {
4097
+ const decodedScheme = unescape(parsed.scheme);
4098
+ if (VALID_SCHEME.test(decodedScheme)) {
4099
+ parsed.scheme = decodedScheme.toLowerCase();
4100
+ } else {
4101
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4102
+ malformedScheme = true;
4103
+ }
4104
+ }
4105
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
4106
+ if (malformedPercentEncoding) {
4107
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
4108
+ }
3835
4109
  if (isNaN(parsed.port)) {
3836
4110
  parsed.port = matches[5];
3837
4111
  }
@@ -3843,9 +4117,16 @@ var require_fast_uri = __commonJS({
3843
4117
  if (parsed.host) {
3844
4118
  const ipv4result = isIPv4(parsed.host);
3845
4119
  if (ipv4result === false) {
4120
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4121
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
3846
4122
  const ipv6result = normalizeIPv6(parsed.host);
3847
- parsed.host = ipv6result.host.toLowerCase();
3848
- isIP = ipv6result.isIPV6;
4123
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4124
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4125
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4126
+ if (malformedIPLiteral) {
4127
+ parsed.error = parsed.error || "URI host is malformed.";
4128
+ malformedAuthorityOrPort = true;
4129
+ }
3849
4130
  } else {
3850
4131
  isIP = true;
3851
4132
  }
@@ -3863,42 +4144,37 @@ var require_fast_uri = __commonJS({
3863
4144
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
3864
4145
  }
3865
4146
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
3866
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
3867
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
3868
- try {
3869
- parsed.host = new URL("http://" + parsed.host).hostname;
3870
- } catch (e) {
3871
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
3872
- }
4147
+ if (!malformedIPLiteral) {
4148
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4149
+ }
4150
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4151
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4152
+ if (!isIP) {
4153
+ host = normalizePercentEncoding(host.toLowerCase());
3873
4154
  }
4155
+ parsed.host = reescapeHostDelimiters(host, isIP);
3874
4156
  }
3875
4157
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
3876
- if (uri.indexOf("%") !== -1) {
3877
- if (parsed.scheme !== void 0) {
3878
- parsed.scheme = unescape(parsed.scheme);
3879
- }
3880
- if (parsed.host !== void 0) {
3881
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
3882
- }
3883
- }
3884
4158
  if (parsed.path) {
3885
4159
  parsed.path = normalizePathEncoding(parsed.path);
3886
4160
  }
4161
+ if (parsed.query) {
4162
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
4163
+ }
3887
4164
  if (parsed.fragment) {
3888
- try {
3889
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3890
- } catch {
3891
- parsed.error = parsed.error || "URI malformed";
3892
- }
4165
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
3893
4166
  }
3894
4167
  }
3895
4168
  if (schemeHandler && schemeHandler.parse) {
3896
4169
  schemeHandler.parse(parsed, options);
4170
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
4171
+ malformedSchemeSpecific = true;
4172
+ }
3897
4173
  }
3898
4174
  } else {
3899
4175
  parsed.error = parsed.error || "URI can not be parsed.";
3900
4176
  }
3901
- return { parsed, malformedAuthorityOrPort };
4177
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
3902
4178
  }
3903
4179
  function parse3(uri, opts) {
3904
4180
  return parseWithStatus(uri, opts).parsed;
@@ -3907,20 +4183,28 @@ var require_fast_uri = __commonJS({
3907
4183
  return normalizeStringWithStatus(uri, opts).normalized;
3908
4184
  }
3909
4185
  function normalizeStringWithStatus(uri, opts) {
3910
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
4186
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
3911
4187
  return {
3912
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
3913
- malformedAuthorityOrPort
4188
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
4189
+ malformedAuthorityOrPort,
4190
+ malformedPercentEncoding,
4191
+ malformedSchemeSpecific,
4192
+ malformedHost,
4193
+ malformedScheme
3914
4194
  };
3915
4195
  }
3916
4196
  function normalizeComparableURI(uri, opts) {
3917
- if (typeof uri === "string") {
3918
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
3919
- return malformedAuthorityOrPort ? void 0 : normalized;
4197
+ if (typeof uri !== "string" && typeof uri !== "object") {
4198
+ return void 0;
3920
4199
  }
3921
- if (typeof uri === "object") {
3922
- return serialize(uri, opts);
4200
+ let value;
4201
+ try {
4202
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
4203
+ } catch {
4204
+ return void 0;
3923
4205
  }
4206
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
4207
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
3924
4208
  }
3925
4209
  var fastUri = {
3926
4210
  SCHEMES,