@mark1russell7/packing 0.2.9 → 0.2.10
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/build/index.js +22 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/skyline.ts +24 -1
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["rowsOf","boxesOf","rowsOf","shapeOf","boundsOf"],"sources":["../src/vector.ts","../src/rect.ts","../src/moves.ts","../src/order.ts","../src/contract.ts","../src/frame.ts","../src/space.ts","../src/maxrects.ts","../src/shelf.ts","../src/skyline.ts","../src/pack.ts","../src/free.ts","../src/push.ts","../src/overflow.ts","../src/sha256.ts","../src/layout-input.ts","../src/measures.ts","../src/metrics.ts","../src/strategy.ts","../src/adapters.ts","../src/convert.ts","../src/portfolio-sets.ts","../src/portfolio-cell.ts","../src/check.ts","../src/portfolio.ts","../src/portfolio-strategy.ts","../src/registry.ts","../src/generators.ts","../src/corpus.ts"],"sourcesContent":["/** A mutable two-dimensional vector. */\nexport class Vector {\n #x: number;\n #y: number;\n\n constructor(x = 0, y = 0) {\n this.#x = x;\n this.#y = y;\n }\n\n /** The first component: a width or a left position. */\n get x(): number { return this.#x; }\n set x(v: number) { this.#x = v; }\n /** The second component: a height or a top position. */\n get y(): number { return this.#y; }\n set y(v: number) { this.#y = v; }\n\n /** This method sets both components. */\n set(x: number, y: number): void {\n this.#x = x;\n this.#y = y;\n }\n\n /** This method copies the components of another vector. */\n setTo(v: Vector): void {\n this.#x = v.x;\n this.#y = v.y;\n }\n\n /** This method gives a new vector: the sum of this vector and another. */\n add(other: Vector): Vector {\n return new Vector(this.#x + other.x, this.#y + other.y);\n }\n\n /** This method gives the product of the components: the area of a size. */\n area(): number {\n return this.#x * this.#y;\n }\n\n /** This method gives a new vector with the same components. */\n clone(): Vector {\n return new Vector(this.#x, this.#y);\n }\n\n /** This method gives a new vector with each component between the components of `min` and `max`. */\n clamp(min: Vector, max: Vector): Vector {\n return new Vector(\n Math.max(min.x, Math.min(max.x, this.#x)),\n Math.max(min.y, Math.min(max.y, this.#y)),\n );\n }\n\n /** This function gives a vector with the same value in both components. */\n static of(scalar: number): Vector {\n return new Vector(scalar, scalar);\n }\n\n /** This function gives the smallest value of each component, or a zero vector for an empty list. */\n static min(vectors: Vector[]): Vector {\n if (!vectors.length) return new Vector();\n return new Vector(\n Math.min(...vectors.map((v) => v.x)),\n Math.min(...vectors.map((v) => v.y)),\n );\n }\n\n /** This function gives the largest value of each component, or a zero vector for an empty list. */\n static max(vectors: Vector[]): Vector {\n if (!vectors.length) return new Vector();\n return new Vector(\n Math.max(...vectors.map((v) => v.x)),\n Math.max(...vectors.map((v) => v.y)),\n );\n }\n\n /** This getter gives a new infinite vector each time. A shared value is not safe, because a vector is mutable. */\n static get Infinity(): Vector {\n return new Vector(Infinity, Infinity);\n }\n}\n","import { Vector } from \"./vector.ts\";\n\n/** A rectangle of the packer. `id` identifies the item that it measures. The packer sets `position` and `wasPacked`. */\n// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- the parameter types the id of the caller\nexport class Rect<T = unknown> {\n readonly #position = new Vector();\n readonly #size = new Vector();\n\n /** The identity of the item that the rectangle measures. */\n id?: T;\n /** The packer sets this field to `true` when it places the rectangle. */\n wasPacked = false;\n /** For an outer rectangle: the packer keeps its width. */\n fixedWidth = false;\n /** For an outer rectangle: the packer keeps its width and its height, and it skips a rectangle that does not fit. */\n fixedSize = false;\n /**\n * The packer keeps the position of a locked rectangle. `packSkyline` packs the other rectangles around it.\n * `packRows` only keeps its position, and other rectangles can overlap it.\n */\n locked = false;\n\n /** The top left corner. */\n get position(): Vector { return this.#position; }\n /** The width and the height. */\n get size(): Vector { return this.#size; }\n\n /** This method gives the right edge. */\n right(): number { return this.#position.x + this.#size.x; }\n /** This method gives the bottom edge. */\n bottom(): number { return this.#position.y + this.#size.y; }\n\n /** This method moves the left edge to the right by an amount, and the right edge stays. */\n shrinkLeft(amount: number): this {\n this.#position.x += amount;\n this.#size.x -= amount;\n return this;\n }\n\n /** This method moves the rectangle by an offset. */\n translateBy(offset: Vector): this {\n this.#position.set(this.#position.x + offset.x, this.#position.y + offset.y);\n return this;\n }\n\n /** This method gives the area of the size. */\n area(): number { return this.#size.area(); }\n\n /** This function gives the rectangles that the packer placed. */\n static packed<U>(rects: Rect<U>[]): Rect<U>[] {\n return rects.filter((r) => r.wasPacked);\n }\n\n /** This function gives the rectangles that the packer did not place. */\n static unpacked<U>(rects: Rect<U>[]): Rect<U>[] {\n return rects.filter((r) => !r.wasPacked);\n }\n\n /** This function marks each rectangle as not placed. A locked rectangle stays placed. */\n static resetPacked<U>(rects: Rect<U>[]): void {\n for (const r of rects) r.wasPacked = r.locked;\n }\n\n /** This function gives the largest right edge, or 0 for an empty list. */\n static maxRight<U>(rects: Rect<U>[]): number {\n return rects.reduce((acc, r) => Math.max(acc, r.right()), 0);\n }\n\n /** This function gives the largest bottom edge, or 0 for an empty list. */\n static maxBottom<U>(rects: Rect<U>[]): number {\n return rects.reduce((acc, r) => Math.max(acc, r.bottom()), 0);\n }\n}\n","// The counts of the characteristic move of each strategy (roadmap item k59, `docs/BENCH.md`, \"Activation\"). The\n// packers count their move here, and the adapters write the count in `trace.measures`. The counts do not change a layout.\n// The module is internal: the package root does not export it.\n\n/** The id of the characteristic move of each strategy and of each shelf fit. The trace of each strategy has its id, also with the count 0. */\nexport const MOVES: Readonly<{\n rows: \"move.gapFill\";\n shelf: \"move.stack\";\n skyline: \"move.lowerWindow\";\n push: \"move.cascade\";\n firstFit: \"move.firstFit\";\n bestFit: \"move.bestFit\";\n bssf: \"move.bssf\";\n blsf: \"move.blsf\";\n baf: \"move.baf\";\n cp: \"move.cp\";\n split: \"move.split\";\n}> = Object.freeze({\n /** A rectangle that the gap fill of `packRow` places in a gap of a row: under a shorter neighbor, or at the row break. */\n rows: \"move.gapFill\",\n /**\n * A rectangle that `packShelf` puts on an open shelf with a taller rectangle. The strip above it stays empty. With a\n * `fit`, the move is a rectangle in the strip above a shorter rectangle of a shelf.\n */\n shelf: \"move.stack\",\n /** A rectangle that the skyline puts in a lower window, not in the leftmost window where it fits. */\n skyline: \"move.lowerWindow\",\n /** A rectangle that a push cascade moves. */\n push: \"move.cascade\",\n /** A rectangle that a shelf fit puts on a shelf that is not the open shelf. The open shelf is the last shelf that the packing opened. */\n firstFit: \"move.firstFit\",\n /** A rectangle that the fit `best` puts on a shelf that is not the first shelf where it fits. */\n bestFit: \"move.bestFit\",\n /** A rectangle that the rule `bssf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n bssf: \"move.bssf\",\n /** A rectangle that the rule `blsf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n blsf: \"move.blsf\",\n /** A rectangle that the rule `baf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n baf: \"move.baf\",\n /** A rectangle that the rule `cp` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n cp: \"move.cp\",\n /** A rectangle of `maxrects` that cuts two free rectangles or more. A shelf or a skyline has no such step. */\n split: \"move.split\",\n});\n\nconst counts = new Map<string, number>();\n\n/** This function adds `n` to the count of a move. */\nexport function countMove(id: string, n = 1): void {\n if (n > 0) counts.set(id, (counts.get(id) ?? 0) + n);\n}\n\n/** This function sets the count of a move to 0. Without an id, it sets each count to 0. */\nexport function clearMoves(id?: string): void {\n if (id === undefined) counts.clear();\n else counts.delete(id);\n}\n\n/** This function gives the count of a move since the last `clearMoves`. */\nexport function moveCount(id: string): number {\n return counts.get(id) ?? 0;\n}\n","import type { Rect } from \"./rect.ts\";\n\n/**\n * An order of the rectangles before the packing. The order changes the layout much. `input` keeps the order of\n * the array of the caller: the row packing then fills no gaps, so its rows read in that order.\n */\nexport type SortOrder = \"height-desc\" | \"height-asc\" | \"width-desc\" | \"area-desc\" | \"input\";\n\n/** This constant lists each sort order. The first one is the default. */\nexport const SORT_ORDERS: readonly SortOrder[] = [\"height-desc\", \"height-asc\", \"width-desc\", \"area-desc\", \"input\"];\n\n/** This function gives the comparator of a sort order. The sort is stable, so `input` keeps the order. */\nexport function compareRects(order: SortOrder): <T>(a: Rect<T>, b: Rect<T>) => number {\n switch (order) {\n case \"height-desc\":\n return (a, b) => b.size.y - a.size.y;\n case \"height-asc\":\n return (a, b) => a.size.y - b.size.y;\n case \"width-desc\":\n return (a, b) => b.size.x - a.size.x;\n case \"area-desc\":\n return (a, b) => b.area() - a.area();\n case \"input\":\n return () => 0;\n }\n}\n","// The data types of the Packer contract (docs/PACKER.md). They are plain data, with no class and no method.\n// Since 0.2.0, the types and the shared values come from `@mark1russell7/layout-contract`. This file adds the packer names.\n\nimport { marginSides, turnBox, type Item, type Sides } from \"@mark1russell7/layout-contract\";\n\nexport {\n DEFAULT_TOLERANCE,\n EPS,\n RECORD_EPS,\n checkInput,\n turnPoint,\n turnPort,\n turnRegion,\n type Item,\n type LayoutContainer,\n type Margin,\n type Obstacle,\n type PackInput,\n type PackOutput,\n type Placement,\n type Port,\n type Region,\n type Side,\n type Sides,\n type StageTrace,\n type Tolerance,\n} from \"@mark1russell7/layout-contract\";\n\n/** This function gives the margin of an item on each side. A number is the same margin on each side. */\nexport function marginOf(item: Pick<Item, \"margin\">): Sides {\n const m = marginSides(item.margin);\n return { top: m.top, right: m.right, bottom: m.bottom, left: m.left };\n}\n\n/**\n * This function gives an item after a turn of 90 degrees clockwise, with the y axis down (decision 1 of\n * `docs/PACKER.md`). The width and the height change places. The top-left corner, the id and the other fields stay.\n * The ports, the shape and the margin turn with the item. The function does not change its argument.\n * It is `turnBox` of the contract.\n */\nexport function turnItem(item: Item): Item {\n return turnBox(item);\n}\n","// The internal frame of the adapters of 0.1: the conversion of a PackInput to the Rect objects of 0.1, and back.\n// Each item grows by its margin and by half the gap on each side. Each obstacle grows by half the gap. Thus two items\n// are `mA + gap + mB` apart. The area of the frame is the container less the inset, grown by half the gap on each side.\n\nimport { boundsOf } from \"@mark1russell7/layout-contract\";\nimport { EPS, marginOf, turnItem, type Item, type Obstacle, type PackInput, type PackOutput, type Placement, type Region, type StageTrace } from \"./contract.ts\";\nimport { Rect } from \"./rect.ts\";\n\nconst clock = (globalThis as { performance?: { now(): number } }).performance;\n\n/** This function gives the time in milliseconds. */\nexport function now(): number {\n return clock ? clock.now() : Date.now();\n}\n\n/** The bounding box of a region comes from the contract. */\nexport { boundsOf } from \"@mark1russell7/layout-contract\";\n\n/** The rectangle of a container: its origin and its size. A free side has the size `Infinity`. */\nexport interface Bounds {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** This function gives the rectangle of a container. A rectangle shape gives the origin and the sizes of the fixed sides. */\nexport function containerBounds(input: PackInput): Bounds {\n const { container } = input;\n const shape = container.shape === undefined ? undefined : boundsOf(container.shape);\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n const w = shape?.w ?? container.w;\n const h = shape?.h ?? container.h;\n if (fixedW && w === undefined) throw new TypeError(`A container with fixed \"${container.fixed}\" needs a width.`);\n if (fixedH && h === undefined) throw new TypeError(`A container with fixed \"${container.fixed}\" needs a height.`);\n return { x: shape?.x ?? 0, y: shape?.y ?? 0, w: fixedW ? w! : Infinity, h: fixedH ? h! : Infinity };\n}\n\n/** One rectangle of the frame, and the item or the obstacle that it measures. */\nexport interface Entry {\n rect: Rect<number>;\n item?: Item;\n obstacle?: Obstacle;\n /** The offset from the corner of the rectangle to the corner of the item or the obstacle. */\n dx: number;\n dy: number;\n}\n\n/** The rectangles of 0.1 for one input. */\nexport interface Frame {\n /** The container coordinates of the origin of the frame. */\n ox: number;\n oy: number;\n /** The size of the area of the frame. A free side has the size `Infinity`. */\n w: number;\n h: number;\n bounds: Bounds;\n inset: number;\n /** The items in the order of their rank, then the obstacles. */\n entries: Entry[];\n /** The ids of the items that are too large for the area. The frame has no rectangle for them. */\n tooLarge: string[];\n}\n\n/** This function gives the items in the order of their rank. The index in the array is the rank of an item without one. */\nexport function byRank(items: readonly Item[]): Item[] {\n return items\n .map((item, index) => ({ item, rank: item.rank ?? index }))\n .toSorted((a, b) => a.rank - b.rank)\n .map((e) => e.item);\n}\n\n/**\n * This function makes the frame of an input. A locked item with a position and an obstacle without `move` are locked\n * rectangles. An obstacle with `move` is a free rectangle only when `movable` is `true`. With `turnable`, a turnable item\n * is too large only when it is too large in the two directions.\n */\nexport function buildFrame(input: PackInput, movable = false, turnable = false): Frame {\n const bounds = containerBounds(input);\n const inset = input.container.inset ?? 0;\n const half = (input.gap ?? 0) / 2;\n const ox = bounds.x + inset - half;\n const oy = bounds.y + inset - half;\n const w = bounds.w - 2 * inset + 2 * half;\n const h = bounds.h - 2 * inset + 2 * half;\n const entries: Entry[] = [];\n const tooLarge: string[] = [];\n\n for (const item of byRank(input.items)) {\n const m = marginOf(item);\n const rect = new Rect<number>();\n rect.size.set(item.w + m.left + m.right + 2 * half, item.h + m.top + m.bottom + 2 * half);\n const dx = m.left + half;\n const dy = m.top + half;\n if (item.locked === true && item.x !== undefined && item.y !== undefined) {\n rect.locked = true;\n rect.position.set(item.x - dx - ox, item.y - dy - oy);\n } else if (\n (rect.size.x > w + EPS || rect.size.y > h + EPS) &&\n !(turnable && item.turnable === true && rect.size.y <= w + EPS && rect.size.x <= h + EPS)\n ) {\n tooLarge.push(item.id);\n continue;\n }\n entries.push({ rect, item, dx, dy });\n }\n\n for (const obstacle of input.obstacles ?? []) {\n const b = boundsOf(obstacle.region);\n const rect = new Rect<number>();\n rect.size.set(b.w + 2 * half, b.h + 2 * half);\n rect.position.set(b.x - half - ox, b.y - half - oy);\n rect.locked = !(movable && obstacle.move !== undefined);\n entries.push({ rect, obstacle, dx: half, dy: half });\n }\n return { ox, oy, w, h, bounds, inset, entries, tooLarge };\n}\n\n/** This function gives the outer rectangle of 0.1 for a frame. A free height starts at 0 and grows. */\nexport function outerOf(frame: Frame): Rect<number> {\n const outer = new Rect<number>();\n const fixedSize = Number.isFinite(frame.h);\n outer.size.set(frame.w, fixedSize ? frame.h : 0);\n outer.fixedWidth = true;\n outer.fixedSize = fixedSize;\n return outer;\n}\n\n/** This function gives the rectangles of a frame, in the order of the entries. */\nexport function rectsOf(frame: Frame): Rect<number>[] {\n return frame.entries.map((e) => e.rect);\n}\n\n/** The turns of a packing: the rectangles that turned, and the turn of an item in the axes of the frame. */\nexport interface FrameTurns {\n /** The rectangles of the frame that the packer turned. */\n rects: ReadonlySet<unknown>;\n /** This function gives an item after a turn of 90 degrees clockwise in the axes of the input, in the axes of the frame. */\n turn: (item: Item) => Item;\n}\n\n/**\n * This function gives the turn of an item for a frame. A frame of `viaAxes` has the axes changed. The turn of the input\n * goes through that change, thus the item turns the other way in the frame.\n */\nexport function frameTurn(transposed: boolean): (item: Item) => Item {\n return transposed ? (item) => transposeItem(turnItem(transposeItem(item))) : turnItem;\n}\n\n/**\n * This function reads the output from the rectangles of a frame after a packing of 0.1. A locked item keeps its\n * position exactly. Each other item that the packer did not place goes to the overflow. With `turns`, each rectangle\n * that turned gives a placement with `turn: 90`.\n */\nexport function readFrame(input: PackInput, frame: Frame, trace: readonly StageTrace[], moved: PackOutput[\"moved\"] = [], turns?: FrameTurns): PackOutput {\n const placements: Placement[] = [];\n const overflow: string[] = [...frame.tooLarge];\n for (const e of frame.entries) {\n const item = e.item;\n if (item === undefined) continue;\n if (item.locked === true && item.x !== undefined && item.y !== undefined) placements.push({ id: item.id, x: item.x, y: item.y });\n else if (e.rect.wasPacked && turns?.rects.has(e.rect) === true) {\n // The half gap is the offset less the margin. The margin of the turned item gives the new offset.\n const half = e.dx - marginOf(item).left;\n const m = marginOf(turns.turn(item));\n placements.push({ id: item.id, x: e.rect.position.x + m.left + half + frame.ox, y: e.rect.position.y + m.top + half + frame.oy, turn: 90 });\n } else if (e.rect.wasPacked) placements.push({ id: item.id, x: e.rect.position.x + e.dx + frame.ox, y: e.rect.position.y + e.dy + frame.oy });\n else overflow.push(item.id);\n }\n return { placements, overflow, size: sizeOf(input, frame, placements, moved, turns), moved, trace };\n}\n\n/**\n * This function gives the size of the container after a packing. A fixed side keeps its size. A free side goes to the\n * far edge of the items with their margins and the inset, or of the obstacles.\n */\nfunction sizeOf(input: PackInput, frame: Frame, placements: Placement[], moved: PackOutput[\"moved\"], turns?: FrameTurns): { w: number; h: number } {\n const items = new Map(input.items.map((i) => [i.id, i]));\n let right = 0;\n let bottom = 0;\n for (const p of placements) {\n const given = items.get(p.id)!;\n const item = p.turn === 90 && turns !== undefined ? turns.turn(given) : given;\n const m = marginOf(item);\n right = Math.max(right, p.x + item.w + m.right + frame.inset - frame.bounds.x);\n bottom = Math.max(bottom, p.y + item.h + m.bottom + frame.inset - frame.bounds.y);\n }\n const movedById = new Map(moved.map((m) => [m.id, m]));\n for (const o of input.obstacles ?? []) {\n const b = boundsOf(o.region);\n const at = movedById.get(o.id) ?? b;\n right = Math.max(right, at.x + b.w - frame.bounds.x);\n bottom = Math.max(bottom, at.y + b.h - frame.bounds.y);\n }\n return {\n w: Number.isFinite(frame.bounds.w) ? frame.bounds.w : right,\n h: Number.isFinite(frame.bounds.h) ? frame.bounds.h : bottom,\n };\n}\n\n/** This function gives a region with the axes changed: x for y, and w for h. */\nexport function transposeRegion(region: Region): Region {\n switch (region.kind) {\n case \"rect\":\n return { kind: \"rect\", x: region.y, y: region.x, w: region.h, h: region.w };\n case \"circle\":\n return { kind: \"circle\", cx: region.cy, cy: region.cx, r: region.r };\n case \"ellipse\":\n return { kind: \"ellipse\", cx: region.cy, cy: region.cx, rx: region.ry, ry: region.rx };\n case \"polygon\": {\n const swap = (ring: readonly (readonly [number, number])[]): [number, number][] => ring.map(([x, y]) => [y, x]);\n return region.holes === undefined\n ? { kind: \"polygon\", points: swap(region.points) }\n : { kind: \"polygon\", points: swap(region.points), holes: region.holes.map(swap) };\n }\n }\n}\n\n/** This function gives an item with the axes changed. The ports go, because the adapters of 0.1 do not read them. */\nfunction transposeItem(item: Item): Item {\n const { ports: _ports, x, y, shape, margin, ...rest } = item;\n return {\n ...rest,\n w: item.h,\n h: item.w,\n ...(y === undefined ? {} : { x: y }),\n ...(x === undefined ? {} : { y: x }),\n ...(shape === undefined ? {} : { shape: transposeRegion(shape) }),\n ...(margin === undefined\n ? {}\n : { margin: typeof margin === \"number\" ? margin : { top: margin.left, right: margin.bottom, bottom: margin.right, left: margin.top } }),\n };\n}\n\n/** This function gives an input with the axes changed. A fixed height becomes a fixed width. */\nexport function transposeInput(input: PackInput): PackInput {\n const c = input.container;\n const container: PackInput[\"container\"] = {\n fixed: c.fixed === \"height\" ? \"width\" : c.fixed === \"width\" ? \"height\" : c.fixed,\n ...(c.h === undefined ? {} : { w: c.h }),\n ...(c.w === undefined ? {} : { h: c.w }),\n ...(c.aspect === undefined ? {} : { aspect: 1 / c.aspect }),\n ...(c.aspectWeight === undefined ? {} : { aspectWeight: c.aspectWeight }),\n ...(c.shape === undefined ? {} : { shape: transposeRegion(c.shape) }),\n ...(c.inset === undefined ? {} : { inset: c.inset }),\n };\n return {\n container,\n items: input.items.map(transposeItem),\n ...(input.obstacles === undefined ? {} : { obstacles: input.obstacles.map((o) => ({ ...o, region: transposeRegion(o.region) })) }),\n ...(input.gap === undefined ? {} : { gap: input.gap }),\n };\n}\n\n/** This function gives an output with the axes changed. */\nexport function transposeOutput(output: PackOutput): PackOutput {\n return {\n placements: output.placements.map((p) => ({ ...p, x: p.y, y: p.x })),\n overflow: [...output.overflow],\n size: { w: output.size.h, h: output.size.w },\n moved: output.moved.map((m) => ({ id: m.id, x: m.y, y: m.x })),\n ...(output.trace === undefined ? {} : { trace: output.trace }),\n };\n}\n\n/**\n * This function packs an input with a fixed height through the turn of the axes. It changes x for y in the input.\n * Then it packs with a fixed width, and changes the axes of the output back.\n */\nexport function viaAxes(input: PackInput, previous: PackOutput | undefined, run: (turned: PackInput, previous: PackOutput | undefined) => PackOutput): PackOutput {\n const start = now();\n const turned = transposeInput(input);\n const inner = run(turned, previous === undefined ? undefined : transposeOutput(previous));\n return { ...transposeOutput(inner), trace: [{ id: \"axes\", ms: now() - start, measures: {} }, ...(inner.trace ?? [])] };\n}\n","// The container layer of roadmap item k37 (docs/PACKER.md): the free space of one input, in the coordinates of the frame.\n// A strategy asks the layer where a rectangle of the frame fits. The layer knows the outline of the container, its holes,\n// the obstacles and the locked items. Thus each strategy packs into each container shape.\n\nimport { boundsOf, regionHitsRect, translate } from \"@mark1russell7/layout-contract\";\nimport { EPS, type PackInput, type Region } from \"./contract.ts\";\nimport { buildFrame, transposeRegion, type Frame } from \"./frame.ts\";\n\n/** A free interval on one axis, from `start` to `end`. A box fits when it starts at `start` or later and ends at `end` or earlier. */\nexport interface FreeSpan {\n readonly start: number;\n readonly end: number;\n}\n\n/** A rectangle of the frame: its top-left corner and its size. */\nexport interface SpaceRect {\n readonly x: number;\n readonly y: number;\n readonly w: number;\n readonly h: number;\n}\n\n/**\n * The free space of one input, in the coordinates of the frame of the adapters. A rectangle of the frame is an item with its\n * margin, grown by half the gap on each side. Each method takes such a rectangle.\n *\n * - The outline of a container with a fixed size is exact. A free side uses the bounding box of the shape, and the holes stay.\n * - The inset of the container counts as in `checkHard`: the item with its margin, grown by the inset, stays in the outline.\n * - A rectangle obstacle and a locked item are holes with the exact rectangles of the frame.\n * - Another obstacle blocks its range over the query, grown by half the gap on each axis.\n */\nexport interface FreeSpace {\n /** The width of the area of the frame. A free side has the width `Infinity`. */\n readonly w: number;\n /** The height of the area of the frame. A free side has the height `Infinity`. */\n readonly h: number;\n /**\n * The value `true` tells that the container is a plain rectangle and that each obstacle is a rectangle. Then `band` does\n * not test y, and `column` does not test x, because each strategy tests the fixed side itself. This is the fast path.\n */\n readonly plain: boolean;\n /** This method gives the free x-spans, from left to right, for a rectangle from `y0` to `y1`. */\n band(y0: number, y1: number): FreeSpan[];\n /**\n * This method gives the first free y-span for a rectangle from `x0` to `x1` that ends after `from`. The span starts\n * at `from` or later. The method gives `undefined` when no such span is free.\n */\n column(x0: number, x1: number, from?: number): FreeSpan | undefined;\n /** This method tells if a rectangle is in the free space. */\n fits(rect: SpaceRect): boolean;\n /** This method gives the first x from `x` where a rectangle of width `w` fits from `y0` to `y1`, or `Infinity`. */\n fitX(x: number, w: number, y0: number, y1: number): number;\n /**\n * This method gives the next top edge after `y0` where the free spans of a rectangle of the height `y1 - y0` change, or\n * `Infinity`. A row that has no place for a rectangle of width `w` steps down to this edge.\n */\n nextY(y0: number, y1: number, w: number): number;\n}\n\n/** A rectangle hole of a layer: its edges on the axis of the spans (`a`) and on the cross axis (`c`). */\ninterface Hole {\n a0: number;\n a1: number;\n c0: number;\n c1: number;\n}\n\n/** A region that blocks its range over a query, grown by `g` on each axis. */\ninterface Blocker {\n region: Region;\n g: number;\n /** The cross-axis edges of the bounding box of the region. */\n c0: number;\n c1: number;\n}\n\n/** A ring of a polygon. */\ntype Ring = readonly (readonly [number, number])[];\n\n/**\n * One axis of the free space. The spans go along x, and the query goes along y. The layer of `column` is the layer of\n * `band` with the axes changed.\n */\ninterface Layer {\n /** `plain` and `box`: the area of the frame. `round`: a circle or an ellipse. `rings`: a polygon. */\n kind: \"plain\" | \"box\" | \"round\" | \"rings\";\n /** The size of the area along the spans and across. */\n w: number;\n h: number;\n /** The growth of a query for the outline: the inset less half the gap. */\n d: number;\n region?: Region;\n rings: Ring[];\n holes: Hole[];\n blockers: Blocker[];\n}\n\n/** This function removes the closed interval from `a` to `b` from a list of spans. A span of no length goes. */\nfunction subtract(spans: [number, number][], a: number, b: number): [number, number][] {\n const out: [number, number][] = [];\n for (const [s, e] of spans) {\n if (b <= s || a >= e) {\n out.push([s, e]);\n continue;\n }\n if (a > s) out.push([s, a]);\n if (e > b) out.push([b, e]);\n }\n return out;\n}\n\n/** This function gives the x of a segment at `y`. The ends give their exact x. */\nfunction xAt(ax: number, ay: number, bx: number, by: number, y: number): number {\n if (y === ay) return ax;\n if (y === by) return bx;\n return ax + ((y - ay) * (bx - ax)) / (by - ay);\n}\n\n/** This function gives the x-range of the part of a segment in the open strip from `y0` to `y1`, or `undefined`. */\nfunction edgeRange(ax: number, ay: number, bx: number, by: number, y0: number, y1: number): [number, number] | undefined {\n const lo = Math.min(ay, by);\n const hi = Math.max(ay, by);\n if (hi <= y0 || lo >= y1) return undefined;\n if (ay === by) return [Math.min(ax, bx), Math.max(ax, bx)];\n const p = xAt(ax, ay, bx, by, Math.max(y0, lo));\n const q = xAt(ax, ay, bx, by, Math.min(y1, hi));\n return [Math.min(p, q), Math.max(p, q)];\n}\n\n/** This function gives the x-range of a region in the open strip from `y0` to `y1`, or `undefined` when they have no common point. */\nfunction regionRange(region: Region, y0: number, y1: number): [number, number] | undefined {\n switch (region.kind) {\n case \"rect\":\n return region.y < y1 && y0 < region.y + region.h ? [region.x, region.x + region.w] : undefined;\n case \"circle\":\n case \"ellipse\": {\n const rx = region.kind === \"circle\" ? region.r : region.rx;\n const ry = region.kind === \"circle\" ? region.r : region.ry;\n if (y1 <= region.cy - ry || y0 >= region.cy + ry) return undefined;\n const dy = y0 <= region.cy && region.cy <= y1 ? 0 : Math.min(Math.abs(y0 - region.cy), Math.abs(y1 - region.cy));\n const c = rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2));\n return [region.cx - c, region.cx + c];\n }\n case \"polygon\": {\n let lo = Infinity;\n let hi = -Infinity;\n const ring = region.points;\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n const r = edgeRange(a[0], a[1], b[0], b[1], y0, y1);\n if (r === undefined) continue;\n lo = Math.min(lo, r[0]);\n hi = Math.max(hi, r[1]);\n }\n return lo <= hi ? [lo, hi] : undefined;\n }\n }\n}\n\n/** This function gives the spans of the outline of a layer for the strip from `y0` to `y1`, before the holes and the blockers. */\nfunction outline(layer: Layer, y0: number, y1: number): [number, number][] {\n const { d } = layer;\n switch (layer.kind) {\n case \"plain\":\n return [[0, layer.w]];\n case \"box\":\n return y0 < 0 || y1 > layer.h ? [] : [[0, layer.w]];\n case \"round\": {\n const r = layer.region!;\n if (r.kind !== \"circle\" && r.kind !== \"ellipse\") return [];\n const rx = r.kind === \"circle\" ? r.r : r.rx;\n const ry = r.kind === \"circle\" ? r.r : r.ry;\n const top = y0 - d;\n const bottom = y1 + d;\n if (top < r.cy - ry || bottom > r.cy + ry) return [];\n const dy = Math.max(Math.abs(top - r.cy), Math.abs(bottom - r.cy));\n // The shortest chord over the height of the query, made smaller by EPS\n const c = rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2)) - EPS;\n const a = r.cx - c + d;\n const b = r.cx + c - d;\n return b > a ? [[a, b]] : [];\n }\n case \"rings\": {\n const top = y0 - d;\n const bottom = y1 + d;\n if (!(bottom > top)) return [];\n const blocked: [number, number][] = [];\n for (const ring of layer.rings) {\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n const r = edgeRange(a[0], a[1], b[0], b[1], top, bottom);\n if (r !== undefined) blocked.push(r);\n }\n }\n if (blocked.length === 0) return [];\n blocked.sort((p, q) => p[0] - q[0] || p[1] - q[1]);\n const merged: [number, number][] = [];\n for (const r of blocked) {\n const last = merged.at(-1);\n if (last !== undefined && r[0] <= last[1]) last[1] = Math.max(last[1], r[1]);\n else merged.push([r[0], r[1]]);\n }\n const spans: [number, number][] = [];\n for (let i = 0; i + 1 < merged.length; i++) {\n const a = merged[i]![1];\n const b = merged[i + 1]![0];\n if (!(b > a)) continue;\n // No edge crosses the box of the gap, thus the box is fully in the polygon or fully out of it\n if (!regionHitsRect(layer.region!, { x: a, y: top, w: b - a, h: bottom - top })) continue;\n if (b - d > a + d) spans.push([a + d, b - d]);\n }\n return spans;\n }\n }\n}\n\n/** This function gives the free spans of a layer for the strip from `y0` to `y1`. */\nfunction spansOf(layer: Layer, y0: number, y1: number): [number, number][] {\n let spans = outline(layer, y0, y1);\n for (const hole of layer.holes) {\n if (spans.length === 0) return spans;\n if (Math.min(y1, hole.c1) - Math.max(y0, hole.c0) > 0) spans = subtract(spans, hole.a0, hole.a1);\n }\n for (const b of layer.blockers) {\n if (spans.length === 0) return spans;\n if (b.c1 + b.g <= y0 || b.c0 - b.g >= y1) continue;\n const r = regionRange(b.region, y0 - b.g, y1 + b.g);\n // The range grows by EPS, as the chord of a round outline shrinks by EPS\n if (r !== undefined) spans = subtract(spans, r[0] - b.g - EPS, r[1] + b.g + EPS);\n }\n return spans;\n}\n\n/** This function gives the first x from `x` where a box of width `w` fits in one of the spans, or `Infinity`. */\nexport function firstFit(spans: readonly FreeSpan[], x: number, w: number): number {\n for (const s of spans) {\n const at = Math.max(x, s.start);\n if (at + w <= s.end) return at;\n }\n return Infinity;\n}\n\n/** This function gives the next top edge of a layer after `y0` for a strip of the height `y1 - y0`, as `FreeSpace.nextY` tells. */\nfunction nextOf(layer: Layer, y0: number, y1: number, w: number): number {\n const height = y1 - y0;\n const { d } = layer;\n let next = Infinity;\n const take = (y: number): void => {\n if (y > y0 + EPS && y < next) next = y;\n };\n for (const hole of layer.holes) if (hole.c0 < y1 && y0 < hole.c1) take(hole.c1);\n for (const b of layer.blockers) if (b.c0 - b.g < y1 && y0 < b.c1 + b.g) take(b.c1 + b.g);\n switch (layer.kind) {\n case \"plain\":\n break;\n case \"box\":\n if (y1 > layer.h) return Infinity;\n break;\n case \"rings\":\n for (const ring of layer.rings) {\n for (const [, vy] of ring) {\n take(vy + d);\n take(vy - height - d);\n }\n }\n break;\n case \"round\": {\n const r = layer.region!;\n if (r.kind !== \"circle\" && r.kind !== \"ellipse\") break;\n const rx = r.kind === \"circle\" ? r.r : r.rx;\n const ry = r.kind === \"circle\" ? r.r : r.ry;\n // The half chord that a box of width w needs, and the largest distance from the center where the chord has it\n const need = w / 2 + d + EPS;\n if (need >= rx) return Infinity;\n const reach = ry * Math.sqrt(1 - (need / rx) ** 2);\n if (y1 + d > r.cy + reach) return Infinity;\n take(r.cy - reach + d);\n break;\n }\n }\n return next;\n}\n\n/** This function gives the layer with the axes changed: the spans go along y, and the query goes along x. */\nfunction transposeLayer(layer: Layer): Layer {\n return {\n kind: layer.kind,\n w: layer.h,\n h: layer.w,\n d: layer.d,\n ...(layer.region === undefined ? {} : { region: transposeRegion(layer.region) }),\n rings: layer.rings.map((ring) => ring.map(([x, y]) => [y, x] as const)),\n holes: layer.holes.map((h) => ({ a0: h.c0, a1: h.c1, c0: h.a0, c1: h.a1 })),\n blockers: layer.blockers.map((b) => {\n const region = transposeRegion(b.region);\n const box = boundsOf(region);\n return { region, g: b.g, c0: box.y, c1: box.y + box.h };\n }),\n };\n}\n\n/** This function makes a blocker of a region in the frame. */\nfunction blockerOf(region: Region, g: number): Blocker {\n const box = boundsOf(region);\n return { region, g, c0: box.y, c1: box.y + box.h };\n}\n\n/**\n * This function gives the free space of an input and its frame. The adapters use it with the frame that they pack.\n * `freeSpace` makes the frame itself.\n */\nexport function spaceOf(input: PackInput, frame: Frame): FreeSpace {\n const { container } = input;\n const half = (input.gap ?? 0) / 2;\n const d = frame.inset - half;\n const shape = container.shape === undefined ? undefined : translate(container.shape, -frame.ox, -frame.oy);\n const fixedSize = Number.isFinite(frame.w) && Number.isFinite(frame.h);\n\n const holes: Hole[] = [];\n const blockers: Blocker[] = [];\n let rectObstacles = true;\n for (const e of frame.entries) {\n if (!e.rect.locked) continue;\n if (e.obstacle !== undefined && e.obstacle.region.kind !== \"rect\") {\n rectObstacles = false;\n blockers.push(blockerOf(translate(e.obstacle.region, -frame.ox, -frame.oy), half));\n continue;\n }\n const r = e.rect;\n holes.push({ a0: r.position.x, a1: r.right(), c0: r.position.y, c1: r.bottom() });\n }\n\n const plainShape = shape === undefined || shape.kind === \"rect\";\n const plain = plainShape && rectObstacles;\n let layer: Layer = { kind: plain ? \"plain\" : \"box\", w: frame.w, h: frame.h, d, rings: [], holes, blockers };\n if (shape !== undefined && shape.kind !== \"rect\") {\n if (fixedSize && shape.kind === \"polygon\") layer = { ...layer, kind: \"rings\", region: shape, rings: [shape.points, ...(shape.holes ?? [])] };\n else if (fixedSize) layer = { ...layer, kind: \"round\", region: shape };\n else if (shape.kind === \"polygon\") {\n // A free side: the bounding box, and the holes of the shape block the rectangles grown by the inset\n for (const ring of shape.holes ?? []) blockers.push(blockerOf({ kind: \"polygon\", points: ring }, d));\n }\n }\n const across = transposeLayer(layer);\n\n const band = (y0: number, y1: number): FreeSpan[] => spansOf(layer, y0, y1).map(([start, end]) => ({ start, end }));\n const space: FreeSpace = {\n w: frame.w,\n h: frame.h,\n plain,\n band,\n column(x0, x1, from = 0) {\n for (const [start, end] of spansOf(across, x0, x1)) {\n const top = Math.max(start, from);\n if (end > top) return { start: top, end };\n }\n return undefined;\n },\n fits(rect) {\n return firstFit(band(rect.y, rect.y + rect.h), rect.x, rect.w) === rect.x;\n },\n fitX(x, w, y0, y1) {\n return firstFit(band(y0, y1), x, w);\n },\n nextY(y0, y1, w) {\n return nextOf(layer, y0, y1, w);\n },\n };\n const bare: Layer = { ...layer, holes: [] };\n let bottom = 0;\n for (const b of blockers) bottom = Math.max(bottom, b.c1 + Math.max(0, b.g));\n PARTS.set(space, {\n kind: layer.kind,\n d,\n holes: holes.map((r) => ({ x: r.a0, y: r.c0, w: r.a1 - r.a0, h: r.c1 - r.c0 })),\n bottom: Number.isFinite(frame.h) ? frame.h : bottom,\n bare: (y0, y1) => spansOf(bare, y0, y1).map(([start, end]) => ({ start, end })),\n });\n return space;\n}\n\n/**\n * The parts of a free space of `spaceOf`. The packer `maxrects` reads them to make its first free rectangles. The\n * package root does not export them.\n */\nexport interface SpaceParts {\n /** The kind of the outline: `plain`, `box`, `round` or `rings`. */\n readonly kind: \"plain\" | \"box\" | \"round\" | \"rings\";\n /** The growth of a query for the outline: the inset less half the gap. */\n readonly d: number;\n /** The rectangle holes: the locked items and the rectangle obstacles, in the coordinates of the frame. */\n readonly holes: readonly SpaceRect[];\n /** The height to cut into bands. A fixed height gives the height. A free height gives the lowest edge of the blockers. */\n readonly bottom: number;\n /** This method gives the free x-spans of the outline and the blockers from `y0` to `y1`, without the rectangle holes. */\n bare(y0: number, y1: number): FreeSpan[];\n}\n\nconst PARTS = new WeakMap<FreeSpace, SpaceParts>();\n\n/** This function gives the parts of a free space of `spaceOf`, or `undefined` for another free space. */\nexport function spaceParts(space: FreeSpace): SpaceParts | undefined {\n return PARTS.get(space);\n}\n\n/**\n * This function gives the free space of an input, in the coordinates of the frame of the adapters. The origin of the\n * frame is the corner of the container, moved in by the inset and out by half the gap. `FreeSpace` tells the methods.\n */\nexport function freeSpace(input: PackInput): FreeSpace {\n return spaceOf(input, buildFrame(input));\n}\n","// The MaxRects family of roadmap item k24 (docs/PACKER.md, \"The MaxRects family\"). The packer keeps a list of the\n// maximal free rectangles. Each box goes to the top-left corner of one free rectangle. A rule chooses the free rectangle.\n// Then the box cuts each free rectangle that it hits into at most four parts, and the list loses each part that is in another.\n\nimport { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport { spaceParts, type FreeSpace, type FreeSpan, type SpaceRect } from \"./space.ts\";\n\n/**\n * The rules of `maxrects` to choose a free rectangle for a box.\n *\n * - `bssf`: the best short side fit. The smaller leftover side is the smallest.\n * - `blsf`: the best long side fit. The larger leftover side is the smallest.\n * - `baf`: the best area fit. The leftover area is the smallest.\n * - `bl`: the bottom-left rule. The bottom edge of the box is the highest, then the left edge is the leftmost.\n * - `cp`: the contact point rule. The box touches the most length of the edges of the frame, the boxes and the obstacles.\n */\nexport const MAXRECTS_RULES: readonly [\"bssf\", \"blsf\", \"baf\", \"bl\", \"cp\"] = Object.freeze([\"bssf\", \"blsf\", \"baf\", \"bl\", \"cp\"] as const);\n\n/** A rule of `maxrects`: `bssf`, `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */\nexport type MaxRectsRule = (typeof MAXRECTS_RULES)[number];\n\n/** The number of bands that the default band height gives. The default band height is the height to cut divided by this number. */\nexport const MAXRECTS_BANDS = 128;\n\n/** The options of `packMaxRects` */\nexport interface MaxRectsOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the free rectangles are\n * exact: the outer rectangle less the locked rectangles. Another space gives an inner approximation with bands.\n */\n space?: FreeSpace;\n /** The rule to choose a free rectangle. The default is `bssf`. */\n rule?: MaxRectsRule;\n /**\n * The largest height of a band of the approximation of a space that is not plain. The bands have equal heights. The\n * default is the height to cut divided by `MAXRECTS_BANDS`. A fixed height cuts the height. A free height cuts to the\n * lowest edge of the obstacles that are not rectangles.\n */\n bandHeight?: number;\n /** The rectangles that can turn by 90 degrees. Without it, no rectangle turns. A locked rectangle does not turn. */\n turnable?: ReadonlySet<unknown>;\n /**\n * The rectangles that the packing turned. Each call turns back the rectangles of this set first, and then it clears the\n * set. Thus a size search can pack the same rectangles many times.\n */\n turned?: Set<unknown>;\n}\n\n/** A rectangle with its four edges, in the coordinates of the outer rectangle. */\ninterface Box {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/** A place for a box: a free rectangle, the turn, and the two scores of the rule. Lower scores are better. */\ninterface Choice {\n index: number;\n turn: boolean;\n x: number;\n y: number;\n w: number;\n h: number;\n s1: number;\n s2: number;\n}\n\n/** The result of `runMaxRects`: the outer rectangle and the free rectangles at the end. */\nexport interface MaxRectsRun<T> {\n outer: Rect<T>;\n /** The free rectangles at the end, in the coordinates of the rectangles. Each one is as wide as the narrowest box and as high as the lowest box. */\n free: SpaceRect[];\n}\n\n/** This function tells if the box `a` is fully in the box `b`. */\nfunction inside(a: Box, b: Box): boolean {\n return a.x0 >= b.x0 && a.y0 >= b.y0 && a.x1 <= b.x1 && a.y1 <= b.y1;\n}\n\n/**\n * This function cuts each free rectangle that the box `b` hits into at most four parts. A part with a side less than\n * `minW` or `minH` goes, because no box fits in it. A part that is in another rectangle of the list goes.\n * The function gives the new list and the number of free rectangles that the box hit.\n */\nfunction cut(free: Box[], b: Box, minW: number, minH: number): { free: Box[]; hits: number } {\n const kept: Box[] = [];\n const parts: Box[] = [];\n let hits = 0;\n const add = (x0: number, y0: number, x1: number, y1: number): void => {\n if (x1 - x0 >= minW && y1 - y0 >= minH) parts.push({ x0, y0, x1, y1 });\n };\n for (const f of free) {\n if (b.x0 >= f.x1 || b.x1 <= f.x0 || b.y0 >= f.y1 || b.y1 <= f.y0) {\n kept.push(f);\n continue;\n }\n hits++;\n if (b.x0 > f.x0) add(f.x0, f.y0, b.x0, f.y1);\n if (b.x1 < f.x1) add(b.x1, f.y0, f.x1, f.y1);\n if (b.y0 > f.y0) add(f.x0, f.y0, f.x1, b.y0);\n if (b.y1 < f.y1) add(f.x0, b.y1, f.x1, f.y1);\n }\n // Each part is in the free rectangle that it comes from. Thus a kept rectangle is never in a part.\n const count = kept.length;\n for (let i = 0; i < parts.length; i++) {\n const p = parts[i]!;\n let drop = false;\n for (let j = 0; j < parts.length && !drop; j++) {\n if (j === i) continue;\n const q = parts[j]!;\n // Of two equal parts, the first part stays\n if (inside(p, q) && (j < i || !inside(q, p))) drop = true;\n }\n for (let k = 0; k < count && !drop; k++) if (inside(p, kept[k]!)) drop = true;\n if (!drop) kept.push(p);\n }\n return { free: kept, hits };\n}\n\n/** The edges of the boxes on one axis: for each coordinate, the flat list of the ranges on the other axis. */\ntype Edges = Map<number, number[]>;\n\n/** This function adds a range to the edges at a coordinate. */\nfunction addEdge(edges: Edges, at: number, a: number, b: number): void {\n const list = edges.get(at);\n if (list === undefined) edges.set(at, [a, b]);\n else list.push(a, b);\n}\n\n/** This function gives the length of the common part of the range from `a` to `b` and the edges at a coordinate. */\nfunction touch(edges: Edges, at: number, a: number, b: number): number {\n const list = edges.get(at);\n if (list === undefined) return 0;\n let sum = 0;\n for (let i = 0; i < list.length; i += 2) sum += Math.max(0, Math.min(b, list[i + 1]!) - Math.max(a, list[i]!));\n return sum;\n}\n\n/**\n * This function gives the walls of a space that is not plain: the parts of the bands that are not free. The bands cut the\n * height from 0 to `top`. Two walls of neighbour bands with the same span become one wall.\n */\nfunction bandWalls(query: (y0: number, y1: number) => FreeSpan[], w: number, top: number, bandHeight: number, grow: number, end: number): Box[] {\n const walls: Box[] = [];\n const count = Math.max(1, Math.ceil(top / bandHeight));\n let open = new Map<string, Box>();\n for (let k = 0; k < count; k++) {\n const y0 = (top * k) / count;\n const y1 = k === count - 1 ? top : (top * (k + 1)) / count;\n // With a growth of the query less than 0, the band asks for a larger strip. Thus the bands cover each y of the outline.\n const spans = query(Math.max(0, y0 - grow), Math.min(end, y1 + grow));\n const next = new Map<string, Box>();\n let x = 0;\n const block = (a: number, b: number): void => {\n if (!(b > a)) return;\n const key = `${a}|${b}`;\n const wall = open.get(key);\n if (wall !== undefined) {\n wall.y1 = y1;\n open.delete(key);\n next.set(key, wall);\n } else next.set(key, { x0: a, y0, x1: b, y1 });\n };\n for (const s of spans) {\n const start = Math.max(0, Math.min(w, s.start));\n const stop = Math.max(0, Math.min(w, s.end));\n if (!(stop > start)) continue;\n block(x, start);\n x = Math.max(x, stop);\n }\n block(x, w);\n walls.push(...open.values());\n open = next;\n }\n walls.push(...open.values());\n return walls;\n}\n\n/**\n * This function packs rectangles with MaxRects, as `packMaxRects` tells. It also gives the free rectangles at the end.\n * The tests read them. The package root does not export this function.\n */\nexport function runMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options: MaxRectsOptions = {}): MaxRectsRun<T> {\n const rule = options.rule ?? \"bssf\";\n if (!(MAXRECTS_RULES as readonly string[]).includes(rule)) throw new RangeError(`The rule of maxrects is one of ${MAXRECTS_RULES.join(\", \")}, not \"${String(rule)}\".`);\n const turned = options.turned;\n if (turned !== undefined) {\n for (const r of rects) if (turned.has(r)) r.size.set(r.size.y, r.size.x);\n turned.clear();\n }\n for (const r of rects) if (r.locked) r.wasPacked = true;\n\n const W = outer.size.x;\n if (!(W > 0)) return { outer, free: [] };\n const ox = outer.position.x;\n const oy = outer.position.y;\n const fixed = outer.fixedSize;\n const space = options.space;\n const parts = space === undefined ? undefined : spaceParts(space);\n const turnable = options.turnable;\n const sorted = rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\")).filter((r) => !r.wasPacked && r.size.x > 0 && r.size.y > 0);\n\n // The smallest width and height of the boxes. A turnable box counts its short side for the two. A free rectangle with\n // less room has no use, thus the list does not keep it.\n let minW = Infinity;\n let minH = Infinity;\n let heights = 0;\n for (const r of sorted) {\n const turns = turnable?.has(r) === true;\n const short = Math.min(r.size.x, r.size.y);\n minW = Math.min(minW, turns ? short : r.size.x);\n minH = Math.min(minH, turns ? short : r.size.y);\n heights += turns ? Math.max(r.size.x, r.size.y) : r.size.y;\n }\n\n // The rectangle holes: the holes of the space, or the locked rectangles. The bands of another space hold its holes.\n const holes: Box[] = [];\n if (parts !== undefined) for (const h of parts.holes) holes.push({ x0: h.x - ox, y0: h.y - oy, x1: h.x + h.w - ox, y1: h.y + h.h - oy });\n else if (space === undefined || space.plain) {\n for (const r of rects) if (r.locked) holes.push({ x0: r.position.x - ox, y0: r.position.y - oy, x1: r.right() - ox, y1: r.bottom() - oy });\n }\n\n // A free height gets room below each obstacle for each box. The content gives the height at the end.\n let floor = parts?.bottom ?? 0;\n for (const h of holes) floor = Math.max(floor, h.y1);\n const H = fixed ? outer.size.y : floor + heights;\n const walls: Box[] = [];\n for (const h of holes) {\n const wall = { x0: Math.max(0, h.x0), y0: Math.max(0, h.y0), x1: Math.min(W, h.x1), y1: Math.min(H, h.y1) };\n if (wall.x1 > wall.x0 && wall.y1 > wall.y0) walls.push(wall);\n }\n if (space !== undefined && !space.plain) {\n const top = parts === undefined ? H : fixed ? H : Math.min(H, parts.bottom);\n if (top > 0) {\n const bandHeight = options.bandHeight ?? top / MAXRECTS_BANDS;\n if (!(bandHeight > 0)) throw new RangeError(`The band height of maxrects is more than 0, not ${String(bandHeight)}.`);\n const query = parts === undefined ? (y0: number, y1: number) => space.band(y0 + oy, y1 + oy) : (y0: number, y1: number) => parts.bare(y0 + oy, y1 + oy);\n const shifted = (y0: number, y1: number): FreeSpan[] => query(y0, y1).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n walls.push(...bandWalls(shifted, W, top, bandHeight, parts === undefined ? 0 : Math.max(0, -parts.d), fixed ? H : Infinity));\n }\n }\n\n let free: Box[] = [{ x0: 0, y0: 0, x1: W, y1: H }];\n for (const wall of walls) free = cut(free, wall, minW, minH).free;\n\n const cp = rule === \"cp\";\n const vertical: Edges = new Map();\n const horizontal: Edges = new Map();\n const mark = (b: Box): void => {\n if (!cp) return;\n addEdge(vertical, b.x0, b.y0, b.y1);\n addEdge(vertical, b.x1, b.y0, b.y1);\n addEdge(horizontal, b.y0, b.x0, b.x1);\n addEdge(horizontal, b.y1, b.x0, b.x1);\n };\n for (const wall of walls) mark(wall);\n const contact = (x: number, y: number, w: number, h: number): number => {\n let sum = 0;\n if (x === 0) sum += h;\n if (x + w === W) sum += h;\n if (y === 0) sum += w;\n if (fixed && y + h === H) sum += w;\n return sum + touch(vertical, x, y, y + h) + touch(vertical, x + w, y, y + h) + touch(horizontal, y, x, x + w) + touch(horizontal, y + h, x, x + w);\n };\n // A space that is not plain checks each place, because the bands only approximate the outline\n const check = space !== undefined && !space.plain;\n let bottom = 0;\n for (const wall of walls) bottom = Math.max(bottom, wall.y1);\n\n for (const rect of sorted) {\n const w = rect.size.x;\n const h = rect.size.y;\n const turns = turnable?.has(rect) === true && w !== h;\n const banned = new Set<number>();\n let best: Choice | undefined;\n let low: Choice | undefined;\n for (;;) {\n best = undefined;\n low = undefined;\n for (let i = 0; i < free.length; i++) {\n const f = free[i]!;\n for (let t = 0; t < (turns ? 2 : 1); t++) {\n if (banned.has(2 * i + t)) continue;\n const bw = t === 1 ? h : w;\n const bh = t === 1 ? w : h;\n if (f.x0 + bw > f.x1 || f.y0 + bh > f.y1) continue;\n const lw = f.x1 - f.x0 - bw;\n const lh = f.y1 - f.y0 - bh;\n let s1: number;\n let s2: number;\n switch (rule) {\n case \"bssf\":\n s1 = Math.min(lw, lh);\n s2 = Math.max(lw, lh);\n break;\n case \"blsf\":\n s1 = Math.max(lw, lh);\n s2 = Math.min(lw, lh);\n break;\n case \"baf\":\n s1 = (f.x1 - f.x0) * (f.y1 - f.y0) - bw * bh;\n s2 = Math.min(lw, lh);\n break;\n case \"bl\":\n s1 = f.y0 + bh;\n s2 = f.x0;\n break;\n case \"cp\":\n s1 = -contact(f.x0, f.y0, bw, bh);\n s2 = f.y0 + bh;\n break;\n }\n const c: Choice = { index: i, turn: t === 1, x: f.x0, y: f.y0, w: bw, h: bh, s1, s2 };\n if (best === undefined || s1 < best.s1 || (s1 === best.s1 && (s2 < best.s2 || (s2 === best.s2 && (c.y < best.y || (c.y === best.y && c.x < best.x)))))) best = c;\n const ly = f.y0 + bh;\n if (low === undefined || ly < low.s1 || (ly === low.s1 && f.x0 < low.s2)) low = { ...c, s1: ly, s2: f.x0 };\n }\n }\n if (best === undefined || !check || space.fits({ x: best.x + ox, y: best.y + oy, w: best.w, h: best.h })) break;\n banned.add(2 * best.index + (best.turn ? 1 : 0));\n }\n\n let place: Box;\n if (best !== undefined) {\n place = { x0: best.x, y0: best.y, x1: best.x + best.w, y1: best.y + best.h };\n if (rule !== \"bl\" && low !== undefined && (low.x !== best.x || low.y !== best.y || low.turn !== best.turn)) countMove(MOVES[rule]);\n if (best.turn) {\n rect.size.set(best.w, best.h);\n turned?.add(rect);\n }\n } else {\n // No free rectangle has room. A fixed size leaves the box out. A free height puts it under all others, at the left edge.\n if (fixed) continue;\n place = { x0: 0, y0: bottom, x1: w, y1: bottom + h };\n }\n rect.position.set(place.x0 + ox, place.y0 + oy);\n rect.wasPacked = true;\n bottom = Math.max(bottom, place.y1);\n const result = cut(free, { x0: place.x0, y0: place.y0, x1: Math.min(W, place.x1), y1: place.y1 }, minW, minH);\n free = result.free;\n if (result.hits >= 2) countMove(MOVES.split);\n mark(place);\n if (!fixed) outer.size.y = Math.max(outer.size.y, place.y1);\n }\n return { outer, free: free.map((f) => ({ x: f.x0 + ox, y: f.y0 + oy, w: f.x1 - f.x0, h: f.y1 - f.y0 })) };\n}\n\n/**\n * This function packs rectangles into an outer rectangle with MaxRects of Jylänki (2010). It keeps the list of the maximal\n * free rectangles, and it does not change the width of the outer rectangle.\n *\n * - Each box goes to the top-left corner of the free rectangle that `options.rule` chooses. `MAXRECTS_RULES` tells the rules.\n * - A tie goes to the higher place, then to the place on the left, then to the first free rectangle of the list.\n * - A `locked` rectangle keeps its position, and the free rectangles go around it.\n * - With a space that is not plain, the free rectangles start from bands of the outline. `MaxRectsOptions` tells the bands.\n * - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a box that does not fit\n * is not packed: its `wasPacked` stays `false`.\n * - The default sort order is `height-desc`. The order of the array of the caller stays.\n */\nexport function packMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options: MaxRectsOptions = {}): Rect<T> {\n return runMaxRects(rects, outer, options).outer;\n}\n","import { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport { firstFit, type FreeSpace, type FreeSpan } from \"./space.ts\";\n\n/**\n * The rule of a shelf packing to choose the shelf of a rectangle. `packShelf` tells each rule.\n *\n * - `next`: only the open shelf, the last shelf that the packing opened.\n * - `first`: the first shelf from the top where the rectangle fits.\n * - `best`: the shelf with the least height left over above the rectangle.\n */\nexport type ShelfFit = \"next\" | \"first\" | \"best\";\n\n/** This constant lists each shelf fit. */\nexport const SHELF_FITS: readonly ShelfFit[] = [\"next\", \"first\", \"best\"];\n\n/** The options of `packShelf` */\nexport interface ShelfOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the packer uses only the\n * outer rectangle and the locked rectangles.\n */\n space?: FreeSpace;\n /**\n * The rule to choose a shelf. Without it, `packShelf` packs as in 0.2.3. With it, `packShelf` uses its own shelves in\n * each container shape, and it stacks rectangles in the strips above the shorter rectangles.\n */\n fit?: ShelfFit;\n}\n\n/** An obstacle in the coordinates of the outer rectangle */\ninterface Box {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\n/**\n * This function gives the first x from `start` where a rectangle of width `w` crosses no obstacle in the band from\n * `top` to `bottom`.\n */\nfunction firstFreeX(obstacles: readonly Box[], start: number, w: number, top: number, bottom: number): number {\n let x = start;\n let moved = true;\n while (moved) {\n moved = false;\n for (const o of obstacles) {\n if (o.top < bottom && top < o.bottom && o.left < x + w && x < o.right) {\n x = o.right;\n moved = true;\n }\n }\n }\n return x;\n}\n\n/** This function gives the lowest bottom edge of the obstacles in the band from `top` to `bottom`, under `top`. */\nfunction nextTop(obstacles: readonly Box[], top: number, bottom: number): number {\n let next = Infinity;\n for (const o of obstacles) if (o.top < bottom && top < o.bottom && o.bottom > top) next = Math.min(next, o.bottom);\n return next;\n}\n\n/**\n * This function packs rectangles into shelves: rows that it fills left to right in the sort order, and does not fill\n * again. It goes around each `locked` rectangle. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - With the sort order `input`, the rows read in the order of the array: left to right, and top to bottom.\n * - With `height-desc` (the default), it is the classic Next-Fit Decreasing Height packing.\n * - A rectangle goes to the first x in the row where it crosses no locked rectangle. If no such x is in the width,\n * a new row starts under the current row.\n * - A rectangle wider than the outer rectangle goes on its own row, at the left edge, and overflows.\n * - It does not change the width. Without `fixedSize`, the height grows to the content. With `fixedSize`, a\n * rectangle that does not fit is not packed: its `wasPacked` stays `false`.\n * - With a space that is not plain, `packRowsInSpace` packs the rows into the outline of the space and around its holes.\n * - With `fit`, `packShelvesInSpace` packs the rectangles, in each container shape. A `fit` that is not in `SHELF_FITS` throws a `RangeError`.\n */\nexport function packShelf<T>(rects: Rect<T>[], outer: Rect<T>, options: ShelfOptions = {}): Rect<T> {\n if (options.fit !== undefined) return packShelvesInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.fit, options.space);\n if (options.space !== undefined && !options.space.plain) return packRowsInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.space);\n const width = outer.size.x;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - outer.position.x;\n const top = rect.position.y - outer.position.y;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n\n let rowTop = 0;\n let rowBottom = 0;\n let cursor = 0;\n let rowEmpty = true;\n\n for (const rect of rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\"))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n const overflows = w > width;\n if (overflows && outer.fixedSize) continue;\n\n // An overflowing rectangle starts a row of its own\n if (overflows && !rowEmpty) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n }\n\n let x = firstFreeX(obstacles, cursor, w, rowTop, rowTop + h);\n while (!overflows && x + w > width) {\n // Start a new row under the current one, or under the obstacles that block an empty row\n rowTop = rowEmpty ? nextTop(obstacles, rowTop, rowTop + h) : rowBottom;\n rowBottom = rowTop;\n cursor = 0;\n rowEmpty = true;\n x = firstFreeX(obstacles, cursor, w, rowTop, rowTop + h);\n }\n while (overflows && x !== 0) {\n rowTop = nextTop(obstacles, rowTop, rowTop + h);\n rowBottom = rowTop;\n x = firstFreeX(obstacles, 0, w, rowTop, rowTop + h);\n }\n\n if (outer.fixedSize && rowTop + h > outer.size.y) continue;\n\n // The move of a shelf: the rectangle joins an open shelf that a taller rectangle made\n if (!rowEmpty && rowTop + h < rowBottom) countMove(MOVES.shelf);\n rect.position.set(x + outer.position.x, rowTop + outer.position.y);\n rect.wasPacked = true;\n rowEmpty = false;\n cursor = x + w;\n rowBottom = Math.max(rowBottom, rowTop + h);\n contentBottom = Math.max(contentBottom, rowTop + h);\n if (overflows) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n }\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n\n/**\n * This function gives the first x from `start` where a rectangle of width `w` fits. There, it crosses no locked rectangle,\n * and it is in a free span of its band. It takes `firstFreeX` and `firstFit` in turn until they agree. It gives `Infinity` when no x fits.\n */\nfunction placeInBand(obstacles: readonly Box[], spans: readonly FreeSpan[], start: number, w: number, top: number, bottom: number): number {\n let x = start;\n for (;;) {\n const free = firstFreeX(obstacles, x, w, top, bottom);\n const fit = firstFit(spans, free, w);\n if (fit === free || !Number.isFinite(fit)) return fit;\n x = fit;\n }\n}\n\n/**\n * This function packs rectangles into rows inside a free space. `packShelf` and `packRows` use it when the space is not\n * plain. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - A rectangle goes to the first x from the row cursor where it fits in the space and crosses no locked rectangle.\n * - When it does not fit, a new row starts under the current row. An empty row steps down to `nextY` of the space.\n * - When the steps of an empty row find no place, the row goes back to its last top edge. Later rectangles can use it.\n * - A rectangle wider than the outer rectangle overflows. Without `fixedSize`, it goes on its own row at the left edge.\n */\nexport function packRowsInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, space: FreeSpace): Rect<T> {\n const width = outer.size.x;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const limit = outer.fixedSize ? outer.size.y : Infinity;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - ox;\n const top = rect.position.y - oy;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n // The x in the row, in the coordinates of the outer rectangle, or Infinity\n const place = (start: number, w: number, top: number, h: number): number => {\n const spans = space.band(top + oy, top + h + oy).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n return placeInBand(obstacles, spans, start, w, top, top + h);\n };\n\n let rowTop = 0;\n let rowBottom = 0;\n let cursor = 0;\n let rowEmpty = true;\n for (const rect of rects.toSorted(compareRects(order))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n if (w > width) {\n if (outer.fixedSize) continue;\n const top = rowEmpty ? rowTop : rowBottom;\n rect.position.set(ox, top + oy);\n rect.wasPacked = true;\n rowTop = top + h;\n rowBottom = rowTop;\n cursor = 0;\n rowEmpty = true;\n contentBottom = Math.max(contentBottom, top + h);\n continue;\n }\n\n let x = place(cursor, w, rowTop, h);\n if (!(x + w <= width) && !rowEmpty) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n x = place(0, w, rowTop, h);\n }\n // The steps of an empty row. They stay only when the rectangle finds a place.\n let top = rowTop;\n while (!(x + w <= width) && top + h <= limit) {\n const next = Math.min(space.nextY(top + oy, top + h + oy, w) - oy, nextTop(obstacles, top, top + h));\n if (!Number.isFinite(next)) break;\n top = next;\n x = place(0, w, top, h);\n }\n if (!(x + w <= width) || top + h > limit) continue;\n if (top !== rowTop) {\n rowTop = top;\n rowBottom = top;\n }\n\n rect.position.set(x + ox, rowTop + oy);\n rect.wasPacked = true;\n rowEmpty = false;\n cursor = x + w;\n rowBottom = Math.max(rowBottom, rowTop + h);\n contentBottom = Math.max(contentBottom, rowTop + h);\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n\n/** A shelf of `packShelvesInSpace`, in the coordinates of the outer rectangle. */\ninterface Shelf {\n /** The top edge of the shelf. */\n top: number;\n /** The height of the shelf: the height of its first rectangle. Only the last shelf grows. */\n height: number;\n /** The x after the last rectangle on the floor of the shelf. The value `Infinity` closes the shelf. */\n cursor: number;\n /** The strips above the rectangles on the floor. A later rectangle stacks in a strip. */\n strips: Strip[];\n}\n\n/** The free strip above a rectangle of a shelf: from `x` to `x + w`, and from `bottom` to the top edge of the next shelf. */\ninterface Strip {\n x: number;\n w: number;\n bottom: number;\n}\n\n/** A place for a rectangle on a shelf. `left` is the height of the shelf that stays free above the rectangle. */\ninterface Spot {\n shelf: Shelf;\n x: number;\n y: number;\n left: number;\n /** The strip of a stacked rectangle. A rectangle on the floor has no strip. */\n strip?: Strip;\n /** The value `true` when the rectangle is taller than the last shelf, and the shelf grows. */\n grow?: boolean;\n}\n\n/**\n * This function packs rectangles into shelves with a fit: `next`, `first` or `best`. `packShelf` uses it when its\n * options have a `fit`. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - A shelf opens at the bottom edge of the last shelf, at the first x where the rectangle fits in the free space.\n * When no x fits, the shelf steps down to `nextY` of the space, as an empty row of `packRowsInSpace` does.\n * - The first rectangle of a shelf sets its height. A rectangle goes on the floor of a shelf at its cursor, or into\n * the strip above a shorter rectangle of the shelf. The strip is the move `move.stack`.\n * - The fit `next` uses only the open shelf: the last shelf that the packing opened. The fit `first` uses the first\n * shelf from the top where the rectangle fits. The fit `best` uses the place with the least height left over.\n * - In a shelf, the rectangle takes the place with the least height left over. A tie goes to a strip, from left to right.\n * - When no shelf has a place, the last shelf grows for a taller rectangle, if it fits. Else a new shelf opens.\n * - A rectangle wider than the outer rectangle overflows. Without `fixedSize`, it goes on a closed shelf of its own at the left edge.\n * - Each place is in the free space and crosses no locked rectangle. Without a space, the outer rectangle and the\n * locked rectangles give the free space.\n */\nfunction packShelvesInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, fit: ShelfFit, space: FreeSpace | undefined): Rect<T> {\n if (!SHELF_FITS.includes(fit)) throw new RangeError(`The shelf fit \"${String(fit)}\" is not one of ${SHELF_FITS.join(\", \")}.`);\n const width = outer.size.x;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const limit = outer.fixedSize ? outer.size.y : Infinity;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - ox;\n const top = rect.position.y - oy;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n const whole: readonly FreeSpan[] = [{ start: 0, end: Infinity }];\n // The x in the band, in the coordinates of the outer rectangle, or Infinity\n const place = (start: number, w: number, top: number, h: number): number => {\n const spans = space === undefined ? whole : space.band(top + oy, top + h + oy).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n return placeInBand(obstacles, spans, start, w, top, top + h);\n };\n // The next top edge where the free spans change, or Infinity\n const stepDown = (top: number, w: number, h: number): number =>\n Math.min(space === undefined ? Infinity : space.nextY(top + oy, top + h + oy, w) - oy, nextTop(obstacles, top, top + h));\n\n // The places of a shelf that the sizes allow, by the height left over. A strip comes before the floor on a tie.\n const spotsOn = (shelf: Shelf, w: number, h: number, grow: boolean): Spot[] => {\n const ceiling = shelf.top + shelf.height;\n const spots: Spot[] = [];\n if (!grow) {\n for (const strip of shelf.strips) {\n if (w <= strip.w && strip.bottom + h <= ceiling) spots.push({ shelf, x: strip.x, y: strip.bottom, left: ceiling - strip.bottom - h, strip });\n }\n }\n const tall = grow ? h > shelf.height && shelf.top + h <= limit : h <= shelf.height;\n if (Number.isFinite(shelf.cursor) && tall) spots.push({ shelf, x: shelf.cursor, y: shelf.top, left: grow ? 0 : shelf.height - h, ...(grow ? { grow } : {}) });\n return spots.toSorted((a, b) => a.left - b.left);\n };\n // The place of a spot in the free space, or undefined. A rectangle on the floor can move right of the cursor.\n const verify = (spot: Spot, w: number, h: number): Spot | undefined => {\n const x = place(spot.x, w, spot.y, h);\n if (spot.strip !== undefined) return x === spot.x ? spot : undefined;\n return x + w <= width ? { ...spot, x } : undefined;\n };\n const firstOn = (shelf: Shelf, w: number, h: number): Spot | undefined => {\n for (const spot of spotsOn(shelf, w, h, false)) {\n const found = verify(spot, w, h);\n if (found !== undefined) return found;\n }\n return undefined;\n };\n\n const shelves: Shelf[] = [];\n for (const rect of rects.toSorted(compareRects(order))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n const open = shelves.at(-1);\n const floor = open === undefined ? 0 : open.top + open.height;\n\n if (w > width) {\n if (outer.fixedSize) continue;\n // An overflowing rectangle goes on a closed shelf of its own, under the locked rectangles at the left edge\n let top = floor;\n while (firstFreeX(obstacles, 0, w, top, top + h) !== 0) {\n const next = nextTop(obstacles, top, top + h);\n if (!Number.isFinite(next)) break;\n top = next;\n }\n rect.position.set(ox, top + oy);\n rect.wasPacked = true;\n shelves.push({ top, height: h, cursor: Infinity, strips: [] });\n contentBottom = Math.max(contentBottom, top + h);\n continue;\n }\n\n // Step 1: a shelf where the rectangle fits without growth\n let spot: Spot | undefined;\n let firstShelf: Shelf | undefined;\n if (fit === \"best\") {\n for (const s of shelves.flatMap((shelf) => spotsOn(shelf, w, h, false)).toSorted((a, b) => a.left - b.left)) {\n spot = verify(s, w, h);\n if (spot !== undefined) break;\n }\n if (spot !== undefined) firstShelf = shelves.find((shelf) => shelf === spot!.shelf || firstOn(shelf, w, h) !== undefined);\n } else {\n for (const shelf of fit === \"next\" ? shelves.slice(-1) : shelves) {\n spot = firstOn(shelf, w, h);\n if (spot !== undefined) break;\n }\n }\n // Step 2: the last shelf grows. Step 3: a new shelf opens under the last shelf.\n if (spot === undefined && open !== undefined) {\n const grown = spotsOn(open, w, h, true)[0];\n if (grown !== undefined) spot = verify(grown, w, h);\n }\n if (spot === undefined) {\n let top = floor;\n let x = place(0, w, top, h);\n while (!(x + w <= width) && top + h <= limit) {\n const next = stepDown(top, w, h);\n if (!Number.isFinite(next)) break;\n top = next;\n x = place(0, w, top, h);\n }\n if (!(x + w <= width) || top + h > limit) continue;\n const shelf: Shelf = { top, height: h, cursor: x, strips: [] };\n shelves.push(shelf);\n spot = { shelf, x, y: top, left: 0 };\n } else {\n if (spot.shelf !== open) countMove(MOVES.firstFit);\n if (firstShelf !== undefined && spot.shelf !== firstShelf) countMove(MOVES.bestFit);\n }\n\n const { shelf } = spot;\n rect.position.set(spot.x + ox, spot.y + oy);\n rect.wasPacked = true;\n if (spot.strip !== undefined) {\n countMove(MOVES.shelf);\n spot.strip.bottom = spot.y + h;\n } else {\n shelf.cursor = spot.x + w;\n shelf.strips.push({ x: spot.x, w, bottom: spot.y + h });\n if (spot.grow === true) shelf.height = h;\n }\n contentBottom = Math.max(contentBottom, spot.y + h);\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n","import { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport type { FreeSpace } from \"./space.ts\";\n\n/**\n * This function finds the lowest window of width `rw` on a skyline. For each `x` in `[0, width - rw]`, the height\n * of the window is the largest value of `skyline[x, x + rw)`. The first `x` with the smallest height wins. A\n * monotonic deque makes the search O(width) for one rectangle.\n *\n * With `limit`, a window is valid only when its height plus `rh` is not more than the smallest value of\n * `limit[x, x + rw)`. A second deque keeps that smallest value. No valid window gives the height `Infinity`.\n */\nexport function lowestWindow(skyline: ArrayLike<number>, width: number, rw: number, limit?: ArrayLike<number>, rh = 0): { x: number; y: number } {\n const { x, y } = findWindow(skyline, width, rw, limit, rh);\n return { x, y };\n}\n\n/** The lowest window of `findWindow`, and `first`: the x of the leftmost valid window, or `-1` */\ninterface Window {\n x: number;\n y: number;\n first: number;\n}\n\n/** This function is `lowestWindow`, and it also gives the x of the leftmost valid window. */\nfunction findWindow(skyline: ArrayLike<number>, width: number, rw: number, limit?: ArrayLike<number>, rh = 0): Window {\n if (limit !== undefined) return lowestLimitedWindow(skyline, limit, width, rw, rh);\n const deque = new Int32Array(width);\n let head = 0;\n let tail = 0;\n let bestX = 0;\n let bestY = Infinity;\n for (let i = 0; i < width; i++) {\n while (tail > head && skyline[deque[tail - 1]!]! <= skyline[i]!) tail--;\n deque[tail++] = i;\n if (deque[head]! <= i - rw) head++;\n if (i >= rw - 1) {\n const max = skyline[deque[head]!]!;\n if (max < bestY) {\n bestY = max;\n bestX = i - rw + 1;\n }\n }\n }\n return { x: bestX, y: bestY, first: width >= rw ? 0 : -1 };\n}\n\n/** This function counts the move of the skyline: a window that is lower than the leftmost valid window. */\nfunction countWindow(w: Window): void {\n if (Number.isFinite(w.y) && w.first >= 0 && w.x !== w.first) countMove(MOVES.skyline);\n}\n\n/** This function is `lowestWindow` with a limit for each cell. */\nfunction lowestLimitedWindow(skyline: ArrayLike<number>, limit: ArrayLike<number>, width: number, rw: number, rh: number): Window {\n const high = new Int32Array(width);\n const low = new Int32Array(width);\n let hh = 0;\n let ht = 0;\n let lh = 0;\n let lt = 0;\n let bestX = 0;\n let bestY = Infinity;\n let first = -1;\n for (let i = 0; i < width; i++) {\n while (ht > hh && skyline[high[ht - 1]!]! <= skyline[i]!) ht--;\n high[ht++] = i;\n if (high[hh]! <= i - rw) hh++;\n while (lt > lh && limit[low[lt - 1]!]! >= limit[i]!) lt--;\n low[lt++] = i;\n if (low[lh]! <= i - rw) lh++;\n if (i >= rw - 1) {\n const max = skyline[high[hh]!]!;\n const valid = max + rh <= limit[low[lh]!]!;\n if (valid && first < 0) first = i - rw + 1;\n if (max < bestY && valid) {\n bestY = max;\n bestX = i - rw + 1;\n }\n }\n }\n return { x: bestX, y: bestY, first };\n}\n\n/** The options of `packSkyline` */\nexport interface SkylineOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the skyline uses only the\n * outer rectangle and the locked rectangles.\n */\n space?: FreeSpace;\n}\n\n/**\n * This function packs rectangles into an outer rectangle with a skyline. It puts each rectangle in the lowest place\n * where it fits, and it does not change the width of the outer rectangle.\n *\n * - A `locked` rectangle keeps its position. The skyline starts at its bottom edge across its width, thus the other\n * rectangles go under it. The space above it stays empty, because a skyline has no holes.\n * - The skyline has a cell for each whole unit of the width. A rectangle that needs more cells than the outer\n * rectangle has goes under all other rectangles, at the left edge.\n * - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a rectangle that\n * does not fit is not packed: its `wasPacked` stays `false`.\n * - The default sort order is `height-desc`. The order of the array of the caller stays.\n * - With a space that is not plain, each cell gets its start and its limit from `column` of the space. The space holds\n * the obstacles and the locked items, thus the locked rectangles only keep their positions.\n */\nexport function packSkyline<T>(rects: Rect<T>[], outer: Rect<T>, options: SkylineOptions = {}): Rect<T> {\n if (options.space !== undefined && !options.space.plain) return packSkylineInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.space);\n // a cell for each whole unit of the width: a rectangle never goes past the right edge\n const width = Math.floor(outer.size.x);\n if (width <= 0) return outer;\n const skyline = new Float64Array(width);\n\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const x0 = Math.max(0, Math.floor(rect.position.x - outer.position.x));\n const x1 = Math.min(width, Math.ceil(rect.position.x - outer.position.x + rect.size.x));\n const bottom = rect.position.y - outer.position.y + rect.size.y;\n for (let i = x0; i < x1; i++) skyline[i] = Math.max(skyline[i]!, bottom);\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, bottom);\n }\n\n for (const rect of rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\"))) {\n if (rect.wasPacked) continue;\n const rw = Math.ceil(rect.size.x);\n const rh = rect.size.y;\n if (rw <= 0 || rh <= 0) continue;\n\n let x: number;\n let y: number;\n if (rw > width) {\n if (outer.fixedSize) continue;\n x = 0;\n y = 0;\n for (let i = 0; i < width; i++) if (skyline[i]! > y) y = skyline[i]!;\n } else {\n const found = findWindow(skyline, width, rw);\n ({ x, y } = found);\n if (outer.fixedSize && y + rh > outer.size.y) continue;\n countWindow(found);\n }\n\n rect.position.set(x + outer.position.x, y + outer.position.y);\n rect.wasPacked = true;\n const top = y + rh;\n for (let i = x; i < Math.min(width, x + rw); i++) skyline[i] = top;\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, top);\n }\n return outer;\n}\n\n/**\n * This function packs rectangles with a skyline in a free space. Each cell has a free range: the skyline is its start,\n * and `limit` is its end. A cell with less room than the lowest rectangle left goes to its next free range.\n */\nfunction packSkylineInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, space: FreeSpace): Rect<T> {\n const width = Math.floor(outer.size.x);\n if (width <= 0) return outer;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const end = outer.fixedSize ? outer.size.y : Infinity;\n for (const rect of rects) if (rect.locked) rect.wasPacked = true;\n\n // The free range of a cell from a y, in the coordinates of the outer rectangle\n const rangeOf = (i: number, from: number): [number, number] => {\n const r = space.column(ox + i, ox + i + 1, from + oy);\n if (r === undefined) return [Infinity, -Infinity];\n return [r.start - oy, Math.min(r.end - oy, end)];\n };\n const skyline = new Float64Array(width);\n const limit = new Float64Array(width);\n for (let i = 0; i < width; i++) [skyline[i], limit[i]] = rangeOf(i, 0);\n\n const sorted = rects.toSorted(compareRects(order)).filter((r) => !r.wasPacked && Math.ceil(r.size.x) > 0 && r.size.y > 0);\n // The lowest height of the rectangles from each index of the sorted list to its end\n const lowest = new Float64Array(sorted.length + 1).fill(Infinity);\n for (let k = sorted.length - 1; k >= 0; k--) lowest[k] = Math.min(lowest[k + 1]!, sorted[k]!.size.y);\n const advance = (k: number): void => {\n const need = lowest[k]!;\n if (!Number.isFinite(need)) return;\n for (let i = 0; i < width; i++) {\n while (Number.isFinite(limit[i]!) && limit[i]! - skyline[i]! < need && limit[i]! < end) [skyline[i], limit[i]] = rangeOf(i, limit[i]!);\n }\n };\n\n for (const [k, rect] of sorted.entries()) {\n advance(k);\n const rw = Math.ceil(rect.size.x);\n const rh = rect.size.y;\n let x: number;\n let y: number;\n if (rw > width) {\n if (outer.fixedSize) continue;\n x = 0;\n y = 0;\n for (let i = 0; i < width; i++) if (Number.isFinite(skyline[i]!) && skyline[i]! > y) y = skyline[i]!;\n rect.position.set(x + ox, y + oy);\n rect.wasPacked = true;\n outer.size.y = Math.max(outer.size.y, y + rh);\n continue;\n }\n let found = findWindow(skyline, width, rw, limit, rh);\n ({ x, y } = found);\n let sky: Float64Array = skyline;\n let lim: Float64Array = limit;\n if (!Number.isFinite(y)) {\n // The second try: each cell goes to its first free range with room for this rectangle\n sky = skyline.slice();\n lim = limit.slice();\n for (let i = 0; i < width; i++) {\n while (Number.isFinite(lim[i]!) && lim[i]! - sky[i]! < rh && lim[i]! < end) [sky[i], lim[i]] = rangeOf(i, lim[i]!);\n }\n found = findWindow(sky, width, rw, lim, rh);\n ({ x, y } = found);\n if (!Number.isFinite(y)) continue;\n }\n\n countWindow(found);\n rect.position.set(x + ox, y + oy);\n rect.wasPacked = true;\n const top = y + rh;\n for (let i = x; i < x + rw; i++) {\n skyline[i] = top;\n limit[i] = lim[i]!;\n }\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, top);\n }\n return outer;\n}\n","import { packMaxRects, type MaxRectsRule } from \"./maxrects.ts\";\nimport { clearMoves, countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport { Rect } from \"./rect.ts\";\nimport { packRowsInSpace, packShelf, type ShelfFit } from \"./shelf.ts\";\nimport { packSkyline } from \"./skyline.ts\";\nimport type { FreeSpace } from \"./space.ts\";\nimport { Vector } from \"./vector.ts\";\n\n/** The options of `pack` and `packRows` */\nexport interface PackOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. With a space that is not plain, each strategy packs into\n * the outline of the container and around its holes. The rows of `packRows` also go around the locked rectangles.\n */\n space?: FreeSpace;\n}\n\n/** The options of `pack` */\nexport interface PackLayoutOptions extends PackOptions {\n /**\n * The packing: `rows` (the default), `skyline`, `shelf` or `maxrects`. `skyline`, `shelf` and `maxrects` pack around\n * locked rectangles. Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.\n */\n strategy?: \"rows\" | \"skyline\" | \"shelf\" | \"maxrects\";\n /** The rule of `shelf` to choose a shelf. Only `shelf` reads it. `ShelfOptions` tells it. Without it, `shelf` packs as in 0.2.3. */\n fit?: ShelfFit;\n /** The rule of `maxrects` to choose a free rectangle. Only `maxrects` reads it. The default is `bssf`. */\n rule?: MaxRectsRule;\n /** The largest height of a band of `maxrects` in a space that is not plain. Only `maxrects` reads it. `MaxRectsOptions` tells it. */\n bandHeight?: number;\n /** The rectangles that `maxrects` can turn by 90 degrees. Only `maxrects` reads it. */\n turnable?: ReadonlySet<unknown>;\n /** The rectangles that `maxrects` turned. Only `maxrects` reads it. `MaxRectsOptions` tells it. */\n turned?: Set<unknown>;\n}\n\n/** The depth of the calls of `packInto`. Only the outer gap fill counts its rectangles as moves. */\nlet fillDepth = 0;\n\nfunction packInto<T>(rects: Rect<T>[], region: Rect<T>, offset: Vector, order: SortOrder): void {\n const unpacked = Rect.unpacked(rects);\n fillDepth++;\n try {\n pack(unpacked, region, { sortOrder: order });\n } finally {\n fillDepth--;\n }\n const placed = Rect.packed(unpacked);\n if (fillDepth === 0) countMove(MOVES.rows, placed.length);\n for (const r of placed) r.translateBy(offset);\n}\n\nfunction packRow<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder): boolean {\n const row: Rect<T>[] = [];\n // toSorted gives a sorted copy, thus the order of the array of the caller stays\n const byHeight = rects.toSorted(compareRects(order));\n // A gap fill puts a later rect before an earlier one, thus the order `input` fills no gaps\n const fillGaps = order !== \"input\";\n\n const rowRect = new Rect<T>();\n rowRect.size.set(outer.size.x, 0);\n\n for (const rect of byHeight) {\n if (rect.wasPacked) continue;\n\n if (rect.size.x > rowRect.size.x) {\n if (outer.fixedSize && rect.size.x > outer.size.x) continue;\n\n const outerLeft = new Rect<T>();\n outerLeft.position.setTo(rowRect.position);\n outerLeft.size.set(outer.size.x - rowRect.position.x, rowRect.size.y);\n outerLeft.fixedSize = true;\n if (fillGaps) packInto(rects, outerLeft, outer.position, order);\n\n rowRect.position.set(0, rowRect.bottom());\n rowRect.size.set(outer.size.x, 0);\n row.length = 0;\n }\n\n if (rowRect.position.y + rect.size.y > outer.size.y) {\n if (outer.fixedSize) continue;\n outer.size.y += rect.size.y;\n if (!outer.fixedWidth && !outer.size.x) outer.size.x = rect.size.x;\n Rect.resetPacked(rects);\n return false;\n }\n\n row.push(rect);\n rect.position.setTo(rowRect.position.add(outer.position));\n rowRect.shrinkLeft(rect.size.x);\n rect.wasPacked = true;\n\n if (rect.size.y > rowRect.size.y) rowRect.size.y = rect.size.y;\n\n if (fillGaps && row.length > 1) {\n const rectInRow = row[row.length - 1]!;\n const outerLeft = new Rect<T>();\n // The position of the region is relative to the outer rectangle, as packInto adds the position of the outer rectangle\n outerLeft.position.set(rectInRow.position.x - outer.position.x, rectInRow.bottom() - outer.position.y);\n outerLeft.size.set(rectInRow.size.x, rowRect.size.y - rectInRow.size.y);\n outerLeft.fixedWidth = true;\n outerLeft.fixedSize = true;\n packInto(rects, outerLeft, outer.position, order);\n }\n }\n return true;\n}\n\n/**\n * This function packs rectangles into an outer rectangle of a given width with a guillotine row packing. It does\n * not change the width. Without `fixedSize`, the height grows until all rectangles fit. A `locked` rectangle keeps\n * its position, but the rows do not go around it. `pack` sets the width first and then uses this function.\n *\n * With `options.space`, the rows go around the locked rectangles and the holes of the space, inside its outline. A space\n * that is plain, with no locked rectangle, gives the rows of 0.1.\n */\nexport function packRows<T>(rects: Rect<T>[], outer: Rect<T>, options: PackOptions = {}): Rect<T> {\n const order = options.sortOrder ?? \"height-desc\";\n const space = options.space;\n if (space !== undefined && (!space.plain || rects.some((r) => r.locked))) return packRowsInSpace(rects, outer, order, space);\n for (const r of rects) if (r.locked) r.wasPacked = true;\n // A row that does not fit grows the height and starts again, thus the gap fills of the try before do not count\n while (!packRow(rects, outer, order)) if (fillDepth === 0) clearMoves(MOVES.rows);\n return outer;\n}\n\n/**\n * This function packs rectangles into an outer rectangle with a guillotine row packing. It sets the position\n * of each rectangle and the size of the outer rectangle, and it gives the outer rectangle.\n *\n * - Without fixed sizes, the outer rectangle starts with a width of 1.5 times the square root of the total area.\n * This width is not less than the width of the widest rectangle. The height grows until all rectangles fit.\n * - With `fixedWidth`, the width stays. A rectangle wider than that width goes on its own row and overflows.\n * - With `fixedSize`, a rectangle that does not fit is not packed: its `wasPacked` stays `false`.\n * - `options.strategy` selects `packRows` (the default), `packSkyline`, `packShelf` or `packMaxRects` after the width is set.\n */\nexport function pack<T>(rects: Rect<T>[], outer: Rect<T> = new Rect(), options: PackLayoutOptions = {}): Rect<T> {\n let totalArea = 0;\n let widest = 0;\n let minX = rects.length > 0 ? Infinity : 0;\n let minY = rects.length > 0 ? Infinity : 0;\n for (const r of rects) {\n totalArea += r.area();\n widest = Math.max(widest, r.size.x);\n minX = Math.min(minX, r.size.x);\n minY = Math.min(minY, r.size.y);\n }\n\n const idealWidth = outer.fixedWidth\n ? outer.size.x\n : Math.max(widest, Math.min(1.5 * Math.sqrt(totalArea), outer.size.x || Infinity));\n\n const ideal = Vector.of(idealWidth).clamp(new Vector(minX, minY), Vector.Infinity);\n\n // A fixed width stays, also when a rectangle is wider: that rectangle overflows\n if (!outer.fixedSize) outer.size.setTo(outer.fixedWidth ? new Vector(outer.size.x, ideal.y) : ideal);\n if (options.strategy === \"skyline\") packSkyline(rects, outer, options);\n else if (options.strategy === \"shelf\") packShelf(rects, outer, options);\n else if (options.strategy === \"maxrects\") packMaxRects(rects, outer, options);\n else packRows(rects, outer, options);\n\n if (!outer.fixedSize) {\n const contentRight = Rect.maxRight(rects);\n if (!outer.size.x) outer.size.x = contentRight;\n else if (!outer.fixedWidth) outer.size.x = Math.min(contentRight, outer.size.x);\n outer.size.y = Rect.maxBottom(rects);\n }\n\n return outer;\n}\n","import { clearMoves } from \"./moves.ts\";\nimport { pack, type PackLayoutOptions } from \"./pack.ts\";\nimport { Rect } from \"./rect.ts\";\n\n/** The options of `packFree` */\nexport interface FreeWidthOptions extends PackLayoutOptions {\n /** The target aspect: the width divided by the height. The default is 1, a square. */\n aspect?: number;\n /**\n * The weight of the aspect error in the objective. The objective is the area times `1 + aspectWeight * aspectError`.\n * The default is 1. With 0, only the area counts.\n */\n aspectWeight?: number;\n /** The number of widths that the first pass tries. The default is 48. */\n samples?: number;\n}\n\n/** One width that `packFree` tried, and its result */\nexport interface FreeWidthTry {\n /** The width of the container for this try */\n width: number;\n /** The width of the content: the right edge of the rectangles */\n contentWidth: number;\n /** The height of the content */\n contentHeight: number;\n /** The objective of this try. Lower is better. */\n objective: number;\n}\n\n/** The result of `packFree` */\nexport interface FreeWidthResult<T> {\n /** The outer rectangle, with the size of the content */\n outer: Rect<T>;\n /** The area of the bounding box of the content */\n area: number;\n /** The area of the rectangles divided by the area of the bounding box */\n fill: number;\n /** The aspect of the bounding box: the width divided by the height */\n aspect: number;\n /** The distance from the target aspect: the absolute value of `log(aspect) - log(target)` */\n aspectError: number;\n /** The objective of the chosen width. Lower is better. */\n objective: number;\n /** Each width that the search tried, in the order of the search */\n tried: FreeWidthTry[];\n}\n\n/** This function gives the distance between an aspect and a target aspect on a log scale. */\nexport function aspectError(width: number, height: number, target = 1): number {\n if (!(width > 0 && height > 0 && target > 0)) return Infinity;\n return Math.abs(Math.log(width / height) - Math.log(target));\n}\n\n/**\n * This function packs rectangles with a free width. It tries many widths with the strategy of `options`, and keeps\n * the width with the lowest objective: the area of the bounding box times `1 + aspectWeight * aspectError`.\n *\n * - The first pass tries `samples` widths on a log scale, from the widest rectangle to the width of one row.\n * - The second pass tries the widths between the two neighbours of the best width of the first pass.\n * - The search is deterministic: the same input gives the same widths and the same result.\n * - A `locked` rectangle keeps its position. The width is not less than its right edge.\n * - Each strategy of `pack` works with this function, because it only changes the width.\n */\nexport function packFree<T>(rects: Rect<T>[], outer: Rect<T> = new Rect(), options: FreeWidthOptions = {}): FreeWidthResult<T> {\n const target = options.aspect ?? 1;\n const weight = options.aspectWeight ?? 1;\n const samples = Math.max(2, Math.floor(options.samples ?? 48));\n const ox = outer.position.x;\n const oy = outer.position.y;\n\n let itemArea = 0;\n let minWidth = 0;\n let rowWidth = 0;\n for (const r of rects) {\n if (r.locked) {\n minWidth = Math.max(minWidth, r.right() - ox);\n continue;\n }\n if (!(r.size.x > 0 && r.size.y > 0)) continue;\n itemArea += r.area();\n minWidth = Math.max(minWidth, r.size.x);\n rowWidth += r.size.x;\n }\n for (const r of rects) if (r.locked) itemArea += r.area();\n const maxWidth = Math.max(minWidth, rowWidth);\n\n const tried: FreeWidthTry[] = [];\n const run = (width: number): FreeWidthTry => {\n // The counts of the moves come from the last run: the run with the best width\n clearMoves();\n Rect.resetPacked(rects);\n const box = new Rect<T>();\n box.position.setTo(outer.position);\n box.size.set(width, 0);\n box.fixedWidth = true;\n pack(rects, box, options);\n const placed = Rect.packed(rects);\n const contentWidth = Math.max(0, Rect.maxRight(placed) - ox);\n const contentHeight = Math.max(0, Rect.maxBottom(placed) - oy);\n const area = contentWidth * contentHeight;\n const objective = area > 0 ? area * (1 + weight * aspectError(contentWidth, contentHeight, target)) : 0;\n const t = { width, contentWidth, contentHeight, objective };\n tried.push(t);\n return t;\n };\n\n // The first pass: widths on a log scale. Each width is a whole number when the sizes are whole numbers.\n const widths: number[] = [];\n if (maxWidth > 0) {\n const ratio = maxWidth / minWidth;\n for (let i = 0; i < samples; i++) {\n const w = minWidth * ratio ** (i / (samples - 1));\n const rounded = i === samples - 1 ? maxWidth : Math.max(minWidth, Math.round(w));\n if (widths.at(-1) !== rounded) widths.push(rounded);\n }\n }\n let best: FreeWidthTry | undefined = undefined;\n let bestIndex = 0;\n for (const [i, w] of widths.entries()) {\n const t = run(w);\n if (best === undefined || t.objective < best.objective) {\n best = t;\n bestIndex = i;\n }\n }\n\n // The second pass: the widths between the two neighbours of the best width\n if (widths.length > 2) {\n const low = widths[Math.max(0, bestIndex - 1)]!;\n const high = widths[Math.min(widths.length - 1, bestIndex + 1)]!;\n const steps = Math.min(Math.floor(samples / 2), Math.max(0, Math.round(high - low) - 1));\n for (let i = 1; i <= steps; i++) {\n const w = Math.round(low + ((high - low) * i) / (steps + 1));\n if (widths.includes(w)) continue;\n const t = run(w);\n if (best === undefined || t.objective < best.objective) best = t;\n }\n }\n\n // The last run packs with the best width, so the positions of the rectangles are those of the best width\n const chosen = best === undefined ? undefined : run(best.width);\n tried.pop();\n const w = chosen?.contentWidth ?? 0;\n const h = chosen?.contentHeight ?? 0;\n if (!outer.fixedSize) outer.size.set(w, h);\n const area = w * h;\n return {\n outer,\n area,\n fill: area > 0 ? itemArea / area : 0,\n aspect: h > 0 ? w / h : 0,\n aspectError: aspectError(w, h, target),\n objective: chosen?.objective ?? 0,\n tried,\n };\n}\n","import type { Rect } from \"./rect.ts\";\n\n/** The options of `pushCascade`. */\nexport interface PushOptions {\n /** The space between a shoved rectangle and the rectangle that shoves it. The default is 8. */\n gap?: number;\n /** The most shoves. The default is eight for each rectangle. The cascade stops at this limit. */\n maxShoves?: number;\n}\n\n/** A direction of a shove: an axis and a sign. */\ninterface Direction {\n readonly axis: \"x\" | \"y\";\n readonly sign: 1 | -1;\n}\n\n/** This function gives the overlap of two rectangles on each axis. A value of 0 or less is no overlap. */\nfunction overlapOf(a: Rect, b: Rect): { x: number; y: number } {\n return {\n x: Math.min(a.right(), b.right()) - Math.max(a.position.x, b.position.x),\n y: Math.min(a.bottom(), b.bottom()) - Math.max(a.position.y, b.position.y),\n };\n}\n\n/**\n * This function gives the direction of a first shove. The axis has the smaller overlap. The sign points away from the\n * center of the pusher. When that shove crosses 0, the sign is positive.\n */\nfunction firstDirection(pusher: Rect, r: Rect, gap: number): Direction {\n const overlap = overlapOf(pusher, r);\n if (overlap.x < overlap.y) {\n const back = r.position.x + r.size.x / 2 < pusher.position.x + pusher.size.x / 2 && pusher.position.x - r.size.x - gap >= 0;\n return { axis: \"x\", sign: back ? -1 : 1 };\n }\n const back = r.position.y + r.size.y / 2 < pusher.position.y + pusher.size.y / 2 && pusher.position.y - r.size.y - gap >= 0;\n return { axis: \"y\", sign: back ? -1 : 1 };\n}\n\n/** This function puts a rectangle past the pusher, along a direction. The rectangle does not go past 0. */\nfunction shove(pusher: Rect, r: Rect, direction: Direction, gap: number): void {\n if (direction.axis === \"x\") {\n const x = direction.sign > 0 ? pusher.right() + gap : pusher.position.x - r.size.x - gap;\n r.position.set(Math.max(0, x), r.position.y);\n return;\n }\n const y = direction.sign > 0 ? pusher.bottom() + gap : pusher.position.y - r.size.y - gap;\n r.position.set(r.position.x, Math.max(0, y));\n}\n\n/**\n * This function moves each rectangle that a placed rectangle overlaps, and the rectangles that those overlap in turn.\n * A shove takes the axis of the smaller overlap, away from the pusher. A shoved rectangle keeps the direction of its first\n * shove when it shoves the next one, so the cascade goes outward. The placed rectangle and each locked rectangle stay.\n * The function moves the rectangles in place and gives the rectangles that moved.\n *\n * @example\n * ```ts\n * const moved = pushCascade(dropped, cards, { gap: 8 });\n * ```\n */\nexport function pushCascade<T>(placed: Rect<T>, rects: readonly Rect<T>[], options: PushOptions = {}): Rect<T>[] {\n const gap = options.gap ?? 8;\n const maxShoves = options.maxShoves ?? rects.length * 8;\n const moved = new Set<Rect<T>>();\n const queue: { pusher: Rect<T>; direction?: Direction }[] = [{ pusher: placed }];\n let shoves = 0;\n while (shoves < maxShoves) {\n const step = queue.shift();\n if (!step) break;\n const { pusher, direction } = step;\n for (const r of rects) {\n if (r === pusher || r === placed || r.locked) continue;\n const overlap = overlapOf(pusher, r);\n if (overlap.x <= 0 || overlap.y <= 0) continue;\n const next = direction ?? firstDirection(pusher, r, gap);\n shove(pusher, r, next, gap);\n moved.add(r);\n queue.push({ pusher: r, direction: next });\n if (++shoves >= maxShoves) break;\n }\n }\n return [...moved];\n}\n","// The forced overflow of roadmap item k59 (docs/MEASURES.md, \"Overflow\"): a lower bound of the count of items that no\n// packer can place in a fixed container. `measure` uses it for `pack.overflow.forced` and `pack.overflow.forcedArea`.\n\nimport { boundsOf } from \"@mark1russell7/layout-contract\";\nimport { DEFAULT_TOLERANCE, type Item, type PackInput, type Region } from \"./contract.ts\";\n\n/** A rectangle: its top-left corner and its size. */\ninterface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** A ring of a polygon. */\ntype Ring = readonly (readonly [number, number])[];\n\n/** A region that the items cannot use: a fixed obstacle or a locked item. */\ninterface Blocked {\n region: Region;\n box: Box;\n}\n\n/** The lower bound of the overflow of one input. `overflowBound` gives it. */\nexport interface OverflowBound {\n /** The count of items that no packer can place. It is a lower bound. */\n readonly forced: number;\n /** The area that no packer can place. It is a lower bound of the area of the unplaced items. */\n readonly area: number;\n /** The upper bound of the free area of a fixed container, or `Infinity` when a side is free. */\n readonly free: number;\n}\n\n/** This function gives the area of a ring by the shoelace formula. The direction of the ring does not count. */\nfunction ringArea(ring: Ring): number {\n let sum = 0;\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n sum += a[0] * b[1] - b[0] * a[1];\n }\n return Math.abs(sum) / 2;\n}\n\n/**\n * This function gives the area of a region that an item cannot use. A polygon loses the area of its holes. Thus a hole\n * that is out of the polygon makes the area too small, and the free area stays an upper bound.\n */\nfunction blockedArea(region: Region): number {\n switch (region.kind) {\n case \"rect\":\n return Math.max(0, region.w) * Math.max(0, region.h);\n case \"circle\":\n return Math.PI * region.r ** 2;\n case \"ellipse\":\n return Math.PI * region.rx * region.ry;\n case \"polygon\": {\n let area = ringArea(region.points);\n for (const hole of region.holes ?? []) area -= ringArea(hole);\n return Math.max(0, area);\n }\n }\n}\n\n/** This function tells if the insides of two rectangles have a common point. Two rectangles with a common edge do not. */\nfunction boxesOverlap(a: Box, b: Box): boolean {\n return Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x) > 0 && Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y) > 0;\n}\n\n/** This function tells if rectangle `a` is in rectangle `b`. */\nfunction boxIn(a: Box, b: Box): boolean {\n return a.x >= b.x && a.y >= b.y && a.x + a.w <= b.x + b.w && a.y + a.h <= b.y + b.h;\n}\n\n/** This function gives the rectangle made smaller by `d` on each side. */\nfunction shrink(b: Box, d: number): Box {\n return { x: b.x + d, y: b.y + d, w: Math.max(0, b.w - 2 * d), h: Math.max(0, b.h - 2 * d) };\n}\n\n/** This function tells if a point is in a ring, by the even-odd rule. */\nfunction pointInRing(x: number, y: number, ring: Ring): boolean {\n let inside = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const [xi, yi] = ring[i]!;\n const [xj, yj] = ring[j]!;\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\n/** This function tells if a segment has a part of a length above 0 in the open rectangle. The Liang-Barsky clip gives it. */\nfunction segmentHitsBox(ax: number, ay: number, bx: number, by: number, r: Box): boolean {\n let t0 = 0;\n let t1 = 1;\n const dx = bx - ax;\n const dy = by - ay;\n const clip = (p: number, q: number): boolean => {\n if (p === 0) return q > 0;\n const t = q / p;\n if (p < 0) {\n if (t > t1) return false;\n if (t > t0) t0 = t;\n } else {\n if (t < t0) return false;\n if (t < t1) t1 = t;\n }\n return true;\n };\n return clip(-dx, ax - r.x) && clip(dx, r.x + r.w - ax) && clip(-dy, ay - r.y) && clip(dy, r.y + r.h - ay) && t1 > t0;\n}\n\n/**\n * This function tells if a rectangle is in a polygon with holes. No edge of a ring crosses the inside of the rectangle.\n * No vertex is in it, and its center is in the polygon by the even-odd rule.\n */\nfunction boxInPolygon(b: Box, rings: readonly Ring[]): boolean {\n for (const ring of rings) {\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i]!;\n const q = ring[(i + 1) % ring.length]!;\n if (p[0] > b.x && p[0] < b.x + b.w && p[1] > b.y && p[1] < b.y + b.h) return false;\n if (segmentHitsBox(p[0], p[1], q[0], q[1], b)) return false;\n }\n }\n const cx = b.x + b.w / 2;\n const cy = b.y + b.h / 2;\n let inside = false;\n for (const ring of rings) if (pointInRing(cx, cy, ring)) inside = !inside;\n return inside;\n}\n\n/** This function tells if a rectangle is in a region of a container. A rectangle with no size is in no region. */\nfunction boxInShape(b: Box, shape: Region): boolean {\n if (!(b.w > 0 && b.h > 0)) return false;\n // A small shrink keeps a rectangle on the outline in the shape\n const s = shrink(b, 1e-9 * Math.max(1, b.w, b.h));\n switch (shape.kind) {\n case \"rect\":\n return boxIn(b, { x: shape.x, y: shape.y, w: shape.w, h: shape.h });\n case \"circle\":\n case \"ellipse\": {\n const rx = shape.kind === \"circle\" ? shape.r : shape.rx;\n const ry = shape.kind === \"circle\" ? shape.r : shape.ry;\n const inside = (x: number, y: number): boolean => ((x - shape.cx) / rx) ** 2 + ((y - shape.cy) / ry) ** 2 <= 1;\n return inside(s.x, s.y) && inside(s.x + s.w, s.y) && inside(s.x, s.y + s.h) && inside(s.x + s.w, s.y + s.h);\n }\n case \"polygon\":\n return boxInPolygon(s, [shape.points, ...(shape.holes ?? [])]);\n }\n}\n\n/**\n * This function gives the area of a container shape. A hole counts only when its bounding box is in the outer ring.\n * Also, that box has no common point with the box of a hole before it. Thus the area is not too small.\n */\nfunction shapeArea(shape: Region): number {\n if (shape.kind !== \"polygon\") return blockedArea(shape);\n let area = ringArea(shape.points);\n const kept: Box[] = [];\n for (const hole of shape.holes ?? []) {\n const box = boundsOf({ kind: \"polygon\", points: hole });\n if (!boxInPolygon(shrink(box, 1e-9 * Math.max(1, box.w, box.h)), [shape.points])) continue;\n if (kept.some((k) => boxesOverlap(k, box))) continue;\n kept.push(box);\n area -= ringArea(hole);\n }\n return Math.max(0, area);\n}\n\n/**\n * This function gives the area of the union of rectangles, each cut to the rectangle `clip`. A sweep over the x edges\n * adds the merged y intervals of each slab.\n */\nfunction unionArea(boxes: readonly Box[], clip: Box): number {\n const cut: Box[] = [];\n for (const b of boxes) {\n const x0 = Math.max(b.x, clip.x);\n const y0 = Math.max(b.y, clip.y);\n const x1 = Math.min(b.x + b.w, clip.x + clip.w);\n const y1 = Math.min(b.y + b.h, clip.y + clip.h);\n if (x1 > x0 && y1 > y0) cut.push({ x: x0, y: y0, w: x1 - x0, h: y1 - y0 });\n }\n const xs = [...new Set(cut.flatMap((b) => [b.x, b.x + b.w]))].toSorted((a, b) => a - b);\n let area = 0;\n for (let i = 0; i + 1 < xs.length; i++) {\n const left = xs[i]!;\n const right = xs[i + 1]!;\n const spans = cut\n .filter((b) => b.x <= left && b.x + b.w >= right)\n .map((b) => [b.y, b.y + b.h] as const)\n .toSorted((p, q) => p[0] - q[0]);\n let covered = 0;\n let top = -Infinity;\n let bottom = -Infinity;\n for (const [s, e] of spans) {\n if (s > bottom) {\n covered += bottom - top > 0 ? bottom - top : 0;\n top = s;\n bottom = e;\n } else bottom = Math.max(bottom, e);\n }\n covered += bottom - top > 0 ? bottom - top : 0;\n area += covered * (right - left);\n }\n return area;\n}\n\n/** This function gives the rectangle of the container: the bounding box of its shape, or 0, 0, `w`, `h`. */\nfunction containerBox(input: PackInput): Box {\n const { container } = input;\n if (container.shape !== undefined) return boundsOf(container.shape);\n return { x: 0, y: 0, w: container.w ?? Infinity, h: container.h ?? Infinity };\n}\n\n/** This function tells if an item is locked at a position. Such an item is not a candidate of the overflow. */\nconst lockedAt = (item: Item): boolean => item.locked === true && item.x !== undefined && item.y !== undefined;\n\n/** This function gives the rectangle of an item at its position: the bounding box of its shape, or its size. */\nfunction itemBox(item: Item): Box {\n const s = item.shape === undefined ? { x: 0, y: 0, w: item.w, h: item.h } : boundsOf(item.shape);\n return { x: (item.x ?? 0) + s.x, y: (item.y ?? 0) + s.y, w: s.w, h: s.h };\n}\n\n/** This function gives the smallest area of an item: its rectangle, or the area of its shape when that is smaller. */\nfunction itemArea(item: Item): number {\n const rect = Math.max(0, item.w) * Math.max(0, item.h);\n return item.shape === undefined ? rect : Math.min(rect, blockedArea(item.shape));\n}\n\n/**\n * This function gives an upper bound of the free area of a container with a fixed size. The bound ignores the gap and\n * the margins, thus it is not too small.\n *\n * - The container area is the inner rectangle (the container less the inset). A shape gives the smaller of that and its exact area.\n * - A rectangle container loses the exact union of the fixed rectangle obstacles and the locked items in the inner rectangle.\n * - A shape loses only the regions that are fully in it and in the inner rectangle, with no common point between their boxes.\n * - An obstacle with `move` can go out of the way. Thus the bound does not subtract it.\n */\nexport function freeAreaBound(input: PackInput): number {\n const bounds = containerBox(input);\n const inset = input.container.inset ?? 0;\n const inner = shrink(bounds, inset);\n if (!(inner.w > 0 && inner.h > 0)) return 0;\n const blocked: Blocked[] = [];\n for (const o of input.obstacles ?? []) if (o.move === undefined) blocked.push({ region: o.region, box: boundsOf(o.region) });\n for (const item of input.items) {\n if (!lockedAt(item)) continue;\n const box = itemBox(item);\n blocked.push({ region: { kind: \"rect\", ...box }, box });\n }\n\n const shape = input.container.shape;\n const innerArea = inner.w * inner.h;\n const inInner = (b: Box): boolean => b.w > 0 && b.h > 0 && boxIn(b, inner);\n if (shape === undefined || shape.kind === \"rect\") {\n const rects = blocked.filter((b) => b.region.kind === \"rect\");\n let free = innerArea - unionArea(rects.map((b) => b.box), inner);\n const kept: Box[] = [];\n for (const b of blocked) {\n if (b.region.kind === \"rect\" || !inInner(b.box)) continue;\n if (rects.some((r) => boxesOverlap(r.box, b.box)) || kept.some((k) => boxesOverlap(k, b.box))) continue;\n kept.push(b.box);\n free -= blockedArea(b.region);\n }\n return Math.max(0, free);\n }\n\n let free = Math.min(innerArea, shapeArea(shape));\n const kept: Box[] = [];\n for (const b of blocked) {\n if (!inInner(b.box) || !boxInShape(b.box, shape) || kept.some((k) => boxesOverlap(k, b.box))) continue;\n kept.push(b.box);\n free -= blockedArea(b.region);\n }\n return Math.max(0, free);\n}\n\n/**\n * This function gives a lower bound of the overflow of an input: the items that no packer can place, and their area.\n *\n * - The candidates are the items that are not locked at a position.\n * - A fixed side forces each candidate that is longer than the side less the inset, in each turn that the item permits.\n * - A fixed size also forces the fewest other candidates that make the rest fit the free area of `freeAreaBound`. These are the largest ones.\n * - The area of the bound is the area of the long items, plus the part of the area of the rest above the free area.\n * - The margins and the gap do not count. A slack of the overlap tolerance along the edge of each candidate keeps the bound valid.\n * - A container with no fixed side gives 0.\n */\nexport function overflowBound(input: PackInput): OverflowBound {\n const { container } = input;\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n if (!fixedW && !fixedH) return { forced: 0, area: 0, free: Infinity };\n const tol = DEFAULT_TOLERANCE.overlap;\n const bounds = containerBox(input);\n const inset = container.inset ?? 0;\n const maxW = fixedW ? bounds.w - 2 * inset + 2 * tol : Infinity;\n const maxH = fixedH ? bounds.h - 2 * inset + 2 * tol : Infinity;\n\n let forced = 0;\n let area = 0;\n let slack = 0;\n const rest: number[] = [];\n for (const item of input.items) {\n if (lockedAt(item)) continue;\n const box = itemBox(item);\n const w = Math.min(item.w, box.w);\n const h = Math.min(item.h, box.h);\n const fits = (w <= maxW && h <= maxH) || (item.turnable === true && h <= maxW && w <= maxH);\n const a = itemArea(item);\n if (!fits) {\n forced += 1;\n area += a;\n continue;\n }\n rest.push(a);\n slack += 2 * tol * (Math.max(0, w) + Math.max(0, h));\n }\n if (!(fixedW && fixedH)) return { forced, area, free: Infinity };\n\n const free = freeAreaBound(input);\n // An item can go out of the container by the tolerance, thus the edge of the container adds a slack too\n const room = free + slack + 2 * tol * (Math.max(0, bounds.w) + Math.max(0, bounds.h));\n let sum = rest.reduce((s, a) => s + a, 0);\n area += Math.max(0, sum - room);\n // The largest items go first, so the count of the dropped items is the smallest count that fits the area\n for (const a of rest.toSorted((p, q) => q - p)) {\n if (sum <= room || !(a > 0)) break;\n sum -= a;\n forced += 1;\n }\n return { forced, area, free };\n}\n","// SHA-256 (FIPS 180-4) in plain TypeScript. The hash of a corpus file needs it, and a browser has no synchronous SHA-256.\n\n/** The round constants of SHA-256. */\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be,\n 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,\n 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85,\n 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\n/** The first hash value of SHA-256. */\nconst H0 = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];\n\n/** This function turns a 32-bit word to the right by `n` bits. */\nconst rotr = (x: number, n: number): number => (x >>> n) | (x << (32 - n));\n\n/**\n * This function gives the UTF-8 bytes of a string. A lone surrogate becomes U+FFFD, as with `TextEncoder`. The\n * package has no `TextEncoder` type, because its code operates on each runtime with no global types.\n */\nexport function utf8(text: string): Uint8Array {\n const out: number[] = [];\n for (let i = 0; i < text.length; i++) {\n let c = text.charCodeAt(i);\n if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length) {\n const next = text.charCodeAt(i + 1);\n if (next >= 0xdc00 && next <= 0xdfff) {\n c = 0x10000 + ((c - 0xd800) << 10) + (next - 0xdc00);\n i++;\n }\n }\n if (c >= 0xd800 && c <= 0xdfff) c = 0xfffd;\n if (c < 0x80) out.push(c);\n else if (c < 0x800) out.push(0xc0 | (c >> 6), 0x80 | (c & 63));\n else if (c < 0x10000) out.push(0xe0 | (c >> 12), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63));\n else out.push(0xf0 | (c >> 18), 0x80 | ((c >> 12) & 63), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63));\n }\n return Uint8Array.from(out);\n}\n\n/** This function gives the SHA-256 of the UTF-8 bytes of a string, as 64 lowercase hex characters. */\nexport function sha256Hex(text: string): string {\n const bytes = utf8(text);\n const length = bytes.length;\n const padded = new Uint8Array((((length + 9 + 63) / 64) | 0) * 64);\n padded.set(bytes);\n padded[length] = 0x80;\n const view = new DataView(padded.buffer);\n const bits = length * 8;\n view.setUint32(padded.length - 8, Math.floor(bits / 0x100000000));\n view.setUint32(padded.length - 4, bits >>> 0);\n\n const hash = [...H0];\n const w = new Uint32Array(64);\n for (let block = 0; block < padded.length; block += 64) {\n for (let t = 0; t < 16; t++) w[t] = view.getUint32(block + t * 4);\n for (let t = 16; t < 64; t++) {\n const a = w[t - 15]!;\n const b = w[t - 2]!;\n const s0 = rotr(a, 7) ^ rotr(a, 18) ^ (a >>> 3);\n const s1 = rotr(b, 17) ^ rotr(b, 19) ^ (b >>> 10);\n w[t] = (w[t - 16]! + s0 + w[t - 7]! + s1) | 0;\n }\n let [a, b, c, d, e, f, g, h] = hash as [number, number, number, number, number, number, number, number];\n for (let t = 0; t < 64; t++) {\n const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);\n const ch = (e & f) ^ (~e & g);\n const t1 = (h + s1 + ch + K[t]! + w[t]!) | 0;\n const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);\n const maj = (a & b) ^ (a & c) ^ (b & c);\n const t2 = (s0 + maj) | 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n hash[0] = (hash[0]! + a) | 0;\n hash[1] = (hash[1]! + b) | 0;\n hash[2] = (hash[2]! + c) | 0;\n hash[3] = (hash[3]! + d) | 0;\n hash[4] = (hash[4]! + e) | 0;\n hash[5] = (hash[5]! + f) | 0;\n hash[6] = (hash[6]! + g) | 0;\n hash[7] = (hash[7]! + h) | 0;\n }\n return hash.map((x) => (x >>> 0).toString(16).padStart(8, \"0\")).join(\"\");\n}\n","// The input file `layout-input/1` of `docs/FORMAT.md`: its types, its numbers, its canonical form and its hash.\n\nimport type { LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput } from \"@mark1russell7/layout-contract\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { sha256Hex, utf8 } from \"./sha256.ts\";\nimport type { Cell } from \"./strategy.ts\";\n\nexport type { LayoutEdge, LayoutInput } from \"@mark1russell7/layout-contract\";\n\n/** The parameters of a generator: a name and a string or a number for each parameter. */\nexport type GeneratorParams = Record<string, string | number>;\n\n/**\n * The stamp of a generated input: the generator, its version, the full parameters and the seed.\n * It is `LayoutGenerator` of the contract with a string or a number for each parameter.\n */\nexport interface GeneratorStamp extends LayoutGenerator {\n readonly params: Readonly<GeneratorParams>;\n}\n\n/**\n * A generated input file `layout-input/1`. It is a `LayoutInput` with each field that a generator writes.\n * `docs/FORMAT.md` gives each field.\n */\nexport interface GeneratedInput extends LayoutInput {\n readonly set: string;\n readonly family: string;\n readonly seed: number;\n /** The origin: `made-up`, `published:<set>` or `known-best:<construction>`. */\n readonly source: string;\n /** The generator of a generated input. A hand-made or published input has `null`. */\n readonly generator: GeneratorStamp | null;\n readonly container: LayoutContainer;\n readonly edges: readonly LayoutEdge[];\n /** The first 16 hex characters of the SHA-256 of the canonical form of the other fields. */\n readonly hash: string;\n}\n\n/** The layout of the obstacles (`docs/research/TAXONOMY.md`, dimension 3). */\nexport type ObstacleLayout = \"none\" | \"center\" | \"scattered\" | \"wall\" | \"corridors\" | \"touching\" | \"edge\";\n\n/** The distribution of the sizes of the items (`docs/research/TAXONOMY.md`, dimension 6). */\nexport type SizeDistribution = \"identical\" | \"nearIdentical\" | \"uniform\" | \"heavyTail\" | \"bimodal\" | \"extremeAspect\";\n\n/** The scale of the count of the items (`docs/research/TAXONOMY.md`, dimension 7). */\nexport type CountScale = \"1\" | \"10\" | \"100\" | \"1k\" | \"10k\";\n\n/**\n * The cell of a generated input: one value for each dimension of the packer. The cell of `cellOf` has the dimensions\n * that the input tells. The generator adds the layout of the obstacles, the sizes, the count and the mode.\n */\nexport interface CorpusCell extends Cell {\n obstacles: ObstacleLayout;\n sizes: SizeDistribution;\n count: CountScale;\n mode: \"offline\" | \"online\" | \"incremental\";\n}\n\n/** This function gives the `fnv1a32` hash of the UTF-8 bytes of a string, as `docs/FORMAT.md` gives it. */\nexport function fnv1a32(text: string): number {\n let h = 0x811c9dc5;\n for (const b of utf8(text)) h = Math.imul(h ^ b, 0x01000193) >>> 0;\n return h;\n}\n\n/** This function rounds the numbers of a file to 3 decimals. A half goes up, and the value `-0` becomes 0. */\nexport function round3(x: number): number {\n const v = Math.round(x * 1000) / 1000;\n return Object.is(v, -0) ? 0 : v;\n}\n\n/**\n * This function gives the canonical form of a value: sorted keys, no whitespace and the numbers of `JSON.stringify`\n * after `round3`. A key with the value `undefined` is not in the form.\n */\nexport function canonicalJson(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(\",\")}}`;\n }\n return JSON.stringify(typeof value === \"number\" ? round3(value) : value);\n}\n\n/** This function gives the hash of an input file: the first 16 hex characters of the SHA-256 of its canonical form without `hash`. */\nexport function hashInput(file: LayoutInput): string {\n const { hash: _hash, ...rest } = file;\n return sha256Hex(canonicalJson(rest)).slice(0, 16);\n}\n\n/**\n * This function gives the `outputHash` of an output. It is the first 16 hex characters of the SHA-256 of the canonical form of\n * its placements, sorted by id. The canonical form rounds each number with `round3`. Thus the order of the list does not count.\n * The records of the benchmark and the key of `packPortfolio` use it. It is not `outputHash` of the contract, which uses a grid.\n */\nexport function outputHash(output: Pick<PackOutput, \"placements\">): string {\n const sorted = output.placements.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));\n return sha256Hex(canonicalJson(sorted)).slice(0, 16);\n}\n\n/** This function gives the scale of a count: the nearest of 1, 10, 100, 1000 and 10000 on a log scale. The count 0 gives `1`. */\nexport function countCell(count: number): CountScale {\n if (count <= 3) return \"1\";\n if (count <= 31) return \"10\";\n if (count <= 316) return \"100\";\n if (count <= 3162) return \"1k\";\n return \"10k\";\n}\n\n/**\n * This function gives the packing input of a file. The boxes become the items, and the edges go.\n * A file without a container gets `{ fixed: \"none\" }`, so the packer picks the size. It is `toPackInput` of the contract.\n */\nexport function toPackInput(file: Pick<LayoutInput, \"container\" | \"boxes\" | \"obstacles\" | \"gap\">): PackInput {\n return {\n container: file.container ?? { fixed: \"none\" },\n items: file.boxes,\n ...(file.obstacles === undefined ? {} : { obstacles: file.obstacles }),\n ...(file.gap === undefined ? {} : { gap: file.gap }),\n };\n}\n","// The algebra of measures (roadmap item k8). `docs/MEASURES.md` defines each measure. This file computes them.\n\nimport type { MeasureSpec as ContractMeasureSpec, Direction } from \"@mark1russell7/layout-contract\";\nimport { RECORD_EPS, type PackInput, type PackOutput } from \"./contract.ts\";\nimport { aspectError } from \"./free.ts\";\nimport { overflowBound } from \"./overflow.ts\";\nimport { round3 } from \"./layout-input.ts\";\n\n/** The direction of a measure comes from the contract: `lower` when a lower value is better, `higher` when a higher value is better. */\nexport type { Direction } from \"@mark1russell7/layout-contract\";\n\n/** The family of a measure. Each family has a section in `docs/MEASURES.md`. */\nexport type MeasureFamily = \"density\" | \"aspect\" | \"order\" | \"raggedness\" | \"overflow\" | \"stability\" | \"determinism\" | \"speed\";\n\n/** The id of a measure of the packer. The ids are those of `docs/FORMAT.md`, and `highways` uses the same ids. */\nexport type MeasureId = \"pack.area\" | \"pack.fill\" | \"pack.whitespace\" | \"pack.aspect\" | \"pack.aspectError\" | \"pack.order.inversions\" | \"pack.order.breaks\" | \"pack.raggedness\" | \"pack.overflow\" | \"pack.overflow.rate\" | \"pack.overflow.area\" | \"pack.overflow.forced\" | \"pack.overflow.forcedArea\" | \"pack.overflow.excess\" | \"pack.overflow.forcedAreaMin\" | \"pack.overflow.excessArea\" | \"pack.stability.moved\" | \"pack.stability.mean\" | \"pack.stability.q95\" | \"pack.deterministic\" | \"pack.search.widths\" | \"pack.search.ms\";\n\n/**\n * The facts of one measure: its family, its unit, its direction and its range.\n * It is `MeasureSpec` of the contract for a packer measure id, with a family.\n */\nexport interface MeasureSpec extends ContractMeasureSpec<MeasureId> {\n readonly family: MeasureFamily;\n /**\n * The floor is the best value of a guard measure. The floor rule of `docs/PROMOTION.md` of `highways` reads it. Each\n * guard of the packer has the floor 0. A measure without a floor has no floor rule.\n */\n readonly floor?: number;\n /**\n * The tolerance is the absolute tolerance at the floor. A candidate within the tolerance ties with a default at the floor.\n *\n * - `pack.order.inversions` and `pack.overflow` have the tolerance 0. Thus each new inversion and each new unplaced item is a loss.\n * - `pack.aspectError` has 0.01, approximately 1% of the aspect. An exact tiling gives the default an error of 0.\n * - `pack.stability.mean` has 0.005 container widths, and `pack.stability.q95` has 0.01. The default often moves no item.\n * - `pack.stability.moved` has 0.02: 2% of the items that stay. On a small change, the default often moves no item.\n */\n readonly tol?: number;\n}\n\n/** The measures of one layout, by id. `measure` gives them. The values are not rounded. */\nexport interface LayoutMeasures {\n \"pack.area\": number;\n \"pack.fill\": number;\n \"pack.whitespace\": number;\n \"pack.aspect\": number;\n \"pack.aspectError\": number;\n \"pack.order.inversions\": number;\n \"pack.order.breaks\": number;\n \"pack.raggedness\": number;\n \"pack.overflow\": number;\n \"pack.overflow.rate\": number;\n \"pack.overflow.area\": number;\n \"pack.overflow.forced\": number;\n /** The tight lower bound of `pack.overflow.area`. `docs/MEASURES.md` defines it. */\n \"pack.overflow.forcedArea\": number;\n \"pack.overflow.excess\": number;\n /**\n * This measure is an alias of `pack.overflow.forcedArea`, with the same value.\n *\n * @deprecated Use `pack.overflow.forcedArea`. The alias stays until the next minor version.\n */\n \"pack.overflow.forcedAreaMin\": number;\n /** The overflow area above its bound: `pack.overflow.area` less `pack.overflow.forcedArea`. */\n \"pack.overflow.excessArea\": number;\n \"pack.search.widths\": number;\n \"pack.search.ms\": number;\n}\n\n/** The stability measures of a change pair, by id. `measureChange` gives them. The values are not rounded. */\nexport interface ChangeMeasures {\n \"pack.stability.moved\": number;\n \"pack.stability.mean\": number;\n \"pack.stability.q95\": number;\n}\n\n/** The options of `measure`. */\nexport interface MeasureOptions {\n /**\n * A box joins a row when its top is this close to the top of the first box of the row. The rows give\n * `pack.raggedness`. The default is half the median height of the boxes.\n */\n rowTolerance?: number;\n}\n\nconst spec = (\n id: MeasureId,\n family: MeasureFamily,\n unit: string,\n direction: Direction,\n min: number,\n max: number,\n minEffect: MeasureSpec[\"minEffect\"],\n guard?: { floor: number; tol: number },\n): MeasureSpec => ({ id, family, unit, direction, min, max, ...(minEffect === undefined ? {} : { minEffect }), ...guard });\n\n/** The minimum effect of an area or a ratio of lengths: 1% of the larger value. */\nconst REL = Object.freeze({ rel: 0.01 });\n\n/**\n * The facts of each measure, by id. `docs/MEASURES.md` gives the full definitions. This record is the source of the floor\n * and the tolerance of each guard of the packer, and of the minimum effect of each measure.\n *\n * - A count and a share of counts have the minimum effect 0. Thus each change of a count is an effect.\n * - A share of an area from 0 to 1 has 0.005. A guard has its tolerance.\n * - An area and a ratio of lengths have `{ rel: 0.01 }`: 1% of the larger value.\n * - The time has no minimum effect, because the times of CI change each time.\n * - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`. Its spec is the same, except the id.\n * The alias stays until the next minor version.\n */\nexport const MEASURE_SPECS: Readonly<Record<MeasureId, MeasureSpec>> = Object.freeze({\n \"pack.area\": spec(\"pack.area\", \"density\", \"square units\", \"lower\", 0, Infinity, REL),\n \"pack.fill\": spec(\"pack.fill\", \"density\", \"share\", \"higher\", 0, 1, 0.005),\n \"pack.whitespace\": spec(\"pack.whitespace\", \"density\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.aspect\": spec(\"pack.aspect\", \"aspect\", \"ratio\", \"lower\", 1, Infinity, REL),\n \"pack.aspectError\": spec(\"pack.aspectError\", \"aspect\", \"natural log\", \"lower\", 0, Infinity, 0.01, { floor: 0, tol: 0.01 }),\n \"pack.order.inversions\": spec(\"pack.order.inversions\", \"order\", \"share\", \"lower\", 0, 1, 0, { floor: 0, tol: 0 }),\n \"pack.order.breaks\": spec(\"pack.order.breaks\", \"order\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.raggedness\": spec(\"pack.raggedness\", \"raggedness\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow\": spec(\"pack.overflow\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0, { floor: 0, tol: 0 }),\n \"pack.overflow.rate\": spec(\"pack.overflow.rate\", \"overflow\", \"share\", \"lower\", 0, 1, 0),\n \"pack.overflow.area\": spec(\"pack.overflow.area\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.forced\": spec(\"pack.overflow.forced\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.overflow.forcedArea\": spec(\"pack.overflow.forcedArea\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.excess\": spec(\"pack.overflow.excess\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0),\n // The deprecated alias of pack.overflow.forcedArea, until the next minor version\n \"pack.overflow.forcedAreaMin\": spec(\"pack.overflow.forcedAreaMin\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.excessArea\": spec(\"pack.overflow.excessArea\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.stability.moved\": spec(\"pack.stability.moved\", \"stability\", \"share\", \"lower\", 0, 1, 0.02, { floor: 0, tol: 0.02 }),\n \"pack.stability.mean\": spec(\"pack.stability.mean\", \"stability\", \"container widths\", \"lower\", 0, Infinity, 0.005, { floor: 0, tol: 0.005 }),\n \"pack.stability.q95\": spec(\"pack.stability.q95\", \"stability\", \"container widths\", \"lower\", 0, Infinity, 0.01, { floor: 0, tol: 0.01 }),\n \"pack.deterministic\": spec(\"pack.deterministic\", \"determinism\", \"boolean\", \"higher\", 0, 1, 0),\n \"pack.search.widths\": spec(\"pack.search.widths\", \"speed\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.search.ms\": spec(\"pack.search.ms\", \"speed\", \"milliseconds\", \"lower\", 0, Infinity, undefined),\n});\n\n/** A placed box: the rectangle of an item at its position, with its rank. */\nexport interface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n rank: number;\n}\n\n/** This function gives the smallest rectangle around the boxes. No box gives a rectangle of size 0 at 0, 0. */\nexport function hullOf(boxes: readonly Pick<Box, \"x\" | \"y\" | \"w\" | \"h\">[]): { x: number; y: number; w: number; h: number } {\n if (boxes.length === 0) return { x: 0, y: 0, w: 0, h: 0 };\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const b of boxes) {\n left = Math.min(left, b.x);\n top = Math.min(top, b.y);\n right = Math.max(right, b.x + b.w);\n bottom = Math.max(bottom, b.y + b.h);\n }\n return { x: left, y: top, w: right - left, h: bottom - top };\n}\n\n/**\n * This function puts the boxes in rows. It sorts the boxes by their top, and keeps the order of the list for equal tops.\n * A box joins the last row when its top is within `tolerance` of the top of the first box of that row.\n */\nexport function rowsOf(boxes: readonly Pick<Box, \"x\" | \"y\" | \"w\">[], tolerance: number): { top: number; right: number; count: number }[] {\n const rows: { top: number; right: number; count: number }[] = [];\n for (const b of boxes.toSorted((p, q) => p.y - q.y)) {\n const row = rows.at(-1);\n if (row && Math.abs(b.y - row.top) <= tolerance) {\n row.right = Math.max(row.right, b.x + b.w);\n row.count += 1;\n } else {\n rows.push({ top: b.y, right: b.x + b.w, count: 1 });\n }\n }\n return rows;\n}\n\n/**\n * This function gives the placed boxes of an output, in the order of the items of the input. A box has the size of its\n * item after the turn. The list has no item without a placement, and no item with a width or a height of 0.\n */\nexport function boxesOf(input: PackInput, output: PackOutput): Box[] {\n const placements = new Map<string, PackOutput[\"placements\"][number]>();\n for (const p of output.placements) if (!placements.has(p.id)) placements.set(p.id, p);\n const boxes: Box[] = [];\n for (const [index, item] of input.items.entries()) {\n const p = placements.get(item.id);\n if (p === undefined || !(item.w > 0 && item.h > 0)) continue;\n const turned = p.turn === 90;\n boxes.push({ x: p.x, y: p.y, w: turned ? item.h : item.w, h: turned ? item.w : item.h, rank: item.rank ?? index });\n }\n return boxes;\n}\n\n/**\n * This function tells if box `a` comes before box `b` in the reading order. Two boxes whose heights overlap by more than\n * `RECORD_EPS` are on one line, and the left box comes first. Otherwise the upper box comes first.\n */\nexport function readsBefore(a: Pick<Box, \"x\" | \"y\" | \"h\">, b: Pick<Box, \"x\" | \"y\" | \"h\">): boolean {\n const shared = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);\n if (shared > RECORD_EPS) return a.x + RECORD_EPS < b.x;\n return a.y < b.y;\n}\n\n/** This function sums one measure over the stages of a trace. A trace without the measure gives 0. */\nfunction traceSum(output: PackOutput, id: string): number {\n let sum = 0;\n for (const stage of output.trace ?? []) sum += stage.measures?.[id] ?? 0;\n return sum;\n}\n\n/**\n * This function gives the measures of one layout, by the ids of `docs/MEASURES.md`. The values are not rounded. A\n * record rounds them with `roundMeasures`.\n *\n * - The boxes are the placed items with a width and a height above 0. The hull is the smallest rectangle around them.\n * - An empty layout gives the area 0, the aspect 1 and the aspect error 0. Its fill is 0 and its whitespace is 1.\n * - The time `pack.search.ms` comes from the trace. It is not part of the determinism rule.\n * - The overflow measures count each id once. `pack.overflow.forced` is the lower bound of `overflowBound`.\n * - `pack.overflow.excess` is the overflow less the forced overflow. A container with no fixed side gives 0 for both.\n * - `pack.overflow.forcedArea` is a lower bound of the overflow area. `pack.overflow.excessArea` is the overflow area above it.\n * - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`, with the same value.\n *\n * @example\n * ```ts\n * const m = measure(input, packWith(\"shelf\", input));\n * m[\"pack.fill\"]; // the area of the boxes divided by the area of the hull\n * ```\n */\nexport function measure(input: PackInput, output: PackOutput, options: MeasureOptions = {}): LayoutMeasures {\n const boxes = boxesOf(input, output);\n const hull = hullOf(boxes);\n const hullArea = hull.w * hull.h;\n const boxArea = boxes.reduce((sum, b) => sum + b.w * b.h, 0);\n const fill = hullArea > 0 ? boxArea / hullArea : 0;\n const empty = boxes.length === 0;\n const target = input.container.aspect ?? 1;\n\n // The reading order: each pair of boxes with different ranks, and each step of the rank order\n let pairs = 0;\n let inversions = 0;\n for (let i = 0; i < boxes.length; i++) {\n for (let j = i + 1; j < boxes.length; j++) {\n const a = boxes[i]!;\n const b = boxes[j]!;\n if (a.rank === b.rank) continue;\n pairs += 1;\n const first = a.rank < b.rank ? a : b;\n const second = first === a ? b : a;\n if (readsBefore(second, first)) inversions += 1;\n }\n }\n const byRank = boxes.toSorted((a, b) => a.rank - b.rank);\n let breaks = 0;\n for (let k = 1; k < byRank.length; k++) {\n const prev = byRank[k - 1]!;\n const next = byRank[k]!;\n if (prev.rank !== next.rank && readsBefore(next, prev)) breaks += 1;\n }\n\n const tolerance = options.rowTolerance ?? quantileOrZero(boxes.map((b) => b.h), 0.5) / 2;\n const rights = rowsOf(boxes, tolerance).map((r) => r.right);\n const spread = rights.length > 0 ? Math.max(...rights) - Math.min(...rights) : 0;\n\n // The overflow: the unplaced items, their area, and the part that no packer can place\n const unplaced = new Set(output.overflow);\n let itemArea = 0;\n let unplacedArea = 0;\n for (const item of input.items) {\n const a = Math.max(0, item.w) * Math.max(0, item.h);\n itemArea += a;\n if (unplaced.has(item.id)) unplacedArea += a;\n }\n const bound = overflowBound(input);\n const overflowArea = itemArea > 0 ? unplacedArea / itemArea : 0;\n const forcedArea = itemArea > 0 ? Math.min(1, bound.area / itemArea) : 0;\n\n return {\n \"pack.area\": hullArea,\n \"pack.fill\": fill,\n \"pack.whitespace\": 1 - fill,\n \"pack.aspect\": empty ? 1 : Math.max(hull.w / hull.h, hull.h / hull.w),\n \"pack.aspectError\": empty ? 0 : aspectError(hull.w, hull.h, target),\n \"pack.order.inversions\": pairs > 0 ? inversions / pairs : 0,\n \"pack.order.breaks\": breaks,\n \"pack.raggedness\": hull.w > 0 ? spread / hull.w : 0,\n \"pack.overflow\": unplaced.size,\n \"pack.overflow.rate\": input.items.length > 0 ? unplaced.size / input.items.length : 0,\n \"pack.overflow.area\": overflowArea,\n \"pack.overflow.forced\": bound.forced,\n \"pack.overflow.forcedArea\": forcedArea,\n \"pack.overflow.excess\": Math.max(0, unplaced.size - bound.forced),\n \"pack.overflow.forcedAreaMin\": forcedArea,\n \"pack.overflow.excessArea\": excessAreaOf(overflowArea, forcedArea),\n \"pack.search.widths\": traceSum(output, \"pack.search.widths\"),\n \"pack.search.ms\": traceSum(output, \"pack.search.ms\"),\n };\n}\n\n/** The float noise of `pack.overflow.excessArea`. A difference below 0 by this value or less becomes 0. */\nconst AREA_NOISE = 1e-9;\n\n/**\n * This function gives the overflow area above its lower bound. A value from `-AREA_NOISE` to 0 becomes 0. A value below\n * `-AREA_NOISE` stays, because it shows a bug of the bound or of the packer.\n */\nfunction excessAreaOf(overflowArea: number, forcedArea: number): number {\n const excess = overflowArea - forcedArea;\n return excess < 0 && excess >= -AREA_NOISE ? 0 : excess;\n}\n\n/**\n * This function gives the stability measures of a change pair: the run on the base input and the run on the changed\n * input. The items match by id. The values are not rounded.\n *\n * - An item stays when both inputs have it and both outputs place it. The added and the removed items do not count.\n * - A staying item moved when its `x` or its `y` changed by more than `RECORD_EPS`, or when its turn changed.\n * - The distance of an item is the length of the move of its top-left corner. The unit is the width `W`.\n * - `W` is the larger width of the 2 output sizes. A `W` of 0 becomes 1, so the unit is then the unit of the input.\n * - No staying item gives 0 for each measure.\n */\nexport function measureChange(baseInput: PackInput, baseOutput: PackOutput, changeInput: PackInput, changeOutput: PackOutput): ChangeMeasures {\n const placed = (input: PackInput, output: PackOutput): Map<string, PackOutput[\"placements\"][number]> => {\n const ids = new Set(input.items.map((i) => i.id));\n const map = new Map<string, PackOutput[\"placements\"][number]>();\n for (const p of output.placements) if (ids.has(p.id) && !map.has(p.id)) map.set(p.id, p);\n return map;\n };\n const before = placed(baseInput, baseOutput);\n const after = placed(changeInput, changeOutput);\n const width = Math.max(baseOutput.size.w, changeOutput.size.w);\n const unit = width > 0 ? width : 1;\n\n const distances: number[] = [];\n let moved = 0;\n for (const [id, p] of before) {\n const q = after.get(id);\n if (q === undefined) continue;\n const dx = q.x - p.x;\n const dy = q.y - p.y;\n if (Math.abs(dx) > RECORD_EPS || Math.abs(dy) > RECORD_EPS || (p.turn ?? 0) !== (q.turn ?? 0)) moved += 1;\n distances.push(Math.hypot(dx, dy) / unit);\n }\n if (distances.length === 0) return { \"pack.stability.moved\": 0, \"pack.stability.mean\": 0, \"pack.stability.q95\": 0 };\n return {\n \"pack.stability.moved\": moved / distances.length,\n \"pack.stability.mean\": distances.reduce((sum, d) => sum + d, 0) / distances.length,\n \"pack.stability.q95\": quantile(distances, 0.95),\n };\n}\n\n/**\n * This function gives the measure `pack.deterministic` of two runs with the same input, options and seed. It gives\n * `true` when the runs have the same placements, overflow, size and moved obstacles.\n *\n * - The placements match by id, so their order in the list does not count. The numbers must be equal.\n * - The trace is not part of the rule, because its times change each time.\n */\nexport function isDeterministic(first: PackOutput, second: PackOutput): boolean {\n const key = <T extends { id: string }>(list: readonly T[]): Map<string, T> => new Map(list.map((e) => [e.id, e]));\n const samePlacements = (a: PackOutput[\"placements\"], b: PackOutput[\"placements\"]): boolean => {\n if (a.length !== b.length) return false;\n const other = key(b);\n return a.every((p) => {\n const q = other.get(p.id);\n return q !== undefined && q.x === p.x && q.y === p.y && (q.turn ?? 0) === (p.turn ?? 0);\n });\n };\n const sameMoved = (a: PackOutput[\"moved\"], b: PackOutput[\"moved\"]): boolean => {\n if (a.length !== b.length) return false;\n const other = key(b);\n return a.every((m) => {\n const n = other.get(m.id);\n return n !== undefined && n.x === m.x && n.y === m.y;\n });\n };\n const overflowA = new Set(first.overflow);\n const overflowB = new Set(second.overflow);\n return (\n first.size.w === second.size.w &&\n first.size.h === second.size.h &&\n overflowA.size === overflowB.size &&\n [...overflowA].every((id) => overflowB.has(id)) &&\n samePlacements(first.placements, second.placements) &&\n sameMoved(first.moved, second.moved)\n );\n}\n\n/**\n * This function rounds each number of a record of measures with `round3`, as `docs/FORMAT.md` tells. A half goes up,\n * and `-0` becomes 0. The function keeps the other values, and it does not change its argument.\n */\nexport function roundMeasures<T extends object>(measures: T): T {\n const out: Record<string, unknown> = {};\n for (const [id, value] of Object.entries(measures)) out[id] = typeof value === \"number\" ? round3(value) : value;\n return out as T;\n}\n\n/**\n * This function gives the paired ratio of a measure on one input: the value of the candidate against the value of the\n * current default. A ratio above 1 is worse, in the direction of the measure.\n *\n * - For `lower`, the ratio is `candidate / current`. For `higher`, it is `current / candidate`.\n * - When both values are 0, the ratio is 1. When only the divisor is 0, the ratio is `Infinity`.\n * - The values are 0 or more. A negative value or `NaN` throws a `RangeError`.\n */\nexport function pairedRatio(candidate: number, current: number, direction: Direction): number {\n if (!(candidate >= 0 && current >= 0)) throw new RangeError(\"A paired ratio needs two values of 0 or more.\");\n const top = direction === \"lower\" ? candidate : current;\n const bottom = direction === \"lower\" ? current : candidate;\n if (bottom === 0) return top === 0 ? 1 : Infinity;\n return top / bottom;\n}\n\n/**\n * This function gives the quantile `q` of a list of numbers, with linear interpolation between the sorted values. The\n * position in the sorted list is `(n - 1) * q`. An empty list or a `q` outside 0 to 1 throws a `RangeError`.\n */\nexport function quantile(values: readonly number[], q: number): number {\n if (values.length === 0) throw new RangeError(\"A quantile needs one value or more.\");\n if (!(q >= 0 && q <= 1)) throw new RangeError(\"A quantile needs a q from 0 to 1.\");\n const sorted = values.toSorted((a, b) => a - b);\n const at = (sorted.length - 1) * q;\n const low = Math.floor(at);\n const part = at - low;\n const a = sorted[low]!;\n if (part === 0) return a;\n const b = sorted[low + 1]!;\n if (a === b) return a;\n return a + part * (b - a);\n}\n\n/** This function gives the quantile `q` of a list, and 0 for an empty list. */\nfunction quantileOrZero(values: readonly number[], q: number): number {\n return values.length === 0 ? 0 : quantile(values, q);\n}\n\n/** This function gives the median of the paired ratios of a corpus: the quantile 0.5. It is not a ratio of two medians. */\nexport function medianRatio(ratios: readonly number[]): number {\n return quantile(ratios, 0.5);\n}\n\n/** This function gives the share of the paired ratios above a limit. An empty list throws a `RangeError`. */\nexport function tailShare(ratios: readonly number[], limit: number): number {\n if (ratios.length === 0) throw new RangeError(\"A tail share needs one ratio or more.\");\n return ratios.filter((r) => r > limit).length / ratios.length;\n}\n","import { hullOf, rowsOf } from \"./measures.ts\";\nimport type { Rect } from \"./rect.ts\";\n\n/** The measurements of a packing. */\nexport interface PackingMetrics {\n /** The number of rectangles. */\n count: number;\n /** The size of the hull: the smallest box around the rectangles. */\n hull: { width: number; height: number };\n /** The width of the hull divided by its height. A hull without height gives 0. */\n hullAspect: number;\n /** The number of rectangles in each row, from the top. */\n rows: number[];\n /** The largest right edge of a row less the smallest right edge of a row. A straight right side gives 0. */\n raggedness: number;\n /** The part of the hull that the rectangles cover: their area divided by the area of the hull. */\n utilization: number;\n /** The width of the widest rectangle divided by the median width. */\n widestOverMedian: number;\n}\n\n/** The options of `packingMetrics`. */\nexport interface MetricsOptions {\n /** A rectangle joins a row when its top is this close to the top of the first rectangle of the row. The default is 40. */\n rowTolerance?: number;\n}\n\n/**\n * This function measures a packing. It gives the hull and its aspect, the rows and the raggedness of the right side.\n * It also gives the part of the hull that the rectangles cover, and the widest rectangle against the median width.\n *\n * @example\n * ```ts\n * const { utilization, raggedness } = packingMetrics(Rect.packed(cards));\n * ```\n */\nexport function packingMetrics(rects: readonly Rect[], options: MetricsOptions = {}): PackingMetrics {\n const tolerance = options.rowTolerance ?? 40;\n const boxes = rects.filter((r) => r.size.x > 0 && r.size.y > 0).map((r) => ({ x: r.position.x, y: r.position.y, w: r.size.x, h: r.size.y }));\n if (boxes.length === 0) return { count: 0, hull: { width: 0, height: 0 }, hullAspect: 0, rows: [], raggedness: 0, utilization: 0, widestOverMedian: 0 };\n\n // The hull and the rows come from the helpers of `measure`, so the two functions agree\n const box = hullOf(boxes);\n const hull = { width: box.w, height: box.h };\n const rows = rowsOf(boxes, tolerance);\n const rights = rows.map((row) => row.right);\n const widths = boxes.map((r) => r.w).toSorted((a, b) => a - b);\n const median = widths[Math.floor(widths.length / 2)] ?? 0;\n const widest = widths.at(-1) ?? 0;\n const area = boxes.reduce((sum, r) => sum + r.w * r.h, 0);\n return {\n count: boxes.length,\n hull,\n hullAspect: hull.height > 0 ? hull.width / hull.height : 0,\n rows: rows.map((row) => row.count),\n raggedness: Math.max(...rights) - Math.min(...rights),\n utilization: hull.width * hull.height > 0 ? area / (hull.width * hull.height) : 0,\n widestOverMedian: median > 0 ? widest / median : 0,\n };\n}\n","import type { LayoutContainer, PackInput, PackOutput, Region } from \"./contract.ts\";\n\n/**\n * For each dimension of the taxonomy, the values that a strategy supports. `docs/research/TAXONOMY.md` gives the values.\n * The type is an alias, not an interface. Thus it fits the record `Supports` of the contract.\n */\nexport type Supports = {\n containerSize: (\"fixed\" | \"freeHeight\" | \"freeWidth\" | \"freeAspect\" | \"freeArea\")[];\n containerShape: (\"rect\" | \"convex\" | \"polygon\" | \"circle\" | \"ellipse\" | \"holes\")[];\n /** The movement of the obstacles. An empty list supports only an input with no obstacle and no locked item. */\n obstacleMove: (\"fixed\" | \"costly\" | \"free\")[];\n itemShape: (\"rect\" | \"circle\" | \"convex\" | \"polygon\" | \"mixed\")[];\n rotation: (\"none\" | \"quarter\" | \"any\")[];\n order: (\"free\" | \"soft\" | \"hard\")[];\n groups: (\"none\" | \"flat\" | \"nested\")[];\n mode: (\"offline\" | \"online\" | \"incremental\")[];\n};\n\n/** A dimension of `Supports`. */\nexport type Dimension = keyof Supports;\n\n/** A value of a dimension of `Supports`. */\nexport type DimensionValue<D extends Dimension = Dimension> = Supports[D][number];\n\n/**\n * The cell of an input: one value for each packer dimension that the input tells. The input does not tell the mode.\n * Without obstacles and locked items, the cell has no `obstacleMove`.\n */\nexport interface Cell {\n containerSize: DimensionValue<\"containerSize\">;\n containerShape: DimensionValue<\"containerShape\">;\n obstacleMove?: DimensionValue<\"obstacleMove\">;\n itemShape: DimensionValue<\"itemShape\">;\n rotation: DimensionValue<\"rotation\">;\n order: DimensionValue<\"order\">;\n groups: DimensionValue<\"groups\">;\n}\n\n/** The context of one packing. */\nexport interface PackContext {\n /** The seed. A strategy gets each random number from `rng`, not from `Math.random`. */\n seed: number;\n /** The random numbers in `[0, 1)`, from `mulberry32` with `seed`. */\n rng: () => number;\n /** A limit for the strategies that search. The strategy gives its best result at the limit. */\n budget?: { ms?: number; steps?: number };\n /** The previous output, for the mode `incremental`. */\n previous?: PackOutput;\n}\n\n/** A packing strategy behind the Packer interface. */\nexport interface Strategy<O = unknown> {\n /** A stable name, for example `shelf`. The records use it. */\n id: string;\n /** The family of the catalog, for example `shelf` or `skyline`. */\n family: string;\n /** The ids of the catalog rows that this strategy builds. */\n catalog: string[];\n /** The cells that the strategy supports. */\n supports: Supports;\n /** The default options. A record writes the options in full. */\n defaults: O;\n /** The value `true` tells that the result depends only on the input, the options and the seed. */\n deterministic: boolean;\n /** This method packs an input. It throws `UnsupportedCell` for an input outside the cells of `supports`. */\n pack(input: PackInput, options: O, context: PackContext): PackOutput;\n}\n\n/** A size search: it gives a strategy of a fixed width the cells `freeAspect` and `freeArea`. */\nexport interface SizeSearch {\n id: string;\n /** This method searches the size of the container for an input with `fixed` set to `none`. `options` go to `inner`. */\n search(input: PackInput, inner: Strategy, context: PackContext, options?: unknown): PackOutput;\n}\n\n/**\n * The error of a strategy for an input outside its cells. The benchmark records this result. It is not a failure of the\n * strategy.\n */\nexport class UnsupportedCell extends Error {\n /** The dimension of the taxonomy. */\n readonly dimension: Dimension;\n /** The value of the input that the strategy does not support. */\n readonly value: string;\n\n constructor(dimension: Dimension, value: string) {\n super(`The strategy does not support the value \"${value}\" of the dimension \"${dimension}\".`);\n this.name = \"UnsupportedCell\";\n this.dimension = dimension;\n this.value = value;\n }\n}\n\n/** This function gives a generator of random numbers in `[0, 1)`: `mulberry32` of `docs/FORMAT.md`. */\nexport function mulberry32(seed: number): () => number {\n let s = seed >>> 0;\n return () => {\n s = (s + 0x6d2b79f5) | 0;\n let t = Math.imul(s ^ (s >>> 15), 1 | s);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** This function makes the context of one packing from a seed. */\nexport function createContext(seed = 0, more: Omit<PackContext, \"seed\" | \"rng\"> = {}): PackContext {\n return { ...more, seed, rng: mulberry32(seed) };\n}\n\n/** This function tells if a polygon ring is convex. A ring with fewer than 3 points is convex. */\nfunction isConvex(points: readonly (readonly [number, number])[]): boolean {\n let sign = 0;\n const n = points.length;\n for (let i = 0; i < n; i++) {\n const [ax, ay] = points[i]!;\n const [bx, by] = points[(i + 1) % n]!;\n const [cx, cy] = points[(i + 2) % n]!;\n const cross = (bx - ax) * (cy - by) - (by - ay) * (cx - bx);\n if (cross === 0) continue;\n if (sign === 0) sign = Math.sign(cross);\n else if (Math.sign(cross) !== sign) return false;\n }\n return true;\n}\n\n/** This function gives the value of `containerShape` of one region. */\nfunction shapeOf(region: Region): DimensionValue<\"containerShape\"> {\n switch (region.kind) {\n case \"rect\":\n case \"circle\":\n case \"ellipse\":\n return region.kind;\n case \"polygon\":\n if (region.holes && region.holes.length > 0) return \"holes\";\n return isConvex(region.points) ? \"convex\" : \"polygon\";\n }\n}\n\n/** This function gives the value of `itemShape` of one item shape. An ellipse is convex. */\nfunction itemShapeOf(region: Region | undefined): DimensionValue<\"itemShape\"> {\n if (region === undefined) return \"rect\";\n switch (region.kind) {\n case \"rect\":\n case \"circle\":\n return region.kind;\n case \"ellipse\":\n return \"convex\";\n case \"polygon\":\n return !region.holes?.length && isConvex(region.points) ? \"convex\" : \"polygon\";\n }\n}\n\n/**\n * This function gives the cell of an input: the values of the packer dimensions that the input tells.\n *\n * - `containerSize` comes from `fixed`. The value `none` gives `freeArea` when `aspectWeight` is 0, and `freeAspect` if not.\n * - `containerShape` comes from the shape. A rectangle container with an obstacle of another region gives `holes`.\n * - `obstacleMove` is the hardest value of the obstacles and the locked items: `costly`, then `free`, then `fixed`.\n * - `order` is `soft` when an item has a rank, and `free` if not. The input does not tell a hard order.\n * - `groups` is `nested` when an item has a parent, `flat` when an item has a group, and `none` if not.\n */\nexport function cellOf(input: PackInput): Cell {\n const { container, items } = input;\n const obstacles = input.obstacles ?? [];\n\n const sizes: Record<LayoutContainer[\"fixed\"], DimensionValue<\"containerSize\">> = {\n size: \"fixed\",\n width: \"freeHeight\",\n height: \"freeWidth\",\n none: container.aspectWeight === 0 ? \"freeArea\" : \"freeAspect\",\n };\n const containerSize = sizes[container.fixed];\n\n let containerShape = container.shape ? shapeOf(container.shape) : \"rect\";\n if (containerShape === \"rect\" && obstacles.some((o) => o.region.kind !== \"rect\")) containerShape = \"holes\";\n\n let obstacleMove: DimensionValue<\"obstacleMove\"> | undefined = items.some((i) => i.locked === true) ? \"fixed\" : undefined;\n for (const o of obstacles) {\n const move = o.move === undefined ? \"fixed\" : o.move.cost > 0 ? \"costly\" : \"free\";\n if (move === \"costly\" || obstacleMove === undefined || (move === \"free\" && obstacleMove === \"fixed\")) obstacleMove = move;\n }\n\n const shapes = new Set(items.map((i) => itemShapeOf(i.shape)));\n const itemShape = shapes.size > 1 ? \"mixed\" : ([...shapes][0] ?? \"rect\");\n\n const cell: Cell = {\n containerSize,\n containerShape,\n itemShape,\n rotation: items.some((i) => i.turnable === true) ? \"quarter\" : \"none\",\n order: items.some((i) => i.rank !== undefined) ? \"soft\" : \"free\",\n groups: items.some((i) => i.parent !== undefined) ? \"nested\" : items.some((i) => i.group !== undefined) ? \"flat\" : \"none\",\n };\n if (obstacleMove !== undefined) cell.obstacleMove = obstacleMove;\n return cell;\n}\n\n/** This function gives the first dimension of a cell that `supports` does not hold, or `undefined` when it holds each one. */\nexport function unsupportedOf(supports: Supports, cell: Partial<Record<Dimension, string>>): { dimension: Dimension; value: string } | undefined {\n for (const dimension of Object.keys(supports) as Dimension[]) {\n const value = cell[dimension];\n if (value === undefined) continue;\n if (!(supports[dimension] as readonly string[]).includes(value)) return { dimension, value };\n }\n return undefined;\n}\n\n/** This function tells if `supports` holds each value of a cell. A dimension that the cell does not have is held. */\nexport function supportsCell(supports: Supports, cell: Partial<Record<Dimension, string>>): boolean {\n return unsupportedOf(supports, cell) === undefined;\n}\n\n/** This function throws `UnsupportedCell` for the first value of the cell of an input that `supports` does not hold. */\nexport function assertSupported(supports: Supports, input: PackInput): void {\n const miss = unsupportedOf(supports, cellOf(input));\n if (miss) throw new UnsupportedCell(miss.dimension, miss.value);\n}\n","// The adapters of 0.1 (docs/PACKER.md): each function of 0.1 runs behind the Packer interface as a strategy.\n\nimport { EPS, type PackInput, type PackOutput } from \"./contract.ts\";\nimport { boundsOf, buildFrame, frameTurn, now, outerOf, readFrame, rectsOf, viaAxes, type Entry, type Frame, type FrameTurns } from \"./frame.ts\";\nimport { packFree } from \"./free.ts\";\nimport type { MaxRectsRule } from \"./maxrects.ts\";\nimport { clearMoves, moveCount, MOVES } from \"./moves.ts\";\nimport type { SortOrder } from \"./order.ts\";\nimport { pack, type PackLayoutOptions } from \"./pack.ts\";\nimport { pushCascade } from \"./push.ts\";\nimport { Rect } from \"./rect.ts\";\nimport type { ShelfFit } from \"./shelf.ts\";\nimport { packSkyline } from \"./skyline.ts\";\nimport { spaceOf } from \"./space.ts\";\nimport { assertSupported, cellOf, UnsupportedCell, type PackContext, type SizeSearch, type Strategy, type Supports } from \"./strategy.ts\";\n\n/** The options of the strategies `rows`, `skyline` and `shelf`. */\nexport interface LayoutStrategyOptions {\n /** The order of the items before the packing. The items are in the order of their rank first. */\n sortOrder: SortOrder;\n /** The number of widths that the first pass of the size search `log-sweep` tries. */\n samples: number;\n /**\n * The rule of `shelf` to choose a shelf: `next`, `first` or `best`. Only `shelf` reads it. Without it, `shelf` packs\n * as in 0.2.3. With it, the trace also counts `move.firstFit` and `move.bestFit`.\n */\n fit?: ShelfFit;\n}\n\n/** The options of the strategy `maxrects`. The strategy does not read `fit`. */\nexport interface MaxRectsStrategyOptions extends LayoutStrategyOptions {\n /** The rule to choose a free rectangle: `bssf` (the default), `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */\n rule: MaxRectsRule;\n /** The value `true` lets each turnable item that is not locked turn by 90 degrees. The default is `false`. */\n rotate: boolean;\n /**\n * The largest height of a band of the approximation of a container that is not a plain rectangle. `MaxRectsOptions`\n * tells the default.\n */\n bandHeight?: number;\n}\n\n/** The id of a strategy of `pack`. */\ntype LayoutId = \"rows\" | \"skyline\" | \"shelf\" | \"maxrects\";\n\n/** The options of a strategy of `pack`: the options of `maxrects` are optional for the other strategies. */\ntype AnyLayoutOptions = LayoutStrategyOptions & Partial<Pick<MaxRectsStrategyOptions, \"rule\" | \"rotate\" | \"bandHeight\">>;\n\n/** The options of `pack` that a strategy adds to the sort order and the space. */\ntype PackExtras = Pick<PackLayoutOptions, \"fit\" | \"rule\" | \"bandHeight\" | \"turnable\" | \"turned\">;\n\n/** The options of the strategy `push`. */\nexport interface PushStrategyOptions {\n /** The order of the items that the cascade does not place. */\n sortOrder: SortOrder;\n /** The most shoves for each item. The cascade stops at this limit. */\n maxShovesPerItem: number;\n}\n\n/**\n * The cells of `rows`, `skyline` and `shelf`, without the movement of the obstacles. The container layer of `src/space.ts`\n * gives them each container shape.\n */\nconst LAYOUT_CELLS = {\n containerSize: [\"fixed\", \"freeHeight\", \"freeWidth\", \"freeAspect\", \"freeArea\"],\n containerShape: [\"rect\", \"convex\", \"polygon\", \"circle\", \"ellipse\", \"holes\"],\n itemShape: [\"rect\"],\n rotation: [\"none\"],\n groups: [\"none\"],\n mode: [\"offline\"],\n} as const satisfies Partial<Supports>;\n\n/** This function makes the supports of a strategy, with copies of each list. */\nfunction supportsOf(cells: { [D in keyof Supports]: readonly Supports[D][number][] }): Supports {\n return {\n containerSize: [...cells.containerSize],\n containerShape: [...cells.containerShape],\n obstacleMove: [...cells.obstacleMove],\n itemShape: [...cells.itemShape],\n rotation: [...cells.rotation],\n order: [...cells.order],\n groups: [...cells.groups],\n mode: [...cells.mode],\n };\n}\n\n/**\n * This function gives the options of `pack` that a strategy adds: the fit of `shelf`, or the rule, the bands and the turns\n * of `maxrects`. A turnable item turns only with `rotate`, and a locked item does not turn.\n */\nfunction extrasOf(id: LayoutId, options: AnyLayoutOptions, frame: Frame): PackExtras {\n if (id === \"shelf\") return options.fit !== undefined ? { fit: options.fit } : {};\n if (id !== \"maxrects\") return {};\n const out: PackExtras = { rule: options.rule ?? \"bssf\", ...(options.bandHeight === undefined ? {} : { bandHeight: options.bandHeight }) };\n if (options.rotate !== true) return out;\n const turnable = new Set(frame.entries.filter((e) => e.item?.turnable === true && !e.rect.locked).map((e) => e.rect));\n return { ...out, turnable, turned: new Set() };\n}\n\n/**\n * This function gives the move counts of the trace of a strategy: its own move, and the moves of a shelf fit. The trace of\n * `maxrects` has the move of its rule and `move.split`. The rule `bl` has only `move.split`.\n */\nfunction movesOf(id: LayoutId, extras: PackExtras): Record<string, number> {\n if (id === \"maxrects\") {\n const rule = extras.rule ?? \"bssf\";\n const out: Record<string, number> = rule === \"bl\" ? {} : { [MOVES[rule]]: moveCount(MOVES[rule]) };\n out[MOVES.split] = moveCount(MOVES.split);\n return out;\n }\n const out: Record<string, number> = { [MOVES[id]]: moveCount(MOVES[id]) };\n if (extras.fit !== undefined) for (const move of [MOVES.firstFit, MOVES.bestFit]) out[move] = moveCount(move);\n return out;\n}\n\n/** This function gives the turns of a packing for `readFrame`, or `undefined` when no rectangle can turn. */\nfunction turnsOf(extras: PackExtras, transposed: boolean): FrameTurns | undefined {\n return extras.turned === undefined ? undefined : { rects: extras.turned, turn: frameTurn(transposed) };\n}\n\n/** This function packs an input with a fixed size or a fixed width with one strategy of `pack`. */\nfunction packFixedWidth(id: LayoutId, input: PackInput, options: AnyLayoutOptions, transposed = false): PackOutput {\n const start = now();\n const frame = buildFrame(input, false, id === \"maxrects\" && options.rotate === true);\n const rects = rectsOf(frame);\n const extras = extrasOf(id, options, frame);\n clearMoves();\n if (frame.w > 0) pack(rects, outerOf(frame), { strategy: id, sortOrder: options.sortOrder, space: spaceOf(input, frame), ...extras });\n const output = readFrame(input, frame, [], [], turnsOf(extras, transposed));\n return { ...output, trace: [{ id, ms: now() - start, measures: { \"pack.overflow\": output.overflow.length, ...movesOf(id, extras) } }] };\n}\n\n/** This function makes the strategy of one function of `pack`. */\nfunction layoutStrategy<O extends AnyLayoutOptions>(\n id: LayoutId,\n family: string,\n catalog: string[],\n cells: Pick<Supports, \"obstacleMove\" | \"order\"> & Partial<Pick<Supports, \"rotation\">>,\n defaults: O,\n): Strategy<O> {\n const self: Strategy<O> = {\n id,\n family,\n catalog,\n supports: supportsOf({ ...LAYOUT_CELLS, ...cells }),\n defaults: { ...defaults },\n deterministic: true,\n pack(input, options, context) {\n assertSupported(self.supports, input);\n const o = { ...self.defaults, ...options };\n switch (input.container.fixed) {\n case \"height\":\n return viaAxes(input, context.previous, (turned) => packFixedWidth(id, turned, o, true));\n case \"none\":\n return logSweep.search(input, self, context, o);\n default:\n return packFixedWidth(id, input, o);\n }\n },\n };\n return self;\n}\n\n/** The defaults of `rows`, `skyline` and `shelf`. */\nconst LAYOUT_DEFAULTS: LayoutStrategyOptions = { sortOrder: \"height-desc\", samples: 48 };\n\n/**\n * The strategy `rows` uses `packRows`: a guillotine row packing with a recursive gap fill. With obstacles, locked items or a\n * container shape, the rows go around the holes of the free space and lose the gap fill. Turnable items, groups and item\n * shapes throw `UnsupportedCell`.\n */\nexport const rows: Strategy<LayoutStrategyOptions> = layoutStrategy(\"rows\", \"shelf\", [\"rows-gap-fill\", \"rows-input\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\", \"hard\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `skyline` uses `packSkyline`: each item goes to the lowest place where it fits. It packs around the\n * locked items and the fixed obstacles, in each container shape. Turnable items, groups and item shapes throw `UnsupportedCell`.\n */\nexport const skyline: Strategy<LayoutStrategyOptions> = layoutStrategy(\"skyline\", \"skyline\", [\"skyline-bl\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `shelf` uses `packShelf`: rows filled left to right, around the locked items and the fixed obstacles.\n * With the sort order `input`, the rows keep the rank order. Turnable items, groups and item shapes throw `UnsupportedCell`.\n * The option `fit` selects a shelf rule of roadmap item k21: `next`, `first` or `best`. The default has no `fit`.\n */\nexport const shelf: Strategy<LayoutStrategyOptions> = layoutStrategy(\"shelf\", \"shelf\", [\"shelf-nf\", \"shelf-nfdh\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\", \"hard\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `maxrects` uses `packMaxRects`: the MaxRects packer of roadmap item k24. It keeps the list of the maximal\n * free rectangles, and the option `rule` chooses the free rectangle for each item. The default rule is `bssf`.\n *\n * - The free rectangles go around the locked items and the fixed obstacles. A plain rectangle container gives exact free\n * rectangles. Another shape gives an inner approximation with horizontal bands.\n * - With `rotate`, each turnable item that is not locked can turn by 90 degrees. Groups and item shapes throw `UnsupportedCell`.\n */\nexport const maxrects: Strategy<MaxRectsStrategyOptions> = layoutStrategy(\n \"maxrects\",\n \"maxrects\",\n [\"maxrects-bssf\", \"maxrects-blsf\", \"maxrects-baf\", \"maxrects-bl\", \"maxrects-cp\", \"maxrects-locked\"],\n { obstacleMove: [\"fixed\"], order: [\"free\", \"soft\"], rotation: [\"none\", \"quarter\"] },\n { ...LAYOUT_DEFAULTS, rule: \"bssf\", rotate: false },\n);\n\n/**\n * The size search `log-sweep` uses `packFree` of 0.1.2: widths on a log scale, then the widths near the best width. It\n * wraps `rows`, `skyline`, `shelf` and `maxrects`. The objective is the area of the frame times `1 + aspectWeight * aspectError`.\n */\nexport const logSweep: SizeSearch = {\n id: \"log-sweep\",\n search(input: PackInput, inner: Strategy, context: PackContext, options?: unknown): PackOutput {\n if (input.container.fixed !== \"none\") return inner.pack(input, options ?? inner.defaults, context);\n const id = inner.id;\n if (id !== \"rows\" && id !== \"skyline\" && id !== \"shelf\" && id !== \"maxrects\") throw new UnsupportedCell(\"containerSize\", cellOf(input).containerSize);\n const o = { ...(inner.defaults as AnyLayoutOptions), ...(options as Partial<AnyLayoutOptions> | undefined) };\n const start = now();\n const frame = buildFrame(input, false, id === \"maxrects\" && o.rotate === true);\n const extras = extrasOf(id, o, frame);\n const result = packFree(rectsOf(frame), new Rect<number>(), {\n strategy: id,\n sortOrder: o.sortOrder,\n space: spaceOf(input, frame),\n samples: o.samples,\n aspect: input.container.aspect ?? 1,\n aspectWeight: input.container.aspectWeight ?? 1,\n ...extras,\n });\n const ms = now() - start;\n const runs = result.tried.length + 1;\n const output = readFrame(input, frame, [], [], turnsOf(extras, false));\n return {\n ...output,\n trace: [\n { id: \"log-sweep\", ms, measures: { \"pack.search.widths\": result.tried.length, \"pack.search.ms\": ms } },\n { id, ms: ms / runs, measures: { \"pack.overflow\": output.overflow.length, ...movesOf(id, extras) } },\n ],\n };\n },\n};\n\n/** This function tells if the insides of two rectangles overlap by more than `EPS`. */\nfunction overlaps(a: Rect, b: Rect): boolean {\n return (\n Math.min(a.right(), b.right()) - Math.max(a.position.x, b.position.x) > EPS &&\n Math.min(a.bottom(), b.bottom()) - Math.max(a.position.y, b.position.y) > EPS\n );\n}\n\n/** This function packs an input with a fixed size or a fixed width with a push cascade. */\nfunction pushFixedWidth(input: PackInput, options: PushStrategyOptions, previous: PackOutput | undefined): PackOutput {\n const start = now();\n const frame = buildFrame(input, true);\n const before = new Map(previous?.placements.map((p) => [p.id, p]));\n const positioned: Entry[] = [];\n const pending: Entry[] = [];\n const obstacles = frame.entries.filter((e) => e.obstacle !== undefined);\n const starts = new Map(obstacles.map((e) => [e, { x: e.rect.position.x, y: e.rect.position.y }]));\n const lockedItems = frame.entries.filter((e) => e.item !== undefined && e.rect.locked);\n\n for (const e of frame.entries) {\n const item = e.item;\n if (item === undefined || e.rect.locked) continue;\n const x = item.x ?? before.get(item.id)?.x;\n const y = item.y ?? before.get(item.id)?.y;\n if (x === undefined || y === undefined) {\n pending.push(e);\n continue;\n }\n e.rect.position.set(x - e.dx - frame.ox, y - e.dy - frame.oy);\n positioned.push(e);\n }\n\n // The cascade: each item in the order of its rank pushes the others, and then it stays\n const inPlay = frame.entries.filter((e) => !pending.includes(e)).map((e) => e.rect);\n const maxShoves = options.maxShovesPerItem * Math.max(1, inPlay.length);\n let cascaded = 0;\n for (const e of positioned) {\n cascaded += pushCascade(e.rect, inPlay, { gap: 0, maxShoves }).length;\n e.rect.locked = true;\n }\n\n // An obstacle that the cascade pushed out of the container or onto a locked item goes back to its start\n const { bounds } = frame;\n const moved: { id: string; x: number; y: number }[] = [];\n for (const e of obstacles) {\n const startAt = starts.get(e)!;\n const x = e.rect.position.x + e.dx + frame.ox;\n const y = e.rect.position.y + e.dy + frame.oy;\n const b = boundsOf(e.obstacle!.region);\n const out = x < bounds.x - EPS || y < bounds.y - EPS || x + b.w > bounds.x + bounds.w + EPS || y + b.h > bounds.y + bounds.h + EPS;\n if (out || lockedItems.some((l) => overlaps(l.rect, e.rect))) e.rect.position.set(startAt.x, startAt.y);\n else if (Math.abs(e.rect.position.x - startAt.x) > EPS || Math.abs(e.rect.position.y - startAt.y) > EPS) moved.push({ id: e.obstacle!.id, x, y });\n }\n const pushMs = now() - start;\n\n // Each item that is out of the area or overlaps a kept rectangle goes to the skyline, around the kept rectangles\n const kept = [...obstacles, ...lockedItems].map((e) => e.rect);\n for (const e of positioned) {\n const r = e.rect;\n const inside = r.position.x >= -EPS && r.position.y >= -EPS && r.right() <= frame.w + EPS && r.bottom() <= frame.h + EPS;\n if (inside && !kept.some((k) => overlaps(k, r))) kept.push(r);\n else pending.push(e);\n }\n const skylineStart = now();\n for (const r of kept) {\n r.locked = true;\n r.wasPacked = true;\n }\n if (pending.length > 0 && frame.w > 0) {\n for (const e of pending) {\n e.rect.locked = false;\n e.rect.wasPacked = false;\n }\n packSkyline([...pending.map((e) => e.rect), ...kept], outerOf(frame), { sortOrder: options.sortOrder });\n }\n const output = readFrame(input, frame, [], moved);\n return {\n ...output,\n trace: [\n { id: \"push\", ms: pushMs, measures: { \"pack.push.moved\": moved.length, [MOVES.push]: cascaded } },\n { id: \"skyline\", ms: now() - skylineStart, measures: { \"pack.push.replaced\": pending.length, \"pack.overflow\": output.overflow.length } },\n ],\n };\n}\n\n/**\n * The strategy `push` uses `pushCascade`. Each item starts at its `x` and `y`, or at its place in `context.previous`.\n * Each item in rank order pushes the items and the movable obstacles that it overlaps. Then `packSkyline` places the\n * items with no start, and the items that still overlap. The output tells each obstacle that moved.\n */\nexport const push: Strategy<PushStrategyOptions> = {\n id: \"push\",\n family: \"incremental\",\n catalog: [\"incremental-push\"],\n supports: supportsOf({\n containerSize: [\"fixed\", \"freeHeight\", \"freeWidth\"],\n containerShape: [\"rect\"],\n obstacleMove: [\"fixed\", \"free\"],\n itemShape: [\"rect\"],\n rotation: [\"none\"],\n order: [\"free\", \"soft\"],\n groups: [\"none\"],\n mode: [\"incremental\"],\n }),\n defaults: { sortOrder: \"height-desc\", maxShovesPerItem: 8 },\n deterministic: true,\n pack(input, options, context) {\n assertSupported(push.supports, input);\n const o = { ...push.defaults, ...options };\n if (input.container.fixed === \"height\") return viaAxes(input, context.previous, (turned, previous) => pushFixedWidth(turned, o, previous));\n return pushFixedWidth(input, o, context.previous);\n },\n};\n","import type { Item, PackInput, PackOutput } from \"./contract.ts\";\nimport type { Rect } from \"./rect.ts\";\n\n/**\n * This function makes a `PackInput` from the `Rect` objects of 0.1. The id of each item is the index of its rectangle.\n *\n * - `fixedSize` gives `fixed` set to `size`, `fixedWidth` gives `width`, and an outer rectangle without them gives `none`.\n * - A locked rectangle gives a locked item at its position.\n * - An outer rectangle at a position other than 0, 0 gives a rectangle shape at that position.\n */\nexport function fromRects<T>(rects: readonly Rect<T>[], outer: Rect<T>): PackInput {\n const fixed = outer.fixedSize ? \"size\" : outer.fixedWidth ? \"width\" : \"none\";\n const container: PackInput[\"container\"] = {\n fixed,\n ...(fixed === \"none\" ? {} : { w: outer.size.x }),\n ...(fixed === \"size\" ? { h: outer.size.y } : {}),\n ...(outer.position.x !== 0 || outer.position.y !== 0\n ? { shape: { kind: \"rect\", x: outer.position.x, y: outer.position.y, w: outer.size.x, h: outer.size.y } as const }\n : {}),\n };\n const items = rects.map(\n (r, i): Item => ({ id: String(i), w: r.size.x, h: r.size.y, ...(r.locked ? { locked: true, x: r.position.x, y: r.position.y } : {}) }),\n );\n return { container, items };\n}\n\n/**\n * This function writes an output back into the `Rect` objects of `fromRects`. It sets the position and `wasPacked` of\n * each rectangle, and the free sides of the outer rectangle. It gives the outer rectangle.\n */\nexport function toRects<T>(output: PackOutput, rects: Rect<T>[], outer: Rect<T>): Rect<T> {\n const placements = new Map(output.placements.map((p) => [p.id, p]));\n for (const [i, r] of rects.entries()) {\n const p = placements.get(String(i));\n if (p === undefined) {\n r.wasPacked = r.locked;\n continue;\n }\n r.position.set(p.x, p.y);\n r.wasPacked = true;\n }\n if (!outer.fixedSize) {\n if (!outer.fixedWidth) outer.size.x = output.size.w;\n outer.size.y = output.size.h;\n }\n return outer;\n}\n","// This file is generated. Do not edit it. `bench/choose-sets.ts` writes it from the records of one run of `bench.yml`:\n// the corpus `pack-screen-v1`, the run 40652567756 and the commit f6a489b.\n// The sets of each cell come from all the 1305 inputs. A cell with fewer than 12 inputs is thin.\n// The default member count of a cell is the largest prefix with a median summed time of 50 ms or less on these CI records.\n\nimport type { PortfolioSets } from \"./portfolio-cell.ts\";\n\n/** The table of the per-cell portfolio: the sets of 1, 2 and 3 members of each cell, with their training scores. The run 40652567756 gives it. */\nexport const PORTFOLIO_SETS: PortfolioSets = {\n \"source\": {\n \"corpus\": \"pack-screen-v1\",\n \"run\": \"40652567756\",\n \"commit\": \"f6a489b\",\n \"inputs\": 1305,\n \"frameMs\": 50\n },\n \"entries\": {\n \"rows\": {\n \"id\": \"rows\",\n \"strategy\": \"rows\"\n },\n \"skyline\": {\n \"id\": \"skyline\",\n \"strategy\": \"skyline\"\n },\n \"shelf\": {\n \"id\": \"shelf\",\n \"strategy\": \"shelf\"\n },\n \"shelf-next\": {\n \"id\": \"shelf-next\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"next\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"shelf-first\": {\n \"id\": \"shelf-first\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"first\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"shelf-best\": {\n \"id\": \"shelf-best\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"best\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"maxrects-bssf\": {\n \"id\": \"maxrects-bssf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"bssf\"\n }\n },\n \"maxrects-blsf\": {\n \"id\": \"maxrects-blsf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"blsf\"\n }\n },\n \"maxrects-baf\": {\n \"id\": \"maxrects-baf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"baf\"\n }\n },\n \"maxrects-bl\": {\n \"id\": \"maxrects-bl\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"bl\"\n }\n },\n \"maxrects-cp\": {\n \"id\": \"maxrects-cp\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"cp\"\n }\n }\n },\n \"all\": {\n \"inputs\": 1305,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.02,\n \"wins\": 857,\n \"winShare\": 0.657,\n \"msMean\": 4.92\n },\n \"2\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.011,\n \"wins\": 1052,\n \"winShare\": 0.806,\n \"msMean\": 9.582\n },\n \"3\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 1139,\n \"winShare\": 0.873,\n \"msMean\": 22.228\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.015,\n \"2\": 2.004,\n \"3\": 3.074\n },\n \"defaultMembers\": 3\n },\n \"shapes\": {\n \"circle\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.015,\n \"wins\": 147,\n \"winShare\": 0.7,\n \"msMean\": 10.026\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 170,\n \"winShare\": 0.81,\n \"msMean\": 35.829\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 190,\n \"winShare\": 0.905,\n \"msMean\": 46.593\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.441,\n \"2\": 7.24,\n \"3\": 10.252\n },\n \"defaultMembers\": 3\n },\n \"convex\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.015,\n \"wins\": 134,\n \"winShare\": 0.638,\n \"msMean\": 6.123\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.004,\n \"wins\": 188,\n \"winShare\": 0.895,\n \"msMean\": 11.606\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.002,\n \"wins\": 197,\n \"winShare\": 0.938,\n \"msMean\": 26.072\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.133,\n \"2\": 3.31,\n \"3\": 7.783\n },\n \"defaultMembers\": 3\n },\n \"ellipse\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.024,\n \"wins\": 144,\n \"winShare\": 0.686,\n \"msMean\": 9.772\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.008,\n \"wins\": 166,\n \"winShare\": 0.79,\n \"msMean\": 34.101\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 185,\n \"winShare\": 0.881,\n \"msMean\": 49.128\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.553,\n \"2\": 7.079,\n \"3\": 11.095\n },\n \"defaultMembers\": 3\n },\n \"holes\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.016,\n \"wins\": 133,\n \"winShare\": 0.633,\n \"msMean\": 2.009\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.011,\n \"wins\": 165,\n \"winShare\": 0.786,\n \"msMean\": 8.29\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 184,\n \"winShare\": 0.876,\n \"msMean\": 13.146\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.755,\n \"2\": 1.626,\n \"3\": 2.455\n },\n \"defaultMembers\": 3\n },\n \"polygon\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.03,\n \"wins\": 131,\n \"winShare\": 0.624,\n \"msMean\": 1.663\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.012,\n \"wins\": 181,\n \"winShare\": 0.862,\n \"msMean\": 7.39\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 194,\n \"winShare\": 0.924,\n \"msMean\": 8.701\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.477,\n \"2\": 1.176,\n \"3\": 1.636\n },\n \"defaultMembers\": 3\n },\n \"rect\": {\n \"inputs\": 255,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 168,\n \"winShare\": 0.659,\n \"msMean\": 0.808\n },\n \"2\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 217,\n \"winShare\": 0.851,\n \"msMean\": 2.807\n },\n \"3\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 230,\n \"winShare\": 0.902,\n \"msMean\": 3.514\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.094,\n \"2\": 0.426,\n \"3\": 0.582\n },\n \"defaultMembers\": 3\n }\n },\n \"cells\": {\n \"circle/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bl\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.004,\n \"fillRegret\": 0.073,\n \"wins\": 11,\n \"winShare\": 0.314,\n \"msMean\": 0.886\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.014,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 1.82\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 2.277\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.938,\n \"2\": 1.86,\n \"3\": 2.105\n },\n \"defaultMembers\": 3\n },\n \"circle/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"skyline\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.025,\n \"wins\": 15,\n \"winShare\": 0.429,\n \"msMean\": 1.028\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 1.317\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 2.411\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.971,\n \"2\": 1.237,\n \"3\": 2.388\n },\n \"defaultMembers\": 3\n },\n \"circle/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.004,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 3.076\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 5.919\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 8.775\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.837,\n \"2\": 5.565,\n \"3\": 8.149\n },\n \"defaultMembers\": 3\n },\n \"circle/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 4.611\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 14.686\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 14.686\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.648,\n \"2\": 14.826,\n \"3\": 14.826\n },\n \"defaultMembers\": 2\n },\n \"circle/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bssf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.003,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 6.057\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 12.12\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 18.376\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.153,\n \"2\": 9.576,\n \"3\": 13.853\n },\n \"defaultMembers\": 3\n },\n \"circle/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 44.25\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 49.4\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 61.283\n }\n },\n \"prefixMedianMs\": {\n \"1\": 46.745,\n \"2\": 51.433,\n \"3\": 63.649\n },\n \"defaultMembers\": 1\n },\n \"convex/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bl\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.007,\n \"fillRegret\": 0.208,\n \"wins\": 5,\n \"winShare\": 0.143,\n \"msMean\": 0.577\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.006,\n \"fillRegret\": 0.017,\n \"wins\": 24,\n \"winShare\": 0.686,\n \"msMean\": 1.301\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.016,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 2.184\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.513,\n \"2\": 1.225,\n \"3\": 1.931\n },\n \"defaultMembers\": 3\n },\n \"convex/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"skyline\"\n ],\n \"2\": [\n \"skyline\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"skyline\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.012,\n \"wins\": 27,\n \"winShare\": 0.771,\n \"msMean\": 1.868\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 31,\n \"winShare\": 0.886,\n \"msMean\": 2.564\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 3.43\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.235,\n \"2\": 2.194,\n \"3\": 3.119\n },\n \"defaultMembers\": 3\n },\n \"convex/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 2.416\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 5.037\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 7.013\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.083,\n \"2\": 4.342,\n \"3\": 5.664\n },\n \"defaultMembers\": 3\n },\n \"convex/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf\",\n \"shelf-first\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 3.347\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 3.533\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 4.004\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.337,\n \"2\": 3.513,\n \"3\": 3.956\n },\n \"defaultMembers\": 3\n },\n \"convex/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.383,\n \"2\": 2.383,\n \"3\": 2.383\n },\n \"defaultMembers\": 1\n },\n \"convex/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-best\"\n ],\n \"2\": [\n \"shelf-best\"\n ],\n \"3\": [\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n }\n },\n \"prefixMedianMs\": {\n \"1\": 18.965,\n \"2\": 18.965,\n \"3\": 18.965\n },\n \"defaultMembers\": 1\n },\n \"ellipse/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"skyline\",\n \"shelf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.005,\n \"fillRegret\": 0.061,\n \"wins\": 12,\n \"winShare\": 0.343,\n \"msMean\": 0.896\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.026,\n \"wins\": 19,\n \"winShare\": 0.543,\n \"msMean\": 1.675\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.016,\n \"wins\": 23,\n \"winShare\": 0.657,\n \"msMean\": 1.684\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.815,\n \"2\": 1.348,\n \"3\": 1.356\n },\n \"defaultMembers\": 3\n },\n \"ellipse/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"skyline\"\n ],\n \"2\": [\n \"skyline\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"skyline\",\n \"maxrects-cp\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.003,\n \"fillRegret\": 0.059,\n \"wins\": 17,\n \"winShare\": 0.486,\n \"msMean\": 0.362\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.021,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 1.407\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 2.39\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.272,\n \"2\": 1.286,\n \"3\": 2.153\n },\n \"defaultMembers\": 3\n },\n \"ellipse/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-bssf\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.004,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 3.074\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 5.854\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 8.393\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.802,\n \"2\": 5.274,\n \"3\": 7.336\n },\n \"defaultMembers\": 3\n },\n \"ellipse/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"skyline\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 5.351\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 7.226\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 17.469\n }\n },\n \"prefixMedianMs\": {\n \"1\": 5.179,\n \"2\": 7.083,\n \"3\": 17.026\n },\n \"defaultMembers\": 3\n },\n \"ellipse/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bssf\"\n ],\n \"2\": [\n \"maxrects-bssf\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bssf\",\n \"maxrects-blsf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 5.533\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 10.704\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 16.428\n }\n },\n \"prefixMedianMs\": {\n \"1\": 5.067,\n \"2\": 9.535,\n \"3\": 13.728\n },\n \"defaultMembers\": 3\n },\n \"ellipse/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n }\n },\n \"prefixMedianMs\": {\n \"1\": 43.159,\n \"2\": 43.159,\n \"3\": 43.159\n },\n \"defaultMembers\": 1\n },\n \"holes/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.05,\n \"wins\": 19,\n \"winShare\": 0.543,\n \"msMean\": 0.392\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 0.671\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.068\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.377,\n \"2\": 0.652,\n \"3\": 1.036\n },\n \"defaultMembers\": 3\n },\n \"holes/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-baf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-baf\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.014,\n \"wins\": 23,\n \"winShare\": 0.657,\n \"msMean\": 0.4\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 27,\n \"winShare\": 0.771,\n \"msMean\": 0.951\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.115\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.391,\n \"2\": 0.912,\n \"3\": 1.024\n },\n \"defaultMembers\": 3\n },\n \"holes/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.003,\n \"fillRegret\": 0.005,\n \"wins\": 20,\n \"winShare\": 0.571,\n \"msMean\": 0.636\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.001,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.13\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.869\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.599,\n \"2\": 1.068,\n \"3\": 1.804\n },\n \"defaultMembers\": 3\n },\n \"holes/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 0.882\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 1.147\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 2.229\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.837,\n \"2\": 1.134,\n \"3\": 2.261\n },\n \"defaultMembers\": 3\n },\n \"holes/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.011,\n \"2\": 1.011,\n \"3\": 1.011\n },\n \"defaultMembers\": 1\n },\n \"holes/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 28.492\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.002,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 36.636\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.002,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 36.636\n }\n },\n \"prefixMedianMs\": {\n \"1\": 29.151,\n \"2\": 37.4,\n \"3\": 37.4\n },\n \"defaultMembers\": 2\n },\n \"polygon/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-blsf\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.08,\n \"wins\": 18,\n \"winShare\": 0.514,\n \"msMean\": 0.209\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.034,\n \"wins\": 22,\n \"winShare\": 0.629,\n \"msMean\": 0.393\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 0.445\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.178,\n \"2\": 0.351,\n \"3\": 0.401\n },\n \"defaultMembers\": 3\n },\n \"polygon/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.04,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 0.233\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.009,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 0.278\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.008,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 0.482\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.175,\n \"2\": 0.222,\n \"3\": 0.408\n },\n \"defaultMembers\": 3\n },\n \"polygon/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.002,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 0.369\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 0.785\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 1.174\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.378,\n \"2\": 0.809,\n \"3\": 1.182\n },\n \"defaultMembers\": 3\n },\n \"polygon/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-blsf\",\n \"shelf-first\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 0.552\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 1.036\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.406\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.519,\n \"2\": 0.989,\n \"3\": 1.357\n },\n \"defaultMembers\": 3\n },\n \"polygon/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.769,\n \"2\": 0.769,\n \"3\": 0.769\n },\n \"defaultMembers\": 1\n },\n \"polygon/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-blsf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 31,\n \"winShare\": 0.886,\n \"msMean\": 11.31\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 16.795\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 24.24\n }\n },\n \"prefixMedianMs\": {\n \"1\": 10.381,\n \"2\": 16.052,\n \"3\": 23.567\n },\n \"defaultMembers\": 3\n },\n \"rect/1/identical\": {\n \"inputs\": 10,\n \"thin\": true\n },\n \"rect/10/heavyTail\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"rows\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"rows\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.049,\n \"wins\": 22,\n \"winShare\": 0.55,\n \"msMean\": 0.02\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 29,\n \"winShare\": 0.725,\n \"msMean\": 0.047\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 33,\n \"winShare\": 0.825,\n \"msMean\": 0.07\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.016,\n \"2\": 0.037,\n \"3\": 0.055\n },\n \"defaultMembers\": 3\n },\n \"rect/10/identical\": {\n \"inputs\": 5,\n \"thin\": true\n },\n \"rect/10/uniform\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-next\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-next\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.035,\n \"wins\": 27,\n \"winShare\": 0.675,\n \"msMean\": 0.043\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.015,\n \"wins\": 33,\n \"winShare\": 0.825,\n \"msMean\": 0.114\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 37,\n \"winShare\": 0.925,\n \"msMean\": 0.173\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.027,\n \"2\": 0.086,\n \"3\": 0.11\n },\n \"defaultMembers\": 3\n },\n \"rect/100/heavyTail\": {\n \"inputs\": 45,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-bssf\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.003,\n \"wins\": 32,\n \"winShare\": 0.711,\n \"msMean\": 0.097\n },\n \"2\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 39,\n \"winShare\": 0.867,\n \"msMean\": 0.24\n },\n \"3\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 42,\n \"winShare\": 0.933,\n \"msMean\": 0.368\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.083,\n \"2\": 0.217,\n \"3\": 0.324\n },\n \"defaultMembers\": 3\n },\n \"rect/100/identical\": {\n \"inputs\": 5,\n \"thin\": true\n },\n \"rect/100/uniform\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 31,\n \"winShare\": 0.775,\n \"msMean\": 0.208\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 38,\n \"winShare\": 0.95,\n \"msMean\": 0.413\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 39,\n \"winShare\": 0.975,\n \"msMean\": 0.648\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.196,\n \"2\": 0.367,\n \"3\": 0.519\n },\n \"defaultMembers\": 3\n },\n \"rect/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.554,\n \"2\": 0.554,\n \"3\": 0.554\n },\n \"defaultMembers\": 1\n },\n \"rect/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 4.737\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 9.299\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 9.299\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.185,\n \"2\": 8.887,\n \"3\": 8.887\n },\n \"defaultMembers\": 2\n }\n }\n};\n","// The per-cell portfolio of roadmap item k20, part 2 (`docs/PACKER.md`, \"The per-cell portfolio\"). The cell of an input\n// comes from the input itself. The table `PORTFOLIO_SETS` gives the members of each cell.\n\nimport type { PackInput } from \"./contract.ts\";\nimport { countCell, type CountScale } from \"./layout-input.ts\";\nimport { PORTFOLIO_SETS } from \"./portfolio-sets.ts\";\nimport type { PortfolioEntry } from \"./portfolio.ts\";\nimport { cellOf, type DimensionValue } from \"./strategy.ts\";\n\n/** The band of the size spread of the items of an input. */\nexport type SpreadBand = \"identical\" | \"uniform\" | \"heavyTail\";\n\n/** The cell of an input for the per-cell portfolio: the container shape, the band of the item count and the band of the size spread. */\nexport interface PortfolioCell {\n shape: DimensionValue<\"containerShape\">;\n /** The band of the item count, as `countCell` gives it: `1`, `10`, `100`, `1k` or `10k`. */\n count: CountScale;\n spread: SpreadBand;\n}\n\n/**\n * The thresholds of the spread bands. The statistic is the standard deviation of the natural log of the linear size\n * `sqrt(w * h)` of each item.\n *\n * - Below `identical`, the band is `identical`.\n * - Below `uniform`, the band is `uniform`.\n * - At `uniform` or above, the band is `heavyTail`.\n *\n * On the seeds 1 to 7 of the generators of `pack-screen-v1`, the uniform sizes give 0.258 at most. The heavy-tail sizes give 0.278 at least.\n */\nexport const SPREAD_THRESHOLDS: Readonly<{ identical: number; uniform: number }> = Object.freeze({ identical: 0.02, uniform: 0.27 });\n\n/** A cell with fewer inputs than this count in the training records is thin. It uses the set of its container shape. */\nexport const THIN_INPUTS = 12;\n\n/**\n * The frame budget of the default member count, in milliseconds. The default count of a cell is the largest prefix of its\n * set of 3 that fits this budget. The prefix fits when its median summed member time on the CI records is this value or less.\n * The count is 1 or more at all times.\n * The default output thus does not depend on the clock: a time limit is only the opt-in option `budgetMs`.\n */\nexport const PORTFOLIO_FRAME_MS = 50;\n\n/** This function gives the key of a cell: `<shape>/<count>/<spread>`, for example `rect/100/uniform`. */\nexport function cellKey(cell: PortfolioCell): string {\n return `${cell.shape}/${cell.count}/${cell.spread}`;\n}\n\n/**\n * This function gives the spread statistic of an input: the standard deviation of the natural log of `sqrt(w * h)` of each item.\n * An item with no area does not count. Fewer than 2 items with an area give 0.\n */\nexport function spreadOf(input: PackInput): number {\n const logs: number[] = [];\n for (const item of input.items) {\n const area = item.w * item.h;\n if (area > 0 && Number.isFinite(area)) logs.push(Math.log(area) / 2);\n }\n if (logs.length < 2) return 0;\n const mean = logs.reduce((a, b) => a + b, 0) / logs.length;\n return Math.sqrt(logs.reduce((a, b) => a + (b - mean) ** 2, 0) / logs.length);\n}\n\n/** This function gives the band of a spread statistic by `SPREAD_THRESHOLDS`. */\nexport function spreadBand(spread: number): SpreadBand {\n if (spread < SPREAD_THRESHOLDS.identical) return \"identical\";\n return spread < SPREAD_THRESHOLDS.uniform ? \"uniform\" : \"heavyTail\";\n}\n\n/**\n * This function gives the cell of an input for the per-cell portfolio. The function reads only the input, not a corpus id.\n *\n * - `shape` is the `containerShape` of `cellOf`.\n * - `count` is `countCell` of the count of the items.\n * - `spread` is `spreadBand` of `spreadOf`.\n */\nexport function portfolioCell(input: PackInput): PortfolioCell {\n return { shape: cellOf(input).containerShape, count: countCell(input.items.length), spread: spreadBand(spreadOf(input)) };\n}\n\n/** The sizes of the sets of the table. */\nexport type PortfolioSize = 1 | 2 | 3;\n\n/** The score of a set on its training records. The regrets are means against the oracle of the pool. */\nexport interface PortfolioTrainScore {\n inputs: number;\n /** The mean of the hard breaks of the winner of the set less those of the oracle */\n hardRegret: number;\n /** The mean of `pack.overflow.excessArea` of the winner of the set less that of the oracle */\n excessAreaRegret: number;\n /** The mean of `pack.fill` of the oracle less that of the winner of the set */\n fillRegret: number;\n /** The inputs where the winner of the set is in the last kept list of the oracle */\n wins: number;\n winShare: number;\n /** The mean of the summed times of the members on an input, in milliseconds */\n msMean: number;\n}\n\n/** The sets of one cell of the table, by size, with their training scores. */\nexport interface PortfolioCellSets {\n /** The inputs of the cell in the training records */\n inputs: number;\n /** The value `true` when `inputs` is less than `THIN_INPUTS`. A thin cell has no sets. It uses the sets of its shape. */\n thin: boolean;\n /** The ids of the members of each set, in the order of the pick. A thin cell has none. */\n sets?: Readonly<Record<`${PortfolioSize}`, readonly string[]>>;\n /** The training score of each set */\n train?: Readonly<Record<`${PortfolioSize}`, PortfolioTrainScore>>;\n /** The median over the inputs of the summed member times of each prefix of the set of 3, in milliseconds. A missing record counts 0. */\n prefixMedianMs?: Readonly<Record<`${PortfolioSize}`, number>>;\n /** The default member count: the largest prefix of the set of 3 with `prefixMedianMs` of `PORTFOLIO_FRAME_MS` or less, and 1 at least */\n defaultMembers?: PortfolioSize;\n}\n\n/** The table of the per-cell portfolio. `bench/choose-sets.ts` generates it from the records of one run. */\nexport interface PortfolioSets {\n /** The run of the records: the corpus, the commit of the code and the id of the run of `bench.yml`. It also has the frame budget of the default counts. */\n source: Readonly<{ corpus: string; run: string; commit: string; inputs: number; frameMs: number }>;\n /** The member of each id: a strategy of the registry with some options */\n entries: Readonly<Record<string, PortfolioEntry>>;\n /** The sets of all the inputs. They are the fixed default of an input of an unknown shape. */\n all: PortfolioCellSets;\n /** The sets of each container shape. They are the fallback of a thin cell and of an unknown cell. */\n shapes: Readonly<Record<string, PortfolioCellSets>>;\n /** The sets of each cell, by `cellKey` */\n cells: Readonly<Record<string, PortfolioCellSets>>;\n}\n\n/** The source of the members of an input in the table. */\nexport type PortfolioSetSource = \"cell\" | \"shape\" | \"default\";\n\n/** This function gives the sets of an input from a table: the sets of its cell, or of its shape, or of all the inputs. */\nexport function portfolioSetOf(input: PackInput, table: PortfolioSets = PORTFOLIO_SETS): { key: string; source: PortfolioSetSource; sets: PortfolioCellSets } {\n const cell = portfolioCell(input);\n const key = cellKey(cell);\n const own = table.cells[key];\n if (own?.sets !== undefined) return { key, source: \"cell\", sets: own };\n const shape = table.shapes[cell.shape];\n if (shape?.sets !== undefined) return { key, source: \"shape\", sets: shape };\n return { key, source: \"default\", sets: table.all };\n}\n\n/**\n * This function gives the `k` members of an input for `packPortfolio`. The members are the set of the cell of the input.\n * A thin cell or an unknown cell takes the set of its shape, or the set of all the inputs. The function throws a `RangeError` for a `k` other than 1, 2 or 3.\n */\nexport function portfolioMembers(input: PackInput, k: number, table: PortfolioSets = PORTFOLIO_SETS): PortfolioEntry[] {\n if (k !== 1 && k !== 2 && k !== 3) throw new RangeError(`The size of a portfolio set is 1, 2 or 3, not ${k}.`);\n const ids = portfolioSetOf(input, table).sets.sets![`${k}`];\n return ids.map((id) => {\n const e = table.entries[id];\n if (e === undefined) throw new RangeError(`The table of the portfolio sets has no entry \"${id}\".`);\n return { ...e };\n });\n}\n\n/**\n * This function gives the default member count of an input: `defaultMembers` of the sets of its cell, its shape or all the inputs.\n * With a `k`, the count is not more than `k`. A table without the count gives `k`, or 3 without a `k`.\n */\nexport function portfolioDefaultMembers(input: PackInput, k?: number, table: PortfolioSets = PORTFOLIO_SETS): number {\n const count = portfolioSetOf(input, table).sets.defaultMembers ?? 3;\n return k === undefined ? count : Math.min(count, k);\n}\n","import { boundsOf, rectInRegion, regionHitsRect, translate, type ContainerTest, type PackHard, type Rect, type Region } from \"@mark1russell7/layout-contract\";\nimport { DEFAULT_TOLERANCE, marginOf, RECORD_EPS, turnItem, type Item, type PackInput, type PackOutput, type Placement, type Tolerance } from \"./contract.ts\";\n\nexport type { ContainerTest, PackHard } from \"@mark1russell7/layout-contract\";\n\n/** A box with its margin: the left, top, right and bottom edges. */\ninterface Box {\n l: number;\n t: number;\n r: number;\n b: number;\n}\n\n/** This function tells if the insides of two boxes overlap by more than a tolerance on each axis. */\nfunction overlap(a: Box, b: Box, tolerance: number): boolean {\n return Math.min(a.r, b.r) - Math.max(a.l, b.l) > tolerance && Math.min(a.b, b.b) - Math.max(a.t, b.t) > tolerance;\n}\n\n/** This function gives the box made smaller by a tolerance on each side, as a rectangle. */\nfunction inner(box: Box, tolerance: number): Rect {\n return { x: box.l + tolerance, y: box.t + tolerance, w: box.r - box.l - 2 * tolerance, h: box.b - box.t - 2 * tolerance };\n}\n\n/**\n * This function counts the breaks of the 4 hard rules of the packer for an output.\n *\n * - `no-overlap`: each pair of items with their margins, and each pair of an item and an obstacle, that overlap by more than `tolerance.overlap`.\n * - `in-container`: each item with its margin that goes out of a fixed side by more than `tolerance.overlap`. The inset of\n * the container makes each fixed side smaller (decision 3 of `docs/PACKER.md`).\n * - `locked-kept`: each locked item that moved by more than `RECORD_EPS`, or that has no placement.\n * - `complete`: each item with no placement that is not in the overflow. A locked item breaks `locked-kept` in its place.\n *\n * A locked item with no placement stays at its input position for `no-overlap` and `in-container`. A locked item with no\n * `x` or no `y` in the input is a bad input. The rules skip it, as `packHard` of the contract does. `checkInput` finds it.\n *\n * The test of an obstacle is exact: a circle, an ellipse and a polygon with holes count only their insides, as in `packHard`.\n * The rules read a shape of the container or of an item as its bounding box (decision 5). The bounding box of an item\n * shape is relative to the position of the item. The result has no tolerance in it.\n *\n * With `options.exactContainer`, a shaped container with the size `fixed` also uses its true outline for `in-container`.\n * A box then counts when `rectInRegion` of the contract tells that it is not in the shape, as in `packHard`.\n * For that test, the box grows by the inset and becomes smaller by `tolerance.overlap` on each side. The default is `false`.\n */\nexport function checkHard(\n input: PackInput,\n output: PackOutput,\n tolerance: Pick<Tolerance, \"overlap\"> = DEFAULT_TOLERANCE,\n options: ContainerTest = {},\n): PackHard {\n const tol = tolerance.overlap;\n const placements = new Map<string, Placement>();\n for (const p of output.placements) if (!placements.has(p.id)) placements.set(p.id, p);\n const overflow = new Set(output.overflow);\n let lockedKept = 0;\n let complete = 0;\n\n const boxes: Box[] = [];\n for (const item of input.items) {\n if (item.locked === true && (item.x === undefined || item.y === undefined)) continue;\n const lockedAt = item.locked === true ? { x: item.x!, y: item.y! } : undefined;\n let p: Pick<Placement, \"x\" | \"y\" | \"turn\"> | undefined = placements.get(item.id);\n if (p === undefined) {\n if (lockedAt === undefined) {\n if (!overflow.has(item.id)) complete += 1;\n continue;\n }\n // A locked item with no placement breaks locked-kept, and it stays at its input position for the other rules\n lockedKept += 1;\n p = lockedAt;\n } else if (lockedAt !== undefined) {\n if (Math.abs(p.x - lockedAt.x) > RECORD_EPS || Math.abs(p.y - lockedAt.y) > RECORD_EPS) lockedKept += 1;\n }\n const placed: Item = p.turn === 90 ? turnItem(item) : item;\n const m = marginOf(placed);\n const area = placed.shape === undefined ? { x: 0, y: 0, w: placed.w, h: placed.h } : boundsOf(placed.shape);\n const l = p.x + area.x;\n const t = p.y + area.y;\n boxes.push({ l: l - m.left, t: t - m.top, r: l + area.w + m.right, b: t + area.h + m.bottom });\n }\n\n const moved = new Map(output.moved.map((m) => [m.id, m]));\n const obstacles: Region[] = (input.obstacles ?? []).map((o) => {\n const at = moved.get(o.id);\n if (at === undefined) return o.region;\n const b = boundsOf(o.region);\n return translate(o.region, at.x - b.x, at.y - b.y);\n });\n\n let overlaps = 0;\n for (const [i, a] of boxes.entries()) {\n for (let j = i + 1; j < boxes.length; j++) if (overlap(a, boxes[j]!, tol)) overlaps += 1;\n if (obstacles.length === 0) continue;\n const rect = inner(a, tol);\n for (const region of obstacles) if (regionHitsRect(region, rect)) overlaps += 1;\n }\n\n const { container } = input;\n const shape = container.shape === undefined ? undefined : boundsOf(container.shape);\n const x = shape?.x ?? 0;\n const y = shape?.y ?? 0;\n const w = shape?.w ?? container.w ?? Infinity;\n const h = shape?.h ?? container.h ?? Infinity;\n const inset = container.inset ?? 0;\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n const exact = options.exactContainer === true && container.fixed === \"size\" ? container.shape : undefined;\n let outside = 0;\n for (const box of boxes) {\n const outX = fixedW && (box.l < x + inset - tol || box.r > x + w - inset + tol);\n const outY = fixedH && (box.t < y + inset - tol || box.b > y + h - inset + tol);\n if (outX || outY) outside += 1;\n else if (exact !== undefined && !rectInRegion(exact, inner({ l: box.l - inset, t: box.t - inset, r: box.r + inset, b: box.b + inset }, tol))) outside += 1;\n }\n return { \"no-overlap\": overlaps, \"in-container\": outside, \"locked-kept\": lockedKept, complete };\n}\n","// The portfolio of roadmap item k20, part 1 (`docs/PACKER.md`, \"The portfolio\"). A portfolio packs an input with each\n// member and keeps the best output by the one pick rule `selectBest` of the contract. Nothing default uses it.\n\nimport { pickMoves, portfolio, type Member, type Portfolio, type PortfolioKey, type PortfolioPick, type SelectLevel } from \"@mark1russell7/layout-contract\";\nimport { checkHard } from \"./check.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { outputHash } from \"./layout-input.ts\";\nimport { MEASURE_SPECS, measure, roundMeasures, type LayoutMeasures } from \"./measures.ts\";\nimport { packWith, strategy } from \"./registry.ts\";\n\n/** A member of `packPortfolio`: a strategy of the registry with some options. The id names the member in the trace. */\nexport interface PortfolioEntry {\n id: string;\n /** The id of a strategy of the registry */\n strategy: string;\n /** The options of the member over the defaults of the strategy */\n options?: unknown;\n}\n\n/** The options of `packPortfolio`. The time limit and the member limit are those of `portfolio` of the contract. */\nexport interface PackPortfolioOptions {\n /** The id of the portfolio. The default is `portfolio`. */\n id?: string;\n /** The seed of each member. The default is 0, as for `packWith`. */\n seed?: number;\n /** The time limit in milliseconds. Without it, each member runs. A cut member makes the pick not deterministic. */\n budgetMs?: number;\n /** The largest count of members that run */\n maxMembers?: number;\n /** The clock in milliseconds. The default is `performance.now`. */\n now?: () => number;\n}\n\n/** The id of the trace stage of `packPortfolio`. Its measure `move.pick` is 1 when the pick is not member 0. */\nexport const PORTFOLIO_STAGE = \"portfolio\";\n\n/**\n * The levels of the pick of `packPortfolio` and of the portfolio report of the benchmark, in order. Level 0 is `hard`.\n *\n * - `hard`: the count of hard breaks of `checkHard` with `exactContainer`. Lower is better, with the minimum effect 0.\n * - `pack.overflow.excessArea`: the overflow area above its bound. Lower is better.\n * - `pack.fill`: the fill of the hull. Higher is better.\n */\nexport const PORTFOLIO_LEVELS: readonly SelectLevel[] = Object.freeze([\n { id: \"hard\", spec: { direction: \"lower\", minEffect: 0 } },\n { id: \"pack.overflow.excessArea\", spec: MEASURE_SPECS[\"pack.overflow.excessArea\"] },\n { id: \"pack.fill\", spec: MEASURE_SPECS[\"pack.fill\"] },\n] as SelectLevel[]);\n\n/** This function gives the count of the hard breaks of an output: the sum of `checkHard` with `exactContainer`. */\nexport function hardBreaks(input: PackInput, output: PackOutput): number {\n return Object.values(checkHard(input, output, undefined, { exactContainer: true })).reduce((sum, n) => sum + n, 0);\n}\n\n/**\n * This function makes an opt-in portfolio of strategies of the registry with `portfolio` of the contract.\n * Its `pick(input)` packs the input with each member and gives the output of the winner, its id and the trace.\n *\n * - A member is a strategy id, or a `PortfolioEntry` with options. The members run in the given order.\n * - `members` is a list, or a function of the input that gives the list. The strategy `portfolio` uses the function form.\n * - The key is the hard breaks, then `pack.overflow.excessArea`, then `pack.fill`. `PORTFOLIO_LEVELS` gives the specs.\n * - The key reads the measures after `roundMeasures`, as a record keeps them. A replay of the records gives the same pick.\n * - The hash of the key is `outputHash`. `selectBest` of the contract picks the winner.\n * - The output of the winner gets the trace stage `portfolio` with `move.pick` of `pickMoves`.\n * - The function throws a `RangeError` for an unknown strategy, an empty list and two members with the same id.\n * With the function form, `pick` throws this error for the list of an input.\n */\nexport function packPortfolio(\n members: readonly (string | PortfolioEntry)[] | ((input: PackInput) => readonly (string | PortfolioEntry)[]),\n options: PackPortfolioOptions = {},\n): Portfolio<PackInput, PackOutput> {\n const seed = options.seed ?? 0;\n const toMembers = (given: readonly (string | PortfolioEntry)[]): Member<PackInput, PackOutput>[] =>\n given.map((m) => {\n const e = typeof m === \"string\" ? { id: m, strategy: m } : m;\n strategy(e.strategy);\n return { id: e.id, run: (input: PackInput): PackOutput => packWith(e.strategy, input, e.options, seed) };\n });\n const list = typeof members === \"function\" ? (input: PackInput): Member<PackInput, PackOutput>[] => toMembers(members(input)) : toMembers(members);\n // Each level reads the measures of one output, so the measures of an output are computed one time\n const cache = new WeakMap<PackOutput, LayoutMeasures>();\n const measured = (input: PackInput, output: PackOutput): LayoutMeasures => {\n let m = cache.get(output);\n if (m === undefined) {\n // The key reads the measures as a record keeps them, so a replay of the records gives the same pick\n m = roundMeasures(measure(input, output));\n cache.set(output, m);\n }\n return m;\n };\n const key: PortfolioKey<PackInput, PackOutput> = {\n hard: hardBreaks,\n levels: PORTFOLIO_LEVELS.slice(1).map((level) => ({\n id: level.id,\n spec: level.spec,\n value: (input: PackInput, output: PackOutput): number => measured(input, output)[level.id as \"pack.fill\" | \"pack.overflow.excessArea\"],\n })),\n hash: outputHash,\n };\n const limits = {\n ...(options.budgetMs !== undefined ? { budgetMs: options.budgetMs } : {}),\n ...(options.maxMembers !== undefined ? { maxMembers: options.maxMembers } : {}),\n ...(options.now !== undefined ? { now: options.now } : {}),\n };\n const inner = portfolio(options.id ?? PORTFOLIO_STAGE, list, key, limits);\n const pick = (input: PackInput): PortfolioPick<PackOutput> => {\n const got = inner.pick(input);\n const stage = { id: PORTFOLIO_STAGE, measures: { \"move.pick\": pickMoves(got.trace).pick } };\n return { ...got, output: { ...got.output, trace: [...(got.output.trace ?? []), stage] } };\n };\n return { id: inner.id, pick, run: (input: PackInput): PackOutput => pick(input).output };\n}\n","// The strategy `portfolio` of roadmap item k20, part 2 (`docs/PACKER.md`, \"The per-cell portfolio\"). It is a composite\n// strategy: it packs an input with the members of the set of its cell, and it keeps the best output. Nothing default uses it.\n\nimport { maxrects, push, rows, shelf, skyline } from \"./adapters.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { portfolioDefaultMembers, portfolioMembers } from \"./portfolio-cell.ts\";\nimport { PORTFOLIO_SETS } from \"./portfolio-sets.ts\";\nimport { packPortfolio } from \"./portfolio.ts\";\nimport type { PackContext, Strategy, Supports } from \"./strategy.ts\";\n\n/** The options of the strategy `portfolio`. Without options, the output is a function of the input only. */\nexport interface PortfolioStrategyOptions {\n /** The size of the set of the cell: 2 or 3. With `k`, each of the `k` members runs. Without `k`, the strategy uses the set of 3. */\n k?: 2 | 3;\n /** The largest count of the members that run. Without `k` and `maxMembers`, the count is `defaultMembers` of the cell. */\n maxMembers?: number;\n /** The opt-in time limit of `portfolio` of the contract, in milliseconds. It has no default. A cut member makes the result not deterministic. */\n budgetMs?: number;\n}\n\n/** The single strategies that the members of the table use */\nconst SINGLES: readonly Strategy[] = [rows, skyline, shelf, push, maxrects] as Strategy[];\n\n/** This function gives the union of the supports of the strategies of the members of the table. */\nfunction unionSupports(): Supports {\n const used = new Set(Object.values(PORTFOLIO_SETS.entries).map((e) => e.strategy));\n const out: Record<string, string[]> = {};\n for (const s of SINGLES.filter((x) => used.has(x.id))) {\n for (const [dim, values] of Object.entries(s.supports) as [string, string[]][]) {\n const list = (out[dim] ??= []);\n for (const v of values) if (!list.includes(v)) list.push(v);\n }\n }\n return out as unknown as Supports;\n}\n\n/**\n * The strategy `portfolio`: `packPortfolio` with the function form `(input) => portfolioMembers(input, k)`. The seed of the context\n * goes to each member. Its supports are the union of the supports of the members.\n *\n * - Without `k` and `maxMembers`, the members are the set of 3 of the cell, and `maxMembers` is `defaultMembers` of the cell.\n * The default output thus does not depend on the clock.\n * - A member that does not support the cell of an input throws, and it does not win. When each member throws, the strategy throws the first error.\n * - The option `budgetMs` goes to `portfolio` of the contract. The first member always runs.\n * - The strategy throws a `RangeError` for a `k` other than 2 or 3.\n */\nexport const portfolioStrategy: Strategy<PortfolioStrategyOptions> = {\n id: \"portfolio\",\n family: \"portfolio\",\n catalog: [],\n supports: unionSupports(),\n defaults: {},\n deterministic: true,\n pack(input: PackInput, options: PortfolioStrategyOptions, context: PackContext): PackOutput {\n const { k, maxMembers, budgetMs } = options;\n if (k !== undefined && k !== 2 && k !== 3) throw new RangeError(`The option k of the strategy portfolio is 2 or 3, not ${String(k)}.`);\n const size = k ?? 3;\n const count = maxMembers ?? (k === undefined ? portfolioDefaultMembers(input) : undefined);\n const limits = { ...(count === undefined ? {} : { maxMembers: count }), ...(budgetMs === undefined ? {} : { budgetMs }) };\n return packPortfolio((x: PackInput) => portfolioMembers(x, size), { id: k === undefined ? \"portfolio\" : `portfolio-k${k}`, seed: context.seed, ...limits }).run(input);\n },\n};\n","import { maxrects, push, rows, shelf, skyline } from \"./adapters.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { portfolioStrategy } from \"./portfolio-strategy.ts\";\nimport { createContext, type Strategy } from \"./strategy.ts\";\n\n/** Each single strategy of the package. The benchmark starts each one on each input of the corpus. */\nexport const strategies: readonly Strategy[] = Object.freeze([rows, skyline, shelf, push, maxrects] as Strategy[]);\n\n/**\n * The composite strategies of the registry: each one packs an input with other strategies. They are not in `strategies`.\n * Since 0.2.7, the list has `portfolio` of roadmap item k20.\n */\nexport const composites: readonly Strategy[] = Object.freeze([portfolioStrategy] as Strategy[]);\n\n/** This function gives the strategy with an id, also a composite strategy. It throws a `RangeError` for an id that the registry does not have. */\nexport function strategy(id: string): Strategy {\n const found = strategies.find((s) => s.id === id) ?? composites.find((s) => s.id === id);\n if (found === undefined) throw new RangeError(`The registry has no strategy \"${id}\".`);\n return found;\n}\n\n/**\n * This function packs an input with the strategy of an id. The options go over the defaults of the strategy. The\n * context gets `mulberry32` with the seed. The default seed is 0.\n */\nexport function packWith(id: string, input: PackInput, options?: unknown, seed = 0): PackOutput {\n const s = strategy(id);\n const merged: unknown = { ...(s.defaults as object), ...(options as object | undefined) };\n return s.pack(input, merged, createContext(seed));\n}\n","// The seeded generators of the corpus (`docs/FORMAT.md`, \"The generators\"). Each generator is a pipeline of 3 steps: the\n// container, then the obstacles, then the boxes. Each step has its own random numbers: `mulberry32` of\n// `fnv1a32(\"<seed>:<step>\")`. Thus a packing input and a routing input with the same seed get the same obstacles.\n\nimport type { Item, LayoutContainer, Obstacle, Region } from \"./contract.ts\";\nimport {\n countCell,\n fnv1a32,\n hashInput,\n round3,\n type CorpusCell,\n type GeneratorParams,\n type GeneratedInput,\n type ObstacleLayout,\n type SizeDistribution,\n} from \"./layout-input.ts\";\nimport { mulberry32, type DimensionValue } from \"./strategy.ts\";\n\n/** The largest count of boxes that a generator makes. */\nconst MAX_COUNT = 100_000;\n\n/** A seeded generator of `layout-input/1` files. The same version, parameters and seed give the same file, byte for byte. */\nexport interface CorpusGenerator<P extends GeneratorParams = GeneratorParams> {\n /** The name. The file writes it in `generator.name`. */\n readonly name: string;\n /** The version. A change of the output of a generator needs a new version. */\n readonly version: number;\n /** The default set of an input, when the call gives no set. */\n readonly set: string;\n /** The default parameters. */\n readonly defaults: Readonly<P>;\n /** For each parameter with a list of values, the values that the generator accepts. */\n readonly values: { readonly [K in keyof P]?: readonly P[K][] };\n /** This method gives the full parameters: the defaults with the given parameters over them. It throws a `RangeError` for a bad parameter. */\n withDefaults(params?: Partial<P>): P;\n /** This method gives the cell of each input of the parameters. The cell does not depend on the seed. */\n cell(params?: Partial<P>): CorpusCell;\n /** This method gives the input file of a seed. The `id` is `<set>/<family>/s<seed>`. */\n generate(seed: number, params?: Partial<P>, set?: string): GeneratedInput;\n}\n\n/** The parts of a file that a generator makes. */\ntype Parts = Pick<GeneratedInput, \"container\" | \"boxes\"> & { obstacles: Obstacle[] };\n\n/** The data of a generator, before `defineGenerator` adds the common steps. */\ninterface GeneratorSpec<P extends GeneratorParams> {\n name: string;\n version: number;\n set: string;\n defaults: P;\n values: { readonly [K in keyof P]?: readonly P[K][] };\n family(params: P): string;\n cell(params: P): CorpusCell;\n build(seed: number, params: P): Parts;\n}\n\n/** A rectangle area in which the obstacles and the sizes of the boxes are made. */\ninterface Frame {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** This function gives the random numbers of one step of a seed. */\nconst stepRandom = (seed: number, step: string): (() => number) => mulberry32(fnv1a32(`${seed}:${step}`));\n\n/** A whole number from lo to hi, both included. */\nconst int = (r: () => number, lo: number, hi: number): number => lo + Math.floor(r() * (hi - lo + 1));\n\n/** A whole number from the floor of lo to the floor of hi, both included. The upper end is not less than the lower end at any time. */\nconst span = (r: () => number, lo: number, hi: number): number => {\n const a = Math.floor(lo);\n return int(r, a, Math.max(a, Math.floor(hi)));\n};\n\n/** A number from lo to hi. */\nconst between = (r: () => number, lo: number, hi: number): number => lo + r() * (hi - lo);\n\n/** This function gives an index with a probability in proportion to its weight. */\nconst pick = (r: () => number, weights: readonly number[]): number => {\n let x = r() * weights.reduce((a, b) => a + b, 0);\n for (const [i, w] of weights.entries()) {\n x -= w;\n if (x < 0) return i;\n }\n return weights.length - 1;\n};\n\n/** This function gives a copy of a value with each number rounded by `round3`. A key with the value `undefined` goes. */\nfunction roundNumbers<T>(value: T): T {\n if (typeof value === \"number\") return round3(value) as T;\n if (Array.isArray(value)) return value.map(roundNumbers) as T;\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) if (v !== undefined) out[k] = roundNumbers(v);\n return out as T;\n }\n return value;\n}\n\n/** This function gives the cell of an input with rectangle items, no rotation, no order and no groups. */\nfunction cellWith(\n containerSize: DimensionValue<\"containerSize\">,\n containerShape: DimensionValue<\"containerShape\">,\n obstacles: ObstacleLayout,\n sizes: SizeDistribution,\n count: number,\n locked = false,\n): CorpusCell {\n const cell: CorpusCell = {\n containerSize,\n containerShape,\n itemShape: \"rect\",\n rotation: \"none\",\n order: \"free\",\n groups: \"none\",\n obstacles,\n sizes,\n count: countCell(count),\n mode: \"offline\",\n };\n if (obstacles !== \"none\" || locked) cell.obstacleMove = \"fixed\";\n return cell;\n}\n\n/** This function makes a generator from its data. It adds the defaults, the checks, the stamp, the rounding and the hash. */\nfunction defineGenerator<P extends GeneratorParams>(spec: GeneratorSpec<P>): CorpusGenerator<P> {\n const withDefaults = (params: Partial<P> = {}): P => {\n const full: GeneratorParams = { ...spec.defaults };\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (!(key in spec.defaults)) throw new RangeError(`The generator \"${spec.name}\" has no parameter \"${key}\".`);\n full[key] = value;\n }\n for (const [key, allowed] of Object.entries(spec.values) as [string, readonly (string | number)[] | undefined][]) {\n if (allowed !== undefined && !allowed.includes(full[key]!)) {\n throw new RangeError(`The parameter \"${key}\" of the generator \"${spec.name}\" has no value \"${String(full[key])}\".`);\n }\n }\n const count = full[\"count\"];\n if (count !== undefined && (typeof count !== \"number\" || !Number.isInteger(count) || count < 0 || count > MAX_COUNT)) {\n throw new RangeError(`The parameter \"count\" of the generator \"${spec.name}\" is a whole number from 0 to ${MAX_COUNT}.`);\n }\n return full as P;\n };\n\n return Object.freeze({\n name: spec.name,\n version: spec.version,\n set: spec.set,\n defaults: Object.freeze({ ...spec.defaults }),\n values: spec.values,\n withDefaults,\n cell: (params?: Partial<P>): CorpusCell => spec.cell(withDefaults(params)),\n generate(seed: number, params?: Partial<P>, set: string = spec.set): GeneratedInput {\n if (!Number.isInteger(seed) || seed < 0) throw new RangeError(`The seed is a whole number from 0. It is ${seed}.`);\n const full = withDefaults(params);\n const family = spec.family(full);\n const { container, obstacles, boxes } = spec.build(seed, full);\n const file: Omit<GeneratedInput, \"hash\"> = roundNumbers({\n schema: \"layout-input/1\" as const,\n id: `${set}/${family}/s${seed}`,\n set,\n family,\n seed,\n source: \"made-up\",\n generator: { name: spec.name, version: spec.version, params: full, seed },\n container,\n obstacles,\n boxes,\n edges: [],\n });\n return { ...file, hash: hashInput(file) };\n },\n });\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The shared generator `rect-scattered` (version 1). `docs/FORMAT.md` gives it step by step. Do not change its output.\n\n/** The parameters of `rect-scattered`. */\nexport type RectScatteredParams = { count: number };\n\n/** The shared generator `rect-scattered` of `docs/FORMAT.md`, version 1: rectangle obstacles at random places in a fixed rectangle. */\nexport const rectScattered: CorpusGenerator<RectScatteredParams> = defineGenerator<RectScatteredParams>({\n name: \"rect-scattered\",\n version: 1,\n set: \"xcheck-v1\",\n defaults: { count: 40 },\n values: {},\n family: () => \"rect-scattered\",\n cell: (p) => cellWith(\"fixed\", \"rect\", \"scattered\", \"uniform\", p.count),\n build(seed, { count }) {\n let r = stepRandom(seed, \"container\");\n const w = int(r, 600, 1000);\n const h = int(r, 400, 800);\n const container: LayoutContainer = { w, h, fixed: \"size\" };\n\n r = stepRandom(seed, \"obstacles\");\n const n = int(r, 3, 8);\n const obstacles: Obstacle[] = [];\n for (let i = 0; i < n; i++) {\n const ow = int(r, 40, 160);\n const oh = int(r, 40, 160);\n const x = int(r, 0, w - ow);\n const y = int(r, 0, h - oh);\n obstacles.push({ id: `o${i}`, region: { kind: \"rect\", x, y, w: ow, h: oh } });\n }\n\n r = stepRandom(seed, \"boxes\");\n const boxes: Item[] = [];\n for (let i = 0; i < count; i++) {\n const bw = int(r, 20, 120);\n const bh = int(r, 20, 80);\n boxes.push({ id: `b${i}`, w: bw, h: bh });\n }\n return { container, obstacles, boxes };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The steps of `rect-grid` and of the families of a user interface.\n\n/** The values of `containerSize` that the generators make. */\nconst CONTAINER_SIZES = [\"fixed\", \"freeHeight\", \"freeWidth\", \"freeAspect\", \"freeArea\"] as const;\n/** The values of `containerShape`. */\nconst CONTAINER_SHAPES = [\"rect\", \"convex\", \"polygon\", \"circle\", \"ellipse\", \"holes\"] as const;\n/** The values of `obstacles`. */\nconst OBSTACLE_LAYOUTS = [\"none\", \"center\", \"scattered\", \"wall\", \"corridors\", \"touching\", \"edge\"] as const;\n/** The values of `sizes`. */\nconst SIZE_DISTRIBUTIONS = [\"identical\", \"nearIdentical\", \"uniform\", \"heavyTail\", \"bimodal\", \"extremeAspect\"] as const;\n\n/** This function gives the container of a size value for the nominal rectangle `w` by `h`, with an optional shape. */\nfunction containerOf(size: DimensionValue<\"containerSize\">, w: number, h: number, shape?: Region): LayoutContainer {\n const containers: Record<DimensionValue<\"containerSize\">, LayoutContainer> = {\n fixed: { w, h, fixed: \"size\" },\n freeHeight: { w, fixed: \"width\" },\n freeWidth: { h, fixed: \"height\" },\n freeAspect: { fixed: \"none\", aspect: round3(w / h) },\n freeArea: { fixed: \"none\", aspectWeight: 0 },\n };\n const container = containers[size];\n return shape === undefined ? container : { ...container, shape };\n}\n\n/** This function gives the 4 corners of a rectangle, clockwise from the top left. */\nconst corners = (x: number, y: number, w: number, h: number): [number, number][] => [\n [x, y],\n [x + w, y],\n [x + w, y + h],\n [x, y + h],\n];\n\n/**\n * This function gives the shape of a container in the rectangle `w` by `h`, and its frame. The frame is a rectangle in\n * the shape. The obstacles and the sizes of the boxes come from the frame.\n */\nfunction shapeOf(r: () => number, shape: DimensionValue<\"containerShape\">, w: number, h: number): { region?: Region; frame: Frame } {\n const m = Math.min(w, h);\n switch (shape) {\n case \"rect\":\n return { frame: { x: 0, y: 0, w, h } };\n case \"convex\": {\n // A rectangle with its 4 corners cut at 45 degrees\n const [a, b, c, d] = [0, 1, 2, 3].map(() => span(r, m * 0.1, m * 0.25)) as [number, number, number, number];\n const points: [number, number][] = [[a, 0], [w - b, 0], [w, b], [w, h - c], [w - c, h], [d, h], [0, h - d], [0, a]];\n const top = Math.max(a, b);\n const bottom = Math.max(c, d);\n return { region: { kind: \"polygon\", points }, frame: { x: 0, y: top, w, h: h - top - bottom } };\n }\n case \"polygon\": {\n // A rectangle with a notch at the bottom right: an L shape\n const nw = span(r, w * 0.25, w * 0.45);\n const nh = span(r, h * 0.25, h * 0.45);\n const points: [number, number][] = [[0, 0], [w, 0], [w, h - nh], [w - nw, h - nh], [w - nw, h], [0, h]];\n return { region: { kind: \"polygon\", points }, frame: { x: 0, y: 0, w: w - nw, h } };\n }\n case \"circle\": {\n const cx = Math.floor(w / 2);\n const cy = Math.floor(h / 2);\n const radius = Math.min(cx, cy);\n const side = 2 * Math.floor((radius * Math.SQRT2 - 1) / 2);\n return { region: { kind: \"circle\", cx, cy, r: radius }, frame: { x: cx - side / 2, y: cy - side / 2, w: side, h: side } };\n }\n case \"ellipse\": {\n const rx = Math.floor(w / 2);\n const ry = Math.floor(h / 2);\n const a = Math.floor(rx / Math.SQRT2);\n const b = Math.floor(ry / Math.SQRT2);\n return { region: { kind: \"ellipse\", cx: rx, cy: ry, rx, ry }, frame: { x: rx - a, y: ry - b, w: 2 * a, h: 2 * b } };\n }\n case \"holes\": {\n // 1 or 2 rectangle holes, the first in the left half and the second in the right half\n const count = int(r, 1, 2);\n const holes: [number, number][][] = [];\n for (let i = 0; i < count; i++) {\n const hw = span(r, w * 0.08, w * 0.15);\n const hh = span(r, h * 0.1, h * 0.25);\n const x = i === 0 ? span(r, 20, w / 2 - hw - 10) : span(r, w / 2 + 10, w - hw - 20);\n const y = span(r, 20, h - hh - 20);\n holes.push(corners(x, y, hw, hh));\n }\n return { region: { kind: \"polygon\", points: corners(0, 0, w, h), holes }, frame: { x: 0, y: 0, w, h } };\n }\n }\n}\n\n/** This function gives the obstacles of a layout in a frame. Each obstacle is a rectangle with whole-number sides. */\nfunction obstaclesOf(r: () => number, layout: ObstacleLayout, f: Frame): Obstacle[] {\n const m = Math.min(f.w, f.h);\n const rects: { x: number; y: number; w: number; h: number }[] = [];\n switch (layout) {\n case \"none\":\n break;\n case \"center\": {\n const w = span(r, f.w * 0.15, f.w * 0.3);\n const h = span(r, f.h * 0.15, f.h * 0.3);\n const jx = Math.floor(f.w * 0.05);\n const jy = Math.floor(f.h * 0.05);\n rects.push({ x: f.x + Math.floor((f.w - w) / 2) + int(r, -jx, jx), y: f.y + Math.floor((f.h - h) / 2) + int(r, -jy, jy), w, h });\n break;\n }\n case \"scattered\": {\n const n = int(r, 3, 8);\n for (let i = 0; i < n; i++) {\n const w = span(r, m * 0.05, m * 0.2);\n const h = span(r, m * 0.05, m * 0.2);\n rects.push({ x: int(r, f.x, f.x + f.w - w), y: int(r, f.y, f.y + f.h - h), w, h });\n }\n break;\n }\n case \"wall\": {\n // One long, thin obstacle from one side. It leaves a gap at its other end.\n const vertical = r() < 0.5;\n const across = vertical ? f.w : f.h;\n const along = vertical ? f.h : f.w;\n const thick = span(r, Math.max(1, across * 0.03), Math.max(1, across * 0.06));\n const length = span(r, along * 0.7, along * 0.85);\n const at = span(r, across * 0.3, across * 0.7 - thick);\n const from = r() < 0.5 ? 0 : along - length;\n rects.push(vertical ? { x: f.x + at, y: f.y + from, w: thick, h: length } : { x: f.x + from, y: f.y + at, w: length, h: thick });\n break;\n }\n case \"corridors\": {\n // A grid of blocks, with a narrow path between two blocks and between a block and the border\n const cols = int(r, 2, 4);\n const rows = int(r, 2, 3);\n const path = span(r, m * 0.08, m * 0.15);\n const bw = Math.floor((f.w - (cols + 1) * path) / cols);\n const bh = Math.floor((f.h - (rows + 1) * path) / rows);\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) rects.push({ x: f.x + path + i * (bw + path), y: f.y + path + j * (bh + path), w: bw, h: bh });\n }\n break;\n }\n case \"touching\": {\n // A chain: each obstacle shares a part of a side with the obstacle before it\n const n = int(r, 2, 4);\n let w = span(r, m * 0.08, m * 0.15);\n let h = span(r, m * 0.08, m * 0.15);\n let x = span(r, f.x + f.w * 0.15, f.x + f.w * 0.35);\n let y = span(r, f.y + f.h * 0.15, f.y + f.h * 0.35);\n rects.push({ x, y, w, h });\n for (let i = 1; i < n; i++) {\n const right = r() < 0.5;\n const nw = span(r, m * 0.08, m * 0.15);\n const nh = span(r, m * 0.08, m * 0.15);\n if (right) {\n y = int(r, y, y + Math.floor(h / 2));\n x += w;\n } else {\n x = int(r, x, x + Math.floor(w / 2));\n y += h;\n }\n w = nw;\n h = nh;\n rects.push({ x, y, w, h });\n }\n break;\n }\n case \"edge\": {\n // Each obstacle touches one side of the frame\n const n = int(r, 2, 5);\n for (let i = 0; i < n; i++) {\n const side = int(r, 0, 3);\n const w = span(r, m * 0.06, m * 0.15);\n const h = span(r, m * 0.06, m * 0.15);\n const x = side === 1 ? f.x + f.w - w : side === 3 ? f.x : int(r, f.x, f.x + f.w - w);\n const y = side === 0 ? f.y : side === 2 ? f.y + f.h - h : int(r, f.y, f.y + f.h - h);\n rects.push({ x, y, w, h });\n }\n break;\n }\n }\n return rects.map((rect, i) => ({ id: `o${i}`, region: { kind: \"rect\", ...rect } }));\n}\n\n/**\n * This function gives the boxes of a size distribution for a frame. The mean box has an area of 40 percent of the\n * frame divided by the count. No box is wider or higher than the frame.\n */\nfunction boxesOf(r: () => number, sizes: SizeDistribution, count: number, f: Frame): Item[] {\n const unit = Math.sqrt((f.w * f.h * 0.4) / Math.max(count, 1));\n const fit = (x: number, max: number): number => Math.min(Math.max(round3(x), 0.01), max);\n const boxes: Item[] = new Array<Item>(count);\n const put = (i: number, w: number, h: number): void => {\n boxes[i] = { id: `b${i}`, w: fit(w, f.w), h: fit(h, f.h) };\n };\n switch (sizes) {\n case \"identical\":\n case \"nearIdentical\": {\n const aspect = Math.sqrt(between(r, 0.6, 1.6));\n const bw = unit * aspect;\n const bh = unit / aspect;\n for (let i = 0; i < count; i++) {\n if (sizes === \"identical\") put(i, bw, bh);\n else put(i, bw * (1 + between(r, -0.03, 0.03)), bh * (1 + between(r, -0.03, 0.03)));\n }\n break;\n }\n case \"uniform\":\n for (let i = 0; i < count; i++) put(i, unit * between(r, 0.5, 1.5), unit * between(r, 0.5, 1.5));\n break;\n case \"heavyTail\": {\n // A Pareto distribution with the index 1.6, cut at 60 percent of the frame\n const cap = 0.6 * Math.min(f.w, f.h);\n for (let i = 0; i < count; i++) {\n const s = Math.min(0.6 * unit * (1 - r()) ** (-1 / 1.6), cap);\n put(i, s * between(r, 0.75, 1.33), s * between(r, 0.75, 1.33));\n }\n break;\n }\n case \"bimodal\":\n for (let i = 0; i < count; i++) {\n const s = r() < 0.25 ? 1.8 * unit : 0.6 * unit;\n put(i, s * between(r, 0.85, 1.15), s * between(r, 0.85, 1.15));\n }\n break;\n case \"extremeAspect\":\n for (let i = 0; i < count; i++) {\n const long = unit * between(r, 2.5, 4);\n const short = unit * between(r, 0.15, 0.35);\n if (r() < 0.5) put(i, long, short);\n else put(i, short, long);\n }\n break;\n }\n return boxes;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// `rect-grid`: one input for each point of the grid of the packer dimensions.\n\n/** The parameters of `rect-grid`: one value for each dimension of the taxonomy that it covers. */\nexport type RectGridParams = {\n containerSize: DimensionValue<\"containerSize\">;\n containerShape: DimensionValue<\"containerShape\">;\n obstacles: ObstacleLayout;\n sizes: SizeDistribution;\n count: number;\n};\n\n/**\n * The generator `rect-grid`, version 1: rectangle boxes for each value of `containerSize`, `containerShape`, `obstacles`\n * and `sizes`, with each count. The container is a nominal rectangle of 600 to 1000 by 400 to 800.\n */\nexport const rectGrid: CorpusGenerator<RectGridParams> = defineGenerator<RectGridParams>({\n name: \"rect-grid\",\n version: 1,\n set: \"corpus-v1\",\n defaults: { containerSize: \"fixed\", containerShape: \"rect\", obstacles: \"none\", sizes: \"uniform\", count: 100 },\n values: { containerSize: CONTAINER_SIZES, containerShape: CONTAINER_SHAPES, obstacles: OBSTACLE_LAYOUTS, sizes: SIZE_DISTRIBUTIONS },\n family: (p) => `rect-grid.${p.containerSize}.${p.containerShape}.${p.obstacles}.${p.sizes}.n${p.count}`,\n cell: (p) => cellWith(p.containerSize, p.containerShape, p.obstacles, p.sizes, p.count),\n build(seed, p) {\n let r = stepRandom(seed, \"container\");\n const w = int(r, 600, 1000);\n const h = int(r, 400, 800);\n const { region, frame } = shapeOf(r, p.containerShape, w, h);\n const container = containerOf(p.containerSize, w, h, region);\n\n r = stepRandom(seed, \"obstacles\");\n const obstacles = obstaclesOf(r, p.obstacles, frame);\n\n r = stepRandom(seed, \"boxes\");\n return { container, obstacles, boxes: boxesOf(r, p.sizes, p.count, frame) };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The families of a user interface: gallery, dashboard, cards and word cloud.\n\n/** The parameters of a family of a user interface. */\nexport type UiParams = {\n containerSize: DimensionValue<\"containerSize\">;\n count: number;\n};\n\n/** This function makes the generator of a family of a user interface. The container is 800 to 1400 by 600 to 1000, with no obstacle. */\nfunction uiGenerator(name: string, sizes: SizeDistribution, count: number, boxes: (r: () => number, count: number) => Item[]): CorpusGenerator<UiParams> {\n return defineGenerator<UiParams>({\n name,\n version: 1,\n set: \"corpus-v1\",\n defaults: { containerSize: \"freeHeight\", count },\n values: { containerSize: CONTAINER_SIZES },\n family: (p) => `${name}.${p.containerSize}.n${p.count}`,\n cell: (p) => cellWith(p.containerSize, \"rect\", \"none\", sizes, p.count),\n build(seed, p) {\n const r = stepRandom(seed, \"container\");\n const w = int(r, 800, 1400);\n const h = int(r, 600, 1000);\n return { container: containerOf(p.containerSize, w, h), obstacles: [], boxes: boxes(stepRandom(seed, \"boxes\"), p.count) };\n },\n });\n}\n\n/** The aspects of the thumbnails of a gallery. */\nconst THUMBNAIL_ASPECTS = [1, 4 / 3, 3 / 2, 16 / 9];\n\n/** The generator `gallery`, version 1: thumbnails with one size and one aspect (1, 4:3, 3:2 or 16:9). The default container has a fixed width. */\nexport const gallery: CorpusGenerator<UiParams> = uiGenerator(\"gallery\", \"identical\", 100, (r, count) => {\n const aspect = THUMBNAIL_ASPECTS[int(r, 0, THUMBNAIL_ASPECTS.length - 1)]!;\n const w = int(r, 120, 240);\n return Array.from({ length: count }, (_, i) => ({ id: `b${i}`, w, h: round3(w / aspect) }));\n});\n\n/** The spans of the dashboard tiles in grid units, and their weights. */\nconst TILE_SPANS: readonly [number, number][] = [[1, 1], [2, 1], [1, 2], [2, 2], [3, 2], [4, 2]];\nconst TILE_WEIGHTS = [4, 3, 2, 3, 1, 1];\n\n/** The generator `dashboard`, version 1: tiles in 6 standard sizes, from 1 by 1 to 4 by 2 grid units of 60 to 100. */\nexport const dashboard: CorpusGenerator<UiParams> = uiGenerator(\"dashboard\", \"bimodal\", 10, (r, count) => {\n const unit = int(r, 60, 100);\n return Array.from({ length: count }, (_, i) => {\n const [cw, ch] = TILE_SPANS[pick(r, TILE_WEIGHTS)]!;\n return { id: `b${i}`, w: cw * unit, h: ch * unit };\n });\n});\n\n/** The generator `cards`, version 1: cards with one width from 200 to 320, and a height from 120 to 420 each. */\nexport const cards: CorpusGenerator<UiParams> = uiGenerator(\"cards\", \"uniform\", 100, (r, count) => {\n const w = int(r, 200, 320);\n return Array.from({ length: count }, (_, i) => ({ id: `b${i}`, w, h: int(r, 120, 420) }));\n});\n\n/** The font sizes of a word cloud, and their weights: many small words and few large words. */\nconst FONT_SIZES = [12, 14, 16, 20, 28, 40];\nconst FONT_WEIGHTS = [30, 25, 20, 12, 8, 5];\n\n/** The generator `word-cloud`, version 1: boxes of text. The height comes from 6 font sizes, the width from 3 to 12 letters. */\nexport const wordCloud: CorpusGenerator<UiParams> = uiGenerator(\"word-cloud\", \"heavyTail\", 100, (r, count) =>\n Array.from({ length: count }, (_, i) => {\n const font = FONT_SIZES[pick(r, FONT_WEIGHTS)]!;\n const letters = int(r, 3, 12);\n return { id: `b${i}`, w: round3(letters * font * 0.6), h: round3(font * 1.25) };\n }),\n);\n\n// ---------------------------------------------------------------------------------------------------------------------\n// `edge-cases`: the inputs at the limits.\n\n/** The cases of `edge-cases`. */\nexport type EdgeCase = \"empty\" | \"one\" | \"oversize\" | \"exactTiling\" | \"touchObstacles\";\n\n/** The parameters of `edge-cases`. The cases `empty` and `one` ignore `count`. */\nexport type EdgeCaseParams = { case: EdgeCase; count: number };\n\n/** The values of `case`. */\nconst EDGE_CASES = [\"empty\", \"one\", \"oversize\", \"exactTiling\", \"touchObstacles\"] as const;\n\n/** This function gives the largest divisor of `n` that is not more than the square root of `n`. */\nconst rowsOf = (n: number): number => {\n for (let d = Math.floor(Math.sqrt(n)); d > 1; d--) if (n % d === 0) return d;\n return 1;\n};\n\n/**\n * The generator `edge-cases`, version 1. Each case has a fixed rectangle container.\n *\n * - `empty`: no box.\n * - `one`: one box.\n * - `oversize`: `count` boxes. One box is wider than the container.\n * - `exactTiling`: `count` identical boxes that fill the container with no free space.\n * - `touchObstacles`: a locked box on the top of an obstacle, and boxes as wide as the path between 2 obstacles.\n */\nexport const edgeCases: CorpusGenerator<EdgeCaseParams> = defineGenerator<EdgeCaseParams>({\n name: \"edge-cases\",\n version: 1,\n set: \"corpus-v1\",\n defaults: { case: \"oversize\", count: 12 },\n values: { case: EDGE_CASES },\n family: (p) => (p.case === \"empty\" || p.case === \"one\" ? `edge-cases.${p.case}` : `edge-cases.${p.case}.n${p.count}`),\n cell: (p) => {\n switch (p.case) {\n case \"empty\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", 0);\n case \"one\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", 1);\n case \"oversize\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"heavyTail\", p.count);\n case \"exactTiling\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", p.count);\n case \"touchObstacles\":\n return cellWith(\"fixed\", \"rect\", \"corridors\", \"uniform\", p.count, true);\n }\n },\n build(seed, p) {\n const needsBoxes = p.case === \"oversize\" || p.case === \"exactTiling\" || p.case === \"touchObstacles\";\n if (needsBoxes && p.count < 1) throw new RangeError(`The case \"${p.case}\" of \"edge-cases\" needs a count of 1 or more.`);\n\n let r = stepRandom(seed, \"container\");\n let w: number;\n let h: number;\n let tile = { w: 0, h: 0, cols: 0, rows: 0 };\n if (p.case === \"exactTiling\") {\n // The container step also picks the size of the tile, because the tiles give the size of the container\n const rows = rowsOf(p.count);\n tile = { w: int(r, 40, 120), h: int(r, 30, 90), cols: p.count / rows, rows };\n w = tile.cols * tile.w;\n h = tile.rows * tile.h;\n } else {\n w = int(r, 600, 1000);\n h = int(r, 400, 800);\n }\n const container: LayoutContainer = { w, h, fixed: \"size\" };\n\n r = stepRandom(seed, \"obstacles\");\n const obstacles: Obstacle[] = [];\n let path = 0;\n let first = { x: 0, y: 0 };\n if (p.case === \"touchObstacles\") {\n path = int(r, 40, 100);\n const ow = int(r, 60, 150);\n const oh = int(r, 100, 200);\n first = { x: span(r, w * 0.1, w * 0.25), y: span(r, h * 0.2, h * 0.4) };\n obstacles.push({ id: \"o0\", region: { kind: \"rect\", x: first.x, y: first.y, w: ow, h: oh } });\n obstacles.push({ id: \"o1\", region: { kind: \"rect\", x: first.x + ow + path, y: first.y, w: int(r, 60, 150), h: oh } });\n }\n\n r = stepRandom(seed, \"boxes\");\n const boxes: Item[] = [];\n switch (p.case) {\n case \"empty\":\n break;\n case \"one\":\n boxes.push({ id: \"b0\", w: int(r, 40, 200), h: int(r, 30, 150) });\n break;\n case \"oversize\": {\n const big = int(r, 0, p.count - 1);\n for (let i = 0; i < p.count; i++) {\n if (i === big) boxes.push({ id: `b${i}`, w: w + int(r, 10, 200), h: int(r, 40, 100) });\n else boxes.push({ id: `b${i}`, w: int(r, 20, 120), h: int(r, 20, 80) });\n }\n break;\n }\n case \"exactTiling\":\n for (let i = 0; i < p.count; i++) boxes.push({ id: `b${i}`, w: tile.w, h: tile.h });\n break;\n case \"touchObstacles\": {\n const lw = int(r, 30, 80);\n const lh = int(r, 20, 60);\n boxes.push({ id: \"b0\", w: lw, h: lh, x: first.x, y: first.y - lh, locked: true });\n for (let i = 1; i < p.count; i++) boxes.push({ id: `b${i}`, w: path, h: int(r, 20, 80) });\n break;\n }\n }\n return { container, obstacles, boxes };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/** Each generator of the package. */\nexport const generators: readonly CorpusGenerator[] = Object.freeze([rectScattered, rectGrid, gallery, dashboard, cards, wordCloud, edgeCases] as CorpusGenerator[]);\n\n/** This function gives the generator with a name. It throws a `RangeError` for a name that the package does not have. */\nexport function generator(name: string): CorpusGenerator {\n const found = generators.find((g) => g.name === name);\n if (found === undefined) throw new RangeError(`The package has no generator \"${name}\".`);\n return found;\n}\n","// The manifest of a corpus: `layout-corpus/1` of `docs/FORMAT.md`.\n\nimport { generator } from \"./generators.ts\";\nimport type { CorpusCell, GeneratedInput, GeneratorParams } from \"./layout-input.ts\";\n\n/** One spec of a corpus: a generator, its parameters and its seeds. */\nexport interface CorpusSpec {\n /** The name of the generator. */\n generator: string;\n /** The version of the generator. Without it, the spec uses the version of the package. A different version is an error. */\n version?: number;\n /** The parameters over the defaults of the generator. */\n params?: GeneratorParams;\n seeds: readonly number[];\n}\n\n/** One input in the index of a manifest. */\nexport interface CorpusEntry {\n id: string;\n hash: string;\n cell: CorpusCell;\n}\n\n/** The manifest `corpus.json` of a corpus. */\nexport interface CorpusManifest {\n schema: \"layout-corpus/1\";\n /** The name of the corpus. Each input has it in `set`. */\n corpus: string;\n /** The specs, each with its version and its full parameters. */\n specs: { generator: string; version: number; params: GeneratorParams; seeds: number[] }[];\n inputs: CorpusEntry[];\n}\n\n/** A corpus: the manifest and the input files, in the order of the specs and the seeds. */\nexport interface Corpus {\n manifest: CorpusManifest;\n inputs: GeneratedInput[];\n}\n\n/**\n * This function generates a corpus from specs. Each input gets the name of the corpus as its set. The function throws a\n * `RangeError` for an unknown generator, a different version or 2 inputs with the same id.\n */\nexport function corpus(name: string, specs: readonly CorpusSpec[]): Corpus {\n const manifest: CorpusManifest = { schema: \"layout-corpus/1\", corpus: name, specs: [], inputs: [] };\n const inputs: GeneratedInput[] = [];\n const ids = new Set<string>();\n for (const spec of specs) {\n const gen = generator(spec.generator);\n if (spec.version !== undefined && spec.version !== gen.version) {\n throw new RangeError(`The generator \"${gen.name}\" has the version ${gen.version}, not ${spec.version}.`);\n }\n const params = gen.withDefaults(spec.params);\n const cell = gen.cell(params);\n manifest.specs.push({ generator: gen.name, version: gen.version, params, seeds: [...spec.seeds] });\n for (const seed of spec.seeds) {\n const file = gen.generate(seed, params, name);\n if (ids.has(file.id)) throw new RangeError(`The corpus has 2 inputs with the id \"${file.id}\".`);\n ids.add(file.id);\n inputs.push(file);\n manifest.inputs.push({ id: file.id, hash: file.hash, cell });\n }\n }\n return { manifest, inputs };\n}\n"],"mappings":";;;AACA,IAAa,SAAb,MAAa,OAAO;CAClB;CACA;CAEA,YAAY,IAAI,GAAG,IAAI,GAAG;EACxB,KAAK,KAAK;EACV,KAAK,KAAK;CACZ;;CAGA,IAAI,IAAY;EAAE,OAAO,KAAK;CAAI;CAClC,IAAI,EAAE,GAAW;EAAE,KAAK,KAAK;CAAG;;CAEhC,IAAI,IAAY;EAAE,OAAO,KAAK;CAAI;CAClC,IAAI,EAAE,GAAW;EAAE,KAAK,KAAK;CAAG;;CAGhC,IAAI,GAAW,GAAiB;EAC9B,KAAK,KAAK;EACV,KAAK,KAAK;CACZ;;CAGA,MAAM,GAAiB;EACrB,KAAK,KAAK,EAAE;EACZ,KAAK,KAAK,EAAE;CACd;;CAGA,IAAI,OAAuB;EACzB,OAAO,IAAI,OAAO,KAAK,KAAK,MAAM,GAAG,KAAK,KAAK,MAAM,CAAC;CACxD;;CAGA,OAAe;EACb,OAAO,KAAK,KAAK,KAAK;CACxB;;CAGA,QAAgB;EACd,OAAO,IAAI,OAAO,KAAK,IAAI,KAAK,EAAE;CACpC;;CAGA,MAAM,KAAa,KAAqB;EACtC,OAAO,IAAI,OACT,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC,GACxC,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC,CAC1C;CACF;;CAGA,OAAO,GAAG,QAAwB;EAChC,OAAO,IAAI,OAAO,QAAQ,MAAM;CAClC;;CAGA,OAAO,IAAI,SAA2B;EACpC,IAAI,CAAC,QAAQ,QAAQ,OAAO,IAAI,OAAO;EACvC,OAAO,IAAI,OACT,KAAK,IAAI,GAAG,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC,GACnC,KAA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AQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,UAAU;GACR,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,YACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,WAAW;GACT,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,SAAS;GACP,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KAC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EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,sBAAsB;GACpB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK,CACH,eACA,aACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;K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KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,qBAAqB;GACnB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,SACF;IACA,KAAK,CACH,WACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,sBAAsB;GACpB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,OACF;IACA,KAAK;KACH;KAC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AAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,SACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,eACF;IACA,KAAK,CACH,iBACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK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,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,oBAAoB;GAClB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,cACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,qBAAqB;GACnB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,OACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KAC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AM,SAAS,IAAI;GAAS;GAAQ,OAAO,CAAC,GAAG,KAAK,KAAK;EAAE,CAAC;EACjG,KAAK,MAAM,QAAQ,KAAK,OAAO;GAC7B,MAAM,OAAO,IAAI,SAAS,MAAM,QAAQ,IAAI;GAC5C,IAAI,IAAI,IAAI,KAAK,EAAE,GAAG,MAAM,IAAI,WAAW,wCAAwC,KAAK,GAAG,GAAG;GAC9F,IAAI,IAAI,KAAK,EAAE;GACf,OAAO,KAAK,IAAI;GAChB,SAAS,OAAO,KAAK;IAAE,IAAI,KAAK;IAAI,MAAM,KAAK;IAAM;GAAK,CAAC;EAC7D;CACF;CACA,OAAO;EAAE;EAAU;CAAO;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["rowsOf","boxesOf","rowsOf","shapeOf","boundsOf"],"sources":["../src/vector.ts","../src/rect.ts","../src/moves.ts","../src/order.ts","../src/contract.ts","../src/frame.ts","../src/space.ts","../src/maxrects.ts","../src/shelf.ts","../src/skyline.ts","../src/pack.ts","../src/free.ts","../src/push.ts","../src/overflow.ts","../src/sha256.ts","../src/layout-input.ts","../src/measures.ts","../src/metrics.ts","../src/strategy.ts","../src/adapters.ts","../src/convert.ts","../src/portfolio-sets.ts","../src/portfolio-cell.ts","../src/check.ts","../src/portfolio.ts","../src/portfolio-strategy.ts","../src/registry.ts","../src/generators.ts","../src/corpus.ts"],"sourcesContent":["/** A mutable two-dimensional vector. */\nexport class Vector {\n #x: number;\n #y: number;\n\n constructor(x = 0, y = 0) {\n this.#x = x;\n this.#y = y;\n }\n\n /** The first component: a width or a left position. */\n get x(): number { return this.#x; }\n set x(v: number) { this.#x = v; }\n /** The second component: a height or a top position. */\n get y(): number { return this.#y; }\n set y(v: number) { this.#y = v; }\n\n /** This method sets both components. */\n set(x: number, y: number): void {\n this.#x = x;\n this.#y = y;\n }\n\n /** This method copies the components of another vector. */\n setTo(v: Vector): void {\n this.#x = v.x;\n this.#y = v.y;\n }\n\n /** This method gives a new vector: the sum of this vector and another. */\n add(other: Vector): Vector {\n return new Vector(this.#x + other.x, this.#y + other.y);\n }\n\n /** This method gives the product of the components: the area of a size. */\n area(): number {\n return this.#x * this.#y;\n }\n\n /** This method gives a new vector with the same components. */\n clone(): Vector {\n return new Vector(this.#x, this.#y);\n }\n\n /** This method gives a new vector with each component between the components of `min` and `max`. */\n clamp(min: Vector, max: Vector): Vector {\n return new Vector(\n Math.max(min.x, Math.min(max.x, this.#x)),\n Math.max(min.y, Math.min(max.y, this.#y)),\n );\n }\n\n /** This function gives a vector with the same value in both components. */\n static of(scalar: number): Vector {\n return new Vector(scalar, scalar);\n }\n\n /** This function gives the smallest value of each component, or a zero vector for an empty list. */\n static min(vectors: Vector[]): Vector {\n if (!vectors.length) return new Vector();\n return new Vector(\n Math.min(...vectors.map((v) => v.x)),\n Math.min(...vectors.map((v) => v.y)),\n );\n }\n\n /** This function gives the largest value of each component, or a zero vector for an empty list. */\n static max(vectors: Vector[]): Vector {\n if (!vectors.length) return new Vector();\n return new Vector(\n Math.max(...vectors.map((v) => v.x)),\n Math.max(...vectors.map((v) => v.y)),\n );\n }\n\n /** This getter gives a new infinite vector each time. A shared value is not safe, because a vector is mutable. */\n static get Infinity(): Vector {\n return new Vector(Infinity, Infinity);\n }\n}\n","import { Vector } from \"./vector.ts\";\n\n/** A rectangle of the packer. `id` identifies the item that it measures. The packer sets `position` and `wasPacked`. */\n// oxlint-disable-next-line typescript/no-unnecessary-type-parameters -- the parameter types the id of the caller\nexport class Rect<T = unknown> {\n readonly #position = new Vector();\n readonly #size = new Vector();\n\n /** The identity of the item that the rectangle measures. */\n id?: T;\n /** The packer sets this field to `true` when it places the rectangle. */\n wasPacked = false;\n /** For an outer rectangle: the packer keeps its width. */\n fixedWidth = false;\n /** For an outer rectangle: the packer keeps its width and its height, and it skips a rectangle that does not fit. */\n fixedSize = false;\n /**\n * The packer keeps the position of a locked rectangle. `packSkyline` packs the other rectangles around it.\n * `packRows` only keeps its position, and other rectangles can overlap it.\n */\n locked = false;\n\n /** The top left corner. */\n get position(): Vector { return this.#position; }\n /** The width and the height. */\n get size(): Vector { return this.#size; }\n\n /** This method gives the right edge. */\n right(): number { return this.#position.x + this.#size.x; }\n /** This method gives the bottom edge. */\n bottom(): number { return this.#position.y + this.#size.y; }\n\n /** This method moves the left edge to the right by an amount, and the right edge stays. */\n shrinkLeft(amount: number): this {\n this.#position.x += amount;\n this.#size.x -= amount;\n return this;\n }\n\n /** This method moves the rectangle by an offset. */\n translateBy(offset: Vector): this {\n this.#position.set(this.#position.x + offset.x, this.#position.y + offset.y);\n return this;\n }\n\n /** This method gives the area of the size. */\n area(): number { return this.#size.area(); }\n\n /** This function gives the rectangles that the packer placed. */\n static packed<U>(rects: Rect<U>[]): Rect<U>[] {\n return rects.filter((r) => r.wasPacked);\n }\n\n /** This function gives the rectangles that the packer did not place. */\n static unpacked<U>(rects: Rect<U>[]): Rect<U>[] {\n return rects.filter((r) => !r.wasPacked);\n }\n\n /** This function marks each rectangle as not placed. A locked rectangle stays placed. */\n static resetPacked<U>(rects: Rect<U>[]): void {\n for (const r of rects) r.wasPacked = r.locked;\n }\n\n /** This function gives the largest right edge, or 0 for an empty list. */\n static maxRight<U>(rects: Rect<U>[]): number {\n return rects.reduce((acc, r) => Math.max(acc, r.right()), 0);\n }\n\n /** This function gives the largest bottom edge, or 0 for an empty list. */\n static maxBottom<U>(rects: Rect<U>[]): number {\n return rects.reduce((acc, r) => Math.max(acc, r.bottom()), 0);\n }\n}\n","// The counts of the characteristic move of each strategy (roadmap item k59, `docs/BENCH.md`, \"Activation\"). The\n// packers count their move here, and the adapters write the count in `trace.measures`. The counts do not change a layout.\n// The module is internal: the package root does not export it.\n\n/** The id of the characteristic move of each strategy and of each shelf fit. The trace of each strategy has its id, also with the count 0. */\nexport const MOVES: Readonly<{\n rows: \"move.gapFill\";\n shelf: \"move.stack\";\n skyline: \"move.lowerWindow\";\n push: \"move.cascade\";\n firstFit: \"move.firstFit\";\n bestFit: \"move.bestFit\";\n bssf: \"move.bssf\";\n blsf: \"move.blsf\";\n baf: \"move.baf\";\n cp: \"move.cp\";\n split: \"move.split\";\n}> = Object.freeze({\n /** A rectangle that the gap fill of `packRow` places in a gap of a row: under a shorter neighbor, or at the row break. */\n rows: \"move.gapFill\",\n /**\n * A rectangle that `packShelf` puts on an open shelf with a taller rectangle. The strip above it stays empty. With a\n * `fit`, the move is a rectangle in the strip above a shorter rectangle of a shelf.\n */\n shelf: \"move.stack\",\n /** A rectangle that the skyline puts in a lower window, not in the leftmost window where it fits. */\n skyline: \"move.lowerWindow\",\n /** A rectangle that a push cascade moves. */\n push: \"move.cascade\",\n /** A rectangle that a shelf fit puts on a shelf that is not the open shelf. The open shelf is the last shelf that the packing opened. */\n firstFit: \"move.firstFit\",\n /** A rectangle that the fit `best` puts on a shelf that is not the first shelf where it fits. */\n bestFit: \"move.bestFit\",\n /** A rectangle that the rule `bssf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n bssf: \"move.bssf\",\n /** A rectangle that the rule `blsf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n blsf: \"move.blsf\",\n /** A rectangle that the rule `baf` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n baf: \"move.baf\",\n /** A rectangle that the rule `cp` of `maxrects` puts in another place than the rule `bl` on the same free rectangles. */\n cp: \"move.cp\",\n /** A rectangle of `maxrects` that cuts two free rectangles or more. A shelf or a skyline has no such step. */\n split: \"move.split\",\n});\n\nconst counts = new Map<string, number>();\n\n/** This function adds `n` to the count of a move. */\nexport function countMove(id: string, n = 1): void {\n if (n > 0) counts.set(id, (counts.get(id) ?? 0) + n);\n}\n\n/** This function sets the count of a move to 0. Without an id, it sets each count to 0. */\nexport function clearMoves(id?: string): void {\n if (id === undefined) counts.clear();\n else counts.delete(id);\n}\n\n/** This function gives the count of a move since the last `clearMoves`. */\nexport function moveCount(id: string): number {\n return counts.get(id) ?? 0;\n}\n","import type { Rect } from \"./rect.ts\";\n\n/**\n * An order of the rectangles before the packing. The order changes the layout much. `input` keeps the order of\n * the array of the caller: the row packing then fills no gaps, so its rows read in that order.\n */\nexport type SortOrder = \"height-desc\" | \"height-asc\" | \"width-desc\" | \"area-desc\" | \"input\";\n\n/** This constant lists each sort order. The first one is the default. */\nexport const SORT_ORDERS: readonly SortOrder[] = [\"height-desc\", \"height-asc\", \"width-desc\", \"area-desc\", \"input\"];\n\n/** This function gives the comparator of a sort order. The sort is stable, so `input` keeps the order. */\nexport function compareRects(order: SortOrder): <T>(a: Rect<T>, b: Rect<T>) => number {\n switch (order) {\n case \"height-desc\":\n return (a, b) => b.size.y - a.size.y;\n case \"height-asc\":\n return (a, b) => a.size.y - b.size.y;\n case \"width-desc\":\n return (a, b) => b.size.x - a.size.x;\n case \"area-desc\":\n return (a, b) => b.area() - a.area();\n case \"input\":\n return () => 0;\n }\n}\n","// The data types of the Packer contract (docs/PACKER.md). They are plain data, with no class and no method.\n// Since 0.2.0, the types and the shared values come from `@mark1russell7/layout-contract`. This file adds the packer names.\n\nimport { marginSides, turnBox, type Item, type Sides } from \"@mark1russell7/layout-contract\";\n\nexport {\n DEFAULT_TOLERANCE,\n EPS,\n RECORD_EPS,\n checkInput,\n turnPoint,\n turnPort,\n turnRegion,\n type Item,\n type LayoutContainer,\n type Margin,\n type Obstacle,\n type PackInput,\n type PackOutput,\n type Placement,\n type Port,\n type Region,\n type Side,\n type Sides,\n type StageTrace,\n type Tolerance,\n} from \"@mark1russell7/layout-contract\";\n\n/** This function gives the margin of an item on each side. A number is the same margin on each side. */\nexport function marginOf(item: Pick<Item, \"margin\">): Sides {\n const m = marginSides(item.margin);\n return { top: m.top, right: m.right, bottom: m.bottom, left: m.left };\n}\n\n/**\n * This function gives an item after a turn of 90 degrees clockwise, with the y axis down (decision 1 of\n * `docs/PACKER.md`). The width and the height change places. The top-left corner, the id and the other fields stay.\n * The ports, the shape and the margin turn with the item. The function does not change its argument.\n * It is `turnBox` of the contract.\n */\nexport function turnItem(item: Item): Item {\n return turnBox(item);\n}\n","// The internal frame of the adapters of 0.1: the conversion of a PackInput to the Rect objects of 0.1, and back.\n// Each item grows by its margin and by half the gap on each side. Each obstacle grows by half the gap. Thus two items\n// are `mA + gap + mB` apart. The area of the frame is the container less the inset, grown by half the gap on each side.\n\nimport { boundsOf } from \"@mark1russell7/layout-contract\";\nimport { EPS, marginOf, turnItem, type Item, type Obstacle, type PackInput, type PackOutput, type Placement, type Region, type StageTrace } from \"./contract.ts\";\nimport { Rect } from \"./rect.ts\";\n\nconst clock = (globalThis as { performance?: { now(): number } }).performance;\n\n/** This function gives the time in milliseconds. */\nexport function now(): number {\n return clock ? clock.now() : Date.now();\n}\n\n/** The bounding box of a region comes from the contract. */\nexport { boundsOf } from \"@mark1russell7/layout-contract\";\n\n/** The rectangle of a container: its origin and its size. A free side has the size `Infinity`. */\nexport interface Bounds {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** This function gives the rectangle of a container. A rectangle shape gives the origin and the sizes of the fixed sides. */\nexport function containerBounds(input: PackInput): Bounds {\n const { container } = input;\n const shape = container.shape === undefined ? undefined : boundsOf(container.shape);\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n const w = shape?.w ?? container.w;\n const h = shape?.h ?? container.h;\n if (fixedW && w === undefined) throw new TypeError(`A container with fixed \"${container.fixed}\" needs a width.`);\n if (fixedH && h === undefined) throw new TypeError(`A container with fixed \"${container.fixed}\" needs a height.`);\n return { x: shape?.x ?? 0, y: shape?.y ?? 0, w: fixedW ? w! : Infinity, h: fixedH ? h! : Infinity };\n}\n\n/** One rectangle of the frame, and the item or the obstacle that it measures. */\nexport interface Entry {\n rect: Rect<number>;\n item?: Item;\n obstacle?: Obstacle;\n /** The offset from the corner of the rectangle to the corner of the item or the obstacle. */\n dx: number;\n dy: number;\n}\n\n/** The rectangles of 0.1 for one input. */\nexport interface Frame {\n /** The container coordinates of the origin of the frame. */\n ox: number;\n oy: number;\n /** The size of the area of the frame. A free side has the size `Infinity`. */\n w: number;\n h: number;\n bounds: Bounds;\n inset: number;\n /** The items in the order of their rank, then the obstacles. */\n entries: Entry[];\n /** The ids of the items that are too large for the area. The frame has no rectangle for them. */\n tooLarge: string[];\n}\n\n/** This function gives the items in the order of their rank. The index in the array is the rank of an item without one. */\nexport function byRank(items: readonly Item[]): Item[] {\n return items\n .map((item, index) => ({ item, rank: item.rank ?? index }))\n .toSorted((a, b) => a.rank - b.rank)\n .map((e) => e.item);\n}\n\n/**\n * This function makes the frame of an input. A locked item with a position and an obstacle without `move` are locked\n * rectangles. An obstacle with `move` is a free rectangle only when `movable` is `true`. With `turnable`, a turnable item\n * is too large only when it is too large in the two directions.\n */\nexport function buildFrame(input: PackInput, movable = false, turnable = false): Frame {\n const bounds = containerBounds(input);\n const inset = input.container.inset ?? 0;\n const half = (input.gap ?? 0) / 2;\n const ox = bounds.x + inset - half;\n const oy = bounds.y + inset - half;\n const w = bounds.w - 2 * inset + 2 * half;\n const h = bounds.h - 2 * inset + 2 * half;\n const entries: Entry[] = [];\n const tooLarge: string[] = [];\n\n for (const item of byRank(input.items)) {\n const m = marginOf(item);\n const rect = new Rect<number>();\n rect.size.set(item.w + m.left + m.right + 2 * half, item.h + m.top + m.bottom + 2 * half);\n const dx = m.left + half;\n const dy = m.top + half;\n if (item.locked === true && item.x !== undefined && item.y !== undefined) {\n rect.locked = true;\n rect.position.set(item.x - dx - ox, item.y - dy - oy);\n } else if (\n (rect.size.x > w + EPS || rect.size.y > h + EPS) &&\n !(turnable && item.turnable === true && rect.size.y <= w + EPS && rect.size.x <= h + EPS)\n ) {\n tooLarge.push(item.id);\n continue;\n }\n entries.push({ rect, item, dx, dy });\n }\n\n for (const obstacle of input.obstacles ?? []) {\n const b = boundsOf(obstacle.region);\n const rect = new Rect<number>();\n rect.size.set(b.w + 2 * half, b.h + 2 * half);\n rect.position.set(b.x - half - ox, b.y - half - oy);\n rect.locked = !(movable && obstacle.move !== undefined);\n entries.push({ rect, obstacle, dx: half, dy: half });\n }\n return { ox, oy, w, h, bounds, inset, entries, tooLarge };\n}\n\n/** This function gives the outer rectangle of 0.1 for a frame. A free height starts at 0 and grows. */\nexport function outerOf(frame: Frame): Rect<number> {\n const outer = new Rect<number>();\n const fixedSize = Number.isFinite(frame.h);\n outer.size.set(frame.w, fixedSize ? frame.h : 0);\n outer.fixedWidth = true;\n outer.fixedSize = fixedSize;\n return outer;\n}\n\n/** This function gives the rectangles of a frame, in the order of the entries. */\nexport function rectsOf(frame: Frame): Rect<number>[] {\n return frame.entries.map((e) => e.rect);\n}\n\n/** The turns of a packing: the rectangles that turned, and the turn of an item in the axes of the frame. */\nexport interface FrameTurns {\n /** The rectangles of the frame that the packer turned. */\n rects: ReadonlySet<unknown>;\n /** This function gives an item after a turn of 90 degrees clockwise in the axes of the input, in the axes of the frame. */\n turn: (item: Item) => Item;\n}\n\n/**\n * This function gives the turn of an item for a frame. A frame of `viaAxes` has the axes changed. The turn of the input\n * goes through that change, thus the item turns the other way in the frame.\n */\nexport function frameTurn(transposed: boolean): (item: Item) => Item {\n return transposed ? (item) => transposeItem(turnItem(transposeItem(item))) : turnItem;\n}\n\n/**\n * This function reads the output from the rectangles of a frame after a packing of 0.1. A locked item keeps its\n * position exactly. Each other item that the packer did not place goes to the overflow. With `turns`, each rectangle\n * that turned gives a placement with `turn: 90`.\n */\nexport function readFrame(input: PackInput, frame: Frame, trace: readonly StageTrace[], moved: PackOutput[\"moved\"] = [], turns?: FrameTurns): PackOutput {\n const placements: Placement[] = [];\n const overflow: string[] = [...frame.tooLarge];\n for (const e of frame.entries) {\n const item = e.item;\n if (item === undefined) continue;\n if (item.locked === true && item.x !== undefined && item.y !== undefined) placements.push({ id: item.id, x: item.x, y: item.y });\n else if (e.rect.wasPacked && turns?.rects.has(e.rect) === true) {\n // The half gap is the offset less the margin. The margin of the turned item gives the new offset.\n const half = e.dx - marginOf(item).left;\n const m = marginOf(turns.turn(item));\n placements.push({ id: item.id, x: e.rect.position.x + m.left + half + frame.ox, y: e.rect.position.y + m.top + half + frame.oy, turn: 90 });\n } else if (e.rect.wasPacked) placements.push({ id: item.id, x: e.rect.position.x + e.dx + frame.ox, y: e.rect.position.y + e.dy + frame.oy });\n else overflow.push(item.id);\n }\n return { placements, overflow, size: sizeOf(input, frame, placements, moved, turns), moved, trace };\n}\n\n/**\n * This function gives the size of the container after a packing. A fixed side keeps its size. A free side goes to the\n * far edge of the items with their margins and the inset, or of the obstacles.\n */\nfunction sizeOf(input: PackInput, frame: Frame, placements: Placement[], moved: PackOutput[\"moved\"], turns?: FrameTurns): { w: number; h: number } {\n const items = new Map(input.items.map((i) => [i.id, i]));\n let right = 0;\n let bottom = 0;\n for (const p of placements) {\n const given = items.get(p.id)!;\n const item = p.turn === 90 && turns !== undefined ? turns.turn(given) : given;\n const m = marginOf(item);\n right = Math.max(right, p.x + item.w + m.right + frame.inset - frame.bounds.x);\n bottom = Math.max(bottom, p.y + item.h + m.bottom + frame.inset - frame.bounds.y);\n }\n const movedById = new Map(moved.map((m) => [m.id, m]));\n for (const o of input.obstacles ?? []) {\n const b = boundsOf(o.region);\n const at = movedById.get(o.id) ?? b;\n right = Math.max(right, at.x + b.w - frame.bounds.x);\n bottom = Math.max(bottom, at.y + b.h - frame.bounds.y);\n }\n return {\n w: Number.isFinite(frame.bounds.w) ? frame.bounds.w : right,\n h: Number.isFinite(frame.bounds.h) ? frame.bounds.h : bottom,\n };\n}\n\n/** This function gives a region with the axes changed: x for y, and w for h. */\nexport function transposeRegion(region: Region): Region {\n switch (region.kind) {\n case \"rect\":\n return { kind: \"rect\", x: region.y, y: region.x, w: region.h, h: region.w };\n case \"circle\":\n return { kind: \"circle\", cx: region.cy, cy: region.cx, r: region.r };\n case \"ellipse\":\n return { kind: \"ellipse\", cx: region.cy, cy: region.cx, rx: region.ry, ry: region.rx };\n case \"polygon\": {\n const swap = (ring: readonly (readonly [number, number])[]): [number, number][] => ring.map(([x, y]) => [y, x]);\n return region.holes === undefined\n ? { kind: \"polygon\", points: swap(region.points) }\n : { kind: \"polygon\", points: swap(region.points), holes: region.holes.map(swap) };\n }\n }\n}\n\n/** This function gives an item with the axes changed. The ports go, because the adapters of 0.1 do not read them. */\nfunction transposeItem(item: Item): Item {\n const { ports: _ports, x, y, shape, margin, ...rest } = item;\n return {\n ...rest,\n w: item.h,\n h: item.w,\n ...(y === undefined ? {} : { x: y }),\n ...(x === undefined ? {} : { y: x }),\n ...(shape === undefined ? {} : { shape: transposeRegion(shape) }),\n ...(margin === undefined\n ? {}\n : { margin: typeof margin === \"number\" ? margin : { top: margin.left, right: margin.bottom, bottom: margin.right, left: margin.top } }),\n };\n}\n\n/** This function gives an input with the axes changed. A fixed height becomes a fixed width. */\nexport function transposeInput(input: PackInput): PackInput {\n const c = input.container;\n const container: PackInput[\"container\"] = {\n fixed: c.fixed === \"height\" ? \"width\" : c.fixed === \"width\" ? \"height\" : c.fixed,\n ...(c.h === undefined ? {} : { w: c.h }),\n ...(c.w === undefined ? {} : { h: c.w }),\n ...(c.aspect === undefined ? {} : { aspect: 1 / c.aspect }),\n ...(c.aspectWeight === undefined ? {} : { aspectWeight: c.aspectWeight }),\n ...(c.shape === undefined ? {} : { shape: transposeRegion(c.shape) }),\n ...(c.inset === undefined ? {} : { inset: c.inset }),\n };\n return {\n container,\n items: input.items.map(transposeItem),\n ...(input.obstacles === undefined ? {} : { obstacles: input.obstacles.map((o) => ({ ...o, region: transposeRegion(o.region) })) }),\n ...(input.gap === undefined ? {} : { gap: input.gap }),\n };\n}\n\n/** This function gives an output with the axes changed. */\nexport function transposeOutput(output: PackOutput): PackOutput {\n return {\n placements: output.placements.map((p) => ({ ...p, x: p.y, y: p.x })),\n overflow: [...output.overflow],\n size: { w: output.size.h, h: output.size.w },\n moved: output.moved.map((m) => ({ id: m.id, x: m.y, y: m.x })),\n ...(output.trace === undefined ? {} : { trace: output.trace }),\n };\n}\n\n/**\n * This function packs an input with a fixed height through the turn of the axes. It changes x for y in the input.\n * Then it packs with a fixed width, and changes the axes of the output back.\n */\nexport function viaAxes(input: PackInput, previous: PackOutput | undefined, run: (turned: PackInput, previous: PackOutput | undefined) => PackOutput): PackOutput {\n const start = now();\n const turned = transposeInput(input);\n const inner = run(turned, previous === undefined ? undefined : transposeOutput(previous));\n return { ...transposeOutput(inner), trace: [{ id: \"axes\", ms: now() - start, measures: {} }, ...(inner.trace ?? [])] };\n}\n","// The container layer of roadmap item k37 (docs/PACKER.md): the free space of one input, in the coordinates of the frame.\n// A strategy asks the layer where a rectangle of the frame fits. The layer knows the outline of the container, its holes,\n// the obstacles and the locked items. Thus each strategy packs into each container shape.\n\nimport { boundsOf, regionHitsRect, translate } from \"@mark1russell7/layout-contract\";\nimport { EPS, type PackInput, type Region } from \"./contract.ts\";\nimport { buildFrame, transposeRegion, type Frame } from \"./frame.ts\";\n\n/** A free interval on one axis, from `start` to `end`. A box fits when it starts at `start` or later and ends at `end` or earlier. */\nexport interface FreeSpan {\n readonly start: number;\n readonly end: number;\n}\n\n/** A rectangle of the frame: its top-left corner and its size. */\nexport interface SpaceRect {\n readonly x: number;\n readonly y: number;\n readonly w: number;\n readonly h: number;\n}\n\n/**\n * The free space of one input, in the coordinates of the frame of the adapters. A rectangle of the frame is an item with its\n * margin, grown by half the gap on each side. Each method takes such a rectangle.\n *\n * - The outline of a container with a fixed size is exact. A free side uses the bounding box of the shape, and the holes stay.\n * - The inset of the container counts as in `checkHard`: the item with its margin, grown by the inset, stays in the outline.\n * - A rectangle obstacle and a locked item are holes with the exact rectangles of the frame.\n * - Another obstacle blocks its range over the query, grown by half the gap on each axis.\n */\nexport interface FreeSpace {\n /** The width of the area of the frame. A free side has the width `Infinity`. */\n readonly w: number;\n /** The height of the area of the frame. A free side has the height `Infinity`. */\n readonly h: number;\n /**\n * The value `true` tells that the container is a plain rectangle and that each obstacle is a rectangle. Then `band` does\n * not test y, and `column` does not test x, because each strategy tests the fixed side itself. This is the fast path.\n */\n readonly plain: boolean;\n /** This method gives the free x-spans, from left to right, for a rectangle from `y0` to `y1`. */\n band(y0: number, y1: number): FreeSpan[];\n /**\n * This method gives the first free y-span for a rectangle from `x0` to `x1` that ends after `from`. The span starts\n * at `from` or later. The method gives `undefined` when no such span is free.\n */\n column(x0: number, x1: number, from?: number): FreeSpan | undefined;\n /** This method tells if a rectangle is in the free space. */\n fits(rect: SpaceRect): boolean;\n /** This method gives the first x from `x` where a rectangle of width `w` fits from `y0` to `y1`, or `Infinity`. */\n fitX(x: number, w: number, y0: number, y1: number): number;\n /**\n * This method gives the next top edge after `y0` where the free spans of a rectangle of the height `y1 - y0` change, or\n * `Infinity`. A row that has no place for a rectangle of width `w` steps down to this edge.\n */\n nextY(y0: number, y1: number, w: number): number;\n}\n\n/** A rectangle hole of a layer: its edges on the axis of the spans (`a`) and on the cross axis (`c`). */\ninterface Hole {\n a0: number;\n a1: number;\n c0: number;\n c1: number;\n}\n\n/** A region that blocks its range over a query, grown by `g` on each axis. */\ninterface Blocker {\n region: Region;\n g: number;\n /** The cross-axis edges of the bounding box of the region. */\n c0: number;\n c1: number;\n}\n\n/** A ring of a polygon. */\ntype Ring = readonly (readonly [number, number])[];\n\n/**\n * One axis of the free space. The spans go along x, and the query goes along y. The layer of `column` is the layer of\n * `band` with the axes changed.\n */\ninterface Layer {\n /** `plain` and `box`: the area of the frame. `round`: a circle or an ellipse. `rings`: a polygon. */\n kind: \"plain\" | \"box\" | \"round\" | \"rings\";\n /** The size of the area along the spans and across. */\n w: number;\n h: number;\n /** The growth of a query for the outline: the inset less half the gap. */\n d: number;\n region?: Region;\n rings: Ring[];\n holes: Hole[];\n blockers: Blocker[];\n}\n\n/** This function removes the closed interval from `a` to `b` from a list of spans. A span of no length goes. */\nfunction subtract(spans: [number, number][], a: number, b: number): [number, number][] {\n const out: [number, number][] = [];\n for (const [s, e] of spans) {\n if (b <= s || a >= e) {\n out.push([s, e]);\n continue;\n }\n if (a > s) out.push([s, a]);\n if (e > b) out.push([b, e]);\n }\n return out;\n}\n\n/** This function gives the x of a segment at `y`. The ends give their exact x. */\nfunction xAt(ax: number, ay: number, bx: number, by: number, y: number): number {\n if (y === ay) return ax;\n if (y === by) return bx;\n return ax + ((y - ay) * (bx - ax)) / (by - ay);\n}\n\n/** This function gives the x-range of the part of a segment in the open strip from `y0` to `y1`, or `undefined`. */\nfunction edgeRange(ax: number, ay: number, bx: number, by: number, y0: number, y1: number): [number, number] | undefined {\n const lo = Math.min(ay, by);\n const hi = Math.max(ay, by);\n if (hi <= y0 || lo >= y1) return undefined;\n if (ay === by) return [Math.min(ax, bx), Math.max(ax, bx)];\n const p = xAt(ax, ay, bx, by, Math.max(y0, lo));\n const q = xAt(ax, ay, bx, by, Math.min(y1, hi));\n return [Math.min(p, q), Math.max(p, q)];\n}\n\n/** This function gives the x-range of a region in the open strip from `y0` to `y1`, or `undefined` when they have no common point. */\nfunction regionRange(region: Region, y0: number, y1: number): [number, number] | undefined {\n switch (region.kind) {\n case \"rect\":\n return region.y < y1 && y0 < region.y + region.h ? [region.x, region.x + region.w] : undefined;\n case \"circle\":\n case \"ellipse\": {\n const rx = region.kind === \"circle\" ? region.r : region.rx;\n const ry = region.kind === \"circle\" ? region.r : region.ry;\n if (y1 <= region.cy - ry || y0 >= region.cy + ry) return undefined;\n const dy = y0 <= region.cy && region.cy <= y1 ? 0 : Math.min(Math.abs(y0 - region.cy), Math.abs(y1 - region.cy));\n const c = rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2));\n return [region.cx - c, region.cx + c];\n }\n case \"polygon\": {\n let lo = Infinity;\n let hi = -Infinity;\n const ring = region.points;\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n const r = edgeRange(a[0], a[1], b[0], b[1], y0, y1);\n if (r === undefined) continue;\n lo = Math.min(lo, r[0]);\n hi = Math.max(hi, r[1]);\n }\n return lo <= hi ? [lo, hi] : undefined;\n }\n }\n}\n\n/** This function gives the spans of the outline of a layer for the strip from `y0` to `y1`, before the holes and the blockers. */\nfunction outline(layer: Layer, y0: number, y1: number): [number, number][] {\n const { d } = layer;\n switch (layer.kind) {\n case \"plain\":\n return [[0, layer.w]];\n case \"box\":\n return y0 < 0 || y1 > layer.h ? [] : [[0, layer.w]];\n case \"round\": {\n const r = layer.region!;\n if (r.kind !== \"circle\" && r.kind !== \"ellipse\") return [];\n const rx = r.kind === \"circle\" ? r.r : r.rx;\n const ry = r.kind === \"circle\" ? r.r : r.ry;\n const top = y0 - d;\n const bottom = y1 + d;\n if (top < r.cy - ry || bottom > r.cy + ry) return [];\n const dy = Math.max(Math.abs(top - r.cy), Math.abs(bottom - r.cy));\n // The shortest chord over the height of the query, made smaller by EPS\n const c = rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2)) - EPS;\n const a = r.cx - c + d;\n const b = r.cx + c - d;\n return b > a ? [[a, b]] : [];\n }\n case \"rings\": {\n const top = y0 - d;\n const bottom = y1 + d;\n if (!(bottom > top)) return [];\n const blocked: [number, number][] = [];\n for (const ring of layer.rings) {\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n const r = edgeRange(a[0], a[1], b[0], b[1], top, bottom);\n if (r !== undefined) blocked.push(r);\n }\n }\n if (blocked.length === 0) return [];\n blocked.sort((p, q) => p[0] - q[0] || p[1] - q[1]);\n const merged: [number, number][] = [];\n for (const r of blocked) {\n const last = merged.at(-1);\n if (last !== undefined && r[0] <= last[1]) last[1] = Math.max(last[1], r[1]);\n else merged.push([r[0], r[1]]);\n }\n const spans: [number, number][] = [];\n for (let i = 0; i + 1 < merged.length; i++) {\n const a = merged[i]![1];\n const b = merged[i + 1]![0];\n if (!(b > a)) continue;\n // No edge crosses the box of the gap, thus the box is fully in the polygon or fully out of it\n if (!regionHitsRect(layer.region!, { x: a, y: top, w: b - a, h: bottom - top })) continue;\n if (b - d > a + d) spans.push([a + d, b - d]);\n }\n return spans;\n }\n }\n}\n\n/** This function gives the free spans of a layer for the strip from `y0` to `y1`. */\nfunction spansOf(layer: Layer, y0: number, y1: number): [number, number][] {\n let spans = outline(layer, y0, y1);\n for (const hole of layer.holes) {\n if (spans.length === 0) return spans;\n if (Math.min(y1, hole.c1) - Math.max(y0, hole.c0) > 0) spans = subtract(spans, hole.a0, hole.a1);\n }\n for (const b of layer.blockers) {\n if (spans.length === 0) return spans;\n if (b.c1 + b.g <= y0 || b.c0 - b.g >= y1) continue;\n const r = regionRange(b.region, y0 - b.g, y1 + b.g);\n // The range grows by EPS, as the chord of a round outline shrinks by EPS\n if (r !== undefined) spans = subtract(spans, r[0] - b.g - EPS, r[1] + b.g + EPS);\n }\n return spans;\n}\n\n/** This function gives the first x from `x` where a box of width `w` fits in one of the spans, or `Infinity`. */\nexport function firstFit(spans: readonly FreeSpan[], x: number, w: number): number {\n for (const s of spans) {\n const at = Math.max(x, s.start);\n if (at + w <= s.end) return at;\n }\n return Infinity;\n}\n\n/** This function gives the next top edge of a layer after `y0` for a strip of the height `y1 - y0`, as `FreeSpace.nextY` tells. */\nfunction nextOf(layer: Layer, y0: number, y1: number, w: number): number {\n const height = y1 - y0;\n const { d } = layer;\n let next = Infinity;\n const take = (y: number): void => {\n if (y > y0 + EPS && y < next) next = y;\n };\n for (const hole of layer.holes) if (hole.c0 < y1 && y0 < hole.c1) take(hole.c1);\n for (const b of layer.blockers) if (b.c0 - b.g < y1 && y0 < b.c1 + b.g) take(b.c1 + b.g);\n switch (layer.kind) {\n case \"plain\":\n break;\n case \"box\":\n if (y1 > layer.h) return Infinity;\n break;\n case \"rings\":\n for (const ring of layer.rings) {\n for (const [, vy] of ring) {\n take(vy + d);\n take(vy - height - d);\n }\n }\n break;\n case \"round\": {\n const r = layer.region!;\n if (r.kind !== \"circle\" && r.kind !== \"ellipse\") break;\n const rx = r.kind === \"circle\" ? r.r : r.rx;\n const ry = r.kind === \"circle\" ? r.r : r.ry;\n // The half chord that a box of width w needs, and the largest distance from the center where the chord has it\n const need = w / 2 + d + EPS;\n if (need >= rx) return Infinity;\n const reach = ry * Math.sqrt(1 - (need / rx) ** 2);\n if (y1 + d > r.cy + reach) return Infinity;\n take(r.cy - reach + d);\n break;\n }\n }\n return next;\n}\n\n/** This function gives the layer with the axes changed: the spans go along y, and the query goes along x. */\nfunction transposeLayer(layer: Layer): Layer {\n return {\n kind: layer.kind,\n w: layer.h,\n h: layer.w,\n d: layer.d,\n ...(layer.region === undefined ? {} : { region: transposeRegion(layer.region) }),\n rings: layer.rings.map((ring) => ring.map(([x, y]) => [y, x] as const)),\n holes: layer.holes.map((h) => ({ a0: h.c0, a1: h.c1, c0: h.a0, c1: h.a1 })),\n blockers: layer.blockers.map((b) => {\n const region = transposeRegion(b.region);\n const box = boundsOf(region);\n return { region, g: b.g, c0: box.y, c1: box.y + box.h };\n }),\n };\n}\n\n/** This function makes a blocker of a region in the frame. */\nfunction blockerOf(region: Region, g: number): Blocker {\n const box = boundsOf(region);\n return { region, g, c0: box.y, c1: box.y + box.h };\n}\n\n/**\n * This function gives the free space of an input and its frame. The adapters use it with the frame that they pack.\n * `freeSpace` makes the frame itself.\n */\nexport function spaceOf(input: PackInput, frame: Frame): FreeSpace {\n const { container } = input;\n const half = (input.gap ?? 0) / 2;\n const d = frame.inset - half;\n const shape = container.shape === undefined ? undefined : translate(container.shape, -frame.ox, -frame.oy);\n const fixedSize = Number.isFinite(frame.w) && Number.isFinite(frame.h);\n\n const holes: Hole[] = [];\n const blockers: Blocker[] = [];\n let rectObstacles = true;\n for (const e of frame.entries) {\n if (!e.rect.locked) continue;\n if (e.obstacle !== undefined && e.obstacle.region.kind !== \"rect\") {\n rectObstacles = false;\n blockers.push(blockerOf(translate(e.obstacle.region, -frame.ox, -frame.oy), half));\n continue;\n }\n const r = e.rect;\n holes.push({ a0: r.position.x, a1: r.right(), c0: r.position.y, c1: r.bottom() });\n }\n\n const plainShape = shape === undefined || shape.kind === \"rect\";\n const plain = plainShape && rectObstacles;\n let layer: Layer = { kind: plain ? \"plain\" : \"box\", w: frame.w, h: frame.h, d, rings: [], holes, blockers };\n if (shape !== undefined && shape.kind !== \"rect\") {\n if (fixedSize && shape.kind === \"polygon\") layer = { ...layer, kind: \"rings\", region: shape, rings: [shape.points, ...(shape.holes ?? [])] };\n else if (fixedSize) layer = { ...layer, kind: \"round\", region: shape };\n else if (shape.kind === \"polygon\") {\n // A free side: the bounding box, and the holes of the shape block the rectangles grown by the inset\n for (const ring of shape.holes ?? []) blockers.push(blockerOf({ kind: \"polygon\", points: ring }, d));\n }\n }\n const across = transposeLayer(layer);\n\n const band = (y0: number, y1: number): FreeSpan[] => spansOf(layer, y0, y1).map(([start, end]) => ({ start, end }));\n const space: FreeSpace = {\n w: frame.w,\n h: frame.h,\n plain,\n band,\n column(x0, x1, from = 0) {\n for (const [start, end] of spansOf(across, x0, x1)) {\n const top = Math.max(start, from);\n if (end > top) return { start: top, end };\n }\n return undefined;\n },\n fits(rect) {\n return firstFit(band(rect.y, rect.y + rect.h), rect.x, rect.w) === rect.x;\n },\n fitX(x, w, y0, y1) {\n return firstFit(band(y0, y1), x, w);\n },\n nextY(y0, y1, w) {\n return nextOf(layer, y0, y1, w);\n },\n };\n const bare: Layer = { ...layer, holes: [] };\n let bottom = 0;\n for (const b of blockers) bottom = Math.max(bottom, b.c1 + Math.max(0, b.g));\n PARTS.set(space, {\n kind: layer.kind,\n d,\n holes: holes.map((r) => ({ x: r.a0, y: r.c0, w: r.a1 - r.a0, h: r.c1 - r.c0 })),\n bottom: Number.isFinite(frame.h) ? frame.h : bottom,\n bare: (y0, y1) => spansOf(bare, y0, y1).map(([start, end]) => ({ start, end })),\n });\n return space;\n}\n\n/**\n * The parts of a free space of `spaceOf`. The packer `maxrects` reads them to make its first free rectangles. The\n * package root does not export them.\n */\nexport interface SpaceParts {\n /** The kind of the outline: `plain`, `box`, `round` or `rings`. */\n readonly kind: \"plain\" | \"box\" | \"round\" | \"rings\";\n /** The growth of a query for the outline: the inset less half the gap. */\n readonly d: number;\n /** The rectangle holes: the locked items and the rectangle obstacles, in the coordinates of the frame. */\n readonly holes: readonly SpaceRect[];\n /** The height to cut into bands. A fixed height gives the height. A free height gives the lowest edge of the blockers. */\n readonly bottom: number;\n /** This method gives the free x-spans of the outline and the blockers from `y0` to `y1`, without the rectangle holes. */\n bare(y0: number, y1: number): FreeSpan[];\n}\n\nconst PARTS = new WeakMap<FreeSpace, SpaceParts>();\n\n/** This function gives the parts of a free space of `spaceOf`, or `undefined` for another free space. */\nexport function spaceParts(space: FreeSpace): SpaceParts | undefined {\n return PARTS.get(space);\n}\n\n/**\n * This function gives the free space of an input, in the coordinates of the frame of the adapters. The origin of the\n * frame is the corner of the container, moved in by the inset and out by half the gap. `FreeSpace` tells the methods.\n */\nexport function freeSpace(input: PackInput): FreeSpace {\n return spaceOf(input, buildFrame(input));\n}\n","// The MaxRects family of roadmap item k24 (docs/PACKER.md, \"The MaxRects family\"). The packer keeps a list of the\n// maximal free rectangles. Each box goes to the top-left corner of one free rectangle. A rule chooses the free rectangle.\n// Then the box cuts each free rectangle that it hits into at most four parts, and the list loses each part that is in another.\n\nimport { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport { spaceParts, type FreeSpace, type FreeSpan, type SpaceRect } from \"./space.ts\";\n\n/**\n * The rules of `maxrects` to choose a free rectangle for a box.\n *\n * - `bssf`: the best short side fit. The smaller leftover side is the smallest.\n * - `blsf`: the best long side fit. The larger leftover side is the smallest.\n * - `baf`: the best area fit. The leftover area is the smallest.\n * - `bl`: the bottom-left rule. The bottom edge of the box is the highest, then the left edge is the leftmost.\n * - `cp`: the contact point rule. The box touches the most length of the edges of the frame, the boxes and the obstacles.\n */\nexport const MAXRECTS_RULES: readonly [\"bssf\", \"blsf\", \"baf\", \"bl\", \"cp\"] = Object.freeze([\"bssf\", \"blsf\", \"baf\", \"bl\", \"cp\"] as const);\n\n/** A rule of `maxrects`: `bssf`, `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */\nexport type MaxRectsRule = (typeof MAXRECTS_RULES)[number];\n\n/** The number of bands that the default band height gives. The default band height is the height to cut divided by this number. */\nexport const MAXRECTS_BANDS = 128;\n\n/** The options of `packMaxRects` */\nexport interface MaxRectsOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the free rectangles are\n * exact: the outer rectangle less the locked rectangles. Another space gives an inner approximation with bands.\n */\n space?: FreeSpace;\n /** The rule to choose a free rectangle. The default is `bssf`. */\n rule?: MaxRectsRule;\n /**\n * The largest height of a band of the approximation of a space that is not plain. The bands have equal heights. The\n * default is the height to cut divided by `MAXRECTS_BANDS`. A fixed height cuts the height. A free height cuts to the\n * lowest edge of the obstacles that are not rectangles.\n */\n bandHeight?: number;\n /** The rectangles that can turn by 90 degrees. Without it, no rectangle turns. A locked rectangle does not turn. */\n turnable?: ReadonlySet<unknown>;\n /**\n * The rectangles that the packing turned. Each call turns back the rectangles of this set first, and then it clears the\n * set. Thus a size search can pack the same rectangles many times.\n */\n turned?: Set<unknown>;\n}\n\n/** A rectangle with its four edges, in the coordinates of the outer rectangle. */\ninterface Box {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n}\n\n/** A place for a box: a free rectangle, the turn, and the two scores of the rule. Lower scores are better. */\ninterface Choice {\n index: number;\n turn: boolean;\n x: number;\n y: number;\n w: number;\n h: number;\n s1: number;\n s2: number;\n}\n\n/** The result of `runMaxRects`: the outer rectangle and the free rectangles at the end. */\nexport interface MaxRectsRun<T> {\n outer: Rect<T>;\n /** The free rectangles at the end, in the coordinates of the rectangles. Each one is as wide as the narrowest box and as high as the lowest box. */\n free: SpaceRect[];\n}\n\n/** This function tells if the box `a` is fully in the box `b`. */\nfunction inside(a: Box, b: Box): boolean {\n return a.x0 >= b.x0 && a.y0 >= b.y0 && a.x1 <= b.x1 && a.y1 <= b.y1;\n}\n\n/**\n * This function cuts each free rectangle that the box `b` hits into at most four parts. A part with a side less than\n * `minW` or `minH` goes, because no box fits in it. A part that is in another rectangle of the list goes.\n * The function gives the new list and the number of free rectangles that the box hit.\n */\nfunction cut(free: Box[], b: Box, minW: number, minH: number): { free: Box[]; hits: number } {\n const kept: Box[] = [];\n const parts: Box[] = [];\n let hits = 0;\n const add = (x0: number, y0: number, x1: number, y1: number): void => {\n if (x1 - x0 >= minW && y1 - y0 >= minH) parts.push({ x0, y0, x1, y1 });\n };\n for (const f of free) {\n if (b.x0 >= f.x1 || b.x1 <= f.x0 || b.y0 >= f.y1 || b.y1 <= f.y0) {\n kept.push(f);\n continue;\n }\n hits++;\n if (b.x0 > f.x0) add(f.x0, f.y0, b.x0, f.y1);\n if (b.x1 < f.x1) add(b.x1, f.y0, f.x1, f.y1);\n if (b.y0 > f.y0) add(f.x0, f.y0, f.x1, b.y0);\n if (b.y1 < f.y1) add(f.x0, b.y1, f.x1, f.y1);\n }\n // Each part is in the free rectangle that it comes from. Thus a kept rectangle is never in a part.\n const count = kept.length;\n for (let i = 0; i < parts.length; i++) {\n const p = parts[i]!;\n let drop = false;\n for (let j = 0; j < parts.length && !drop; j++) {\n if (j === i) continue;\n const q = parts[j]!;\n // Of two equal parts, the first part stays\n if (inside(p, q) && (j < i || !inside(q, p))) drop = true;\n }\n for (let k = 0; k < count && !drop; k++) if (inside(p, kept[k]!)) drop = true;\n if (!drop) kept.push(p);\n }\n return { free: kept, hits };\n}\n\n/** The edges of the boxes on one axis: for each coordinate, the flat list of the ranges on the other axis. */\ntype Edges = Map<number, number[]>;\n\n/** This function adds a range to the edges at a coordinate. */\nfunction addEdge(edges: Edges, at: number, a: number, b: number): void {\n const list = edges.get(at);\n if (list === undefined) edges.set(at, [a, b]);\n else list.push(a, b);\n}\n\n/** This function gives the length of the common part of the range from `a` to `b` and the edges at a coordinate. */\nfunction touch(edges: Edges, at: number, a: number, b: number): number {\n const list = edges.get(at);\n if (list === undefined) return 0;\n let sum = 0;\n for (let i = 0; i < list.length; i += 2) sum += Math.max(0, Math.min(b, list[i + 1]!) - Math.max(a, list[i]!));\n return sum;\n}\n\n/**\n * This function gives the walls of a space that is not plain: the parts of the bands that are not free. The bands cut the\n * height from 0 to `top`. Two walls of neighbour bands with the same span become one wall.\n */\nfunction bandWalls(query: (y0: number, y1: number) => FreeSpan[], w: number, top: number, bandHeight: number, grow: number, end: number): Box[] {\n const walls: Box[] = [];\n const count = Math.max(1, Math.ceil(top / bandHeight));\n let open = new Map<string, Box>();\n for (let k = 0; k < count; k++) {\n const y0 = (top * k) / count;\n const y1 = k === count - 1 ? top : (top * (k + 1)) / count;\n // With a growth of the query less than 0, the band asks for a larger strip. Thus the bands cover each y of the outline.\n const spans = query(Math.max(0, y0 - grow), Math.min(end, y1 + grow));\n const next = new Map<string, Box>();\n let x = 0;\n const block = (a: number, b: number): void => {\n if (!(b > a)) return;\n const key = `${a}|${b}`;\n const wall = open.get(key);\n if (wall !== undefined) {\n wall.y1 = y1;\n open.delete(key);\n next.set(key, wall);\n } else next.set(key, { x0: a, y0, x1: b, y1 });\n };\n for (const s of spans) {\n const start = Math.max(0, Math.min(w, s.start));\n const stop = Math.max(0, Math.min(w, s.end));\n if (!(stop > start)) continue;\n block(x, start);\n x = Math.max(x, stop);\n }\n block(x, w);\n walls.push(...open.values());\n open = next;\n }\n walls.push(...open.values());\n return walls;\n}\n\n/**\n * This function packs rectangles with MaxRects, as `packMaxRects` tells. It also gives the free rectangles at the end.\n * The tests read them. The package root does not export this function.\n */\nexport function runMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options: MaxRectsOptions = {}): MaxRectsRun<T> {\n const rule = options.rule ?? \"bssf\";\n if (!(MAXRECTS_RULES as readonly string[]).includes(rule)) throw new RangeError(`The rule of maxrects is one of ${MAXRECTS_RULES.join(\", \")}, not \"${String(rule)}\".`);\n const turned = options.turned;\n if (turned !== undefined) {\n for (const r of rects) if (turned.has(r)) r.size.set(r.size.y, r.size.x);\n turned.clear();\n }\n for (const r of rects) if (r.locked) r.wasPacked = true;\n\n const W = outer.size.x;\n if (!(W > 0)) return { outer, free: [] };\n const ox = outer.position.x;\n const oy = outer.position.y;\n const fixed = outer.fixedSize;\n const space = options.space;\n const parts = space === undefined ? undefined : spaceParts(space);\n const turnable = options.turnable;\n const sorted = rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\")).filter((r) => !r.wasPacked && r.size.x > 0 && r.size.y > 0);\n\n // The smallest width and height of the boxes. A turnable box counts its short side for the two. A free rectangle with\n // less room has no use, thus the list does not keep it.\n let minW = Infinity;\n let minH = Infinity;\n let heights = 0;\n for (const r of sorted) {\n const turns = turnable?.has(r) === true;\n const short = Math.min(r.size.x, r.size.y);\n minW = Math.min(minW, turns ? short : r.size.x);\n minH = Math.min(minH, turns ? short : r.size.y);\n heights += turns ? Math.max(r.size.x, r.size.y) : r.size.y;\n }\n\n // The rectangle holes: the holes of the space, or the locked rectangles. The bands of another space hold its holes.\n const holes: Box[] = [];\n if (parts !== undefined) for (const h of parts.holes) holes.push({ x0: h.x - ox, y0: h.y - oy, x1: h.x + h.w - ox, y1: h.y + h.h - oy });\n else if (space === undefined || space.plain) {\n for (const r of rects) if (r.locked) holes.push({ x0: r.position.x - ox, y0: r.position.y - oy, x1: r.right() - ox, y1: r.bottom() - oy });\n }\n\n // A free height gets room below each obstacle for each box. The content gives the height at the end.\n let floor = parts?.bottom ?? 0;\n for (const h of holes) floor = Math.max(floor, h.y1);\n const H = fixed ? outer.size.y : floor + heights;\n const walls: Box[] = [];\n for (const h of holes) {\n const wall = { x0: Math.max(0, h.x0), y0: Math.max(0, h.y0), x1: Math.min(W, h.x1), y1: Math.min(H, h.y1) };\n if (wall.x1 > wall.x0 && wall.y1 > wall.y0) walls.push(wall);\n }\n if (space !== undefined && !space.plain) {\n const top = parts === undefined ? H : fixed ? H : Math.min(H, parts.bottom);\n if (top > 0) {\n const bandHeight = options.bandHeight ?? top / MAXRECTS_BANDS;\n if (!(bandHeight > 0)) throw new RangeError(`The band height of maxrects is more than 0, not ${String(bandHeight)}.`);\n const query = parts === undefined ? (y0: number, y1: number) => space.band(y0 + oy, y1 + oy) : (y0: number, y1: number) => parts.bare(y0 + oy, y1 + oy);\n const shifted = (y0: number, y1: number): FreeSpan[] => query(y0, y1).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n walls.push(...bandWalls(shifted, W, top, bandHeight, parts === undefined ? 0 : Math.max(0, -parts.d), fixed ? H : Infinity));\n }\n }\n\n let free: Box[] = [{ x0: 0, y0: 0, x1: W, y1: H }];\n for (const wall of walls) free = cut(free, wall, minW, minH).free;\n\n const cp = rule === \"cp\";\n const vertical: Edges = new Map();\n const horizontal: Edges = new Map();\n const mark = (b: Box): void => {\n if (!cp) return;\n addEdge(vertical, b.x0, b.y0, b.y1);\n addEdge(vertical, b.x1, b.y0, b.y1);\n addEdge(horizontal, b.y0, b.x0, b.x1);\n addEdge(horizontal, b.y1, b.x0, b.x1);\n };\n for (const wall of walls) mark(wall);\n const contact = (x: number, y: number, w: number, h: number): number => {\n let sum = 0;\n if (x === 0) sum += h;\n if (x + w === W) sum += h;\n if (y === 0) sum += w;\n if (fixed && y + h === H) sum += w;\n return sum + touch(vertical, x, y, y + h) + touch(vertical, x + w, y, y + h) + touch(horizontal, y, x, x + w) + touch(horizontal, y + h, x, x + w);\n };\n // A space that is not plain checks each place, because the bands only approximate the outline\n const check = space !== undefined && !space.plain;\n let bottom = 0;\n for (const wall of walls) bottom = Math.max(bottom, wall.y1);\n\n for (const rect of sorted) {\n const w = rect.size.x;\n const h = rect.size.y;\n const turns = turnable?.has(rect) === true && w !== h;\n const banned = new Set<number>();\n let best: Choice | undefined;\n let low: Choice | undefined;\n for (;;) {\n best = undefined;\n low = undefined;\n for (let i = 0; i < free.length; i++) {\n const f = free[i]!;\n for (let t = 0; t < (turns ? 2 : 1); t++) {\n if (banned.has(2 * i + t)) continue;\n const bw = t === 1 ? h : w;\n const bh = t === 1 ? w : h;\n if (f.x0 + bw > f.x1 || f.y0 + bh > f.y1) continue;\n const lw = f.x1 - f.x0 - bw;\n const lh = f.y1 - f.y0 - bh;\n let s1: number;\n let s2: number;\n switch (rule) {\n case \"bssf\":\n s1 = Math.min(lw, lh);\n s2 = Math.max(lw, lh);\n break;\n case \"blsf\":\n s1 = Math.max(lw, lh);\n s2 = Math.min(lw, lh);\n break;\n case \"baf\":\n s1 = (f.x1 - f.x0) * (f.y1 - f.y0) - bw * bh;\n s2 = Math.min(lw, lh);\n break;\n case \"bl\":\n s1 = f.y0 + bh;\n s2 = f.x0;\n break;\n case \"cp\":\n s1 = -contact(f.x0, f.y0, bw, bh);\n s2 = f.y0 + bh;\n break;\n }\n const c: Choice = { index: i, turn: t === 1, x: f.x0, y: f.y0, w: bw, h: bh, s1, s2 };\n if (best === undefined || s1 < best.s1 || (s1 === best.s1 && (s2 < best.s2 || (s2 === best.s2 && (c.y < best.y || (c.y === best.y && c.x < best.x)))))) best = c;\n const ly = f.y0 + bh;\n if (low === undefined || ly < low.s1 || (ly === low.s1 && f.x0 < low.s2)) low = { ...c, s1: ly, s2: f.x0 };\n }\n }\n if (best === undefined || !check || space.fits({ x: best.x + ox, y: best.y + oy, w: best.w, h: best.h })) break;\n banned.add(2 * best.index + (best.turn ? 1 : 0));\n }\n\n let place: Box;\n if (best !== undefined) {\n place = { x0: best.x, y0: best.y, x1: best.x + best.w, y1: best.y + best.h };\n if (rule !== \"bl\" && low !== undefined && (low.x !== best.x || low.y !== best.y || low.turn !== best.turn)) countMove(MOVES[rule]);\n if (best.turn) {\n rect.size.set(best.w, best.h);\n turned?.add(rect);\n }\n } else {\n // No free rectangle has room. A fixed size leaves the box out. A free height puts it under all others, at the left edge.\n if (fixed) continue;\n place = { x0: 0, y0: bottom, x1: w, y1: bottom + h };\n }\n rect.position.set(place.x0 + ox, place.y0 + oy);\n rect.wasPacked = true;\n bottom = Math.max(bottom, place.y1);\n const result = cut(free, { x0: place.x0, y0: place.y0, x1: Math.min(W, place.x1), y1: place.y1 }, minW, minH);\n free = result.free;\n if (result.hits >= 2) countMove(MOVES.split);\n mark(place);\n if (!fixed) outer.size.y = Math.max(outer.size.y, place.y1);\n }\n return { outer, free: free.map((f) => ({ x: f.x0 + ox, y: f.y0 + oy, w: f.x1 - f.x0, h: f.y1 - f.y0 })) };\n}\n\n/**\n * This function packs rectangles into an outer rectangle with MaxRects of Jylänki (2010). It keeps the list of the maximal\n * free rectangles, and it does not change the width of the outer rectangle.\n *\n * - Each box goes to the top-left corner of the free rectangle that `options.rule` chooses. `MAXRECTS_RULES` tells the rules.\n * - A tie goes to the higher place, then to the place on the left, then to the first free rectangle of the list.\n * - A `locked` rectangle keeps its position, and the free rectangles go around it.\n * - With a space that is not plain, the free rectangles start from bands of the outline. `MaxRectsOptions` tells the bands.\n * - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a box that does not fit\n * is not packed: its `wasPacked` stays `false`.\n * - The default sort order is `height-desc`. The order of the array of the caller stays.\n */\nexport function packMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options: MaxRectsOptions = {}): Rect<T> {\n return runMaxRects(rects, outer, options).outer;\n}\n","import { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport { firstFit, type FreeSpace, type FreeSpan } from \"./space.ts\";\n\n/**\n * The rule of a shelf packing to choose the shelf of a rectangle. `packShelf` tells each rule.\n *\n * - `next`: only the open shelf, the last shelf that the packing opened.\n * - `first`: the first shelf from the top where the rectangle fits.\n * - `best`: the shelf with the least height left over above the rectangle.\n */\nexport type ShelfFit = \"next\" | \"first\" | \"best\";\n\n/** This constant lists each shelf fit. */\nexport const SHELF_FITS: readonly ShelfFit[] = [\"next\", \"first\", \"best\"];\n\n/** The options of `packShelf` */\nexport interface ShelfOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the packer uses only the\n * outer rectangle and the locked rectangles.\n */\n space?: FreeSpace;\n /**\n * The rule to choose a shelf. Without it, `packShelf` packs as in 0.2.3. With it, `packShelf` uses its own shelves in\n * each container shape, and it stacks rectangles in the strips above the shorter rectangles.\n */\n fit?: ShelfFit;\n}\n\n/** An obstacle in the coordinates of the outer rectangle */\ninterface Box {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\n/**\n * This function gives the first x from `start` where a rectangle of width `w` crosses no obstacle in the band from\n * `top` to `bottom`.\n */\nfunction firstFreeX(obstacles: readonly Box[], start: number, w: number, top: number, bottom: number): number {\n let x = start;\n let moved = true;\n while (moved) {\n moved = false;\n for (const o of obstacles) {\n if (o.top < bottom && top < o.bottom && o.left < x + w && x < o.right) {\n x = o.right;\n moved = true;\n }\n }\n }\n return x;\n}\n\n/** This function gives the lowest bottom edge of the obstacles in the band from `top` to `bottom`, under `top`. */\nfunction nextTop(obstacles: readonly Box[], top: number, bottom: number): number {\n let next = Infinity;\n for (const o of obstacles) if (o.top < bottom && top < o.bottom && o.bottom > top) next = Math.min(next, o.bottom);\n return next;\n}\n\n/**\n * This function packs rectangles into shelves: rows that it fills left to right in the sort order, and does not fill\n * again. It goes around each `locked` rectangle. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - With the sort order `input`, the rows read in the order of the array: left to right, and top to bottom.\n * - With `height-desc` (the default), it is the classic Next-Fit Decreasing Height packing.\n * - A rectangle goes to the first x in the row where it crosses no locked rectangle. If no such x is in the width,\n * a new row starts under the current row.\n * - A rectangle wider than the outer rectangle goes on its own row, at the left edge, and overflows.\n * - It does not change the width. Without `fixedSize`, the height grows to the content. With `fixedSize`, a\n * rectangle that does not fit is not packed: its `wasPacked` stays `false`.\n * - With a space that is not plain, `packRowsInSpace` packs the rows into the outline of the space and around its holes.\n * - With `fit`, `packShelvesInSpace` packs the rectangles, in each container shape. A `fit` that is not in `SHELF_FITS` throws a `RangeError`.\n */\nexport function packShelf<T>(rects: Rect<T>[], outer: Rect<T>, options: ShelfOptions = {}): Rect<T> {\n if (options.fit !== undefined) return packShelvesInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.fit, options.space);\n if (options.space !== undefined && !options.space.plain) return packRowsInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.space);\n const width = outer.size.x;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - outer.position.x;\n const top = rect.position.y - outer.position.y;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n\n let rowTop = 0;\n let rowBottom = 0;\n let cursor = 0;\n let rowEmpty = true;\n\n for (const rect of rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\"))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n const overflows = w > width;\n if (overflows && outer.fixedSize) continue;\n\n // An overflowing rectangle starts a row of its own\n if (overflows && !rowEmpty) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n }\n\n let x = firstFreeX(obstacles, cursor, w, rowTop, rowTop + h);\n while (!overflows && x + w > width) {\n // Start a new row under the current one, or under the obstacles that block an empty row\n rowTop = rowEmpty ? nextTop(obstacles, rowTop, rowTop + h) : rowBottom;\n rowBottom = rowTop;\n cursor = 0;\n rowEmpty = true;\n x = firstFreeX(obstacles, cursor, w, rowTop, rowTop + h);\n }\n while (overflows && x !== 0) {\n rowTop = nextTop(obstacles, rowTop, rowTop + h);\n rowBottom = rowTop;\n x = firstFreeX(obstacles, 0, w, rowTop, rowTop + h);\n }\n\n if (outer.fixedSize && rowTop + h > outer.size.y) continue;\n\n // The move of a shelf: the rectangle joins an open shelf that a taller rectangle made\n if (!rowEmpty && rowTop + h < rowBottom) countMove(MOVES.shelf);\n rect.position.set(x + outer.position.x, rowTop + outer.position.y);\n rect.wasPacked = true;\n rowEmpty = false;\n cursor = x + w;\n rowBottom = Math.max(rowBottom, rowTop + h);\n contentBottom = Math.max(contentBottom, rowTop + h);\n if (overflows) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n }\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n\n/**\n * This function gives the first x from `start` where a rectangle of width `w` fits. There, it crosses no locked rectangle,\n * and it is in a free span of its band. It takes `firstFreeX` and `firstFit` in turn until they agree. It gives `Infinity` when no x fits.\n */\nfunction placeInBand(obstacles: readonly Box[], spans: readonly FreeSpan[], start: number, w: number, top: number, bottom: number): number {\n let x = start;\n for (;;) {\n const free = firstFreeX(obstacles, x, w, top, bottom);\n const fit = firstFit(spans, free, w);\n if (fit === free || !Number.isFinite(fit)) return fit;\n x = fit;\n }\n}\n\n/**\n * This function packs rectangles into rows inside a free space. `packShelf` and `packRows` use it when the space is not\n * plain. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - A rectangle goes to the first x from the row cursor where it fits in the space and crosses no locked rectangle.\n * - When it does not fit, a new row starts under the current row. An empty row steps down to `nextY` of the space.\n * - When the steps of an empty row find no place, the row goes back to its last top edge. Later rectangles can use it.\n * - A rectangle wider than the outer rectangle overflows. Without `fixedSize`, it goes on its own row at the left edge.\n */\nexport function packRowsInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, space: FreeSpace): Rect<T> {\n const width = outer.size.x;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const limit = outer.fixedSize ? outer.size.y : Infinity;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - ox;\n const top = rect.position.y - oy;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n // The x in the row, in the coordinates of the outer rectangle, or Infinity\n const place = (start: number, w: number, top: number, h: number): number => {\n const spans = space.band(top + oy, top + h + oy).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n return placeInBand(obstacles, spans, start, w, top, top + h);\n };\n\n let rowTop = 0;\n let rowBottom = 0;\n let cursor = 0;\n let rowEmpty = true;\n for (const rect of rects.toSorted(compareRects(order))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n if (w > width) {\n if (outer.fixedSize) continue;\n const top = rowEmpty ? rowTop : rowBottom;\n rect.position.set(ox, top + oy);\n rect.wasPacked = true;\n rowTop = top + h;\n rowBottom = rowTop;\n cursor = 0;\n rowEmpty = true;\n contentBottom = Math.max(contentBottom, top + h);\n continue;\n }\n\n let x = place(cursor, w, rowTop, h);\n if (!(x + w <= width) && !rowEmpty) {\n rowTop = rowBottom;\n cursor = 0;\n rowEmpty = true;\n x = place(0, w, rowTop, h);\n }\n // The steps of an empty row. They stay only when the rectangle finds a place.\n let top = rowTop;\n while (!(x + w <= width) && top + h <= limit) {\n const next = Math.min(space.nextY(top + oy, top + h + oy, w) - oy, nextTop(obstacles, top, top + h));\n if (!Number.isFinite(next)) break;\n top = next;\n x = place(0, w, top, h);\n }\n if (!(x + w <= width) || top + h > limit) continue;\n if (top !== rowTop) {\n rowTop = top;\n rowBottom = top;\n }\n\n rect.position.set(x + ox, rowTop + oy);\n rect.wasPacked = true;\n rowEmpty = false;\n cursor = x + w;\n rowBottom = Math.max(rowBottom, rowTop + h);\n contentBottom = Math.max(contentBottom, rowTop + h);\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n\n/** A shelf of `packShelvesInSpace`, in the coordinates of the outer rectangle. */\ninterface Shelf {\n /** The top edge of the shelf. */\n top: number;\n /** The height of the shelf: the height of its first rectangle. Only the last shelf grows. */\n height: number;\n /** The x after the last rectangle on the floor of the shelf. The value `Infinity` closes the shelf. */\n cursor: number;\n /** The strips above the rectangles on the floor. A later rectangle stacks in a strip. */\n strips: Strip[];\n}\n\n/** The free strip above a rectangle of a shelf: from `x` to `x + w`, and from `bottom` to the top edge of the next shelf. */\ninterface Strip {\n x: number;\n w: number;\n bottom: number;\n}\n\n/** A place for a rectangle on a shelf. `left` is the height of the shelf that stays free above the rectangle. */\ninterface Spot {\n shelf: Shelf;\n x: number;\n y: number;\n left: number;\n /** The strip of a stacked rectangle. A rectangle on the floor has no strip. */\n strip?: Strip;\n /** The value `true` when the rectangle is taller than the last shelf, and the shelf grows. */\n grow?: boolean;\n}\n\n/**\n * This function packs rectangles into shelves with a fit: `next`, `first` or `best`. `packShelf` uses it when its\n * options have a `fit`. It sets the position of each rectangle and gives the outer rectangle.\n *\n * - A shelf opens at the bottom edge of the last shelf, at the first x where the rectangle fits in the free space.\n * When no x fits, the shelf steps down to `nextY` of the space, as an empty row of `packRowsInSpace` does.\n * - The first rectangle of a shelf sets its height. A rectangle goes on the floor of a shelf at its cursor, or into\n * the strip above a shorter rectangle of the shelf. The strip is the move `move.stack`.\n * - The fit `next` uses only the open shelf: the last shelf that the packing opened. The fit `first` uses the first\n * shelf from the top where the rectangle fits. The fit `best` uses the place with the least height left over.\n * - In a shelf, the rectangle takes the place with the least height left over. A tie goes to a strip, from left to right.\n * - When no shelf has a place, the last shelf grows for a taller rectangle, if it fits. Else a new shelf opens.\n * - A rectangle wider than the outer rectangle overflows. Without `fixedSize`, it goes on a closed shelf of its own at the left edge.\n * - Each place is in the free space and crosses no locked rectangle. Without a space, the outer rectangle and the\n * locked rectangles give the free space.\n */\nfunction packShelvesInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, fit: ShelfFit, space: FreeSpace | undefined): Rect<T> {\n if (!SHELF_FITS.includes(fit)) throw new RangeError(`The shelf fit \"${String(fit)}\" is not one of ${SHELF_FITS.join(\", \")}.`);\n const width = outer.size.x;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const limit = outer.fixedSize ? outer.size.y : Infinity;\n const obstacles: Box[] = [];\n let contentBottom = 0;\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const left = rect.position.x - ox;\n const top = rect.position.y - oy;\n obstacles.push({ left, top, right: left + rect.size.x, bottom: top + rect.size.y });\n contentBottom = Math.max(contentBottom, top + rect.size.y);\n }\n const whole: readonly FreeSpan[] = [{ start: 0, end: Infinity }];\n // The x in the band, in the coordinates of the outer rectangle, or Infinity\n const place = (start: number, w: number, top: number, h: number): number => {\n const spans = space === undefined ? whole : space.band(top + oy, top + h + oy).map((s) => ({ start: s.start - ox, end: s.end - ox }));\n return placeInBand(obstacles, spans, start, w, top, top + h);\n };\n // The next top edge where the free spans change, or Infinity\n const stepDown = (top: number, w: number, h: number): number =>\n Math.min(space === undefined ? Infinity : space.nextY(top + oy, top + h + oy, w) - oy, nextTop(obstacles, top, top + h));\n\n // The places of a shelf that the sizes allow, by the height left over. A strip comes before the floor on a tie.\n const spotsOn = (shelf: Shelf, w: number, h: number, grow: boolean): Spot[] => {\n const ceiling = shelf.top + shelf.height;\n const spots: Spot[] = [];\n if (!grow) {\n for (const strip of shelf.strips) {\n if (w <= strip.w && strip.bottom + h <= ceiling) spots.push({ shelf, x: strip.x, y: strip.bottom, left: ceiling - strip.bottom - h, strip });\n }\n }\n const tall = grow ? h > shelf.height && shelf.top + h <= limit : h <= shelf.height;\n if (Number.isFinite(shelf.cursor) && tall) spots.push({ shelf, x: shelf.cursor, y: shelf.top, left: grow ? 0 : shelf.height - h, ...(grow ? { grow } : {}) });\n return spots.toSorted((a, b) => a.left - b.left);\n };\n // The place of a spot in the free space, or undefined. A rectangle on the floor can move right of the cursor.\n const verify = (spot: Spot, w: number, h: number): Spot | undefined => {\n const x = place(spot.x, w, spot.y, h);\n if (spot.strip !== undefined) return x === spot.x ? spot : undefined;\n return x + w <= width ? { ...spot, x } : undefined;\n };\n const firstOn = (shelf: Shelf, w: number, h: number): Spot | undefined => {\n for (const spot of spotsOn(shelf, w, h, false)) {\n const found = verify(spot, w, h);\n if (found !== undefined) return found;\n }\n return undefined;\n };\n\n const shelves: Shelf[] = [];\n for (const rect of rects.toSorted(compareRects(order))) {\n if (rect.wasPacked) continue;\n const w = rect.size.x;\n const h = rect.size.y;\n if (!(w > 0 && h > 0)) continue;\n const open = shelves.at(-1);\n const floor = open === undefined ? 0 : open.top + open.height;\n\n if (w > width) {\n if (outer.fixedSize) continue;\n // An overflowing rectangle goes on a closed shelf of its own, under the locked rectangles at the left edge\n let top = floor;\n while (firstFreeX(obstacles, 0, w, top, top + h) !== 0) {\n const next = nextTop(obstacles, top, top + h);\n if (!Number.isFinite(next)) break;\n top = next;\n }\n rect.position.set(ox, top + oy);\n rect.wasPacked = true;\n shelves.push({ top, height: h, cursor: Infinity, strips: [] });\n contentBottom = Math.max(contentBottom, top + h);\n continue;\n }\n\n // Step 1: a shelf where the rectangle fits without growth\n let spot: Spot | undefined;\n let firstShelf: Shelf | undefined;\n if (fit === \"best\") {\n for (const s of shelves.flatMap((shelf) => spotsOn(shelf, w, h, false)).toSorted((a, b) => a.left - b.left)) {\n spot = verify(s, w, h);\n if (spot !== undefined) break;\n }\n if (spot !== undefined) firstShelf = shelves.find((shelf) => shelf === spot!.shelf || firstOn(shelf, w, h) !== undefined);\n } else {\n for (const shelf of fit === \"next\" ? shelves.slice(-1) : shelves) {\n spot = firstOn(shelf, w, h);\n if (spot !== undefined) break;\n }\n }\n // Step 2: the last shelf grows. Step 3: a new shelf opens under the last shelf.\n if (spot === undefined && open !== undefined) {\n const grown = spotsOn(open, w, h, true)[0];\n if (grown !== undefined) spot = verify(grown, w, h);\n }\n if (spot === undefined) {\n let top = floor;\n let x = place(0, w, top, h);\n while (!(x + w <= width) && top + h <= limit) {\n const next = stepDown(top, w, h);\n if (!Number.isFinite(next)) break;\n top = next;\n x = place(0, w, top, h);\n }\n if (!(x + w <= width) || top + h > limit) continue;\n const shelf: Shelf = { top, height: h, cursor: x, strips: [] };\n shelves.push(shelf);\n spot = { shelf, x, y: top, left: 0 };\n } else {\n if (spot.shelf !== open) countMove(MOVES.firstFit);\n if (firstShelf !== undefined && spot.shelf !== firstShelf) countMove(MOVES.bestFit);\n }\n\n const { shelf } = spot;\n rect.position.set(spot.x + ox, spot.y + oy);\n rect.wasPacked = true;\n if (spot.strip !== undefined) {\n countMove(MOVES.shelf);\n spot.strip.bottom = spot.y + h;\n } else {\n shelf.cursor = spot.x + w;\n shelf.strips.push({ x: spot.x, w, bottom: spot.y + h });\n if (spot.grow === true) shelf.height = h;\n }\n contentBottom = Math.max(contentBottom, spot.y + h);\n }\n\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, contentBottom);\n return outer;\n}\n","import { countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport type { Rect } from \"./rect.ts\";\nimport type { FreeSpace } from \"./space.ts\";\n\n/**\n * This function finds the lowest window of width `rw` on a skyline. For each `x` in `[0, width - rw]`, the height\n * of the window is the largest value of `skyline[x, x + rw)`. The first `x` with the smallest height wins. A\n * monotonic deque makes the search O(width) for one rectangle.\n *\n * With `limit`, a window is valid only when its height plus `rh` is not more than the smallest value of\n * `limit[x, x + rw)`. A second deque keeps that smallest value. No valid window gives the height `Infinity`.\n */\nexport function lowestWindow(skyline: ArrayLike<number>, width: number, rw: number, limit?: ArrayLike<number>, rh = 0): { x: number; y: number } {\n const { x, y } = findWindow(skyline, width, rw, limit, rh);\n return { x, y };\n}\n\n/** The lowest window of `findWindow`, and `first`: the x of the leftmost valid window, or `-1` */\ninterface Window {\n x: number;\n y: number;\n first: number;\n}\n\n/** This function is `lowestWindow`, and it also gives the x of the leftmost valid window. */\nfunction findWindow(skyline: ArrayLike<number>, width: number, rw: number, limit?: ArrayLike<number>, rh = 0): Window {\n if (limit !== undefined) return lowestLimitedWindow(skyline, limit, width, rw, rh);\n const deque = new Int32Array(width);\n let head = 0;\n let tail = 0;\n let bestX = 0;\n let bestY = Infinity;\n for (let i = 0; i < width; i++) {\n while (tail > head && skyline[deque[tail - 1]!]! <= skyline[i]!) tail--;\n deque[tail++] = i;\n if (deque[head]! <= i - rw) head++;\n if (i >= rw - 1) {\n const max = skyline[deque[head]!]!;\n if (max < bestY) {\n bestY = max;\n bestX = i - rw + 1;\n }\n }\n }\n return { x: bestX, y: bestY, first: width >= rw ? 0 : -1 };\n}\n\n/** This function counts the move of the skyline: a window that is lower than the leftmost valid window. */\nfunction countWindow(w: Window): void {\n if (Number.isFinite(w.y) && w.first >= 0 && w.x !== w.first) countMove(MOVES.skyline);\n}\n\n/** This function is `lowestWindow` with a limit for each cell. */\nfunction lowestLimitedWindow(skyline: ArrayLike<number>, limit: ArrayLike<number>, width: number, rw: number, rh: number): Window {\n const high = new Int32Array(width);\n const low = new Int32Array(width);\n let hh = 0;\n let ht = 0;\n let lh = 0;\n let lt = 0;\n let bestX = 0;\n let bestY = Infinity;\n let first = -1;\n for (let i = 0; i < width; i++) {\n while (ht > hh && skyline[high[ht - 1]!]! <= skyline[i]!) ht--;\n high[ht++] = i;\n if (high[hh]! <= i - rw) hh++;\n while (lt > lh && limit[low[lt - 1]!]! >= limit[i]!) lt--;\n low[lt++] = i;\n if (low[lh]! <= i - rw) lh++;\n if (i >= rw - 1) {\n const max = skyline[high[hh]!]!;\n const valid = max + rh <= limit[low[lh]!]!;\n if (valid && first < 0) first = i - rw + 1;\n if (max < bestY && valid) {\n bestY = max;\n bestX = i - rw + 1;\n }\n }\n }\n return { x: bestX, y: bestY, first };\n}\n\n/** The options of `packSkyline` */\nexport interface SkylineOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the skyline uses only the\n * outer rectangle and the locked rectangles.\n */\n space?: FreeSpace;\n}\n\n/**\n * This function packs rectangles into an outer rectangle with a skyline. It puts each rectangle in the lowest place\n * where it fits, and it does not change the width of the outer rectangle.\n *\n * - A `locked` rectangle keeps its position. The skyline starts at its bottom edge across its width, thus the other\n * rectangles go under it. The space above it stays empty, because a skyline has no holes.\n * - The skyline has a cell for each whole unit of the width. A rectangle that needs more cells than the outer\n * rectangle has goes under all other rectangles, at the left edge.\n * - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a rectangle that\n * does not fit is not packed: its `wasPacked` stays `false`.\n * - The default sort order is `height-desc`. The order of the array of the caller stays.\n * - With a space that is not plain, each cell gets its start and its limit from `column` of the space. The space holds\n * the obstacles and the locked items, thus the locked rectangles only keep their positions.\n */\nexport function packSkyline<T>(rects: Rect<T>[], outer: Rect<T>, options: SkylineOptions = {}): Rect<T> {\n if (options.space !== undefined && !options.space.plain) return packSkylineInSpace(rects, outer, options.sortOrder ?? \"height-desc\", options.space);\n // a cell for each whole unit of the width: a rectangle never goes past the right edge\n const width = Math.floor(outer.size.x);\n if (width <= 0) return outer;\n const skyline = new Float64Array(width);\n\n for (const rect of rects) {\n if (!rect.locked) continue;\n rect.wasPacked = true;\n const x0 = Math.max(0, Math.floor(rect.position.x - outer.position.x));\n const x1 = Math.min(width, Math.ceil(rect.position.x - outer.position.x + rect.size.x));\n const bottom = rect.position.y - outer.position.y + rect.size.y;\n for (let i = x0; i < x1; i++) skyline[i] = Math.max(skyline[i]!, bottom);\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, bottom);\n }\n\n for (const rect of rects.toSorted(compareRects(options.sortOrder ?? \"height-desc\"))) {\n if (rect.wasPacked) continue;\n const rw = Math.ceil(rect.size.x);\n const rh = rect.size.y;\n if (rw <= 0 || rh <= 0) continue;\n\n let x: number;\n let y: number;\n if (rw > width) {\n if (outer.fixedSize) continue;\n x = 0;\n y = 0;\n for (let i = 0; i < width; i++) if (skyline[i]! > y) y = skyline[i]!;\n } else {\n const found = findWindow(skyline, width, rw);\n ({ x, y } = found);\n if (outer.fixedSize && y + rh > outer.size.y) continue;\n countWindow(found);\n }\n\n rect.position.set(x + outer.position.x, y + outer.position.y);\n rect.wasPacked = true;\n const top = y + rh;\n for (let i = x; i < Math.min(width, x + rw); i++) skyline[i] = top;\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, top);\n }\n return outer;\n}\n\n/**\n * This function packs rectangles with a skyline in a free space. Each cell has a free range: the skyline is its start,\n * and `limit` is its end. A cell with less room than the lowest rectangle left goes to its next free range.\n *\n * A rectangle that needs more cells than the outer rectangle has goes at the left edge. Its y is the first y where each\n * cell is free over its height. Then each cell starts after the rectangle, as in the plain skyline.\n */\nfunction packSkylineInSpace<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder, space: FreeSpace): Rect<T> {\n const width = Math.floor(outer.size.x);\n if (width <= 0) return outer;\n const ox = outer.position.x;\n const oy = outer.position.y;\n const end = outer.fixedSize ? outer.size.y : Infinity;\n for (const rect of rects) if (rect.locked) rect.wasPacked = true;\n\n // The free range of a cell from a y, in the coordinates of the outer rectangle\n const rangeOf = (i: number, from: number): [number, number] => {\n const r = space.column(ox + i, ox + i + 1, from + oy);\n if (r === undefined) return [Infinity, -Infinity];\n return [r.start - oy, Math.min(r.end - oy, end)];\n };\n const skyline = new Float64Array(width);\n const limit = new Float64Array(width);\n for (let i = 0; i < width; i++) [skyline[i], limit[i]] = rangeOf(i, 0);\n\n const sorted = rects.toSorted(compareRects(order)).filter((r) => !r.wasPacked && Math.ceil(r.size.x) > 0 && r.size.y > 0);\n // The lowest height of the rectangles from each index of the sorted list to its end\n const lowest = new Float64Array(sorted.length + 1).fill(Infinity);\n for (let k = sorted.length - 1; k >= 0; k--) lowest[k] = Math.min(lowest[k + 1]!, sorted[k]!.size.y);\n const advance = (k: number): void => {\n const need = lowest[k]!;\n if (!Number.isFinite(need)) return;\n for (let i = 0; i < width; i++) {\n while (Number.isFinite(limit[i]!) && limit[i]! - skyline[i]! < need && limit[i]! < end) [skyline[i], limit[i]] = rangeOf(i, limit[i]!);\n }\n };\n\n for (const [k, rect] of sorted.entries()) {\n advance(k);\n const rw = Math.ceil(rect.size.x);\n const rh = rect.size.y;\n let x: number;\n let y: number;\n if (rw > width) {\n if (outer.fixedSize) continue;\n x = 0;\n y = 0;\n for (let i = 0; i < width; i++) if (Number.isFinite(skyline[i]!) && skyline[i]! > y) y = skyline[i]!;\n // The rectangle covers each cell, thus it goes to the first y where each cell is free over its height\n for (let moved = true; moved; ) {\n moved = false;\n for (let i = 0; i < width; i++) {\n if (!Number.isFinite(skyline[i]!)) continue;\n const [s, e] = rangeOf(i, y);\n const next = s > y ? s : e < y + rh ? rangeOf(i, e)[0] : y;\n if (next > y && Number.isFinite(next)) {\n y = next;\n moved = true;\n }\n }\n }\n rect.position.set(x + ox, y + oy);\n rect.wasPacked = true;\n const top = y + rh;\n // Each cell starts after the rectangle. A cell with a range that ends before the top of the rectangle goes to its next range.\n for (let i = 0; i < width; i++) {\n if (!Number.isFinite(skyline[i]!)) continue;\n if (top <= limit[i]!) skyline[i] = top;\n else [skyline[i], limit[i]] = rangeOf(i, top);\n }\n outer.size.y = Math.max(outer.size.y, top);\n continue;\n }\n let found = findWindow(skyline, width, rw, limit, rh);\n ({ x, y } = found);\n let sky: Float64Array = skyline;\n let lim: Float64Array = limit;\n if (!Number.isFinite(y)) {\n // The second try: each cell goes to its first free range with room for this rectangle\n sky = skyline.slice();\n lim = limit.slice();\n for (let i = 0; i < width; i++) {\n while (Number.isFinite(lim[i]!) && lim[i]! - sky[i]! < rh && lim[i]! < end) [sky[i], lim[i]] = rangeOf(i, lim[i]!);\n }\n found = findWindow(sky, width, rw, lim, rh);\n ({ x, y } = found);\n if (!Number.isFinite(y)) continue;\n }\n\n countWindow(found);\n rect.position.set(x + ox, y + oy);\n rect.wasPacked = true;\n const top = y + rh;\n for (let i = x; i < x + rw; i++) {\n skyline[i] = top;\n limit[i] = lim[i]!;\n }\n if (!outer.fixedSize) outer.size.y = Math.max(outer.size.y, top);\n }\n return outer;\n}\n","import { packMaxRects, type MaxRectsRule } from \"./maxrects.ts\";\nimport { clearMoves, countMove, MOVES } from \"./moves.ts\";\nimport { compareRects, type SortOrder } from \"./order.ts\";\nimport { Rect } from \"./rect.ts\";\nimport { packRowsInSpace, packShelf, type ShelfFit } from \"./shelf.ts\";\nimport { packSkyline } from \"./skyline.ts\";\nimport type { FreeSpace } from \"./space.ts\";\nimport { Vector } from \"./vector.ts\";\n\n/** The options of `pack` and `packRows` */\nexport interface PackOptions {\n /** The order of the rectangles before the packing. The default is `height-desc`. */\n sortOrder?: SortOrder;\n /**\n * The free space of the container: `freeSpace` of the input. With a space that is not plain, each strategy packs into\n * the outline of the container and around its holes. The rows of `packRows` also go around the locked rectangles.\n */\n space?: FreeSpace;\n}\n\n/** The options of `pack` */\nexport interface PackLayoutOptions extends PackOptions {\n /**\n * The packing: `rows` (the default), `skyline`, `shelf` or `maxrects`. `skyline`, `shelf` and `maxrects` pack around\n * locked rectangles. Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.\n */\n strategy?: \"rows\" | \"skyline\" | \"shelf\" | \"maxrects\";\n /** The rule of `shelf` to choose a shelf. Only `shelf` reads it. `ShelfOptions` tells it. Without it, `shelf` packs as in 0.2.3. */\n fit?: ShelfFit;\n /** The rule of `maxrects` to choose a free rectangle. Only `maxrects` reads it. The default is `bssf`. */\n rule?: MaxRectsRule;\n /** The largest height of a band of `maxrects` in a space that is not plain. Only `maxrects` reads it. `MaxRectsOptions` tells it. */\n bandHeight?: number;\n /** The rectangles that `maxrects` can turn by 90 degrees. Only `maxrects` reads it. */\n turnable?: ReadonlySet<unknown>;\n /** The rectangles that `maxrects` turned. Only `maxrects` reads it. `MaxRectsOptions` tells it. */\n turned?: Set<unknown>;\n}\n\n/** The depth of the calls of `packInto`. Only the outer gap fill counts its rectangles as moves. */\nlet fillDepth = 0;\n\nfunction packInto<T>(rects: Rect<T>[], region: Rect<T>, offset: Vector, order: SortOrder): void {\n const unpacked = Rect.unpacked(rects);\n fillDepth++;\n try {\n pack(unpacked, region, { sortOrder: order });\n } finally {\n fillDepth--;\n }\n const placed = Rect.packed(unpacked);\n if (fillDepth === 0) countMove(MOVES.rows, placed.length);\n for (const r of placed) r.translateBy(offset);\n}\n\nfunction packRow<T>(rects: Rect<T>[], outer: Rect<T>, order: SortOrder): boolean {\n const row: Rect<T>[] = [];\n // toSorted gives a sorted copy, thus the order of the array of the caller stays\n const byHeight = rects.toSorted(compareRects(order));\n // A gap fill puts a later rect before an earlier one, thus the order `input` fills no gaps\n const fillGaps = order !== \"input\";\n\n const rowRect = new Rect<T>();\n rowRect.size.set(outer.size.x, 0);\n\n for (const rect of byHeight) {\n if (rect.wasPacked) continue;\n\n if (rect.size.x > rowRect.size.x) {\n if (outer.fixedSize && rect.size.x > outer.size.x) continue;\n\n const outerLeft = new Rect<T>();\n outerLeft.position.setTo(rowRect.position);\n outerLeft.size.set(outer.size.x - rowRect.position.x, rowRect.size.y);\n outerLeft.fixedSize = true;\n if (fillGaps) packInto(rects, outerLeft, outer.position, order);\n\n rowRect.position.set(0, rowRect.bottom());\n rowRect.size.set(outer.size.x, 0);\n row.length = 0;\n }\n\n if (rowRect.position.y + rect.size.y > outer.size.y) {\n if (outer.fixedSize) continue;\n outer.size.y += rect.size.y;\n if (!outer.fixedWidth && !outer.size.x) outer.size.x = rect.size.x;\n Rect.resetPacked(rects);\n return false;\n }\n\n row.push(rect);\n rect.position.setTo(rowRect.position.add(outer.position));\n rowRect.shrinkLeft(rect.size.x);\n rect.wasPacked = true;\n\n if (rect.size.y > rowRect.size.y) rowRect.size.y = rect.size.y;\n\n if (fillGaps && row.length > 1) {\n const rectInRow = row[row.length - 1]!;\n const outerLeft = new Rect<T>();\n // The position of the region is relative to the outer rectangle, as packInto adds the position of the outer rectangle\n outerLeft.position.set(rectInRow.position.x - outer.position.x, rectInRow.bottom() - outer.position.y);\n outerLeft.size.set(rectInRow.size.x, rowRect.size.y - rectInRow.size.y);\n outerLeft.fixedWidth = true;\n outerLeft.fixedSize = true;\n packInto(rects, outerLeft, outer.position, order);\n }\n }\n return true;\n}\n\n/**\n * This function packs rectangles into an outer rectangle of a given width with a guillotine row packing. It does\n * not change the width. Without `fixedSize`, the height grows until all rectangles fit. A `locked` rectangle keeps\n * its position, but the rows do not go around it. `pack` sets the width first and then uses this function.\n *\n * With `options.space`, the rows go around the locked rectangles and the holes of the space, inside its outline. A space\n * that is plain, with no locked rectangle, gives the rows of 0.1.\n */\nexport function packRows<T>(rects: Rect<T>[], outer: Rect<T>, options: PackOptions = {}): Rect<T> {\n const order = options.sortOrder ?? \"height-desc\";\n const space = options.space;\n if (space !== undefined && (!space.plain || rects.some((r) => r.locked))) return packRowsInSpace(rects, outer, order, space);\n for (const r of rects) if (r.locked) r.wasPacked = true;\n // A row that does not fit grows the height and starts again, thus the gap fills of the try before do not count\n while (!packRow(rects, outer, order)) if (fillDepth === 0) clearMoves(MOVES.rows);\n return outer;\n}\n\n/**\n * This function packs rectangles into an outer rectangle with a guillotine row packing. It sets the position\n * of each rectangle and the size of the outer rectangle, and it gives the outer rectangle.\n *\n * - Without fixed sizes, the outer rectangle starts with a width of 1.5 times the square root of the total area.\n * This width is not less than the width of the widest rectangle. The height grows until all rectangles fit.\n * - With `fixedWidth`, the width stays. A rectangle wider than that width goes on its own row and overflows.\n * - With `fixedSize`, a rectangle that does not fit is not packed: its `wasPacked` stays `false`.\n * - `options.strategy` selects `packRows` (the default), `packSkyline`, `packShelf` or `packMaxRects` after the width is set.\n */\nexport function pack<T>(rects: Rect<T>[], outer: Rect<T> = new Rect(), options: PackLayoutOptions = {}): Rect<T> {\n let totalArea = 0;\n let widest = 0;\n let minX = rects.length > 0 ? Infinity : 0;\n let minY = rects.length > 0 ? Infinity : 0;\n for (const r of rects) {\n totalArea += r.area();\n widest = Math.max(widest, r.size.x);\n minX = Math.min(minX, r.size.x);\n minY = Math.min(minY, r.size.y);\n }\n\n const idealWidth = outer.fixedWidth\n ? outer.size.x\n : Math.max(widest, Math.min(1.5 * Math.sqrt(totalArea), outer.size.x || Infinity));\n\n const ideal = Vector.of(idealWidth).clamp(new Vector(minX, minY), Vector.Infinity);\n\n // A fixed width stays, also when a rectangle is wider: that rectangle overflows\n if (!outer.fixedSize) outer.size.setTo(outer.fixedWidth ? new Vector(outer.size.x, ideal.y) : ideal);\n if (options.strategy === \"skyline\") packSkyline(rects, outer, options);\n else if (options.strategy === \"shelf\") packShelf(rects, outer, options);\n else if (options.strategy === \"maxrects\") packMaxRects(rects, outer, options);\n else packRows(rects, outer, options);\n\n if (!outer.fixedSize) {\n const contentRight = Rect.maxRight(rects);\n if (!outer.size.x) outer.size.x = contentRight;\n else if (!outer.fixedWidth) outer.size.x = Math.min(contentRight, outer.size.x);\n outer.size.y = Rect.maxBottom(rects);\n }\n\n return outer;\n}\n","import { clearMoves } from \"./moves.ts\";\nimport { pack, type PackLayoutOptions } from \"./pack.ts\";\nimport { Rect } from \"./rect.ts\";\n\n/** The options of `packFree` */\nexport interface FreeWidthOptions extends PackLayoutOptions {\n /** The target aspect: the width divided by the height. The default is 1, a square. */\n aspect?: number;\n /**\n * The weight of the aspect error in the objective. The objective is the area times `1 + aspectWeight * aspectError`.\n * The default is 1. With 0, only the area counts.\n */\n aspectWeight?: number;\n /** The number of widths that the first pass tries. The default is 48. */\n samples?: number;\n}\n\n/** One width that `packFree` tried, and its result */\nexport interface FreeWidthTry {\n /** The width of the container for this try */\n width: number;\n /** The width of the content: the right edge of the rectangles */\n contentWidth: number;\n /** The height of the content */\n contentHeight: number;\n /** The objective of this try. Lower is better. */\n objective: number;\n}\n\n/** The result of `packFree` */\nexport interface FreeWidthResult<T> {\n /** The outer rectangle, with the size of the content */\n outer: Rect<T>;\n /** The area of the bounding box of the content */\n area: number;\n /** The area of the rectangles divided by the area of the bounding box */\n fill: number;\n /** The aspect of the bounding box: the width divided by the height */\n aspect: number;\n /** The distance from the target aspect: the absolute value of `log(aspect) - log(target)` */\n aspectError: number;\n /** The objective of the chosen width. Lower is better. */\n objective: number;\n /** Each width that the search tried, in the order of the search */\n tried: FreeWidthTry[];\n}\n\n/** This function gives the distance between an aspect and a target aspect on a log scale. */\nexport function aspectError(width: number, height: number, target = 1): number {\n if (!(width > 0 && height > 0 && target > 0)) return Infinity;\n return Math.abs(Math.log(width / height) - Math.log(target));\n}\n\n/**\n * This function packs rectangles with a free width. It tries many widths with the strategy of `options`, and keeps\n * the width with the lowest objective: the area of the bounding box times `1 + aspectWeight * aspectError`.\n *\n * - The first pass tries `samples` widths on a log scale, from the widest rectangle to the width of one row.\n * - The second pass tries the widths between the two neighbours of the best width of the first pass.\n * - The search is deterministic: the same input gives the same widths and the same result.\n * - A `locked` rectangle keeps its position. The width is not less than its right edge.\n * - Each strategy of `pack` works with this function, because it only changes the width.\n */\nexport function packFree<T>(rects: Rect<T>[], outer: Rect<T> = new Rect(), options: FreeWidthOptions = {}): FreeWidthResult<T> {\n const target = options.aspect ?? 1;\n const weight = options.aspectWeight ?? 1;\n const samples = Math.max(2, Math.floor(options.samples ?? 48));\n const ox = outer.position.x;\n const oy = outer.position.y;\n\n let itemArea = 0;\n let minWidth = 0;\n let rowWidth = 0;\n for (const r of rects) {\n if (r.locked) {\n minWidth = Math.max(minWidth, r.right() - ox);\n continue;\n }\n if (!(r.size.x > 0 && r.size.y > 0)) continue;\n itemArea += r.area();\n minWidth = Math.max(minWidth, r.size.x);\n rowWidth += r.size.x;\n }\n for (const r of rects) if (r.locked) itemArea += r.area();\n const maxWidth = Math.max(minWidth, rowWidth);\n\n const tried: FreeWidthTry[] = [];\n const run = (width: number): FreeWidthTry => {\n // The counts of the moves come from the last run: the run with the best width\n clearMoves();\n Rect.resetPacked(rects);\n const box = new Rect<T>();\n box.position.setTo(outer.position);\n box.size.set(width, 0);\n box.fixedWidth = true;\n pack(rects, box, options);\n const placed = Rect.packed(rects);\n const contentWidth = Math.max(0, Rect.maxRight(placed) - ox);\n const contentHeight = Math.max(0, Rect.maxBottom(placed) - oy);\n const area = contentWidth * contentHeight;\n const objective = area > 0 ? area * (1 + weight * aspectError(contentWidth, contentHeight, target)) : 0;\n const t = { width, contentWidth, contentHeight, objective };\n tried.push(t);\n return t;\n };\n\n // The first pass: widths on a log scale. Each width is a whole number when the sizes are whole numbers.\n const widths: number[] = [];\n if (maxWidth > 0) {\n const ratio = maxWidth / minWidth;\n for (let i = 0; i < samples; i++) {\n const w = minWidth * ratio ** (i / (samples - 1));\n const rounded = i === samples - 1 ? maxWidth : Math.max(minWidth, Math.round(w));\n if (widths.at(-1) !== rounded) widths.push(rounded);\n }\n }\n let best: FreeWidthTry | undefined = undefined;\n let bestIndex = 0;\n for (const [i, w] of widths.entries()) {\n const t = run(w);\n if (best === undefined || t.objective < best.objective) {\n best = t;\n bestIndex = i;\n }\n }\n\n // The second pass: the widths between the two neighbours of the best width\n if (widths.length > 2) {\n const low = widths[Math.max(0, bestIndex - 1)]!;\n const high = widths[Math.min(widths.length - 1, bestIndex + 1)]!;\n const steps = Math.min(Math.floor(samples / 2), Math.max(0, Math.round(high - low) - 1));\n for (let i = 1; i <= steps; i++) {\n const w = Math.round(low + ((high - low) * i) / (steps + 1));\n if (widths.includes(w)) continue;\n const t = run(w);\n if (best === undefined || t.objective < best.objective) best = t;\n }\n }\n\n // The last run packs with the best width, so the positions of the rectangles are those of the best width\n const chosen = best === undefined ? undefined : run(best.width);\n tried.pop();\n const w = chosen?.contentWidth ?? 0;\n const h = chosen?.contentHeight ?? 0;\n if (!outer.fixedSize) outer.size.set(w, h);\n const area = w * h;\n return {\n outer,\n area,\n fill: area > 0 ? itemArea / area : 0,\n aspect: h > 0 ? w / h : 0,\n aspectError: aspectError(w, h, target),\n objective: chosen?.objective ?? 0,\n tried,\n };\n}\n","import type { Rect } from \"./rect.ts\";\n\n/** The options of `pushCascade`. */\nexport interface PushOptions {\n /** The space between a shoved rectangle and the rectangle that shoves it. The default is 8. */\n gap?: number;\n /** The most shoves. The default is eight for each rectangle. The cascade stops at this limit. */\n maxShoves?: number;\n}\n\n/** A direction of a shove: an axis and a sign. */\ninterface Direction {\n readonly axis: \"x\" | \"y\";\n readonly sign: 1 | -1;\n}\n\n/** This function gives the overlap of two rectangles on each axis. A value of 0 or less is no overlap. */\nfunction overlapOf(a: Rect, b: Rect): { x: number; y: number } {\n return {\n x: Math.min(a.right(), b.right()) - Math.max(a.position.x, b.position.x),\n y: Math.min(a.bottom(), b.bottom()) - Math.max(a.position.y, b.position.y),\n };\n}\n\n/**\n * This function gives the direction of a first shove. The axis has the smaller overlap. The sign points away from the\n * center of the pusher. When that shove crosses 0, the sign is positive.\n */\nfunction firstDirection(pusher: Rect, r: Rect, gap: number): Direction {\n const overlap = overlapOf(pusher, r);\n if (overlap.x < overlap.y) {\n const back = r.position.x + r.size.x / 2 < pusher.position.x + pusher.size.x / 2 && pusher.position.x - r.size.x - gap >= 0;\n return { axis: \"x\", sign: back ? -1 : 1 };\n }\n const back = r.position.y + r.size.y / 2 < pusher.position.y + pusher.size.y / 2 && pusher.position.y - r.size.y - gap >= 0;\n return { axis: \"y\", sign: back ? -1 : 1 };\n}\n\n/** This function puts a rectangle past the pusher, along a direction. The rectangle does not go past 0. */\nfunction shove(pusher: Rect, r: Rect, direction: Direction, gap: number): void {\n if (direction.axis === \"x\") {\n const x = direction.sign > 0 ? pusher.right() + gap : pusher.position.x - r.size.x - gap;\n r.position.set(Math.max(0, x), r.position.y);\n return;\n }\n const y = direction.sign > 0 ? pusher.bottom() + gap : pusher.position.y - r.size.y - gap;\n r.position.set(r.position.x, Math.max(0, y));\n}\n\n/**\n * This function moves each rectangle that a placed rectangle overlaps, and the rectangles that those overlap in turn.\n * A shove takes the axis of the smaller overlap, away from the pusher. A shoved rectangle keeps the direction of its first\n * shove when it shoves the next one, so the cascade goes outward. The placed rectangle and each locked rectangle stay.\n * The function moves the rectangles in place and gives the rectangles that moved.\n *\n * @example\n * ```ts\n * const moved = pushCascade(dropped, cards, { gap: 8 });\n * ```\n */\nexport function pushCascade<T>(placed: Rect<T>, rects: readonly Rect<T>[], options: PushOptions = {}): Rect<T>[] {\n const gap = options.gap ?? 8;\n const maxShoves = options.maxShoves ?? rects.length * 8;\n const moved = new Set<Rect<T>>();\n const queue: { pusher: Rect<T>; direction?: Direction }[] = [{ pusher: placed }];\n let shoves = 0;\n while (shoves < maxShoves) {\n const step = queue.shift();\n if (!step) break;\n const { pusher, direction } = step;\n for (const r of rects) {\n if (r === pusher || r === placed || r.locked) continue;\n const overlap = overlapOf(pusher, r);\n if (overlap.x <= 0 || overlap.y <= 0) continue;\n const next = direction ?? firstDirection(pusher, r, gap);\n shove(pusher, r, next, gap);\n moved.add(r);\n queue.push({ pusher: r, direction: next });\n if (++shoves >= maxShoves) break;\n }\n }\n return [...moved];\n}\n","// The forced overflow of roadmap item k59 (docs/MEASURES.md, \"Overflow\"): a lower bound of the count of items that no\n// packer can place in a fixed container. `measure` uses it for `pack.overflow.forced` and `pack.overflow.forcedArea`.\n\nimport { boundsOf } from \"@mark1russell7/layout-contract\";\nimport { DEFAULT_TOLERANCE, type Item, type PackInput, type Region } from \"./contract.ts\";\n\n/** A rectangle: its top-left corner and its size. */\ninterface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** A ring of a polygon. */\ntype Ring = readonly (readonly [number, number])[];\n\n/** A region that the items cannot use: a fixed obstacle or a locked item. */\ninterface Blocked {\n region: Region;\n box: Box;\n}\n\n/** The lower bound of the overflow of one input. `overflowBound` gives it. */\nexport interface OverflowBound {\n /** The count of items that no packer can place. It is a lower bound. */\n readonly forced: number;\n /** The area that no packer can place. It is a lower bound of the area of the unplaced items. */\n readonly area: number;\n /** The upper bound of the free area of a fixed container, or `Infinity` when a side is free. */\n readonly free: number;\n}\n\n/** This function gives the area of a ring by the shoelace formula. The direction of the ring does not count. */\nfunction ringArea(ring: Ring): number {\n let sum = 0;\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!;\n const b = ring[(i + 1) % ring.length]!;\n sum += a[0] * b[1] - b[0] * a[1];\n }\n return Math.abs(sum) / 2;\n}\n\n/**\n * This function gives the area of a region that an item cannot use. A polygon loses the area of its holes. Thus a hole\n * that is out of the polygon makes the area too small, and the free area stays an upper bound.\n */\nfunction blockedArea(region: Region): number {\n switch (region.kind) {\n case \"rect\":\n return Math.max(0, region.w) * Math.max(0, region.h);\n case \"circle\":\n return Math.PI * region.r ** 2;\n case \"ellipse\":\n return Math.PI * region.rx * region.ry;\n case \"polygon\": {\n let area = ringArea(region.points);\n for (const hole of region.holes ?? []) area -= ringArea(hole);\n return Math.max(0, area);\n }\n }\n}\n\n/** This function tells if the insides of two rectangles have a common point. Two rectangles with a common edge do not. */\nfunction boxesOverlap(a: Box, b: Box): boolean {\n return Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x) > 0 && Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y) > 0;\n}\n\n/** This function tells if rectangle `a` is in rectangle `b`. */\nfunction boxIn(a: Box, b: Box): boolean {\n return a.x >= b.x && a.y >= b.y && a.x + a.w <= b.x + b.w && a.y + a.h <= b.y + b.h;\n}\n\n/** This function gives the rectangle made smaller by `d` on each side. */\nfunction shrink(b: Box, d: number): Box {\n return { x: b.x + d, y: b.y + d, w: Math.max(0, b.w - 2 * d), h: Math.max(0, b.h - 2 * d) };\n}\n\n/** This function tells if a point is in a ring, by the even-odd rule. */\nfunction pointInRing(x: number, y: number, ring: Ring): boolean {\n let inside = false;\n for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {\n const [xi, yi] = ring[i]!;\n const [xj, yj] = ring[j]!;\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n }\n return inside;\n}\n\n/** This function tells if a segment has a part of a length above 0 in the open rectangle. The Liang-Barsky clip gives it. */\nfunction segmentHitsBox(ax: number, ay: number, bx: number, by: number, r: Box): boolean {\n let t0 = 0;\n let t1 = 1;\n const dx = bx - ax;\n const dy = by - ay;\n const clip = (p: number, q: number): boolean => {\n if (p === 0) return q > 0;\n const t = q / p;\n if (p < 0) {\n if (t > t1) return false;\n if (t > t0) t0 = t;\n } else {\n if (t < t0) return false;\n if (t < t1) t1 = t;\n }\n return true;\n };\n return clip(-dx, ax - r.x) && clip(dx, r.x + r.w - ax) && clip(-dy, ay - r.y) && clip(dy, r.y + r.h - ay) && t1 > t0;\n}\n\n/**\n * This function tells if a rectangle is in a polygon with holes. No edge of a ring crosses the inside of the rectangle.\n * No vertex is in it, and its center is in the polygon by the even-odd rule.\n */\nfunction boxInPolygon(b: Box, rings: readonly Ring[]): boolean {\n for (const ring of rings) {\n for (let i = 0; i < ring.length; i++) {\n const p = ring[i]!;\n const q = ring[(i + 1) % ring.length]!;\n if (p[0] > b.x && p[0] < b.x + b.w && p[1] > b.y && p[1] < b.y + b.h) return false;\n if (segmentHitsBox(p[0], p[1], q[0], q[1], b)) return false;\n }\n }\n const cx = b.x + b.w / 2;\n const cy = b.y + b.h / 2;\n let inside = false;\n for (const ring of rings) if (pointInRing(cx, cy, ring)) inside = !inside;\n return inside;\n}\n\n/** This function tells if a rectangle is in a region of a container. A rectangle with no size is in no region. */\nfunction boxInShape(b: Box, shape: Region): boolean {\n if (!(b.w > 0 && b.h > 0)) return false;\n // A small shrink keeps a rectangle on the outline in the shape\n const s = shrink(b, 1e-9 * Math.max(1, b.w, b.h));\n switch (shape.kind) {\n case \"rect\":\n return boxIn(b, { x: shape.x, y: shape.y, w: shape.w, h: shape.h });\n case \"circle\":\n case \"ellipse\": {\n const rx = shape.kind === \"circle\" ? shape.r : shape.rx;\n const ry = shape.kind === \"circle\" ? shape.r : shape.ry;\n const inside = (x: number, y: number): boolean => ((x - shape.cx) / rx) ** 2 + ((y - shape.cy) / ry) ** 2 <= 1;\n return inside(s.x, s.y) && inside(s.x + s.w, s.y) && inside(s.x, s.y + s.h) && inside(s.x + s.w, s.y + s.h);\n }\n case \"polygon\":\n return boxInPolygon(s, [shape.points, ...(shape.holes ?? [])]);\n }\n}\n\n/**\n * This function gives the area of a container shape. A hole counts only when its bounding box is in the outer ring.\n * Also, that box has no common point with the box of a hole before it. Thus the area is not too small.\n */\nfunction shapeArea(shape: Region): number {\n if (shape.kind !== \"polygon\") return blockedArea(shape);\n let area = ringArea(shape.points);\n const kept: Box[] = [];\n for (const hole of shape.holes ?? []) {\n const box = boundsOf({ kind: \"polygon\", points: hole });\n if (!boxInPolygon(shrink(box, 1e-9 * Math.max(1, box.w, box.h)), [shape.points])) continue;\n if (kept.some((k) => boxesOverlap(k, box))) continue;\n kept.push(box);\n area -= ringArea(hole);\n }\n return Math.max(0, area);\n}\n\n/**\n * This function gives the area of the union of rectangles, each cut to the rectangle `clip`. A sweep over the x edges\n * adds the merged y intervals of each slab.\n */\nfunction unionArea(boxes: readonly Box[], clip: Box): number {\n const cut: Box[] = [];\n for (const b of boxes) {\n const x0 = Math.max(b.x, clip.x);\n const y0 = Math.max(b.y, clip.y);\n const x1 = Math.min(b.x + b.w, clip.x + clip.w);\n const y1 = Math.min(b.y + b.h, clip.y + clip.h);\n if (x1 > x0 && y1 > y0) cut.push({ x: x0, y: y0, w: x1 - x0, h: y1 - y0 });\n }\n const xs = [...new Set(cut.flatMap((b) => [b.x, b.x + b.w]))].toSorted((a, b) => a - b);\n let area = 0;\n for (let i = 0; i + 1 < xs.length; i++) {\n const left = xs[i]!;\n const right = xs[i + 1]!;\n const spans = cut\n .filter((b) => b.x <= left && b.x + b.w >= right)\n .map((b) => [b.y, b.y + b.h] as const)\n .toSorted((p, q) => p[0] - q[0]);\n let covered = 0;\n let top = -Infinity;\n let bottom = -Infinity;\n for (const [s, e] of spans) {\n if (s > bottom) {\n covered += bottom - top > 0 ? bottom - top : 0;\n top = s;\n bottom = e;\n } else bottom = Math.max(bottom, e);\n }\n covered += bottom - top > 0 ? bottom - top : 0;\n area += covered * (right - left);\n }\n return area;\n}\n\n/** This function gives the rectangle of the container: the bounding box of its shape, or 0, 0, `w`, `h`. */\nfunction containerBox(input: PackInput): Box {\n const { container } = input;\n if (container.shape !== undefined) return boundsOf(container.shape);\n return { x: 0, y: 0, w: container.w ?? Infinity, h: container.h ?? Infinity };\n}\n\n/** This function tells if an item is locked at a position. Such an item is not a candidate of the overflow. */\nconst lockedAt = (item: Item): boolean => item.locked === true && item.x !== undefined && item.y !== undefined;\n\n/** This function gives the rectangle of an item at its position: the bounding box of its shape, or its size. */\nfunction itemBox(item: Item): Box {\n const s = item.shape === undefined ? { x: 0, y: 0, w: item.w, h: item.h } : boundsOf(item.shape);\n return { x: (item.x ?? 0) + s.x, y: (item.y ?? 0) + s.y, w: s.w, h: s.h };\n}\n\n/** This function gives the smallest area of an item: its rectangle, or the area of its shape when that is smaller. */\nfunction itemArea(item: Item): number {\n const rect = Math.max(0, item.w) * Math.max(0, item.h);\n return item.shape === undefined ? rect : Math.min(rect, blockedArea(item.shape));\n}\n\n/**\n * This function gives an upper bound of the free area of a container with a fixed size. The bound ignores the gap and\n * the margins, thus it is not too small.\n *\n * - The container area is the inner rectangle (the container less the inset). A shape gives the smaller of that and its exact area.\n * - A rectangle container loses the exact union of the fixed rectangle obstacles and the locked items in the inner rectangle.\n * - A shape loses only the regions that are fully in it and in the inner rectangle, with no common point between their boxes.\n * - An obstacle with `move` can go out of the way. Thus the bound does not subtract it.\n */\nexport function freeAreaBound(input: PackInput): number {\n const bounds = containerBox(input);\n const inset = input.container.inset ?? 0;\n const inner = shrink(bounds, inset);\n if (!(inner.w > 0 && inner.h > 0)) return 0;\n const blocked: Blocked[] = [];\n for (const o of input.obstacles ?? []) if (o.move === undefined) blocked.push({ region: o.region, box: boundsOf(o.region) });\n for (const item of input.items) {\n if (!lockedAt(item)) continue;\n const box = itemBox(item);\n blocked.push({ region: { kind: \"rect\", ...box }, box });\n }\n\n const shape = input.container.shape;\n const innerArea = inner.w * inner.h;\n const inInner = (b: Box): boolean => b.w > 0 && b.h > 0 && boxIn(b, inner);\n if (shape === undefined || shape.kind === \"rect\") {\n const rects = blocked.filter((b) => b.region.kind === \"rect\");\n let free = innerArea - unionArea(rects.map((b) => b.box), inner);\n const kept: Box[] = [];\n for (const b of blocked) {\n if (b.region.kind === \"rect\" || !inInner(b.box)) continue;\n if (rects.some((r) => boxesOverlap(r.box, b.box)) || kept.some((k) => boxesOverlap(k, b.box))) continue;\n kept.push(b.box);\n free -= blockedArea(b.region);\n }\n return Math.max(0, free);\n }\n\n let free = Math.min(innerArea, shapeArea(shape));\n const kept: Box[] = [];\n for (const b of blocked) {\n if (!inInner(b.box) || !boxInShape(b.box, shape) || kept.some((k) => boxesOverlap(k, b.box))) continue;\n kept.push(b.box);\n free -= blockedArea(b.region);\n }\n return Math.max(0, free);\n}\n\n/**\n * This function gives a lower bound of the overflow of an input: the items that no packer can place, and their area.\n *\n * - The candidates are the items that are not locked at a position.\n * - A fixed side forces each candidate that is longer than the side less the inset, in each turn that the item permits.\n * - A fixed size also forces the fewest other candidates that make the rest fit the free area of `freeAreaBound`. These are the largest ones.\n * - The area of the bound is the area of the long items, plus the part of the area of the rest above the free area.\n * - The margins and the gap do not count. A slack of the overlap tolerance along the edge of each candidate keeps the bound valid.\n * - A container with no fixed side gives 0.\n */\nexport function overflowBound(input: PackInput): OverflowBound {\n const { container } = input;\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n if (!fixedW && !fixedH) return { forced: 0, area: 0, free: Infinity };\n const tol = DEFAULT_TOLERANCE.overlap;\n const bounds = containerBox(input);\n const inset = container.inset ?? 0;\n const maxW = fixedW ? bounds.w - 2 * inset + 2 * tol : Infinity;\n const maxH = fixedH ? bounds.h - 2 * inset + 2 * tol : Infinity;\n\n let forced = 0;\n let area = 0;\n let slack = 0;\n const rest: number[] = [];\n for (const item of input.items) {\n if (lockedAt(item)) continue;\n const box = itemBox(item);\n const w = Math.min(item.w, box.w);\n const h = Math.min(item.h, box.h);\n const fits = (w <= maxW && h <= maxH) || (item.turnable === true && h <= maxW && w <= maxH);\n const a = itemArea(item);\n if (!fits) {\n forced += 1;\n area += a;\n continue;\n }\n rest.push(a);\n slack += 2 * tol * (Math.max(0, w) + Math.max(0, h));\n }\n if (!(fixedW && fixedH)) return { forced, area, free: Infinity };\n\n const free = freeAreaBound(input);\n // An item can go out of the container by the tolerance, thus the edge of the container adds a slack too\n const room = free + slack + 2 * tol * (Math.max(0, bounds.w) + Math.max(0, bounds.h));\n let sum = rest.reduce((s, a) => s + a, 0);\n area += Math.max(0, sum - room);\n // The largest items go first, so the count of the dropped items is the smallest count that fits the area\n for (const a of rest.toSorted((p, q) => q - p)) {\n if (sum <= room || !(a > 0)) break;\n sum -= a;\n forced += 1;\n }\n return { forced, area, free };\n}\n","// SHA-256 (FIPS 180-4) in plain TypeScript. The hash of a corpus file needs it, and a browser has no synchronous SHA-256.\n\n/** The round constants of SHA-256. */\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be,\n 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa,\n 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85,\n 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,\n 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\n/** The first hash value of SHA-256. */\nconst H0 = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];\n\n/** This function turns a 32-bit word to the right by `n` bits. */\nconst rotr = (x: number, n: number): number => (x >>> n) | (x << (32 - n));\n\n/**\n * This function gives the UTF-8 bytes of a string. A lone surrogate becomes U+FFFD, as with `TextEncoder`. The\n * package has no `TextEncoder` type, because its code operates on each runtime with no global types.\n */\nexport function utf8(text: string): Uint8Array {\n const out: number[] = [];\n for (let i = 0; i < text.length; i++) {\n let c = text.charCodeAt(i);\n if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length) {\n const next = text.charCodeAt(i + 1);\n if (next >= 0xdc00 && next <= 0xdfff) {\n c = 0x10000 + ((c - 0xd800) << 10) + (next - 0xdc00);\n i++;\n }\n }\n if (c >= 0xd800 && c <= 0xdfff) c = 0xfffd;\n if (c < 0x80) out.push(c);\n else if (c < 0x800) out.push(0xc0 | (c >> 6), 0x80 | (c & 63));\n else if (c < 0x10000) out.push(0xe0 | (c >> 12), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63));\n else out.push(0xf0 | (c >> 18), 0x80 | ((c >> 12) & 63), 0x80 | ((c >> 6) & 63), 0x80 | (c & 63));\n }\n return Uint8Array.from(out);\n}\n\n/** This function gives the SHA-256 of the UTF-8 bytes of a string, as 64 lowercase hex characters. */\nexport function sha256Hex(text: string): string {\n const bytes = utf8(text);\n const length = bytes.length;\n const padded = new Uint8Array((((length + 9 + 63) / 64) | 0) * 64);\n padded.set(bytes);\n padded[length] = 0x80;\n const view = new DataView(padded.buffer);\n const bits = length * 8;\n view.setUint32(padded.length - 8, Math.floor(bits / 0x100000000));\n view.setUint32(padded.length - 4, bits >>> 0);\n\n const hash = [...H0];\n const w = new Uint32Array(64);\n for (let block = 0; block < padded.length; block += 64) {\n for (let t = 0; t < 16; t++) w[t] = view.getUint32(block + t * 4);\n for (let t = 16; t < 64; t++) {\n const a = w[t - 15]!;\n const b = w[t - 2]!;\n const s0 = rotr(a, 7) ^ rotr(a, 18) ^ (a >>> 3);\n const s1 = rotr(b, 17) ^ rotr(b, 19) ^ (b >>> 10);\n w[t] = (w[t - 16]! + s0 + w[t - 7]! + s1) | 0;\n }\n let [a, b, c, d, e, f, g, h] = hash as [number, number, number, number, number, number, number, number];\n for (let t = 0; t < 64; t++) {\n const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);\n const ch = (e & f) ^ (~e & g);\n const t1 = (h + s1 + ch + K[t]! + w[t]!) | 0;\n const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);\n const maj = (a & b) ^ (a & c) ^ (b & c);\n const t2 = (s0 + maj) | 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) | 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) | 0;\n }\n hash[0] = (hash[0]! + a) | 0;\n hash[1] = (hash[1]! + b) | 0;\n hash[2] = (hash[2]! + c) | 0;\n hash[3] = (hash[3]! + d) | 0;\n hash[4] = (hash[4]! + e) | 0;\n hash[5] = (hash[5]! + f) | 0;\n hash[6] = (hash[6]! + g) | 0;\n hash[7] = (hash[7]! + h) | 0;\n }\n return hash.map((x) => (x >>> 0).toString(16).padStart(8, \"0\")).join(\"\");\n}\n","// The input file `layout-input/1` of `docs/FORMAT.md`: its types, its numbers, its canonical form and its hash.\n\nimport type { LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput } from \"@mark1russell7/layout-contract\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { sha256Hex, utf8 } from \"./sha256.ts\";\nimport type { Cell } from \"./strategy.ts\";\n\nexport type { LayoutEdge, LayoutInput } from \"@mark1russell7/layout-contract\";\n\n/** The parameters of a generator: a name and a string or a number for each parameter. */\nexport type GeneratorParams = Record<string, string | number>;\n\n/**\n * The stamp of a generated input: the generator, its version, the full parameters and the seed.\n * It is `LayoutGenerator` of the contract with a string or a number for each parameter.\n */\nexport interface GeneratorStamp extends LayoutGenerator {\n readonly params: Readonly<GeneratorParams>;\n}\n\n/**\n * A generated input file `layout-input/1`. It is a `LayoutInput` with each field that a generator writes.\n * `docs/FORMAT.md` gives each field.\n */\nexport interface GeneratedInput extends LayoutInput {\n readonly set: string;\n readonly family: string;\n readonly seed: number;\n /** The origin: `made-up`, `published:<set>` or `known-best:<construction>`. */\n readonly source: string;\n /** The generator of a generated input. A hand-made or published input has `null`. */\n readonly generator: GeneratorStamp | null;\n readonly container: LayoutContainer;\n readonly edges: readonly LayoutEdge[];\n /** The first 16 hex characters of the SHA-256 of the canonical form of the other fields. */\n readonly hash: string;\n}\n\n/** The layout of the obstacles (`docs/research/TAXONOMY.md`, dimension 3). */\nexport type ObstacleLayout = \"none\" | \"center\" | \"scattered\" | \"wall\" | \"corridors\" | \"touching\" | \"edge\";\n\n/** The distribution of the sizes of the items (`docs/research/TAXONOMY.md`, dimension 6). */\nexport type SizeDistribution = \"identical\" | \"nearIdentical\" | \"uniform\" | \"heavyTail\" | \"bimodal\" | \"extremeAspect\";\n\n/** The scale of the count of the items (`docs/research/TAXONOMY.md`, dimension 7). */\nexport type CountScale = \"1\" | \"10\" | \"100\" | \"1k\" | \"10k\";\n\n/**\n * The cell of a generated input: one value for each dimension of the packer. The cell of `cellOf` has the dimensions\n * that the input tells. The generator adds the layout of the obstacles, the sizes, the count and the mode.\n */\nexport interface CorpusCell extends Cell {\n obstacles: ObstacleLayout;\n sizes: SizeDistribution;\n count: CountScale;\n mode: \"offline\" | \"online\" | \"incremental\";\n}\n\n/** This function gives the `fnv1a32` hash of the UTF-8 bytes of a string, as `docs/FORMAT.md` gives it. */\nexport function fnv1a32(text: string): number {\n let h = 0x811c9dc5;\n for (const b of utf8(text)) h = Math.imul(h ^ b, 0x01000193) >>> 0;\n return h;\n}\n\n/** This function rounds the numbers of a file to 3 decimals. A half goes up, and the value `-0` becomes 0. */\nexport function round3(x: number): number {\n const v = Math.round(x * 1000) / 1000;\n return Object.is(v, -0) ? 0 : v;\n}\n\n/**\n * This function gives the canonical form of a value: sorted keys, no whitespace and the numbers of `JSON.stringify`\n * after `round3`. A key with the value `undefined` is not in the form.\n */\nexport function canonicalJson(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n if (value !== null && typeof value === \"object\") {\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(\",\")}}`;\n }\n return JSON.stringify(typeof value === \"number\" ? round3(value) : value);\n}\n\n/** This function gives the hash of an input file: the first 16 hex characters of the SHA-256 of its canonical form without `hash`. */\nexport function hashInput(file: LayoutInput): string {\n const { hash: _hash, ...rest } = file;\n return sha256Hex(canonicalJson(rest)).slice(0, 16);\n}\n\n/**\n * This function gives the `outputHash` of an output. It is the first 16 hex characters of the SHA-256 of the canonical form of\n * its placements, sorted by id. The canonical form rounds each number with `round3`. Thus the order of the list does not count.\n * The records of the benchmark and the key of `packPortfolio` use it. It is not `outputHash` of the contract, which uses a grid.\n */\nexport function outputHash(output: Pick<PackOutput, \"placements\">): string {\n const sorted = output.placements.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));\n return sha256Hex(canonicalJson(sorted)).slice(0, 16);\n}\n\n/** This function gives the scale of a count: the nearest of 1, 10, 100, 1000 and 10000 on a log scale. The count 0 gives `1`. */\nexport function countCell(count: number): CountScale {\n if (count <= 3) return \"1\";\n if (count <= 31) return \"10\";\n if (count <= 316) return \"100\";\n if (count <= 3162) return \"1k\";\n return \"10k\";\n}\n\n/**\n * This function gives the packing input of a file. The boxes become the items, and the edges go.\n * A file without a container gets `{ fixed: \"none\" }`, so the packer picks the size. It is `toPackInput` of the contract.\n */\nexport function toPackInput(file: Pick<LayoutInput, \"container\" | \"boxes\" | \"obstacles\" | \"gap\">): PackInput {\n return {\n container: file.container ?? { fixed: \"none\" },\n items: file.boxes,\n ...(file.obstacles === undefined ? {} : { obstacles: file.obstacles }),\n ...(file.gap === undefined ? {} : { gap: file.gap }),\n };\n}\n","// The algebra of measures (roadmap item k8). `docs/MEASURES.md` defines each measure. This file computes them.\n\nimport type { MeasureSpec as ContractMeasureSpec, Direction } from \"@mark1russell7/layout-contract\";\nimport { RECORD_EPS, type PackInput, type PackOutput } from \"./contract.ts\";\nimport { aspectError } from \"./free.ts\";\nimport { overflowBound } from \"./overflow.ts\";\nimport { round3 } from \"./layout-input.ts\";\n\n/** The direction of a measure comes from the contract: `lower` when a lower value is better, `higher` when a higher value is better. */\nexport type { Direction } from \"@mark1russell7/layout-contract\";\n\n/** The family of a measure. Each family has a section in `docs/MEASURES.md`. */\nexport type MeasureFamily = \"density\" | \"aspect\" | \"order\" | \"raggedness\" | \"overflow\" | \"stability\" | \"determinism\" | \"speed\";\n\n/** The id of a measure of the packer. The ids are those of `docs/FORMAT.md`, and `highways` uses the same ids. */\nexport type MeasureId = \"pack.area\" | \"pack.fill\" | \"pack.whitespace\" | \"pack.aspect\" | \"pack.aspectError\" | \"pack.order.inversions\" | \"pack.order.breaks\" | \"pack.raggedness\" | \"pack.overflow\" | \"pack.overflow.rate\" | \"pack.overflow.area\" | \"pack.overflow.forced\" | \"pack.overflow.forcedArea\" | \"pack.overflow.excess\" | \"pack.overflow.forcedAreaMin\" | \"pack.overflow.excessArea\" | \"pack.stability.moved\" | \"pack.stability.mean\" | \"pack.stability.q95\" | \"pack.deterministic\" | \"pack.search.widths\" | \"pack.search.ms\";\n\n/**\n * The facts of one measure: its family, its unit, its direction and its range.\n * It is `MeasureSpec` of the contract for a packer measure id, with a family.\n */\nexport interface MeasureSpec extends ContractMeasureSpec<MeasureId> {\n readonly family: MeasureFamily;\n /**\n * The floor is the best value of a guard measure. The floor rule of `docs/PROMOTION.md` of `highways` reads it. Each\n * guard of the packer has the floor 0. A measure without a floor has no floor rule.\n */\n readonly floor?: number;\n /**\n * The tolerance is the absolute tolerance at the floor. A candidate within the tolerance ties with a default at the floor.\n *\n * - `pack.order.inversions` and `pack.overflow` have the tolerance 0. Thus each new inversion and each new unplaced item is a loss.\n * - `pack.aspectError` has 0.01, approximately 1% of the aspect. An exact tiling gives the default an error of 0.\n * - `pack.stability.mean` has 0.005 container widths, and `pack.stability.q95` has 0.01. The default often moves no item.\n * - `pack.stability.moved` has 0.02: 2% of the items that stay. On a small change, the default often moves no item.\n */\n readonly tol?: number;\n}\n\n/** The measures of one layout, by id. `measure` gives them. The values are not rounded. */\nexport interface LayoutMeasures {\n \"pack.area\": number;\n \"pack.fill\": number;\n \"pack.whitespace\": number;\n \"pack.aspect\": number;\n \"pack.aspectError\": number;\n \"pack.order.inversions\": number;\n \"pack.order.breaks\": number;\n \"pack.raggedness\": number;\n \"pack.overflow\": number;\n \"pack.overflow.rate\": number;\n \"pack.overflow.area\": number;\n \"pack.overflow.forced\": number;\n /** The tight lower bound of `pack.overflow.area`. `docs/MEASURES.md` defines it. */\n \"pack.overflow.forcedArea\": number;\n \"pack.overflow.excess\": number;\n /**\n * This measure is an alias of `pack.overflow.forcedArea`, with the same value.\n *\n * @deprecated Use `pack.overflow.forcedArea`. The alias stays until the next minor version.\n */\n \"pack.overflow.forcedAreaMin\": number;\n /** The overflow area above its bound: `pack.overflow.area` less `pack.overflow.forcedArea`. */\n \"pack.overflow.excessArea\": number;\n \"pack.search.widths\": number;\n \"pack.search.ms\": number;\n}\n\n/** The stability measures of a change pair, by id. `measureChange` gives them. The values are not rounded. */\nexport interface ChangeMeasures {\n \"pack.stability.moved\": number;\n \"pack.stability.mean\": number;\n \"pack.stability.q95\": number;\n}\n\n/** The options of `measure`. */\nexport interface MeasureOptions {\n /**\n * A box joins a row when its top is this close to the top of the first box of the row. The rows give\n * `pack.raggedness`. The default is half the median height of the boxes.\n */\n rowTolerance?: number;\n}\n\nconst spec = (\n id: MeasureId,\n family: MeasureFamily,\n unit: string,\n direction: Direction,\n min: number,\n max: number,\n minEffect: MeasureSpec[\"minEffect\"],\n guard?: { floor: number; tol: number },\n): MeasureSpec => ({ id, family, unit, direction, min, max, ...(minEffect === undefined ? {} : { minEffect }), ...guard });\n\n/** The minimum effect of an area or a ratio of lengths: 1% of the larger value. */\nconst REL = Object.freeze({ rel: 0.01 });\n\n/**\n * The facts of each measure, by id. `docs/MEASURES.md` gives the full definitions. This record is the source of the floor\n * and the tolerance of each guard of the packer, and of the minimum effect of each measure.\n *\n * - A count and a share of counts have the minimum effect 0. Thus each change of a count is an effect.\n * - A share of an area from 0 to 1 has 0.005. A guard has its tolerance.\n * - An area and a ratio of lengths have `{ rel: 0.01 }`: 1% of the larger value.\n * - The time has no minimum effect, because the times of CI change each time.\n * - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`. Its spec is the same, except the id.\n * The alias stays until the next minor version.\n */\nexport const MEASURE_SPECS: Readonly<Record<MeasureId, MeasureSpec>> = Object.freeze({\n \"pack.area\": spec(\"pack.area\", \"density\", \"square units\", \"lower\", 0, Infinity, REL),\n \"pack.fill\": spec(\"pack.fill\", \"density\", \"share\", \"higher\", 0, 1, 0.005),\n \"pack.whitespace\": spec(\"pack.whitespace\", \"density\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.aspect\": spec(\"pack.aspect\", \"aspect\", \"ratio\", \"lower\", 1, Infinity, REL),\n \"pack.aspectError\": spec(\"pack.aspectError\", \"aspect\", \"natural log\", \"lower\", 0, Infinity, 0.01, { floor: 0, tol: 0.01 }),\n \"pack.order.inversions\": spec(\"pack.order.inversions\", \"order\", \"share\", \"lower\", 0, 1, 0, { floor: 0, tol: 0 }),\n \"pack.order.breaks\": spec(\"pack.order.breaks\", \"order\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.raggedness\": spec(\"pack.raggedness\", \"raggedness\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow\": spec(\"pack.overflow\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0, { floor: 0, tol: 0 }),\n \"pack.overflow.rate\": spec(\"pack.overflow.rate\", \"overflow\", \"share\", \"lower\", 0, 1, 0),\n \"pack.overflow.area\": spec(\"pack.overflow.area\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.forced\": spec(\"pack.overflow.forced\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.overflow.forcedArea\": spec(\"pack.overflow.forcedArea\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.excess\": spec(\"pack.overflow.excess\", \"overflow\", \"count\", \"lower\", 0, Infinity, 0),\n // The deprecated alias of pack.overflow.forcedArea, until the next minor version\n \"pack.overflow.forcedAreaMin\": spec(\"pack.overflow.forcedAreaMin\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.overflow.excessArea\": spec(\"pack.overflow.excessArea\", \"overflow\", \"share\", \"lower\", 0, 1, 0.005),\n \"pack.stability.moved\": spec(\"pack.stability.moved\", \"stability\", \"share\", \"lower\", 0, 1, 0.02, { floor: 0, tol: 0.02 }),\n \"pack.stability.mean\": spec(\"pack.stability.mean\", \"stability\", \"container widths\", \"lower\", 0, Infinity, 0.005, { floor: 0, tol: 0.005 }),\n \"pack.stability.q95\": spec(\"pack.stability.q95\", \"stability\", \"container widths\", \"lower\", 0, Infinity, 0.01, { floor: 0, tol: 0.01 }),\n \"pack.deterministic\": spec(\"pack.deterministic\", \"determinism\", \"boolean\", \"higher\", 0, 1, 0),\n \"pack.search.widths\": spec(\"pack.search.widths\", \"speed\", \"count\", \"lower\", 0, Infinity, 0),\n \"pack.search.ms\": spec(\"pack.search.ms\", \"speed\", \"milliseconds\", \"lower\", 0, Infinity, undefined),\n});\n\n/** A placed box: the rectangle of an item at its position, with its rank. */\nexport interface Box {\n x: number;\n y: number;\n w: number;\n h: number;\n rank: number;\n}\n\n/** This function gives the smallest rectangle around the boxes. No box gives a rectangle of size 0 at 0, 0. */\nexport function hullOf(boxes: readonly Pick<Box, \"x\" | \"y\" | \"w\" | \"h\">[]): { x: number; y: number; w: number; h: number } {\n if (boxes.length === 0) return { x: 0, y: 0, w: 0, h: 0 };\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const b of boxes) {\n left = Math.min(left, b.x);\n top = Math.min(top, b.y);\n right = Math.max(right, b.x + b.w);\n bottom = Math.max(bottom, b.y + b.h);\n }\n return { x: left, y: top, w: right - left, h: bottom - top };\n}\n\n/**\n * This function puts the boxes in rows. It sorts the boxes by their top, and keeps the order of the list for equal tops.\n * A box joins the last row when its top is within `tolerance` of the top of the first box of that row.\n */\nexport function rowsOf(boxes: readonly Pick<Box, \"x\" | \"y\" | \"w\">[], tolerance: number): { top: number; right: number; count: number }[] {\n const rows: { top: number; right: number; count: number }[] = [];\n for (const b of boxes.toSorted((p, q) => p.y - q.y)) {\n const row = rows.at(-1);\n if (row && Math.abs(b.y - row.top) <= tolerance) {\n row.right = Math.max(row.right, b.x + b.w);\n row.count += 1;\n } else {\n rows.push({ top: b.y, right: b.x + b.w, count: 1 });\n }\n }\n return rows;\n}\n\n/**\n * This function gives the placed boxes of an output, in the order of the items of the input. A box has the size of its\n * item after the turn. The list has no item without a placement, and no item with a width or a height of 0.\n */\nexport function boxesOf(input: PackInput, output: PackOutput): Box[] {\n const placements = new Map<string, PackOutput[\"placements\"][number]>();\n for (const p of output.placements) if (!placements.has(p.id)) placements.set(p.id, p);\n const boxes: Box[] = [];\n for (const [index, item] of input.items.entries()) {\n const p = placements.get(item.id);\n if (p === undefined || !(item.w > 0 && item.h > 0)) continue;\n const turned = p.turn === 90;\n boxes.push({ x: p.x, y: p.y, w: turned ? item.h : item.w, h: turned ? item.w : item.h, rank: item.rank ?? index });\n }\n return boxes;\n}\n\n/**\n * This function tells if box `a` comes before box `b` in the reading order. Two boxes whose heights overlap by more than\n * `RECORD_EPS` are on one line, and the left box comes first. Otherwise the upper box comes first.\n */\nexport function readsBefore(a: Pick<Box, \"x\" | \"y\" | \"h\">, b: Pick<Box, \"x\" | \"y\" | \"h\">): boolean {\n const shared = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);\n if (shared > RECORD_EPS) return a.x + RECORD_EPS < b.x;\n return a.y < b.y;\n}\n\n/** This function sums one measure over the stages of a trace. A trace without the measure gives 0. */\nfunction traceSum(output: PackOutput, id: string): number {\n let sum = 0;\n for (const stage of output.trace ?? []) sum += stage.measures?.[id] ?? 0;\n return sum;\n}\n\n/**\n * This function gives the measures of one layout, by the ids of `docs/MEASURES.md`. The values are not rounded. A\n * record rounds them with `roundMeasures`.\n *\n * - The boxes are the placed items with a width and a height above 0. The hull is the smallest rectangle around them.\n * - An empty layout gives the area 0, the aspect 1 and the aspect error 0. Its fill is 0 and its whitespace is 1.\n * - The time `pack.search.ms` comes from the trace. It is not part of the determinism rule.\n * - The overflow measures count each id once. `pack.overflow.forced` is the lower bound of `overflowBound`.\n * - `pack.overflow.excess` is the overflow less the forced overflow. A container with no fixed side gives 0 for both.\n * - `pack.overflow.forcedArea` is a lower bound of the overflow area. `pack.overflow.excessArea` is the overflow area above it.\n * - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`, with the same value.\n *\n * @example\n * ```ts\n * const m = measure(input, packWith(\"shelf\", input));\n * m[\"pack.fill\"]; // the area of the boxes divided by the area of the hull\n * ```\n */\nexport function measure(input: PackInput, output: PackOutput, options: MeasureOptions = {}): LayoutMeasures {\n const boxes = boxesOf(input, output);\n const hull = hullOf(boxes);\n const hullArea = hull.w * hull.h;\n const boxArea = boxes.reduce((sum, b) => sum + b.w * b.h, 0);\n const fill = hullArea > 0 ? boxArea / hullArea : 0;\n const empty = boxes.length === 0;\n const target = input.container.aspect ?? 1;\n\n // The reading order: each pair of boxes with different ranks, and each step of the rank order\n let pairs = 0;\n let inversions = 0;\n for (let i = 0; i < boxes.length; i++) {\n for (let j = i + 1; j < boxes.length; j++) {\n const a = boxes[i]!;\n const b = boxes[j]!;\n if (a.rank === b.rank) continue;\n pairs += 1;\n const first = a.rank < b.rank ? a : b;\n const second = first === a ? b : a;\n if (readsBefore(second, first)) inversions += 1;\n }\n }\n const byRank = boxes.toSorted((a, b) => a.rank - b.rank);\n let breaks = 0;\n for (let k = 1; k < byRank.length; k++) {\n const prev = byRank[k - 1]!;\n const next = byRank[k]!;\n if (prev.rank !== next.rank && readsBefore(next, prev)) breaks += 1;\n }\n\n const tolerance = options.rowTolerance ?? quantileOrZero(boxes.map((b) => b.h), 0.5) / 2;\n const rights = rowsOf(boxes, tolerance).map((r) => r.right);\n const spread = rights.length > 0 ? Math.max(...rights) - Math.min(...rights) : 0;\n\n // The overflow: the unplaced items, their area, and the part that no packer can place\n const unplaced = new Set(output.overflow);\n let itemArea = 0;\n let unplacedArea = 0;\n for (const item of input.items) {\n const a = Math.max(0, item.w) * Math.max(0, item.h);\n itemArea += a;\n if (unplaced.has(item.id)) unplacedArea += a;\n }\n const bound = overflowBound(input);\n const overflowArea = itemArea > 0 ? unplacedArea / itemArea : 0;\n const forcedArea = itemArea > 0 ? Math.min(1, bound.area / itemArea) : 0;\n\n return {\n \"pack.area\": hullArea,\n \"pack.fill\": fill,\n \"pack.whitespace\": 1 - fill,\n \"pack.aspect\": empty ? 1 : Math.max(hull.w / hull.h, hull.h / hull.w),\n \"pack.aspectError\": empty ? 0 : aspectError(hull.w, hull.h, target),\n \"pack.order.inversions\": pairs > 0 ? inversions / pairs : 0,\n \"pack.order.breaks\": breaks,\n \"pack.raggedness\": hull.w > 0 ? spread / hull.w : 0,\n \"pack.overflow\": unplaced.size,\n \"pack.overflow.rate\": input.items.length > 0 ? unplaced.size / input.items.length : 0,\n \"pack.overflow.area\": overflowArea,\n \"pack.overflow.forced\": bound.forced,\n \"pack.overflow.forcedArea\": forcedArea,\n \"pack.overflow.excess\": Math.max(0, unplaced.size - bound.forced),\n \"pack.overflow.forcedAreaMin\": forcedArea,\n \"pack.overflow.excessArea\": excessAreaOf(overflowArea, forcedArea),\n \"pack.search.widths\": traceSum(output, \"pack.search.widths\"),\n \"pack.search.ms\": traceSum(output, \"pack.search.ms\"),\n };\n}\n\n/** The float noise of `pack.overflow.excessArea`. A difference below 0 by this value or less becomes 0. */\nconst AREA_NOISE = 1e-9;\n\n/**\n * This function gives the overflow area above its lower bound. A value from `-AREA_NOISE` to 0 becomes 0. A value below\n * `-AREA_NOISE` stays, because it shows a bug of the bound or of the packer.\n */\nfunction excessAreaOf(overflowArea: number, forcedArea: number): number {\n const excess = overflowArea - forcedArea;\n return excess < 0 && excess >= -AREA_NOISE ? 0 : excess;\n}\n\n/**\n * This function gives the stability measures of a change pair: the run on the base input and the run on the changed\n * input. The items match by id. The values are not rounded.\n *\n * - An item stays when both inputs have it and both outputs place it. The added and the removed items do not count.\n * - A staying item moved when its `x` or its `y` changed by more than `RECORD_EPS`, or when its turn changed.\n * - The distance of an item is the length of the move of its top-left corner. The unit is the width `W`.\n * - `W` is the larger width of the 2 output sizes. A `W` of 0 becomes 1, so the unit is then the unit of the input.\n * - No staying item gives 0 for each measure.\n */\nexport function measureChange(baseInput: PackInput, baseOutput: PackOutput, changeInput: PackInput, changeOutput: PackOutput): ChangeMeasures {\n const placed = (input: PackInput, output: PackOutput): Map<string, PackOutput[\"placements\"][number]> => {\n const ids = new Set(input.items.map((i) => i.id));\n const map = new Map<string, PackOutput[\"placements\"][number]>();\n for (const p of output.placements) if (ids.has(p.id) && !map.has(p.id)) map.set(p.id, p);\n return map;\n };\n const before = placed(baseInput, baseOutput);\n const after = placed(changeInput, changeOutput);\n const width = Math.max(baseOutput.size.w, changeOutput.size.w);\n const unit = width > 0 ? width : 1;\n\n const distances: number[] = [];\n let moved = 0;\n for (const [id, p] of before) {\n const q = after.get(id);\n if (q === undefined) continue;\n const dx = q.x - p.x;\n const dy = q.y - p.y;\n if (Math.abs(dx) > RECORD_EPS || Math.abs(dy) > RECORD_EPS || (p.turn ?? 0) !== (q.turn ?? 0)) moved += 1;\n distances.push(Math.hypot(dx, dy) / unit);\n }\n if (distances.length === 0) return { \"pack.stability.moved\": 0, \"pack.stability.mean\": 0, \"pack.stability.q95\": 0 };\n return {\n \"pack.stability.moved\": moved / distances.length,\n \"pack.stability.mean\": distances.reduce((sum, d) => sum + d, 0) / distances.length,\n \"pack.stability.q95\": quantile(distances, 0.95),\n };\n}\n\n/**\n * This function gives the measure `pack.deterministic` of two runs with the same input, options and seed. It gives\n * `true` when the runs have the same placements, overflow, size and moved obstacles.\n *\n * - The placements match by id, so their order in the list does not count. The numbers must be equal.\n * - The trace is not part of the rule, because its times change each time.\n */\nexport function isDeterministic(first: PackOutput, second: PackOutput): boolean {\n const key = <T extends { id: string }>(list: readonly T[]): Map<string, T> => new Map(list.map((e) => [e.id, e]));\n const samePlacements = (a: PackOutput[\"placements\"], b: PackOutput[\"placements\"]): boolean => {\n if (a.length !== b.length) return false;\n const other = key(b);\n return a.every((p) => {\n const q = other.get(p.id);\n return q !== undefined && q.x === p.x && q.y === p.y && (q.turn ?? 0) === (p.turn ?? 0);\n });\n };\n const sameMoved = (a: PackOutput[\"moved\"], b: PackOutput[\"moved\"]): boolean => {\n if (a.length !== b.length) return false;\n const other = key(b);\n return a.every((m) => {\n const n = other.get(m.id);\n return n !== undefined && n.x === m.x && n.y === m.y;\n });\n };\n const overflowA = new Set(first.overflow);\n const overflowB = new Set(second.overflow);\n return (\n first.size.w === second.size.w &&\n first.size.h === second.size.h &&\n overflowA.size === overflowB.size &&\n [...overflowA].every((id) => overflowB.has(id)) &&\n samePlacements(first.placements, second.placements) &&\n sameMoved(first.moved, second.moved)\n );\n}\n\n/**\n * This function rounds each number of a record of measures with `round3`, as `docs/FORMAT.md` tells. A half goes up,\n * and `-0` becomes 0. The function keeps the other values, and it does not change its argument.\n */\nexport function roundMeasures<T extends object>(measures: T): T {\n const out: Record<string, unknown> = {};\n for (const [id, value] of Object.entries(measures)) out[id] = typeof value === \"number\" ? round3(value) : value;\n return out as T;\n}\n\n/**\n * This function gives the paired ratio of a measure on one input: the value of the candidate against the value of the\n * current default. A ratio above 1 is worse, in the direction of the measure.\n *\n * - For `lower`, the ratio is `candidate / current`. For `higher`, it is `current / candidate`.\n * - When both values are 0, the ratio is 1. When only the divisor is 0, the ratio is `Infinity`.\n * - The values are 0 or more. A negative value or `NaN` throws a `RangeError`.\n */\nexport function pairedRatio(candidate: number, current: number, direction: Direction): number {\n if (!(candidate >= 0 && current >= 0)) throw new RangeError(\"A paired ratio needs two values of 0 or more.\");\n const top = direction === \"lower\" ? candidate : current;\n const bottom = direction === \"lower\" ? current : candidate;\n if (bottom === 0) return top === 0 ? 1 : Infinity;\n return top / bottom;\n}\n\n/**\n * This function gives the quantile `q` of a list of numbers, with linear interpolation between the sorted values. The\n * position in the sorted list is `(n - 1) * q`. An empty list or a `q` outside 0 to 1 throws a `RangeError`.\n */\nexport function quantile(values: readonly number[], q: number): number {\n if (values.length === 0) throw new RangeError(\"A quantile needs one value or more.\");\n if (!(q >= 0 && q <= 1)) throw new RangeError(\"A quantile needs a q from 0 to 1.\");\n const sorted = values.toSorted((a, b) => a - b);\n const at = (sorted.length - 1) * q;\n const low = Math.floor(at);\n const part = at - low;\n const a = sorted[low]!;\n if (part === 0) return a;\n const b = sorted[low + 1]!;\n if (a === b) return a;\n return a + part * (b - a);\n}\n\n/** This function gives the quantile `q` of a list, and 0 for an empty list. */\nfunction quantileOrZero(values: readonly number[], q: number): number {\n return values.length === 0 ? 0 : quantile(values, q);\n}\n\n/** This function gives the median of the paired ratios of a corpus: the quantile 0.5. It is not a ratio of two medians. */\nexport function medianRatio(ratios: readonly number[]): number {\n return quantile(ratios, 0.5);\n}\n\n/** This function gives the share of the paired ratios above a limit. An empty list throws a `RangeError`. */\nexport function tailShare(ratios: readonly number[], limit: number): number {\n if (ratios.length === 0) throw new RangeError(\"A tail share needs one ratio or more.\");\n return ratios.filter((r) => r > limit).length / ratios.length;\n}\n","import { hullOf, rowsOf } from \"./measures.ts\";\nimport type { Rect } from \"./rect.ts\";\n\n/** The measurements of a packing. */\nexport interface PackingMetrics {\n /** The number of rectangles. */\n count: number;\n /** The size of the hull: the smallest box around the rectangles. */\n hull: { width: number; height: number };\n /** The width of the hull divided by its height. A hull without height gives 0. */\n hullAspect: number;\n /** The number of rectangles in each row, from the top. */\n rows: number[];\n /** The largest right edge of a row less the smallest right edge of a row. A straight right side gives 0. */\n raggedness: number;\n /** The part of the hull that the rectangles cover: their area divided by the area of the hull. */\n utilization: number;\n /** The width of the widest rectangle divided by the median width. */\n widestOverMedian: number;\n}\n\n/** The options of `packingMetrics`. */\nexport interface MetricsOptions {\n /** A rectangle joins a row when its top is this close to the top of the first rectangle of the row. The default is 40. */\n rowTolerance?: number;\n}\n\n/**\n * This function measures a packing. It gives the hull and its aspect, the rows and the raggedness of the right side.\n * It also gives the part of the hull that the rectangles cover, and the widest rectangle against the median width.\n *\n * @example\n * ```ts\n * const { utilization, raggedness } = packingMetrics(Rect.packed(cards));\n * ```\n */\nexport function packingMetrics(rects: readonly Rect[], options: MetricsOptions = {}): PackingMetrics {\n const tolerance = options.rowTolerance ?? 40;\n const boxes = rects.filter((r) => r.size.x > 0 && r.size.y > 0).map((r) => ({ x: r.position.x, y: r.position.y, w: r.size.x, h: r.size.y }));\n if (boxes.length === 0) return { count: 0, hull: { width: 0, height: 0 }, hullAspect: 0, rows: [], raggedness: 0, utilization: 0, widestOverMedian: 0 };\n\n // The hull and the rows come from the helpers of `measure`, so the two functions agree\n const box = hullOf(boxes);\n const hull = { width: box.w, height: box.h };\n const rows = rowsOf(boxes, tolerance);\n const rights = rows.map((row) => row.right);\n const widths = boxes.map((r) => r.w).toSorted((a, b) => a - b);\n const median = widths[Math.floor(widths.length / 2)] ?? 0;\n const widest = widths.at(-1) ?? 0;\n const area = boxes.reduce((sum, r) => sum + r.w * r.h, 0);\n return {\n count: boxes.length,\n hull,\n hullAspect: hull.height > 0 ? hull.width / hull.height : 0,\n rows: rows.map((row) => row.count),\n raggedness: Math.max(...rights) - Math.min(...rights),\n utilization: hull.width * hull.height > 0 ? area / (hull.width * hull.height) : 0,\n widestOverMedian: median > 0 ? widest / median : 0,\n };\n}\n","import type { LayoutContainer, PackInput, PackOutput, Region } from \"./contract.ts\";\n\n/**\n * For each dimension of the taxonomy, the values that a strategy supports. `docs/research/TAXONOMY.md` gives the values.\n * The type is an alias, not an interface. Thus it fits the record `Supports` of the contract.\n */\nexport type Supports = {\n containerSize: (\"fixed\" | \"freeHeight\" | \"freeWidth\" | \"freeAspect\" | \"freeArea\")[];\n containerShape: (\"rect\" | \"convex\" | \"polygon\" | \"circle\" | \"ellipse\" | \"holes\")[];\n /** The movement of the obstacles. An empty list supports only an input with no obstacle and no locked item. */\n obstacleMove: (\"fixed\" | \"costly\" | \"free\")[];\n itemShape: (\"rect\" | \"circle\" | \"convex\" | \"polygon\" | \"mixed\")[];\n rotation: (\"none\" | \"quarter\" | \"any\")[];\n order: (\"free\" | \"soft\" | \"hard\")[];\n groups: (\"none\" | \"flat\" | \"nested\")[];\n mode: (\"offline\" | \"online\" | \"incremental\")[];\n};\n\n/** A dimension of `Supports`. */\nexport type Dimension = keyof Supports;\n\n/** A value of a dimension of `Supports`. */\nexport type DimensionValue<D extends Dimension = Dimension> = Supports[D][number];\n\n/**\n * The cell of an input: one value for each packer dimension that the input tells. The input does not tell the mode.\n * Without obstacles and locked items, the cell has no `obstacleMove`.\n */\nexport interface Cell {\n containerSize: DimensionValue<\"containerSize\">;\n containerShape: DimensionValue<\"containerShape\">;\n obstacleMove?: DimensionValue<\"obstacleMove\">;\n itemShape: DimensionValue<\"itemShape\">;\n rotation: DimensionValue<\"rotation\">;\n order: DimensionValue<\"order\">;\n groups: DimensionValue<\"groups\">;\n}\n\n/** The context of one packing. */\nexport interface PackContext {\n /** The seed. A strategy gets each random number from `rng`, not from `Math.random`. */\n seed: number;\n /** The random numbers in `[0, 1)`, from `mulberry32` with `seed`. */\n rng: () => number;\n /** A limit for the strategies that search. The strategy gives its best result at the limit. */\n budget?: { ms?: number; steps?: number };\n /** The previous output, for the mode `incremental`. */\n previous?: PackOutput;\n}\n\n/** A packing strategy behind the Packer interface. */\nexport interface Strategy<O = unknown> {\n /** A stable name, for example `shelf`. The records use it. */\n id: string;\n /** The family of the catalog, for example `shelf` or `skyline`. */\n family: string;\n /** The ids of the catalog rows that this strategy builds. */\n catalog: string[];\n /** The cells that the strategy supports. */\n supports: Supports;\n /** The default options. A record writes the options in full. */\n defaults: O;\n /** The value `true` tells that the result depends only on the input, the options and the seed. */\n deterministic: boolean;\n /** This method packs an input. It throws `UnsupportedCell` for an input outside the cells of `supports`. */\n pack(input: PackInput, options: O, context: PackContext): PackOutput;\n}\n\n/** A size search: it gives a strategy of a fixed width the cells `freeAspect` and `freeArea`. */\nexport interface SizeSearch {\n id: string;\n /** This method searches the size of the container for an input with `fixed` set to `none`. `options` go to `inner`. */\n search(input: PackInput, inner: Strategy, context: PackContext, options?: unknown): PackOutput;\n}\n\n/**\n * The error of a strategy for an input outside its cells. The benchmark records this result. It is not a failure of the\n * strategy.\n */\nexport class UnsupportedCell extends Error {\n /** The dimension of the taxonomy. */\n readonly dimension: Dimension;\n /** The value of the input that the strategy does not support. */\n readonly value: string;\n\n constructor(dimension: Dimension, value: string) {\n super(`The strategy does not support the value \"${value}\" of the dimension \"${dimension}\".`);\n this.name = \"UnsupportedCell\";\n this.dimension = dimension;\n this.value = value;\n }\n}\n\n/** This function gives a generator of random numbers in `[0, 1)`: `mulberry32` of `docs/FORMAT.md`. */\nexport function mulberry32(seed: number): () => number {\n let s = seed >>> 0;\n return () => {\n s = (s + 0x6d2b79f5) | 0;\n let t = Math.imul(s ^ (s >>> 15), 1 | s);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** This function makes the context of one packing from a seed. */\nexport function createContext(seed = 0, more: Omit<PackContext, \"seed\" | \"rng\"> = {}): PackContext {\n return { ...more, seed, rng: mulberry32(seed) };\n}\n\n/** This function tells if a polygon ring is convex. A ring with fewer than 3 points is convex. */\nfunction isConvex(points: readonly (readonly [number, number])[]): boolean {\n let sign = 0;\n const n = points.length;\n for (let i = 0; i < n; i++) {\n const [ax, ay] = points[i]!;\n const [bx, by] = points[(i + 1) % n]!;\n const [cx, cy] = points[(i + 2) % n]!;\n const cross = (bx - ax) * (cy - by) - (by - ay) * (cx - bx);\n if (cross === 0) continue;\n if (sign === 0) sign = Math.sign(cross);\n else if (Math.sign(cross) !== sign) return false;\n }\n return true;\n}\n\n/** This function gives the value of `containerShape` of one region. */\nfunction shapeOf(region: Region): DimensionValue<\"containerShape\"> {\n switch (region.kind) {\n case \"rect\":\n case \"circle\":\n case \"ellipse\":\n return region.kind;\n case \"polygon\":\n if (region.holes && region.holes.length > 0) return \"holes\";\n return isConvex(region.points) ? \"convex\" : \"polygon\";\n }\n}\n\n/** This function gives the value of `itemShape` of one item shape. An ellipse is convex. */\nfunction itemShapeOf(region: Region | undefined): DimensionValue<\"itemShape\"> {\n if (region === undefined) return \"rect\";\n switch (region.kind) {\n case \"rect\":\n case \"circle\":\n return region.kind;\n case \"ellipse\":\n return \"convex\";\n case \"polygon\":\n return !region.holes?.length && isConvex(region.points) ? \"convex\" : \"polygon\";\n }\n}\n\n/**\n * This function gives the cell of an input: the values of the packer dimensions that the input tells.\n *\n * - `containerSize` comes from `fixed`. The value `none` gives `freeArea` when `aspectWeight` is 0, and `freeAspect` if not.\n * - `containerShape` comes from the shape. A rectangle container with an obstacle of another region gives `holes`.\n * - `obstacleMove` is the hardest value of the obstacles and the locked items: `costly`, then `free`, then `fixed`.\n * - `order` is `soft` when an item has a rank, and `free` if not. The input does not tell a hard order.\n * - `groups` is `nested` when an item has a parent, `flat` when an item has a group, and `none` if not.\n */\nexport function cellOf(input: PackInput): Cell {\n const { container, items } = input;\n const obstacles = input.obstacles ?? [];\n\n const sizes: Record<LayoutContainer[\"fixed\"], DimensionValue<\"containerSize\">> = {\n size: \"fixed\",\n width: \"freeHeight\",\n height: \"freeWidth\",\n none: container.aspectWeight === 0 ? \"freeArea\" : \"freeAspect\",\n };\n const containerSize = sizes[container.fixed];\n\n let containerShape = container.shape ? shapeOf(container.shape) : \"rect\";\n if (containerShape === \"rect\" && obstacles.some((o) => o.region.kind !== \"rect\")) containerShape = \"holes\";\n\n let obstacleMove: DimensionValue<\"obstacleMove\"> | undefined = items.some((i) => i.locked === true) ? \"fixed\" : undefined;\n for (const o of obstacles) {\n const move = o.move === undefined ? \"fixed\" : o.move.cost > 0 ? \"costly\" : \"free\";\n if (move === \"costly\" || obstacleMove === undefined || (move === \"free\" && obstacleMove === \"fixed\")) obstacleMove = move;\n }\n\n const shapes = new Set(items.map((i) => itemShapeOf(i.shape)));\n const itemShape = shapes.size > 1 ? \"mixed\" : ([...shapes][0] ?? \"rect\");\n\n const cell: Cell = {\n containerSize,\n containerShape,\n itemShape,\n rotation: items.some((i) => i.turnable === true) ? \"quarter\" : \"none\",\n order: items.some((i) => i.rank !== undefined) ? \"soft\" : \"free\",\n groups: items.some((i) => i.parent !== undefined) ? \"nested\" : items.some((i) => i.group !== undefined) ? \"flat\" : \"none\",\n };\n if (obstacleMove !== undefined) cell.obstacleMove = obstacleMove;\n return cell;\n}\n\n/** This function gives the first dimension of a cell that `supports` does not hold, or `undefined` when it holds each one. */\nexport function unsupportedOf(supports: Supports, cell: Partial<Record<Dimension, string>>): { dimension: Dimension; value: string } | undefined {\n for (const dimension of Object.keys(supports) as Dimension[]) {\n const value = cell[dimension];\n if (value === undefined) continue;\n if (!(supports[dimension] as readonly string[]).includes(value)) return { dimension, value };\n }\n return undefined;\n}\n\n/** This function tells if `supports` holds each value of a cell. A dimension that the cell does not have is held. */\nexport function supportsCell(supports: Supports, cell: Partial<Record<Dimension, string>>): boolean {\n return unsupportedOf(supports, cell) === undefined;\n}\n\n/** This function throws `UnsupportedCell` for the first value of the cell of an input that `supports` does not hold. */\nexport function assertSupported(supports: Supports, input: PackInput): void {\n const miss = unsupportedOf(supports, cellOf(input));\n if (miss) throw new UnsupportedCell(miss.dimension, miss.value);\n}\n","// The adapters of 0.1 (docs/PACKER.md): each function of 0.1 runs behind the Packer interface as a strategy.\n\nimport { EPS, type PackInput, type PackOutput } from \"./contract.ts\";\nimport { boundsOf, buildFrame, frameTurn, now, outerOf, readFrame, rectsOf, viaAxes, type Entry, type Frame, type FrameTurns } from \"./frame.ts\";\nimport { packFree } from \"./free.ts\";\nimport type { MaxRectsRule } from \"./maxrects.ts\";\nimport { clearMoves, moveCount, MOVES } from \"./moves.ts\";\nimport type { SortOrder } from \"./order.ts\";\nimport { pack, type PackLayoutOptions } from \"./pack.ts\";\nimport { pushCascade } from \"./push.ts\";\nimport { Rect } from \"./rect.ts\";\nimport type { ShelfFit } from \"./shelf.ts\";\nimport { packSkyline } from \"./skyline.ts\";\nimport { spaceOf } from \"./space.ts\";\nimport { assertSupported, cellOf, UnsupportedCell, type PackContext, type SizeSearch, type Strategy, type Supports } from \"./strategy.ts\";\n\n/** The options of the strategies `rows`, `skyline` and `shelf`. */\nexport interface LayoutStrategyOptions {\n /** The order of the items before the packing. The items are in the order of their rank first. */\n sortOrder: SortOrder;\n /** The number of widths that the first pass of the size search `log-sweep` tries. */\n samples: number;\n /**\n * The rule of `shelf` to choose a shelf: `next`, `first` or `best`. Only `shelf` reads it. Without it, `shelf` packs\n * as in 0.2.3. With it, the trace also counts `move.firstFit` and `move.bestFit`.\n */\n fit?: ShelfFit;\n}\n\n/** The options of the strategy `maxrects`. The strategy does not read `fit`. */\nexport interface MaxRectsStrategyOptions extends LayoutStrategyOptions {\n /** The rule to choose a free rectangle: `bssf` (the default), `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */\n rule: MaxRectsRule;\n /** The value `true` lets each turnable item that is not locked turn by 90 degrees. The default is `false`. */\n rotate: boolean;\n /**\n * The largest height of a band of the approximation of a container that is not a plain rectangle. `MaxRectsOptions`\n * tells the default.\n */\n bandHeight?: number;\n}\n\n/** The id of a strategy of `pack`. */\ntype LayoutId = \"rows\" | \"skyline\" | \"shelf\" | \"maxrects\";\n\n/** The options of a strategy of `pack`: the options of `maxrects` are optional for the other strategies. */\ntype AnyLayoutOptions = LayoutStrategyOptions & Partial<Pick<MaxRectsStrategyOptions, \"rule\" | \"rotate\" | \"bandHeight\">>;\n\n/** The options of `pack` that a strategy adds to the sort order and the space. */\ntype PackExtras = Pick<PackLayoutOptions, \"fit\" | \"rule\" | \"bandHeight\" | \"turnable\" | \"turned\">;\n\n/** The options of the strategy `push`. */\nexport interface PushStrategyOptions {\n /** The order of the items that the cascade does not place. */\n sortOrder: SortOrder;\n /** The most shoves for each item. The cascade stops at this limit. */\n maxShovesPerItem: number;\n}\n\n/**\n * The cells of `rows`, `skyline` and `shelf`, without the movement of the obstacles. The container layer of `src/space.ts`\n * gives them each container shape.\n */\nconst LAYOUT_CELLS = {\n containerSize: [\"fixed\", \"freeHeight\", \"freeWidth\", \"freeAspect\", \"freeArea\"],\n containerShape: [\"rect\", \"convex\", \"polygon\", \"circle\", \"ellipse\", \"holes\"],\n itemShape: [\"rect\"],\n rotation: [\"none\"],\n groups: [\"none\"],\n mode: [\"offline\"],\n} as const satisfies Partial<Supports>;\n\n/** This function makes the supports of a strategy, with copies of each list. */\nfunction supportsOf(cells: { [D in keyof Supports]: readonly Supports[D][number][] }): Supports {\n return {\n containerSize: [...cells.containerSize],\n containerShape: [...cells.containerShape],\n obstacleMove: [...cells.obstacleMove],\n itemShape: [...cells.itemShape],\n rotation: [...cells.rotation],\n order: [...cells.order],\n groups: [...cells.groups],\n mode: [...cells.mode],\n };\n}\n\n/**\n * This function gives the options of `pack` that a strategy adds: the fit of `shelf`, or the rule, the bands and the turns\n * of `maxrects`. A turnable item turns only with `rotate`, and a locked item does not turn.\n */\nfunction extrasOf(id: LayoutId, options: AnyLayoutOptions, frame: Frame): PackExtras {\n if (id === \"shelf\") return options.fit !== undefined ? { fit: options.fit } : {};\n if (id !== \"maxrects\") return {};\n const out: PackExtras = { rule: options.rule ?? \"bssf\", ...(options.bandHeight === undefined ? {} : { bandHeight: options.bandHeight }) };\n if (options.rotate !== true) return out;\n const turnable = new Set(frame.entries.filter((e) => e.item?.turnable === true && !e.rect.locked).map((e) => e.rect));\n return { ...out, turnable, turned: new Set() };\n}\n\n/**\n * This function gives the move counts of the trace of a strategy: its own move, and the moves of a shelf fit. The trace of\n * `maxrects` has the move of its rule and `move.split`. The rule `bl` has only `move.split`.\n */\nfunction movesOf(id: LayoutId, extras: PackExtras): Record<string, number> {\n if (id === \"maxrects\") {\n const rule = extras.rule ?? \"bssf\";\n const out: Record<string, number> = rule === \"bl\" ? {} : { [MOVES[rule]]: moveCount(MOVES[rule]) };\n out[MOVES.split] = moveCount(MOVES.split);\n return out;\n }\n const out: Record<string, number> = { [MOVES[id]]: moveCount(MOVES[id]) };\n if (extras.fit !== undefined) for (const move of [MOVES.firstFit, MOVES.bestFit]) out[move] = moveCount(move);\n return out;\n}\n\n/** This function gives the turns of a packing for `readFrame`, or `undefined` when no rectangle can turn. */\nfunction turnsOf(extras: PackExtras, transposed: boolean): FrameTurns | undefined {\n return extras.turned === undefined ? undefined : { rects: extras.turned, turn: frameTurn(transposed) };\n}\n\n/** This function packs an input with a fixed size or a fixed width with one strategy of `pack`. */\nfunction packFixedWidth(id: LayoutId, input: PackInput, options: AnyLayoutOptions, transposed = false): PackOutput {\n const start = now();\n const frame = buildFrame(input, false, id === \"maxrects\" && options.rotate === true);\n const rects = rectsOf(frame);\n const extras = extrasOf(id, options, frame);\n clearMoves();\n if (frame.w > 0) pack(rects, outerOf(frame), { strategy: id, sortOrder: options.sortOrder, space: spaceOf(input, frame), ...extras });\n const output = readFrame(input, frame, [], [], turnsOf(extras, transposed));\n return { ...output, trace: [{ id, ms: now() - start, measures: { \"pack.overflow\": output.overflow.length, ...movesOf(id, extras) } }] };\n}\n\n/** This function makes the strategy of one function of `pack`. */\nfunction layoutStrategy<O extends AnyLayoutOptions>(\n id: LayoutId,\n family: string,\n catalog: string[],\n cells: Pick<Supports, \"obstacleMove\" | \"order\"> & Partial<Pick<Supports, \"rotation\">>,\n defaults: O,\n): Strategy<O> {\n const self: Strategy<O> = {\n id,\n family,\n catalog,\n supports: supportsOf({ ...LAYOUT_CELLS, ...cells }),\n defaults: { ...defaults },\n deterministic: true,\n pack(input, options, context) {\n assertSupported(self.supports, input);\n const o = { ...self.defaults, ...options };\n switch (input.container.fixed) {\n case \"height\":\n return viaAxes(input, context.previous, (turned) => packFixedWidth(id, turned, o, true));\n case \"none\":\n return logSweep.search(input, self, context, o);\n default:\n return packFixedWidth(id, input, o);\n }\n },\n };\n return self;\n}\n\n/** The defaults of `rows`, `skyline` and `shelf`. */\nconst LAYOUT_DEFAULTS: LayoutStrategyOptions = { sortOrder: \"height-desc\", samples: 48 };\n\n/**\n * The strategy `rows` uses `packRows`: a guillotine row packing with a recursive gap fill. With obstacles, locked items or a\n * container shape, the rows go around the holes of the free space and lose the gap fill. Turnable items, groups and item\n * shapes throw `UnsupportedCell`.\n */\nexport const rows: Strategy<LayoutStrategyOptions> = layoutStrategy(\"rows\", \"shelf\", [\"rows-gap-fill\", \"rows-input\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\", \"hard\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `skyline` uses `packSkyline`: each item goes to the lowest place where it fits. It packs around the\n * locked items and the fixed obstacles, in each container shape. Turnable items, groups and item shapes throw `UnsupportedCell`.\n */\nexport const skyline: Strategy<LayoutStrategyOptions> = layoutStrategy(\"skyline\", \"skyline\", [\"skyline-bl\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `shelf` uses `packShelf`: rows filled left to right, around the locked items and the fixed obstacles.\n * With the sort order `input`, the rows keep the rank order. Turnable items, groups and item shapes throw `UnsupportedCell`.\n * The option `fit` selects a shelf rule of roadmap item k21: `next`, `first` or `best`. The default has no `fit`.\n */\nexport const shelf: Strategy<LayoutStrategyOptions> = layoutStrategy(\"shelf\", \"shelf\", [\"shelf-nf\", \"shelf-nfdh\"], {\n obstacleMove: [\"fixed\"],\n order: [\"free\", \"soft\", \"hard\"],\n}, LAYOUT_DEFAULTS);\n\n/**\n * The strategy `maxrects` uses `packMaxRects`: the MaxRects packer of roadmap item k24. It keeps the list of the maximal\n * free rectangles, and the option `rule` chooses the free rectangle for each item. The default rule is `bssf`.\n *\n * - The free rectangles go around the locked items and the fixed obstacles. A plain rectangle container gives exact free\n * rectangles. Another shape gives an inner approximation with horizontal bands.\n * - With `rotate`, each turnable item that is not locked can turn by 90 degrees. Groups and item shapes throw `UnsupportedCell`.\n */\nexport const maxrects: Strategy<MaxRectsStrategyOptions> = layoutStrategy(\n \"maxrects\",\n \"maxrects\",\n [\"maxrects-bssf\", \"maxrects-blsf\", \"maxrects-baf\", \"maxrects-bl\", \"maxrects-cp\", \"maxrects-locked\"],\n { obstacleMove: [\"fixed\"], order: [\"free\", \"soft\"], rotation: [\"none\", \"quarter\"] },\n { ...LAYOUT_DEFAULTS, rule: \"bssf\", rotate: false },\n);\n\n/**\n * The size search `log-sweep` uses `packFree` of 0.1.2: widths on a log scale, then the widths near the best width. It\n * wraps `rows`, `skyline`, `shelf` and `maxrects`. The objective is the area of the frame times `1 + aspectWeight * aspectError`.\n */\nexport const logSweep: SizeSearch = {\n id: \"log-sweep\",\n search(input: PackInput, inner: Strategy, context: PackContext, options?: unknown): PackOutput {\n if (input.container.fixed !== \"none\") return inner.pack(input, options ?? inner.defaults, context);\n const id = inner.id;\n if (id !== \"rows\" && id !== \"skyline\" && id !== \"shelf\" && id !== \"maxrects\") throw new UnsupportedCell(\"containerSize\", cellOf(input).containerSize);\n const o = { ...(inner.defaults as AnyLayoutOptions), ...(options as Partial<AnyLayoutOptions> | undefined) };\n const start = now();\n const frame = buildFrame(input, false, id === \"maxrects\" && o.rotate === true);\n const extras = extrasOf(id, o, frame);\n const result = packFree(rectsOf(frame), new Rect<number>(), {\n strategy: id,\n sortOrder: o.sortOrder,\n space: spaceOf(input, frame),\n samples: o.samples,\n aspect: input.container.aspect ?? 1,\n aspectWeight: input.container.aspectWeight ?? 1,\n ...extras,\n });\n const ms = now() - start;\n const runs = result.tried.length + 1;\n const output = readFrame(input, frame, [], [], turnsOf(extras, false));\n return {\n ...output,\n trace: [\n { id: \"log-sweep\", ms, measures: { \"pack.search.widths\": result.tried.length, \"pack.search.ms\": ms } },\n { id, ms: ms / runs, measures: { \"pack.overflow\": output.overflow.length, ...movesOf(id, extras) } },\n ],\n };\n },\n};\n\n/** This function tells if the insides of two rectangles overlap by more than `EPS`. */\nfunction overlaps(a: Rect, b: Rect): boolean {\n return (\n Math.min(a.right(), b.right()) - Math.max(a.position.x, b.position.x) > EPS &&\n Math.min(a.bottom(), b.bottom()) - Math.max(a.position.y, b.position.y) > EPS\n );\n}\n\n/** This function packs an input with a fixed size or a fixed width with a push cascade. */\nfunction pushFixedWidth(input: PackInput, options: PushStrategyOptions, previous: PackOutput | undefined): PackOutput {\n const start = now();\n const frame = buildFrame(input, true);\n const before = new Map(previous?.placements.map((p) => [p.id, p]));\n const positioned: Entry[] = [];\n const pending: Entry[] = [];\n const obstacles = frame.entries.filter((e) => e.obstacle !== undefined);\n const starts = new Map(obstacles.map((e) => [e, { x: e.rect.position.x, y: e.rect.position.y }]));\n const lockedItems = frame.entries.filter((e) => e.item !== undefined && e.rect.locked);\n\n for (const e of frame.entries) {\n const item = e.item;\n if (item === undefined || e.rect.locked) continue;\n const x = item.x ?? before.get(item.id)?.x;\n const y = item.y ?? before.get(item.id)?.y;\n if (x === undefined || y === undefined) {\n pending.push(e);\n continue;\n }\n e.rect.position.set(x - e.dx - frame.ox, y - e.dy - frame.oy);\n positioned.push(e);\n }\n\n // The cascade: each item in the order of its rank pushes the others, and then it stays\n const inPlay = frame.entries.filter((e) => !pending.includes(e)).map((e) => e.rect);\n const maxShoves = options.maxShovesPerItem * Math.max(1, inPlay.length);\n let cascaded = 0;\n for (const e of positioned) {\n cascaded += pushCascade(e.rect, inPlay, { gap: 0, maxShoves }).length;\n e.rect.locked = true;\n }\n\n // An obstacle that the cascade pushed out of the container or onto a locked item goes back to its start\n const { bounds } = frame;\n const moved: { id: string; x: number; y: number }[] = [];\n for (const e of obstacles) {\n const startAt = starts.get(e)!;\n const x = e.rect.position.x + e.dx + frame.ox;\n const y = e.rect.position.y + e.dy + frame.oy;\n const b = boundsOf(e.obstacle!.region);\n const out = x < bounds.x - EPS || y < bounds.y - EPS || x + b.w > bounds.x + bounds.w + EPS || y + b.h > bounds.y + bounds.h + EPS;\n if (out || lockedItems.some((l) => overlaps(l.rect, e.rect))) e.rect.position.set(startAt.x, startAt.y);\n else if (Math.abs(e.rect.position.x - startAt.x) > EPS || Math.abs(e.rect.position.y - startAt.y) > EPS) moved.push({ id: e.obstacle!.id, x, y });\n }\n const pushMs = now() - start;\n\n // Each item that is out of the area or overlaps a kept rectangle goes to the skyline, around the kept rectangles\n const kept = [...obstacles, ...lockedItems].map((e) => e.rect);\n for (const e of positioned) {\n const r = e.rect;\n const inside = r.position.x >= -EPS && r.position.y >= -EPS && r.right() <= frame.w + EPS && r.bottom() <= frame.h + EPS;\n if (inside && !kept.some((k) => overlaps(k, r))) kept.push(r);\n else pending.push(e);\n }\n const skylineStart = now();\n for (const r of kept) {\n r.locked = true;\n r.wasPacked = true;\n }\n if (pending.length > 0 && frame.w > 0) {\n for (const e of pending) {\n e.rect.locked = false;\n e.rect.wasPacked = false;\n }\n packSkyline([...pending.map((e) => e.rect), ...kept], outerOf(frame), { sortOrder: options.sortOrder });\n }\n const output = readFrame(input, frame, [], moved);\n return {\n ...output,\n trace: [\n { id: \"push\", ms: pushMs, measures: { \"pack.push.moved\": moved.length, [MOVES.push]: cascaded } },\n { id: \"skyline\", ms: now() - skylineStart, measures: { \"pack.push.replaced\": pending.length, \"pack.overflow\": output.overflow.length } },\n ],\n };\n}\n\n/**\n * The strategy `push` uses `pushCascade`. Each item starts at its `x` and `y`, or at its place in `context.previous`.\n * Each item in rank order pushes the items and the movable obstacles that it overlaps. Then `packSkyline` places the\n * items with no start, and the items that still overlap. The output tells each obstacle that moved.\n */\nexport const push: Strategy<PushStrategyOptions> = {\n id: \"push\",\n family: \"incremental\",\n catalog: [\"incremental-push\"],\n supports: supportsOf({\n containerSize: [\"fixed\", \"freeHeight\", \"freeWidth\"],\n containerShape: [\"rect\"],\n obstacleMove: [\"fixed\", \"free\"],\n itemShape: [\"rect\"],\n rotation: [\"none\"],\n order: [\"free\", \"soft\"],\n groups: [\"none\"],\n mode: [\"incremental\"],\n }),\n defaults: { sortOrder: \"height-desc\", maxShovesPerItem: 8 },\n deterministic: true,\n pack(input, options, context) {\n assertSupported(push.supports, input);\n const o = { ...push.defaults, ...options };\n if (input.container.fixed === \"height\") return viaAxes(input, context.previous, (turned, previous) => pushFixedWidth(turned, o, previous));\n return pushFixedWidth(input, o, context.previous);\n },\n};\n","import type { Item, PackInput, PackOutput } from \"./contract.ts\";\nimport type { Rect } from \"./rect.ts\";\n\n/**\n * This function makes a `PackInput` from the `Rect` objects of 0.1. The id of each item is the index of its rectangle.\n *\n * - `fixedSize` gives `fixed` set to `size`, `fixedWidth` gives `width`, and an outer rectangle without them gives `none`.\n * - A locked rectangle gives a locked item at its position.\n * - An outer rectangle at a position other than 0, 0 gives a rectangle shape at that position.\n */\nexport function fromRects<T>(rects: readonly Rect<T>[], outer: Rect<T>): PackInput {\n const fixed = outer.fixedSize ? \"size\" : outer.fixedWidth ? \"width\" : \"none\";\n const container: PackInput[\"container\"] = {\n fixed,\n ...(fixed === \"none\" ? {} : { w: outer.size.x }),\n ...(fixed === \"size\" ? { h: outer.size.y } : {}),\n ...(outer.position.x !== 0 || outer.position.y !== 0\n ? { shape: { kind: \"rect\", x: outer.position.x, y: outer.position.y, w: outer.size.x, h: outer.size.y } as const }\n : {}),\n };\n const items = rects.map(\n (r, i): Item => ({ id: String(i), w: r.size.x, h: r.size.y, ...(r.locked ? { locked: true, x: r.position.x, y: r.position.y } : {}) }),\n );\n return { container, items };\n}\n\n/**\n * This function writes an output back into the `Rect` objects of `fromRects`. It sets the position and `wasPacked` of\n * each rectangle, and the free sides of the outer rectangle. It gives the outer rectangle.\n */\nexport function toRects<T>(output: PackOutput, rects: Rect<T>[], outer: Rect<T>): Rect<T> {\n const placements = new Map(output.placements.map((p) => [p.id, p]));\n for (const [i, r] of rects.entries()) {\n const p = placements.get(String(i));\n if (p === undefined) {\n r.wasPacked = r.locked;\n continue;\n }\n r.position.set(p.x, p.y);\n r.wasPacked = true;\n }\n if (!outer.fixedSize) {\n if (!outer.fixedWidth) outer.size.x = output.size.w;\n outer.size.y = output.size.h;\n }\n return outer;\n}\n","// This file is generated. Do not edit it. `bench/choose-sets.ts` writes it from the records of one run of `bench.yml`:\n// the corpus `pack-screen-v1`, the run 40652567756 and the commit f6a489b.\n// The sets of each cell come from all the 1305 inputs. A cell with fewer than 12 inputs is thin.\n// The default member count of a cell is the largest prefix with a median summed time of 50 ms or less on these CI records.\n\nimport type { PortfolioSets } from \"./portfolio-cell.ts\";\n\n/** The table of the per-cell portfolio: the sets of 1, 2 and 3 members of each cell, with their training scores. The run 40652567756 gives it. */\nexport const PORTFOLIO_SETS: PortfolioSets = {\n \"source\": {\n \"corpus\": \"pack-screen-v1\",\n \"run\": \"40652567756\",\n \"commit\": \"f6a489b\",\n \"inputs\": 1305,\n \"frameMs\": 50\n },\n \"entries\": {\n \"rows\": {\n \"id\": \"rows\",\n \"strategy\": \"rows\"\n },\n \"skyline\": {\n \"id\": \"skyline\",\n \"strategy\": \"skyline\"\n },\n \"shelf\": {\n \"id\": \"shelf\",\n \"strategy\": \"shelf\"\n },\n \"shelf-next\": {\n \"id\": \"shelf-next\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"next\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"shelf-first\": {\n \"id\": \"shelf-first\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"first\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"shelf-best\": {\n \"id\": \"shelf-best\",\n \"strategy\": \"shelf\",\n \"options\": {\n \"fit\": \"best\",\n \"sortOrder\": \"height-desc\"\n }\n },\n \"maxrects-bssf\": {\n \"id\": \"maxrects-bssf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"bssf\"\n }\n },\n \"maxrects-blsf\": {\n \"id\": \"maxrects-blsf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"blsf\"\n }\n },\n \"maxrects-baf\": {\n \"id\": \"maxrects-baf\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"baf\"\n }\n },\n \"maxrects-bl\": {\n \"id\": \"maxrects-bl\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"bl\"\n }\n },\n \"maxrects-cp\": {\n \"id\": \"maxrects-cp\",\n \"strategy\": \"maxrects\",\n \"options\": {\n \"rule\": \"cp\"\n }\n }\n },\n \"all\": {\n \"inputs\": 1305,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.02,\n \"wins\": 857,\n \"winShare\": 0.657,\n \"msMean\": 4.92\n },\n \"2\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.011,\n \"wins\": 1052,\n \"winShare\": 0.806,\n \"msMean\": 9.582\n },\n \"3\": {\n \"inputs\": 1305,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 1139,\n \"winShare\": 0.873,\n \"msMean\": 22.228\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.015,\n \"2\": 2.004,\n \"3\": 3.074\n },\n \"defaultMembers\": 3\n },\n \"shapes\": {\n \"circle\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.015,\n \"wins\": 147,\n \"winShare\": 0.7,\n \"msMean\": 10.026\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 170,\n \"winShare\": 0.81,\n \"msMean\": 35.829\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 190,\n \"winShare\": 0.905,\n \"msMean\": 46.593\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.441,\n \"2\": 7.24,\n \"3\": 10.252\n },\n \"defaultMembers\": 3\n },\n \"convex\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.015,\n \"wins\": 134,\n \"winShare\": 0.638,\n \"msMean\": 6.123\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.004,\n \"wins\": 188,\n \"winShare\": 0.895,\n \"msMean\": 11.606\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.002,\n \"wins\": 197,\n \"winShare\": 0.938,\n \"msMean\": 26.072\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.133,\n \"2\": 3.31,\n \"3\": 7.783\n },\n \"defaultMembers\": 3\n },\n \"ellipse\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.024,\n \"wins\": 144,\n \"winShare\": 0.686,\n \"msMean\": 9.772\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.008,\n \"wins\": 166,\n \"winShare\": 0.79,\n \"msMean\": 34.101\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 185,\n \"winShare\": 0.881,\n \"msMean\": 49.128\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.553,\n \"2\": 7.079,\n \"3\": 11.095\n },\n \"defaultMembers\": 3\n },\n \"holes\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.016,\n \"wins\": 133,\n \"winShare\": 0.633,\n \"msMean\": 2.009\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.011,\n \"wins\": 165,\n \"winShare\": 0.786,\n \"msMean\": 8.29\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 184,\n \"winShare\": 0.876,\n \"msMean\": 13.146\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.755,\n \"2\": 1.626,\n \"3\": 2.455\n },\n \"defaultMembers\": 3\n },\n \"polygon\": {\n \"inputs\": 210,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.03,\n \"wins\": 131,\n \"winShare\": 0.624,\n \"msMean\": 1.663\n },\n \"2\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.012,\n \"wins\": 181,\n \"winShare\": 0.862,\n \"msMean\": 7.39\n },\n \"3\": {\n \"inputs\": 210,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 194,\n \"winShare\": 0.924,\n \"msMean\": 8.701\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.477,\n \"2\": 1.176,\n \"3\": 1.636\n },\n \"defaultMembers\": 3\n },\n \"rect\": {\n \"inputs\": 255,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 168,\n \"winShare\": 0.659,\n \"msMean\": 0.808\n },\n \"2\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 217,\n \"winShare\": 0.851,\n \"msMean\": 2.807\n },\n \"3\": {\n \"inputs\": 255,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 230,\n \"winShare\": 0.902,\n \"msMean\": 3.514\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.094,\n \"2\": 0.426,\n \"3\": 0.582\n },\n \"defaultMembers\": 3\n }\n },\n \"cells\": {\n \"circle/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bl\",\n \"skyline\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.004,\n \"fillRegret\": 0.073,\n \"wins\": 11,\n \"winShare\": 0.314,\n \"msMean\": 0.886\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.014,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 1.82\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 2.277\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.938,\n \"2\": 1.86,\n \"3\": 2.105\n },\n \"defaultMembers\": 3\n },\n \"circle/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"skyline\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.025,\n \"wins\": 15,\n \"winShare\": 0.429,\n \"msMean\": 1.028\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 1.317\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 2.411\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.971,\n \"2\": 1.237,\n \"3\": 2.388\n },\n \"defaultMembers\": 3\n },\n \"circle/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.004,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 3.076\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 5.919\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 8.775\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.837,\n \"2\": 5.565,\n \"3\": 8.149\n },\n \"defaultMembers\": 3\n },\n \"circle/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 4.611\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 14.686\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 14.686\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.648,\n \"2\": 14.826,\n \"3\": 14.826\n },\n \"defaultMembers\": 2\n },\n \"circle/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bssf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.003,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 6.057\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 12.12\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 18.376\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.153,\n \"2\": 9.576,\n \"3\": 13.853\n },\n \"defaultMembers\": 3\n },\n \"circle/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 44.25\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 49.4\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 61.283\n }\n },\n \"prefixMedianMs\": {\n \"1\": 46.745,\n \"2\": 51.433,\n \"3\": 63.649\n },\n \"defaultMembers\": 1\n },\n \"convex/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"maxrects-bl\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.007,\n \"fillRegret\": 0.208,\n \"wins\": 5,\n \"winShare\": 0.143,\n \"msMean\": 0.577\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.006,\n \"fillRegret\": 0.017,\n \"wins\": 24,\n \"winShare\": 0.686,\n \"msMean\": 1.301\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.016,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 2.184\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.513,\n \"2\": 1.225,\n \"3\": 1.931\n },\n \"defaultMembers\": 3\n },\n \"convex/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"skyline\"\n ],\n \"2\": [\n \"skyline\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"skyline\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.012,\n \"wins\": 27,\n \"winShare\": 0.771,\n \"msMean\": 1.868\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.006,\n \"wins\": 31,\n \"winShare\": 0.886,\n \"msMean\": 2.564\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 3.43\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.235,\n \"2\": 2.194,\n \"3\": 3.119\n },\n \"defaultMembers\": 3\n },\n \"convex/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 2.416\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 5.037\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 7.013\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.083,\n \"2\": 4.342,\n \"3\": 5.664\n },\n \"defaultMembers\": 3\n },\n \"convex/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf\",\n \"shelf-first\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 3.347\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 3.533\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 4.004\n }\n },\n \"prefixMedianMs\": {\n \"1\": 3.337,\n \"2\": 3.513,\n \"3\": 3.956\n },\n \"defaultMembers\": 3\n },\n \"convex/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 3.71\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.383,\n \"2\": 2.383,\n \"3\": 2.383\n },\n \"defaultMembers\": 1\n },\n \"convex/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-best\"\n ],\n \"2\": [\n \"shelf-best\"\n ],\n \"3\": [\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 19.138\n }\n },\n \"prefixMedianMs\": {\n \"1\": 18.965,\n \"2\": 18.965,\n \"3\": 18.965\n },\n \"defaultMembers\": 1\n },\n \"ellipse/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-cp\",\n \"skyline\",\n \"shelf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.005,\n \"fillRegret\": 0.061,\n \"wins\": 12,\n \"winShare\": 0.343,\n \"msMean\": 0.896\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.026,\n \"wins\": 19,\n \"winShare\": 0.543,\n \"msMean\": 1.675\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.016,\n \"wins\": 23,\n \"winShare\": 0.657,\n \"msMean\": 1.684\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.815,\n \"2\": 1.348,\n \"3\": 1.356\n },\n \"defaultMembers\": 3\n },\n \"ellipse/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"skyline\"\n ],\n \"2\": [\n \"skyline\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"skyline\",\n \"maxrects-cp\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.003,\n \"fillRegret\": 0.059,\n \"wins\": 17,\n \"winShare\": 0.486,\n \"msMean\": 0.362\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.021,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 1.407\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 2.39\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.272,\n \"2\": 1.286,\n \"3\": 2.153\n },\n \"defaultMembers\": 3\n },\n \"ellipse/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-bssf\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.004,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 3.074\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 5.854\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 8.393\n }\n },\n \"prefixMedianMs\": {\n \"1\": 2.802,\n \"2\": 5.274,\n \"3\": 7.336\n },\n \"defaultMembers\": 3\n },\n \"ellipse/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"skyline\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"skyline\",\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 5.351\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 7.226\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 17.469\n }\n },\n \"prefixMedianMs\": {\n \"1\": 5.179,\n \"2\": 7.083,\n \"3\": 17.026\n },\n \"defaultMembers\": 3\n },\n \"ellipse/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bssf\"\n ],\n \"2\": [\n \"maxrects-bssf\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bssf\",\n \"maxrects-blsf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 5.533\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 10.704\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 16.428\n }\n },\n \"prefixMedianMs\": {\n \"1\": 5.067,\n \"2\": 9.535,\n \"3\": 13.728\n },\n \"defaultMembers\": 3\n },\n \"ellipse/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\"\n ],\n \"3\": [\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 42.562\n }\n },\n \"prefixMedianMs\": {\n \"1\": 43.159,\n \"2\": 43.159,\n \"3\": 43.159\n },\n \"defaultMembers\": 1\n },\n \"holes/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.05,\n \"wins\": 19,\n \"winShare\": 0.543,\n \"msMean\": 0.392\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 0.671\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.01,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.068\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.377,\n \"2\": 0.652,\n \"3\": 1.036\n },\n \"defaultMembers\": 3\n },\n \"holes/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-baf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-baf\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.014,\n \"wins\": 23,\n \"winShare\": 0.657,\n \"msMean\": 0.4\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 27,\n \"winShare\": 0.771,\n \"msMean\": 0.951\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.115\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.391,\n \"2\": 0.912,\n \"3\": 1.024\n },\n \"defaultMembers\": 3\n },\n \"holes/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.003,\n \"fillRegret\": 0.005,\n \"wins\": 20,\n \"winShare\": 0.571,\n \"msMean\": 0.636\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.001,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 1.13\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.869\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.599,\n \"2\": 1.068,\n \"3\": 1.804\n },\n \"defaultMembers\": 3\n },\n \"holes/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf\",\n \"maxrects-bssf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 32,\n \"winShare\": 0.914,\n \"msMean\": 0.882\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.002,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 1.147\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 2.229\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.837,\n \"2\": 1.134,\n \"3\": 2.261\n },\n \"defaultMembers\": 3\n },\n \"holes/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.206\n }\n },\n \"prefixMedianMs\": {\n \"1\": 1.011,\n \"2\": 1.011,\n \"3\": 1.011\n },\n \"defaultMembers\": 1\n },\n \"holes/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.003,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 28.492\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.002,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 36.636\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.002,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 36.636\n }\n },\n \"prefixMedianMs\": {\n \"1\": 29.151,\n \"2\": 37.4,\n \"3\": 37.4\n },\n \"defaultMembers\": 2\n },\n \"polygon/10/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-blsf\",\n \"shelf-best\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.001,\n \"fillRegret\": 0.08,\n \"wins\": 18,\n \"winShare\": 0.514,\n \"msMean\": 0.209\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.034,\n \"wins\": 22,\n \"winShare\": 0.629,\n \"msMean\": 0.393\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 0.445\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.178,\n \"2\": 0.351,\n \"3\": 0.401\n },\n \"defaultMembers\": 3\n },\n \"polygon/10/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-best\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-best\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.04,\n \"wins\": 21,\n \"winShare\": 0.6,\n \"msMean\": 0.233\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.009,\n \"wins\": 28,\n \"winShare\": 0.8,\n \"msMean\": 0.278\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.008,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 0.482\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.175,\n \"2\": 0.222,\n \"3\": 0.408\n },\n \"defaultMembers\": 3\n },\n \"polygon/100/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-cp\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.002,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 0.369\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 33,\n \"winShare\": 0.943,\n \"msMean\": 0.785\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 1.174\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.378,\n \"2\": 0.809,\n \"3\": 1.182\n },\n \"defaultMembers\": 3\n },\n \"polygon/100/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-blsf\",\n \"shelf-first\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.019,\n \"wins\": 26,\n \"winShare\": 0.743,\n \"msMean\": 0.552\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 29,\n \"winShare\": 0.829,\n \"msMean\": 1.036\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 1.406\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.519,\n \"2\": 0.989,\n \"3\": 1.357\n },\n \"defaultMembers\": 3\n },\n \"polygon/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.981\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.769,\n \"2\": 0.769,\n \"3\": 0.769\n },\n \"defaultMembers\": 1\n },\n \"polygon/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-blsf\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-blsf\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 31,\n \"winShare\": 0.886,\n \"msMean\": 11.31\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 34,\n \"winShare\": 0.971,\n \"msMean\": 16.795\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 24.24\n }\n },\n \"prefixMedianMs\": {\n \"1\": 10.381,\n \"2\": 16.052,\n \"3\": 23.567\n },\n \"defaultMembers\": 3\n },\n \"rect/1/identical\": {\n \"inputs\": 10,\n \"thin\": true\n },\n \"rect/10/heavyTail\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"rows\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"rows\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.049,\n \"wins\": 22,\n \"winShare\": 0.55,\n \"msMean\": 0.02\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.013,\n \"wins\": 29,\n \"winShare\": 0.725,\n \"msMean\": 0.047\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.007,\n \"wins\": 33,\n \"winShare\": 0.825,\n \"msMean\": 0.07\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.016,\n \"2\": 0.037,\n \"3\": 0.055\n },\n \"defaultMembers\": 3\n },\n \"rect/10/identical\": {\n \"inputs\": 5,\n \"thin\": true\n },\n \"rect/10/uniform\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-next\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-next\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.035,\n \"wins\": 27,\n \"winShare\": 0.675,\n \"msMean\": 0.043\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.015,\n \"wins\": 33,\n \"winShare\": 0.825,\n \"msMean\": 0.114\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 37,\n \"winShare\": 0.925,\n \"msMean\": 0.173\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.027,\n \"2\": 0.086,\n \"3\": 0.11\n },\n \"defaultMembers\": 3\n },\n \"rect/100/heavyTail\": {\n \"inputs\": 45,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"maxrects-bssf\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"maxrects-bssf\",\n \"maxrects-baf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0.002,\n \"fillRegret\": 0.003,\n \"wins\": 32,\n \"winShare\": 0.711,\n \"msMean\": 0.097\n },\n \"2\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 39,\n \"winShare\": 0.867,\n \"msMean\": 0.24\n },\n \"3\": {\n \"inputs\": 45,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 42,\n \"winShare\": 0.933,\n \"msMean\": 0.368\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.083,\n \"2\": 0.217,\n \"3\": 0.324\n },\n \"defaultMembers\": 3\n },\n \"rect/100/identical\": {\n \"inputs\": 5,\n \"thin\": true\n },\n \"rect/100/uniform\": {\n \"inputs\": 40,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-bl\"\n ],\n \"2\": [\n \"maxrects-bl\",\n \"shelf-first\"\n ],\n \"3\": [\n \"maxrects-bl\",\n \"shelf-first\",\n \"maxrects-blsf\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.005,\n \"wins\": 31,\n \"winShare\": 0.775,\n \"msMean\": 0.208\n },\n \"2\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.001,\n \"wins\": 38,\n \"winShare\": 0.95,\n \"msMean\": 0.413\n },\n \"3\": {\n \"inputs\": 40,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0,\n \"wins\": 39,\n \"winShare\": 0.975,\n \"msMean\": 0.648\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.196,\n \"2\": 0.367,\n \"3\": 0.519\n },\n \"defaultMembers\": 3\n },\n \"rect/1k/heavyTail\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"maxrects-cp\"\n ],\n \"2\": [\n \"maxrects-cp\"\n ],\n \"3\": [\n \"maxrects-cp\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": -0.001,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 0.679\n }\n },\n \"prefixMedianMs\": {\n \"1\": 0.554,\n \"2\": 0.554,\n \"3\": 0.554\n },\n \"defaultMembers\": 1\n },\n \"rect/1k/uniform\": {\n \"inputs\": 35,\n \"thin\": false,\n \"sets\": {\n \"1\": [\n \"shelf-first\"\n ],\n \"2\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ],\n \"3\": [\n \"shelf-first\",\n \"maxrects-bl\"\n ]\n },\n \"train\": {\n \"1\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": 0.004,\n \"wins\": 30,\n \"winShare\": 0.857,\n \"msMean\": 4.737\n },\n \"2\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 9.299\n },\n \"3\": {\n \"inputs\": 35,\n \"hardRegret\": 0,\n \"excessAreaRegret\": 0,\n \"fillRegret\": -0.001,\n \"wins\": 35,\n \"winShare\": 1,\n \"msMean\": 9.299\n }\n },\n \"prefixMedianMs\": {\n \"1\": 4.185,\n \"2\": 8.887,\n \"3\": 8.887\n },\n \"defaultMembers\": 2\n }\n }\n};\n","// The per-cell portfolio of roadmap item k20, part 2 (`docs/PACKER.md`, \"The per-cell portfolio\"). The cell of an input\n// comes from the input itself. The table `PORTFOLIO_SETS` gives the members of each cell.\n\nimport type { PackInput } from \"./contract.ts\";\nimport { countCell, type CountScale } from \"./layout-input.ts\";\nimport { PORTFOLIO_SETS } from \"./portfolio-sets.ts\";\nimport type { PortfolioEntry } from \"./portfolio.ts\";\nimport { cellOf, type DimensionValue } from \"./strategy.ts\";\n\n/** The band of the size spread of the items of an input. */\nexport type SpreadBand = \"identical\" | \"uniform\" | \"heavyTail\";\n\n/** The cell of an input for the per-cell portfolio: the container shape, the band of the item count and the band of the size spread. */\nexport interface PortfolioCell {\n shape: DimensionValue<\"containerShape\">;\n /** The band of the item count, as `countCell` gives it: `1`, `10`, `100`, `1k` or `10k`. */\n count: CountScale;\n spread: SpreadBand;\n}\n\n/**\n * The thresholds of the spread bands. The statistic is the standard deviation of the natural log of the linear size\n * `sqrt(w * h)` of each item.\n *\n * - Below `identical`, the band is `identical`.\n * - Below `uniform`, the band is `uniform`.\n * - At `uniform` or above, the band is `heavyTail`.\n *\n * On the seeds 1 to 7 of the generators of `pack-screen-v1`, the uniform sizes give 0.258 at most. The heavy-tail sizes give 0.278 at least.\n */\nexport const SPREAD_THRESHOLDS: Readonly<{ identical: number; uniform: number }> = Object.freeze({ identical: 0.02, uniform: 0.27 });\n\n/** A cell with fewer inputs than this count in the training records is thin. It uses the set of its container shape. */\nexport const THIN_INPUTS = 12;\n\n/**\n * The frame budget of the default member count, in milliseconds. The default count of a cell is the largest prefix of its\n * set of 3 that fits this budget. The prefix fits when its median summed member time on the CI records is this value or less.\n * The count is 1 or more at all times.\n * The default output thus does not depend on the clock: a time limit is only the opt-in option `budgetMs`.\n */\nexport const PORTFOLIO_FRAME_MS = 50;\n\n/** This function gives the key of a cell: `<shape>/<count>/<spread>`, for example `rect/100/uniform`. */\nexport function cellKey(cell: PortfolioCell): string {\n return `${cell.shape}/${cell.count}/${cell.spread}`;\n}\n\n/**\n * This function gives the spread statistic of an input: the standard deviation of the natural log of `sqrt(w * h)` of each item.\n * An item with no area does not count. Fewer than 2 items with an area give 0.\n */\nexport function spreadOf(input: PackInput): number {\n const logs: number[] = [];\n for (const item of input.items) {\n const area = item.w * item.h;\n if (area > 0 && Number.isFinite(area)) logs.push(Math.log(area) / 2);\n }\n if (logs.length < 2) return 0;\n const mean = logs.reduce((a, b) => a + b, 0) / logs.length;\n return Math.sqrt(logs.reduce((a, b) => a + (b - mean) ** 2, 0) / logs.length);\n}\n\n/** This function gives the band of a spread statistic by `SPREAD_THRESHOLDS`. */\nexport function spreadBand(spread: number): SpreadBand {\n if (spread < SPREAD_THRESHOLDS.identical) return \"identical\";\n return spread < SPREAD_THRESHOLDS.uniform ? \"uniform\" : \"heavyTail\";\n}\n\n/**\n * This function gives the cell of an input for the per-cell portfolio. The function reads only the input, not a corpus id.\n *\n * - `shape` is the `containerShape` of `cellOf`.\n * - `count` is `countCell` of the count of the items.\n * - `spread` is `spreadBand` of `spreadOf`.\n */\nexport function portfolioCell(input: PackInput): PortfolioCell {\n return { shape: cellOf(input).containerShape, count: countCell(input.items.length), spread: spreadBand(spreadOf(input)) };\n}\n\n/** The sizes of the sets of the table. */\nexport type PortfolioSize = 1 | 2 | 3;\n\n/** The score of a set on its training records. The regrets are means against the oracle of the pool. */\nexport interface PortfolioTrainScore {\n inputs: number;\n /** The mean of the hard breaks of the winner of the set less those of the oracle */\n hardRegret: number;\n /** The mean of `pack.overflow.excessArea` of the winner of the set less that of the oracle */\n excessAreaRegret: number;\n /** The mean of `pack.fill` of the oracle less that of the winner of the set */\n fillRegret: number;\n /** The inputs where the winner of the set is in the last kept list of the oracle */\n wins: number;\n winShare: number;\n /** The mean of the summed times of the members on an input, in milliseconds */\n msMean: number;\n}\n\n/** The sets of one cell of the table, by size, with their training scores. */\nexport interface PortfolioCellSets {\n /** The inputs of the cell in the training records */\n inputs: number;\n /** The value `true` when `inputs` is less than `THIN_INPUTS`. A thin cell has no sets. It uses the sets of its shape. */\n thin: boolean;\n /** The ids of the members of each set, in the order of the pick. A thin cell has none. */\n sets?: Readonly<Record<`${PortfolioSize}`, readonly string[]>>;\n /** The training score of each set */\n train?: Readonly<Record<`${PortfolioSize}`, PortfolioTrainScore>>;\n /** The median over the inputs of the summed member times of each prefix of the set of 3, in milliseconds. A missing record counts 0. */\n prefixMedianMs?: Readonly<Record<`${PortfolioSize}`, number>>;\n /** The default member count: the largest prefix of the set of 3 with `prefixMedianMs` of `PORTFOLIO_FRAME_MS` or less, and 1 at least */\n defaultMembers?: PortfolioSize;\n}\n\n/** The table of the per-cell portfolio. `bench/choose-sets.ts` generates it from the records of one run. */\nexport interface PortfolioSets {\n /** The run of the records: the corpus, the commit of the code and the id of the run of `bench.yml`. It also has the frame budget of the default counts. */\n source: Readonly<{ corpus: string; run: string; commit: string; inputs: number; frameMs: number }>;\n /** The member of each id: a strategy of the registry with some options */\n entries: Readonly<Record<string, PortfolioEntry>>;\n /** The sets of all the inputs. They are the fixed default of an input of an unknown shape. */\n all: PortfolioCellSets;\n /** The sets of each container shape. They are the fallback of a thin cell and of an unknown cell. */\n shapes: Readonly<Record<string, PortfolioCellSets>>;\n /** The sets of each cell, by `cellKey` */\n cells: Readonly<Record<string, PortfolioCellSets>>;\n}\n\n/** The source of the members of an input in the table. */\nexport type PortfolioSetSource = \"cell\" | \"shape\" | \"default\";\n\n/** This function gives the sets of an input from a table: the sets of its cell, or of its shape, or of all the inputs. */\nexport function portfolioSetOf(input: PackInput, table: PortfolioSets = PORTFOLIO_SETS): { key: string; source: PortfolioSetSource; sets: PortfolioCellSets } {\n const cell = portfolioCell(input);\n const key = cellKey(cell);\n const own = table.cells[key];\n if (own?.sets !== undefined) return { key, source: \"cell\", sets: own };\n const shape = table.shapes[cell.shape];\n if (shape?.sets !== undefined) return { key, source: \"shape\", sets: shape };\n return { key, source: \"default\", sets: table.all };\n}\n\n/**\n * This function gives the `k` members of an input for `packPortfolio`. The members are the set of the cell of the input.\n * A thin cell or an unknown cell takes the set of its shape, or the set of all the inputs. The function throws a `RangeError` for a `k` other than 1, 2 or 3.\n */\nexport function portfolioMembers(input: PackInput, k: number, table: PortfolioSets = PORTFOLIO_SETS): PortfolioEntry[] {\n if (k !== 1 && k !== 2 && k !== 3) throw new RangeError(`The size of a portfolio set is 1, 2 or 3, not ${k}.`);\n const ids = portfolioSetOf(input, table).sets.sets![`${k}`];\n return ids.map((id) => {\n const e = table.entries[id];\n if (e === undefined) throw new RangeError(`The table of the portfolio sets has no entry \"${id}\".`);\n return { ...e };\n });\n}\n\n/**\n * This function gives the default member count of an input: `defaultMembers` of the sets of its cell, its shape or all the inputs.\n * With a `k`, the count is not more than `k`. A table without the count gives `k`, or 3 without a `k`.\n */\nexport function portfolioDefaultMembers(input: PackInput, k?: number, table: PortfolioSets = PORTFOLIO_SETS): number {\n const count = portfolioSetOf(input, table).sets.defaultMembers ?? 3;\n return k === undefined ? count : Math.min(count, k);\n}\n","import { boundsOf, rectInRegion, regionHitsRect, translate, type ContainerTest, type PackHard, type Rect, type Region } from \"@mark1russell7/layout-contract\";\nimport { DEFAULT_TOLERANCE, marginOf, RECORD_EPS, turnItem, type Item, type PackInput, type PackOutput, type Placement, type Tolerance } from \"./contract.ts\";\n\nexport type { ContainerTest, PackHard } from \"@mark1russell7/layout-contract\";\n\n/** A box with its margin: the left, top, right and bottom edges. */\ninterface Box {\n l: number;\n t: number;\n r: number;\n b: number;\n}\n\n/** This function tells if the insides of two boxes overlap by more than a tolerance on each axis. */\nfunction overlap(a: Box, b: Box, tolerance: number): boolean {\n return Math.min(a.r, b.r) - Math.max(a.l, b.l) > tolerance && Math.min(a.b, b.b) - Math.max(a.t, b.t) > tolerance;\n}\n\n/** This function gives the box made smaller by a tolerance on each side, as a rectangle. */\nfunction inner(box: Box, tolerance: number): Rect {\n return { x: box.l + tolerance, y: box.t + tolerance, w: box.r - box.l - 2 * tolerance, h: box.b - box.t - 2 * tolerance };\n}\n\n/**\n * This function counts the breaks of the 4 hard rules of the packer for an output.\n *\n * - `no-overlap`: each pair of items with their margins, and each pair of an item and an obstacle, that overlap by more than `tolerance.overlap`.\n * - `in-container`: each item with its margin that goes out of a fixed side by more than `tolerance.overlap`. The inset of\n * the container makes each fixed side smaller (decision 3 of `docs/PACKER.md`).\n * - `locked-kept`: each locked item that moved by more than `RECORD_EPS`, or that has no placement.\n * - `complete`: each item with no placement that is not in the overflow. A locked item breaks `locked-kept` in its place.\n *\n * A locked item with no placement stays at its input position for `no-overlap` and `in-container`. A locked item with no\n * `x` or no `y` in the input is a bad input. The rules skip it, as `packHard` of the contract does. `checkInput` finds it.\n *\n * The test of an obstacle is exact: a circle, an ellipse and a polygon with holes count only their insides, as in `packHard`.\n * The rules read a shape of the container or of an item as its bounding box (decision 5). The bounding box of an item\n * shape is relative to the position of the item. The result has no tolerance in it.\n *\n * With `options.exactContainer`, a shaped container with the size `fixed` also uses its true outline for `in-container`.\n * A box then counts when `rectInRegion` of the contract tells that it is not in the shape, as in `packHard`.\n * For that test, the box grows by the inset and becomes smaller by `tolerance.overlap` on each side. The default is `false`.\n */\nexport function checkHard(\n input: PackInput,\n output: PackOutput,\n tolerance: Pick<Tolerance, \"overlap\"> = DEFAULT_TOLERANCE,\n options: ContainerTest = {},\n): PackHard {\n const tol = tolerance.overlap;\n const placements = new Map<string, Placement>();\n for (const p of output.placements) if (!placements.has(p.id)) placements.set(p.id, p);\n const overflow = new Set(output.overflow);\n let lockedKept = 0;\n let complete = 0;\n\n const boxes: Box[] = [];\n for (const item of input.items) {\n if (item.locked === true && (item.x === undefined || item.y === undefined)) continue;\n const lockedAt = item.locked === true ? { x: item.x!, y: item.y! } : undefined;\n let p: Pick<Placement, \"x\" | \"y\" | \"turn\"> | undefined = placements.get(item.id);\n if (p === undefined) {\n if (lockedAt === undefined) {\n if (!overflow.has(item.id)) complete += 1;\n continue;\n }\n // A locked item with no placement breaks locked-kept, and it stays at its input position for the other rules\n lockedKept += 1;\n p = lockedAt;\n } else if (lockedAt !== undefined) {\n if (Math.abs(p.x - lockedAt.x) > RECORD_EPS || Math.abs(p.y - lockedAt.y) > RECORD_EPS) lockedKept += 1;\n }\n const placed: Item = p.turn === 90 ? turnItem(item) : item;\n const m = marginOf(placed);\n const area = placed.shape === undefined ? { x: 0, y: 0, w: placed.w, h: placed.h } : boundsOf(placed.shape);\n const l = p.x + area.x;\n const t = p.y + area.y;\n boxes.push({ l: l - m.left, t: t - m.top, r: l + area.w + m.right, b: t + area.h + m.bottom });\n }\n\n const moved = new Map(output.moved.map((m) => [m.id, m]));\n const obstacles: Region[] = (input.obstacles ?? []).map((o) => {\n const at = moved.get(o.id);\n if (at === undefined) return o.region;\n const b = boundsOf(o.region);\n return translate(o.region, at.x - b.x, at.y - b.y);\n });\n\n let overlaps = 0;\n for (const [i, a] of boxes.entries()) {\n for (let j = i + 1; j < boxes.length; j++) if (overlap(a, boxes[j]!, tol)) overlaps += 1;\n if (obstacles.length === 0) continue;\n const rect = inner(a, tol);\n for (const region of obstacles) if (regionHitsRect(region, rect)) overlaps += 1;\n }\n\n const { container } = input;\n const shape = container.shape === undefined ? undefined : boundsOf(container.shape);\n const x = shape?.x ?? 0;\n const y = shape?.y ?? 0;\n const w = shape?.w ?? container.w ?? Infinity;\n const h = shape?.h ?? container.h ?? Infinity;\n const inset = container.inset ?? 0;\n const fixedW = container.fixed === \"size\" || container.fixed === \"width\";\n const fixedH = container.fixed === \"size\" || container.fixed === \"height\";\n const exact = options.exactContainer === true && container.fixed === \"size\" ? container.shape : undefined;\n let outside = 0;\n for (const box of boxes) {\n const outX = fixedW && (box.l < x + inset - tol || box.r > x + w - inset + tol);\n const outY = fixedH && (box.t < y + inset - tol || box.b > y + h - inset + tol);\n if (outX || outY) outside += 1;\n else if (exact !== undefined && !rectInRegion(exact, inner({ l: box.l - inset, t: box.t - inset, r: box.r + inset, b: box.b + inset }, tol))) outside += 1;\n }\n return { \"no-overlap\": overlaps, \"in-container\": outside, \"locked-kept\": lockedKept, complete };\n}\n","// The portfolio of roadmap item k20, part 1 (`docs/PACKER.md`, \"The portfolio\"). A portfolio packs an input with each\n// member and keeps the best output by the one pick rule `selectBest` of the contract. Nothing default uses it.\n\nimport { pickMoves, portfolio, type Member, type Portfolio, type PortfolioKey, type PortfolioPick, type SelectLevel } from \"@mark1russell7/layout-contract\";\nimport { checkHard } from \"./check.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { outputHash } from \"./layout-input.ts\";\nimport { MEASURE_SPECS, measure, roundMeasures, type LayoutMeasures } from \"./measures.ts\";\nimport { packWith, strategy } from \"./registry.ts\";\n\n/** A member of `packPortfolio`: a strategy of the registry with some options. The id names the member in the trace. */\nexport interface PortfolioEntry {\n id: string;\n /** The id of a strategy of the registry */\n strategy: string;\n /** The options of the member over the defaults of the strategy */\n options?: unknown;\n}\n\n/** The options of `packPortfolio`. The time limit and the member limit are those of `portfolio` of the contract. */\nexport interface PackPortfolioOptions {\n /** The id of the portfolio. The default is `portfolio`. */\n id?: string;\n /** The seed of each member. The default is 0, as for `packWith`. */\n seed?: number;\n /** The time limit in milliseconds. Without it, each member runs. A cut member makes the pick not deterministic. */\n budgetMs?: number;\n /** The largest count of members that run */\n maxMembers?: number;\n /** The clock in milliseconds. The default is `performance.now`. */\n now?: () => number;\n}\n\n/** The id of the trace stage of `packPortfolio`. Its measure `move.pick` is 1 when the pick is not member 0. */\nexport const PORTFOLIO_STAGE = \"portfolio\";\n\n/**\n * The levels of the pick of `packPortfolio` and of the portfolio report of the benchmark, in order. Level 0 is `hard`.\n *\n * - `hard`: the count of hard breaks of `checkHard` with `exactContainer`. Lower is better, with the minimum effect 0.\n * - `pack.overflow.excessArea`: the overflow area above its bound. Lower is better.\n * - `pack.fill`: the fill of the hull. Higher is better.\n */\nexport const PORTFOLIO_LEVELS: readonly SelectLevel[] = Object.freeze([\n { id: \"hard\", spec: { direction: \"lower\", minEffect: 0 } },\n { id: \"pack.overflow.excessArea\", spec: MEASURE_SPECS[\"pack.overflow.excessArea\"] },\n { id: \"pack.fill\", spec: MEASURE_SPECS[\"pack.fill\"] },\n] as SelectLevel[]);\n\n/** This function gives the count of the hard breaks of an output: the sum of `checkHard` with `exactContainer`. */\nexport function hardBreaks(input: PackInput, output: PackOutput): number {\n return Object.values(checkHard(input, output, undefined, { exactContainer: true })).reduce((sum, n) => sum + n, 0);\n}\n\n/**\n * This function makes an opt-in portfolio of strategies of the registry with `portfolio` of the contract.\n * Its `pick(input)` packs the input with each member and gives the output of the winner, its id and the trace.\n *\n * - A member is a strategy id, or a `PortfolioEntry` with options. The members run in the given order.\n * - `members` is a list, or a function of the input that gives the list. The strategy `portfolio` uses the function form.\n * - The key is the hard breaks, then `pack.overflow.excessArea`, then `pack.fill`. `PORTFOLIO_LEVELS` gives the specs.\n * - The key reads the measures after `roundMeasures`, as a record keeps them. A replay of the records gives the same pick.\n * - The hash of the key is `outputHash`. `selectBest` of the contract picks the winner.\n * - The output of the winner gets the trace stage `portfolio` with `move.pick` of `pickMoves`.\n * - The function throws a `RangeError` for an unknown strategy, an empty list and two members with the same id.\n * With the function form, `pick` throws this error for the list of an input.\n */\nexport function packPortfolio(\n members: readonly (string | PortfolioEntry)[] | ((input: PackInput) => readonly (string | PortfolioEntry)[]),\n options: PackPortfolioOptions = {},\n): Portfolio<PackInput, PackOutput> {\n const seed = options.seed ?? 0;\n const toMembers = (given: readonly (string | PortfolioEntry)[]): Member<PackInput, PackOutput>[] =>\n given.map((m) => {\n const e = typeof m === \"string\" ? { id: m, strategy: m } : m;\n strategy(e.strategy);\n return { id: e.id, run: (input: PackInput): PackOutput => packWith(e.strategy, input, e.options, seed) };\n });\n const list = typeof members === \"function\" ? (input: PackInput): Member<PackInput, PackOutput>[] => toMembers(members(input)) : toMembers(members);\n // Each level reads the measures of one output, so the measures of an output are computed one time\n const cache = new WeakMap<PackOutput, LayoutMeasures>();\n const measured = (input: PackInput, output: PackOutput): LayoutMeasures => {\n let m = cache.get(output);\n if (m === undefined) {\n // The key reads the measures as a record keeps them, so a replay of the records gives the same pick\n m = roundMeasures(measure(input, output));\n cache.set(output, m);\n }\n return m;\n };\n const key: PortfolioKey<PackInput, PackOutput> = {\n hard: hardBreaks,\n levels: PORTFOLIO_LEVELS.slice(1).map((level) => ({\n id: level.id,\n spec: level.spec,\n value: (input: PackInput, output: PackOutput): number => measured(input, output)[level.id as \"pack.fill\" | \"pack.overflow.excessArea\"],\n })),\n hash: outputHash,\n };\n const limits = {\n ...(options.budgetMs !== undefined ? { budgetMs: options.budgetMs } : {}),\n ...(options.maxMembers !== undefined ? { maxMembers: options.maxMembers } : {}),\n ...(options.now !== undefined ? { now: options.now } : {}),\n };\n const inner = portfolio(options.id ?? PORTFOLIO_STAGE, list, key, limits);\n const pick = (input: PackInput): PortfolioPick<PackOutput> => {\n const got = inner.pick(input);\n const stage = { id: PORTFOLIO_STAGE, measures: { \"move.pick\": pickMoves(got.trace).pick } };\n return { ...got, output: { ...got.output, trace: [...(got.output.trace ?? []), stage] } };\n };\n return { id: inner.id, pick, run: (input: PackInput): PackOutput => pick(input).output };\n}\n","// The strategy `portfolio` of roadmap item k20, part 2 (`docs/PACKER.md`, \"The per-cell portfolio\"). It is a composite\n// strategy: it packs an input with the members of the set of its cell, and it keeps the best output. Nothing default uses it.\n\nimport { maxrects, push, rows, shelf, skyline } from \"./adapters.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { portfolioDefaultMembers, portfolioMembers } from \"./portfolio-cell.ts\";\nimport { PORTFOLIO_SETS } from \"./portfolio-sets.ts\";\nimport { packPortfolio } from \"./portfolio.ts\";\nimport type { PackContext, Strategy, Supports } from \"./strategy.ts\";\n\n/** The options of the strategy `portfolio`. Without options, the output is a function of the input only. */\nexport interface PortfolioStrategyOptions {\n /** The size of the set of the cell: 2 or 3. With `k`, each of the `k` members runs. Without `k`, the strategy uses the set of 3. */\n k?: 2 | 3;\n /** The largest count of the members that run. Without `k` and `maxMembers`, the count is `defaultMembers` of the cell. */\n maxMembers?: number;\n /** The opt-in time limit of `portfolio` of the contract, in milliseconds. It has no default. A cut member makes the result not deterministic. */\n budgetMs?: number;\n}\n\n/** The single strategies that the members of the table use */\nconst SINGLES: readonly Strategy[] = [rows, skyline, shelf, push, maxrects] as Strategy[];\n\n/** This function gives the union of the supports of the strategies of the members of the table. */\nfunction unionSupports(): Supports {\n const used = new Set(Object.values(PORTFOLIO_SETS.entries).map((e) => e.strategy));\n const out: Record<string, string[]> = {};\n for (const s of SINGLES.filter((x) => used.has(x.id))) {\n for (const [dim, values] of Object.entries(s.supports) as [string, string[]][]) {\n const list = (out[dim] ??= []);\n for (const v of values) if (!list.includes(v)) list.push(v);\n }\n }\n return out as unknown as Supports;\n}\n\n/**\n * The strategy `portfolio`: `packPortfolio` with the function form `(input) => portfolioMembers(input, k)`. The seed of the context\n * goes to each member. Its supports are the union of the supports of the members.\n *\n * - Without `k` and `maxMembers`, the members are the set of 3 of the cell, and `maxMembers` is `defaultMembers` of the cell.\n * The default output thus does not depend on the clock.\n * - A member that does not support the cell of an input throws, and it does not win. When each member throws, the strategy throws the first error.\n * - The option `budgetMs` goes to `portfolio` of the contract. The first member always runs.\n * - The strategy throws a `RangeError` for a `k` other than 2 or 3.\n */\nexport const portfolioStrategy: Strategy<PortfolioStrategyOptions> = {\n id: \"portfolio\",\n family: \"portfolio\",\n catalog: [],\n supports: unionSupports(),\n defaults: {},\n deterministic: true,\n pack(input: PackInput, options: PortfolioStrategyOptions, context: PackContext): PackOutput {\n const { k, maxMembers, budgetMs } = options;\n if (k !== undefined && k !== 2 && k !== 3) throw new RangeError(`The option k of the strategy portfolio is 2 or 3, not ${String(k)}.`);\n const size = k ?? 3;\n const count = maxMembers ?? (k === undefined ? portfolioDefaultMembers(input) : undefined);\n const limits = { ...(count === undefined ? {} : { maxMembers: count }), ...(budgetMs === undefined ? {} : { budgetMs }) };\n return packPortfolio((x: PackInput) => portfolioMembers(x, size), { id: k === undefined ? \"portfolio\" : `portfolio-k${k}`, seed: context.seed, ...limits }).run(input);\n },\n};\n","import { maxrects, push, rows, shelf, skyline } from \"./adapters.ts\";\nimport type { PackInput, PackOutput } from \"./contract.ts\";\nimport { portfolioStrategy } from \"./portfolio-strategy.ts\";\nimport { createContext, type Strategy } from \"./strategy.ts\";\n\n/** Each single strategy of the package. The benchmark starts each one on each input of the corpus. */\nexport const strategies: readonly Strategy[] = Object.freeze([rows, skyline, shelf, push, maxrects] as Strategy[]);\n\n/**\n * The composite strategies of the registry: each one packs an input with other strategies. They are not in `strategies`.\n * Since 0.2.7, the list has `portfolio` of roadmap item k20.\n */\nexport const composites: readonly Strategy[] = Object.freeze([portfolioStrategy] as Strategy[]);\n\n/** This function gives the strategy with an id, also a composite strategy. It throws a `RangeError` for an id that the registry does not have. */\nexport function strategy(id: string): Strategy {\n const found = strategies.find((s) => s.id === id) ?? composites.find((s) => s.id === id);\n if (found === undefined) throw new RangeError(`The registry has no strategy \"${id}\".`);\n return found;\n}\n\n/**\n * This function packs an input with the strategy of an id. The options go over the defaults of the strategy. The\n * context gets `mulberry32` with the seed. The default seed is 0.\n */\nexport function packWith(id: string, input: PackInput, options?: unknown, seed = 0): PackOutput {\n const s = strategy(id);\n const merged: unknown = { ...(s.defaults as object), ...(options as object | undefined) };\n return s.pack(input, merged, createContext(seed));\n}\n","// The seeded generators of the corpus (`docs/FORMAT.md`, \"The generators\"). Each generator is a pipeline of 3 steps: the\n// container, then the obstacles, then the boxes. Each step has its own random numbers: `mulberry32` of\n// `fnv1a32(\"<seed>:<step>\")`. Thus a packing input and a routing input with the same seed get the same obstacles.\n\nimport type { Item, LayoutContainer, Obstacle, Region } from \"./contract.ts\";\nimport {\n countCell,\n fnv1a32,\n hashInput,\n round3,\n type CorpusCell,\n type GeneratorParams,\n type GeneratedInput,\n type ObstacleLayout,\n type SizeDistribution,\n} from \"./layout-input.ts\";\nimport { mulberry32, type DimensionValue } from \"./strategy.ts\";\n\n/** The largest count of boxes that a generator makes. */\nconst MAX_COUNT = 100_000;\n\n/** A seeded generator of `layout-input/1` files. The same version, parameters and seed give the same file, byte for byte. */\nexport interface CorpusGenerator<P extends GeneratorParams = GeneratorParams> {\n /** The name. The file writes it in `generator.name`. */\n readonly name: string;\n /** The version. A change of the output of a generator needs a new version. */\n readonly version: number;\n /** The default set of an input, when the call gives no set. */\n readonly set: string;\n /** The default parameters. */\n readonly defaults: Readonly<P>;\n /** For each parameter with a list of values, the values that the generator accepts. */\n readonly values: { readonly [K in keyof P]?: readonly P[K][] };\n /** This method gives the full parameters: the defaults with the given parameters over them. It throws a `RangeError` for a bad parameter. */\n withDefaults(params?: Partial<P>): P;\n /** This method gives the cell of each input of the parameters. The cell does not depend on the seed. */\n cell(params?: Partial<P>): CorpusCell;\n /** This method gives the input file of a seed. The `id` is `<set>/<family>/s<seed>`. */\n generate(seed: number, params?: Partial<P>, set?: string): GeneratedInput;\n}\n\n/** The parts of a file that a generator makes. */\ntype Parts = Pick<GeneratedInput, \"container\" | \"boxes\"> & { obstacles: Obstacle[] };\n\n/** The data of a generator, before `defineGenerator` adds the common steps. */\ninterface GeneratorSpec<P extends GeneratorParams> {\n name: string;\n version: number;\n set: string;\n defaults: P;\n values: { readonly [K in keyof P]?: readonly P[K][] };\n family(params: P): string;\n cell(params: P): CorpusCell;\n build(seed: number, params: P): Parts;\n}\n\n/** A rectangle area in which the obstacles and the sizes of the boxes are made. */\ninterface Frame {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\n/** This function gives the random numbers of one step of a seed. */\nconst stepRandom = (seed: number, step: string): (() => number) => mulberry32(fnv1a32(`${seed}:${step}`));\n\n/** A whole number from lo to hi, both included. */\nconst int = (r: () => number, lo: number, hi: number): number => lo + Math.floor(r() * (hi - lo + 1));\n\n/** A whole number from the floor of lo to the floor of hi, both included. The upper end is not less than the lower end at any time. */\nconst span = (r: () => number, lo: number, hi: number): number => {\n const a = Math.floor(lo);\n return int(r, a, Math.max(a, Math.floor(hi)));\n};\n\n/** A number from lo to hi. */\nconst between = (r: () => number, lo: number, hi: number): number => lo + r() * (hi - lo);\n\n/** This function gives an index with a probability in proportion to its weight. */\nconst pick = (r: () => number, weights: readonly number[]): number => {\n let x = r() * weights.reduce((a, b) => a + b, 0);\n for (const [i, w] of weights.entries()) {\n x -= w;\n if (x < 0) return i;\n }\n return weights.length - 1;\n};\n\n/** This function gives a copy of a value with each number rounded by `round3`. A key with the value `undefined` goes. */\nfunction roundNumbers<T>(value: T): T {\n if (typeof value === \"number\") return round3(value) as T;\n if (Array.isArray(value)) return value.map(roundNumbers) as T;\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) if (v !== undefined) out[k] = roundNumbers(v);\n return out as T;\n }\n return value;\n}\n\n/** This function gives the cell of an input with rectangle items, no rotation, no order and no groups. */\nfunction cellWith(\n containerSize: DimensionValue<\"containerSize\">,\n containerShape: DimensionValue<\"containerShape\">,\n obstacles: ObstacleLayout,\n sizes: SizeDistribution,\n count: number,\n locked = false,\n): CorpusCell {\n const cell: CorpusCell = {\n containerSize,\n containerShape,\n itemShape: \"rect\",\n rotation: \"none\",\n order: \"free\",\n groups: \"none\",\n obstacles,\n sizes,\n count: countCell(count),\n mode: \"offline\",\n };\n if (obstacles !== \"none\" || locked) cell.obstacleMove = \"fixed\";\n return cell;\n}\n\n/** This function makes a generator from its data. It adds the defaults, the checks, the stamp, the rounding and the hash. */\nfunction defineGenerator<P extends GeneratorParams>(spec: GeneratorSpec<P>): CorpusGenerator<P> {\n const withDefaults = (params: Partial<P> = {}): P => {\n const full: GeneratorParams = { ...spec.defaults };\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined) continue;\n if (!(key in spec.defaults)) throw new RangeError(`The generator \"${spec.name}\" has no parameter \"${key}\".`);\n full[key] = value;\n }\n for (const [key, allowed] of Object.entries(spec.values) as [string, readonly (string | number)[] | undefined][]) {\n if (allowed !== undefined && !allowed.includes(full[key]!)) {\n throw new RangeError(`The parameter \"${key}\" of the generator \"${spec.name}\" has no value \"${String(full[key])}\".`);\n }\n }\n const count = full[\"count\"];\n if (count !== undefined && (typeof count !== \"number\" || !Number.isInteger(count) || count < 0 || count > MAX_COUNT)) {\n throw new RangeError(`The parameter \"count\" of the generator \"${spec.name}\" is a whole number from 0 to ${MAX_COUNT}.`);\n }\n return full as P;\n };\n\n return Object.freeze({\n name: spec.name,\n version: spec.version,\n set: spec.set,\n defaults: Object.freeze({ ...spec.defaults }),\n values: spec.values,\n withDefaults,\n cell: (params?: Partial<P>): CorpusCell => spec.cell(withDefaults(params)),\n generate(seed: number, params?: Partial<P>, set: string = spec.set): GeneratedInput {\n if (!Number.isInteger(seed) || seed < 0) throw new RangeError(`The seed is a whole number from 0. It is ${seed}.`);\n const full = withDefaults(params);\n const family = spec.family(full);\n const { container, obstacles, boxes } = spec.build(seed, full);\n const file: Omit<GeneratedInput, \"hash\"> = roundNumbers({\n schema: \"layout-input/1\" as const,\n id: `${set}/${family}/s${seed}`,\n set,\n family,\n seed,\n source: \"made-up\",\n generator: { name: spec.name, version: spec.version, params: full, seed },\n container,\n obstacles,\n boxes,\n edges: [],\n });\n return { ...file, hash: hashInput(file) };\n },\n });\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The shared generator `rect-scattered` (version 1). `docs/FORMAT.md` gives it step by step. Do not change its output.\n\n/** The parameters of `rect-scattered`. */\nexport type RectScatteredParams = { count: number };\n\n/** The shared generator `rect-scattered` of `docs/FORMAT.md`, version 1: rectangle obstacles at random places in a fixed rectangle. */\nexport const rectScattered: CorpusGenerator<RectScatteredParams> = defineGenerator<RectScatteredParams>({\n name: \"rect-scattered\",\n version: 1,\n set: \"xcheck-v1\",\n defaults: { count: 40 },\n values: {},\n family: () => \"rect-scattered\",\n cell: (p) => cellWith(\"fixed\", \"rect\", \"scattered\", \"uniform\", p.count),\n build(seed, { count }) {\n let r = stepRandom(seed, \"container\");\n const w = int(r, 600, 1000);\n const h = int(r, 400, 800);\n const container: LayoutContainer = { w, h, fixed: \"size\" };\n\n r = stepRandom(seed, \"obstacles\");\n const n = int(r, 3, 8);\n const obstacles: Obstacle[] = [];\n for (let i = 0; i < n; i++) {\n const ow = int(r, 40, 160);\n const oh = int(r, 40, 160);\n const x = int(r, 0, w - ow);\n const y = int(r, 0, h - oh);\n obstacles.push({ id: `o${i}`, region: { kind: \"rect\", x, y, w: ow, h: oh } });\n }\n\n r = stepRandom(seed, \"boxes\");\n const boxes: Item[] = [];\n for (let i = 0; i < count; i++) {\n const bw = int(r, 20, 120);\n const bh = int(r, 20, 80);\n boxes.push({ id: `b${i}`, w: bw, h: bh });\n }\n return { container, obstacles, boxes };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The steps of `rect-grid` and of the families of a user interface.\n\n/** The values of `containerSize` that the generators make. */\nconst CONTAINER_SIZES = [\"fixed\", \"freeHeight\", \"freeWidth\", \"freeAspect\", \"freeArea\"] as const;\n/** The values of `containerShape`. */\nconst CONTAINER_SHAPES = [\"rect\", \"convex\", \"polygon\", \"circle\", \"ellipse\", \"holes\"] as const;\n/** The values of `obstacles`. */\nconst OBSTACLE_LAYOUTS = [\"none\", \"center\", \"scattered\", \"wall\", \"corridors\", \"touching\", \"edge\"] as const;\n/** The values of `sizes`. */\nconst SIZE_DISTRIBUTIONS = [\"identical\", \"nearIdentical\", \"uniform\", \"heavyTail\", \"bimodal\", \"extremeAspect\"] as const;\n\n/** This function gives the container of a size value for the nominal rectangle `w` by `h`, with an optional shape. */\nfunction containerOf(size: DimensionValue<\"containerSize\">, w: number, h: number, shape?: Region): LayoutContainer {\n const containers: Record<DimensionValue<\"containerSize\">, LayoutContainer> = {\n fixed: { w, h, fixed: \"size\" },\n freeHeight: { w, fixed: \"width\" },\n freeWidth: { h, fixed: \"height\" },\n freeAspect: { fixed: \"none\", aspect: round3(w / h) },\n freeArea: { fixed: \"none\", aspectWeight: 0 },\n };\n const container = containers[size];\n return shape === undefined ? container : { ...container, shape };\n}\n\n/** This function gives the 4 corners of a rectangle, clockwise from the top left. */\nconst corners = (x: number, y: number, w: number, h: number): [number, number][] => [\n [x, y],\n [x + w, y],\n [x + w, y + h],\n [x, y + h],\n];\n\n/**\n * This function gives the shape of a container in the rectangle `w` by `h`, and its frame. The frame is a rectangle in\n * the shape. The obstacles and the sizes of the boxes come from the frame.\n */\nfunction shapeOf(r: () => number, shape: DimensionValue<\"containerShape\">, w: number, h: number): { region?: Region; frame: Frame } {\n const m = Math.min(w, h);\n switch (shape) {\n case \"rect\":\n return { frame: { x: 0, y: 0, w, h } };\n case \"convex\": {\n // A rectangle with its 4 corners cut at 45 degrees\n const [a, b, c, d] = [0, 1, 2, 3].map(() => span(r, m * 0.1, m * 0.25)) as [number, number, number, number];\n const points: [number, number][] = [[a, 0], [w - b, 0], [w, b], [w, h - c], [w - c, h], [d, h], [0, h - d], [0, a]];\n const top = Math.max(a, b);\n const bottom = Math.max(c, d);\n return { region: { kind: \"polygon\", points }, frame: { x: 0, y: top, w, h: h - top - bottom } };\n }\n case \"polygon\": {\n // A rectangle with a notch at the bottom right: an L shape\n const nw = span(r, w * 0.25, w * 0.45);\n const nh = span(r, h * 0.25, h * 0.45);\n const points: [number, number][] = [[0, 0], [w, 0], [w, h - nh], [w - nw, h - nh], [w - nw, h], [0, h]];\n return { region: { kind: \"polygon\", points }, frame: { x: 0, y: 0, w: w - nw, h } };\n }\n case \"circle\": {\n const cx = Math.floor(w / 2);\n const cy = Math.floor(h / 2);\n const radius = Math.min(cx, cy);\n const side = 2 * Math.floor((radius * Math.SQRT2 - 1) / 2);\n return { region: { kind: \"circle\", cx, cy, r: radius }, frame: { x: cx - side / 2, y: cy - side / 2, w: side, h: side } };\n }\n case \"ellipse\": {\n const rx = Math.floor(w / 2);\n const ry = Math.floor(h / 2);\n const a = Math.floor(rx / Math.SQRT2);\n const b = Math.floor(ry / Math.SQRT2);\n return { region: { kind: \"ellipse\", cx: rx, cy: ry, rx, ry }, frame: { x: rx - a, y: ry - b, w: 2 * a, h: 2 * b } };\n }\n case \"holes\": {\n // 1 or 2 rectangle holes, the first in the left half and the second in the right half\n const count = int(r, 1, 2);\n const holes: [number, number][][] = [];\n for (let i = 0; i < count; i++) {\n const hw = span(r, w * 0.08, w * 0.15);\n const hh = span(r, h * 0.1, h * 0.25);\n const x = i === 0 ? span(r, 20, w / 2 - hw - 10) : span(r, w / 2 + 10, w - hw - 20);\n const y = span(r, 20, h - hh - 20);\n holes.push(corners(x, y, hw, hh));\n }\n return { region: { kind: \"polygon\", points: corners(0, 0, w, h), holes }, frame: { x: 0, y: 0, w, h } };\n }\n }\n}\n\n/** This function gives the obstacles of a layout in a frame. Each obstacle is a rectangle with whole-number sides. */\nfunction obstaclesOf(r: () => number, layout: ObstacleLayout, f: Frame): Obstacle[] {\n const m = Math.min(f.w, f.h);\n const rects: { x: number; y: number; w: number; h: number }[] = [];\n switch (layout) {\n case \"none\":\n break;\n case \"center\": {\n const w = span(r, f.w * 0.15, f.w * 0.3);\n const h = span(r, f.h * 0.15, f.h * 0.3);\n const jx = Math.floor(f.w * 0.05);\n const jy = Math.floor(f.h * 0.05);\n rects.push({ x: f.x + Math.floor((f.w - w) / 2) + int(r, -jx, jx), y: f.y + Math.floor((f.h - h) / 2) + int(r, -jy, jy), w, h });\n break;\n }\n case \"scattered\": {\n const n = int(r, 3, 8);\n for (let i = 0; i < n; i++) {\n const w = span(r, m * 0.05, m * 0.2);\n const h = span(r, m * 0.05, m * 0.2);\n rects.push({ x: int(r, f.x, f.x + f.w - w), y: int(r, f.y, f.y + f.h - h), w, h });\n }\n break;\n }\n case \"wall\": {\n // One long, thin obstacle from one side. It leaves a gap at its other end.\n const vertical = r() < 0.5;\n const across = vertical ? f.w : f.h;\n const along = vertical ? f.h : f.w;\n const thick = span(r, Math.max(1, across * 0.03), Math.max(1, across * 0.06));\n const length = span(r, along * 0.7, along * 0.85);\n const at = span(r, across * 0.3, across * 0.7 - thick);\n const from = r() < 0.5 ? 0 : along - length;\n rects.push(vertical ? { x: f.x + at, y: f.y + from, w: thick, h: length } : { x: f.x + from, y: f.y + at, w: length, h: thick });\n break;\n }\n case \"corridors\": {\n // A grid of blocks, with a narrow path between two blocks and between a block and the border\n const cols = int(r, 2, 4);\n const rows = int(r, 2, 3);\n const path = span(r, m * 0.08, m * 0.15);\n const bw = Math.floor((f.w - (cols + 1) * path) / cols);\n const bh = Math.floor((f.h - (rows + 1) * path) / rows);\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) rects.push({ x: f.x + path + i * (bw + path), y: f.y + path + j * (bh + path), w: bw, h: bh });\n }\n break;\n }\n case \"touching\": {\n // A chain: each obstacle shares a part of a side with the obstacle before it\n const n = int(r, 2, 4);\n let w = span(r, m * 0.08, m * 0.15);\n let h = span(r, m * 0.08, m * 0.15);\n let x = span(r, f.x + f.w * 0.15, f.x + f.w * 0.35);\n let y = span(r, f.y + f.h * 0.15, f.y + f.h * 0.35);\n rects.push({ x, y, w, h });\n for (let i = 1; i < n; i++) {\n const right = r() < 0.5;\n const nw = span(r, m * 0.08, m * 0.15);\n const nh = span(r, m * 0.08, m * 0.15);\n if (right) {\n y = int(r, y, y + Math.floor(h / 2));\n x += w;\n } else {\n x = int(r, x, x + Math.floor(w / 2));\n y += h;\n }\n w = nw;\n h = nh;\n rects.push({ x, y, w, h });\n }\n break;\n }\n case \"edge\": {\n // Each obstacle touches one side of the frame\n const n = int(r, 2, 5);\n for (let i = 0; i < n; i++) {\n const side = int(r, 0, 3);\n const w = span(r, m * 0.06, m * 0.15);\n const h = span(r, m * 0.06, m * 0.15);\n const x = side === 1 ? f.x + f.w - w : side === 3 ? f.x : int(r, f.x, f.x + f.w - w);\n const y = side === 0 ? f.y : side === 2 ? f.y + f.h - h : int(r, f.y, f.y + f.h - h);\n rects.push({ x, y, w, h });\n }\n break;\n }\n }\n return rects.map((rect, i) => ({ id: `o${i}`, region: { kind: \"rect\", ...rect } }));\n}\n\n/**\n * This function gives the boxes of a size distribution for a frame. The mean box has an area of 40 percent of the\n * frame divided by the count. No box is wider or higher than the frame.\n */\nfunction boxesOf(r: () => number, sizes: SizeDistribution, count: number, f: Frame): Item[] {\n const unit = Math.sqrt((f.w * f.h * 0.4) / Math.max(count, 1));\n const fit = (x: number, max: number): number => Math.min(Math.max(round3(x), 0.01), max);\n const boxes: Item[] = new Array<Item>(count);\n const put = (i: number, w: number, h: number): void => {\n boxes[i] = { id: `b${i}`, w: fit(w, f.w), h: fit(h, f.h) };\n };\n switch (sizes) {\n case \"identical\":\n case \"nearIdentical\": {\n const aspect = Math.sqrt(between(r, 0.6, 1.6));\n const bw = unit * aspect;\n const bh = unit / aspect;\n for (let i = 0; i < count; i++) {\n if (sizes === \"identical\") put(i, bw, bh);\n else put(i, bw * (1 + between(r, -0.03, 0.03)), bh * (1 + between(r, -0.03, 0.03)));\n }\n break;\n }\n case \"uniform\":\n for (let i = 0; i < count; i++) put(i, unit * between(r, 0.5, 1.5), unit * between(r, 0.5, 1.5));\n break;\n case \"heavyTail\": {\n // A Pareto distribution with the index 1.6, cut at 60 percent of the frame\n const cap = 0.6 * Math.min(f.w, f.h);\n for (let i = 0; i < count; i++) {\n const s = Math.min(0.6 * unit * (1 - r()) ** (-1 / 1.6), cap);\n put(i, s * between(r, 0.75, 1.33), s * between(r, 0.75, 1.33));\n }\n break;\n }\n case \"bimodal\":\n for (let i = 0; i < count; i++) {\n const s = r() < 0.25 ? 1.8 * unit : 0.6 * unit;\n put(i, s * between(r, 0.85, 1.15), s * between(r, 0.85, 1.15));\n }\n break;\n case \"extremeAspect\":\n for (let i = 0; i < count; i++) {\n const long = unit * between(r, 2.5, 4);\n const short = unit * between(r, 0.15, 0.35);\n if (r() < 0.5) put(i, long, short);\n else put(i, short, long);\n }\n break;\n }\n return boxes;\n}\n\n// ---------------------------------------------------------------------------------------------------------------------\n// `rect-grid`: one input for each point of the grid of the packer dimensions.\n\n/** The parameters of `rect-grid`: one value for each dimension of the taxonomy that it covers. */\nexport type RectGridParams = {\n containerSize: DimensionValue<\"containerSize\">;\n containerShape: DimensionValue<\"containerShape\">;\n obstacles: ObstacleLayout;\n sizes: SizeDistribution;\n count: number;\n};\n\n/**\n * The generator `rect-grid`, version 1: rectangle boxes for each value of `containerSize`, `containerShape`, `obstacles`\n * and `sizes`, with each count. The container is a nominal rectangle of 600 to 1000 by 400 to 800.\n */\nexport const rectGrid: CorpusGenerator<RectGridParams> = defineGenerator<RectGridParams>({\n name: \"rect-grid\",\n version: 1,\n set: \"corpus-v1\",\n defaults: { containerSize: \"fixed\", containerShape: \"rect\", obstacles: \"none\", sizes: \"uniform\", count: 100 },\n values: { containerSize: CONTAINER_SIZES, containerShape: CONTAINER_SHAPES, obstacles: OBSTACLE_LAYOUTS, sizes: SIZE_DISTRIBUTIONS },\n family: (p) => `rect-grid.${p.containerSize}.${p.containerShape}.${p.obstacles}.${p.sizes}.n${p.count}`,\n cell: (p) => cellWith(p.containerSize, p.containerShape, p.obstacles, p.sizes, p.count),\n build(seed, p) {\n let r = stepRandom(seed, \"container\");\n const w = int(r, 600, 1000);\n const h = int(r, 400, 800);\n const { region, frame } = shapeOf(r, p.containerShape, w, h);\n const container = containerOf(p.containerSize, w, h, region);\n\n r = stepRandom(seed, \"obstacles\");\n const obstacles = obstaclesOf(r, p.obstacles, frame);\n\n r = stepRandom(seed, \"boxes\");\n return { container, obstacles, boxes: boxesOf(r, p.sizes, p.count, frame) };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n// The families of a user interface: gallery, dashboard, cards and word cloud.\n\n/** The parameters of a family of a user interface. */\nexport type UiParams = {\n containerSize: DimensionValue<\"containerSize\">;\n count: number;\n};\n\n/** This function makes the generator of a family of a user interface. The container is 800 to 1400 by 600 to 1000, with no obstacle. */\nfunction uiGenerator(name: string, sizes: SizeDistribution, count: number, boxes: (r: () => number, count: number) => Item[]): CorpusGenerator<UiParams> {\n return defineGenerator<UiParams>({\n name,\n version: 1,\n set: \"corpus-v1\",\n defaults: { containerSize: \"freeHeight\", count },\n values: { containerSize: CONTAINER_SIZES },\n family: (p) => `${name}.${p.containerSize}.n${p.count}`,\n cell: (p) => cellWith(p.containerSize, \"rect\", \"none\", sizes, p.count),\n build(seed, p) {\n const r = stepRandom(seed, \"container\");\n const w = int(r, 800, 1400);\n const h = int(r, 600, 1000);\n return { container: containerOf(p.containerSize, w, h), obstacles: [], boxes: boxes(stepRandom(seed, \"boxes\"), p.count) };\n },\n });\n}\n\n/** The aspects of the thumbnails of a gallery. */\nconst THUMBNAIL_ASPECTS = [1, 4 / 3, 3 / 2, 16 / 9];\n\n/** The generator `gallery`, version 1: thumbnails with one size and one aspect (1, 4:3, 3:2 or 16:9). The default container has a fixed width. */\nexport const gallery: CorpusGenerator<UiParams> = uiGenerator(\"gallery\", \"identical\", 100, (r, count) => {\n const aspect = THUMBNAIL_ASPECTS[int(r, 0, THUMBNAIL_ASPECTS.length - 1)]!;\n const w = int(r, 120, 240);\n return Array.from({ length: count }, (_, i) => ({ id: `b${i}`, w, h: round3(w / aspect) }));\n});\n\n/** The spans of the dashboard tiles in grid units, and their weights. */\nconst TILE_SPANS: readonly [number, number][] = [[1, 1], [2, 1], [1, 2], [2, 2], [3, 2], [4, 2]];\nconst TILE_WEIGHTS = [4, 3, 2, 3, 1, 1];\n\n/** The generator `dashboard`, version 1: tiles in 6 standard sizes, from 1 by 1 to 4 by 2 grid units of 60 to 100. */\nexport const dashboard: CorpusGenerator<UiParams> = uiGenerator(\"dashboard\", \"bimodal\", 10, (r, count) => {\n const unit = int(r, 60, 100);\n return Array.from({ length: count }, (_, i) => {\n const [cw, ch] = TILE_SPANS[pick(r, TILE_WEIGHTS)]!;\n return { id: `b${i}`, w: cw * unit, h: ch * unit };\n });\n});\n\n/** The generator `cards`, version 1: cards with one width from 200 to 320, and a height from 120 to 420 each. */\nexport const cards: CorpusGenerator<UiParams> = uiGenerator(\"cards\", \"uniform\", 100, (r, count) => {\n const w = int(r, 200, 320);\n return Array.from({ length: count }, (_, i) => ({ id: `b${i}`, w, h: int(r, 120, 420) }));\n});\n\n/** The font sizes of a word cloud, and their weights: many small words and few large words. */\nconst FONT_SIZES = [12, 14, 16, 20, 28, 40];\nconst FONT_WEIGHTS = [30, 25, 20, 12, 8, 5];\n\n/** The generator `word-cloud`, version 1: boxes of text. The height comes from 6 font sizes, the width from 3 to 12 letters. */\nexport const wordCloud: CorpusGenerator<UiParams> = uiGenerator(\"word-cloud\", \"heavyTail\", 100, (r, count) =>\n Array.from({ length: count }, (_, i) => {\n const font = FONT_SIZES[pick(r, FONT_WEIGHTS)]!;\n const letters = int(r, 3, 12);\n return { id: `b${i}`, w: round3(letters * font * 0.6), h: round3(font * 1.25) };\n }),\n);\n\n// ---------------------------------------------------------------------------------------------------------------------\n// `edge-cases`: the inputs at the limits.\n\n/** The cases of `edge-cases`. */\nexport type EdgeCase = \"empty\" | \"one\" | \"oversize\" | \"exactTiling\" | \"touchObstacles\";\n\n/** The parameters of `edge-cases`. The cases `empty` and `one` ignore `count`. */\nexport type EdgeCaseParams = { case: EdgeCase; count: number };\n\n/** The values of `case`. */\nconst EDGE_CASES = [\"empty\", \"one\", \"oversize\", \"exactTiling\", \"touchObstacles\"] as const;\n\n/** This function gives the largest divisor of `n` that is not more than the square root of `n`. */\nconst rowsOf = (n: number): number => {\n for (let d = Math.floor(Math.sqrt(n)); d > 1; d--) if (n % d === 0) return d;\n return 1;\n};\n\n/**\n * The generator `edge-cases`, version 1. Each case has a fixed rectangle container.\n *\n * - `empty`: no box.\n * - `one`: one box.\n * - `oversize`: `count` boxes. One box is wider than the container.\n * - `exactTiling`: `count` identical boxes that fill the container with no free space.\n * - `touchObstacles`: a locked box on the top of an obstacle, and boxes as wide as the path between 2 obstacles.\n */\nexport const edgeCases: CorpusGenerator<EdgeCaseParams> = defineGenerator<EdgeCaseParams>({\n name: \"edge-cases\",\n version: 1,\n set: \"corpus-v1\",\n defaults: { case: \"oversize\", count: 12 },\n values: { case: EDGE_CASES },\n family: (p) => (p.case === \"empty\" || p.case === \"one\" ? `edge-cases.${p.case}` : `edge-cases.${p.case}.n${p.count}`),\n cell: (p) => {\n switch (p.case) {\n case \"empty\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", 0);\n case \"one\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", 1);\n case \"oversize\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"heavyTail\", p.count);\n case \"exactTiling\":\n return cellWith(\"fixed\", \"rect\", \"none\", \"identical\", p.count);\n case \"touchObstacles\":\n return cellWith(\"fixed\", \"rect\", \"corridors\", \"uniform\", p.count, true);\n }\n },\n build(seed, p) {\n const needsBoxes = p.case === \"oversize\" || p.case === \"exactTiling\" || p.case === \"touchObstacles\";\n if (needsBoxes && p.count < 1) throw new RangeError(`The case \"${p.case}\" of \"edge-cases\" needs a count of 1 or more.`);\n\n let r = stepRandom(seed, \"container\");\n let w: number;\n let h: number;\n let tile = { w: 0, h: 0, cols: 0, rows: 0 };\n if (p.case === \"exactTiling\") {\n // The container step also picks the size of the tile, because the tiles give the size of the container\n const rows = rowsOf(p.count);\n tile = { w: int(r, 40, 120), h: int(r, 30, 90), cols: p.count / rows, rows };\n w = tile.cols * tile.w;\n h = tile.rows * tile.h;\n } else {\n w = int(r, 600, 1000);\n h = int(r, 400, 800);\n }\n const container: LayoutContainer = { w, h, fixed: \"size\" };\n\n r = stepRandom(seed, \"obstacles\");\n const obstacles: Obstacle[] = [];\n let path = 0;\n let first = { x: 0, y: 0 };\n if (p.case === \"touchObstacles\") {\n path = int(r, 40, 100);\n const ow = int(r, 60, 150);\n const oh = int(r, 100, 200);\n first = { x: span(r, w * 0.1, w * 0.25), y: span(r, h * 0.2, h * 0.4) };\n obstacles.push({ id: \"o0\", region: { kind: \"rect\", x: first.x, y: first.y, w: ow, h: oh } });\n obstacles.push({ id: \"o1\", region: { kind: \"rect\", x: first.x + ow + path, y: first.y, w: int(r, 60, 150), h: oh } });\n }\n\n r = stepRandom(seed, \"boxes\");\n const boxes: Item[] = [];\n switch (p.case) {\n case \"empty\":\n break;\n case \"one\":\n boxes.push({ id: \"b0\", w: int(r, 40, 200), h: int(r, 30, 150) });\n break;\n case \"oversize\": {\n const big = int(r, 0, p.count - 1);\n for (let i = 0; i < p.count; i++) {\n if (i === big) boxes.push({ id: `b${i}`, w: w + int(r, 10, 200), h: int(r, 40, 100) });\n else boxes.push({ id: `b${i}`, w: int(r, 20, 120), h: int(r, 20, 80) });\n }\n break;\n }\n case \"exactTiling\":\n for (let i = 0; i < p.count; i++) boxes.push({ id: `b${i}`, w: tile.w, h: tile.h });\n break;\n case \"touchObstacles\": {\n const lw = int(r, 30, 80);\n const lh = int(r, 20, 60);\n boxes.push({ id: \"b0\", w: lw, h: lh, x: first.x, y: first.y - lh, locked: true });\n for (let i = 1; i < p.count; i++) boxes.push({ id: `b${i}`, w: path, h: int(r, 20, 80) });\n break;\n }\n }\n return { container, obstacles, boxes };\n },\n});\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/** Each generator of the package. */\nexport const generators: readonly CorpusGenerator[] = Object.freeze([rectScattered, rectGrid, gallery, dashboard, cards, wordCloud, edgeCases] as CorpusGenerator[]);\n\n/** This function gives the generator with a name. It throws a `RangeError` for a name that the package does not have. */\nexport function generator(name: string): CorpusGenerator {\n const found = generators.find((g) => g.name === name);\n if (found === undefined) throw new RangeError(`The package has no generator \"${name}\".`);\n return found;\n}\n","// The manifest of a corpus: `layout-corpus/1` of `docs/FORMAT.md`.\n\nimport { generator } from \"./generators.ts\";\nimport type { CorpusCell, GeneratedInput, GeneratorParams } from \"./layout-input.ts\";\n\n/** One spec of a corpus: a generator, its parameters and its seeds. */\nexport interface CorpusSpec {\n /** The name of the generator. */\n generator: string;\n /** The version of the generator. Without it, the spec uses the version of the package. A different version is an error. */\n version?: number;\n /** The parameters over the defaults of the generator. */\n params?: GeneratorParams;\n seeds: readonly number[];\n}\n\n/** One input in the index of a manifest. */\nexport interface CorpusEntry {\n id: string;\n hash: string;\n cell: CorpusCell;\n}\n\n/** The manifest `corpus.json` of a corpus. */\nexport interface CorpusManifest {\n schema: \"layout-corpus/1\";\n /** The name of the corpus. Each input has it in `set`. */\n corpus: string;\n /** The specs, each with its version and its full parameters. */\n specs: { generator: string; version: number; params: GeneratorParams; seeds: number[] }[];\n inputs: CorpusEntry[];\n}\n\n/** A corpus: the manifest and the input files, in the order of the specs and the seeds. */\nexport interface Corpus {\n manifest: CorpusManifest;\n inputs: GeneratedInput[];\n}\n\n/**\n * This function generates a corpus from specs. Each input gets the name of the corpus as its set. The function throws a\n * `RangeError` for an unknown generator, a different version or 2 inputs with the same id.\n */\nexport function corpus(name: string, specs: readonly CorpusSpec[]): Corpus {\n const manifest: CorpusManifest = { schema: \"layout-corpus/1\", corpus: name, specs: [], inputs: [] };\n const inputs: GeneratedInput[] = [];\n const ids = new Set<string>();\n for (const spec of specs) {\n const gen = generator(spec.generator);\n if (spec.version !== undefined && spec.version !== gen.version) {\n throw new RangeError(`The generator \"${gen.name}\" has the version ${gen.version}, not ${spec.version}.`);\n }\n const params = gen.withDefaults(spec.params);\n const cell = gen.cell(params);\n manifest.specs.push({ generator: gen.name, version: gen.version, params, seeds: [...spec.seeds] });\n for (const seed of spec.seeds) {\n const file = gen.generate(seed, params, name);\n if (ids.has(file.id)) throw new RangeError(`The corpus has 2 inputs with the id \"${file.id}\".`);\n ids.add(file.id);\n inputs.push(file);\n manifest.inputs.push({ id: file.id, hash: file.hash, cell });\n }\n }\n return { manifest, inputs };\n}\n"],"mappings":";;;AACA,IAAa,SAAb,MAAa,OAAO;CAClB;CACA;CAEA,YAAY,IAAI,GAAG,IAAI,GAAG;EACxB,KAAK,KAAK;EACV,KAAK,KAAK;CACZ;;CAGA,IAAI,IAAY;EAAE,OAAO,KAAK;CAAI;CAClC,IAAI,EAAE,GAAW;EAAE,KAAK,KAAK;CAAG;;CAEhC,IAAI,IAAY;EAAE,OAAO,KAAK;CAAI;CAClC,IAAI,EAAE,GAAW;EAAE,KAAK,KAAK;CAAG;;CAGhC,IAAI,GAAW,GAAiB;EAC9B,KAAK,KAAK;EACV,KAAK,KAAK;CACZ;;CAGA,MAAM,G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ACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,WAAW;GACT,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,YACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,QAAQ;GACN,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,YACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;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IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,sBAAsB;GACpB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK,CACH,eACA,aACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;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AK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,yBAAyB;GACvB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,SACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,eACF;IACA,KAAK,CACH,iBACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,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,yBAAyB;GACvB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,aACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,uBAAuB;GACrB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,eACA,eACF;IACA,KAAK;KACH;KACA;KACA;IACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;IACA,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ,UAAU;IACZ;GACF;GACA,kBAAkB;IAChB,KAAK;IACL,KAAK;IACL,KAAK;GACP;GACA,kBAAkB;EACpB;EACA,wBAAwB;GACtB,UAAU;GACV,QAAQ;GACR,QAAQ;IACN,KAAK,CACH,aACF;IACA,KAAK,CACH,aACF;IACA,KAAK,CACH,aACF;GACF;GACA,SAAS;IACP,KAAK;KACH,UAAU;KACV,cAAc;KACd,oBAAoB;KACpB,cAAc;KACd,QAAQ;KACR,YAAY;KACZ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