inferred-types 0.54.2 → 0.54.4

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.
@@ -264,6 +264,7 @@ __export(src_exports, {
264
264
  filter: () => filter,
265
265
  find: () => find,
266
266
  fnMeta: () => fnMeta,
267
+ fromDefineObject: () => fromDefineObject,
267
268
  get: () => get,
268
269
  getDaysBetween: () => getDaysBetween,
269
270
  getEach: () => getEach,
@@ -272,6 +273,7 @@ __export(src_exports, {
272
273
  getToday: () => getToday,
273
274
  getTokenKind: () => getTokenKind,
274
275
  getTomorrow: () => getTomorrow,
276
+ getTypeSubtype: () => getTypeSubtype,
275
277
  getUrlPath: () => getUrlPath,
276
278
  getUrlPort: () => getUrlPort,
277
279
  getUrlProtocol: () => getUrlProtocol,
@@ -512,6 +514,7 @@ __export(src_exports, {
512
514
  isTupleToken: () => isTupleToken,
513
515
  isTurkishNewsUrl: () => isTurkishNewsUrl,
514
516
  isTypeOf: () => isTypeOf,
517
+ isTypeSubtype: () => isTypeSubtype,
515
518
  isTypeToken: () => isTypeToken,
516
519
  isTypeTokenKind: () => isTypeTokenKind,
517
520
  isTypeTuple: () => isTypeTuple,
@@ -5445,201 +5448,6 @@ function ensureTrailing(content, ensure) {
5445
5448
  content.endsWith(ensure) ? content : `${content}${ensure}`
5446
5449
  );
5447
5450
  }
5448
- function identity(...values) {
5449
- return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
5450
- }
5451
- function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5452
- if (ch.length !== 1) {
5453
- throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
5454
- }
5455
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5456
- }
5457
- function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
5458
- if (ch.length !== 1) {
5459
- throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
5460
- }
5461
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
5462
- }
5463
- function parseTemplate(template) {
5464
- const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:as\s+(string|number|boolean)\s*)?\}\}/g;
5465
- let lastIndex = 0;
5466
- let match;
5467
- const segments = [];
5468
- do {
5469
- match = pattern.exec(template);
5470
- if (match) {
5471
- const [fullMatch, varName, asType2] = match;
5472
- const staticPart = template.slice(lastIndex, match.index);
5473
- if (staticPart) {
5474
- segments.push({ dynamic: false, text: staticPart });
5475
- }
5476
- segments.push({
5477
- dynamic: true,
5478
- varName,
5479
- type: asType2 ? asType2 : "string"
5480
- });
5481
- lastIndex = match.index + fullMatch.length;
5482
- }
5483
- } while (match);
5484
- const remainder = template.slice(lastIndex);
5485
- if (remainder) {
5486
- segments.push({ dynamic: false, text: remainder });
5487
- }
5488
- return segments;
5489
- }
5490
- function escapeRegex(str) {
5491
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5492
- }
5493
- function buildRegexPattern(segments) {
5494
- let regexStr = "^";
5495
- for (const seg of segments) {
5496
- if (!seg.dynamic) {
5497
- regexStr += escapeRegex(seg.text);
5498
- } else {
5499
- switch (seg.type) {
5500
- case "string":
5501
- regexStr += `(?<${seg.varName}>.*?)`;
5502
- break;
5503
- case "number":
5504
- regexStr += `(?<${seg.varName}>\\d+)`;
5505
- break;
5506
- case "boolean":
5507
- regexStr += `(?<${seg.varName}>(?:true|false))`;
5508
- break;
5509
- }
5510
- }
5511
- }
5512
- regexStr += "$";
5513
- return new RegExp(regexStr, "s");
5514
- }
5515
- function convertValue(type, value) {
5516
- switch (type) {
5517
- case "string":
5518
- return value;
5519
- case "number":
5520
- return Number(value);
5521
- case "boolean":
5522
- return value === "true";
5523
- }
5524
- }
5525
- function matchTemplate(inference, test) {
5526
- const segments = parseTemplate(inference);
5527
- const regex = buildRegexPattern(segments);
5528
- const match = test.match(regex);
5529
- if (!match)
5530
- return false;
5531
- const result2 = {};
5532
- for (const seg of segments) {
5533
- if (seg.dynamic) {
5534
- const rawVal = match.groups?.[seg.varName];
5535
- if (rawVal === void 0)
5536
- return false;
5537
- result2[seg.varName.toLowerCase()] = convertValue(seg.type, rawVal);
5538
- }
5539
- }
5540
- return result2;
5541
- }
5542
- function infer(inference) {
5543
- return (test) => {
5544
- return matchTemplate(inference, test);
5545
- };
5546
- }
5547
- function idLiteral(o) {
5548
- return { ...o, id: o.id };
5549
- }
5550
- function nameLiteral(o) {
5551
- return o;
5552
- }
5553
- function kindLiteral(o) {
5554
- return o;
5555
- }
5556
- function idTypeGuard(_o) {
5557
- return true;
5558
- }
5559
- function literal(obj) {
5560
- return obj;
5561
- }
5562
- function lowercase(str) {
5563
- return str.toLowerCase();
5564
- }
5565
- function narrow(...values) {
5566
- return values.length === 1 ? values[0] : values;
5567
- }
5568
- function pathJoin(...segments) {
5569
- const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
5570
- const original_path = segments.join("/");
5571
- const pre = original_path.startsWith("/") ? "/" : "";
5572
- const post = original_path.endsWith("/") ? "/" : "";
5573
- return `${pre}${clean_path}${post}`;
5574
- }
5575
- var asPhoneFormat = () => `NOT IMPLEMENTED`;
5576
- function getPhoneCountryCode(phone) {
5577
- return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
5578
- stripLeading(stripLeading(phone.trim(), "+"), "00"),
5579
- ...NUMERIC_CHAR2
5580
- ) : "";
5581
- }
5582
- function removePhoneCountryCode(phone) {
5583
- const countryCode = getPhoneCountryCode(phone);
5584
- return countryCode !== "" ? stripLeading(stripLeading(
5585
- phone.trim(),
5586
- "+",
5587
- "00"
5588
- ), countryCode).trim() : phone.trim();
5589
- }
5590
- var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
5591
- function endingIn(word, postfix) {
5592
- switch (postfix) {
5593
- case "is":
5594
- return word.endsWith(postfix) ? `${word}es` : void 0;
5595
- case "singular-noun":
5596
- return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
5597
- case "f":
5598
- return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
5599
- case "y":
5600
- return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
5601
- default:
5602
- throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
5603
- }
5604
- }
5605
- function pluralize(word) {
5606
- const right = rightWhitespace(word);
5607
- const w = word.trimEnd();
5608
- const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
5609
- return `${result2}${right}`;
5610
- }
5611
- function retainAfter(content, ...find2) {
5612
- const idx = Math.min(
5613
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5614
- );
5615
- const min = Math.min(...find2.map((i) => i.length));
5616
- let len = Math.max(...find2.map((i) => i.length));
5617
- if (min !== len) {
5618
- if (!find2.includes(content.slice(idx, len))) {
5619
- len = min;
5620
- }
5621
- }
5622
- return idx && idx > 0 ? content.slice(idx + len) : "";
5623
- }
5624
- function retainAfterInclusive(content, ...find2) {
5625
- const minFound = Math.min(
5626
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
5627
- );
5628
- return minFound > 0 ? content.slice(minFound) : "";
5629
- }
5630
- function asChars(str) {
5631
- return str.split("");
5632
- }
5633
- function retainChars(content, ...retain2) {
5634
- const chars = asChars(content);
5635
- return chars.filter((c) => retain2.includes(c)).join("");
5636
- }
5637
- function asRecord(obj) {
5638
- return obj;
5639
- }
5640
- function asString(value) {
5641
- return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
5642
- }
5643
5451
  function isFunction(value) {
5644
5452
  return typeof value === "function";
5645
5453
  }
@@ -5921,6 +5729,150 @@ function hasKeys(...props) {
5921
5729
  return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
5922
5730
  };
5923
5731
  }
5732
+ function asChars(str) {
5733
+ return str.split("");
5734
+ }
5735
+ function asRecord(obj) {
5736
+ return obj;
5737
+ }
5738
+ function asString(value) {
5739
+ return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
5740
+ }
5741
+ function csv(csv2, format = `string-numeric-tuple`) {
5742
+ const tuple3 = [];
5743
+ csv2.split(/,\s?/).forEach((v) => {
5744
+ tuple3.push(
5745
+ format === "string-numeric-tuple" ? isNumberLike(v) ? Number(v) : v : format === "json-tuple" ? isNumberLike(v) ? Number(v) : v === "true" ? true : v === "false" ? false : `"${v}"` : format === "string-tuple" ? `${v}` : Never2
5746
+ );
5747
+ });
5748
+ return tuple3;
5749
+ }
5750
+ function intersect(value, _intersectedWith) {
5751
+ return value;
5752
+ }
5753
+ function stripTrailing(content, ...strip2) {
5754
+ let output = String(content);
5755
+ for (const s of strip2) {
5756
+ if (output.endsWith(String(s))) {
5757
+ output = output.slice(0, -1 * String(s).length);
5758
+ }
5759
+ }
5760
+ return isNumber(content) ? Number(output) : output;
5761
+ }
5762
+ function ip6GroupExpansion(ip) {
5763
+ return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
5764
+ }
5765
+ function jsonValue(val) {
5766
+ return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
5767
+ }
5768
+ function jsonValues(...val) {
5769
+ return val.map((i) => jsonValue(i));
5770
+ }
5771
+ function lookupAlpha2Code(code, prop) {
5772
+ const found = ISO3166_12.find((i) => i.alpha2 === code);
5773
+ return found ? found[prop] : void 0;
5774
+ }
5775
+ function lookupAlpha3Code(code, prop) {
5776
+ const found = ISO3166_12.find((i) => i.alpha3 === code);
5777
+ return found ? found[prop] : void 0;
5778
+ }
5779
+ function lookupName(name, prop) {
5780
+ const found = ISO3166_12.find((i) => i.name === name);
5781
+ return found ? found[prop] : void 0;
5782
+ }
5783
+ function lookupNumericCode(code, prop) {
5784
+ let num = isNumber(code) ? `${code}` : code;
5785
+ if (num.length === 1) {
5786
+ num = `00${num}`;
5787
+ } else if (num.length === 2) {
5788
+ num = `0${num}`;
5789
+ }
5790
+ const found = ISO3166_12.find((i) => i.countryCode === num);
5791
+ return found ? found[prop] : void 0;
5792
+ }
5793
+ function lookupCountryName(code) {
5794
+ const uc = uppercase(code);
5795
+ return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
5796
+ }
5797
+ function lookupCountryAlpha2(code) {
5798
+ const uc = uppercase(code);
5799
+ return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
5800
+ }
5801
+ function lookupCountryAlpha3(token) {
5802
+ const uc = uppercase(token);
5803
+ return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
5804
+ }
5805
+ function lookupCountryCode(token) {
5806
+ const uc = uppercase(token);
5807
+ return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
5808
+ }
5809
+ function mergeObjects(defVal, override) {
5810
+ const intersectingKeys = sharedKeys(defVal, override);
5811
+ const defUnique = withoutKeys(defVal, ...intersectingKeys);
5812
+ const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
5813
+ const merged = {
5814
+ ...intersectingKeys.reduce(
5815
+ (acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
5816
+ {}
5817
+ ),
5818
+ ...defUnique,
5819
+ ...overrideUnique
5820
+ };
5821
+ return merged;
5822
+ }
5823
+ function isUndefined(value) {
5824
+ return typeof value === "undefined";
5825
+ }
5826
+ function mergeScalars(a, b) {
5827
+ return isUndefined(b) ? a : b;
5828
+ }
5829
+ function mergeTuples(a, b) {
5830
+ return b.length > a.length ? b.map((v, idx) => v !== void 0 ? v : a[idx]) : [...b, ...a.slice(b.length)].map((v, idx) => v !== void 0 ? v : a[idx]);
5831
+ }
5832
+ function never(val) {
5833
+ return val;
5834
+ }
5835
+ function optional(value) {
5836
+ return value;
5837
+ }
5838
+ function orNull(value) {
5839
+ return value;
5840
+ }
5841
+ function optionalOrNull(value) {
5842
+ return value;
5843
+ }
5844
+ function stripParenthesis(val) {
5845
+ return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
5846
+ }
5847
+ function convertScalar(val) {
5848
+ switch (typeof val) {
5849
+ case "number":
5850
+ return val;
5851
+ case "string":
5852
+ return Number(val);
5853
+ case "boolean":
5854
+ return val ? 1 : 0;
5855
+ default:
5856
+ throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
5857
+ }
5858
+ }
5859
+ var convertList = (val) => val.map((i) => convertScalar(i));
5860
+ function toNumber(value) {
5861
+ return Array.isArray(value) ? convertList(value) : convertScalar(value);
5862
+ }
5863
+ var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
5864
+ function removeTailwindModifiers(val) {
5865
+ return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
5866
+ }
5867
+ function getTailwindModifiers(val) {
5868
+ return val.split(":").filter((i) => isTailwindModifier(i));
5869
+ }
5870
+ function union(..._options) {
5871
+ return (value) => value;
5872
+ }
5873
+ function unionize(value, _inUnionWith) {
5874
+ return value;
5875
+ }
5924
5876
  function hasWhiteSpace(val) {
5925
5877
  return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
5926
5878
  }
@@ -6090,12 +6042,12 @@ function isTrue(value) {
6090
6042
  function isTruthy(val) {
6091
6043
  return !FALSY_VALUES2.includes(val);
6092
6044
  }
6045
+ function isTypeSubtype(val) {
6046
+ return isString(val) && val.split("/").length === 2;
6047
+ }
6093
6048
  function isTypeTuple(value) {
6094
6049
  return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
6095
6050
  }
6096
- function isUndefined(value) {
6097
- return typeof value === "undefined";
6098
- }
6099
6051
  function isUnset(val) {
6100
6052
  return isObject(val) && val.kind === "Unset";
6101
6053
  }
@@ -6652,140 +6604,204 @@ function isYouTubeSubscriptionsUrl(val) {
6652
6604
  function isYouTubeCreatorUrl(url) {
6653
6605
  return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
6654
6606
  }
6655
- function isYouTubeVideosInPlaylist(val) {
6656
- return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
6657
- }
6658
- function csv(csv2, format = `string-numeric-tuple`) {
6659
- const tuple3 = [];
6660
- csv2.split(/,\s?/).forEach((v) => {
6661
- tuple3.push(
6662
- format === "string-numeric-tuple" ? isNumberLike(v) ? Number(v) : v : format === "json-tuple" ? isNumberLike(v) ? Number(v) : v === "true" ? true : v === "false" ? false : `"${v}"` : format === "string-tuple" ? `${v}` : Never2
6663
- );
6664
- });
6665
- return tuple3;
6666
- }
6667
- function intersect(value, _intersectedWith) {
6668
- return value;
6669
- }
6670
- function stripTrailing(content, ...strip2) {
6671
- let output = String(content);
6672
- for (const s of strip2) {
6673
- if (output.endsWith(String(s))) {
6674
- output = output.slice(0, -1 * String(s).length);
6675
- }
6607
+ function isYouTubeVideosInPlaylist(val) {
6608
+ return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
6609
+ }
6610
+ function getTypeSubtype(str) {
6611
+ if (isTypeSubtype(str)) {
6612
+ const [t, st] = str.split("/");
6613
+ return [t, st];
6614
+ } else {
6615
+ const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
6616
+ err.name = "InvalidTypeSubtype";
6617
+ throw err;
6676
6618
  }
6677
- return isNumber(content) ? Number(output) : output;
6678
6619
  }
6679
- function ip6GroupExpansion(ip) {
6680
- return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
6620
+ function identity(...values) {
6621
+ return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
6681
6622
  }
6682
- function jsonValue(val) {
6683
- return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
6623
+ function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6624
+ if (ch.length !== 1) {
6625
+ throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
6626
+ }
6627
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6684
6628
  }
6685
- function jsonValues(...val) {
6686
- return val.map((i) => jsonValue(i));
6629
+ function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6630
+ if (ch.length !== 1) {
6631
+ throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
6632
+ }
6633
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6687
6634
  }
6688
- function lookupAlpha2Code(code, prop) {
6689
- const found = ISO3166_12.find((i) => i.alpha2 === code);
6690
- return found ? found[prop] : void 0;
6635
+ function parseTemplate(template) {
6636
+ const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:as\s+(string|number|boolean)\s*)?\}\}/g;
6637
+ let lastIndex = 0;
6638
+ let match;
6639
+ const segments = [];
6640
+ do {
6641
+ match = pattern.exec(template);
6642
+ if (match) {
6643
+ const [fullMatch, varName, asType2] = match;
6644
+ const staticPart = template.slice(lastIndex, match.index);
6645
+ if (staticPart) {
6646
+ segments.push({ dynamic: false, text: staticPart });
6647
+ }
6648
+ segments.push({
6649
+ dynamic: true,
6650
+ varName,
6651
+ type: asType2 ? asType2 : "string"
6652
+ });
6653
+ lastIndex = match.index + fullMatch.length;
6654
+ }
6655
+ } while (match);
6656
+ const remainder = template.slice(lastIndex);
6657
+ if (remainder) {
6658
+ segments.push({ dynamic: false, text: remainder });
6659
+ }
6660
+ return segments;
6691
6661
  }
6692
- function lookupAlpha3Code(code, prop) {
6693
- const found = ISO3166_12.find((i) => i.alpha3 === code);
6694
- return found ? found[prop] : void 0;
6662
+ function escapeRegex(str) {
6663
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6695
6664
  }
6696
- function lookupName(name, prop) {
6697
- const found = ISO3166_12.find((i) => i.name === name);
6698
- return found ? found[prop] : void 0;
6665
+ function buildRegexPattern(segments) {
6666
+ let regexStr = "^";
6667
+ for (const seg of segments) {
6668
+ if (!seg.dynamic) {
6669
+ regexStr += escapeRegex(seg.text);
6670
+ } else {
6671
+ switch (seg.type) {
6672
+ case "string":
6673
+ regexStr += `(?<${seg.varName}>.*?)`;
6674
+ break;
6675
+ case "number":
6676
+ regexStr += `(?<${seg.varName}>\\d+)`;
6677
+ break;
6678
+ case "boolean":
6679
+ regexStr += `(?<${seg.varName}>(?:true|false))`;
6680
+ break;
6681
+ }
6682
+ }
6683
+ }
6684
+ regexStr += "$";
6685
+ return new RegExp(regexStr, "s");
6699
6686
  }
6700
- function lookupNumericCode(code, prop) {
6701
- let num = isNumber(code) ? `${code}` : code;
6702
- if (num.length === 1) {
6703
- num = `00${num}`;
6704
- } else if (num.length === 2) {
6705
- num = `0${num}`;
6687
+ function convertValue(type, value) {
6688
+ switch (type) {
6689
+ case "string":
6690
+ return value;
6691
+ case "number":
6692
+ return Number(value);
6693
+ case "boolean":
6694
+ return value === "true";
6706
6695
  }
6707
- const found = ISO3166_12.find((i) => i.countryCode === num);
6708
- return found ? found[prop] : void 0;
6709
6696
  }
6710
- function lookupCountryName(code) {
6711
- const uc = uppercase(code);
6712
- return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
6697
+ function matchTemplate(inference, test) {
6698
+ const segments = parseTemplate(inference);
6699
+ const regex = buildRegexPattern(segments);
6700
+ const match = test.match(regex);
6701
+ if (!match)
6702
+ return false;
6703
+ const result2 = {};
6704
+ for (const seg of segments) {
6705
+ if (seg.dynamic) {
6706
+ const rawVal = match.groups?.[seg.varName];
6707
+ if (rawVal === void 0)
6708
+ return false;
6709
+ result2[seg.varName.toLowerCase()] = convertValue(seg.type, rawVal);
6710
+ }
6711
+ }
6712
+ return result2;
6713
6713
  }
6714
- function lookupCountryAlpha2(code) {
6715
- const uc = uppercase(code);
6716
- return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
6714
+ function infer(inference) {
6715
+ return (test) => {
6716
+ return matchTemplate(inference, test);
6717
+ };
6717
6718
  }
6718
- function lookupCountryAlpha3(token) {
6719
- const uc = uppercase(token);
6720
- return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
6719
+ function idLiteral(o) {
6720
+ return { ...o, id: o.id };
6721
6721
  }
6722
- function lookupCountryCode(token) {
6723
- const uc = uppercase(token);
6724
- return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
6722
+ function nameLiteral(o) {
6723
+ return o;
6725
6724
  }
6726
- function mergeObjects(defVal, override) {
6727
- const intersectingKeys = sharedKeys(defVal, override);
6728
- const defUnique = withoutKeys(defVal, ...intersectingKeys);
6729
- const overrideUnique = withoutKeys(defVal, ...intersectingKeys);
6730
- const merged = {
6731
- ...intersectingKeys.reduce(
6732
- (acc, key) => typeof override[key] === "undefined" ? { ...acc, [key]: defVal[key] } : { ...acc, [key]: override[key] },
6733
- {}
6734
- ),
6735
- ...defUnique,
6736
- ...overrideUnique
6737
- };
6738
- return merged;
6725
+ function kindLiteral(o) {
6726
+ return o;
6739
6727
  }
6740
- function mergeScalars(a, b) {
6741
- return isUndefined(b) ? a : b;
6728
+ function idTypeGuard(_o) {
6729
+ return true;
6742
6730
  }
6743
- function mergeTuples(a, b) {
6744
- return b.length > a.length ? b.map((v, idx) => v !== void 0 ? v : a[idx]) : [...b, ...a.slice(b.length)].map((v, idx) => v !== void 0 ? v : a[idx]);
6731
+ function literal(obj) {
6732
+ return obj;
6745
6733
  }
6746
- function never(val) {
6747
- return val;
6734
+ function lowercase(str) {
6735
+ return str.toLowerCase();
6748
6736
  }
6749
- function optional(value) {
6750
- return value;
6737
+ function narrow(...values) {
6738
+ return values.length === 1 ? values[0] : values;
6751
6739
  }
6752
- function orNull(value) {
6753
- return value;
6740
+ function pathJoin(...segments) {
6741
+ const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
6742
+ const original_path = segments.join("/");
6743
+ const pre = original_path.startsWith("/") ? "/" : "";
6744
+ const post = original_path.endsWith("/") ? "/" : "";
6745
+ return `${pre}${clean_path}${post}`;
6754
6746
  }
6755
- function optionalOrNull(value) {
6756
- return value;
6747
+ var asPhoneFormat = () => `NOT IMPLEMENTED`;
6748
+ function getPhoneCountryCode(phone) {
6749
+ return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
6750
+ stripLeading(stripLeading(phone.trim(), "+"), "00"),
6751
+ ...NUMERIC_CHAR2
6752
+ ) : "";
6757
6753
  }
6758
- function stripParenthesis(val) {
6759
- return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
6754
+ function removePhoneCountryCode(phone) {
6755
+ const countryCode = getPhoneCountryCode(phone);
6756
+ return countryCode !== "" ? stripLeading(stripLeading(
6757
+ phone.trim(),
6758
+ "+",
6759
+ "00"
6760
+ ), countryCode).trim() : phone.trim();
6760
6761
  }
6761
- function convertScalar(val) {
6762
- switch (typeof val) {
6763
- case "number":
6764
- return val;
6765
- case "string":
6766
- return Number(val);
6767
- case "boolean":
6768
- return val ? 1 : 0;
6762
+ var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
6763
+ function endingIn(word, postfix) {
6764
+ switch (postfix) {
6765
+ case "is":
6766
+ return word.endsWith(postfix) ? `${word}es` : void 0;
6767
+ case "singular-noun":
6768
+ return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
6769
+ case "f":
6770
+ return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
6771
+ case "y":
6772
+ return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
6769
6773
  default:
6770
- throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
6774
+ throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
6771
6775
  }
6772
6776
  }
6773
- var convertList = (val) => val.map((i) => convertScalar(i));
6774
- function toNumber(value) {
6775
- return Array.isArray(value) ? convertList(value) : convertScalar(value);
6776
- }
6777
- var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
6778
- function removeTailwindModifiers(val) {
6779
- return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
6777
+ function pluralize(word) {
6778
+ const right = rightWhitespace(word);
6779
+ const w = word.trimEnd();
6780
+ const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
6781
+ return `${result2}${right}`;
6780
6782
  }
6781
- function getTailwindModifiers(val) {
6782
- return val.split(":").filter((i) => isTailwindModifier(i));
6783
+ function retainAfter(content, ...find2) {
6784
+ const idx = Math.min(
6785
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6786
+ );
6787
+ const min = Math.min(...find2.map((i) => i.length));
6788
+ let len = Math.max(...find2.map((i) => i.length));
6789
+ if (min !== len) {
6790
+ if (!find2.includes(content.slice(idx, len))) {
6791
+ len = min;
6792
+ }
6793
+ }
6794
+ return idx && idx > 0 ? content.slice(idx + len) : "";
6783
6795
  }
6784
- function union(..._options) {
6785
- return (value) => value;
6796
+ function retainAfterInclusive(content, ...find2) {
6797
+ const minFound = Math.min(
6798
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6799
+ );
6800
+ return minFound > 0 ? content.slice(minFound) : "";
6786
6801
  }
6787
- function unionize(value, _inUnionWith) {
6788
- return value;
6802
+ function retainChars(content, ...retain2) {
6803
+ const chars = asChars(content);
6804
+ return chars.filter((c) => retain2.includes(c)).join("");
6789
6805
  }
6790
6806
  function retainUntil(content, ...find2) {
6791
6807
  const chars = asChars(content);
@@ -7371,6 +7387,9 @@ function fnTokenClosure(kind, params, returns) {
7371
7387
  function createTypeToken(kind) {
7372
7388
  return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
7373
7389
  }
7390
+ function fromDefineObject(defn) {
7391
+ return defn;
7392
+ }
7374
7393
  function getTokenKind(token) {
7375
7394
  const bare = stripSurround("<<", ">>")(token);
7376
7395
  const parts = bare.split("::");
@@ -7851,6 +7870,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
7851
7870
  filter,
7852
7871
  find,
7853
7872
  fnMeta,
7873
+ fromDefineObject,
7854
7874
  get,
7855
7875
  getDaysBetween,
7856
7876
  getEach,
@@ -7859,6 +7879,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
7859
7879
  getToday,
7860
7880
  getTokenKind,
7861
7881
  getTomorrow,
7882
+ getTypeSubtype,
7862
7883
  getUrlPath,
7863
7884
  getUrlPort,
7864
7885
  getUrlProtocol,
@@ -8099,6 +8120,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8099
8120
  isTupleToken,
8100
8121
  isTurkishNewsUrl,
8101
8122
  isTypeOf,
8123
+ isTypeSubtype,
8102
8124
  isTypeToken,
8103
8125
  isTypeTokenKind,
8104
8126
  isTypeTuple,