inferred-types 0.55.13 → 0.55.14

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.
@@ -274,6 +274,7 @@ __export(index_exports, {
274
274
  errCondition: () => errCondition,
275
275
  filter: () => filter,
276
276
  filterEmpty: () => filterEmpty,
277
+ filterUndefined: () => filterUndefined,
277
278
  find: () => find,
278
279
  fnMeta: () => fnMeta,
279
280
  fromDefineObject: () => fromDefineObject,
@@ -680,7 +681,7 @@ __export(index_exports, {
680
681
  twColor: () => twColor,
681
682
  unbox: () => unbox,
682
683
  uncapitalize: () => uncapitalize,
683
- union: () => union3,
684
+ union: () => union,
684
685
  unionize: () => unionize,
685
686
  unique: () => unique,
686
687
  uniqueKeys: () => uniqueKeys,
@@ -5835,2526 +5836,2529 @@ var filter = "NOT READY";
5835
5836
  function filterEmpty(...val) {
5836
5837
  return val.filter((i) => isNotEmpty(i));
5837
5838
  }
5838
- function find(list2, deref = null) {
5839
- return (comparator) => {
5840
- return list2.find((i) => {
5841
- const val = deref ? isObject(i) || isArray(i) ? deref in i ? i[deref] : void 0 : i : i;
5842
- return val === comparator;
5843
- });
5844
- };
5845
- }
5846
- function getEach(list2, dotPath) {
5847
- const result2 = list2.map(
5848
- (i) => isNull(dotPath) ? i : isContainer(i) ? get(i, dotPath) : Never2
5849
- ).filter((i) => !isErrorCondition(i));
5850
- return result2;
5851
- }
5852
- function indexOf(val, index) {
5853
- const isNegative = isNumber(index) && index < 0;
5854
- if (isNegative && !Array.isArray(val)) {
5855
- throw new Error(`The indexOf(val,idx) utility received a negative index value [${index}] but the value being de-references is not an array [${typeof val}]!`);
5856
- }
5857
- if (isNegative && Array.isArray(val) && val.length < Math.abs(index)) {
5858
- throw new Error(`The indexOf(val,idx) utility received a negative index of ${index} but the length of the array passed in is only ${val.length}! This is not allowed.`);
5859
- }
5860
- const idx = isNegative && Array.isArray(val) ? val.length + 1 - Math.abs(index) : index;
5861
- return index === null ? val : isNull(idx) ? val : isArray(val) ? Number(idx) in val ? val[Number(idx)] : errCondition("invalid-index", `attempt to index a numeric array with an invalid index: ${Number(idx)}`) : isObject(val) ? String(idx) in val ? val[String(idx)] : errCondition("invalid-index", `attempt to index a dictionary object with an invalid index: ${String(idx)}`) : errCondition("invalid-container-type", `Attempt to use indexOf() on an invalid container type: ${typeof val}`);
5839
+ function isFunction(value) {
5840
+ return typeof value === "function";
5862
5841
  }
5863
- function intersectWithOffset(a, b, deref) {
5864
- const aIndexable = a.every((i) => isIndexable(i));
5865
- const bIndexable = b.every((i) => isIndexable(i));
5866
- if (!aIndexable || !bIndexable) {
5867
- if (!aIndexable) {
5868
- throw new Error(`The "a" array passed into intersect(a,b) was not fully composed of indexable properties: ${a.map((i) => typeof i).join(", ")}`);
5869
- } else {
5870
- throw new Error(`The "b" array passed into intersect(a,b) was not fully composed of indexable properties: ${b.map((i) => typeof i).join(", ")}`);
5871
- }
5872
- }
5873
- const aMatches = getEach(a, deref);
5874
- const bMatches = getEach(b, deref);
5875
- const sharedKeys2 = ifNotNull(
5876
- deref,
5877
- (v) => [
5878
- a.filter((i) => Array.from(bMatches).includes(get(i, v))),
5879
- b.filter((i) => Array.from(aMatches).includes(get(i, v)))
5880
- ],
5881
- () => a.filter((k) => b.includes(k))
5882
- );
5883
- return sharedKeys2;
5842
+ function isObject(value) {
5843
+ return typeof value === "object" && value !== null && Array.isArray(value) === false;
5884
5844
  }
5885
- function intersectNoOffset(a, b) {
5886
- return a.length < b.length ? a.filter((val) => b.includes(val)) : b.filter((val) => a.includes(val));
5845
+ function isNarrowableObject(value) {
5846
+ return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
5887
5847
  }
5888
- function intersection(a, b, deref = null) {
5889
- return deref === null ? intersectNoOffset(a, b) : intersectWithOffset(a, b, deref);
5848
+ function isEscapeFunction(val) {
5849
+ return isFunction(val) && "escape" in val && val.escape === true;
5890
5850
  }
5891
- function joinWith(joinWith2) {
5892
- return (...tuple3) => {
5893
- const tup = tuple3;
5894
- return tup.join(joinWith2);
5895
- };
5851
+ function isOptionalParamFunction(val) {
5852
+ return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
5896
5853
  }
5897
- function last(list2) {
5898
- return [...list2].pop();
5854
+ function isApi(api2) {
5855
+ return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
5899
5856
  }
5900
- function logicalReturns(conditions) {
5901
- return conditions.map(
5902
- (c) => isBoolean(c) ? c : isFunction(c) ? c() : Never2
5903
- );
5857
+ function isApiSurface(val) {
5858
+ return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
5904
5859
  }
5905
- function reverse(list2) {
5906
- return [...list2].reverse();
5860
+ function isDate(val) {
5861
+ return val instanceof Date;
5907
5862
  }
5908
- function shift(list2) {
5909
- let rtn;
5910
- if (isDefined(list2)) {
5911
- rtn = list2.length === 0 ? void 0 : list2[0];
5912
- try {
5913
- list2 = list2.slice(1);
5914
- } catch {
5915
- }
5916
- } else {
5917
- rtn = void 0;
5863
+ function isIsoDateTime(val) {
5864
+ if (!isString(val)) {
5865
+ return false;
5918
5866
  }
5919
- return rtn;
5920
- }
5921
- function slice(list2, start2, end) {
5922
- return list2.slice(start2, end);
5923
- }
5924
- function unique(...values) {
5925
- const u = [];
5926
- for (const i of values.flat()) {
5927
- if (!u.includes(i)) {
5928
- u.push(i);
5929
- }
5867
+ const ISO_DATETIME_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})?$/;
5868
+ if (!ISO_DATETIME_REGEX.test(val)) {
5869
+ return false;
5930
5870
  }
5931
- return u;
5932
- }
5933
- function box(value) {
5934
- const rtn = {
5935
- __type: "box",
5936
- value,
5937
- unbox: (...p) => {
5938
- return typeof value === "function" ? value(...p) : value;
5871
+ const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
5872
+ const [year, month, day, hours, minutes, seconds] = matches.map(Number);
5873
+ if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
5874
+ return false;
5875
+ }
5876
+ if (month < 1 || month > 12) {
5877
+ return false;
5878
+ }
5879
+ ;
5880
+ const daysInMonth = new Date(year, month, 0).getDate();
5881
+ if (day < 1 || day > daysInMonth) {
5882
+ return false;
5883
+ }
5884
+ ;
5885
+ const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
5886
+ if (tzMatch) {
5887
+ const [_2, _sign, tzHours, tzMinutes] = tzMatch;
5888
+ const numHours = Number.parseInt(tzHours, 10);
5889
+ const numMinutes = Number.parseInt(tzMinutes, 10);
5890
+ if (numHours > 14 || numMinutes > 59) {
5891
+ return false;
5939
5892
  }
5940
- };
5941
- return rtn;
5942
- }
5943
- function isBox(thing) {
5944
- return typeof thing === "object" && "__type" in thing && thing.__type === "box";
5893
+ if (numHours === 14 && numMinutes > 0) {
5894
+ return false;
5895
+ }
5896
+ }
5897
+ return true;
5945
5898
  }
5946
- function boxDictionaryValues(dict) {
5947
- const keys = Object.keys(dict);
5948
- return keys.reduce(
5949
- (acc, key) => ({ ...acc, [key]: box(dict[key]) }),
5950
- {}
5951
- );
5899
+ function isIsoExplicitDate(val) {
5900
+ if (isString(val)) {
5901
+ const parts = val.split("-").map((i) => Number(i));
5902
+ return val.includes("-") ? val.split("-").every((i) => isNumberLike(i)) ? parts[0] >= 0 && parts[0] <= 9999 && parts[1] >= 1 && parts[1] <= 12 && parts[2] >= 1 && parts[2] <= 31 : false : false;
5903
+ } else {
5904
+ return false;
5905
+ }
5952
5906
  }
5953
- function unbox(val) {
5954
- return isBox(val) ? val.value : val;
5907
+ function isIsoImplicitDate(val) {
5908
+ if (isString(val) && val.length === 8 && isNumberLike(val)) {
5909
+ const year = Number(val.slice(0, 4));
5910
+ const month = Number(val.slice(4, 6));
5911
+ const date = Number(val.slice(6, 8));
5912
+ return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
5913
+ } else {
5914
+ return false;
5915
+ }
5955
5916
  }
5956
- function capitalize(str) {
5957
- return `${str?.slice(0, 1).toUpperCase()}${str?.slice(1)}`;
5917
+ function isIsoDate(val) {
5918
+ if (isString(val)) {
5919
+ return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
5920
+ } else {
5921
+ return false;
5922
+ }
5958
5923
  }
5959
- function cssColor(color, v1, v2, v3, opacity) {
5960
- return `color(${color} ${v1} ${v2} ${v3}${opacity ? ` / ${opacity}` : ""}`;
5924
+ function isIsoExplicitTime(val) {
5925
+ if (isString(val)) {
5926
+ const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
5927
+ return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5928
+ } else {
5929
+ return false;
5930
+ }
5961
5931
  }
5962
- function twColor(color, luminosity) {
5963
- const lum = luminosity in TW_LUMINOSITY2 ? TW_LUMINOSITY2[luminosity] : 0;
5964
- const chroma = luminosity in TW_CHROMA2 ? TW_CHROMA2[luminosity] : 0;
5965
- const hue = TW_HUE2[color];
5966
- return `oklch(${lum} ${chroma} ${hue})`;
5932
+ function isIsoImplicitTime(val) {
5933
+ if (isString(val)) {
5934
+ const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
5935
+ return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
5936
+ } else {
5937
+ return false;
5938
+ }
5967
5939
  }
5968
- function ensureLeading(content, ensure) {
5969
- const output = String(content);
5970
- return output.startsWith(String(ensure)) ? content : isString(content) ? `${ensure}${content}` : Number(`${ensure}${content}`);
5940
+ function isIsoTime(val) {
5941
+ return isIsoExplicitTime(val) || isIsoImplicitTime(val);
5971
5942
  }
5972
- function ensureSurround(prefix, postfix) {
5973
- const fn2 = (input) => {
5974
- let result2 = input;
5975
- result2 = ensureLeading(result2, prefix);
5976
- result2 = ensureTrailing(result2, postfix);
5977
- return result2;
5978
- };
5979
- return fn2;
5943
+ function isIsoYear(val) {
5944
+ return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
5980
5945
  }
5981
- function ensureTrailing(content, ensure) {
5982
- return (
5983
- //
5984
- content.endsWith(ensure) ? content : `${content}${ensure}`
5985
- );
5946
+ function isLuxonDateTime(val) {
5947
+ return isObject(val) && typeof val === "object" && val !== null && "isValid" in val && "invalidReason" in val && "invalidExplanation" in val && "toISO" in val && "toFormat" in val && "toMillis" in val && "year" in val && "month" in val && "day" in val && "hour" in val && "minute" in val && "second" in val && "millisecond" in val && typeof val.isValid === "boolean" && typeof val.toISO === "function";
5986
5948
  }
5987
- function getTypeSubtype(str) {
5988
- if (isTypeSubtype(str)) {
5989
- const [t, st] = str.split("/");
5990
- return [t, st];
5991
- } else {
5992
- const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
5993
- err.name = "InvalidTypeSubtype";
5994
- throw err;
5949
+ function isMoment(val) {
5950
+ if (val instanceof Date) {
5951
+ return false;
5995
5952
  }
5953
+ return isObject(val) && typeof val.format === "function" && typeof val.year === "function" && typeof val.month === "function" && typeof val.date === "function" && "_isAMomentObject" in val && "_isValid" in val && typeof val.add === "function" && typeof val.subtract === "function" && typeof val.toISOString === "function" && typeof val.isValid === "function";
5996
5954
  }
5997
- function identity(...values) {
5998
- return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
5999
- }
6000
- function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6001
- if (ch.length !== 1) {
6002
- throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
5955
+ function isThisMonth(val) {
5956
+ const now = /* @__PURE__ */ new Date();
5957
+ const currentYear = now.getFullYear();
5958
+ const currentMonth = now.getMonth() + 1;
5959
+ if (val instanceof Date) {
5960
+ return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
6003
5961
  }
6004
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6005
- }
6006
- function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
6007
- if (ch.length !== 1) {
6008
- throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
5962
+ if (isMoment(val)) {
5963
+ const monthValue = val.month();
5964
+ return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
6009
5965
  }
6010
- return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
6011
- }
6012
- function parseTemplate(template) {
6013
- const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
6014
- let lastIndex = 0;
6015
- let match;
6016
- const segments = [];
6017
- while (match = pattern.exec(template)) {
6018
- const [fullMatch, varName, asType2] = match;
6019
- const staticPart = template.slice(lastIndex, match.index);
6020
- if (staticPart) {
6021
- segments.push({ dynamic: false, text: staticPart });
6022
- }
6023
- segments.push({
6024
- dynamic: true,
6025
- varName,
6026
- type: asType2 ? asType2 : "string"
6027
- });
6028
- lastIndex = match.index + fullMatch.length;
5966
+ if (isLuxonDateTime(val)) {
5967
+ return val.year === currentYear && val.month === currentMonth;
6029
5968
  }
6030
- const remainder = template.slice(lastIndex);
6031
- if (remainder) {
6032
- segments.push({ dynamic: false, text: remainder });
5969
+ if (typeof val === "string") {
5970
+ const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
5971
+ if (!isoDateRegex.test(val)) {
5972
+ return false;
5973
+ }
5974
+ const dateMatch = val.match(/^(\d{4})-(\d{2})/);
5975
+ if (dateMatch) {
5976
+ const year = Number.parseInt(dateMatch[1], 10);
5977
+ const month = Number.parseInt(dateMatch[2], 10);
5978
+ return year === currentYear && month === currentMonth;
5979
+ }
6033
5980
  }
6034
- return segments;
5981
+ return false;
6035
5982
  }
6036
- function escapeRegex(str) {
6037
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5983
+ function isThisWeek(date) {
5984
+ const targetDate = asDate(date);
5985
+ if (!targetDate) {
5986
+ return false;
5987
+ }
5988
+ const currentWeek = getWeekNumber();
5989
+ const targetWeek = getWeekNumber(targetDate);
5990
+ return currentWeek === targetWeek;
6038
5991
  }
6039
- function buildRegexPattern(segments) {
6040
- let regexStr = "^";
6041
- for (const seg of segments) {
6042
- if (!seg.dynamic) {
6043
- regexStr += escapeRegex(seg.text);
5992
+ function isThisYear(val) {
5993
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
5994
+ if (isObject(val) || isNumber(val) || isString(val)) {
5995
+ const date = asDate(val);
5996
+ if (date) {
5997
+ return date.getFullYear() === currentYear;
6044
5998
  } else {
6045
- switch (seg.type) {
6046
- case "string":
6047
- regexStr += "(.*?)";
6048
- break;
6049
- case "number":
6050
- regexStr += "(\\d+)";
6051
- break;
6052
- case "boolean":
6053
- regexStr += "(true|false)";
6054
- break;
6055
- }
5999
+ return false;
6056
6000
  }
6057
6001
  }
6058
- regexStr += "$";
6059
- return new RegExp(regexStr);
6002
+ return false;
6060
6003
  }
6061
- function convertValue(type, value) {
6062
- switch (type) {
6063
- case "string":
6064
- return value;
6065
- case "number":
6066
- return Number(value);
6067
- case "boolean":
6068
- return value === "true";
6004
+ function isToday(test) {
6005
+ if (isString(test)) {
6006
+ const justDate = stripAfter(test, "T");
6007
+ return isIsoExplicitDate(justDate) && justDate === getToday();
6008
+ } else if (isMoment(test) || isDate(test)) {
6009
+ return stripAfter(test.toISOString(), "T") === getToday();
6010
+ } else if (isLuxonDateTime(test)) {
6011
+ return stripAfter(test.toISO(), "T") === getToday();
6069
6012
  }
6013
+ return false;
6070
6014
  }
6071
- function matchTemplate(template, test) {
6072
- const segments = parseTemplate(template);
6073
- const regex = buildRegexPattern(segments);
6074
- const match = regex.exec(test);
6075
- if (!match)
6076
- return false;
6077
- let captureIndex = 1;
6078
- const result2 = {};
6079
- for (const seg of segments) {
6080
- if (seg.dynamic) {
6081
- const rawVal = match[captureIndex++];
6082
- if (rawVal === void 0)
6083
- return false;
6084
- result2[seg.varName] = convertValue(seg.type, rawVal);
6085
- }
6015
+ function isTomorrow(test) {
6016
+ if (isString(test)) {
6017
+ const justDate = stripAfter(test, "T");
6018
+ return isIsoExplicitDate(justDate) && justDate === getTomorrow();
6019
+ } else if (isMoment(test) || isDate(test)) {
6020
+ return stripAfter(test.toISOString(), "T") === getTomorrow();
6021
+ } else if (isLuxonDateTime(test)) {
6022
+ return stripAfter(test.toISO(), "T") === getTomorrow();
6086
6023
  }
6087
- return result2;
6024
+ return false;
6088
6025
  }
6089
- function infer(inference) {
6090
- return (test) => {
6091
- return matchTemplate(inference, test);
6092
- };
6026
+ function isYesterday(test) {
6027
+ if (isString(test)) {
6028
+ const justDate = stripAfter(test, "T");
6029
+ return isIsoExplicitDate(justDate) && justDate === getYesterday();
6030
+ } else if (isMoment(test) || isDate(test)) {
6031
+ return stripAfter(test.toISOString(), "T") === getYesterday();
6032
+ } else if (isLuxonDateTime(test)) {
6033
+ return stripAfter(test.toISO(), "T") === getYesterday();
6034
+ }
6035
+ return false;
6093
6036
  }
6094
- function idLiteral(o) {
6095
- return { ...o, id: o.id };
6037
+ function isVisa(val) {
6038
+ if (isString(val) && val.startsWith("4")) {
6039
+ const parts = val.split(" ");
6040
+ return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4);
6041
+ }
6042
+ return false;
6096
6043
  }
6097
- function nameLiteral(o) {
6098
- return o;
6044
+ function isMastercard(val) {
6045
+ if (isString(val) && val.startsWith("4")) {
6046
+ const parts = val.split(" ");
6047
+ return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4) && ["51", "55", "22", "23", "24", "25", "26", "27"].some((i) => val.startsWith(i));
6048
+ }
6049
+ return false;
6099
6050
  }
6100
- function kindLiteral(o) {
6101
- return o;
6051
+ function isVisaMastercard(val) {
6052
+ return isVisa(val) || isMastercard(val);
6102
6053
  }
6103
- function idTypeGuard(_o) {
6104
- return true;
6054
+ function isAmericanExpress(val) {
6055
+ if (isString(val)) {
6056
+ const parts = val.split(" ");
6057
+ return parts.length === 3 && parts.every(
6058
+ (i) => isNumberLike(i) && parts[0].length === 4 && parts[1].length === 6
6059
+ );
6060
+ }
6061
+ return false;
6105
6062
  }
6106
- function literal(obj) {
6107
- return obj;
6063
+ function isCreditCard(val) {
6064
+ return isVisaMastercard(val) || isAmericanExpress(val);
6108
6065
  }
6109
- function lowercase(str) {
6110
- return str.toLowerCase();
6066
+ function cardType(cardNumber) {
6067
+ const cleanedNumber = String(cardNumber).replace(/\D/g, "");
6068
+ const length = cleanedNumber.length;
6069
+ if (!isValidLength(length)) {
6070
+ return "invalid";
6071
+ }
6072
+ if (!luhnCheck(cleanedNumber)) {
6073
+ return "invalid";
6074
+ }
6075
+ const cardTypes = [
6076
+ { name: "Visa", lengths: [16], prefixes: [/^4/] },
6077
+ { name: "Mastercard", lengths: [16], prefixes: [/^(51|52|53|54|55|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/] },
6078
+ { name: "American Express", lengths: [15], prefixes: [/^3[47]/] },
6079
+ { name: "Discover", lengths: [16], prefixes: [/^(6011|622(12[6-9]|1[3-9]\d|2[0-4]\d|25\d|6[4-9]|7[0-4]|8[0-4]|9\d)|64[4-9]|65)/] },
6080
+ { name: "JCB", lengths: [16], prefixes: [/^(35|2131|1800)/] },
6081
+ { name: "Diners Club", lengths: [14, 16], prefixes: [/^(30[0-5]|36|38)/] },
6082
+ { name: "China UnionPay", lengths: [16, 17, 18, 19], prefixes: [/^(62|88)/] },
6083
+ { name: "Maestro", lengths: [12, 13, 14, 15, 16, 17, 18, 19], prefixes: [/^(5018|5020|5038|6304)/] },
6084
+ { name: "Solo", lengths: [16, 18, 19], prefixes: [/^(6334|6767)/] }
6085
+ ];
6086
+ for (const type of cardTypes) {
6087
+ if (type.lengths.includes(length)) {
6088
+ for (const prefix of type.prefixes) {
6089
+ if (prefix.test(cleanedNumber)) {
6090
+ return type.name;
6091
+ }
6092
+ }
6093
+ }
6094
+ }
6095
+ return "invalid";
6111
6096
  }
6112
- function narrow(...values) {
6113
- return values.length === 1 ? values[0] : values;
6097
+ function isValidLength(length) {
6098
+ const validLengths = [13, 14, 15, 16, 17, 18, 19];
6099
+ return validLengths.includes(length);
6114
6100
  }
6115
- function pathJoin(...segments) {
6116
- const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
6117
- const original_path = segments.join("/");
6118
- const pre = original_path.startsWith("/") ? "/" : "";
6119
- const post = original_path.endsWith("/") ? "/" : "";
6120
- return `${pre}${clean_path}${post}`;
6101
+ function luhnCheck(num) {
6102
+ let sum = 0;
6103
+ let double = false;
6104
+ for (let i = num.length - 1; i >= 0; i--) {
6105
+ let n = Number.parseInt(num.charAt(i), 10);
6106
+ if (double) {
6107
+ n *= 2;
6108
+ if (n > 9) {
6109
+ n -= 9;
6110
+ }
6111
+ }
6112
+ sum += n;
6113
+ double = !double;
6114
+ }
6115
+ return sum % 10 === 0;
6121
6116
  }
6122
- var asPhoneFormat = () => `NOT IMPLEMENTED`;
6123
- function getPhoneCountryCode(phone) {
6124
- return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
6125
- stripLeading(stripLeading(phone.trim(), "+"), "00"),
6126
- ...NUMERIC_CHAR2
6127
- ) : "";
6117
+ function isString(value) {
6118
+ return typeof value === "string";
6128
6119
  }
6129
- function removePhoneCountryCode(phone) {
6130
- const countryCode = getPhoneCountryCode(phone);
6131
- return countryCode !== "" ? stripLeading(stripLeading(
6132
- phone.trim(),
6133
- "+",
6134
- "00"
6135
- ), countryCode).trim() : phone.trim();
6120
+ function isIso3166Alpha2(val) {
6121
+ const codes = ISO3166_12.map((i) => i.alpha2);
6122
+ return isString(val) && codes.includes(val);
6136
6123
  }
6137
- var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
6138
- function endingIn(word, postfix) {
6139
- switch (postfix) {
6140
- case "is":
6141
- return word.endsWith(postfix) ? `${word}es` : void 0;
6142
- case "singular-noun":
6143
- return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
6144
- case "f":
6145
- return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
6146
- case "y":
6147
- return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
6148
- default:
6149
- throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
6150
- }
6124
+ function isCountryCode2(val) {
6125
+ const codes = ISO3166_12.map((i) => i.alpha2);
6126
+ return isString(val) && codes.includes(val);
6151
6127
  }
6152
- function pluralize(word) {
6153
- const right = rightWhitespace(word);
6154
- const w = word.trimEnd();
6155
- const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
6156
- return `${result2}${right}`;
6157
- }
6158
- function retainAfter(content, ...find2) {
6159
- const idx = Math.min(
6160
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6161
- );
6162
- const min = Math.min(...find2.map((i) => i.length));
6163
- let len = Math.max(...find2.map((i) => i.length));
6164
- if (min !== len) {
6165
- if (!find2.includes(content.slice(idx, len))) {
6166
- len = min;
6167
- }
6168
- }
6169
- return idx && idx > 0 ? content.slice(idx + len) : "";
6128
+ function isIso3166Alpha3(val) {
6129
+ const codes = ISO3166_12.map((i) => i.alpha3);
6130
+ return isString(val) && codes.includes(val);
6170
6131
  }
6171
- function retainAfterInclusive(content, ...find2) {
6172
- const minFound = Math.min(
6173
- ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
6174
- );
6175
- return minFound > 0 ? content.slice(minFound) : "";
6132
+ function isCountryCode3(val) {
6133
+ const codes = ISO3166_12.map((i) => i.alpha3);
6134
+ return isString(val) && codes.includes(val);
6176
6135
  }
6177
- function retainChars(content, ...retain2) {
6178
- const chars = asChars(content);
6179
- return chars.filter((c) => retain2.includes(c)).join("");
6136
+ function isIso3166CountryCode(val) {
6137
+ const codes = ISO3166_12.map((i) => i.countryCode);
6138
+ return isString(val) && codes.includes(val);
6180
6139
  }
6181
- function retainUntil(content, ...find2) {
6182
- const chars = asChars(content);
6183
- let idx = 0;
6184
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
6185
- idx = idx + 1;
6186
- }
6187
- return idx === 0 ? "" : content.slice(0, idx);
6140
+ function isCountryAbbrev(val) {
6141
+ return isCountryCode2(val) || isCountryCode3(val);
6188
6142
  }
6189
- function retainUntilInclusive(content, ...find2) {
6190
- const chars = asChars(content);
6191
- let idx = 0;
6192
- while (!find2.includes(chars[idx]) && idx <= chars.length) {
6193
- idx = idx + 1;
6194
- }
6195
- return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
6143
+ function isIso3166CountryName(val) {
6144
+ const codes = ISO3166_12.map((i) => i.name);
6145
+ return isString(val) && codes.includes(val);
6196
6146
  }
6197
- function retainWhile(content, ...retain2) {
6198
- const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
6199
- return content.slice(0, stopIdx);
6147
+ function isCountryName(val) {
6148
+ const codes = ISO3166_12.map((i) => i.name);
6149
+ return isString(val) && codes.includes(val);
6200
6150
  }
6201
- function rightWhitespace(content) {
6202
- const trimmed = content.trimStart();
6203
- return retainAfterInclusive(
6204
- trimmed,
6205
- ...WHITESPACE_CHARS2
6206
- );
6151
+ var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
6152
+ var NAME = US_STATE_LOOKUP2.map((i) => i.name);
6153
+ function isUsStateAbbreviation(val) {
6154
+ return isString(val) && ABBREV.includes(val);
6207
6155
  }
6208
- function split(str, sep = "") {
6209
- return str.split(sep);
6156
+ function isUsStateName(val) {
6157
+ return isString(val) && NAME.includes(val);
6210
6158
  }
6211
- function stripAfter(content, find2) {
6212
- return content.split(find2).shift();
6159
+ function isNumericString(value) {
6160
+ const numericChars = [...NUMERIC_CHAR2];
6161
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
6213
6162
  }
6214
- function stripBefore(content, find2) {
6215
- return content.split(find2).slice(1).join(find2);
6163
+ function isNumberLike(value) {
6164
+ const numericChars = [...NUMERIC_CHAR2];
6165
+ return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
6216
6166
  }
6217
- function stripChars(content, ...strip2) {
6218
- const chars = asChars(content);
6219
- return chars.filter((c) => !strip2.includes(c)).join("");
6167
+ function isNumber(value) {
6168
+ return typeof value === "number";
6220
6169
  }
6221
- function stripLeading(content, ...strip2) {
6222
- if (isUndefined(content)) {
6223
- return void 0;
6224
- }
6225
- let output = String(content);
6226
- for (const s of strip2) {
6227
- if (output.startsWith(String(s))) {
6228
- output = output.slice(String(s).length);
6229
- }
6170
+ function isZipCode5(val) {
6171
+ if (isNumber(val)) {
6172
+ return isZipCode5(`${val}`);
6230
6173
  }
6231
- return isNumber(content) ? Number(output) : output;
6232
- }
6233
- function stripSurround(...chars) {
6234
- return (input) => {
6235
- let output = String(input);
6236
- for (const s of chars) {
6237
- if (output.startsWith(String(s))) {
6238
- output = output.slice(String(s).length);
6239
- }
6240
- if (output.endsWith(String(s))) {
6241
- output = output.slice(0, -1 * String(s).length);
6242
- }
6243
- }
6244
- return isNumber(input) ? Number(output) : output;
6245
- };
6174
+ return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
6246
6175
  }
6247
- function stripTrailing(content, ...strip2) {
6248
- if (isUndefined(content)) {
6249
- return void 0;
6250
- }
6251
- let output = String(content);
6252
- for (const s of strip2) {
6253
- if (output.endsWith(String(s))) {
6254
- output = output.slice(0, -1 * String(s).length);
6255
- }
6176
+ function isZipPlus4(val) {
6177
+ if (isString(val)) {
6178
+ const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
6179
+ const next = stripChars(val.trim().replace(first, "").trim(), "-");
6180
+ return first.length === 5 && next.length === 4 && isNumberLike(next);
6256
6181
  }
6257
- return isNumber(content) ? Number(output) : output;
6182
+ return false;
6258
6183
  }
6259
- function stripUntil(content, ...until) {
6260
- const stopIdx = asChars(content).findIndex((c) => until.includes(c));
6261
- return content.slice(stopIdx);
6184
+ function isZipCode(val) {
6185
+ return isZipCode5(val) || isZipPlus4(val);
6262
6186
  }
6263
- function stripWhile(content, ...match) {
6264
- const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
6265
- return content.slice(stopIdx);
6187
+ function isSpecificConstant(kind) {
6188
+ return (value) => {
6189
+ return !!(isConstant(value) && value.kind === kind);
6190
+ };
6266
6191
  }
6267
- function surround(prefix, postfix) {
6268
- return (input) => `${prefix}${input}${postfix}`;
6192
+ function hasDefaultValue(value) {
6193
+ const noDefault = isSpecificConstant("no-default-value");
6194
+ return !noDefault(value);
6269
6195
  }
6270
- function takeNumericCharacters(content) {
6271
- const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
6272
- return content.slice(0, nonNumericIdx);
6196
+ function hasIndexOf(value, idx) {
6197
+ const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
6198
+ return isErrorCondition(result2, "invalid-index") ? false : result2;
6273
6199
  }
6274
- function toCamelCase(input, preserveWhitespace) {
6275
- const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
6276
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6277
- pascal
6278
- );
6279
- const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
6280
- return camel;
6200
+ function hasKeys(...props) {
6201
+ return (val) => {
6202
+ const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
6203
+ return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
6204
+ };
6281
6205
  }
6282
- function toKebabCase(input, _preserveWhitespace = false) {
6283
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
6284
- const replaceWhitespace = (i) => i.replace(/\s/g, "-");
6285
- const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
6286
- const replaceLeadingDash = (i) => i.replace(/^-/, "");
6287
- const replaceTrailingDash = (i) => i.replace(/-$/, "");
6288
- const replaceUnderscore = (i) => i.replace(/_/g, "-");
6289
- const removeDupDashes = (i) => i.replace(/-+/g, "-");
6290
- return removeDupDashes(`${preWhite}${replaceUnderscore(
6291
- replaceTrailingDash(
6292
- replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
6293
- )
6294
- )}${postWhite}`);
6206
+ function asChars(str) {
6207
+ return str.split("");
6295
6208
  }
6296
- function toNumericArray(arr) {
6297
- return arr.map((i) => Number(i));
6209
+ function asRecord(obj) {
6210
+ return obj;
6298
6211
  }
6299
- function toPascalCase(input, preserveWhitespace = void 0) {
6300
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
6301
- input
6302
- );
6303
- const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
6304
- const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
6305
- const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
6306
- const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
6307
- const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
6308
- replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
6309
- )}${preserveWhitespace ? postWhite : ""}`;
6310
- return pascal;
6212
+ function asString(value) {
6213
+ return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
6311
6214
  }
6312
- function toSnakeCase(input, preserveWhitespace = false) {
6313
- const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
6314
- const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
6315
- const convertDashes = (input2) => input2.replace(/-/g, "_");
6316
- const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
6317
- const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
6318
- return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
6319
- injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
6320
- ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
6215
+ function csv(csv2, format = `string-numeric-tuple`) {
6216
+ const tuple3 = [];
6217
+ csv2.split(/,\s?/).forEach((v) => {
6218
+ tuple3.push(
6219
+ 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
6220
+ );
6221
+ });
6222
+ return tuple3;
6321
6223
  }
6322
- function toString(val) {
6323
- return String(val);
6224
+ function fromKeyValue(kvs) {
6225
+ const obj = {};
6226
+ for (const kv of kvs) {
6227
+ obj[kv.key] = kv.value;
6228
+ }
6229
+ return obj;
6324
6230
  }
6325
- function toUppercase(str) {
6326
- return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
6231
+ function intersect(value, _intersectedWith) {
6232
+ return value;
6327
6233
  }
6328
- function trim(input) {
6329
- return input.trim();
6234
+ function ip6GroupExpansion(ip) {
6235
+ return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
6330
6236
  }
6331
- function trimLeft(input) {
6332
- return input.trimStart();
6237
+ function jsonValue(val) {
6238
+ return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
6333
6239
  }
6334
- function trimStart(input) {
6335
- return input.trimStart();
6240
+ function jsonValues(...val) {
6241
+ return val.map((i) => jsonValue(i));
6336
6242
  }
6337
- function trimRight(input) {
6338
- return input.trimEnd();
6243
+ function lookupAlpha2Code(code, prop) {
6244
+ const found = ISO3166_12.find((i) => i.alpha2 === code);
6245
+ return found ? found[prop] : void 0;
6339
6246
  }
6340
- function trimEnd(input) {
6341
- return input.trimEnd();
6247
+ function lookupAlpha3Code(code, prop) {
6248
+ const found = ISO3166_12.find((i) => i.alpha3 === code);
6249
+ return found ? found[prop] : void 0;
6342
6250
  }
6343
- function truncate(content, maxLength, ellipsis = false) {
6344
- const overLimit = content.length > maxLength;
6345
- return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
6251
+ function lookupName(name, prop) {
6252
+ const found = ISO3166_12.find((i) => i.name === name);
6253
+ return found ? found[prop] : void 0;
6346
6254
  }
6347
- function tuple(...values) {
6348
- const arr = values.length === 1 ? values[0] : values;
6349
- return asArray(arr);
6255
+ function lookupNumericCode(code, prop) {
6256
+ let num = isNumber(code) ? `${code}` : code;
6257
+ if (num.length === 1) {
6258
+ num = `00${num}`;
6259
+ } else if (num.length === 2) {
6260
+ num = `0${num}`;
6261
+ }
6262
+ const found = ISO3166_12.find((i) => i.countryCode === num);
6263
+ return found ? found[prop] : void 0;
6350
6264
  }
6351
- function uncapitalize(str) {
6352
- return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
6265
+ function lookupCountryName(code) {
6266
+ const uc = uppercase(code);
6267
+ return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
6353
6268
  }
6354
- var unset = "<<unset>>";
6355
- function uppercase(str) {
6356
- return str.toUpperCase();
6269
+ function lookupCountryAlpha2(code) {
6270
+ const uc = uppercase(code);
6271
+ return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
6357
6272
  }
6358
- function widen(value) {
6359
- return value;
6273
+ function lookupCountryAlpha3(token) {
6274
+ const uc = uppercase(token);
6275
+ return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
6360
6276
  }
6361
- var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
6362
- function getUrlProtocol(url) {
6363
- const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
6364
- return proto;
6277
+ function lookupCountryCode(token) {
6278
+ const uc = uppercase(token);
6279
+ return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
6365
6280
  }
6366
- function removeUrlProtocol(url) {
6367
- return stripBefore(url, "://");
6281
+ function asMapper(fn2) {
6282
+ const props = {
6283
+ kind: "Mapper",
6284
+ map: (from) => {
6285
+ return from.map(fn2);
6286
+ }
6287
+ };
6288
+ return createFnWithPropsExplicit(fn2, props);
6368
6289
  }
6369
- function ensurePath(val) {
6370
- const val2 = ensureLeading(val, "/");
6371
- return val === "" ? "" : stripTrailing(val2, "/");
6290
+ function createObjectMap() {
6291
+ return (map2) => {
6292
+ const fn2 = (input) => {
6293
+ return Object.keys(map2).reduce(
6294
+ (acc, key) => {
6295
+ const val = map2[key];
6296
+ return {
6297
+ ...acc,
6298
+ [key]: isFunction(val) ? val(input) : val
6299
+ };
6300
+ },
6301
+ {}
6302
+ );
6303
+ };
6304
+ return fn2;
6305
+ };
6372
6306
  }
6373
- function getUrlPath(url) {
6374
- return isUrl(url) ? ensurePath(
6375
- stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
6376
- ) : Never2;
6307
+ function createMapper() {
6308
+ return (fn2) => {
6309
+ return asMapper(fn2);
6310
+ };
6377
6311
  }
6378
- function getUrlQueryParams(url, specific = void 0) {
6379
- const qp = stripBefore(url, "?");
6380
- if (specific) {
6381
- return qp.includes(`${specific}=`) ? decodeURIComponent(
6382
- stripAfter(
6383
- stripBefore(qp, `${specific}=`),
6384
- "&"
6385
- ).replace(/\+/g, "%20")
6386
- ) : void 0;
6387
- }
6388
- return qp === "" ? qp : `?${qp}`;
6312
+ function mergeObjects(defVal, override) {
6313
+ return {
6314
+ ...defVal,
6315
+ ...override
6316
+ };
6389
6317
  }
6390
- function getUrlDefaultPort(url) {
6391
- const proto = getUrlProtocol(url);
6392
- return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
6318
+ function isUndefined(value) {
6319
+ return typeof value === "undefined";
6393
6320
  }
6394
- function getUrlPort(url, resolve = false) {
6395
- const re = /.*:(\d{2,3})/;
6396
- const match = url.match(re);
6397
- return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
6321
+ function mergeScalars(a, b) {
6322
+ return isUndefined(b) ? a : b;
6398
6323
  }
6399
- function getUrlSource(url) {
6400
- const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
6401
- return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
6324
+ function mergeTuples(a, b) {
6325
+ 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]);
6402
6326
  }
6403
- function getUrlBase(url) {
6404
- const path = getUrlPath(url);
6405
- const remaining = stripAfter(url, path);
6406
- return remaining;
6327
+ function never(val) {
6328
+ return val;
6407
6329
  }
6408
- function getUrlDynamics(url) {
6409
- const path = getUrlPath(url);
6410
- const qp = getUrlQueryParams(url);
6411
- const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
6412
- const segmentTypes = [
6413
- "string",
6414
- "number",
6415
- "boolean",
6416
- "Opt<string>",
6417
- "Opt<number>",
6418
- "Opt<boolean>"
6419
- ];
6420
- const pathVars = {};
6421
- const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
6422
- const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
6423
- const findPathNamed = infer(`<{{infer name}}>`);
6424
- for (const part of pathParts) {
6425
- const union4 = findPathUnion(part);
6426
- const typed = findPathTyped(part);
6427
- const named = findPathNamed(part);
6428
- if (union4) {
6429
- if (isVariable(union4.name) && isCsv(union4.union)) {
6430
- pathVars[union4.name] = `string(${union4.union})`;
6431
- }
6432
- } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
6433
- pathVars[typed.name] = typed.type;
6434
- } else if (named && isVariable(named.name)) {
6435
- pathVars[named.name] = "string";
6436
- }
6437
- }
6438
- const qpVars = {};
6439
- const qpParts = stripLeading(qp, "?").split("&");
6440
- for (const p of qpParts) {
6441
- const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
6442
- const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
6443
- const fixed = infer(`{{infer var}}={{infer val}}`)(p);
6444
- if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
6445
- qpVars[union4.var] = `string(${union4.params})`;
6446
- } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
6447
- qpVars[dynamic.var] = dynamic.val;
6448
- } else if (fixed && isVariable(fixed.var)) {
6449
- qpVars[fixed.var] = fixed.val;
6450
- }
6451
- }
6452
- return {
6453
- pathVars,
6454
- qpVars,
6455
- allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
6456
- ...pathVars,
6457
- ...qpVars
6458
- }
6459
- };
6330
+ function optional(value) {
6331
+ return value;
6460
6332
  }
6461
- function urlMeta(url) {
6333
+ function orNull(value) {
6334
+ return value;
6335
+ }
6336
+ function optionalOrNull(value) {
6337
+ return value;
6338
+ }
6339
+ function stripParenthesis(val) {
6340
+ return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
6341
+ }
6342
+ function sortKeyApi(order) {
6462
6343
  return {
6463
- url,
6464
- isUrl: isUrl(url),
6465
- protocol: getUrlProtocol(url),
6466
- path: getUrlPath(url),
6467
- queryParameters: getUrlQueryParams(url),
6468
- params: getUrlDynamics,
6469
- port: getUrlPort(url),
6470
- source: getUrlSource(url),
6471
- isIpAddress: isIpAddress(getUrlSource(url)),
6472
- isIp4Address: isIp4Address(getUrlSource(url)),
6473
- isIp6Address: isIp6Address(getUrlSource(url))
6344
+ order,
6345
+ toTop: (...keys) => sortKeyApi(
6346
+ [
6347
+ ...keys,
6348
+ ...order.filter((i) => !keys.includes(i))
6349
+ ]
6350
+ ),
6351
+ toBottom: (...keys) => sortKeyApi(
6352
+ [
6353
+ ...order.filter((i) => !keys.includes(i)),
6354
+ ...keys
6355
+ ]
6356
+ ),
6357
+ done: () => order
6474
6358
  };
6475
6359
  }
6476
- function getYouTubePageType(url) {
6477
- return isYouTubeUrl(url) ? isYouTubeVideoUrl(url) && (hasUrlQueryParameter(url, "v") || isYouTubeShareUrl(url)) ? hasUrlQueryParameter(url, "list") ? isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::in-list::share-link::with-timestamp` : `play::video::in-list::share-link` : `play::video::in-list` : isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::solo::share-link::with-timestamp` : `play::video::solo::share-link` : `play::video::solo` : isYouTubeCreatorUrl(url) ? getUrlPath(url).includes("/videos") ? "creator::videos" : getUrlPath(url).includes("/playlists") ? "creator::playlists" : last(getUrlPath(url).split("/")).startsWith("@") || getUrlPath(url).includes("/featured") ? "creator::featured" : "creator::other" : isYouTubeFeedUrl(url) ? isYouTubeFeedUrl(url, "history") ? "feed::history" : isYouTubeFeedUrl(url, "playlists") ? "feed::playlists" : isYouTubeFeedUrl(url, "liked") ? "feed::liked" : isYouTubeFeedUrl(url, "subscriptions") ? "feed::subscriptions" : isYouTubeFeedUrl(url, "trending") ? "feed::trending" : "feed::other" : isYouTubeVideosInPlaylist(url) ? "playlist::show" : "other" : Never2;
6360
+ function toKeyValue(obj, sort) {
6361
+ let keys = keysOf(obj);
6362
+ const tuple3 = [];
6363
+ if (sort) {
6364
+ keys = handleDoneFn(sort(sortKeyApi(keys)));
6365
+ }
6366
+ for (const k of keys) {
6367
+ tuple3.push({ key: k, value: obj[k] });
6368
+ }
6369
+ return tuple3;
6478
6370
  }
6479
- function youtubeEmbed(url) {
6480
- if (hasUrlQueryParameter(url, "v")) {
6481
- const id = getUrlQueryParams(url, "v");
6482
- return `https://www.youtube.com/embed/${id}`;
6483
- } else if (isYouTubeShareUrl(url)) {
6484
- const id = url.split("/").pop();
6485
- if (id) {
6486
- return `https://www.youtube.com/embed/${id}`;
6487
- } else {
6488
- throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
6489
- }
6490
- } else {
6491
- throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
6371
+ function convertScalar(val) {
6372
+ switch (typeof val) {
6373
+ case "number":
6374
+ return val;
6375
+ case "string":
6376
+ return Number(val);
6377
+ case "boolean":
6378
+ return val ? 1 : 0;
6379
+ default:
6380
+ throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
6492
6381
  }
6493
6382
  }
6494
- function youtubeMeta(url) {
6495
- return isYouTubeUrl(url) ? {
6496
- url,
6497
- isYouTubeUrl: true,
6498
- isShareUrl: isYouTubeShareUrl(url),
6499
- pageType: getYouTubePageType(url)
6500
- } : {
6501
- url,
6502
- isYouTubeUrl: false
6503
- };
6383
+ var convertList = (val) => val.map((i) => convertScalar(i));
6384
+ function toNumber(value) {
6385
+ return Array.isArray(value) ? convertList(value) : convertScalar(value);
6504
6386
  }
6505
- function queue(state) {
6506
- return {
6507
- queue: state,
6508
- size: state.length,
6509
- isEmpty() {
6510
- return state.length === 0;
6511
- },
6512
- clear() {
6513
- state.slice(0, 0);
6514
- },
6515
- drain() {
6516
- const old_state = [...state];
6517
- state.slice(0, 0);
6518
- return old_state;
6519
- },
6520
- push(...add) {
6521
- state.push(...add);
6522
- },
6523
- drop(quantity) {
6524
- if (quantity && quantity > state.length) {
6525
- throw new Error("Cannot drop more elements than present in the queue");
6526
- }
6527
- state.splice(0, quantity || 1);
6528
- },
6529
- take(quantity) {
6530
- if (quantity && quantity > state.length) {
6531
- throw new Error("Cannot take more elements than present in the queue");
6532
- }
6533
- const result2 = state.slice(0, quantity || 1);
6534
- state.splice(0, quantity || 1);
6535
- return result2;
6536
- },
6537
- *[Symbol.iterator]() {
6538
- for (let i = 0; i < state.length; i++) {
6539
- yield state[i];
6540
- }
6541
- }
6542
- };
6543
- }
6544
- function createFifoQueue(...list2) {
6545
- return queue([...list2]);
6387
+ var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
6388
+ function removeTailwindModifiers(val) {
6389
+ return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
6546
6390
  }
6547
- function queue2(state) {
6548
- return {
6549
- queue: state,
6550
- size: state.length,
6551
- isEmpty() {
6552
- return state.length === 0;
6553
- },
6554
- push(...add) {
6555
- state.push(...add);
6556
- },
6557
- drop(quantity) {
6558
- state.splice(-quantity);
6559
- },
6560
- clear() {
6561
- state.slice(0, 0);
6562
- },
6563
- drain() {
6564
- const old_state = [...state];
6565
- state.slice(0, 0);
6566
- return old_state;
6567
- },
6568
- take(quantity) {
6569
- const result2 = state.slice(-quantity);
6570
- state.splice(-quantity);
6571
- return result2;
6572
- },
6573
- *[Symbol.iterator]() {
6574
- for (let i = state.length - 1; i >= 0; i--) {
6575
- yield state[i];
6576
- }
6577
- }
6578
- };
6391
+ function getTailwindModifiers(val) {
6392
+ return val.split(":").filter((i) => isTailwindModifier(i));
6579
6393
  }
6580
- function createLifoQueue(...list2) {
6581
- return queue2([...list2]);
6394
+ function union(..._options) {
6395
+ return (value) => value;
6582
6396
  }
6583
- var scalarToToken = identity({
6584
- string: "<<string>>",
6585
- number: "<<number>>",
6586
- boolean: "<<boolean>>",
6587
- true: "<<true>>",
6588
- false: "<<false>>",
6589
- null: "<<null>>",
6590
- undefined: "<<undefined>>",
6591
- unknown: "<<unknown>>",
6592
- any: "<<any>>",
6593
- never: "<<never>>"
6594
- });
6595
- function stringLiteral(str) {
6596
- return stripAfter(stripBefore(str, "string("), ")");
6397
+ function unionize(value, _inUnionWith) {
6398
+ return value;
6597
6399
  }
6598
- function numericLiteral(str) {
6599
- return stripAfter(stripBefore(str, "number("), ")");
6400
+ function hasWhiteSpace(val) {
6401
+ return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
6600
6402
  }
6601
- function handleOptional(token) {
6602
- const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
6603
- return bare.startsWith("string") ? `<<union::[ <<string>>, <<undefined>> ]>>` : bare.startsWith("number") ? `<<union::[ <<number>>, <<undefined>> ]>>` : bare.startsWith("boolean") ? `<<union::[ <<boolean>>, <<undefined>> ]>>` : bare.startsWith("unknown") ? `<<union::[ <<unknown>>, <<undefined>> ]>>` : `<<never>>`;
6403
+ function endsWith(endingIn2) {
6404
+ return (val) => {
6405
+ return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
6406
+ };
6604
6407
  }
6605
- function simpleScalarTokenToTypeToken(val) {
6606
- return val in scalarToToken ? scalarToToken[val] : val.startsWith("string(") ? stringLiteral(val).includes(",") ? `<<union::[ ${stringLiteral(val).split(/,\s?/).map((i) => `"${i}"`).join(", ")} ]>>` : `<<string::${stringLiteral(val)}>>` : val.startsWith("number(") ? numericLiteral(val).includes(",") ? `<<union::[ ${numericLiteral(val).split(/,\s?/).join(", ")} ]>>` : `<<number::${numericLiteral(val)}>>` : val.startsWith("Opt<") ? handleOptional(val) : `<<never>>`;
6408
+ function isEqual(base) {
6409
+ return (value) => isSameTypeOf(base)(value) ? value === base : false;
6607
6410
  }
6608
- function unionNode(node) {
6609
- return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
6411
+ function isLength(value, len) {
6412
+ return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
6610
6413
  }
6611
- function union(nodes) {
6612
- return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
6414
+ function isSameTypeOf(base) {
6415
+ return (compare) => {
6416
+ return typeof base === typeof compare;
6417
+ };
6613
6418
  }
6614
- var stripUnion = stripSurround("Union(", ")");
6615
- function simpleUnionTokenToTypeToken(val) {
6616
- return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union(stripUnion(val))} ]>>` : Never2;
6419
+ function isTuple(...tuple3) {
6420
+ const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
6421
+ return (v) => {
6422
+ return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
6423
+ };
6617
6424
  }
6618
- function simpleContainerTokenToTypeToken(_val) {
6425
+ function isTypeOf(type) {
6426
+ return (value) => {
6427
+ return typeof value === type;
6428
+ };
6619
6429
  }
6620
- function asTypeToken(_val) {
6621
- return "not ready";
6430
+ function startsWith(startingWith) {
6431
+ return (val) => {
6432
+ return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
6433
+ };
6622
6434
  }
6623
- function addToken(token, ...params) {
6624
- return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
6435
+ function isHtmlElement(val) {
6436
+ return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6625
6437
  }
6626
- function boolean(literal2) {
6627
- return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
6438
+ function isAlpha(value) {
6439
+ return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
6628
6440
  }
6629
- var unknown = () => "<<unknown>>";
6630
- var undefinedType = () => "<<undefined>>";
6631
- var nullType = () => "<<null>>";
6632
- function fn(..._args) {
6633
- return {
6634
- returns: (_rtn) => ({
6635
- addProperties: (_kv) => {
6636
- return null;
6637
- },
6638
- done: () => {
6639
- return null;
6640
- }
6641
- }),
6642
- done: () => {
6643
- const result2 = null;
6644
- return result2;
6645
- }
6646
- };
6441
+ function isArray(value) {
6442
+ return Array.isArray(value) === true;
6647
6443
  }
6648
- function dictionary(_obj) {
6649
- return null;
6444
+ function isBoolean(value) {
6445
+ return typeof value === "boolean";
6650
6446
  }
6651
- function tuple2(..._elements) {
6652
- return null;
6447
+ function isBooleanLike(val) {
6448
+ return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
6653
6449
  }
6654
- function regexToken(re, ...rep) {
6655
- let exp = "";
6656
- if (isString(re)) {
6657
- try {
6658
- const test = new RegExp(re);
6659
- if (!isRegExp(test)) {
6660
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
6661
- err.name = "InvalidRegEx";
6662
- throw err;
6663
- } else {
6664
- exp = re;
6665
- }
6666
- } catch {
6667
- const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
6668
- err.name = "InvalidRegEx";
6669
- throw err;
6670
- }
6671
- } else if (isRegExp(re)) {
6672
- exp = re.toString();
6673
- }
6674
- const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
6675
- return token;
6450
+ function isConstant(value) {
6451
+ return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
6676
6452
  }
6677
- function addSingleton(token, api2) {
6678
- return (...literals) => {
6679
- return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
6680
- "union",
6681
- literals.map((l) => addToken(token, `${l}`)).join(",")
6682
- );
6683
- };
6453
+ function isContainer(value) {
6454
+ return !!(Array.isArray(value) || isObject(value));
6684
6455
  }
6685
- var stringApi = {
6686
- startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
6687
- endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
6688
- zip: () => addToken("string-set", "Zip5"),
6689
- zipPlus4: () => addToken("string-set", "Zip5_4"),
6690
- zipCode: () => addToken("string-set", "ZipCode"),
6691
- militaryTime: (resolution) => {
6692
- return addToken(
6693
- "string-set",
6694
- "militaryTime",
6695
- resolution || "HH:MM"
6696
- );
6697
- },
6698
- civilianTime: (resolution) => {
6699
- return addToken(
6700
- "string-set",
6701
- "militaryTime",
6702
- resolution || "HH:MM"
6703
- );
6704
- },
6705
- numericString: () => addToken("string-set", "numeric"),
6706
- ipv4Address: () => addToken("string-set", "ipv4Address"),
6707
- ipv6Address: () => addToken("string-set", "ipv6Address"),
6708
- regex: (exp, ...literalRepresentation) => {
6709
- const token = regexToken(exp, ...literalRepresentation);
6710
- return token;
6711
- },
6712
- done: () => addToken("string")
6713
- };
6714
- var string22 = addSingleton("string", stringApi);
6715
- var number = addSingleton("number");
6716
- function union2(...elements) {
6717
- const result2 = elements.map((_el) => {
6718
- });
6719
- return result2;
6456
+ var tokens = [
6457
+ "1",
6458
+ "inherit",
6459
+ "initial",
6460
+ "revert",
6461
+ "revert-layer",
6462
+ "unset",
6463
+ "auto"
6464
+ ];
6465
+ var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
6466
+ function isCssAspectRatio(val) {
6467
+ return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
6720
6468
  }
6721
- function record(_key, _value) {
6722
- return null;
6469
+ function isCsv(val) {
6470
+ return isString(val) && val.includes(",") && !val.startsWith(",");
6723
6471
  }
6724
- function array(_type) {
6725
- return null;
6472
+ function isDefined(value) {
6473
+ return value !== void 0;
6726
6474
  }
6727
- function set(_type) {
6728
- return null;
6475
+ function isDoneFn(val) {
6476
+ return hasKeys("done")(val) && typeof val.done === "function";
6729
6477
  }
6730
- function map(_key, _value) {
6731
- return null;
6478
+ function isEmail(val) {
6479
+ if (!isString(val)) {
6480
+ return false;
6481
+ }
6482
+ const parts = val?.split("@");
6483
+ const domain = parts[1]?.split(".");
6484
+ const tld = domain ? domain.pop() : "";
6485
+ const firstChar = val[0].toLowerCase();
6486
+ return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
6732
6487
  }
6733
- function weakMap(_key, _value) {
6734
- return null;
6488
+ function isEmpty(val) {
6489
+ return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
6735
6490
  }
6736
- function isAddOrDone(val) {
6737
- return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
6491
+ function isNotEmpty(val) {
6492
+ return !(isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && (val?.length === 0 || val?.length === void 0));
6738
6493
  }
6739
- var ShapeApiImplementation = {
6740
- string: string22,
6741
- number,
6742
- boolean,
6743
- unknown,
6744
- undefined: undefinedType,
6745
- null: nullType,
6746
- union: union2,
6747
- fn,
6748
- record,
6749
- array,
6750
- set,
6751
- map,
6752
- weakMap,
6753
- dictionary,
6754
- tuple: tuple2
6755
- };
6756
- function shape(cb) {
6757
- const rtn = cb(ShapeApiImplementation);
6758
- return handleDoneFn(
6759
- isAddOrDone(rtn) ? rtn.done() : rtn
6760
- );
6494
+ function isErrorCondition(value, kind = null) {
6495
+ return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
6761
6496
  }
6762
- function isShape(v) {
6763
- return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
6497
+ function isFalse(i) {
6498
+ return typeof i === "boolean" && !i;
6764
6499
  }
6765
- function asDefineObject(defn) {
6766
- const result2 = Object.keys(defn).reduce(
6767
- (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
6768
- ...acc,
6769
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
6770
- } : isFunction(defn[i]) ? {
6771
- ...acc,
6772
- [i]: handleDoneFn(defn[i](ShapeApiImplementation))
6773
- } : Never2,
6774
- {}
6775
- );
6776
- return result2;
6500
+ function isFalsy(val) {
6501
+ return FALSY_VALUES2.includes(val);
6777
6502
  }
6778
- function asType(...token) {
6779
- return isFunction(token) ? token(ShapeApiImplementation) : token.length === 1 ? isFunction(token[0]) ? handleDoneFn(token[0](ShapeApiImplementation)) : isDefineObject(token[0]) ? asDefineObject(token[0]) : token[0] : token.map((i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i);
6503
+ function isFnWithParams(input, ...params) {
6504
+ return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
6780
6505
  }
6781
- function asStringLiteral(...values) {
6782
- return values.map((i) => i);
6506
+ function isHexadecimal(val) {
6507
+ return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
6783
6508
  }
6784
- var choices = "NOT READY";
6785
- function doesExtend(type) {
6786
- return (val) => {
6787
- let response = false;
6788
- if (isString(val)) {
6789
- if (type === "string") {
6790
- response = true;
6791
- }
6792
- if (type.startsWith("string(")) {
6793
- const literals = stripAfter(
6794
- stripBefore(type, "string("),
6795
- ")"
6796
- ).split(/,\s*/);
6797
- if (literals.includes(val)) {
6798
- response = true;
6799
- }
6800
- }
6801
- }
6802
- if (isNumber(val)) {
6803
- if (type === "number") {
6804
- response = true;
6805
- }
6806
- if (type.startsWith("number(")) {
6807
- const literals = stripAfter(
6808
- stripBefore(type, "number("),
6809
- ")"
6810
- ).split(/,\s*/).map(Number);
6811
- if (literals.includes(val)) {
6812
- response = true;
6813
- }
6814
- }
6815
- }
6816
- if (isNull(val) && (type === "null" || type === "Opt<null>")) {
6817
- response = true;
6818
- }
6819
- if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
6820
- response = true;
6821
- }
6822
- if (isBoolean(val)) {
6823
- if (type === "boolean") {
6824
- response = true;
6825
- }
6826
- if (type === "true" && val === true || type === "false" && val === false) {
6827
- response = true;
6828
- }
6829
- }
6830
- if (isNarrowableObject(val)) {
6831
- if (type === "Dict" || type === "Dict<string, unknown>") {
6832
- response = true;
6833
- }
6834
- if (startsWith("Dict<")(type)) {
6835
- const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
6836
- if (match) {
6837
- const { value } = match;
6838
- const isOpt = value.includes(`Opt<`);
6839
- const values = objectValues(val);
6840
- 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>") {
6841
- response = true;
6842
- }
6843
- }
6844
- }
6845
- }
6846
- if (isArray(val)) {
6847
- if (type === "Array" || type === "Array<unknown>") {
6848
- return true;
6849
- }
6850
- 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)) {
6851
- response = true;
6852
- }
6853
- }
6854
- if (isMap(val)) {
6855
- 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)) {
6856
- response = true;
6857
- }
6858
- }
6859
- if (isSetContainer(val)) {
6860
- 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))) {
6861
- response = true;
6862
- }
6509
+ function isIndexable(value) {
6510
+ return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
6511
+ }
6512
+ function isInlineSvg(v) {
6513
+ return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
6514
+ }
6515
+ function isMap(val) {
6516
+ return val instanceof Map;
6517
+ }
6518
+ function isNever(val) {
6519
+ return isConstant(val) && val.kind === "never";
6520
+ }
6521
+ function isNothing(val) {
6522
+ return !!(val === null || val === void 0);
6523
+ }
6524
+ function isNotNull(value) {
6525
+ return value === null;
6526
+ }
6527
+ function isNull(value) {
6528
+ return value === null;
6529
+ }
6530
+ function maybePhoneNumber(val) {
6531
+ const svelte = String(val).trim();
6532
+ const chars = svelte.split("");
6533
+ const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
6534
+ const valid2 = ["+", "(", ...NUMERIC_CHAR2];
6535
+ const nothing = stripChars(svelte, ...[
6536
+ ...NUMERIC_CHAR2,
6537
+ ...WHITESPACE_CHARS2,
6538
+ "(",
6539
+ ")",
6540
+ "+",
6541
+ ".",
6542
+ "-"
6543
+ ]);
6544
+ return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
6545
+ }
6546
+ var start = PHONE_COUNTRY_CODES2.map((i) => `+${i[0]} `);
6547
+ function hasCountryCode(val) {
6548
+ if (isString(val)) {
6549
+ return start.some((i) => val.trimStart().startsWith(i));
6550
+ }
6551
+ return false;
6552
+ }
6553
+ function isUsPhoneNumber(val) {
6554
+ if (isString(val)) {
6555
+ return maybePhoneNumber(val) && val.trimStart().startsWith(`+1 `);
6556
+ }
6557
+ return false;
6558
+ }
6559
+ function isPhoneNumber(val) {
6560
+ if (isString(val) && maybePhoneNumber(val) && [" ", "-", "."].some((i) => val.includes(i))) {
6561
+ const cc = getPhoneCountryCode(val);
6562
+ const without = cc === "" ? retainChars(val, ...NUMERIC_CHAR2) : retainChars(val.trimStart().replace(`+${cc} `, ""), ...NUMERIC_CHAR2);
6563
+ switch (cc) {
6564
+ case "1":
6565
+ return without.length === 10;
6566
+ case "44":
6567
+ return !![10, 11].includes(without.length);
6568
+ case "":
6569
+ return without.length <= 10;
6570
+ default:
6571
+ return without.length <= 11;
6863
6572
  }
6864
- return response;
6865
- };
6573
+ }
6574
+ return false;
6866
6575
  }
6867
- function ip6Prefix(...groups) {
6868
- const empty = addToken("string");
6869
- const count = 4 - groups.length;
6870
- const fillIn = [];
6871
- for (let index = 0; index < count; index++) {
6872
- fillIn.push(empty);
6576
+ function isReadonlyArray(value) {
6577
+ return Array.isArray(value) === true;
6578
+ }
6579
+ function isRef(value) {
6580
+ return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
6581
+ }
6582
+ function isRegExp(val) {
6583
+ return val instanceof RegExp;
6584
+ }
6585
+ function isLikeRegExp(val) {
6586
+ if (isRegExp(val)) {
6587
+ return true;
6873
6588
  }
6874
- return [
6875
- "<<string::",
6876
- [
6877
- groups.join(":"),
6878
- fillIn.join(":")
6879
- ].join(":"),
6880
- ">>"
6881
- ].join("");
6589
+ if (isString(val)) {
6590
+ try {
6591
+ const _re = new RegExp(val);
6592
+ return true;
6593
+ } catch {
6594
+ return false;
6595
+ }
6596
+ }
6597
+ return false;
6598
+ }
6599
+ function isSymbol(value) {
6600
+ return typeof value === "symbol";
6601
+ }
6602
+ function isScalar(value) {
6603
+ return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
6604
+ }
6605
+ function isSet(val) {
6606
+ return isObject(val) ? val.kind !== "Unset" : true;
6607
+ }
6608
+ function isSetContainer(val) {
6609
+ return val instanceof Set;
6610
+ }
6611
+ function isStringArray(val) {
6612
+ return Array.isArray(val) && val.every((i) => isString(i));
6613
+ }
6614
+ function isThenable(val) {
6615
+ return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
6616
+ }
6617
+ function isTrimable(val) {
6618
+ return isString(val) && val !== val.trim();
6619
+ }
6620
+ function isTrue(value) {
6621
+ return value === true;
6622
+ }
6623
+ function isTruthy(val) {
6624
+ return !FALSY_VALUES2.includes(val);
6625
+ }
6626
+ function isTypeSubtype(val) {
6627
+ return isString(val) && val.split("/").length === 2;
6628
+ }
6629
+ function isTypeTuple(value) {
6630
+ return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
6631
+ }
6632
+ function isUnset(val) {
6633
+ return isObject(val) && val.kind === "Unset";
6882
6634
  }
6883
- function createProxy(...initialize) {
6884
- const state = initialize;
6885
- state.id = null;
6886
- const proxy = new Proxy(state, {});
6887
- Object.defineProperty(proxy, "id", {
6888
- enumerable: false
6889
- });
6890
- return proxy;
6635
+ function isUri(val, ...protocols) {
6636
+ const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
6637
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6891
6638
  }
6892
- function list(...init) {
6893
- return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
6639
+ function isUrl(val, ...protocols) {
6640
+ const p = protocols.length === 0 ? ["http", "https"] : protocols;
6641
+ return isString(val) && p.some((i) => val.startsWith(`${i}://`));
6894
6642
  }
6895
- function singletonApi(kind) {
6896
- return {
6897
- wide: () => `<<${kind}>>`,
6898
- literal: (val) => `<<${kind}::${val}>>`
6899
- };
6643
+ var VALID = [
6644
+ ...ALPHA_CHARS2,
6645
+ ...NUMERIC_CHAR2,
6646
+ "_",
6647
+ "."
6648
+ ];
6649
+ var alpha = null;
6650
+ function valid(chars) {
6651
+ return chars.every((i) => VALID.includes(i));
6900
6652
  }
6901
- function setApi(_variant) {
6902
- return null;
6653
+ function isVariable(val) {
6654
+ return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
6903
6655
  }
6904
- function fnReturnsApi(variant, _params, returns) {
6905
- return isSet(returns) ? null : (_rtn) => {
6906
- return isSet(returns) ? `<<${variant}::>>` : null;
6907
- };
6656
+ function separate(s) {
6657
+ return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
6908
6658
  }
6909
- function fnParamsApi(variant, params, _returns) {
6910
- return isSet(params) ? null : (params2) => {
6911
- return isSet(params2) ? `<<${variant}::>>` : null;
6912
- };
6659
+ function isAreaMetric(val) {
6660
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6913
6661
  }
6914
- function fnDoneApi(variant, params, returns) {
6915
- return isUnset(params) && isUnset(returns) ? `<<` : ``;
6662
+ function isLuminosityMetric(val) {
6663
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6916
6664
  }
6917
- function fnTokenClosure(kind, params, returns) {
6918
- return {
6919
- done: fnDoneApi(kind, params, returns),
6920
- params: fnParamsApi(kind, params, returns),
6921
- returns: fnReturnsApi(kind, params, returns)
6922
- };
6665
+ function isResistance(val) {
6666
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6923
6667
  }
6924
- function createTypeToken(kind) {
6925
- return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
6668
+ function isCurrentMetric(val) {
6669
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6926
6670
  }
6927
- function fromDefineObject(defn) {
6928
- return defn;
6671
+ function isVoltageMetric(val) {
6672
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6929
6673
  }
6930
- function getTokenKind(token) {
6931
- const bare = stripSurround("<<", ">>")(token);
6932
- const parts = bare.split("::");
6933
- const kind = parts.pop();
6934
- return kind;
6674
+ function isFrequencyMetric(val) {
6675
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6935
6676
  }
6936
- var simpleToken = (token) => token;
6937
- var simpleScalarToken = (token) => token;
6938
- var simpleContainerToken = (token) => token;
6939
- function simpleScalarType(token) {
6940
- const value = simpleScalarToken(token);
6941
- return value;
6677
+ function isPowerMetric(val) {
6678
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6942
6679
  }
6943
- function simpleContainerType(token) {
6944
- const value = simpleContainerToken(token);
6945
- return value;
6680
+ function isTimeMetric(val) {
6681
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6946
6682
  }
6947
- function simpleType(token) {
6948
- const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
6949
- return value;
6683
+ function isEnergyMetric(val) {
6684
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6950
6685
  }
6951
- function hasOverlappingKeys(a, b) {
6952
- const keys = Object.keys(a);
6953
- for (const k of keys) {
6954
- if (k in b) {
6955
- return true;
6956
- }
6957
- }
6958
- return false;
6686
+ function isPressureMetric(val) {
6687
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6959
6688
  }
6960
- function uniqueKeys(left, right) {
6961
- const isNumeric = !!(isArray(left) && isArray(right));
6962
- if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
6963
- throw new Error("uniqueKeys(l,r) given invalid comparison; both left and right values should be an object or an array but not one of each!");
6964
- }
6965
- const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
6966
- const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
6967
- if (isNumeric) {
6968
- throw new Error("uniqueKeys does not yet work with tuples");
6969
- }
6970
- const leftKeys = l.filter((i) => !r.includes(i));
6971
- const rightKeys = r.filter((i) => !l.includes(i));
6972
- return [
6973
- "LeftRight",
6974
- leftKeys,
6975
- rightKeys
6976
- ];
6689
+ function isTemperatureMetric(val) {
6690
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6977
6691
  }
6978
- function asChars(str) {
6979
- return str.split("");
6692
+ function isVolumeMetric(val) {
6693
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6980
6694
  }
6981
- function asRecord(obj) {
6982
- return obj;
6695
+ function isAccelerationMetric(val) {
6696
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6983
6697
  }
6984
- function asString(value) {
6985
- return isString(value) ? value : isNumber(value) ? `${value}` : isBoolean(value) ? `${value}` : isArray(value) ? value.join("") : String(value);
6698
+ function isSpeedMetric(val) {
6699
+ const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
6700
+ return isString(val) && speed.includes(separate(val));
6986
6701
  }
6987
- function isFunction(value) {
6988
- return typeof value === "function";
6702
+ function isMassMetric(val) {
6703
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6989
6704
  }
6990
- function isObject(value) {
6991
- return typeof value === "object" && value !== null && Array.isArray(value) === false;
6705
+ function isDistanceMetric(val) {
6706
+ return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
6992
6707
  }
6993
- function isNarrowableObject(value) {
6994
- return isObject(value) && Object.keys(value).every((key) => ["string", "number", "boolean", "symbol", "object", "undefined", "void", "null"].includes(typeof value[key]));
6708
+ function isMetric(val) {
6709
+ return isDistanceMetric(val) || isMassMetric(val) || isSpeedMetric(val) || isAccelerationMetric(val) || isVoltageMetric(val) || isTemperatureMetric(val) || isPressureMetric(val) || isEnergyMetric(val) || isTimeMetric(val) || isPowerMetric(val) || isFrequencyMetric(val) || isVoltageMetric(val) || isCurrentMetric(val) || isLuminosityMetric(val) || isAreaMetric(val);
6995
6710
  }
6996
- function isEscapeFunction(val) {
6997
- return isFunction(val) && "escape" in val && val.escape === true;
6711
+ function isAreaUom(val) {
6712
+ return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6998
6713
  }
6999
- function isOptionalParamFunction(val) {
7000
- return isFunction(val) && "optionalParams" in val && val.optionalParams === true;
6714
+ function isLuminosityUom(val) {
6715
+ return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7001
6716
  }
7002
- function isApi(api2) {
7003
- return isObject(api2) && "surface" in api2 && "_kind" in api2 && api2._kind === "api";
6717
+ function isResistanceUom(val) {
6718
+ return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7004
6719
  }
7005
- function isApiSurface(val) {
7006
- return isObject(val) && Object.keys(val).some((k) => isEscapeFunction(val[k]));
6720
+ function isCurrentUom(val) {
6721
+ return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7007
6722
  }
7008
- function isDate(val) {
7009
- return val instanceof Date;
6723
+ function isVoltageUom(val) {
6724
+ return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7010
6725
  }
7011
- function isIsoDateTime(val) {
7012
- if (!isString(val)) {
7013
- return false;
7014
- }
7015
- const ISO_DATETIME_REGEX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(Z|[+-]\d{2}:\d{2})?$/;
7016
- if (!ISO_DATETIME_REGEX.test(val)) {
7017
- return false;
7018
- }
7019
- const [_, ...matches] = val.match(ISO_DATETIME_REGEX) || [];
7020
- const [year, month, day, hours, minutes, seconds] = matches.map(Number);
7021
- if (hours >= 24 || minutes >= 60 || seconds != null && seconds >= 60) {
7022
- return false;
7023
- }
7024
- if (month < 1 || month > 12) {
7025
- return false;
7026
- }
7027
- ;
7028
- const daysInMonth = new Date(year, month, 0).getDate();
7029
- if (day < 1 || day > daysInMonth) {
7030
- return false;
7031
- }
7032
- ;
7033
- const tzMatch = val.match(/([+-])(\d{2}):(\d{2})$/);
7034
- if (tzMatch) {
7035
- const [_2, _sign, tzHours, tzMinutes] = tzMatch;
7036
- const numHours = Number.parseInt(tzHours, 10);
7037
- const numMinutes = Number.parseInt(tzMinutes, 10);
7038
- if (numHours > 14 || numMinutes > 59) {
7039
- return false;
7040
- }
7041
- if (numHours === 14 && numMinutes > 0) {
7042
- return false;
7043
- }
7044
- }
7045
- return true;
6726
+ function isFrequencyUom(val) {
6727
+ return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7046
6728
  }
7047
- function isIsoExplicitDate(val) {
7048
- if (isString(val)) {
7049
- const parts = val.split("-").map((i) => Number(i));
7050
- return val.includes("-") ? val.split("-").every((i) => isNumberLike(i)) ? parts[0] >= 0 && parts[0] <= 9999 && parts[1] >= 1 && parts[1] <= 12 && parts[2] >= 1 && parts[2] <= 31 : false : false;
7051
- } else {
7052
- return false;
7053
- }
6729
+ function isPowerUom(val) {
6730
+ return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7054
6731
  }
7055
- function isIsoImplicitDate(val) {
7056
- if (isString(val) && val.length === 8 && isNumberLike(val)) {
7057
- const year = Number(val.slice(0, 4));
7058
- const month = Number(val.slice(4, 6));
7059
- const date = Number(val.slice(6, 8));
7060
- return year >= 0 && year <= 9999 && month >= 1 && month <= 12 && date >= 1 && date <= 31;
7061
- } else {
7062
- return false;
7063
- }
6732
+ function isTimeUom(val) {
6733
+ return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7064
6734
  }
7065
- function isIsoDate(val) {
7066
- if (isString(val)) {
7067
- return val.includes("-") ? isIsoExplicitDate(val) : isIsoImplicitDate(val);
7068
- } else {
7069
- return false;
7070
- }
6735
+ function isEnergyUom(val) {
6736
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7071
6737
  }
7072
- function isIsoExplicitTime(val) {
7073
- if (isString(val)) {
7074
- const parts = stripLeading(stripAfter(val, "Z"), "T").split(/[:.]/).map((i) => Number(i));
7075
- return val.startsWith("T") && val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
7076
- } else {
7077
- return false;
7078
- }
6738
+ function isPressureUom(val) {
6739
+ return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7079
6740
  }
7080
- function isIsoImplicitTime(val) {
7081
- if (isString(val)) {
7082
- const parts = stripAfter(val, "Z").split(/[:.]/).map((i) => Number(i));
7083
- return val.includes(":") && val.split(":").length === 3 && parts[0] >= 0 && parts[0] <= 23 && parts[1] >= 0 && parts[1] <= 59;
7084
- } else {
7085
- return false;
7086
- }
6741
+ function isTemperatureUom(val) {
6742
+ return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6743
+ }
6744
+ function isVolumeUom(val) {
6745
+ return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
6746
+ }
6747
+ function isAccelerationUom(val) {
6748
+ return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7087
6749
  }
7088
- function isIsoTime(val) {
7089
- return isIsoExplicitTime(val) || isIsoImplicitTime(val);
6750
+ function isSpeedUom(val) {
6751
+ return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7090
6752
  }
7091
- function isIsoYear(val) {
7092
- return !!(isString(val) && val.length === 4 && isNumber(Number(val)) && Number(val) >= 0 && Number(val) <= 9999);
6753
+ function isMassUom(val) {
6754
+ return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7093
6755
  }
7094
- function isLuxonDateTime(val) {
7095
- return isObject(val) && typeof val === "object" && val !== null && "isValid" in val && "invalidReason" in val && "invalidExplanation" in val && "toISO" in val && "toFormat" in val && "toMillis" in val && "year" in val && "month" in val && "day" in val && "hour" in val && "minute" in val && "second" in val && "millisecond" in val && typeof val.isValid === "boolean" && typeof val.toISO === "function";
6756
+ function isDistanceUom(val) {
6757
+ return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7096
6758
  }
7097
- function isMoment(val) {
7098
- if (val instanceof Date) {
7099
- return false;
7100
- }
7101
- return isObject(val) && typeof val.format === "function" && typeof val.year === "function" && typeof val.month === "function" && typeof val.date === "function" && "_isAMomentObject" in val && "_isValid" in val && typeof val.add === "function" && typeof val.subtract === "function" && typeof val.toISOString === "function" && typeof val.isValid === "function";
6759
+ function isUom(val) {
6760
+ return isDistanceUom(val) || isMassUom(val) || isSpeedUom(val) || isAccelerationUom(val) || isVoltageUom(val) || isTemperatureUom(val) || isPressureUom(val) || isEnergyUom(val) || isTimeUom(val) || isPowerUom(val) || isFrequencyUom(val) || isVoltageUom(val) || isCurrentUom(val) || isLuminosityUom(val) || isAreaUom(val);
7102
6761
  }
7103
- function isThisMonth(val) {
7104
- const now = /* @__PURE__ */ new Date();
7105
- const currentYear = now.getFullYear();
7106
- const currentMonth = now.getMonth() + 1;
7107
- if (val instanceof Date) {
7108
- return val.getFullYear() === currentYear && val.getMonth() + 1 === currentMonth;
7109
- }
7110
- if (isMoment(val)) {
7111
- const monthValue = val.month();
7112
- return val.year() === currentYear && (typeof monthValue === "number" ? monthValue + 1 : monthValue) === currentMonth;
7113
- }
7114
- if (isLuxonDateTime(val)) {
7115
- return val.year === currentYear && val.month === currentMonth;
7116
- }
7117
- if (typeof val === "string") {
7118
- const isoDateRegex = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])(?:T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][01]\d:[0-5]\d))?$/;
7119
- if (!isoDateRegex.test(val)) {
7120
- return false;
7121
- }
7122
- const dateMatch = val.match(/^(\d{4})-(\d{2})/);
7123
- if (dateMatch) {
7124
- const year = Number.parseInt(dateMatch[1], 10);
7125
- const month = Number.parseInt(dateMatch[2], 10);
7126
- return year === currentYear && month === currentMonth;
7127
- }
7128
- }
7129
- return false;
6762
+ function isIp4Address(val) {
6763
+ return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
7130
6764
  }
7131
- function isThisWeek(date) {
7132
- const targetDate = asDate(date);
7133
- if (!targetDate) {
7134
- return false;
7135
- }
7136
- const currentWeek = getWeekNumber();
7137
- const targetWeek = getWeekNumber(targetDate);
7138
- return currentWeek === targetWeek;
6765
+ function isIp6Address(val) {
6766
+ const expanded = isString(val) ? ip6GroupExpansion(val) : "";
6767
+ return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
7139
6768
  }
7140
- function isThisYear(val) {
7141
- const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
7142
- if (isObject(val) || isNumber(val) || isString(val)) {
7143
- const date = asDate(val);
7144
- if (date) {
7145
- return date.getFullYear() === currentYear;
7146
- } else {
7147
- return false;
7148
- }
7149
- }
7150
- return false;
6769
+ function isIpAddress(val) {
6770
+ return isIp4Address(val) || isIp6Address(val);
7151
6771
  }
7152
- function isToday(test) {
7153
- if (isString(test)) {
7154
- const justDate = stripAfter(test, "T");
7155
- return isIsoExplicitDate(justDate) && justDate === getToday();
7156
- } else if (isMoment(test) || isDate(test)) {
7157
- return stripAfter(test.toISOString(), "T") === getToday();
7158
- } else if (isLuxonDateTime(test)) {
7159
- return stripAfter(test.toISO(), "T") === getToday();
7160
- }
7161
- return false;
6772
+ function hasUrlPort(val) {
6773
+ return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
7162
6774
  }
7163
- function isTomorrow(test) {
7164
- if (isString(test)) {
7165
- const justDate = stripAfter(test, "T");
7166
- return isIsoExplicitDate(justDate) && justDate === getTomorrow();
7167
- } else if (isMoment(test) || isDate(test)) {
7168
- return stripAfter(test.toISOString(), "T") === getTomorrow();
7169
- } else if (isLuxonDateTime(test)) {
7170
- return stripAfter(test.toISO(), "T") === getTomorrow();
7171
- }
7172
- return false;
6775
+ function isUrlPath(val) {
6776
+ return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
6777
+ (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
6778
+ );
7173
6779
  }
7174
- function isYesterday(test) {
7175
- if (isString(test)) {
7176
- const justDate = stripAfter(test, "T");
7177
- return isIsoExplicitDate(justDate) && justDate === getYesterday();
7178
- } else if (isMoment(test) || isDate(test)) {
7179
- return stripAfter(test.toISOString(), "T") === getYesterday();
7180
- } else if (isLuxonDateTime(test)) {
7181
- return stripAfter(test.toISO(), "T") === getYesterday();
7182
- }
7183
- return false;
6780
+ function isDomainName(val) {
6781
+ return isString(val) && val.split(".").filter((i) => i).length > 1 && isString(val.split(".").filter((i) => i).pop()) && asChars(val.split(".").filter((i) => i).pop()).length > 1 && val.split(".").filter((i) => i).every(
6782
+ (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
6783
+ );
7184
6784
  }
7185
- function isVisa(val) {
7186
- if (isString(val) && val.startsWith("4")) {
7187
- const parts = val.split(" ");
7188
- return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4);
7189
- }
7190
- return false;
6785
+ function isUrlSource(val) {
6786
+ return isDomainName(val) || isIpAddress(val);
7191
6787
  }
7192
- function isMastercard(val) {
7193
- if (isString(val) && val.startsWith("4")) {
7194
- const parts = val.split(" ");
7195
- return parts.length === 4 && parts.every((i) => isNumberLike(i) && i.length === 4) && ["51", "55", "22", "23", "24", "25", "26", "27"].some((i) => val.startsWith(i));
7196
- }
7197
- return false;
6788
+ function hasUrlQueryParameter(val, prop) {
6789
+ return isString(getUrlQueryParams(val, prop));
7198
6790
  }
7199
- function isVisaMastercard(val) {
7200
- return isVisa(val) || isMastercard(val);
6791
+ function isNumericArray(val) {
6792
+ return Array.isArray(val) && val.every((i) => isNumber(i));
7201
6793
  }
7202
- function isAmericanExpress(val) {
7203
- if (isString(val)) {
7204
- const parts = val.split(" ");
7205
- return parts.length === 3 && parts.every(
7206
- (i) => isNumberLike(i) && parts[0].length === 4 && parts[1].length === 6
7207
- );
7208
- }
7209
- return false;
6794
+ function hasProtocol(val, ...protocols) {
6795
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
7210
6796
  }
7211
- function isCreditCard(val) {
7212
- return isVisaMastercard(val) || isAmericanExpress(val);
6797
+ function isProtocol(val, ...protocols) {
6798
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
7213
6799
  }
7214
- function cardType(cardNumber) {
7215
- const cleanedNumber = String(cardNumber).replace(/\D/g, "");
7216
- const length = cleanedNumber.length;
7217
- if (!isValidLength(length)) {
7218
- return "invalid";
7219
- }
7220
- if (!luhnCheck(cleanedNumber)) {
7221
- return "invalid";
7222
- }
7223
- const cardTypes = [
7224
- { name: "Visa", lengths: [16], prefixes: [/^4/] },
7225
- { name: "Mastercard", lengths: [16], prefixes: [/^(51|52|53|54|55|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/] },
7226
- { name: "American Express", lengths: [15], prefixes: [/^3[47]/] },
7227
- { name: "Discover", lengths: [16], prefixes: [/^(6011|622(12[6-9]|1[3-9]\d|2[0-4]\d|25\d|6[4-9]|7[0-4]|8[0-4]|9\d)|64[4-9]|65)/] },
7228
- { name: "JCB", lengths: [16], prefixes: [/^(35|2131|1800)/] },
7229
- { name: "Diners Club", lengths: [14, 16], prefixes: [/^(30[0-5]|36|38)/] },
7230
- { name: "China UnionPay", lengths: [16, 17, 18, 19], prefixes: [/^(62|88)/] },
7231
- { name: "Maestro", lengths: [12, 13, 14, 15, 16, 17, 18, 19], prefixes: [/^(5018|5020|5038|6304)/] },
7232
- { name: "Solo", lengths: [16, 18, 19], prefixes: [/^(6334|6767)/] }
7233
- ];
7234
- for (const type of cardTypes) {
7235
- if (type.lengths.includes(length)) {
7236
- for (const prefix of type.prefixes) {
7237
- if (prefix.test(cleanedNumber)) {
7238
- return type.name;
6800
+ function hasProtocolPrefix(val, ...protocols) {
6801
+ 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));
6802
+ }
6803
+ function isProtocolPrefix(val, ...protocols) {
6804
+ return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
6805
+ }
6806
+ function isTypeToken(val, kind) {
6807
+ if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
6808
+ const stripped = stripSurround("<<", ">>")(val);
6809
+ if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
6810
+ if (kind) {
6811
+ if (isAtomicKind(kind)) {
6812
+ return val === `<<${kind}>>`;
6813
+ } else if (isSetBasedKind(kind)) {
6814
+ return val.startsWith(`<<${kind}::`);
6815
+ } else {
6816
+ return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
7239
6817
  }
6818
+ } else {
6819
+ return true;
7240
6820
  }
7241
6821
  }
6822
+ return false;
7242
6823
  }
7243
- return "invalid";
6824
+ return false;
7244
6825
  }
7245
- function isValidLength(length) {
7246
- const validLengths = [13, 14, 15, 16, 17, 18, 19];
7247
- return validLengths.includes(length);
6826
+ function isTypeTokenKind(val) {
6827
+ return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
7248
6828
  }
7249
- function luhnCheck(num) {
7250
- let sum = 0;
7251
- let double = false;
7252
- for (let i = num.length - 1; i >= 0; i--) {
7253
- let n = Number.parseInt(num.charAt(i), 10);
7254
- if (double) {
7255
- n *= 2;
7256
- if (n > 9) {
7257
- n -= 9;
7258
- }
7259
- }
7260
- sum += n;
7261
- double = !double;
7262
- }
7263
- return sum % 10 === 0;
6829
+ function isAtomicToken(val) {
6830
+ return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
7264
6831
  }
7265
- function isString(value) {
7266
- return typeof value === "string";
6832
+ function isAtomicKind(val) {
6833
+ return isString(val) && TT_ATOMICS2.includes(val);
7267
6834
  }
7268
- function isIso3166Alpha2(val) {
7269
- const codes = ISO3166_12.map((i) => i.alpha2);
7270
- return isString(val) && codes.includes(val);
6835
+ function isObjectToken(val) {
6836
+ return isTypeToken(val, "obj");
7271
6837
  }
7272
- function isCountryCode2(val) {
7273
- const codes = ISO3166_12.map((i) => i.alpha2);
7274
- return isString(val) && codes.includes(val);
6838
+ function isRecordToken(val) {
6839
+ return isTypeToken(val, "rec");
7275
6840
  }
7276
- function isIso3166Alpha3(val) {
7277
- const codes = ISO3166_12.map((i) => i.alpha3);
7278
- return isString(val) && codes.includes(val);
6841
+ function isTupleToken(val) {
6842
+ return isTypeToken(val, "tuple");
7279
6843
  }
7280
- function isCountryCode3(val) {
7281
- const codes = ISO3166_12.map((i) => i.alpha3);
7282
- return isString(val) && codes.includes(val);
6844
+ function isArrayToken(val) {
6845
+ return isTypeToken(val, "arr");
7283
6846
  }
7284
- function isIso3166CountryCode(val) {
7285
- const codes = ISO3166_12.map((i) => i.countryCode);
7286
- return isString(val) && codes.includes(val);
6847
+ function isMapToken(val) {
6848
+ return isTypeToken(val, "map");
6849
+ }
6850
+ function isSetToken(val) {
6851
+ return isTypeToken(val, "set");
6852
+ }
6853
+ function isContainerToken(val) {
6854
+ return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
6855
+ }
6856
+ function isShapeCallback(val) {
6857
+ return isFunction(val) && val.kind === "shape";
6858
+ }
6859
+ var token_types = [
6860
+ ...TT_ATOMICS2,
6861
+ ...TT_CONTAINERS2,
6862
+ ...TT_FUNCTIONS2,
6863
+ ...TT_SETS2,
6864
+ ...TT_SINGLETONS2
6865
+ ];
6866
+ function isShapeToken(val) {
6867
+ return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
7287
6868
  }
7288
- function isCountryAbbrev(val) {
7289
- return isCountryCode2(val) || isCountryCode3(val);
6869
+ var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
6870
+ var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
6871
+ function isSimpleToken(val) {
6872
+ return isString(val) && split_tokens.some(
6873
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6874
+ );
7290
6875
  }
7291
- function isIso3166CountryName(val) {
7292
- const codes = ISO3166_12.map((i) => i.name);
7293
- return isString(val) && codes.includes(val);
6876
+ function isSimpleScalarToken(val) {
6877
+ return isString(val) && scalar_split_tokens.some(
6878
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6879
+ );
7294
6880
  }
7295
- function isCountryName(val) {
7296
- const codes = ISO3166_12.map((i) => i.name);
7297
- return isString(val) && codes.includes(val);
6881
+ function isSimpleContainerToken(val) {
6882
+ return isString(val) && scalar_split_tokens.some(
6883
+ (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
6884
+ );
7298
6885
  }
7299
- var ABBREV = US_STATE_LOOKUP2.map((i) => i.abbrev);
7300
- var NAME = US_STATE_LOOKUP2.map((i) => i.name);
7301
- function isUsStateAbbreviation(val) {
7302
- return isString(val) && ABBREV.includes(val);
6886
+ function isSimpleTokenTuple(val) {
6887
+ return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
7303
6888
  }
7304
- function isUsStateName(val) {
7305
- return isString(val) && NAME.includes(val);
6889
+ function isSimpleScalarTokenTuple(val) {
6890
+ return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
7306
6891
  }
7307
- function isNumericString(value) {
7308
- const numericChars = [...NUMERIC_CHAR2];
7309
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i));
6892
+ function isSimpleContainerTokenTuple(val) {
6893
+ return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
7310
6894
  }
7311
- function isNumberLike(value) {
7312
- const numericChars = [...NUMERIC_CHAR2];
7313
- return typeof value === "string" && split(value).every((i) => numericChars.includes(i)) ? true : typeof value === "number";
6895
+ function isDefineObject(val) {
6896
+ return isObject(val) && Object.keys(val).some(
6897
+ (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
6898
+ );
7314
6899
  }
7315
- function isNumber(value) {
7316
- return typeof value === "number";
6900
+ function isFnBasedToken(val) {
6901
+ if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
6902
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6903
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
6904
+ }
7317
6905
  }
7318
- function isZipCode5(val) {
7319
- if (isNumber(val)) {
7320
- return isZipCode5(`${val}`);
6906
+ function isFnBasedKind(val) {
6907
+ if (isString(val) && isTypeTokenKind(val)) {
6908
+ const stripped = stripSurround(TT_START2, TT_STOP2)(val);
6909
+ return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
7321
6910
  }
7322
- return isString(val) && val.trim().length === 5 && isNumberLike(val.trim());
6911
+ return false;
7323
6912
  }
7324
- function isZipPlus4(val) {
7325
- if (isString(val)) {
7326
- const first = retainWhile(val.trim(), ...NUMERIC_CHAR2);
7327
- const next = stripChars(val.trim().replace(first, "").trim(), "-");
7328
- return first.length === 5 && next.length === 4 && isNumberLike(next);
6913
+ function isSetBasedToken(val) {
6914
+ if (isTypeToken(val)) {
6915
+ const kind = getTokenKind(val);
6916
+ return kind.endsWith(`-set`);
7329
6917
  }
7330
6918
  return false;
7331
6919
  }
7332
- function isZipCode(val) {
7333
- return isZipCode5(val) || isZipPlus4(val);
6920
+ function isSetBasedKind(val) {
6921
+ return isString(val) && val.endsWith(`-set`);
7334
6922
  }
7335
- function isSpecificConstant(kind) {
7336
- return (value) => {
7337
- return !!(isConstant(value) && value.kind === kind);
7338
- };
6923
+ function isSingletonKind(val) {
6924
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7339
6925
  }
7340
- function hasDefaultValue(value) {
7341
- const noDefault = isSpecificConstant("no-default-value");
7342
- return !noDefault(value);
6926
+ function isSingletonToken(val) {
6927
+ return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7343
6928
  }
7344
- function hasIndexOf(value, idx) {
7345
- const result2 = isObject(value) ? String(idx) in value : Array.isArray(value) ? Number(idx) in value : false;
7346
- return isErrorCondition(result2, "invalid-index") ? false : result2;
6929
+ function isTailwindColorName(val) {
6930
+ return isString(val) && Object.keys(TW_HUE2).includes(val);
7347
6931
  }
7348
- function hasKeys(...props) {
7349
- return (val) => {
7350
- const keys = Array.isArray(props) ? props : Object.keys(props).filter((i) => typeof i === "string");
7351
- return !!((isFunction(val) || isObject(val)) && keys.every((k) => k in val));
7352
- };
6932
+ function isTailwindColorWithLuminosity(val) {
6933
+ return isString(val) && isTailwindColorName(val.split("-")[0]) && (!["white", "black"].includes(val.split("-")[0]) || val.split("-").length === 1) && (!val.includes("-") || Object.keys(TW_LUMINOSITY2).includes(retainAfter(val, "-")));
7353
6934
  }
7354
- function hasWhiteSpace(val) {
7355
- return isString(val) && asChars(val).some((c) => WHITESPACE_CHARS2.includes(c));
6935
+ function isTailwindColorWithLuminosityAndOpacity(val) {
6936
+ return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
7356
6937
  }
7357
- function endsWith(endingIn2) {
7358
- return (val) => {
7359
- return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
7360
- };
6938
+ function isTailwindColor(val) {
6939
+ return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
7361
6940
  }
7362
- function isEqual(base) {
7363
- return (value) => isSameTypeOf(base)(value) ? value === base : false;
6941
+ function isTailwindModifier(val) {
6942
+ return isString(val) && TW_MODIFIERS2.includes(val);
7364
6943
  }
7365
- function isLength(value, len) {
7366
- return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
6944
+ function isTailwindColorTarget(val) {
6945
+ return isString(val) && TW_COLOR_TARGETS2.includes(val);
7367
6946
  }
7368
- function isSameTypeOf(base) {
7369
- return (compare) => {
7370
- return typeof base === typeof compare;
7371
- };
6947
+ function isTailwindColorClass(val, ...allowedModifiers) {
6948
+ if (isString(val)) {
6949
+ const mods = getTailwindModifiers(val);
6950
+ const targetted = removeTailwindModifiers(val);
6951
+ const target = targetted.split("-")[0];
6952
+ const color = targetted.split("-").slice(1).join("-");
6953
+ return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
6954
+ }
6955
+ return false;
7372
6956
  }
7373
- function isTuple(...tuple3) {
7374
- const results = tuple3.map((i) => i(ShapeApiImplementation)).map((i) => isDoneFn(i) ? i.done() : i);
7375
- return (v) => {
7376
- return isArray(v) && v.length === results.length && results.every(isShape) && v.every((item, idx) => isSameTypeOf(results[idx])(item));
7377
- };
6957
+ var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
6958
+ function isAustralianNewsUrl(val) {
6959
+ return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
7378
6960
  }
7379
- function isTypeOf(type) {
7380
- return (value) => {
7381
- return typeof value === type;
7382
- };
6961
+ var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
6962
+ function isBelgiumNewsUrl(val) {
6963
+ return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
7383
6964
  }
7384
- function startsWith(startingWith) {
7385
- return (val) => {
7386
- return isString(val) ? !!val.startsWith(startingWith) : isNumber(val) ? !!String(val).startsWith(startingWith) : false;
7387
- };
6965
+ var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
6966
+ function isCanadianNewsUrl(val) {
6967
+ return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
7388
6968
  }
7389
- function isHtmlElement(val) {
7390
- return isObject(val) && "attributes" in val && "firstElementChild" in val && "innerHTML" in val;
6969
+ var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
6970
+ function isDanishNewsUrl(val) {
6971
+ return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
7391
6972
  }
7392
- function isAlpha(value) {
7393
- return isString(value) && split(value).every((v) => ALPHA_CHARS2.includes(v));
6973
+ var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
6974
+ function isDutchNewsUrl(val) {
6975
+ return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
7394
6976
  }
7395
- function isArray(value) {
7396
- return Array.isArray(value) === true;
6977
+ var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
6978
+ function isFrenchNewsUrl(val) {
6979
+ return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
7397
6980
  }
7398
- function isBoolean(value) {
7399
- return typeof value === "boolean";
6981
+ var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
6982
+ function isGermanNewsUrl(val) {
6983
+ return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
7400
6984
  }
7401
- function isBooleanLike(val) {
7402
- return isBoolean(val) || isString(val) && ["true", "false", "boolean"].includes(val);
6985
+ var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
6986
+ function isIndianNewsUrl(val) {
6987
+ return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
7403
6988
  }
7404
- function isConstant(value) {
7405
- return !!(isObject(value) && "_type" in value && "kind" in value && value._type === "Constant");
6989
+ var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
6990
+ function isItalianNewsUrl(val) {
6991
+ return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
7406
6992
  }
7407
- function isContainer(value) {
7408
- return !!(Array.isArray(value) || isObject(value));
6993
+ var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
6994
+ function isJapaneseNewsUrl(val) {
6995
+ return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
7409
6996
  }
7410
- var tokens = [
7411
- "1",
7412
- "inherit",
7413
- "initial",
7414
- "revert",
7415
- "revert-layer",
7416
- "unset",
7417
- "auto"
7418
- ];
7419
- var isRatio = (val) => /\d{1,4}\s*\/\s*\d{1,4}/.test(val);
7420
- function isCssAspectRatio(val) {
7421
- return isString(val) && val.split(/\s+/).every((i) => tokens.includes(i) || isRatio(i));
6997
+ var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
6998
+ function isMexicanNewsUrl(val) {
6999
+ return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
7422
7000
  }
7423
- function isCsv(val) {
7424
- return isString(val) && val.includes(",") && !val.startsWith(",");
7001
+ var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
7002
+ function isNorwegianNewsUrl(val) {
7003
+ return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
7425
7004
  }
7426
- function isDefined(value) {
7427
- return typeof value !== "undefined";
7005
+ var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
7006
+ function isSouthKoreanNewsUrl(val) {
7007
+ return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
7428
7008
  }
7429
- function isDoneFn(val) {
7430
- return hasKeys("done")(val) && typeof val.done === "function";
7009
+ var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
7010
+ function isSpanishNewsUrl(val) {
7011
+ return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
7431
7012
  }
7432
- function isEmail(val) {
7433
- if (!isString(val)) {
7434
- return false;
7435
- }
7436
- const parts = val?.split("@");
7437
- const domain = parts[1]?.split(".");
7438
- const tld = domain ? domain.pop() : "";
7439
- const firstChar = val[0].toLowerCase();
7440
- return isString(val) && (LOWER_ALPHA_CHARS2.includes(firstChar) && parts.length === 2 && domain.length >= 1 && tld.length >= 2);
7013
+ var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
7014
+ function isSwissNewsUrl(val) {
7015
+ return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
7441
7016
  }
7442
- function isEmpty(val) {
7443
- return isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && val.length === 0;
7017
+ var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
7018
+ function isTurkishNewsUrl(val) {
7019
+ return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
7444
7020
  }
7445
- function isNotEmpty(val) {
7446
- return !(isUndefined(val) || isNull(val) || isString(val) && val.length === 0 || isObject(val) && Object.keys(val).length === 0 || isArray(val) && (val?.length === 0 || val?.length === void 0));
7021
+ var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
7022
+ function isUkNewsUrl(val) {
7023
+ return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
7447
7024
  }
7448
- function isErrorCondition(value, kind = null) {
7449
- return isObject(value) && "__kind" in value && value.__kind === "ErrorCondition" && "kind" in value ? kind !== null ? value.kind === kind : true : false;
7025
+ var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
7026
+ function isUsNewsUrl(val) {
7027
+ return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
7028
+ }
7029
+ var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
7030
+ function isChineseNewsUrl(val) {
7031
+ return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
7032
+ }
7033
+ function isNewsUrl(val) {
7034
+ 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);
7035
+ }
7036
+ function isBitbucketUrl(val) {
7037
+ const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
7038
+ return isString(val) && valid2.some(
7039
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7040
+ );
7450
7041
  }
7451
- function isFalse(i) {
7452
- return typeof i === "boolean" && !i;
7042
+ function isCodeCommitUrl(val) {
7043
+ const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
7044
+ return isString(val) && valid2.some(
7045
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7046
+ );
7453
7047
  }
7454
- function isFalsy(val) {
7455
- return FALSY_VALUES2.includes(val);
7048
+ function isGithubUrl(val) {
7049
+ const valid2 = [
7050
+ "https://github.com",
7051
+ "https://www.github.com",
7052
+ "https://github.io"
7053
+ ];
7054
+ return isString(val) && valid2.some(
7055
+ (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7056
+ );
7456
7057
  }
7457
- function isFnWithParams(input, ...params) {
7458
- return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
7058
+ function isGithubOrgUrl(val) {
7059
+ return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
7459
7060
  }
7460
- function isHexadecimal(val) {
7461
- return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
7061
+ function stripper(s) {
7062
+ return stripTrailing(
7063
+ stripLeading(s, "https://github.com/"),
7064
+ "/"
7065
+ );
7462
7066
  }
7463
- function isIndexable(value) {
7464
- return !!(Array.isArray(value) || typeof value === "object" && keysOf(value).length > 0);
7067
+ function isGithubRepoUrl(val) {
7068
+ return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
7465
7069
  }
7466
- function isInlineSvg(v) {
7467
- return isString(v) && v.trim().startsWith(`<svg`) && v.trim().endsWith(`</svg>`);
7070
+ function isGithubRepoReleasesUrl(val) {
7071
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
7468
7072
  }
7469
- function isMap(val) {
7470
- return val instanceof Map;
7073
+ function isGithubRepoReleaseTagUrl(val) {
7074
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
7471
7075
  }
7472
- function isNever(val) {
7473
- return isConstant(val) && val.kind === "never";
7076
+ function isGithubIssuesListUrl(val) {
7077
+ return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
7474
7078
  }
7475
- function isNothing(val) {
7476
- return !!(val === null || val === void 0);
7079
+ function isGithubIssueUrl(val) {
7080
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
7477
7081
  }
7478
- function isNotNull(value) {
7479
- return value === null;
7082
+ function isGithubProjectsListUrl(val) {
7083
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
7480
7084
  }
7481
- function isNull(value) {
7482
- return value === null;
7085
+ function isGithubProjectUrl(val) {
7086
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
7483
7087
  }
7484
- function maybePhoneNumber(val) {
7485
- const svelte = String(val).trim();
7486
- const chars = svelte.split("");
7487
- const numeric = retainChars(svelte, ...NUMERIC_CHAR2);
7488
- const valid2 = ["+", "(", ...NUMERIC_CHAR2];
7489
- const nothing = stripChars(svelte, ...[
7490
- ...NUMERIC_CHAR2,
7491
- ...WHITESPACE_CHARS2,
7492
- "(",
7493
- ")",
7494
- "+",
7495
- ".",
7496
- "-"
7497
- ]);
7498
- return chars.every((i) => valid2.includes(i)) && svelte.startsWith(`+`) ? numeric.length >= 8 : svelte.startsWith(`00`) ? numeric.length >= 10 : numeric.length >= 7 && nothing === "";
7088
+ function isGithubReleasesListUrl(val) {
7089
+ return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
7499
7090
  }
7500
- var start = PHONE_COUNTRY_CODES2.map((i) => `+${i[0]} `);
7501
- function hasCountryCode(val) {
7502
- if (isString(val)) {
7503
- return start.some((i) => val.trimStart().startsWith(i));
7504
- }
7505
- return false;
7091
+ function isGithubReleaseTagUrl(val) {
7092
+ return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
7506
7093
  }
7507
- function isUsPhoneNumber(val) {
7508
- if (isString(val)) {
7509
- return maybePhoneNumber(val) && val.trimStart().startsWith(`+1 `);
7510
- }
7511
- return false;
7094
+ function isRepoSource(v) {
7095
+ return isString(v) && REPO_SOURCES2.includes(v);
7512
7096
  }
7513
- function isPhoneNumber(val) {
7514
- if (isString(val) && maybePhoneNumber(val) && [" ", "-", "."].some((i) => val.includes(i))) {
7515
- const cc = getPhoneCountryCode(val);
7516
- const without = cc === "" ? retainChars(val, ...NUMERIC_CHAR2) : retainChars(val.trimStart().replace(`+${cc} `, ""), ...NUMERIC_CHAR2);
7517
- switch (cc) {
7518
- case "1":
7519
- return without.length === 10;
7520
- case "44":
7521
- return !![10, 11].includes(without.length);
7522
- case "":
7523
- return without.length <= 10;
7524
- default:
7525
- return without.length <= 11;
7526
- }
7527
- }
7528
- return false;
7097
+ function isSemanticVersion(v, allowPrefix = false) {
7098
+ return isString(v) && v.split(".").length === 3 && !Number.isNaN(Number(v.split(".")[1])) && !Number.isNaN(Number(v.split(".")[2])) && (!Number.isNaN(Number(v.split(".")[0])) || allowPrefix && !Number.isNaN(Number(stripLeading(v.split(".")[0], "v").trim())));
7529
7099
  }
7530
- function isReadonlyArray(value) {
7531
- return Array.isArray(value) === true;
7100
+ function isRepoUrl(val) {
7101
+ return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
7532
7102
  }
7533
- function isRef(value) {
7534
- return isObject(value) && "value" in value && Array.from(Object.keys(value)).includes("_value");
7103
+ function isWholeFoodsUrl(val) {
7104
+ return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
7535
7105
  }
7536
- function isRegExp(val) {
7537
- return val instanceof RegExp;
7106
+ function isCvsUrl(val) {
7107
+ return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
7538
7108
  }
7539
- function isLikeRegExp(val) {
7540
- if (isRegExp(val)) {
7541
- return true;
7542
- }
7543
- if (isString(val)) {
7544
- try {
7545
- const _re = new RegExp(val);
7546
- return true;
7547
- } catch {
7548
- return false;
7549
- }
7550
- }
7551
- return false;
7109
+ function isWalgreensUrl(val) {
7110
+ return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
7552
7111
  }
7553
- function isSymbol(value) {
7554
- return typeof value === "symbol";
7112
+ function isKrogersUrl(val) {
7113
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7555
7114
  }
7556
- function isScalar(value) {
7557
- return isString(value) || isNumber(value) || isSymbol(value) || isNull(value);
7115
+ function isZaraUrl(val) {
7116
+ return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
7558
7117
  }
7559
- function isSet(val) {
7560
- return isObject(val) ? val.kind !== "Unset" : true;
7118
+ function isHmUrl(val) {
7119
+ return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
7561
7120
  }
7562
- function isSetContainer(val) {
7563
- return val instanceof Set;
7121
+ function isDellUrl(val) {
7122
+ return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
7564
7123
  }
7565
- function isStringArray(val) {
7566
- return Array.isArray(val) && val.every((i) => isString(i));
7124
+ function isIkeaUrl(val) {
7125
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7567
7126
  }
7568
- function isThenable(val) {
7569
- return isObject(val) && "then" in val && "catch" in val && typeof val.then === "function";
7127
+ function isLowesUrl(val) {
7128
+ return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7570
7129
  }
7571
- function isTrimable(val) {
7572
- return isString(val) && val !== val.trim();
7130
+ function isNikeUrl(val) {
7131
+ return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
7573
7132
  }
7574
- function isTrue(value) {
7575
- return value === true;
7133
+ function isWayfairUrl(val) {
7134
+ return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
7576
7135
  }
7577
- function isTruthy(val) {
7578
- return !FALSY_VALUES2.includes(val);
7136
+ function isBestBuyUrl(val) {
7137
+ return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
7579
7138
  }
7580
- function isTypeSubtype(val) {
7581
- return isString(val) && val.split("/").length === 2;
7139
+ function isCostCoUrl(val) {
7140
+ return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
7582
7141
  }
7583
- function isTypeTuple(value) {
7584
- return Array.isArray(value) && value.length === 3 && typeof value[1] === "function";
7142
+ function isEtsyUrl(val) {
7143
+ return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
7585
7144
  }
7586
- function isUndefined(value) {
7587
- return typeof value === "undefined";
7145
+ function isTargetUrl(val) {
7146
+ return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
7588
7147
  }
7589
- function isUnset(val) {
7590
- return isObject(val) && val.kind === "Unset";
7148
+ function isEbayUrl(val) {
7149
+ return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
7591
7150
  }
7592
- function isUri(val, ...protocols) {
7593
- const p = protocols.length === 0 ? valuesOf(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i) : protocols;
7594
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
7151
+ function isHomeDepotUrl(val) {
7152
+ return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
7595
7153
  }
7596
- function isUrl(val, ...protocols) {
7597
- const p = protocols.length === 0 ? ["http", "https"] : protocols;
7598
- return isString(val) && p.some((i) => val.startsWith(`${i}://`));
7154
+ function isMacysUrl(val) {
7155
+ return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
7599
7156
  }
7600
- var VALID = [
7601
- ...ALPHA_CHARS2,
7602
- ...NUMERIC_CHAR2,
7603
- "_",
7604
- "."
7605
- ];
7606
- var alpha = null;
7607
- function valid(chars) {
7608
- return chars.every((i) => VALID.includes(i));
7157
+ function isAppleUrl(val) {
7158
+ return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
7609
7159
  }
7610
- function isVariable(val) {
7611
- return isString(val) && startsWith(alpha)(val) && valid(asChars(val));
7160
+ function isWalmartUrl(val) {
7161
+ return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
7612
7162
  }
7613
- function separate(s) {
7614
- return stripWhile(s.toLowerCase(), ...NUMERIC_CHAR2).trim();
7163
+ function isAmazonUrl(val) {
7164
+ return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
7615
7165
  }
7616
- function isAreaMetric(val) {
7617
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7166
+ function isRetailUrl(val) {
7167
+ return isAmazonUrl(val) || isWalgreensUrl(val) || isAppleUrl(val) || isMacysUrl(val) || isEbayUrl(val) || isHomeDepotUrl(val) || isTargetUrl(val) || isEtsyUrl(val) || isCostCoUrl(val) || isBestBuyUrl(val) || isWayfairUrl(val) || isNikeUrl(val) || isLowesUrl(val) || isIkeaUrl(val) || isDellUrl(val) || isHmUrl(val) || isZaraUrl(val) || isKrogersUrl(val) || isWalgreensUrl(val) || isCvsUrl(val) || isWholeFoodsUrl(val);
7618
7168
  }
7619
- function isLuminosityMetric(val) {
7620
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7169
+ var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
7170
+ var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
7171
+ function isSocialMediaUrl(val) {
7172
+ return isString(val) && URL20.some((i) => val.startsWith(i));
7621
7173
  }
7622
- function isResistance(val) {
7623
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7174
+ function isSocialMediaProfileUrl(val) {
7175
+ return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
7624
7176
  }
7625
- function isCurrentMetric(val) {
7626
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7177
+ function isYouTubeUrl(val) {
7178
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
7627
7179
  }
7628
- function isVoltageMetric(val) {
7629
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7180
+ function isYouTubeShareUrl(val) {
7181
+ return isString(val) && val.startsWith(`https://youtu.be`);
7630
7182
  }
7631
- function isFrequencyMetric(val) {
7632
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7183
+ function isYouTubeVideoUrl(val) {
7184
+ return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
7633
7185
  }
7634
- function isPowerMetric(val) {
7635
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7186
+ function isYouTubePlaylistUrl(val) {
7187
+ return isString(val) && (val === `https://www.youtube.com/feed/playlists` || val === `https://youtube.com/feed/playlists` || val === `https://www.youtube.com/channel/playlists` || val === `https://youtube.com/channel/playlists` || val.startsWith(`https://www.youtube.com/@`) && val.endsWith(`/playlists`) || val.startsWith(`https://youtube.com/@`) && val.endsWith(`/playlists`));
7636
7188
  }
7637
- function isTimeMetric(val) {
7638
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7189
+ function feed_map(type) {
7190
+ return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
7639
7191
  }
7640
- function isEnergyMetric(val) {
7641
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7192
+ function isYouTubeFeedUrl(val, type) {
7193
+ return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
7642
7194
  }
7643
- function isPressureMetric(val) {
7644
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7195
+ function isYouTubeFeedHistoryUrl(val) {
7196
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
7645
7197
  }
7646
- function isTemperatureMetric(val) {
7647
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7198
+ function isYouTubePlaylistsUrl(val) {
7199
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
7648
7200
  }
7649
- function isVolumeMetric(val) {
7650
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7201
+ function isYouTubeTrendingUrl(val) {
7202
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
7651
7203
  }
7652
- function isAccelerationMetric(val) {
7653
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7204
+ function isYouTubeSubscriptionsUrl(val) {
7205
+ return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
7654
7206
  }
7655
- function isSpeedMetric(val) {
7656
- const speed = SPEED_METRICS_LOOKUP2.map((i) => i.abbrev);
7657
- return isString(val) && speed.includes(separate(val));
7207
+ function isYouTubeCreatorUrl(url) {
7208
+ return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
7658
7209
  }
7659
- function isMassMetric(val) {
7660
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7210
+ function isYouTubeVideosInPlaylist(val) {
7211
+ return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
7661
7212
  }
7662
- function isDistanceMetric(val) {
7663
- return isString(val) && DISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(separate(val));
7213
+ function isVueRef(val) {
7214
+ if (isObject(val)) {
7215
+ const keys = Object.keys(val);
7216
+ return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
7217
+ }
7218
+ return false;
7664
7219
  }
7665
- function isMetric(val) {
7666
- return isDistanceMetric(val) || isMassMetric(val) || isSpeedMetric(val) || isAccelerationMetric(val) || isVoltageMetric(val) || isTemperatureMetric(val) || isPressureMetric(val) || isEnergyMetric(val) || isTimeMetric(val) || isPowerMetric(val) || isFrequencyMetric(val) || isVoltageMetric(val) || isCurrentMetric(val) || isLuminosityMetric(val) || isAreaMetric(val);
7220
+ function filterUndefined(...val) {
7221
+ return val.filter((i) => isDefined(i));
7667
7222
  }
7668
- function isAreaUom(val) {
7669
- return isString(val) && AREA_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7223
+ function find(list2, deref = null) {
7224
+ return (comparator) => {
7225
+ return list2.find((i) => {
7226
+ const val = deref ? isObject(i) || isArray(i) ? deref in i ? i[deref] : void 0 : i : i;
7227
+ return val === comparator;
7228
+ });
7229
+ };
7670
7230
  }
7671
- function isLuminosityUom(val) {
7672
- return isString(val) && LUMINOSITY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7231
+ function getEach(list2, dotPath) {
7232
+ const result2 = list2.map(
7233
+ (i) => isNull(dotPath) ? i : isContainer(i) ? get(i, dotPath) : Never2
7234
+ ).filter((i) => !isErrorCondition(i));
7235
+ return result2;
7673
7236
  }
7674
- function isResistanceUom(val) {
7675
- return isString(val) && RESISTANCE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7237
+ function indexOf(val, index) {
7238
+ const isNegative = isNumber(index) && index < 0;
7239
+ if (isNegative && !Array.isArray(val)) {
7240
+ throw new Error(`The indexOf(val,idx) utility received a negative index value [${index}] but the value being de-references is not an array [${typeof val}]!`);
7241
+ }
7242
+ if (isNegative && Array.isArray(val) && val.length < Math.abs(index)) {
7243
+ throw new Error(`The indexOf(val,idx) utility received a negative index of ${index} but the length of the array passed in is only ${val.length}! This is not allowed.`);
7244
+ }
7245
+ const idx = isNegative && Array.isArray(val) ? val.length + 1 - Math.abs(index) : index;
7246
+ return index === null ? val : isNull(idx) ? val : isArray(val) ? Number(idx) in val ? val[Number(idx)] : errCondition("invalid-index", `attempt to index a numeric array with an invalid index: ${Number(idx)}`) : isObject(val) ? String(idx) in val ? val[String(idx)] : errCondition("invalid-index", `attempt to index a dictionary object with an invalid index: ${String(idx)}`) : errCondition("invalid-container-type", `Attempt to use indexOf() on an invalid container type: ${typeof val}`);
7676
7247
  }
7677
- function isCurrentUom(val) {
7678
- return isString(val) && CURRENT_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7248
+ function intersectWithOffset(a, b, deref) {
7249
+ const aIndexable = a.every((i) => isIndexable(i));
7250
+ const bIndexable = b.every((i) => isIndexable(i));
7251
+ if (!aIndexable || !bIndexable) {
7252
+ if (!aIndexable) {
7253
+ throw new Error(`The "a" array passed into intersect(a,b) was not fully composed of indexable properties: ${a.map((i) => typeof i).join(", ")}`);
7254
+ } else {
7255
+ throw new Error(`The "b" array passed into intersect(a,b) was not fully composed of indexable properties: ${b.map((i) => typeof i).join(", ")}`);
7256
+ }
7257
+ }
7258
+ const aMatches = getEach(a, deref);
7259
+ const bMatches = getEach(b, deref);
7260
+ const sharedKeys2 = ifNotNull(
7261
+ deref,
7262
+ (v) => [
7263
+ a.filter((i) => Array.from(bMatches).includes(get(i, v))),
7264
+ b.filter((i) => Array.from(aMatches).includes(get(i, v)))
7265
+ ],
7266
+ () => a.filter((k) => b.includes(k))
7267
+ );
7268
+ return sharedKeys2;
7679
7269
  }
7680
- function isVoltageUom(val) {
7681
- return isString(val) && VOLTAGE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7270
+ function intersectNoOffset(a, b) {
7271
+ return a.length < b.length ? a.filter((val) => b.includes(val)) : b.filter((val) => a.includes(val));
7682
7272
  }
7683
- function isFrequencyUom(val) {
7684
- return isString(val) && FREQUENCY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7273
+ function intersection(a, b, deref = null) {
7274
+ return deref === null ? intersectNoOffset(a, b) : intersectWithOffset(a, b, deref);
7685
7275
  }
7686
- function isPowerUom(val) {
7687
- return isString(val) && POWER_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7276
+ function joinWith(joinWith2) {
7277
+ return (...tuple3) => {
7278
+ const tup = tuple3;
7279
+ return tup.join(joinWith2);
7280
+ };
7688
7281
  }
7689
- function isTimeUom(val) {
7690
- return isString(val) && TIME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7282
+ function last(list2) {
7283
+ return [...list2].pop();
7691
7284
  }
7692
- function isEnergyUom(val) {
7693
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7285
+ function logicalReturns(conditions) {
7286
+ return conditions.map(
7287
+ (c) => isBoolean(c) ? c : isFunction(c) ? c() : Never2
7288
+ );
7694
7289
  }
7695
- function isPressureUom(val) {
7696
- return isString(val) && PRESSURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7290
+ function reverse(list2) {
7291
+ return [...list2].reverse();
7697
7292
  }
7698
- function isTemperatureUom(val) {
7699
- return isString(val) && TEMPERATURE_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7293
+ function shift(list2) {
7294
+ let rtn;
7295
+ if (isDefined(list2)) {
7296
+ rtn = list2.length === 0 ? void 0 : list2[0];
7297
+ try {
7298
+ list2 = list2.slice(1);
7299
+ } catch {
7300
+ }
7301
+ } else {
7302
+ rtn = void 0;
7303
+ }
7304
+ return rtn;
7700
7305
  }
7701
- function isVolumeUom(val) {
7702
- return isString(val) && VOLUME_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7306
+ function slice(list2, start2, end) {
7307
+ return list2.slice(start2, end);
7703
7308
  }
7704
- function isAccelerationUom(val) {
7705
- return isString(val) && ACCELERATION_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7309
+ function unique(...values) {
7310
+ const u = [];
7311
+ for (const i of values.flat()) {
7312
+ if (!u.includes(i)) {
7313
+ u.push(i);
7314
+ }
7315
+ }
7316
+ return u;
7706
7317
  }
7707
- function isSpeedUom(val) {
7708
- return isString(val) && SPEED_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7318
+ function box(value) {
7319
+ const rtn = {
7320
+ __type: "box",
7321
+ value,
7322
+ unbox: (...p) => {
7323
+ return typeof value === "function" ? value(...p) : value;
7324
+ }
7325
+ };
7326
+ return rtn;
7709
7327
  }
7710
- function isMassUom(val) {
7711
- return isString(val) && MASS_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7328
+ function isBox(thing) {
7329
+ return typeof thing === "object" && "__type" in thing && thing.__type === "box";
7712
7330
  }
7713
- function isDistanceUom(val) {
7714
- return isString(val) && ENERGY_METRICS_LOOKUP2.map((i) => i.abbrev).includes(val);
7331
+ function boxDictionaryValues(dict) {
7332
+ const keys = Object.keys(dict);
7333
+ return keys.reduce(
7334
+ (acc, key) => ({ ...acc, [key]: box(dict[key]) }),
7335
+ {}
7336
+ );
7715
7337
  }
7716
- function isUom(val) {
7717
- return isDistanceUom(val) || isMassUom(val) || isSpeedUom(val) || isAccelerationUom(val) || isVoltageUom(val) || isTemperatureUom(val) || isPressureUom(val) || isEnergyUom(val) || isTimeUom(val) || isPowerUom(val) || isFrequencyUom(val) || isVoltageUom(val) || isCurrentUom(val) || isLuminosityUom(val) || isAreaUom(val);
7338
+ function unbox(val) {
7339
+ return isBox(val) ? val.value : val;
7718
7340
  }
7719
- function isIp4Address(val) {
7720
- return isString(val) && val.split(".").length === 4 && val.split(".").every((i) => isNumberLike(i)) && val.split(".").every((i) => Number(i) >= 0 && Number(i) <= 255);
7341
+ function capitalize(str) {
7342
+ return `${str?.slice(0, 1).toUpperCase()}${str?.slice(1)}`;
7721
7343
  }
7722
- function isIp6Address(val) {
7723
- const expanded = isString(val) ? ip6GroupExpansion(val) : "";
7724
- return isString(val) && isString(expanded) && expanded.split(":").every((i) => asChars(i).length >= 1 && asChars(i).length <= 4) && expanded.split(":").every((i) => isHexadecimal(i));
7344
+ function cssColor(color, v1, v2, v3, opacity) {
7345
+ return `color(${color} ${v1} ${v2} ${v3}${opacity ? ` / ${opacity}` : ""}`;
7725
7346
  }
7726
- function isIpAddress(val) {
7727
- return isIp4Address(val) || isIp6Address(val);
7347
+ function twColor(color, luminosity) {
7348
+ const lum = luminosity in TW_LUMINOSITY2 ? TW_LUMINOSITY2[luminosity] : 0;
7349
+ const chroma = luminosity in TW_CHROMA2 ? TW_CHROMA2[luminosity] : 0;
7350
+ const hue = TW_HUE2[color];
7351
+ return `oklch(${lum} ${chroma} ${hue})`;
7728
7352
  }
7729
- function hasUrlPort(val) {
7730
- return isString(val) && asChars(removeUrlProtocol(val)).includes(":");
7353
+ function ensureLeading(content, ensure) {
7354
+ const output = String(content);
7355
+ return output.startsWith(String(ensure)) ? content : isString(content) ? `${ensure}${content}` : Number(`${ensure}${content}`);
7731
7356
  }
7732
- function isUrlPath(val) {
7733
- return isString(val) && (val === "" || val.startsWith("/")) && asChars(val).every(
7734
- (c) => isAlpha(c) || isNumberLike(c) || c === "_" || c === "@" || c === "." || c === "-"
7735
- );
7357
+ function ensureSurround(prefix, postfix) {
7358
+ const fn2 = (input) => {
7359
+ let result2 = input;
7360
+ result2 = ensureLeading(result2, prefix);
7361
+ result2 = ensureTrailing(result2, postfix);
7362
+ return result2;
7363
+ };
7364
+ return fn2;
7736
7365
  }
7737
- function isDomainName(val) {
7738
- return isString(val) && val.split(".").filter((i) => i).length > 1 && isString(val.split(".").filter((i) => i).pop()) && asChars(val.split(".").filter((i) => i).pop()).length > 1 && val.split(".").filter((i) => i).every(
7739
- (i) => isAlpha(i) || isNumberLike(i) || i === "-" || i === "_"
7366
+ function ensureTrailing(content, ensure) {
7367
+ return (
7368
+ //
7369
+ content.endsWith(ensure) ? content : `${content}${ensure}`
7740
7370
  );
7741
7371
  }
7742
- function isUrlSource(val) {
7743
- return isDomainName(val) || isIpAddress(val);
7744
- }
7745
- function hasUrlQueryParameter(val, prop) {
7746
- return isString(getUrlQueryParams(val, prop));
7372
+ function getTypeSubtype(str) {
7373
+ if (isTypeSubtype(str)) {
7374
+ const [t, st] = str.split("/");
7375
+ return [t, st];
7376
+ } else {
7377
+ const err = new Error(`An invalid Type/Subtype was passed into getTypeSubtype(${str})`);
7378
+ err.name = "InvalidTypeSubtype";
7379
+ throw err;
7380
+ }
7747
7381
  }
7748
- function isNumericArray(val) {
7749
- return Array.isArray(val) && val.every((i) => isNumber(i));
7382
+ function identity(...values) {
7383
+ return values.length === 1 ? values[0] : values.length === 0 ? void 0 : values;
7750
7384
  }
7751
- function hasProtocol(val, ...protocols) {
7752
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.some((i) => val.startsWith(i)) : protocols.some((i) => val.startsWith(i));
7385
+ function ifLowercaseChar(ch, callbackForMatch, callbackForNoMatch) {
7386
+ if (ch.length !== 1) {
7387
+ throw new Error(`call to ifUppercaseChar received ${ch.length} characters but is only valid when one character is passed in!`);
7388
+ }
7389
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
7753
7390
  }
7754
- function isProtocol(val, ...protocols) {
7755
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.includes(val) : protocols.includes(val);
7391
+ function ifUppercaseChar(ch, callbackForMatch, callbackForNoMatch) {
7392
+ if (ch.length !== 1) {
7393
+ throw new Error(`Invalid string length passed to ifUppercaseChar(ch); this function requires a single character but ${ch.length} were received`);
7394
+ }
7395
+ return LOWER_ALPHA_CHARS2.includes(ch) ? callbackForMatch(ch) : callbackForNoMatch(ch);
7756
7396
  }
7757
- function hasProtocolPrefix(val, ...protocols) {
7758
- 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));
7397
+ function parseTemplate(template) {
7398
+ const pattern = /\{\{\s*infer\s+([A-Za-z_]\w*)\s*(?:(?:extends|as)\s+(string|number|boolean)\s*)?\}\}/g;
7399
+ let lastIndex = 0;
7400
+ let match;
7401
+ const segments = [];
7402
+ while (match = pattern.exec(template)) {
7403
+ const [fullMatch, varName, asType2] = match;
7404
+ const staticPart = template.slice(lastIndex, match.index);
7405
+ if (staticPart) {
7406
+ segments.push({ dynamic: false, text: staticPart });
7407
+ }
7408
+ segments.push({
7409
+ dynamic: true,
7410
+ varName,
7411
+ type: asType2 ? asType2 : "string"
7412
+ });
7413
+ lastIndex = match.index + fullMatch.length;
7414
+ }
7415
+ const remainder = template.slice(lastIndex);
7416
+ if (remainder) {
7417
+ segments.push({ dynamic: false, text: remainder });
7418
+ }
7419
+ return segments;
7759
7420
  }
7760
- function isProtocolPrefix(val, ...protocols) {
7761
- return isString(val) && protocols.length === 0 ? NETWORK_PROTOCOL2.map((i) => `${i}://`).includes(val) : protocols.map((i) => `${i}://`).includes(val);
7421
+ function escapeRegex(str) {
7422
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7762
7423
  }
7763
- function isTypeToken(val, kind) {
7764
- if (isString(val) && val.startsWith("<<") && val.endsWith(">>")) {
7765
- const stripped = stripSurround("<<", ">>")(val);
7766
- if (TT_KIND_VARIANTS2.some((k) => stripped.startsWith(k))) {
7767
- if (kind) {
7768
- if (isAtomicKind(kind)) {
7769
- return val === `<<${kind}>>`;
7770
- } else if (isSetBasedKind(kind)) {
7771
- return val.startsWith(`<<${kind}::`);
7772
- } else {
7773
- return val === `<<${kind}>>` || val.startsWith(`<<${kind}::`);
7774
- }
7775
- } else {
7776
- return true;
7424
+ function buildRegexPattern(segments) {
7425
+ let regexStr = "^";
7426
+ for (const seg of segments) {
7427
+ if (!seg.dynamic) {
7428
+ regexStr += escapeRegex(seg.text);
7429
+ } else {
7430
+ switch (seg.type) {
7431
+ case "string":
7432
+ regexStr += "(.*?)";
7433
+ break;
7434
+ case "number":
7435
+ regexStr += "(\\d+)";
7436
+ break;
7437
+ case "boolean":
7438
+ regexStr += "(true|false)";
7439
+ break;
7777
7440
  }
7778
7441
  }
7779
- return false;
7780
7442
  }
7781
- return false;
7782
- }
7783
- function isTypeTokenKind(val) {
7784
- return !!(isString(val) && TT_KIND_VARIANTS2.includes(val));
7785
- }
7786
- function isAtomicToken(val) {
7787
- return isString(val) && TT_ATOMICS2.some((i) => val.startsWith(`<<${i}`));
7443
+ regexStr += "$";
7444
+ return new RegExp(regexStr);
7788
7445
  }
7789
- function isAtomicKind(val) {
7790
- return isString(val) && TT_ATOMICS2.includes(val);
7446
+ function convertValue(type, value) {
7447
+ switch (type) {
7448
+ case "string":
7449
+ return value;
7450
+ case "number":
7451
+ return Number(value);
7452
+ case "boolean":
7453
+ return value === "true";
7454
+ }
7791
7455
  }
7792
- function isObjectToken(val) {
7793
- return isTypeToken(val, "obj");
7456
+ function matchTemplate(template, test) {
7457
+ const segments = parseTemplate(template);
7458
+ const regex = buildRegexPattern(segments);
7459
+ const match = regex.exec(test);
7460
+ if (!match)
7461
+ return false;
7462
+ let captureIndex = 1;
7463
+ const result2 = {};
7464
+ for (const seg of segments) {
7465
+ if (seg.dynamic) {
7466
+ const rawVal = match[captureIndex++];
7467
+ if (rawVal === void 0)
7468
+ return false;
7469
+ result2[seg.varName] = convertValue(seg.type, rawVal);
7470
+ }
7471
+ }
7472
+ return result2;
7794
7473
  }
7795
- function isRecordToken(val) {
7796
- return isTypeToken(val, "rec");
7474
+ function infer(inference) {
7475
+ return (test) => {
7476
+ return matchTemplate(inference, test);
7477
+ };
7797
7478
  }
7798
- function isTupleToken(val) {
7799
- return isTypeToken(val, "tuple");
7479
+ function idLiteral(o) {
7480
+ return { ...o, id: o.id };
7800
7481
  }
7801
- function isArrayToken(val) {
7802
- return isTypeToken(val, "arr");
7482
+ function nameLiteral(o) {
7483
+ return o;
7803
7484
  }
7804
- function isMapToken(val) {
7805
- return isTypeToken(val, "map");
7485
+ function kindLiteral(o) {
7486
+ return o;
7806
7487
  }
7807
- function isSetToken(val) {
7808
- return isTypeToken(val, "set");
7488
+ function idTypeGuard(_o) {
7489
+ return true;
7809
7490
  }
7810
- function isContainerToken(val) {
7811
- return isObjectToken(val) || isRecordToken(val) || isTupleToken(val) || isArrayToken(val) || isMapToken(val) || isSetToken(val);
7491
+ function literal(obj) {
7492
+ return obj;
7812
7493
  }
7813
- function isShapeCallback(val) {
7814
- return isFunction(val) && val.kind === "shape";
7494
+ function lowercase(str) {
7495
+ return str.toLowerCase();
7815
7496
  }
7816
- var token_types = [
7817
- ...TT_ATOMICS2,
7818
- ...TT_CONTAINERS2,
7819
- ...TT_FUNCTIONS2,
7820
- ...TT_SETS2,
7821
- ...TT_SINGLETONS2
7822
- ];
7823
- function isShapeToken(val) {
7824
- return isString(val) && val.startsWith("<<") && val.endsWith(">>") && token_types.some((t) => val.startsWith(`<<${t}`));
7497
+ function narrow(...values) {
7498
+ return values.length === 1 ? values[0] : values;
7825
7499
  }
7826
- var split_tokens = SIMPLE_TOKENS2.map((i) => i.split("TOKEN"));
7827
- var scalar_split_tokens = SIMPLE_SCALAR_TOKENS2.map((i) => i.split("TOKEN"));
7828
- function isSimpleToken(val) {
7829
- return isString(val) && split_tokens.some(
7830
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7831
- );
7500
+ function pathJoin(...segments) {
7501
+ const clean_path = segments.map((i) => stripTrailing(stripLeading(i, "/"), "/")).join("/");
7502
+ const original_path = segments.join("/");
7503
+ const pre = original_path.startsWith("/") ? "/" : "";
7504
+ const post = original_path.endsWith("/") ? "/" : "";
7505
+ return `${pre}${clean_path}${post}`;
7832
7506
  }
7833
- function isSimpleScalarToken(val) {
7834
- return isString(val) && scalar_split_tokens.some(
7835
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7836
- );
7507
+ var asPhoneFormat = () => `NOT IMPLEMENTED`;
7508
+ function getPhoneCountryCode(phone) {
7509
+ return phone.trim().startsWith("+") || phone.trim().startsWith("00") ? retainWhile(
7510
+ stripLeading(stripLeading(phone.trim(), "+"), "00"),
7511
+ ...NUMERIC_CHAR2
7512
+ ) : "";
7837
7513
  }
7838
- function isSimpleContainerToken(val) {
7839
- return isString(val) && scalar_split_tokens.some(
7840
- (i) => i.length === 1 && val === i[0] || val.startsWith(i[0]) && val.endsWith(i.slice(-1)[0]) && i.every((p) => val.includes(p))
7841
- );
7514
+ function removePhoneCountryCode(phone) {
7515
+ const countryCode = getPhoneCountryCode(phone);
7516
+ return countryCode !== "" ? stripLeading(stripLeading(
7517
+ phone.trim(),
7518
+ "+",
7519
+ "00"
7520
+ ), countryCode).trim() : phone.trim();
7842
7521
  }
7843
- function isSimpleTokenTuple(val) {
7844
- return isArray(val) && val.length !== 0 && val.every(isSimpleToken);
7522
+ var isException = (word) => Object.keys(PLURAL_EXCEPTIONS2).includes(word);
7523
+ function endingIn(word, postfix) {
7524
+ switch (postfix) {
7525
+ case "is":
7526
+ return word.endsWith(postfix) ? `${word}es` : void 0;
7527
+ case "singular-noun":
7528
+ return SINGULAR_NOUN_ENDINGS2.some((i) => word.endsWith(i)) ? split(word).every((i) => [...ALPHA_CHARS2].includes(i)) ? `${word}es` : void 0 : void 0;
7529
+ case "f":
7530
+ return word.endsWith("f") ? `${stripTrailing(word, "f")}ves` : word.endsWith("fe") ? `${stripTrailing(word, "fe")}ves` : void 0;
7531
+ case "y":
7532
+ return word.endsWith("y") ? `${stripTrailing(word, "y")}ies` : void 0;
7533
+ default:
7534
+ throw new Error(`endingIn received "${postfix}" as a postfix but this ending is not known!`);
7535
+ }
7845
7536
  }
7846
- function isSimpleScalarTokenTuple(val) {
7847
- return isArray(val) && val.length !== 0 && val.every(isSimpleScalarToken);
7537
+ function pluralize(word) {
7538
+ const right = rightWhitespace(word);
7539
+ const w = word.trimEnd();
7540
+ const result2 = isException(w) ? PLURAL_EXCEPTIONS2[w] : endingIn(w, "is") || endingIn(w, "singular-noun") || endingIn(w, "f") || endingIn(w, "y") || `${w}s`;
7541
+ return `${result2}${right}`;
7848
7542
  }
7849
- function isSimpleContainerTokenTuple(val) {
7850
- return isArray(val) && val.length !== 0 && val.every(isSimpleContainerToken);
7543
+ function retainAfter(content, ...find2) {
7544
+ const idx = Math.min(
7545
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
7546
+ );
7547
+ const min = Math.min(...find2.map((i) => i.length));
7548
+ let len = Math.max(...find2.map((i) => i.length));
7549
+ if (min !== len) {
7550
+ if (!find2.includes(content.slice(idx, len))) {
7551
+ len = min;
7552
+ }
7553
+ }
7554
+ return idx && idx > 0 ? content.slice(idx + len) : "";
7851
7555
  }
7852
- function isDefineObject(val) {
7853
- return isObject(val) && Object.keys(val).some(
7854
- (key) => isSimpleToken(val[key]) || isShapeToken(val) || isShapeCallback(val)
7556
+ function retainAfterInclusive(content, ...find2) {
7557
+ const minFound = Math.min(
7558
+ ...find2.map((i) => content.indexOf(i)).filter((i) => i > -1)
7855
7559
  );
7560
+ return minFound > 0 ? content.slice(minFound) : "";
7856
7561
  }
7857
- function isFnBasedToken(val) {
7858
- if (isString(val) && val.startsWith(TT_START2) && val.endsWith(TT_STOP2)) {
7859
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
7860
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
7861
- }
7562
+ function retainChars(content, ...retain2) {
7563
+ const chars = asChars(content);
7564
+ return chars.filter((c) => retain2.includes(c)).join("");
7862
7565
  }
7863
- function isFnBasedKind(val) {
7864
- if (isString(val) && isTypeTokenKind(val)) {
7865
- const stripped = stripSurround(TT_START2, TT_STOP2)(val);
7866
- return TT_FUNCTIONS2.some((i) => stripped.startsWith(i));
7566
+ function retainUntil(content, ...find2) {
7567
+ const chars = asChars(content);
7568
+ let idx = 0;
7569
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
7570
+ idx = idx + 1;
7867
7571
  }
7868
- return false;
7572
+ return idx === 0 ? "" : content.slice(0, idx);
7869
7573
  }
7870
- function isSetBasedToken(val) {
7871
- if (isTypeToken(val)) {
7872
- const kind = getTokenKind(val);
7873
- return kind.endsWith(`-set`);
7574
+ function retainUntilInclusive(content, ...find2) {
7575
+ const chars = asChars(content);
7576
+ let idx = 0;
7577
+ while (!find2.includes(chars[idx]) && idx <= chars.length) {
7578
+ idx = idx + 1;
7874
7579
  }
7875
- return false;
7876
- }
7877
- function isSetBasedKind(val) {
7878
- return isString(val) && val.endsWith(`-set`);
7879
- }
7880
- function isSingletonKind(val) {
7881
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7882
- }
7883
- function isSingletonToken(val) {
7884
- return isString(val) && TT_SINGLETONS2.some((i) => val.startsWith(`<<${i}`));
7885
- }
7886
- function isTailwindColorName(val) {
7887
- return isString(val) && Object.keys(TW_HUE2).includes(val);
7888
- }
7889
- function isTailwindColorWithLuminosity(val) {
7890
- return isString(val) && isTailwindColorName(val.split("-")[0]) && (!["white", "black"].includes(val.split("-")[0]) || val.split("-").length === 1) && (!val.includes("-") || Object.keys(TW_LUMINOSITY2).includes(retainAfter(val, "-")));
7891
- }
7892
- function isTailwindColorWithLuminosityAndOpacity(val) {
7893
- return isString(val) && val.includes("/") && isTailwindColorWithLuminosity(val.split("/")[0]) && isNumberLike(val.split("/")[1]) && ([1, 2].includes(val.split("/")[1].length) || val.split("/")[1] === "100");
7580
+ return idx === 0 ? content.slice(0, 1) : content.slice(0, idx + 1);
7894
7581
  }
7895
- function isTailwindColor(val) {
7896
- return isTailwindColorWithLuminosity(val) || isTailwindColorWithLuminosityAndOpacity(val);
7582
+ function retainWhile(content, ...retain2) {
7583
+ const stopIdx = asChars(content).findIndex((c) => !retain2.includes(c));
7584
+ return content.slice(0, stopIdx);
7897
7585
  }
7898
- function isTailwindModifier(val) {
7899
- return isString(val) && TW_MODIFIERS2.includes(val);
7586
+ function rightWhitespace(content) {
7587
+ const trimmed = content.trimStart();
7588
+ return retainAfterInclusive(
7589
+ trimmed,
7590
+ ...WHITESPACE_CHARS2
7591
+ );
7900
7592
  }
7901
- function isTailwindColorTarget(val) {
7902
- return isString(val) && TW_COLOR_TARGETS2.includes(val);
7593
+ function split(str, sep = "") {
7594
+ return str.split(sep);
7903
7595
  }
7904
- function isTailwindColorClass(val, ...allowedModifiers) {
7905
- if (isString(val)) {
7906
- const mods = getTailwindModifiers(val);
7907
- const targetted = removeTailwindModifiers(val);
7908
- const target = targetted.split("-")[0];
7909
- const color = targetted.split("-").slice(1).join("-");
7910
- return isTailwindColorTarget(target) && isTailwindColor(color) && (allowedModifiers[0] === true || mods.every((i) => allowedModifiers.includes(i)));
7911
- }
7912
- return false;
7596
+ function stripAfter(content, find2) {
7597
+ return content.split(find2).shift();
7913
7598
  }
7914
- var URL = AUSTRALIAN_NEWS2.flatMap((i) => i.baseUrls);
7915
- function isAustralianNewsUrl(val) {
7916
- return isString(val) && val.startsWith("https://") && (URL.includes(val) || URL.some((i) => i.startsWith(`${i}/`)));
7599
+ function stripBefore(content, find2) {
7600
+ return content.split(find2).slice(1).join(find2);
7917
7601
  }
7918
- var URL2 = BELGIUM_NEWS2.flatMap((i) => i.baseUrls);
7919
- function isBelgiumNewsUrl(val) {
7920
- return isString(val) && val.startsWith("https://") && (URL2.includes(val) || URL2.some((i) => i.startsWith(`${i}/`)));
7602
+ function stripChars(content, ...strip2) {
7603
+ const chars = asChars(content);
7604
+ return chars.filter((c) => !strip2.includes(c)).join("");
7921
7605
  }
7922
- var URL3 = CANADIAN_NEWS2.flatMap((i) => i.baseUrls);
7923
- function isCanadianNewsUrl(val) {
7924
- return isString(val) && val.startsWith("https://") && (URL3.includes(val) || URL3.some((i) => i.startsWith(`${i}/`)));
7606
+ function stripLeading(content, ...strip2) {
7607
+ if (isUndefined(content)) {
7608
+ return void 0;
7609
+ }
7610
+ let output = String(content);
7611
+ for (const s of strip2) {
7612
+ if (output.startsWith(String(s))) {
7613
+ output = output.slice(String(s).length);
7614
+ }
7615
+ }
7616
+ return isNumber(content) ? Number(output) : output;
7925
7617
  }
7926
- var URL4 = DANISH_NEWS2.flatMap((i) => i.baseUrls);
7927
- function isDanishNewsUrl(val) {
7928
- return isString(val) && val.startsWith("https://") && (URL4.includes(val) || URL4.some((i) => i.startsWith(`${i}/`)));
7618
+ function stripSurround(...chars) {
7619
+ return (input) => {
7620
+ let output = String(input);
7621
+ for (const s of chars) {
7622
+ if (output.startsWith(String(s))) {
7623
+ output = output.slice(String(s).length);
7624
+ }
7625
+ if (output.endsWith(String(s))) {
7626
+ output = output.slice(0, -1 * String(s).length);
7627
+ }
7628
+ }
7629
+ return isNumber(input) ? Number(output) : output;
7630
+ };
7929
7631
  }
7930
- var URL5 = DUTCH_NEWS2.flatMap((i) => i.baseUrls);
7931
- function isDutchNewsUrl(val) {
7932
- return isString(val) && val.startsWith("https://") && (URL5.includes(val) || URL5.some((i) => i.startsWith(`${i}/`)));
7632
+ function stripTrailing(content, ...strip2) {
7633
+ if (isUndefined(content)) {
7634
+ return void 0;
7635
+ }
7636
+ let output = String(content);
7637
+ for (const s of strip2) {
7638
+ if (output.endsWith(String(s))) {
7639
+ output = output.slice(0, -1 * String(s).length);
7640
+ }
7641
+ }
7642
+ return isNumber(content) ? Number(output) : output;
7933
7643
  }
7934
- var URL6 = FRENCH_NEWS2.flatMap((i) => i.baseUrls);
7935
- function isFrenchNewsUrl(val) {
7936
- return isString(val) && val.startsWith("https://") && (URL6.includes(val) || URL6.some((i) => i.startsWith(`${i}/`)));
7644
+ function stripUntil(content, ...until) {
7645
+ const stopIdx = asChars(content).findIndex((c) => until.includes(c));
7646
+ return content.slice(stopIdx);
7937
7647
  }
7938
- var URL7 = GERMAN_NEWS2.flatMap((i) => i.baseUrls);
7939
- function isGermanNewsUrl(val) {
7940
- return isString(val) && val.startsWith("https://") && (URL7.includes(val) || URL7.some((i) => i.startsWith(`${i}/`)));
7648
+ function stripWhile(content, ...match) {
7649
+ const stopIdx = asChars(content).findIndex((c) => !match.includes(c));
7650
+ return content.slice(stopIdx);
7941
7651
  }
7942
- var URL8 = INDIAN_NEWS2.flatMap((i) => i.baseUrls);
7943
- function isIndianNewsUrl(val) {
7944
- return isString(val) && val.startsWith("https://") && (URL8.includes(val) || URL8.some((i) => i.startsWith(`${i}/`)));
7652
+ function surround(prefix, postfix) {
7653
+ return (input) => `${prefix}${input}${postfix}`;
7945
7654
  }
7946
- var URL9 = ITALIAN_NEWS2.flatMap((i) => i.baseUrls);
7947
- function isItalianNewsUrl(val) {
7948
- return isString(val) && val.startsWith("https://") && (URL9.includes(val) || URL9.some((i) => i.startsWith(`${i}/`)));
7655
+ function takeNumericCharacters(content) {
7656
+ const nonNumericIdx = asChars(content).findIndex((i) => !NUMERIC_CHAR2.includes(i));
7657
+ return content.slice(0, nonNumericIdx);
7949
7658
  }
7950
- var URL10 = JAPANESE_NEWS2.flatMap((i) => i.baseUrls);
7951
- function isJapaneseNewsUrl(val) {
7952
- return isString(val) && val.startsWith("https://") && (URL10.includes(val) || URL10.some((i) => i.startsWith(`${i}/`)));
7659
+ function toCamelCase(input, preserveWhitespace) {
7660
+ const pascal = preserveWhitespace ? toPascalCase(input, preserveWhitespace) : toPascalCase(input);
7661
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
7662
+ pascal
7663
+ );
7664
+ const camel = (preserveWhitespace ? preWhite : "") + focus.replace(/^.*?(\d*[a-z|])/is, (_2, p1) => p1.toLowerCase()) + (preserveWhitespace ? postWhite : "");
7665
+ return camel;
7953
7666
  }
7954
- var URL11 = MEXICAN_NEWS2.flatMap((i) => i.baseUrls);
7955
- function isMexicanNewsUrl(val) {
7956
- return isString(val) && val.startsWith("https://") && (URL11.includes(val) || URL11.some((i) => i.startsWith(`${i}/`)));
7667
+ function toKebabCase(input, _preserveWhitespace = false) {
7668
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
7669
+ const replaceWhitespace = (i) => i.replace(/\s/g, "-");
7670
+ const replaceUppercase = (i) => i.replace(/[A-Z]/g, (c) => `-${c[0].toLowerCase()}`);
7671
+ const replaceLeadingDash = (i) => i.replace(/^-/, "");
7672
+ const replaceTrailingDash = (i) => i.replace(/-$/, "");
7673
+ const replaceUnderscore = (i) => i.replace(/_/g, "-");
7674
+ const removeDupDashes = (i) => i.replace(/-+/g, "-");
7675
+ return removeDupDashes(`${preWhite}${replaceUnderscore(
7676
+ replaceTrailingDash(
7677
+ replaceLeadingDash(removeDupDashes(replaceWhitespace(replaceUppercase(focus))))
7678
+ )
7679
+ )}${postWhite}`);
7957
7680
  }
7958
- var URL12 = NORWEGIAN_NEWS2.flatMap((i) => i.baseUrls);
7959
- function isNorwegianNewsUrl(val) {
7960
- return isString(val) && val.startsWith("https://") && (URL12.includes(val) || URL12.some((i) => i.startsWith(`${i}/`)));
7681
+ function toNumericArray(arr) {
7682
+ return arr.map((i) => Number(i));
7961
7683
  }
7962
- var URL13 = SOUTH_KOREAN_NEWS2.flatMap((i) => i.baseUrls);
7963
- function isSouthKoreanNewsUrl(val) {
7964
- return isString(val) && val.startsWith("https://") && (URL13.includes(val) || URL13.some((i) => i.startsWith(`${i}/`)));
7684
+ function toPascalCase(input, preserveWhitespace = void 0) {
7685
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(
7686
+ input
7687
+ );
7688
+ const convertInteriorToCap = (i) => i.replace(/[ |_\-]+(\d*[a-z|])/gi, (_2, p1) => p1.toUpperCase());
7689
+ const startingToCap = (i) => i.replace(/^[_|-]*(\d*[a-z])/g, (_2, p1) => p1.toUpperCase());
7690
+ const replaceLeadingTrash = (i) => i.replace(/^[-_]/, "");
7691
+ const replaceTrailingTrash = (i) => i.replace(/[-_]$/, "");
7692
+ const pascal = `${preserveWhitespace ? preWhite : ""}${capitalize(
7693
+ replaceTrailingTrash(replaceLeadingTrash(convertInteriorToCap(startingToCap(focus))))
7694
+ )}${preserveWhitespace ? postWhite : ""}`;
7695
+ return pascal;
7965
7696
  }
7966
- var URL14 = SPANISH_NEWS2.flatMap((i) => i.baseUrls);
7967
- function isSpanishNewsUrl(val) {
7968
- return isString(val) && val.startsWith("https://") && (URL14.includes(val) || URL14.some((i) => i.startsWith(`${i}/`)));
7697
+ function toSnakeCase(input, preserveWhitespace = false) {
7698
+ const [_, preWhite, focus, postWhite] = /^(\s*)(.*?)(\s*)$/.exec(input);
7699
+ const convertInteriorSpace = (input2) => input2.replace(/\s+/g, "_");
7700
+ const convertDashes = (input2) => input2.replace(/-/g, "_");
7701
+ const injectUnderscoreBeforeCaps = (input2) => input2.replace(/([A-Z])/g, "_$1");
7702
+ const removeLeadingUnderscore = (input2) => input2.startsWith("_") ? input2.slice(1) : input2;
7703
+ return ((preserveWhitespace ? preWhite : "") + removeLeadingUnderscore(
7704
+ injectUnderscoreBeforeCaps(convertDashes(convertInteriorSpace(focus)))
7705
+ ).toLowerCase() + (preserveWhitespace ? postWhite : "")).replace(/__/g, "_");
7969
7706
  }
7970
- var URL15 = SWISS_NEWS2.flatMap((i) => i.baseUrls);
7971
- function isSwissNewsUrl(val) {
7972
- return isString(val) && val.startsWith("https://") && (URL15.includes(val) || URL15.some((i) => i.startsWith(`${i}/`)));
7707
+ function toString(val) {
7708
+ return String(val);
7973
7709
  }
7974
- var URL16 = TURKISH_NEWS2.flatMap((i) => i.baseUrls);
7975
- function isTurkishNewsUrl(val) {
7976
- return isString(val) && val.startsWith("https://") && (URL16.includes(val) || URL16.some((i) => i.startsWith(`${i}/`)));
7710
+ function toUppercase(str) {
7711
+ return str.split("").map((i) => ifLowercaseChar(i, (v) => capitalize(v), (v) => v)).join("");
7977
7712
  }
7978
- var URL17 = UK_NEWS2.flatMap((i) => i.baseUrls);
7979
- function isUkNewsUrl(val) {
7980
- return isString(val) && val.startsWith("https://") && (URL17.includes(val) || URL17.some((i) => i.startsWith(`${i}/`)));
7713
+ function trim(input) {
7714
+ return input.trim();
7981
7715
  }
7982
- var URL18 = US_NEWS2.flatMap((i) => i.baseUrls);
7983
- function isUsNewsUrl(val) {
7984
- return isString(val) && val.startsWith("https://") && (URL18.includes(val) || URL18.some((i) => i.startsWith(`${i}/`)));
7716
+ function trimLeft(input) {
7717
+ return input.trimStart();
7985
7718
  }
7986
- var URL19 = CHINESE_NEWS2.flatMap((i) => i.baseUrls);
7987
- function isChineseNewsUrl(val) {
7988
- return isString(val) && val.startsWith("https://") && (URL19.includes(val) || URL19.some((i) => i.startsWith(`${i}/`)));
7719
+ function trimStart(input) {
7720
+ return input.trimStart();
7989
7721
  }
7990
- function isNewsUrl(val) {
7991
- 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);
7722
+ function trimRight(input) {
7723
+ return input.trimEnd();
7992
7724
  }
7993
- function isBitbucketUrl(val) {
7994
- const valid2 = REPO_SOURCE_LOOKUP2.bitbucket;
7995
- return isString(val) && valid2.some(
7996
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
7997
- );
7725
+ function trimEnd(input) {
7726
+ return input.trimEnd();
7998
7727
  }
7999
- function isCodeCommitUrl(val) {
8000
- const valid2 = REPO_SOURCE_LOOKUP2.codecommit;
8001
- return isString(val) && valid2.some(
8002
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
8003
- );
7728
+ function truncate(content, maxLength, ellipsis = false) {
7729
+ const overLimit = content.length > maxLength;
7730
+ return overLimit ? ellipsis ? `${content.slice(0, maxLength)}${typeof ellipsis === "string" ? ellipsis : "..."}` : content.slice(0, maxLength) : content;
8004
7731
  }
8005
- function isGithubUrl(val) {
8006
- const valid2 = [
8007
- "https://github.com",
8008
- "https://www.github.com",
8009
- "https://github.io"
8010
- ];
8011
- return isString(val) && valid2.some(
8012
- (i) => val === i || val.startsWith(`${i}/`) || val.startsWith(`${i}?`)
8013
- );
7732
+ function tuple(...values) {
7733
+ const arr = values.length === 1 ? values[0] : values;
7734
+ return asArray(arr);
8014
7735
  }
8015
- function isGithubOrgUrl(val) {
8016
- return isString(val) && (val.startsWith("https://github.com/") && stripper(val).length === 2);
7736
+ function uncapitalize(str) {
7737
+ return `${str?.slice(0, 1).toLowerCase()}${str?.slice(1)}`;
8017
7738
  }
8018
- function stripper(s) {
8019
- return stripTrailing(
8020
- stripLeading(s, "https://github.com/"),
8021
- "/"
8022
- );
7739
+ var unset = "<<unset>>";
7740
+ function uppercase(str) {
7741
+ return str.toUpperCase();
8023
7742
  }
8024
- function isGithubRepoUrl(val) {
8025
- return !!(isString(val) && (val.startsWith("https://github.com/") && stripper(val).split("/").length === 2));
7743
+ function widen(value) {
7744
+ return value;
8026
7745
  }
8027
- function isGithubRepoReleasesUrl(val) {
8028
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases") && stripper(val).split("/").length === 3);
7746
+ var PROTOCOLS = Object.values(NETWORK_PROTOCOL_LOOKUP2).flat().filter((i) => i !== "");
7747
+ function getUrlProtocol(url) {
7748
+ const proto = PROTOCOLS.find((p) => url.startsWith(`${p}://`));
7749
+ return proto;
8029
7750
  }
8030
- function isGithubRepoReleaseTagUrl(val) {
8031
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).length === 4);
7751
+ function removeUrlProtocol(url) {
7752
+ return stripBefore(url, "://");
8032
7753
  }
8033
- function isGithubIssuesListUrl(val) {
8034
- return isString(val) && val.startsWith("https://github.com/") && val.includes("/issues");
7754
+ function ensurePath(val) {
7755
+ const val2 = ensureLeading(val, "/");
7756
+ return val === "" ? "" : stripTrailing(val2, "/");
8035
7757
  }
8036
- function isGithubIssueUrl(val) {
8037
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/issues/"));
7758
+ function getUrlPath(url) {
7759
+ return isUrl(url) ? ensurePath(
7760
+ stripAfter(stripBefore(removeUrlProtocol(url), "/"), "?")
7761
+ ) : Never2;
8038
7762
  }
8039
- function isGithubProjectsListUrl(val) {
8040
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/projects?") || val.trim().endsWith("/projects")) && stripper(val).split("/").length === 3);
7763
+ function getUrlQueryParams(url, specific = void 0) {
7764
+ const qp = stripBefore(url, "?");
7765
+ if (specific) {
7766
+ return qp.includes(`${specific}=`) ? decodeURIComponent(
7767
+ stripAfter(
7768
+ stripBefore(qp, `${specific}=`),
7769
+ "&"
7770
+ ).replace(/\+/g, "%20")
7771
+ ) : void 0;
7772
+ }
7773
+ return qp === "" ? qp : `?${qp}`;
8041
7774
  }
8042
- function isGithubProjectUrl(val) {
8043
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/projects/") && stripper(val).split("/").length === 4);
7775
+ function getUrlDefaultPort(url) {
7776
+ const proto = getUrlProtocol(url);
7777
+ return proto in PROTOCOL_DEFAULT_PORTS2 ? PROTOCOL_DEFAULT_PORTS2[proto] : null;
8044
7778
  }
8045
- function isGithubReleasesListUrl(val) {
8046
- return isString(val) && (val.startsWith("https://github.com/") && (val.includes("/releases?") || val.trim().endsWith("/releases")) && stripper(val).split("/").length === 3);
7779
+ function getUrlPort(url, resolve = false) {
7780
+ const re = /.*:(\d{2,3})/;
7781
+ const match = url.match(re);
7782
+ return re.test(url) && match && isNumberLike(Array.from(match)[1]) ? Number(Array.from(match)[1]) : resolve ? getUrlDefaultPort(url) : hasProtocol(url) ? `default` : null;
8047
7783
  }
8048
- function isGithubReleaseTagUrl(val) {
8049
- return isString(val) && (val.startsWith("https://github.com/") && val.includes("/releases/tag/") && stripper(val).split("/").length === 5);
7784
+ function getUrlSource(url) {
7785
+ const candidate = stripAfter(stripAfter(stripAfter(removeUrlProtocol(url), "/"), "?"), ":");
7786
+ return isIpAddress(candidate) || isDomainName(candidate) ? candidate : Never2;
8050
7787
  }
8051
- function isRepoSource(v) {
8052
- return isString(v) && REPO_SOURCES2.includes(v);
7788
+ function getUrlBase(url) {
7789
+ const path = getUrlPath(url);
7790
+ const remaining = stripAfter(url, path);
7791
+ return remaining;
8053
7792
  }
8054
- function isSemanticVersion(v, allowPrefix = false) {
8055
- return isString(v) && v.split(".").length === 3 && !Number.isNaN(Number(v.split(".")[1])) && !Number.isNaN(Number(v.split(".")[2])) && (!Number.isNaN(Number(v.split(".")[0])) || allowPrefix && !Number.isNaN(Number(stripLeading(v.split(".")[0], "v").trim())));
7793
+ function getUrlDynamics(url) {
7794
+ const path = getUrlPath(url);
7795
+ const qp = getUrlQueryParams(url);
7796
+ const pathParts = path.startsWith("<") ? path.split("<").map((i) => ensureLeading(i, "<")) : path.split("<").map((i) => ensureLeading(i, "<")).slice(1);
7797
+ const segmentTypes = [
7798
+ "string",
7799
+ "number",
7800
+ "boolean",
7801
+ "Opt<string>",
7802
+ "Opt<number>",
7803
+ "Opt<boolean>"
7804
+ ];
7805
+ const pathVars = {};
7806
+ const findPathTyped = infer(`<{{infer name}} as {{infer type}}>`);
7807
+ const findPathUnion = infer(`<{{infer name}} as string({{infer union}})>`);
7808
+ const findPathNamed = infer(`<{{infer name}}>`);
7809
+ for (const part of pathParts) {
7810
+ const union4 = findPathUnion(part);
7811
+ const typed = findPathTyped(part);
7812
+ const named = findPathNamed(part);
7813
+ if (union4) {
7814
+ if (isVariable(union4.name) && isCsv(union4.union)) {
7815
+ pathVars[union4.name] = `string(${union4.union})`;
7816
+ }
7817
+ } else if (typed && segmentTypes.includes(typed.type) && isVariable(typed.name)) {
7818
+ pathVars[typed.name] = typed.type;
7819
+ } else if (named && isVariable(named.name)) {
7820
+ pathVars[named.name] = "string";
7821
+ }
7822
+ }
7823
+ const qpVars = {};
7824
+ const qpParts = stripLeading(qp, "?").split("&");
7825
+ for (const p of qpParts) {
7826
+ const union4 = infer(`{{infer var}}=<string({{infer params}})>`)(p);
7827
+ const dynamic = infer(`{{infer var}}=<{{infer val}}>`)(p);
7828
+ const fixed = infer(`{{infer var}}={{infer val}}`)(p);
7829
+ if (union4 && isVariable(union4.var) && isCsv(union4.params)) {
7830
+ qpVars[union4.var] = `string(${union4.params})`;
7831
+ } else if (dynamic && isVariable(dynamic.var) && segmentTypes.includes(dynamic.val)) {
7832
+ qpVars[dynamic.var] = dynamic.val;
7833
+ } else if (fixed && isVariable(fixed.var)) {
7834
+ qpVars[fixed.var] = fixed.val;
7835
+ }
7836
+ }
7837
+ return {
7838
+ pathVars,
7839
+ qpVars,
7840
+ allVars: hasOverlappingKeys(pathVars, qpVars) ? null : {
7841
+ ...pathVars,
7842
+ ...qpVars
7843
+ }
7844
+ };
8056
7845
  }
8057
- function isRepoUrl(val) {
8058
- return isGithubUrl(val) || isBitbucketUrl(val) || isCodeCommitUrl(val);
7846
+ function urlMeta(url) {
7847
+ return {
7848
+ url,
7849
+ isUrl: isUrl(url),
7850
+ protocol: getUrlProtocol(url),
7851
+ path: getUrlPath(url),
7852
+ queryParameters: getUrlQueryParams(url),
7853
+ params: getUrlDynamics,
7854
+ port: getUrlPort(url),
7855
+ source: getUrlSource(url),
7856
+ isIpAddress: isIpAddress(getUrlSource(url)),
7857
+ isIp4Address: isIp4Address(getUrlSource(url)),
7858
+ isIp6Address: isIp6Address(getUrlSource(url))
7859
+ };
8059
7860
  }
8060
- function isWholeFoodsUrl(val) {
8061
- return isString(val) && WHOLE_FOODS_DNS2.some((i) => val.startsWith(`https://${i}`));
7861
+ function getYouTubePageType(url) {
7862
+ return isYouTubeUrl(url) ? isYouTubeVideoUrl(url) && (hasUrlQueryParameter(url, "v") || isYouTubeShareUrl(url)) ? hasUrlQueryParameter(url, "list") ? isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::in-list::share-link::with-timestamp` : `play::video::in-list::share-link` : `play::video::in-list` : isYouTubeShareUrl(url) ? hasUrlQueryParameter(url, "t") ? `play::video::solo::share-link::with-timestamp` : `play::video::solo::share-link` : `play::video::solo` : isYouTubeCreatorUrl(url) ? getUrlPath(url).includes("/videos") ? "creator::videos" : getUrlPath(url).includes("/playlists") ? "creator::playlists" : last(getUrlPath(url).split("/")).startsWith("@") || getUrlPath(url).includes("/featured") ? "creator::featured" : "creator::other" : isYouTubeFeedUrl(url) ? isYouTubeFeedUrl(url, "history") ? "feed::history" : isYouTubeFeedUrl(url, "playlists") ? "feed::playlists" : isYouTubeFeedUrl(url, "liked") ? "feed::liked" : isYouTubeFeedUrl(url, "subscriptions") ? "feed::subscriptions" : isYouTubeFeedUrl(url, "trending") ? "feed::trending" : "feed::other" : isYouTubeVideosInPlaylist(url) ? "playlist::show" : "other" : Never2;
8062
7863
  }
8063
- function isCvsUrl(val) {
8064
- return isString(val) && CVS_DNS2.some((i) => val.startsWith(`https://${i}`));
7864
+ function youtubeEmbed(url) {
7865
+ if (hasUrlQueryParameter(url, "v")) {
7866
+ const id = getUrlQueryParams(url, "v");
7867
+ return `https://www.youtube.com/embed/${id}`;
7868
+ } else if (isYouTubeShareUrl(url)) {
7869
+ const id = url.split("/").pop();
7870
+ if (id) {
7871
+ return `https://www.youtube.com/embed/${id}`;
7872
+ } else {
7873
+ throw new Error(`Unexpected problem parsing share URL -- "${url}" -- into a YouTube embed URL`);
7874
+ }
7875
+ } else {
7876
+ throw new Error(`Unexpected URL structure; unable to convert "${url}" to a YouTube embed URL`);
7877
+ }
8065
7878
  }
8066
- function isWalgreensUrl(val) {
8067
- return isString(val) && WALGREENS_DNS2.some((i) => val.startsWith(`https://${i}`));
7879
+ function youtubeMeta(url) {
7880
+ return isYouTubeUrl(url) ? {
7881
+ url,
7882
+ isYouTubeUrl: true,
7883
+ isShareUrl: isYouTubeShareUrl(url),
7884
+ pageType: getYouTubePageType(url)
7885
+ } : {
7886
+ url,
7887
+ isYouTubeUrl: false
7888
+ };
8068
7889
  }
8069
- function isKrogersUrl(val) {
8070
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7890
+ function queue(state) {
7891
+ return {
7892
+ queue: state,
7893
+ size: state.length,
7894
+ isEmpty() {
7895
+ return state.length === 0;
7896
+ },
7897
+ clear() {
7898
+ state.slice(0, 0);
7899
+ },
7900
+ drain() {
7901
+ const old_state = [...state];
7902
+ state.slice(0, 0);
7903
+ return old_state;
7904
+ },
7905
+ push(...add) {
7906
+ state.push(...add);
7907
+ },
7908
+ drop(quantity) {
7909
+ if (quantity && quantity > state.length) {
7910
+ throw new Error("Cannot drop more elements than present in the queue");
7911
+ }
7912
+ state.splice(0, quantity || 1);
7913
+ },
7914
+ take(quantity) {
7915
+ if (quantity && quantity > state.length) {
7916
+ throw new Error("Cannot take more elements than present in the queue");
7917
+ }
7918
+ const result2 = state.slice(0, quantity || 1);
7919
+ state.splice(0, quantity || 1);
7920
+ return result2;
7921
+ },
7922
+ *[Symbol.iterator]() {
7923
+ for (let i = 0; i < state.length; i++) {
7924
+ yield state[i];
7925
+ }
7926
+ }
7927
+ };
8071
7928
  }
8072
- function isZaraUrl(val) {
8073
- return isString(val) && ZARA_DNS2.some((i) => val.startsWith(`https://${i}`));
7929
+ function createFifoQueue(...list2) {
7930
+ return queue([...list2]);
8074
7931
  }
8075
- function isHmUrl(val) {
8076
- return isString(val) && HM_DNS2.some((i) => val.startsWith(`https://${i}`));
7932
+ function queue2(state) {
7933
+ return {
7934
+ queue: state,
7935
+ size: state.length,
7936
+ isEmpty() {
7937
+ return state.length === 0;
7938
+ },
7939
+ push(...add) {
7940
+ state.push(...add);
7941
+ },
7942
+ drop(quantity) {
7943
+ state.splice(-quantity);
7944
+ },
7945
+ clear() {
7946
+ state.slice(0, 0);
7947
+ },
7948
+ drain() {
7949
+ const old_state = [...state];
7950
+ state.slice(0, 0);
7951
+ return old_state;
7952
+ },
7953
+ take(quantity) {
7954
+ const result2 = state.slice(-quantity);
7955
+ state.splice(-quantity);
7956
+ return result2;
7957
+ },
7958
+ *[Symbol.iterator]() {
7959
+ for (let i = state.length - 1; i >= 0; i--) {
7960
+ yield state[i];
7961
+ }
7962
+ }
7963
+ };
8077
7964
  }
8078
- function isDellUrl(val) {
8079
- return isString(val) && DELL_DNS2.some((i) => val.startsWith(`https://${i}`));
7965
+ function createLifoQueue(...list2) {
7966
+ return queue2([...list2]);
8080
7967
  }
8081
- function isIkeaUrl(val) {
8082
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7968
+ var scalarToToken = identity({
7969
+ string: "<<string>>",
7970
+ number: "<<number>>",
7971
+ boolean: "<<boolean>>",
7972
+ true: "<<true>>",
7973
+ false: "<<false>>",
7974
+ null: "<<null>>",
7975
+ undefined: "<<undefined>>",
7976
+ unknown: "<<unknown>>",
7977
+ any: "<<any>>",
7978
+ never: "<<never>>"
7979
+ });
7980
+ function stringLiteral(str) {
7981
+ return stripAfter(stripBefore(str, "string("), ")");
8083
7982
  }
8084
- function isLowesUrl(val) {
8085
- return isString(val) && KROGER_DNS2.some((i) => val.startsWith(`https://${i}`));
7983
+ function numericLiteral(str) {
7984
+ return stripAfter(stripBefore(str, "number("), ")");
8086
7985
  }
8087
- function isNikeUrl(val) {
8088
- return isString(val) && NIKE_DNS2.some((i) => val.startsWith(`https://${i}`));
7986
+ function handleOptional(token) {
7987
+ const bare = stripTrailing(stripLeading(token, "Opt<"), ">");
7988
+ return bare.startsWith("string") ? `<<union::[ <<string>>, <<undefined>> ]>>` : bare.startsWith("number") ? `<<union::[ <<number>>, <<undefined>> ]>>` : bare.startsWith("boolean") ? `<<union::[ <<boolean>>, <<undefined>> ]>>` : bare.startsWith("unknown") ? `<<union::[ <<unknown>>, <<undefined>> ]>>` : `<<never>>`;
8089
7989
  }
8090
- function isWayfairUrl(val) {
8091
- return isString(val) && WAYFAIR_DNS2.some((i) => val.startsWith(`https://${i}`));
7990
+ function simpleScalarTokenToTypeToken(val) {
7991
+ return val in scalarToToken ? scalarToToken[val] : val.startsWith("string(") ? stringLiteral(val).includes(",") ? `<<union::[ ${stringLiteral(val).split(/,\s?/).map((i) => `"${i}"`).join(", ")} ]>>` : `<<string::${stringLiteral(val)}>>` : val.startsWith("number(") ? numericLiteral(val).includes(",") ? `<<union::[ ${numericLiteral(val).split(/,\s?/).join(", ")} ]>>` : `<<number::${numericLiteral(val)}>>` : val.startsWith("Opt<") ? handleOptional(val) : `<<never>>`;
8092
7992
  }
8093
- function isBestBuyUrl(val) {
8094
- return isString(val) && BEST_BUY_DNS2.some((i) => val.startsWith(`https://${i}`));
7993
+ function unionNode(node) {
7994
+ return isNumberLike(node) ? `<<number::${node}>>` : isBooleanLike(node) ? `<<${node}>>` : isSimpleContainerToken(node) ? simpleContainerTokenToTypeToken(node) : isSimpleScalarToken(node) ? simpleScalarToken(node) : `<<string::${node}>>`;
8095
7995
  }
8096
- function isCostCoUrl(val) {
8097
- return isString(val) && COSTCO_DNS2.some((i) => val.startsWith(`https://${i}`));
7996
+ function union2(nodes) {
7997
+ return Array.isArray(nodes) ? nodes.map((n) => unionNode(n)) : nodes.includes(",") ? nodes.split(/,\s?/).map((n) => unionNode(n)).join(", ") : unionNode(nodes);
8098
7998
  }
8099
- function isEtsyUrl(val) {
8100
- return isString(val) && ETSY_DNS2.some((i) => val.startsWith(`https://${i}`));
7999
+ var stripUnion = stripSurround("Union(", ")");
8000
+ function simpleUnionTokenToTypeToken(val) {
8001
+ return val.startsWith(`Union(`) && val.endsWith(`)`) ? `<<union::[ ${union2(stripUnion(val))} ]>>` : Never2;
8101
8002
  }
8102
- function isTargetUrl(val) {
8103
- return isString(val) && TARGET_DNS2.some((i) => val.startsWith(`https://${i}`));
8003
+ function simpleContainerTokenToTypeToken(_val) {
8104
8004
  }
8105
- function isEbayUrl(val) {
8106
- return isString(val) && EBAY_DNS2.some((i) => val.startsWith(`https://${i}`));
8005
+ function asTypeToken(_val) {
8006
+ return "not ready";
8107
8007
  }
8108
- function isHomeDepotUrl(val) {
8109
- return isString(val) && HOME_DEPOT_DNS2.some((i) => val.startsWith(`https://${i}`));
8008
+ function addToken(token, ...params) {
8009
+ return `<<${token}${params.length > 0 ? `::${params.join("::")}` : ""}>>`;
8110
8010
  }
8111
- function isMacysUrl(val) {
8112
- return isString(val) && MACYS_DNS2.some((i) => val.startsWith(`https://${i}`));
8011
+ function boolean(literal2) {
8012
+ return isDefined(literal2) ? isTrue(literal2) ? addToken("true") : isFalse(literal2) ? addToken("false") : addToken("boolean") : addToken("boolean");
8113
8013
  }
8114
- function isAppleUrl(val) {
8115
- return isString(val) && APPLE_DNS2.some((i) => val.startsWith(`https://${i}`));
8014
+ var unknown = () => "<<unknown>>";
8015
+ var undefinedType = () => "<<undefined>>";
8016
+ var nullType = () => "<<null>>";
8017
+ function fn(..._args) {
8018
+ return {
8019
+ returns: (_rtn) => ({
8020
+ addProperties: (_kv) => {
8021
+ return null;
8022
+ },
8023
+ done: () => {
8024
+ return null;
8025
+ }
8026
+ }),
8027
+ done: () => {
8028
+ const result2 = null;
8029
+ return result2;
8030
+ }
8031
+ };
8116
8032
  }
8117
- function isWalmartUrl(val) {
8118
- return isString(val) && WALMART_DNS2.some((i) => val.startsWith(`https://${i}`));
8033
+ function dictionary(_obj) {
8034
+ return null;
8119
8035
  }
8120
- function isAmazonUrl(val) {
8121
- return isString(val) && AMAZON_DNS2.some((i) => val.startsWith(`https://${i}`));
8036
+ function tuple2(..._elements) {
8037
+ return null;
8122
8038
  }
8123
- function isRetailUrl(val) {
8124
- return isAmazonUrl(val) || isWalgreensUrl(val) || isAppleUrl(val) || isMacysUrl(val) || isEbayUrl(val) || isHomeDepotUrl(val) || isTargetUrl(val) || isEtsyUrl(val) || isCostCoUrl(val) || isBestBuyUrl(val) || isWayfairUrl(val) || isNikeUrl(val) || isLowesUrl(val) || isIkeaUrl(val) || isDellUrl(val) || isHmUrl(val) || isZaraUrl(val) || isKrogersUrl(val) || isWalgreensUrl(val) || isCvsUrl(val) || isWholeFoodsUrl(val);
8039
+ function regexToken(re, ...rep) {
8040
+ let exp = "";
8041
+ if (isString(re)) {
8042
+ try {
8043
+ const test = new RegExp(re);
8044
+ if (!isRegExp(test)) {
8045
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
8046
+ err.name = "InvalidRegEx";
8047
+ throw err;
8048
+ } else {
8049
+ exp = re;
8050
+ }
8051
+ } catch {
8052
+ const err = new Error(`Invalid RegEx passed into regexToken(${re}, ${JSON.stringify(rep)})!`);
8053
+ err.name = "InvalidRegEx";
8054
+ throw err;
8055
+ }
8056
+ } else if (isRegExp(re)) {
8057
+ exp = re.toString();
8058
+ }
8059
+ const token = `<<string-set::regexp::${encodeURIComponent(exp)}>>`;
8060
+ return token;
8125
8061
  }
8126
- var URL20 = SOCIAL_MEDIA2.flatMap((i) => i.baseUrls);
8127
- var PROFILE = SOCIAL_MEDIA2.map((i) => i.profileUrl);
8128
- function isSocialMediaUrl(val) {
8129
- return isString(val) && URL20.some((i) => val.startsWith(i));
8062
+ function addSingleton(token, api2) {
8063
+ return (...literals) => {
8064
+ return literals.length === 0 ? api2 || addToken(token) : literals.length === 1 ? addToken(token, literals[0]) : addToken(
8065
+ "union",
8066
+ literals.map((l) => addToken(token, `${l}`)).join(",")
8067
+ );
8068
+ };
8130
8069
  }
8131
- function isSocialMediaProfileUrl(val) {
8132
- return isString(val) && PROFILE.some((i) => i.startsWith(`${i}`));
8070
+ var stringApi = {
8071
+ startsWith: (startsWith2) => addToken(`string-set`, `startsWith::${startsWith2}`),
8072
+ endsWith: (endsWith2) => addToken(`string-set`, `endsWith::${endsWith2}`),
8073
+ zip: () => addToken("string-set", "Zip5"),
8074
+ zipPlus4: () => addToken("string-set", "Zip5_4"),
8075
+ zipCode: () => addToken("string-set", "ZipCode"),
8076
+ militaryTime: (resolution) => {
8077
+ return addToken(
8078
+ "string-set",
8079
+ "militaryTime",
8080
+ resolution || "HH:MM"
8081
+ );
8082
+ },
8083
+ civilianTime: (resolution) => {
8084
+ return addToken(
8085
+ "string-set",
8086
+ "militaryTime",
8087
+ resolution || "HH:MM"
8088
+ );
8089
+ },
8090
+ numericString: () => addToken("string-set", "numeric"),
8091
+ ipv4Address: () => addToken("string-set", "ipv4Address"),
8092
+ ipv6Address: () => addToken("string-set", "ipv6Address"),
8093
+ regex: (exp, ...literalRepresentation) => {
8094
+ const token = regexToken(exp, ...literalRepresentation);
8095
+ return token;
8096
+ },
8097
+ done: () => addToken("string")
8098
+ };
8099
+ var string22 = addSingleton("string", stringApi);
8100
+ var number = addSingleton("number");
8101
+ function union3(...elements) {
8102
+ const result2 = elements.map((_el) => {
8103
+ });
8104
+ return result2;
8133
8105
  }
8134
- function isYouTubeUrl(val) {
8135
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
8106
+ function record(_key, _value) {
8107
+ return null;
8136
8108
  }
8137
- function isYouTubeShareUrl(val) {
8138
- return isString(val) && val.startsWith(`https://youtu.be`);
8109
+ function array(_type) {
8110
+ return null;
8139
8111
  }
8140
- function isYouTubeVideoUrl(val) {
8141
- return isString(val) && (val.startsWith("https://www.youtube.com") || val.startsWith("https://youtube.com") || val.startsWith("https://youtu.be"));
8112
+ function set(_type) {
8113
+ return null;
8142
8114
  }
8143
- function isYouTubePlaylistUrl(val) {
8144
- return isString(val) && (val === `https://www.youtube.com/feed/playlists` || val === `https://youtube.com/feed/playlists` || val === `https://www.youtube.com/channel/playlists` || val === `https://youtube.com/channel/playlists` || val.startsWith(`https://www.youtube.com/@`) && val.endsWith(`/playlists`) || val.startsWith(`https://youtube.com/@`) && val.endsWith(`/playlists`));
8115
+ function map(_key, _value) {
8116
+ return null;
8145
8117
  }
8146
- function feed_map(type) {
8147
- return isUndefined(type) ? `/feed` : type === "liked" ? `/playlist?list=LL` : ["history", "playlists", "trending", "subscriptions"].includes(type) ? `/feed/${type}` : `/feed/`;
8118
+ function weakMap(_key, _value) {
8119
+ return null;
8148
8120
  }
8149
- function isYouTubeFeedUrl(val, type) {
8150
- return isString(val) && (val.startsWith(`https://www.youtube.com${feed_map(type)}`) || val.startsWith(`https://youtube.com${feed_map(type)}`));
8121
+ function isAddOrDone(val) {
8122
+ return isObject(val) && hasKeys("add", "done") && typeof val.done === "function" && typeof val.add === "function";
8151
8123
  }
8152
- function isYouTubeFeedHistoryUrl(val) {
8153
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/history`) || val.startsWith(`https://youtube.com/feed/history`));
8124
+ var ShapeApiImplementation = {
8125
+ string: string22,
8126
+ number,
8127
+ boolean,
8128
+ unknown,
8129
+ undefined: undefinedType,
8130
+ null: nullType,
8131
+ union: union3,
8132
+ fn,
8133
+ record,
8134
+ array,
8135
+ set,
8136
+ map,
8137
+ weakMap,
8138
+ dictionary,
8139
+ tuple: tuple2
8140
+ };
8141
+ function shape(cb) {
8142
+ const rtn = cb(ShapeApiImplementation);
8143
+ return handleDoneFn(
8144
+ isAddOrDone(rtn) ? rtn.done() : rtn
8145
+ );
8154
8146
  }
8155
- function isYouTubePlaylistsUrl(val) {
8156
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/playlists`) || val.startsWith(`https://youtube.com/feed/playlists`));
8147
+ function isShape(v) {
8148
+ return !!(isString(v) && v.startsWith("<<") && v.endsWith(">>") && SHAPE_PREFIXES2.some((i) => v.startsWith(`<<${i}`)));
8157
8149
  }
8158
- function isYouTubeTrendingUrl(val) {
8159
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/trending`) || val.startsWith(`https://youtube.com/feed/trending`));
8150
+ function asDefineObject(defn) {
8151
+ const result2 = Object.keys(defn).reduce(
8152
+ (acc, i) => isSimpleToken(defn[i]) ? { ...acc, [i]: asType(defn[i]) } : isDoneFn(defn[i]) ? {
8153
+ ...acc,
8154
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
8155
+ } : isFunction(defn[i]) ? {
8156
+ ...acc,
8157
+ [i]: handleDoneFn(defn[i](ShapeApiImplementation))
8158
+ } : Never2,
8159
+ {}
8160
+ );
8161
+ return result2;
8160
8162
  }
8161
- function isYouTubeSubscriptionsUrl(val) {
8162
- return isString(val) && (val.startsWith(`https://www.youtube.com/feed/subscriptions`) || val.startsWith(`https://youtube.com/feed/subscriptions`));
8163
+ function asType(...token) {
8164
+ return isFunction(token) ? token(ShapeApiImplementation) : token.length === 1 ? isFunction(token[0]) ? handleDoneFn(token[0](ShapeApiImplementation)) : isDefineObject(token[0]) ? asDefineObject(token[0]) : token[0] : token.map((i) => isFunction(i) ? handleDoneFn(i(ShapeApiImplementation)) : i);
8163
8165
  }
8164
- function isYouTubeCreatorUrl(url) {
8165
- return isString(url) && (url.startsWith(`https://www.youtube.com/@`) || url.startsWith(`https://youtube.com/@`) || url.startsWith(`https://www.youtube.com/channel/`));
8166
+ function asStringLiteral(...values) {
8167
+ return values.map((i) => i);
8166
8168
  }
8167
- function isYouTubeVideosInPlaylist(val) {
8168
- return isString(val) && (val.startsWith(`https://www.youtube.com/playlist?`) || val.startsWith(`https://youtube.com/playlist?`)) && hasUrlQueryParameter(val, "list");
8169
+ var choices = "NOT READY";
8170
+ function doesExtend(type) {
8171
+ return (val) => {
8172
+ let response = false;
8173
+ if (isString(val)) {
8174
+ if (type === "string") {
8175
+ response = true;
8176
+ }
8177
+ if (type.startsWith("string(")) {
8178
+ const literals = stripAfter(
8179
+ stripBefore(type, "string("),
8180
+ ")"
8181
+ ).split(/,\s*/);
8182
+ if (literals.includes(val)) {
8183
+ response = true;
8184
+ }
8185
+ }
8186
+ }
8187
+ if (isNumber(val)) {
8188
+ if (type === "number") {
8189
+ response = true;
8190
+ }
8191
+ if (type.startsWith("number(")) {
8192
+ const literals = stripAfter(
8193
+ stripBefore(type, "number("),
8194
+ ")"
8195
+ ).split(/,\s*/).map(Number);
8196
+ if (literals.includes(val)) {
8197
+ response = true;
8198
+ }
8199
+ }
8200
+ }
8201
+ if (isNull(val) && (type === "null" || type === "Opt<null>")) {
8202
+ response = true;
8203
+ }
8204
+ if (isUndefined(val) && (type === "undefined" || type.startsWith("Opt<"))) {
8205
+ response = true;
8206
+ }
8207
+ if (isBoolean(val)) {
8208
+ if (type === "boolean") {
8209
+ response = true;
8210
+ }
8211
+ if (type === "true" && val === true || type === "false" && val === false) {
8212
+ response = true;
8213
+ }
8214
+ }
8215
+ if (isNarrowableObject(val)) {
8216
+ if (type === "Dict" || type === "Dict<string, unknown>") {
8217
+ response = true;
8218
+ }
8219
+ if (startsWith("Dict<")(type)) {
8220
+ const match = infer("Dict<{{infer key}}, {{infer value}}>")(type);
8221
+ if (match) {
8222
+ const { value } = match;
8223
+ const isOpt = value.includes(`Opt<`);
8224
+ const values = objectValues(val);
8225
+ 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>") {
8226
+ response = true;
8227
+ }
8228
+ }
8229
+ }
8230
+ }
8231
+ if (isArray(val)) {
8232
+ if (type === "Array" || type === "Array<unknown>") {
8233
+ return true;
8234
+ }
8235
+ 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)) {
8236
+ response = true;
8237
+ }
8238
+ }
8239
+ if (isMap(val)) {
8240
+ 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)) {
8241
+ response = true;
8242
+ }
8243
+ }
8244
+ if (isSetContainer(val)) {
8245
+ 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))) {
8246
+ response = true;
8247
+ }
8248
+ }
8249
+ return response;
8250
+ };
8169
8251
  }
8170
- function isVueRef(val) {
8171
- if (isObject(val)) {
8172
- const keys = Object.keys(val);
8173
- return !!["dep", "__v_isRef"].every((i) => keys.includes(i));
8252
+ function ip6Prefix(...groups) {
8253
+ const empty = addToken("string");
8254
+ const count = 4 - groups.length;
8255
+ const fillIn = [];
8256
+ for (let index = 0; index < count; index++) {
8257
+ fillIn.push(empty);
8174
8258
  }
8175
- return false;
8259
+ return [
8260
+ "<<string::",
8261
+ [
8262
+ groups.join(":"),
8263
+ fillIn.join(":")
8264
+ ].join(":"),
8265
+ ">>"
8266
+ ].join("");
8176
8267
  }
8177
- function csv(csv2, format = `string-numeric-tuple`) {
8178
- const tuple3 = [];
8179
- csv2.split(/,\s?/).forEach((v) => {
8180
- tuple3.push(
8181
- 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
8182
- );
8268
+ function createProxy(...initialize) {
8269
+ const state = initialize;
8270
+ state.id = null;
8271
+ const proxy = new Proxy(state, {});
8272
+ Object.defineProperty(proxy, "id", {
8273
+ enumerable: false
8183
8274
  });
8184
- return tuple3;
8185
- }
8186
- function fromKeyValue(kvs) {
8187
- const obj = {};
8188
- for (const kv of kvs) {
8189
- obj[kv.key] = kv.value;
8190
- }
8191
- return obj;
8192
- }
8193
- function intersect(value, _intersectedWith) {
8194
- return value;
8195
- }
8196
- function ip6GroupExpansion(ip) {
8197
- return stripTrailing(ip.replaceAll("::", ":0000:"), ":");
8198
- }
8199
- function jsonValue(val) {
8200
- return isNumberLike(val) ? Number(val) : val === "true" ? true : val === "false" ? false : `"${val}"`;
8201
- }
8202
- function jsonValues(...val) {
8203
- return val.map((i) => jsonValue(i));
8204
- }
8205
- function lookupAlpha2Code(code, prop) {
8206
- const found = ISO3166_12.find((i) => i.alpha2 === code);
8207
- return found ? found[prop] : void 0;
8208
- }
8209
- function lookupAlpha3Code(code, prop) {
8210
- const found = ISO3166_12.find((i) => i.alpha3 === code);
8211
- return found ? found[prop] : void 0;
8212
- }
8213
- function lookupName(name, prop) {
8214
- const found = ISO3166_12.find((i) => i.name === name);
8215
- return found ? found[prop] : void 0;
8216
- }
8217
- function lookupNumericCode(code, prop) {
8218
- let num = isNumber(code) ? `${code}` : code;
8219
- if (num.length === 1) {
8220
- num = `00${num}`;
8221
- } else if (num.length === 2) {
8222
- num = `0${num}`;
8223
- }
8224
- const found = ISO3166_12.find((i) => i.countryCode === num);
8225
- return found ? found[prop] : void 0;
8226
- }
8227
- function lookupCountryName(code) {
8228
- const uc = uppercase(code);
8229
- return isNumberLike(code) ? lookupNumericCode(code, "name") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "name") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "name") : void 0;
8275
+ return proxy;
8230
8276
  }
8231
- function lookupCountryAlpha2(code) {
8232
- const uc = uppercase(code);
8233
- return isNumberLike(code) ? lookupNumericCode(code, "alpha2") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha2") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha2") : isIso3166CountryName(code) ? lookupName(code, "alpha2") : void 0;
8277
+ function list(...init) {
8278
+ return init.length === 1 && isArray(init[0]) ? createProxy(...init[0]) : createProxy(...init);
8234
8279
  }
8235
- function lookupCountryAlpha3(token) {
8236
- const uc = uppercase(token);
8237
- return isNumberLike(token) ? lookupNumericCode(token, "alpha3") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "alpha3") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "alpha3") : isIso3166CountryName(token) ? lookupName(token, "alpha3") : void 0;
8280
+ function singletonApi(kind) {
8281
+ return {
8282
+ wide: () => `<<${kind}>>`,
8283
+ literal: (val) => `<<${kind}::${val}>>`
8284
+ };
8238
8285
  }
8239
- function lookupCountryCode(token) {
8240
- const uc = uppercase(token);
8241
- return isNumberLike(token) ? lookupNumericCode(token, "countryCode") : isIso3166Alpha2(uc) ? lookupAlpha2Code(uc, "countryCode") : isIso3166Alpha3(uc) ? lookupAlpha3Code(uc, "countryCode") : isIso3166CountryName(token) ? lookupName(token, "countryCode") : void 0;
8286
+ function setApi(_variant) {
8287
+ return null;
8242
8288
  }
8243
- function asMapper(fn2) {
8244
- const props = {
8245
- kind: "Mapper",
8246
- map: (from) => {
8247
- return from.map(fn2);
8248
- }
8289
+ function fnReturnsApi(variant, _params, returns) {
8290
+ return isSet(returns) ? null : (_rtn) => {
8291
+ return isSet(returns) ? `<<${variant}::>>` : null;
8249
8292
  };
8250
- return createFnWithPropsExplicit(fn2, props);
8251
8293
  }
8252
- function createObjectMap() {
8253
- return (map2) => {
8254
- const fn2 = (input) => {
8255
- return Object.keys(map2).reduce(
8256
- (acc, key) => {
8257
- const val = map2[key];
8258
- return {
8259
- ...acc,
8260
- [key]: isFunction(val) ? val(input) : val
8261
- };
8262
- },
8263
- {}
8264
- );
8265
- };
8266
- return fn2;
8294
+ function fnParamsApi(variant, params, _returns) {
8295
+ return isSet(params) ? null : (params2) => {
8296
+ return isSet(params2) ? `<<${variant}::>>` : null;
8267
8297
  };
8268
8298
  }
8269
- function createMapper() {
8270
- return (fn2) => {
8271
- return asMapper(fn2);
8272
- };
8299
+ function fnDoneApi(variant, params, returns) {
8300
+ return isUnset(params) && isUnset(returns) ? `<<` : ``;
8273
8301
  }
8274
- function mergeObjects(defVal, override) {
8302
+ function fnTokenClosure(kind, params, returns) {
8275
8303
  return {
8276
- ...defVal,
8277
- ...override
8304
+ done: fnDoneApi(kind, params, returns),
8305
+ params: fnParamsApi(kind, params, returns),
8306
+ returns: fnReturnsApi(kind, params, returns)
8278
8307
  };
8279
8308
  }
8280
- function mergeScalars(a, b) {
8281
- return isUndefined(b) ? a : b;
8309
+ function createTypeToken(kind) {
8310
+ return isAtomicKind(kind) ? `<<${kind}>>` : isSingletonKind(kind) ? singletonApi(kind) : isSetBasedKind(kind) ? setApi(kind) : isFnBasedKind(kind) ? handleDoneFn(fnTokenClosure(kind, unset, unset)) : "<<never>>";
8282
8311
  }
8283
- function mergeTuples(a, b) {
8284
- 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]);
8312
+ function fromDefineObject(defn) {
8313
+ return defn;
8285
8314
  }
8286
- function never(val) {
8287
- return val;
8315
+ function getTokenKind(token) {
8316
+ const bare = stripSurround("<<", ">>")(token);
8317
+ const parts = bare.split("::");
8318
+ const kind = parts.pop();
8319
+ return kind;
8288
8320
  }
8289
- function optional(value) {
8321
+ var simpleToken = (token) => token;
8322
+ var simpleScalarToken = (token) => token;
8323
+ var simpleContainerToken = (token) => token;
8324
+ function simpleScalarType(token) {
8325
+ const value = simpleScalarToken(token);
8290
8326
  return value;
8291
8327
  }
8292
- function orNull(value) {
8328
+ function simpleContainerType(token) {
8329
+ const value = simpleContainerToken(token);
8293
8330
  return value;
8294
8331
  }
8295
- function optionalOrNull(value) {
8332
+ function simpleType(token) {
8333
+ const value = isSimpleScalarToken(token) ? simpleScalarType(token) : isSimpleContainerToken(token) ? simpleContainerToken(token) : Never2;
8296
8334
  return value;
8297
8335
  }
8298
- function stripParenthesis(val) {
8299
- return stripTrailing(stripLeading(val.trim(), "("), ")").trim();
8300
- }
8301
- function sortKeyApi(order) {
8302
- return {
8303
- order,
8304
- toTop: (...keys) => sortKeyApi(
8305
- [
8306
- ...keys,
8307
- ...order.filter((i) => !keys.includes(i))
8308
- ]
8309
- ),
8310
- toBottom: (...keys) => sortKeyApi(
8311
- [
8312
- ...order.filter((i) => !keys.includes(i)),
8313
- ...keys
8314
- ]
8315
- ),
8316
- done: () => order
8317
- };
8318
- }
8319
- function toKeyValue(obj, sort) {
8320
- let keys = keysOf(obj);
8321
- const tuple3 = [];
8322
- if (sort) {
8323
- keys = handleDoneFn(sort(sortKeyApi(keys)));
8324
- }
8336
+ function hasOverlappingKeys(a, b) {
8337
+ const keys = Object.keys(a);
8325
8338
  for (const k of keys) {
8326
- tuple3.push({ key: k, value: obj[k] });
8339
+ if (k in b) {
8340
+ return true;
8341
+ }
8327
8342
  }
8328
- return tuple3;
8343
+ return false;
8329
8344
  }
8330
- function convertScalar(val) {
8331
- switch (typeof val) {
8332
- case "number":
8333
- return val;
8334
- case "string":
8335
- return Number(val);
8336
- case "boolean":
8337
- return val ? 1 : 0;
8338
- default:
8339
- throw new Error(`${typeof val} is an invalid scalar type to convert to a number!`);
8345
+ function uniqueKeys(left, right) {
8346
+ const isNumeric = !!(isArray(left) && isArray(right));
8347
+ if (isArray(left) && !isArray(right) || isArray(right) && !isArray(left)) {
8348
+ throw new Error("uniqueKeys(l,r) given invalid comparison; both left and right values should be an object or an array but not one of each!");
8340
8349
  }
8341
- }
8342
- var convertList = (val) => val.map((i) => convertScalar(i));
8343
- function toNumber(value) {
8344
- return Array.isArray(value) ? convertList(value) : convertScalar(value);
8345
- }
8346
- var MODS = TW_MODIFIERS2.map((i) => `${i}:`);
8347
- function removeTailwindModifiers(val) {
8348
- return MODS.some((i) => val.startsWith(i)) ? removeTailwindModifiers(val.replace(MODS.find((i) => val.startsWith(i)), "")) : val;
8349
- }
8350
- function getTailwindModifiers(val) {
8351
- return val.split(":").filter((i) => isTailwindModifier(i));
8352
- }
8353
- function union3(..._options) {
8354
- return (value) => value;
8355
- }
8356
- function unionize(value, _inUnionWith) {
8357
- return value;
8350
+ const l = isNumeric ? Object.keys(left).map((i) => Number(i)) : Object.keys(left);
8351
+ const r = isNumeric ? Object.keys(right).map((i) => Number(i)) : Object.keys(right);
8352
+ if (isNumeric) {
8353
+ throw new Error("uniqueKeys does not yet work with tuples");
8354
+ }
8355
+ const leftKeys = l.filter((i) => !r.includes(i));
8356
+ const rightKeys = r.filter((i) => !l.includes(i));
8357
+ return [
8358
+ "LeftRight",
8359
+ leftKeys,
8360
+ rightKeys
8361
+ ];
8358
8362
  }
8359
8363
  function asVueRef(value) {
8360
8364
  return {
@@ -8807,6 +8811,7 @@ var ExifSaturation = /* @__PURE__ */ ((ExifSaturation2) => {
8807
8811
  errCondition,
8808
8812
  filter,
8809
8813
  filterEmpty,
8814
+ filterUndefined,
8810
8815
  find,
8811
8816
  fnMeta,
8812
8817
  fromDefineObject,