@contember/utilities 2.0.0-alpha.19 → 2.0.0-alpha.20
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/development/index.cjs +0 -29
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +1 -30
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/structures/BijectiveIndexedMap.cjs.map +1 -1
- package/dist/development/src/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/development/src/structures/LRUCache.cjs.map +1 -1
- package/dist/development/src/structures/LRUCache.js.map +1 -1
- package/dist/production/index.cjs +0 -29
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +1 -30
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/structures/BijectiveIndexedMap.cjs.map +1 -1
- package/dist/production/src/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/production/src/structures/LRUCache.cjs.map +1 -1
- package/dist/production/src/structures/LRUCache.js.map +1 -1
- package/dist/types/assert-types/index.d.ts +0 -4
- package/dist/types/assert-types/index.d.ts.map +1 -1
- package/dist/types/dom/index.d.ts +0 -4
- package/dist/types/dom/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/structures/BijectiveIndexedMap.d.ts +4 -4
- package/dist/types/structures/BijectiveIndexedMap.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/index.d.ts +0 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assert-types/index.ts +0 -4
- package/src/dom/index.ts +0 -4
- package/src/index.ts +0 -6
- package/src/structures/BijectiveIndexedMap.ts +4 -4
- package/src/structures/LRUCache.ts +1 -1
- package/src/types/index.ts +0 -1
- package/dist/development/src/assert-types/AssertionError.cjs +0 -9
- package/dist/development/src/assert-types/AssertionError.cjs.map +0 -1
- package/dist/development/src/assert-types/AssertionError.js +0 -9
- package/dist/development/src/assert-types/AssertionError.js.map +0 -1
- package/dist/development/src/assert-types/Predicates.cjs +0 -7
- package/dist/development/src/assert-types/Predicates.cjs.map +0 -1
- package/dist/development/src/assert-types/Predicates.js +0 -7
- package/dist/development/src/assert-types/Predicates.js.map +0 -1
- package/dist/development/src/assert-types/assert.cjs +0 -10
- package/dist/development/src/assert-types/assert.cjs.map +0 -1
- package/dist/development/src/assert-types/assert.js +0 -10
- package/dist/development/src/assert-types/assert.js.map +0 -1
- package/dist/development/src/css-utilities/px.cjs +0 -7
- package/dist/development/src/css-utilities/px.cjs.map +0 -1
- package/dist/development/src/css-utilities/px.js +0 -7
- package/dist/development/src/css-utilities/px.js.map +0 -1
- package/dist/development/src/data-utilities/dateToStringWithoutTimezone.cjs +0 -20
- package/dist/development/src/data-utilities/dateToStringWithoutTimezone.cjs.map +0 -1
- package/dist/development/src/data-utilities/dateToStringWithoutTimezone.js +0 -20
- package/dist/development/src/data-utilities/dateToStringWithoutTimezone.js.map +0 -1
- package/dist/development/src/dom/getElementDimensions.cjs +0 -22
- package/dist/development/src/dom/getElementDimensions.cjs.map +0 -1
- package/dist/development/src/dom/getElementDimensions.js +0 -22
- package/dist/development/src/dom/getElementDimensions.js.map +0 -1
- package/dist/development/src/dom/getSizeFromResizeObserverEntry.cjs +0 -24
- package/dist/development/src/dom/getSizeFromResizeObserverEntry.cjs.map +0 -1
- package/dist/development/src/dom/getSizeFromResizeObserverEntry.js +0 -24
- package/dist/development/src/dom/getSizeFromResizeObserverEntry.js.map +0 -1
- package/dist/development/src/dom/shouldCancelStart.cjs +0 -29
- package/dist/development/src/dom/shouldCancelStart.cjs.map +0 -1
- package/dist/development/src/dom/shouldCancelStart.js +0 -29
- package/dist/development/src/dom/shouldCancelStart.js.map +0 -1
- package/dist/development/src/dom/stateDataAttributes.cjs +0 -11
- package/dist/development/src/dom/stateDataAttributes.cjs.map +0 -1
- package/dist/development/src/dom/stateDataAttributes.js +0 -11
- package/dist/development/src/dom/stateDataAttributes.js.map +0 -1
- package/dist/development/src/events/isSpecialLinkClick.cjs +0 -5
- package/dist/development/src/events/isSpecialLinkClick.cjs.map +0 -1
- package/dist/development/src/events/isSpecialLinkClick.js +0 -5
- package/dist/development/src/events/isSpecialLinkClick.js.map +0 -1
- package/dist/development/src/functional/omit.cjs +0 -15
- package/dist/development/src/functional/omit.cjs.map +0 -1
- package/dist/development/src/functional/omit.js +0 -15
- package/dist/development/src/functional/omit.js.map +0 -1
- package/dist/development/src/functional/pick.cjs +0 -15
- package/dist/development/src/functional/pick.cjs.map +0 -1
- package/dist/development/src/functional/pick.js +0 -15
- package/dist/development/src/functional/pick.js.map +0 -1
- package/dist/development/src/functional/range.cjs +0 -7
- package/dist/development/src/functional/range.cjs.map +0 -1
- package/dist/development/src/functional/range.js +0 -7
- package/dist/development/src/functional/range.js.map +0 -1
- package/dist/development/src/string-utilities/kebabCase.cjs +0 -8
- package/dist/development/src/string-utilities/kebabCase.cjs.map +0 -1
- package/dist/development/src/string-utilities/kebabCase.js +0 -8
- package/dist/development/src/string-utilities/kebabCase.js.map +0 -1
- package/dist/production/src/assert-types/AssertionError.cjs +0 -9
- package/dist/production/src/assert-types/AssertionError.cjs.map +0 -1
- package/dist/production/src/assert-types/AssertionError.js +0 -9
- package/dist/production/src/assert-types/AssertionError.js.map +0 -1
- package/dist/production/src/assert-types/Predicates.cjs +0 -7
- package/dist/production/src/assert-types/Predicates.cjs.map +0 -1
- package/dist/production/src/assert-types/Predicates.js +0 -7
- package/dist/production/src/assert-types/Predicates.js.map +0 -1
- package/dist/production/src/assert-types/assert.cjs +0 -10
- package/dist/production/src/assert-types/assert.cjs.map +0 -1
- package/dist/production/src/assert-types/assert.js +0 -10
- package/dist/production/src/assert-types/assert.js.map +0 -1
- package/dist/production/src/css-utilities/px.cjs +0 -7
- package/dist/production/src/css-utilities/px.cjs.map +0 -1
- package/dist/production/src/css-utilities/px.js +0 -7
- package/dist/production/src/css-utilities/px.js.map +0 -1
- package/dist/production/src/data-utilities/dateToStringWithoutTimezone.cjs +0 -20
- package/dist/production/src/data-utilities/dateToStringWithoutTimezone.cjs.map +0 -1
- package/dist/production/src/data-utilities/dateToStringWithoutTimezone.js +0 -20
- package/dist/production/src/data-utilities/dateToStringWithoutTimezone.js.map +0 -1
- package/dist/production/src/dom/getElementDimensions.cjs +0 -22
- package/dist/production/src/dom/getElementDimensions.cjs.map +0 -1
- package/dist/production/src/dom/getElementDimensions.js +0 -22
- package/dist/production/src/dom/getElementDimensions.js.map +0 -1
- package/dist/production/src/dom/getSizeFromResizeObserverEntry.cjs +0 -24
- package/dist/production/src/dom/getSizeFromResizeObserverEntry.cjs.map +0 -1
- package/dist/production/src/dom/getSizeFromResizeObserverEntry.js +0 -24
- package/dist/production/src/dom/getSizeFromResizeObserverEntry.js.map +0 -1
- package/dist/production/src/dom/shouldCancelStart.cjs +0 -29
- package/dist/production/src/dom/shouldCancelStart.cjs.map +0 -1
- package/dist/production/src/dom/shouldCancelStart.js +0 -29
- package/dist/production/src/dom/shouldCancelStart.js.map +0 -1
- package/dist/production/src/dom/stateDataAttributes.cjs +0 -11
- package/dist/production/src/dom/stateDataAttributes.cjs.map +0 -1
- package/dist/production/src/dom/stateDataAttributes.js +0 -11
- package/dist/production/src/dom/stateDataAttributes.js.map +0 -1
- package/dist/production/src/events/isSpecialLinkClick.cjs +0 -5
- package/dist/production/src/events/isSpecialLinkClick.cjs.map +0 -1
- package/dist/production/src/events/isSpecialLinkClick.js +0 -5
- package/dist/production/src/events/isSpecialLinkClick.js.map +0 -1
- package/dist/production/src/functional/omit.cjs +0 -15
- package/dist/production/src/functional/omit.cjs.map +0 -1
- package/dist/production/src/functional/omit.js +0 -15
- package/dist/production/src/functional/omit.js.map +0 -1
- package/dist/production/src/functional/pick.cjs +0 -15
- package/dist/production/src/functional/pick.cjs.map +0 -1
- package/dist/production/src/functional/pick.js +0 -15
- package/dist/production/src/functional/pick.js.map +0 -1
- package/dist/production/src/functional/range.cjs +0 -7
- package/dist/production/src/functional/range.cjs.map +0 -1
- package/dist/production/src/functional/range.js +0 -7
- package/dist/production/src/functional/range.js.map +0 -1
- package/dist/production/src/string-utilities/kebabCase.cjs +0 -8
- package/dist/production/src/string-utilities/kebabCase.cjs.map +0 -1
- package/dist/production/src/string-utilities/kebabCase.js +0 -8
- package/dist/production/src/string-utilities/kebabCase.js.map +0 -1
- package/dist/types/assert-types/AssertionError.d.ts +0 -4
- package/dist/types/assert-types/AssertionError.d.ts.map +0 -1
- package/dist/types/assert-types/Predicates.d.ts +0 -2
- package/dist/types/assert-types/Predicates.d.ts.map +0 -1
- package/dist/types/assert-types/assert.d.ts +0 -3
- package/dist/types/assert-types/assert.d.ts.map +0 -1
- package/dist/types/assert-types/types.d.ts +0 -2
- package/dist/types/assert-types/types.d.ts.map +0 -1
- package/dist/types/css-utilities/index.d.ts +0 -2
- package/dist/types/css-utilities/index.d.ts.map +0 -1
- package/dist/types/css-utilities/px.d.ts +0 -8
- package/dist/types/css-utilities/px.d.ts.map +0 -1
- package/dist/types/data-utilities/dateToStringWithoutTimezone.d.ts +0 -4
- package/dist/types/data-utilities/dateToStringWithoutTimezone.d.ts.map +0 -1
- package/dist/types/data-utilities/index.d.ts +0 -2
- package/dist/types/data-utilities/index.d.ts.map +0 -1
- package/dist/types/dom/getElementDimensions.d.ts +0 -14
- package/dist/types/dom/getElementDimensions.d.ts.map +0 -1
- package/dist/types/dom/getSizeFromResizeObserverEntry.d.ts +0 -5
- package/dist/types/dom/getSizeFromResizeObserverEntry.d.ts.map +0 -1
- package/dist/types/dom/shouldCancelStart.d.ts +0 -4
- package/dist/types/dom/shouldCancelStart.d.ts.map +0 -1
- package/dist/types/dom/stateDataAttributes.d.ts +0 -4
- package/dist/types/dom/stateDataAttributes.d.ts.map +0 -1
- package/dist/types/events/index.d.ts +0 -2
- package/dist/types/events/index.d.ts.map +0 -1
- package/dist/types/events/isSpecialLinkClick.d.ts +0 -2
- package/dist/types/events/isSpecialLinkClick.d.ts.map +0 -1
- package/dist/types/functional/index.d.ts +0 -4
- package/dist/types/functional/index.d.ts.map +0 -1
- package/dist/types/functional/omit.d.ts +0 -2
- package/dist/types/functional/omit.d.ts.map +0 -1
- package/dist/types/functional/pick.d.ts +0 -2
- package/dist/types/functional/pick.d.ts.map +0 -1
- package/dist/types/functional/range.d.ts +0 -9
- package/dist/types/functional/range.d.ts.map +0 -1
- package/dist/types/string-utilities/index.d.ts +0 -2
- package/dist/types/string-utilities/index.d.ts.map +0 -1
- package/dist/types/string-utilities/kebabCase.d.ts +0 -2
- package/dist/types/string-utilities/kebabCase.d.ts.map +0 -1
- package/dist/types/types/PolymorphicRefs.d.ts +0 -47
- package/dist/types/types/PolymorphicRefs.d.ts.map +0 -1
- package/src/assert-types/AssertionError.ts +0 -5
- package/src/assert-types/Predicates.ts +0 -3
- package/src/assert-types/assert.ts +0 -15
- package/src/assert-types/types.ts +0 -1
- package/src/css-utilities/index.ts +0 -1
- package/src/css-utilities/px.ts +0 -9
- package/src/data-utilities/dateToStringWithoutTimezone.ts +0 -18
- package/src/data-utilities/index.ts +0 -1
- package/src/dom/getElementDimensions.ts +0 -36
- package/src/dom/getSizeFromResizeObserverEntry.ts +0 -26
- package/src/dom/shouldCancelStart.ts +0 -32
- package/src/dom/stateDataAttributes.ts +0 -8
- package/src/events/index.ts +0 -1
- package/src/events/isSpecialLinkClick.ts +0 -1
- package/src/functional/index.ts +0 -3
- package/src/functional/omit.ts +0 -13
- package/src/functional/pick.ts +0 -13
- package/src/functional/range.ts +0 -11
- package/src/string-utilities/index.ts +0 -1
- package/src/string-utilities/kebabCase.ts +0 -5
- package/src/types/PolymorphicRefs.ts +0 -70
- package/tests/css-utilities/px.test.ts +0 -12
- package/tests/deprecate/deprecate.test.ts +0 -53
- package/tests/functional/omit.test.ts +0 -20
- package/tests/functional/pick.test.ts +0 -12
- package/tests/functional/range.test.ts +0 -12
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const AssertionError = require("./src/assert-types/AssertionError.cjs");
|
|
4
|
-
const Predicates = require("./src/assert-types/Predicates.cjs");
|
|
5
|
-
const assert = require("./src/assert-types/assert.cjs");
|
|
6
3
|
const assertNever = require("./src/assert-types/assertNever.cjs");
|
|
7
|
-
const px = require("./src/css-utilities/px.cjs");
|
|
8
|
-
const dateToStringWithoutTimezone = require("./src/data-utilities/dateToStringWithoutTimezone.cjs");
|
|
9
4
|
const deprecate = require("./src/deprecate/deprecate.cjs");
|
|
10
5
|
const dataAttribute = require("./src/dom/dataAttribute.cjs");
|
|
11
|
-
const getElementDimensions = require("./src/dom/getElementDimensions.cjs");
|
|
12
|
-
const getSizeFromResizeObserverEntry = require("./src/dom/getSizeFromResizeObserverEntry.cjs");
|
|
13
|
-
const shouldCancelStart = require("./src/dom/shouldCancelStart.cjs");
|
|
14
|
-
const stateDataAttributes = require("./src/dom/stateDataAttributes.cjs");
|
|
15
6
|
const svgSizeProps = require("./src/dom/svgSizeProps.cjs");
|
|
16
|
-
const isSpecialLinkClick = require("./src/events/isSpecialLinkClick.cjs");
|
|
17
|
-
const omit = require("./src/functional/omit.cjs");
|
|
18
|
-
const pick = require("./src/functional/pick.cjs");
|
|
19
|
-
const range = require("./src/functional/range.cjs");
|
|
20
|
-
const kebabCase = require("./src/string-utilities/kebabCase.cjs");
|
|
21
7
|
const BijectiveIndexedMap = require("./src/structures/BijectiveIndexedMap.cjs");
|
|
22
8
|
const LRUCache = require("./src/structures/LRUCache.cjs");
|
|
23
9
|
const WeakIdCache = require("./src/structures/WeakIdCache.cjs");
|
|
24
|
-
exports.AssertionError = AssertionError.AssertionError;
|
|
25
|
-
exports.isNonNegativeNumber = Predicates.isNonNegativeNumber;
|
|
26
|
-
exports.assert = assert.assert;
|
|
27
10
|
exports.assertNever = assertNever.assertNever;
|
|
28
|
-
exports.px = px.px;
|
|
29
|
-
exports.dateToStringWithoutTimezone = dateToStringWithoutTimezone.dateToStringWithoutTimezone;
|
|
30
11
|
exports.deprecate = deprecate.deprecate;
|
|
31
12
|
exports.dataAttribute = dataAttribute.dataAttribute;
|
|
32
|
-
exports.getElementDimensions = getElementDimensions.getElementDimensions;
|
|
33
|
-
exports.getElementDimensionsCallback = getElementDimensions.getElementDimensionsCallback;
|
|
34
|
-
exports.getSizeFromResizeObserverEntryFactory = getSizeFromResizeObserverEntry.getSizeFromResizeObserverEntryFactory;
|
|
35
|
-
exports.shouldCancelStart = shouldCancelStart.shouldCancelStart;
|
|
36
|
-
exports.stateDataAttributes = stateDataAttributes.stateDataAttributes;
|
|
37
13
|
exports.svgSizeProps = svgSizeProps.svgSizeProps;
|
|
38
|
-
exports.isSpecialLinkClick = isSpecialLinkClick.isSpecialLinkClick;
|
|
39
|
-
exports.omit = omit.omit;
|
|
40
|
-
exports.pick = pick.pick;
|
|
41
|
-
exports.range = range.range;
|
|
42
|
-
exports.toKebabCase = kebabCase.toKebabCase;
|
|
43
14
|
exports.BijectiveIndexedMap = BijectiveIndexedMap.BijectiveIndexedMap;
|
|
44
15
|
exports.LRUCache = LRUCache.LRUCache;
|
|
45
16
|
exports.WeakIdCache = WeakIdCache.WeakIdCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1,46 +1,17 @@
|
|
|
1
|
-
import { AssertionError } from "./src/assert-types/AssertionError.js";
|
|
2
|
-
import { isNonNegativeNumber } from "./src/assert-types/Predicates.js";
|
|
3
|
-
import { assert } from "./src/assert-types/assert.js";
|
|
4
1
|
import { assertNever } from "./src/assert-types/assertNever.js";
|
|
5
|
-
import { px } from "./src/css-utilities/px.js";
|
|
6
|
-
import { dateToStringWithoutTimezone } from "./src/data-utilities/dateToStringWithoutTimezone.js";
|
|
7
2
|
import { deprecate } from "./src/deprecate/deprecate.js";
|
|
8
3
|
import { dataAttribute } from "./src/dom/dataAttribute.js";
|
|
9
|
-
import { getElementDimensions, getElementDimensionsCallback } from "./src/dom/getElementDimensions.js";
|
|
10
|
-
import { getSizeFromResizeObserverEntryFactory } from "./src/dom/getSizeFromResizeObserverEntry.js";
|
|
11
|
-
import { shouldCancelStart } from "./src/dom/shouldCancelStart.js";
|
|
12
|
-
import { stateDataAttributes } from "./src/dom/stateDataAttributes.js";
|
|
13
4
|
import { svgSizeProps } from "./src/dom/svgSizeProps.js";
|
|
14
|
-
import { isSpecialLinkClick } from "./src/events/isSpecialLinkClick.js";
|
|
15
|
-
import { omit } from "./src/functional/omit.js";
|
|
16
|
-
import { pick } from "./src/functional/pick.js";
|
|
17
|
-
import { range } from "./src/functional/range.js";
|
|
18
|
-
import { toKebabCase } from "./src/string-utilities/kebabCase.js";
|
|
19
5
|
import { BijectiveIndexedMap } from "./src/structures/BijectiveIndexedMap.js";
|
|
20
6
|
import { LRUCache } from "./src/structures/LRUCache.js";
|
|
21
7
|
import { WeakIdCache } from "./src/structures/WeakIdCache.js";
|
|
22
8
|
export {
|
|
23
|
-
AssertionError,
|
|
24
9
|
BijectiveIndexedMap,
|
|
25
10
|
LRUCache,
|
|
26
11
|
WeakIdCache,
|
|
27
|
-
assert,
|
|
28
12
|
assertNever,
|
|
29
13
|
dataAttribute,
|
|
30
|
-
dateToStringWithoutTimezone,
|
|
31
14
|
deprecate,
|
|
32
|
-
|
|
33
|
-
getElementDimensionsCallback,
|
|
34
|
-
getSizeFromResizeObserverEntryFactory,
|
|
35
|
-
isNonNegativeNumber,
|
|
36
|
-
isSpecialLinkClick,
|
|
37
|
-
omit,
|
|
38
|
-
pick,
|
|
39
|
-
px,
|
|
40
|
-
range,
|
|
41
|
-
shouldCancelStart,
|
|
42
|
-
stateDataAttributes,
|
|
43
|
-
svgSizeProps,
|
|
44
|
-
toKebabCase
|
|
15
|
+
svgSizeProps
|
|
45
16
|
};
|
|
46
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator]():
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): MapIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): MapIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): MapIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): MapIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAA;AAOO,MAAM,oBAA+C;AAAA,EAWpD,YAAY,cAA6D;AAV/D,kBAAA,MAAA,YAAA;AACA,kBAAA,MAAA,OAAA;AACT,kBAAA,MAAA,WAAA;AAES,kBAAA,MAAA,SAAA;AAEjB,kBAAA,MAAiB,IAAsB,qBAAA;AAKtC,QAAI,wBAAwB,qBAAqB;AAChD,WAAK,aAAa,IAAI,IAAI,aAAa,UAAU;AACjD,WAAK,QAAQ,IAAI,IAAI,aAAa,KAAK;AACvC,WAAK,YAAY,aAAa;AAC9B,WAAK,UAAU,aAAa;AAAA,IAAA,OACtB;AACD,WAAA,iCAAiB;AACjB,WAAA,4BAAY;AACjB,WAAK,YAAY;AACjB,WAAK,UAAU;AAAA,IAChB;AAAA,EACD;AAAA,EAEQ,cAAc;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,IAAW,OAAe;AACzB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,EAEO,QAAc;AACpB,SAAK,WAAW;AAChB,SAAK,MAAM;EACZ;AAAA,EACO,OAAO,KAAiB;AAC9B,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACK,SAAA,WAAW,OAAO,KAAK;AACvB,SAAA,MAAM,OAAO,GAAG;AACd,WAAA;AAAA,EACR;AA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AkGf,OAAO,aAAiC;AAChD,WAAO,KAAK;EACb;AAAA,EAEA,CAAQ,UAA+B;AAC3B,eAAA,SAAS,KAAK,UAAU;AAClC,YAAM,CAAC,KAAK,QAAQ,KAAK,GAAG,KAAK;AAAA,IAClC;AAAA,EACD;AAAA,EAEA,CAAQ,OAAuB;AACnB,eAAA,SAAS,KAAK,UAAU;AAC5B,YAAA,KAAK,QAAQ,KAAK;AAAA,IACzB;AAAA,EACD;AAAA,EAEA,CAAQ,SAAyB;AAChC,eAAW,SAAS,KAAK,WAAW,OAAA,GAAU;AAC7C,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BijectiveIndexedMap.js","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator]():
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.js","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): MapIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): MapIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): MapIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): MapIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;AAAA,IAAA;AAOO,MAAM,oBAA+C;AAAA,EAWpD,YAAY,cAA6D;AAV/D,kBAAA,MAAA,YAAA;AACA,kBAAA,MAAA,OAAA;AACT,kBAAA,MAAA,WAAA;AAES,kBAAA,MAAA,SAAA;AAEjB,kBAAA,MAAiB,IAAsB,qBAAA;AAKtC,QAAI,wBAAwB,qBAAqB;AAChD,WAAK,aAAa,IAAI,IAAI,aAAa,UAAU;AACjD,WAAK,QAAQ,IAAI,IAAI,aAAa,KAAK;AACvC,WAAK,YAAY,aAAa;AAC9B,WAAK,UAAU,aAAa;AAAA,IAAA,OACtB;AACD,WAAA,iCAAiB;AACjB,WAAA,4BAAY;AACjB,WAAK,YAAY;AACjB,WAAK,UAAU;AAAA,IAChB;AAAA,EACD;AAAA,EAEQ,cAAc;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,IAAW,OAAe;AACzB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,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AAK,MAAM,IAAI,GAAG;AACnC,UAAI,aAAa,QAAW;AAC3B,cAAM,IAAI,MAAM;AAAA,MACjB;AACA,YAAM,QAAQ,KAAK,WAAW,IAAI,QAAQ;AAKrC,WAAA,WAAW,OAAO,QAAQ;AAC1B,WAAA,WAAW,IAAI,UAAU,KAAK;AAAA,IACpC;AAAA,EACD;AAAA,EAEA,GAlGiB,KAAA,OAAO,aAkGf,OAAO,aAAiC;AAChD,WAAO,KAAK;EACb;AAAA,EAEA,CAAQ,UAA+B;AAC3B,eAAA,SAAS,KAAK,UAAU;AAClC,YAAM,CAAC,KAAK,QAAQ,KAAK,GAAG,KAAK;AAAA,IAClC;AAAA,EACD;AAAA,EAEA,CAAQ,OAAuB;AACnB,eAAA,SAAS,KAAK,UAAU;AAC5B,YAAA,KAAK,QAAQ,KAAK;AAAA,IACzB;AAAA,EACD;AAAA,EAEA,CAAQ,SAAyB;AAChC,eAAW,SAAS,KAAK,WAAW,OAAA,GAAU;AAC7C,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LRUCache.cjs","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value
|
|
1
|
+
{"version":3,"file":"LRUCache.cjs","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value!\n\t}\n}\n"],"names":[],"mappings":";;;;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LRUCache.js","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value
|
|
1
|
+
{"version":3,"file":"LRUCache.js","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value!\n\t}\n}\n"],"names":[],"mappings":";;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;"}
|
|
@@ -1,45 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const AssertionError = require("./src/assert-types/AssertionError.cjs");
|
|
4
|
-
const Predicates = require("./src/assert-types/Predicates.cjs");
|
|
5
|
-
const assert = require("./src/assert-types/assert.cjs");
|
|
6
3
|
const assertNever = require("./src/assert-types/assertNever.cjs");
|
|
7
|
-
const px = require("./src/css-utilities/px.cjs");
|
|
8
|
-
const dateToStringWithoutTimezone = require("./src/data-utilities/dateToStringWithoutTimezone.cjs");
|
|
9
4
|
const deprecate = require("./src/deprecate/deprecate.cjs");
|
|
10
5
|
const dataAttribute = require("./src/dom/dataAttribute.cjs");
|
|
11
|
-
const getElementDimensions = require("./src/dom/getElementDimensions.cjs");
|
|
12
|
-
const getSizeFromResizeObserverEntry = require("./src/dom/getSizeFromResizeObserverEntry.cjs");
|
|
13
|
-
const shouldCancelStart = require("./src/dom/shouldCancelStart.cjs");
|
|
14
|
-
const stateDataAttributes = require("./src/dom/stateDataAttributes.cjs");
|
|
15
6
|
const svgSizeProps = require("./src/dom/svgSizeProps.cjs");
|
|
16
|
-
const isSpecialLinkClick = require("./src/events/isSpecialLinkClick.cjs");
|
|
17
|
-
const omit = require("./src/functional/omit.cjs");
|
|
18
|
-
const pick = require("./src/functional/pick.cjs");
|
|
19
|
-
const range = require("./src/functional/range.cjs");
|
|
20
|
-
const kebabCase = require("./src/string-utilities/kebabCase.cjs");
|
|
21
7
|
const BijectiveIndexedMap = require("./src/structures/BijectiveIndexedMap.cjs");
|
|
22
8
|
const LRUCache = require("./src/structures/LRUCache.cjs");
|
|
23
9
|
const WeakIdCache = require("./src/structures/WeakIdCache.cjs");
|
|
24
|
-
exports.AssertionError = AssertionError.AssertionError;
|
|
25
|
-
exports.isNonNegativeNumber = Predicates.isNonNegativeNumber;
|
|
26
|
-
exports.assert = assert.assert;
|
|
27
10
|
exports.assertNever = assertNever.assertNever;
|
|
28
|
-
exports.px = px.px;
|
|
29
|
-
exports.dateToStringWithoutTimezone = dateToStringWithoutTimezone.dateToStringWithoutTimezone;
|
|
30
11
|
exports.deprecate = deprecate.deprecate;
|
|
31
12
|
exports.dataAttribute = dataAttribute.dataAttribute;
|
|
32
|
-
exports.getElementDimensions = getElementDimensions.getElementDimensions;
|
|
33
|
-
exports.getElementDimensionsCallback = getElementDimensions.getElementDimensionsCallback;
|
|
34
|
-
exports.getSizeFromResizeObserverEntryFactory = getSizeFromResizeObserverEntry.getSizeFromResizeObserverEntryFactory;
|
|
35
|
-
exports.shouldCancelStart = shouldCancelStart.shouldCancelStart;
|
|
36
|
-
exports.stateDataAttributes = stateDataAttributes.stateDataAttributes;
|
|
37
13
|
exports.svgSizeProps = svgSizeProps.svgSizeProps;
|
|
38
|
-
exports.isSpecialLinkClick = isSpecialLinkClick.isSpecialLinkClick;
|
|
39
|
-
exports.omit = omit.omit;
|
|
40
|
-
exports.pick = pick.pick;
|
|
41
|
-
exports.range = range.range;
|
|
42
|
-
exports.toKebabCase = kebabCase.toKebabCase;
|
|
43
14
|
exports.BijectiveIndexedMap = BijectiveIndexedMap.BijectiveIndexedMap;
|
|
44
15
|
exports.LRUCache = LRUCache.LRUCache;
|
|
45
16
|
exports.WeakIdCache = WeakIdCache.WeakIdCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -1,46 +1,17 @@
|
|
|
1
|
-
import { AssertionError } from "./src/assert-types/AssertionError.js";
|
|
2
|
-
import { isNonNegativeNumber } from "./src/assert-types/Predicates.js";
|
|
3
|
-
import { assert } from "./src/assert-types/assert.js";
|
|
4
1
|
import { assertNever } from "./src/assert-types/assertNever.js";
|
|
5
|
-
import { px } from "./src/css-utilities/px.js";
|
|
6
|
-
import { dateToStringWithoutTimezone } from "./src/data-utilities/dateToStringWithoutTimezone.js";
|
|
7
2
|
import { deprecate } from "./src/deprecate/deprecate.js";
|
|
8
3
|
import { dataAttribute } from "./src/dom/dataAttribute.js";
|
|
9
|
-
import { getElementDimensions, getElementDimensionsCallback } from "./src/dom/getElementDimensions.js";
|
|
10
|
-
import { getSizeFromResizeObserverEntryFactory } from "./src/dom/getSizeFromResizeObserverEntry.js";
|
|
11
|
-
import { shouldCancelStart } from "./src/dom/shouldCancelStart.js";
|
|
12
|
-
import { stateDataAttributes } from "./src/dom/stateDataAttributes.js";
|
|
13
4
|
import { svgSizeProps } from "./src/dom/svgSizeProps.js";
|
|
14
|
-
import { isSpecialLinkClick } from "./src/events/isSpecialLinkClick.js";
|
|
15
|
-
import { omit } from "./src/functional/omit.js";
|
|
16
|
-
import { pick } from "./src/functional/pick.js";
|
|
17
|
-
import { range } from "./src/functional/range.js";
|
|
18
|
-
import { toKebabCase } from "./src/string-utilities/kebabCase.js";
|
|
19
5
|
import { BijectiveIndexedMap } from "./src/structures/BijectiveIndexedMap.js";
|
|
20
6
|
import { LRUCache } from "./src/structures/LRUCache.js";
|
|
21
7
|
import { WeakIdCache } from "./src/structures/WeakIdCache.js";
|
|
22
8
|
export {
|
|
23
|
-
AssertionError,
|
|
24
9
|
BijectiveIndexedMap,
|
|
25
10
|
LRUCache,
|
|
26
11
|
WeakIdCache,
|
|
27
|
-
assert,
|
|
28
12
|
assertNever,
|
|
29
13
|
dataAttribute,
|
|
30
|
-
dateToStringWithoutTimezone,
|
|
31
14
|
deprecate,
|
|
32
|
-
|
|
33
|
-
getElementDimensionsCallback,
|
|
34
|
-
getSizeFromResizeObserverEntryFactory,
|
|
35
|
-
isNonNegativeNumber,
|
|
36
|
-
isSpecialLinkClick,
|
|
37
|
-
omit,
|
|
38
|
-
pick,
|
|
39
|
-
px,
|
|
40
|
-
range,
|
|
41
|
-
shouldCancelStart,
|
|
42
|
-
stateDataAttributes,
|
|
43
|
-
svgSizeProps,
|
|
44
|
-
toKebabCase
|
|
15
|
+
svgSizeProps
|
|
45
16
|
};
|
|
46
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator]():
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.cjs","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): MapIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): MapIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): MapIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): MapIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;AAAA,IAAA;AAOO,MAAM,oBA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AAA,EACD;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BijectiveIndexedMap.js","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator]():
|
|
1
|
+
{"version":3,"file":"BijectiveIndexedMap.js","sources":["../../../../../packages/utilities/src/structures/BijectiveIndexedMap.ts"],"sourcesContent":["// Bijective as in we need to supply the inverse and also guarantee that the values are unique.\n// Provided this invariant, this should behave more or less like a regular map except it has a somewhat special\n// iteration order. Unlike a regular map, which just honors insertion order, this also provides a special method\n// changeKey. With this, we can change the key under which a value (that is already on the map) is accessible.\n// With an ordinary map, that operation would require us to delete the original [K1, V] pair and insert\n// a new one [K2, V]. That would however change the order of iteration. This main purpose of this data structure is\n// the ability to avoid that and enable the value V to preserve its original place.\nexport class BijectiveIndexedMap<K, V> implements Map<K, V> {\n\tprivate readonly valueStore: Map<number, V>\n\tprivate readonly index: Map<K, number>\n\tprivate indexSeed: number\n\n\tprivate readonly inverse: (value: V) => K\n\n\tpublic readonly [Symbol.toStringTag] = 'BijectiveIndexedMap'\n\n\tpublic constructor(originalMap: BijectiveIndexedMap<K, V>)\n\tpublic constructor(inverse: (value: V) => K)\n\tpublic constructor(inverseOrMap: BijectiveIndexedMap<K, V> | ((value: V) => K)) {\n\t\tif (inverseOrMap instanceof BijectiveIndexedMap) {\n\t\t\tthis.valueStore = new Map(inverseOrMap.valueStore)\n\t\t\tthis.index = new Map(inverseOrMap.index)\n\t\t\tthis.indexSeed = inverseOrMap.indexSeed\n\t\t\tthis.inverse = inverseOrMap.inverse\n\t\t} else {\n\t\t\tthis.valueStore = new Map()\n\t\t\tthis.index = new Map()\n\t\t\tthis.indexSeed = 0\n\t\t\tthis.inverse = inverseOrMap\n\t\t}\n\t}\n\n\tprivate getNewIndex() {\n\t\treturn this.indexSeed++\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.valueStore.size\n\t}\n\n\tpublic clear(): void {\n\t\tthis.valueStore.clear()\n\t\tthis.index.clear()\n\t}\n\tpublic delete(key: K): boolean {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn false\n\t\t}\n\t\tthis.valueStore.delete(index)\n\t\tthis.index.delete(key)\n\t\treturn true\n\t}\n\tpublic forEach(callback: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tcallback.call(thisArg, value, key, this)\n\t\t}\n\t}\n\n\tpublic get(key: K): V | undefined {\n\t\tconst index = this.index.get(key)\n\n\t\tif (index === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn this.valueStore.get(index)\n\t}\n\tpublic has(key: K): boolean {\n\t\treturn this.index.has(key)\n\t}\n\tpublic set(key: K, value: V): this {\n\t\tconst existingIndex = this.index.get(key)\n\n\t\tif (existingIndex === undefined) {\n\t\t\tconst newIndex = this.getNewIndex()\n\t\t\tthis.index.set(key, newIndex)\n\t\t\tthis.valueStore.set(newIndex, value)\n\t\t} else {\n\t\t\tthis.valueStore.set(existingIndex, value)\n\t\t}\n\t\treturn this\n\t}\n\n\t// This doesn't use the inverse in order to avoid confusion.\n\t// See the description above.\n\tpublic changeKey(oldKey: K, newKey: K): this {\n\t\tconst index = this.index.get(oldKey)\n\t\tif (index === undefined) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tthis.index.delete(oldKey)\n\t\tthis.index.set(newKey, index)\n\t\treturn this\n\t}\n\n\tpublic changeKeyOrder(newOrder: Iterable<K>) {\n\t\tfor (const key of newOrder) {\n\t\t\tconst keyIndex = this.index.get(key)\n\t\t\tif (keyIndex === undefined) {\n\t\t\t\tthrow new Error()\n\t\t\t}\n\t\t\tconst value = this.valueStore.get(keyIndex)!\n\n\t\t\t// This effectively removes value from wherever it was and puts it at the end.\n\t\t\t// Provided newOrder.size is the same as valueStore, by the end of this loop\n\t\t\t// the values will be in the correct order.\n\t\t\tthis.valueStore.delete(keyIndex)\n\t\t\tthis.valueStore.set(keyIndex, value)\n\t\t}\n\t}\n\n\tpublic *[Symbol.iterator](): MapIterator<[K, V]> {\n\t\tyield* this.entries()\n\t}\n\n\tpublic *entries(): MapIterator<[K, V]> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield [this.inverse(value), value]\n\t\t}\n\t}\n\n\tpublic *keys(): MapIterator<K> {\n\t\tfor (const value of this.values()) {\n\t\t\tyield this.inverse(value)\n\t\t}\n\t}\n\n\tpublic *values(): MapIterator<V> {\n\t\tfor (const value of this.valueStore.values()) {\n\t\t\tif (value === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tyield value\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;AAAA,IAAA;AAOO,MAAM,oBAA+C;AAAA,EAWpD,YAAY,cAA6D;AAV/D,kBAAA,MAAA,YAAA;AACA,kBAAA,MAAA,OAAA;AACT,kBAAA,MAAA,WAAA;AAES,kBAAA,MAAA,SAAA;AAEjB,kBAAA,MAAiB,IAAsB,qBAAA;AAKtC,QAAI,wBAAwB,qBAAqB;AAChD,WAAK,aAAa,IAAI,IAAI,aAAa,UAAU;AACjD,WAAK,QAAQ,IAAI,IAAI,aAAa,KAAK;AACvC,WAAK,YAAY,aAAa;AAC9B,WAAK,UAAU,aAAa;AAAA,IAAA,OACtB;AACD,WAAA,iCAAiB;AACjB,WAAA,4BAAY;AACjB,WAAK,YAAY;AACjB,WAAK,UAAU;AAAA,IAChB;AAAA,EACD;AAAA,EAEQ,cAAc;AACrB,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,IAAW,OAAe;AACzB,WAAO,KAAK,WAAW;AAAA,EACxB;AAAA,EAEO,QAAc;AACpB,SAAK,WAAW;AAChB,SAAK,MAAM;EACZ;AAAA,EACO,OAAO,KAAiB;AAC9B,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACK,SAAA,WAAW,OAAO,KAAK;AACvB,SAAA,MAAM,OAAO,GAAG;AACd,WAAA;AAAA,EACR;AAAA,EACO,QAAQ,UAAsD,SAAqB;AACzF,eAAW,CAAC,KAAK,KAAK,KAAK,KAAK,WAAW;AAC1C,eAAS,KAAK,SAAS,OAAO,KAAK,IAAI;AAAA,IACxC;AAAA,EACD;AAAA,EAEO,IAAI,K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AA,EACD;AAAA,EAEA,CAAQ,OAAuB;AACnB,eAAA,SAAS,KAAK,UAAU;AAC5B,YAAA,KAAK,QAAQ,KAAK;AAAA,IACzB;AAAA,EACD;AAAA,EAEA,CAAQ,SAAyB;AAChC,eAAW,SAAS,KAAK,WAAW,OAAA,GAAU;AAC7C,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LRUCache.cjs","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value
|
|
1
|
+
{"version":3,"file":"LRUCache.cjs","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value!\n\t}\n}\n"],"names":[],"mappings":";;;;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LRUCache.js","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value
|
|
1
|
+
{"version":3,"file":"LRUCache.js","sources":["../../../../../packages/utilities/src/structures/LRUCache.ts"],"sourcesContent":["// This is heavily inspired by https://stackoverflow.com/a/46432113\nexport class LRUCache<Key, Value> {\n\tprivate readonly cache = new Map<Key, Value>()\n\n\tpublic constructor(private readonly maxSize: number) {}\n\n\tpublic get(key: Key): Value | undefined {\n\t\tconst value = this.cache.get(key)\n\n\t\tif (value !== undefined) {\n\t\t\tthis.cache.delete(key)\n\t\t\tthis.cache.set(key, value)\n\t\t}\n\t\treturn value\n\t}\n\n\tpublic set(key: Key, value: Value) {\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.delete(key) // Refresh this key\n\t\t} else if (this.cache.size === this.maxSize) {\n\t\t\tthis.cache.delete(this.getOldestKey()) // Evict the oldest value\n\t\t}\n\t\tthis.cache.set(key, value)\n\t}\n\n\tprivate getOldestKey(): Key {\n\t\treturn this.cache.keys().next().value!\n\t}\n}\n"],"names":[],"mappings":";;;AACO,MAAM,SAAqB;AAAA,EAG1B,YAA6B,SAAiB;AAAjB,SAAA,UAAA;AAFnB,kBAAA,MAAA,6BAAY,IAAgB,CAAA;AAAA,EAES;AAAA,EAE/C,IAAI,KAA6B;AACvC,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAEhC,QAAI,UAAU,QAAW;AACnB,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,MAAM,IAAI,KAAK,KAAK;AAAA,IAC1B;AACO,WAAA;AAAA,EACR;AAAA,EAEO,IAAI,KAAU,OAAc;AAClC,QAAI,KAAK,MAAM,IAAI,GAAG,GAAG;AACnB,WAAA,MAAM,OAAO,GAAG;AAAA,IACX,WAAA,KAAK,MAAM,SAAS,KAAK,SAAS;AAC5C,WAAK,MAAM,OAAO,KAAK,aAAc,CAAA;AAAA,IACtC;AACK,SAAA,MAAM,IAAI,KAAK,KAAK;AAAA,EAC1B;AAAA,EAEQ,eAAoB;AAC3B,WAAO,KAAK,MAAM,KAAK,EAAE,OAAO;AAAA,EACjC;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assert-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assert-types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
export * from './dataAttribute';
|
|
2
|
-
export * from './getElementDimensions';
|
|
3
|
-
export * from './getSizeFromResizeObserverEntry';
|
|
4
|
-
export * from './shouldCancelStart';
|
|
5
|
-
export * from './stateDataAttributes';
|
|
6
2
|
export * from './svgSizeProps';
|
|
7
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dom/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dom/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export * from './assert-types';
|
|
2
|
-
export * from './css-utilities';
|
|
3
|
-
export * from './data-utilities';
|
|
4
2
|
export * from './deprecate';
|
|
5
3
|
export * from './dom';
|
|
6
|
-
export * from './events';
|
|
7
|
-
export * from './functional';
|
|
8
|
-
export * from './string-utilities';
|
|
9
|
-
export * from './types';
|
|
10
4
|
export * from './structures';
|
|
11
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA"}
|
|
@@ -16,9 +16,9 @@ export declare class BijectiveIndexedMap<K, V> implements Map<K, V> {
|
|
|
16
16
|
set(key: K, value: V): this;
|
|
17
17
|
changeKey(oldKey: K, newKey: K): this;
|
|
18
18
|
changeKeyOrder(newOrder: Iterable<K>): void;
|
|
19
|
-
[Symbol.iterator]():
|
|
20
|
-
entries():
|
|
21
|
-
keys():
|
|
22
|
-
values():
|
|
19
|
+
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
20
|
+
entries(): MapIterator<[K, V]>;
|
|
21
|
+
keys(): MapIterator<K>;
|
|
22
|
+
values(): MapIterator<V>;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=BijectiveIndexedMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BijectiveIndexedMap.d.ts","sourceRoot":"","sources":["../../../src/structures/BijectiveIndexedMap.ts"],"names":[],"mappings":"AAOA,qBAAa,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAE,YAAW,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,SAAS,CAAQ;IAEzB,OAAO,CAAC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