inferred-types 0.54.8 → 0.55.0

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.
@@ -93,11 +93,15 @@ __export(src_exports, {
93
93
  MARKED: () => MARKED,
94
94
  MASS_METRICS_LOOKUP: () => MASS_METRICS_LOOKUP,
95
95
  MEXICAN_NEWS: () => MEXICAN_NEWS,
96
+ MIME_TYPES: () => MIME_TYPES,
96
97
  MONTH_ABBR: () => MONTH_ABBR,
97
98
  MONTH_NAME: () => MONTH_NAME,
98
99
  MapCardinality: () => MapCardinality,
99
100
  NARROW_CONTAINER_TYPE_KINDS: () => NARROW_CONTAINER_TYPE_KINDS,
101
+ NETWORK_PROTOCOL: () => NETWORK_PROTOCOL,
102
+ NETWORK_PROTOCOL_INSECURE: () => NETWORK_PROTOCOL_INSECURE,
100
103
  NETWORK_PROTOCOL_LOOKUP: () => NETWORK_PROTOCOL_LOOKUP,
104
+ NETWORK_PROTOCOL_SECURE: () => NETWORK_PROTOCOL_SECURE,
101
105
  NIKE_DNS: () => NIKE_DNS,
102
106
  NON_ZERO_NUMERIC_CHAR: () => NON_ZERO_NUMERIC_CHAR,
103
107
  NORWEGIAN_NEWS: () => NORWEGIAN_NEWS,
@@ -114,6 +118,7 @@ __export(src_exports, {
114
118
  PLURAL_EXCEPTIONS_OLD: () => PLURAL_EXCEPTIONS_OLD,
115
119
  POWER_METRICS_LOOKUP: () => POWER_METRICS_LOOKUP,
116
120
  PRESSURE_METRICS_LOOKUP: () => PRESSURE_METRICS_LOOKUP,
121
+ PROTOCOL_DEFAULT_PORTS: () => PROTOCOL_DEFAULT_PORTS,
117
122
  PROXMOX_CT_STATE: () => PROXMOX_CT_STATE,
118
123
  REPO_PAGE_TYPES: () => REPO_PAGE_TYPES,
119
124
  REPO_SOURCES: () => REPO_SOURCES,
@@ -277,6 +282,9 @@ __export(src_exports, {
277
282
  getTokenKind: () => getTokenKind,
278
283
  getTomorrow: () => getTomorrow,
279
284
  getTypeSubtype: () => getTypeSubtype,
285
+ getUrlBase: () => getUrlBase,
286
+ getUrlDefaultPort: () => getUrlDefaultPort,
287
+ getUrlDynamics: () => getUrlDynamics,
280
288
  getUrlPath: () => getUrlPath,
281
289
  getUrlPort: () => getUrlPort,
282
290
  getUrlProtocol: () => getUrlProtocol,
@@ -289,6 +297,9 @@ __export(src_exports, {
289
297
  hasDefaultValue: () => hasDefaultValue,
290
298
  hasIndexOf: () => hasIndexOf,
291
299
  hasKeys: () => hasKeys,
300
+ hasOverlappingKeys: () => hasOverlappingKeys,
301
+ hasProtocol: () => hasProtocol,
302
+ hasProtocolPrefix: () => hasProtocolPrefix,
292
303
  hasUrlPort: () => hasUrlPort,
293
304
  hasUrlQueryParameter: () => hasUrlQueryParameter,
294
305
  hasWhiteSpace: () => hasWhiteSpace,
@@ -354,6 +365,7 @@ __export(src_exports, {
354
365
  isCountryCode3: () => isCountryCode3,
355
366
  isCountryName: () => isCountryName,
356
367
  isCssAspectRatio: () => isCssAspectRatio,
368
+ isCsv: () => isCsv,
357
369
  isCurrentMetric: () => isCurrentMetric,
358
370
  isCurrentUom: () => isCurrentUom,
359
371
  isCvsUrl: () => isCvsUrl,
@@ -430,12 +442,14 @@ __export(src_exports, {
430
442
  isLuminosityUom: () => isLuminosityUom,
431
443
  isLuxonDateTime: () => isLuxonDateTime,
432
444
  isMacysUrl: () => isMacysUrl,
445
+ isMap: () => isMap,
433
446
  isMapToken: () => isMapToken,
434
447
  isMassMetric: () => isMassMetric,
435
448
  isMassUom: () => isMassUom,
436
449
  isMetric: () => isMetric,
437
450
  isMexicanNewsUrl: () => isMexicanNewsUrl,
438
451
  isMoment: () => isMoment,
452
+ isNarrowableObject: () => isNarrowableObject,
439
453
  isNever: () => isNever,
440
454
  isNewsUrl: () => isNewsUrl,
441
455
  isNikeUrl: () => isNikeUrl,
@@ -455,6 +469,8 @@ __export(src_exports, {
455
469
  isPowerUom: () => isPowerUom,
456
470
  isPressureMetric: () => isPressureMetric,
457
471
  isPressureUom: () => isPressureUom,
472
+ isProtocol: () => isProtocol,
473
+ isProtocolPrefix: () => isProtocolPrefix,
458
474
  isReadonlyArray: () => isReadonlyArray,
459
475
  isRecordToken: () => isRecordToken,
460
476
  isRef: () => isRef,
@@ -470,6 +486,7 @@ __export(src_exports, {
470
486
  isSet: () => isSet,
471
487
  isSetBasedKind: () => isSetBasedKind,
472
488
  isSetBasedToken: () => isSetBasedToken,
489
+ isSetContainer: () => isSetContainer,
473
490
  isSetToken: () => isSetToken,
474
491
  isShape: () => isShape,
475
492
  isShapeCallback: () => isShapeCallback,
@@ -532,6 +549,7 @@ __export(src_exports, {
532
549
  isUsNewsUrl: () => isUsNewsUrl,
533
550
  isUsStateAbbreviation: () => isUsStateAbbreviation,
534
551
  isUsStateName: () => isUsStateName,
552
+ isVariable: () => isVariable,
535
553
  isVoltageMetric: () => isVoltageMetric,
536
554
  isVoltageUom: () => isVoltageUom,
537
555
  isVolumeMetric: () => isVolumeMetric,
@@ -579,6 +597,7 @@ __export(src_exports, {
579
597
  narrowObjectToType: () => narrowObjectToType,
580
598
  never: () => never,
581
599
  objectToApi: () => objectToApi,
600
+ objectValues: () => objectValues,
582
601
  omit: () => omit,
583
602
  optional: () => optional,
584
603
  optionalOrNull: () => optionalOrNull,
@@ -655,6 +674,7 @@ __export(src_exports, {
655
674
  widen: () => widen,
656
675
  withDefaults: () => withDefaults,
657
676
  withKeys: () => withKeys,
677
+ withValue: () => withValue,
658
678
  withoutKeys: () => withoutKeys,
659
679
  withoutValue: () => withoutValue,
660
680
  wrapFn: () => wrapFn,
@@ -1173,6 +1193,73 @@ var HASH_TABLE_CHAR = {
1173
1193
  ...HASH_TABLE_SPECIAL
1174
1194
  };
1175
1195
  var HASH_TABLE_OTHER = "999";
1196
+ var MIME_TYPES = [
1197
+ // Application MIME Types
1198
+ "application/json",
1199
+ "application/xml",
1200
+ "application/javascript",
1201
+ "application/pdf",
1202
+ "application/ld+json",
1203
+ "application/octet-stream",
1204
+ "application/x-www-form-urlencoded",
1205
+ "application/vnd.api+json",
1206
+ "application/msword",
1207
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1208
+ "application/vnd.ms-excel",
1209
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1210
+ "application/vnd.ms-powerpoint",
1211
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
1212
+ // Text MIME Types
1213
+ "text/plain",
1214
+ "text/html",
1215
+ "text/css",
1216
+ "text/csv",
1217
+ "text/javascript",
1218
+ "text/markdown",
1219
+ // Image MIME Types
1220
+ "image/jpeg",
1221
+ "image/png",
1222
+ "image/gif",
1223
+ "image/bmp",
1224
+ "image/webp",
1225
+ "image/svg+xml",
1226
+ "image/tiff",
1227
+ // Audio MIME Types
1228
+ "audio/mpeg",
1229
+ "audio/ogg",
1230
+ "audio/wav",
1231
+ "audio/webm",
1232
+ "audio/flac",
1233
+ // Video MIME Types
1234
+ "video/mp4",
1235
+ "video/mpeg",
1236
+ "video/ogg",
1237
+ "video/webm",
1238
+ "video/quicktime",
1239
+ // Multipart MIME Types
1240
+ "multipart/form-data",
1241
+ "multipart/mixed",
1242
+ "multipart/alternative",
1243
+ "multipart/related",
1244
+ // Font MIME Types
1245
+ "font/woff",
1246
+ "font/woff2",
1247
+ "font/ttf",
1248
+ "font/otf",
1249
+ // Other Common MIME Types
1250
+ "application/rss+xml",
1251
+ "application/atom+xml",
1252
+ "application/x-pkcs12",
1253
+ "application/x-shockwave-flash",
1254
+ "application/x-www-form-urlencoded",
1255
+ "application/x-font-ttf",
1256
+ "application/x-font-opentype",
1257
+ "application/x-font-woff",
1258
+ "application/x-font-woff2",
1259
+ "application/vnd.rar",
1260
+ "application/zip",
1261
+ "application/x-7z-compressed"
1262
+ ];
1176
1263
  var IMAGE_FORMAT_LOOKUP = [
1177
1264
  { ext: "jpg", webFormat: true, other_ext: ["jpeg"] },
1178
1265
  { ext: "png", webFormat: true, other_ext: [] },
@@ -1513,13 +1600,51 @@ var IPv6 = {
1513
1600
  var IPv4 = {
1514
1601
  Loopback: "127.0.0.1"
1515
1602
  };
1603
+ var NETWORK_PROTOCOL_INSECURE = [
1604
+ "http",
1605
+ "ftp",
1606
+ "ws",
1607
+ "dns",
1608
+ "telnet",
1609
+ "imap",
1610
+ "pop3",
1611
+ "smtp"
1612
+ ];
1613
+ var NETWORK_PROTOCOL_SECURE = [
1614
+ "https",
1615
+ "sftp",
1616
+ "wss",
1617
+ "sdns",
1618
+ "ssh"
1619
+ ];
1620
+ var NETWORK_PROTOCOL = [
1621
+ ...NETWORK_PROTOCOL_INSECURE,
1622
+ ...NETWORK_PROTOCOL_SECURE
1623
+ ];
1516
1624
  var NETWORK_PROTOCOL_LOOKUP = {
1517
1625
  http: ["http", "https"],
1518
1626
  ftp: ["ftp", "sftp"],
1519
1627
  file: ["", "file"],
1520
1628
  ws: ["ws", "wss"],
1521
1629
  ssh: ["", "ssh"],
1522
- scp: ["", "scp"]
1630
+ scp: ["", "scp"],
1631
+ telnet: ["telnet", ""],
1632
+ dns: ["dns", "sdns"]
1633
+ };
1634
+ var PROTOCOL_DEFAULT_PORTS = {
1635
+ http: 80,
1636
+ https: 443,
1637
+ ws: 80,
1638
+ wss: 443,
1639
+ ssh: 22,
1640
+ telnet: 23,
1641
+ dns: 53,
1642
+ sdns: 853,
1643
+ smtp: 25,
1644
+ imap: 142,
1645
+ pop3: 110,
1646
+ ftp: 21,
1647
+ sftp: 22
1523
1648
  };
1524
1649
  var TOP_LEVEL_DOMAINS = [
1525
1650
  "com",
@@ -3821,13 +3946,51 @@ var AREA_METRICS_LOOKUP2 = [
3821
3946
  { abbrev: "acre", name: "acre" },
3822
3947
  { abbrev: "ha", name: "hectare" }
3823
3948
  ];
3949
+ var NETWORK_PROTOCOL_INSECURE2 = [
3950
+ "http",
3951
+ "ftp",
3952
+ "ws",
3953
+ "dns",
3954
+ "telnet",
3955
+ "imap",
3956
+ "pop3",
3957
+ "smtp"
3958
+ ];
3959
+ var NETWORK_PROTOCOL_SECURE2 = [
3960
+ "https",
3961
+ "sftp",
3962
+ "wss",
3963
+ "sdns",
3964
+ "ssh"
3965
+ ];
3966
+ var NETWORK_PROTOCOL2 = [
3967
+ ...NETWORK_PROTOCOL_INSECURE2,
3968
+ ...NETWORK_PROTOCOL_SECURE2
3969
+ ];
3824
3970
  var NETWORK_PROTOCOL_LOOKUP2 = {
3825
3971
  http: ["http", "https"],
3826
3972
  ftp: ["ftp", "sftp"],
3827
3973
  file: ["", "file"],
3828
3974
  ws: ["ws", "wss"],
3829
3975
  ssh: ["", "ssh"],
3830
- scp: ["", "scp"]
3976
+ scp: ["", "scp"],
3977
+ telnet: ["telnet", ""],
3978
+ dns: ["dns", "sdns"]
3979
+ };
3980
+ var PROTOCOL_DEFAULT_PORTS2 = {
3981
+ http: 80,
3982
+ https: 443,
3983
+ ws: 80,
3984
+ wss: 443,
3985
+ ssh: 22,
3986
+ telnet: 23,
3987
+ dns: 53,
3988
+ sdns: 853,
3989
+ smtp: 25,
3990
+ imap: 142,
3991
+ pop3: 110,
3992
+ ftp: 21,
3993
+ sftp: 22
3831
3994
  };
3832
3995
  var Never2 = createConstant2("never");
3833
3996
  var US_NEWS2 = [
@@ -5258,6 +5421,16 @@ function narrowObjectToType() {
5258
5421
  }
5259
5422
  );
5260
5423
  }
5424
+ function objectValues(obj) {
5425
+ const tuple3 = Object.keys(obj).reduce(
5426
+ (acc, key) => [
5427
+ ...acc,
5428
+ obj[key]
5429
+ ],
5430
+ []
5431
+ );
5432
+ return tuple3;
5433
+ }
5261
5434
  function omit(obj, ...removeKeys) {
5262
5435
  const keys = Object.keys(obj);
5263
5436
  return keys.reduce(
@@ -5308,12 +5481,110 @@ function withKeys(dict, ...keys) {
5308
5481
  function withoutKeys(dict, ...exclude) {
5309
5482
  return omit(dict, ...exclude);
5310
5483
  }
5311
- function withoutValue(val) {
5484
+ function doesExtend(type) {
5485
+ return (val) => {
5486
+ let response = false;
5487
+ if (isString(val)) {
5488
+ if (type === "string") {
5489
+ response = true;
5490
+ }
5491
+ if (type.startsWith("string(")) {
5492
+ const literals = stripAfter(
5493
+ stripBefore(type, "string("),
5494
+ ")"
5495
+ ).split(/,\s*/);
5496
+ if (literals.includes(val)) {
5497
+ response = true;
5498
+ }
5499
+ }
5500
+ }
5501
+ if (isNumber(val)) {
5502
+ if (type === "number") {
5503
+ response = true;
5504
+ }
5505
+ if (type.startsWith("number(")) {
5506
+ const literals = stripAfter(
5507
+ stripBefore(type, "number("),
5508
+ ")"
5509
+ ).split(/,\s*/).map(Number);
5510
+ if (literals.includes(val)) {
5511
+ response = true;
5512
+ }
5513
+ }
5514
+ }
5515
+ if (isNull(val) && (type === "null" || type === "Opt<null>")) {
5516
+ response = true;
5517
+ }
5518
+ if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
5519
+ response = true;
5520
+ }
5521
+ if (isBoolean(val)) {
5522
+ if (type === "boolean") {
5523
+ response = true;
5524
+ }
5525
+ if (type === "true" && val === true || type === "false" && val === false) {
5526
+ response = true;
5527
+ }
5528
+ }
5529
+ if (isNarrowableObject(val)) {
5530
+ if (type === "Dict" || type === "Dict<string, unknown>") {
5531
+ response = true;
5532
+ }
5533
+ if (startsWith("Dict<")(type)) {
5534
+ const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
5535
+ if (match) {
5536
+ const { value } = match;
5537
+ const isOpt = value.includes(`Opt<`);
5538
+ const values = objectValues(val);
5539
+ if (values.every((i) => isOpt ? isString(i) || isUndefined(i) : isString(i)) && type === "Dict<string, string>" || values.every((i) => isOpt ? isUndefined(i) || isNumber(i) : isNumber(i)) && type === "Dict<string, number>" || values.every((i) => isOpt ? isUndefined(i) || isBoolean(i) : isBoolean(i)) && type === "Dict<string, boolean>") {
5540
+ response = true;
5541
+ }
5542
+ }
5543
+ }
5544
+ }
5545
+ if (isArray(val)) {
5546
+ if (type === "Array" || type === "Array<unknown>") {
5547
+ return true;
5548
+ }
5549
+ if (type === "Array<Dict>" && val.every(isObject) || type === "Array<boolean>" && val.every(isBoolean) || type === "Array<string>" && val.every(isString) || type === "Array<number>" && val.every(isNumber) || type === "Array<Map>" && val.every(isMap) || type === "Array<Set>" && val.every(isSetContainer)) {
5550
+ response = true;
5551
+ }
5552
+ }
5553
+ if (isMap(val)) {
5554
+ if (type === "Map" || type === "Map<Dict, Array>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isArray) || type === "Map<Dict, Dict>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isObject) || type === "Map<Dict, boolean>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isBoolean) || type === "Map<Dict, number>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isNumber) || type === "Map<Dict, string>" && Array.from(val.keys()).every(isObject) && Array.from(val.values()).every(isString) || type === "Map<Dict, unknown>" && Array.from(val.keys()).every(isObject) || type === "Map<string, string>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isString) || type === "Map<string, number>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isNumber) || type === "Map<string, boolean>" && Array.from(val.keys()).every(isString) && Array.from(val.values()).every(isBoolean) || type === "Map<string, unknown>" && Array.from(val.keys()).every(isString) || type === "Map<number, string>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isString) || type === "Map<number, number>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isNumber) || type === "Map<number, boolean>" && Array.from(val.keys()).every(isNumber) && Array.from(val.values()).every(isBoolean) || type === "Map<number, unknown>" && Array.from(val.keys()).every(isNumber)) {
5555
+ response = true;
5556
+ }
5557
+ }
5558
+ if (isSetContainer(val)) {
5559
+ if (type === "Set" || type === "Set<unknown>" || type === "Set<boolean>" && Array.from(val).every(isBoolean) || type === "Set<string>" && Array.from(val).every(isString) || type === "Set<number>" && Array.from(val).every(isNumber) || type === "Set<Opt<boolean>>" && Array.from(val).every((i) => isBoolean(i) || isUndefined(i)) || type === "Set<Opt<string>>" && Array.from(val).every((i) => isString(i) || isUndefined(i)) || type === "Set<Opt<number>>" && Array.from(val).every((i) => isNumber(i) || isUndefined(i))) {
5560
+ response = true;
5561
+ }
5562
+ }
5563
+ return response;
5564
+ };
5565
+ }
5566
+ function withoutValue(wo) {
5312
5567
  return (obj) => {
5313
- return Object.keys(obj).reduce(
5314
- (acc, key) => val === obj[key] ? acc : { ...acc, [key]: obj[key] },
5315
- {}
5316
- );
5568
+ const output = {};
5569
+ for (const key of keysOf(obj)) {
5570
+ const val = obj[key];
5571
+ if (!doesExtend(wo)(val)) {
5572
+ output[key] = val;
5573
+ }
5574
+ }
5575
+ return output;
5576
+ };
5577
+ }
5578
+ function withValue(wo) {
5579
+ return (obj) => {
5580
+ const output = {};
5581
+ for (const key of keysOf(obj)) {
5582
+ const val = obj[key];
5583
+ if (doesExtend(wo)(val)) {
5584
+ output[key] = val;
5585
+ }
5586
+ }
5587
+ return output;
5317
5588
  };
5318
5589
  }
5319
5590
  function createErrorCondition(kind, msg = "", utility = "") {
@@ -5380,7 +5651,7 @@ var filter = "NOT READY";
5380
5651
  function find(list2, deref = null) {
5381
5652
  return (comparator) => {
5382
5653
  return list2.find((i) => {
5383
- const val = deref ? isContainer(i) ? deref in i ? i[deref] : void 0 : i : i;
5654
+ const val = deref ? isObject(i) || isArray(i) ? deref in i ? i[deref] : void 0 : i : i;
5384
5655
  return val === comparator;
5385
5656
  });
5386
5657
  };
@@ -5532,6 +5803,9 @@ function isFunction(value) {
5532
5803
  function isObject(value) {
5533
5804
  return typeof value === "object" && value !== null && Array.isArray(value) === false;
5534
5805
  }
5806
+ function isNarrowableObject(value) {
5807
+ return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
5808
+ }
5535
5809
  function isEscapeFunction(val) {
5536
5810
  return isFunction(val) && "escape" in val && val.escape === true;
5537
5811
  }
@@ -6051,6 +6325,9 @@ var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
6051
6325
  function isCssAspectRatio(val) {
6052
6326
  return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
6053
6327
  }
6328
+ function isCsv(val) {
6329
+ return isString(val) && val.includes(",") && !val.startsWith(",");
6330
+ }
6054
6331
  function isDefined(value) {
6055
6332
  return typeof value !== "undefined";
6056
6333
  }
@@ -6088,6 +6365,9 @@ function isIndexable(value) {
6088
6365
  function isInlineSvg(v) {
6089
6366
  return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
6090
6367
  }
6368
+ function isMap(val) {
6369
+ return val instanceof Map;
6370
+ }
6091
6371
  function isNever(val) {
6092
6372
  return isConstant(val) && val.kind === "never";
6093
6373
  }
@@ -6101,7 +6381,7 @@ function isPhoneNumber(val) {
6101
6381
  const svelte = String(val).trim();
6102
6382
  const chars = svelte.split("");
6103
6383
  const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
6104
- const valid = ["+", "(", ...NUMERIC_CHAR2];
6384
+ const valid2 = ["+", "(", ...NUMERIC_CHAR2];
6105
6385
  const nothing = stripChars(svelte, ...[
6106
6386
  ...NUMERIC_CHAR2,
6107
6387
  ...WHITESPACE_CHARS2,
@@ -6111,7 +6391,7 @@ function isPhoneNumber(val) {
6111
6391
  ".",
6112
6392
  "-"
6113
6393
  ]);
6114
- return chars.every((i) => valid.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6394
+ return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6115
6395
  }
6116
6396
  function isReadonlyArray(value) {
6117
6397
  return Array.isArray(value) === true;
@@ -6136,6 +6416,12 @@ function isLikeRegExp(val) {
6136
6416
  }
6137
6417
  return false;
6138
6418
  }
6419
+ function isSet(val) {
6420
+ return isObject(val) ? val.kind !== "Unset" : true;
6421
+ }
6422
+ function isSetContainer(val) {
6423
+ return val instanceof Set;
6424
+ }
6139
6425
  function isStringArray(val) {
6140
6426
  return Array.isArray(val) && val.every((i) => isString(i));
6141
6427
  }
@@ -6160,9 +6446,6 @@ function isTypeTuple(value) {
6160
6446
  function isUnset(val) {
6161
6447
  return isObject(val) && val.kind === "Unset";
6162
6448
  }
6163
- function isSet(val) {
6164
- return isObject(val) ? val.kind !== "Unset" : true;
6165
- }
6166
6449
  function isUri(val, ...protocols) {
6167
6450
  const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
6168
6451
  return isString(val) && p.some((i) => val.startsWith(`${i}://`));
@@ -6171,6 +6454,19 @@ function isUrl(val, ...protocols) {
6171
6454
  const p = protocols.length === 0 ? ["http", "https"] : protocols;
6172
6455
  return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6173
6456
  }
6457
+ var VALID = [
6458
+ ...ALPHA_CHARS2,
6459
+ ...NUMERIC_CHAR2,
6460
+ "_",
6461
+ "."
6462
+ ];
6463
+ var alpha = null;
6464
+ function valid(chars) {
6465
+ return chars.every((i) => VALID.includes(i));
6466
+ }
6467
+ function isVariable(val) {
6468
+ return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6469
+ }
6174
6470
  function separate(s) {
6175
6471
  return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6176
6472
  }
@@ -6309,6 +6605,18 @@ function hasUrlQueryParameter(val, prop) {
6309
6605
  function isNumericArray(val) {
6310
6606
  return Array.isArray(val) && val.every((i) => isNumber(i));
6311
6607
  }
6608
+ function hasProtocol(val, ...protocols) {
6609
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
6610
+ }
6611
+ function isProtocol(val, ...protocols) {
6612
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
6613
+ }
6614
+ function hasProtocolPrefix(val, ...protocols) {
6615
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).some((i) => val.startsWith(i)) : protocols.map((i) => `${i}://`).some((i) => val.startsWith(i));
6616
+ }
6617
+ function isProtocolPrefix(val, ...protocols) {
6618
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6619
+ }
6312
6620
  function isTypeToken(val, kind) {
6313
6621
  if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
6314
6622
  const stripped = stripSurround("<<", ">>")(val);
@@ -6540,24 +6848,24 @@ function isNewsUrl(val) {
6540
6848
  return isAustralianNewsUrl(val) || isBelgiumNewsUrl(val) || isCanadianNewsUrl(val) || isDanishNewsUrl(val) || isDutchNewsUrl(val) || isFrenchNewsUrl(val) || isGermanNewsUrl(val) || isIndianNewsUrl(val) || isItalianNewsUrl(val) || isJapaneseNewsUrl(val) || isMexicanNewsUrl(val) || isNorwegianNewsUrl(val) || isSouthKoreanNewsUrl(val) || isSpanishNewsUrl(val) || isSwissNewsUrl(val) || isTurkishNewsUrl(val) || isUkNewsUrl(val) || isUsNewsUrl(val);
6541
6849
  }
6542
6850
  function isBitbucketUrl(val) {
6543
- const valid = REPO_SOURCE_LOOKUP2.bitbucket;
6544
- return isString(val) && valid.some(
6851
+ const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
6852
+ return isString(val) && valid2.some(
6545
6853
  (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6546
6854
  );
6547
6855
  }
6548
6856
  function isCodeCommitUrl(val) {
6549
- const valid = REPO_SOURCE_LOOKUP2.codecommit;
6550
- return isString(val) && valid.some(
6857
+ const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
6858
+ return isString(val) && valid2.some(
6551
6859
  (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6552
6860
  );
6553
6861
  }
6554
6862
  function isGithubUrl(val) {
6555
- const valid = [
6863
+ const valid2 = [
6556
6864
  "https://github.com",
6557
6865
  "https://www.github.com",
6558
6866
  "https://github.io"
6559
6867
  ];
6560
- return isString(val) && valid.some(
6868
+ return isString(val) && valid2.some(
6561
6869
  (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
6562
6870
  );
6563
6871
  }
@@ -7101,16 +7409,77 @@ function getUrlQueryParams(url, specific = void 0) {
7101
7409
  }
7102
7410
  return qp === "" ? qp : `?${qp}`;
7103
7411
  }
7104
- function getUrlPort(url) {
7105
- const candidate = takeNumericCharacters(
7106
- stripBefore(removeUrlProtocol(url), ":")
7107
- );
7108
- return candidate === "" ? "default" : Number(candidate);
7412
+ function getUrlDefaultPort(url) {
7413
+ const proto = getUrlProtocol(url);
7414
+ return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
7415
+ }
7416
+ function getUrlPort(url, resolve = false) {
7417
+ const re = /.*:(\d{2,3})/;
7418
+ const match = url.match(re);
7419
+ return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
7109
7420
  }
7110
7421
  function getUrlSource(url) {
7111
7422
  const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
7112
7423
  return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
7113
7424
  }
7425
+ function getUrlBase(url) {
7426
+ const path = getUrlPath(url);
7427
+ const remaining = stripAfter(url, path);
7428
+ return remaining;
7429
+ }
7430
+ function getUrlDynamics(url) {
7431
+ const path = getUrlPath(url);
7432
+ const qp = getUrlQueryParams(url);
7433
+ const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
7434
+ const segmentTypes = [
7435
+ "string",
7436
+ "number",
7437
+ "boolean",
7438
+ "Opt<string>",
7439
+ "Opt<number>",
7440
+ "Opt<boolean>"
7441
+ ];
7442
+ const pathVars = {};
7443
+ const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
7444
+ const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
7445
+ const findPathNamed = infer(`<{{infer name}}>`);
7446
+ for (const part of pathParts) {
7447
+ const union4 = findPathUnion(part);
7448
+ const typed = findPathTyped(part);
7449
+ const named = findPathNamed(part);
7450
+ if (union4) {
7451
+ if (isVariable(union4.name) && isCsv(union4.union)) {
7452
+ pathVars[union4.name] = `string(${union4.union})`;
7453
+ }
7454
+ } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
7455
+ pathVars[typed.name] = typed.type;
7456
+ } else if (named && isVariable(named.name)) {
7457
+ pathVars[named.name] = "string";
7458
+ }
7459
+ }
7460
+ const qpVars = {};
7461
+ const qpParts = stripLeading(qp, "?").split("&");
7462
+ for (const p of qpParts) {
7463
+ const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
7464
+ const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
7465
+ const fixed = infer(`{{infer var}}={{infer val}}`)(p);
7466
+ if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
7467
+ qpVars[union4.var] = `string(${union4.params})`;
7468
+ } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
7469
+ qpVars[dynamic.var] = dynamic.val;
7470
+ } else if (fixed && isVariable(fixed.var)) {
7471
+ qpVars[fixed.var] = fixed.val;
7472
+ }
7473
+ }
7474
+ return {
7475
+ pathVars,
7476
+ qpVars,
7477
+ allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
7478
+ ...pathVars,
7479
+ ...qpVars
7480
+ }
7481
+ };
7482
+ }
7114
7483
  function urlMeta(url) {
7115
7484
  return {
7116
7485
  url,
@@ -7118,6 +7487,7 @@ function urlMeta(url) {
7118
7487
  protocol: getUrlProtocol(url),
7119
7488
  path: getUrlPath(url),
7120
7489
  queryParameters: getUrlQueryParams(url),
7490
+ params: getUrlDynamics,
7121
7491
  port: getUrlPort(url),
7122
7492
  source: getUrlSource(url),
7123
7493
  isIpAddress: isIpAddress(getUrlSource(url)),
@@ -7518,6 +7888,15 @@ function simpleType(token) {
7518
7888
  const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
7519
7889
  return value;
7520
7890
  }
7891
+ function hasOverlappingKeys(a, b) {
7892
+ const keys = Object.keys(a);
7893
+ for (const k of keys) {
7894
+ if (k in b) {
7895
+ return true;
7896
+ }
7897
+ }
7898
+ return false;
7899
+ }
7521
7900
  function uniqueKeys(left, right) {
7522
7901
  const isNumeric = !!(isArray(left) && isArray(right));
7523
7902
  if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
@@ -7806,11 +8185,15 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
7806
8185
  MARKED,
7807
8186
  MASS_METRICS_LOOKUP,
7808
8187
  MEXICAN_NEWS,
8188
+ MIME_TYPES,
7809
8189
  MONTH_ABBR,
7810
8190
  MONTH_NAME,
7811
8191
  MapCardinality,
7812
8192
  NARROW_CONTAINER_TYPE_KINDS,
8193
+ NETWORK_PROTOCOL,
8194
+ NETWORK_PROTOCOL_INSECURE,
7813
8195
  NETWORK_PROTOCOL_LOOKUP,
8196
+ NETWORK_PROTOCOL_SECURE,
7814
8197
  NIKE_DNS,
7815
8198
  NON_ZERO_NUMERIC_CHAR,
7816
8199
  NORWEGIAN_NEWS,
@@ -7827,6 +8210,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
7827
8210
  PLURAL_EXCEPTIONS_OLD,
7828
8211
  POWER_METRICS_LOOKUP,
7829
8212
  PRESSURE_METRICS_LOOKUP,
8213
+ PROTOCOL_DEFAULT_PORTS,
7830
8214
  PROXMOX_CT_STATE,
7831
8215
  REPO_PAGE_TYPES,
7832
8216
  REPO_SOURCES,
@@ -7990,6 +8374,9 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
7990
8374
  getTokenKind,
7991
8375
  getTomorrow,
7992
8376
  getTypeSubtype,
8377
+ getUrlBase,
8378
+ getUrlDefaultPort,
8379
+ getUrlDynamics,
7993
8380
  getUrlPath,
7994
8381
  getUrlPort,
7995
8382
  getUrlProtocol,
@@ -8002,6 +8389,9 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8002
8389
  hasDefaultValue,
8003
8390
  hasIndexOf,
8004
8391
  hasKeys,
8392
+ hasOverlappingKeys,
8393
+ hasProtocol,
8394
+ hasProtocolPrefix,
8005
8395
  hasUrlPort,
8006
8396
  hasUrlQueryParameter,
8007
8397
  hasWhiteSpace,
@@ -8067,6 +8457,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8067
8457
  isCountryCode3,
8068
8458
  isCountryName,
8069
8459
  isCssAspectRatio,
8460
+ isCsv,
8070
8461
  isCurrentMetric,
8071
8462
  isCurrentUom,
8072
8463
  isCvsUrl,
@@ -8143,12 +8534,14 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8143
8534
  isLuminosityUom,
8144
8535
  isLuxonDateTime,
8145
8536
  isMacysUrl,
8537
+ isMap,
8146
8538
  isMapToken,
8147
8539
  isMassMetric,
8148
8540
  isMassUom,
8149
8541
  isMetric,
8150
8542
  isMexicanNewsUrl,
8151
8543
  isMoment,
8544
+ isNarrowableObject,
8152
8545
  isNever,
8153
8546
  isNewsUrl,
8154
8547
  isNikeUrl,
@@ -8168,6 +8561,8 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8168
8561
  isPowerUom,
8169
8562
  isPressureMetric,
8170
8563
  isPressureUom,
8564
+ isProtocol,
8565
+ isProtocolPrefix,
8171
8566
  isReadonlyArray,
8172
8567
  isRecordToken,
8173
8568
  isRef,
@@ -8183,6 +8578,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8183
8578
  isSet,
8184
8579
  isSetBasedKind,
8185
8580
  isSetBasedToken,
8581
+ isSetContainer,
8186
8582
  isSetToken,
8187
8583
  isShape,
8188
8584
  isShapeCallback,
@@ -8245,6 +8641,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8245
8641
  isUsNewsUrl,
8246
8642
  isUsStateAbbreviation,
8247
8643
  isUsStateName,
8644
+ isVariable,
8248
8645
  isVoltageMetric,
8249
8646
  isVoltageUom,
8250
8647
  isVolumeMetric,
@@ -8292,6 +8689,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8292
8689
  narrowObjectToType,
8293
8690
  never,
8294
8691
  objectToApi,
8692
+ objectValues,
8295
8693
  omit,
8296
8694
  optional,
8297
8695
  optionalOrNull,
@@ -8368,6 +8766,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8368
8766
  widen,
8369
8767
  withDefaults,
8370
8768
  withKeys,
8769
+ withValue,
8371
8770
  withoutKeys,
8372
8771
  withoutValue,
8373
8772
  wrapFn,