@mark1russell7/vex-domains 0.19.1 → 0.20.1

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/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @mark1russell7/vex @mark1russell7/vex-domains
20
20
  | `NDVectorDomain` | `NDVector`: a vector with named components | `add`, `subtract`, `min`, `max`, `scale`, `dot`, `get` |
21
21
  | `NumDomain` | numbers | `add`, `multiply`, `min`, `max`, `sqrt`, `floor`, `gt`, `vec2`, `xy`, `insets`, `date` |
22
22
  | `BoolDomain` | booleans | `and`, `or`, `xor`, `not` |
23
- | `TextDomain` | texts | `concat`, `length`, `codePoints`, `upper`, `lower`, `trim`, `contains` |
23
+ | `TextDomain` | texts | `concat`, `length`, `codePoints`, `epochMillis`, `upper`, `lower`, `trim`, `contains` |
24
24
  | `JsonDomain` | JSON data: texts, numbers, booleans, arrays and plain objects. Put it last. | `kind`, `kinds`, `fields`, `field`, `leaves` |
25
25
  | `ColorDomain` | `Color`: an RGB color | `mix`, `add`, `multiply`, `luminance`, `relativeLuminance`, `contrast` |
26
26
  | `AngleDomain` | `Angle`: an angle | `add`, `normalize`, `sin`, `cos`, `degrees` |
package/build/index.d.ts CHANGED
@@ -365,6 +365,7 @@ export type TextOps = {
365
365
  readonly concat: FnOp<string, (a: string, b: unknown) => string>;
366
366
  readonly length: FnOp<string, (a: string) => number>;
367
367
  readonly codePoints: FnOp<string, (a: string) => VexList<number>>;
368
+ readonly epochMillis: FnOp<string, (a: string) => number>;
368
369
  readonly upper: FnOp<string, TextFn1>;
369
370
  readonly lower: FnOp<string, TextFn1>;
370
371
  readonly trim: FnOp<string, TextFn1>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/vec2.ts","../src/xy.ts","../src/insets.ts","../src/ndvector.ts","../src/date.ts","../src/scalars.ts","../src/text.ts","../src/color.ts","../src/angle.ts","../src/json.ts","../src/schema.ts","../src/wrappers.ts"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":3,"file":"index.d.ts","names":[],"sources":["../src/vec2.ts","../src/xy.ts","../src/insets.ts","../src/ndvector.ts","../src/date.ts","../src/scalars.ts","../src/text.ts","../src/color.ts","../src/angle.ts","../src/json.ts","../src/schema.ts","../src/wrappers.ts"],"mappings":";;;;;;;;;;qBAOa;WACF;WACA;EAET,YAAY,WAAW;;SAMhB,GAAG,WAAW,YAAY;;SAI1B,OAAO,YAAY;;kBAIV,MAAM;;kBAEN,KAAK;EAErB,IAAI,GAAG,OAAO;EAGd,SAAS,GAAG,OAAO;;EAInB,SAAS,GAAG,OAAO;;EAInB,OAAO,GAAG,OAAO;;EAIjB,IAAI,GAAG,OAAO;;EAId,IAAI,GAAG,OAAO;EAGd,MAAM,YAAY;EAGlB,UAAU;EAGV,SAAS;EAGT,OAAO;;EAIP,QAAQ;EAGR,SAAS;EAGT,SAAS;EAGT,QAAQ;EAGR,MAAM,YAAY,aAAa;EAG/B,QAAQ;;;;;EAOR,QAAQ,cAAc,gBAAgB;;;;;EAOtC,OAAO,GAAG,MAAM,GAAG,OAAO;;EAI1B,OAAO,kBAAkB;;EAMzB,aAAa;;;;;EAQb,WAAW;;EAKX,KAAK,GAAG,MAAM,YAAY;EAG1B;EAGA;EAGA,SAAS,GAAG;EAGZ,IAAI,GAAG;;EAIP,MAAM,KAAK;;EAIX,OAAO,KAAK;;EAIZ,MAAM,GAAG;;EAIT;;EAIA;;EAIA;EAGA;EAGA;EAGA,OAAO,GAAG;EAGV;EAGA;EAGA;EAGA;EAGA;EAGA;EAGA,YAAY;EAGZ,YAAY;EAGZ,eAAe;EAGf,eAAe;EAGf;aAAqB;aAAoB;;EAGzC;;KAKG;;YAQO,UAAU,QAAQ,MAAM;WACzB,GAAG,KAAK,OAAO,GAAG;WAClB,GAAG,KAAK,OAAO,GAAG;;;qBAIhB,YAAY,eAAe,MAAM;;;;;iBClN7B;WACN;WACA;;KAGN,SAAS,GAAG,IAAI,GAAG,OAAO;KAC1B,SAAS,GAAG,OAAO;KACn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,MAAM,IAAI,MAAM;EAGlC,MAAM,GAAG,IAAI,OAAO,MAAM,MAAM,KAAK,MAAM;EAG3C,QAAQ,GAAG,UAAU,IAAI,IAAI;;;YAMnB,WAAW,QAAQ;;qBAGlB,aAAa,gBAAgB,gBAAgB"}
package/build/index.js CHANGED
@@ -1655,6 +1655,43 @@ const TextDomain = defineDomain({
1655
1655
  keys: "position"
1656
1656
  }
1657
1657
  },
1658
+ epochMillis: {
1659
+ fn: (a) => {
1660
+ const m = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):(\d{2})))?$/.exec(a);
1661
+ if (m === null) throw new Error("\"epochMillis\" needs an ISO 8601 text, for example 2026-03-01 or 2026-03-01T12:30:00Z");
1662
+ const n = (i) => Number(m[i] ?? "0");
1663
+ const [y, mo, d, h, mi, s, oh, om] = [
1664
+ n(1),
1665
+ n(2),
1666
+ n(3),
1667
+ n(4),
1668
+ n(5),
1669
+ n(6),
1670
+ n(10),
1671
+ n(11)
1672
+ ];
1673
+ const last = [
1674
+ 31,
1675
+ y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0) ? 29 : 28,
1676
+ 31,
1677
+ 30,
1678
+ 31,
1679
+ 30,
1680
+ 31,
1681
+ 31,
1682
+ 30,
1683
+ 31,
1684
+ 30,
1685
+ 31
1686
+ ][mo - 1] ?? 0;
1687
+ if (d < 1 || d > last || h > 23 || mi > 59 || s > 59 || oh > 23 || om > 59) throw new Error("\"epochMillis\" found a day or a time that does not exist");
1688
+ const ms = Number((m[7] ?? "").padEnd(3, "0").slice(0, 3));
1689
+ const offset = (m[9] === "-" ? -1 : 1) * (oh * 60 + om) * 6e4;
1690
+ return Date.UTC(y + 400, mo - 1, d, h, mi, s, ms) - 0xb7af85d9c00 - offset;
1691
+ },
1692
+ params: [],
1693
+ returns: "number"
1694
+ },
1658
1695
  upper: {
1659
1696
  fn: (a) => a.toUpperCase(),
1660
1697
  returns: "string",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/vec2-form.ts","../src/vec2.ts","../src/xy.ts","../src/insets.ts","../src/ndvector.ts","../src/date.ts","../src/scalars.ts","../src/text.ts","../src/color.ts","../src/angle.ts","../src/json.ts","../src/schema.ts","../src/wrappers.ts"],"sourcesContent":["import type { ModuleForm } from \"@mark1russell7/vex\";\n\n/** A 2D vector in a standalone module: plain data with the fields of `Vec2`. */\ninterface Plain {\n readonly x: number;\n readonly y: number;\n}\n\n/**\n * The form of `Vec2Domain` in a standalone module (COMPILE.MODULE.FORM). A module has no import, and a copy of the class\n * is another class. Thus a vector in a module is plain data, the data of `toJSON` of a `Vec2`. Each op has the arithmetic\n * of the method with its name, so it has the same bits. The test accepts a `Vec2` too, so a host can give its vectors.\n */\nexport const VEC2_FORM: ModuleForm = {\n is: (u: unknown): boolean => typeof u === \"object\" && u !== null && typeof (u as Plain).x === \"number\" && typeof (u as Plain).y === \"number\",\n fromScalar: (n: number): Plain => ({ x: n, y: n }),\n samples: (): readonly Plain[] => [{ x: 0, y: 0 }, { x: 1.5, y: -2 }, { x: 3, y: 4 }],\n ops: {\n add: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x + b.x, y: a.y + b.y }), identity: (): Plain => ({ x: 0, y: 0 }) },\n subtract: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x - b.x, y: a.y - b.y }) },\n multiply: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x * b.x, y: a.y * b.y }), identity: (): Plain => ({ x: 1, y: 1 }) },\n divide: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x / b.x, y: a.y / b.y }) },\n min: { fn: (a: Plain, b: Plain): Plain => ({ x: Math.min(a.x, b.x), y: Math.min(a.y, b.y) }) },\n max: { fn: (a: Plain, b: Plain): Plain => ({ x: Math.max(a.x, b.x), y: Math.max(a.y, b.y) }) },\n scale: { fn: (a: Plain, k: number): Plain => ({ x: a.x * k, y: a.y * k }) },\n negate: { fn: (a: Plain): Plain => ({ x: -a.x, y: -a.y }) },\n halve: { fn: (a: Plain): Plain => ({ x: a.x * 0.5, y: a.y * 0.5 }) },\n abs: { fn: (a: Plain): Plain => ({ x: Math.abs(a.x), y: Math.abs(a.y) }) },\n sign: { fn: (a: Plain): Plain => ({ x: Math.sign(a.x), y: Math.sign(a.y) }) },\n round: { fn: (a: Plain): Plain => ({ x: Math.round(a.x), y: Math.round(a.y) }) },\n floor: { fn: (a: Plain): Plain => ({ x: Math.floor(a.x), y: Math.floor(a.y) }) },\n ceil: { fn: (a: Plain): Plain => ({ x: Math.ceil(a.x), y: Math.ceil(a.y) }) },\n clamp: { fn: (a: Plain, lo: number, hi: number): Plain => ({ x: Math.min(hi, Math.max(lo, a.x)), y: Math.min(hi, Math.max(lo, a.y)) }) },\n swap: { fn: (a: Plain): Plain => ({ x: a.y, y: a.x }) },\n compose: { fn: (a: Plain, main: number, cross: number): Plain => ({ x: a.x * main + a.y * cross, y: a.y * main + a.x * cross }) },\n select: { fn: (m: Plain, a: Plain, b: Plain): Plain => ({ x: m.x !== 0 ? a.x : b.x, y: m.y !== 0 ? a.y : b.y }) },\n rotate: {\n fn: (a: Plain, radians: number): Plain => {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n return { x: c * a.x - s * a.y, y: s * a.x + c * a.y };\n },\n },\n normalize: {\n fn: (a: Plain): Plain => {\n const len = Math.hypot(a.x, a.y);\n return len === 0 ? { x: a.x, y: a.y } : { x: a.x * (1 / len), y: a.y * (1 / len) };\n },\n },\n minAxis: { fn: (a: Plain): Plain => (Number.isNaN(a.x) || Number.isNaN(a.y) ? { x: Number.NaN, y: Number.NaN } : a.x <= a.y ? { x: 1, y: 0 } : { x: 0, y: 1 }) },\n lerp: { fn: (a: Plain, o: Plain, t: number): Plain => ({ x: a.x + (o.x - a.x) * t, y: a.y + (o.y - a.y) * t }) },\n length: { fn: (a: Plain): number => Math.hypot(a.x, a.y) },\n lengthSq: { fn: (a: Plain): number => a.x * a.x + a.y * a.y },\n distance: { fn: (a: Plain, o: Plain): number => Math.hypot(a.x - o.x, a.y - o.y) },\n dot: { fn: (a: Plain, o: Plain): number => a.x * o.x + a.y * o.y },\n along: { fn: (a: Plain, dir: Plain): number => a.x * dir.x + a.y * dir.y },\n across: { fn: (a: Plain, dir: Plain): number => a.x * dir.y + a.y * dir.x },\n cross: { fn: (a: Plain, o: Plain): number => a.x * o.y - a.y * o.x },\n angle: { fn: (a: Plain): number => Math.atan2(a.y, a.x) },\n area: { fn: (a: Plain): number => a.x * a.y },\n sum: { fn: (a: Plain): number => a.x + a.y },\n minComponent: { fn: (a: Plain): number => Math.min(a.x, a.y) },\n maxComponent: { fn: (a: Plain): number => Math.max(a.x, a.y) },\n equals: { fn: (a: Plain, o: Plain): boolean => a.x === o.x && a.y === o.y },\n anyNonPositive: { fn: (a: Plain): boolean => a.x <= 0 || a.y <= 0 },\n allPositive: { fn: (a: Plain): boolean => a.x > 0 && a.y > 0 },\n anyNegative: { fn: (a: Plain): boolean => a.x < 0 || a.y < 0 },\n allNonNegative: { fn: (a: Plain): boolean => a.x >= 0 && a.y >= 0 },\n anyZero: { fn: (a: Plain): boolean => a.x === 0 || a.y === 0 },\n allZero: { fn: (a: Plain): boolean => a.x === 0 && a.y === 0 },\n anyLessThan: { fn: (a: Plain, n: number): boolean => a.x < n || a.y < n },\n allLessThan: { fn: (a: Plain, n: number): boolean => a.x < n && a.y < n },\n anyGreaterThan: { fn: (a: Plain, n: number): boolean => a.x > n || a.y > n },\n allGreaterThan: { fn: (a: Plain, n: number): boolean => a.x > n && a.y > n },\n },\n};\n","import { defineDomain, type Domain, type FnOp, type OpTable } from \"@mark1russell7/vex\";\nimport { VEC2_FORM } from \"./vec2-form.ts\";\n\n/**\n * An immutable 2D vector. The methods live on the prototype, so a vector costs two numbers. Division is real\n * division: a division by zero gives an infinite component, and the domain check turns it into `#NUM!`.\n */\nexport class Vec2 {\n readonly x: number;\n readonly y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n /** This function makes a vector. */\n static of(x: number, y: number): Vec2 {\n return new Vec2(x, y);\n }\n /** This function makes a vector with the same value in both components. */\n static scalar(n: number): Vec2 {\n return new Vec2(n, n);\n }\n /** The zero vector. */\n static readonly zero: Vec2 = new Vec2(0, 0);\n /** The vector of ones. */\n static readonly one: Vec2 = new Vec2(1, 1);\n\n add(o: Vec2): Vec2 {\n return new Vec2(this.x + o.x, this.y + o.y);\n }\n subtract(o: Vec2): Vec2 {\n return new Vec2(this.x - o.x, this.y - o.y);\n }\n /** The component-wise product. */\n multiply(o: Vec2): Vec2 {\n return new Vec2(this.x * o.x, this.y * o.y);\n }\n /** The component-wise quotient. A zero component of `o` gives an infinite component. */\n divide(o: Vec2): Vec2 {\n return new Vec2(this.x / o.x, this.y / o.y);\n }\n /** The component-wise minimum. */\n min(o: Vec2): Vec2 {\n return new Vec2(Math.min(this.x, o.x), Math.min(this.y, o.y));\n }\n /** The component-wise maximum. */\n max(o: Vec2): Vec2 {\n return new Vec2(Math.max(this.x, o.x), Math.max(this.y, o.y));\n }\n scale(k: number): Vec2 {\n return new Vec2(this.x * k, this.y * k);\n }\n negate(): Vec2 {\n return new Vec2(-this.x, -this.y);\n }\n halve(): Vec2 {\n return this.scale(0.5);\n }\n abs(): Vec2 {\n return new Vec2(Math.abs(this.x), Math.abs(this.y));\n }\n /** The component-wise sign, as `Math.sign` gives it. A component `NaN` stays `NaN`, and the domain check gives `#NUM!`. */\n sign(): Vec2 {\n return new Vec2(Math.sign(this.x), Math.sign(this.y));\n }\n round(): Vec2 {\n return new Vec2(Math.round(this.x), Math.round(this.y));\n }\n floor(): Vec2 {\n return new Vec2(Math.floor(this.x), Math.floor(this.y));\n }\n ceil(): Vec2 {\n return new Vec2(Math.ceil(this.x), Math.ceil(this.y));\n }\n clamp(lo: number, hi: number): Vec2 {\n return new Vec2(Math.min(hi, Math.max(lo, this.x)), Math.min(hi, Math.max(lo, this.y)));\n }\n swap(): Vec2 {\n return new Vec2(this.y, this.x);\n }\n /**\n * The vector with `main` along the unit axis of this vector and `cross` on the other axis: `this * main + swap(this) *\n * cross`. For the axis (1, 0) it is (main, cross), and for the axis (0, 1) it is (cross, main).\n */\n compose(main: number, cross: number): Vec2 {\n return new Vec2(this.x * main + this.y * cross, this.y * main + this.x * cross);\n }\n /**\n * The component-wise choice: a component of `a` where this mask has a component that is not 0, else the component\n * of `b`. Thus `hi.select(v.min(hi), v)` bounds each component of `v` by `hi`, and a 0 in `hi` sets no bound.\n */\n select(a: Vec2, b: Vec2): Vec2 {\n return new Vec2(this.x !== 0 ? a.x : b.x, this.y !== 0 ? a.y : b.y);\n }\n /** The vector turned by `radians`, counterclockwise. */\n rotate(radians: number): Vec2 {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n return new Vec2(c * this.x - s * this.y, s * this.x + c * this.y);\n }\n /** The vector with length 1. The zero vector stays zero. */\n normalize(): Vec2 {\n const len = this.length();\n return len === 0 ? this : this.scale(1 / len);\n }\n /**\n * The unit vector of the smaller component: (1, 0) if `x <= y`, else (0, 1). The comparison uses the signed values, so\n * `v.abs().minAxis()` compares sizes. A tie gives (1, 0). A component `NaN` gives `NaN` components, thus `#NUM!`.\n */\n minAxis(): Vec2 {\n if (Number.isNaN(this.x) || Number.isNaN(this.y)) return new Vec2(Number.NaN, Number.NaN);\n return this.x <= this.y ? new Vec2(1, 0) : new Vec2(0, 1);\n }\n /** The linear interpolation from this vector to `o`. */\n lerp(o: Vec2, t: number): Vec2 {\n return new Vec2(this.x + (o.x - this.x) * t, this.y + (o.y - this.y) * t);\n }\n length(): number {\n return Math.hypot(this.x, this.y);\n }\n lengthSq(): number {\n return this.x * this.x + this.y * this.y;\n }\n distance(o: Vec2): number {\n return Math.hypot(this.x - o.x, this.y - o.y);\n }\n dot(o: Vec2): number {\n return this.x * o.x + this.y * o.y;\n }\n /** The component along the unit axis `dir`: `dot(this, dir)`. For the axis (1, 0) it is x, and for (0, 1) it is y. */\n along(dir: Vec2): number {\n return this.x * dir.x + this.y * dir.y;\n }\n /** The component on the other axis of the unit axis `dir`: `dot(this, swap(dir))`. For the axis (1, 0) it is y. */\n across(dir: Vec2): number {\n return this.x * dir.y + this.y * dir.x;\n }\n /** The z component of the 3D cross product. */\n cross(o: Vec2): number {\n return this.x * o.y - this.y * o.x;\n }\n /** The angle of the vector, in radians, from the x axis. */\n angle(): number {\n return Math.atan2(this.y, this.x);\n }\n /** The product of the components: the area of a size vector. */\n area(): number {\n return this.x * this.y;\n }\n /** The sum of the components. */\n sum(): number {\n return this.x + this.y;\n }\n minComponent(): number {\n return Math.min(this.x, this.y);\n }\n maxComponent(): number {\n return Math.max(this.x, this.y);\n }\n equals(o: Vec2): boolean {\n return this.x === o.x && this.y === o.y;\n }\n anyNonPositive(): boolean {\n return this.x <= 0 || this.y <= 0;\n }\n allPositive(): boolean {\n return this.x > 0 && this.y > 0;\n }\n anyNegative(): boolean {\n return this.x < 0 || this.y < 0;\n }\n allNonNegative(): boolean {\n return this.x >= 0 && this.y >= 0;\n }\n anyZero(): boolean {\n return this.x === 0 || this.y === 0;\n }\n allZero(): boolean {\n return this.x === 0 && this.y === 0;\n }\n anyLessThan(n: number): boolean {\n return this.x < n || this.y < n;\n }\n allLessThan(n: number): boolean {\n return this.x < n && this.y < n;\n }\n anyGreaterThan(n: number): boolean {\n return this.x > n || this.y > n;\n }\n allGreaterThan(n: number): boolean {\n return this.x > n && this.y > n;\n }\n toJSON(): { readonly x: number; readonly y: number } {\n return { x: this.x, y: this.y };\n }\n toString(): string {\n return `(${this.x}, ${this.y})`;\n }\n}\n\ntype Vec2OpNames =\n | \"add\" | \"subtract\" | \"multiply\" | \"divide\" | \"min\" | \"max\" | \"scale\" | \"negate\" | \"halve\" | \"abs\" | \"sign\" | \"round\"\n | \"floor\" | \"ceil\" | \"clamp\" | \"swap\" | \"compose\" | \"select\" | \"rotate\" | \"normalize\" | \"minAxis\" | \"lerp\" | \"length\"\n | \"lengthSq\" | \"distance\" | \"dot\" | \"along\" | \"across\" | \"cross\" | \"angle\" | \"area\" | \"sum\" | \"minComponent\"\n | \"maxComponent\" | \"equals\" | \"anyNonPositive\" | \"allPositive\" | \"anyNegative\" | \"allNonNegative\" | \"anyZero\"\n | \"allZero\" | \"anyLessThan\" | \"allLessThan\" | \"anyGreaterThan\" | \"allGreaterThan\";\n\n/** The ops of `Vec2Domain`. The ops `x` and `y` give a component. */\nexport type Vec2Ops = OpTable<Vec2, Vec2OpNames, \"add\" | \"subtract\" | \"multiply\" | \"divide\" | \"min\" | \"max\" | \"select\"> & {\n readonly x: FnOp<Vec2, (v: Vec2) => number>;\n readonly y: FnOp<Vec2, (v: Vec2) => number>;\n};\n\n/** The domain of 2D vectors. A number argument of a component-wise op lifts to a vector with that value twice. */\nexport const Vec2Domain: Domain<\"Vec2\", Vec2, Vec2Ops> = defineDomain<\"Vec2\", Vec2, Vec2Ops>({\n name: \"Vec2\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Vec2 => u instanceof Vec2,\n fromScalar: (n: number): Vec2 => Vec2.scalar(n),\n valid: (v: Vec2): boolean => Number.isFinite(v.x) && Number.isFinite(v.y),\n show: (v: Vec2): string => v.toString(),\n encode: (v: Vec2): readonly [number, number] => [v.x, v.y],\n decode: (u: unknown): Vec2 => {\n // Stryker disable next-line ArrayDeclaration: a list with a text gives NaN components, like the empty list\n const [x, y] = Array.isArray(u) ? (u as readonly unknown[]) : [];\n return new Vec2(typeof x === \"number\" ? x : Number.NaN, typeof y === \"number\" ? y : Number.NaN);\n },\n // COMPILE.MODULE.FORM: a module cannot hold this class, so a vector in a module is plain data.\n moduleForm: { ...VEC2_FORM, literal: (u: unknown): { readonly x: number; readonly y: number } | undefined => (u instanceof Vec2 ? u.toJSON() : undefined) },\n ops: {\n // The components are fields of a vector, not methods, so these two ops are functions.\n x: { fn: (v: Vec2): number => v.x, params: [], returns: \"number\" },\n y: { fn: (v: Vec2): number => v.y, params: [], returns: \"number\" },\n add: { laws: [\"commutative\", \"associative\"], identity: () => Vec2.zero, liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n subtract: { liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n multiply: { laws: [\"commutative\", \"associative\"], identity: () => Vec2.one, liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n divide: { liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n min: { laws: [\"commutative\", \"associative\", \"idempotent\"], liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n max: { laws: [\"commutative\", \"associative\", \"idempotent\"], liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n scale: { params: [\"number\"], returns: \"domain\" },\n negate: { params: [], returns: \"domain\" },\n halve: { params: [], returns: \"domain\" },\n abs: { params: [], returns: \"domain\" },\n sign: { params: [], returns: \"domain\" },\n round: { params: [], returns: \"domain\" },\n floor: { params: [], returns: \"domain\" },\n ceil: { params: [], returns: \"domain\" },\n clamp: { params: [\"number\", \"number\"], returns: \"domain\" },\n swap: { params: [], returns: \"domain\" },\n compose: { params: [\"number\", \"number\"], returns: \"domain\" },\n select: { liftScalar: true, params: [\"domain\", \"domain\"], returns: \"domain\" },\n rotate: { params: [\"number\"], returns: \"domain\" },\n normalize: { params: [], returns: \"domain\" },\n minAxis: { params: [], returns: \"domain\" },\n lerp: { params: [\"domain\", \"number\"], returns: \"domain\" },\n length: { params: [], returns: \"number\" },\n lengthSq: { params: [], returns: \"number\" },\n distance: { params: [\"domain\"], returns: \"number\" },\n dot: { laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n along: { params: [\"domain\"], returns: \"number\" },\n across: { params: [\"domain\"], returns: \"number\" },\n cross: { params: [\"domain\"], returns: \"number\" },\n angle: { params: [], returns: \"number\" },\n area: { params: [], returns: \"number\" },\n sum: { params: [], returns: \"number\" },\n minComponent: { params: [], returns: \"number\" },\n maxComponent: { params: [], returns: \"number\" },\n equals: { laws: [\"commutative\"], params: [\"domain\"], returns: \"boolean\" },\n anyNonPositive: { params: [], returns: \"boolean\" },\n allPositive: { params: [], returns: \"boolean\" },\n anyNegative: { params: [], returns: \"boolean\" },\n allNonNegative: { params: [], returns: \"boolean\" },\n anyZero: { params: [], returns: \"boolean\" },\n allZero: { params: [], returns: \"boolean\" },\n anyLessThan: { params: [\"number\"], returns: \"boolean\" },\n allLessThan: { params: [\"number\"], returns: \"boolean\" },\n anyGreaterThan: { params: [\"number\"], returns: \"boolean\" },\n allGreaterThan: { params: [\"number\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\n\n/**\n * A 2D vector as plain data. `XYDomain` has the component-wise ops of `Vec2Domain`, but each op is a function of plain\n * data. Thus a standalone module of `@mark1russell7/vex-compiler` can copy the domain, and a 2D program can be a module.\n */\nexport interface XY {\n readonly x: number;\n readonly y: number;\n}\n\ntype XYFn2 = (a: XY, b: XY) => XY;\ntype XYFn1 = (a: XY) => XY;\ntype XYNum1 = (a: XY) => number;\n\n/** The ops of `XYDomain`. */\nexport type XYOps = {\n readonly x: FnOp<XY, XYNum1>;\n readonly y: FnOp<XY, XYNum1>;\n readonly add: FnOp<XY, XYFn2>;\n readonly subtract: FnOp<XY, XYFn2>;\n readonly multiply: FnOp<XY, XYFn2>;\n readonly divide: FnOp<XY, XYFn2>;\n readonly min: FnOp<XY, XYFn2>;\n readonly max: FnOp<XY, XYFn2>;\n readonly scale: FnOp<XY, (a: XY, k: number) => XY>;\n readonly negate: FnOp<XY, XYFn1>;\n readonly abs: FnOp<XY, XYFn1>;\n readonly sign: FnOp<XY, XYFn1>;\n readonly minAxis: FnOp<XY, XYFn1>;\n readonly floor: FnOp<XY, XYFn1>;\n readonly ceil: FnOp<XY, XYFn1>;\n readonly round: FnOp<XY, XYFn1>;\n readonly dot: FnOp<XY, (a: XY, b: XY) => number>;\n readonly length: FnOp<XY, XYNum1>;\n readonly distance: FnOp<XY, (a: XY, b: XY) => number>;\n readonly area: FnOp<XY, XYNum1>;\n readonly sum: FnOp<XY, XYNum1>;\n readonly equals: FnOp<XY, (a: XY, b: XY) => boolean>;\n};\n\n/**\n * The domain of 2D vectors as plain data: an object with the two number fields `x` and `y` and no other field. The op\n * `xy` of `NumDomain` makes one. No op lifts a number, so each op has a static site in a module. Put `XYDomain` before\n * `NumRecordDomain`, because a record of numbers accepts the same objects.\n */\nexport const XYDomain: Domain<\"XY\", XY, XYOps> = defineDomain<\"XY\", XY, XYOps>({\n name: \"XY\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n fields: [\"x\", \"y\"],\n // A plain object: its prototype is Object.prototype or null, so an instance of a class such as Vec2 is not an XY.\n is: (u: unknown): u is XY => typeof u === \"object\" && u !== null && [Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) && Object.keys(u).length === 2 && typeof (u as XY).x === \"number\" && typeof (u as XY).y === \"number\",\n valid: (v: XY): boolean => Number.isFinite(v.x) && Number.isFinite(v.y),\n show: (v: XY): string => `(${v.x}, ${v.y})`,\n samples: (): readonly XY[] => [{ x: 0, y: 0 }, { x: 1.5, y: -2 }, { x: 3, y: 4 }],\n ops: {\n x: { fn: (a: XY): number => a.x, params: [], returns: \"number\" },\n y: { fn: (a: XY): number => a.y, params: [], returns: \"number\" },\n add: { fn: (a: XY, b: XY): XY => ({ x: a.x + b.x, y: a.y + b.y }), laws: [\"commutative\", \"associative\"], identity: (): XY => ({ x: 0, y: 0 }), params: [\"domain\"], returns: \"domain\" },\n subtract: { fn: (a: XY, b: XY): XY => ({ x: a.x - b.x, y: a.y - b.y }), params: [\"domain\"], returns: \"domain\" },\n multiply: { fn: (a: XY, b: XY): XY => ({ x: a.x * b.x, y: a.y * b.y }), laws: [\"commutative\", \"associative\"], identity: (): XY => ({ x: 1, y: 1 }), params: [\"domain\"], returns: \"domain\" },\n divide: { fn: (a: XY, b: XY): XY => ({ x: a.x / b.x, y: a.y / b.y }), params: [\"domain\"], returns: \"domain\" },\n min: { fn: (a: XY, b: XY): XY => ({ x: Math.min(a.x, b.x), y: Math.min(a.y, b.y) }), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], returns: \"domain\" },\n max: { fn: (a: XY, b: XY): XY => ({ x: Math.max(a.x, b.x), y: Math.max(a.y, b.y) }), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], returns: \"domain\" },\n scale: { fn: (a: XY, k: number): XY => ({ x: a.x * k, y: a.y * k }), params: [\"number\"], returns: \"domain\" },\n negate: { fn: (a: XY): XY => ({ x: -a.x, y: -a.y }), params: [], returns: \"domain\" },\n abs: { fn: (a: XY): XY => ({ x: Math.abs(a.x), y: Math.abs(a.y) }), params: [], returns: \"domain\" },\n sign: { fn: (a: XY): XY => ({ x: Math.sign(a.x), y: Math.sign(a.y) }), params: [], returns: \"domain\" },\n // The rules of minAxis of Vec2 (VEC2.MINAXIS). NaN components fail the check of the result, so `NaN` gives #NUM!.\n minAxis: { fn: (a: XY): XY => (Number.isNaN(a.x) || Number.isNaN(a.y) ? { x: Number.NaN, y: Number.NaN } : a.x <= a.y ? { x: 1, y: 0 } : { x: 0, y: 1 }), params: [], returns: \"domain\" },\n floor: { fn: (a: XY): XY => ({ x: Math.floor(a.x), y: Math.floor(a.y) }), params: [], returns: \"domain\" },\n ceil: { fn: (a: XY): XY => ({ x: Math.ceil(a.x), y: Math.ceil(a.y) }), params: [], returns: \"domain\" },\n round: { fn: (a: XY): XY => ({ x: Math.round(a.x), y: Math.round(a.y) }), params: [], returns: \"domain\" },\n dot: { fn: (a: XY, b: XY): number => a.x * b.x + a.y * b.y, laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n length: { fn: (a: XY): number => Math.hypot(a.x, a.y), params: [], returns: \"number\" },\n distance: { fn: (a: XY, b: XY): number => Math.hypot(a.x - b.x, a.y - b.y), laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n area: { fn: (a: XY): number => a.x * a.y, params: [], returns: \"number\" },\n sum: { fn: (a: XY): number => a.x + a.y, params: [], returns: \"number\" },\n equals: { fn: (a: XY, b: XY): boolean => a.x === b.x && a.y === b.y, laws: [\"commutative\"], params: [\"domain\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\nimport { Vec2 } from \"./vec2.ts\";\nimport type { XY } from \"./xy.ts\";\n\n/**\n * The four sides of an inset, as plain data. The `start` sides are the leading pair, and the `end` sides are the\n * trailing pair. Each pair is in the order of a 2D vector: `x`, then `y`. The names are logical, so a side does not\n * depend on the direction of an axis.\n */\nexport interface Insets {\n readonly startX: number;\n readonly startY: number;\n readonly endX: number;\n readonly endY: number;\n}\n\ntype InsetsNum1 = (a: Insets) => number;\ntype InsetsXY1 = (a: Insets) => XY;\ntype InsetsVec1 = (a: Insets) => Vec2;\n\n/** The ops of `InsetsDomain`. */\nexport type InsetsOps = {\n readonly startX: FnOp<Insets, InsetsNum1>;\n readonly startY: FnOp<Insets, InsetsNum1>;\n readonly endX: FnOp<Insets, InsetsNum1>;\n readonly endY: FnOp<Insets, InsetsNum1>;\n readonly start: FnOp<Insets, InsetsXY1>;\n readonly end: FnOp<Insets, InsetsXY1>;\n readonly startVec2: FnOp<Insets, InsetsVec1>;\n readonly endVec2: FnOp<Insets, InsetsVec1>;\n readonly add: FnOp<Insets, (a: Insets, b: Insets) => Insets> & { readonly liftScalar: true };\n readonly scale: FnOp<Insets, (a: Insets, k: number) => Insets>;\n};\n\n/**\n * The domain of insets: an object with the four number fields of `Insets` and no other field. The op `insets` of\n * `NumDomain` makes one, and a number argument of `add` lifts to four equal sides. `start` and `end` give plain `XY`\n * values, so a module can copy them. `startVec2` and `endVec2` give `Vec2` values, and a module cannot copy them. Put\n * `InsetsDomain` before `NumRecordDomain`, because a record of numbers accepts the same objects.\n */\nexport const InsetsDomain: Domain<\"Insets\", Insets, InsetsOps> = defineDomain<\"Insets\", Insets, InsetsOps>({\n name: \"Insets\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n fields: [\"startX\", \"startY\", \"endX\", \"endY\"],\n // A plain object: its prototype is Object.prototype or null, so an instance of a class is not a value of this domain.\n is: (u: unknown): u is Insets => {\n if (typeof u !== \"object\" || u === null || ![Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) || Object.keys(u).length !== 4) return false;\n const v = u as Insets;\n return typeof v.startX === \"number\" && typeof v.startY === \"number\" && typeof v.endX === \"number\" && typeof v.endY === \"number\";\n },\n fromScalar: (n: number): Insets => ({ startX: n, startY: n, endX: n, endY: n }),\n valid: (v: Insets): boolean => Number.isFinite(v.startX) && Number.isFinite(v.startY) && Number.isFinite(v.endX) && Number.isFinite(v.endY),\n show: (v: Insets): string => `(${v.startX}, ${v.startY}, ${v.endX}, ${v.endY})`,\n samples: (): readonly Insets[] => [\n { startX: 0, startY: 0, endX: 0, endY: 0 },\n { startX: 1.5, startY: -2, endX: 3, endY: 4 },\n { startX: 8, startY: 8, endX: 8, endY: 8 },\n ],\n ops: {\n startX: { fn: (a: Insets): number => a.startX, params: [], returns: \"number\" },\n startY: { fn: (a: Insets): number => a.startY, params: [], returns: \"number\" },\n endX: { fn: (a: Insets): number => a.endX, params: [], returns: \"number\" },\n endY: { fn: (a: Insets): number => a.endY, params: [], returns: \"number\" },\n start: { fn: (a: Insets): XY => ({ x: a.startX, y: a.startY }), params: [], returns: \"domain:XY\" },\n end: { fn: (a: Insets): XY => ({ x: a.endX, y: a.endY }), params: [], returns: \"domain:XY\" },\n startVec2: { fn: (a: Insets): Vec2 => new Vec2(a.startX, a.startY), params: [], returns: \"domain:Vec2\" },\n endVec2: { fn: (a: Insets): Vec2 => new Vec2(a.endX, a.endY), params: [], returns: \"domain:Vec2\" },\n add: {\n fn: (a: Insets, b: Insets): Insets => ({ startX: a.startX + b.startX, startY: a.startY + b.startY, endX: a.endX + b.endX, endY: a.endY + b.endY }),\n laws: [\"commutative\", \"associative\"],\n identity: (): Insets => ({ startX: 0, startY: 0, endX: 0, endY: 0 }),\n liftScalar: true,\n params: [\"domain\"],\n returns: \"domain\",\n },\n scale: { fn: (a: Insets, k: number): Insets => ({ startX: a.startX * k, startY: a.startY * k, endX: a.endX * k, endY: a.endY * k }), params: [\"number\"], returns: \"domain\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp, type OpTable, type SizeRule } from \"@mark1russell7/vex\";\n\n/**\n * An immutable vector with named components. The type parameter `K` is the set of component names. Ops that\n * combine two vectors use the union of their names, and a missing component counts as 0. The constructor\n * keeps each number, also a number that is not finite: the domain check reports such a value as `#NUM!`.\n */\nexport class NDVector<K extends string = string> {\n /** The components: name to number. */\n readonly c: Readonly<Record<K, number>>;\n\n constructor(c: Readonly<Record<K, number>>) {\n this.c = Object.freeze({ ...c });\n }\n\n /** This function makes a vector from name and value pairs. */\n static of<K extends string>(entries: readonly (readonly [K, number])[]): NDVector<K> {\n const c = {} as Record<K, number>;\n for (const [k, v] of entries) c[k] = v;\n return new NDVector(c);\n }\n /** This function makes the zero vector over the names `keys`. */\n static zero<K extends string>(keys: readonly K[] = []): NDVector<K> {\n return NDVector.of(keys.map((k) => [k, 0] as const));\n }\n\n /** The names of the components. */\n keys(): readonly K[] {\n return Object.keys(this.c) as K[];\n }\n /** The value of a component, or 0 if the vector does not have it. */\n get(k: string): number {\n return Object.hasOwn(this.c, k) ? Number((this.c as Readonly<Record<string, number>>)[k]) : 0;\n }\n set<K2 extends string>(k: K2, v: number): NDVector<K | K2> {\n return new NDVector({ ...this.c, [k]: v } as Record<K | K2, number>);\n }\n map(f: (name: K, v: number) => number): NDVector<K> {\n const c = {} as Record<K, number>;\n for (const k of this.keys()) c[k] = f(k, this.get(k));\n return new NDVector(c);\n }\n /** The vector with only the names in `keys`. A zero component is dropped, unless `keepZeros` is true. */\n pick<K2 extends K>(keys: readonly K2[], keepZeros = false): NDVector<K2> {\n const c = {} as Record<K2, number>;\n for (const k of keys) {\n const v = this.get(k);\n if (keepZeros || v !== 0) c[k] = v;\n }\n return new NDVector(c);\n }\n /** The vector with the names in `keys` added. A new component is 0. */\n withKeys<K2 extends string>(keys: readonly K2[]): NDVector<K | K2> {\n const c = { ...this.c } as Record<K | K2, number>;\n for (const k of keys) if (!Object.hasOwn(c, k)) c[k] = 0;\n return new NDVector(c);\n }\n #combine<K2 extends string>(o: NDVector<K2>, f: (a: number, b: number) => number): NDVector<K | K2> {\n const c = {} as Record<K | K2, number>;\n for (const k of new Set<K | K2>([...this.keys(), ...o.keys()])) c[k] = f(this.get(k), o.get(k));\n return new NDVector(c);\n }\n add<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a + b);\n }\n subtract<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a - b);\n }\n /** The component-wise product. */\n multiply<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a * b);\n }\n /** The component-wise minimum. A component that one vector does not have counts as 0. */\n min<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => Math.min(a, b));\n }\n /** The component-wise maximum. A component that one vector does not have counts as 0. */\n max<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => Math.max(a, b));\n }\n /** Of each component, the value of this vector if it is not 0, else the value of `o`. */\n mergePreferNonZero<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => (a !== 0 ? a : b));\n }\n scale(k: number): NDVector<K> {\n return this.map((_n, v) => v * k);\n }\n clamp(lo: number, hi: number): NDVector<K> {\n return this.map((_n, v) => Math.min(hi, Math.max(lo, v)));\n }\n dot(o: NDVector): number {\n let s = 0;\n for (const k of new Set<string>([...this.keys(), ...o.keys()])) s += this.get(k) * o.get(k);\n return s;\n }\n /** The L2 length. */\n length(): number {\n return Math.sqrt(this.keys().reduce((s, k) => s + this.get(k) ** 2, 0));\n }\n /** The L1 norm. */\n norm1(): number {\n return this.keys().reduce((s, k) => s + Math.abs(this.get(k)), 0);\n }\n /** The largest absolute component. */\n normInf(): number {\n return this.keys().reduce((m, k) => Math.max(m, Math.abs(this.get(k))), 0);\n }\n equals(o: NDVector): boolean {\n const keys = new Set<string>([...this.keys(), ...o.keys()]);\n for (const k of keys) if (this.get(k) !== o.get(k)) return false;\n return true;\n }\n /** True if each component is a finite number. */\n isFinite(): boolean {\n return this.keys().every((k) => Number.isFinite(this.get(k)));\n }\n toJSON(): Readonly<Record<K, number>> {\n return { ...this.c };\n }\n toString(): string {\n return `NDVector(${JSON.stringify(this.c)})`;\n }\n}\n\ntype NDOpNames =\n | \"add\" | \"subtract\" | \"multiply\" | \"min\" | \"max\" | \"mergePreferNonZero\" | \"scale\" | \"clamp\" | \"dot\" | \"length\" | \"norm1\" | \"normInf\"\n | \"equals\" | \"pick\" | \"withKeys\" | \"get\" | \"set\";\n\n/** The ops of `NDVectorDomain`. No op lifts numbers. */\nexport type NDVectorOps = OpTable<NDVector, NDOpNames>;\n\n/** The ops of `LiftedNDVectorDomain`. */\nexport type LiftedNDVectorOps = OpTable<NDVector, NDOpNames, \"add\" | \"subtract\" | \"multiply\" | \"dot\">;\n\n/** The size rule of an op whose result has the keys of both vectors, each key one time (LOOP.SIZE.OPS). */\nconst KEYS = { size: [1, 1], union: true } as const satisfies SizeRule;\n\n/** The size rule of an op that lifts a number to the vector `{ scalar: n }`: the keys of both, and maybe one key more. */\nconst LIFTED = { size: [1, 1], union: true, constant: true } as const satisfies SizeRule;\n\nconst ndOps = {\n add: { laws: [\"commutative\", \"associative\"], identity: (): NDVector => NDVector.zero(), params: [\"domain\"], size: KEYS },\n subtract: { params: [\"domain\"], size: KEYS },\n multiply: { laws: [\"commutative\", \"associative\"], params: [\"domain\"], size: KEYS },\n min: { laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n max: { laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n mergePreferNonZero: { laws: [\"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n scale: { params: [\"number\"], size: { size: [1, 0] } },\n clamp: { params: [\"number\", \"number\"], size: { size: [1, 0, 0] } },\n dot: { laws: [\"commutative\"], params: [\"domain\"], size: \"scalar\" },\n length: { size: \"scalar\" },\n norm1: { size: \"scalar\" },\n normInf: { size: \"scalar\" },\n equals: { laws: [\"commutative\"], params: [\"domain\"], size: \"scalar\" },\n pick: { size: { size: [1, 1, 0], union: true } },\n withKeys: { size: KEYS },\n get: { params: [\"string\"], size: \"scalar\" },\n set: { params: [\"string\", \"number\"], size: { size: [1, 1, 0], union: true } },\n} as const satisfies NDVectorOps;\n\nconst isNDVector = (u: unknown): u is NDVector => u instanceof NDVector;\n\n/** The domain of named-component vectors. A number argument is an error here: use `LiftedNDVectorDomain` to lift. */\nexport const NDVectorDomain: Domain<\"NDVector\", NDVector, NDVectorOps> = defineDomain<\"NDVector\", NDVector, NDVectorOps>({\n name: \"NDVector\",\n is: isNDVector,\n valid: (v: NDVector): boolean => v.isFinite(),\n show: (v: NDVector): string => v.toString(),\n encode: (v: NDVector): unknown => v.toJSON(),\n decode: (u: unknown): NDVector => new NDVector(u as Readonly<Record<string, number>>),\n ops: ndOps,\n});\n\n/**\n * The domain of named-component vectors with scalar lifting. A number argument of `add`, `subtract`,\n * `multiply` or `dot` becomes the vector `{ scalar: n }`. This domain is independent of `NDVectorDomain`:\n * the two can be in one program, and neither changes the other.\n */\nexport const LiftedNDVectorDomain: Domain<\"NDVector(lifted)\", NDVector, LiftedNDVectorOps> = defineDomain<\"NDVector(lifted)\", NDVector, LiftedNDVectorOps>({\n name: \"NDVector(lifted)\",\n is: isNDVector,\n fromScalar: (n: number): NDVector => new NDVector({ scalar: n }),\n valid: (v: NDVector): boolean => v.isFinite(),\n show: (v: NDVector): string => v.toString(),\n ops: {\n ...ndOps,\n add: { ...ndOps.add, liftScalar: true, size: LIFTED },\n subtract: { ...ndOps.subtract, liftScalar: true, size: LIFTED },\n multiply: { ...ndOps.multiply, liftScalar: true, size: LIFTED },\n dot: { ...ndOps.dot, liftScalar: true },\n },\n});\n\n/** A plain record whose values are finite numbers. */\nexport type NumRecord = Readonly<Record<string, number>>;\n\n/** The ops of `NumRecordDomain`. */\nexport type NumRecordOps = {\n readonly toNDVector: FnOp<NumRecord, (r: NumRecord) => NDVector>;\n};\n\nconst isNumRecord = (u: unknown): u is NumRecord => {\n if (typeof u !== \"object\" || u === null || Array.isArray(u)) return false;\n const proto: unknown = Object.getPrototypeOf(u);\n // Number.isFinite gives false for each value that is not a number.\n return (proto === Object.prototype || proto === null) && Object.values(u).every((v) => Number.isFinite(v));\n};\n\n/** The domain of plain number records. Its op `toNDVector` builds a vector from fields, for example from `rec()`. */\nexport const NumRecordDomain: Domain<\"NumRecord\", NumRecord, NumRecordOps> = defineDomain<\"NumRecord\", NumRecord, NumRecordOps>({\n name: \"NumRecord\",\n is: isNumRecord,\n ops: {\n toNDVector: { fn: (r: NumRecord): NDVector => new NDVector(r), size: { size: [1] } },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\nconst MS_PER_DAY = 86_400_000;\n\n/** The largest distance from 1970-01-01 in days. The `Date` of JavaScript has the same range. */\nexport const MAX_DAYS = 100_000_000;\n\nconst ISO = /^([+-]?\\d{4,6})-(\\d{2})-(\\d{2})$/;\n\n/** This function gives the `Date` of JavaScript at 00:00 UTC of a day. */\nconst utc = (days: number): Date => new Date(days * MS_PER_DAY);\n\n/**\n * An immutable day of the calendar, without a time and without a time zone. It keeps the number of days since\n * 1970-01-01, so the arithmetic of days is the arithmetic of numbers. The calendar is the Gregorian calendar, also\n * before 1582.\n */\nexport class LocalDate {\n /** The number of days since 1970-01-01. */\n readonly days: number;\n\n constructor(days: number) {\n this.days = days;\n }\n\n /**\n * This function makes a date from a year, a month from 1 to 12, and a day. A month or a day outside its range rolls\n * over, like the function `DATE` of a spreadsheet. Thus month 13 is January of the next year, and day 0 is the last\n * day of the month before. A number that is not whole gives a date that is not valid.\n */\n static of(year: number, month: number, day: number): LocalDate {\n if (![year, month, day].every(Number.isSafeInteger)) return new LocalDate(Number.NaN);\n // setUTCFullYear does not change the years 0 to 99 into 1900 to 1999, but Date.UTC does.\n const d = new Date(0);\n d.setUTCFullYear(year, month - 1, day);\n return new LocalDate(Math.round(d.getTime() / MS_PER_DAY));\n }\n\n /** This function reads a date in the form `YYYY-MM-DD`. A day that does not exist, for example `2026-02-30`, gives `undefined`. */\n static parse(text: string): LocalDate | undefined {\n const m = ISO.exec(text.trim());\n if (m === null) return undefined;\n const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];\n const date = LocalDate.of(y, mo, d);\n // A month or a day outside its range rolls over into another month, so the month tells if the day exists.\n return date.month() === mo ? date : undefined;\n }\n\n /** The year. */\n year(): number {\n return utc(this.days).getUTCFullYear();\n }\n /** The month, from 1 to 12. */\n month(): number {\n return utc(this.days).getUTCMonth() + 1;\n }\n /** The day of the month, from 1 to 31. */\n day(): number {\n return utc(this.days).getUTCDate();\n }\n /** The day of the week, from 1 (Sunday) to 7 (Saturday), like `WEEKDAY` of a spreadsheet. */\n weekday(): number {\n return utc(this.days).getUTCDay() + 1;\n }\n /** The date `n` days later. A negative `n` goes back. */\n add(n: number): LocalDate {\n return new LocalDate(this.days + n);\n }\n /** The number of days from the date `x` to this date, or the date `x` days before this date. */\n subtract(x: LocalDate | number): LocalDate | number {\n return x instanceof LocalDate ? this.days - x.days : new LocalDate(this.days - x);\n }\n /**\n * The same day `n` months later, like `EDATE` of a spreadsheet. When that month is shorter, the result is its last\n * day: one month after 31 January is the last day of February.\n */\n addMonths(n: number): LocalDate {\n // LocalDate.of gives a date that is not valid for a number of months that is not whole.\n const first = LocalDate.of(this.year(), this.month() + n, 1);\n const last = LocalDate.of(first.year(), first.month() + 1, 0);\n return new LocalDate(Math.min(first.days + this.day() - 1, last.days));\n }\n /** The last day of the month `n` months later, like `EOMONTH` of a spreadsheet. */\n endOfMonth(n: number): LocalDate {\n return LocalDate.of(this.year(), this.month() + n + 1, 0);\n }\n gt(o: LocalDate): boolean {\n return this.days > o.days;\n }\n gte(o: LocalDate): boolean {\n return this.days >= o.days;\n }\n lt(o: LocalDate): boolean {\n return this.days < o.days;\n }\n lte(o: LocalDate): boolean {\n return this.days <= o.days;\n }\n eq(o: LocalDate): boolean {\n return this.days === o.days;\n }\n /** The form `YYYY-MM-DD`. A year before 0 or after 9999 has a sign and six digits, as in ISO 8601. */\n toString(): string {\n const y = this.year();\n // Stryker disable next-line EqualityOperator: the year 0 takes the first branch, so y < 0 and y <= 0 are the same in the second\n const year = y >= 0 && y <= 9999 ? String(y).padStart(4, \"0\") : `${y < 0 ? \"-\" : \"+\"}${String(Math.abs(y)).padStart(6, \"0\")}`;\n return `${year}-${String(this.month()).padStart(2, \"0\")}-${String(this.day()).padStart(2, \"0\")}`;\n }\n}\n\n/** The ops of `DateDomain`. */\nexport type DateOps = OpTable<LocalDate, \"add\" | \"subtract\" | \"addMonths\" | \"endOfMonth\" | \"year\" | \"month\" | \"day\" | \"weekday\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"eq\">;\n\n/**\n * The domain of dates. `add` takes a count of days. `subtract` takes a date, for the days between the two dates, or a\n * count of days. A valid date is a whole count of days, within `MAX_DAYS` of 1970-01-01.\n */\nexport const DateDomain: Domain<\"Date\", LocalDate, DateOps> = defineDomain<\"Date\", LocalDate, DateOps>({\n name: \"Date\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is LocalDate => u instanceof LocalDate,\n valid: (d: LocalDate): boolean => Number.isSafeInteger(d.days) && Math.abs(d.days) <= MAX_DAYS,\n show: (d: LocalDate): string => d.toString(),\n encode: (d: LocalDate): string => d.toString(),\n decode: (u: unknown): LocalDate => (typeof u === \"string\" ? LocalDate.parse(u) : undefined) ?? new LocalDate(Number.NaN),\n ops: {\n add: { params: [\"number\"] },\n subtract: { params: [\"any\"] },\n addMonths: { params: [\"number\"] },\n endOfMonth: { params: [\"number\"] },\n year: {},\n month: {},\n day: {},\n weekday: {},\n gt: { params: [\"domain\"] },\n gte: { params: [\"domain\"] },\n lt: { params: [\"domain\"] },\n lte: { params: [\"domain\"] },\n eq: { laws: [\"commutative\"], params: [\"domain\"] },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\nimport { LocalDate } from \"./date.ts\";\nimport type { Insets } from \"./insets.ts\";\nimport { Vec2 } from \"./vec2.ts\";\nimport type { XY } from \"./xy.ts\";\n\ntype NumFn1 = (a: number) => number;\ntype NumFn2 = (a: number, b: number) => number;\ntype NumFn3 = (a: number, b: number, c: number) => number;\ntype NumTest = (a: number, b: number) => boolean;\n\n/** The ops of `NumDomain`. */\nexport type NumOps = {\n readonly add: FnOp<number, NumFn2>;\n readonly subtract: FnOp<number, NumFn2>;\n readonly multiply: FnOp<number, NumFn2>;\n readonly divide: FnOp<number, NumFn2>;\n readonly mod: FnOp<number, NumFn2>;\n readonly pow: FnOp<number, NumFn2>;\n readonly min: FnOp<number, NumFn2>;\n readonly max: FnOp<number, NumFn2>;\n readonly clamp: FnOp<number, NumFn3>;\n readonly abs: FnOp<number, NumFn1>;\n readonly negate: FnOp<number, NumFn1>;\n readonly sign: FnOp<number, NumFn1>;\n readonly sqrt: FnOp<number, NumFn1>;\n readonly ln: FnOp<number, NumFn1>;\n readonly exp: FnOp<number, NumFn1>;\n readonly log10: FnOp<number, NumFn1>;\n readonly sin: FnOp<number, NumFn1>;\n readonly cos: FnOp<number, NumFn1>;\n readonly asin: FnOp<number, NumFn1>;\n readonly hypot: FnOp<number, NumFn2>;\n readonly date: FnOp<number, (year: number, month: number, day: number) => LocalDate>;\n readonly vec2: FnOp<number, (x: number, y: number) => Vec2>;\n readonly xy: FnOp<number, (x: number, y: number) => XY>;\n readonly insets: FnOp<number, (startX: number, startY: number, endX: number, endY: number) => Insets>;\n readonly floor: FnOp<number, NumFn1>;\n readonly ceil: FnOp<number, NumFn1>;\n readonly round: FnOp<number, NumFn1>;\n readonly gt: FnOp<number, NumTest>;\n readonly gte: FnOp<number, NumTest>;\n readonly lt: FnOp<number, NumTest>;\n readonly lte: FnOp<number, NumTest>;\n readonly eq: FnOp<number, NumTest>;\n};\n\n/** The domain of numbers. A result that is not a finite number is the error `#NUM!`. */\nexport const NumDomain: Domain<\"Num\", number, NumOps> = defineDomain<\"Num\", number, NumOps>({\n // COMPILE.MODULE.FORM: a vector in a module is plain data, so `vec2` needs no class there.\n moduleForm: { ops: { vec2: { fn: (x: number, y: number): { readonly x: number; readonly y: number } => ({ x, y }), returns: \"domain:Vec2\" } } },\n name: \"Num\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is number => typeof u === \"number\",\n primitive: \"number\",\n valid: (n: number): boolean => Number.isFinite(n),\n show: (n: number): string => String(n),\n ops: {\n add: { fn: (a: number, b: number): number => a + b, laws: [\"commutative\", \"associative\"], identity: (): number => 0, params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n subtract: { fn: (a: number, b: number): number => a - b, params: [\"number\"], returns: \"number\", monotone: [\"up\", \"down\"] },\n multiply: { fn: (a: number, b: number): number => a * b, laws: [\"commutative\", \"associative\"], identity: (): number => 1, params: [\"number\"], returns: \"number\" },\n divide: { fn: (a: number, b: number): number => a / b, params: [\"number\"], returns: \"number\" },\n mod: { fn: (a: number, b: number): number => a % b, params: [\"number\"], returns: \"number\" },\n pow: { fn: (a: number, b: number): number => a ** b, params: [\"number\"], returns: \"number\" },\n min: { fn: (a: number, b: number): number => Math.min(a, b), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n max: { fn: (a: number, b: number): number => Math.max(a, b), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n clamp: { fn: (a: number, lo: number, hi: number): number => Math.min(hi, Math.max(lo, a)), params: [\"number\", \"number\"], returns: \"number\", monotone: [\"up\", \"up\", \"up\"] },\n abs: { fn: (a: number): number => Math.abs(a), returns: \"number\" },\n negate: { fn: (a: number): number => -a, returns: \"number\", monotone: [\"down\"] },\n // NUM.SIGN: the check of the result turns NaN into #NUM!, and an infinite number has a sign.\n sign: { fn: (a: number): number => Math.sign(a), returns: \"number\", monotone: [\"up\"] },\n sqrt: { fn: (a: number): number => Math.sqrt(a), returns: \"number\" },\n ln: { fn: (a: number): number => Math.log(a), returns: \"number\" },\n exp: { fn: (a: number): number => Math.exp(a), returns: \"number\" },\n log10: { fn: (a: number): number => Math.log10(a), returns: \"number\" },\n // The angles of sin, cos and asin are in radians.\n sin: { fn: (a: number): number => Math.sin(a), returns: \"number\" },\n cos: { fn: (a: number): number => Math.cos(a), returns: \"number\" },\n asin: { fn: (a: number): number => Math.asin(a), returns: \"number\" },\n hypot: { fn: (a: number, b: number): number => Math.hypot(a, b), laws: [\"commutative\"], params: [\"number\"], returns: \"number\" },\n // The year is the receiver: date(year, month, day). The result is a LocalDate, so a chain continues in DateDomain.\n date: { fn: (year: number, month: number, day: number): LocalDate => LocalDate.of(year, month, day), params: [\"number\", \"number\"] },\n // The x component is the receiver: vec2(x, y). The result is a Vec2, so a chain continues in Vec2Domain.\n vec2: { fn: (x: number, y: number): Vec2 => new Vec2(x, y), params: [\"number\"] },\n // The same as plain data, for a standalone module: xy(x, y). The result is a value of XYDomain.\n xy: { fn: (x: number, y: number): XY => ({ x, y }), params: [\"number\"], returns: \"domain:XY\" },\n // The leading sides, then the trailing sides: insets(startX, startY, endX, endY). The result is a value of InsetsDomain.\n insets: { fn: (startX: number, startY: number, endX: number, endY: number): Insets => ({ startX, startY, endX, endY }), params: [\"number\", \"number\", \"number\"], returns: \"domain:Insets\" },\n floor: { fn: (a: number): number => Math.floor(a), returns: \"number\", monotone: [\"up\"] },\n ceil: { fn: (a: number): number => Math.ceil(a), returns: \"number\", monotone: [\"up\"] },\n round: { fn: (a: number): number => Math.round(a), returns: \"number\", monotone: [\"up\"] },\n gt: { fn: (a: number, b: number): boolean => a > b, params: [\"number\"], returns: \"boolean\" },\n gte: { fn: (a: number, b: number): boolean => a >= b, params: [\"number\"], returns: \"boolean\" },\n lt: { fn: (a: number, b: number): boolean => a < b, params: [\"number\"], returns: \"boolean\" },\n lte: { fn: (a: number, b: number): boolean => a <= b, params: [\"number\"], returns: \"boolean\" },\n eq: { fn: (a: number, b: number): boolean => a === b, laws: [\"commutative\"], params: [\"number\"], returns: \"boolean\" },\n },\n});\n\ntype BoolFn1 = (a: boolean) => boolean;\ntype BoolFn2 = (a: boolean, b: boolean) => boolean;\n\n/** The ops of `BoolDomain`. */\nexport type BoolOps = {\n readonly and: FnOp<boolean, BoolFn2>;\n readonly or: FnOp<boolean, BoolFn2>;\n readonly xor: FnOp<boolean, BoolFn2>;\n readonly not: FnOp<boolean, BoolFn1>;\n readonly eq: FnOp<boolean, BoolFn2>;\n};\n\n/** The domain of booleans. For lazy logic, use the special forms `and`, `or` and `if` of the IR. */\nexport const BoolDomain: Domain<\"Bool\", boolean, BoolOps> = defineDomain<\"Bool\", boolean, BoolOps>({\n name: \"Bool\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is boolean => typeof u === \"boolean\",\n primitive: \"boolean\",\n show: (b: boolean): string => String(b),\n ops: {\n and: { fn: (a: boolean, b: boolean): boolean => a && b, laws: [\"commutative\", \"associative\", \"idempotent\"], identity: (): boolean => true, params: [\"boolean\"], returns: \"boolean\", monotone: [\"up\", \"up\"] },\n or: { fn: (a: boolean, b: boolean): boolean => a || b, laws: [\"commutative\", \"associative\", \"idempotent\"], identity: (): boolean => false, params: [\"boolean\"], returns: \"boolean\", monotone: [\"up\", \"up\"] },\n xor: { fn: (a: boolean, b: boolean): boolean => a !== b, laws: [\"commutative\", \"associative\"], identity: (): boolean => false, params: [\"boolean\"], returns: \"boolean\" },\n not: { fn: (a: boolean): boolean => !a, returns: \"boolean\", monotone: [\"down\"] },\n eq: { fn: (a: boolean, b: boolean): boolean => a === b, laws: [\"commutative\"], params: [\"boolean\"], returns: \"boolean\" },\n },\n});\n","/**\n * The domain of texts. The op `concat` joins a text and a value of any kind. It is the operator `&` of a\n * spreadsheet, and of the formula language of the sheet app.\n */\nimport { defineDomain, type Domain, type FnOp, type VexList } from \"@mark1russell7/vex\";\n\ntype TextFn1 = (a: string) => string;\n\n/** The ops of `TextDomain`. */\nexport type TextOps = {\n readonly concat: FnOp<string, (a: string, b: unknown) => string>;\n readonly length: FnOp<string, (a: string) => number>;\n readonly codePoints: FnOp<string, (a: string) => VexList<number>>;\n readonly upper: FnOp<string, TextFn1>;\n readonly lower: FnOp<string, TextFn1>;\n readonly trim: FnOp<string, TextFn1>;\n readonly contains: FnOp<string, (a: string, b: string) => boolean>;\n readonly eq: FnOp<string, (a: string, b: string) => boolean>;\n};\n\n/**\n * This function gives the text of a value for `concat`. A text stays. A plain record gives its JSON text. Another\n * value, for example a number or a `Vec2`, gives its own text.\n */\nconst textOf = (u: unknown): string => (typeof u === \"object\" && u !== null && Object.getPrototypeOf(u) === Object.prototype ? JSON.stringify(u) : String(u));\n\n/** The domain of texts. */\nexport const TextDomain: Domain<\"Text\", string, TextOps> = defineDomain<\"Text\", string, TextOps>({\n name: \"Text\",\n is: (u: unknown): u is string => typeof u === \"string\",\n primitive: \"string\",\n show: (s: string): string => JSON.stringify(s),\n // LOOP.SIZE.OPS: `concat` adds the JSON text of a value that is not a text. `upper` and `lower` can make a text\n // longer, for example \"ß\" becomes \"SS\". The new letters do not change again, so a text grows at most three times in\n // total, and not at each step.\n ops: {\n concat: { fn: (a: string, b: unknown): string => a + textOf(b), params: [\"any\"], returns: \"string\", size: { size: [1, \"text\"] } },\n // The length counts UTF-16 code units, like the function LEN of a spreadsheet.\n length: { fn: (a: string): number => a.length, returns: \"number\" },\n // The list has one item for each code point, so a pair of surrogates is one item, and a lone surrogate is an item\n // with its own value (TEXT.CODEPOINTS). The function reads no name of Vex, so a module can copy it. The rule tells\n // that the count is at most the length. Each item has a number and a new key, so `keys` adds a part for each item.\n codePoints: {\n fn: (a: string): VexList<number> =>\n Object.freeze({\n kind: \"vex.list\",\n items: Object.freeze(Array.from(a, (ch, i) => ({ key: String(i), result: { ok: true as const, value: ch.codePointAt(0) as number } }))),\n }),\n returns: \"list:number\",\n size: { size: [1], inner: [0], item: [0], keys: \"position\" },\n },\n upper: { fn: (a: string): string => a.toUpperCase(), returns: \"string\", size: { size: [1] } },\n lower: { fn: (a: string): string => a.toLowerCase(), returns: \"string\", size: { size: [1] } },\n trim: { fn: (a: string): string => a.trim(), returns: \"string\", size: { size: [1] } },\n contains: { fn: (a: string, b: string): boolean => a.includes(b), params: [\"string\"], returns: \"boolean\" },\n eq: { fn: (a: string, b: string): boolean => a === b, laws: [\"commutative\"], params: [\"string\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\n/** The linear value of an sRGB channel from 0 to 255, with the sRGB transfer function of WCAG 2.1. */\nfunction linear(channel: number): number {\n const s = Math.min(1, Math.max(0, channel / 255));\n // For integer channels, the sRGB threshold 0.04045 and the WCAG threshold 0.03928 give the same result.\n return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n}\n\n/**\n * An immutable RGBA color. The channels have no fixed range: use `clamp` to limit them. `add` adds the color\n * channels and keeps the larger alpha, so `add` is commutative and associative.\n */\nexport class Color {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n readonly a: number;\n\n constructor(r: number, g: number, b: number, a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n\n /** This function makes a gray color with the value `n` in each channel. */\n static gray(n: number): Color {\n return new Color(n, n, n, 1);\n }\n /** The black color with alpha 0: the identity of `add`. */\n static readonly none: Color = new Color(0, 0, 0, 0);\n\n /** The channel sum. The alpha is the larger alpha. */\n add(o: Color): Color {\n return new Color(this.r + o.r, this.g + o.g, this.b + o.b, Math.max(this.a, o.a));\n }\n /** Each color channel times `factor`. The alpha does not change. */\n multiply(factor: number): Color {\n return new Color(this.r * factor, this.g * factor, this.b * factor, this.a);\n }\n /** Each color channel in the range from `lo` to `hi`. */\n clamp(lo = 0, hi = 255): Color {\n const c = (x: number): number => Math.min(hi, Math.max(lo, x));\n return new Color(c(this.r), c(this.g), c(this.b), this.a);\n }\n /** The linear mix from this color to `o`. */\n mix(o: Color, t: number): Color {\n const m = (x: number, y: number): number => x + (y - x) * t;\n return new Color(m(this.r, o.r), m(this.g, o.g), m(this.b, o.b), m(this.a, o.a));\n }\n /** The relative luminance (Rec. 709 weights) of the color channels. */\n luminance(): number {\n return 0.2126 * this.r + 0.7152 * this.g + 0.0722 * this.b;\n }\n /**\n * The relative luminance of WCAG 2.1, from 0 (black) to 1 (white). Each channel from 0 to 255 becomes a linear\n * value with the sRGB transfer function. A channel outside the range counts as the nearest end of the range.\n */\n relativeLuminance(): number {\n return 0.2126 * linear(this.r) + 0.7152 * linear(this.g) + 0.0722 * linear(this.b);\n }\n /** The contrast ratio of WCAG 2.1 between this color and `o`: 1 for equal luminance, 21 for black and white. */\n contrast(o: Color): number {\n const a = this.relativeLuminance();\n const b = o.relativeLuminance();\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n }\n equals(o: Color): boolean {\n return this.r === o.r && this.g === o.g && this.b === o.b && this.a === o.a;\n }\n toArray(): readonly [number, number, number, number] {\n return [this.r, this.g, this.b, this.a];\n }\n toString(): string {\n return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;\n }\n}\n\n/** The ops of `ColorDomain`. */\nexport type ColorOps = OpTable<Color, \"add\" | \"multiply\" | \"clamp\" | \"mix\" | \"luminance\" | \"relativeLuminance\" | \"contrast\" | \"equals\">;\n\n/** The domain of colors. */\nexport const ColorDomain: Domain<\"Color\", Color, ColorOps> = defineDomain<\"Color\", Color, ColorOps>({\n name: \"Color\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Color => u instanceof Color,\n fromScalar: (n: number): Color => Color.gray(n),\n valid: (c: Color): boolean => c.toArray().every((x) => Number.isFinite(x)),\n show: (c: Color): string => c.toString(),\n encode: (c: Color): readonly number[] => c.toArray(),\n decode: (u: unknown): Color => {\n const [r, g, b, a] = (Array.isArray(u) ? u : []) as readonly number[];\n return new Color(r ?? Number.NaN, g ?? Number.NaN, b ?? Number.NaN, a ?? 1);\n },\n ops: {\n add: { laws: [\"commutative\", \"associative\"], identity: (): Color => Color.none, params: [\"domain\"] },\n multiply: { params: [\"number\"] },\n clamp: { params: [\"number\", \"number\"] },\n mix: { params: [\"domain\", \"number\"] },\n luminance: {},\n relativeLuminance: {},\n contrast: { laws: [\"commutative\"], params: [\"domain\"] },\n equals: { laws: [\"commutative\"], params: [\"domain\"] },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\nimport { Vec2 } from \"./vec2.ts\";\n\n/** An immutable angle in radians. */\nexport class Angle {\n readonly radians: number;\n\n constructor(radians: number) {\n this.radians = radians;\n }\n\n /** This function makes an angle from degrees. */\n static fromDegrees(deg: number): Angle {\n return new Angle((deg * Math.PI) / 180);\n }\n /** The zero angle: the identity of `add`. */\n static readonly zero: Angle = new Angle(0);\n\n add(o: Angle): Angle {\n return new Angle(this.radians + o.radians);\n }\n subtract(o: Angle): Angle {\n return new Angle(this.radians - o.radians);\n }\n scale(k: number): Angle {\n return new Angle(this.radians * k);\n }\n /** The same angle in the range from -π (included) to π (not included). */\n normalize(): Angle {\n const twoPi = Math.PI * 2;\n // Stryker disable next-line ArithmeticOperator: x + π and x - π differ by 2π, so the result after mod 2π is the same\n return new Angle((((this.radians + Math.PI) % twoPi) + twoPi) % twoPi - Math.PI);\n }\n /** The vector with this angle and the length `length`. The result is a `Vec2`, so a chain continues in that domain. */\n toVec2(length = 1): Vec2 {\n return new Vec2(Math.cos(this.radians) * length, Math.sin(this.radians) * length);\n }\n sin(): number {\n return Math.sin(this.radians);\n }\n cos(): number {\n return Math.cos(this.radians);\n }\n degrees(): number {\n return (this.radians * 180) / Math.PI;\n }\n toString(): string {\n return `${this.radians} rad`;\n }\n}\n\n/** The ops of `AngleDomain`. */\nexport type AngleOps = OpTable<Angle, \"add\" | \"subtract\" | \"scale\" | \"normalize\" | \"toVec2\" | \"sin\" | \"cos\" | \"degrees\", \"add\" | \"subtract\">;\n\n/** The domain of angles. A number argument of `add` or `subtract` lifts to an angle in radians. */\nexport const AngleDomain: Domain<\"Angle\", Angle, AngleOps> = defineDomain<\"Angle\", Angle, AngleOps>({\n name: \"Angle\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Angle => u instanceof Angle,\n fromScalar: (n: number): Angle => new Angle(n),\n valid: (a: Angle): boolean => Number.isFinite(a.radians),\n show: (a: Angle): string => a.toString(),\n encode: (a: Angle): number => a.radians,\n decode: (u: unknown): Angle => new Angle(typeof u === \"number\" ? u : Number.NaN),\n ops: {\n add: { laws: [\"commutative\", \"associative\"], identity: (): Angle => Angle.zero, liftScalar: true, params: [\"domain\"] },\n subtract: { liftScalar: true, params: [\"domain\"] },\n scale: { params: [\"number\"] },\n normalize: {},\n toVec2: { params: [\"number\"] },\n sin: {},\n cos: {},\n degrees: {},\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\n\n/**\n * A JSON value that `JsonDomain` accepts: a text, a finite number, a boolean, an array or a plain object. The items of\n * an array and the fields of an object can be `null`.\n */\nexport type JsonValue = string | number | boolean | readonly unknown[] | { readonly [key: string]: unknown };\n\n/** The kind of a JSON value. */\nexport type JsonKind = \"boolean\" | \"number\" | \"string\" | \"array\" | \"object\";\n\n/** The kind of an item of an array or of a field of an object: the kind of a JSON value, or `\"null\"`. */\nexport type JsonItemKind = JsonKind | \"null\";\n\n/**\n * A leaf of the walk of `leaves` (JSON.LEAVES): the path of a field, the kind of its value, and the value. A leaf of the\n * kind `\"null\"` has no value.\n */\nexport interface JsonLeaf {\n readonly path: string;\n readonly kind: JsonItemKind;\n readonly value?: unknown;\n}\n\n/** The ops of `JsonDomain`. */\nexport type JsonOps = {\n readonly kind: FnOp<JsonValue, (v: JsonValue) => JsonKind>;\n readonly kinds: FnOp<JsonValue, (c: JsonValue) => readonly JsonItemKind[]>;\n readonly fields: FnOp<JsonValue, (o: JsonValue) => readonly string[]>;\n readonly field: FnOp<JsonValue, (o: JsonValue, k: unknown) => unknown>;\n readonly leaves: FnOp<JsonValue, (o: JsonValue, depth: number) => readonly JsonLeaf[]>;\n};\n\n/**\n * The domain of JSON values, for example the documents of a database. Each op is a function of plain data, so a\n * standalone module can copy the domain. Put `JsonDomain` last in the list of domains. Then `add`, `eq` and the other\n * ops of `NumDomain`, `TextDomain` and `BoolDomain` come first. The names `keys`, `get` and `values` are list ops. A\n * domain op comes before a list op on an array, so the domain does not use these names.\n */\nexport const JsonDomain: Domain<\"Json\", JsonValue, JsonOps> = defineDomain<\"Json\", JsonValue, JsonOps>({\n name: \"Json\",\n // A plain object has the prototype Object.prototype or null. Thus a Vec2, a LocalDate or a Map is not a JSON value.\n // An object with the kind \"vex.list\" and an array of items is a list of Vex. The test reads no name outside itself,\n // so a module can copy it.\n is: (u: unknown): u is JsonValue =>\n typeof u === \"string\" ||\n typeof u === \"boolean\" ||\n Number.isFinite(u) ||\n Array.isArray(u) ||\n (typeof u === \"object\" &&\n u !== null &&\n [Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) &&\n !((u as { readonly kind?: unknown }).kind === \"vex.list\" && Array.isArray((u as { readonly items?: unknown }).items))),\n samples: (): readonly JsonValue[] => [{ a: 1, b: [true, null], c: { d: \"x\" } }, [1, \"x\", null, [2]], \"x\", 2, false],\n // LOOP.SIZE.OPS: each op gives a part of its value, or a list with one item for each field or leaf of its value.\n ops: {\n // Each op reads no name outside itself, so a module can copy its text.\n kind: { fn: (v: JsonValue): JsonKind => (Array.isArray(v) ? \"array\" : (typeof v as JsonKind)), params: [], returns: \"string\", size: \"fixed\" },\n kinds: {\n fn: (c: JsonValue): readonly JsonItemKind[] => {\n if (typeof c !== \"object\") throw new Error(`\"kinds\" needs an array or an object, not a ${typeof c}`);\n // Array.from gives undefined for a hole, so a hole has the kind \"null\".\n return Array.from(Array.isArray(c) ? (c as readonly unknown[]) : Object.values(c), (x, i): JsonItemKind => {\n if (x === null || x === undefined) return \"null\";\n if (Array.isArray(x)) return \"array\";\n if (typeof x === \"string\" || typeof x === \"boolean\" || Number.isFinite(x) || [Object.prototype, null].includes(Object.getPrototypeOf(x) as object | null)) return typeof x as JsonKind;\n throw new Error(`\"kinds\" found a value that is not JSON at the position ${i}`);\n });\n },\n params: [],\n size: { size: [\"scaled\"], keys: \"position\" },\n },\n fields: {\n fn: (o: JsonValue): readonly string[] => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"fields\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n return Object.keys(o);\n },\n params: [],\n size: { size: [1], keys: \"position\" },\n },\n field: {\n fn: (o: JsonValue, k: unknown): unknown => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"field\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n if (typeof k !== \"string\") throw new Error(`\"field\" needs a text key, not a ${typeof k}`);\n if (!Object.hasOwn(o, k)) throw new Error(`the object has no field \"${k}\"`);\n const value = (o as Readonly<Record<string, unknown>>)[k];\n if (value === null || value === undefined) throw new Error(`the field \"${k}\" is null`);\n return value;\n },\n params: [\"any\"],\n returns: \"any\",\n // LOOP.SIZE.PART: a field of an object is an item of the object, and the op takes no other value.\n size: {\n size: [1, 0],\n byParts: { size: [[1, \"item\"], 0], count: [[1, \"item\"], 0], inner: [[1, \"item\"], 0], item: [[1, \"part\"], 0], part: [[1, \"part\"], 0] },\n },\n },\n // The walk of a schema as a flat list (JSON.LEAVES). The function reads no name outside itself, so a\n // module can copy it. A stack of the objects, not recursion, keeps the order of a recursive walk.\n leaves: {\n fn: (o: JsonValue, depth: number): readonly JsonLeaf[] => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"leaves\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n if (!Number.isSafeInteger(depth) || depth < 1 || depth > 100) throw new Error(`\"leaves\" needs a depth that is a whole number from 1 to 100, not ${String(depth)}`);\n const out: JsonLeaf[] = [];\n const stack = [{ at: o as Readonly<Record<string, unknown>>, keys: Object.keys(o), next: 0, prefix: \"\", level: 1 }];\n for (let top = stack.at(-1); top !== undefined; top = stack.at(-1)) {\n const key = top.keys[top.next++];\n if (key === undefined) {\n stack.pop();\n continue;\n }\n const x = top.at[key];\n const path = top.prefix === \"\" ? key : `${top.prefix}.${key}`;\n let kind: JsonItemKind;\n if (x === null || x === undefined) kind = \"null\";\n else if (Array.isArray(x)) kind = \"array\";\n else if (typeof x === \"string\" || typeof x === \"boolean\" || Number.isFinite(x) || [Object.prototype, null].includes(Object.getPrototypeOf(x) as object | null)) kind = typeof x as JsonKind;\n else throw new Error(`\"leaves\" found a value that is not JSON at the path \"${path}\"`);\n const inner = kind === \"object\" && top.level < depth ? Object.keys(x as object) : [];\n if (inner.length > 0) stack.push({ at: x as Readonly<Record<string, unknown>>, keys: inner, next: 0, prefix: path, level: top.level + 1 });\n else out.push(Object.freeze(kind === \"null\" ? { path, kind } : { path, kind, value: x }));\n }\n return Object.freeze(out);\n },\n params: [\"number\"],\n // A path repeats the keys above it, at most 100 levels, so the size of the list is the size of the object times a\n // fixed factor.\n size: { size: [\"scaled\", 0], keys: \"position\" },\n },\n },\n});\n","/**\n * The schema program (EXAMPLE.SCHEMA). It reads a list of JSON documents. For each field path, it gives the distinct\n * kinds of the values and the number of documents with the path.\n *\n * The walk `leaves(d, 3)` goes into an object that is not empty at a depth under 3. It records an empty object, or an\n * object at the depth 3, with the kind `object`. It does not go into an array. The kind of an array is `array<k1|k2>`,\n * from the distinct kinds of its items, or `array` when it is empty.\n */\nimport { app, axes, call, each, evaluate, fn, let_, lit, rec, space, v, vexList, type AnyDomain, type Expr, type ItemNames } from \"@mark1russell7/vex\";\nimport { JsonDomain } from \"./json.ts\";\nimport { BoolDomain, NumDomain } from \"./scalars.ts\";\nimport { TextDomain } from \"./text.ts\";\n\n/** A record of the schema: one field path, its distinct kinds in the order of their first occurrence, and its count of documents. */\nexport interface JsonFieldSchema {\n readonly path: string;\n readonly kinds: readonly string[];\n readonly count: number;\n}\n\n/** These are the domains of `SCHEMA_PROGRAM`. `JsonDomain` is last, so `eq`, `concat` and `gt` go to the domains of numbers and texts. */\nexport const SCHEMA_DOMAINS: readonly AnyDomain[] = [NumDomain, BoolDomain, TextDomain, JsonDomain];\n\n// Stryker disable next-line ArrayDeclaration: the added item is a text with no field, so its row is an error, and flat skips an error item (LIST.BUILD), so the list gives no notes, as the empty list does\nconst EMPTY = lit(vexList([]));\n/** A loop over the items of a list, with the names of the item and of its position (AXIS.LIST.ITEM). */\nconst loop = (list: Expr, as: ItemNames, body: Expr): Expr => each(axes.list(list), body, undefined, as);\nconst text = (...parts: Expr[]): Expr => parts.reduce((a, b) => app(\"concat\", a, b));\nconst field = (o: Expr, k: string): Expr => app(\"field\", o, lit(k));\n\n/** The kind of the array `a`: `array<k1|k2>` from the distinct kinds of its items, or `array` when it is empty. */\nconst arrayKind = fn([\"a\"], let_({ ks: app(\"distinct\", app(\"kinds\", v(\"a\"))) }, app(\"if\", app(\"eq\", app(\"count\", v(\"ks\")), lit(0)), lit(\"array\"), text(lit(\"array<\"), app(\"join\", v(\"ks\"), lit(\"|\")), lit(\">\")))));\n\n/** The notes of each document that is an object: the path and the kind of each leaf, and the position of the document. */\nconst notes = app(\n \"flat\",\n loop(\n v(\"docs\"),\n [\"d\", \"i\"],\n // Stryker disable next-line BooleanLiteral: flat skips an error item (LIST.BUILD), so a document without a kind gives no notes with true too\n loop(app(\"if\", app(\"ifError\", app(\"eq\", app(\"kind\", v(\"d\")), lit(\"object\")), lit(false)), app(\"leaves\", v(\"d\"), lit(3)), EMPTY), [\"l\"], rec({ path: field(v(\"l\"), \"path\"), kind: app(\"if\", app(\"eq\", field(v(\"l\"), \"kind\"), lit(\"array\")), call(\"arrayKind\", field(v(\"l\"), \"value\")), field(v(\"l\"), \"kind\")), doc: v(\"i\") })),\n ),\n);\n\n/** The records of the schema: for each group of notes with one path, the distinct kinds and the count of the documents. */\nconst records = let_(\n { groups: app(\"group\", v(\"notes\"), loop(v(\"notes\"), [\"n\"], field(v(\"n\"), \"path\"))) },\n app(\n \"values\",\n loop(\n v(\"groups\"),\n [\"g\"],\n rec({\n path: field(app(\"nth\", v(\"g\"), lit(0)), \"path\"),\n kinds: app(\"values\", app(\"distinct\", loop(v(\"g\"), [\"n\"], field(v(\"n\"), \"kind\")))),\n count: app(\"count\", app(\"distinct\", loop(v(\"g\"), [\"n\"], field(v(\"n\"), \"doc\")))),\n }),\n ),\n ),\n);\n\n/**\n * This is the schema program. It reads the documents from the name `docs`, and it gives an array of `JsonFieldSchema`\n * in the order that the paths first occur. It skips a document that is not an object, and a document with a value that\n * is not JSON. Evaluate it with `SCHEMA_DOMAINS`.\n */\nexport const SCHEMA_PROGRAM: Expr = let_({ arrayKind }, let_({ notes }, records));\n\n/**\n * This function evaluates `SCHEMA_PROGRAM` for the documents `docs`, and it gives the records of the schema. It throws\n * an `Error` with the code and the message when the program gives an error, for example when `docs` is not an array.\n */\nexport function schemaOf(docs: readonly unknown[]): readonly JsonFieldSchema[] {\n const r = evaluate(SCHEMA_PROGRAM, { space: space.array([{}]), origin: \"0\", domains: SCHEMA_DOMAINS, vars: { docs } });\n if (!r.ok) throw new Error(`the schema program gave ${r.error.code}: ${r.error.message}`);\n return r.value as readonly JsonFieldSchema[];\n}\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\n/** A wrapper around a function. Its op `invoke` calls the function. It shows how a domain can hold behavior. */\nexport class Fn {\n readonly fn: (...args: never[]) => unknown;\n\n constructor(fn: (...args: never[]) => unknown) {\n this.fn = fn;\n }\n invoke(...args: readonly unknown[]): unknown {\n return (this.fn as (...a: readonly unknown[]) => unknown)(...args);\n }\n}\n\n/** The ops of `FnDomain`. */\nexport type FnOps = OpTable<Fn, \"invoke\">;\n\n/** The domain of function wrappers. */\nexport const FnDomain: Domain<\"Fn\", Fn, FnOps> = defineDomain<\"Fn\", Fn, FnOps>({\n name: \"Fn\",\n is: (u: unknown): u is Fn => u instanceof Fn,\n // LOOP.SIZE.OPS: `invoke` calls a function of the value, so it has no size rule.\n ops: { invoke: {} },\n});\n\n/**\n * A value that is there (`top`) or not there (`bottom`). It shows a domain whose ops take functions. A Vex\n * program can also hold this state in its own errors, so most programs do not need this domain.\n */\nexport class Maybe<T> {\n readonly #has: boolean;\n readonly #value: T | undefined;\n\n private constructor(has: boolean, value: T | undefined) {\n this.#has = has;\n this.#value = value;\n }\n static top<T>(value: T): Maybe<T> {\n return new Maybe<T>(true, value);\n }\n static bottom<T = never>(): Maybe<T> {\n return new Maybe<T>(false, undefined);\n }\n isTop(): boolean {\n return this.#has;\n }\n isBottom(): boolean {\n return !this.#has;\n }\n map<U>(f: (value: T) => U): Maybe<U> {\n return this.#has ? Maybe.top(f(this.#value as T)) : Maybe.bottom<U>();\n }\n chain<U>(f: (value: T) => Maybe<U>): Maybe<U> {\n return this.#has ? f(this.#value as T) : Maybe.bottom<U>();\n }\n valueOr<U>(fallback: U): T | U {\n return this.#has ? (this.#value as T) : fallback;\n }\n}\n\n/** The ops of `MaybeDomain`. */\nexport type MaybeOps = OpTable<Maybe<unknown>, \"isTop\" | \"isBottom\" | \"map\" | \"chain\" | \"valueOr\">;\n\n/** The domain of `Maybe` values. */\nexport const MaybeDomain: Domain<\"Maybe\", Maybe<unknown>, MaybeOps> = defineDomain<\"Maybe\", Maybe<unknown>, MaybeOps>({\n name: \"Maybe\",\n is: (u: unknown): u is Maybe<unknown> => u instanceof Maybe,\n // LOOP.SIZE.OPS: `map` and `chain` call a function of the value, so they have no size rule.\n ops: { isTop: { size: \"scalar\" }, isBottom: { size: \"scalar\" }, map: {}, chain: {}, valueOr: { size: { size: [1, 1] } } },\n});\n"],"mappings":";;;;;;;AAaA,MAAa,YAAwB;CACnC,KAAK,MAAwB,OAAO,MAAM,YAAY,MAAM,QAAQ,OAAQ,EAAY,MAAM,YAAY,OAAQ,EAAY,MAAM;CACpI,aAAa,OAAsB;EAAE,GAAG;EAAG,GAAG;CAAE;CAChD,eAAiC;EAAC;GAAE,GAAG;GAAG,GAAG;EAAE;EAAG;GAAE,GAAG;GAAK,GAAG;EAAG;EAAG;GAAE,GAAG;GAAG,GAAG;EAAE;CAAC;CACnF,KAAK;EACH,KAAK;GAAE,KAAK,GAAU,OAAqB;IAAE,GAAG,EAAE,IAAI,EAAE;IAAG,GAAG,EAAE,IAAI,EAAE;GAAE;GAAI,iBAAwB;IAAE,GAAG;IAAG,GAAG;GAAE;EAAG;EACpH,UAAU,EAAE,KAAK,GAAU,OAAqB;GAAE,GAAG,EAAE,IAAI,EAAE;GAAG,GAAG,EAAE,IAAI,EAAE;EAAE,GAAG;EAChF,UAAU;GAAE,KAAK,GAAU,OAAqB;IAAE,GAAG,EAAE,IAAI,EAAE;IAAG,GAAG,EAAE,IAAI,EAAE;GAAE;GAAI,iBAAwB;IAAE,GAAG;IAAG,GAAG;GAAE;EAAG;EACzH,QAAQ,EAAE,KAAK,GAAU,OAAqB;GAAE,GAAG,EAAE,IAAI,EAAE;GAAG,GAAG,EAAE,IAAI,EAAE;EAAE,GAAG;EAC9E,KAAK,EAAE,KAAK,GAAU,OAAqB;GAAE,GAAG,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC;GAAG,GAAG,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC;EAAE,GAAG;EAC7F,KAAK,EAAE,KAAK,GAAU,OAAqB;GAAE,GAAG,KAAK,IAAI,EAAE,GAAG,EAAE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CAAC;EAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE;CAAE;AAC1H,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/vec2-form.ts","../src/vec2.ts","../src/xy.ts","../src/insets.ts","../src/ndvector.ts","../src/date.ts","../src/scalars.ts","../src/text.ts","../src/color.ts","../src/angle.ts","../src/json.ts","../src/schema.ts","../src/wrappers.ts"],"sourcesContent":["import type { ModuleForm } from \"@mark1russell7/vex\";\n\n/** A 2D vector in a standalone module: plain data with the fields of `Vec2`. */\ninterface Plain {\n readonly x: number;\n readonly y: number;\n}\n\n/**\n * The form of `Vec2Domain` in a standalone module (COMPILE.MODULE.FORM). A module has no import, and a copy of the class\n * is another class. Thus a vector in a module is plain data, the data of `toJSON` of a `Vec2`. Each op has the arithmetic\n * of the method with its name, so it has the same bits. The test accepts a `Vec2` too, so a host can give its vectors.\n */\nexport const VEC2_FORM: ModuleForm = {\n is: (u: unknown): boolean => typeof u === \"object\" && u !== null && typeof (u as Plain).x === \"number\" && typeof (u as Plain).y === \"number\",\n fromScalar: (n: number): Plain => ({ x: n, y: n }),\n samples: (): readonly Plain[] => [{ x: 0, y: 0 }, { x: 1.5, y: -2 }, { x: 3, y: 4 }],\n ops: {\n add: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x + b.x, y: a.y + b.y }), identity: (): Plain => ({ x: 0, y: 0 }) },\n subtract: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x - b.x, y: a.y - b.y }) },\n multiply: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x * b.x, y: a.y * b.y }), identity: (): Plain => ({ x: 1, y: 1 }) },\n divide: { fn: (a: Plain, b: Plain): Plain => ({ x: a.x / b.x, y: a.y / b.y }) },\n min: { fn: (a: Plain, b: Plain): Plain => ({ x: Math.min(a.x, b.x), y: Math.min(a.y, b.y) }) },\n max: { fn: (a: Plain, b: Plain): Plain => ({ x: Math.max(a.x, b.x), y: Math.max(a.y, b.y) }) },\n scale: { fn: (a: Plain, k: number): Plain => ({ x: a.x * k, y: a.y * k }) },\n negate: { fn: (a: Plain): Plain => ({ x: -a.x, y: -a.y }) },\n halve: { fn: (a: Plain): Plain => ({ x: a.x * 0.5, y: a.y * 0.5 }) },\n abs: { fn: (a: Plain): Plain => ({ x: Math.abs(a.x), y: Math.abs(a.y) }) },\n sign: { fn: (a: Plain): Plain => ({ x: Math.sign(a.x), y: Math.sign(a.y) }) },\n round: { fn: (a: Plain): Plain => ({ x: Math.round(a.x), y: Math.round(a.y) }) },\n floor: { fn: (a: Plain): Plain => ({ x: Math.floor(a.x), y: Math.floor(a.y) }) },\n ceil: { fn: (a: Plain): Plain => ({ x: Math.ceil(a.x), y: Math.ceil(a.y) }) },\n clamp: { fn: (a: Plain, lo: number, hi: number): Plain => ({ x: Math.min(hi, Math.max(lo, a.x)), y: Math.min(hi, Math.max(lo, a.y)) }) },\n swap: { fn: (a: Plain): Plain => ({ x: a.y, y: a.x }) },\n compose: { fn: (a: Plain, main: number, cross: number): Plain => ({ x: a.x * main + a.y * cross, y: a.y * main + a.x * cross }) },\n select: { fn: (m: Plain, a: Plain, b: Plain): Plain => ({ x: m.x !== 0 ? a.x : b.x, y: m.y !== 0 ? a.y : b.y }) },\n rotate: {\n fn: (a: Plain, radians: number): Plain => {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n return { x: c * a.x - s * a.y, y: s * a.x + c * a.y };\n },\n },\n normalize: {\n fn: (a: Plain): Plain => {\n const len = Math.hypot(a.x, a.y);\n return len === 0 ? { x: a.x, y: a.y } : { x: a.x * (1 / len), y: a.y * (1 / len) };\n },\n },\n minAxis: { fn: (a: Plain): Plain => (Number.isNaN(a.x) || Number.isNaN(a.y) ? { x: Number.NaN, y: Number.NaN } : a.x <= a.y ? { x: 1, y: 0 } : { x: 0, y: 1 }) },\n lerp: { fn: (a: Plain, o: Plain, t: number): Plain => ({ x: a.x + (o.x - a.x) * t, y: a.y + (o.y - a.y) * t }) },\n length: { fn: (a: Plain): number => Math.hypot(a.x, a.y) },\n lengthSq: { fn: (a: Plain): number => a.x * a.x + a.y * a.y },\n distance: { fn: (a: Plain, o: Plain): number => Math.hypot(a.x - o.x, a.y - o.y) },\n dot: { fn: (a: Plain, o: Plain): number => a.x * o.x + a.y * o.y },\n along: { fn: (a: Plain, dir: Plain): number => a.x * dir.x + a.y * dir.y },\n across: { fn: (a: Plain, dir: Plain): number => a.x * dir.y + a.y * dir.x },\n cross: { fn: (a: Plain, o: Plain): number => a.x * o.y - a.y * o.x },\n angle: { fn: (a: Plain): number => Math.atan2(a.y, a.x) },\n area: { fn: (a: Plain): number => a.x * a.y },\n sum: { fn: (a: Plain): number => a.x + a.y },\n minComponent: { fn: (a: Plain): number => Math.min(a.x, a.y) },\n maxComponent: { fn: (a: Plain): number => Math.max(a.x, a.y) },\n equals: { fn: (a: Plain, o: Plain): boolean => a.x === o.x && a.y === o.y },\n anyNonPositive: { fn: (a: Plain): boolean => a.x <= 0 || a.y <= 0 },\n allPositive: { fn: (a: Plain): boolean => a.x > 0 && a.y > 0 },\n anyNegative: { fn: (a: Plain): boolean => a.x < 0 || a.y < 0 },\n allNonNegative: { fn: (a: Plain): boolean => a.x >= 0 && a.y >= 0 },\n anyZero: { fn: (a: Plain): boolean => a.x === 0 || a.y === 0 },\n allZero: { fn: (a: Plain): boolean => a.x === 0 && a.y === 0 },\n anyLessThan: { fn: (a: Plain, n: number): boolean => a.x < n || a.y < n },\n allLessThan: { fn: (a: Plain, n: number): boolean => a.x < n && a.y < n },\n anyGreaterThan: { fn: (a: Plain, n: number): boolean => a.x > n || a.y > n },\n allGreaterThan: { fn: (a: Plain, n: number): boolean => a.x > n && a.y > n },\n },\n};\n","import { defineDomain, type Domain, type FnOp, type OpTable } from \"@mark1russell7/vex\";\nimport { VEC2_FORM } from \"./vec2-form.ts\";\n\n/**\n * An immutable 2D vector. The methods live on the prototype, so a vector costs two numbers. Division is real\n * division: a division by zero gives an infinite component, and the domain check turns it into `#NUM!`.\n */\nexport class Vec2 {\n readonly x: number;\n readonly y: number;\n\n constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n /** This function makes a vector. */\n static of(x: number, y: number): Vec2 {\n return new Vec2(x, y);\n }\n /** This function makes a vector with the same value in both components. */\n static scalar(n: number): Vec2 {\n return new Vec2(n, n);\n }\n /** The zero vector. */\n static readonly zero: Vec2 = new Vec2(0, 0);\n /** The vector of ones. */\n static readonly one: Vec2 = new Vec2(1, 1);\n\n add(o: Vec2): Vec2 {\n return new Vec2(this.x + o.x, this.y + o.y);\n }\n subtract(o: Vec2): Vec2 {\n return new Vec2(this.x - o.x, this.y - o.y);\n }\n /** The component-wise product. */\n multiply(o: Vec2): Vec2 {\n return new Vec2(this.x * o.x, this.y * o.y);\n }\n /** The component-wise quotient. A zero component of `o` gives an infinite component. */\n divide(o: Vec2): Vec2 {\n return new Vec2(this.x / o.x, this.y / o.y);\n }\n /** The component-wise minimum. */\n min(o: Vec2): Vec2 {\n return new Vec2(Math.min(this.x, o.x), Math.min(this.y, o.y));\n }\n /** The component-wise maximum. */\n max(o: Vec2): Vec2 {\n return new Vec2(Math.max(this.x, o.x), Math.max(this.y, o.y));\n }\n scale(k: number): Vec2 {\n return new Vec2(this.x * k, this.y * k);\n }\n negate(): Vec2 {\n return new Vec2(-this.x, -this.y);\n }\n halve(): Vec2 {\n return this.scale(0.5);\n }\n abs(): Vec2 {\n return new Vec2(Math.abs(this.x), Math.abs(this.y));\n }\n /** The component-wise sign, as `Math.sign` gives it. A component `NaN` stays `NaN`, and the domain check gives `#NUM!`. */\n sign(): Vec2 {\n return new Vec2(Math.sign(this.x), Math.sign(this.y));\n }\n round(): Vec2 {\n return new Vec2(Math.round(this.x), Math.round(this.y));\n }\n floor(): Vec2 {\n return new Vec2(Math.floor(this.x), Math.floor(this.y));\n }\n ceil(): Vec2 {\n return new Vec2(Math.ceil(this.x), Math.ceil(this.y));\n }\n clamp(lo: number, hi: number): Vec2 {\n return new Vec2(Math.min(hi, Math.max(lo, this.x)), Math.min(hi, Math.max(lo, this.y)));\n }\n swap(): Vec2 {\n return new Vec2(this.y, this.x);\n }\n /**\n * The vector with `main` along the unit axis of this vector and `cross` on the other axis: `this * main + swap(this) *\n * cross`. For the axis (1, 0) it is (main, cross), and for the axis (0, 1) it is (cross, main).\n */\n compose(main: number, cross: number): Vec2 {\n return new Vec2(this.x * main + this.y * cross, this.y * main + this.x * cross);\n }\n /**\n * The component-wise choice: a component of `a` where this mask has a component that is not 0, else the component\n * of `b`. Thus `hi.select(v.min(hi), v)` bounds each component of `v` by `hi`, and a 0 in `hi` sets no bound.\n */\n select(a: Vec2, b: Vec2): Vec2 {\n return new Vec2(this.x !== 0 ? a.x : b.x, this.y !== 0 ? a.y : b.y);\n }\n /** The vector turned by `radians`, counterclockwise. */\n rotate(radians: number): Vec2 {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n return new Vec2(c * this.x - s * this.y, s * this.x + c * this.y);\n }\n /** The vector with length 1. The zero vector stays zero. */\n normalize(): Vec2 {\n const len = this.length();\n return len === 0 ? this : this.scale(1 / len);\n }\n /**\n * The unit vector of the smaller component: (1, 0) if `x <= y`, else (0, 1). The comparison uses the signed values, so\n * `v.abs().minAxis()` compares sizes. A tie gives (1, 0). A component `NaN` gives `NaN` components, thus `#NUM!`.\n */\n minAxis(): Vec2 {\n if (Number.isNaN(this.x) || Number.isNaN(this.y)) return new Vec2(Number.NaN, Number.NaN);\n return this.x <= this.y ? new Vec2(1, 0) : new Vec2(0, 1);\n }\n /** The linear interpolation from this vector to `o`. */\n lerp(o: Vec2, t: number): Vec2 {\n return new Vec2(this.x + (o.x - this.x) * t, this.y + (o.y - this.y) * t);\n }\n length(): number {\n return Math.hypot(this.x, this.y);\n }\n lengthSq(): number {\n return this.x * this.x + this.y * this.y;\n }\n distance(o: Vec2): number {\n return Math.hypot(this.x - o.x, this.y - o.y);\n }\n dot(o: Vec2): number {\n return this.x * o.x + this.y * o.y;\n }\n /** The component along the unit axis `dir`: `dot(this, dir)`. For the axis (1, 0) it is x, and for (0, 1) it is y. */\n along(dir: Vec2): number {\n return this.x * dir.x + this.y * dir.y;\n }\n /** The component on the other axis of the unit axis `dir`: `dot(this, swap(dir))`. For the axis (1, 0) it is y. */\n across(dir: Vec2): number {\n return this.x * dir.y + this.y * dir.x;\n }\n /** The z component of the 3D cross product. */\n cross(o: Vec2): number {\n return this.x * o.y - this.y * o.x;\n }\n /** The angle of the vector, in radians, from the x axis. */\n angle(): number {\n return Math.atan2(this.y, this.x);\n }\n /** The product of the components: the area of a size vector. */\n area(): number {\n return this.x * this.y;\n }\n /** The sum of the components. */\n sum(): number {\n return this.x + this.y;\n }\n minComponent(): number {\n return Math.min(this.x, this.y);\n }\n maxComponent(): number {\n return Math.max(this.x, this.y);\n }\n equals(o: Vec2): boolean {\n return this.x === o.x && this.y === o.y;\n }\n anyNonPositive(): boolean {\n return this.x <= 0 || this.y <= 0;\n }\n allPositive(): boolean {\n return this.x > 0 && this.y > 0;\n }\n anyNegative(): boolean {\n return this.x < 0 || this.y < 0;\n }\n allNonNegative(): boolean {\n return this.x >= 0 && this.y >= 0;\n }\n anyZero(): boolean {\n return this.x === 0 || this.y === 0;\n }\n allZero(): boolean {\n return this.x === 0 && this.y === 0;\n }\n anyLessThan(n: number): boolean {\n return this.x < n || this.y < n;\n }\n allLessThan(n: number): boolean {\n return this.x < n && this.y < n;\n }\n anyGreaterThan(n: number): boolean {\n return this.x > n || this.y > n;\n }\n allGreaterThan(n: number): boolean {\n return this.x > n && this.y > n;\n }\n toJSON(): { readonly x: number; readonly y: number } {\n return { x: this.x, y: this.y };\n }\n toString(): string {\n return `(${this.x}, ${this.y})`;\n }\n}\n\ntype Vec2OpNames =\n | \"add\" | \"subtract\" | \"multiply\" | \"divide\" | \"min\" | \"max\" | \"scale\" | \"negate\" | \"halve\" | \"abs\" | \"sign\" | \"round\"\n | \"floor\" | \"ceil\" | \"clamp\" | \"swap\" | \"compose\" | \"select\" | \"rotate\" | \"normalize\" | \"minAxis\" | \"lerp\" | \"length\"\n | \"lengthSq\" | \"distance\" | \"dot\" | \"along\" | \"across\" | \"cross\" | \"angle\" | \"area\" | \"sum\" | \"minComponent\"\n | \"maxComponent\" | \"equals\" | \"anyNonPositive\" | \"allPositive\" | \"anyNegative\" | \"allNonNegative\" | \"anyZero\"\n | \"allZero\" | \"anyLessThan\" | \"allLessThan\" | \"anyGreaterThan\" | \"allGreaterThan\";\n\n/** The ops of `Vec2Domain`. The ops `x` and `y` give a component. */\nexport type Vec2Ops = OpTable<Vec2, Vec2OpNames, \"add\" | \"subtract\" | \"multiply\" | \"divide\" | \"min\" | \"max\" | \"select\"> & {\n readonly x: FnOp<Vec2, (v: Vec2) => number>;\n readonly y: FnOp<Vec2, (v: Vec2) => number>;\n};\n\n/** The domain of 2D vectors. A number argument of a component-wise op lifts to a vector with that value twice. */\nexport const Vec2Domain: Domain<\"Vec2\", Vec2, Vec2Ops> = defineDomain<\"Vec2\", Vec2, Vec2Ops>({\n name: \"Vec2\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Vec2 => u instanceof Vec2,\n fromScalar: (n: number): Vec2 => Vec2.scalar(n),\n valid: (v: Vec2): boolean => Number.isFinite(v.x) && Number.isFinite(v.y),\n show: (v: Vec2): string => v.toString(),\n encode: (v: Vec2): readonly [number, number] => [v.x, v.y],\n decode: (u: unknown): Vec2 => {\n // Stryker disable next-line ArrayDeclaration: a list with a text gives NaN components, like the empty list\n const [x, y] = Array.isArray(u) ? (u as readonly unknown[]) : [];\n return new Vec2(typeof x === \"number\" ? x : Number.NaN, typeof y === \"number\" ? y : Number.NaN);\n },\n // COMPILE.MODULE.FORM: a module cannot hold this class, so a vector in a module is plain data.\n moduleForm: { ...VEC2_FORM, literal: (u: unknown): { readonly x: number; readonly y: number } | undefined => (u instanceof Vec2 ? u.toJSON() : undefined) },\n ops: {\n // The components are fields of a vector, not methods, so these two ops are functions.\n x: { fn: (v: Vec2): number => v.x, params: [], returns: \"number\" },\n y: { fn: (v: Vec2): number => v.y, params: [], returns: \"number\" },\n add: { laws: [\"commutative\", \"associative\"], identity: () => Vec2.zero, liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n subtract: { liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n multiply: { laws: [\"commutative\", \"associative\"], identity: () => Vec2.one, liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n divide: { liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n min: { laws: [\"commutative\", \"associative\", \"idempotent\"], liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n max: { laws: [\"commutative\", \"associative\", \"idempotent\"], liftScalar: true, params: [\"domain\"], returns: \"domain\" },\n scale: { params: [\"number\"], returns: \"domain\" },\n negate: { params: [], returns: \"domain\" },\n halve: { params: [], returns: \"domain\" },\n abs: { params: [], returns: \"domain\" },\n sign: { params: [], returns: \"domain\" },\n round: { params: [], returns: \"domain\" },\n floor: { params: [], returns: \"domain\" },\n ceil: { params: [], returns: \"domain\" },\n clamp: { params: [\"number\", \"number\"], returns: \"domain\" },\n swap: { params: [], returns: \"domain\" },\n compose: { params: [\"number\", \"number\"], returns: \"domain\" },\n select: { liftScalar: true, params: [\"domain\", \"domain\"], returns: \"domain\" },\n rotate: { params: [\"number\"], returns: \"domain\" },\n normalize: { params: [], returns: \"domain\" },\n minAxis: { params: [], returns: \"domain\" },\n lerp: { params: [\"domain\", \"number\"], returns: \"domain\" },\n length: { params: [], returns: \"number\" },\n lengthSq: { params: [], returns: \"number\" },\n distance: { params: [\"domain\"], returns: \"number\" },\n dot: { laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n along: { params: [\"domain\"], returns: \"number\" },\n across: { params: [\"domain\"], returns: \"number\" },\n cross: { params: [\"domain\"], returns: \"number\" },\n angle: { params: [], returns: \"number\" },\n area: { params: [], returns: \"number\" },\n sum: { params: [], returns: \"number\" },\n minComponent: { params: [], returns: \"number\" },\n maxComponent: { params: [], returns: \"number\" },\n equals: { laws: [\"commutative\"], params: [\"domain\"], returns: \"boolean\" },\n anyNonPositive: { params: [], returns: \"boolean\" },\n allPositive: { params: [], returns: \"boolean\" },\n anyNegative: { params: [], returns: \"boolean\" },\n allNonNegative: { params: [], returns: \"boolean\" },\n anyZero: { params: [], returns: \"boolean\" },\n allZero: { params: [], returns: \"boolean\" },\n anyLessThan: { params: [\"number\"], returns: \"boolean\" },\n allLessThan: { params: [\"number\"], returns: \"boolean\" },\n anyGreaterThan: { params: [\"number\"], returns: \"boolean\" },\n allGreaterThan: { params: [\"number\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\n\n/**\n * A 2D vector as plain data. `XYDomain` has the component-wise ops of `Vec2Domain`, but each op is a function of plain\n * data. Thus a standalone module of `@mark1russell7/vex-compiler` can copy the domain, and a 2D program can be a module.\n */\nexport interface XY {\n readonly x: number;\n readonly y: number;\n}\n\ntype XYFn2 = (a: XY, b: XY) => XY;\ntype XYFn1 = (a: XY) => XY;\ntype XYNum1 = (a: XY) => number;\n\n/** The ops of `XYDomain`. */\nexport type XYOps = {\n readonly x: FnOp<XY, XYNum1>;\n readonly y: FnOp<XY, XYNum1>;\n readonly add: FnOp<XY, XYFn2>;\n readonly subtract: FnOp<XY, XYFn2>;\n readonly multiply: FnOp<XY, XYFn2>;\n readonly divide: FnOp<XY, XYFn2>;\n readonly min: FnOp<XY, XYFn2>;\n readonly max: FnOp<XY, XYFn2>;\n readonly scale: FnOp<XY, (a: XY, k: number) => XY>;\n readonly negate: FnOp<XY, XYFn1>;\n readonly abs: FnOp<XY, XYFn1>;\n readonly sign: FnOp<XY, XYFn1>;\n readonly minAxis: FnOp<XY, XYFn1>;\n readonly floor: FnOp<XY, XYFn1>;\n readonly ceil: FnOp<XY, XYFn1>;\n readonly round: FnOp<XY, XYFn1>;\n readonly dot: FnOp<XY, (a: XY, b: XY) => number>;\n readonly length: FnOp<XY, XYNum1>;\n readonly distance: FnOp<XY, (a: XY, b: XY) => number>;\n readonly area: FnOp<XY, XYNum1>;\n readonly sum: FnOp<XY, XYNum1>;\n readonly equals: FnOp<XY, (a: XY, b: XY) => boolean>;\n};\n\n/**\n * The domain of 2D vectors as plain data: an object with the two number fields `x` and `y` and no other field. The op\n * `xy` of `NumDomain` makes one. No op lifts a number, so each op has a static site in a module. Put `XYDomain` before\n * `NumRecordDomain`, because a record of numbers accepts the same objects.\n */\nexport const XYDomain: Domain<\"XY\", XY, XYOps> = defineDomain<\"XY\", XY, XYOps>({\n name: \"XY\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n fields: [\"x\", \"y\"],\n // A plain object: its prototype is Object.prototype or null, so an instance of a class such as Vec2 is not an XY.\n is: (u: unknown): u is XY => typeof u === \"object\" && u !== null && [Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) && Object.keys(u).length === 2 && typeof (u as XY).x === \"number\" && typeof (u as XY).y === \"number\",\n valid: (v: XY): boolean => Number.isFinite(v.x) && Number.isFinite(v.y),\n show: (v: XY): string => `(${v.x}, ${v.y})`,\n samples: (): readonly XY[] => [{ x: 0, y: 0 }, { x: 1.5, y: -2 }, { x: 3, y: 4 }],\n ops: {\n x: { fn: (a: XY): number => a.x, params: [], returns: \"number\" },\n y: { fn: (a: XY): number => a.y, params: [], returns: \"number\" },\n add: { fn: (a: XY, b: XY): XY => ({ x: a.x + b.x, y: a.y + b.y }), laws: [\"commutative\", \"associative\"], identity: (): XY => ({ x: 0, y: 0 }), params: [\"domain\"], returns: \"domain\" },\n subtract: { fn: (a: XY, b: XY): XY => ({ x: a.x - b.x, y: a.y - b.y }), params: [\"domain\"], returns: \"domain\" },\n multiply: { fn: (a: XY, b: XY): XY => ({ x: a.x * b.x, y: a.y * b.y }), laws: [\"commutative\", \"associative\"], identity: (): XY => ({ x: 1, y: 1 }), params: [\"domain\"], returns: \"domain\" },\n divide: { fn: (a: XY, b: XY): XY => ({ x: a.x / b.x, y: a.y / b.y }), params: [\"domain\"], returns: \"domain\" },\n min: { fn: (a: XY, b: XY): XY => ({ x: Math.min(a.x, b.x), y: Math.min(a.y, b.y) }), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], returns: \"domain\" },\n max: { fn: (a: XY, b: XY): XY => ({ x: Math.max(a.x, b.x), y: Math.max(a.y, b.y) }), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], returns: \"domain\" },\n scale: { fn: (a: XY, k: number): XY => ({ x: a.x * k, y: a.y * k }), params: [\"number\"], returns: \"domain\" },\n negate: { fn: (a: XY): XY => ({ x: -a.x, y: -a.y }), params: [], returns: \"domain\" },\n abs: { fn: (a: XY): XY => ({ x: Math.abs(a.x), y: Math.abs(a.y) }), params: [], returns: \"domain\" },\n sign: { fn: (a: XY): XY => ({ x: Math.sign(a.x), y: Math.sign(a.y) }), params: [], returns: \"domain\" },\n // The rules of minAxis of Vec2 (VEC2.MINAXIS). NaN components fail the check of the result, so `NaN` gives #NUM!.\n minAxis: { fn: (a: XY): XY => (Number.isNaN(a.x) || Number.isNaN(a.y) ? { x: Number.NaN, y: Number.NaN } : a.x <= a.y ? { x: 1, y: 0 } : { x: 0, y: 1 }), params: [], returns: \"domain\" },\n floor: { fn: (a: XY): XY => ({ x: Math.floor(a.x), y: Math.floor(a.y) }), params: [], returns: \"domain\" },\n ceil: { fn: (a: XY): XY => ({ x: Math.ceil(a.x), y: Math.ceil(a.y) }), params: [], returns: \"domain\" },\n round: { fn: (a: XY): XY => ({ x: Math.round(a.x), y: Math.round(a.y) }), params: [], returns: \"domain\" },\n dot: { fn: (a: XY, b: XY): number => a.x * b.x + a.y * b.y, laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n length: { fn: (a: XY): number => Math.hypot(a.x, a.y), params: [], returns: \"number\" },\n distance: { fn: (a: XY, b: XY): number => Math.hypot(a.x - b.x, a.y - b.y), laws: [\"commutative\"], params: [\"domain\"], returns: \"number\" },\n area: { fn: (a: XY): number => a.x * a.y, params: [], returns: \"number\" },\n sum: { fn: (a: XY): number => a.x + a.y, params: [], returns: \"number\" },\n equals: { fn: (a: XY, b: XY): boolean => a.x === b.x && a.y === b.y, laws: [\"commutative\"], params: [\"domain\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\nimport { Vec2 } from \"./vec2.ts\";\nimport type { XY } from \"./xy.ts\";\n\n/**\n * The four sides of an inset, as plain data. The `start` sides are the leading pair, and the `end` sides are the\n * trailing pair. Each pair is in the order of a 2D vector: `x`, then `y`. The names are logical, so a side does not\n * depend on the direction of an axis.\n */\nexport interface Insets {\n readonly startX: number;\n readonly startY: number;\n readonly endX: number;\n readonly endY: number;\n}\n\ntype InsetsNum1 = (a: Insets) => number;\ntype InsetsXY1 = (a: Insets) => XY;\ntype InsetsVec1 = (a: Insets) => Vec2;\n\n/** The ops of `InsetsDomain`. */\nexport type InsetsOps = {\n readonly startX: FnOp<Insets, InsetsNum1>;\n readonly startY: FnOp<Insets, InsetsNum1>;\n readonly endX: FnOp<Insets, InsetsNum1>;\n readonly endY: FnOp<Insets, InsetsNum1>;\n readonly start: FnOp<Insets, InsetsXY1>;\n readonly end: FnOp<Insets, InsetsXY1>;\n readonly startVec2: FnOp<Insets, InsetsVec1>;\n readonly endVec2: FnOp<Insets, InsetsVec1>;\n readonly add: FnOp<Insets, (a: Insets, b: Insets) => Insets> & { readonly liftScalar: true };\n readonly scale: FnOp<Insets, (a: Insets, k: number) => Insets>;\n};\n\n/**\n * The domain of insets: an object with the four number fields of `Insets` and no other field. The op `insets` of\n * `NumDomain` makes one, and a number argument of `add` lifts to four equal sides. `start` and `end` give plain `XY`\n * values, so a module can copy them. `startVec2` and `endVec2` give `Vec2` values, and a module cannot copy them. Put\n * `InsetsDomain` before `NumRecordDomain`, because a record of numbers accepts the same objects.\n */\nexport const InsetsDomain: Domain<\"Insets\", Insets, InsetsOps> = defineDomain<\"Insets\", Insets, InsetsOps>({\n name: \"Insets\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n fields: [\"startX\", \"startY\", \"endX\", \"endY\"],\n // A plain object: its prototype is Object.prototype or null, so an instance of a class is not a value of this domain.\n is: (u: unknown): u is Insets => {\n if (typeof u !== \"object\" || u === null || ![Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) || Object.keys(u).length !== 4) return false;\n const v = u as Insets;\n return typeof v.startX === \"number\" && typeof v.startY === \"number\" && typeof v.endX === \"number\" && typeof v.endY === \"number\";\n },\n fromScalar: (n: number): Insets => ({ startX: n, startY: n, endX: n, endY: n }),\n valid: (v: Insets): boolean => Number.isFinite(v.startX) && Number.isFinite(v.startY) && Number.isFinite(v.endX) && Number.isFinite(v.endY),\n show: (v: Insets): string => `(${v.startX}, ${v.startY}, ${v.endX}, ${v.endY})`,\n samples: (): readonly Insets[] => [\n { startX: 0, startY: 0, endX: 0, endY: 0 },\n { startX: 1.5, startY: -2, endX: 3, endY: 4 },\n { startX: 8, startY: 8, endX: 8, endY: 8 },\n ],\n ops: {\n startX: { fn: (a: Insets): number => a.startX, params: [], returns: \"number\" },\n startY: { fn: (a: Insets): number => a.startY, params: [], returns: \"number\" },\n endX: { fn: (a: Insets): number => a.endX, params: [], returns: \"number\" },\n endY: { fn: (a: Insets): number => a.endY, params: [], returns: \"number\" },\n start: { fn: (a: Insets): XY => ({ x: a.startX, y: a.startY }), params: [], returns: \"domain:XY\" },\n end: { fn: (a: Insets): XY => ({ x: a.endX, y: a.endY }), params: [], returns: \"domain:XY\" },\n startVec2: { fn: (a: Insets): Vec2 => new Vec2(a.startX, a.startY), params: [], returns: \"domain:Vec2\" },\n endVec2: { fn: (a: Insets): Vec2 => new Vec2(a.endX, a.endY), params: [], returns: \"domain:Vec2\" },\n add: {\n fn: (a: Insets, b: Insets): Insets => ({ startX: a.startX + b.startX, startY: a.startY + b.startY, endX: a.endX + b.endX, endY: a.endY + b.endY }),\n laws: [\"commutative\", \"associative\"],\n identity: (): Insets => ({ startX: 0, startY: 0, endX: 0, endY: 0 }),\n liftScalar: true,\n params: [\"domain\"],\n returns: \"domain\",\n },\n scale: { fn: (a: Insets, k: number): Insets => ({ startX: a.startX * k, startY: a.startY * k, endX: a.endX * k, endY: a.endY * k }), params: [\"number\"], returns: \"domain\" },\n },\n});\n","import { defineDomain, type Domain, type FnOp, type OpTable, type SizeRule } from \"@mark1russell7/vex\";\n\n/**\n * An immutable vector with named components. The type parameter `K` is the set of component names. Ops that\n * combine two vectors use the union of their names, and a missing component counts as 0. The constructor\n * keeps each number, also a number that is not finite: the domain check reports such a value as `#NUM!`.\n */\nexport class NDVector<K extends string = string> {\n /** The components: name to number. */\n readonly c: Readonly<Record<K, number>>;\n\n constructor(c: Readonly<Record<K, number>>) {\n this.c = Object.freeze({ ...c });\n }\n\n /** This function makes a vector from name and value pairs. */\n static of<K extends string>(entries: readonly (readonly [K, number])[]): NDVector<K> {\n const c = {} as Record<K, number>;\n for (const [k, v] of entries) c[k] = v;\n return new NDVector(c);\n }\n /** This function makes the zero vector over the names `keys`. */\n static zero<K extends string>(keys: readonly K[] = []): NDVector<K> {\n return NDVector.of(keys.map((k) => [k, 0] as const));\n }\n\n /** The names of the components. */\n keys(): readonly K[] {\n return Object.keys(this.c) as K[];\n }\n /** The value of a component, or 0 if the vector does not have it. */\n get(k: string): number {\n return Object.hasOwn(this.c, k) ? Number((this.c as Readonly<Record<string, number>>)[k]) : 0;\n }\n set<K2 extends string>(k: K2, v: number): NDVector<K | K2> {\n return new NDVector({ ...this.c, [k]: v } as Record<K | K2, number>);\n }\n map(f: (name: K, v: number) => number): NDVector<K> {\n const c = {} as Record<K, number>;\n for (const k of this.keys()) c[k] = f(k, this.get(k));\n return new NDVector(c);\n }\n /** The vector with only the names in `keys`. A zero component is dropped, unless `keepZeros` is true. */\n pick<K2 extends K>(keys: readonly K2[], keepZeros = false): NDVector<K2> {\n const c = {} as Record<K2, number>;\n for (const k of keys) {\n const v = this.get(k);\n if (keepZeros || v !== 0) c[k] = v;\n }\n return new NDVector(c);\n }\n /** The vector with the names in `keys` added. A new component is 0. */\n withKeys<K2 extends string>(keys: readonly K2[]): NDVector<K | K2> {\n const c = { ...this.c } as Record<K | K2, number>;\n for (const k of keys) if (!Object.hasOwn(c, k)) c[k] = 0;\n return new NDVector(c);\n }\n #combine<K2 extends string>(o: NDVector<K2>, f: (a: number, b: number) => number): NDVector<K | K2> {\n const c = {} as Record<K | K2, number>;\n for (const k of new Set<K | K2>([...this.keys(), ...o.keys()])) c[k] = f(this.get(k), o.get(k));\n return new NDVector(c);\n }\n add<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a + b);\n }\n subtract<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a - b);\n }\n /** The component-wise product. */\n multiply<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => a * b);\n }\n /** The component-wise minimum. A component that one vector does not have counts as 0. */\n min<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => Math.min(a, b));\n }\n /** The component-wise maximum. A component that one vector does not have counts as 0. */\n max<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => Math.max(a, b));\n }\n /** Of each component, the value of this vector if it is not 0, else the value of `o`. */\n mergePreferNonZero<K2 extends string>(o: NDVector<K2>): NDVector<K | K2> {\n return this.#combine(o, (a, b) => (a !== 0 ? a : b));\n }\n scale(k: number): NDVector<K> {\n return this.map((_n, v) => v * k);\n }\n clamp(lo: number, hi: number): NDVector<K> {\n return this.map((_n, v) => Math.min(hi, Math.max(lo, v)));\n }\n dot(o: NDVector): number {\n let s = 0;\n for (const k of new Set<string>([...this.keys(), ...o.keys()])) s += this.get(k) * o.get(k);\n return s;\n }\n /** The L2 length. */\n length(): number {\n return Math.sqrt(this.keys().reduce((s, k) => s + this.get(k) ** 2, 0));\n }\n /** The L1 norm. */\n norm1(): number {\n return this.keys().reduce((s, k) => s + Math.abs(this.get(k)), 0);\n }\n /** The largest absolute component. */\n normInf(): number {\n return this.keys().reduce((m, k) => Math.max(m, Math.abs(this.get(k))), 0);\n }\n equals(o: NDVector): boolean {\n const keys = new Set<string>([...this.keys(), ...o.keys()]);\n for (const k of keys) if (this.get(k) !== o.get(k)) return false;\n return true;\n }\n /** True if each component is a finite number. */\n isFinite(): boolean {\n return this.keys().every((k) => Number.isFinite(this.get(k)));\n }\n toJSON(): Readonly<Record<K, number>> {\n return { ...this.c };\n }\n toString(): string {\n return `NDVector(${JSON.stringify(this.c)})`;\n }\n}\n\ntype NDOpNames =\n | \"add\" | \"subtract\" | \"multiply\" | \"min\" | \"max\" | \"mergePreferNonZero\" | \"scale\" | \"clamp\" | \"dot\" | \"length\" | \"norm1\" | \"normInf\"\n | \"equals\" | \"pick\" | \"withKeys\" | \"get\" | \"set\";\n\n/** The ops of `NDVectorDomain`. No op lifts numbers. */\nexport type NDVectorOps = OpTable<NDVector, NDOpNames>;\n\n/** The ops of `LiftedNDVectorDomain`. */\nexport type LiftedNDVectorOps = OpTable<NDVector, NDOpNames, \"add\" | \"subtract\" | \"multiply\" | \"dot\">;\n\n/** The size rule of an op whose result has the keys of both vectors, each key one time (LOOP.SIZE.OPS). */\nconst KEYS = { size: [1, 1], union: true } as const satisfies SizeRule;\n\n/** The size rule of an op that lifts a number to the vector `{ scalar: n }`: the keys of both, and maybe one key more. */\nconst LIFTED = { size: [1, 1], union: true, constant: true } as const satisfies SizeRule;\n\nconst ndOps = {\n add: { laws: [\"commutative\", \"associative\"], identity: (): NDVector => NDVector.zero(), params: [\"domain\"], size: KEYS },\n subtract: { params: [\"domain\"], size: KEYS },\n multiply: { laws: [\"commutative\", \"associative\"], params: [\"domain\"], size: KEYS },\n min: { laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n max: { laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n mergePreferNonZero: { laws: [\"associative\", \"idempotent\"], params: [\"domain\"], size: KEYS },\n scale: { params: [\"number\"], size: { size: [1, 0] } },\n clamp: { params: [\"number\", \"number\"], size: { size: [1, 0, 0] } },\n dot: { laws: [\"commutative\"], params: [\"domain\"], size: \"scalar\" },\n length: { size: \"scalar\" },\n norm1: { size: \"scalar\" },\n normInf: { size: \"scalar\" },\n equals: { laws: [\"commutative\"], params: [\"domain\"], size: \"scalar\" },\n pick: { size: { size: [1, 1, 0], union: true } },\n withKeys: { size: KEYS },\n get: { params: [\"string\"], size: \"scalar\" },\n set: { params: [\"string\", \"number\"], size: { size: [1, 1, 0], union: true } },\n} as const satisfies NDVectorOps;\n\nconst isNDVector = (u: unknown): u is NDVector => u instanceof NDVector;\n\n/** The domain of named-component vectors. A number argument is an error here: use `LiftedNDVectorDomain` to lift. */\nexport const NDVectorDomain: Domain<\"NDVector\", NDVector, NDVectorOps> = defineDomain<\"NDVector\", NDVector, NDVectorOps>({\n name: \"NDVector\",\n is: isNDVector,\n valid: (v: NDVector): boolean => v.isFinite(),\n show: (v: NDVector): string => v.toString(),\n encode: (v: NDVector): unknown => v.toJSON(),\n decode: (u: unknown): NDVector => new NDVector(u as Readonly<Record<string, number>>),\n ops: ndOps,\n});\n\n/**\n * The domain of named-component vectors with scalar lifting. A number argument of `add`, `subtract`,\n * `multiply` or `dot` becomes the vector `{ scalar: n }`. This domain is independent of `NDVectorDomain`:\n * the two can be in one program, and neither changes the other.\n */\nexport const LiftedNDVectorDomain: Domain<\"NDVector(lifted)\", NDVector, LiftedNDVectorOps> = defineDomain<\"NDVector(lifted)\", NDVector, LiftedNDVectorOps>({\n name: \"NDVector(lifted)\",\n is: isNDVector,\n fromScalar: (n: number): NDVector => new NDVector({ scalar: n }),\n valid: (v: NDVector): boolean => v.isFinite(),\n show: (v: NDVector): string => v.toString(),\n ops: {\n ...ndOps,\n add: { ...ndOps.add, liftScalar: true, size: LIFTED },\n subtract: { ...ndOps.subtract, liftScalar: true, size: LIFTED },\n multiply: { ...ndOps.multiply, liftScalar: true, size: LIFTED },\n dot: { ...ndOps.dot, liftScalar: true },\n },\n});\n\n/** A plain record whose values are finite numbers. */\nexport type NumRecord = Readonly<Record<string, number>>;\n\n/** The ops of `NumRecordDomain`. */\nexport type NumRecordOps = {\n readonly toNDVector: FnOp<NumRecord, (r: NumRecord) => NDVector>;\n};\n\nconst isNumRecord = (u: unknown): u is NumRecord => {\n if (typeof u !== \"object\" || u === null || Array.isArray(u)) return false;\n const proto: unknown = Object.getPrototypeOf(u);\n // Number.isFinite gives false for each value that is not a number.\n return (proto === Object.prototype || proto === null) && Object.values(u).every((v) => Number.isFinite(v));\n};\n\n/** The domain of plain number records. Its op `toNDVector` builds a vector from fields, for example from `rec()`. */\nexport const NumRecordDomain: Domain<\"NumRecord\", NumRecord, NumRecordOps> = defineDomain<\"NumRecord\", NumRecord, NumRecordOps>({\n name: \"NumRecord\",\n is: isNumRecord,\n ops: {\n toNDVector: { fn: (r: NumRecord): NDVector => new NDVector(r), size: { size: [1] } },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\nconst MS_PER_DAY = 86_400_000;\n\n/** The largest distance from 1970-01-01 in days. The `Date` of JavaScript has the same range. */\nexport const MAX_DAYS = 100_000_000;\n\nconst ISO = /^([+-]?\\d{4,6})-(\\d{2})-(\\d{2})$/;\n\n/** This function gives the `Date` of JavaScript at 00:00 UTC of a day. */\nconst utc = (days: number): Date => new Date(days * MS_PER_DAY);\n\n/**\n * An immutable day of the calendar, without a time and without a time zone. It keeps the number of days since\n * 1970-01-01, so the arithmetic of days is the arithmetic of numbers. The calendar is the Gregorian calendar, also\n * before 1582.\n */\nexport class LocalDate {\n /** The number of days since 1970-01-01. */\n readonly days: number;\n\n constructor(days: number) {\n this.days = days;\n }\n\n /**\n * This function makes a date from a year, a month from 1 to 12, and a day. A month or a day outside its range rolls\n * over, like the function `DATE` of a spreadsheet. Thus month 13 is January of the next year, and day 0 is the last\n * day of the month before. A number that is not whole gives a date that is not valid.\n */\n static of(year: number, month: number, day: number): LocalDate {\n if (![year, month, day].every(Number.isSafeInteger)) return new LocalDate(Number.NaN);\n // setUTCFullYear does not change the years 0 to 99 into 1900 to 1999, but Date.UTC does.\n const d = new Date(0);\n d.setUTCFullYear(year, month - 1, day);\n return new LocalDate(Math.round(d.getTime() / MS_PER_DAY));\n }\n\n /** This function reads a date in the form `YYYY-MM-DD`. A day that does not exist, for example `2026-02-30`, gives `undefined`. */\n static parse(text: string): LocalDate | undefined {\n const m = ISO.exec(text.trim());\n if (m === null) return undefined;\n const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];\n const date = LocalDate.of(y, mo, d);\n // A month or a day outside its range rolls over into another month, so the month tells if the day exists.\n return date.month() === mo ? date : undefined;\n }\n\n /** The year. */\n year(): number {\n return utc(this.days).getUTCFullYear();\n }\n /** The month, from 1 to 12. */\n month(): number {\n return utc(this.days).getUTCMonth() + 1;\n }\n /** The day of the month, from 1 to 31. */\n day(): number {\n return utc(this.days).getUTCDate();\n }\n /** The day of the week, from 1 (Sunday) to 7 (Saturday), like `WEEKDAY` of a spreadsheet. */\n weekday(): number {\n return utc(this.days).getUTCDay() + 1;\n }\n /** The date `n` days later. A negative `n` goes back. */\n add(n: number): LocalDate {\n return new LocalDate(this.days + n);\n }\n /** The number of days from the date `x` to this date, or the date `x` days before this date. */\n subtract(x: LocalDate | number): LocalDate | number {\n return x instanceof LocalDate ? this.days - x.days : new LocalDate(this.days - x);\n }\n /**\n * The same day `n` months later, like `EDATE` of a spreadsheet. When that month is shorter, the result is its last\n * day: one month after 31 January is the last day of February.\n */\n addMonths(n: number): LocalDate {\n // LocalDate.of gives a date that is not valid for a number of months that is not whole.\n const first = LocalDate.of(this.year(), this.month() + n, 1);\n const last = LocalDate.of(first.year(), first.month() + 1, 0);\n return new LocalDate(Math.min(first.days + this.day() - 1, last.days));\n }\n /** The last day of the month `n` months later, like `EOMONTH` of a spreadsheet. */\n endOfMonth(n: number): LocalDate {\n return LocalDate.of(this.year(), this.month() + n + 1, 0);\n }\n gt(o: LocalDate): boolean {\n return this.days > o.days;\n }\n gte(o: LocalDate): boolean {\n return this.days >= o.days;\n }\n lt(o: LocalDate): boolean {\n return this.days < o.days;\n }\n lte(o: LocalDate): boolean {\n return this.days <= o.days;\n }\n eq(o: LocalDate): boolean {\n return this.days === o.days;\n }\n /** The form `YYYY-MM-DD`. A year before 0 or after 9999 has a sign and six digits, as in ISO 8601. */\n toString(): string {\n const y = this.year();\n // Stryker disable next-line EqualityOperator: the year 0 takes the first branch, so y < 0 and y <= 0 are the same in the second\n const year = y >= 0 && y <= 9999 ? String(y).padStart(4, \"0\") : `${y < 0 ? \"-\" : \"+\"}${String(Math.abs(y)).padStart(6, \"0\")}`;\n return `${year}-${String(this.month()).padStart(2, \"0\")}-${String(this.day()).padStart(2, \"0\")}`;\n }\n}\n\n/** The ops of `DateDomain`. */\nexport type DateOps = OpTable<LocalDate, \"add\" | \"subtract\" | \"addMonths\" | \"endOfMonth\" | \"year\" | \"month\" | \"day\" | \"weekday\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"eq\">;\n\n/**\n * The domain of dates. `add` takes a count of days. `subtract` takes a date, for the days between the two dates, or a\n * count of days. A valid date is a whole count of days, within `MAX_DAYS` of 1970-01-01.\n */\nexport const DateDomain: Domain<\"Date\", LocalDate, DateOps> = defineDomain<\"Date\", LocalDate, DateOps>({\n name: \"Date\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is LocalDate => u instanceof LocalDate,\n valid: (d: LocalDate): boolean => Number.isSafeInteger(d.days) && Math.abs(d.days) <= MAX_DAYS,\n show: (d: LocalDate): string => d.toString(),\n encode: (d: LocalDate): string => d.toString(),\n decode: (u: unknown): LocalDate => (typeof u === \"string\" ? LocalDate.parse(u) : undefined) ?? new LocalDate(Number.NaN),\n ops: {\n add: { params: [\"number\"] },\n subtract: { params: [\"any\"] },\n addMonths: { params: [\"number\"] },\n endOfMonth: { params: [\"number\"] },\n year: {},\n month: {},\n day: {},\n weekday: {},\n gt: { params: [\"domain\"] },\n gte: { params: [\"domain\"] },\n lt: { params: [\"domain\"] },\n lte: { params: [\"domain\"] },\n eq: { laws: [\"commutative\"], params: [\"domain\"] },\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\nimport { LocalDate } from \"./date.ts\";\nimport type { Insets } from \"./insets.ts\";\nimport { Vec2 } from \"./vec2.ts\";\nimport type { XY } from \"./xy.ts\";\n\ntype NumFn1 = (a: number) => number;\ntype NumFn2 = (a: number, b: number) => number;\ntype NumFn3 = (a: number, b: number, c: number) => number;\ntype NumTest = (a: number, b: number) => boolean;\n\n/** The ops of `NumDomain`. */\nexport type NumOps = {\n readonly add: FnOp<number, NumFn2>;\n readonly subtract: FnOp<number, NumFn2>;\n readonly multiply: FnOp<number, NumFn2>;\n readonly divide: FnOp<number, NumFn2>;\n readonly mod: FnOp<number, NumFn2>;\n readonly pow: FnOp<number, NumFn2>;\n readonly min: FnOp<number, NumFn2>;\n readonly max: FnOp<number, NumFn2>;\n readonly clamp: FnOp<number, NumFn3>;\n readonly abs: FnOp<number, NumFn1>;\n readonly negate: FnOp<number, NumFn1>;\n readonly sign: FnOp<number, NumFn1>;\n readonly sqrt: FnOp<number, NumFn1>;\n readonly ln: FnOp<number, NumFn1>;\n readonly exp: FnOp<number, NumFn1>;\n readonly log10: FnOp<number, NumFn1>;\n readonly sin: FnOp<number, NumFn1>;\n readonly cos: FnOp<number, NumFn1>;\n readonly asin: FnOp<number, NumFn1>;\n readonly hypot: FnOp<number, NumFn2>;\n readonly date: FnOp<number, (year: number, month: number, day: number) => LocalDate>;\n readonly vec2: FnOp<number, (x: number, y: number) => Vec2>;\n readonly xy: FnOp<number, (x: number, y: number) => XY>;\n readonly insets: FnOp<number, (startX: number, startY: number, endX: number, endY: number) => Insets>;\n readonly floor: FnOp<number, NumFn1>;\n readonly ceil: FnOp<number, NumFn1>;\n readonly round: FnOp<number, NumFn1>;\n readonly gt: FnOp<number, NumTest>;\n readonly gte: FnOp<number, NumTest>;\n readonly lt: FnOp<number, NumTest>;\n readonly lte: FnOp<number, NumTest>;\n readonly eq: FnOp<number, NumTest>;\n};\n\n/** The domain of numbers. A result that is not a finite number is the error `#NUM!`. */\nexport const NumDomain: Domain<\"Num\", number, NumOps> = defineDomain<\"Num\", number, NumOps>({\n // COMPILE.MODULE.FORM: a vector in a module is plain data, so `vec2` needs no class there.\n moduleForm: { ops: { vec2: { fn: (x: number, y: number): { readonly x: number; readonly y: number } => ({ x, y }), returns: \"domain:Vec2\" } } },\n name: \"Num\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is number => typeof u === \"number\",\n primitive: \"number\",\n valid: (n: number): boolean => Number.isFinite(n),\n show: (n: number): string => String(n),\n ops: {\n add: { fn: (a: number, b: number): number => a + b, laws: [\"commutative\", \"associative\"], identity: (): number => 0, params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n subtract: { fn: (a: number, b: number): number => a - b, params: [\"number\"], returns: \"number\", monotone: [\"up\", \"down\"] },\n multiply: { fn: (a: number, b: number): number => a * b, laws: [\"commutative\", \"associative\"], identity: (): number => 1, params: [\"number\"], returns: \"number\" },\n divide: { fn: (a: number, b: number): number => a / b, params: [\"number\"], returns: \"number\" },\n mod: { fn: (a: number, b: number): number => a % b, params: [\"number\"], returns: \"number\" },\n pow: { fn: (a: number, b: number): number => a ** b, params: [\"number\"], returns: \"number\" },\n min: { fn: (a: number, b: number): number => Math.min(a, b), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n max: { fn: (a: number, b: number): number => Math.max(a, b), laws: [\"commutative\", \"associative\", \"idempotent\"], params: [\"number\"], returns: \"number\", monotone: [\"up\", \"up\"] },\n clamp: { fn: (a: number, lo: number, hi: number): number => Math.min(hi, Math.max(lo, a)), params: [\"number\", \"number\"], returns: \"number\", monotone: [\"up\", \"up\", \"up\"] },\n abs: { fn: (a: number): number => Math.abs(a), returns: \"number\" },\n negate: { fn: (a: number): number => -a, returns: \"number\", monotone: [\"down\"] },\n // NUM.SIGN: the check of the result turns NaN into #NUM!, and an infinite number has a sign.\n sign: { fn: (a: number): number => Math.sign(a), returns: \"number\", monotone: [\"up\"] },\n sqrt: { fn: (a: number): number => Math.sqrt(a), returns: \"number\" },\n ln: { fn: (a: number): number => Math.log(a), returns: \"number\" },\n exp: { fn: (a: number): number => Math.exp(a), returns: \"number\" },\n log10: { fn: (a: number): number => Math.log10(a), returns: \"number\" },\n // The angles of sin, cos and asin are in radians.\n sin: { fn: (a: number): number => Math.sin(a), returns: \"number\" },\n cos: { fn: (a: number): number => Math.cos(a), returns: \"number\" },\n asin: { fn: (a: number): number => Math.asin(a), returns: \"number\" },\n hypot: { fn: (a: number, b: number): number => Math.hypot(a, b), laws: [\"commutative\"], params: [\"number\"], returns: \"number\" },\n // The year is the receiver: date(year, month, day). The result is a LocalDate, so a chain continues in DateDomain.\n date: { fn: (year: number, month: number, day: number): LocalDate => LocalDate.of(year, month, day), params: [\"number\", \"number\"] },\n // The x component is the receiver: vec2(x, y). The result is a Vec2, so a chain continues in Vec2Domain.\n vec2: { fn: (x: number, y: number): Vec2 => new Vec2(x, y), params: [\"number\"] },\n // The same as plain data, for a standalone module: xy(x, y). The result is a value of XYDomain.\n xy: { fn: (x: number, y: number): XY => ({ x, y }), params: [\"number\"], returns: \"domain:XY\" },\n // The leading sides, then the trailing sides: insets(startX, startY, endX, endY). The result is a value of InsetsDomain.\n insets: { fn: (startX: number, startY: number, endX: number, endY: number): Insets => ({ startX, startY, endX, endY }), params: [\"number\", \"number\", \"number\"], returns: \"domain:Insets\" },\n floor: { fn: (a: number): number => Math.floor(a), returns: \"number\", monotone: [\"up\"] },\n ceil: { fn: (a: number): number => Math.ceil(a), returns: \"number\", monotone: [\"up\"] },\n round: { fn: (a: number): number => Math.round(a), returns: \"number\", monotone: [\"up\"] },\n gt: { fn: (a: number, b: number): boolean => a > b, params: [\"number\"], returns: \"boolean\" },\n gte: { fn: (a: number, b: number): boolean => a >= b, params: [\"number\"], returns: \"boolean\" },\n lt: { fn: (a: number, b: number): boolean => a < b, params: [\"number\"], returns: \"boolean\" },\n lte: { fn: (a: number, b: number): boolean => a <= b, params: [\"number\"], returns: \"boolean\" },\n eq: { fn: (a: number, b: number): boolean => a === b, laws: [\"commutative\"], params: [\"number\"], returns: \"boolean\" },\n },\n});\n\ntype BoolFn1 = (a: boolean) => boolean;\ntype BoolFn2 = (a: boolean, b: boolean) => boolean;\n\n/** The ops of `BoolDomain`. */\nexport type BoolOps = {\n readonly and: FnOp<boolean, BoolFn2>;\n readonly or: FnOp<boolean, BoolFn2>;\n readonly xor: FnOp<boolean, BoolFn2>;\n readonly not: FnOp<boolean, BoolFn1>;\n readonly eq: FnOp<boolean, BoolFn2>;\n};\n\n/** The domain of booleans. For lazy logic, use the special forms `and`, `or` and `if` of the IR. */\nexport const BoolDomain: Domain<\"Bool\", boolean, BoolOps> = defineDomain<\"Bool\", boolean, BoolOps>({\n name: \"Bool\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is boolean => typeof u === \"boolean\",\n primitive: \"boolean\",\n show: (b: boolean): string => String(b),\n ops: {\n and: { fn: (a: boolean, b: boolean): boolean => a && b, laws: [\"commutative\", \"associative\", \"idempotent\"], identity: (): boolean => true, params: [\"boolean\"], returns: \"boolean\", monotone: [\"up\", \"up\"] },\n or: { fn: (a: boolean, b: boolean): boolean => a || b, laws: [\"commutative\", \"associative\", \"idempotent\"], identity: (): boolean => false, params: [\"boolean\"], returns: \"boolean\", monotone: [\"up\", \"up\"] },\n xor: { fn: (a: boolean, b: boolean): boolean => a !== b, laws: [\"commutative\", \"associative\"], identity: (): boolean => false, params: [\"boolean\"], returns: \"boolean\" },\n not: { fn: (a: boolean): boolean => !a, returns: \"boolean\", monotone: [\"down\"] },\n eq: { fn: (a: boolean, b: boolean): boolean => a === b, laws: [\"commutative\"], params: [\"boolean\"], returns: \"boolean\" },\n },\n});\n","/**\n * The domain of texts. The op `concat` joins a text and a value of any kind. It is the operator `&` of a\n * spreadsheet, and of the formula language of the sheet app.\n */\nimport { defineDomain, type Domain, type FnOp, type VexList } from \"@mark1russell7/vex\";\n\ntype TextFn1 = (a: string) => string;\n\n/** The ops of `TextDomain`. */\nexport type TextOps = {\n readonly concat: FnOp<string, (a: string, b: unknown) => string>;\n readonly length: FnOp<string, (a: string) => number>;\n readonly codePoints: FnOp<string, (a: string) => VexList<number>>;\n readonly epochMillis: FnOp<string, (a: string) => number>;\n readonly upper: FnOp<string, TextFn1>;\n readonly lower: FnOp<string, TextFn1>;\n readonly trim: FnOp<string, TextFn1>;\n readonly contains: FnOp<string, (a: string, b: string) => boolean>;\n readonly eq: FnOp<string, (a: string, b: string) => boolean>;\n};\n\n/**\n * This function gives the text of a value for `concat`. A text stays. A plain record gives its JSON text. Another\n * value, for example a number or a `Vec2`, gives its own text.\n */\nconst textOf = (u: unknown): string => (typeof u === \"object\" && u !== null && Object.getPrototypeOf(u) === Object.prototype ? JSON.stringify(u) : String(u));\n\n/** The domain of texts. */\nexport const TextDomain: Domain<\"Text\", string, TextOps> = defineDomain<\"Text\", string, TextOps>({\n name: \"Text\",\n is: (u: unknown): u is string => typeof u === \"string\",\n primitive: \"string\",\n show: (s: string): string => JSON.stringify(s),\n // LOOP.SIZE.OPS: `concat` adds the JSON text of a value that is not a text. `upper` and `lower` can make a text\n // longer, for example \"ß\" becomes \"SS\". The new letters do not change again, so a text grows at most three times in\n // total, and not at each step.\n ops: {\n concat: { fn: (a: string, b: unknown): string => a + textOf(b), params: [\"any\"], returns: \"string\", size: { size: [1, \"text\"] } },\n // The length counts UTF-16 code units, like the function LEN of a spreadsheet.\n length: { fn: (a: string): number => a.length, returns: \"number\" },\n // The list has one item for each code point, so a pair of surrogates is one item, and a lone surrogate is an item\n // with its own value (TEXT.CODEPOINTS). The function reads no name of Vex, so a module can copy it. The rule tells\n // that the count is at most the length. Each item has a number and a new key, so `keys` adds a part for each item.\n codePoints: {\n fn: (a: string): VexList<number> =>\n Object.freeze({\n kind: \"vex.list\",\n items: Object.freeze(Array.from(a, (ch, i) => ({ key: String(i), result: { ok: true as const, value: ch.codePointAt(0) as number } }))),\n }),\n returns: \"list:number\",\n size: { size: [1], inner: [0], item: [0], keys: \"position\" },\n },\n // The milliseconds since 1970-01-01T00:00:00Z of an ISO 8601 time, so the ops of numbers compare times\n // (TEXT.EPOCHMILLIS). A time needs `Z` or an offset, because a local time depends on the computer. A `t` and a `z` in\n // lower case are valid, as in RFC 3339 section 5.6. A bad text throws, so it gives #CALC!. The function reads no name\n // outside itself, so a module can copy it.\n epochMillis: {\n fn: (a: string): number => {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[Tt](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?(?:([Zz])|([+-])(\\d{2}):(\\d{2})))?$/.exec(a);\n if (m === null) throw new Error('\"epochMillis\" needs an ISO 8601 text, for example 2026-03-01 or 2026-03-01T12:30:00Z');\n const n = (i: number): number => Number(m[i] ?? \"0\");\n const [y, mo, d, h, mi, s, oh, om] = [n(1), n(2), n(3), n(4), n(5), n(6), n(10), n(11)];\n const leap = y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0);\n const last = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][mo - 1] ?? 0;\n if (d < 1 || d > last || h > 23 || mi > 59 || s > 59 || oh > 23 || om > 59) throw new Error('\"epochMillis\" found a day or a time that does not exist');\n const ms = Number((m[7] ?? \"\").padEnd(3, \"0\").slice(0, 3));\n const offset = (m[9] === \"-\" ? -1 : 1) * (oh * 60 + om) * 60_000;\n // Date.UTC changes the years 0 to 99 into 1900 to 1999. 400 years of the calendar are 146097 days, so the\n // function adds 400 years and subtracts their milliseconds.\n return Date.UTC(y + 400, mo - 1, d, h, mi, s, ms) - 12_622_780_800_000 - offset;\n },\n params: [],\n returns: \"number\",\n },\n upper: { fn: (a: string): string => a.toUpperCase(), returns: \"string\", size: { size: [1] } },\n lower: { fn: (a: string): string => a.toLowerCase(), returns: \"string\", size: { size: [1] } },\n trim: { fn: (a: string): string => a.trim(), returns: \"string\", size: { size: [1] } },\n contains: { fn: (a: string, b: string): boolean => a.includes(b), params: [\"string\"], returns: \"boolean\" },\n eq: { fn: (a: string, b: string): boolean => a === b, laws: [\"commutative\"], params: [\"string\"], returns: \"boolean\" },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\n/** The linear value of an sRGB channel from 0 to 255, with the sRGB transfer function of WCAG 2.1. */\nfunction linear(channel: number): number {\n const s = Math.min(1, Math.max(0, channel / 255));\n // For integer channels, the sRGB threshold 0.04045 and the WCAG threshold 0.03928 give the same result.\n return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n}\n\n/**\n * An immutable RGBA color. The channels have no fixed range: use `clamp` to limit them. `add` adds the color\n * channels and keeps the larger alpha, so `add` is commutative and associative.\n */\nexport class Color {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n readonly a: number;\n\n constructor(r: number, g: number, b: number, a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n\n /** This function makes a gray color with the value `n` in each channel. */\n static gray(n: number): Color {\n return new Color(n, n, n, 1);\n }\n /** The black color with alpha 0: the identity of `add`. */\n static readonly none: Color = new Color(0, 0, 0, 0);\n\n /** The channel sum. The alpha is the larger alpha. */\n add(o: Color): Color {\n return new Color(this.r + o.r, this.g + o.g, this.b + o.b, Math.max(this.a, o.a));\n }\n /** Each color channel times `factor`. The alpha does not change. */\n multiply(factor: number): Color {\n return new Color(this.r * factor, this.g * factor, this.b * factor, this.a);\n }\n /** Each color channel in the range from `lo` to `hi`. */\n clamp(lo = 0, hi = 255): Color {\n const c = (x: number): number => Math.min(hi, Math.max(lo, x));\n return new Color(c(this.r), c(this.g), c(this.b), this.a);\n }\n /** The linear mix from this color to `o`. */\n mix(o: Color, t: number): Color {\n const m = (x: number, y: number): number => x + (y - x) * t;\n return new Color(m(this.r, o.r), m(this.g, o.g), m(this.b, o.b), m(this.a, o.a));\n }\n /** The relative luminance (Rec. 709 weights) of the color channels. */\n luminance(): number {\n return 0.2126 * this.r + 0.7152 * this.g + 0.0722 * this.b;\n }\n /**\n * The relative luminance of WCAG 2.1, from 0 (black) to 1 (white). Each channel from 0 to 255 becomes a linear\n * value with the sRGB transfer function. A channel outside the range counts as the nearest end of the range.\n */\n relativeLuminance(): number {\n return 0.2126 * linear(this.r) + 0.7152 * linear(this.g) + 0.0722 * linear(this.b);\n }\n /** The contrast ratio of WCAG 2.1 between this color and `o`: 1 for equal luminance, 21 for black and white. */\n contrast(o: Color): number {\n const a = this.relativeLuminance();\n const b = o.relativeLuminance();\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n }\n equals(o: Color): boolean {\n return this.r === o.r && this.g === o.g && this.b === o.b && this.a === o.a;\n }\n toArray(): readonly [number, number, number, number] {\n return [this.r, this.g, this.b, this.a];\n }\n toString(): string {\n return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`;\n }\n}\n\n/** The ops of `ColorDomain`. */\nexport type ColorOps = OpTable<Color, \"add\" | \"multiply\" | \"clamp\" | \"mix\" | \"luminance\" | \"relativeLuminance\" | \"contrast\" | \"equals\">;\n\n/** The domain of colors. */\nexport const ColorDomain: Domain<\"Color\", Color, ColorOps> = defineDomain<\"Color\", Color, ColorOps>({\n name: \"Color\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Color => u instanceof Color,\n fromScalar: (n: number): Color => Color.gray(n),\n valid: (c: Color): boolean => c.toArray().every((x) => Number.isFinite(x)),\n show: (c: Color): string => c.toString(),\n encode: (c: Color): readonly number[] => c.toArray(),\n decode: (u: unknown): Color => {\n const [r, g, b, a] = (Array.isArray(u) ? u : []) as readonly number[];\n return new Color(r ?? Number.NaN, g ?? Number.NaN, b ?? Number.NaN, a ?? 1);\n },\n ops: {\n add: { laws: [\"commutative\", \"associative\"], identity: (): Color => Color.none, params: [\"domain\"] },\n multiply: { params: [\"number\"] },\n clamp: { params: [\"number\", \"number\"] },\n mix: { params: [\"domain\", \"number\"] },\n luminance: {},\n relativeLuminance: {},\n contrast: { laws: [\"commutative\"], params: [\"domain\"] },\n equals: { laws: [\"commutative\"], params: [\"domain\"] },\n },\n});\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\nimport { Vec2 } from \"./vec2.ts\";\n\n/** An immutable angle in radians. */\nexport class Angle {\n readonly radians: number;\n\n constructor(radians: number) {\n this.radians = radians;\n }\n\n /** This function makes an angle from degrees. */\n static fromDegrees(deg: number): Angle {\n return new Angle((deg * Math.PI) / 180);\n }\n /** The zero angle: the identity of `add`. */\n static readonly zero: Angle = new Angle(0);\n\n add(o: Angle): Angle {\n return new Angle(this.radians + o.radians);\n }\n subtract(o: Angle): Angle {\n return new Angle(this.radians - o.radians);\n }\n scale(k: number): Angle {\n return new Angle(this.radians * k);\n }\n /** The same angle in the range from -π (included) to π (not included). */\n normalize(): Angle {\n const twoPi = Math.PI * 2;\n // Stryker disable next-line ArithmeticOperator: x + π and x - π differ by 2π, so the result after mod 2π is the same\n return new Angle((((this.radians + Math.PI) % twoPi) + twoPi) % twoPi - Math.PI);\n }\n /** The vector with this angle and the length `length`. The result is a `Vec2`, so a chain continues in that domain. */\n toVec2(length = 1): Vec2 {\n return new Vec2(Math.cos(this.radians) * length, Math.sin(this.radians) * length);\n }\n sin(): number {\n return Math.sin(this.radians);\n }\n cos(): number {\n return Math.cos(this.radians);\n }\n degrees(): number {\n return (this.radians * 180) / Math.PI;\n }\n toString(): string {\n return `${this.radians} rad`;\n }\n}\n\n/** The ops of `AngleDomain`. */\nexport type AngleOps = OpTable<Angle, \"add\" | \"subtract\" | \"scale\" | \"normalize\" | \"toVec2\" | \"sin\" | \"cos\" | \"degrees\", \"add\" | \"subtract\">;\n\n/** The domain of angles. A number argument of `add` or `subtract` lifts to an angle in radians. */\nexport const AngleDomain: Domain<\"Angle\", Angle, AngleOps> = defineDomain<\"Angle\", Angle, AngleOps>({\n name: \"Angle\",\n // LOOP.SIZE.OPS: each value has a fixed size, so each op has a size rule.\n size: \"fixed\",\n is: (u: unknown): u is Angle => u instanceof Angle,\n fromScalar: (n: number): Angle => new Angle(n),\n valid: (a: Angle): boolean => Number.isFinite(a.radians),\n show: (a: Angle): string => a.toString(),\n encode: (a: Angle): number => a.radians,\n decode: (u: unknown): Angle => new Angle(typeof u === \"number\" ? u : Number.NaN),\n ops: {\n add: { laws: [\"commutative\", \"associative\"], identity: (): Angle => Angle.zero, liftScalar: true, params: [\"domain\"] },\n subtract: { liftScalar: true, params: [\"domain\"] },\n scale: { params: [\"number\"] },\n normalize: {},\n toVec2: { params: [\"number\"] },\n sin: {},\n cos: {},\n degrees: {},\n },\n});\n","import { defineDomain, type Domain, type FnOp } from \"@mark1russell7/vex\";\n\n/**\n * A JSON value that `JsonDomain` accepts: a text, a finite number, a boolean, an array or a plain object. The items of\n * an array and the fields of an object can be `null`.\n */\nexport type JsonValue = string | number | boolean | readonly unknown[] | { readonly [key: string]: unknown };\n\n/** The kind of a JSON value. */\nexport type JsonKind = \"boolean\" | \"number\" | \"string\" | \"array\" | \"object\";\n\n/** The kind of an item of an array or of a field of an object: the kind of a JSON value, or `\"null\"`. */\nexport type JsonItemKind = JsonKind | \"null\";\n\n/**\n * A leaf of the walk of `leaves` (JSON.LEAVES): the path of a field, the kind of its value, and the value. A leaf of the\n * kind `\"null\"` has no value.\n */\nexport interface JsonLeaf {\n readonly path: string;\n readonly kind: JsonItemKind;\n readonly value?: unknown;\n}\n\n/** The ops of `JsonDomain`. */\nexport type JsonOps = {\n readonly kind: FnOp<JsonValue, (v: JsonValue) => JsonKind>;\n readonly kinds: FnOp<JsonValue, (c: JsonValue) => readonly JsonItemKind[]>;\n readonly fields: FnOp<JsonValue, (o: JsonValue) => readonly string[]>;\n readonly field: FnOp<JsonValue, (o: JsonValue, k: unknown) => unknown>;\n readonly leaves: FnOp<JsonValue, (o: JsonValue, depth: number) => readonly JsonLeaf[]>;\n};\n\n/**\n * The domain of JSON values, for example the documents of a database. Each op is a function of plain data, so a\n * standalone module can copy the domain. Put `JsonDomain` last in the list of domains. Then `add`, `eq` and the other\n * ops of `NumDomain`, `TextDomain` and `BoolDomain` come first. The names `keys`, `get` and `values` are list ops. A\n * domain op comes before a list op on an array, so the domain does not use these names.\n */\nexport const JsonDomain: Domain<\"Json\", JsonValue, JsonOps> = defineDomain<\"Json\", JsonValue, JsonOps>({\n name: \"Json\",\n // A plain object has the prototype Object.prototype or null. Thus a Vec2, a LocalDate or a Map is not a JSON value.\n // An object with the kind \"vex.list\" and an array of items is a list of Vex. The test reads no name outside itself,\n // so a module can copy it.\n is: (u: unknown): u is JsonValue =>\n typeof u === \"string\" ||\n typeof u === \"boolean\" ||\n Number.isFinite(u) ||\n Array.isArray(u) ||\n (typeof u === \"object\" &&\n u !== null &&\n [Object.prototype, null].includes(Object.getPrototypeOf(u) as object | null) &&\n !((u as { readonly kind?: unknown }).kind === \"vex.list\" && Array.isArray((u as { readonly items?: unknown }).items))),\n samples: (): readonly JsonValue[] => [{ a: 1, b: [true, null], c: { d: \"x\" } }, [1, \"x\", null, [2]], \"x\", 2, false],\n // LOOP.SIZE.OPS: each op gives a part of its value, or a list with one item for each field or leaf of its value.\n ops: {\n // Each op reads no name outside itself, so a module can copy its text.\n kind: { fn: (v: JsonValue): JsonKind => (Array.isArray(v) ? \"array\" : (typeof v as JsonKind)), params: [], returns: \"string\", size: \"fixed\" },\n kinds: {\n fn: (c: JsonValue): readonly JsonItemKind[] => {\n if (typeof c !== \"object\") throw new Error(`\"kinds\" needs an array or an object, not a ${typeof c}`);\n // Array.from gives undefined for a hole, so a hole has the kind \"null\".\n return Array.from(Array.isArray(c) ? (c as readonly unknown[]) : Object.values(c), (x, i): JsonItemKind => {\n if (x === null || x === undefined) return \"null\";\n if (Array.isArray(x)) return \"array\";\n if (typeof x === \"string\" || typeof x === \"boolean\" || Number.isFinite(x) || [Object.prototype, null].includes(Object.getPrototypeOf(x) as object | null)) return typeof x as JsonKind;\n throw new Error(`\"kinds\" found a value that is not JSON at the position ${i}`);\n });\n },\n params: [],\n size: { size: [\"scaled\"], keys: \"position\" },\n },\n fields: {\n fn: (o: JsonValue): readonly string[] => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"fields\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n return Object.keys(o);\n },\n params: [],\n size: { size: [1], keys: \"position\" },\n },\n field: {\n fn: (o: JsonValue, k: unknown): unknown => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"field\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n if (typeof k !== \"string\") throw new Error(`\"field\" needs a text key, not a ${typeof k}`);\n if (!Object.hasOwn(o, k)) throw new Error(`the object has no field \"${k}\"`);\n const value = (o as Readonly<Record<string, unknown>>)[k];\n if (value === null || value === undefined) throw new Error(`the field \"${k}\" is null`);\n return value;\n },\n params: [\"any\"],\n returns: \"any\",\n // LOOP.SIZE.PART: a field of an object is an item of the object, and the op takes no other value.\n size: {\n size: [1, 0],\n byParts: { size: [[1, \"item\"], 0], count: [[1, \"item\"], 0], inner: [[1, \"item\"], 0], item: [[1, \"part\"], 0], part: [[1, \"part\"], 0] },\n },\n },\n // The walk of a schema as a flat list (JSON.LEAVES). The function reads no name outside itself, so a\n // module can copy it. A stack of the objects, not recursion, keeps the order of a recursive walk.\n leaves: {\n fn: (o: JsonValue, depth: number): readonly JsonLeaf[] => {\n if (typeof o !== \"object\" || Array.isArray(o)) throw new Error(`\"leaves\" needs an object, not ${Array.isArray(o) ? \"an array\" : `a ${typeof o}`}`);\n if (!Number.isSafeInteger(depth) || depth < 1 || depth > 100) throw new Error(`\"leaves\" needs a depth that is a whole number from 1 to 100, not ${String(depth)}`);\n const out: JsonLeaf[] = [];\n const stack = [{ at: o as Readonly<Record<string, unknown>>, keys: Object.keys(o), next: 0, prefix: \"\", level: 1 }];\n for (let top = stack.at(-1); top !== undefined; top = stack.at(-1)) {\n const key = top.keys[top.next++];\n if (key === undefined) {\n stack.pop();\n continue;\n }\n const x = top.at[key];\n const path = top.prefix === \"\" ? key : `${top.prefix}.${key}`;\n let kind: JsonItemKind;\n if (x === null || x === undefined) kind = \"null\";\n else if (Array.isArray(x)) kind = \"array\";\n else if (typeof x === \"string\" || typeof x === \"boolean\" || Number.isFinite(x) || [Object.prototype, null].includes(Object.getPrototypeOf(x) as object | null)) kind = typeof x as JsonKind;\n else throw new Error(`\"leaves\" found a value that is not JSON at the path \"${path}\"`);\n const inner = kind === \"object\" && top.level < depth ? Object.keys(x as object) : [];\n if (inner.length > 0) stack.push({ at: x as Readonly<Record<string, unknown>>, keys: inner, next: 0, prefix: path, level: top.level + 1 });\n else out.push(Object.freeze(kind === \"null\" ? { path, kind } : { path, kind, value: x }));\n }\n return Object.freeze(out);\n },\n params: [\"number\"],\n // A path repeats the keys above it, at most 100 levels, so the size of the list is the size of the object times a\n // fixed factor.\n size: { size: [\"scaled\", 0], keys: \"position\" },\n },\n },\n});\n","/**\n * The schema program (EXAMPLE.SCHEMA). It reads a list of JSON documents. For each field path, it gives the distinct\n * kinds of the values and the number of documents with the path.\n *\n * The walk `leaves(d, 3)` goes into an object that is not empty at a depth under 3. It records an empty object, or an\n * object at the depth 3, with the kind `object`. It does not go into an array. The kind of an array is `array<k1|k2>`,\n * from the distinct kinds of its items, or `array` when it is empty.\n */\nimport { app, axes, call, each, evaluate, fn, let_, lit, rec, space, v, vexList, type AnyDomain, type Expr, type ItemNames } from \"@mark1russell7/vex\";\nimport { JsonDomain } from \"./json.ts\";\nimport { BoolDomain, NumDomain } from \"./scalars.ts\";\nimport { TextDomain } from \"./text.ts\";\n\n/** A record of the schema: one field path, its distinct kinds in the order of their first occurrence, and its count of documents. */\nexport interface JsonFieldSchema {\n readonly path: string;\n readonly kinds: readonly string[];\n readonly count: number;\n}\n\n/** These are the domains of `SCHEMA_PROGRAM`. `JsonDomain` is last, so `eq`, `concat` and `gt` go to the domains of numbers and texts. */\nexport const SCHEMA_DOMAINS: readonly AnyDomain[] = [NumDomain, BoolDomain, TextDomain, JsonDomain];\n\n// Stryker disable next-line ArrayDeclaration: the added item is a text with no field, so its row is an error, and flat skips an error item (LIST.BUILD), so the list gives no notes, as the empty list does\nconst EMPTY = lit(vexList([]));\n/** A loop over the items of a list, with the names of the item and of its position (AXIS.LIST.ITEM). */\nconst loop = (list: Expr, as: ItemNames, body: Expr): Expr => each(axes.list(list), body, undefined, as);\nconst text = (...parts: Expr[]): Expr => parts.reduce((a, b) => app(\"concat\", a, b));\nconst field = (o: Expr, k: string): Expr => app(\"field\", o, lit(k));\n\n/** The kind of the array `a`: `array<k1|k2>` from the distinct kinds of its items, or `array` when it is empty. */\nconst arrayKind = fn([\"a\"], let_({ ks: app(\"distinct\", app(\"kinds\", v(\"a\"))) }, app(\"if\", app(\"eq\", app(\"count\", v(\"ks\")), lit(0)), lit(\"array\"), text(lit(\"array<\"), app(\"join\", v(\"ks\"), lit(\"|\")), lit(\">\")))));\n\n/** The notes of each document that is an object: the path and the kind of each leaf, and the position of the document. */\nconst notes = app(\n \"flat\",\n loop(\n v(\"docs\"),\n [\"d\", \"i\"],\n // Stryker disable next-line BooleanLiteral: flat skips an error item (LIST.BUILD), so a document without a kind gives no notes with true too\n loop(app(\"if\", app(\"ifError\", app(\"eq\", app(\"kind\", v(\"d\")), lit(\"object\")), lit(false)), app(\"leaves\", v(\"d\"), lit(3)), EMPTY), [\"l\"], rec({ path: field(v(\"l\"), \"path\"), kind: app(\"if\", app(\"eq\", field(v(\"l\"), \"kind\"), lit(\"array\")), call(\"arrayKind\", field(v(\"l\"), \"value\")), field(v(\"l\"), \"kind\")), doc: v(\"i\") })),\n ),\n);\n\n/** The records of the schema: for each group of notes with one path, the distinct kinds and the count of the documents. */\nconst records = let_(\n { groups: app(\"group\", v(\"notes\"), loop(v(\"notes\"), [\"n\"], field(v(\"n\"), \"path\"))) },\n app(\n \"values\",\n loop(\n v(\"groups\"),\n [\"g\"],\n rec({\n path: field(app(\"nth\", v(\"g\"), lit(0)), \"path\"),\n kinds: app(\"values\", app(\"distinct\", loop(v(\"g\"), [\"n\"], field(v(\"n\"), \"kind\")))),\n count: app(\"count\", app(\"distinct\", loop(v(\"g\"), [\"n\"], field(v(\"n\"), \"doc\")))),\n }),\n ),\n ),\n);\n\n/**\n * This is the schema program. It reads the documents from the name `docs`, and it gives an array of `JsonFieldSchema`\n * in the order that the paths first occur. It skips a document that is not an object, and a document with a value that\n * is not JSON. Evaluate it with `SCHEMA_DOMAINS`.\n */\nexport const SCHEMA_PROGRAM: Expr = let_({ arrayKind }, let_({ notes }, records));\n\n/**\n * This function evaluates `SCHEMA_PROGRAM` for the documents `docs`, and it gives the records of the schema. It throws\n * an `Error` with the code and the message when the program gives an error, for example when `docs` is not an array.\n */\nexport function schemaOf(docs: readonly unknown[]): readonly JsonFieldSchema[] {\n const r = evaluate(SCHEMA_PROGRAM, { space: space.array([{}]), origin: \"0\", domains: SCHEMA_DOMAINS, vars: { docs } });\n if (!r.ok) throw new Error(`the schema program gave ${r.error.code}: ${r.error.message}`);\n return r.value as readonly JsonFieldSchema[];\n}\n","import { defineDomain, type Domain, type OpTable } from \"@mark1russell7/vex\";\n\n/** A wrapper around a function. Its op `invoke` calls the function. It shows how a domain can hold behavior. */\nexport class Fn {\n readonly fn: (...args: never[]) => unknown;\n\n constructor(fn: (...args: never[]) => unknown) {\n this.fn = fn;\n }\n invoke(...args: readonly unknown[]): unknown {\n return (this.fn as (...a: readonly unknown[]) => unknown)(...args);\n }\n}\n\n/** The ops of `FnDomain`. */\nexport type FnOps = OpTable<Fn, \"invoke\">;\n\n/** The domain of function wrappers. */\nexport const FnDomain: Domain<\"Fn\", Fn, FnOps> = defineDomain<\"Fn\", Fn, FnOps>({\n name: \"Fn\",\n is: (u: unknown): u is Fn => u instanceof Fn,\n // LOOP.SIZE.OPS: `invoke` calls a function of the value, so it has no size rule.\n ops: { invoke: {} },\n});\n\n/**\n * A value that is there (`top`) or not there (`bottom`). It shows a domain whose ops take functions. A Vex\n * program can also hold this state in its own errors, so most programs do not need this domain.\n */\nexport class Maybe<T> {\n readonly #has: boolean;\n readonly #value: T | undefined;\n\n private constructor(has: boolean, value: T | undefined) {\n this.#has = has;\n this.#value = value;\n }\n static top<T>(value: T): Maybe<T> {\n return new Maybe<T>(true, value);\n }\n static bottom<T = never>(): Maybe<T> {\n return new Maybe<T>(false, undefined);\n }\n isTop(): boolean {\n return this.#has;\n }\n isBottom(): boolean {\n return !this.#has;\n }\n map<U>(f: (value: T) => U): Maybe<U> {\n return this.#has ? Maybe.top(f(this.#value as T)) : Maybe.bottom<U>();\n }\n chain<U>(f: (value: T) => Maybe<U>): Maybe<U> {\n return this.#has ? f(this.#value as T) : Maybe.bottom<U>();\n }\n valueOr<U>(fallback: U): T | U {\n return this.#has ? (this.#value as T) : fallback;\n }\n}\n\n/** The ops of `MaybeDomain`. */\nexport type MaybeOps = OpTable<Maybe<unknown>, \"isTop\" | \"isBottom\" | \"map\" | \"chain\" | \"valueOr\">;\n\n/** The domain of `Maybe` values. */\nexport const MaybeDomain: Domain<\"Maybe\", Maybe<unknown>, MaybeOps> = defineDomain<\"Maybe\", Maybe<unknown>, MaybeOps>({\n name: \"Maybe\",\n is: (u: unknown): u is Maybe<unknown> => u instanceof Maybe,\n // LOOP.SIZE.OPS: `map` and `chain` call a function of the value, so they have no size rule.\n ops: { isTop: { size: \"scalar\" }, isBottom: { size: \"scalar\" }, map: {}, chain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IAAI;CACnE;AACF;;AAMA,MAAa,WAAoC,aAA8B;CAC7E,MAAM;CACN,KAAK,MAAwB,aAAa;CAE1C,KAAK,EAAE,QAAQ,CAAC,EAAE;AACpB,CAAC;;;;;AAMD,IAAa,QAAb,MAAa,MAAS;CACX;CACA;CAED,YAAY,KAAc,OAAsB;EACtD,KAAK,OAAO;EACZ,KAAK,SAAS;CAChB;CACA,OAAO,IAAO,OAAoB;EAChC,OAAO,IAAI,MAAS,MAAM,KAAK;CACjC;CACA,OAAO,SAA8B;EACnC,OAAO,IAAI,MAAS,OAAO,KAAA,CAAS;CACtC;CACA,QAAiB;EACf,OAAO,KAAK;CACd;CACA,WAAoB;EAClB,OAAO,CAAC,KAAK;CACf;CACA,IAAO,GAA8B;EACnC,OAAO,KAAK,OAAO,MAAM,IAAI,EAAE,KAAK,MAAW,CAAC,IAAI,MAAM,OAAU;CACtE;CACA,MAAS,GAAqC;EAC5C,OAAO,KAAK,OAAO,EAAE,KAAK,MAAW,IAAI,MAAM,OAAU;CAC3D;CACA,QAAW,UAAoB;EAC7B,OAAO,KAAK,OAAQ,KAAK,SAAe;CAC1C;AACF;;AAMA,MAAa,cAAyD,aAAgD;CACpH,MAAM;CACN,KAAK,MAAoC,aAAa;CAEtD,KAAK;EAAE,OAAO,EAAE,MAAM,SAAS;EAAG,UAAU,EAAE,MAAM,SAAS;EAAG,KAAK,CAAC;EAAG,OAAO,CAAC;EAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE;CAAE;AAC1H,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/vex-domains",
4
- "version": "0.19.1",
4
+ "version": "0.20.1",
5
5
  "description": "Vex domains: 2D vectors, named-component vectors, colors, angles, numbers, booleans and amounts in units.",
6
6
  "keywords": [
7
7
  "vex",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@mark1russell7/quantity": "^0.4.0",
61
- "@mark1russell7/vex": "0.19.1"
61
+ "@mark1russell7/vex": "0.20.1"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "tsdown",
package/src/text.ts CHANGED
@@ -11,6 +11,7 @@ export type TextOps = {
11
11
  readonly concat: FnOp<string, (a: string, b: unknown) => string>;
12
12
  readonly length: FnOp<string, (a: string) => number>;
13
13
  readonly codePoints: FnOp<string, (a: string) => VexList<number>>;
14
+ readonly epochMillis: FnOp<string, (a: string) => number>;
14
15
  readonly upper: FnOp<string, TextFn1>;
15
16
  readonly lower: FnOp<string, TextFn1>;
16
17
  readonly trim: FnOp<string, TextFn1>;
@@ -49,6 +50,28 @@ export const TextDomain: Domain<"Text", string, TextOps> = defineDomain<"Text",
49
50
  returns: "list:number",
50
51
  size: { size: [1], inner: [0], item: [0], keys: "position" },
51
52
  },
53
+ // The milliseconds since 1970-01-01T00:00:00Z of an ISO 8601 time, so the ops of numbers compare times
54
+ // (TEXT.EPOCHMILLIS). A time needs `Z` or an offset, because a local time depends on the computer. A `t` and a `z` in
55
+ // lower case are valid, as in RFC 3339 section 5.6. A bad text throws, so it gives #CALC!. The function reads no name
56
+ // outside itself, so a module can copy it.
57
+ epochMillis: {
58
+ fn: (a: string): number => {
59
+ const m = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):(\d{2})))?$/.exec(a);
60
+ if (m === null) throw new Error('"epochMillis" needs an ISO 8601 text, for example 2026-03-01 or 2026-03-01T12:30:00Z');
61
+ const n = (i: number): number => Number(m[i] ?? "0");
62
+ const [y, mo, d, h, mi, s, oh, om] = [n(1), n(2), n(3), n(4), n(5), n(6), n(10), n(11)];
63
+ const leap = y % 4 === 0 && (y % 100 !== 0 || y % 400 === 0);
64
+ const last = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][mo - 1] ?? 0;
65
+ if (d < 1 || d > last || h > 23 || mi > 59 || s > 59 || oh > 23 || om > 59) throw new Error('"epochMillis" found a day or a time that does not exist');
66
+ const ms = Number((m[7] ?? "").padEnd(3, "0").slice(0, 3));
67
+ const offset = (m[9] === "-" ? -1 : 1) * (oh * 60 + om) * 60_000;
68
+ // Date.UTC changes the years 0 to 99 into 1900 to 1999. 400 years of the calendar are 146097 days, so the
69
+ // function adds 400 years and subtracts their milliseconds.
70
+ return Date.UTC(y + 400, mo - 1, d, h, mi, s, ms) - 12_622_780_800_000 - offset;
71
+ },
72
+ params: [],
73
+ returns: "number",
74
+ },
52
75
  upper: { fn: (a: string): string => a.toUpperCase(), returns: "string", size: { size: [1] } },
53
76
  lower: { fn: (a: string): string => a.toLowerCase(), returns: "string", size: { size: [1] } },
54
77
  trim: { fn: (a: string): string => a.trim(), returns: "string", size: { size: [1] } },