@cccsaurora/clue-ui 1.5.0-dev.469 → 1.5.0-dev.471

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 (60) hide show
  1. package/{ActionForm-pbNGEuwp.js → ActionForm-DIAUGhSr.js} +5 -5
  2. package/{AnnotationDetails-C-up01mY.js → AnnotationDetails-DmrYK0Qc.js} +2 -2
  3. package/{AnnotationPreview-CEVRdPnY.js → AnnotationPreview-DAswA7fu.js} +2 -2
  4. package/{ClueEnrichContext-DaGfR7GQ.js → ClueEnrichContext-B76X-cLH.js} +2 -2
  5. package/components/AnnotationBody.js +1 -1
  6. package/components/AnnotationDetailPopover.js +3 -3
  7. package/components/AnnotationDetails.js +3 -3
  8. package/components/AnnotationEntry.js +1 -1
  9. package/components/AnnotationPreview.js +2 -2
  10. package/components/ClassificationChip.js +2 -2
  11. package/components/EnrichedCard.js +2 -2
  12. package/components/EnrichedChip.js +4 -4
  13. package/components/EnrichedTypography.js +2 -2
  14. package/components/ErrorBoundary.js +2 -2
  15. package/components/RetryFailedEnrichments.js +1 -1
  16. package/components/SourcePicker.js +1 -1
  17. package/components/actions/ActionForm.js +1 -1
  18. package/components/actions/ExecutePopover.js +2 -2
  19. package/components/actions/ResultModal.js +2 -2
  20. package/components/actions/formats/index.js +1 -1
  21. package/components/display/graph/elements/NodeCard.js +2 -9
  22. package/components/display/icons/Iconified.js +1 -1
  23. package/components/display/markdown/index.js +1813 -665
  24. package/components/enrichment/EnrichPopover.js +1 -1
  25. package/components/fetchers/Fetcher.js +4 -4
  26. package/components/fetchers/FetcherResultView.js +1 -1
  27. package/components/fetchers/StatusChip.js +1 -1
  28. package/components/group/GroupControl.js +1 -1
  29. package/components/stats/QueryStatus.js +1 -1
  30. package/database/index.js +2 -2
  31. package/database/replication.js +2 -2
  32. package/hooks/ClueActionContext.js +2 -2
  33. package/hooks/ClueDatabaseContext.js +1 -1
  34. package/hooks/ClueEnrichContext.js +3 -3
  35. package/hooks/ClueFetcherContext.js +1 -1
  36. package/hooks/ClueGroupContext.js +1 -1
  37. package/hooks/CluePopupContext.js +2 -2
  38. package/hooks/ClueProvider.js +3 -3
  39. package/hooks/ClueUIPluginContext.js +1 -1
  40. package/hooks/selectors.js +2 -2
  41. package/hooks/useActionResult.js +1 -1
  42. package/hooks/useAnnotations.js +2 -2
  43. package/hooks/useClue.js +1 -1
  44. package/hooks/useClueActions.js +1 -1
  45. package/hooks/useClueTypeConfig.js +1 -1
  46. package/hooks/useErrors.js +1 -1
  47. package/hooks/useFetcherResult.js +1 -1
  48. package/{iconify-DJxl6dC-.js → iconify-CYJTToEF.js} +9 -9
  49. package/icons/Action.js +3 -3
  50. package/icons/Assessment.js +2 -2
  51. package/icons/Context.js +2 -2
  52. package/icons/Opinion.js +2 -2
  53. package/{index-BFOmLhDH.js → index-8lXdRRpV.js} +541 -144
  54. package/{index-Gwnzh4FL.js → index-CPetQxOc.js} +617 -161
  55. package/{index-CWUzifNE.js → index-DT_sunCV.js} +1 -1
  56. package/main.js +5 -5
  57. package/package.json +3 -3
  58. package/plugins/store.js +1 -1
  59. package/{replication-DYXRsbKM.js → replication-DDxxY_CX.js} +1 -1
  60. package/{store-DHP48fQB.js → store-C0DRfMxZ.js} +3 -3
@@ -1,6 +1,6 @@
1
1
  import { d as debounce } from "./sessionStorage-B68y-wnE.js";
2
2
  import { i as isObject } from "./isObject-FTY-5JQX.js";
3
- import { aq as identity, aL as operate, W as createOperatorSubscriber, ax as isFunction, U as computeValue, b0 as truthy, H as assert, a4 as ensureArray, at as isArray, T as compare, V as createExpressionOperator, c as $eq$1, f as $gt$1, h as $gte$1, k as $lt$1, m as $lte$1, p as $ne$1, M as MingoError, ay as isFunction$1, X as createQueryOperator, $ as $all$1, al as getSchemaByObjectPath, aK as objectPathMonad, y as INDEX_MIN, I as INDEX_MAX, a5 as ensureNotFalsy, ag as getFromMapOrCreate, ai as getPrimaryFieldOfPrimaryKey, aS as requestIdleCallbackIfAvailable, B as BehaviorSubject, aG as mergeMap, aa as firstValueFrom, a8 as filter, ab as flatClone$1, a0 as createRxQuery, _ as _getDefaultQuery, aP as queryCollection, aH as newRxError, af as getDefaultRevision, aJ as now, aN as prepareQuery, aM as overwritable, az as isMaybeReadonlyArray, ac as flatCloneDocWithMeta, S as Subject, a_ as toArray, K as categorizeBulkWriteRows, aO as pushAtSortPosition, ak as getQueryMatcher, am as getSortComparator, P as PROMISE_RESOLVE_TRUE, z as PROMISE_RESOLVE_VOID, R as RXDB_VERSION, a6 as ensureRxStorageInstanceParamsAreCorrect, aQ as randomToken, a1 as deepEqual, aT as requestIdlePromiseNoQueue, a as $and$1, b as $elemMatch, d as $eq$2, e as $exists, g as $gt$2, i as $gte$2, j as $in, l as $lt$2, n as $lte$2, o as $mod, q as $ne$2, r as $nin, s as $nor, t as $not$1, u as $or$1, v as $regex, w as $size, x as $type, ar as initOptions, C as Context, Q as Query, b2 as walk, aU as resolve$1, au as isDate, aB as isObject$1, aD as isRegExp, O as cloneDeep, an as has, as as intersection, b1 as unique, aA as isNumber, aC as isOperator, av as isEqual, L as clone$1, aW as runQueryUpdateFunction, ae as getChangedDocumentsSince, aV as runPluginHooks, aX as setProperty, aF as merge, aY as shareReplay, A as RXJS_SHARE_REPLAY_DEFAULTS, aE as map, G as appendToArray, aj as getProperty, aZ as startWith, a3 as distinctUntilChanged, F as addRxPlugin, Y as createRxDatabase, aR as replicateSelectorCollection } from "./replication-DYXRsbKM.js";
3
+ import { aq as identity, aL as operate, W as createOperatorSubscriber, ax as isFunction, U as computeValue, b0 as truthy, H as assert, a4 as ensureArray, at as isArray, T as compare, V as createExpressionOperator, c as $eq$1, f as $gt$1, h as $gte$1, k as $lt$1, m as $lte$1, p as $ne$1, M as MingoError, ay as isFunction$1, X as createQueryOperator, $ as $all$1, al as getSchemaByObjectPath, aK as objectPathMonad, y as INDEX_MIN, I as INDEX_MAX, a5 as ensureNotFalsy, ag as getFromMapOrCreate, ai as getPrimaryFieldOfPrimaryKey, aS as requestIdleCallbackIfAvailable, B as BehaviorSubject, aG as mergeMap, aa as firstValueFrom, a8 as filter, ab as flatClone$1, a0 as createRxQuery, _ as _getDefaultQuery, aP as queryCollection, aH as newRxError, af as getDefaultRevision, aJ as now, aN as prepareQuery, aM as overwritable, az as isMaybeReadonlyArray, ac as flatCloneDocWithMeta, S as Subject, a_ as toArray, K as categorizeBulkWriteRows, aO as pushAtSortPosition, ak as getQueryMatcher, am as getSortComparator, P as PROMISE_RESOLVE_TRUE, z as PROMISE_RESOLVE_VOID, R as RXDB_VERSION, a6 as ensureRxStorageInstanceParamsAreCorrect, aQ as randomToken, a1 as deepEqual, aT as requestIdlePromiseNoQueue, a as $and$1, b as $elemMatch, d as $eq$2, e as $exists, g as $gt$2, i as $gte$2, j as $in, l as $lt$2, n as $lte$2, o as $mod, q as $ne$2, r as $nin, s as $nor, t as $not$1, u as $or$1, v as $regex, w as $size, x as $type, ar as initOptions, C as Context, Q as Query, b2 as walk, aU as resolve$1, au as isDate, aB as isObject$1, aD as isRegExp, O as cloneDeep, an as has, as as intersection, b1 as unique, aA as isNumber, aC as isOperator, av as isEqual, L as clone$1, aW as runQueryUpdateFunction, ae as getChangedDocumentsSince, aV as runPluginHooks, aX as setProperty, aF as merge, aY as shareReplay, A as RXJS_SHARE_REPLAY_DEFAULTS, aE as map, G as appendToArray, aj as getProperty, aZ as startWith, a3 as distinctUntilChanged, F as addRxPlugin, Y as createRxDatabase, aR as replicateSelectorCollection } from "./replication-DDxxY_CX.js";
4
4
  import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.js";
5
5
  import { REPLICATE } from "./utils/constants.js";
6
6
  import { REPLICATORS } from "./database/globals.js";
@@ -151,6 +151,28 @@ function requireUtils() {
151
151
  hasRequiredUtils = 1;
152
152
  const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
153
153
  const 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);
154
+ const isPort = RegExp.prototype.test.bind(/^\d*$/u);
155
+ const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
156
+ const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
157
+ const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
158
+ const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
159
+ const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
160
+ const BYTE_HEX = new Array(256);
161
+ {
162
+ const HEX_DIGITS = "0123456789ABCDEF";
163
+ for (let i = 0; i < 256; i++) {
164
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
165
+ }
166
+ }
167
+ function percentEncodeNonAscii(cp) {
168
+ if (cp < 2048) {
169
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
170
+ }
171
+ if (cp < 65536) {
172
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
173
+ }
174
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
175
+ }
154
176
  function stringArrayToHexStripped(input) {
155
177
  let acc = "";
156
178
  let code2 = 0;
@@ -175,91 +197,105 @@ function requireUtils() {
175
197
  }
176
198
  return acc;
177
199
  }
200
+ const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
201
+ const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
202
+ const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
178
203
  const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
179
- function consumeIsZone(buffer) {
180
- buffer.length = 0;
181
- return true;
182
- }
183
- function consumeHextets(buffer, address, output) {
184
- if (buffer.length) {
185
- const hex = stringArrayToHexStripped(buffer);
186
- if (hex !== "") {
187
- address.push(hex);
188
- } else {
189
- output.error = true;
190
- return false;
204
+ function isZoneIdentifier(zone) {
205
+ if (zone.length === 0) return false;
206
+ for (let i = 0; i < zone.length; i++) {
207
+ if (isZoneCharacter(zone[i])) continue;
208
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
209
+ i += 2;
210
+ continue;
191
211
  }
192
- buffer.length = 0;
212
+ return false;
193
213
  }
194
214
  return true;
195
215
  }
196
- function getIPV6(input) {
197
- let tokenCount = 0;
198
- const output = { error: false, address: "", zone: "" };
199
- const address = [];
200
- const buffer = [];
201
- let endipv6Encountered = false;
202
- let endIpv6 = false;
203
- let consume = consumeHextets;
204
- for (let i = 0; i < input.length; i++) {
205
- const cursor = input[i];
206
- if (cursor === "[" || cursor === "]") {
207
- continue;
208
- }
209
- if (cursor === ":") {
210
- if (endipv6Encountered === true) {
211
- endIpv6 = true;
212
- }
213
- if (!consume(buffer, address, output)) {
214
- break;
215
- }
216
- if (++tokenCount > 7) {
217
- output.error = true;
218
- break;
219
- }
220
- if (i > 0 && input[i - 1] === ":") {
221
- endipv6Encountered = true;
222
- }
223
- address.push(":");
224
- continue;
225
- } else if (cursor === "%") {
226
- if (!consume(buffer, address, output)) {
227
- break;
216
+ function compressIPv6ZeroRun(hextets) {
217
+ let bestStart = -1;
218
+ let bestLength = 0;
219
+ let runStart = -1;
220
+ let runLength = 0;
221
+ for (let i = 0; i < hextets.length; i++) {
222
+ if (hextets[i] === "0") {
223
+ if (runStart === -1) runStart = i;
224
+ runLength++;
225
+ if (runLength > bestLength) {
226
+ bestLength = runLength;
227
+ bestStart = runStart;
228
228
  }
229
- consume = consumeIsZone;
230
229
  } else {
231
- buffer.push(cursor);
230
+ runStart = -1;
231
+ runLength = 0;
232
+ }
233
+ }
234
+ if (bestLength < 2) return hextets.join(":");
235
+ const head = hextets.slice(0, bestStart).join(":");
236
+ const tail = hextets.slice(bestStart + bestLength).join(":");
237
+ return head + "::" + tail;
238
+ }
239
+ function normalizeIPv6Address(input) {
240
+ const compression = input.indexOf("::");
241
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0;
242
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
243
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
244
+ if (compression !== -1) {
245
+ if (left.length === 1 && left[0] === "") left.length = 0;
246
+ if (right.length === 1 && right[0] === "") right.length = 0;
247
+ }
248
+ const parts = left.concat(right);
249
+ let hextetCount = 0;
250
+ for (let i = 0; i < parts.length; i++) {
251
+ const part = parts[i];
252
+ if (part === "") return void 0;
253
+ if (part.indexOf(".") !== -1) {
254
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0;
255
+ hextetCount += 2;
232
256
  continue;
233
257
  }
258
+ if (!isHextet(part)) return void 0;
259
+ parts[i] = parseInt(part, 16).toString(16);
260
+ hextetCount++;
234
261
  }
235
- if (buffer.length) {
236
- if (consume === consumeIsZone) {
237
- output.zone = buffer.join("");
238
- } else if (endIpv6) {
239
- address.push(buffer.join(""));
240
- } else {
241
- address.push(stringArrayToHexStripped(buffer));
242
- }
262
+ if (compression === -1) {
263
+ if (hextetCount !== 8) return void 0;
264
+ return compressIPv6ZeroRun(parts);
243
265
  }
244
- output.address = address.join("");
245
- return output;
266
+ if (hextetCount >= 8) return void 0;
267
+ const expanded = parts.slice(0, left.length);
268
+ for (let i = hextetCount; i < 8; i++) expanded.push("0");
269
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]);
270
+ return compressIPv6ZeroRun(expanded);
246
271
  }
247
272
  function normalizeIPv6(host) {
248
- if (findToken(host, ":") < 2) {
249
- return { host, isIPV6: false };
250
- }
251
- const ipv6 = getIPV6(host);
252
- if (!ipv6.error) {
253
- let newHost = ipv6.address;
254
- let escapedHost = ipv6.address;
255
- if (ipv6.zone) {
256
- newHost += "%" + ipv6.zone;
257
- escapedHost += "%25" + ipv6.zone;
258
- }
259
- return { host: newHost, isIPV6: true, escapedHost };
260
- } else {
261
- return { host, isIPV6: false };
262
- }
273
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
274
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
275
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true };
276
+ let input = bracketed ? host.slice(1, -1) : host;
277
+ if (bracketed && isIPvFuture(input)) {
278
+ input = input.toLowerCase();
279
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
280
+ }
281
+ if (findToken(input, ":") < 2) {
282
+ return { host, isIPV6: false, error: bracketed };
283
+ }
284
+ let zoneIdentifier = "";
285
+ const zoneSeparator = input.indexOf("%");
286
+ if (zoneSeparator !== -1) {
287
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
288
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
289
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true };
290
+ input = input.slice(0, zoneSeparator);
291
+ }
292
+ const address = normalizeIPv6Address(input);
293
+ if (address === void 0) return { host, isIPV6: false, error: true };
294
+ return {
295
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
296
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
297
+ isIPV6: true
298
+ };
263
299
  }
264
300
  function findToken(str, token) {
265
301
  let ind = 0;
@@ -343,56 +379,265 @@ function requireUtils() {
343
379
  }
344
380
  return output.join("");
345
381
  }
346
- function normalizeComponentEncoding(component, esc) {
347
- const func = esc !== true ? escape : unescape;
348
- if (component.scheme !== void 0) {
349
- component.scheme = func(component.scheme);
382
+ const HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
383
+ const HOST_DELIM_RE = /[@/?#:]/g;
384
+ const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
385
+ function reescapeHostDelimiters(host, isIP) {
386
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
387
+ re.lastIndex = 0;
388
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
389
+ }
390
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
391
+ if (input.indexOf("%") === -1) {
392
+ return input;
350
393
  }
351
- if (component.userinfo !== void 0) {
352
- component.userinfo = func(component.userinfo);
394
+ let output = "";
395
+ for (let i = 0; i < input.length; i++) {
396
+ if (input[i] === "%" && i + 2 < input.length) {
397
+ const hex = input.slice(i + 1, i + 3);
398
+ if (isHexPair(hex)) {
399
+ const normalizedHex = hex.toUpperCase();
400
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
401
+ if (decodeUnreserved && isUnreserved(decoded)) {
402
+ output += decoded;
403
+ } else {
404
+ output += "%" + normalizedHex;
405
+ }
406
+ i += 2;
407
+ continue;
408
+ }
409
+ }
410
+ output += input[i];
353
411
  }
354
- if (component.host !== void 0) {
355
- component.host = func(component.host);
412
+ return output;
413
+ }
414
+ function normalizePathEncoding(input) {
415
+ let output = "";
416
+ for (let i = 0; i < input.length; i++) {
417
+ const ch = input[i];
418
+ if (ch === "%" && i + 2 < input.length) {
419
+ const hex = input.slice(i + 1, i + 3);
420
+ if (isHexPair(hex)) {
421
+ const normalizedHex = hex.toUpperCase();
422
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
423
+ if (decoded !== "." && isUnreserved(decoded)) {
424
+ output += decoded;
425
+ } else {
426
+ output += "%" + normalizedHex;
427
+ }
428
+ i += 2;
429
+ continue;
430
+ }
431
+ }
432
+ if (isPathCharacter(ch)) {
433
+ output += ch;
434
+ } else {
435
+ const code2 = input.charCodeAt(i);
436
+ if (code2 < 128) {
437
+ output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
438
+ } else if (code2 < 55296 || code2 > 57343) {
439
+ output += percentEncodeNonAscii(code2);
440
+ } else if (code2 <= 56319 && i + 1 < input.length) {
441
+ const low = input.charCodeAt(i + 1);
442
+ if (low >= 56320 && low <= 57343) {
443
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
444
+ i++;
445
+ } else {
446
+ output += percentEncodeNonAscii(65533);
447
+ }
448
+ } else {
449
+ output += percentEncodeNonAscii(65533);
450
+ }
451
+ }
356
452
  }
357
- if (component.path !== void 0) {
358
- component.path = func(component.path);
453
+ return output;
454
+ }
455
+ function serializePathEncoding(input, pathNoScheme = false) {
456
+ let output = "";
457
+ let firstSegment = pathNoScheme && input[0] !== "/";
458
+ for (let i = 0; i < input.length; i++) {
459
+ const ch = input[i];
460
+ if (ch === "%" && i + 2 < input.length) {
461
+ const hex = input.slice(i + 1, i + 3);
462
+ if (isHexPair(hex)) {
463
+ output += "%" + hex.toUpperCase();
464
+ i += 2;
465
+ continue;
466
+ }
467
+ }
468
+ if (ch === "/") {
469
+ firstSegment = false;
470
+ }
471
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
472
+ output += ch;
473
+ } else {
474
+ const code2 = input.charCodeAt(i);
475
+ if (code2 < 128) {
476
+ output += BYTE_HEX[code2];
477
+ } else if (code2 < 55296 || code2 > 57343) {
478
+ output += percentEncodeNonAscii(code2);
479
+ } else if (code2 <= 56319 && i + 1 < input.length) {
480
+ const low = input.charCodeAt(i + 1);
481
+ if (low >= 56320 && low <= 57343) {
482
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
483
+ i++;
484
+ } else {
485
+ output += percentEncodeNonAscii(65533);
486
+ }
487
+ } else {
488
+ output += percentEncodeNonAscii(65533);
489
+ }
490
+ }
359
491
  }
360
- if (component.query !== void 0) {
361
- component.query = func(component.query);
492
+ return output;
493
+ }
494
+ function encodeComponent(input, isAllowed) {
495
+ let output = "";
496
+ for (let i = 0; i < input.length; i++) {
497
+ const ch = input[i];
498
+ if (ch === "%" && i + 2 < input.length) {
499
+ const hex = input.slice(i + 1, i + 3);
500
+ if (isHexPair(hex)) {
501
+ output += "%" + hex.toUpperCase();
502
+ i += 2;
503
+ continue;
504
+ }
505
+ }
506
+ if (isAllowed(ch)) {
507
+ output += ch;
508
+ } else {
509
+ const code2 = input.charCodeAt(i);
510
+ if (code2 < 128) {
511
+ output += BYTE_HEX[code2];
512
+ } else if (code2 < 55296 || code2 > 57343) {
513
+ output += percentEncodeNonAscii(code2);
514
+ } else if (code2 <= 56319 && i + 1 < input.length) {
515
+ const low = input.charCodeAt(i + 1);
516
+ if (low >= 56320 && low <= 57343) {
517
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
518
+ i++;
519
+ } else {
520
+ output += percentEncodeNonAscii(65533);
521
+ }
522
+ } else {
523
+ output += percentEncodeNonAscii(65533);
524
+ }
525
+ }
362
526
  }
363
- if (component.fragment !== void 0) {
364
- component.fragment = func(component.fragment);
527
+ return output;
528
+ }
529
+ function encodeUserinfo(input) {
530
+ return encodeComponent(input, isUserinfoCharacter);
531
+ }
532
+ function encodeQuery(input) {
533
+ return encodeComponent(input, isQueryFragmentCharacter);
534
+ }
535
+ function encodeFragment(input) {
536
+ return encodeComponent(input, isQueryFragmentCharacter);
537
+ }
538
+ function isEscapeSafe(cp) {
539
+ 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;
540
+ }
541
+ function normalizeQueryFragmentEncoding(input) {
542
+ let output = "";
543
+ for (let i = 0; i < input.length; i++) {
544
+ const ch = input[i];
545
+ if (ch === "%" && i + 2 < input.length) {
546
+ const hex = input.slice(i + 1, i + 3);
547
+ if (isHexPair(hex)) {
548
+ const normalizedHex = hex.toUpperCase();
549
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
550
+ if (isUnreserved(decoded)) {
551
+ output += decoded;
552
+ } else {
553
+ output += "%" + normalizedHex;
554
+ }
555
+ i += 2;
556
+ continue;
557
+ }
558
+ }
559
+ if (isQueryFragmentCharacter(ch)) {
560
+ output += ch;
561
+ } else {
562
+ const code2 = input.charCodeAt(i);
563
+ if (code2 < 128) {
564
+ output += isEscapeSafe(code2) ? ch : BYTE_HEX[code2];
565
+ } else if (code2 < 55296 || code2 > 57343) {
566
+ output += percentEncodeNonAscii(code2);
567
+ } else if (code2 <= 56319 && i + 1 < input.length) {
568
+ const low = input.charCodeAt(i + 1);
569
+ if (low >= 56320 && low <= 57343) {
570
+ output += percentEncodeNonAscii(65536 + (code2 - 55296 << 10) + (low - 56320));
571
+ i++;
572
+ } else {
573
+ output += percentEncodeNonAscii(65533);
574
+ }
575
+ } else {
576
+ output += percentEncodeNonAscii(65533);
577
+ }
578
+ }
365
579
  }
366
- return component;
580
+ return output;
581
+ }
582
+ function escapePreservingEscapes(input) {
583
+ let output = "";
584
+ for (let i = 0; i < input.length; i++) {
585
+ if (input[i] === "%" && i + 2 < input.length) {
586
+ const hex = input.slice(i + 1, i + 3);
587
+ if (isHexPair(hex)) {
588
+ output += "%" + hex.toUpperCase();
589
+ i += 2;
590
+ continue;
591
+ }
592
+ }
593
+ output += escape(input[i]);
594
+ }
595
+ return output;
367
596
  }
368
597
  function recomposeAuthority(component) {
369
598
  const uriTokens = [];
370
599
  if (component.userinfo !== void 0) {
371
- uriTokens.push(component.userinfo);
600
+ uriTokens.push(encodeUserinfo(component.userinfo));
372
601
  uriTokens.push("@");
373
602
  }
374
603
  if (component.host !== void 0) {
375
- let host = unescape(component.host);
604
+ let host = component.host;
376
605
  if (!isIPv4(host)) {
377
- const ipV6res = normalizeIPv6(host);
378
- if (ipV6res.isIPV6 === true) {
606
+ let ipV6res = normalizeIPv6(host);
607
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
608
+ host = normalizePercentEncoding(host, true);
609
+ ipV6res = normalizeIPv6(host);
610
+ }
611
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
379
612
  host = `[${ipV6res.escapedHost}]`;
380
613
  } else {
381
- host = component.host;
614
+ host = reescapeHostDelimiters(host, false);
382
615
  }
383
616
  }
384
617
  uriTokens.push(host);
385
618
  }
386
619
  if (typeof component.port === "number" || typeof component.port === "string") {
620
+ const port = String(component.port);
621
+ if (!isPort(port)) {
622
+ throw new TypeError("URI port is malformed.");
623
+ }
387
624
  uriTokens.push(":");
388
- uriTokens.push(String(component.port));
625
+ uriTokens.push(port);
389
626
  }
390
627
  return uriTokens.length ? uriTokens.join("") : void 0;
391
628
  }
392
629
  utils = {
393
630
  nonSimpleDomain,
394
631
  recomposeAuthority,
395
- normalizeComponentEncoding,
632
+ reescapeHostDelimiters,
633
+ normalizePercentEncoding,
634
+ normalizePathEncoding,
635
+ serializePathEncoding,
636
+ normalizeQueryFragmentEncoding,
637
+ encodeUserinfo,
638
+ encodeQuery,
639
+ encodeFragment,
640
+ escapePreservingEscapes,
396
641
  removeDotSegments,
397
642
  isIPv4,
398
643
  isUUID,
@@ -407,7 +652,7 @@ function requireSchemes() {
407
652
  if (hasRequiredSchemes) return schemes;
408
653
  hasRequiredSchemes = 1;
409
654
  const { isUUID } = requireUtils();
410
- const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
655
+ const URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
411
656
  const supportedSchemeNames = (
412
657
  /** @type {const} */
413
658
  [
@@ -468,9 +713,10 @@ function requireSchemes() {
468
713
  wsComponent.secure = void 0;
469
714
  }
470
715
  if (wsComponent.resourceName) {
471
- const [path, query] = wsComponent.resourceName.split("?");
716
+ const queryIndex = wsComponent.resourceName.indexOf("?");
717
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
472
718
  wsComponent.path = path && path !== "/" ? path : void 0;
473
- wsComponent.query = query;
719
+ wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
474
720
  wsComponent.resourceName = void 0;
475
721
  }
476
722
  wsComponent.fragment = void 0;
@@ -482,7 +728,7 @@ function requireSchemes() {
482
728
  return urnComponent;
483
729
  }
484
730
  const matches = urnComponent.path.match(URN_REG);
485
- if (matches) {
731
+ if (matches && matches[0] === urnComponent.path) {
486
732
  const scheme = options.scheme || urnComponent.scheme || "urn";
487
733
  urnComponent.nid = matches[1].toLowerCase();
488
734
  urnComponent.nss = matches[2];
@@ -615,12 +861,21 @@ var hasRequiredFastUri;
615
861
  function requireFastUri() {
616
862
  if (hasRequiredFastUri) return fastUri.exports;
617
863
  hasRequiredFastUri = 1;
618
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = requireUtils();
864
+ const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
619
865
  const { SCHEMES, getSchemeHandler } = requireSchemes();
866
+ const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
867
+ const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
868
+ function decodeValidScheme(scheme) {
869
+ const decodedScheme = unescape(String(scheme));
870
+ if (!VALID_SCHEME.test(decodedScheme)) {
871
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
872
+ }
873
+ return decodedScheme;
874
+ }
620
875
  function normalize(uri2, options) {
621
876
  if (typeof uri2 === "string") {
622
877
  uri2 = /** @type {T} */
623
- serialize(parse(uri2, options), options);
878
+ normalizeString(uri2, options);
624
879
  } else if (typeof uri2 === "object") {
625
880
  uri2 = /** @type {T} */
626
881
  parse(serialize(uri2, options), options);
@@ -629,7 +884,34 @@ function requireFastUri() {
629
884
  }
630
885
  function resolve2(baseURI, relativeURI, options) {
631
886
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
632
- const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
887
+ const {
888
+ parsed: baseParsed,
889
+ malformedAuthorityOrPort: baseMalformed,
890
+ malformedPercentEncoding: baseMalformedPercentEncoding,
891
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
892
+ malformedHost: baseMalformedHost,
893
+ malformedScheme: baseMalformedScheme
894
+ } = parseWithStatus(baseURI, schemelessOptions);
895
+ const {
896
+ parsed: relativeParsed,
897
+ malformedAuthorityOrPort: relativeMalformed,
898
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
899
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
900
+ malformedHost: relativeMalformedHost,
901
+ malformedScheme: relativeMalformedScheme
902
+ } = parseWithStatus(relativeURI, schemelessOptions);
903
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
904
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
905
+ }
906
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
907
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
908
+ const resolvedHost = resolved.host;
909
+ const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
910
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
911
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
912
+ if (resolved.error && !encodedASCIIHost) {
913
+ throw new Error(resolved.error);
914
+ }
633
915
  schemelessOptions.skipEscape = true;
634
916
  return serialize(resolved, schemelessOptions);
635
917
  }
@@ -687,19 +969,9 @@ function requireFastUri() {
687
969
  return target;
688
970
  }
689
971
  function equal2(uriA, uriB, options) {
690
- if (typeof uriA === "string") {
691
- uriA = unescape(uriA);
692
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
693
- } else if (typeof uriA === "object") {
694
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
695
- }
696
- if (typeof uriB === "string") {
697
- uriB = unescape(uriB);
698
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
699
- } else if (typeof uriB === "object") {
700
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
701
- }
702
- return uriA.toLowerCase() === uriB.toLowerCase();
972
+ const normalizedA = normalizeComparableURI(uriA, options);
973
+ const normalizedB = normalizeComparableURI(uriB, options);
974
+ return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB;
703
975
  }
704
976
  function serialize(cmpts, opts) {
705
977
  const component = {
@@ -720,19 +992,22 @@ function requireFastUri() {
720
992
  };
721
993
  const options = Object.assign({}, opts);
722
994
  const uriTokens = [];
995
+ if (component.scheme) {
996
+ component.scheme = decodeValidScheme(component.scheme);
997
+ }
723
998
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
724
999
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
1000
+ const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
1001
+ const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
725
1002
  if (component.path !== void 0) {
726
1003
  if (!options.skipEscape) {
727
- component.path = escape(component.path);
728
- if (component.scheme !== void 0) {
729
- component.path = component.path.split("%3A").join(":");
730
- }
1004
+ component.path = serializePathEncoding(component.path, pathNoScheme);
731
1005
  } else {
732
- component.path = unescape(component.path);
1006
+ component.path = normalizePercentEncoding(component.path);
733
1007
  }
734
1008
  }
735
1009
  if (options.reference !== "suffix" && component.scheme) {
1010
+ component.scheme = decodeValidScheme(component.scheme);
736
1011
  uriTokens.push(component.scheme, ":");
737
1012
  }
738
1013
  const authority = recomposeAuthority(component);
@@ -750,21 +1025,64 @@ function requireFastUri() {
750
1025
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
751
1026
  s = removeDotSegments(s);
752
1027
  }
1028
+ if (pathNoScheme) {
1029
+ s = serializePathEncoding(s, true);
1030
+ }
753
1031
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
754
1032
  s = "/%2F" + s.slice(2);
755
1033
  }
756
1034
  uriTokens.push(s);
757
1035
  }
758
1036
  if (component.query !== void 0) {
759
- uriTokens.push("?", component.query);
1037
+ uriTokens.push("?", encodeQuery(component.query));
760
1038
  }
761
1039
  if (component.fragment !== void 0) {
762
- uriTokens.push("#", component.fragment);
1040
+ uriTokens.push("#", encodeFragment(component.fragment));
763
1041
  }
764
1042
  return uriTokens.join("");
765
1043
  }
766
1044
  const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
767
- function parse(uri2, opts) {
1045
+ const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
1046
+ const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
1047
+ function getParseError(parsed, matches) {
1048
+ if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
1049
+ return 'URI path must start with "/" when authority is present.';
1050
+ }
1051
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
1052
+ return "URI port is malformed.";
1053
+ }
1054
+ return void 0;
1055
+ }
1056
+ function hasMalformedPercentEncoding(component) {
1057
+ if (component === void 0) return false;
1058
+ let percent = component.indexOf("%");
1059
+ while (percent !== -1) {
1060
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
1061
+ return true;
1062
+ }
1063
+ percent = component.indexOf("%", percent + 3);
1064
+ }
1065
+ return false;
1066
+ }
1067
+ function isIPLiteral(host) {
1068
+ return host[0] === "[" && host[host.length - 1] === "]";
1069
+ }
1070
+ function hasMalformedComponentPercentEncoding(matches) {
1071
+ const host = matches[4];
1072
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
1073
+ }
1074
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
1075
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
1076
+ try {
1077
+ parsed.host = new URL("http://" + parsed.host).hostname;
1078
+ } catch (e) {
1079
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
1080
+ return true;
1081
+ }
1082
+ }
1083
+ return false;
1084
+ }
1085
+ function parseWithStatus(uri2, opts) {
768
1086
  const options = Object.assign({}, opts);
769
1087
  const parsed = {
770
1088
  scheme: void 0,
@@ -775,6 +1093,12 @@ function requireFastUri() {
775
1093
  query: void 0,
776
1094
  fragment: void 0
777
1095
  };
1096
+ let malformedAuthorityOrPort = false;
1097
+ let malformedPercentEncoding = false;
1098
+ let malformedSchemeSpecific = false;
1099
+ let malformedHost = false;
1100
+ let malformedIPLiteral = false;
1101
+ let malformedScheme = false;
778
1102
  let isIP = false;
779
1103
  if (options.reference === "suffix") {
780
1104
  if (options.scheme) {
@@ -783,6 +1107,25 @@ function requireFastUri() {
783
1107
  uri2 = "//" + uri2;
784
1108
  }
785
1109
  }
1110
+ const authorityMatch = uri2.match(AUTHORITY_PREFIX);
1111
+ if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
1112
+ parsed.error = "URI authority must not contain a literal backslash.";
1113
+ malformedAuthorityOrPort = true;
1114
+ }
1115
+ const introducerMatch = uri2.match(AUTHORITY_INTRODUCER_REGION);
1116
+ if (introducerMatch !== null) {
1117
+ const region = introducerMatch[1];
1118
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
1119
+ if (normalizedRegion.length >= 2) {
1120
+ if (normalizedRegion.slice(0, 2) !== "//") {
1121
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
1122
+ malformedAuthorityOrPort = true;
1123
+ } else if (region.length !== normalizedRegion.length) {
1124
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
1125
+ malformedAuthorityOrPort = true;
1126
+ }
1127
+ }
1128
+ }
786
1129
  const matches = uri2.match(URI_PARSE);
787
1130
  if (matches) {
788
1131
  parsed.scheme = matches[1];
@@ -792,15 +1135,40 @@ function requireFastUri() {
792
1135
  parsed.path = matches[6] || "";
793
1136
  parsed.query = matches[7];
794
1137
  parsed.fragment = matches[8];
1138
+ if (parsed.scheme !== void 0) {
1139
+ const decodedScheme = unescape(parsed.scheme);
1140
+ if (VALID_SCHEME.test(decodedScheme)) {
1141
+ parsed.scheme = decodedScheme.toLowerCase();
1142
+ } else {
1143
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
1144
+ malformedScheme = true;
1145
+ }
1146
+ }
1147
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
1148
+ if (malformedPercentEncoding) {
1149
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
1150
+ }
795
1151
  if (isNaN(parsed.port)) {
796
1152
  parsed.port = matches[5];
797
1153
  }
1154
+ const parseError = getParseError(parsed, matches);
1155
+ if (parseError !== void 0) {
1156
+ parsed.error = parsed.error || parseError;
1157
+ malformedAuthorityOrPort = true;
1158
+ }
798
1159
  if (parsed.host) {
799
1160
  const ipv4result = isIPv4(parsed.host);
800
1161
  if (ipv4result === false) {
1162
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
1163
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
801
1164
  const ipv6result = normalizeIPv6(parsed.host);
802
- parsed.host = ipv6result.host.toLowerCase();
803
- isIP = ipv6result.isIPV6;
1165
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
1166
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
1167
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
1168
+ if (malformedIPLiteral) {
1169
+ parsed.error = parsed.error || "URI host is malformed.";
1170
+ malformedAuthorityOrPort = true;
1171
+ }
804
1172
  } else {
805
1173
  isIP = true;
806
1174
  }
@@ -818,38 +1186,67 @@ function requireFastUri() {
818
1186
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
819
1187
  }
820
1188
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
821
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
822
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
823
- try {
824
- parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
825
- } catch (e) {
826
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
827
- }
1189
+ if (!malformedIPLiteral) {
1190
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
1191
+ }
1192
+ if (uri2.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
1193
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
1194
+ if (!isIP) {
1195
+ host = normalizePercentEncoding(host.toLowerCase());
828
1196
  }
1197
+ parsed.host = reescapeHostDelimiters(host, isIP);
829
1198
  }
830
1199
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
831
- if (uri2.indexOf("%") !== -1) {
832
- if (parsed.scheme !== void 0) {
833
- parsed.scheme = unescape(parsed.scheme);
834
- }
835
- if (parsed.host !== void 0) {
836
- parsed.host = unescape(parsed.host);
837
- }
838
- }
839
1200
  if (parsed.path) {
840
- parsed.path = escape(unescape(parsed.path));
1201
+ parsed.path = normalizePathEncoding(parsed.path);
1202
+ }
1203
+ if (parsed.query) {
1204
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
841
1205
  }
842
1206
  if (parsed.fragment) {
843
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
1207
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
844
1208
  }
845
1209
  }
846
1210
  if (schemeHandler && schemeHandler.parse) {
847
1211
  schemeHandler.parse(parsed, options);
1212
+ if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) {
1213
+ malformedSchemeSpecific = true;
1214
+ }
848
1215
  }
849
1216
  } else {
850
1217
  parsed.error = parsed.error || "URI can not be parsed.";
851
1218
  }
852
- return parsed;
1219
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
1220
+ }
1221
+ function parse(uri2, opts) {
1222
+ return parseWithStatus(uri2, opts).parsed;
1223
+ }
1224
+ function normalizeString(uri2, opts) {
1225
+ return normalizeStringWithStatus(uri2, opts).normalized;
1226
+ }
1227
+ function normalizeStringWithStatus(uri2, opts) {
1228
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri2, opts);
1229
+ return {
1230
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri2 : serialize(parsed, opts),
1231
+ malformedAuthorityOrPort,
1232
+ malformedPercentEncoding,
1233
+ malformedSchemeSpecific,
1234
+ malformedHost,
1235
+ malformedScheme
1236
+ };
1237
+ }
1238
+ function normalizeComparableURI(uri2, opts) {
1239
+ if (typeof uri2 !== "string" && typeof uri2 !== "object") {
1240
+ return void 0;
1241
+ }
1242
+ let value;
1243
+ try {
1244
+ value = typeof uri2 === "string" ? uri2 : serialize(uri2, opts);
1245
+ } catch {
1246
+ return void 0;
1247
+ }
1248
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
1249
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
853
1250
  }
854
1251
  const fastUri$1 = {
855
1252
  SCHEMES,
@@ -9259,7 +9656,7 @@ const buildDatabase = async (_config = {}) => {
9259
9656
  addRxPlugin(RxDBStatePlugin);
9260
9657
  /* v8 ignore next 10 -- @preserve */
9261
9658
  if (config.devMode) {
9262
- await import("./index-CWUzifNE.js").then((module) => {
9659
+ await import("./index-DT_sunCV.js").then((module) => {
9263
9660
  addRxPlugin(module.RxDBDevModePlugin);
9264
9661
  if (config.testing) {
9265
9662
  module.disableWarnings();