@ac-kit/math-grid 0.2.3 → 0.4.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/CHANGELOG.md +153 -0
- package/README.md +100 -3
- package/dist/_coverage-contour2.d.ts +48 -0
- package/dist/_coverage-contour2.d.ts.map +1 -0
- package/dist/_coverage-contour2.js +1670 -0
- package/dist/_coverage-contour2.js.map +1 -0
- package/dist/_nearest-site-propagation2.d.ts +80 -0
- package/dist/_nearest-site-propagation2.d.ts.map +1 -0
- package/dist/_nearest-site-propagation2.js +551 -0
- package/dist/_nearest-site-propagation2.js.map +1 -0
- package/dist/grid-coord2.d.ts +44 -2
- package/dist/grid-coord2.d.ts.map +1 -1
- package/dist/grid-coord2.js +51 -11
- package/dist/grid-coord2.js.map +1 -1
- package/dist/grid-pack-dfs.d.ts.map +1 -1
- package/dist/grid-pack-dfs.js +4 -2
- package/dist/grid-pack-dfs.js.map +1 -1
- package/dist/grid2-pixel.d.ts +32 -17
- package/dist/grid2-pixel.d.ts.map +1 -1
- package/dist/grid2-pixel.js +70 -54
- package/dist/grid2-pixel.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/infinite-grid2.js.map +1 -1
- package/dist/shelf-allocator.d.ts +67 -0
- package/dist/shelf-allocator.d.ts.map +1 -0
- package/dist/shelf-allocator.js +163 -0
- package/dist/shelf-allocator.js.map +1 -0
- package/dist/signed-distance-from-coverage2.d.ts +84 -0
- package/dist/signed-distance-from-coverage2.d.ts.map +1 -0
- package/dist/signed-distance-from-coverage2.js +285 -0
- package/dist/signed-distance-from-coverage2.js.map +1 -0
- package/dist/squared-distance-transform2.d.ts +25 -0
- package/dist/squared-distance-transform2.d.ts.map +1 -0
- package/dist/squared-distance-transform2.js +123 -0
- package/dist/squared-distance-transform2.js.map +1 -0
- package/package.json +8 -5
package/dist/grid-coord2.js
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
1
|
export function gridCoord2Add(a, b) {
|
|
2
2
|
return { row: a.row + b.row, col: a.col + b.col };
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The Euclidean distance `√(Δrow² + Δcol²)` between two coordinates: the
|
|
6
|
+
* straight-line distance between the cell centres.
|
|
7
|
+
*
|
|
8
|
+
* Time complexity: O(1). Coordinates are not validated, and `NaN` propagates.
|
|
9
|
+
* The squares overflow beyond about `1e154`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* gridCoord2Distance({ row: 0, col: 0 }, { row: 3, col: 4 }); // 5
|
|
13
|
+
*
|
|
14
|
+
* @param a - The first coordinate.
|
|
15
|
+
* @param b - The second coordinate.
|
|
16
|
+
* @returns The distance, `0` only for equal coordinates.
|
|
17
|
+
*/
|
|
18
|
+
export function gridCoord2Distance(a, b) {
|
|
19
|
+
const rowDelta = a.row - b.row;
|
|
20
|
+
const colDelta = a.col - b.col;
|
|
21
|
+
return Math.sqrt(rowDelta * rowDelta + colDelta * colDelta);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The Manhattan distance `|Δrow| + |Δcol|`: the number of moves between two
|
|
25
|
+
* coordinates when only the four edge-adjacent steps are allowed.
|
|
26
|
+
*
|
|
27
|
+
* Time complexity: O(1). Coordinates are not validated, and `NaN` propagates.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* gridCoord2DistanceManhattan({ row: 0, col: 0 }, { row: 3, col: 4 }); // 7
|
|
31
|
+
*
|
|
32
|
+
* @param a - The first coordinate.
|
|
33
|
+
* @param b - The second coordinate.
|
|
34
|
+
* @returns The distance.
|
|
35
|
+
*/
|
|
36
|
+
export function gridCoord2DistanceManhattan(a, b) {
|
|
37
|
+
return Math.abs(a.row - b.row) + Math.abs(a.col - b.col);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The Chebyshev distance `max(|Δrow|, |Δcol|)`: the number of moves between two
|
|
41
|
+
* coordinates when the eight neighbouring steps are allowed and a diagonal
|
|
42
|
+
* costs one.
|
|
43
|
+
*
|
|
44
|
+
* Time complexity: O(1). Coordinates are not validated, and `NaN` propagates.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* gridCoord2DistanceChebyshev({ row: 0, col: 0 }, { row: 3, col: 4 }); // 4
|
|
48
|
+
*
|
|
49
|
+
* @param a - The first coordinate.
|
|
50
|
+
* @param b - The second coordinate.
|
|
51
|
+
* @returns The distance.
|
|
52
|
+
*/
|
|
53
|
+
export function gridCoord2DistanceChebyshev(a, b) {
|
|
54
|
+
return Math.max(Math.abs(a.row - b.row), Math.abs(a.col - b.col));
|
|
15
55
|
}
|
|
16
56
|
export function gridCoord2Equals(a, b) {
|
|
17
57
|
return a.row === b.row && a.col === b.col;
|
package/dist/grid-coord2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-coord2.js","sourceRoot":"","sources":["../src/grid-coord2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grid-coord2.js","sourceRoot":"","sources":["../src/grid-coord2.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,aAAa,CAAC,CAAa,EAAE,CAAa;IACzD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAa,EAAE,CAAa;IAC9D,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;IAC/B,M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fsPackGrid2(items, columnCount, classify, options) {
|
|
|
34
34
|
const triedShapes = new Set();
|
|
35
35
|
const weighted = [];
|
|
36
36
|
for (let i = 0; i < items.length; i++) {
|
|
37
|
-
if (used[i])
|
|
37
|
+
if (used[i]) {
|
|
38
38
|
continue;
|
|
39
|
+
}
|
|
39
40
|
const it = items[i];
|
|
40
41
|
const key = shapeKey(it);
|
|
41
|
-
if (triedShapes.has(key))
|
|
42
|
+
if (triedShapes.has(key)) {
|
|
42
43
|
continue;
|
|
44
|
+
}
|
|
43
45
|
if (!grid.canPlaceRect({ start: coord, span: it.span })) {
|
|
44
46
|
continue;
|
|
45
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pack-dfs.js","sourceRoot":"","sources":["../src/grid-pack-dfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAI7D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAwD9C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAC3B,KAAU,EACV,WAAmB,EACnB,QAA+B,EAC/B,OAA4B;IAE5B,MAAM,EACL,QAAQ,GAAG,CAAC,EAAK,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EACvD,SAAS,GAAG,IAAK,GACjB,GAAG,OAAO,IAAI,EAAE,CAAC;IAElB,MAAM,IAAI,GAAG,IAAI,UAAU,CAAU,WAAW,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAiB,CAAC;IACvC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,WAAW,GAAG,C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,CAAC,CAAC;QACnE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,WAAW,EAAE,CAAC;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC1B,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,GAAY,EAAE,CAAC,WAAW,KAAK,KAAK,CAAC,MAAM,CAAC;IAE3D,MAAM,WAAW,GAAG,GAAY,EAAE;QACjC,IAAI,EAAE,KAAK,GAAG,SAAS,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC,CAAC;IAEF,6EAA6E;IAC7E,4EAA4E;IAC5E,0DAA0D;IAC1D,OAAO,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACnC,KAAK,GAAG,CAAC,CAAC;QACV,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,EAAE;YACnC,YAAY;YACZ,KAAK;YACL,IAAI;YACJ,MAAM;YACN,WAAW;SACX,CAAC,CAAC;QAEH,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;YACnC,MAAM;QACP,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,SAAS,CACb;YACC,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE;SACrD,EACD,IAAI,CACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/grid2-pixel.d.ts
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import { GridCoord2 } from "./grid-coord2.js";
|
|
4
|
-
import { GridRect2 } from "./grid-rect2.js";
|
|
5
|
-
import { GridSize2 } from "./grid-size2.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
export declare function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare function
|
|
1
|
+
import { type Box2, type ReadonlyBox2 } from "@ac-kit/math-geometry";
|
|
2
|
+
import type { ReadonlyVec2, Vec2 } from "@ac-kit/math-linear";
|
|
3
|
+
import type { GridCoord2 } from "./grid-coord2.js";
|
|
4
|
+
import type { GridRect2 } from "./grid-rect2.js";
|
|
5
|
+
import type { GridSize2 } from "./grid-size2.js";
|
|
6
|
+
/**
|
|
7
|
+
* Writes the position of the cell `coord`'s top-left corner, `[col·width,
|
|
8
|
+
* row·height]`, into `out`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function vec2FromGridCoord2(out: Vec2, coord: GridCoord2, cellSize?: ReadonlyVec2): Vec2;
|
|
11
|
+
/** Writes the extent of `size` cells, `[cols·width, rows·height]`, into `out`. */
|
|
12
|
+
export declare function vec2FromGridSize2(out: Vec2, size: GridSize2, cellSize?: ReadonlyVec2): Vec2;
|
|
13
|
+
/**
|
|
14
|
+
* Writes the box covered by `rect` (its start to its start plus its span) into
|
|
15
|
+
* `out`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function box2FromGridRect2(out: Box2, rect: GridRect2, cellSize?: ReadonlyVec2): Box2;
|
|
18
|
+
/**
|
|
19
|
+
* The cell coordinates, not rounded, of the point `point`: `{ col: x / width,
|
|
20
|
+
* row: y / height }`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function gridCoord2FromVec2(point: ReadonlyVec2, cellSize?: ReadonlyVec2): GridCoord2;
|
|
23
|
+
/**
|
|
24
|
+
* The size in cells, not rounded, of the extent `size`: `{ cols: width /
|
|
25
|
+
* cellWidth, rows: height / cellHeight }`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function gridSize2FromVec2(size: ReadonlyVec2, cellSize?: ReadonlyVec2): GridSize2;
|
|
28
|
+
/**
|
|
29
|
+
* The rectangle of cells, not rounded, covered by `box`: its minimum corner as
|
|
30
|
+
* the start, its extent as the span.
|
|
31
|
+
*/
|
|
32
|
+
export declare function gridRect2FromBox2(box: ReadonlyBox2, cellSize?: ReadonlyVec2): GridRect2;
|
|
18
33
|
//# sourceMappingURL=grid2-pixel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid2-pixel.d.ts","sourceRoot":"","sources":["../src/grid2-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"grid2-pixel.d.ts","sourceRoot":"","sources":["../src/grid2-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAW,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AASjD;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,YAAY,GACrB,IAAI,CASN;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,SAAS,EACf,QAAQ,CAAC,EAAE,YAAY,GACrB,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,SAAS,EACf,QAAQ,CAAC,EAAE,YAAY,GACrB,IAAI,CAYN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,YAAY,GACrB,UAAU,CAIZ;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,EAAE,YAAY,GACrB,SAAS,CAIX;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,YAAY,EACjB,QAAQ,CAAC,EAAE,YAAY,GACrB,SAAS,CAUX"}
|
package/dist/grid2-pixel.js
CHANGED
|
@@ -1,63 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// Convention: col = x, row = y, cols = width, rows =
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { box2Set } from "@ac-kit/math-geometry";
|
|
2
|
+
// The conversions between lattice records (integers, cells) and continuous
|
|
3
|
+
// space (`Vec2`, `Box2`). Convention: col = x, row = y, cols = width, rows =
|
|
4
|
+
// height. `cellSize` is the width and height of one cell in continuous units;
|
|
5
|
+
// omitted, the cells are one unit wide and high, so each conversion is an exact
|
|
6
|
+
// field remapping. Going from continuous space to the grid is exact too:
|
|
7
|
+
// fractional cells come back, round at the call site.
|
|
8
|
+
/**
|
|
9
|
+
* Writes the position of the cell `coord`'s top-left corner, `[col·width,
|
|
10
|
+
* row·height]`, into `out`.
|
|
11
|
+
*/
|
|
12
|
+
export function vec2FromGridCoord2(out, coord, cellSize) {
|
|
13
|
+
if (cellSize === undefined) {
|
|
14
|
+
out[0] = coord.col;
|
|
15
|
+
out[1] = coord.row;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
out[0] = coord.col * cellSize[0];
|
|
19
|
+
out[1] = coord.row * cellSize[1];
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
7
22
|
}
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
/** Writes the extent of `size` cells, `[cols·width, rows·height]`, into `out`. */
|
|
24
|
+
export function vec2FromGridSize2(out, size, cellSize) {
|
|
25
|
+
if (cellSize === undefined) {
|
|
26
|
+
out[0] = size.cols;
|
|
27
|
+
out[1] = size.rows;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
out[0] = size.cols * cellSize[0];
|
|
31
|
+
out[1] = size.rows * cellSize[1];
|
|
32
|
+
}
|
|
33
|
+
return out;
|
|
10
34
|
}
|
|
11
|
-
|
|
12
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Writes the box covered by `rect` (its start to its start plus its span) into
|
|
37
|
+
* `out`.
|
|
38
|
+
*/
|
|
39
|
+
export function box2FromGridRect2(out, rect, cellSize) {
|
|
40
|
+
const width = cellSize === undefined ? 1 : cellSize[0];
|
|
41
|
+
const height = cellSize === undefined ? 1 : cellSize[1];
|
|
42
|
+
const minX = rect.start.col * width;
|
|
43
|
+
const minY = rect.start.row * height;
|
|
44
|
+
return box2Set(out, minX, minY, minX + rect.span.cols * width, minY + rect.span.rows * height);
|
|
13
45
|
}
|
|
14
|
-
|
|
15
|
-
|
|
46
|
+
/**
|
|
47
|
+
* The cell coordinates, not rounded, of the point `point`: `{ col: x / width,
|
|
48
|
+
* row: y / height }`.
|
|
49
|
+
*/
|
|
50
|
+
export function gridCoord2FromVec2(point, cellSize) {
|
|
51
|
+
return cellSize === undefined
|
|
52
|
+
? { col: point[0], row: point[1] }
|
|
53
|
+
: { col: point[0] / cellSize[0], row: point[1] / cellSize[1] };
|
|
16
54
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
start: point2ToGridCoord2(rect.origin),
|
|
26
|
-
span: size2ToGridSize2(rect.size),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
// ─── Scaled (pixel) conversions ───────────────────────────────────────────────
|
|
30
|
-
//
|
|
31
|
-
// `cellSize` is the pixel dimensions of one grid cell.
|
|
32
|
-
// Inverse (pixel→grid) returns exact (non-integer) values — round at the call site.
|
|
33
|
-
export function gridCoord2ToPixelPoint2(coord, cellSize) {
|
|
34
|
-
return { x: coord.col * cellSize.width, y: coord.row * cellSize.height };
|
|
35
|
-
}
|
|
36
|
-
export function gridSize2ToPixelSize2(size, cellSize) {
|
|
37
|
-
return {
|
|
38
|
-
width: size.cols * cellSize.width,
|
|
39
|
-
height: size.rows * cellSize.height,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
export function gridRect2ToPixelRect2(rect, cellSize) {
|
|
43
|
-
return {
|
|
44
|
-
origin: gridCoord2ToPixelPoint2(rect.start, cellSize),
|
|
45
|
-
size: gridSize2ToPixelSize2(rect.span, cellSize),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export function pixelPoint2ToGridCoord2(point, cellSize) {
|
|
49
|
-
return { col: point.x / cellSize.width, row: point.y / cellSize.height };
|
|
50
|
-
}
|
|
51
|
-
export function pixelSize2ToGridSize2(size, cellSize) {
|
|
52
|
-
return {
|
|
53
|
-
cols: size.width / cellSize.width,
|
|
54
|
-
rows: size.height / cellSize.height,
|
|
55
|
-
};
|
|
55
|
+
/**
|
|
56
|
+
* The size in cells, not rounded, of the extent `size`: `{ cols: width /
|
|
57
|
+
* cellWidth, rows: height / cellHeight }`.
|
|
58
|
+
*/
|
|
59
|
+
export function gridSize2FromVec2(size, cellSize) {
|
|
60
|
+
return cellSize === undefined
|
|
61
|
+
? { cols: size[0], rows: size[1] }
|
|
62
|
+
: { cols: size[0] / cellSize[0], rows: size[1] / cellSize[1] };
|
|
56
63
|
}
|
|
57
|
-
|
|
64
|
+
/**
|
|
65
|
+
* The rectangle of cells, not rounded, covered by `box`: its minimum corner as
|
|
66
|
+
* the start, its extent as the span.
|
|
67
|
+
*/
|
|
68
|
+
export function gridRect2FromBox2(box, cellSize) {
|
|
69
|
+
const width = cellSize === undefined ? 1 : cellSize[0];
|
|
70
|
+
const height = cellSize === undefined ? 1 : cellSize[1];
|
|
58
71
|
return {
|
|
59
|
-
start:
|
|
60
|
-
span:
|
|
72
|
+
start: { col: box[0] / width, row: box[1] / height },
|
|
73
|
+
span: {
|
|
74
|
+
cols: (box[2] - box[0]) / width,
|
|
75
|
+
rows: (box[3] - box[1]) / height,
|
|
76
|
+
},
|
|
61
77
|
};
|
|
62
78
|
}
|
|
63
79
|
//# sourceMappingURL=grid2-pixel.js.map
|
package/dist/grid2-pixel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid2-pixel.js","sourceRoot":"","sources":["../src/grid2-pixel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"grid2-pixel.js","sourceRoot":"","sources":["../src/grid2-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAqB,MAAM,uBAAuB,CAAC;AAO9E,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,gFAAgF;AAChF,yEAAyE;AACzE,sDAAsD;AAEtD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAS,EACT,KAAiB,EACjB,QAAuB;IAEvB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QACnB,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IACpB,CAAC;SAAM,CAAC;QACP,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACjC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,iBAAiB,CAChC,GAAS,EACT,IAAe,EACf,QAAuB;IAEvB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,GAAG,CAAC,CAA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from "./grid2-pixel.js";
|
|
|
8
8
|
export * from "./grid2.js";
|
|
9
9
|
export * from "./infinite-grid2.js";
|
|
10
10
|
export * from "./row-grid2.js";
|
|
11
|
+
export * from "./shelf-allocator.js";
|
|
12
|
+
export * from "./signed-distance-from-coverage2.js";
|
|
13
|
+
export * from "./squared-distance-transform2.js";
|
|
11
14
|
export * from "./strip-grid2.js";
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,5 +8,8 @@ export * from "./grid2-pixel.js";
|
|
|
8
8
|
export * from "./grid2.js";
|
|
9
9
|
export * from "./infinite-grid2.js";
|
|
10
10
|
export * from "./row-grid2.js";
|
|
11
|
+
export * from "./shelf-allocator.js";
|
|
12
|
+
export * from "./signed-distance-from-coverage2.js";
|
|
13
|
+
export * from "./squared-distance-transform2.js";
|
|
11
14
|
export * from "./strip-grid2.js";
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infinite-grid2.js","sourceRoot":"","sources":["../src/infinite-grid2.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;GAGG;AACH,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BACL;oBACC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;oBACrC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;iBACtC;gBACD,KAAK;aACL,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,CAAC,KAAiB,EAAE,KAAQ;QAClC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACD;AAED,SAAS,iBAAiB,CAAC,KAAiB;IAC3C,OAAO,GAAG,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** A rectangle handed out by a `ShelfAllocator`. */
|
|
2
|
+
export type ShelfAllocation = {
|
|
3
|
+
/** Left edge. */
|
|
4
|
+
readonly x: number;
|
|
5
|
+
/** Top edge. */
|
|
6
|
+
readonly y: number;
|
|
7
|
+
/** Pass to `ShelfAllocator.release`; never reused by the allocator. */
|
|
8
|
+
readonly id: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Rectangles allocated and released one by one in a fixed area, on shelves
|
|
12
|
+
* (rows of similar height): a rectangle goes on the shelf of the least height
|
|
13
|
+
* that holds it and has a free span wide enough (first fit), or on a new shelf
|
|
14
|
+
* below the last one. A released rectangle frees its own span at once, merged
|
|
15
|
+
* with adjacent free spans; a shelf left with no rectangle is emptied and the
|
|
16
|
+
* last empty shelves are removed. Rows are never split or merged, so entries of
|
|
17
|
+
* very different heights can fragment the area.
|
|
18
|
+
*
|
|
19
|
+
* Coordinates are integers in `[0, width) × [0, height)` (texels, pixels).
|
|
20
|
+
* Identifiers increase from 0 and are not reused, even after `clear`, so a
|
|
21
|
+
* stale identifier is always detected.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* const atlas = new ShelfAllocator(256, 256);
|
|
25
|
+
* const slot = atlas.allocate(40, 12); // { x: 0, y: 0, id: 0 }
|
|
26
|
+
* atlas.release(slot!.id);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class ShelfAllocator {
|
|
30
|
+
private readonly width_;
|
|
31
|
+
private readonly height_;
|
|
32
|
+
private readonly shelves_;
|
|
33
|
+
private readonly entries_;
|
|
34
|
+
private nextId_;
|
|
35
|
+
private nextY_;
|
|
36
|
+
private usedArea_;
|
|
37
|
+
/**
|
|
38
|
+
* @throws {RangeError} When `width` or `height` is not a positive integer, or
|
|
39
|
+
* when `width · height` is not a safe integer.
|
|
40
|
+
*/
|
|
41
|
+
constructor(width: number, height: number);
|
|
42
|
+
/** The area given to live allocations over the total area, in `[0, 1]`. */
|
|
43
|
+
get occupancy(): number;
|
|
44
|
+
/**
|
|
45
|
+
* The top-left of a free area and its id, or `undefined` when none fits.
|
|
46
|
+
*
|
|
47
|
+
* O(shelves + free spans of the chosen shelf).
|
|
48
|
+
*
|
|
49
|
+
* @throws {RangeError} When `width` or `height` is not a positive integer.
|
|
50
|
+
*/
|
|
51
|
+
allocate(width: number, height: number): ShelfAllocation | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Frees a rectangle.
|
|
54
|
+
*
|
|
55
|
+
* O(shelves + free spans of its shelf).
|
|
56
|
+
*
|
|
57
|
+
* @throws {RangeError} For an id that was never allocated, was already
|
|
58
|
+
* released or was cleared.
|
|
59
|
+
*/
|
|
60
|
+
release(id: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Releases everything. Previous ids stay invalid. O(1) besides dropping the
|
|
63
|
+
* entries.
|
|
64
|
+
*/
|
|
65
|
+
clear(): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=shelf-allocator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shelf-allocator.d.ts","sourceRoot":"","sources":["../src/shelf-allocator.ts"],"names":[],"mappings":"AAEA,oDAAoD;AACpD,MAAM,MAAM,eAAe,GAAG;IAC7B,iBAAiB;IACjB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB,CAAC;AA0BF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;IACrD,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,SAAS,CAAK;IAEtB;;;OAGG;IACH,YAAY,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAUxC;IAED,2EAA2E;IAC3E,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAmDnE;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAwCxB;IAED;;;OAGG;IACH,KAAK,IAAI,IAAI,CAKZ;CACD"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { describeValue } from "@ac-kit/core";
|
|
2
|
+
function assertDimension(name, value) {
|
|
3
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
4
|
+
throw new RangeError(`${name} must be a positive integer, got ${describeValue(value)}`);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Rectangles allocated and released one by one in a fixed area, on shelves
|
|
9
|
+
* (rows of similar height): a rectangle goes on the shelf of the least height
|
|
10
|
+
* that holds it and has a free span wide enough (first fit), or on a new shelf
|
|
11
|
+
* below the last one. A released rectangle frees its own span at once, merged
|
|
12
|
+
* with adjacent free spans; a shelf left with no rectangle is emptied and the
|
|
13
|
+
* last empty shelves are removed. Rows are never split or merged, so entries of
|
|
14
|
+
* very different heights can fragment the area.
|
|
15
|
+
*
|
|
16
|
+
* Coordinates are integers in `[0, width) × [0, height)` (texels, pixels).
|
|
17
|
+
* Identifiers increase from 0 and are not reused, even after `clear`, so a
|
|
18
|
+
* stale identifier is always detected.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const atlas = new ShelfAllocator(256, 256);
|
|
22
|
+
* const slot = atlas.allocate(40, 12); // { x: 0, y: 0, id: 0 }
|
|
23
|
+
* atlas.release(slot!.id);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class ShelfAllocator {
|
|
27
|
+
width_;
|
|
28
|
+
height_;
|
|
29
|
+
shelves_ = [];
|
|
30
|
+
entries_ = new Map();
|
|
31
|
+
nextId_ = 0;
|
|
32
|
+
nextY_ = 0;
|
|
33
|
+
usedArea_ = 0;
|
|
34
|
+
/**
|
|
35
|
+
* @throws {RangeError} When `width` or `height` is not a positive integer, or
|
|
36
|
+
* when `width · height` is not a safe integer.
|
|
37
|
+
*/
|
|
38
|
+
constructor(width, height) {
|
|
39
|
+
assertDimension("width", width);
|
|
40
|
+
assertDimension("height", height);
|
|
41
|
+
if (!Number.isSafeInteger(width * height)) {
|
|
42
|
+
throw new RangeError(`area ${width}×${height} exceeds the safe integer range`);
|
|
43
|
+
}
|
|
44
|
+
this.width_ = width;
|
|
45
|
+
this.height_ = height;
|
|
46
|
+
}
|
|
47
|
+
/** The area given to live allocations over the total area, in `[0, 1]`. */
|
|
48
|
+
get occupancy() {
|
|
49
|
+
return this.usedArea_ / (this.width_ * this.height_);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The top-left of a free area and its id, or `undefined` when none fits.
|
|
53
|
+
*
|
|
54
|
+
* O(shelves + free spans of the chosen shelf).
|
|
55
|
+
*
|
|
56
|
+
* @throws {RangeError} When `width` or `height` is not a positive integer.
|
|
57
|
+
*/
|
|
58
|
+
allocate(width, height) {
|
|
59
|
+
assertDimension("width", width);
|
|
60
|
+
assertDimension("height", height);
|
|
61
|
+
if (width > this.width_ || height > this.height_) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
let best;
|
|
65
|
+
let bestSpan = -1;
|
|
66
|
+
for (const shelf of this.shelves_) {
|
|
67
|
+
if (shelf.height < height ||
|
|
68
|
+
(best !== undefined && shelf.height >= best.height)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const span = shelf.free.findIndex((free) => free.length >= width);
|
|
72
|
+
if (span >= 0) {
|
|
73
|
+
best = shelf;
|
|
74
|
+
bestSpan = span;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (best === undefined) {
|
|
78
|
+
if (this.height_ - this.nextY_ < height) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
best = {
|
|
82
|
+
y: this.nextY_,
|
|
83
|
+
height,
|
|
84
|
+
free: [{ start: 0, length: this.width_ }],
|
|
85
|
+
live: 0,
|
|
86
|
+
};
|
|
87
|
+
bestSpan = 0;
|
|
88
|
+
this.shelves_.push(best);
|
|
89
|
+
this.nextY_ += height;
|
|
90
|
+
}
|
|
91
|
+
const id = this.nextId_++;
|
|
92
|
+
const span = best.free[bestSpan];
|
|
93
|
+
const x = span.start;
|
|
94
|
+
if (span.length === width) {
|
|
95
|
+
best.free.splice(bestSpan, 1);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
span.start += width;
|
|
99
|
+
span.length -= width;
|
|
100
|
+
}
|
|
101
|
+
best.live += 1;
|
|
102
|
+
this.entries_.set(id, { shelf: best, x, width, height });
|
|
103
|
+
this.usedArea_ += width * height;
|
|
104
|
+
return { x, y: best.y, id };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Frees a rectangle.
|
|
108
|
+
*
|
|
109
|
+
* O(shelves + free spans of its shelf).
|
|
110
|
+
*
|
|
111
|
+
* @throws {RangeError} For an id that was never allocated, was already
|
|
112
|
+
* released or was cleared.
|
|
113
|
+
*/
|
|
114
|
+
release(id) {
|
|
115
|
+
const entry = this.entries_.get(id);
|
|
116
|
+
if (entry === undefined) {
|
|
117
|
+
throw new RangeError(`unknown or already released id ${id}`);
|
|
118
|
+
}
|
|
119
|
+
this.entries_.delete(id);
|
|
120
|
+
this.usedArea_ -= entry.width * entry.height;
|
|
121
|
+
const shelf = entry.shelf;
|
|
122
|
+
shelf.live -= 1;
|
|
123
|
+
if (shelf.live > 0) {
|
|
124
|
+
const free = shelf.free;
|
|
125
|
+
let index = free.findIndex((span) => span.start > entry.x);
|
|
126
|
+
if (index < 0) {
|
|
127
|
+
index = free.length;
|
|
128
|
+
}
|
|
129
|
+
free.splice(index, 0, { start: entry.x, length: entry.width });
|
|
130
|
+
const next = free[index + 1];
|
|
131
|
+
if (next !== undefined && next.start === entry.x + entry.width) {
|
|
132
|
+
free[index].length += next.length;
|
|
133
|
+
free.splice(index + 1, 1);
|
|
134
|
+
}
|
|
135
|
+
const previous = free[index - 1];
|
|
136
|
+
if (previous !== undefined &&
|
|
137
|
+
previous.start + previous.length === entry.x) {
|
|
138
|
+
previous.length += free[index].length;
|
|
139
|
+
free.splice(index, 1);
|
|
140
|
+
}
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
shelf.free.length = 0;
|
|
144
|
+
shelf.free.push({ start: 0, length: this.width_ });
|
|
145
|
+
let last = this.shelves_.at(-1);
|
|
146
|
+
while (last !== undefined && last.live === 0) {
|
|
147
|
+
this.shelves_.pop();
|
|
148
|
+
this.nextY_ = last.y;
|
|
149
|
+
last = this.shelves_.at(-1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Releases everything. Previous ids stay invalid. O(1) besides dropping the
|
|
154
|
+
* entries.
|
|
155
|
+
*/
|
|
156
|
+
clear() {
|
|
157
|
+
this.shelves_.length = 0;
|
|
158
|
+
this.entries_.clear();
|
|
159
|
+
this.nextY_ = 0;
|
|
160
|
+
this.usedArea_ = 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=shelf-allocator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shelf-allocator.js","sourceRoot":"","sources":["../src/shelf-allocator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA4B7C,SAAS,eAAe,CAAC,IAAY,EAAE,KAAa;IACnD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,oCAAoC,aAAa,CAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACH,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,cAAc;IACT,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,QAAQ,GAAY,EAAE,CAAC;IACvB,QAAQ,GAAG,IAAI,GAAG,EAAiB,CAAC;IAC7C,OAAO,GAAG,CAAC,CAAC;IACZ,MAAM,GAAG,CAAC,CAAC;IACX,SAAS,GAAG,CAAC,CAAC;IAEtB;;;OAGG;IACH,YAAY,KAAa,EAAE,MAAc;QACxC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,UAAU,CACnB,QAAQ,KAAK,IAAI,MAAM,iCAAiC,CACxD,CAAC;QACH,C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