@aehrc/ecl-core 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1388 -786
- package/dist/index.d.ts +359 -1
- package/dist/index.mjs +1388 -786
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1584,10 +1584,10 @@ function requireCallBind() {
|
|
|
1584
1584
|
var applyBind2 = requireApplyBind();
|
|
1585
1585
|
module2.exports = function callBind2(originalFunction) {
|
|
1586
1586
|
var func = callBindBasic(arguments);
|
|
1587
|
-
var adjustedLength = originalFunction.length - (arguments.length - 1);
|
|
1587
|
+
var adjustedLength = 1 + originalFunction.length - (arguments.length - 1);
|
|
1588
1588
|
return setFunctionLength2(
|
|
1589
1589
|
func,
|
|
1590
|
-
|
|
1590
|
+
adjustedLength > 0 ? adjustedLength : 0,
|
|
1591
1591
|
true
|
|
1592
1592
|
);
|
|
1593
1593
|
};
|
|
@@ -1637,7 +1637,7 @@ function requireWhichTypedArray() {
|
|
|
1637
1637
|
if (descriptor && descriptor.get) {
|
|
1638
1638
|
var bound = callBind2(descriptor.get);
|
|
1639
1639
|
cache2[
|
|
1640
|
-
/** @type {`$${
|
|
1640
|
+
/** @type {`$${TypedArrayName}`} */
|
|
1641
1641
|
"$" + typedArray
|
|
1642
1642
|
] = bound;
|
|
1643
1643
|
}
|
|
@@ -1649,28 +1649,28 @@ function requireWhichTypedArray() {
|
|
|
1649
1649
|
var fn = arr.slice || arr.set;
|
|
1650
1650
|
if (fn) {
|
|
1651
1651
|
var bound = (
|
|
1652
|
-
/** @type {
|
|
1652
|
+
/** @type {BoundSlice | BoundSet} */
|
|
1653
1653
|
// @ts-expect-error TODO FIXME
|
|
1654
1654
|
callBind2(fn)
|
|
1655
1655
|
);
|
|
1656
1656
|
cache2[
|
|
1657
|
-
/** @type {`$${
|
|
1657
|
+
/** @type {`$${TypedArrayName}`} */
|
|
1658
1658
|
"$" + typedArray
|
|
1659
1659
|
] = bound;
|
|
1660
1660
|
}
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
1663
|
-
|
|
1663
|
+
function tryTypedArrays(value) {
|
|
1664
1664
|
var found = false;
|
|
1665
1665
|
forEach2(
|
|
1666
|
-
/** @type {Record
|
|
1666
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */
|
|
1667
1667
|
cache2,
|
|
1668
|
-
/** @
|
|
1668
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} typedArray */
|
|
1669
1669
|
function(getter, typedArray) {
|
|
1670
1670
|
if (!found) {
|
|
1671
1671
|
try {
|
|
1672
1672
|
if ("$" + getter(value) === typedArray) {
|
|
1673
|
-
found = /** @type {
|
|
1673
|
+
found = /** @type {TypedArrayName} */
|
|
1674
1674
|
$slice(typedArray, 1);
|
|
1675
1675
|
}
|
|
1676
1676
|
} catch (e) {
|
|
@@ -1679,18 +1679,18 @@ function requireWhichTypedArray() {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
);
|
|
1681
1681
|
return found;
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1682
|
+
}
|
|
1683
|
+
function trySlices(value) {
|
|
1684
1684
|
var found = false;
|
|
1685
1685
|
forEach2(
|
|
1686
|
-
/** @type {Record
|
|
1686
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */
|
|
1687
1687
|
cache2,
|
|
1688
|
-
/** @
|
|
1688
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} name */
|
|
1689
1689
|
function(getter, name) {
|
|
1690
1690
|
if (!found) {
|
|
1691
1691
|
try {
|
|
1692
1692
|
getter(value);
|
|
1693
|
-
found = /** @type {
|
|
1693
|
+
found = /** @type {TypedArrayName} */
|
|
1694
1694
|
$slice(name, 1);
|
|
1695
1695
|
} catch (e) {
|
|
1696
1696
|
}
|
|
@@ -1698,14 +1698,17 @@ function requireWhichTypedArray() {
|
|
|
1698
1698
|
}
|
|
1699
1699
|
);
|
|
1700
1700
|
return found;
|
|
1701
|
-
}
|
|
1701
|
+
}
|
|
1702
|
+
function isTATag(tag) {
|
|
1703
|
+
return $indexOf(typedArrays, tag) > -1;
|
|
1704
|
+
}
|
|
1702
1705
|
whichTypedArray = function whichTypedArray2(value) {
|
|
1703
1706
|
if (!value || typeof value !== "object") {
|
|
1704
1707
|
return false;
|
|
1705
1708
|
}
|
|
1706
1709
|
if (!hasToStringTag) {
|
|
1707
1710
|
var tag = $slice($toString(value), 8, -1);
|
|
1708
|
-
if (
|
|
1711
|
+
if (isTATag(tag)) {
|
|
1709
1712
|
return tag;
|
|
1710
1713
|
}
|
|
1711
1714
|
if (tag !== "Object") {
|
|
@@ -1735,7 +1738,7 @@ var hasRequiredTypes;
|
|
|
1735
1738
|
function requireTypes() {
|
|
1736
1739
|
if (hasRequiredTypes) return types;
|
|
1737
1740
|
hasRequiredTypes = 1;
|
|
1738
|
-
(function(
|
|
1741
|
+
(function(exports2) {
|
|
1739
1742
|
var isArgumentsObject = /* @__PURE__ */ requireIsArguments$1();
|
|
1740
1743
|
var isGeneratorFunction2 = requireIsGeneratorFunction();
|
|
1741
1744
|
var whichTypedArray2 = /* @__PURE__ */ requireWhichTypedArray();
|
|
@@ -1766,64 +1769,64 @@ function requireTypes() {
|
|
|
1766
1769
|
return false;
|
|
1767
1770
|
}
|
|
1768
1771
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
+
exports2.isArgumentsObject = isArgumentsObject;
|
|
1773
|
+
exports2.isGeneratorFunction = isGeneratorFunction2;
|
|
1774
|
+
exports2.isTypedArray = isTypedArray2;
|
|
1772
1775
|
function isPromise(input) {
|
|
1773
1776
|
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
|
|
1774
1777
|
}
|
|
1775
|
-
|
|
1778
|
+
exports2.isPromise = isPromise;
|
|
1776
1779
|
function isArrayBufferView(value) {
|
|
1777
1780
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
1778
1781
|
return ArrayBuffer.isView(value);
|
|
1779
1782
|
}
|
|
1780
1783
|
return isTypedArray2(value) || isDataView(value);
|
|
1781
1784
|
}
|
|
1782
|
-
|
|
1785
|
+
exports2.isArrayBufferView = isArrayBufferView;
|
|
1783
1786
|
function isUint8Array(value) {
|
|
1784
1787
|
return whichTypedArray2(value) === "Uint8Array";
|
|
1785
1788
|
}
|
|
1786
|
-
|
|
1789
|
+
exports2.isUint8Array = isUint8Array;
|
|
1787
1790
|
function isUint8ClampedArray(value) {
|
|
1788
1791
|
return whichTypedArray2(value) === "Uint8ClampedArray";
|
|
1789
1792
|
}
|
|
1790
|
-
|
|
1793
|
+
exports2.isUint8ClampedArray = isUint8ClampedArray;
|
|
1791
1794
|
function isUint16Array(value) {
|
|
1792
1795
|
return whichTypedArray2(value) === "Uint16Array";
|
|
1793
1796
|
}
|
|
1794
|
-
|
|
1797
|
+
exports2.isUint16Array = isUint16Array;
|
|
1795
1798
|
function isUint32Array(value) {
|
|
1796
1799
|
return whichTypedArray2(value) === "Uint32Array";
|
|
1797
1800
|
}
|
|
1798
|
-
|
|
1801
|
+
exports2.isUint32Array = isUint32Array;
|
|
1799
1802
|
function isInt8Array(value) {
|
|
1800
1803
|
return whichTypedArray2(value) === "Int8Array";
|
|
1801
1804
|
}
|
|
1802
|
-
|
|
1805
|
+
exports2.isInt8Array = isInt8Array;
|
|
1803
1806
|
function isInt16Array(value) {
|
|
1804
1807
|
return whichTypedArray2(value) === "Int16Array";
|
|
1805
1808
|
}
|
|
1806
|
-
|
|
1809
|
+
exports2.isInt16Array = isInt16Array;
|
|
1807
1810
|
function isInt32Array(value) {
|
|
1808
1811
|
return whichTypedArray2(value) === "Int32Array";
|
|
1809
1812
|
}
|
|
1810
|
-
|
|
1813
|
+
exports2.isInt32Array = isInt32Array;
|
|
1811
1814
|
function isFloat32Array(value) {
|
|
1812
1815
|
return whichTypedArray2(value) === "Float32Array";
|
|
1813
1816
|
}
|
|
1814
|
-
|
|
1817
|
+
exports2.isFloat32Array = isFloat32Array;
|
|
1815
1818
|
function isFloat64Array(value) {
|
|
1816
1819
|
return whichTypedArray2(value) === "Float64Array";
|
|
1817
1820
|
}
|
|
1818
|
-
|
|
1821
|
+
exports2.isFloat64Array = isFloat64Array;
|
|
1819
1822
|
function isBigInt64Array(value) {
|
|
1820
1823
|
return whichTypedArray2(value) === "BigInt64Array";
|
|
1821
1824
|
}
|
|
1822
|
-
|
|
1825
|
+
exports2.isBigInt64Array = isBigInt64Array;
|
|
1823
1826
|
function isBigUint64Array(value) {
|
|
1824
1827
|
return whichTypedArray2(value) === "BigUint64Array";
|
|
1825
1828
|
}
|
|
1826
|
-
|
|
1829
|
+
exports2.isBigUint64Array = isBigUint64Array;
|
|
1827
1830
|
function isMapToString(value) {
|
|
1828
1831
|
return ObjectToString(value) === "[object Map]";
|
|
1829
1832
|
}
|
|
@@ -1834,7 +1837,7 @@ function requireTypes() {
|
|
|
1834
1837
|
}
|
|
1835
1838
|
return isMapToString.working ? isMapToString(value) : value instanceof Map;
|
|
1836
1839
|
}
|
|
1837
|
-
|
|
1840
|
+
exports2.isMap = isMap;
|
|
1838
1841
|
function isSetToString(value) {
|
|
1839
1842
|
return ObjectToString(value) === "[object Set]";
|
|
1840
1843
|
}
|
|
@@ -1845,7 +1848,7 @@ function requireTypes() {
|
|
|
1845
1848
|
}
|
|
1846
1849
|
return isSetToString.working ? isSetToString(value) : value instanceof Set;
|
|
1847
1850
|
}
|
|
1848
|
-
|
|
1851
|
+
exports2.isSet = isSet;
|
|
1849
1852
|
function isWeakMapToString(value) {
|
|
1850
1853
|
return ObjectToString(value) === "[object WeakMap]";
|
|
1851
1854
|
}
|
|
@@ -1856,7 +1859,7 @@ function requireTypes() {
|
|
|
1856
1859
|
}
|
|
1857
1860
|
return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
|
|
1858
1861
|
}
|
|
1859
|
-
|
|
1862
|
+
exports2.isWeakMap = isWeakMap;
|
|
1860
1863
|
function isWeakSetToString(value) {
|
|
1861
1864
|
return ObjectToString(value) === "[object WeakSet]";
|
|
1862
1865
|
}
|
|
@@ -1864,7 +1867,7 @@ function requireTypes() {
|
|
|
1864
1867
|
function isWeakSet(value) {
|
|
1865
1868
|
return isWeakSetToString(value);
|
|
1866
1869
|
}
|
|
1867
|
-
|
|
1870
|
+
exports2.isWeakSet = isWeakSet;
|
|
1868
1871
|
function isArrayBufferToString(value) {
|
|
1869
1872
|
return ObjectToString(value) === "[object ArrayBuffer]";
|
|
1870
1873
|
}
|
|
@@ -1875,7 +1878,7 @@ function requireTypes() {
|
|
|
1875
1878
|
}
|
|
1876
1879
|
return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
|
|
1877
1880
|
}
|
|
1878
|
-
|
|
1881
|
+
exports2.isArrayBuffer = isArrayBuffer;
|
|
1879
1882
|
function isDataViewToString(value) {
|
|
1880
1883
|
return ObjectToString(value) === "[object DataView]";
|
|
1881
1884
|
}
|
|
@@ -1886,7 +1889,7 @@ function requireTypes() {
|
|
|
1886
1889
|
}
|
|
1887
1890
|
return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
|
|
1888
1891
|
}
|
|
1889
|
-
|
|
1892
|
+
exports2.isDataView = isDataView;
|
|
1890
1893
|
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
|
|
1891
1894
|
function isSharedArrayBufferToString(value) {
|
|
1892
1895
|
return ObjectToString(value) === "[object SharedArrayBuffer]";
|
|
@@ -1900,57 +1903,57 @@ function requireTypes() {
|
|
|
1900
1903
|
}
|
|
1901
1904
|
return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
|
|
1902
1905
|
}
|
|
1903
|
-
|
|
1906
|
+
exports2.isSharedArrayBuffer = isSharedArrayBuffer;
|
|
1904
1907
|
function isAsyncFunction(value) {
|
|
1905
1908
|
return ObjectToString(value) === "[object AsyncFunction]";
|
|
1906
1909
|
}
|
|
1907
|
-
|
|
1910
|
+
exports2.isAsyncFunction = isAsyncFunction;
|
|
1908
1911
|
function isMapIterator(value) {
|
|
1909
1912
|
return ObjectToString(value) === "[object Map Iterator]";
|
|
1910
1913
|
}
|
|
1911
|
-
|
|
1914
|
+
exports2.isMapIterator = isMapIterator;
|
|
1912
1915
|
function isSetIterator(value) {
|
|
1913
1916
|
return ObjectToString(value) === "[object Set Iterator]";
|
|
1914
1917
|
}
|
|
1915
|
-
|
|
1918
|
+
exports2.isSetIterator = isSetIterator;
|
|
1916
1919
|
function isGeneratorObject(value) {
|
|
1917
1920
|
return ObjectToString(value) === "[object Generator]";
|
|
1918
1921
|
}
|
|
1919
|
-
|
|
1922
|
+
exports2.isGeneratorObject = isGeneratorObject;
|
|
1920
1923
|
function isWebAssemblyCompiledModule(value) {
|
|
1921
1924
|
return ObjectToString(value) === "[object WebAssembly.Module]";
|
|
1922
1925
|
}
|
|
1923
|
-
|
|
1926
|
+
exports2.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
|
|
1924
1927
|
function isNumberObject(value) {
|
|
1925
1928
|
return checkBoxedPrimitive(value, numberValue);
|
|
1926
1929
|
}
|
|
1927
|
-
|
|
1930
|
+
exports2.isNumberObject = isNumberObject;
|
|
1928
1931
|
function isStringObject(value) {
|
|
1929
1932
|
return checkBoxedPrimitive(value, stringValue);
|
|
1930
1933
|
}
|
|
1931
|
-
|
|
1934
|
+
exports2.isStringObject = isStringObject;
|
|
1932
1935
|
function isBooleanObject(value) {
|
|
1933
1936
|
return checkBoxedPrimitive(value, booleanValue);
|
|
1934
1937
|
}
|
|
1935
|
-
|
|
1938
|
+
exports2.isBooleanObject = isBooleanObject;
|
|
1936
1939
|
function isBigIntObject(value) {
|
|
1937
1940
|
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
|
|
1938
1941
|
}
|
|
1939
|
-
|
|
1942
|
+
exports2.isBigIntObject = isBigIntObject;
|
|
1940
1943
|
function isSymbolObject(value) {
|
|
1941
1944
|
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
|
|
1942
1945
|
}
|
|
1943
|
-
|
|
1946
|
+
exports2.isSymbolObject = isSymbolObject;
|
|
1944
1947
|
function isBoxedPrimitive(value) {
|
|
1945
1948
|
return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
|
|
1946
1949
|
}
|
|
1947
|
-
|
|
1950
|
+
exports2.isBoxedPrimitive = isBoxedPrimitive;
|
|
1948
1951
|
function isAnyArrayBuffer(value) {
|
|
1949
1952
|
return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
|
|
1950
1953
|
}
|
|
1951
|
-
|
|
1954
|
+
exports2.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
1952
1955
|
["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
|
|
1953
|
-
Object.defineProperty(
|
|
1956
|
+
Object.defineProperty(exports2, method, {
|
|
1954
1957
|
enumerable: false,
|
|
1955
1958
|
value: function() {
|
|
1956
1959
|
throw new Error(method + " is not supported in userland");
|
|
@@ -2007,7 +2010,7 @@ var hasRequiredUtil;
|
|
|
2007
2010
|
function requireUtil() {
|
|
2008
2011
|
if (hasRequiredUtil) return util;
|
|
2009
2012
|
hasRequiredUtil = 1;
|
|
2010
|
-
(function(
|
|
2013
|
+
(function(exports2) {
|
|
2011
2014
|
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
|
|
2012
2015
|
var keys = Object.keys(obj);
|
|
2013
2016
|
var descriptors = {};
|
|
@@ -2017,7 +2020,7 @@ function requireUtil() {
|
|
|
2017
2020
|
return descriptors;
|
|
2018
2021
|
};
|
|
2019
2022
|
var formatRegExp = /%[sdj%]/g;
|
|
2020
|
-
|
|
2023
|
+
exports2.format = function(f) {
|
|
2021
2024
|
if (!isString(f)) {
|
|
2022
2025
|
var objects = [];
|
|
2023
2026
|
for (var i = 0; i < arguments.length; i++) {
|
|
@@ -2055,13 +2058,13 @@ function requireUtil() {
|
|
|
2055
2058
|
}
|
|
2056
2059
|
return str;
|
|
2057
2060
|
};
|
|
2058
|
-
|
|
2061
|
+
exports2.deprecate = function(fn, msg) {
|
|
2059
2062
|
if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) {
|
|
2060
2063
|
return fn;
|
|
2061
2064
|
}
|
|
2062
2065
|
if (typeof process$1 === "undefined") {
|
|
2063
2066
|
return function() {
|
|
2064
|
-
return
|
|
2067
|
+
return exports2.deprecate(fn, msg).apply(this, arguments);
|
|
2065
2068
|
};
|
|
2066
2069
|
}
|
|
2067
2070
|
var warned = false;
|
|
@@ -2087,13 +2090,13 @@ function requireUtil() {
|
|
|
2087
2090
|
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
|
|
2088
2091
|
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
|
|
2089
2092
|
}
|
|
2090
|
-
|
|
2093
|
+
exports2.debuglog = function(set) {
|
|
2091
2094
|
set = set.toUpperCase();
|
|
2092
2095
|
if (!debugs[set]) {
|
|
2093
2096
|
if (debugEnvRegex.test(set)) {
|
|
2094
2097
|
var pid = process$1.pid;
|
|
2095
2098
|
debugs[set] = function() {
|
|
2096
|
-
var msg =
|
|
2099
|
+
var msg = exports2.format.apply(exports2, arguments);
|
|
2097
2100
|
console.error("%s %d: %s", set, pid, msg);
|
|
2098
2101
|
};
|
|
2099
2102
|
} else {
|
|
@@ -2113,7 +2116,7 @@ function requireUtil() {
|
|
|
2113
2116
|
if (isBoolean(opts)) {
|
|
2114
2117
|
ctx.showHidden = opts;
|
|
2115
2118
|
} else if (opts) {
|
|
2116
|
-
|
|
2119
|
+
exports2._extend(ctx, opts);
|
|
2117
2120
|
}
|
|
2118
2121
|
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
|
2119
2122
|
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
|
@@ -2122,7 +2125,7 @@ function requireUtil() {
|
|
|
2122
2125
|
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
|
2123
2126
|
return formatValue(ctx, obj, ctx.depth);
|
|
2124
2127
|
}
|
|
2125
|
-
|
|
2128
|
+
exports2.inspect = inspect;
|
|
2126
2129
|
inspect.colors = {
|
|
2127
2130
|
"bold": [1, 22],
|
|
2128
2131
|
"italic": [3, 23],
|
|
@@ -2169,7 +2172,7 @@ function requireUtil() {
|
|
|
2169
2172
|
}
|
|
2170
2173
|
function formatValue(ctx, value, recurseTimes) {
|
|
2171
2174
|
if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
|
|
2172
|
-
value.inspect !==
|
|
2175
|
+
value.inspect !== exports2.inspect && // Also filter out any prototype objects using the circular check.
|
|
2173
2176
|
!(value.constructor && value.constructor.prototype === value)) {
|
|
2174
2177
|
var ret = value.inspect(recurseTimes, ctx);
|
|
2175
2178
|
if (!isString(ret)) {
|
|
@@ -2355,68 +2358,68 @@ function requireUtil() {
|
|
|
2355
2358
|
}
|
|
2356
2359
|
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
|
|
2357
2360
|
}
|
|
2358
|
-
|
|
2361
|
+
exports2.types = requireTypes();
|
|
2359
2362
|
function isArray(ar) {
|
|
2360
2363
|
return Array.isArray(ar);
|
|
2361
2364
|
}
|
|
2362
|
-
|
|
2365
|
+
exports2.isArray = isArray;
|
|
2363
2366
|
function isBoolean(arg) {
|
|
2364
2367
|
return typeof arg === "boolean";
|
|
2365
2368
|
}
|
|
2366
|
-
|
|
2369
|
+
exports2.isBoolean = isBoolean;
|
|
2367
2370
|
function isNull(arg) {
|
|
2368
2371
|
return arg === null;
|
|
2369
2372
|
}
|
|
2370
|
-
|
|
2373
|
+
exports2.isNull = isNull;
|
|
2371
2374
|
function isNullOrUndefined(arg) {
|
|
2372
2375
|
return arg == null;
|
|
2373
2376
|
}
|
|
2374
|
-
|
|
2377
|
+
exports2.isNullOrUndefined = isNullOrUndefined;
|
|
2375
2378
|
function isNumber(arg) {
|
|
2376
2379
|
return typeof arg === "number";
|
|
2377
2380
|
}
|
|
2378
|
-
|
|
2381
|
+
exports2.isNumber = isNumber;
|
|
2379
2382
|
function isString(arg) {
|
|
2380
2383
|
return typeof arg === "string";
|
|
2381
2384
|
}
|
|
2382
|
-
|
|
2385
|
+
exports2.isString = isString;
|
|
2383
2386
|
function isSymbol(arg) {
|
|
2384
2387
|
return typeof arg === "symbol";
|
|
2385
2388
|
}
|
|
2386
|
-
|
|
2389
|
+
exports2.isSymbol = isSymbol;
|
|
2387
2390
|
function isUndefined(arg) {
|
|
2388
2391
|
return arg === void 0;
|
|
2389
2392
|
}
|
|
2390
|
-
|
|
2393
|
+
exports2.isUndefined = isUndefined;
|
|
2391
2394
|
function isRegExp(re) {
|
|
2392
2395
|
return isObject(re) && objectToString(re) === "[object RegExp]";
|
|
2393
2396
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2397
|
+
exports2.isRegExp = isRegExp;
|
|
2398
|
+
exports2.types.isRegExp = isRegExp;
|
|
2396
2399
|
function isObject(arg) {
|
|
2397
2400
|
return typeof arg === "object" && arg !== null;
|
|
2398
2401
|
}
|
|
2399
|
-
|
|
2402
|
+
exports2.isObject = isObject;
|
|
2400
2403
|
function isDate(d) {
|
|
2401
2404
|
return isObject(d) && objectToString(d) === "[object Date]";
|
|
2402
2405
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2406
|
+
exports2.isDate = isDate;
|
|
2407
|
+
exports2.types.isDate = isDate;
|
|
2405
2408
|
function isError(e) {
|
|
2406
2409
|
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
|
|
2407
2410
|
}
|
|
2408
|
-
|
|
2409
|
-
|
|
2411
|
+
exports2.isError = isError;
|
|
2412
|
+
exports2.types.isNativeError = isError;
|
|
2410
2413
|
function isFunction(arg) {
|
|
2411
2414
|
return typeof arg === "function";
|
|
2412
2415
|
}
|
|
2413
|
-
|
|
2416
|
+
exports2.isFunction = isFunction;
|
|
2414
2417
|
function isPrimitive(arg) {
|
|
2415
2418
|
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
|
|
2416
2419
|
typeof arg === "undefined";
|
|
2417
2420
|
}
|
|
2418
|
-
|
|
2419
|
-
|
|
2421
|
+
exports2.isPrimitive = isPrimitive;
|
|
2422
|
+
exports2.isBuffer = requireIsBufferBrowser();
|
|
2420
2423
|
function objectToString(o) {
|
|
2421
2424
|
return Object.prototype.toString.call(o);
|
|
2422
2425
|
}
|
|
@@ -2446,11 +2449,11 @@ function requireUtil() {
|
|
|
2446
2449
|
].join(":");
|
|
2447
2450
|
return [d.getDate(), months[d.getMonth()], time].join(" ");
|
|
2448
2451
|
}
|
|
2449
|
-
|
|
2450
|
-
console.log("%s - %s", timestamp(),
|
|
2452
|
+
exports2.log = function() {
|
|
2453
|
+
console.log("%s - %s", timestamp(), exports2.format.apply(exports2, arguments));
|
|
2451
2454
|
};
|
|
2452
|
-
|
|
2453
|
-
|
|
2455
|
+
exports2.inherits = requireInherits_browser();
|
|
2456
|
+
exports2._extend = function(origin, add) {
|
|
2454
2457
|
if (!add || !isObject(add)) return origin;
|
|
2455
2458
|
var keys = Object.keys(add);
|
|
2456
2459
|
var i = keys.length;
|
|
@@ -2463,7 +2466,7 @@ function requireUtil() {
|
|
|
2463
2466
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
2464
2467
|
}
|
|
2465
2468
|
var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
|
|
2466
|
-
|
|
2469
|
+
exports2.promisify = function promisify(original) {
|
|
2467
2470
|
if (typeof original !== "function")
|
|
2468
2471
|
throw new TypeError('The "original" argument must be of type Function');
|
|
2469
2472
|
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
|
@@ -2515,7 +2518,7 @@ function requireUtil() {
|
|
|
2515
2518
|
getOwnPropertyDescriptors(original)
|
|
2516
2519
|
);
|
|
2517
2520
|
};
|
|
2518
|
-
|
|
2521
|
+
exports2.promisify.custom = kCustomPromisifiedSymbol;
|
|
2519
2522
|
function callbackifyOnRejected(reason, cb) {
|
|
2520
2523
|
if (!reason) {
|
|
2521
2524
|
var newReason = new Error("Promise was rejected with a falsy value");
|
|
@@ -2557,7 +2560,7 @@ function requireUtil() {
|
|
|
2557
2560
|
);
|
|
2558
2561
|
return callbackified;
|
|
2559
2562
|
}
|
|
2560
|
-
|
|
2563
|
+
exports2.callbackify = callbackify;
|
|
2561
2564
|
})(util);
|
|
2562
2565
|
return util;
|
|
2563
2566
|
}
|
|
@@ -4767,17 +4770,17 @@ var hasRequiredIntStream;
|
|
|
4767
4770
|
function requireIntStream() {
|
|
4768
4771
|
if (hasRequiredIntStream) return IntStream;
|
|
4769
4772
|
hasRequiredIntStream = 1;
|
|
4770
|
-
(function(
|
|
4773
|
+
(function(exports2) {
|
|
4771
4774
|
/*!
|
|
4772
4775
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
4773
4776
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
4774
4777
|
*/
|
|
4775
|
-
Object.defineProperty(
|
|
4776
|
-
|
|
4778
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4779
|
+
exports2.IntStream = void 0;
|
|
4777
4780
|
(function(IntStream2) {
|
|
4778
4781
|
IntStream2.EOF = -1;
|
|
4779
4782
|
IntStream2.UNKNOWN_SOURCE_NAME = "<unknown>";
|
|
4780
|
-
})(
|
|
4783
|
+
})(exports2.IntStream || (exports2.IntStream = {}));
|
|
4781
4784
|
})(IntStream);
|
|
4782
4785
|
return IntStream;
|
|
4783
4786
|
}
|
|
@@ -4932,7 +4935,7 @@ var hasRequiredATNState;
|
|
|
4932
4935
|
function requireATNState() {
|
|
4933
4936
|
if (hasRequiredATNState) return ATNState;
|
|
4934
4937
|
hasRequiredATNState = 1;
|
|
4935
|
-
(function(
|
|
4938
|
+
(function(exports2) {
|
|
4936
4939
|
/*!
|
|
4937
4940
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
4938
4941
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -4943,8 +4946,8 @@ function requireATNState() {
|
|
|
4943
4946
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4944
4947
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4945
4948
|
};
|
|
4946
|
-
Object.defineProperty(
|
|
4947
|
-
|
|
4949
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4950
|
+
exports2.ATNState = void 0;
|
|
4948
4951
|
const Decorators_1 = requireDecorators();
|
|
4949
4952
|
let ATNState$1 = class ATNState2 {
|
|
4950
4953
|
constructor() {
|
|
@@ -5053,10 +5056,10 @@ function requireATNState() {
|
|
|
5053
5056
|
__decorate([
|
|
5054
5057
|
Decorators_1.Override
|
|
5055
5058
|
], ATNState$1.prototype, "toString", null);
|
|
5056
|
-
|
|
5059
|
+
exports2.ATNState = ATNState$1;
|
|
5057
5060
|
(function(ATNState2) {
|
|
5058
5061
|
ATNState2.INVALID_STATE_NUMBER = -1;
|
|
5059
|
-
})(ATNState$1 =
|
|
5062
|
+
})(ATNState$1 = exports2.ATNState || (exports2.ATNState = {}));
|
|
5060
5063
|
})(ATNState);
|
|
5061
5064
|
return ATNState;
|
|
5062
5065
|
}
|
|
@@ -5065,13 +5068,13 @@ var hasRequiredATNStateType;
|
|
|
5065
5068
|
function requireATNStateType() {
|
|
5066
5069
|
if (hasRequiredATNStateType) return ATNStateType;
|
|
5067
5070
|
hasRequiredATNStateType = 1;
|
|
5068
|
-
(function(
|
|
5071
|
+
(function(exports2) {
|
|
5069
5072
|
/*!
|
|
5070
5073
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5071
5074
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
5072
5075
|
*/
|
|
5073
|
-
Object.defineProperty(
|
|
5074
|
-
|
|
5076
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5077
|
+
exports2.ATNStateType = void 0;
|
|
5075
5078
|
(function(ATNStateType2) {
|
|
5076
5079
|
ATNStateType2[ATNStateType2["INVALID_TYPE"] = 0] = "INVALID_TYPE";
|
|
5077
5080
|
ATNStateType2[ATNStateType2["BASIC"] = 1] = "BASIC";
|
|
@@ -5086,7 +5089,7 @@ function requireATNStateType() {
|
|
|
5086
5089
|
ATNStateType2[ATNStateType2["STAR_LOOP_ENTRY"] = 10] = "STAR_LOOP_ENTRY";
|
|
5087
5090
|
ATNStateType2[ATNStateType2["PLUS_LOOP_BACK"] = 11] = "PLUS_LOOP_BACK";
|
|
5088
5091
|
ATNStateType2[ATNStateType2["LOOP_END"] = 12] = "LOOP_END";
|
|
5089
|
-
})(
|
|
5092
|
+
})(exports2.ATNStateType || (exports2.ATNStateType = {}));
|
|
5090
5093
|
})(ATNStateType);
|
|
5091
5094
|
return ATNStateType;
|
|
5092
5095
|
}
|
|
@@ -5291,13 +5294,13 @@ var hasRequiredMurmurHash;
|
|
|
5291
5294
|
function requireMurmurHash() {
|
|
5292
5295
|
if (hasRequiredMurmurHash) return MurmurHash;
|
|
5293
5296
|
hasRequiredMurmurHash = 1;
|
|
5294
|
-
(function(
|
|
5297
|
+
(function(exports2) {
|
|
5295
5298
|
/*!
|
|
5296
5299
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5297
5300
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
5298
5301
|
*/
|
|
5299
|
-
Object.defineProperty(
|
|
5300
|
-
|
|
5302
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5303
|
+
exports2.MurmurHash = void 0;
|
|
5301
5304
|
(function(MurmurHash2) {
|
|
5302
5305
|
const DEFAULT_SEED = 0;
|
|
5303
5306
|
function initialize(seed = DEFAULT_SEED) {
|
|
@@ -5362,7 +5365,7 @@ function requireMurmurHash() {
|
|
|
5362
5365
|
}
|
|
5363
5366
|
return hash;
|
|
5364
5367
|
}
|
|
5365
|
-
})(
|
|
5368
|
+
})(exports2.MurmurHash || (exports2.MurmurHash = {}));
|
|
5366
5369
|
})(MurmurHash);
|
|
5367
5370
|
return MurmurHash;
|
|
5368
5371
|
}
|
|
@@ -5975,7 +5978,7 @@ var hasRequiredSemanticContext;
|
|
|
5975
5978
|
function requireSemanticContext() {
|
|
5976
5979
|
if (hasRequiredSemanticContext) return SemanticContext;
|
|
5977
5980
|
hasRequiredSemanticContext = 1;
|
|
5978
|
-
(function(
|
|
5981
|
+
(function(exports2) {
|
|
5979
5982
|
/*!
|
|
5980
5983
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5981
5984
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -5991,8 +5994,8 @@ function requireSemanticContext() {
|
|
|
5991
5994
|
decorator(target, key, paramIndex);
|
|
5992
5995
|
};
|
|
5993
5996
|
};
|
|
5994
|
-
Object.defineProperty(
|
|
5995
|
-
|
|
5997
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5998
|
+
exports2.SemanticContext = void 0;
|
|
5996
5999
|
const Array2DHashSet_1 = requireArray2DHashSet();
|
|
5997
6000
|
const ArrayEqualityComparator_1 = requireArrayEqualityComparator();
|
|
5998
6001
|
const MurmurHash_1 = requireMurmurHash();
|
|
@@ -6089,7 +6092,7 @@ function requireSemanticContext() {
|
|
|
6089
6092
|
return result;
|
|
6090
6093
|
}
|
|
6091
6094
|
};
|
|
6092
|
-
|
|
6095
|
+
exports2.SemanticContext = SemanticContext$1;
|
|
6093
6096
|
(function(SemanticContext2) {
|
|
6094
6097
|
const AND_HASHCODE = 40363613;
|
|
6095
6098
|
const OR_HASHCODE = 486279973;
|
|
@@ -6410,7 +6413,7 @@ function requireSemanticContext() {
|
|
|
6410
6413
|
__param(1, Decorators_1.NotNull)
|
|
6411
6414
|
], OR);
|
|
6412
6415
|
SemanticContext2.OR = OR;
|
|
6413
|
-
})(SemanticContext$1 =
|
|
6416
|
+
})(SemanticContext$1 = exports2.SemanticContext || (exports2.SemanticContext = {}));
|
|
6414
6417
|
})(SemanticContext);
|
|
6415
6418
|
return SemanticContext;
|
|
6416
6419
|
}
|
|
@@ -6593,13 +6596,13 @@ var hasRequiredArrays;
|
|
|
6593
6596
|
function requireArrays() {
|
|
6594
6597
|
if (hasRequiredArrays) return Arrays;
|
|
6595
6598
|
hasRequiredArrays = 1;
|
|
6596
|
-
(function(
|
|
6599
|
+
(function(exports2) {
|
|
6597
6600
|
/*!
|
|
6598
6601
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
6599
6602
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
6600
6603
|
*/
|
|
6601
|
-
Object.defineProperty(
|
|
6602
|
-
|
|
6604
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6605
|
+
exports2.Arrays = void 0;
|
|
6603
6606
|
(function(Arrays2) {
|
|
6604
6607
|
function binarySearch(array, key, fromIndex, toIndex) {
|
|
6605
6608
|
return binarySearch0(array, fromIndex !== void 0 ? fromIndex : 0, toIndex !== void 0 ? toIndex : array.length, key);
|
|
@@ -6642,7 +6645,7 @@ function requireArrays() {
|
|
|
6642
6645
|
return result;
|
|
6643
6646
|
}
|
|
6644
6647
|
Arrays2.toString = toString;
|
|
6645
|
-
})(
|
|
6648
|
+
})(exports2.Arrays || (exports2.Arrays = {}));
|
|
6646
6649
|
})(Arrays);
|
|
6647
6650
|
return Arrays;
|
|
6648
6651
|
}
|
|
@@ -7074,13 +7077,13 @@ var hasRequiredToken;
|
|
|
7074
7077
|
function requireToken() {
|
|
7075
7078
|
if (hasRequiredToken) return Token;
|
|
7076
7079
|
hasRequiredToken = 1;
|
|
7077
|
-
(function(
|
|
7080
|
+
(function(exports2) {
|
|
7078
7081
|
/*!
|
|
7079
7082
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7080
7083
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
7081
7084
|
*/
|
|
7082
|
-
Object.defineProperty(
|
|
7083
|
-
|
|
7085
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7086
|
+
exports2.Token = void 0;
|
|
7084
7087
|
const IntStream_1 = requireIntStream();
|
|
7085
7088
|
(function(Token2) {
|
|
7086
7089
|
Token2.INVALID_TYPE = 0;
|
|
@@ -7090,7 +7093,7 @@ function requireToken() {
|
|
|
7090
7093
|
Token2.DEFAULT_CHANNEL = 0;
|
|
7091
7094
|
Token2.HIDDEN_CHANNEL = 1;
|
|
7092
7095
|
Token2.MIN_USER_CHANNEL_VALUE = 2;
|
|
7093
|
-
})(
|
|
7096
|
+
})(exports2.Token || (exports2.Token = {}));
|
|
7094
7097
|
})(Token);
|
|
7095
7098
|
return Token;
|
|
7096
7099
|
}
|
|
@@ -7312,7 +7315,7 @@ var hasRequiredCommonTokenFactory;
|
|
|
7312
7315
|
function requireCommonTokenFactory() {
|
|
7313
7316
|
if (hasRequiredCommonTokenFactory) return CommonTokenFactory;
|
|
7314
7317
|
hasRequiredCommonTokenFactory = 1;
|
|
7315
|
-
(function(
|
|
7318
|
+
(function(exports2) {
|
|
7316
7319
|
/*!
|
|
7317
7320
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7318
7321
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7323,8 +7326,8 @@ function requireCommonTokenFactory() {
|
|
|
7323
7326
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7324
7327
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7325
7328
|
};
|
|
7326
|
-
Object.defineProperty(
|
|
7327
|
-
|
|
7329
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7330
|
+
exports2.CommonTokenFactory = void 0;
|
|
7328
7331
|
const CommonToken_1 = requireCommonToken();
|
|
7329
7332
|
const Interval_1 = requireInterval();
|
|
7330
7333
|
const Decorators_1 = requireDecorators();
|
|
@@ -7360,10 +7363,10 @@ function requireCommonTokenFactory() {
|
|
|
7360
7363
|
__decorate([
|
|
7361
7364
|
Decorators_1.Override
|
|
7362
7365
|
], CommonTokenFactory$1.prototype, "createSimple", null);
|
|
7363
|
-
|
|
7366
|
+
exports2.CommonTokenFactory = CommonTokenFactory$1;
|
|
7364
7367
|
(function(CommonTokenFactory2) {
|
|
7365
7368
|
CommonTokenFactory2.DEFAULT = new CommonTokenFactory2();
|
|
7366
|
-
})(CommonTokenFactory$1 =
|
|
7369
|
+
})(CommonTokenFactory$1 = exports2.CommonTokenFactory || (exports2.CommonTokenFactory = {}));
|
|
7367
7370
|
})(CommonTokenFactory);
|
|
7368
7371
|
return CommonTokenFactory;
|
|
7369
7372
|
}
|
|
@@ -7551,7 +7554,7 @@ var hasRequiredPredictionContextCache;
|
|
|
7551
7554
|
function requirePredictionContextCache() {
|
|
7552
7555
|
if (hasRequiredPredictionContextCache) return PredictionContextCache;
|
|
7553
7556
|
hasRequiredPredictionContextCache = 1;
|
|
7554
|
-
(function(
|
|
7557
|
+
(function(exports2) {
|
|
7555
7558
|
/*!
|
|
7556
7559
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7557
7560
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7562,8 +7565,8 @@ function requirePredictionContextCache() {
|
|
|
7562
7565
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7563
7566
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7564
7567
|
};
|
|
7565
|
-
Object.defineProperty(
|
|
7566
|
-
|
|
7568
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7569
|
+
exports2.PredictionContextCache = void 0;
|
|
7567
7570
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
7568
7571
|
const Decorators_1 = requireDecorators();
|
|
7569
7572
|
const ObjectEqualityComparator_1 = requireObjectEqualityComparator();
|
|
@@ -7615,7 +7618,7 @@ function requirePredictionContextCache() {
|
|
|
7615
7618
|
return result;
|
|
7616
7619
|
}
|
|
7617
7620
|
};
|
|
7618
|
-
|
|
7621
|
+
exports2.PredictionContextCache = PredictionContextCache$1;
|
|
7619
7622
|
PredictionContextCache$1.UNCACHED = new PredictionContextCache$1(false);
|
|
7620
7623
|
(function(PredictionContextCache2) {
|
|
7621
7624
|
class PredictionContextAndInt {
|
|
@@ -7679,7 +7682,7 @@ function requirePredictionContextCache() {
|
|
|
7679
7682
|
Decorators_1.Override
|
|
7680
7683
|
], IdentityCommutativePredictionContextOperands.prototype, "hashCode", null);
|
|
7681
7684
|
PredictionContextCache2.IdentityCommutativePredictionContextOperands = IdentityCommutativePredictionContextOperands;
|
|
7682
|
-
})(PredictionContextCache$1 =
|
|
7685
|
+
})(PredictionContextCache$1 = exports2.PredictionContextCache || (exports2.PredictionContextCache = {}));
|
|
7683
7686
|
})(PredictionContextCache);
|
|
7684
7687
|
return PredictionContextCache;
|
|
7685
7688
|
}
|
|
@@ -7687,7 +7690,7 @@ var hasRequiredPredictionContext;
|
|
|
7687
7690
|
function requirePredictionContext() {
|
|
7688
7691
|
if (hasRequiredPredictionContext) return PredictionContext;
|
|
7689
7692
|
hasRequiredPredictionContext = 1;
|
|
7690
|
-
(function(
|
|
7693
|
+
(function(exports2) {
|
|
7691
7694
|
/*!
|
|
7692
7695
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7693
7696
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7703,8 +7706,8 @@ function requirePredictionContext() {
|
|
|
7703
7706
|
decorator(target, key, paramIndex);
|
|
7704
7707
|
};
|
|
7705
7708
|
};
|
|
7706
|
-
Object.defineProperty(
|
|
7707
|
-
|
|
7709
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7710
|
+
exports2.SingletonPredictionContext = exports2.PredictionContext = void 0;
|
|
7708
7711
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
7709
7712
|
const Array2DHashSet_1 = requireArray2DHashSet();
|
|
7710
7713
|
const Arrays_1 = requireArrays();
|
|
@@ -7966,7 +7969,7 @@ function requirePredictionContext() {
|
|
|
7966
7969
|
__param(1, Decorators_1.NotNull),
|
|
7967
7970
|
__param(2, Decorators_1.NotNull)
|
|
7968
7971
|
], PredictionContext$1, "getCachedContext", null);
|
|
7969
|
-
|
|
7972
|
+
exports2.PredictionContext = PredictionContext$1;
|
|
7970
7973
|
class EmptyPredictionContext extends PredictionContext$1 {
|
|
7971
7974
|
constructor(fullContext) {
|
|
7972
7975
|
super(PredictionContext$1.calculateEmptyHashCode());
|
|
@@ -8322,7 +8325,7 @@ function requirePredictionContext() {
|
|
|
8322
8325
|
SingletonPredictionContext = __decorate([
|
|
8323
8326
|
__param(0, Decorators_1.NotNull)
|
|
8324
8327
|
], SingletonPredictionContext);
|
|
8325
|
-
|
|
8328
|
+
exports2.SingletonPredictionContext = SingletonPredictionContext;
|
|
8326
8329
|
(function(PredictionContext2) {
|
|
8327
8330
|
PredictionContext2.EMPTY_LOCAL = new EmptyPredictionContext(false);
|
|
8328
8331
|
PredictionContext2.EMPTY_FULL = new EmptyPredictionContext(true);
|
|
@@ -8352,7 +8355,7 @@ function requirePredictionContext() {
|
|
|
8352
8355
|
Decorators_1.Override
|
|
8353
8356
|
], IdentityEqualityComparator.prototype, "equals", null);
|
|
8354
8357
|
PredictionContext2.IdentityEqualityComparator = IdentityEqualityComparator;
|
|
8355
|
-
})(PredictionContext$1 =
|
|
8358
|
+
})(PredictionContext$1 = exports2.PredictionContext || (exports2.PredictionContext = {}));
|
|
8356
8359
|
})(PredictionContext);
|
|
8357
8360
|
return PredictionContext;
|
|
8358
8361
|
}
|
|
@@ -9843,7 +9846,7 @@ var hasRequiredDFAState;
|
|
|
9843
9846
|
function requireDFAState() {
|
|
9844
9847
|
if (hasRequiredDFAState) return DFAState;
|
|
9845
9848
|
hasRequiredDFAState = 1;
|
|
9846
|
-
(function(
|
|
9849
|
+
(function(exports2) {
|
|
9847
9850
|
/*!
|
|
9848
9851
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
9849
9852
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -9859,8 +9862,8 @@ function requireDFAState() {
|
|
|
9859
9862
|
decorator(target, key, paramIndex);
|
|
9860
9863
|
};
|
|
9861
9864
|
};
|
|
9862
|
-
Object.defineProperty(
|
|
9863
|
-
|
|
9865
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
9866
|
+
exports2.DFAState = void 0;
|
|
9864
9867
|
const ATN_1 = requireATN();
|
|
9865
9868
|
const BitSet_1 = requireBitSet();
|
|
9866
9869
|
const MurmurHash_1 = requireMurmurHash();
|
|
@@ -10023,7 +10026,7 @@ function requireDFAState() {
|
|
|
10023
10026
|
__decorate([
|
|
10024
10027
|
Decorators_1.Override
|
|
10025
10028
|
], DFAState$1.prototype, "toString", null);
|
|
10026
|
-
|
|
10029
|
+
exports2.DFAState = DFAState$1;
|
|
10027
10030
|
(function(DFAState2) {
|
|
10028
10031
|
let PredPrediction = class PredPrediction {
|
|
10029
10032
|
constructor(pred, alt) {
|
|
@@ -10044,7 +10047,7 @@ function requireDFAState() {
|
|
|
10044
10047
|
__param(0, Decorators_1.NotNull)
|
|
10045
10048
|
], PredPrediction);
|
|
10046
10049
|
DFAState2.PredPrediction = PredPrediction;
|
|
10047
|
-
})(DFAState$1 =
|
|
10050
|
+
})(DFAState$1 = exports2.DFAState || (exports2.DFAState = {}));
|
|
10048
10051
|
})(DFAState);
|
|
10049
10052
|
return DFAState;
|
|
10050
10053
|
}
|
|
@@ -10052,7 +10055,7 @@ var hasRequiredATNSimulator;
|
|
|
10052
10055
|
function requireATNSimulator() {
|
|
10053
10056
|
if (hasRequiredATNSimulator) return ATNSimulator;
|
|
10054
10057
|
hasRequiredATNSimulator = 1;
|
|
10055
|
-
(function(
|
|
10058
|
+
(function(exports2) {
|
|
10056
10059
|
/*!
|
|
10057
10060
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
10058
10061
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -10068,8 +10071,8 @@ function requireATNSimulator() {
|
|
|
10068
10071
|
decorator(target, key, paramIndex);
|
|
10069
10072
|
};
|
|
10070
10073
|
};
|
|
10071
|
-
Object.defineProperty(
|
|
10072
|
-
|
|
10074
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10075
|
+
exports2.ATNSimulator = void 0;
|
|
10073
10076
|
const ATNConfigSet_1 = requireATNConfigSet();
|
|
10074
10077
|
const DFAState_1 = requireDFAState();
|
|
10075
10078
|
const Decorators_1 = requireDecorators();
|
|
@@ -10109,10 +10112,10 @@ function requireATNSimulator() {
|
|
|
10109
10112
|
ATNSimulator$1 = __decorate([
|
|
10110
10113
|
__param(0, Decorators_1.NotNull)
|
|
10111
10114
|
], ATNSimulator$1);
|
|
10112
|
-
|
|
10115
|
+
exports2.ATNSimulator = ATNSimulator$1;
|
|
10113
10116
|
/* @__PURE__ */ (function(ATNSimulator2) {
|
|
10114
|
-
})(ATNSimulator$1 =
|
|
10115
|
-
|
|
10117
|
+
})(ATNSimulator$1 = exports2.ATNSimulator || (exports2.ATNSimulator = {}));
|
|
10118
|
+
exports2.ATNSimulator = ATNSimulator$1;
|
|
10116
10119
|
})(ATNSimulator);
|
|
10117
10120
|
return ATNSimulator;
|
|
10118
10121
|
}
|
|
@@ -11456,7 +11459,7 @@ var hasRequiredATN;
|
|
|
11456
11459
|
function requireATN() {
|
|
11457
11460
|
if (hasRequiredATN) return ATN;
|
|
11458
11461
|
hasRequiredATN = 1;
|
|
11459
|
-
(function(
|
|
11462
|
+
(function(exports2) {
|
|
11460
11463
|
/*!
|
|
11461
11464
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
11462
11465
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -11472,8 +11475,8 @@ function requireATN() {
|
|
|
11472
11475
|
decorator(target, key, paramIndex);
|
|
11473
11476
|
};
|
|
11474
11477
|
};
|
|
11475
|
-
Object.defineProperty(
|
|
11476
|
-
|
|
11478
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11479
|
+
exports2.ATN = void 0;
|
|
11477
11480
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
11478
11481
|
const DFA_1 = requireDFA();
|
|
11479
11482
|
const IntervalSet_1 = requireIntervalSet();
|
|
@@ -11666,11 +11669,11 @@ function requireATN() {
|
|
|
11666
11669
|
ATN$1 = __decorate([
|
|
11667
11670
|
__param(0, Decorators_1.NotNull)
|
|
11668
11671
|
], ATN$1);
|
|
11669
|
-
|
|
11672
|
+
exports2.ATN = ATN$1;
|
|
11670
11673
|
(function(ATN2) {
|
|
11671
11674
|
ATN2.INVALID_ALT_NUMBER = 0;
|
|
11672
|
-
})(ATN$1 =
|
|
11673
|
-
|
|
11675
|
+
})(ATN$1 = exports2.ATN || (exports2.ATN = {}));
|
|
11676
|
+
exports2.ATN = ATN$1;
|
|
11674
11677
|
})(ATN);
|
|
11675
11678
|
return ATN;
|
|
11676
11679
|
}
|
|
@@ -12109,7 +12112,7 @@ var hasRequiredLexerATNSimulator;
|
|
|
12109
12112
|
function requireLexerATNSimulator() {
|
|
12110
12113
|
if (hasRequiredLexerATNSimulator) return LexerATNSimulator;
|
|
12111
12114
|
hasRequiredLexerATNSimulator = 1;
|
|
12112
|
-
(function(
|
|
12115
|
+
(function(exports2) {
|
|
12113
12116
|
/*!
|
|
12114
12117
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
12115
12118
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -12125,8 +12128,8 @@ function requireLexerATNSimulator() {
|
|
|
12125
12128
|
decorator(target, key, paramIndex);
|
|
12126
12129
|
};
|
|
12127
12130
|
};
|
|
12128
|
-
Object.defineProperty(
|
|
12129
|
-
|
|
12131
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12132
|
+
exports2.LexerATNSimulator = void 0;
|
|
12130
12133
|
const AcceptStateInfo_1 = requireAcceptStateInfo();
|
|
12131
12134
|
const ATN_1 = requireATN();
|
|
12132
12135
|
const ATNConfig_1 = requireATNConfig();
|
|
@@ -12687,7 +12690,7 @@ function requireLexerATNSimulator() {
|
|
|
12687
12690
|
LexerATNSimulator$1 = __decorate([
|
|
12688
12691
|
__param(0, Decorators_1.NotNull)
|
|
12689
12692
|
], LexerATNSimulator$1);
|
|
12690
|
-
|
|
12693
|
+
exports2.LexerATNSimulator = LexerATNSimulator$1;
|
|
12691
12694
|
(function(LexerATNSimulator2) {
|
|
12692
12695
|
LexerATNSimulator2.debug = false;
|
|
12693
12696
|
LexerATNSimulator2.dfa_debug = false;
|
|
@@ -12705,8 +12708,8 @@ function requireLexerATNSimulator() {
|
|
|
12705
12708
|
}
|
|
12706
12709
|
}
|
|
12707
12710
|
LexerATNSimulator2.SimState = SimState;
|
|
12708
|
-
})(LexerATNSimulator$1 =
|
|
12709
|
-
|
|
12711
|
+
})(LexerATNSimulator$1 = exports2.LexerATNSimulator || (exports2.LexerATNSimulator = {}));
|
|
12712
|
+
exports2.LexerATNSimulator = LexerATNSimulator$1;
|
|
12710
12713
|
})(LexerATNSimulator);
|
|
12711
12714
|
return LexerATNSimulator;
|
|
12712
12715
|
}
|
|
@@ -14272,7 +14275,7 @@ var hasRequiredLexerMoreAction;
|
|
|
14272
14275
|
function requireLexerMoreAction() {
|
|
14273
14276
|
if (hasRequiredLexerMoreAction) return LexerMoreAction;
|
|
14274
14277
|
hasRequiredLexerMoreAction = 1;
|
|
14275
|
-
(function(
|
|
14278
|
+
(function(exports2) {
|
|
14276
14279
|
/*!
|
|
14277
14280
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14278
14281
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14288,8 +14291,8 @@ function requireLexerMoreAction() {
|
|
|
14288
14291
|
decorator(target, key, paramIndex);
|
|
14289
14292
|
};
|
|
14290
14293
|
};
|
|
14291
|
-
Object.defineProperty(
|
|
14292
|
-
|
|
14294
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14295
|
+
exports2.LexerMoreAction = void 0;
|
|
14293
14296
|
const MurmurHash_1 = requireMurmurHash();
|
|
14294
14297
|
const Decorators_1 = requireDecorators();
|
|
14295
14298
|
let LexerMoreAction$1 = class LexerMoreAction {
|
|
@@ -14351,10 +14354,10 @@ function requireLexerMoreAction() {
|
|
|
14351
14354
|
__decorate([
|
|
14352
14355
|
Decorators_1.Override
|
|
14353
14356
|
], LexerMoreAction$1.prototype, "toString", null);
|
|
14354
|
-
|
|
14357
|
+
exports2.LexerMoreAction = LexerMoreAction$1;
|
|
14355
14358
|
(function(LexerMoreAction2) {
|
|
14356
14359
|
LexerMoreAction2.INSTANCE = new LexerMoreAction2();
|
|
14357
|
-
})(LexerMoreAction$1 =
|
|
14360
|
+
})(LexerMoreAction$1 = exports2.LexerMoreAction || (exports2.LexerMoreAction = {}));
|
|
14358
14361
|
})(LexerMoreAction);
|
|
14359
14362
|
return LexerMoreAction;
|
|
14360
14363
|
}
|
|
@@ -14363,7 +14366,7 @@ var hasRequiredLexerPopModeAction;
|
|
|
14363
14366
|
function requireLexerPopModeAction() {
|
|
14364
14367
|
if (hasRequiredLexerPopModeAction) return LexerPopModeAction;
|
|
14365
14368
|
hasRequiredLexerPopModeAction = 1;
|
|
14366
|
-
(function(
|
|
14369
|
+
(function(exports2) {
|
|
14367
14370
|
/*!
|
|
14368
14371
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14369
14372
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14379,8 +14382,8 @@ function requireLexerPopModeAction() {
|
|
|
14379
14382
|
decorator(target, key, paramIndex);
|
|
14380
14383
|
};
|
|
14381
14384
|
};
|
|
14382
|
-
Object.defineProperty(
|
|
14383
|
-
|
|
14385
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14386
|
+
exports2.LexerPopModeAction = void 0;
|
|
14384
14387
|
const MurmurHash_1 = requireMurmurHash();
|
|
14385
14388
|
const Decorators_1 = requireDecorators();
|
|
14386
14389
|
let LexerPopModeAction$1 = class LexerPopModeAction {
|
|
@@ -14442,10 +14445,10 @@ function requireLexerPopModeAction() {
|
|
|
14442
14445
|
__decorate([
|
|
14443
14446
|
Decorators_1.Override
|
|
14444
14447
|
], LexerPopModeAction$1.prototype, "toString", null);
|
|
14445
|
-
|
|
14448
|
+
exports2.LexerPopModeAction = LexerPopModeAction$1;
|
|
14446
14449
|
(function(LexerPopModeAction2) {
|
|
14447
14450
|
LexerPopModeAction2.INSTANCE = new LexerPopModeAction2();
|
|
14448
|
-
})(LexerPopModeAction$1 =
|
|
14451
|
+
})(LexerPopModeAction$1 = exports2.LexerPopModeAction || (exports2.LexerPopModeAction = {}));
|
|
14449
14452
|
})(LexerPopModeAction);
|
|
14450
14453
|
return LexerPopModeAction;
|
|
14451
14454
|
}
|
|
@@ -14557,7 +14560,7 @@ var hasRequiredLexerSkipAction;
|
|
|
14557
14560
|
function requireLexerSkipAction() {
|
|
14558
14561
|
if (hasRequiredLexerSkipAction) return LexerSkipAction;
|
|
14559
14562
|
hasRequiredLexerSkipAction = 1;
|
|
14560
|
-
(function(
|
|
14563
|
+
(function(exports2) {
|
|
14561
14564
|
/*!
|
|
14562
14565
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14563
14566
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14573,8 +14576,8 @@ function requireLexerSkipAction() {
|
|
|
14573
14576
|
decorator(target, key, paramIndex);
|
|
14574
14577
|
};
|
|
14575
14578
|
};
|
|
14576
|
-
Object.defineProperty(
|
|
14577
|
-
|
|
14579
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14580
|
+
exports2.LexerSkipAction = void 0;
|
|
14578
14581
|
const MurmurHash_1 = requireMurmurHash();
|
|
14579
14582
|
const Decorators_1 = requireDecorators();
|
|
14580
14583
|
let LexerSkipAction$1 = class LexerSkipAction {
|
|
@@ -14636,10 +14639,10 @@ function requireLexerSkipAction() {
|
|
|
14636
14639
|
__decorate([
|
|
14637
14640
|
Decorators_1.Override
|
|
14638
14641
|
], LexerSkipAction$1.prototype, "toString", null);
|
|
14639
|
-
|
|
14642
|
+
exports2.LexerSkipAction = LexerSkipAction$1;
|
|
14640
14643
|
(function(LexerSkipAction2) {
|
|
14641
14644
|
LexerSkipAction2.INSTANCE = new LexerSkipAction2();
|
|
14642
|
-
})(LexerSkipAction$1 =
|
|
14645
|
+
})(LexerSkipAction$1 = exports2.LexerSkipAction || (exports2.LexerSkipAction = {}));
|
|
14643
14646
|
})(LexerSkipAction);
|
|
14644
14647
|
return LexerSkipAction;
|
|
14645
14648
|
}
|
|
@@ -15677,7 +15680,7 @@ var hasRequiredPredictionMode;
|
|
|
15677
15680
|
function requirePredictionMode() {
|
|
15678
15681
|
if (hasRequiredPredictionMode) return PredictionMode;
|
|
15679
15682
|
hasRequiredPredictionMode = 1;
|
|
15680
|
-
(function(
|
|
15683
|
+
(function(exports2) {
|
|
15681
15684
|
/*!
|
|
15682
15685
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
15683
15686
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -15688,8 +15691,8 @@ function requirePredictionMode() {
|
|
|
15688
15691
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15689
15692
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15690
15693
|
};
|
|
15691
|
-
Object.defineProperty(
|
|
15692
|
-
|
|
15694
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15695
|
+
exports2.PredictionMode = void 0;
|
|
15693
15696
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
15694
15697
|
const MurmurHash_1 = requireMurmurHash();
|
|
15695
15698
|
const Decorators_1 = requireDecorators();
|
|
@@ -15698,7 +15701,7 @@ function requirePredictionMode() {
|
|
|
15698
15701
|
PredictionMode2[PredictionMode2["SLL"] = 0] = "SLL";
|
|
15699
15702
|
PredictionMode2[PredictionMode2["LL"] = 1] = "LL";
|
|
15700
15703
|
PredictionMode2[PredictionMode2["LL_EXACT_AMBIG_DETECTION"] = 2] = "LL_EXACT_AMBIG_DETECTION";
|
|
15701
|
-
})(
|
|
15704
|
+
})(exports2.PredictionMode || (exports2.PredictionMode = {}));
|
|
15702
15705
|
(function(PredictionMode2) {
|
|
15703
15706
|
class AltAndContextMap extends Array2DHashMap_1.Array2DHashMap {
|
|
15704
15707
|
constructor() {
|
|
@@ -15754,7 +15757,7 @@ function requirePredictionMode() {
|
|
|
15754
15757
|
return true;
|
|
15755
15758
|
}
|
|
15756
15759
|
PredictionMode2.allConfigsInRuleStopStates = allConfigsInRuleStopStates;
|
|
15757
|
-
})(
|
|
15760
|
+
})(exports2.PredictionMode || (exports2.PredictionMode = {}));
|
|
15758
15761
|
})(PredictionMode);
|
|
15759
15762
|
return PredictionMode;
|
|
15760
15763
|
}
|
|
@@ -19203,13 +19206,13 @@ var hasRequiredCodePointBuffer;
|
|
|
19203
19206
|
function requireCodePointBuffer() {
|
|
19204
19207
|
if (hasRequiredCodePointBuffer) return CodePointBuffer;
|
|
19205
19208
|
hasRequiredCodePointBuffer = 1;
|
|
19206
|
-
(function(
|
|
19209
|
+
(function(exports2) {
|
|
19207
19210
|
/*!
|
|
19208
19211
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
19209
19212
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
19210
19213
|
*/
|
|
19211
|
-
Object.defineProperty(
|
|
19212
|
-
|
|
19214
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19215
|
+
exports2.CodePointBuffer = void 0;
|
|
19213
19216
|
const assert2 = requireAssert();
|
|
19214
19217
|
const Character2 = requireCharacter();
|
|
19215
19218
|
class CodePointBuffer2 {
|
|
@@ -19243,7 +19246,7 @@ function requireCodePointBuffer() {
|
|
|
19243
19246
|
return new CodePointBuffer2.Builder(initialBufferSize);
|
|
19244
19247
|
}
|
|
19245
19248
|
}
|
|
19246
|
-
|
|
19249
|
+
exports2.CodePointBuffer = CodePointBuffer2;
|
|
19247
19250
|
(function(CodePointBuffer3) {
|
|
19248
19251
|
let Type;
|
|
19249
19252
|
(function(Type2) {
|
|
@@ -19420,7 +19423,7 @@ function requireCodePointBuffer() {
|
|
|
19420
19423
|
}
|
|
19421
19424
|
}
|
|
19422
19425
|
CodePointBuffer3.Builder = Builder;
|
|
19423
|
-
})(CodePointBuffer2 =
|
|
19426
|
+
})(CodePointBuffer2 = exports2.CodePointBuffer || (exports2.CodePointBuffer = {}));
|
|
19424
19427
|
})(CodePointBuffer);
|
|
19425
19428
|
return CodePointBuffer;
|
|
19426
19429
|
}
|
|
@@ -19560,13 +19563,13 @@ var hasRequiredCharStreams;
|
|
|
19560
19563
|
function requireCharStreams() {
|
|
19561
19564
|
if (hasRequiredCharStreams) return CharStreams;
|
|
19562
19565
|
hasRequiredCharStreams = 1;
|
|
19563
|
-
(function(
|
|
19566
|
+
(function(exports2) {
|
|
19564
19567
|
/*!
|
|
19565
19568
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
19566
19569
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
19567
19570
|
*/
|
|
19568
|
-
Object.defineProperty(
|
|
19569
|
-
|
|
19571
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
19572
|
+
exports2.CharStreams = void 0;
|
|
19570
19573
|
const CodePointBuffer_1 = requireCodePointBuffer();
|
|
19571
19574
|
const CodePointCharStream_1 = requireCodePointCharStream();
|
|
19572
19575
|
const IntStream_1 = requireIntStream();
|
|
@@ -19584,7 +19587,7 @@ function requireCharStreams() {
|
|
|
19584
19587
|
return CodePointCharStream_1.CodePointCharStream.fromBuffer(codePointBufferBuilder.build(), sourceName);
|
|
19585
19588
|
}
|
|
19586
19589
|
CharStreams2.fromString = fromString;
|
|
19587
|
-
})(
|
|
19590
|
+
})(exports2.CharStreams || (exports2.CharStreams = {}));
|
|
19588
19591
|
})(CharStreams);
|
|
19589
19592
|
return CharStreams;
|
|
19590
19593
|
}
|
|
@@ -22176,7 +22179,7 @@ var hasRequiredParseTreePatternMatcher;
|
|
|
22176
22179
|
function requireParseTreePatternMatcher() {
|
|
22177
22180
|
if (hasRequiredParseTreePatternMatcher) return ParseTreePatternMatcher;
|
|
22178
22181
|
hasRequiredParseTreePatternMatcher = 1;
|
|
22179
|
-
(function(
|
|
22182
|
+
(function(exports2) {
|
|
22180
22183
|
/*!
|
|
22181
22184
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
22182
22185
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -22192,8 +22195,8 @@ function requireParseTreePatternMatcher() {
|
|
|
22192
22195
|
decorator(target, key, paramIndex);
|
|
22193
22196
|
};
|
|
22194
22197
|
};
|
|
22195
|
-
Object.defineProperty(
|
|
22196
|
-
|
|
22198
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22199
|
+
exports2.ParseTreePatternMatcher = void 0;
|
|
22197
22200
|
const BailErrorStrategy_1 = requireBailErrorStrategy();
|
|
22198
22201
|
const CharStreams_1 = requireCharStreams();
|
|
22199
22202
|
const CommonTokenStream_1 = requireCommonTokenStream();
|
|
@@ -22529,7 +22532,7 @@ function requireParseTreePatternMatcher() {
|
|
|
22529
22532
|
__param(1, Decorators_1.NotNull),
|
|
22530
22533
|
__param(2, Decorators_1.NotNull)
|
|
22531
22534
|
], ParseTreePatternMatcher$1.prototype, "matchImpl", null);
|
|
22532
|
-
|
|
22535
|
+
exports2.ParseTreePatternMatcher = ParseTreePatternMatcher$1;
|
|
22533
22536
|
(function(ParseTreePatternMatcher2) {
|
|
22534
22537
|
class CannotInvokeStartRule extends Error {
|
|
22535
22538
|
constructor(error) {
|
|
@@ -22544,7 +22547,7 @@ function requireParseTreePatternMatcher() {
|
|
|
22544
22547
|
}
|
|
22545
22548
|
}
|
|
22546
22549
|
ParseTreePatternMatcher2.StartRuleDoesNotConsumeFullPattern = StartRuleDoesNotConsumeFullPattern;
|
|
22547
|
-
})(ParseTreePatternMatcher$1 =
|
|
22550
|
+
})(ParseTreePatternMatcher$1 = exports2.ParseTreePatternMatcher || (exports2.ParseTreePatternMatcher = {}));
|
|
22548
22551
|
})(ParseTreePatternMatcher);
|
|
22549
22552
|
return ParseTreePatternMatcher;
|
|
22550
22553
|
}
|
|
@@ -24828,13 +24831,13 @@ var hasRequiredDependents;
|
|
|
24828
24831
|
function requireDependents() {
|
|
24829
24832
|
if (hasRequiredDependents) return Dependents;
|
|
24830
24833
|
hasRequiredDependents = 1;
|
|
24831
|
-
(function(
|
|
24834
|
+
(function(exports2) {
|
|
24832
24835
|
/*!
|
|
24833
24836
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
24834
24837
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
24835
24838
|
*/
|
|
24836
|
-
Object.defineProperty(
|
|
24837
|
-
|
|
24839
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
24840
|
+
exports2.Dependents = void 0;
|
|
24838
24841
|
(function(Dependents2) {
|
|
24839
24842
|
Dependents2[Dependents2["SELF"] = 0] = "SELF";
|
|
24840
24843
|
Dependents2[Dependents2["PARENTS"] = 1] = "PARENTS";
|
|
@@ -24846,7 +24849,7 @@ function requireDependents() {
|
|
|
24846
24849
|
Dependents2[Dependents2["FOLLOWING_SIBLINGS"] = 7] = "FOLLOWING_SIBLINGS";
|
|
24847
24850
|
Dependents2[Dependents2["PRECEEDING"] = 8] = "PRECEEDING";
|
|
24848
24851
|
Dependents2[Dependents2["FOLLOWING"] = 9] = "FOLLOWING";
|
|
24849
|
-
})(
|
|
24852
|
+
})(exports2.Dependents || (exports2.Dependents = {}));
|
|
24850
24853
|
})(Dependents);
|
|
24851
24854
|
return Dependents;
|
|
24852
24855
|
}
|
|
@@ -25609,7 +25612,7 @@ var hasRequiredAntlr4ts;
|
|
|
25609
25612
|
function requireAntlr4ts() {
|
|
25610
25613
|
if (hasRequiredAntlr4ts) return antlr4ts;
|
|
25611
25614
|
hasRequiredAntlr4ts = 1;
|
|
25612
|
-
(function(
|
|
25615
|
+
(function(exports2) {
|
|
25613
25616
|
/*!
|
|
25614
25617
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
25615
25618
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -25623,59 +25626,60 @@ function requireAntlr4ts() {
|
|
|
25623
25626
|
if (k2 === void 0) k2 = k;
|
|
25624
25627
|
o[k2] = m[k];
|
|
25625
25628
|
}));
|
|
25626
|
-
var __exportStar = antlr4ts && antlr4ts.__exportStar || function(m,
|
|
25627
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(
|
|
25629
|
+
var __exportStar = antlr4ts && antlr4ts.__exportStar || function(m, exports3) {
|
|
25630
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
25628
25631
|
};
|
|
25629
|
-
Object.defineProperty(
|
|
25630
|
-
__exportStar(requireANTLRErrorListener(),
|
|
25631
|
-
__exportStar(requireANTLRErrorStrategy(),
|
|
25632
|
-
__exportStar(requireANTLRInputStream(),
|
|
25633
|
-
__exportStar(requireBailErrorStrategy(),
|
|
25634
|
-
__exportStar(requireBufferedTokenStream(),
|
|
25635
|
-
__exportStar(requireCharStream(),
|
|
25636
|
-
__exportStar(requireCharStreams(),
|
|
25637
|
-
__exportStar(requireCodePointBuffer(),
|
|
25638
|
-
__exportStar(requireCodePointCharStream(),
|
|
25639
|
-
__exportStar(requireCommonToken(),
|
|
25640
|
-
__exportStar(requireCommonTokenFactory(),
|
|
25641
|
-
__exportStar(requireCommonTokenStream(),
|
|
25642
|
-
__exportStar(requireConsoleErrorListener(),
|
|
25643
|
-
__exportStar(requireDefaultErrorStrategy(),
|
|
25644
|
-
__exportStar(requireDependents(),
|
|
25645
|
-
__exportStar(requireDiagnosticErrorListener(),
|
|
25646
|
-
__exportStar(requireFailedPredicateException(),
|
|
25647
|
-
__exportStar(requireInputMismatchException(),
|
|
25648
|
-
__exportStar(requireInterpreterRuleContext(),
|
|
25649
|
-
__exportStar(requireIntStream(),
|
|
25650
|
-
__exportStar(requireLexer(),
|
|
25651
|
-
__exportStar(requireLexerInterpreter(),
|
|
25652
|
-
__exportStar(requireLexerNoViableAltException(),
|
|
25653
|
-
__exportStar(requireListTokenSource(),
|
|
25654
|
-
__exportStar(requireNoViableAltException(),
|
|
25655
|
-
__exportStar(requireParser(),
|
|
25656
|
-
__exportStar(requireParserErrorListener(),
|
|
25657
|
-
__exportStar(requireParserInterpreter(),
|
|
25658
|
-
__exportStar(requireParserRuleContext(),
|
|
25659
|
-
__exportStar(requireProxyErrorListener(),
|
|
25660
|
-
__exportStar(requireProxyParserErrorListener(),
|
|
25661
|
-
__exportStar(requireRecognitionException(),
|
|
25662
|
-
__exportStar(requireRecognizer(),
|
|
25663
|
-
__exportStar(requireRuleContext(),
|
|
25664
|
-
__exportStar(requireRuleContextWithAltNum(),
|
|
25665
|
-
__exportStar(requireRuleDependency(),
|
|
25666
|
-
__exportStar(requireRuleVersion(),
|
|
25667
|
-
__exportStar(requireToken(),
|
|
25668
|
-
__exportStar(requireTokenFactory(),
|
|
25669
|
-
__exportStar(requireTokenSource(),
|
|
25670
|
-
__exportStar(requireTokenStream(),
|
|
25671
|
-
__exportStar(requireTokenStreamRewriter(),
|
|
25672
|
-
__exportStar(requireVocabulary(),
|
|
25673
|
-
__exportStar(requireVocabularyImpl(),
|
|
25674
|
-
__exportStar(requireWritableToken(),
|
|
25632
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25633
|
+
__exportStar(requireANTLRErrorListener(), exports2);
|
|
25634
|
+
__exportStar(requireANTLRErrorStrategy(), exports2);
|
|
25635
|
+
__exportStar(requireANTLRInputStream(), exports2);
|
|
25636
|
+
__exportStar(requireBailErrorStrategy(), exports2);
|
|
25637
|
+
__exportStar(requireBufferedTokenStream(), exports2);
|
|
25638
|
+
__exportStar(requireCharStream(), exports2);
|
|
25639
|
+
__exportStar(requireCharStreams(), exports2);
|
|
25640
|
+
__exportStar(requireCodePointBuffer(), exports2);
|
|
25641
|
+
__exportStar(requireCodePointCharStream(), exports2);
|
|
25642
|
+
__exportStar(requireCommonToken(), exports2);
|
|
25643
|
+
__exportStar(requireCommonTokenFactory(), exports2);
|
|
25644
|
+
__exportStar(requireCommonTokenStream(), exports2);
|
|
25645
|
+
__exportStar(requireConsoleErrorListener(), exports2);
|
|
25646
|
+
__exportStar(requireDefaultErrorStrategy(), exports2);
|
|
25647
|
+
__exportStar(requireDependents(), exports2);
|
|
25648
|
+
__exportStar(requireDiagnosticErrorListener(), exports2);
|
|
25649
|
+
__exportStar(requireFailedPredicateException(), exports2);
|
|
25650
|
+
__exportStar(requireInputMismatchException(), exports2);
|
|
25651
|
+
__exportStar(requireInterpreterRuleContext(), exports2);
|
|
25652
|
+
__exportStar(requireIntStream(), exports2);
|
|
25653
|
+
__exportStar(requireLexer(), exports2);
|
|
25654
|
+
__exportStar(requireLexerInterpreter(), exports2);
|
|
25655
|
+
__exportStar(requireLexerNoViableAltException(), exports2);
|
|
25656
|
+
__exportStar(requireListTokenSource(), exports2);
|
|
25657
|
+
__exportStar(requireNoViableAltException(), exports2);
|
|
25658
|
+
__exportStar(requireParser(), exports2);
|
|
25659
|
+
__exportStar(requireParserErrorListener(), exports2);
|
|
25660
|
+
__exportStar(requireParserInterpreter(), exports2);
|
|
25661
|
+
__exportStar(requireParserRuleContext(), exports2);
|
|
25662
|
+
__exportStar(requireProxyErrorListener(), exports2);
|
|
25663
|
+
__exportStar(requireProxyParserErrorListener(), exports2);
|
|
25664
|
+
__exportStar(requireRecognitionException(), exports2);
|
|
25665
|
+
__exportStar(requireRecognizer(), exports2);
|
|
25666
|
+
__exportStar(requireRuleContext(), exports2);
|
|
25667
|
+
__exportStar(requireRuleContextWithAltNum(), exports2);
|
|
25668
|
+
__exportStar(requireRuleDependency(), exports2);
|
|
25669
|
+
__exportStar(requireRuleVersion(), exports2);
|
|
25670
|
+
__exportStar(requireToken(), exports2);
|
|
25671
|
+
__exportStar(requireTokenFactory(), exports2);
|
|
25672
|
+
__exportStar(requireTokenSource(), exports2);
|
|
25673
|
+
__exportStar(requireTokenStream(), exports2);
|
|
25674
|
+
__exportStar(requireTokenStreamRewriter(), exports2);
|
|
25675
|
+
__exportStar(requireVocabulary(), exports2);
|
|
25676
|
+
__exportStar(requireVocabularyImpl(), exports2);
|
|
25677
|
+
__exportStar(requireWritableToken(), exports2);
|
|
25675
25678
|
})(antlr4ts);
|
|
25676
25679
|
return antlr4ts;
|
|
25677
25680
|
}
|
|
25678
25681
|
var antlr4tsExports = requireAntlr4ts();
|
|
25682
|
+
var PredictionModeExports = requirePredictionMode();
|
|
25679
25683
|
var ATNDeserializerExports = requireATNDeserializer();
|
|
25680
25684
|
var LexerExports = requireLexer();
|
|
25681
25685
|
var LexerATNSimulatorExports = requireLexerATNSimulator();
|
|
@@ -50917,6 +50921,8 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
|
50917
50921
|
NodeType2["ConstraintOperator"] = "ConstraintOperator";
|
|
50918
50922
|
NodeType2["LogicalOperator"] = "LogicalOperator";
|
|
50919
50923
|
NodeType2["Refinement"] = "Refinement";
|
|
50924
|
+
NodeType2["AttributeSet"] = "AttributeSet";
|
|
50925
|
+
NodeType2["AttributeGroup"] = "AttributeGroup";
|
|
50920
50926
|
NodeType2["Attribute"] = "Attribute";
|
|
50921
50927
|
NodeType2["AttributeName"] = "AttributeName";
|
|
50922
50928
|
NodeType2["AttributeValue"] = "AttributeValue";
|
|
@@ -51111,76 +51117,106 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51111
51117
|
};
|
|
51112
51118
|
}
|
|
51113
51119
|
visitEclrefinement(ctx) {
|
|
51120
|
+
const content = this.buildRefinement(ctx);
|
|
51114
51121
|
const attributes = [];
|
|
51115
|
-
|
|
51122
|
+
collectAttributes$1(content, attributes);
|
|
51123
|
+
return {
|
|
51124
|
+
type: NodeType.Refinement,
|
|
51125
|
+
range: this.getRange(ctx),
|
|
51126
|
+
attributes,
|
|
51127
|
+
content
|
|
51128
|
+
};
|
|
51129
|
+
}
|
|
51130
|
+
/**
|
|
51131
|
+
* eclrefinement : subrefinement ws (conjunctionrefinementset | disjunctionrefinementset)?
|
|
51132
|
+
*
|
|
51133
|
+
* The grammar forbids mixing conjunction and disjunction at the same level, so
|
|
51134
|
+
* at most one of the two sets is present and the resulting set is homogeneous.
|
|
51135
|
+
*/
|
|
51136
|
+
buildRefinement(ctx) {
|
|
51137
|
+
const first = this.buildSubrefinement(ctx.subrefinement());
|
|
51116
51138
|
const conjSet = ctx.conjunctionrefinementset();
|
|
51117
51139
|
if (conjSet) {
|
|
51118
|
-
const
|
|
51119
|
-
|
|
51120
|
-
this.collectAttributesFromSubrefinement(sub, attributes);
|
|
51121
|
-
}
|
|
51140
|
+
const rest = conjSet.subrefinement().map((sub) => this.buildSubrefinement(sub));
|
|
51141
|
+
return this.makeSet(ctx, "AND", conjunctionStyle(conjSet.conjunction()), [first, ...rest]);
|
|
51122
51142
|
}
|
|
51123
51143
|
const disjSet = ctx.disjunctionrefinementset();
|
|
51124
51144
|
if (disjSet) {
|
|
51125
|
-
const
|
|
51126
|
-
|
|
51127
|
-
this.collectAttributesFromSubrefinement(sub, attributes);
|
|
51128
|
-
}
|
|
51145
|
+
const rest = disjSet.subrefinement().map((sub) => this.buildSubrefinement(sub));
|
|
51146
|
+
return this.makeSet(ctx, "OR", ",", [first, ...rest]);
|
|
51129
51147
|
}
|
|
51130
|
-
return
|
|
51131
|
-
type: NodeType.Refinement,
|
|
51132
|
-
range: this.getRange(ctx),
|
|
51133
|
-
attributes
|
|
51134
|
-
};
|
|
51148
|
+
return first;
|
|
51135
51149
|
}
|
|
51136
|
-
|
|
51150
|
+
/** subrefinement : eclattributeset | eclattributegroup | ( eclrefinement ) */
|
|
51151
|
+
buildSubrefinement(ctx) {
|
|
51137
51152
|
const attrSet = ctx.eclattributeset();
|
|
51138
51153
|
if (attrSet) {
|
|
51139
|
-
this.
|
|
51140
|
-
return;
|
|
51154
|
+
return this.buildAttributeSet(attrSet);
|
|
51141
51155
|
}
|
|
51142
51156
|
const attrGroup = ctx.eclattributegroup();
|
|
51143
51157
|
if (attrGroup) {
|
|
51144
|
-
const
|
|
51145
|
-
|
|
51146
|
-
|
|
51158
|
+
const content = this.buildAttributeSet(attrGroup.eclattributeset());
|
|
51159
|
+
if (!content) {
|
|
51160
|
+
return null;
|
|
51161
|
+
}
|
|
51162
|
+
const cardinality = attrGroup.cardinality();
|
|
51163
|
+
const group = {
|
|
51164
|
+
type: NodeType.AttributeGroup,
|
|
51165
|
+
range: this.getRange(ctx),
|
|
51166
|
+
content
|
|
51167
|
+
};
|
|
51168
|
+
if (cardinality) {
|
|
51169
|
+
group.cardinality = "[" + cardinality.text + "]";
|
|
51170
|
+
}
|
|
51171
|
+
return group;
|
|
51147
51172
|
}
|
|
51148
51173
|
const nestedRef = ctx.eclrefinement();
|
|
51149
|
-
|
|
51150
|
-
const nested = this.visitEclrefinement(nestedRef);
|
|
51151
|
-
attributes.push(...nested.attributes);
|
|
51152
|
-
}
|
|
51174
|
+
return nestedRef ? markParenthesized(this.buildRefinement(nestedRef)) : null;
|
|
51153
51175
|
}
|
|
51154
|
-
|
|
51155
|
-
|
|
51176
|
+
/** eclattributeset : subattributeset ws (conjunctionattributeset | disjunctionattributeset)? */
|
|
51177
|
+
buildAttributeSet(ctx) {
|
|
51178
|
+
const first = this.buildSubattributeSet(ctx.subattributeset());
|
|
51156
51179
|
const conjSet = ctx.conjunctionattributeset();
|
|
51157
51180
|
if (conjSet) {
|
|
51158
|
-
const
|
|
51159
|
-
|
|
51160
|
-
this.collectAttributeFromSubattributeset(sub, attributes);
|
|
51161
|
-
}
|
|
51181
|
+
const rest = conjSet.subattributeset().map((sub) => this.buildSubattributeSet(sub));
|
|
51182
|
+
return this.makeSet(ctx, "AND", conjunctionStyle(conjSet.conjunction()), [first, ...rest]);
|
|
51162
51183
|
}
|
|
51163
51184
|
const disjSet = ctx.disjunctionattributeset();
|
|
51164
51185
|
if (disjSet) {
|
|
51165
|
-
const
|
|
51166
|
-
|
|
51167
|
-
this.collectAttributeFromSubattributeset(sub, attributes);
|
|
51168
|
-
}
|
|
51186
|
+
const rest = disjSet.subattributeset().map((sub) => this.buildSubattributeSet(sub));
|
|
51187
|
+
return this.makeSet(ctx, "OR", ",", [first, ...rest]);
|
|
51169
51188
|
}
|
|
51189
|
+
return first;
|
|
51170
51190
|
}
|
|
51171
|
-
|
|
51191
|
+
/** subattributeset : eclattribute | ( eclattributeset ) */
|
|
51192
|
+
buildSubattributeSet(ctx) {
|
|
51172
51193
|
const attr = ctx.eclattribute();
|
|
51173
51194
|
if (attr) {
|
|
51174
|
-
|
|
51175
|
-
if (attrNode) {
|
|
51176
|
-
attributes.push(attrNode);
|
|
51177
|
-
}
|
|
51178
|
-
return;
|
|
51195
|
+
return this.visitEclattribute(attr);
|
|
51179
51196
|
}
|
|
51180
51197
|
const nestedSet = ctx.eclattributeset();
|
|
51181
|
-
|
|
51182
|
-
|
|
51198
|
+
return nestedSet ? markParenthesized(this.buildAttributeSet(nestedSet)) : null;
|
|
51199
|
+
}
|
|
51200
|
+
/**
|
|
51201
|
+
* Build a set node from its members, dropping members that failed to parse.
|
|
51202
|
+
* Collapses to the single member when only one survives, so a set node always
|
|
51203
|
+
* represents a real operator in the source.
|
|
51204
|
+
*/
|
|
51205
|
+
makeSet(ctx, operator, style, members) {
|
|
51206
|
+
const present = members.filter((m) => m !== null);
|
|
51207
|
+
if (present.length === 0) {
|
|
51208
|
+
return null;
|
|
51183
51209
|
}
|
|
51210
|
+
if (present.length === 1) {
|
|
51211
|
+
return present[0];
|
|
51212
|
+
}
|
|
51213
|
+
return {
|
|
51214
|
+
type: NodeType.AttributeSet,
|
|
51215
|
+
range: this.getRange(ctx),
|
|
51216
|
+
operator,
|
|
51217
|
+
conjunctionStyle: operator === "AND" ? style : ",",
|
|
51218
|
+
members: present
|
|
51219
|
+
};
|
|
51184
51220
|
}
|
|
51185
51221
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- ANTLR visitor with multiple grammar rule branches
|
|
51186
51222
|
visitEclattribute(ctx) {
|
|
@@ -51243,12 +51279,14 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51243
51279
|
rawValue: ctx.text
|
|
51244
51280
|
};
|
|
51245
51281
|
}
|
|
51282
|
+
const cardinalityCtx = ctx.cardinality();
|
|
51246
51283
|
return {
|
|
51247
51284
|
type: NodeType.Attribute,
|
|
51248
51285
|
range: this.getRange(ctx),
|
|
51249
51286
|
name: attrName,
|
|
51250
51287
|
value,
|
|
51251
|
-
reversed
|
|
51288
|
+
reversed,
|
|
51289
|
+
cardinality: cardinalityCtx ? "[" + cardinalityCtx.text + "]" : void 0
|
|
51252
51290
|
};
|
|
51253
51291
|
}
|
|
51254
51292
|
// Dotted expressions
|
|
@@ -51451,6 +51489,28 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51451
51489
|
}
|
|
51452
51490
|
}
|
|
51453
51491
|
}
|
|
51492
|
+
function conjunctionStyle(conjunctions) {
|
|
51493
|
+
return conjunctions.some((c) => !c.text.trimStart().startsWith(",")) ? "AND" : ",";
|
|
51494
|
+
}
|
|
51495
|
+
function collectAttributes$1(node, out) {
|
|
51496
|
+
if (!node) return;
|
|
51497
|
+
switch (node.type) {
|
|
51498
|
+
case NodeType.Attribute:
|
|
51499
|
+
out.push(node);
|
|
51500
|
+
break;
|
|
51501
|
+
case NodeType.AttributeGroup:
|
|
51502
|
+
collectAttributes$1(node.content, out);
|
|
51503
|
+
break;
|
|
51504
|
+
case NodeType.AttributeSet:
|
|
51505
|
+
for (const member of node.members) {
|
|
51506
|
+
collectAttributes$1(member, out);
|
|
51507
|
+
}
|
|
51508
|
+
break;
|
|
51509
|
+
}
|
|
51510
|
+
}
|
|
51511
|
+
function markParenthesized(node) {
|
|
51512
|
+
return (node == null ? void 0 : node.type) === NodeType.AttributeSet ? { ...node, parenthesized: true } : node;
|
|
51513
|
+
}
|
|
51454
51514
|
class ECLErrorListener {
|
|
51455
51515
|
constructor() {
|
|
51456
51516
|
__publicField(this, "errors", []);
|
|
@@ -51816,34 +51876,12 @@ function computeColumn(text, i, baseColumn) {
|
|
|
51816
51876
|
}
|
|
51817
51877
|
let lastInput = null;
|
|
51818
51878
|
let lastResult = null;
|
|
51819
|
-
function
|
|
51820
|
-
if (input === lastInput && lastResult !== null) {
|
|
51821
|
-
return lastResult;
|
|
51822
|
-
}
|
|
51879
|
+
function runParseAttempt(input, predictionMode) {
|
|
51823
51880
|
const inputStream = new antlr4tsExports.ANTLRInputStream(input);
|
|
51824
51881
|
const lexer = new ECLLexer(inputStream);
|
|
51825
51882
|
const tokenStream = new antlr4tsExports.CommonTokenStream(lexer);
|
|
51826
|
-
tokenStream.fill();
|
|
51827
|
-
const tokens = tokenStream.getTokens().map((token) => {
|
|
51828
|
-
var _a;
|
|
51829
|
-
return {
|
|
51830
|
-
type: token.type,
|
|
51831
|
-
text: token.text ?? "",
|
|
51832
|
-
range: {
|
|
51833
|
-
start: {
|
|
51834
|
-
line: token.line,
|
|
51835
|
-
column: token.charPositionInLine,
|
|
51836
|
-
offset: token.startIndex
|
|
51837
|
-
},
|
|
51838
|
-
end: {
|
|
51839
|
-
line: token.line,
|
|
51840
|
-
column: token.charPositionInLine + (((_a = token.text) == null ? void 0 : _a.length) ?? 0),
|
|
51841
|
-
offset: token.stopIndex + 1
|
|
51842
|
-
}
|
|
51843
|
-
}
|
|
51844
|
-
};
|
|
51845
|
-
});
|
|
51846
51883
|
const parser = new ECLParser(tokenStream);
|
|
51884
|
+
parser.interpreter.setPredictionMode(predictionMode);
|
|
51847
51885
|
const errorListener = new ECLErrorListener();
|
|
51848
51886
|
parser.removeErrorListeners();
|
|
51849
51887
|
parser.addErrorListener(errorListener);
|
|
@@ -51868,7 +51906,44 @@ function parseECL(input) {
|
|
|
51868
51906
|
}
|
|
51869
51907
|
} catch {
|
|
51870
51908
|
}
|
|
51871
|
-
|
|
51909
|
+
return { ast, errors: errorListener.getErrors() };
|
|
51910
|
+
}
|
|
51911
|
+
function parseWithFallback(input) {
|
|
51912
|
+
const sll = runParseAttempt(input, PredictionModeExports.PredictionMode.SLL);
|
|
51913
|
+
if (sll.ast !== null && sll.errors.length === 0) {
|
|
51914
|
+
return sll;
|
|
51915
|
+
}
|
|
51916
|
+
return runParseAttempt(input, PredictionModeExports.PredictionMode.LL);
|
|
51917
|
+
}
|
|
51918
|
+
function parseECL(input) {
|
|
51919
|
+
if (input === lastInput && lastResult !== null) {
|
|
51920
|
+
return lastResult;
|
|
51921
|
+
}
|
|
51922
|
+
const tokenInputStream = new antlr4tsExports.ANTLRInputStream(input);
|
|
51923
|
+
const tokenLexer = new ECLLexer(tokenInputStream);
|
|
51924
|
+
const tokenStream = new antlr4tsExports.CommonTokenStream(tokenLexer);
|
|
51925
|
+
tokenStream.fill();
|
|
51926
|
+
const tokens = tokenStream.getTokens().map((token) => {
|
|
51927
|
+
var _a;
|
|
51928
|
+
return {
|
|
51929
|
+
type: token.type,
|
|
51930
|
+
text: token.text ?? "",
|
|
51931
|
+
range: {
|
|
51932
|
+
start: {
|
|
51933
|
+
line: token.line,
|
|
51934
|
+
column: token.charPositionInLine,
|
|
51935
|
+
offset: token.startIndex
|
|
51936
|
+
},
|
|
51937
|
+
end: {
|
|
51938
|
+
line: token.line,
|
|
51939
|
+
column: token.charPositionInLine + (((_a = token.text) == null ? void 0 : _a.length) ?? 0),
|
|
51940
|
+
offset: token.stopIndex + 1
|
|
51941
|
+
}
|
|
51942
|
+
}
|
|
51943
|
+
};
|
|
51944
|
+
});
|
|
51945
|
+
const { ast, errors: parseErrors } = parseWithFallback(input);
|
|
51946
|
+
const existingErrors = parseErrors;
|
|
51872
51947
|
if (existingErrors.length > 0) {
|
|
51873
51948
|
const issues = analyzeExpression(input);
|
|
51874
51949
|
if (issues.mixedOperator) {
|
|
@@ -51955,7 +52030,7 @@ function parseECL(input) {
|
|
|
51955
52030
|
const warnings = ast ? checkMixedRefinementOperators(ast, input) : [];
|
|
51956
52031
|
const result = {
|
|
51957
52032
|
ast,
|
|
51958
|
-
errors:
|
|
52033
|
+
errors: parseErrors,
|
|
51959
52034
|
warnings,
|
|
51960
52035
|
tokens
|
|
51961
52036
|
};
|
|
@@ -51968,6 +52043,7 @@ function extractConceptIds(ast, options) {
|
|
|
51968
52043
|
const deduplicate = (options == null ? void 0 : options.deduplicate) ?? true;
|
|
51969
52044
|
const seenIds = /* @__PURE__ */ new Set();
|
|
51970
52045
|
function visitNode(node) {
|
|
52046
|
+
if (!node) return;
|
|
51971
52047
|
switch (node.type) {
|
|
51972
52048
|
case NodeType.ConceptReference:
|
|
51973
52049
|
if (!deduplicate || !seenIds.has(node.conceptId)) {
|
|
@@ -51993,7 +52069,7 @@ function extractConceptIds(ast, options) {
|
|
|
51993
52069
|
}
|
|
51994
52070
|
break;
|
|
51995
52071
|
case NodeType.ExpressionConstraint:
|
|
51996
|
-
|
|
52072
|
+
visitNode(node.expression);
|
|
51997
52073
|
break;
|
|
51998
52074
|
case NodeType.SubExpressionConstraint:
|
|
51999
52075
|
visitNode(node.focus);
|
|
@@ -52271,8 +52347,141 @@ function isValidDescriptionId(sctid) {
|
|
|
52271
52347
|
const partitionId = sctid.substring(sctid.length - 3, sctid.length - 1);
|
|
52272
52348
|
return partitionId === "01" || partitionId === "11";
|
|
52273
52349
|
}
|
|
52350
|
+
class TerminologyError extends Error {
|
|
52351
|
+
constructor(message, options = {}) {
|
|
52352
|
+
super(message);
|
|
52353
|
+
/**
|
|
52354
|
+
* The underlying failure.
|
|
52355
|
+
*
|
|
52356
|
+
* Declared explicitly (rather than relying on `Error.cause`) so it is part of
|
|
52357
|
+
* the emitted type declarations and is present on every runtime.
|
|
52358
|
+
*/
|
|
52359
|
+
__publicField(this, "cause");
|
|
52360
|
+
/** The request URL, when known. */
|
|
52361
|
+
__publicField(this, "url");
|
|
52362
|
+
/** The HTTP status, present only on {@link TerminologyHttpError}. */
|
|
52363
|
+
__publicField(this, "status");
|
|
52364
|
+
this.name = "TerminologyError";
|
|
52365
|
+
this.cause = options.cause;
|
|
52366
|
+
this.url = options.url;
|
|
52367
|
+
this.status = options.status;
|
|
52368
|
+
}
|
|
52369
|
+
}
|
|
52370
|
+
class TerminologyTransportError extends TerminologyError {
|
|
52371
|
+
constructor(message, options = {}) {
|
|
52372
|
+
super(message, options);
|
|
52373
|
+
__publicField(this, "kind", "transport");
|
|
52374
|
+
/** True when the failure was a client-side timeout rather than a hard failure. */
|
|
52375
|
+
__publicField(this, "timedOut");
|
|
52376
|
+
this.name = "TerminologyTransportError";
|
|
52377
|
+
this.timedOut = options.timedOut ?? false;
|
|
52378
|
+
}
|
|
52379
|
+
}
|
|
52380
|
+
class TerminologyHttpError extends TerminologyError {
|
|
52381
|
+
constructor(message, options) {
|
|
52382
|
+
super(message, options);
|
|
52383
|
+
__publicField(this, "kind", "http");
|
|
52384
|
+
/** The HTTP reason phrase, when the client exposes one. */
|
|
52385
|
+
__publicField(this, "statusText");
|
|
52386
|
+
this.name = "TerminologyHttpError";
|
|
52387
|
+
this.statusText = options.statusText;
|
|
52388
|
+
}
|
|
52389
|
+
}
|
|
52390
|
+
function isTerminologyError(value) {
|
|
52391
|
+
if (value instanceof TerminologyError) return true;
|
|
52392
|
+
if (!(value instanceof Error)) return false;
|
|
52393
|
+
const kind = value.kind;
|
|
52394
|
+
return value.name === "TerminologyTransportError" && kind === "transport" || value.name === "TerminologyHttpError" && kind === "http";
|
|
52395
|
+
}
|
|
52396
|
+
function isTerminologyTransportError(value) {
|
|
52397
|
+
return isTerminologyError(value) && value.kind === "transport";
|
|
52398
|
+
}
|
|
52399
|
+
function isTerminologyHttpError(value) {
|
|
52400
|
+
return isTerminologyError(value) && value.kind === "http";
|
|
52401
|
+
}
|
|
52402
|
+
function isAbortLike(error) {
|
|
52403
|
+
if (typeof error !== "object" || error === null) return false;
|
|
52404
|
+
const name = error.name;
|
|
52405
|
+
return name === "AbortError" || name === "TimeoutError";
|
|
52406
|
+
}
|
|
52407
|
+
function describe(error) {
|
|
52408
|
+
if (error instanceof Error) return error.message;
|
|
52409
|
+
return String(error);
|
|
52410
|
+
}
|
|
52411
|
+
function toTransportError(error, options) {
|
|
52412
|
+
if (isTerminologyTransportError(error)) return error;
|
|
52413
|
+
const timedOut = isAbortLike(error);
|
|
52414
|
+
const after = options.timeoutMs === void 0 ? "" : ` after ${options.timeoutMs}ms`;
|
|
52415
|
+
const reason = timedOut ? `timed out${after}` : `failed: ${describe(error)}`;
|
|
52416
|
+
return new TerminologyTransportError(`Could not reach the terminology server — ${options.operation} ${reason}`, {
|
|
52417
|
+
cause: error,
|
|
52418
|
+
url: options.url,
|
|
52419
|
+
timedOut
|
|
52420
|
+
});
|
|
52421
|
+
}
|
|
52422
|
+
function toHttpError(options) {
|
|
52423
|
+
const suffix = options.detail ? `: ${options.detail}` : "";
|
|
52424
|
+
return new TerminologyHttpError(
|
|
52425
|
+
`Terminology server returned HTTP ${options.status} for ${options.operation}${suffix}`,
|
|
52426
|
+
options
|
|
52427
|
+
);
|
|
52428
|
+
}
|
|
52274
52429
|
const DEFAULT_USER_AGENT = "ecl-lsp/1.0.0";
|
|
52275
52430
|
const IS_BROWSER = typeof globalThis !== "undefined" && "document" in globalThis;
|
|
52431
|
+
function isEclEvaluationStrategy(value) {
|
|
52432
|
+
return value === "auto" || value === "implicit-url" || value === "post";
|
|
52433
|
+
}
|
|
52434
|
+
class ConcurrencyQueue {
|
|
52435
|
+
constructor(max2) {
|
|
52436
|
+
__publicField(this, "running", 0);
|
|
52437
|
+
__publicField(this, "waiters", []);
|
|
52438
|
+
this.max = max2;
|
|
52439
|
+
}
|
|
52440
|
+
run(fn) {
|
|
52441
|
+
return new Promise((resolve, reject) => {
|
|
52442
|
+
const attempt = () => {
|
|
52443
|
+
this.running++;
|
|
52444
|
+
fn().then(resolve, reject).finally(() => {
|
|
52445
|
+
this.running--;
|
|
52446
|
+
const next = this.waiters.shift();
|
|
52447
|
+
if (next) next();
|
|
52448
|
+
});
|
|
52449
|
+
};
|
|
52450
|
+
if (this.running < this.max) attempt();
|
|
52451
|
+
else this.waiters.push(attempt);
|
|
52452
|
+
});
|
|
52453
|
+
}
|
|
52454
|
+
}
|
|
52455
|
+
const RETRY_BASE_DELAY_MS = 500;
|
|
52456
|
+
const RETRY_MAX_DELAY_MS = 1e4;
|
|
52457
|
+
const RETRY_MAX_ATTEMPTS = 3;
|
|
52458
|
+
const RETRY_JITTER_MS = 200;
|
|
52459
|
+
const CANONICAL_URL_RESERVED = [
|
|
52460
|
+
["|", "%7C"],
|
|
52461
|
+
// FHIR canonical `system|version` delimiter — the issue #68 corruption
|
|
52462
|
+
["#", "%23"],
|
|
52463
|
+
// URL fragment delimiter; also introduces ECL concrete values such as `#20`
|
|
52464
|
+
["&", "%26"],
|
|
52465
|
+
// separates parameters within the canonical URL's own query string
|
|
52466
|
+
["+", "%2B"],
|
|
52467
|
+
// read as a space by form-style query decoders
|
|
52468
|
+
["?", "%3F"]
|
|
52469
|
+
// query string introducer
|
|
52470
|
+
];
|
|
52471
|
+
function encodeEclForCanonicalUrl(expression) {
|
|
52472
|
+
let encoded = expression.replaceAll("%", "%25");
|
|
52473
|
+
for (const [character, escape] of CANONICAL_URL_RESERVED) {
|
|
52474
|
+
encoded = encoded.replaceAll(character, escape);
|
|
52475
|
+
}
|
|
52476
|
+
return encoded;
|
|
52477
|
+
}
|
|
52478
|
+
const VALUE_SET_NOT_FOUND = /value\s*sets?\s*not\s*found/i;
|
|
52479
|
+
const IMPLICIT_VALUE_SET_UNSUPPORTED = [
|
|
52480
|
+
/implicit[^.]*value\s*sets?[^.]*not\s*supported/i,
|
|
52481
|
+
/not\s*supported[^.]*implicit[^.]*value\s*sets?/i
|
|
52482
|
+
];
|
|
52483
|
+
class EvaluationIssueError extends Error {
|
|
52484
|
+
}
|
|
52276
52485
|
const _FhirTerminologyService = class _FhirTerminologyService {
|
|
52277
52486
|
constructor(options = {}) {
|
|
52278
52487
|
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
@@ -52285,9 +52494,28 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52285
52494
|
__publicField(this, "searchCacheTTL");
|
|
52286
52495
|
// milliseconds
|
|
52287
52496
|
__publicField(this, "snomedVersion");
|
|
52497
|
+
__publicField(this, "evaluationStrategy");
|
|
52288
52498
|
__publicField(this, "onResolvedVersion");
|
|
52289
52499
|
__publicField(this, "resolvedVersion", null);
|
|
52500
|
+
/**
|
|
52501
|
+
* Latched once a POST `ValueSet/$expand` fallback has succeeded in `'auto'` mode: the
|
|
52502
|
+
* server has demonstrated it cannot serve the implicit ValueSet URL form, so subsequent
|
|
52503
|
+
* evaluations skip the wasted round-trip for the lifetime of this instance.
|
|
52504
|
+
*/
|
|
52505
|
+
__publicField(this, "usePostExpand", false);
|
|
52506
|
+
/**
|
|
52507
|
+
* Latched once a bulk `ValueSet/$expand` has been rejected with a 4xx: the server does
|
|
52508
|
+
* not accept a POSTed ValueSet enumerating concepts in `compose.include.concept`, and
|
|
52509
|
+
* the request shape never varies, so retrying it on every validation pass only costs a
|
|
52510
|
+
* wasted round-trip and a console warning (issue #55). 5xx responses are treated as
|
|
52511
|
+
* transient and do not latch.
|
|
52512
|
+
*/
|
|
52513
|
+
__publicField(this, "bulkExpandUnsupported", false);
|
|
52514
|
+
__publicField(this, "queue");
|
|
52290
52515
|
var _a;
|
|
52516
|
+
const maxConcurrency = options.maxConcurrency ?? 25;
|
|
52517
|
+
if (maxConcurrency <= 0) throw new Error(`maxConcurrency must be > 0, got ${maxConcurrency}`);
|
|
52518
|
+
this.queue = new ConcurrencyQueue(maxConcurrency);
|
|
52291
52519
|
this.baseUrl = options.baseUrl ?? "https://tx.ontoserver.csiro.au/fhir";
|
|
52292
52520
|
this.timeout = options.timeout ?? 2e3;
|
|
52293
52521
|
this.userAgent = options.userAgent ?? DEFAULT_USER_AGENT;
|
|
@@ -52295,6 +52523,7 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52295
52523
|
this.searchTimeout = 5e3;
|
|
52296
52524
|
this.searchCacheTTL = 5 * 60 * 1e3;
|
|
52297
52525
|
this.snomedVersion = ((_a = options.snomedVersion) == null ? void 0 : _a.trim()) ? options.snomedVersion.trim() : void 0;
|
|
52526
|
+
this.evaluationStrategy = isEclEvaluationStrategy(options.evaluationStrategy) ? options.evaluationStrategy : "auto";
|
|
52298
52527
|
this.onResolvedVersion = options.onResolvedVersion;
|
|
52299
52528
|
}
|
|
52300
52529
|
/** The SNOMED CT system URL base for implicit ValueSet URLs. */
|
|
@@ -52381,53 +52610,150 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52381
52610
|
clearTimeout(timeoutId);
|
|
52382
52611
|
}
|
|
52383
52612
|
}
|
|
52613
|
+
/**
|
|
52614
|
+
* Perform a request, translating any network-level failure (connection
|
|
52615
|
+
* refused, DNS failure, timeout/abort) into a {@link TerminologyTransportError}
|
|
52616
|
+
* so callers can tell "server unreachable" from "server said no".
|
|
52617
|
+
*/
|
|
52618
|
+
async request(url, timeoutMs, operation, init) {
|
|
52619
|
+
try {
|
|
52620
|
+
return await this.fetchQueued(url, timeoutMs, init);
|
|
52621
|
+
} catch (error) {
|
|
52622
|
+
throw toTransportError(error, { url, operation, timeoutMs });
|
|
52623
|
+
}
|
|
52624
|
+
}
|
|
52625
|
+
/** Read the body of an error response, extracting a FHIR OperationOutcome if present. */
|
|
52626
|
+
static async readErrorBody(response) {
|
|
52627
|
+
var _a, _b;
|
|
52628
|
+
let text;
|
|
52629
|
+
try {
|
|
52630
|
+
text = await response.text();
|
|
52631
|
+
} catch {
|
|
52632
|
+
return { outcome: null, detail: void 0 };
|
|
52633
|
+
}
|
|
52634
|
+
let parsed;
|
|
52635
|
+
try {
|
|
52636
|
+
parsed = JSON.parse(text);
|
|
52637
|
+
} catch {
|
|
52638
|
+
const trimmed = text.trim();
|
|
52639
|
+
return { outcome: null, detail: trimmed ? trimmed.slice(0, 200) : void 0 };
|
|
52640
|
+
}
|
|
52641
|
+
const outcome = typeof parsed === "object" && parsed !== null && parsed.resourceType === "OperationOutcome" ? parsed : null;
|
|
52642
|
+
const issue = (_a = outcome == null ? void 0 : outcome.issue) == null ? void 0 : _a[0];
|
|
52643
|
+
const detail = (issue == null ? void 0 : issue.diagnostics) ?? ((_b = issue == null ? void 0 : issue.details) == null ? void 0 : _b.text);
|
|
52644
|
+
return { outcome, detail };
|
|
52645
|
+
}
|
|
52646
|
+
/**
|
|
52647
|
+
* True when an error response is the server's well-formed way of saying
|
|
52648
|
+
* "I do not know this code" — the one case that maps to `null` rather than
|
|
52649
|
+
* an exception.
|
|
52650
|
+
*
|
|
52651
|
+
* A 404 is only accepted as such when the body is a real FHIR
|
|
52652
|
+
* OperationOutcome; a bare 404 (wrong base URL, proxy page) is a fault.
|
|
52653
|
+
*/
|
|
52654
|
+
static isUnknownCodeResponse(status, outcome) {
|
|
52655
|
+
if (!outcome) return false;
|
|
52656
|
+
if (status === 404) return true;
|
|
52657
|
+
if (status !== 400 && status !== 422) return false;
|
|
52658
|
+
return (outcome.issue ?? []).some((issue) => {
|
|
52659
|
+
var _a;
|
|
52660
|
+
if (issue.code && _FhirTerminologyService.UNKNOWN_CODE_ISSUE_CODES.has(issue.code.toLowerCase())) {
|
|
52661
|
+
return true;
|
|
52662
|
+
}
|
|
52663
|
+
const prose = `${issue.diagnostics ?? ""} ${((_a = issue.details) == null ? void 0 : _a.text) ?? ""}`.toLowerCase();
|
|
52664
|
+
return _FhirTerminologyService.UNKNOWN_CODE_PHRASES.some((phrase) => prose.includes(phrase));
|
|
52665
|
+
});
|
|
52666
|
+
}
|
|
52667
|
+
/**
|
|
52668
|
+
* Look up a single concept.
|
|
52669
|
+
*
|
|
52670
|
+
* @returns the concept, or `null` when the terminology server gave a
|
|
52671
|
+
* well-formed answer saying the code is unknown to it.
|
|
52672
|
+
* @throws {TerminologyTransportError} when the server could not be reached,
|
|
52673
|
+
* the request timed out, or the response body was unusable.
|
|
52674
|
+
* @throws {TerminologyHttpError} when the server answered with an error
|
|
52675
|
+
* status that is not an "unknown code" response.
|
|
52676
|
+
*/
|
|
52677
|
+
async fetchWithRetry(url, timeoutMs, init) {
|
|
52678
|
+
for (let attempt = 0; attempt < RETRY_MAX_ATTEMPTS; attempt++) {
|
|
52679
|
+
const response = await this.fetchWithTimeout(url, timeoutMs, init);
|
|
52680
|
+
if (response.status !== 429) return response;
|
|
52681
|
+
if (attempt === RETRY_MAX_ATTEMPTS - 1) {
|
|
52682
|
+
throw new Error(`FHIR request rate-limited after ${RETRY_MAX_ATTEMPTS} attempts`);
|
|
52683
|
+
}
|
|
52684
|
+
const retryAfterHeader = response.headers.get("Retry-After");
|
|
52685
|
+
const retryAfterMs = retryAfterHeader ? parseInt(retryAfterHeader, 10) * 1e3 : 0;
|
|
52686
|
+
const backoff = Math.min(RETRY_BASE_DELAY_MS * Math.pow(2, attempt), RETRY_MAX_DELAY_MS);
|
|
52687
|
+
const jitter = Math.random() * RETRY_JITTER_MS;
|
|
52688
|
+
const waitMs = Math.max(retryAfterMs, backoff + jitter);
|
|
52689
|
+
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
52690
|
+
}
|
|
52691
|
+
throw new Error("Unreachable");
|
|
52692
|
+
}
|
|
52693
|
+
fetchQueued(url, timeoutMs, init) {
|
|
52694
|
+
return this.queue.run(() => this.fetchWithRetry(url, timeoutMs, init));
|
|
52695
|
+
}
|
|
52384
52696
|
async getConceptInfo(conceptId) {
|
|
52385
52697
|
var _a;
|
|
52386
52698
|
const cached = this.cache.get(conceptId);
|
|
52387
52699
|
if (cached) {
|
|
52388
52700
|
return cached;
|
|
52389
52701
|
}
|
|
52390
|
-
|
|
52391
|
-
|
|
52392
|
-
|
|
52393
|
-
|
|
52394
|
-
|
|
52395
|
-
|
|
52396
|
-
|
|
52702
|
+
let url = `${this.baseUrl}/CodeSystem/$lookup?system=http://snomed.info/sct&code=${encodeURIComponent(conceptId)}`;
|
|
52703
|
+
if (this.snomedVersion) {
|
|
52704
|
+
url += `&version=${encodeURIComponent(this.snomedVersion)}`;
|
|
52705
|
+
}
|
|
52706
|
+
const operation = `$lookup of concept ${conceptId}`;
|
|
52707
|
+
const response = await this.request(url, this.timeout, operation);
|
|
52708
|
+
if (!response.ok) {
|
|
52709
|
+
const { outcome, detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
52710
|
+
if (_FhirTerminologyService.isUnknownCodeResponse(response.status, outcome)) {
|
|
52397
52711
|
return null;
|
|
52398
52712
|
}
|
|
52399
|
-
|
|
52400
|
-
|
|
52401
|
-
|
|
52402
|
-
|
|
52403
|
-
|
|
52404
|
-
|
|
52405
|
-
const parts = prop.part ?? [];
|
|
52406
|
-
const codePart = parts.find((p) => p.name === "code" && p.valueCode === "inactive");
|
|
52407
|
-
return codePart !== void 0;
|
|
52713
|
+
throw toHttpError({
|
|
52714
|
+
status: response.status,
|
|
52715
|
+
statusText: response.statusText,
|
|
52716
|
+
url,
|
|
52717
|
+
operation,
|
|
52718
|
+
detail
|
|
52408
52719
|
});
|
|
52409
|
-
|
|
52410
|
-
|
|
52411
|
-
|
|
52412
|
-
|
|
52413
|
-
active = false;
|
|
52414
|
-
}
|
|
52415
|
-
}
|
|
52416
|
-
const conceptInfo = {
|
|
52417
|
-
id: conceptId,
|
|
52418
|
-
fsn: display,
|
|
52419
|
-
pt: display,
|
|
52420
|
-
// Simplified - would need to parse designations
|
|
52421
|
-
active
|
|
52422
|
-
};
|
|
52423
|
-
if (this.cache.size < 1e4) {
|
|
52424
|
-
this.cache.set(conceptId, conceptInfo);
|
|
52425
|
-
}
|
|
52426
|
-
return conceptInfo;
|
|
52720
|
+
}
|
|
52721
|
+
let data;
|
|
52722
|
+
try {
|
|
52723
|
+
data = await response.json();
|
|
52427
52724
|
} catch (error) {
|
|
52428
|
-
|
|
52429
|
-
|
|
52725
|
+
throw new TerminologyTransportError(`Terminology server returned an unreadable response for ${operation}`, {
|
|
52726
|
+
cause: error,
|
|
52727
|
+
url
|
|
52728
|
+
});
|
|
52729
|
+
}
|
|
52730
|
+
const params = data.parameter ?? [];
|
|
52731
|
+
this.captureResolvedVersionFromLookup(params);
|
|
52732
|
+
const display = ((_a = params.find((p) => p.name === "display")) == null ? void 0 : _a.valueString) ?? "";
|
|
52733
|
+
const properties = params.filter((p) => p.name === "property");
|
|
52734
|
+
const inactiveProperty = properties.find((prop) => {
|
|
52735
|
+
const parts = prop.part ?? [];
|
|
52736
|
+
const codePart = parts.find((p) => p.name === "code" && p.valueCode === "inactive");
|
|
52737
|
+
return codePart !== void 0;
|
|
52738
|
+
});
|
|
52739
|
+
let active = true;
|
|
52740
|
+
if (inactiveProperty) {
|
|
52741
|
+
const valuePart = (inactiveProperty.part ?? []).find((p) => p.name === "value");
|
|
52742
|
+
if ((valuePart == null ? void 0 : valuePart.valueBoolean) === true) {
|
|
52743
|
+
active = false;
|
|
52744
|
+
}
|
|
52745
|
+
}
|
|
52746
|
+
const conceptInfo = {
|
|
52747
|
+
id: conceptId,
|
|
52748
|
+
fsn: display,
|
|
52749
|
+
pt: display,
|
|
52750
|
+
// Simplified - would need to parse designations
|
|
52751
|
+
active
|
|
52752
|
+
};
|
|
52753
|
+
if (this.cache.size < 1e4) {
|
|
52754
|
+
this.cache.set(conceptId, conceptInfo);
|
|
52430
52755
|
}
|
|
52756
|
+
return conceptInfo;
|
|
52431
52757
|
}
|
|
52432
52758
|
async getHistoricalAssociations(conceptId) {
|
|
52433
52759
|
const entries = Object.entries(_FhirTerminologyService.ASSOCIATION_REFSETS);
|
|
@@ -52446,7 +52772,7 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52446
52772
|
const cmUrl = `${this.snomedSystemUrl}?fhir_cm=${refsetId}`;
|
|
52447
52773
|
const targetUrl = "http://snomed.info/sct?fhir_vs";
|
|
52448
52774
|
const url = `${this.baseUrl}/ConceptMap/$translate?code=${encodeURIComponent(conceptId)}&system=${encodeURIComponent("http://snomed.info/sct")}&target=${encodeURIComponent(targetUrl)}&url=${encodeURIComponent(cmUrl)}`;
|
|
52449
|
-
const response = await this.
|
|
52775
|
+
const response = await this.fetchQueued(url, this.timeout, {
|
|
52450
52776
|
headers: { Accept: "application/fhir+json" }
|
|
52451
52777
|
});
|
|
52452
52778
|
if (!response.ok) return [];
|
|
@@ -52469,11 +52795,65 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52469
52795
|
return [];
|
|
52470
52796
|
}
|
|
52471
52797
|
}
|
|
52798
|
+
/**
|
|
52799
|
+
* Validate a batch of concepts.
|
|
52800
|
+
*
|
|
52801
|
+
* A `null` map value means the terminology server positively reported the
|
|
52802
|
+
* code as unknown. Failures are never reported as `null` — they reject.
|
|
52803
|
+
*
|
|
52804
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
52805
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
52806
|
+
*/
|
|
52472
52807
|
async validateConcepts(conceptIds) {
|
|
52473
52808
|
const results = /* @__PURE__ */ new Map();
|
|
52474
52809
|
if (conceptIds.length === 0) {
|
|
52475
52810
|
return results;
|
|
52476
52811
|
}
|
|
52812
|
+
const uncachedIds = this.partitionCached(conceptIds, results);
|
|
52813
|
+
if (uncachedIds.length === 0) {
|
|
52814
|
+
return results;
|
|
52815
|
+
}
|
|
52816
|
+
if (this.bulkExpandUnsupported) {
|
|
52817
|
+
await this.lookupEach(uncachedIds, results);
|
|
52818
|
+
return results;
|
|
52819
|
+
}
|
|
52820
|
+
try {
|
|
52821
|
+
const expandResults = await this.bulkExpand(uncachedIds);
|
|
52822
|
+
const missingIds = this.mergeExpandResults(uncachedIds, expandResults, results);
|
|
52823
|
+
await this.lookupEach(missingIds, results);
|
|
52824
|
+
return results;
|
|
52825
|
+
} catch (error) {
|
|
52826
|
+
if (isTerminologyTransportError(error)) throw error;
|
|
52827
|
+
if (isTerminologyHttpError(error) && error.status >= 400 && error.status < 500) {
|
|
52828
|
+
this.bulkExpandUnsupported = true;
|
|
52829
|
+
}
|
|
52830
|
+
await this.lookupEach(uncachedIds, results);
|
|
52831
|
+
return results;
|
|
52832
|
+
}
|
|
52833
|
+
}
|
|
52834
|
+
/**
|
|
52835
|
+
* Move concepts found in a bulk expansion into `results` (and the cache),
|
|
52836
|
+
* returning the IDs that were absent and still need an individual lookup.
|
|
52837
|
+
*/
|
|
52838
|
+
mergeExpandResults(uncachedIds, expandResults, results) {
|
|
52839
|
+
const missingIds = [];
|
|
52840
|
+
for (const id of uncachedIds) {
|
|
52841
|
+
const info = expandResults.get(id);
|
|
52842
|
+
if (info) {
|
|
52843
|
+
results.set(id, info);
|
|
52844
|
+
if (this.cache.size < 1e4) {
|
|
52845
|
+
this.cache.set(id, info);
|
|
52846
|
+
}
|
|
52847
|
+
} else {
|
|
52848
|
+
missingIds.push(id);
|
|
52849
|
+
}
|
|
52850
|
+
}
|
|
52851
|
+
return missingIds;
|
|
52852
|
+
}
|
|
52853
|
+
/**
|
|
52854
|
+
* Move already-cached concepts into `results`, returning the IDs still to fetch.
|
|
52855
|
+
*/
|
|
52856
|
+
partitionCached(conceptIds, results) {
|
|
52477
52857
|
const uncachedIds = [];
|
|
52478
52858
|
for (const id of conceptIds) {
|
|
52479
52859
|
const cachedInfo = this.cache.get(id);
|
|
@@ -52483,40 +52863,17 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52483
52863
|
uncachedIds.push(id);
|
|
52484
52864
|
}
|
|
52485
52865
|
}
|
|
52486
|
-
|
|
52487
|
-
|
|
52488
|
-
|
|
52489
|
-
|
|
52490
|
-
|
|
52491
|
-
|
|
52492
|
-
|
|
52493
|
-
const info = expandResults.get(id);
|
|
52494
|
-
if (info) {
|
|
52495
|
-
results.set(id, info);
|
|
52496
|
-
if (this.cache.size < 1e4) {
|
|
52497
|
-
this.cache.set(id, info);
|
|
52498
|
-
}
|
|
52499
|
-
} else {
|
|
52500
|
-
missingIds.push(id);
|
|
52501
|
-
}
|
|
52502
|
-
}
|
|
52503
|
-
if (missingIds.length > 0) {
|
|
52504
|
-
const lookups = missingIds.map(async (id) => {
|
|
52505
|
-
const info = await this.getConceptInfo(id);
|
|
52506
|
-
results.set(id, info);
|
|
52507
|
-
});
|
|
52508
|
-
await Promise.all(lookups);
|
|
52509
|
-
}
|
|
52510
|
-
return results;
|
|
52511
|
-
} catch (error) {
|
|
52512
|
-
console.warn("Bulk concept validation failed, falling back to individual lookups:", error);
|
|
52513
|
-
const lookups = uncachedIds.map(async (id) => {
|
|
52866
|
+
return uncachedIds;
|
|
52867
|
+
}
|
|
52868
|
+
/** Look each concept up individually, recording the result (or `null` if absent). */
|
|
52869
|
+
async lookupEach(conceptIds, results) {
|
|
52870
|
+
if (conceptIds.length === 0) return;
|
|
52871
|
+
await Promise.all(
|
|
52872
|
+
conceptIds.map(async (id) => {
|
|
52514
52873
|
const info = await this.getConceptInfo(id);
|
|
52515
52874
|
results.set(id, info);
|
|
52516
|
-
})
|
|
52517
|
-
|
|
52518
|
-
return results;
|
|
52519
|
-
}
|
|
52875
|
+
})
|
|
52876
|
+
);
|
|
52520
52877
|
}
|
|
52521
52878
|
async bulkExpand(conceptIds) {
|
|
52522
52879
|
var _a, _b;
|
|
@@ -52533,13 +52890,21 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52533
52890
|
resourceType: "ValueSet",
|
|
52534
52891
|
compose: { include: [include] }
|
|
52535
52892
|
};
|
|
52536
|
-
const
|
|
52893
|
+
const operation = `bulk $expand of ${conceptIds.length} concept(s)`;
|
|
52894
|
+
const response = await this.request(url, this.timeout, operation, {
|
|
52537
52895
|
method: "POST",
|
|
52538
52896
|
headers: { "Content-Type": "application/fhir+json" },
|
|
52539
52897
|
body: JSON.stringify(valueSet)
|
|
52540
52898
|
});
|
|
52541
52899
|
if (!response.ok) {
|
|
52542
|
-
|
|
52900
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
52901
|
+
throw toHttpError({
|
|
52902
|
+
status: response.status,
|
|
52903
|
+
statusText: response.statusText,
|
|
52904
|
+
url,
|
|
52905
|
+
operation,
|
|
52906
|
+
detail
|
|
52907
|
+
});
|
|
52543
52908
|
}
|
|
52544
52909
|
const data = await response.json();
|
|
52545
52910
|
this.captureResolvedVersion((_a = data.expansion) == null ? void 0 : _a.parameter);
|
|
@@ -52568,6 +52933,14 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52568
52933
|
}
|
|
52569
52934
|
return results;
|
|
52570
52935
|
}
|
|
52936
|
+
/**
|
|
52937
|
+
* Search for concepts by text or SCTID.
|
|
52938
|
+
*
|
|
52939
|
+
* An empty result set means the server found no matches.
|
|
52940
|
+
*
|
|
52941
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
52942
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
52943
|
+
*/
|
|
52571
52944
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- FHIR response parser with nested property traversal
|
|
52572
52945
|
async searchConcepts(query) {
|
|
52573
52946
|
if (!query || query.trim().length === 0) {
|
|
@@ -52594,22 +52967,17 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52594
52967
|
}
|
|
52595
52968
|
entriesToDelete.forEach((key) => this.searchCache.delete(key));
|
|
52596
52969
|
}
|
|
52597
|
-
|
|
52598
|
-
|
|
52599
|
-
|
|
52600
|
-
|
|
52601
|
-
|
|
52602
|
-
response = await this.searchByFilter(trimmedQuery);
|
|
52603
|
-
}
|
|
52604
|
-
this.searchCache.set(trimmedQuery, {
|
|
52605
|
-
data: response,
|
|
52606
|
-
timestamp: Date.now()
|
|
52607
|
-
});
|
|
52608
|
-
return response;
|
|
52609
|
-
} catch (error) {
|
|
52610
|
-
console.warn(`Search failed for query "${trimmedQuery}":`, error);
|
|
52611
|
-
throw new Error("Terminology server unavailable");
|
|
52970
|
+
let response;
|
|
52971
|
+
if (/^\d+$/.test(trimmedQuery) && isValidSnomedId(trimmedQuery)) {
|
|
52972
|
+
response = await this.lookupById(trimmedQuery);
|
|
52973
|
+
} else {
|
|
52974
|
+
response = await this.searchByFilter(trimmedQuery);
|
|
52612
52975
|
}
|
|
52976
|
+
this.searchCache.set(trimmedQuery, {
|
|
52977
|
+
data: response,
|
|
52978
|
+
timestamp: Date.now()
|
|
52979
|
+
});
|
|
52980
|
+
return response;
|
|
52613
52981
|
}
|
|
52614
52982
|
async lookupById(conceptId) {
|
|
52615
52983
|
const info = await this.getConceptInfo(conceptId);
|
|
@@ -52628,26 +52996,116 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52628
52996
|
};
|
|
52629
52997
|
}
|
|
52630
52998
|
async evaluateEcl(expression, limit = 200) {
|
|
52631
|
-
var _a, _b, _c, _d, _e;
|
|
52632
52999
|
if (!expression || expression.trim().length === 0) {
|
|
52633
53000
|
return { total: 0, concepts: [], truncated: false };
|
|
52634
53001
|
}
|
|
52635
|
-
const
|
|
52636
|
-
const
|
|
52637
|
-
|
|
52638
|
-
|
|
52639
|
-
|
|
52640
|
-
|
|
52641
|
-
|
|
52642
|
-
|
|
52643
|
-
|
|
52644
|
-
|
|
52645
|
-
|
|
52646
|
-
|
|
53002
|
+
const trimmed = expression.trim();
|
|
53003
|
+
const deadline = Date.now() + this.evaluationTimeout;
|
|
53004
|
+
try {
|
|
53005
|
+
return await this.runEvaluationStrategy(trimmed, limit, deadline);
|
|
53006
|
+
} catch (error) {
|
|
53007
|
+
if (!(error instanceof EvaluationIssueError)) throw error;
|
|
53008
|
+
throw this.createEvaluationError(trimmed, error);
|
|
53009
|
+
}
|
|
53010
|
+
}
|
|
53011
|
+
/**
|
|
53012
|
+
* Transport selection for {@link evaluateEcl}.
|
|
53013
|
+
*
|
|
53014
|
+
* A forced `'post'` strategy — or a latched successful POST fallback — goes straight to
|
|
53015
|
+
* `POST ValueSet/$expand`. Otherwise the implicit ValueSet URL GET runs first, and in
|
|
53016
|
+
* `'auto'` mode a failure whose *shape* says the server cannot serve implicit ValueSets
|
|
53017
|
+
* (issue #55) is retried over POST.
|
|
53018
|
+
*/
|
|
53019
|
+
async runEvaluationStrategy(expression, limit, deadline) {
|
|
53020
|
+
if (this.evaluationStrategy === "post" || this.usePostExpand) {
|
|
53021
|
+
return await this.evaluateViaPostExpand(expression, limit, deadline);
|
|
53022
|
+
}
|
|
53023
|
+
const response = await this.fetchQueued(
|
|
53024
|
+
this.buildImplicitEvaluationUrl(expression, limit),
|
|
53025
|
+
this.remainingTimeout(deadline)
|
|
53026
|
+
);
|
|
53027
|
+
if (response.ok) {
|
|
53028
|
+
return this.parseEvaluationResponse(await response.json());
|
|
53029
|
+
}
|
|
53030
|
+
const outcome = await this.readOperationOutcome(response);
|
|
53031
|
+
if (this.evaluationStrategy === "implicit-url" || !this.shouldFallbackToPostExpand(response.status, outcome)) {
|
|
53032
|
+
throw new EvaluationIssueError(outcome.issue);
|
|
53033
|
+
}
|
|
53034
|
+
try {
|
|
53035
|
+
const result = await this.evaluateViaPostExpand(expression, limit, deadline);
|
|
53036
|
+
this.usePostExpand = true;
|
|
53037
|
+
return result;
|
|
53038
|
+
} catch (error) {
|
|
53039
|
+
if (!(error instanceof EvaluationIssueError)) throw error;
|
|
53040
|
+
throw new EvaluationIssueError(
|
|
53041
|
+
`${error.message} (POST ValueSet/$expand fallback; the implicit ValueSet URL also failed: ${outcome.issue})`,
|
|
53042
|
+
{ cause: error }
|
|
53043
|
+
);
|
|
53044
|
+
}
|
|
53045
|
+
}
|
|
53046
|
+
/** `GET ValueSet/$expand?url=<canonical implicit ECL ValueSet>` — see {@link encodeEclForCanonicalUrl}. */
|
|
53047
|
+
buildImplicitEvaluationUrl(expression, limit) {
|
|
53048
|
+
const implicitVsUrl = `${this.snomedSystemUrl}?fhir_vs=ecl/${encodeEclForCanonicalUrl(expression)}`;
|
|
53049
|
+
return `${this.baseUrl}/ValueSet/$expand?url=${encodeURIComponent(implicitVsUrl)}&count=${limit}`;
|
|
53050
|
+
}
|
|
53051
|
+
/**
|
|
53052
|
+
* `POST ValueSet/$expand` carrying the ECL in `compose.include.filter` with
|
|
53053
|
+
* `property: "constraint"` — the form requested in issue #55. The expression travels in a
|
|
53054
|
+
* JSON body, so it needs no escaping at all.
|
|
53055
|
+
*/
|
|
53056
|
+
async evaluateViaPostExpand(expression, limit, deadline) {
|
|
53057
|
+
const include = {
|
|
53058
|
+
system: "http://snomed.info/sct",
|
|
53059
|
+
// eslint-disable-line sonarjs/no-clear-text-protocols -- FHIR system URI, not a network URL
|
|
53060
|
+
...this.snomedVersion ? { version: this.snomedVersion } : {},
|
|
53061
|
+
filter: [{ property: "constraint", op: "=", value: expression }]
|
|
53062
|
+
};
|
|
53063
|
+
const response = await this.fetchQueued(
|
|
53064
|
+
`${this.baseUrl}/ValueSet/$expand?count=${limit}`,
|
|
53065
|
+
this.remainingTimeout(deadline),
|
|
53066
|
+
{
|
|
53067
|
+
method: "POST",
|
|
53068
|
+
headers: { "Content-Type": "application/fhir+json", Accept: "application/fhir+json" },
|
|
53069
|
+
body: JSON.stringify({ resourceType: "ValueSet", compose: { include: [include] } })
|
|
52647
53070
|
}
|
|
52648
|
-
|
|
53071
|
+
);
|
|
53072
|
+
if (!response.ok) {
|
|
53073
|
+
throw new EvaluationIssueError((await this.readOperationOutcome(response)).issue);
|
|
52649
53074
|
}
|
|
52650
|
-
|
|
53075
|
+
return this.parseEvaluationResponse(await response.json());
|
|
53076
|
+
}
|
|
53077
|
+
/**
|
|
53078
|
+
* True when an implicit-URL failure indicates the implicit ValueSet *form* is unsupported
|
|
53079
|
+
* rather than the expression being invalid.
|
|
53080
|
+
*
|
|
53081
|
+
* Deliberately excludes a bare HTTP 422: that is also how a genuine ECL syntax error
|
|
53082
|
+
* presents, and retrying those over POST would only turn one clear error into two requests
|
|
53083
|
+
* and a muddled message. The `'not-found'` OperationOutcome code is still honoured on any
|
|
53084
|
+
* status, which covers servers that report a missing implicit ValueSet as 422.
|
|
53085
|
+
*/
|
|
53086
|
+
shouldFallbackToPostExpand(status, outcome) {
|
|
53087
|
+
return status === 404 || status === 414 || outcome.code === "not-found" || VALUE_SET_NOT_FOUND.test(outcome.issue) || IMPLICIT_VALUE_SET_UNSUPPORTED.some((pattern) => pattern.test(outcome.issue));
|
|
53088
|
+
}
|
|
53089
|
+
/** Remaining milliseconds in the shared evaluation budget; throws once it is spent. */
|
|
53090
|
+
remainingTimeout(deadline) {
|
|
53091
|
+
const remaining = deadline - Date.now();
|
|
53092
|
+
if (remaining <= 0) {
|
|
53093
|
+
throw new EvaluationIssueError("evaluation timed out");
|
|
53094
|
+
}
|
|
53095
|
+
return remaining;
|
|
53096
|
+
}
|
|
53097
|
+
/** The machine-readable code and human-readable text of a FHIR error response. */
|
|
53098
|
+
async readOperationOutcome(response) {
|
|
53099
|
+
var _a, _b;
|
|
53100
|
+
const data = await response.json().catch(() => null);
|
|
53101
|
+
const first = (_a = data == null ? void 0 : data.issue) == null ? void 0 : _a[0];
|
|
53102
|
+
return {
|
|
53103
|
+
code: first == null ? void 0 : first.code,
|
|
53104
|
+
issue: (first == null ? void 0 : first.diagnostics) ?? ((_b = first == null ? void 0 : first.details) == null ? void 0 : _b.text) ?? `HTTP ${response.status}`
|
|
53105
|
+
};
|
|
53106
|
+
}
|
|
53107
|
+
/** Shared expansion mapping for both the implicit-URL and POST evaluation transports. */
|
|
53108
|
+
parseEvaluationResponse(data) {
|
|
52651
53109
|
const expansion = data.expansion ?? {};
|
|
52652
53110
|
this.captureResolvedVersion(expansion.parameter);
|
|
52653
53111
|
const total = typeof expansion.total === "number" ? expansion.total : 0;
|
|
@@ -52662,11 +53120,31 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52662
53120
|
truncated: total > concepts.length
|
|
52663
53121
|
};
|
|
52664
53122
|
}
|
|
53123
|
+
createEvaluationError(expression, error) {
|
|
53124
|
+
const issue = error.message;
|
|
53125
|
+
if (expression.includes("{{") && /no viable alternative/i.test(issue)) {
|
|
53126
|
+
const cleaned = issue.replace(/^\[[0-9a-f-]+\]:\s*/i, "");
|
|
53127
|
+
return new Error(
|
|
53128
|
+
`FHIR evaluation failed: ${cleaned}
|
|
53129
|
+
Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by this terminology server.`,
|
|
53130
|
+
{ cause: error }
|
|
53131
|
+
);
|
|
53132
|
+
}
|
|
53133
|
+
return new Error(`FHIR evaluation failed: ${issue}`, { cause: error });
|
|
53134
|
+
}
|
|
52665
53135
|
async searchByFilter(filter) {
|
|
52666
53136
|
const url = `${this.baseUrl}/ValueSet/$expand?url=${this.snomedSystemUrl}?fhir_vs&filter=${encodeURIComponent(filter)}&count=21&includeDesignations=true&activeOnly=true`;
|
|
52667
|
-
const
|
|
53137
|
+
const operation = `concept search for "${filter}"`;
|
|
53138
|
+
const response = await this.request(url, this.searchTimeout, operation);
|
|
52668
53139
|
if (!response.ok) {
|
|
52669
|
-
|
|
53140
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
53141
|
+
throw toHttpError({
|
|
53142
|
+
status: response.status,
|
|
53143
|
+
statusText: response.statusText,
|
|
53144
|
+
url,
|
|
53145
|
+
operation,
|
|
53146
|
+
detail
|
|
53147
|
+
});
|
|
52670
53148
|
}
|
|
52671
53149
|
const data = await response.json();
|
|
52672
53150
|
const expansion = data.expansion ?? {};
|
|
@@ -52692,9 +53170,17 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52692
53170
|
async getSnomedEditions() {
|
|
52693
53171
|
var _a;
|
|
52694
53172
|
const url = `${this.baseUrl}/CodeSystem?url=http://snomed.info/sct`;
|
|
52695
|
-
const
|
|
53173
|
+
const operation = "SNOMED CT edition discovery";
|
|
53174
|
+
const response = await this.request(url, this.searchTimeout, operation);
|
|
52696
53175
|
if (!response.ok) {
|
|
52697
|
-
|
|
53176
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
53177
|
+
throw toHttpError({
|
|
53178
|
+
status: response.status,
|
|
53179
|
+
statusText: response.statusText,
|
|
53180
|
+
url,
|
|
53181
|
+
operation,
|
|
53182
|
+
detail
|
|
53183
|
+
});
|
|
52698
53184
|
}
|
|
52699
53185
|
const data = await response.json();
|
|
52700
53186
|
const editionMap = /* @__PURE__ */ new Map();
|
|
@@ -52719,6 +53205,10 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52719
53205
|
return editions;
|
|
52720
53206
|
}
|
|
52721
53207
|
};
|
|
53208
|
+
/** Issue codes a FHIR server uses to say "this code is not in the code system". */
|
|
53209
|
+
__publicField(_FhirTerminologyService, "UNKNOWN_CODE_ISSUE_CODES", /* @__PURE__ */ new Set(["not-found", "code-invalid", "invalid-code"]));
|
|
53210
|
+
/** Phrases servers use in OperationOutcome prose when a code is unknown. */
|
|
53211
|
+
__publicField(_FhirTerminologyService, "UNKNOWN_CODE_PHRASES", ["unknown code", "not found", "invalid code", "unable to find"]);
|
|
52722
53212
|
/** Map of SNOMED CT historical association reference set IDs to association types. */
|
|
52723
53213
|
__publicField(_FhirTerminologyService, "ASSOCIATION_REFSETS", {
|
|
52724
53214
|
"900000000000527005": "same-as",
|
|
@@ -53194,13 +53684,13 @@ function printAst(ast, sourceText, options) {
|
|
|
53194
53684
|
if (!ast) {
|
|
53195
53685
|
return "";
|
|
53196
53686
|
}
|
|
53197
|
-
return printExpression$1(ast, 0, 0, options, sourceText);
|
|
53687
|
+
return printExpression$1(ast, 0, 0, options, sourceText, true);
|
|
53198
53688
|
}
|
|
53199
|
-
function printExpression$1(node, depth, column, opts, src) {
|
|
53689
|
+
function printExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
53200
53690
|
const inner = node.expression;
|
|
53201
53691
|
switch (inner.type) {
|
|
53202
53692
|
case NodeType.SubExpressionConstraint:
|
|
53203
|
-
return printSubExpression$1(inner, depth, column, opts, src);
|
|
53693
|
+
return printSubExpression$1(inner, depth, column, opts, src, isRoot);
|
|
53204
53694
|
case NodeType.CompoundExpression:
|
|
53205
53695
|
return printCompoundExpression$1(inner, depth, column, opts, src);
|
|
53206
53696
|
case NodeType.RefinedExpression:
|
|
@@ -53213,7 +53703,7 @@ function printExpression$1(node, depth, column, opts, src) {
|
|
|
53213
53703
|
}
|
|
53214
53704
|
}
|
|
53215
53705
|
}
|
|
53216
|
-
function printSubExpression$1(node, depth, column, opts, src) {
|
|
53706
|
+
function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
53217
53707
|
let result = "";
|
|
53218
53708
|
if (node.operator) {
|
|
53219
53709
|
result += node.operator.operator + " ";
|
|
@@ -53230,10 +53720,11 @@ function printSubExpression$1(node, depth, column, opts, src) {
|
|
|
53230
53720
|
break;
|
|
53231
53721
|
case NodeType.ExpressionConstraint: {
|
|
53232
53722
|
const innerExpr = node.focus;
|
|
53233
|
-
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf) {
|
|
53723
|
+
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf && !node.filters && !node.historySupplement) {
|
|
53234
53724
|
const inner = innerExpr.expression;
|
|
53235
|
-
|
|
53236
|
-
|
|
53725
|
+
const needsParens = !isRoot && (inner.type === NodeType.RefinedExpression || inner.type === NodeType.DottedExpression);
|
|
53726
|
+
if (inner.type !== NodeType.CompoundExpression && !needsParens) {
|
|
53727
|
+
result += printExpression$1(innerExpr, depth, column + result.length, opts, src, isRoot);
|
|
53237
53728
|
break;
|
|
53238
53729
|
}
|
|
53239
53730
|
}
|
|
@@ -53265,7 +53756,7 @@ function printSubExpression$1(node, depth, column, opts, src) {
|
|
|
53265
53756
|
}
|
|
53266
53757
|
function printCompoundExpression$1(node, depth, column, opts, src) {
|
|
53267
53758
|
const op = node.operator.operator;
|
|
53268
|
-
const opSep =
|
|
53759
|
+
const opSep = ` ${op} `;
|
|
53269
53760
|
let operands = node.operands;
|
|
53270
53761
|
if (opts.removeRedundantParentheses && (op === "AND" || op === "OR")) {
|
|
53271
53762
|
operands = flattenSameOperatorOperands(operands, op);
|
|
@@ -53328,42 +53819,84 @@ function printRefinedExpression$1(node, depth, column, opts, src) {
|
|
|
53328
53819
|
}
|
|
53329
53820
|
const focusIsMultilineParen = focus.includes("\n") && node.expression.focus.type === NodeType.ExpressionConstraint;
|
|
53330
53821
|
const attrDepth = focusIsMultilineParen ? depth + 2 : depth + 1;
|
|
53331
|
-
const
|
|
53332
|
-
|
|
53333
|
-
|
|
53334
|
-
|
|
53335
|
-
|
|
53336
|
-
const attrs = node.refinement.attributes.map((a) => printAttribute$1(a, attrDepth + 1, innerInd.length, opts, src));
|
|
53337
|
-
return focus + ":\n" + ind + "{\n" + attrs.map((a) => innerInd + a).join(",\n") + "\n" + ind + "}";
|
|
53338
|
-
}
|
|
53339
|
-
const attrParts = [];
|
|
53340
|
-
let prevEnd = node.refinement.range.start.offset;
|
|
53341
|
-
for (const attr of node.refinement.attributes) {
|
|
53342
|
-
const printed = printAttribute$1(attr, attrDepth, ind.length, opts, src);
|
|
53343
|
-
const inBraces = isAttrInBraceGroup$1(attr, prevEnd, src);
|
|
53344
|
-
attrParts.push(ind + (inBraces ? "{ " + printed + " }" : printed));
|
|
53345
|
-
prevEnd = attr.range.end.offset;
|
|
53346
|
-
}
|
|
53347
|
-
return focus + ":\n" + attrParts.join(",\n");
|
|
53348
|
-
}
|
|
53349
|
-
function isAttrInBraceGroup$1(attr, prevEnd, src) {
|
|
53350
|
-
const gap = src.slice(prevEnd, attr.range.start.offset);
|
|
53351
|
-
return gap.includes("{");
|
|
53822
|
+
const content = node.refinement.content;
|
|
53823
|
+
if (!content) {
|
|
53824
|
+
return focus + ":";
|
|
53825
|
+
}
|
|
53826
|
+
return focus + ":\n" + printMemberBlock(content, attrDepth, opts, src);
|
|
53352
53827
|
}
|
|
53353
|
-
function
|
|
53354
|
-
|
|
53355
|
-
|
|
53356
|
-
|
|
53357
|
-
|
|
53358
|
-
|
|
53359
|
-
|
|
53360
|
-
|
|
53828
|
+
function setSeparator(node) {
|
|
53829
|
+
if (node.operator === "OR") return " OR ";
|
|
53830
|
+
return node.conjunctionStyle === "AND" ? " AND " : ", ";
|
|
53831
|
+
}
|
|
53832
|
+
function flattenSameOperatorMembers$1(node, opts) {
|
|
53833
|
+
const result = [];
|
|
53834
|
+
for (const member of node.members) {
|
|
53835
|
+
const redundant = member.type === NodeType.AttributeSet && member.operator === node.operator && (!member.parenthesized || opts.removeRedundantParentheses);
|
|
53836
|
+
if (redundant) {
|
|
53837
|
+
result.push(...flattenSameOperatorMembers$1(member, opts));
|
|
53838
|
+
} else {
|
|
53839
|
+
result.push(member);
|
|
53840
|
+
}
|
|
53361
53841
|
}
|
|
53362
|
-
return
|
|
53842
|
+
return result;
|
|
53843
|
+
}
|
|
53844
|
+
function printRefinementMember$1(node, depth, column, opts, src) {
|
|
53845
|
+
switch (node.type) {
|
|
53846
|
+
case NodeType.Attribute:
|
|
53847
|
+
return printAttribute$1(node, depth, column, opts, src);
|
|
53848
|
+
case NodeType.AttributeGroup: {
|
|
53849
|
+
const prefix = (node.cardinality ? node.cardinality + " " : "") + "{ ";
|
|
53850
|
+
return prefix + printRefinementMember$1(node.content, depth, column + prefix.length, opts, src) + " }";
|
|
53851
|
+
}
|
|
53852
|
+
case NodeType.AttributeSet: {
|
|
53853
|
+
const members = flattenSameOperatorMembers$1(node, opts);
|
|
53854
|
+
const sep = setSeparator(node);
|
|
53855
|
+
const parts = [];
|
|
53856
|
+
let col = column;
|
|
53857
|
+
for (const member of members) {
|
|
53858
|
+
const text = printNestedMember(member, depth, col, opts, src);
|
|
53859
|
+
parts.push(text);
|
|
53860
|
+
col += text.length + sep.length;
|
|
53861
|
+
}
|
|
53862
|
+
return parts.join(sep);
|
|
53863
|
+
}
|
|
53864
|
+
}
|
|
53865
|
+
}
|
|
53866
|
+
function printNestedMember(node, depth, column, opts, src) {
|
|
53867
|
+
if (node.type === NodeType.AttributeSet) {
|
|
53868
|
+
return "(" + printRefinementMember$1(node, depth, column + 1, opts, src) + ")";
|
|
53869
|
+
}
|
|
53870
|
+
return printRefinementMember$1(node, depth, column, opts, src);
|
|
53871
|
+
}
|
|
53872
|
+
function printMemberBlock(node, depth, opts, src) {
|
|
53873
|
+
const ind = getIndentString(depth, opts);
|
|
53874
|
+
if (node.type === NodeType.AttributeGroup) {
|
|
53875
|
+
const card = node.cardinality ? node.cardinality + " " : "";
|
|
53876
|
+
return ind + card + "{\n" + printMemberBlock(node.content, depth + 1, opts, src) + "\n" + ind + "}";
|
|
53877
|
+
}
|
|
53878
|
+
if (node.type === NodeType.AttributeSet) {
|
|
53879
|
+
const members = flattenSameOperatorMembers$1(node, opts);
|
|
53880
|
+
const rendered = members.map((member) => {
|
|
53881
|
+
const line = ind + printNestedMember(member, depth, ind.length, opts, src);
|
|
53882
|
+
if (member.type === NodeType.AttributeGroup && opts.maxLineLength > 0 && line.length > opts.maxLineLength) {
|
|
53883
|
+
return printMemberBlock(member, depth, opts, src);
|
|
53884
|
+
}
|
|
53885
|
+
return line;
|
|
53886
|
+
});
|
|
53887
|
+
if (node.operator === "AND" && node.conjunctionStyle === ",") {
|
|
53888
|
+
return rendered.join(",\n");
|
|
53889
|
+
}
|
|
53890
|
+
const keyword = node.operator;
|
|
53891
|
+
return rendered.map((text, i) => i === 0 ? text : ind + keyword + " " + text.slice(ind.length)).join("\n");
|
|
53892
|
+
}
|
|
53893
|
+
return ind + printAttribute$1(node, depth, ind.length, opts, src);
|
|
53894
|
+
}
|
|
53895
|
+
function printRefinement$1(node, depth, opts, src) {
|
|
53896
|
+
return node.content ? printRefinementMember$1(node.content, depth, 0, opts, src) : "";
|
|
53363
53897
|
}
|
|
53364
53898
|
function printAttribute$1(node, depth, column, opts, src) {
|
|
53365
|
-
const
|
|
53366
|
-
const cardinalityPrefix = preNameSrc.length > 0 ? preNameSrc + " " : "";
|
|
53899
|
+
const cardinalityPrefix = node.cardinality ? node.cardinality + " " : "";
|
|
53367
53900
|
let name;
|
|
53368
53901
|
if (node.name.conceptId) {
|
|
53369
53902
|
name = node.name.term ? node.name.conceptId + normalizeTerm(node.name.term) : node.name.conceptId;
|
|
@@ -53397,6 +53930,336 @@ function lastLineLength(text) {
|
|
|
53397
53930
|
const lastNewline = text.lastIndexOf("\n");
|
|
53398
53931
|
return lastNewline === -1 ? text.length : text.length - lastNewline - 1;
|
|
53399
53932
|
}
|
|
53933
|
+
function printCanonical(ast, sourceText, outerOperator) {
|
|
53934
|
+
if (ast.type === NodeType.SubExpressionConstraint) {
|
|
53935
|
+
return printSubExpression(ast, sourceText, outerOperator);
|
|
53936
|
+
}
|
|
53937
|
+
return printExpression(ast, sourceText, outerOperator);
|
|
53938
|
+
}
|
|
53939
|
+
function printExpression(node, src, outerOperator) {
|
|
53940
|
+
const inner = node.expression;
|
|
53941
|
+
switch (inner.type) {
|
|
53942
|
+
case NodeType.SubExpressionConstraint:
|
|
53943
|
+
return printSubExpression(inner, src, outerOperator);
|
|
53944
|
+
case NodeType.CompoundExpression:
|
|
53945
|
+
return printCompoundExpression(inner, src);
|
|
53946
|
+
case NodeType.RefinedExpression:
|
|
53947
|
+
return printRefinedExpression(inner, src);
|
|
53948
|
+
case NodeType.DottedExpression:
|
|
53949
|
+
return printDottedExpression(inner, src);
|
|
53950
|
+
default: {
|
|
53951
|
+
const _exhaustive = inner;
|
|
53952
|
+
return String(_exhaustive);
|
|
53953
|
+
}
|
|
53954
|
+
}
|
|
53955
|
+
}
|
|
53956
|
+
function printSubExpression(node, src, outerOperator) {
|
|
53957
|
+
let result = "";
|
|
53958
|
+
if (node.operator) {
|
|
53959
|
+
result += node.operator.operator;
|
|
53960
|
+
}
|
|
53961
|
+
if (node.memberOf) {
|
|
53962
|
+
result += "^";
|
|
53963
|
+
}
|
|
53964
|
+
switch (node.focus.type) {
|
|
53965
|
+
case NodeType.ConceptReference:
|
|
53966
|
+
result += printConceptReference(node.focus);
|
|
53967
|
+
break;
|
|
53968
|
+
case NodeType.Wildcard:
|
|
53969
|
+
result += "*";
|
|
53970
|
+
break;
|
|
53971
|
+
case NodeType.ExpressionConstraint: {
|
|
53972
|
+
const innerExpr = node.focus.expression;
|
|
53973
|
+
if (innerExpr.type !== NodeType.CompoundExpression) {
|
|
53974
|
+
result += printExpression(node.focus, src, outerOperator);
|
|
53975
|
+
} else if (outerOperator && innerExpr.operator.operator === outerOperator) {
|
|
53976
|
+
result += printExpression(node.focus, src, outerOperator);
|
|
53977
|
+
} else {
|
|
53978
|
+
result += "(" + printExpression(node.focus, src) + ")";
|
|
53979
|
+
}
|
|
53980
|
+
break;
|
|
53981
|
+
}
|
|
53982
|
+
}
|
|
53983
|
+
if (node.filters) {
|
|
53984
|
+
for (const filter of node.filters) {
|
|
53985
|
+
const filterText = src.slice(filter.range.start.offset, filter.range.end.offset);
|
|
53986
|
+
result += " " + filterText.replaceAll(/\s+/g, " ").trim();
|
|
53987
|
+
}
|
|
53988
|
+
}
|
|
53989
|
+
if (node.historySupplement) {
|
|
53990
|
+
const histText = src.slice(node.historySupplement.range.start.offset, node.historySupplement.range.end.offset);
|
|
53991
|
+
result += " " + histText.replaceAll(/\s+/g, " ").trim();
|
|
53992
|
+
}
|
|
53993
|
+
return result;
|
|
53994
|
+
}
|
|
53995
|
+
function printCompoundExpression(node, src) {
|
|
53996
|
+
const op = node.operator.operator;
|
|
53997
|
+
return node.operands.map((operand) => printSubExpression(operand, src, op)).join(` ${op} `);
|
|
53998
|
+
}
|
|
53999
|
+
function printRefinedExpression(node, src) {
|
|
54000
|
+
const focus = printSubExpression(node.expression, src);
|
|
54001
|
+
const refinement = printRefinement(node.refinement, src);
|
|
54002
|
+
return focus + ":" + refinement;
|
|
54003
|
+
}
|
|
54004
|
+
function printDottedExpression(node, src) {
|
|
54005
|
+
const source = printSubExpression(node.source, src);
|
|
54006
|
+
const dots = node.attributes.map((a) => printSubExpression(a.attributeName, src));
|
|
54007
|
+
return source + dots.map((d) => "." + d).join("");
|
|
54008
|
+
}
|
|
54009
|
+
function printRefinement(node, src) {
|
|
54010
|
+
return node.content ? printRefinementMember(node.content, src) : "";
|
|
54011
|
+
}
|
|
54012
|
+
function printRefinementMember(node, src) {
|
|
54013
|
+
switch (node.type) {
|
|
54014
|
+
case NodeType.Attribute:
|
|
54015
|
+
return printAttribute(node, src);
|
|
54016
|
+
case NodeType.AttributeGroup:
|
|
54017
|
+
return (node.cardinality ?? "") + "{" + printRefinementMember(node.content, src) + "}";
|
|
54018
|
+
case NodeType.AttributeSet: {
|
|
54019
|
+
const sep = node.operator === "OR" ? " OR " : ",";
|
|
54020
|
+
return node.members.map(
|
|
54021
|
+
(member) => member.type === NodeType.AttributeSet ? "(" + printRefinementMember(member, src) + ")" : printRefinementMember(member, src)
|
|
54022
|
+
).join(sep);
|
|
54023
|
+
}
|
|
54024
|
+
}
|
|
54025
|
+
}
|
|
54026
|
+
function printAttribute(node, src) {
|
|
54027
|
+
const cardinalityPrefix = node.cardinality ? node.cardinality + " " : "";
|
|
54028
|
+
let name;
|
|
54029
|
+
if (node.name.conceptId) {
|
|
54030
|
+
name = node.name.conceptId;
|
|
54031
|
+
} else if (node.name.expression) {
|
|
54032
|
+
name = printSubExpression(node.name.expression, src);
|
|
54033
|
+
} else {
|
|
54034
|
+
name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
54035
|
+
}
|
|
54036
|
+
const between = src.slice(node.name.range.end.offset, node.value.range.start.offset);
|
|
54037
|
+
const opMatch = /(!?=|[<>]=)/.exec(between);
|
|
54038
|
+
const compOp = opMatch ? opMatch[1] : "=";
|
|
54039
|
+
const hasHashPrefix = between.includes("#");
|
|
54040
|
+
let value;
|
|
54041
|
+
if (node.value.expression) {
|
|
54042
|
+
value = printSubExpression(node.value.expression, src);
|
|
54043
|
+
} else if (node.value.rawValue) {
|
|
54044
|
+
value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
54045
|
+
} else {
|
|
54046
|
+
value = src.slice(node.value.range.start.offset, node.value.range.end.offset).trim();
|
|
54047
|
+
}
|
|
54048
|
+
const reversed = node.reversed ? "R " : "";
|
|
54049
|
+
return cardinalityPrefix + reversed + name + " " + compOp + " " + value;
|
|
54050
|
+
}
|
|
54051
|
+
function printConceptReference(node) {
|
|
54052
|
+
return node.conceptId;
|
|
54053
|
+
}
|
|
54054
|
+
function normaliseAst(ast, sourceText) {
|
|
54055
|
+
return normaliseExpression(ast, sourceText);
|
|
54056
|
+
}
|
|
54057
|
+
function normaliseExpression(node, src) {
|
|
54058
|
+
const inner = node.expression;
|
|
54059
|
+
let normalised;
|
|
54060
|
+
switch (inner.type) {
|
|
54061
|
+
case NodeType.SubExpressionConstraint:
|
|
54062
|
+
normalised = normaliseSubExpression(inner, src);
|
|
54063
|
+
break;
|
|
54064
|
+
case NodeType.CompoundExpression:
|
|
54065
|
+
normalised = normaliseCompoundExpression(inner, src);
|
|
54066
|
+
break;
|
|
54067
|
+
case NodeType.RefinedExpression:
|
|
54068
|
+
normalised = normaliseRefinedExpression(inner, src);
|
|
54069
|
+
break;
|
|
54070
|
+
case NodeType.DottedExpression:
|
|
54071
|
+
normalised = normaliseDottedExpression(inner, src);
|
|
54072
|
+
break;
|
|
54073
|
+
default: {
|
|
54074
|
+
const _exhaustive = inner;
|
|
54075
|
+
normalised = _exhaustive;
|
|
54076
|
+
}
|
|
54077
|
+
}
|
|
54078
|
+
return { ...node, expression: normalised };
|
|
54079
|
+
}
|
|
54080
|
+
function normaliseSubExpression(node, src) {
|
|
54081
|
+
let focus;
|
|
54082
|
+
switch (node.focus.type) {
|
|
54083
|
+
case NodeType.ConceptReference:
|
|
54084
|
+
focus = stripTerm(node.focus);
|
|
54085
|
+
break;
|
|
54086
|
+
case NodeType.Wildcard:
|
|
54087
|
+
focus = { ...node.focus };
|
|
54088
|
+
break;
|
|
54089
|
+
case NodeType.ExpressionConstraint:
|
|
54090
|
+
focus = normaliseExpression(node.focus, src);
|
|
54091
|
+
break;
|
|
54092
|
+
}
|
|
54093
|
+
return {
|
|
54094
|
+
...node,
|
|
54095
|
+
operator: node.operator ? { ...node.operator } : void 0,
|
|
54096
|
+
focus,
|
|
54097
|
+
filters: node.filters ? node.filters.map(copyFilter) : void 0,
|
|
54098
|
+
historySupplement: node.historySupplement ? { ...node.historySupplement } : void 0
|
|
54099
|
+
};
|
|
54100
|
+
}
|
|
54101
|
+
function normaliseCompoundExpression(node, src) {
|
|
54102
|
+
const op = node.operator.operator;
|
|
54103
|
+
let normOperands = node.operands.map((o) => normaliseSubExpression(o, src));
|
|
54104
|
+
if (op === "AND" || op === "OR") {
|
|
54105
|
+
normOperands = flattenSameOperator(normOperands, op, src);
|
|
54106
|
+
}
|
|
54107
|
+
if (op === "AND" || op === "OR") {
|
|
54108
|
+
normOperands.sort((a, b) => {
|
|
54109
|
+
const ka = printCanonical(a, src);
|
|
54110
|
+
const kb = printCanonical(b, src);
|
|
54111
|
+
return ka.localeCompare(kb);
|
|
54112
|
+
});
|
|
54113
|
+
}
|
|
54114
|
+
return {
|
|
54115
|
+
...node,
|
|
54116
|
+
operator: { ...node.operator },
|
|
54117
|
+
operands: normOperands
|
|
54118
|
+
};
|
|
54119
|
+
}
|
|
54120
|
+
function flattenSameOperator(operands, operator, src) {
|
|
54121
|
+
const result = [];
|
|
54122
|
+
for (const operand of operands) {
|
|
54123
|
+
if (operand.focus.type === NodeType.ExpressionConstraint && !operand.operator && !operand.memberOf && !operand.filters && !operand.historySupplement) {
|
|
54124
|
+
const inner = operand.focus.expression;
|
|
54125
|
+
if (inner.type === NodeType.CompoundExpression && inner.operator.operator === operator) {
|
|
54126
|
+
const innerNorm = normaliseCompoundExpression(inner, src);
|
|
54127
|
+
result.push(...innerNorm.operands);
|
|
54128
|
+
continue;
|
|
54129
|
+
}
|
|
54130
|
+
}
|
|
54131
|
+
result.push(operand);
|
|
54132
|
+
}
|
|
54133
|
+
return result;
|
|
54134
|
+
}
|
|
54135
|
+
function normaliseRefinedExpression(node, src) {
|
|
54136
|
+
return {
|
|
54137
|
+
...node,
|
|
54138
|
+
expression: normaliseSubExpression(node.expression, src),
|
|
54139
|
+
refinement: normaliseRefinement(node.refinement, src)
|
|
54140
|
+
};
|
|
54141
|
+
}
|
|
54142
|
+
function normaliseRefinement(node, src) {
|
|
54143
|
+
const content = node.content ? normaliseRefinementMember(node.content, src) : null;
|
|
54144
|
+
const attributes = [];
|
|
54145
|
+
collectAttributes(content, attributes);
|
|
54146
|
+
return { ...node, attributes, content };
|
|
54147
|
+
}
|
|
54148
|
+
function normaliseRefinementMember(node, src) {
|
|
54149
|
+
switch (node.type) {
|
|
54150
|
+
case NodeType.Attribute:
|
|
54151
|
+
return normaliseAttribute(node, src);
|
|
54152
|
+
case NodeType.AttributeGroup:
|
|
54153
|
+
return { ...node, content: normaliseRefinementMember(node.content, src) };
|
|
54154
|
+
case NodeType.AttributeSet: {
|
|
54155
|
+
const members = flattenSameOperatorMembers(node).map((m) => normaliseRefinementMember(m, src));
|
|
54156
|
+
members.sort((a, b) => compareRefinementMembers(a, b, src));
|
|
54157
|
+
return { ...node, conjunctionStyle: ",", members };
|
|
54158
|
+
}
|
|
54159
|
+
}
|
|
54160
|
+
}
|
|
54161
|
+
function flattenSameOperatorMembers(node) {
|
|
54162
|
+
const result = [];
|
|
54163
|
+
for (const member of node.members) {
|
|
54164
|
+
if (member.type === NodeType.AttributeSet && member.operator === node.operator) {
|
|
54165
|
+
result.push(...flattenSameOperatorMembers(member));
|
|
54166
|
+
} else {
|
|
54167
|
+
result.push(member);
|
|
54168
|
+
}
|
|
54169
|
+
}
|
|
54170
|
+
return result;
|
|
54171
|
+
}
|
|
54172
|
+
function collectAttributes(node, out) {
|
|
54173
|
+
if (!node) return;
|
|
54174
|
+
switch (node.type) {
|
|
54175
|
+
case NodeType.Attribute:
|
|
54176
|
+
out.push(node);
|
|
54177
|
+
break;
|
|
54178
|
+
case NodeType.AttributeGroup:
|
|
54179
|
+
collectAttributes(node.content, out);
|
|
54180
|
+
break;
|
|
54181
|
+
case NodeType.AttributeSet:
|
|
54182
|
+
for (const member of node.members) {
|
|
54183
|
+
collectAttributes(member, out);
|
|
54184
|
+
}
|
|
54185
|
+
break;
|
|
54186
|
+
}
|
|
54187
|
+
}
|
|
54188
|
+
function compareRefinementMembers(a, b, src) {
|
|
54189
|
+
if (a.type === NodeType.Attribute && b.type === NodeType.Attribute) {
|
|
54190
|
+
return compareAttributes(a, b, src);
|
|
54191
|
+
}
|
|
54192
|
+
if (a.type === NodeType.Attribute) return -1;
|
|
54193
|
+
if (b.type === NodeType.Attribute) return 1;
|
|
54194
|
+
return printRefinementMember(a, src).localeCompare(printRefinementMember(b, src));
|
|
54195
|
+
}
|
|
54196
|
+
function compareAttributes(a, b, src) {
|
|
54197
|
+
const aId = a.name.conceptId;
|
|
54198
|
+
const bId = b.name.conceptId;
|
|
54199
|
+
if (aId && bId) {
|
|
54200
|
+
const aBig = BigInt(aId);
|
|
54201
|
+
const bBig = BigInt(bId);
|
|
54202
|
+
if (aBig < bBig) return -1;
|
|
54203
|
+
if (aBig > bBig) return 1;
|
|
54204
|
+
return 0;
|
|
54205
|
+
}
|
|
54206
|
+
if (aId) return -1;
|
|
54207
|
+
if (bId) return 1;
|
|
54208
|
+
const aKey = a.name.expression ? printCanonical(a.name.expression, src) : "";
|
|
54209
|
+
const bKey = b.name.expression ? printCanonical(b.name.expression, src) : "";
|
|
54210
|
+
return aKey.localeCompare(bKey);
|
|
54211
|
+
}
|
|
54212
|
+
function normaliseAttribute(node, src) {
|
|
54213
|
+
return {
|
|
54214
|
+
...node,
|
|
54215
|
+
name: normaliseAttributeName(node.name, src),
|
|
54216
|
+
value: normaliseAttributeValue(node.value, src)
|
|
54217
|
+
};
|
|
54218
|
+
}
|
|
54219
|
+
function normaliseAttributeName(node, src) {
|
|
54220
|
+
return {
|
|
54221
|
+
...node,
|
|
54222
|
+
term: void 0,
|
|
54223
|
+
// §5.1: strip display terms
|
|
54224
|
+
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
54225
|
+
};
|
|
54226
|
+
}
|
|
54227
|
+
function normaliseAttributeValue(node, src) {
|
|
54228
|
+
return {
|
|
54229
|
+
...node,
|
|
54230
|
+
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
54231
|
+
};
|
|
54232
|
+
}
|
|
54233
|
+
function normaliseDottedExpression(node, src) {
|
|
54234
|
+
return {
|
|
54235
|
+
...node,
|
|
54236
|
+
source: normaliseSubExpression(node.source, src),
|
|
54237
|
+
attributes: node.attributes.map((a) => ({
|
|
54238
|
+
...a,
|
|
54239
|
+
attributeName: normaliseSubExpression(a.attributeName, src)
|
|
54240
|
+
}))
|
|
54241
|
+
};
|
|
54242
|
+
}
|
|
54243
|
+
function stripTerm(node) {
|
|
54244
|
+
return { ...node, term: void 0 };
|
|
54245
|
+
}
|
|
54246
|
+
function copyFilter(node) {
|
|
54247
|
+
return { ...node };
|
|
54248
|
+
}
|
|
54249
|
+
function structuralSignature(ast, sourceText) {
|
|
54250
|
+
return printCanonical(normaliseAst(ast, sourceText), sourceText);
|
|
54251
|
+
}
|
|
54252
|
+
function signatureOf(text) {
|
|
54253
|
+
try {
|
|
54254
|
+
const { ast, errors: errors2 } = parseECL(text);
|
|
54255
|
+
if (!ast || errors2.length > 0) {
|
|
54256
|
+
return null;
|
|
54257
|
+
}
|
|
54258
|
+
return structuralSignature(ast, text);
|
|
54259
|
+
} catch {
|
|
54260
|
+
return null;
|
|
54261
|
+
}
|
|
54262
|
+
}
|
|
53400
54263
|
function splitExpressions(text) {
|
|
53401
54264
|
const delimiter = "/* ECL-END */";
|
|
53402
54265
|
const delimiterPositions = [];
|
|
@@ -53566,23 +54429,43 @@ function normalizeFilterBlocks(text) {
|
|
|
53566
54429
|
return match.toLowerCase() === lower ? canonical : match;
|
|
53567
54430
|
});
|
|
53568
54431
|
}
|
|
53569
|
-
normalized = normalized.replace(/\s*(
|
|
54432
|
+
normalized = normalized.replace(/\s*(!=|>=|<=)\s*/g, " $1 ");
|
|
54433
|
+
normalized = normalized.replace(new RegExp("\\s*(?<![!<>])=\\s*", "g"), " = ");
|
|
53570
54434
|
normalized = normalized.replace(/,\s*/g, ", ");
|
|
53571
54435
|
normalized = normalized.replace(/ {2,}/g, " ");
|
|
53572
54436
|
normalized = normalized.replace(/^\s*/, " ").replace(/\s*$/, " ");
|
|
53573
54437
|
return "{{" + normalized + "}}";
|
|
53574
54438
|
});
|
|
53575
54439
|
}
|
|
54440
|
+
function applyAstPrinter(normalizedText, options) {
|
|
54441
|
+
try {
|
|
54442
|
+
const reParsed = parseECL(normalizedText);
|
|
54443
|
+
const coversAll = reParsed.ast && reParsed.errors.length === 0 && reParsed.ast.range.end.offset >= normalizedText.trimEnd().length;
|
|
54444
|
+
if (!coversAll || !reParsed.ast) {
|
|
54445
|
+
return normalizedText;
|
|
54446
|
+
}
|
|
54447
|
+
const before = structuralSignature(reParsed.ast, normalizedText);
|
|
54448
|
+
const printed = printAst(reParsed.ast, normalizedText, options);
|
|
54449
|
+
return signatureOf(printed) === before ? printed : normalizedText;
|
|
54450
|
+
} catch {
|
|
54451
|
+
return normalizedText;
|
|
54452
|
+
}
|
|
54453
|
+
}
|
|
53576
54454
|
function formatExpressionBody(text, options, ast) {
|
|
53577
54455
|
const { comments, textWithoutComments } = extractComments(text);
|
|
53578
54456
|
const nonDelimiterComments = comments.filter((c) => c.content.trim() !== "/* ECL-END */");
|
|
53579
54457
|
let formatted = normalizeFilterBlocks(textWithoutComments);
|
|
53580
54458
|
formatted = formatted.replace(
|
|
53581
|
-
//
|
|
54459
|
+
// Bounded ECL expression text; no ReDoS risk.
|
|
54460
|
+
// Measured quadratic in the length of a contiguous whitespace run, not exponential.
|
|
54461
|
+
// Realistic ECL has no such runs: 500 expressions (43 KB) format in ~47 ms, while only a
|
|
54462
|
+
// synthetic 32 K-char whitespace run reaches ~2.6 s. The input is the document the user
|
|
54463
|
+
// opened, not untrusted network data.
|
|
54464
|
+
// eslint-disable-next-line sonarjs/super-linear-regex -- see note above
|
|
53582
54465
|
new RegExp("(\\S?)(?<![A-Za-z])\\s*(AND|OR|MINUS)\\s*(?![A-Za-z])(\\S?)", "g"),
|
|
53583
|
-
(
|
|
53584
|
-
const formattedOp =
|
|
53585
|
-
return
|
|
54466
|
+
(_match, before, op, after) => {
|
|
54467
|
+
const formattedOp = ` ${op} `;
|
|
54468
|
+
return before + formattedOp + after;
|
|
53586
54469
|
}
|
|
53587
54470
|
);
|
|
53588
54471
|
formatted = formatted.replace(/[ \t]*(:)[ \t]*/g, formatRefinementColon("$1"));
|
|
@@ -53590,23 +54473,21 @@ function formatExpressionBody(text, options, ast) {
|
|
|
53590
54473
|
formatted = formatted.replace(new RegExp("[ \\t]*(?<![!<>])(=)[ \\t]*", "g"), formatRefinementEquals("$1"));
|
|
53591
54474
|
formatted = formatted.replace(/(<<|<|>>|>)\s*(\d)/g, "$1 $2");
|
|
53592
54475
|
formatted = formatted.replace(/(\d)\s+(\|)/g, "$1$2");
|
|
53593
|
-
formatted = formatted.replace(/\|([^|]+)\|/g, (
|
|
54476
|
+
formatted = formatted.replace(/\|([^|]+)\|/g, (_match, content) => {
|
|
53594
54477
|
return normalizeTerm(content);
|
|
53595
54478
|
});
|
|
53596
54479
|
if (ast) {
|
|
53597
|
-
|
|
53598
|
-
const reParsed = parseECL(formatted);
|
|
53599
|
-
const astCoversAll = reParsed.ast && reParsed.errors.length === 0 && reParsed.ast.range.end.offset >= formatted.trimEnd().length;
|
|
53600
|
-
if (astCoversAll && reParsed.ast) {
|
|
53601
|
-
formatted = printAst(reParsed.ast, formatted, options);
|
|
53602
|
-
} else {
|
|
53603
|
-
}
|
|
53604
|
-
} catch {
|
|
53605
|
-
}
|
|
54480
|
+
formatted = applyAstPrinter(formatted, options);
|
|
53606
54481
|
}
|
|
53607
54482
|
if (options.breakOnRefinementComma) {
|
|
53608
54483
|
formatted = applyRefinementCommaBreaks(formatted, options);
|
|
53609
54484
|
}
|
|
54485
|
+
{
|
|
54486
|
+
const baseline = signatureOf(normalizeFilterBlocks(textWithoutComments));
|
|
54487
|
+
if (baseline !== null && signatureOf(formatted) !== baseline) {
|
|
54488
|
+
formatted = textWithoutComments;
|
|
54489
|
+
}
|
|
54490
|
+
}
|
|
53610
54491
|
const withComments = reinsertComments(formatted.trim(), text, nonDelimiterComments);
|
|
53611
54492
|
return withComments;
|
|
53612
54493
|
}
|
|
@@ -55610,14 +56491,12 @@ async function getFhirFilterCompletions(keyword, terminologyService) {
|
|
|
55610
56491
|
}
|
|
55611
56492
|
try {
|
|
55612
56493
|
const response = await terminologyService.evaluateEcl(ecl, EXPANSION_LIMIT);
|
|
55613
|
-
const items = response.concepts.map(
|
|
55614
|
-
|
|
55615
|
-
|
|
55616
|
-
|
|
55617
|
-
|
|
55618
|
-
|
|
55619
|
-
})
|
|
55620
|
-
);
|
|
56494
|
+
const items = response.concepts.map((concept, index) => ({
|
|
56495
|
+
label: `${concept.code} |${concept.display}|`,
|
|
56496
|
+
kind: "value",
|
|
56497
|
+
detail: concept.display,
|
|
56498
|
+
sortText: `e-${(20 + index).toString().padStart(3, "0")}`
|
|
56499
|
+
}));
|
|
55621
56500
|
cache.set(key, { items, timestamp: Date.now() });
|
|
55622
56501
|
return items;
|
|
55623
56502
|
} catch {
|
|
@@ -55828,62 +56707,45 @@ const eclTokenTypes = [
|
|
|
55828
56707
|
// 8 — history supplement keywords
|
|
55829
56708
|
];
|
|
55830
56709
|
const eclTokenModifiers = [];
|
|
55831
|
-
const NT = {
|
|
55832
|
-
ExpressionConstraint: "ExpressionConstraint",
|
|
55833
|
-
SubExpressionConstraint: "SubExpressionConstraint",
|
|
55834
|
-
CompoundExpression: "CompoundExpression",
|
|
55835
|
-
RefinedExpression: "RefinedExpression",
|
|
55836
|
-
DottedExpression: "DottedExpression",
|
|
55837
|
-
DottedAttribute: "DottedAttribute",
|
|
55838
|
-
Refinement: "Refinement",
|
|
55839
|
-
Attribute: "Attribute",
|
|
55840
|
-
FilterConstraint: "FilterConstraint",
|
|
55841
|
-
HistorySupplement: "HistorySupplement"
|
|
55842
|
-
};
|
|
55843
56710
|
function collectAttributeNamePositions(ast, lineOffsets) {
|
|
55844
56711
|
const positions = /* @__PURE__ */ new Set();
|
|
55845
56712
|
function visit(node) {
|
|
55846
|
-
|
|
55847
|
-
if (!(node == null ? void 0 : node.type)) return;
|
|
56713
|
+
if (!node) return;
|
|
55848
56714
|
switch (node.type) {
|
|
55849
|
-
case
|
|
55850
|
-
|
|
56715
|
+
case NodeType.ExpressionConstraint:
|
|
56716
|
+
visit(node.expression);
|
|
55851
56717
|
break;
|
|
55852
|
-
case
|
|
55853
|
-
|
|
55854
|
-
|
|
55855
|
-
|
|
55856
|
-
}
|
|
55857
|
-
if (node.historySupplement) visit(node.historySupplement);
|
|
56718
|
+
case NodeType.SubExpressionConstraint:
|
|
56719
|
+
visit(node.focus);
|
|
56720
|
+
for (const f of node.filters ?? []) visit(f);
|
|
56721
|
+
visit(node.historySupplement);
|
|
55858
56722
|
break;
|
|
55859
|
-
case
|
|
56723
|
+
case NodeType.CompoundExpression:
|
|
55860
56724
|
for (const op of node.operands) visit(op);
|
|
55861
56725
|
break;
|
|
55862
|
-
case
|
|
56726
|
+
case NodeType.RefinedExpression:
|
|
55863
56727
|
visit(node.expression);
|
|
55864
56728
|
visit(node.refinement);
|
|
55865
56729
|
break;
|
|
55866
|
-
case
|
|
56730
|
+
case NodeType.DottedExpression:
|
|
55867
56731
|
visit(node.source);
|
|
55868
56732
|
for (const attr of node.attributes) visit(attr);
|
|
55869
56733
|
break;
|
|
55870
|
-
case
|
|
55871
|
-
|
|
55872
|
-
markSubExpressionAsAttrName(node.attributeName, lineOffsets, positions);
|
|
55873
|
-
}
|
|
56734
|
+
case NodeType.DottedAttribute:
|
|
56735
|
+
markSubExpressionAsAttrName(node.attributeName, lineOffsets, positions);
|
|
55874
56736
|
break;
|
|
55875
|
-
case
|
|
56737
|
+
case NodeType.Refinement:
|
|
55876
56738
|
for (const attr of node.attributes) visit(attr);
|
|
55877
56739
|
break;
|
|
55878
|
-
case
|
|
56740
|
+
case NodeType.Attribute:
|
|
55879
56741
|
markAttributeName(node.name, lineOffsets, positions);
|
|
55880
|
-
|
|
56742
|
+
visit(node.value.expression);
|
|
55881
56743
|
break;
|
|
55882
|
-
case
|
|
56744
|
+
case NodeType.FilterConstraint:
|
|
55883
56745
|
for (const ce of node.conceptExpressions) visit(ce);
|
|
55884
56746
|
break;
|
|
55885
|
-
case
|
|
55886
|
-
|
|
56747
|
+
case NodeType.HistorySupplement:
|
|
56748
|
+
visit(node.subsetExpression);
|
|
55887
56749
|
break;
|
|
55888
56750
|
}
|
|
55889
56751
|
}
|
|
@@ -56117,275 +56979,6 @@ function isInsideFilterBlock(ranges, matchStart, matchEnd) {
|
|
|
56117
56979
|
}
|
|
56118
56980
|
return false;
|
|
56119
56981
|
}
|
|
56120
|
-
function printCanonical(ast, sourceText, outerOperator) {
|
|
56121
|
-
if (ast.type === NodeType.SubExpressionConstraint) {
|
|
56122
|
-
return printSubExpression(ast, sourceText, outerOperator);
|
|
56123
|
-
}
|
|
56124
|
-
return printExpression(ast, sourceText, outerOperator);
|
|
56125
|
-
}
|
|
56126
|
-
function printExpression(node, src, outerOperator) {
|
|
56127
|
-
const inner = node.expression;
|
|
56128
|
-
switch (inner.type) {
|
|
56129
|
-
case NodeType.SubExpressionConstraint:
|
|
56130
|
-
return printSubExpression(inner, src, outerOperator);
|
|
56131
|
-
case NodeType.CompoundExpression:
|
|
56132
|
-
return printCompoundExpression(inner, src);
|
|
56133
|
-
case NodeType.RefinedExpression:
|
|
56134
|
-
return printRefinedExpression(inner, src);
|
|
56135
|
-
case NodeType.DottedExpression:
|
|
56136
|
-
return printDottedExpression(inner, src);
|
|
56137
|
-
default: {
|
|
56138
|
-
const _exhaustive = inner;
|
|
56139
|
-
return String(_exhaustive);
|
|
56140
|
-
}
|
|
56141
|
-
}
|
|
56142
|
-
}
|
|
56143
|
-
function printSubExpression(node, src, outerOperator) {
|
|
56144
|
-
let result = "";
|
|
56145
|
-
if (node.operator) {
|
|
56146
|
-
result += node.operator.operator;
|
|
56147
|
-
}
|
|
56148
|
-
if (node.memberOf) {
|
|
56149
|
-
result += "^";
|
|
56150
|
-
}
|
|
56151
|
-
switch (node.focus.type) {
|
|
56152
|
-
case NodeType.ConceptReference:
|
|
56153
|
-
result += printConceptReference(node.focus);
|
|
56154
|
-
break;
|
|
56155
|
-
case NodeType.Wildcard:
|
|
56156
|
-
result += "*";
|
|
56157
|
-
break;
|
|
56158
|
-
case NodeType.ExpressionConstraint: {
|
|
56159
|
-
const innerExpr = node.focus.expression;
|
|
56160
|
-
if (innerExpr.type !== NodeType.CompoundExpression) {
|
|
56161
|
-
result += printExpression(node.focus, src, outerOperator);
|
|
56162
|
-
} else if (outerOperator && innerExpr.operator.operator === outerOperator) {
|
|
56163
|
-
result += printExpression(node.focus, src, outerOperator);
|
|
56164
|
-
} else {
|
|
56165
|
-
result += "(" + printExpression(node.focus, src) + ")";
|
|
56166
|
-
}
|
|
56167
|
-
break;
|
|
56168
|
-
}
|
|
56169
|
-
}
|
|
56170
|
-
if (node.filters) {
|
|
56171
|
-
for (const filter of node.filters) {
|
|
56172
|
-
const filterText = src.slice(filter.range.start.offset, filter.range.end.offset);
|
|
56173
|
-
result += " " + filterText.replaceAll(/\s+/g, " ").trim();
|
|
56174
|
-
}
|
|
56175
|
-
}
|
|
56176
|
-
if (node.historySupplement) {
|
|
56177
|
-
const histText = src.slice(node.historySupplement.range.start.offset, node.historySupplement.range.end.offset);
|
|
56178
|
-
result += " " + histText.replaceAll(/\s+/g, " ").trim();
|
|
56179
|
-
}
|
|
56180
|
-
return result;
|
|
56181
|
-
}
|
|
56182
|
-
function printCompoundExpression(node, src) {
|
|
56183
|
-
const op = node.operator.operator;
|
|
56184
|
-
return node.operands.map((operand) => printSubExpression(operand, src, op)).join(` ${op} `);
|
|
56185
|
-
}
|
|
56186
|
-
function printRefinedExpression(node, src) {
|
|
56187
|
-
const focus = printSubExpression(node.expression, src);
|
|
56188
|
-
const refinement = printRefinement(node.refinement, src);
|
|
56189
|
-
return focus + ":" + refinement;
|
|
56190
|
-
}
|
|
56191
|
-
function printDottedExpression(node, src) {
|
|
56192
|
-
const source = printSubExpression(node.source, src);
|
|
56193
|
-
const dots = node.attributes.map((a) => printSubExpression(a.attributeName, src));
|
|
56194
|
-
return source + dots.map((d) => "." + d).join("");
|
|
56195
|
-
}
|
|
56196
|
-
function printRefinement(node, src) {
|
|
56197
|
-
const parts = [];
|
|
56198
|
-
let prevEnd = node.range.start.offset;
|
|
56199
|
-
for (const attr of node.attributes) {
|
|
56200
|
-
const printed = printAttribute(attr, src);
|
|
56201
|
-
const inBraces = isAttrInBraceGroup(attr, prevEnd, src);
|
|
56202
|
-
parts.push(inBraces ? "{" + printed + "}" : printed);
|
|
56203
|
-
prevEnd = attr.range.end.offset;
|
|
56204
|
-
}
|
|
56205
|
-
return parts.join(",");
|
|
56206
|
-
}
|
|
56207
|
-
function isAttrInBraceGroup(attr, prevEnd, src) {
|
|
56208
|
-
const gap = src.slice(prevEnd, attr.range.start.offset);
|
|
56209
|
-
return gap.includes("{");
|
|
56210
|
-
}
|
|
56211
|
-
function printAttribute(node, src) {
|
|
56212
|
-
const preNameSrc = src.slice(node.range.start.offset, node.name.range.start.offset).trim();
|
|
56213
|
-
const cardinalityRaw = preNameSrc.replace(/^\{?\s*/, "").trim();
|
|
56214
|
-
const cardinalityPrefix = cardinalityRaw.length > 0 ? cardinalityRaw + " " : "";
|
|
56215
|
-
let name;
|
|
56216
|
-
if (node.name.conceptId) {
|
|
56217
|
-
name = node.name.conceptId;
|
|
56218
|
-
} else if (node.name.expression) {
|
|
56219
|
-
name = printSubExpression(node.name.expression, src);
|
|
56220
|
-
} else {
|
|
56221
|
-
name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
56222
|
-
}
|
|
56223
|
-
const between = src.slice(node.name.range.end.offset, node.value.range.start.offset);
|
|
56224
|
-
const opMatch = /(!?=|[<>]=)/.exec(between);
|
|
56225
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
56226
|
-
const hasHashPrefix = between.includes("#");
|
|
56227
|
-
let value;
|
|
56228
|
-
if (node.value.expression) {
|
|
56229
|
-
value = printSubExpression(node.value.expression, src);
|
|
56230
|
-
} else if (node.value.rawValue) {
|
|
56231
|
-
value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
56232
|
-
} else {
|
|
56233
|
-
value = src.slice(node.value.range.start.offset, node.value.range.end.offset).trim();
|
|
56234
|
-
}
|
|
56235
|
-
const reversed = node.reversed ? "R " : "";
|
|
56236
|
-
return cardinalityPrefix + reversed + name + " " + compOp + " " + value;
|
|
56237
|
-
}
|
|
56238
|
-
function printConceptReference(node) {
|
|
56239
|
-
return node.conceptId;
|
|
56240
|
-
}
|
|
56241
|
-
function normaliseAst(ast, sourceText) {
|
|
56242
|
-
return normaliseExpression(ast, sourceText);
|
|
56243
|
-
}
|
|
56244
|
-
function normaliseExpression(node, src) {
|
|
56245
|
-
const inner = node.expression;
|
|
56246
|
-
let normalised;
|
|
56247
|
-
switch (inner.type) {
|
|
56248
|
-
case NodeType.SubExpressionConstraint:
|
|
56249
|
-
normalised = normaliseSubExpression(inner, src);
|
|
56250
|
-
break;
|
|
56251
|
-
case NodeType.CompoundExpression:
|
|
56252
|
-
normalised = normaliseCompoundExpression(inner, src);
|
|
56253
|
-
break;
|
|
56254
|
-
case NodeType.RefinedExpression:
|
|
56255
|
-
normalised = normaliseRefinedExpression(inner, src);
|
|
56256
|
-
break;
|
|
56257
|
-
case NodeType.DottedExpression:
|
|
56258
|
-
normalised = normaliseDottedExpression(inner, src);
|
|
56259
|
-
break;
|
|
56260
|
-
default: {
|
|
56261
|
-
const _exhaustive = inner;
|
|
56262
|
-
normalised = _exhaustive;
|
|
56263
|
-
}
|
|
56264
|
-
}
|
|
56265
|
-
return { ...node, expression: normalised };
|
|
56266
|
-
}
|
|
56267
|
-
function normaliseSubExpression(node, src) {
|
|
56268
|
-
let focus;
|
|
56269
|
-
switch (node.focus.type) {
|
|
56270
|
-
case NodeType.ConceptReference:
|
|
56271
|
-
focus = stripTerm(node.focus);
|
|
56272
|
-
break;
|
|
56273
|
-
case NodeType.Wildcard:
|
|
56274
|
-
focus = { ...node.focus };
|
|
56275
|
-
break;
|
|
56276
|
-
case NodeType.ExpressionConstraint:
|
|
56277
|
-
focus = normaliseExpression(node.focus, src);
|
|
56278
|
-
break;
|
|
56279
|
-
}
|
|
56280
|
-
return {
|
|
56281
|
-
...node,
|
|
56282
|
-
operator: node.operator ? { ...node.operator } : void 0,
|
|
56283
|
-
focus,
|
|
56284
|
-
filters: node.filters ? node.filters.map(copyFilter) : void 0,
|
|
56285
|
-
historySupplement: node.historySupplement ? { ...node.historySupplement } : void 0
|
|
56286
|
-
};
|
|
56287
|
-
}
|
|
56288
|
-
function normaliseCompoundExpression(node, src) {
|
|
56289
|
-
const op = node.operator.operator;
|
|
56290
|
-
let normOperands = node.operands.map((o) => normaliseSubExpression(o, src));
|
|
56291
|
-
if (op === "AND" || op === "OR") {
|
|
56292
|
-
normOperands = flattenSameOperator(normOperands, op, src);
|
|
56293
|
-
}
|
|
56294
|
-
if (op === "AND" || op === "OR") {
|
|
56295
|
-
normOperands.sort((a, b) => {
|
|
56296
|
-
const ka = printCanonical(a, src);
|
|
56297
|
-
const kb = printCanonical(b, src);
|
|
56298
|
-
return ka.localeCompare(kb);
|
|
56299
|
-
});
|
|
56300
|
-
}
|
|
56301
|
-
return {
|
|
56302
|
-
...node,
|
|
56303
|
-
operator: { ...node.operator },
|
|
56304
|
-
operands: normOperands
|
|
56305
|
-
};
|
|
56306
|
-
}
|
|
56307
|
-
function flattenSameOperator(operands, operator, src) {
|
|
56308
|
-
const result = [];
|
|
56309
|
-
for (const operand of operands) {
|
|
56310
|
-
if (operand.focus.type === NodeType.ExpressionConstraint && !operand.operator && !operand.memberOf && !operand.filters && !operand.historySupplement) {
|
|
56311
|
-
const inner = operand.focus.expression;
|
|
56312
|
-
if (inner.type === NodeType.CompoundExpression && inner.operator.operator === operator) {
|
|
56313
|
-
const innerNorm = normaliseCompoundExpression(inner, src);
|
|
56314
|
-
result.push(...innerNorm.operands);
|
|
56315
|
-
continue;
|
|
56316
|
-
}
|
|
56317
|
-
}
|
|
56318
|
-
result.push(operand);
|
|
56319
|
-
}
|
|
56320
|
-
return result;
|
|
56321
|
-
}
|
|
56322
|
-
function normaliseRefinedExpression(node, src) {
|
|
56323
|
-
return {
|
|
56324
|
-
...node,
|
|
56325
|
-
expression: normaliseSubExpression(node.expression, src),
|
|
56326
|
-
refinement: normaliseRefinement(node.refinement, src)
|
|
56327
|
-
};
|
|
56328
|
-
}
|
|
56329
|
-
function normaliseRefinement(node, src) {
|
|
56330
|
-
const normAttrs = node.attributes.map((a) => normaliseAttribute(a, src));
|
|
56331
|
-
normAttrs.sort((a, b) => compareAttributes(a, b, src));
|
|
56332
|
-
return { ...node, attributes: normAttrs };
|
|
56333
|
-
}
|
|
56334
|
-
function compareAttributes(a, b, src) {
|
|
56335
|
-
const aId = a.name.conceptId;
|
|
56336
|
-
const bId = b.name.conceptId;
|
|
56337
|
-
if (aId && bId) {
|
|
56338
|
-
const aBig = BigInt(aId);
|
|
56339
|
-
const bBig = BigInt(bId);
|
|
56340
|
-
if (aBig < bBig) return -1;
|
|
56341
|
-
if (aBig > bBig) return 1;
|
|
56342
|
-
return 0;
|
|
56343
|
-
}
|
|
56344
|
-
if (aId) return -1;
|
|
56345
|
-
if (bId) return 1;
|
|
56346
|
-
const aKey = a.name.expression ? printCanonical(a.name.expression, src) : "";
|
|
56347
|
-
const bKey = b.name.expression ? printCanonical(b.name.expression, src) : "";
|
|
56348
|
-
return aKey.localeCompare(bKey);
|
|
56349
|
-
}
|
|
56350
|
-
function normaliseAttribute(node, src) {
|
|
56351
|
-
return {
|
|
56352
|
-
...node,
|
|
56353
|
-
name: normaliseAttributeName(node.name, src),
|
|
56354
|
-
value: normaliseAttributeValue(node.value, src)
|
|
56355
|
-
};
|
|
56356
|
-
}
|
|
56357
|
-
function normaliseAttributeName(node, src) {
|
|
56358
|
-
return {
|
|
56359
|
-
...node,
|
|
56360
|
-
term: void 0,
|
|
56361
|
-
// §5.1: strip display terms
|
|
56362
|
-
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
56363
|
-
};
|
|
56364
|
-
}
|
|
56365
|
-
function normaliseAttributeValue(node, src) {
|
|
56366
|
-
return {
|
|
56367
|
-
...node,
|
|
56368
|
-
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
56369
|
-
};
|
|
56370
|
-
}
|
|
56371
|
-
function normaliseDottedExpression(node, src) {
|
|
56372
|
-
return {
|
|
56373
|
-
...node,
|
|
56374
|
-
source: normaliseSubExpression(node.source, src),
|
|
56375
|
-
attributes: node.attributes.map(
|
|
56376
|
-
(a) => ({
|
|
56377
|
-
...a,
|
|
56378
|
-
attributeName: normaliseSubExpression(a.attributeName, src)
|
|
56379
|
-
})
|
|
56380
|
-
)
|
|
56381
|
-
};
|
|
56382
|
-
}
|
|
56383
|
-
function stripTerm(node) {
|
|
56384
|
-
return { ...node, term: void 0 };
|
|
56385
|
-
}
|
|
56386
|
-
function copyFilter(node) {
|
|
56387
|
-
return { ...node };
|
|
56388
|
-
}
|
|
56389
56982
|
class CanonicaliseError extends Error {
|
|
56390
56983
|
constructor(message, parseErrors) {
|
|
56391
56984
|
super(message);
|
|
@@ -57430,6 +58023,9 @@ function getGuide(uri2) {
|
|
|
57430
58023
|
exports.CanonicaliseError = CanonicaliseError;
|
|
57431
58024
|
exports.FhirTerminologyService = FhirTerminologyService;
|
|
57432
58025
|
exports.REFACTORING_RESOLVE_KIND = REFACTORING_RESOLVE_KIND;
|
|
58026
|
+
exports.TerminologyError = TerminologyError;
|
|
58027
|
+
exports.TerminologyHttpError = TerminologyHttpError;
|
|
58028
|
+
exports.TerminologyTransportError = TerminologyTransportError;
|
|
57433
58029
|
exports.allArticles = allArticles;
|
|
57434
58030
|
exports.analyzeExpression = analyzeExpression;
|
|
57435
58031
|
exports.buildReplacementText = buildReplacementText;
|
|
@@ -57467,6 +58063,10 @@ exports.getText = getText;
|
|
|
57467
58063
|
exports.getValidOperatorsAtPosition = getValidOperatorsAtPosition;
|
|
57468
58064
|
exports.groupIntoExpressions = groupIntoExpressions;
|
|
57469
58065
|
exports.isConceptPositionValid = isConceptPositionValid;
|
|
58066
|
+
exports.isEclEvaluationStrategy = isEclEvaluationStrategy;
|
|
58067
|
+
exports.isTerminologyError = isTerminologyError;
|
|
58068
|
+
exports.isTerminologyHttpError = isTerminologyHttpError;
|
|
58069
|
+
exports.isTerminologyTransportError = isTerminologyTransportError;
|
|
57470
58070
|
exports.isValidConceptId = isValidConceptId;
|
|
57471
58071
|
exports.isValidDescriptionId = isValidDescriptionId;
|
|
57472
58072
|
exports.isValidSnomedId = isValidSnomedId;
|
|
@@ -57478,6 +58078,8 @@ exports.positionAt = positionAt;
|
|
|
57478
58078
|
exports.refineParseError = refineParseError;
|
|
57479
58079
|
exports.resolveAddDisplayTerms = resolveAddDisplayTerms;
|
|
57480
58080
|
exports.resolveUnifiedSimplify = resolveUnifiedSimplify;
|
|
58081
|
+
exports.toHttpError = toHttpError;
|
|
58082
|
+
exports.toTransportError = toTransportError;
|
|
57481
58083
|
exports.validateBoolean = validateBoolean;
|
|
57482
58084
|
exports.validateIndentSize = validateIndentSize;
|
|
57483
58085
|
exports.validateIndentStyle = validateIndentStyle;
|