@kyralabs/m3e-shapes 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +95 -2
- package/dist/index.js +347 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphics-shapes/corner-rounding.ts","../src/graphics-shapes/point.ts","../src/graphics-shapes/utils.ts","../src/graphics-shapes/cubic.ts","../src/graphics-shapes/features.ts","../src/graphics-shapes/float-mapping.ts","../src/graphics-shapes/feature-mapping.ts","../src/graphics-shapes/polygon-measure.ts","../src/graphics-shapes/morph.ts","../src/graphics-shapes/rounded-polygon.ts","../src/graphics-shapes/shapes.ts","../src/matrix.ts","../src/path.ts","../src/shape-util.ts","../src/material-shapes.ts","../src/loading-indicator.ts"],"names":["f","clockwise","f2","angle","distance","cache"],"mappings":";AA0CO,IAAM,cAAA,GAAN,MAAM,eAAA,CAAe;AAAA;AAAA,EAE1B,OAAgB,SAAA,mBAA4B,IAAI,eAAA,EAAe;AAAA,EAEtD,MAAA;AAAA,EACA,SAAA;AAAA;AAAA,EAGT,WAAA,CAAY,MAAA,GAAS,CAAA,EAAG,SAAA,GAAY,CAAA,EAAG;AACrC,IAAA,IAAA,CAAK,MAAA,GAAS,IAAA,CAAK,MAAA,CAAO,MAAM,CAAA;AAChC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAA,CAAK,MAAA,CAAO,SAAS,CAAA;AAAA,EACxC;AACF;;;AClCA,IAAM,IAAI,IAAA,CAAK,MAAA;AAOR,IAAM,KAAA,GAAQ,CAAC,CAAA,EAAW,CAAA,MAAsB,EAAE,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,CAAE,CAAC,CAAA,EAAE,CAAA;AAQnE,IAAM,WAAA,GAAc,CAAC,CAAA,KAAqB,CAAA,CAA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A;AACnF,IAAA,MAAA,GAAS,IAAI,sBAAA,CAAuB,IAAA,EAAM,aAAA,EAAe,oBAAoB,CAAA;AAC7E,IAAAA,MAAAA,CAAM,GAAA,CAAI,GAAA,EAAK,MAAM,CAAA;AAAA,EACvB;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/CornerRounding.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\n/**\n * CornerRounding defines the amount and quality around a given vertex of a shape. [radius] defines\n * the radius of the circle which forms the basis of the rounding for the vertex. [smoothing]\n * defines the amount by which the curve is extended from the circular arc around the corner to the\n * edge between vertices.\n *\n * Each corner of a shape can be thought of as either:\n * - unrounded (with a corner radius of 0 and no smoothing)\n * - rounded with only a circular arc (with smoothing of 0). In this case, the rounding around\n * the corner follows an approximated circular arc between the edges to adjacent vertices.\n * - rounded with three curves: There is an inner circular arc and two symmetric flanking curves.\n * The flanking curves determine the curvature from the inner curve to the edges, with a value of\n * 0 (no smoothing) meaning that it is purely a circular curve and a value of 1 meaning that the\n * flanking curves are maximized between the inner curve and the edges.\n *\n * @param radius a value of 0 or greater, representing the radius of the circle which defines the\n * inner rounding arc of the corner. A value of 0 indicates that the corner is sharp, or\n * completely unrounded. A positive value is the requested size of the radius. Note that this\n * radius is an absolute size that should relate to the overall size of its shape.\n * @param smoothing the amount by which the arc is \"smoothed\" by extending the curve from the inner\n * circular arc to the edge between vertices. A value of 0 (no smoothing) indicates that the\n * corner is rounded by only a circular arc; there are no flanking curves. A value of 1 indicates\n * that there is no circular arc in the center; the flanking curves on either side meet at the\n * middle.\n */\nexport class CornerRounding {\n /** [Unrounded] has a rounding radius of zero, producing a sharp corner at a vertex. */\n static readonly Unrounded = /* @__PURE__ */ new CornerRounding();\n\n readonly radius: number;\n readonly smoothing: number;\n\n /** Both values are Kotlin `Float`s (rounded to float32). */\n constructor(radius = 0, smoothing = 0) {\n this.radius = Math.fround(radius);\n this.smoothing = Math.fround(smoothing);\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Point.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Kotlin models a point as a FloatFloatPair with extension functions; here it is an immutable\n// `{ x, y }` with free functions of the same names. Coordinates are float32 (see utils.ts).\n\nconst f = Math.fround;\n\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport const point = (x: number, y: number): Point => ({ x: f(x), y: f(y) });\n\n/**\n * The magnitude of the Point, which is the distance of this point from (0, 0).\n *\n * If you need this value to compare it to another [Point]'s distance, consider using\n * [getDistanceSquared] instead, since it is cheaper to compute.\n */\nexport const getDistance = (p: Point): number => f(Math.sqrt(getDistanceSquared(p)));\n\n/** The square of the magnitude of the Point. This is cheaper than computing [getDistance]. */\nexport const getDistanceSquared = (p: Point): number => f(f(p.x * p.x) + f(p.y * p.y));\n\nexport const dotProduct = (p: Point, other: Point): number =>\n f(f(p.x * other.x) + f(p.y * other.y));\n\nexport const dotProductXY = (p: Point, otherX: number, otherY: number): number =>\n f(f(p.x * otherX) + f(p.y * otherY));\n\n/**\n * Compute the Z coordinate of the cross product of two vectors, to check if the second vector is\n * going clockwise ( > 0 ) or counterclockwise (< 0) compared with the first one. It could also be\n * 0, if the vectors are co-linear.\n */\nexport const clockwise = (p: Point, other: Point): boolean =>\n f(f(p.x * other.y) - f(p.y * other.x)) > 0;\n\n/** Returns unit vector representing the direction to this point from (0, 0) */\nexport function getDirection(p: Point): Point {\n const d = getDistance(p);\n if (!(d > 0)) throw new Error(\"Can't get the direction of a 0-length vector\");\n return div(p, d);\n}\n\n/** Unary negation: the same arrow pointing in the reverse direction. */\nexport const unaryMinus = (p: Point): Point => point(-p.x, -p.y);\n\nexport const minus = (p: Point, other: Point): Point => point(p.x - other.x, p.y - other.y);\n\nexport const plus = (p: Point, other: Point): Point => point(p.x + other.x, p.y + other.y);\n\nexport const times = (p: Point, operand: number): Point => point(p.x * operand, p.y * operand);\n\nexport const div = (p: Point, operand: number): Point => point(p.x / operand, p.y / operand);\n\nexport const rem = (p: Point, operand: number): Point => point(p.x % operand, p.y % operand);\n\n/** Linearly interpolate between two Points. */\nexport const interpolatePoint = (start: Point, stop: Point, fraction: number): Point =>\n point(\n f(f(f(1 - fraction) * start.x) + f(fraction * stop.x)),\n f(f(f(1 - fraction) * start.y) + f(fraction * stop.y)),\n );\n\n/** Interface for a function that can transform (rotate/scale/translate/etc.) points. */\nexport type PointTransformer = (x: number, y: number) => readonly [number, number];\n\nexport function transformed(p: Point, f: PointTransformer): Point {\n const [x, y] = f(p.x, p.y);\n return point(x, y);\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Utils.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Float32-faithful: Kotlin does this math in `Float`, so every operation is rounded with\n// `fround` (exact for + - * / and sqrt; `kotlin.math` trig is the double result rounded to\n// float). Symmetric shapes produce near-ties in Morph's corner matching that only the same\n// rounding resolves the way Compose does.\n\nimport { type Point, point, plus, times } from './point.js';\n\n/** Kotlin `Float` rounding. */\nexport const f = Math.fround;\n\n/** Kotlin `Float.MIN_VALUE`: the smallest *positive* float32 (not the most negative). */\nexport const FLOAT_MIN_VALUE = 1.401298464324817e-45;\n/** Kotlin `Float.MAX_VALUE`. */\nexport const FLOAT_MAX_VALUE = 3.4028234663852886e38;\n\n/** This class has all internal methods, used by Polygon, Morph, etc. */\nexport const distance = (x: number, y: number): number => f(Math.sqrt(f(f(x * x) + f(y * y))));\n\nexport const distanceSquared = (x: number, y: number): number => f(f(x * x) + f(y * y));\n\n/** Returns unit vector representing the direction to this point from (0, 0) */\nexport function directionVector(x: number, y: number): Point {\n const d = distance(x, y);\n if (!(d > 0)) throw new Error('Required distance greater than zero');\n return point(f(x / d), f(y / d));\n}\n\nexport const directionVectorFromAngle = (angleRadians: number): Point =>\n point(f(Math.cos(angleRadians)), f(Math.sin(angleRadians)));\n\n/**\n * These epsilon values are used internally to determine when two points are the same, within some\n * reasonable roundoff error. The distance epsilon is smaller, with the intention that the roundoff\n * should not be larger than a pixel on any reasonable sized display.\n */\nexport const DistanceEpsilon = /* @__PURE__ */ f(1e-4);\nexport const AngleEpsilon = /* @__PURE__ */ f(1e-6);\n\nexport const Zero: Point = /* @__PURE__ */ point(0, 0);\nexport const FloatPi = /* @__PURE__ */ f(Math.PI);\nexport const TwoPi = /* @__PURE__ */ f(2 * FloatPi);\n\nexport const angle = (x: number, y: number): number => f(f(f(Math.atan2(y, x)) + TwoPi) % TwoPi);\n\nexport const radialToCartesian = (\n radius: number,\n angleRadians: number,\n center: Point = Zero,\n): Point => plus(times(directionVectorFromAngle(angleRadians), radius), center);\n\nexport const rotate90 = (p: Point): Point => point(-p.y, p.x);\n\nexport const square = (x: number): number => f(x * x);\n\n/** Linearly interpolate between [start] and [stop] with [fraction] fraction between them. */\nexport const interpolate = (start: number, stop: number, fraction: number): number =>\n f(f(f(1 - fraction) * start) + f(fraction * stop));\n\nexport const positiveModulo = (num: number, mod: number): number => f(f(f(num % mod) + mod) % mod);\n\n/**\n * Does a ternary search in [v0..v1] to find the parameter that minimizes the given function.\n * Stops when the search space size is reduced below the given tolerance.\n */\nexport function findMinimum(\n v0: number,\n v1: number,\n tolerance: number,\n fn: (value: number) => number,\n): number {\n let a = v0;\n let b = v1;\n while (f(b - a) > tolerance) {\n const c1 = f(f(f(2 * a) + b) / 3);\n const c2 = f(f(f(2 * b) + a) / 3);\n if (fn(c1) < fn(c2)) {\n b = c2;\n } else {\n a = c1;\n }\n }\n return f(f(a + b) / 2);\n}\n\n/** Kotlin's default `findMinimum` tolerance. */\nexport const FIND_MINIMUM_TOLERANCE = /* @__PURE__ */ f(1e-3);\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Cubic.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { type Point, type PointTransformer, dotProduct, dotProductXY, point } from './point.js';\nimport { DistanceEpsilon, directionVector, distance, f, interpolate, rotate90 } from './utils.js';\n\nconst inUnitRange = (t: number) => t >= 0 && t <= 1;\n\n/**\n * This class holds the anchor and control point data for a single cubic Bézier curve, with anchor\n * points ([anchor0X], [anchor0Y]) and ([anchor1X], [anchor1Y]) at either end and control points\n * ([control0X], [control0Y]) and ([control1X], [control1Y]) determining the slope of the curve\n * between the anchor points.\n */\nexport class Cubic {\n /** Kotlin `FloatArray`: values are stored as float32. */\n readonly points: Float32Array;\n\n constructor(points: ArrayLike<number> = new Float32Array(8)) {\n if (points.length !== 8) throw new Error('Points array size should be 8');\n this.points = Float32Array.from(points);\n }\n\n /** Creates a Cubic from its eight coordinates (the top-level Kotlin `Cubic(...)` factory). */\n static of(\n anchor0X: number,\n anchor0Y: number,\n control0X: number,\n control0Y: number,\n control1X: number,\n control1Y: number,\n anchor1X: number,\n anchor1Y: number,\n ): Cubic {\n return new Cubic([\n anchor0X,\n anchor0Y,\n control0X,\n control0Y,\n control1X,\n control1Y,\n anchor1X,\n anchor1Y,\n ]);\n }\n\n static fromPoints(anchor0: Point, control0: Point, control1: Point, anchor1: Point): Cubic {\n return Cubic.of(\n anchor0.x,\n anchor0.y,\n control0.x,\n control0.y,\n control1.x,\n control1.y,\n anchor1.x,\n anchor1.y,\n );\n }\n\n get anchor0X(): number {\n return this.points[0]!;\n }\n get anchor0Y(): number {\n return this.points[1]!;\n }\n get control0X(): number {\n return this.points[2]!;\n }\n get control0Y(): number {\n return this.points[3]!;\n }\n get control1X(): number {\n return this.points[4]!;\n }\n get control1Y(): number {\n return this.points[5]!;\n }\n get anchor1X(): number {\n return this.points[6]!;\n }\n get anchor1Y(): number {\n return this.points[7]!;\n }\n\n pointOnCurve(t: number): Point {\n const u = f(1 - t);\n const w0 = f(f(u * u) * u);\n const w1 = f(f(f(3 * t) * u) * u);\n const w2 = f(f(f(3 * t) * t) * u);\n const w3 = f(f(t * t) * t);\n return point(\n f(\n f(f(f(this.anchor0X * w0) + f(this.control0X * w1)) + f(this.control1X * w2)) +\n f(this.anchor1X * w3),\n ),\n f(\n f(f(f(this.anchor0Y * w0) + f(this.control0Y * w1)) + f(this.control1Y * w2)) +\n f(this.anchor1Y * w3),\n ),\n );\n }\n\n zeroLength(): boolean {\n return (\n Math.abs(f(this.anchor0X - this.anchor1X)) < DistanceEpsilon &&\n Math.abs(f(this.anchor0Y - this.anchor1Y)) < DistanceEpsilon\n );\n }\n\n /**\n * Fills [bounds] with `[minX, minY, maxX, maxY]`. With [approximate], the bounding box of all\n * anchors and controls; otherwise the exact extrema (solving the derivative quadratic).\n */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = false): void {\n // A curve might be of zero-length, with both anchors co-lated.\n // Just return the point itself.\n if (this.zeroLength()) {\n bounds[0] = this.anchor0X;\n bounds[1] = this.anchor0Y;\n bounds[2] = this.anchor0X;\n bounds[3] = this.anchor0Y;\n return;\n }\n\n let minX = Math.min(this.anchor0X, this.anchor1X);\n let minY = Math.min(this.anchor0Y, this.anchor1Y);\n let maxX = Math.max(this.anchor0X, this.anchor1X);\n let maxY = Math.max(this.anchor0Y, this.anchor1Y);\n\n if (approximate) {\n // Approximate bounds use the bounding box of all anchors and controls\n bounds[0] = Math.min(minX, Math.min(this.control0X, this.control1X));\n bounds[1] = Math.min(minY, Math.min(this.control0Y, this.control1Y));\n bounds[2] = Math.max(maxX, Math.max(this.control0X, this.control1X));\n bounds[3] = Math.max(maxY, Math.max(this.control0Y, this.control1Y));\n return;\n }\n\n const zeroIsh = (value: number) => Math.abs(value) < DistanceEpsilon;\n const includeX = (t: number) => {\n if (!inUnitRange(t)) return;\n const it = this.pointOnCurve(t).x;\n if (it < minX) minX = it;\n if (it > maxX) maxX = it;\n };\n const includeY = (t: number) => {\n if (!inUnitRange(t)) return;\n const it = this.pointOnCurve(t).y;\n if (it < minY) minY = it;\n if (it > maxY) maxY = it;\n };\n\n // Find the derivative, which is a quadratic Bezier. Then we can solve for t using\n // the quadratic formula\n const xa = f(\n f(f(-this.anchor0X + f(3 * this.control0X)) - f(3 * this.control1X)) + this.anchor1X,\n );\n const xb = f(f(f(2 * this.anchor0X) - f(4 * this.control0X)) + f(2 * this.control1X));\n const xc = f(-this.anchor0X + this.control0X);\n\n if (zeroIsh(xa)) {\n // Try the Muller method instead; it can find a single root when a is 0\n if (xb !== 0) includeX(f(f(2 * xc) / f(-2 * xb)));\n } else {\n const xs = f(f(xb * xb) - f(f(4 * xa) * xc));\n if (xs >= 0) {\n includeX(f(f(-xb + f(Math.sqrt(xs))) / f(2 * xa)));\n includeX(f(f(-xb - f(Math.sqrt(xs))) / f(2 * xa)));\n }\n }\n\n // Repeat the above for y coordinate\n const ya = f(\n f(f(-this.anchor0Y + f(3 * this.control0Y)) - f(3 * this.control1Y)) + this.anchor1Y,\n );\n const yb = f(f(f(2 * this.anchor0Y) - f(4 * this.control0Y)) + f(2 * this.control1Y));\n const yc = f(-this.anchor0Y + this.control0Y);\n\n if (zeroIsh(ya)) {\n if (yb !== 0) includeY(f(f(2 * yc) / f(-2 * yb)));\n } else {\n const ys = f(f(yb * yb) - f(f(4 * ya) * yc));\n if (ys >= 0) {\n includeY(f(f(-yb + f(Math.sqrt(ys))) / f(2 * ya)));\n includeY(f(f(-yb - f(Math.sqrt(ys))) / f(2 * ya)));\n }\n }\n bounds[0] = minX;\n bounds[1] = minY;\n bounds[2] = maxX;\n bounds[3] = maxY;\n }\n\n /** Returns two Cubics, created by splitting this curve at the given distance of [t]. */\n split(t: number): [Cubic, Cubic] {\n const u = f(1 - t);\n const p = this.pointOnCurve(t);\n const uu = f(u * u);\n const ut2 = f(f(2 * u) * t);\n const tt = f(t * t);\n const lerp = (a: number, b: number) => f(f(a * u) + f(b * t));\n const quad = (a: number, b: number, c: number) => f(f(f(a * uu) + f(b * ut2)) + f(c * tt));\n return [\n Cubic.of(\n this.anchor0X,\n this.anchor0Y,\n lerp(this.anchor0X, this.control0X),\n lerp(this.anchor0Y, this.control0Y),\n quad(this.anchor0X, this.control0X, this.control1X),\n quad(this.anchor0Y, this.control0Y, this.control1Y),\n p.x,\n p.y,\n ),\n Cubic.of(\n p.x,\n p.y,\n quad(this.control0X, this.control1X, this.anchor1X),\n quad(this.control0Y, this.control1Y, this.anchor1Y),\n lerp(this.control1X, this.anchor1X),\n lerp(this.control1Y, this.anchor1Y),\n this.anchor1X,\n this.anchor1Y,\n ),\n ];\n }\n\n /** Utility function to reverse the control/anchor points for this curve. */\n reverse(): Cubic {\n return Cubic.of(\n this.anchor1X,\n this.anchor1Y,\n this.control1X,\n this.control1Y,\n this.control0X,\n this.control0Y,\n this.anchor0X,\n this.anchor0Y,\n );\n }\n\n plus(o: Cubic): Cubic {\n return new Cubic(this.points.map((v, i) => v + o.points[i]!));\n }\n\n times(x: number): Cubic {\n return new Cubic(this.points.map((v) => v * x));\n }\n\n div(x: number): Cubic {\n return this.times(f(1 / x));\n }\n\n toString(): string {\n const [a0x, a0y, c0x, c0y, c1x, c1y, a1x, a1y] = Array.from(this.points, String);\n return `anchor0: (${a0x!}, ${a0y!}) control0: (${c0x!}, ${c0y!}), control1: (${c1x!}, ${c1y!}), anchor1: (${a1x!}, ${a1y!})`;\n }\n\n equals(other: unknown): boolean {\n if (this === other) return true;\n return other instanceof Cubic && this.points.every((v, i) => v === other.points[i]);\n }\n\n /** Transforms the points in this [Cubic] with the given [PointTransformer]. */\n transformed(f: PointTransformer): Cubic {\n const newCubic = new MutableCubic();\n newCubic.points.set(this.points);\n newCubic.transform(f);\n return newCubic;\n }\n\n /** Generates a bezier curve that is a straight line between the given anchor points. */\n static straightLine(x0: number, y0: number, x1: number, y1: number): Cubic {\n return Cubic.of(\n x0,\n y0,\n interpolate(x0, x1, ONE_THIRD),\n interpolate(y0, y1, ONE_THIRD),\n interpolate(x0, x1, TWO_THIRDS),\n interpolate(y0, y1, TWO_THIRDS),\n x1,\n y1,\n );\n }\n\n /**\n * Generates a bezier curve that approximates a circular arc, with p0 and p1 as the starting and\n * ending anchor points. The curve generated is the smallest of the two possible arcs around the\n * entire 360-degree circle. Arcs of greater than 180 degrees should use more than one arc\n * together. Note that p0 and p1 should be equidistant from the center.\n */\n static circularArc(\n centerX: number,\n centerY: number,\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n ): Cubic {\n const p0d = directionVector(f(x0 - centerX), f(y0 - centerY));\n const p1d = directionVector(f(x1 - centerX), f(y1 - centerY));\n const rotatedP0 = rotate90(p0d);\n const rotatedP1 = rotate90(p1d);\n const clockwise = dotProductXY(rotatedP0, f(x1 - centerX), f(y1 - centerY)) >= 0;\n const cosa = dotProduct(p0d, p1d);\n if (cosa > COS_NEARLY_ZERO_ANGLE) /* p0 ~= p1 */ return Cubic.straightLine(x0, y0, x1, y1);\n const oneMinusCosa = f(1 - cosa);\n const k = f(\n f(\n f(\n f(f(distance(f(x0 - centerX), f(y0 - centerY)) * 4) / 3) *\n f(f(Math.sqrt(f(2 * oneMinusCosa))) - f(Math.sqrt(f(1 - f(cosa * cosa))))),\n ) / oneMinusCosa,\n ) * (clockwise ? 1 : -1),\n );\n return Cubic.of(\n x0,\n y0,\n f(x0 + f(rotatedP0.x * k)),\n f(y0 + f(rotatedP0.y * k)),\n f(x1 - f(rotatedP1.x * k)),\n f(y1 - f(rotatedP1.y * k)),\n x1,\n y1,\n );\n }\n}\n\n/** Kotlin `0.999f`, `1f / 3f` and `2f / 3f`. */\nconst COS_NEARLY_ZERO_ANGLE = /* @__PURE__ */ f(0.999);\nconst ONE_THIRD = /* @__PURE__ */ f(1 / 3);\nconst TWO_THIRDS = /* @__PURE__ */ f(2 / 3);\n\n/** This is a Mutable version of [Cubic], used mostly for performance critical paths. */\nexport class MutableCubic extends Cubic {\n private transformOnePoint(f: PointTransformer, ix: number): void {\n const [x, y] = f(this.points[ix]!, this.points[ix + 1]!);\n this.points[ix] = x;\n this.points[ix + 1] = y;\n }\n\n transform(f: PointTransformer): void {\n this.transformOnePoint(f, 0);\n this.transformOnePoint(f, 2);\n this.transformOnePoint(f, 4);\n this.transformOnePoint(f, 6);\n }\n\n interpolate(c1: Cubic, c2: Cubic, progress: number): void {\n for (let i = 0; i < 8; i++) {\n this.points[i] = interpolate(c1.points[i]!, c2.points[i]!, progress);\n }\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Features.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport type { Cubic } from './cubic.js';\nimport { type Point, type PointTransformer, transformed } from './point.js';\n\n/**\n * This class holds information about a corner (rounded or not) or an edge of a given polygon. The\n * features of a Polygon can be used to manipulate the shape with more context of what the shape\n * actually is, rather than simply manipulating the raw curves and lines which describe it.\n */\nexport abstract class Feature {\n constructor(readonly cubics: readonly Cubic[]) {}\n\n abstract transformed(f: PointTransformer): Feature;\n\n abstract toString(): string;\n}\n\n/**\n * Edges have only a list of the cubic curves which make up the edge. Edges lie between corners\n * and have no vertex or concavity; the curves are simply straight lines (represented by Cubic\n * curves).\n */\nexport class Edge extends Feature {\n transformed(f: PointTransformer): Edge {\n return new Edge(this.cubics.map((c) => c.transformed(f)));\n }\n\n toString(): string {\n return 'Edge';\n }\n}\n\n/**\n * Corners contain the list of cubic curves which describe how the corner is rounded (or not),\n * plus the vertex at the corner (which the cubics may or may not pass through, depending on\n * whether the corner is rounded) and a flag indicating whether the corner is convex. A regular\n * polygon has all convex corners, while a star polygon generally (but not necessarily) has both\n * convex (outer) and concave (inner) corners.\n */\nexport class Corner extends Feature {\n constructor(\n cubics: readonly Cubic[],\n readonly vertex: Point,\n readonly roundedCenter: Point,\n readonly convex = true,\n ) {\n super(cubics);\n }\n\n transformed(f: PointTransformer): Corner {\n return new Corner(\n this.cubics.map((c) => c.transformed(f)),\n transformed(this.vertex, f),\n transformed(this.roundedCenter, f),\n this.convex,\n );\n }\n\n toString(): string {\n return `Corner: vertex=(${String(this.vertex.x)}, ${String(this.vertex.y)}), center=(${String(this.roundedCenter.x)}, ${String(this.roundedCenter.y)}), convex=${String(this.convex)}`;\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/FloatMapping.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { f, positiveModulo } from './utils.js';\n\n/**\n * Checks if the given progress is in the given progress range, since progress is in the [0..1)\n * interval, and wraps, there is a special case when progressTo < progressFrom. For example, if\n * the progress range is 0.7 to 0.2, both 0.8 and 0.1 are inside and 0.5 is outside.\n */\nexport function progressInRange(\n progress: number,\n progressFrom: number,\n progressTo: number,\n): boolean {\n return progressTo >= progressFrom\n ? progress >= progressFrom && progress <= progressTo\n : progress >= progressFrom || progress <= progressTo;\n}\n\n/**\n * Maps from one set of progress values to another. This is used by DoubleMapper to retrieve the\n * value on one shape that maps to the appropriate value on the other.\n */\nexport function linearMap(\n xValues: readonly number[],\n yValues: readonly number[],\n x: number,\n): number {\n if (!(x >= 0 && x <= 1)) throw new Error(`Invalid progress: ${String(x)}`);\n const n = xValues.length;\n const segmentStartIndex = xValues.findIndex((_, it) =>\n progressInRange(x, xValues[it]!, xValues[(it + 1) % n]!),\n );\n if (segmentStartIndex === -1)\n throw new Error('Collection contains no element matching the predicate.');\n const segmentEndIndex = (segmentStartIndex + 1) % n;\n const segmentSizeX = positiveModulo(\n f(xValues[segmentEndIndex]! - xValues[segmentStartIndex]!),\n 1,\n );\n const segmentSizeY = positiveModulo(\n f(yValues[segmentEndIndex]! - yValues[segmentStartIndex]!),\n 1,\n );\n const positionInSegment =\n segmentSizeX < f(0.001)\n ? 0.5\n : f(positiveModulo(f(x - xValues[segmentStartIndex]!), 1) / segmentSizeX);\n return positiveModulo(f(yValues[segmentStartIndex]! + f(segmentSizeY * positionInSegment)), 1);\n}\n\n/**\n * DoubleMapper creates mappings from values in the [0..1) source space to values in the [0..1)\n * target space, and back. This mapping is created given a finite list of representative mappings,\n * and this is extended to the whole interval by linear interpolation, and wrapping around.\n */\nexport class DoubleMapper {\n private readonly sourceValues: number[] = [];\n private readonly targetValues: number[] = [];\n\n constructor(...mappings: (readonly [number, number])[]) {\n for (const [source, target] of mappings) {\n this.sourceValues.push(f(source));\n this.targetValues.push(f(target));\n }\n validateProgress(this.sourceValues);\n validateProgress(this.targetValues);\n }\n\n map(x: number): number {\n return linearMap(this.sourceValues, this.targetValues, x);\n }\n\n mapBack(x: number): number {\n return linearMap(this.targetValues, this.sourceValues, x);\n }\n\n static readonly Identity = /* @__PURE__ */ new DoubleMapper(\n // We need any 2 points in the (x, x) diagonal, with x in the [0, 1) range,\n // We spread them as much as possible to minimize float errors.\n [0, 0],\n [0.5, 0.5],\n );\n}\n\n/**\n * Verify that a list of progress values are all in the range [0.0, 1.0) and is monotonically\n * increasing, with the exception of maybe one wrap around.\n */\nexport function validateProgress(p: readonly number[]): void {\n if (!p.every((curr) => curr >= 0 && curr <= 1)) {\n throw new Error(`FloatMapping - Progress outside of range: ${p.join(', ')}`);\n }\n let wraps = 0;\n for (let it = 1; it < p.length; it++) if (p[it]! < p[it - 1]!) wraps++;\n if (wraps > 1) throw new Error(`FloatMapping - Progress wraps more than once: ${p.join(', ')}`);\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/FeatureMapping.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { Corner, type Feature } from './features.js';\nimport { DoubleMapper } from './float-mapping.js';\nimport type { ProgressableFeature } from './polygon-measure.js';\nimport { FLOAT_MAX_VALUE, f } from './utils.js';\n\n/** Kotlin `minBy`: the first element with the smallest key. */\nfunction minBy(from: number, toInclusive: number, key: (i: number) => number): number {\n let best = from;\n let bestKey = key(from);\n for (let i = from + 1; i <= toInclusive; i++) {\n const k = key(i);\n if (k < bestKey) {\n best = i;\n bestKey = k;\n }\n }\n return best;\n}\n\n/**\n * Creates a mapping between the \"features\" (rounded corners) of two shapes. Used by Morph to\n * decide which corners of one shape morph into which corners of the other.\n */\nexport function featureMapper(\n features1: readonly ProgressableFeature[],\n features2: readonly ProgressableFeature[],\n): DoubleMapper {\n // We only use corners for this mapping.\n const filteredFeatures1 = features1.filter((f) => f.feature instanceof Corner);\n const filteredFeatures2 = features2.filter((f) => f.feature instanceof Corner);\n\n const [m1, m2] =\n filteredFeatures1.length > filteredFeatures2.length\n ? [doMapping(filteredFeatures2, filteredFeatures1), filteredFeatures2]\n : [filteredFeatures1, doMapping(filteredFeatures1, filteredFeatures2)];\n\n const mm: (readonly [number, number])[] = [];\n for (let i = 0; i < m1.length; i++) {\n if (i === m2.length) break;\n mm.push([m1[i]!.progress, m2[i]!.progress]);\n }\n return new DoubleMapper(...mm);\n}\n\n/**\n * Returns distance along overall shape between two Features on the two different shapes. This\n * information is used to determine how to map features (and the curves that make up those\n * features).\n */\nexport function featureDistSquared(f1: Feature, f2: Feature): number {\n if (f1 instanceof Corner && f2 instanceof Corner && f1.convex !== f2.convex) {\n // Simple hack to force all features to map only to features of the same concavity, by\n // returning an infinitely large distance in that case\n return FLOAT_MAX_VALUE;\n }\n const first1 = f1.cubics[0]!;\n const last1 = f1.cubics[f1.cubics.length - 1]!;\n const first2 = f2.cubics[0]!;\n const last2 = f2.cubics[f2.cubics.length - 1]!;\n const c1x = f(f(first1.anchor0X + last1.anchor1X) / 2);\n const c1y = f(f(first1.anchor0Y + last1.anchor1Y) / 2);\n const c2x = f(f(first2.anchor0X + last2.anchor1X) / 2);\n const c2y = f(f(first2.anchor0Y + last2.anchor1Y) / 2);\n const dx = f(c1x - c2x);\n const dy = f(c1y - c2y);\n return f(f(dx * dx) + f(dy * dy));\n}\n\n/**\n * Returns a mapping of the features in f2 that best map to the features in f1. The result will\n * be a list of features in f2 that is the size of f1.\n */\nexport function doMapping(\n f1: readonly ProgressableFeature[],\n f2: readonly ProgressableFeature[],\n): ProgressableFeature[] {\n // Pick the first mapping in a greedy way.\n const ix = minBy(0, f2.length - 1, (it) => featureDistSquared(f1[0]!.feature, f2[it]!.feature));\n\n const m = f1.length;\n const n = f2.length;\n\n const ret = [f2[ix]!];\n let lastPicked = ix;\n for (let i = 1; i < m; i++) {\n // Check the indices we can pick, which one is better.\n // Leave enough items in f2 to pick matches for the items left in f1.\n let last = ix - (m - i);\n if (!(last > lastPicked)) last += n;\n const best = minBy(lastPicked + 1, last, (it) =>\n featureDistSquared(f1[i]!.feature, f2[it % n]!.feature),\n );\n ret.push(f2[best % n]!);\n lastPicked = best;\n }\n return ret;\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/PolygonMeasure.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// 1.0.1 measures outline progress by angle around the polygon center (AngleMeasurer);\n// 1.1.0 switched to curve length.\n\nimport type { Cubic } from './cubic.js';\nimport { Corner, type Feature } from './features.js';\nimport type { RoundedPolygon } from './rounded-polygon.js';\nimport { DistanceEpsilon, TwoPi, angle, f, findMinimum, positiveModulo } from './utils.js';\n\n/** A feature with its position along the outline of its polygon, in [0, 1). */\nexport class ProgressableFeature {\n constructor(\n readonly progress: number,\n readonly feature: Feature,\n ) {}\n}\n\nexport interface Measurer {\n /**\n * Returns size of given cubic, according to however the implementation wants to measure the\n * size (angle, length, etc). It has to be greater or equal to 0.\n */\n measureCubic(c: Cubic): number;\n\n /**\n * Given a cubic and a measure that should be between 0 and the value returned by measureCubic\n * (If not, it will be capped), finds the parameter t of the cubic at which that measure is\n * reached.\n */\n findCubicCutPoint(c: Cubic, m: number): number;\n}\n\n/**\n * Approximates the arc lengths of cubics by measuring the angle swept around the center of the\n * polygon.\n */\nexport class AngleMeasurer implements Measurer {\n constructor(\n readonly centerX: number,\n readonly centerY: number,\n ) {}\n\n measureCubic(c: Cubic): number {\n const it = positiveModulo(\n f(\n angle(f(c.anchor1X - this.centerX), f(c.anchor1Y - this.centerY)) -\n angle(f(c.anchor0X - this.centerX), f(c.anchor0Y - this.centerY)),\n ),\n TwoPi,\n );\n // Avoid an empty cubic to measure almost TwoPi\n return it > f(TwoPi - DistanceEpsilon) ? 0 : it;\n }\n\n findCubicCutPoint(c: Cubic, m: number): number {\n const angle0 = angle(f(c.anchor0X - this.centerX), f(c.anchor0Y - this.centerY));\n return findMinimum(0, 1, f(1e-5), (t) => {\n const curvePoint = c.pointOnCurve(t);\n const a = angle(f(curvePoint.x - this.centerX), f(curvePoint.y - this.centerY));\n return Math.abs(f(positiveModulo(f(a - angle0), TwoPi) - m));\n });\n }\n}\n\nexport class MeasuredCubic {\n readonly measuredSize: number;\n\n constructor(\n private readonly measurer: Measurer,\n readonly cubic: Cubic,\n private _startOutlineProgress: number,\n private _endOutlineProgress: number,\n ) {\n if (!(_endOutlineProgress >= _startOutlineProgress)) {\n throw new Error(\n 'endOutlineProgress is expected to be equal or greater than startOutlineProgress',\n );\n }\n this.measuredSize = measurer.measureCubic(cubic);\n }\n\n get startOutlineProgress(): number {\n return this._startOutlineProgress;\n }\n\n get endOutlineProgress(): number {\n return this._endOutlineProgress;\n }\n\n updateProgressRange(\n startOutlineProgress: number = this._startOutlineProgress,\n endOutlineProgress: number = this._endOutlineProgress,\n ): void {\n if (!(endOutlineProgress >= startOutlineProgress)) {\n throw new Error(\n 'endOutlineProgress is expected to be equal or greater than startOutlineProgress',\n );\n }\n this._startOutlineProgress = startOutlineProgress;\n this._endOutlineProgress = endOutlineProgress;\n }\n\n /**\n * Cut this MeasuredCubic into two MeasuredCubics at the given outline progress value.\n */\n cutAtProgress(cutOutlineProgress: number): [MeasuredCubic, MeasuredCubic] {\n // Floating point errors further up can cause cutOutlineProgress to land just\n // slightly outside of the start/end progress for this cubic, so we limit it\n // to those bounds to avoid further errors later\n const boundedCutOutlineProgress = Math.min(\n Math.max(cutOutlineProgress, this._startOutlineProgress),\n this._endOutlineProgress,\n );\n const outlineProgressSize = f(this._endOutlineProgress - this._startOutlineProgress);\n const progressFromStart = f(boundedCutOutlineProgress - this._startOutlineProgress);\n\n // Note that in earlier parts of the computation, we have empty MeasuredCubics (cubics\n // with progressSize == 0f), but those cubics are filtered out before this method is\n // called.\n const relativeProgress = f(progressFromStart / outlineProgressSize);\n const t = this.measurer.findCubicCutPoint(this.cubic, f(relativeProgress * this.measuredSize));\n if (!(t >= 0 && t <= 1)) throw new Error('Cubic cut point is expected to be between 0 and 1');\n\n // c1/c2 are the two new cubics, then we return MeasuredCubics created from them\n const [c1, c2] = this.cubic.split(t);\n return [\n new MeasuredCubic(this.measurer, c1, this._startOutlineProgress, boundedCutOutlineProgress),\n new MeasuredCubic(this.measurer, c2, boundedCutOutlineProgress, this._endOutlineProgress),\n ];\n }\n\n toString(): string {\n return `MeasuredCubic(outlineProgress=[${String(this._startOutlineProgress)} .. ${String(this._endOutlineProgress)}], size=${String(this.measuredSize)}, cubic=${String(this.cubic)})`;\n }\n}\n\nexport class MeasuredPolygon implements Iterable<MeasuredCubic> {\n private readonly cubics: MeasuredCubic[];\n\n private constructor(\n private readonly measurer: Measurer,\n readonly features: readonly ProgressableFeature[],\n cubics: readonly Cubic[],\n outlineProgress: readonly number[],\n ) {\n if (outlineProgress.length !== cubics.length + 1) {\n throw new Error('Outline progress size is expected to be the cubics size + 1');\n }\n if (outlineProgress[0] !== 0)\n throw new Error('First outline progress value is expected to be zero');\n if (outlineProgress[outlineProgress.length - 1] !== 1) {\n throw new Error('Last outline progress value is expected to be one');\n }\n const measuredCubics: MeasuredCubic[] = [];\n let startOutlineProgress = 0;\n for (let index = 0; index < cubics.length; index++) {\n // Filter out \"empty\" cubics\n if (f(outlineProgress[index + 1]! - outlineProgress[index]!) > DistanceEpsilon) {\n measuredCubics.push(\n new MeasuredCubic(\n measurer,\n cubics[index]!,\n startOutlineProgress,\n outlineProgress[index + 1]!,\n ),\n );\n // The next measured cubic will start exactly where this one ends.\n startOutlineProgress = outlineProgress[index + 1]!;\n }\n }\n // We could have removed empty cubics at the end. Ensure the last measured cubic ends at 1f\n measuredCubics[measuredCubics.length - 1]!.updateProgressRange(undefined, 1);\n this.cubics = measuredCubics;\n }\n\n get size(): number {\n return this.cubics.length;\n }\n\n get(index: number): MeasuredCubic {\n const cubic = this.cubics[index];\n if (!cubic) throw new RangeError(`index ${String(index)} out of range`);\n return cubic;\n }\n\n [Symbol.iterator](): Iterator<MeasuredCubic> {\n return this.cubics[Symbol.iterator]();\n }\n\n /**\n * Finds the point in the input list of measured cubics that pass the given outline progress, and\n * generates a new MeasuredPolygon (equivalent to this), that starts at that point. This usually\n * means cutting the cubic that crosses the outline progress (unless the cut is at one of its\n * ends) For example, given outline progress 0.4f and measured cubics on these outline progress\n * ranges: c1 [0 -> 0.2] c2 [0.2 -> 0.5] c3 [0.5 -> 1.0] c2 will be cut in two, at the given\n * outline progress, we can name these c2a [0.2 -> 0.4] and c2b [0.4 -> 0.5] The return then will\n * have the following cubics, in this order: c2b, c3, c1, c2a\n */\n cutAndShift(cuttingPoint: number): MeasuredPolygon {\n if (!(cuttingPoint >= 0 && cuttingPoint <= 1)) {\n throw new Error('Cutting point is expected to be between 0 and 1');\n }\n if (cuttingPoint < DistanceEpsilon) return this;\n\n // Find the index of cubic we want to cut\n const targetIndex = this.cubics.findIndex(\n (it) => cuttingPoint >= it.startOutlineProgress && cuttingPoint <= it.endOutlineProgress,\n );\n const target = this.get(targetIndex);\n // Cut the target cubic.\n // b1, b2 are two resulting cubics after cut\n const [b1, b2] = target.cutAtProgress(cuttingPoint);\n\n // Construct the list of the cubics we need:\n // * The second part of the target cubic (after the cut)\n // * All cubics after the target, until the end + All cubics from the start, before the\n // target cubic\n // * The first part of the target cubic (before the cut)\n const retCubics: Cubic[] = [b2.cubic];\n for (let i = 1; i < this.cubics.length; i++) {\n retCubics.push(this.get((i + targetIndex) % this.cubics.length).cubic);\n }\n retCubics.push(b1.cubic);\n\n // Construct the array of outline progress.\n // For example, if we have 3 cubics with outline progress [0 .. 0.3], [0.3 .. 0.8] &\n // [0.8 .. 1.0], and we cut + shift at 0.6:\n // 0. 0123456789\n // |--|--/-|-|\n // The outline progresses will start at 0 (the cutting point, that shifs to 0.0),\n // then 0.8 - 0.6 = 0.2, then 1 - 0.6 = 0.4, then 0.3 - 0.6 + 1 = 0.7,\n // then 1 (the cutting point again),\n // all together: (0.0, 0.2, 0.4, 0.7, 1.0)\n const retOutlineProgress: number[] = [];\n for (let index = 0; index < this.cubics.length + 2; index++) {\n if (index === 0) retOutlineProgress.push(0);\n else if (index === this.cubics.length + 1) retOutlineProgress.push(1);\n else {\n const cubicIndex = (targetIndex + index - 1) % this.cubics.length;\n retOutlineProgress.push(\n positiveModulo(f(this.get(cubicIndex).endOutlineProgress - cuttingPoint), 1),\n );\n }\n }\n\n // Shift the feature outline progress too.\n const newFeatures = this.features.map(\n (it) => new ProgressableFeature(positiveModulo(f(it.progress - cuttingPoint), 1), it.feature),\n );\n\n // Filter out all empty cubics (i.e. start and end anchor are (almost) the same point.)\n return new MeasuredPolygon(this.measurer, newFeatures, retCubics, retOutlineProgress);\n }\n\n static measurePolygon(measurer: Measurer, polygon: RoundedPolygon): MeasuredPolygon {\n const cubics: Cubic[] = [];\n const featureToCubic: [Feature, number][] = [];\n\n // Get the cubics from the polygon, at the same time, extract the features and keep a\n // reference to the representative cubic we will use.\n for (const feature of polygon.features) {\n for (let cubicIndex = 0; cubicIndex < feature.cubics.length; cubicIndex++) {\n if (feature instanceof Corner && cubicIndex === Math.trunc(feature.cubics.length / 2)) {\n featureToCubic.push([feature, cubics.length]);\n }\n cubics.push(feature.cubics[cubicIndex]!);\n }\n }\n const measures: number[] = [0];\n for (const cubic of cubics) {\n const m = measurer.measureCubic(cubic);\n if (!(m >= 0)) throw new Error('Measured cubic is expected to be greater or equal to zero');\n measures.push(f(measures[measures.length - 1]! + m));\n }\n const totalMeasure = measures[measures.length - 1]!;\n const outlineProgress = measures.map((m) => f(m / totalMeasure));\n\n const features = featureToCubic.map(\n ([feature, ix]) =>\n new ProgressableFeature(f(f(outlineProgress[ix]! + outlineProgress[ix + 1]!) / 2), feature),\n );\n return new MeasuredPolygon(measurer, features, cubics, outlineProgress);\n }\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Morph.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { Cubic, MutableCubic } from './cubic.js';\nimport { featureMapper } from './feature-mapping.js';\nimport { AngleMeasurer, type MeasuredCubic, MeasuredPolygon } from './polygon-measure.js';\nimport type { RoundedPolygon } from './rounded-polygon.js';\nimport { AngleEpsilon, f, interpolate, positiveModulo } from './utils.js';\n\n/**\n * This class is used to animate between start and end polygons objects.\n *\n * Morphing between arbitrary objects can be problematic because it can be difficult to determine\n * how the points of a given shape map to the points of some other shape. [Morph] simplifies the\n * problem by only operating on [RoundedPolygon] objects, which are known to have similar,\n * contiguous structures. For one thing, the shape of a polygon is contiguous from start to end\n * (compared to an arbitrary Path object, which could have one or more `moveTo` operations in the\n * shape). Also, all edges of a polygon shape are represented by [Cubic] objects, thus the start\n * and end shapes use similar operations. Two Polygon shapes then only differ in the quantity and\n * placement of their curves. The morph works by determining how to map the curves of the two\n * shapes together (based on proximity and other information, such as distance to polygon\n * vertices and concavity), and splitting curves when the shapes do not have the same number of\n * curves or when the curve placement within the shapes is very different.\n */\nexport class Morph {\n /** The structure which holds the actual shape being morphed: matched start/end cubics. */\n readonly morphMatch: readonly (readonly [Cubic, Cubic])[];\n\n constructor(\n private readonly start: RoundedPolygon,\n private readonly end: RoundedPolygon,\n ) {\n this.morphMatch = Morph.match(start, end);\n }\n\n /** Axis-aligned bounds covering both start and end shapes (and so the whole morph). */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = true): number[] {\n this.start.calculateBounds(bounds, approximate);\n const [minX, minY, maxX, maxY] = bounds as [number, number, number, number];\n this.end.calculateBounds(bounds, approximate);\n bounds[0] = Math.min(minX, bounds[0]!);\n bounds[1] = Math.min(minY, bounds[1]!);\n bounds[2] = Math.max(maxX, bounds[2]!);\n bounds[3] = Math.max(maxY, bounds[3]!);\n return bounds;\n }\n\n /** A square that holds both shapes in any rotation (see RoundedPolygon.calculateMaxBounds). */\n calculateMaxBounds(bounds: number[] = [0, 0, 0, 0]): number[] {\n this.start.calculateMaxBounds(bounds);\n const [minX, minY, maxX, maxY] = bounds as [number, number, number, number];\n this.end.calculateMaxBounds(bounds);\n bounds[0] = Math.min(minX, bounds[0]!);\n bounds[1] = Math.min(minY, bounds[1]!);\n bounds[2] = Math.max(maxX, bounds[2]!);\n bounds[3] = Math.max(maxY, bounds[3]!);\n return bounds;\n }\n\n /**\n * Returns a representation of the morph object at a given [progress] value as a list of Cubics.\n * Note that this function causes a new list to be created and populated, so there is some\n * overhead.\n */\n asCubics(progress: number): Cubic[] {\n const out: Cubic[] = [];\n // The first/last mechanism here ensures that the final anchor point in the shape\n // exactly matches the first anchor point. There can be rendering artifacts introduced\n // by those points being slightly off, even by much less than a pixel\n let firstCubic: Cubic | null = null;\n let lastCubic: Cubic | null = null;\n for (const [first, second] of this.morphMatch) {\n const cubic = new Cubic(\n first.points.map((v, it) => interpolate(v, second.points[it]!, progress)),\n );\n firstCubic ??= cubic;\n if (lastCubic !== null) out.push(lastCubic);\n lastCubic = cubic;\n }\n if (lastCubic !== null && firstCubic !== null) {\n out.push(\n Cubic.of(\n lastCubic.anchor0X,\n lastCubic.anchor0Y,\n lastCubic.control0X,\n lastCubic.control0Y,\n lastCubic.control1X,\n lastCubic.control1Y,\n firstCubic.anchor0X,\n firstCubic.anchor0Y,\n ),\n );\n }\n return out;\n }\n\n /**\n * Calls [callback] for each of the cubics of the morph at [progress], reusing [mutableCubic]\n * (no per-frame allocation).\n */\n forEachCubic(\n progress: number,\n callback: (cubic: MutableCubic) => void,\n mutableCubic: MutableCubic = new MutableCubic(),\n ): void {\n for (const [first, second] of this.morphMatch) {\n mutableCubic.interpolate(first, second, progress);\n callback(mutableCubic);\n }\n }\n\n /**\n * Matches the cubics of two polygons: measures both outlines, maps their corners, cuts and\n * shifts the end polygon, then walks both, cutting curves so every pair spans the same progress.\n */\n static match(p1: RoundedPolygon, p2: RoundedPolygon): [Cubic, Cubic][] {\n // Measure polygons, returns lists of measured cubics for each polygon, which\n // we then use to match start/end curves\n const measuredPolygon1 = MeasuredPolygon.measurePolygon(\n new AngleMeasurer(p1.centerX, p1.centerY),\n p1,\n );\n const measuredPolygon2 = MeasuredPolygon.measurePolygon(\n new AngleMeasurer(p2.centerX, p2.centerY),\n p2,\n );\n\n // features1 and 2 will contain the list of corners (just the inner circular curve)\n // along with the progress at the middle of those corners. These measurement values\n // are then used to compare and match between the two polygons\n const features1 = measuredPolygon1.features;\n const features2 = measuredPolygon2.features;\n\n // Map features: doubleMapper is the result of mapping the features in each shape to the\n // closest feature in the other shape.\n // Given a progress in one of the shapes it can be used to find the corresponding\n // progress in the other shape (in both directions)\n const doubleMapper = featureMapper(features1, features2);\n\n // cut point on poly2 is the mapping of the 0 point on poly1\n const polygon2CutPoint = doubleMapper.map(0);\n\n // Cut and rotate.\n // Polygons start at progress 0, and the featureMapper has decided that we want to match\n // progress 0 in the first polygon to `polygon2CutPoint` on the second polygon.\n // So we need to cut the second polygon there and \"rotate it\", so as we walk through\n // both polygons we can find the matching.\n // The resulting bs1/2 are MeasuredPolygons, whose MeasuredCubics start from\n // outlineProgress=0 and increasing until outlineProgress=1\n const bs1 = measuredPolygon1;\n const bs2 = measuredPolygon2.cutAndShift(polygon2CutPoint);\n\n // Match\n // Now we can compare the two lists of measured cubics and create a list of pairs\n // of cubics [ret], which are the start/end curves that represent the Morph object\n // and the start and end shapes, and which can be interpolated to animate the\n // between those shapes.\n const ret: [Cubic, Cubic][] = [];\n const getOrNull = (p: MeasuredPolygon, i: number): MeasuredCubic | null =>\n i < p.size ? p.get(i) : null;\n // i1/i2 are the indices of the current cubic on the start (1) and end (2) shapes\n let i1 = 0;\n let i2 = 0;\n // b1, b2 are the current measured cubic for each polygon\n let b1 = getOrNull(bs1, i1++);\n let b2 = getOrNull(bs2, i2++);\n // Iterate until all curves are accounted for and matched\n while (b1 !== null && b2 !== null) {\n // Progresses are in shape1 perspective\n // b1a, b2a are ending progress values of current measured cubics in [0,1] range\n const b1a = i1 === bs1.size ? 1 : b1.endOutlineProgress;\n const b2a =\n i2 === bs2.size\n ? 1\n : doubleMapper.mapBack(positiveModulo(f(b2.endOutlineProgress + polygon2CutPoint), 1));\n const minb = Math.min(b1a, b2a);\n // min b is the progress at which the curve that ends first ends.\n // If both curves ends roughly there, no cutting is needed, we have a match.\n // If one curve extends beyond, we need to cut it.\n let seg1: MeasuredCubic;\n let newb1: MeasuredCubic | null;\n if (b1a > f(minb + AngleEpsilon)) {\n [seg1, newb1] = b1.cutAtProgress(minb);\n } else {\n seg1 = b1;\n newb1 = getOrNull(bs1, i1++);\n }\n let seg2: MeasuredCubic;\n let newb2: MeasuredCubic | null;\n if (b2a > f(minb + AngleEpsilon)) {\n [seg2, newb2] = b2.cutAtProgress(\n positiveModulo(f(doubleMapper.map(minb) - polygon2CutPoint), 1),\n );\n } else {\n seg2 = b2;\n newb2 = getOrNull(bs2, i2++);\n }\n ret.push([seg1.cubic, seg2.cubic]);\n b1 = newb1;\n b2 = newb2;\n }\n if (!(b1 === null && b2 === null)) {\n throw new Error(\"Expected both Polygon's Cubic to be fully matched\");\n }\n return ret;\n }\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/RoundedPolygon.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Faithful to 1.0.1, including two upstream behaviours fixed in later releases:\n// - calculateCenter() divides the coordinate sum by vertices.size and then by 2 again\n// (graphics-shapes 1.1.0-alpha01: \"Fix an error in the algorithm to estimate the center\").\n// - calculateBounds() starts max values at Float.MIN_VALUE (the smallest positive float), so\n// bounds of geometry entirely at negative coordinates report max 0.\n\nimport { CornerRounding } from './corner-rounding.js';\nimport { Cubic } from './cubic.js';\nimport { Corner, Edge, type Feature } from './features.js';\nimport {\n type Point,\n type PointTransformer,\n clockwise,\n div,\n dotProduct,\n getDirection,\n interpolatePoint,\n minus,\n plus,\n point,\n times,\n transformed,\n} from './point.js';\nimport {\n DistanceEpsilon,\n FLOAT_MAX_VALUE,\n FLOAT_MIN_VALUE,\n FloatPi,\n directionVector,\n f,\n distance,\n distanceSquared,\n radialToCartesian,\n rotate90,\n square,\n} from './utils.js';\n\n/**\n * The RoundedPolygon class allows simple construction of polygonal shapes with optional rounding\n * at the vertices. Polygons can be constructed with either the number of vertices desired or an\n * ordered list of vertices.\n */\nexport class RoundedPolygon {\n readonly cubics: readonly Cubic[];\n readonly centerX: number;\n readonly centerY: number;\n\n constructor(\n readonly features: readonly Feature[],\n centerX: number,\n centerY: number,\n ) {\n this.centerX = f(centerX);\n this.centerY = f(centerY);\n this.cubics = buildCubics(features);\n let prevCubic = this.cubics[this.cubics.length - 1]!;\n for (const cubic of this.cubics) {\n if (\n Math.abs(f(cubic.anchor0X - prevCubic.anchor1X)) > DistanceEpsilon ||\n Math.abs(f(cubic.anchor0Y - prevCubic.anchor1Y)) > DistanceEpsilon\n ) {\n throw new Error(\n 'RoundedPolygon must be contiguous, with the anchor points of all curves matching the ' +\n 'anchor points of the preceding and succeeding cubics',\n );\n }\n prevCubic = cubic;\n }\n }\n\n /** Transforms (scales/translates/etc.) this [RoundedPolygon] with the given [PointTransformer]. */\n transformed(f: PointTransformer): RoundedPolygon {\n const center = transformed(point(this.centerX, this.centerY), f);\n return new RoundedPolygon(\n this.features.map((feature) => feature.transformed(f)),\n center.x,\n center.y,\n );\n }\n\n /**\n * Creates a new RoundedPolygon, moving and resizing this one, so it is completely inside the\n * (0, 0) -> (1, 1) square, centered if there extra space in one direction\n */\n normalized(): RoundedPolygon {\n const bounds = this.calculateBounds();\n const width = f(bounds[2]! - bounds[0]!);\n const height = f(bounds[3]! - bounds[1]!);\n const side = Math.max(width, height);\n // Center the shape if bounds are not a square\n const offsetX = f(f(f(side - width) / 2) - bounds[0]!); /* left */\n const offsetY = f(f(f(side - height) / 2) - bounds[1]!); /* top */\n return this.transformed((x, y) => [f(f(x + offsetX) / side), f(f(y + offsetY) / side)]);\n }\n\n toString(): string {\n return `[RoundedPolygon. Cubics = ${this.cubics.join(', ')} || Features = ${this.features.join(', ')} || Center = (${String(this.centerX)}, ${String(this.centerY)})]`;\n }\n\n /**\n * Like [calculateBounds], this function calculates the axis-aligned bounds of the object and\n * returns that rectangle. But this function determines the max dimension of the shape (by\n * calculating the distance from its center to the start and midpoint of each curve) and returns\n * a square which can be used to hold the object in any rotation.\n */\n calculateMaxBounds(bounds: number[] = [0, 0, 0, 0]): number[] {\n if (bounds.length < 4) throw new Error('Required bounds size of 4');\n let maxDistSquared = 0;\n for (const cubic of this.cubics) {\n const anchorDistance = distanceSquared(\n f(cubic.anchor0X - this.centerX),\n f(cubic.anchor0Y - this.centerY),\n );\n const middlePoint = cubic.pointOnCurve(0.5);\n const middleDistance = distanceSquared(\n f(middlePoint.x - this.centerX),\n f(middlePoint.y - this.centerY),\n );\n maxDistSquared = Math.max(maxDistSquared, Math.max(anchorDistance, middleDistance));\n }\n const d = f(Math.sqrt(maxDistSquared));\n bounds[0] = f(this.centerX - d);\n bounds[1] = f(this.centerY - d);\n bounds[2] = f(this.centerX + d);\n bounds[3] = f(this.centerY + d);\n return bounds;\n }\n\n /**\n * Calculates the axis-aligned bounds of the object. With [approximate] (the default), uses the\n * bounding box of every anchor and control point.\n */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = true): number[] {\n if (bounds.length < 4) throw new Error('Required bounds size of 4');\n let minX = FLOAT_MAX_VALUE;\n let minY = FLOAT_MAX_VALUE;\n let maxX = FLOAT_MIN_VALUE;\n let maxY = FLOAT_MIN_VALUE;\n for (const cubic of this.cubics) {\n cubic.calculateBounds(bounds, approximate);\n minX = Math.min(minX, bounds[0]!);\n minY = Math.min(minY, bounds[1]!);\n maxX = Math.max(maxX, bounds[2]!);\n maxY = Math.max(maxY, bounds[3]!);\n }\n bounds[0] = minX;\n bounds[1] = minY;\n bounds[2] = maxX;\n bounds[3] = maxY;\n return bounds;\n }\n\n /** Copy constructor (Kotlin `RoundedPolygon(source)`). */\n static copy(source: RoundedPolygon): RoundedPolygon {\n return new RoundedPolygon(source.features, source.centerX, source.centerY);\n }\n\n /**\n * Regular polygon of [numVertices] vertices around ([centerX], [centerY]) at [radius]\n * (Kotlin `RoundedPolygon(numVertices, …)`).\n */\n static fromVertexCount(\n numVertices: number,\n options: {\n radius?: number;\n centerX?: number;\n centerY?: number;\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n } = {},\n ): RoundedPolygon {\n const { radius = 1, centerX = 0, centerY = 0, rounding = CornerRounding.Unrounded } = options;\n return RoundedPolygon.fromVertices(\n verticesFromNumVerts(numVertices, radius, centerX, centerY),\n {\n rounding,\n perVertexRounding: options.perVertexRounding ?? null,\n centerX,\n centerY,\n },\n );\n }\n\n /**\n * Polygon from an ordered list of `[x0, y0, x1, y1, …]` vertices (Kotlin\n * `RoundedPolygon(vertices, …)`). Center defaults to the (1.0.1) estimate from the vertices.\n */\n static fromVertices(\n vertices: ArrayLike<number>,\n options: {\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n ): RoundedPolygon {\n const {\n rounding = CornerRounding.Unrounded,\n perVertexRounding = null,\n centerX = FLOAT_MIN_VALUE,\n centerY = FLOAT_MIN_VALUE,\n } = options;\n if (vertices.length < 6) throw new Error('Polygons must have at least 3 vertices');\n if (vertices.length % 2 === 1) throw new Error('The vertices array should have even size');\n if (perVertexRounding !== null && perVertexRounding.length * 2 !== vertices.length) {\n throw new Error(\n 'perVertexRounding list should be either null or the same size as the number of vertices (vertices.size / 2)',\n );\n }\n // Kotlin FloatArray\n const v = (i: number) => f(vertices[i]!);\n const corners: Cubic[][] = [];\n const n = vertices.length / 2;\n const roundedCorners: RoundedCorner[] = [];\n for (let i = 0; i < n; i++) {\n const vtxRounding = perVertexRounding?.[i] ?? rounding;\n const prevIndex = ((i + n - 1) % n) * 2;\n const nextIndex = ((i + 1) % n) * 2;\n roundedCorners.push(\n new RoundedCorner(\n point(v(prevIndex), v(prevIndex + 1)),\n point(v(i * 2), v(i * 2 + 1)),\n point(v(nextIndex), v(nextIndex + 1)),\n vtxRounding,\n ),\n );\n }\n\n // For each side, check if we have enough space to do the cuts needed, and if not split\n // the available space, first for round cuts, then for smoothing if there is space left.\n // Each element in this list is a pair, that represent how much we can do of the cut for\n // the given side (side i goes from corner i to corner i+1), the elements of the pair are:\n // first is how much we can use of expectedRoundCut, second how much of expectedCut\n const cutAdjusts: (readonly [number, number])[] = [];\n for (let ix = 0; ix < n; ix++) {\n const here = roundedCorners[ix]!;\n const next = roundedCorners[(ix + 1) % n]!;\n const expectedRoundCut = f(here.expectedRoundCut + next.expectedRoundCut);\n const expectedCut = f(here.expectedCut + next.expectedCut);\n const vtxX = v(ix * 2);\n const vtxY = v(ix * 2 + 1);\n const nextVtxX = v(((ix + 1) % n) * 2);\n const nextVtxY = v(((ix + 1) % n) * 2 + 1);\n const sideSize = distance(f(vtxX - nextVtxX), f(vtxY - nextVtxY));\n\n // Check expectedRoundCut first, and ensure we fulfill rounding needs first for\n // both corners before using space for smoothing\n if (expectedRoundCut > sideSize) {\n // Not enough room for fully rounding, see how much we can actually do.\n cutAdjusts.push([f(sideSize / expectedRoundCut), 0]);\n } else if (expectedCut > sideSize) {\n // We can do full rounding, but not full smoothing.\n cutAdjusts.push([1, f(f(sideSize - expectedRoundCut) / f(expectedCut - expectedRoundCut))]);\n } else {\n // There is enough room for rounding & smoothing.\n cutAdjusts.push([1, 1]);\n }\n }\n\n // Create and store list of beziers for each [potentially] rounded corner\n for (let i = 0; i < n; i++) {\n // allowedCuts[0] is for the side from the previous corner to this one,\n // allowedCuts[1] is for the side from this corner to the next one.\n const allowedCuts: number[] = [];\n const corner = roundedCorners[i]!;\n for (let delta = 0; delta <= 1; delta++) {\n const [roundCutRatio, cutRatio] = cutAdjusts[(i + n - 1 + delta) % n]!;\n allowedCuts.push(\n f(\n f(corner.expectedRoundCut * roundCutRatio) +\n f(f(corner.expectedCut - corner.expectedRoundCut) * cutRatio),\n ),\n );\n }\n corners.push(corner.getCubics(allowedCuts[0]!, allowedCuts[1]));\n }\n\n // Finally, store the calculated cubics. This includes all of the rounded corners\n // from above, along with new cubics representing the edges between those corners.\n const tempFeatures: Feature[] = [];\n for (let i = 0; i < n; i++) {\n // Determine whether corner at this vertex is concave or convex, based on the\n // relationship of the prev->curr/curr->next vectors\n // Note that these indices are for pairs of values (points), they need to be\n // doubled to access the xy values in the vertices float array\n const prevVtxIndex = (i + n - 1) % n;\n const nextVtxIndex = (i + 1) % n;\n const currVertex = point(v(i * 2), v(i * 2 + 1));\n const prevVertex = point(v(prevVtxIndex * 2), v(prevVtxIndex * 2 + 1));\n const nextVertex = point(v(nextVtxIndex * 2), v(nextVtxIndex * 2 + 1));\n const convex = clockwise(minus(currVertex, prevVertex), minus(nextVertex, currVertex));\n tempFeatures.push(new Corner(corners[i]!, currVertex, roundedCorners[i]!.center, convex));\n const last = corners[i]![corners[i]!.length - 1]!;\n const first = corners[(i + 1) % n]![0]!;\n tempFeatures.push(\n new Edge([\n Cubic.straightLine(last.anchor1X, last.anchor1Y, first.anchor0X, first.anchor0Y),\n ]),\n );\n }\n\n const { x: cx, y: cy } =\n centerX === FLOAT_MIN_VALUE || centerY === FLOAT_MIN_VALUE\n ? calculateCenter(vertices)\n : point(f(centerX), f(centerY));\n return new RoundedPolygon(tempFeatures, cx, cy);\n }\n}\n\nfunction buildCubics(features: readonly Feature[]): Cubic[] {\n const out: Cubic[] = [];\n // The first/last mechanism here ensures that the final anchor point in the shape\n // exactly matches the first anchor point. There can be rendering artifacts introduced\n // by those points being slightly off, even by much less than a pixel\n let firstCubic: Cubic | null = null;\n let lastCubic: Cubic | null = null;\n let firstFeatureSplitStart: Cubic[] | null = null;\n let firstFeatureSplitEnd: Cubic[] | null = null;\n if (features.length > 0 && features[0]!.cubics.length === 3) {\n const centerCubic = features[0]!.cubics[1]!;\n const [start, end] = centerCubic.split(0.5);\n firstFeatureSplitStart = [features[0]!.cubics[0]!, start];\n firstFeatureSplitEnd = [end, features[0]!.cubics[2]!];\n }\n // iterating one past the features list size allows us to insert the initial split\n // cubic if it exists\n for (let i = 0; i <= features.length; i++) {\n let featureCubics: readonly Cubic[];\n if (i === 0 && firstFeatureSplitEnd !== null) featureCubics = firstFeatureSplitEnd;\n else if (i === features.length) {\n if (firstFeatureSplitStart !== null) featureCubics = firstFeatureSplitStart;\n else break;\n } else featureCubics = features[i]!.cubics;\n\n for (const cubic of featureCubics) {\n // Skip zero-length curves; they add nothing and can trigger rendering artifacts\n if (!cubic.zeroLength()) {\n if (lastCubic !== null) out.push(lastCubic);\n lastCubic = cubic;\n firstCubic ??= cubic;\n } else if (lastCubic !== null) {\n // Dropping several zero-ish length curves in a row can lead to\n // enough discontinuity to throw an exception later, even though the\n // distances are quite small. Account for that by making the last\n // cubic use the latest anchor point, always. (Mutates the shared cubic, as upstream.)\n lastCubic.points[6] = cubic.anchor1X;\n lastCubic.points[7] = cubic.anchor1Y;\n }\n }\n }\n if (lastCubic !== null && firstCubic !== null) {\n out.push(\n Cubic.of(\n lastCubic.anchor0X,\n lastCubic.anchor0Y,\n lastCubic.control0X,\n lastCubic.control0Y,\n lastCubic.control1X,\n lastCubic.control1Y,\n firstCubic.anchor0X,\n firstCubic.anchor0Y,\n ),\n );\n }\n return out;\n}\n\n/** 1.0.1 center estimate (divides by vertices.size, then by 2 again; see file header). */\nfunction calculateCenter(vertices: ArrayLike<number>): Point {\n let cumulativeX = 0;\n let cumulativeY = 0;\n let index = 0;\n while (index < vertices.length) {\n cumulativeX = f(cumulativeX + f(vertices[index++]!));\n cumulativeY = f(cumulativeY + f(vertices[index++]!));\n }\n return point(f(cumulativeX / vertices.length) / 2, f(cumulativeY / vertices.length) / 2);\n}\n\n/**\n * Private utility class that holds the information about each corner in a polygon. The shape of\n * the corner can be returned by calling the [getCubics] function, which will return a list of\n * curves representing the corner geometry. The shape of the corner depends on the [rounding]\n * constructor parameter.\n */\nclass RoundedCorner {\n readonly d1: Point;\n readonly d2: Point;\n readonly cornerRadius: number;\n readonly smoothing: number;\n readonly cosAngle: number;\n readonly sinAngle: number;\n readonly expectedRoundCut: number;\n /**\n * the center of the circle approximated by the rounding curve (or the middle of the three\n * curves if smoothing is requested). The center is the same as p0 if there is no rounding.\n */\n center: Point = point(0, 0);\n\n constructor(\n readonly p0: Point,\n readonly p1: Point,\n readonly p2: Point,\n readonly rounding: CornerRounding | null = null,\n ) {\n this.d1 = getDirection(minus(p0, p1));\n this.d2 = getDirection(minus(p2, p1));\n this.cornerRadius = rounding?.radius ?? 0;\n this.smoothing = rounding?.smoothing ?? 0;\n // cosine of angle at p1 is dot product of unit vectors to the other two vertices\n this.cosAngle = dotProduct(this.d1, this.d2);\n // identity: sin^2 + cos^2 = 1\n // sinAngle gives us the intersection\n this.sinAngle = f(Math.sqrt(f(1 - square(this.cosAngle))));\n // How much we need to cut, as measured on a side, to get the required radius\n // calculating where the rounding circle hits the edge\n // This uses the identity of tan(A/2) = sinA/(1 + cosA), where tan(A/2) = radius/cut\n this.expectedRoundCut =\n this.sinAngle > 1e-3 ? f(f(this.cornerRadius * f(this.cosAngle + 1)) / this.sinAngle) : 0;\n }\n\n /** smoothing changes the actual cut. 0 is same as expectedRoundCut, 1 doubles it */\n get expectedCut(): number {\n return f(f(1 + this.smoothing) * this.expectedRoundCut);\n }\n\n getCubics(allowedCut0: number, allowedCut1: number = allowedCut0): Cubic[] {\n // We use the minimum of both cuts to determine the radius, but if there is more space\n // in one side we can use it for smoothing.\n const allowedCut = Math.min(allowedCut0, allowedCut1);\n // Nothing to do, just use lines, or a point\n if (\n this.expectedRoundCut < DistanceEpsilon ||\n allowedCut < DistanceEpsilon ||\n this.cornerRadius < DistanceEpsilon\n ) {\n this.center = this.p1;\n return [Cubic.straightLine(this.p1.x, this.p1.y, this.p1.x, this.p1.y)];\n }\n // How much of the cut is required for the rounding part.\n const actualRoundCut = Math.min(allowedCut, this.expectedRoundCut);\n // We have two smoothing values, one for each side of the vertex\n // Space is used for rounding values first. If there is space left over, then we\n // apply smoothing, if it was requested\n const actualSmoothing0 = this.calculateActualSmoothingValue(allowedCut0);\n const actualSmoothing1 = this.calculateActualSmoothingValue(allowedCut1);\n // Scale the radius if needed\n const actualR = f(f(this.cornerRadius * actualRoundCut) / this.expectedRoundCut);\n // Distance from the corner (p1) to the center\n const centerDistance = f(Math.sqrt(f(square(actualR) + square(actualRoundCut))));\n // Center of the arc we will use for rounding\n this.center = plus(\n this.p1,\n times(getDirection(div(plus(this.d1, this.d2), 2)), centerDistance),\n );\n const circleIntersection0 = plus(this.p1, times(this.d1, actualRoundCut));\n const circleIntersection2 = plus(this.p1, times(this.d2, actualRoundCut));\n const flanking0 = this.computeFlankingCurve(\n actualRoundCut,\n actualSmoothing0,\n this.p1,\n this.p0,\n circleIntersection0,\n circleIntersection2,\n this.center,\n actualR,\n );\n const flanking2 = this.computeFlankingCurve(\n actualRoundCut,\n actualSmoothing1,\n this.p1,\n this.p2,\n circleIntersection2,\n circleIntersection0,\n this.center,\n actualR,\n ).reverse();\n return [\n flanking0,\n Cubic.circularArc(\n this.center.x,\n this.center.y,\n flanking0.anchor1X,\n flanking0.anchor1Y,\n flanking2.anchor0X,\n flanking2.anchor0Y,\n ),\n flanking2,\n ];\n }\n\n /**\n * If allowedCut (the amount we are able to cut) is greater than the expected cut (without\n * smoothing applied yet), then there is room to apply smoothing and we calculate the actual\n * smoothing value here.\n */\n private calculateActualSmoothingValue(allowedCut: number): number {\n if (allowedCut > this.expectedCut) return this.smoothing;\n if (allowedCut > this.expectedRoundCut) {\n return f(\n f(this.smoothing * f(allowedCut - this.expectedRoundCut)) /\n f(this.expectedCut - this.expectedRoundCut),\n );\n }\n return 0;\n }\n\n /**\n * Compute a single flanking curve for this corner: from the side start to the rounding circle,\n * smoothed by [actualSmoothingValues].\n */\n private computeFlankingCurve(\n actualRoundCut: number,\n actualSmoothingValues: number,\n corner: Point,\n sideStart: Point,\n circleSegmentIntersection: Point,\n otherCircleSegmentIntersection: Point,\n circleCenter: Point,\n actualR: number,\n ): Cubic {\n // sideStart is the anchor, 'anchor' is actual control point\n const sideDirection = getDirection(minus(sideStart, corner));\n const curveStart = plus(\n corner,\n times(times(sideDirection, actualRoundCut), f(1 + actualSmoothingValues)),\n );\n // We use an approximation to cut a part of the circle section proportional to 1 - smooth,\n // When smooth = 0, we take the full section, when smooth = 1, we take nothing.\n const p = interpolatePoint(\n circleSegmentIntersection,\n div(plus(circleSegmentIntersection, otherCircleSegmentIntersection), 2),\n actualSmoothingValues,\n );\n // The flanking curve ends on the circle\n const curveEnd = plus(\n circleCenter,\n times(directionVector(f(p.x - circleCenter.x), f(p.y - circleCenter.y)), actualR),\n );\n // The anchor on the circle segment side is in the intersection between the tangent to the\n // circle in the circle/flanking curve boundary and the linear segment.\n const circleTangent = rotate90(minus(curveEnd, circleCenter));\n const anchorEnd =\n lineIntersection(sideStart, sideDirection, curveEnd, circleTangent) ??\n circleSegmentIntersection;\n // From what remains, we pick a point for the start anchor.\n // 2/3 seems to come from design tools?\n const anchorStart = div(plus(curveStart, times(anchorEnd, 2)), 3);\n return Cubic.fromPoints(curveStart, anchorStart, anchorEnd, curveEnd);\n }\n}\n\n/**\n * Returns the intersection point of the two lines d0->d1 and p0->p1, or null if the lines do not\n * intersect\n */\nfunction lineIntersection(p0: Point, d0: Point, p1: Point, d1: Point): Point | null {\n const rotatedD1 = rotate90(d1);\n const den = dotProduct(d0, rotatedD1);\n if (Math.abs(den) < DistanceEpsilon) return null;\n const num = dotProduct(minus(p1, p0), rotatedD1);\n // Also check the relative value. This is equivalent to abs(den/num) < DistanceEpsilon,\n // but avoid doing a division\n if (Math.abs(den) < f(DistanceEpsilon * Math.abs(num))) return null;\n const k = f(num / den);\n return plus(p0, times(d0, k));\n}\n\nfunction verticesFromNumVerts(\n numVertices: number,\n radius: number,\n centerX: number,\n centerY: number,\n): number[] {\n const result: number[] = [];\n for (let i = 0; i < numVertices; i++) {\n const vertex = plus(\n radialToCartesian(f(radius), f(f(f(FloatPi / numVertices) * 2) * i)),\n point(centerX, centerY),\n );\n result.push(vertex.x, vertex.y);\n }\n return result;\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Shapes.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Kotlin companion extensions (`RoundedPolygon.circle(...)`) become free functions.\n\nimport { CornerRounding } from './corner-rounding.js';\nimport { type Point, plus, point } from './point.js';\nimport { RoundedPolygon } from './rounded-polygon.js';\nimport { FloatPi, TwoPi, f, interpolate, radialToCartesian } from './utils.js';\n\n/**\n * Creates a circular shape, approximating the rounding of the shape around the underlying polygon\n * vertices.\n */\nexport function circle(\n options: { numVertices?: number; radius?: number; centerX?: number; centerY?: number } = {},\n): RoundedPolygon {\n const { numVertices = 8 } = options;\n const radius = f(options.radius ?? 1);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (numVertices < 3) throw new Error('Circle must have at least three vertices');\n\n // Half of the angle between two adjacent vertices on the polygon\n const theta = f(FloatPi / numVertices);\n // Radius of the underlying RoundedPolygon object given the desired radius of the circle\n const polygonRadius = f(radius / f(Math.cos(theta)));\n return RoundedPolygon.fromVertexCount(numVertices, {\n rounding: new CornerRounding(radius),\n radius: polygonRadius,\n centerX,\n centerY,\n });\n}\n\n/** Creates a rectangular shape with the given width/height around the given center. */\nexport function rectangle(\n options: {\n width?: number;\n height?: number;\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const { rounding = CornerRounding.Unrounded, perVertexRounding = null } = options;\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 2);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n const left = f(centerX - f(width / 2));\n const top = f(centerY - f(height / 2));\n const right = f(centerX + f(width / 2));\n const bottom = f(centerY + f(height / 2));\n return RoundedPolygon.fromVertices([right, bottom, left, bottom, left, top, right, top], {\n rounding,\n perVertexRounding,\n centerX,\n centerY,\n });\n}\n\n/**\n * Creates a star polygon, which is like a regular polygon except every other vertex is on either\n * an inner or outer radius.\n */\nexport function star(\n numVerticesPerRadius: number,\n options: {\n radius?: number;\n innerRadius?: number;\n rounding?: CornerRounding;\n innerRounding?: CornerRounding | null;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const { rounding = CornerRounding.Unrounded, innerRounding = null } = options;\n const radius = f(options.radius ?? 1);\n const innerRadius = f(options.innerRadius ?? 0.5);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (radius <= 0 || innerRadius <= 0) throw new Error('Star radii must both be greater than 0');\n if (innerRadius >= radius) throw new Error('innerRadius must be less than radius');\n\n let pvRounding = options.perVertexRounding ?? null;\n // If no per-vertex rounding supplied and caller asked for inner rounding,\n // create per-vertex rounding list based on supplied outer/inner rounding parameters\n if (pvRounding === null && innerRounding !== null) {\n pvRounding = Array.from({ length: numVerticesPerRadius }, () => [\n rounding,\n innerRounding,\n ]).flat();\n }\n\n // Star polygon is just a polygon with all vertices supplied (where we generate\n // those vertices to be on the inner/outer radii)\n return RoundedPolygon.fromVertices(\n starVerticesFromNumVerts(numVerticesPerRadius, radius, innerRadius, centerX, centerY),\n { rounding, perVertexRounding: pvRounding, centerX, centerY },\n );\n}\n\n/**\n * A pill shape consists of a rectangle shape bounded by two semicircles at either of the long\n * ends of the rectangle.\n */\nexport function pill(\n options: {\n width?: number;\n height?: number;\n smoothing?: number;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 1);\n const smoothing = f(options.smoothing ?? 0);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (!(width > 0 && height > 0))\n throw new Error('Pill shapes must have positive width and height');\n const wHalf = f(width / 2);\n const hHalf = f(height / 2);\n return RoundedPolygon.fromVertices(\n [\n f(wHalf + centerX),\n f(hHalf + centerY),\n f(-wHalf + centerX),\n f(hHalf + centerY),\n f(-wHalf + centerX),\n f(-hHalf + centerY),\n f(wHalf + centerX),\n f(-hHalf + centerY),\n ],\n { rounding: new CornerRounding(Math.min(wHalf, hHalf), smoothing), centerX, centerY },\n );\n}\n\n/**\n * A pillStar shape is like a [pill] except it has inner and outer radii along its pill-shaped\n * outline, just like a [star] has inner and outer radii along its circular outline.\n */\nexport function pillStar(\n options: {\n width?: number;\n height?: number;\n numVerticesPerRadius?: number;\n innerRadiusRatio?: number;\n rounding?: CornerRounding;\n innerRounding?: CornerRounding | null;\n perVertexRounding?: readonly CornerRounding[] | null;\n vertexSpacing?: number;\n startLocation?: number;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const {\n numVerticesPerRadius = 8,\n rounding = CornerRounding.Unrounded,\n innerRounding = null,\n } = options;\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 1);\n const innerRadiusRatio = f(options.innerRadiusRatio ?? 0.5);\n const vertexSpacing = f(options.vertexSpacing ?? 0.5);\n const startLocation = f(options.startLocation ?? 0);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (!(width > 0 && height > 0))\n throw new Error('Pill shapes must have positive width and height');\n if (!(innerRadiusRatio > 0 && innerRadiusRatio <= 1)) {\n throw new Error('innerRadius must be between 0 and 1');\n }\n let pvRounding = options.perVertexRounding ?? null;\n // If no per-vertex rounding supplied and caller asked for inner rounding,\n // create per-vertex rounding list based on supplied outer/inner rounding parameters\n if (pvRounding === null && innerRounding !== null) {\n pvRounding = Array.from({ length: numVerticesPerRadius }, () => [\n rounding,\n innerRounding,\n ]).flat();\n }\n return RoundedPolygon.fromVertices(\n pillStarVerticesFromNumVerts(\n numVerticesPerRadius,\n width,\n height,\n innerRadiusRatio,\n vertexSpacing,\n startLocation,\n centerX,\n centerY,\n ),\n { rounding, perVertexRounding: pvRounding, centerX, centerY },\n );\n}\n\nfunction pillStarVerticesFromNumVerts(\n numVerticesPerRadius: number,\n width: number,\n height: number,\n innerRadius: number,\n vertexSpacing: number,\n startLocation: number,\n centerX: number,\n centerY: number,\n): number[] {\n // The general approach here is to get the perimeter of the underlying pill outline,\n // then the t value for each vertex as we walk that perimeter. This tells us where\n // on the outline to place that vertex, then we figure out where to place the vertex\n // depending on which \"section\" it is in. The possible sections are the vertical edges\n // on the sides, the circular sections on all four corners, or the horizontal edges\n // on the top and bottom. Note that either the vertical or horizontal edges will be\n // of length zero (whichever dimension is smaller gets only circular curvature for the\n // pill shape).\n const endcapRadius = Math.min(width, height);\n const vSegLen = Math.max(f(height - width), 0);\n const hSegLen = Math.max(f(width - height), 0);\n const vSegHalf = f(vSegLen / 2);\n const hSegHalf = f(hSegLen / 2);\n // vertexSpacing is used to position the vertices on the end caps. The caller has the choice\n // of spacing the inner (0) or outer (1) vertices like those along the edges, causing the\n // other vertices to be either further apart (0) or closer (1). The default is .5, which\n // averages things. The magnitude of the inner and rounding parameters may cause the caller\n // to want a different value.\n const circlePerimeter = f(f(TwoPi * endcapRadius) * interpolate(innerRadius, 1, vertexSpacing));\n // perimeter is circle perimeter plus horizontal and vertical sections of inner rectangle,\n // whether either (or even both) might be of length zero.\n const perimeter = f(f(f(2 * hSegLen) + f(2 * vSegLen)) + circlePerimeter);\n\n // The sections array holds the t start values of that part of the outline. We use these to\n // determine which section a given vertex lies in, based on its t value, as well as where\n // in that section it lies.\n const sections = new Float32Array(11);\n const quarter = f(circlePerimeter / 4);\n sections[0] = 0;\n sections[1] = vSegLen / 2;\n sections[2] = sections[1] + quarter;\n sections[3] = sections[2] + hSegLen;\n sections[4] = sections[3] + quarter;\n sections[5] = sections[4] + vSegLen;\n sections[6] = sections[5] + quarter;\n sections[7] = sections[6] + hSegLen;\n sections[8] = sections[7] + quarter;\n sections[9] = sections[8] + f(vSegLen / 2);\n sections[10] = perimeter;\n\n // \"t\" is the length along the entire pill outline for a given vertex. With vertices spaced\n // evenly along this contour, we can determine for any vertex where it should lie.\n const tPerVertex = f(perimeter / (2 * numVerticesPerRadius));\n // separate iteration for inner vs outer, unlike the other shapes, because\n // the vertices can lie in different quadrants so each needs their own calculation\n let inner = false;\n // Increment section index as we walk around the pill contour with our increasing t values\n let currSecIndex = 0;\n // secStart/End are used to determine how far along a given vertex is in the section\n // in which it lands\n let secStart = 0;\n let secEnd = sections[1];\n // t value is used to place each vertex. 0 is on the positive x axis,\n // moving into section 0 to begin with. startLocation, a value from 0 to 1, varies the location\n // anywhere on the perimeter of the shape\n let t = f(startLocation * perimeter);\n // The list of vertices to be returned\n const result: number[] = [];\n const rectBR = point(hSegHalf, vSegHalf);\n const rectBL = point(-hSegHalf, vSegHalf);\n const rectTL = point(-hSegHalf, -vSegHalf);\n const rectTR = point(hSegHalf, -vSegHalf);\n // Each iteration through this loop uses the next t value as we walk around the shape\n for (let i = 0; i < numVerticesPerRadius * 2; i++) {\n // t could start (and end) after 0; extra boundedT logic makes sure it does the right\n // thing when crossing the boundar past 0 again\n const boundedT = f(t % perimeter);\n if (boundedT < secStart) currSecIndex = 0;\n while (boundedT >= sections[(currSecIndex + 1) % sections.length]!) {\n currSecIndex = (currSecIndex + 1) % sections.length;\n secStart = sections[currSecIndex]!;\n secEnd = sections[(currSecIndex + 1) % sections.length]!;\n }\n // find t in section and its proportion of that section total length\n const tInSection = f(boundedT - secStart);\n const tProportion = f(tInSection / f(secEnd - secStart));\n const halfArc = f(f(tProportion * FloatPi) / 2);\n\n // The vertex placement in a section varies depending on whether it is on one of the\n // semicircle endcaps or along one of the straight edges. For the endcaps, we use\n // tProportion to get the angle along that circular cap and add\n // the starting angle for that section. For the edges we use a straight linear calculation\n // given tProportion and the start/end t values for that edge.\n const currRadius = inner ? f(endcapRadius * innerRadius) : endcapRadius;\n let vertex: Point;\n switch (currSecIndex) {\n case 0:\n vertex = point(currRadius, f(tProportion * vSegHalf));\n break;\n case 1:\n vertex = plus(radialToCartesian(currRadius, halfArc), rectBR);\n break;\n case 2:\n vertex = point(f(hSegHalf - f(tProportion * hSegLen)), currRadius);\n break;\n case 3:\n vertex = plus(radialToCartesian(currRadius, f(f(FloatPi / 2) + halfArc)), rectBL);\n break;\n case 4:\n vertex = point(-currRadius, f(vSegHalf - f(tProportion * vSegLen)));\n break;\n case 5:\n vertex = plus(radialToCartesian(currRadius, f(FloatPi + halfArc)), rectTL);\n break;\n case 6:\n vertex = point(f(-hSegHalf + f(tProportion * hSegLen)), -currRadius);\n break;\n case 7:\n vertex = plus(radialToCartesian(currRadius, f(f(FloatPi * 1.5) + halfArc)), rectTR);\n break;\n default: // 8\n vertex = point(currRadius, f(-vSegHalf + f(tProportion * vSegHalf)));\n }\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n t = f(t + tPerVertex);\n inner = !inner;\n }\n return result;\n}\n\nfunction starVerticesFromNumVerts(\n numVerticesPerRadius: number,\n radius: number,\n innerRadius: number,\n centerX: number,\n centerY: number,\n): number[] {\n const result: number[] = [];\n for (let i = 0; i < numVerticesPerRadius; i++) {\n let vertex = radialToCartesian(radius, f(f(f(FloatPi / numVerticesPerRadius) * 2) * i));\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n vertex = radialToCartesian(innerRadius, f(f(FloatPi / numVerticesPerRadius) * (2 * i + 1)));\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n }\n return result;\n}\n","/*\n * Copyright 2020 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Only the subset MaterialShapes and ShapeUtil use: identity, rotateZ, scale and map(point).\n// Values are stored and computed as float32, like Compose's FloatArray math.\n\nconst f = Math.fround;\n\n/** A 4x4 matrix, row-major as in Compose (`this[row, column]`). Identity when created. */\nexport class Matrix {\n readonly values: Float32Array = new Float32Array([\n 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,\n ]);\n\n get(row: number, column: number): number {\n return this.values[row * 4 + column] ?? 0;\n }\n\n set(row: number, column: number, v: number): void {\n this.values[row * 4 + column] = v;\n }\n\n /** Does the 3D transform on the point and returns its `x` and `y` values. */\n map(x: number, y: number): readonly [number, number] {\n const v00 = this.get(0, 0);\n const v01 = this.get(0, 1);\n const v03 = this.get(0, 3);\n const v10 = this.get(1, 0);\n const v11 = this.get(1, 1);\n const v13 = this.get(1, 3);\n const v30 = this.get(3, 0);\n const v31 = this.get(3, 1);\n const v33 = this.get(3, 3);\n\n const z = f(f(f(v03 * x) + f(v13 * y)) + v33);\n const inverseZ = f(1 / z);\n const pZ = Number.isFinite(inverseZ) ? inverseZ : 0;\n\n return [\n f(pZ * f(f(f(v00 * x) + f(v10 * y)) + v30)),\n f(pZ * f(f(f(v01 * x) + f(v11 * y)) + v31)),\n ];\n }\n\n /** Applies a rotation of [degrees] around Z to `this`. */\n rotateZ(degrees: number): this {\n const r = f(degrees) * (Math.PI / 180);\n const s = Math.fround(Math.sin(r));\n const c = Math.fround(Math.cos(r));\n for (let column = 0; column < 4; column++) {\n const a0 = this.get(0, column);\n const a1 = this.get(1, column);\n this.set(0, column, f(c * a0) + f(s * a1));\n this.set(1, column, f(-s * a0) + f(c * a1));\n }\n return this;\n }\n\n /** Scales this matrix by [x], [y], [z]. */\n scale(x = 1, y = 1, z = 1): this {\n for (let column = 0; column < 4; column++) {\n this.set(0, column, this.get(0, column) * f(x));\n this.set(1, column, this.get(1, column) * f(y));\n this.set(2, column, this.get(2, column) * f(z));\n }\n return this;\n }\n}\n","// Minimal path model standing in for Compose's `Path` in the ShapeUtil/MaterialShapes ports: an\n// ordered command list (absolute coordinates) that serializes to an SVG `d` attribute.\nimport type { Matrix } from './matrix.js';\n\nexport type PathCommand =\n | readonly ['M', number, number]\n | readonly ['L', number, number]\n | readonly ['C', number, number, number, number, number, number]\n | readonly ['Z'];\n\nconst mapPoints = (\n command: PathCommand,\n f: (x: number, y: number) => readonly [number, number],\n): PathCommand => {\n switch (command[0]) {\n case 'M':\n case 'L':\n return [command[0], ...f(command[1], command[2])];\n case 'C':\n return [\n 'C',\n ...f(command[1], command[2]),\n ...f(command[3], command[4]),\n ...f(command[5], command[6]),\n ];\n case 'Z':\n return command;\n }\n};\n\n/** Compose `Path.transform(matrix)`: maps every point. */\nexport const transformPath = (path: readonly PathCommand[], matrix: Matrix): PathCommand[] =>\n path.map((command) => mapPoints(command, (x, y) => matrix.map(x, y)));\n\n/** Compose `Path.translate(offset)`. */\nexport const translatePath = (\n path: readonly PathCommand[],\n dx: number,\n dy: number,\n): PathCommand[] => path.map((command) => mapPoints(command, (x, y) => [x + dx, y + dy]));\n\n/**\n * Compose `Path.getBounds()`: `[left, top, right, bottom]` over every point, control points\n * included (Skia's `SkPath::getBounds`). Empty paths give `[0, 0, 0, 0]`.\n */\nexport function pathBounds(path: readonly PathCommand[]): [number, number, number, number] {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const command of path) {\n for (let i = 1; i + 1 < command.length; i += 2) {\n const x = command[i] as number;\n const y = command[i + 1] as number;\n left = Math.min(left, x);\n top = Math.min(top, y);\n right = Math.max(right, x);\n bottom = Math.max(bottom, y);\n }\n }\n return left === Infinity ? [0, 0, 0, 0] : [left, top, right, bottom];\n}\n\nconst formatNumber = (value: number, fractionDigits: number): string => {\n const fixed = value.toFixed(fractionDigits);\n const text = fixed.includes('.') ? fixed.replace(/\\.?0+$/, '') : fixed;\n return text === '-0' ? '0' : text;\n};\n\n/**\n * Serializes a path to an SVG `d` attribute with absolute commands. [fractionDigits] bounds the\n * decimals per number (trailing zeros dropped).\n */\nexport function toSvgPathData(path: readonly PathCommand[], fractionDigits = 4): string {\n return path\n .map(([verb, ...values]) =>\n values.length === 0\n ? verb\n : `${verb}${values.map((v) => formatNumber(v, fractionDigits)).join(' ')}`,\n )\n .join('');\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/ShapeUtil.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n\nimport type { Cubic } from './graphics-shapes/cubic.js';\nimport type { Morph } from './graphics-shapes/morph.js';\nimport type { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, transformPath } from './path.js';\n\n/** Transforms a [RoundedPolygon] with the given [Matrix]. */\nexport const transformedByMatrix = (polygon: RoundedPolygon, matrix: Matrix): RoundedPolygon =>\n polygon.transformed((x, y) => matrix.map(x, y));\n\nexport interface PathOptions {\n /**\n * Angle in degrees the path starts drawing from. Note that, as in Compose, the path is rotated\n * around the origin; the pivot only measures the angle of the first anchor.\n */\n startAngle?: number;\n /** Draws the outline twice (for stroke animations). */\n repeatPath?: boolean;\n /** Closes the path. */\n closePath?: boolean;\n}\n\n// Defaults follow the public wrappers in MaterialShapes.kt (`startAngle = 0`: start at 3 o'clock);\n// the internal ShapeUtil functions default to 270 (12 o'clock).\n\n/** Path for a [RoundedPolygon]; the start angle is measured around its center. */\nexport function polygonToPath(polygon: RoundedPolygon, options: PathOptions = {}): PathCommand[] {\n const { startAngle = 0, repeatPath = false, closePath = true } = options;\n return pathFromCubics(\n startAngle,\n repeatPath,\n closePath,\n polygon.cubics,\n polygon.centerX,\n polygon.centerY,\n );\n}\n\nexport interface MorphPathOptions extends PathOptions {\n rotationPivotX?: number;\n rotationPivotY?: number;\n}\n\n/** Path for a [Morph] at [progress]; the start angle is measured around the rotation pivot. */\nexport function morphToPath(\n morph: Morph,\n progress: number,\n options: MorphPathOptions = {},\n): PathCommand[] {\n const {\n startAngle = 0,\n repeatPath = false,\n closePath = true,\n rotationPivotX = 0,\n rotationPivotY = 0,\n } = options;\n return pathFromCubics(\n startAngle,\n repeatPath,\n closePath,\n morph.asCubics(progress),\n rotationPivotX,\n rotationPivotY,\n );\n}\n\nfunction pathFromCubics(\n startAngle: number,\n repeatPath: boolean,\n closePath: boolean,\n cubics: readonly Cubic[],\n rotationPivotX: number,\n rotationPivotY: number,\n): PathCommand[] {\n const path: PathCommand[] = [];\n const first = cubics[0];\n if (first !== undefined) path.push(['M', first.anchor0X, first.anchor0Y]);\n const addCubics = () => {\n for (const it of cubics) {\n path.push([\n 'C',\n it.control0X,\n it.control0Y,\n it.control1X,\n it.control1Y,\n it.anchor1X,\n it.anchor1Y,\n ]);\n }\n };\n addCubics();\n if (repeatPath && first !== undefined) {\n path.push(['L', first.anchor0X, first.anchor0Y]);\n addCubics();\n }\n\n if (closePath) path.push(['Z']);\n\n if (startAngle !== 0 && first !== undefined) {\n const f = Math.fround;\n const angleToFirstCubic = radiansToDegrees(\n f(Math.atan2(f(first.anchor0Y - rotationPivotY), f(first.anchor0X - rotationPivotX))),\n );\n // Rotate the Path to to start from the given angle.\n return transformPath(path, new Matrix().rotateZ(f(-angleToFirstCubic + startAngle)));\n }\n return path;\n}\n\nconst radiansToDegrees = (radians: number): number => Math.fround((radians * 180) / Math.PI);\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MaterialShapes.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Float32-faithful like the graphics-shapes port (see graphics-shapes/utils.ts): Kotlin float\n// literals and every Float operation go through `f` (Math.fround).\n\nimport { CornerRounding } from './graphics-shapes/corner-rounding.js';\nimport { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { circle, rectangle, star } from './graphics-shapes/shapes.js';\nimport { FloatPi, f } from './graphics-shapes/utils.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, pathBounds, transformPath, translatePath } from './path.js';\nimport { polygonToPath, transformedByMatrix } from './shape-util.js';\n\n/**\n * The outline Compose's `RoundedPolygon.toShape(startAngle).createOutline(size, …)` produces: the\n * path scaled to [width] x [height], then centered by its control-point bounds.\n */\nexport function toShapeOutline(\n polygon: RoundedPolygon,\n width: number,\n height: number,\n startAngle = 0,\n): PathCommand[] {\n const shapePath = polygonToPath(polygon, { startAngle });\n // Scale and translate the path to align its center with the available size center.\n const path = transformPath(shapePath, new Matrix().scale(width, height));\n const [left, top, right, bottom] = pathBounds(path);\n return translatePath(path, width / 2 - (left + right) / 2, height / 2 - (top + bottom) / 2);\n}\n\n// Cache various roundings for use below\nconst cornerRound15 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.15));\nconst cornerRound20 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.2));\nconst cornerRound30 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.3));\nconst cornerRound50 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.5));\nconst cornerRound100 = /* @__PURE__ */ new CornerRounding(1);\n\n// A function call, so the module constants below can carry a `@__PURE__` annotation (an\n// annotated `new Matrix().rotateZ(…)` chain is ambiguous to bundlers).\nconst rotationZ = (degrees: number): Matrix => new Matrix().rotateZ(degrees);\n\nconst rotateNeg45 = /* @__PURE__ */ rotationZ(-45);\nconst rotateNeg90 = /* @__PURE__ */ rotationZ(-90);\nconst rotateNeg135 = /* @__PURE__ */ rotationZ(-135);\n\ninterface PointNRound {\n readonly x: number;\n readonly y: number;\n readonly r: CornerRounding;\n}\n\n/** `PointNRound(Offset(x, y), r)` with Kotlin float literals. */\nconst pnr = (x: number, y: number, r: CornerRounding = CornerRounding.Unrounded): PointNRound => ({\n x: f(x),\n y: f(y),\n r,\n});\n\n/** `CornerRounding(radius, smoothing)` with Kotlin float literals. */\nconst cr = (radius: number, smoothing = 0): CornerRounding => new CornerRounding(radius, smoothing);\n\nconst toRadians = (degrees: number): number => f(f(f(degrees / 360) * 2) * FloatPi);\n\nconst angleDegrees = (x: number, y: number): number => f(f(f(Math.atan2(y, x)) * 180) / FloatPi);\n\nfunction rotateDegrees(\n p: PointNRound,\n angle: number,\n centerX: number,\n centerY: number,\n): PointNRound {\n const a = toRadians(angle);\n const cos = f(Math.cos(a));\n const sin = f(Math.sin(a));\n const offX = f(p.x - centerX);\n const offY = f(p.y - centerY);\n return {\n x: f(f(f(offX * cos) - f(offY * sin)) + centerX),\n y: f(f(f(offX * sin) + f(offY * cos)) + centerY),\n r: p.r,\n };\n}\n\nfunction doRepeat(\n points: readonly PointNRound[],\n reps: number,\n centerX: number,\n centerY: number,\n mirroring: boolean,\n): PointNRound[] {\n const out: PointNRound[] = [];\n if (mirroring) {\n const angles = points.map((it) => angleDegrees(f(it.x - centerX), f(it.y - centerY)));\n const distances = points.map((it) => {\n const x = f(it.x - centerX);\n const y = f(it.y - centerY);\n return f(Math.sqrt(f(f(x * x) + f(y * y))));\n });\n const actualReps = reps * 2;\n const sectionAngle = f(360 / actualReps);\n for (let it = 0; it < actualReps; it++) {\n for (let index = 0; index < points.length; index++) {\n const i = it % 2 === 0 ? index : points.length - 1 - index;\n if (i > 0 || it % 2 === 0) {\n const angle = angles[i] ?? 0;\n const a = toRadians(\n f(\n f(sectionAngle * it) +\n (it % 2 === 0 ? angle : f(f(sectionAngle - angle) + f(2 * (angles[0] ?? 0)))),\n ),\n );\n const distance = distances[i] ?? 0;\n out.push({\n x: f(f(f(Math.cos(a)) * distance) + centerX),\n y: f(f(f(Math.sin(a)) * distance) + centerY),\n r: points[i]?.r ?? CornerRounding.Unrounded,\n });\n }\n }\n }\n } else {\n const np = points.length;\n for (let it = 0; it < np * reps; it++) {\n const p = points[it % np];\n if (p) out.push(rotateDegrees(p, f((Math.trunc(it / np) * 360) / reps), centerX, centerY));\n }\n }\n return out;\n}\n\nfunction customPolygon(\n points: readonly PointNRound[],\n reps: number,\n mirroring = false,\n): RoundedPolygon {\n // Every MaterialShapes polygon uses the default center, Offset(0.5f, 0.5f).\n const centerX = 0.5;\n const centerY = 0.5;\n const actualPoints = doRepeat(points, reps, centerX, centerY, mirroring);\n return RoundedPolygon.fromVertices(\n actualPoints.flatMap((p) => [p.x, p.y]),\n { perVertexRounding: actualPoints.map((p) => p.r), centerX, centerY },\n );\n}\n\n// The builders, in MaterialShapes.kt order.\nconst builders = {\n Circle: () => circle({ numVertices: 10 }),\n Square: () => rectangle({ width: 1, height: 1, rounding: cornerRound30 }),\n Slanted: () =>\n customPolygon([pnr(0.926, 0.97, cr(0.189, 0.811)), pnr(-0.021, 0.967, cr(0.187, 0.057))], 2),\n Arch: () =>\n transformedByMatrix(\n RoundedPolygon.fromVertexCount(4, {\n perVertexRounding: [cornerRound100, cornerRound100, cornerRound20, cornerRound20],\n }),\n rotateNeg135,\n ),\n Fan: () =>\n customPolygon(\n [\n pnr(1.004, 1.0, cr(0.148, 0.417)),\n pnr(0.0, 1.0, cr(0.151)),\n pnr(0.0, -0.003, cr(0.148)),\n pnr(0.978, 0.02, cr(0.803)),\n ],\n 1,\n ),\n Arrow: () =>\n customPolygon(\n [\n pnr(0.5, 0.892, cr(0.313)),\n pnr(-0.216, 1.05, cr(0.207)),\n pnr(0.499, -0.16, cr(0.215, 1.0)),\n pnr(1.225, 1.06, cr(0.211)),\n ],\n 1,\n ),\n SemiCircle: () =>\n rectangle({\n width: f(1.6),\n height: 1,\n perVertexRounding: [cornerRound20, cornerRound20, cornerRound100, cornerRound100],\n }),\n Oval: () =>\n transformedByMatrix(transformedByMatrix(circle(), new Matrix().scale(1, f(0.64))), rotateNeg45),\n Pill: () =>\n customPolygon(\n [pnr(0.961, 0.039, cr(0.426)), pnr(1.001, 0.428), pnr(1.0, 0.609, cr(1.0))],\n 2,\n true,\n ),\n Triangle: () =>\n transformedByMatrix(\n RoundedPolygon.fromVertexCount(3, { rounding: cornerRound20 }),\n rotateNeg90,\n ),\n Diamond: () => customPolygon([pnr(0.5, 1.096, cr(0.151, 0.524)), pnr(0.04, 0.5, cr(0.159))], 2),\n ClamShell: () =>\n customPolygon(\n [pnr(0.171, 0.841, cr(0.159)), pnr(-0.02, 0.5, cr(0.14)), pnr(0.17, 0.159, cr(0.159))],\n 2,\n ),\n Pentagon: () =>\n customPolygon(\n [pnr(0.5, -0.009, cr(0.172)), pnr(1.03, 0.365, cr(0.164)), pnr(0.828, 0.97, cr(0.169))],\n 1,\n true,\n ),\n Gem: () =>\n customPolygon(\n [\n pnr(0.499, 1.023, cr(0.241, 0.778)),\n pnr(-0.005, 0.792, cr(0.208)),\n pnr(0.073, 0.258, cr(0.228)),\n pnr(0.433, -0.0, cr(0.491)),\n ],\n 1,\n true,\n ),\n Sunny: () => star(8, { innerRadius: f(0.8), rounding: cornerRound15 }),\n VerySunny: () => customPolygon([pnr(0.5, 1.08, cr(0.085)), pnr(0.358, 0.843, cr(0.085))], 8),\n Cookie4Sided: () => customPolygon([pnr(1.237, 1.236, cr(0.258)), pnr(0.5, 0.918, cr(0.233))], 4),\n // 6-point cookie\n Cookie6Sided: () => customPolygon([pnr(0.723, 0.884, cr(0.394)), pnr(0.5, 1.099, cr(0.398))], 6),\n // 7-point cookie\n Cookie7Sided: () =>\n transformedByMatrix(star(7, { innerRadius: f(0.75), rounding: cornerRound50 }), rotateNeg90),\n Cookie9Sided: () =>\n transformedByMatrix(star(9, { innerRadius: f(0.8), rounding: cornerRound50 }), rotateNeg90),\n Cookie12Sided: () =>\n transformedByMatrix(star(12, { innerRadius: f(0.8), rounding: cornerRound50 }), rotateNeg90),\n Ghostish: () =>\n customPolygon(\n [\n pnr(0.5, 0, cr(1.0)),\n pnr(1, 0, cr(1.0)),\n pnr(1, 1.14, cr(0.254, 0.106)),\n pnr(0.575, 0.906, cr(0.253)),\n ],\n 1,\n true,\n ),\n Clover4Leaf: () => customPolygon([pnr(0.5, 0.074), pnr(0.725, -0.099, cr(0.476))], 4, true),\n Clover8Leaf: () => customPolygon([pnr(0.5, 0.036), pnr(0.758, -0.101, cr(0.209))], 8),\n Burst: () => customPolygon([pnr(0.5, -0.006, cr(0.006)), pnr(0.592, 0.158, cr(0.006))], 12),\n SoftBurst: () => customPolygon([pnr(0.193, 0.277, cr(0.053)), pnr(0.176, 0.055, cr(0.053))], 10),\n Boom: () => customPolygon([pnr(0.457, 0.296, cr(0.007)), pnr(0.5, -0.051, cr(0.007))], 15),\n SoftBoom: () =>\n customPolygon(\n [\n pnr(0.733, 0.454),\n pnr(0.839, 0.437, cr(0.532)),\n pnr(0.949, 0.449, cr(0.439, 1.0)),\n pnr(0.998, 0.478, cr(0.174)),\n ],\n 16,\n true,\n ),\n Flower: () =>\n customPolygon(\n [pnr(0.37, 0.187), pnr(0.416, 0.049, cr(0.381)), pnr(0.479, 0.001, cr(0.095))],\n 8,\n true,\n ),\n Puffy: () =>\n transformedByMatrix(\n customPolygon(\n [\n pnr(0.5, 0.053),\n pnr(0.545, -0.04, cr(0.405)),\n pnr(0.67, -0.035, cr(0.426)),\n pnr(0.717, 0.066, cr(0.574)),\n pnr(0.722, 0.128),\n pnr(0.777, 0.002, cr(0.36)),\n pnr(0.914, 0.149, cr(0.66)),\n pnr(0.926, 0.289, cr(0.66)),\n pnr(0.881, 0.346),\n pnr(0.94, 0.344, cr(0.126)),\n pnr(1.003, 0.437, cr(0.255)),\n ],\n 2,\n true,\n ),\n new Matrix().scale(1, f(0.742)),\n ),\n PuffyDiamond: () =>\n customPolygon(\n [pnr(0.87, 0.13, cr(0.146)), pnr(0.818, 0.357), pnr(1.0, 0.332, cr(0.853))],\n 4,\n true,\n ),\n PixelCircle: () =>\n customPolygon(\n [\n pnr(0.5, 0.0),\n pnr(0.704, 0.0),\n pnr(0.704, 0.065),\n pnr(0.843, 0.065),\n pnr(0.843, 0.148),\n pnr(0.926, 0.148),\n pnr(0.926, 0.296),\n pnr(1.0, 0.296),\n ],\n 2,\n true,\n ),\n PixelTriangle: () =>\n customPolygon(\n [\n pnr(0.11, 0.5),\n pnr(0.113, 0.0),\n pnr(0.287, 0.0),\n pnr(0.287, 0.087),\n pnr(0.421, 0.087),\n pnr(0.421, 0.17),\n pnr(0.56, 0.17),\n pnr(0.56, 0.265),\n pnr(0.674, 0.265),\n pnr(0.675, 0.344),\n pnr(0.789, 0.344),\n pnr(0.789, 0.439),\n pnr(0.888, 0.439),\n ],\n 1,\n true,\n ),\n Bun: () =>\n customPolygon(\n [pnr(0.796, 0.5), pnr(0.853, 0.518, cr(1)), pnr(0.992, 0.631, cr(1)), pnr(0.968, 1.0, cr(1))],\n 2,\n true,\n ),\n Heart: () =>\n customPolygon(\n [\n pnr(0.5, 0.268, cr(0.016)),\n pnr(0.792, -0.066, cr(0.958)),\n pnr(1.064, 0.276, cr(1.0)),\n pnr(0.501, 0.946, cr(0.129)),\n ],\n 1,\n true,\n ),\n} satisfies Record<string, () => RoundedPolygon>;\n\nexport type MaterialShapeName = keyof typeof builders;\n\n/** The 35 Material shape names, in MaterialShapes.kt order. */\nexport const materialShapeNames = /* @__PURE__ */ Object.keys(builders) as MaterialShapeName[];\n\nconst cache = new Map<MaterialShapeName, RoundedPolygon>();\n\n/**\n * A predefined Material shape as a normalized [RoundedPolygon] (fits the unit square), created on\n * first use and cached, like the `MaterialShapes.<Name>` getters.\n */\nexport function materialShape(name: MaterialShapeName): RoundedPolygon {\n let polygon = cache.get(name);\n if (polygon === undefined) {\n polygon = builders[name]().normalized();\n cache.set(name, polygon);\n }\n return polygon;\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/LoadingIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The geometry of Compose's LoadingIndicator, float32-faithful: the default polygon lists\n// (LoadingIndicatorDefaults), morphSequence, calculateScaleFactor, processPath, and the\n// determinate draw step of LoadingIndicatorImpl. Timing (the indeterminate morph spring and the\n// global rotation) is in @kyralabs/m3e-motion; its values are generated tokens.\n\nimport { Morph } from './graphics-shapes/morph.js';\nimport type { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { f } from './graphics-shapes/utils.js';\nimport { type MaterialShapeName, materialShape } from './material-shapes.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, pathBounds, toSvgPathData, transformPath } from './path.js';\nimport { morphToPath, transformedByMatrix } from './shape-util.js';\n\nconst INDETERMINATE: readonly MaterialShapeName[] = [\n 'SoftBurst',\n 'Cookie9Sided',\n 'Pentagon',\n 'Pill',\n 'Sunny',\n 'Cookie4Sided',\n 'Oval',\n];\n\n/**\n * `LoadingIndicatorDefaults.IndeterminateIndicatorPolygons`: the seven shapes the indeterminate\n * indicator morphs between, in order.\n */\nexport const indeterminateIndicatorPolygons = (): RoundedPolygon[] =>\n INDETERMINATE.map(materialShape);\n\n/**\n * `LoadingIndicatorDefaults.DeterminateIndicatorPolygons`: a circle rotated by 360° / 20 (for a\n * smoother morph into the soft burst, which is rotated by the same angle) and the soft burst.\n */\nexport const determinateIndicatorPolygons = (): RoundedPolygon[] => [\n transformedByMatrix(materialShape('Circle'), new Matrix().rotateZ(f(360 / 20))),\n materialShape('SoftBurst'),\n];\n\n/**\n * A morph between each consecutive pair of polygons (each normalized) and, when\n * [circularSequence], a final morph from the last back to the first.\n */\nexport function morphSequence(\n polygons: readonly RoundedPolygon[],\n circularSequence: boolean,\n): Morph[] {\n const morphs: Morph[] = [];\n for (let i = 0; i < polygons.length; i++) {\n if (i + 1 < polygons.length) {\n morphs.push(new Morph(polygons[i]!.normalized(), polygons[i + 1]!.normalized()));\n } else if (circularSequence) {\n // Create a morph from the last shape to the first shape\n morphs.push(new Morph(polygons[i]!.normalized(), polygons[0]!.normalized()));\n }\n }\n return morphs;\n}\n\n/**\n * The scale factor that keeps every polygon inside its box while it rotates: the smallest\n * bounds-to-max-bounds ratio (using the larger of the x and y ratios, for pill-like shapes).\n */\nexport function calculateScaleFactor(polygons: readonly RoundedPolygon[]): number {\n let scaleFactor = 1;\n const bounds = [0, 0, 0, 0];\n const maxBounds = [0, 0, 0, 0];\n for (const polygon of polygons) {\n polygon.calculateBounds(bounds);\n polygon.calculateMaxBounds(maxBounds);\n const scaleX = f(f(bounds[2]! - bounds[0]!) / f(maxBounds[2]! - maxBounds[0]!));\n const scaleY = f(f(bounds[3]! - bounds[1]!) / f(maxBounds[3]! - maxBounds[1]!));\n // We use max(scaleX, scaleY) to handle cases like a pill-shape that can throw off the\n // entire calculation.\n scaleFactor = Math.min(scaleFactor, Math.max(scaleX, scaleY));\n }\n return scaleFactor;\n}\n\n/**\n * Scales a normalized path by `size × scaleFactor` and centers it (by its control-point bounds)\n * in a `width` x `height` box.\n */\nexport function processPath(\n path: readonly PathCommand[],\n width: number,\n height: number,\n scaleFactor: number,\n): PathCommand[] {\n // Scale to the desired size.\n const scaled = transformPath(\n path,\n new Matrix().scale(f(width * scaleFactor), f(height * scaleFactor)),\n );\n // Translate the path to align its center with the available size center.\n const [left, top, right, bottom] = pathBounds(scaled);\n const dx = f(f(width / 2) - f(left + f(f(right - left) / 2)));\n const dy = f(f(height / 2) - f(top + f(f(bottom - top) / 2)));\n return scaled.map((command): PathCommand => {\n switch (command[0]) {\n case 'M':\n case 'L':\n return [command[0], f(command[1] + dx), f(command[2] + dy)];\n case 'C':\n return [\n 'C',\n f(command[1] + dx),\n f(command[2] + dy),\n f(command[3] + dx),\n f(command[4] + dy),\n f(command[5] + dx),\n f(command[6] + dy),\n ];\n case 'Z':\n return command;\n }\n });\n}\n\n/** What the indicator draws in one frame: a morph at a progress, rotated about the center. */\nexport interface LoadingIndicatorFrame {\n morphIndex: number;\n morphProgress: number;\n /** Degrees, clockwise. */\n rotation: number;\n}\n\n/**\n * The determinate draw step: picks the active morph for [progress] (coerced to 0..1), its local\n * progress, and rotates counterclockwise by half a turn over the whole range.\n */\nexport function determinateFrame(progress: number, morphCount: number): LoadingIndicatorFrame {\n const value = Number.isNaN(progress) ? 0 : Math.min(Math.max(f(progress), 0), 1);\n const scaled = f(morphCount * value);\n // Adjust the active morph index according to the progress.\n const morphIndex = Math.min(Math.trunc(scaled), morphCount - 1);\n // Prevents a zero when the progress is one and we are at the last shape morph.\n const morphProgress = value === 1 && morphIndex === morphCount - 1 ? 1 : scaled % 1;\n // Rotate counterclockwise.\n return { morphIndex, morphProgress, rotation: f(-value * 180) };\n}\n\n/**\n * A loading indicator's shapes, prepared once: the morph sequence and the scale factor\n * (`calculateScaleFactor × activeIndicatorScale`, where the active indicator scale is the token\n * ratio `ActiveSize / min(ContainerWidth, ContainerHeight)`).\n */\nexport class LoadingIndicatorShapes {\n readonly morphs: readonly Morph[];\n readonly scaleFactor: number;\n\n constructor(\n polygons: readonly RoundedPolygon[],\n circularSequence: boolean,\n activeIndicatorScale: number,\n ) {\n if (polygons.length < 2) {\n throw new Error('indicatorPolygons should have, at least, two RoundedPolygons');\n }\n this.morphs = morphSequence(polygons, circularSequence);\n this.scaleFactor = f(calculateScaleFactor(polygons) * f(activeIndicatorScale));\n }\n\n /** The processed path of morph [morphIndex] at [progress] in a [size]-sided square. */\n path(morphIndex: number, progress: number, size: number): PathCommand[] {\n const morph = this.morphs[morphIndex]!;\n return processPath(\n morphToPath(morph, progress, { startAngle: 0 }),\n size,\n size,\n this.scaleFactor,\n );\n }\n\n /** {@link path} as an SVG `d` attribute. */\n pathData(morphIndex: number, progress: number, size: number): string {\n return toSvgPathData(this.path(morphIndex, progress, size));\n }\n}\n\nconst defaultShapes = new Map<string, LoadingIndicatorShapes>();\nconst customShapes = new WeakMap<readonly RoundedPolygon[], Map<string, LoadingIndicatorShapes>>();\n\n/**\n * {@link LoadingIndicatorShapes} for an indicator, built once per polygon list (null = the\n * Compose defaults for the kind), kind and active indicator scale. Morph construction is the\n * expensive part, so every indicator on a page shares it.\n */\nexport function loadingIndicatorShapes(\n polygons: readonly RoundedPolygon[] | null,\n indeterminate: boolean,\n activeIndicatorScale: number,\n): LoadingIndicatorShapes {\n const key = `${String(indeterminate)}:${String(activeIndicatorScale)}`;\n let cache = defaultShapes;\n if (polygons) {\n cache = customShapes.get(polygons) ?? new Map<string, LoadingIndicatorShapes>();\n customShapes.set(polygons, cache);\n }\n let shapes = cache.get(key);\n if (!shapes) {\n const list =\n polygons ??\n (indeterminate ? indeterminateIndicatorPolygons() : determinateIndicatorPolygons());\n shapes = new LoadingIndicatorShapes(list, indeterminate, activeIndicatorScale);\n cache.set(key, shapes);\n }\n return shapes;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphics-shapes/corner-rounding.ts","../src/graphics-shapes/point.ts","../src/graphics-shapes/utils.ts","../src/graphics-shapes/cubic.ts","../src/graphics-shapes/features.ts","../src/graphics-shapes/float-mapping.ts","../src/graphics-shapes/feature-mapping.ts","../src/graphics-shapes/polygon-measure.ts","../src/graphics-shapes/morph.ts","../src/graphics-shapes/rounded-polygon.ts","../src/graphics-shapes/shapes.ts","../src/matrix.ts","../src/path.ts","../src/shape-util.ts","../src/material-shapes.ts","../src/loading-indicator.ts","../src/path-measure.ts","../src/progress-indicator.ts"],"names":["f","clockwise","f2","command","angle","distance","cache","processPath"],"mappings":";AA0CO,IAAM,cAAA,GAAN,MAAM,eAAA,CAAe;AAAA;AAAA,EAE1B,OAAgB,SAAA,mBAA4B,IAAI,eAAA,EAAe;AAAA,EAEtD,MAAA;AAAA,EACA,SAAA;AAAA;AAAA,EAGT,WAAA,CAAY,MAAA,GAAS,CAAA,EAAG,SAAA,GAAY,CAAA,EAAG;AACrC,IAAA,IAAA,CAAK,MAAA,GAAS,IAAA,CAAK,MAAA,CAAO,MAAM,CAAA;AAChC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAA,CAAK,MAAA,CAAO,SAAS,CAAA;AAAA,EACxC;AACF;;;AClC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AM,MAAA,IAAU,CAAC,CAAA;AAC3F","file":"index.js","sourcesContent":["/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/CornerRounding.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\n/**\n * CornerRounding defines the amount and quality around a given vertex of a shape. [radius] defines\n * the radius of the circle which forms the basis of the rounding for the vertex. [smoothing]\n * defines the amount by which the curve is extended from the circular arc around the corner to the\n * edge between vertices.\n *\n * Each corner of a shape can be thought of as either:\n * - unrounded (with a corner radius of 0 and no smoothing)\n * - rounded with only a circular arc (with smoothing of 0). In this case, the rounding around\n * the corner follows an approximated circular arc between the edges to adjacent vertices.\n * - rounded with three curves: There is an inner circular arc and two symmetric flanking curves.\n * The flanking curves determine the curvature from the inner curve to the edges, with a value of\n * 0 (no smoothing) meaning that it is purely a circular curve and a value of 1 meaning that the\n * flanking curves are maximized between the inner curve and the edges.\n *\n * @param radius a value of 0 or greater, representing the radius of the circle which defines the\n * inner rounding arc of the corner. A value of 0 indicates that the corner is sharp, or\n * completely unrounded. A positive value is the requested size of the radius. Note that this\n * radius is an absolute size that should relate to the overall size of its shape.\n * @param smoothing the amount by which the arc is \"smoothed\" by extending the curve from the inner\n * circular arc to the edge between vertices. A value of 0 (no smoothing) indicates that the\n * corner is rounded by only a circular arc; there are no flanking curves. A value of 1 indicates\n * that there is no circular arc in the center; the flanking curves on either side meet at the\n * middle.\n */\nexport class CornerRounding {\n /** [Unrounded] has a rounding radius of zero, producing a sharp corner at a vertex. */\n static readonly Unrounded = /* @__PURE__ */ new CornerRounding();\n\n readonly radius: number;\n readonly smoothing: number;\n\n /** Both values are Kotlin `Float`s (rounded to float32). */\n constructor(radius = 0, smoothing = 0) {\n this.radius = Math.fround(radius);\n this.smoothing = Math.fround(smoothing);\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Point.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Kotlin models a point as a FloatFloatPair with extension functions; here it is an immutable\n// `{ x, y }` with free functions of the same names. Coordinates are float32 (see utils.ts).\n\nconst f = Math.fround;\n\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport const point = (x: number, y: number): Point => ({ x: f(x), y: f(y) });\n\n/**\n * The magnitude of the Point, which is the distance of this point from (0, 0).\n *\n * If you need this value to compare it to another [Point]'s distance, consider using\n * [getDistanceSquared] instead, since it is cheaper to compute.\n */\nexport const getDistance = (p: Point): number => f(Math.sqrt(getDistanceSquared(p)));\n\n/** The square of the magnitude of the Point. This is cheaper than computing [getDistance]. */\nexport const getDistanceSquared = (p: Point): number => f(f(p.x * p.x) + f(p.y * p.y));\n\nexport const dotProduct = (p: Point, other: Point): number =>\n f(f(p.x * other.x) + f(p.y * other.y));\n\nexport const dotProductXY = (p: Point, otherX: number, otherY: number): number =>\n f(f(p.x * otherX) + f(p.y * otherY));\n\n/**\n * Compute the Z coordinate of the cross product of two vectors, to check if the second vector is\n * going clockwise ( > 0 ) or counterclockwise (< 0) compared with the first one. It could also be\n * 0, if the vectors are co-linear.\n */\nexport const clockwise = (p: Point, other: Point): boolean =>\n f(f(p.x * other.y) - f(p.y * other.x)) > 0;\n\n/** Returns unit vector representing the direction to this point from (0, 0) */\nexport function getDirection(p: Point): Point {\n const d = getDistance(p);\n if (!(d > 0)) throw new Error(\"Can't get the direction of a 0-length vector\");\n return div(p, d);\n}\n\n/** Unary negation: the same arrow pointing in the reverse direction. */\nexport const unaryMinus = (p: Point): Point => point(-p.x, -p.y);\n\nexport const minus = (p: Point, other: Point): Point => point(p.x - other.x, p.y - other.y);\n\nexport const plus = (p: Point, other: Point): Point => point(p.x + other.x, p.y + other.y);\n\nexport const times = (p: Point, operand: number): Point => point(p.x * operand, p.y * operand);\n\nexport const div = (p: Point, operand: number): Point => point(p.x / operand, p.y / operand);\n\nexport const rem = (p: Point, operand: number): Point => point(p.x % operand, p.y % operand);\n\n/** Linearly interpolate between two Points. */\nexport const interpolatePoint = (start: Point, stop: Point, fraction: number): Point =>\n point(\n f(f(f(1 - fraction) * start.x) + f(fraction * stop.x)),\n f(f(f(1 - fraction) * start.y) + f(fraction * stop.y)),\n );\n\n/** Interface for a function that can transform (rotate/scale/translate/etc.) points. */\nexport type PointTransformer = (x: number, y: number) => readonly [number, number];\n\nexport function transformed(p: Point, f: PointTransformer): Point {\n const [x, y] = f(p.x, p.y);\n return point(x, y);\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Utils.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Float32-faithful: Kotlin does this math in `Float`, so every operation is rounded with\n// `fround` (exact for + - * / and sqrt; `kotlin.math` trig is the double result rounded to\n// float). Symmetric shapes produce near-ties in Morph's corner matching that only the same\n// rounding resolves the way Compose does.\n\nimport { type Point, point, plus, times } from './point.js';\n\n/** Kotlin `Float` rounding. */\nexport const f = Math.fround;\n\n/** Kotlin `Float.MIN_VALUE`: the smallest *positive* float32 (not the most negative). */\nexport const FLOAT_MIN_VALUE = 1.401298464324817e-45;\n/** Kotlin `Float.MAX_VALUE`. */\nexport const FLOAT_MAX_VALUE = 3.4028234663852886e38;\n\n/** This class has all internal methods, used by Polygon, Morph, etc. */\nexport const distance = (x: number, y: number): number => f(Math.sqrt(f(f(x * x) + f(y * y))));\n\nexport const distanceSquared = (x: number, y: number): number => f(f(x * x) + f(y * y));\n\n/** Returns unit vector representing the direction to this point from (0, 0) */\nexport function directionVector(x: number, y: number): Point {\n const d = distance(x, y);\n if (!(d > 0)) throw new Error('Required distance greater than zero');\n return point(f(x / d), f(y / d));\n}\n\nexport const directionVectorFromAngle = (angleRadians: number): Point =>\n point(f(Math.cos(angleRadians)), f(Math.sin(angleRadians)));\n\n/**\n * These epsilon values are used internally to determine when two points are the same, within some\n * reasonable roundoff error. The distance epsilon is smaller, with the intention that the roundoff\n * should not be larger than a pixel on any reasonable sized display.\n */\nexport const DistanceEpsilon = /* @__PURE__ */ f(1e-4);\nexport const AngleEpsilon = /* @__PURE__ */ f(1e-6);\n\nexport const Zero: Point = /* @__PURE__ */ point(0, 0);\nexport const FloatPi = /* @__PURE__ */ f(Math.PI);\nexport const TwoPi = /* @__PURE__ */ f(2 * FloatPi);\n\nexport const angle = (x: number, y: number): number => f(f(f(Math.atan2(y, x)) + TwoPi) % TwoPi);\n\nexport const radialToCartesian = (\n radius: number,\n angleRadians: number,\n center: Point = Zero,\n): Point => plus(times(directionVectorFromAngle(angleRadians), radius), center);\n\nexport const rotate90 = (p: Point): Point => point(-p.y, p.x);\n\nexport const square = (x: number): number => f(x * x);\n\n/** Linearly interpolate between [start] and [stop] with [fraction] fraction between them. */\nexport const interpolate = (start: number, stop: number, fraction: number): number =>\n f(f(f(1 - fraction) * start) + f(fraction * stop));\n\nexport const positiveModulo = (num: number, mod: number): number => f(f(f(num % mod) + mod) % mod);\n\n/**\n * Does a ternary search in [v0..v1] to find the parameter that minimizes the given function.\n * Stops when the search space size is reduced below the given tolerance.\n */\nexport function findMinimum(\n v0: number,\n v1: number,\n tolerance: number,\n fn: (value: number) => number,\n): number {\n let a = v0;\n let b = v1;\n while (f(b - a) > tolerance) {\n const c1 = f(f(f(2 * a) + b) / 3);\n const c2 = f(f(f(2 * b) + a) / 3);\n if (fn(c1) < fn(c2)) {\n b = c2;\n } else {\n a = c1;\n }\n }\n return f(f(a + b) / 2);\n}\n\n/** Kotlin's default `findMinimum` tolerance. */\nexport const FIND_MINIMUM_TOLERANCE = /* @__PURE__ */ f(1e-3);\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Cubic.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { type Point, type PointTransformer, dotProduct, dotProductXY, point } from './point.js';\nimport { DistanceEpsilon, directionVector, distance, f, interpolate, rotate90 } from './utils.js';\n\nconst inUnitRange = (t: number) => t >= 0 && t <= 1;\n\n/**\n * This class holds the anchor and control point data for a single cubic Bézier curve, with anchor\n * points ([anchor0X], [anchor0Y]) and ([anchor1X], [anchor1Y]) at either end and control points\n * ([control0X], [control0Y]) and ([control1X], [control1Y]) determining the slope of the curve\n * between the anchor points.\n */\nexport class Cubic {\n /** Kotlin `FloatArray`: values are stored as float32. */\n readonly points: Float32Array;\n\n constructor(points: ArrayLike<number> = new Float32Array(8)) {\n if (points.length !== 8) throw new Error('Points array size should be 8');\n this.points = Float32Array.from(points);\n }\n\n /** Creates a Cubic from its eight coordinates (the top-level Kotlin `Cubic(...)` factory). */\n static of(\n anchor0X: number,\n anchor0Y: number,\n control0X: number,\n control0Y: number,\n control1X: number,\n control1Y: number,\n anchor1X: number,\n anchor1Y: number,\n ): Cubic {\n return new Cubic([\n anchor0X,\n anchor0Y,\n control0X,\n control0Y,\n control1X,\n control1Y,\n anchor1X,\n anchor1Y,\n ]);\n }\n\n static fromPoints(anchor0: Point, control0: Point, control1: Point, anchor1: Point): Cubic {\n return Cubic.of(\n anchor0.x,\n anchor0.y,\n control0.x,\n control0.y,\n control1.x,\n control1.y,\n anchor1.x,\n anchor1.y,\n );\n }\n\n get anchor0X(): number {\n return this.points[0]!;\n }\n get anchor0Y(): number {\n return this.points[1]!;\n }\n get control0X(): number {\n return this.points[2]!;\n }\n get control0Y(): number {\n return this.points[3]!;\n }\n get control1X(): number {\n return this.points[4]!;\n }\n get control1Y(): number {\n return this.points[5]!;\n }\n get anchor1X(): number {\n return this.points[6]!;\n }\n get anchor1Y(): number {\n return this.points[7]!;\n }\n\n pointOnCurve(t: number): Point {\n const u = f(1 - t);\n const w0 = f(f(u * u) * u);\n const w1 = f(f(f(3 * t) * u) * u);\n const w2 = f(f(f(3 * t) * t) * u);\n const w3 = f(f(t * t) * t);\n return point(\n f(\n f(f(f(this.anchor0X * w0) + f(this.control0X * w1)) + f(this.control1X * w2)) +\n f(this.anchor1X * w3),\n ),\n f(\n f(f(f(this.anchor0Y * w0) + f(this.control0Y * w1)) + f(this.control1Y * w2)) +\n f(this.anchor1Y * w3),\n ),\n );\n }\n\n zeroLength(): boolean {\n return (\n Math.abs(f(this.anchor0X - this.anchor1X)) < DistanceEpsilon &&\n Math.abs(f(this.anchor0Y - this.anchor1Y)) < DistanceEpsilon\n );\n }\n\n /**\n * Fills [bounds] with `[minX, minY, maxX, maxY]`. With [approximate], the bounding box of all\n * anchors and controls; otherwise the exact extrema (solving the derivative quadratic).\n */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = false): void {\n // A curve might be of zero-length, with both anchors co-lated.\n // Just return the point itself.\n if (this.zeroLength()) {\n bounds[0] = this.anchor0X;\n bounds[1] = this.anchor0Y;\n bounds[2] = this.anchor0X;\n bounds[3] = this.anchor0Y;\n return;\n }\n\n let minX = Math.min(this.anchor0X, this.anchor1X);\n let minY = Math.min(this.anchor0Y, this.anchor1Y);\n let maxX = Math.max(this.anchor0X, this.anchor1X);\n let maxY = Math.max(this.anchor0Y, this.anchor1Y);\n\n if (approximate) {\n // Approximate bounds use the bounding box of all anchors and controls\n bounds[0] = Math.min(minX, Math.min(this.control0X, this.control1X));\n bounds[1] = Math.min(minY, Math.min(this.control0Y, this.control1Y));\n bounds[2] = Math.max(maxX, Math.max(this.control0X, this.control1X));\n bounds[3] = Math.max(maxY, Math.max(this.control0Y, this.control1Y));\n return;\n }\n\n const zeroIsh = (value: number) => Math.abs(value) < DistanceEpsilon;\n const includeX = (t: number) => {\n if (!inUnitRange(t)) return;\n const it = this.pointOnCurve(t).x;\n if (it < minX) minX = it;\n if (it > maxX) maxX = it;\n };\n const includeY = (t: number) => {\n if (!inUnitRange(t)) return;\n const it = this.pointOnCurve(t).y;\n if (it < minY) minY = it;\n if (it > maxY) maxY = it;\n };\n\n // Find the derivative, which is a quadratic Bezier. Then we can solve for t using\n // the quadratic formula\n const xa = f(\n f(f(-this.anchor0X + f(3 * this.control0X)) - f(3 * this.control1X)) + this.anchor1X,\n );\n const xb = f(f(f(2 * this.anchor0X) - f(4 * this.control0X)) + f(2 * this.control1X));\n const xc = f(-this.anchor0X + this.control0X);\n\n if (zeroIsh(xa)) {\n // Try the Muller method instead; it can find a single root when a is 0\n if (xb !== 0) includeX(f(f(2 * xc) / f(-2 * xb)));\n } else {\n const xs = f(f(xb * xb) - f(f(4 * xa) * xc));\n if (xs >= 0) {\n includeX(f(f(-xb + f(Math.sqrt(xs))) / f(2 * xa)));\n includeX(f(f(-xb - f(Math.sqrt(xs))) / f(2 * xa)));\n }\n }\n\n // Repeat the above for y coordinate\n const ya = f(\n f(f(-this.anchor0Y + f(3 * this.control0Y)) - f(3 * this.control1Y)) + this.anchor1Y,\n );\n const yb = f(f(f(2 * this.anchor0Y) - f(4 * this.control0Y)) + f(2 * this.control1Y));\n const yc = f(-this.anchor0Y + this.control0Y);\n\n if (zeroIsh(ya)) {\n if (yb !== 0) includeY(f(f(2 * yc) / f(-2 * yb)));\n } else {\n const ys = f(f(yb * yb) - f(f(4 * ya) * yc));\n if (ys >= 0) {\n includeY(f(f(-yb + f(Math.sqrt(ys))) / f(2 * ya)));\n includeY(f(f(-yb - f(Math.sqrt(ys))) / f(2 * ya)));\n }\n }\n bounds[0] = minX;\n bounds[1] = minY;\n bounds[2] = maxX;\n bounds[3] = maxY;\n }\n\n /** Returns two Cubics, created by splitting this curve at the given distance of [t]. */\n split(t: number): [Cubic, Cubic] {\n const u = f(1 - t);\n const p = this.pointOnCurve(t);\n const uu = f(u * u);\n const ut2 = f(f(2 * u) * t);\n const tt = f(t * t);\n const lerp = (a: number, b: number) => f(f(a * u) + f(b * t));\n const quad = (a: number, b: number, c: number) => f(f(f(a * uu) + f(b * ut2)) + f(c * tt));\n return [\n Cubic.of(\n this.anchor0X,\n this.anchor0Y,\n lerp(this.anchor0X, this.control0X),\n lerp(this.anchor0Y, this.control0Y),\n quad(this.anchor0X, this.control0X, this.control1X),\n quad(this.anchor0Y, this.control0Y, this.control1Y),\n p.x,\n p.y,\n ),\n Cubic.of(\n p.x,\n p.y,\n quad(this.control0X, this.control1X, this.anchor1X),\n quad(this.control0Y, this.control1Y, this.anchor1Y),\n lerp(this.control1X, this.anchor1X),\n lerp(this.control1Y, this.anchor1Y),\n this.anchor1X,\n this.anchor1Y,\n ),\n ];\n }\n\n /** Utility function to reverse the control/anchor points for this curve. */\n reverse(): Cubic {\n return Cubic.of(\n this.anchor1X,\n this.anchor1Y,\n this.control1X,\n this.control1Y,\n this.control0X,\n this.control0Y,\n this.anchor0X,\n this.anchor0Y,\n );\n }\n\n plus(o: Cubic): Cubic {\n return new Cubic(this.points.map((v, i) => v + o.points[i]!));\n }\n\n times(x: number): Cubic {\n return new Cubic(this.points.map((v) => v * x));\n }\n\n div(x: number): Cubic {\n return this.times(f(1 / x));\n }\n\n toString(): string {\n const [a0x, a0y, c0x, c0y, c1x, c1y, a1x, a1y] = Array.from(this.points, String);\n return `anchor0: (${a0x!}, ${a0y!}) control0: (${c0x!}, ${c0y!}), control1: (${c1x!}, ${c1y!}), anchor1: (${a1x!}, ${a1y!})`;\n }\n\n equals(other: unknown): boolean {\n if (this === other) return true;\n return other instanceof Cubic && this.points.every((v, i) => v === other.points[i]);\n }\n\n /** Transforms the points in this [Cubic] with the given [PointTransformer]. */\n transformed(f: PointTransformer): Cubic {\n const newCubic = new MutableCubic();\n newCubic.points.set(this.points);\n newCubic.transform(f);\n return newCubic;\n }\n\n /** Generates a bezier curve that is a straight line between the given anchor points. */\n static straightLine(x0: number, y0: number, x1: number, y1: number): Cubic {\n return Cubic.of(\n x0,\n y0,\n interpolate(x0, x1, ONE_THIRD),\n interpolate(y0, y1, ONE_THIRD),\n interpolate(x0, x1, TWO_THIRDS),\n interpolate(y0, y1, TWO_THIRDS),\n x1,\n y1,\n );\n }\n\n /**\n * Generates a bezier curve that approximates a circular arc, with p0 and p1 as the starting and\n * ending anchor points. The curve generated is the smallest of the two possible arcs around the\n * entire 360-degree circle. Arcs of greater than 180 degrees should use more than one arc\n * together. Note that p0 and p1 should be equidistant from the center.\n */\n static circularArc(\n centerX: number,\n centerY: number,\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n ): Cubic {\n const p0d = directionVector(f(x0 - centerX), f(y0 - centerY));\n const p1d = directionVector(f(x1 - centerX), f(y1 - centerY));\n const rotatedP0 = rotate90(p0d);\n const rotatedP1 = rotate90(p1d);\n const clockwise = dotProductXY(rotatedP0, f(x1 - centerX), f(y1 - centerY)) >= 0;\n const cosa = dotProduct(p0d, p1d);\n if (cosa > COS_NEARLY_ZERO_ANGLE) /* p0 ~= p1 */ return Cubic.straightLine(x0, y0, x1, y1);\n const oneMinusCosa = f(1 - cosa);\n const k = f(\n f(\n f(\n f(f(distance(f(x0 - centerX), f(y0 - centerY)) * 4) / 3) *\n f(f(Math.sqrt(f(2 * oneMinusCosa))) - f(Math.sqrt(f(1 - f(cosa * cosa))))),\n ) / oneMinusCosa,\n ) * (clockwise ? 1 : -1),\n );\n return Cubic.of(\n x0,\n y0,\n f(x0 + f(rotatedP0.x * k)),\n f(y0 + f(rotatedP0.y * k)),\n f(x1 - f(rotatedP1.x * k)),\n f(y1 - f(rotatedP1.y * k)),\n x1,\n y1,\n );\n }\n}\n\n/** Kotlin `0.999f`, `1f / 3f` and `2f / 3f`. */\nconst COS_NEARLY_ZERO_ANGLE = /* @__PURE__ */ f(0.999);\nconst ONE_THIRD = /* @__PURE__ */ f(1 / 3);\nconst TWO_THIRDS = /* @__PURE__ */ f(2 / 3);\n\n/** This is a Mutable version of [Cubic], used mostly for performance critical paths. */\nexport class MutableCubic extends Cubic {\n private transformOnePoint(f: PointTransformer, ix: number): void {\n const [x, y] = f(this.points[ix]!, this.points[ix + 1]!);\n this.points[ix] = x;\n this.points[ix + 1] = y;\n }\n\n transform(f: PointTransformer): void {\n this.transformOnePoint(f, 0);\n this.transformOnePoint(f, 2);\n this.transformOnePoint(f, 4);\n this.transformOnePoint(f, 6);\n }\n\n interpolate(c1: Cubic, c2: Cubic, progress: number): void {\n for (let i = 0; i < 8; i++) {\n this.points[i] = interpolate(c1.points[i]!, c2.points[i]!, progress);\n }\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Features.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport type { Cubic } from './cubic.js';\nimport { type Point, type PointTransformer, transformed } from './point.js';\n\n/**\n * This class holds information about a corner (rounded or not) or an edge of a given polygon. The\n * features of a Polygon can be used to manipulate the shape with more context of what the shape\n * actually is, rather than simply manipulating the raw curves and lines which describe it.\n */\nexport abstract class Feature {\n constructor(readonly cubics: readonly Cubic[]) {}\n\n abstract transformed(f: PointTransformer): Feature;\n\n abstract toString(): string;\n}\n\n/**\n * Edges have only a list of the cubic curves which make up the edge. Edges lie between corners\n * and have no vertex or concavity; the curves are simply straight lines (represented by Cubic\n * curves).\n */\nexport class Edge extends Feature {\n transformed(f: PointTransformer): Edge {\n return new Edge(this.cubics.map((c) => c.transformed(f)));\n }\n\n toString(): string {\n return 'Edge';\n }\n}\n\n/**\n * Corners contain the list of cubic curves which describe how the corner is rounded (or not),\n * plus the vertex at the corner (which the cubics may or may not pass through, depending on\n * whether the corner is rounded) and a flag indicating whether the corner is convex. A regular\n * polygon has all convex corners, while a star polygon generally (but not necessarily) has both\n * convex (outer) and concave (inner) corners.\n */\nexport class Corner extends Feature {\n constructor(\n cubics: readonly Cubic[],\n readonly vertex: Point,\n readonly roundedCenter: Point,\n readonly convex = true,\n ) {\n super(cubics);\n }\n\n transformed(f: PointTransformer): Corner {\n return new Corner(\n this.cubics.map((c) => c.transformed(f)),\n transformed(this.vertex, f),\n transformed(this.roundedCenter, f),\n this.convex,\n );\n }\n\n toString(): string {\n return `Corner: vertex=(${String(this.vertex.x)}, ${String(this.vertex.y)}), center=(${String(this.roundedCenter.x)}, ${String(this.roundedCenter.y)}), convex=${String(this.convex)}`;\n }\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/FloatMapping.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { f, positiveModulo } from './utils.js';\n\n/**\n * Checks if the given progress is in the given progress range, since progress is in the [0..1)\n * interval, and wraps, there is a special case when progressTo < progressFrom. For example, if\n * the progress range is 0.7 to 0.2, both 0.8 and 0.1 are inside and 0.5 is outside.\n */\nexport function progressInRange(\n progress: number,\n progressFrom: number,\n progressTo: number,\n): boolean {\n return progressTo >= progressFrom\n ? progress >= progressFrom && progress <= progressTo\n : progress >= progressFrom || progress <= progressTo;\n}\n\n/**\n * Maps from one set of progress values to another. This is used by DoubleMapper to retrieve the\n * value on one shape that maps to the appropriate value on the other.\n */\nexport function linearMap(\n xValues: readonly number[],\n yValues: readonly number[],\n x: number,\n): number {\n if (!(x >= 0 && x <= 1)) throw new Error(`Invalid progress: ${String(x)}`);\n const n = xValues.length;\n const segmentStartIndex = xValues.findIndex((_, it) =>\n progressInRange(x, xValues[it]!, xValues[(it + 1) % n]!),\n );\n if (segmentStartIndex === -1)\n throw new Error('Collection contains no element matching the predicate.');\n const segmentEndIndex = (segmentStartIndex + 1) % n;\n const segmentSizeX = positiveModulo(\n f(xValues[segmentEndIndex]! - xValues[segmentStartIndex]!),\n 1,\n );\n const segmentSizeY = positiveModulo(\n f(yValues[segmentEndIndex]! - yValues[segmentStartIndex]!),\n 1,\n );\n const positionInSegment =\n segmentSizeX < f(0.001)\n ? 0.5\n : f(positiveModulo(f(x - xValues[segmentStartIndex]!), 1) / segmentSizeX);\n return positiveModulo(f(yValues[segmentStartIndex]! + f(segmentSizeY * positionInSegment)), 1);\n}\n\n/**\n * DoubleMapper creates mappings from values in the [0..1) source space to values in the [0..1)\n * target space, and back. This mapping is created given a finite list of representative mappings,\n * and this is extended to the whole interval by linear interpolation, and wrapping around.\n */\nexport class DoubleMapper {\n private readonly sourceValues: number[] = [];\n private readonly targetValues: number[] = [];\n\n constructor(...mappings: (readonly [number, number])[]) {\n for (const [source, target] of mappings) {\n this.sourceValues.push(f(source));\n this.targetValues.push(f(target));\n }\n validateProgress(this.sourceValues);\n validateProgress(this.targetValues);\n }\n\n map(x: number): number {\n return linearMap(this.sourceValues, this.targetValues, x);\n }\n\n mapBack(x: number): number {\n return linearMap(this.targetValues, this.sourceValues, x);\n }\n\n static readonly Identity = /* @__PURE__ */ new DoubleMapper(\n // We need any 2 points in the (x, x) diagonal, with x in the [0, 1) range,\n // We spread them as much as possible to minimize float errors.\n [0, 0],\n [0.5, 0.5],\n );\n}\n\n/**\n * Verify that a list of progress values are all in the range [0.0, 1.0) and is monotonically\n * increasing, with the exception of maybe one wrap around.\n */\nexport function validateProgress(p: readonly number[]): void {\n if (!p.every((curr) => curr >= 0 && curr <= 1)) {\n throw new Error(`FloatMapping - Progress outside of range: ${p.join(', ')}`);\n }\n let wraps = 0;\n for (let it = 1; it < p.length; it++) if (p[it]! < p[it - 1]!) wraps++;\n if (wraps > 1) throw new Error(`FloatMapping - Progress wraps more than once: ${p.join(', ')}`);\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/FeatureMapping.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { Corner, type Feature } from './features.js';\nimport { DoubleMapper } from './float-mapping.js';\nimport type { ProgressableFeature } from './polygon-measure.js';\nimport { FLOAT_MAX_VALUE, f } from './utils.js';\n\n/** Kotlin `minBy`: the first element with the smallest key. */\nfunction minBy(from: number, toInclusive: number, key: (i: number) => number): number {\n let best = from;\n let bestKey = key(from);\n for (let i = from + 1; i <= toInclusive; i++) {\n const k = key(i);\n if (k < bestKey) {\n best = i;\n bestKey = k;\n }\n }\n return best;\n}\n\n/**\n * Creates a mapping between the \"features\" (rounded corners) of two shapes. Used by Morph to\n * decide which corners of one shape morph into which corners of the other.\n */\nexport function featureMapper(\n features1: readonly ProgressableFeature[],\n features2: readonly ProgressableFeature[],\n): DoubleMapper {\n // We only use corners for this mapping.\n const filteredFeatures1 = features1.filter((f) => f.feature instanceof Corner);\n const filteredFeatures2 = features2.filter((f) => f.feature instanceof Corner);\n\n const [m1, m2] =\n filteredFeatures1.length > filteredFeatures2.length\n ? [doMapping(filteredFeatures2, filteredFeatures1), filteredFeatures2]\n : [filteredFeatures1, doMapping(filteredFeatures1, filteredFeatures2)];\n\n const mm: (readonly [number, number])[] = [];\n for (let i = 0; i < m1.length; i++) {\n if (i === m2.length) break;\n mm.push([m1[i]!.progress, m2[i]!.progress]);\n }\n return new DoubleMapper(...mm);\n}\n\n/**\n * Returns distance along overall shape between two Features on the two different shapes. This\n * information is used to determine how to map features (and the curves that make up those\n * features).\n */\nexport function featureDistSquared(f1: Feature, f2: Feature): number {\n if (f1 instanceof Corner && f2 instanceof Corner && f1.convex !== f2.convex) {\n // Simple hack to force all features to map only to features of the same concavity, by\n // returning an infinitely large distance in that case\n return FLOAT_MAX_VALUE;\n }\n const first1 = f1.cubics[0]!;\n const last1 = f1.cubics[f1.cubics.length - 1]!;\n const first2 = f2.cubics[0]!;\n const last2 = f2.cubics[f2.cubics.length - 1]!;\n const c1x = f(f(first1.anchor0X + last1.anchor1X) / 2);\n const c1y = f(f(first1.anchor0Y + last1.anchor1Y) / 2);\n const c2x = f(f(first2.anchor0X + last2.anchor1X) / 2);\n const c2y = f(f(first2.anchor0Y + last2.anchor1Y) / 2);\n const dx = f(c1x - c2x);\n const dy = f(c1y - c2y);\n return f(f(dx * dx) + f(dy * dy));\n}\n\n/**\n * Returns a mapping of the features in f2 that best map to the features in f1. The result will\n * be a list of features in f2 that is the size of f1.\n */\nexport function doMapping(\n f1: readonly ProgressableFeature[],\n f2: readonly ProgressableFeature[],\n): ProgressableFeature[] {\n // Pick the first mapping in a greedy way.\n const ix = minBy(0, f2.length - 1, (it) => featureDistSquared(f1[0]!.feature, f2[it]!.feature));\n\n const m = f1.length;\n const n = f2.length;\n\n const ret = [f2[ix]!];\n let lastPicked = ix;\n for (let i = 1; i < m; i++) {\n // Check the indices we can pick, which one is better.\n // Leave enough items in f2 to pick matches for the items left in f1.\n let last = ix - (m - i);\n if (!(last > lastPicked)) last += n;\n const best = minBy(lastPicked + 1, last, (it) =>\n featureDistSquared(f1[i]!.feature, f2[it % n]!.feature),\n );\n ret.push(f2[best % n]!);\n lastPicked = best;\n }\n return ret;\n}\n","/*\n * Copyright 2023 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/PolygonMeasure.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// 1.0.1 measures outline progress by angle around the polygon center (AngleMeasurer);\n// 1.1.0 switched to curve length.\n\nimport type { Cubic } from './cubic.js';\nimport { Corner, type Feature } from './features.js';\nimport type { RoundedPolygon } from './rounded-polygon.js';\nimport { DistanceEpsilon, TwoPi, angle, f, findMinimum, positiveModulo } from './utils.js';\n\n/** A feature with its position along the outline of its polygon, in [0, 1). */\nexport class ProgressableFeature {\n constructor(\n readonly progress: number,\n readonly feature: Feature,\n ) {}\n}\n\nexport interface Measurer {\n /**\n * Returns size of given cubic, according to however the implementation wants to measure the\n * size (angle, length, etc). It has to be greater or equal to 0.\n */\n measureCubic(c: Cubic): number;\n\n /**\n * Given a cubic and a measure that should be between 0 and the value returned by measureCubic\n * (If not, it will be capped), finds the parameter t of the cubic at which that measure is\n * reached.\n */\n findCubicCutPoint(c: Cubic, m: number): number;\n}\n\n/**\n * Approximates the arc lengths of cubics by measuring the angle swept around the center of the\n * polygon.\n */\nexport class AngleMeasurer implements Measurer {\n constructor(\n readonly centerX: number,\n readonly centerY: number,\n ) {}\n\n measureCubic(c: Cubic): number {\n const it = positiveModulo(\n f(\n angle(f(c.anchor1X - this.centerX), f(c.anchor1Y - this.centerY)) -\n angle(f(c.anchor0X - this.centerX), f(c.anchor0Y - this.centerY)),\n ),\n TwoPi,\n );\n // Avoid an empty cubic to measure almost TwoPi\n return it > f(TwoPi - DistanceEpsilon) ? 0 : it;\n }\n\n findCubicCutPoint(c: Cubic, m: number): number {\n const angle0 = angle(f(c.anchor0X - this.centerX), f(c.anchor0Y - this.centerY));\n return findMinimum(0, 1, f(1e-5), (t) => {\n const curvePoint = c.pointOnCurve(t);\n const a = angle(f(curvePoint.x - this.centerX), f(curvePoint.y - this.centerY));\n return Math.abs(f(positiveModulo(f(a - angle0), TwoPi) - m));\n });\n }\n}\n\nexport class MeasuredCubic {\n readonly measuredSize: number;\n\n constructor(\n private readonly measurer: Measurer,\n readonly cubic: Cubic,\n private _startOutlineProgress: number,\n private _endOutlineProgress: number,\n ) {\n if (!(_endOutlineProgress >= _startOutlineProgress)) {\n throw new Error(\n 'endOutlineProgress is expected to be equal or greater than startOutlineProgress',\n );\n }\n this.measuredSize = measurer.measureCubic(cubic);\n }\n\n get startOutlineProgress(): number {\n return this._startOutlineProgress;\n }\n\n get endOutlineProgress(): number {\n return this._endOutlineProgress;\n }\n\n updateProgressRange(\n startOutlineProgress: number = this._startOutlineProgress,\n endOutlineProgress: number = this._endOutlineProgress,\n ): void {\n if (!(endOutlineProgress >= startOutlineProgress)) {\n throw new Error(\n 'endOutlineProgress is expected to be equal or greater than startOutlineProgress',\n );\n }\n this._startOutlineProgress = startOutlineProgress;\n this._endOutlineProgress = endOutlineProgress;\n }\n\n /**\n * Cut this MeasuredCubic into two MeasuredCubics at the given outline progress value.\n */\n cutAtProgress(cutOutlineProgress: number): [MeasuredCubic, MeasuredCubic] {\n // Floating point errors further up can cause cutOutlineProgress to land just\n // slightly outside of the start/end progress for this cubic, so we limit it\n // to those bounds to avoid further errors later\n const boundedCutOutlineProgress = Math.min(\n Math.max(cutOutlineProgress, this._startOutlineProgress),\n this._endOutlineProgress,\n );\n const outlineProgressSize = f(this._endOutlineProgress - this._startOutlineProgress);\n const progressFromStart = f(boundedCutOutlineProgress - this._startOutlineProgress);\n\n // Note that in earlier parts of the computation, we have empty MeasuredCubics (cubics\n // with progressSize == 0f), but those cubics are filtered out before this method is\n // called.\n const relativeProgress = f(progressFromStart / outlineProgressSize);\n const t = this.measurer.findCubicCutPoint(this.cubic, f(relativeProgress * this.measuredSize));\n if (!(t >= 0 && t <= 1)) throw new Error('Cubic cut point is expected to be between 0 and 1');\n\n // c1/c2 are the two new cubics, then we return MeasuredCubics created from them\n const [c1, c2] = this.cubic.split(t);\n return [\n new MeasuredCubic(this.measurer, c1, this._startOutlineProgress, boundedCutOutlineProgress),\n new MeasuredCubic(this.measurer, c2, boundedCutOutlineProgress, this._endOutlineProgress),\n ];\n }\n\n toString(): string {\n return `MeasuredCubic(outlineProgress=[${String(this._startOutlineProgress)} .. ${String(this._endOutlineProgress)}], size=${String(this.measuredSize)}, cubic=${String(this.cubic)})`;\n }\n}\n\nexport class MeasuredPolygon implements Iterable<MeasuredCubic> {\n private readonly cubics: MeasuredCubic[];\n\n private constructor(\n private readonly measurer: Measurer,\n readonly features: readonly ProgressableFeature[],\n cubics: readonly Cubic[],\n outlineProgress: readonly number[],\n ) {\n if (outlineProgress.length !== cubics.length + 1) {\n throw new Error('Outline progress size is expected to be the cubics size + 1');\n }\n if (outlineProgress[0] !== 0)\n throw new Error('First outline progress value is expected to be zero');\n if (outlineProgress[outlineProgress.length - 1] !== 1) {\n throw new Error('Last outline progress value is expected to be one');\n }\n const measuredCubics: MeasuredCubic[] = [];\n let startOutlineProgress = 0;\n for (let index = 0; index < cubics.length; index++) {\n // Filter out \"empty\" cubics\n if (f(outlineProgress[index + 1]! - outlineProgress[index]!) > DistanceEpsilon) {\n measuredCubics.push(\n new MeasuredCubic(\n measurer,\n cubics[index]!,\n startOutlineProgress,\n outlineProgress[index + 1]!,\n ),\n );\n // The next measured cubic will start exactly where this one ends.\n startOutlineProgress = outlineProgress[index + 1]!;\n }\n }\n // We could have removed empty cubics at the end. Ensure the last measured cubic ends at 1f\n measuredCubics[measuredCubics.length - 1]!.updateProgressRange(undefined, 1);\n this.cubics = measuredCubics;\n }\n\n get size(): number {\n return this.cubics.length;\n }\n\n get(index: number): MeasuredCubic {\n const cubic = this.cubics[index];\n if (!cubic) throw new RangeError(`index ${String(index)} out of range`);\n return cubic;\n }\n\n [Symbol.iterator](): Iterator<MeasuredCubic> {\n return this.cubics[Symbol.iterator]();\n }\n\n /**\n * Finds the point in the input list of measured cubics that pass the given outline progress, and\n * generates a new MeasuredPolygon (equivalent to this), that starts at that point. This usually\n * means cutting the cubic that crosses the outline progress (unless the cut is at one of its\n * ends) For example, given outline progress 0.4f and measured cubics on these outline progress\n * ranges: c1 [0 -> 0.2] c2 [0.2 -> 0.5] c3 [0.5 -> 1.0] c2 will be cut in two, at the given\n * outline progress, we can name these c2a [0.2 -> 0.4] and c2b [0.4 -> 0.5] The return then will\n * have the following cubics, in this order: c2b, c3, c1, c2a\n */\n cutAndShift(cuttingPoint: number): MeasuredPolygon {\n if (!(cuttingPoint >= 0 && cuttingPoint <= 1)) {\n throw new Error('Cutting point is expected to be between 0 and 1');\n }\n if (cuttingPoint < DistanceEpsilon) return this;\n\n // Find the index of cubic we want to cut\n const targetIndex = this.cubics.findIndex(\n (it) => cuttingPoint >= it.startOutlineProgress && cuttingPoint <= it.endOutlineProgress,\n );\n const target = this.get(targetIndex);\n // Cut the target cubic.\n // b1, b2 are two resulting cubics after cut\n const [b1, b2] = target.cutAtProgress(cuttingPoint);\n\n // Construct the list of the cubics we need:\n // * The second part of the target cubic (after the cut)\n // * All cubics after the target, until the end + All cubics from the start, before the\n // target cubic\n // * The first part of the target cubic (before the cut)\n const retCubics: Cubic[] = [b2.cubic];\n for (let i = 1; i < this.cubics.length; i++) {\n retCubics.push(this.get((i + targetIndex) % this.cubics.length).cubic);\n }\n retCubics.push(b1.cubic);\n\n // Construct the array of outline progress.\n // For example, if we have 3 cubics with outline progress [0 .. 0.3], [0.3 .. 0.8] &\n // [0.8 .. 1.0], and we cut + shift at 0.6:\n // 0. 0123456789\n // |--|--/-|-|\n // The outline progresses will start at 0 (the cutting point, that shifs to 0.0),\n // then 0.8 - 0.6 = 0.2, then 1 - 0.6 = 0.4, then 0.3 - 0.6 + 1 = 0.7,\n // then 1 (the cutting point again),\n // all together: (0.0, 0.2, 0.4, 0.7, 1.0)\n const retOutlineProgress: number[] = [];\n for (let index = 0; index < this.cubics.length + 2; index++) {\n if (index === 0) retOutlineProgress.push(0);\n else if (index === this.cubics.length + 1) retOutlineProgress.push(1);\n else {\n const cubicIndex = (targetIndex + index - 1) % this.cubics.length;\n retOutlineProgress.push(\n positiveModulo(f(this.get(cubicIndex).endOutlineProgress - cuttingPoint), 1),\n );\n }\n }\n\n // Shift the feature outline progress too.\n const newFeatures = this.features.map(\n (it) => new ProgressableFeature(positiveModulo(f(it.progress - cuttingPoint), 1), it.feature),\n );\n\n // Filter out all empty cubics (i.e. start and end anchor are (almost) the same point.)\n return new MeasuredPolygon(this.measurer, newFeatures, retCubics, retOutlineProgress);\n }\n\n static measurePolygon(measurer: Measurer, polygon: RoundedPolygon): MeasuredPolygon {\n const cubics: Cubic[] = [];\n const featureToCubic: [Feature, number][] = [];\n\n // Get the cubics from the polygon, at the same time, extract the features and keep a\n // reference to the representative cubic we will use.\n for (const feature of polygon.features) {\n for (let cubicIndex = 0; cubicIndex < feature.cubics.length; cubicIndex++) {\n if (feature instanceof Corner && cubicIndex === Math.trunc(feature.cubics.length / 2)) {\n featureToCubic.push([feature, cubics.length]);\n }\n cubics.push(feature.cubics[cubicIndex]!);\n }\n }\n const measures: number[] = [0];\n for (const cubic of cubics) {\n const m = measurer.measureCubic(cubic);\n if (!(m >= 0)) throw new Error('Measured cubic is expected to be greater or equal to zero');\n measures.push(f(measures[measures.length - 1]! + m));\n }\n const totalMeasure = measures[measures.length - 1]!;\n const outlineProgress = measures.map((m) => f(m / totalMeasure));\n\n const features = featureToCubic.map(\n ([feature, ix]) =>\n new ProgressableFeature(f(f(outlineProgress[ix]! + outlineProgress[ix + 1]!) / 2), feature),\n );\n return new MeasuredPolygon(measurer, features, cubics, outlineProgress);\n }\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Morph.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n\nimport { Cubic, MutableCubic } from './cubic.js';\nimport { featureMapper } from './feature-mapping.js';\nimport { AngleMeasurer, type MeasuredCubic, MeasuredPolygon } from './polygon-measure.js';\nimport type { RoundedPolygon } from './rounded-polygon.js';\nimport { AngleEpsilon, f, interpolate, positiveModulo } from './utils.js';\n\n/**\n * This class is used to animate between start and end polygons objects.\n *\n * Morphing between arbitrary objects can be problematic because it can be difficult to determine\n * how the points of a given shape map to the points of some other shape. [Morph] simplifies the\n * problem by only operating on [RoundedPolygon] objects, which are known to have similar,\n * contiguous structures. For one thing, the shape of a polygon is contiguous from start to end\n * (compared to an arbitrary Path object, which could have one or more `moveTo` operations in the\n * shape). Also, all edges of a polygon shape are represented by [Cubic] objects, thus the start\n * and end shapes use similar operations. Two Polygon shapes then only differ in the quantity and\n * placement of their curves. The morph works by determining how to map the curves of the two\n * shapes together (based on proximity and other information, such as distance to polygon\n * vertices and concavity), and splitting curves when the shapes do not have the same number of\n * curves or when the curve placement within the shapes is very different.\n */\nexport class Morph {\n /** The structure which holds the actual shape being morphed: matched start/end cubics. */\n readonly morphMatch: readonly (readonly [Cubic, Cubic])[];\n\n constructor(\n private readonly start: RoundedPolygon,\n private readonly end: RoundedPolygon,\n ) {\n this.morphMatch = Morph.match(start, end);\n }\n\n /** Axis-aligned bounds covering both start and end shapes (and so the whole morph). */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = true): number[] {\n this.start.calculateBounds(bounds, approximate);\n const [minX, minY, maxX, maxY] = bounds as [number, number, number, number];\n this.end.calculateBounds(bounds, approximate);\n bounds[0] = Math.min(minX, bounds[0]!);\n bounds[1] = Math.min(minY, bounds[1]!);\n bounds[2] = Math.max(maxX, bounds[2]!);\n bounds[3] = Math.max(maxY, bounds[3]!);\n return bounds;\n }\n\n /** A square that holds both shapes in any rotation (see RoundedPolygon.calculateMaxBounds). */\n calculateMaxBounds(bounds: number[] = [0, 0, 0, 0]): number[] {\n this.start.calculateMaxBounds(bounds);\n const [minX, minY, maxX, maxY] = bounds as [number, number, number, number];\n this.end.calculateMaxBounds(bounds);\n bounds[0] = Math.min(minX, bounds[0]!);\n bounds[1] = Math.min(minY, bounds[1]!);\n bounds[2] = Math.max(maxX, bounds[2]!);\n bounds[3] = Math.max(maxY, bounds[3]!);\n return bounds;\n }\n\n /**\n * Returns a representation of the morph object at a given [progress] value as a list of Cubics.\n * Note that this function causes a new list to be created and populated, so there is some\n * overhead.\n */\n asCubics(progress: number): Cubic[] {\n const out: Cubic[] = [];\n // The first/last mechanism here ensures that the final anchor point in the shape\n // exactly matches the first anchor point. There can be rendering artifacts introduced\n // by those points being slightly off, even by much less than a pixel\n let firstCubic: Cubic | null = null;\n let lastCubic: Cubic | null = null;\n for (const [first, second] of this.morphMatch) {\n const cubic = new Cubic(\n first.points.map((v, it) => interpolate(v, second.points[it]!, progress)),\n );\n firstCubic ??= cubic;\n if (lastCubic !== null) out.push(lastCubic);\n lastCubic = cubic;\n }\n if (lastCubic !== null && firstCubic !== null) {\n out.push(\n Cubic.of(\n lastCubic.anchor0X,\n lastCubic.anchor0Y,\n lastCubic.control0X,\n lastCubic.control0Y,\n lastCubic.control1X,\n lastCubic.control1Y,\n firstCubic.anchor0X,\n firstCubic.anchor0Y,\n ),\n );\n }\n return out;\n }\n\n /**\n * Calls [callback] for each of the cubics of the morph at [progress], reusing [mutableCubic]\n * (no per-frame allocation).\n */\n forEachCubic(\n progress: number,\n callback: (cubic: MutableCubic) => void,\n mutableCubic: MutableCubic = new MutableCubic(),\n ): void {\n for (const [first, second] of this.morphMatch) {\n mutableCubic.interpolate(first, second, progress);\n callback(mutableCubic);\n }\n }\n\n /**\n * Matches the cubics of two polygons: measures both outlines, maps their corners, cuts and\n * shifts the end polygon, then walks both, cutting curves so every pair spans the same progress.\n */\n static match(p1: RoundedPolygon, p2: RoundedPolygon): [Cubic, Cubic][] {\n // Measure polygons, returns lists of measured cubics for each polygon, which\n // we then use to match start/end curves\n const measuredPolygon1 = MeasuredPolygon.measurePolygon(\n new AngleMeasurer(p1.centerX, p1.centerY),\n p1,\n );\n const measuredPolygon2 = MeasuredPolygon.measurePolygon(\n new AngleMeasurer(p2.centerX, p2.centerY),\n p2,\n );\n\n // features1 and 2 will contain the list of corners (just the inner circular curve)\n // along with the progress at the middle of those corners. These measurement values\n // are then used to compare and match between the two polygons\n const features1 = measuredPolygon1.features;\n const features2 = measuredPolygon2.features;\n\n // Map features: doubleMapper is the result of mapping the features in each shape to the\n // closest feature in the other shape.\n // Given a progress in one of the shapes it can be used to find the corresponding\n // progress in the other shape (in both directions)\n const doubleMapper = featureMapper(features1, features2);\n\n // cut point on poly2 is the mapping of the 0 point on poly1\n const polygon2CutPoint = doubleMapper.map(0);\n\n // Cut and rotate.\n // Polygons start at progress 0, and the featureMapper has decided that we want to match\n // progress 0 in the first polygon to `polygon2CutPoint` on the second polygon.\n // So we need to cut the second polygon there and \"rotate it\", so as we walk through\n // both polygons we can find the matching.\n // The resulting bs1/2 are MeasuredPolygons, whose MeasuredCubics start from\n // outlineProgress=0 and increasing until outlineProgress=1\n const bs1 = measuredPolygon1;\n const bs2 = measuredPolygon2.cutAndShift(polygon2CutPoint);\n\n // Match\n // Now we can compare the two lists of measured cubics and create a list of pairs\n // of cubics [ret], which are the start/end curves that represent the Morph object\n // and the start and end shapes, and which can be interpolated to animate the\n // between those shapes.\n const ret: [Cubic, Cubic][] = [];\n const getOrNull = (p: MeasuredPolygon, i: number): MeasuredCubic | null =>\n i < p.size ? p.get(i) : null;\n // i1/i2 are the indices of the current cubic on the start (1) and end (2) shapes\n let i1 = 0;\n let i2 = 0;\n // b1, b2 are the current measured cubic for each polygon\n let b1 = getOrNull(bs1, i1++);\n let b2 = getOrNull(bs2, i2++);\n // Iterate until all curves are accounted for and matched\n while (b1 !== null && b2 !== null) {\n // Progresses are in shape1 perspective\n // b1a, b2a are ending progress values of current measured cubics in [0,1] range\n const b1a = i1 === bs1.size ? 1 : b1.endOutlineProgress;\n const b2a =\n i2 === bs2.size\n ? 1\n : doubleMapper.mapBack(positiveModulo(f(b2.endOutlineProgress + polygon2CutPoint), 1));\n const minb = Math.min(b1a, b2a);\n // min b is the progress at which the curve that ends first ends.\n // If both curves ends roughly there, no cutting is needed, we have a match.\n // If one curve extends beyond, we need to cut it.\n let seg1: MeasuredCubic;\n let newb1: MeasuredCubic | null;\n if (b1a > f(minb + AngleEpsilon)) {\n [seg1, newb1] = b1.cutAtProgress(minb);\n } else {\n seg1 = b1;\n newb1 = getOrNull(bs1, i1++);\n }\n let seg2: MeasuredCubic;\n let newb2: MeasuredCubic | null;\n if (b2a > f(minb + AngleEpsilon)) {\n [seg2, newb2] = b2.cutAtProgress(\n positiveModulo(f(doubleMapper.map(minb) - polygon2CutPoint), 1),\n );\n } else {\n seg2 = b2;\n newb2 = getOrNull(bs2, i2++);\n }\n ret.push([seg1.cubic, seg2.cubic]);\n b1 = newb1;\n b2 = newb2;\n }\n if (!(b1 === null && b2 === null)) {\n throw new Error(\"Expected both Polygon's Cubic to be fully matched\");\n }\n return ret;\n }\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/RoundedPolygon.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Faithful to 1.0.1, including two upstream behaviours fixed in later releases:\n// - calculateCenter() divides the coordinate sum by vertices.size and then by 2 again\n// (graphics-shapes 1.1.0-alpha01: \"Fix an error in the algorithm to estimate the center\").\n// - calculateBounds() starts max values at Float.MIN_VALUE (the smallest positive float), so\n// bounds of geometry entirely at negative coordinates report max 0.\n\nimport { CornerRounding } from './corner-rounding.js';\nimport { Cubic } from './cubic.js';\nimport { Corner, Edge, type Feature } from './features.js';\nimport {\n type Point,\n type PointTransformer,\n clockwise,\n div,\n dotProduct,\n getDirection,\n interpolatePoint,\n minus,\n plus,\n point,\n times,\n transformed,\n} from './point.js';\nimport {\n DistanceEpsilon,\n FLOAT_MAX_VALUE,\n FLOAT_MIN_VALUE,\n FloatPi,\n directionVector,\n f,\n distance,\n distanceSquared,\n radialToCartesian,\n rotate90,\n square,\n} from './utils.js';\n\n/**\n * The RoundedPolygon class allows simple construction of polygonal shapes with optional rounding\n * at the vertices. Polygons can be constructed with either the number of vertices desired or an\n * ordered list of vertices.\n */\nexport class RoundedPolygon {\n readonly cubics: readonly Cubic[];\n readonly centerX: number;\n readonly centerY: number;\n\n constructor(\n readonly features: readonly Feature[],\n centerX: number,\n centerY: number,\n ) {\n this.centerX = f(centerX);\n this.centerY = f(centerY);\n this.cubics = buildCubics(features);\n let prevCubic = this.cubics[this.cubics.length - 1]!;\n for (const cubic of this.cubics) {\n if (\n Math.abs(f(cubic.anchor0X - prevCubic.anchor1X)) > DistanceEpsilon ||\n Math.abs(f(cubic.anchor0Y - prevCubic.anchor1Y)) > DistanceEpsilon\n ) {\n throw new Error(\n 'RoundedPolygon must be contiguous, with the anchor points of all curves matching the ' +\n 'anchor points of the preceding and succeeding cubics',\n );\n }\n prevCubic = cubic;\n }\n }\n\n /** Transforms (scales/translates/etc.) this [RoundedPolygon] with the given [PointTransformer]. */\n transformed(f: PointTransformer): RoundedPolygon {\n const center = transformed(point(this.centerX, this.centerY), f);\n return new RoundedPolygon(\n this.features.map((feature) => feature.transformed(f)),\n center.x,\n center.y,\n );\n }\n\n /**\n * Creates a new RoundedPolygon, moving and resizing this one, so it is completely inside the\n * (0, 0) -> (1, 1) square, centered if there extra space in one direction\n */\n normalized(): RoundedPolygon {\n const bounds = this.calculateBounds();\n const width = f(bounds[2]! - bounds[0]!);\n const height = f(bounds[3]! - bounds[1]!);\n const side = Math.max(width, height);\n // Center the shape if bounds are not a square\n const offsetX = f(f(f(side - width) / 2) - bounds[0]!); /* left */\n const offsetY = f(f(f(side - height) / 2) - bounds[1]!); /* top */\n return this.transformed((x, y) => [f(f(x + offsetX) / side), f(f(y + offsetY) / side)]);\n }\n\n toString(): string {\n return `[RoundedPolygon. Cubics = ${this.cubics.join(', ')} || Features = ${this.features.join(', ')} || Center = (${String(this.centerX)}, ${String(this.centerY)})]`;\n }\n\n /**\n * Like [calculateBounds], this function calculates the axis-aligned bounds of the object and\n * returns that rectangle. But this function determines the max dimension of the shape (by\n * calculating the distance from its center to the start and midpoint of each curve) and returns\n * a square which can be used to hold the object in any rotation.\n */\n calculateMaxBounds(bounds: number[] = [0, 0, 0, 0]): number[] {\n if (bounds.length < 4) throw new Error('Required bounds size of 4');\n let maxDistSquared = 0;\n for (const cubic of this.cubics) {\n const anchorDistance = distanceSquared(\n f(cubic.anchor0X - this.centerX),\n f(cubic.anchor0Y - this.centerY),\n );\n const middlePoint = cubic.pointOnCurve(0.5);\n const middleDistance = distanceSquared(\n f(middlePoint.x - this.centerX),\n f(middlePoint.y - this.centerY),\n );\n maxDistSquared = Math.max(maxDistSquared, Math.max(anchorDistance, middleDistance));\n }\n const d = f(Math.sqrt(maxDistSquared));\n bounds[0] = f(this.centerX - d);\n bounds[1] = f(this.centerY - d);\n bounds[2] = f(this.centerX + d);\n bounds[3] = f(this.centerY + d);\n return bounds;\n }\n\n /**\n * Calculates the axis-aligned bounds of the object. With [approximate] (the default), uses the\n * bounding box of every anchor and control point.\n */\n calculateBounds(bounds: number[] = [0, 0, 0, 0], approximate = true): number[] {\n if (bounds.length < 4) throw new Error('Required bounds size of 4');\n let minX = FLOAT_MAX_VALUE;\n let minY = FLOAT_MAX_VALUE;\n let maxX = FLOAT_MIN_VALUE;\n let maxY = FLOAT_MIN_VALUE;\n for (const cubic of this.cubics) {\n cubic.calculateBounds(bounds, approximate);\n minX = Math.min(minX, bounds[0]!);\n minY = Math.min(minY, bounds[1]!);\n maxX = Math.max(maxX, bounds[2]!);\n maxY = Math.max(maxY, bounds[3]!);\n }\n bounds[0] = minX;\n bounds[1] = minY;\n bounds[2] = maxX;\n bounds[3] = maxY;\n return bounds;\n }\n\n /** Copy constructor (Kotlin `RoundedPolygon(source)`). */\n static copy(source: RoundedPolygon): RoundedPolygon {\n return new RoundedPolygon(source.features, source.centerX, source.centerY);\n }\n\n /**\n * Regular polygon of [numVertices] vertices around ([centerX], [centerY]) at [radius]\n * (Kotlin `RoundedPolygon(numVertices, …)`).\n */\n static fromVertexCount(\n numVertices: number,\n options: {\n radius?: number;\n centerX?: number;\n centerY?: number;\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n } = {},\n ): RoundedPolygon {\n const { radius = 1, centerX = 0, centerY = 0, rounding = CornerRounding.Unrounded } = options;\n return RoundedPolygon.fromVertices(\n verticesFromNumVerts(numVertices, radius, centerX, centerY),\n {\n rounding,\n perVertexRounding: options.perVertexRounding ?? null,\n centerX,\n centerY,\n },\n );\n }\n\n /**\n * Polygon from an ordered list of `[x0, y0, x1, y1, …]` vertices (Kotlin\n * `RoundedPolygon(vertices, …)`). Center defaults to the (1.0.1) estimate from the vertices.\n */\n static fromVertices(\n vertices: ArrayLike<number>,\n options: {\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n ): RoundedPolygon {\n const {\n rounding = CornerRounding.Unrounded,\n perVertexRounding = null,\n centerX = FLOAT_MIN_VALUE,\n centerY = FLOAT_MIN_VALUE,\n } = options;\n if (vertices.length < 6) throw new Error('Polygons must have at least 3 vertices');\n if (vertices.length % 2 === 1) throw new Error('The vertices array should have even size');\n if (perVertexRounding !== null && perVertexRounding.length * 2 !== vertices.length) {\n throw new Error(\n 'perVertexRounding list should be either null or the same size as the number of vertices (vertices.size / 2)',\n );\n }\n // Kotlin FloatArray\n const v = (i: number) => f(vertices[i]!);\n const corners: Cubic[][] = [];\n const n = vertices.length / 2;\n const roundedCorners: RoundedCorner[] = [];\n for (let i = 0; i < n; i++) {\n const vtxRounding = perVertexRounding?.[i] ?? rounding;\n const prevIndex = ((i + n - 1) % n) * 2;\n const nextIndex = ((i + 1) % n) * 2;\n roundedCorners.push(\n new RoundedCorner(\n point(v(prevIndex), v(prevIndex + 1)),\n point(v(i * 2), v(i * 2 + 1)),\n point(v(nextIndex), v(nextIndex + 1)),\n vtxRounding,\n ),\n );\n }\n\n // For each side, check if we have enough space to do the cuts needed, and if not split\n // the available space, first for round cuts, then for smoothing if there is space left.\n // Each element in this list is a pair, that represent how much we can do of the cut for\n // the given side (side i goes from corner i to corner i+1), the elements of the pair are:\n // first is how much we can use of expectedRoundCut, second how much of expectedCut\n const cutAdjusts: (readonly [number, number])[] = [];\n for (let ix = 0; ix < n; ix++) {\n const here = roundedCorners[ix]!;\n const next = roundedCorners[(ix + 1) % n]!;\n const expectedRoundCut = f(here.expectedRoundCut + next.expectedRoundCut);\n const expectedCut = f(here.expectedCut + next.expectedCut);\n const vtxX = v(ix * 2);\n const vtxY = v(ix * 2 + 1);\n const nextVtxX = v(((ix + 1) % n) * 2);\n const nextVtxY = v(((ix + 1) % n) * 2 + 1);\n const sideSize = distance(f(vtxX - nextVtxX), f(vtxY - nextVtxY));\n\n // Check expectedRoundCut first, and ensure we fulfill rounding needs first for\n // both corners before using space for smoothing\n if (expectedRoundCut > sideSize) {\n // Not enough room for fully rounding, see how much we can actually do.\n cutAdjusts.push([f(sideSize / expectedRoundCut), 0]);\n } else if (expectedCut > sideSize) {\n // We can do full rounding, but not full smoothing.\n cutAdjusts.push([1, f(f(sideSize - expectedRoundCut) / f(expectedCut - expectedRoundCut))]);\n } else {\n // There is enough room for rounding & smoothing.\n cutAdjusts.push([1, 1]);\n }\n }\n\n // Create and store list of beziers for each [potentially] rounded corner\n for (let i = 0; i < n; i++) {\n // allowedCuts[0] is for the side from the previous corner to this one,\n // allowedCuts[1] is for the side from this corner to the next one.\n const allowedCuts: number[] = [];\n const corner = roundedCorners[i]!;\n for (let delta = 0; delta <= 1; delta++) {\n const [roundCutRatio, cutRatio] = cutAdjusts[(i + n - 1 + delta) % n]!;\n allowedCuts.push(\n f(\n f(corner.expectedRoundCut * roundCutRatio) +\n f(f(corner.expectedCut - corner.expectedRoundCut) * cutRatio),\n ),\n );\n }\n corners.push(corner.getCubics(allowedCuts[0]!, allowedCuts[1]));\n }\n\n // Finally, store the calculated cubics. This includes all of the rounded corners\n // from above, along with new cubics representing the edges between those corners.\n const tempFeatures: Feature[] = [];\n for (let i = 0; i < n; i++) {\n // Determine whether corner at this vertex is concave or convex, based on the\n // relationship of the prev->curr/curr->next vectors\n // Note that these indices are for pairs of values (points), they need to be\n // doubled to access the xy values in the vertices float array\n const prevVtxIndex = (i + n - 1) % n;\n const nextVtxIndex = (i + 1) % n;\n const currVertex = point(v(i * 2), v(i * 2 + 1));\n const prevVertex = point(v(prevVtxIndex * 2), v(prevVtxIndex * 2 + 1));\n const nextVertex = point(v(nextVtxIndex * 2), v(nextVtxIndex * 2 + 1));\n const convex = clockwise(minus(currVertex, prevVertex), minus(nextVertex, currVertex));\n tempFeatures.push(new Corner(corners[i]!, currVertex, roundedCorners[i]!.center, convex));\n const last = corners[i]![corners[i]!.length - 1]!;\n const first = corners[(i + 1) % n]![0]!;\n tempFeatures.push(\n new Edge([\n Cubic.straightLine(last.anchor1X, last.anchor1Y, first.anchor0X, first.anchor0Y),\n ]),\n );\n }\n\n const { x: cx, y: cy } =\n centerX === FLOAT_MIN_VALUE || centerY === FLOAT_MIN_VALUE\n ? calculateCenter(vertices)\n : point(f(centerX), f(centerY));\n return new RoundedPolygon(tempFeatures, cx, cy);\n }\n}\n\nfunction buildCubics(features: readonly Feature[]): Cubic[] {\n const out: Cubic[] = [];\n // The first/last mechanism here ensures that the final anchor point in the shape\n // exactly matches the first anchor point. There can be rendering artifacts introduced\n // by those points being slightly off, even by much less than a pixel\n let firstCubic: Cubic | null = null;\n let lastCubic: Cubic | null = null;\n let firstFeatureSplitStart: Cubic[] | null = null;\n let firstFeatureSplitEnd: Cubic[] | null = null;\n if (features.length > 0 && features[0]!.cubics.length === 3) {\n const centerCubic = features[0]!.cubics[1]!;\n const [start, end] = centerCubic.split(0.5);\n firstFeatureSplitStart = [features[0]!.cubics[0]!, start];\n firstFeatureSplitEnd = [end, features[0]!.cubics[2]!];\n }\n // iterating one past the features list size allows us to insert the initial split\n // cubic if it exists\n for (let i = 0; i <= features.length; i++) {\n let featureCubics: readonly Cubic[];\n if (i === 0 && firstFeatureSplitEnd !== null) featureCubics = firstFeatureSplitEnd;\n else if (i === features.length) {\n if (firstFeatureSplitStart !== null) featureCubics = firstFeatureSplitStart;\n else break;\n } else featureCubics = features[i]!.cubics;\n\n for (const cubic of featureCubics) {\n // Skip zero-length curves; they add nothing and can trigger rendering artifacts\n if (!cubic.zeroLength()) {\n if (lastCubic !== null) out.push(lastCubic);\n lastCubic = cubic;\n firstCubic ??= cubic;\n } else if (lastCubic !== null) {\n // Dropping several zero-ish length curves in a row can lead to\n // enough discontinuity to throw an exception later, even though the\n // distances are quite small. Account for that by making the last\n // cubic use the latest anchor point, always. (Mutates the shared cubic, as upstream.)\n lastCubic.points[6] = cubic.anchor1X;\n lastCubic.points[7] = cubic.anchor1Y;\n }\n }\n }\n if (lastCubic !== null && firstCubic !== null) {\n out.push(\n Cubic.of(\n lastCubic.anchor0X,\n lastCubic.anchor0Y,\n lastCubic.control0X,\n lastCubic.control0Y,\n lastCubic.control1X,\n lastCubic.control1Y,\n firstCubic.anchor0X,\n firstCubic.anchor0Y,\n ),\n );\n }\n return out;\n}\n\n/** 1.0.1 center estimate (divides by vertices.size, then by 2 again; see file header). */\nfunction calculateCenter(vertices: ArrayLike<number>): Point {\n let cumulativeX = 0;\n let cumulativeY = 0;\n let index = 0;\n while (index < vertices.length) {\n cumulativeX = f(cumulativeX + f(vertices[index++]!));\n cumulativeY = f(cumulativeY + f(vertices[index++]!));\n }\n return point(f(cumulativeX / vertices.length) / 2, f(cumulativeY / vertices.length) / 2);\n}\n\n/**\n * Private utility class that holds the information about each corner in a polygon. The shape of\n * the corner can be returned by calling the [getCubics] function, which will return a list of\n * curves representing the corner geometry. The shape of the corner depends on the [rounding]\n * constructor parameter.\n */\nclass RoundedCorner {\n readonly d1: Point;\n readonly d2: Point;\n readonly cornerRadius: number;\n readonly smoothing: number;\n readonly cosAngle: number;\n readonly sinAngle: number;\n readonly expectedRoundCut: number;\n /**\n * the center of the circle approximated by the rounding curve (or the middle of the three\n * curves if smoothing is requested). The center is the same as p0 if there is no rounding.\n */\n center: Point = point(0, 0);\n\n constructor(\n readonly p0: Point,\n readonly p1: Point,\n readonly p2: Point,\n readonly rounding: CornerRounding | null = null,\n ) {\n this.d1 = getDirection(minus(p0, p1));\n this.d2 = getDirection(minus(p2, p1));\n this.cornerRadius = rounding?.radius ?? 0;\n this.smoothing = rounding?.smoothing ?? 0;\n // cosine of angle at p1 is dot product of unit vectors to the other two vertices\n this.cosAngle = dotProduct(this.d1, this.d2);\n // identity: sin^2 + cos^2 = 1\n // sinAngle gives us the intersection\n this.sinAngle = f(Math.sqrt(f(1 - square(this.cosAngle))));\n // How much we need to cut, as measured on a side, to get the required radius\n // calculating where the rounding circle hits the edge\n // This uses the identity of tan(A/2) = sinA/(1 + cosA), where tan(A/2) = radius/cut\n this.expectedRoundCut =\n this.sinAngle > 1e-3 ? f(f(this.cornerRadius * f(this.cosAngle + 1)) / this.sinAngle) : 0;\n }\n\n /** smoothing changes the actual cut. 0 is same as expectedRoundCut, 1 doubles it */\n get expectedCut(): number {\n return f(f(1 + this.smoothing) * this.expectedRoundCut);\n }\n\n getCubics(allowedCut0: number, allowedCut1: number = allowedCut0): Cubic[] {\n // We use the minimum of both cuts to determine the radius, but if there is more space\n // in one side we can use it for smoothing.\n const allowedCut = Math.min(allowedCut0, allowedCut1);\n // Nothing to do, just use lines, or a point\n if (\n this.expectedRoundCut < DistanceEpsilon ||\n allowedCut < DistanceEpsilon ||\n this.cornerRadius < DistanceEpsilon\n ) {\n this.center = this.p1;\n return [Cubic.straightLine(this.p1.x, this.p1.y, this.p1.x, this.p1.y)];\n }\n // How much of the cut is required for the rounding part.\n const actualRoundCut = Math.min(allowedCut, this.expectedRoundCut);\n // We have two smoothing values, one for each side of the vertex\n // Space is used for rounding values first. If there is space left over, then we\n // apply smoothing, if it was requested\n const actualSmoothing0 = this.calculateActualSmoothingValue(allowedCut0);\n const actualSmoothing1 = this.calculateActualSmoothingValue(allowedCut1);\n // Scale the radius if needed\n const actualR = f(f(this.cornerRadius * actualRoundCut) / this.expectedRoundCut);\n // Distance from the corner (p1) to the center\n const centerDistance = f(Math.sqrt(f(square(actualR) + square(actualRoundCut))));\n // Center of the arc we will use for rounding\n this.center = plus(\n this.p1,\n times(getDirection(div(plus(this.d1, this.d2), 2)), centerDistance),\n );\n const circleIntersection0 = plus(this.p1, times(this.d1, actualRoundCut));\n const circleIntersection2 = plus(this.p1, times(this.d2, actualRoundCut));\n const flanking0 = this.computeFlankingCurve(\n actualRoundCut,\n actualSmoothing0,\n this.p1,\n this.p0,\n circleIntersection0,\n circleIntersection2,\n this.center,\n actualR,\n );\n const flanking2 = this.computeFlankingCurve(\n actualRoundCut,\n actualSmoothing1,\n this.p1,\n this.p2,\n circleIntersection2,\n circleIntersection0,\n this.center,\n actualR,\n ).reverse();\n return [\n flanking0,\n Cubic.circularArc(\n this.center.x,\n this.center.y,\n flanking0.anchor1X,\n flanking0.anchor1Y,\n flanking2.anchor0X,\n flanking2.anchor0Y,\n ),\n flanking2,\n ];\n }\n\n /**\n * If allowedCut (the amount we are able to cut) is greater than the expected cut (without\n * smoothing applied yet), then there is room to apply smoothing and we calculate the actual\n * smoothing value here.\n */\n private calculateActualSmoothingValue(allowedCut: number): number {\n if (allowedCut > this.expectedCut) return this.smoothing;\n if (allowedCut > this.expectedRoundCut) {\n return f(\n f(this.smoothing * f(allowedCut - this.expectedRoundCut)) /\n f(this.expectedCut - this.expectedRoundCut),\n );\n }\n return 0;\n }\n\n /**\n * Compute a single flanking curve for this corner: from the side start to the rounding circle,\n * smoothed by [actualSmoothingValues].\n */\n private computeFlankingCurve(\n actualRoundCut: number,\n actualSmoothingValues: number,\n corner: Point,\n sideStart: Point,\n circleSegmentIntersection: Point,\n otherCircleSegmentIntersection: Point,\n circleCenter: Point,\n actualR: number,\n ): Cubic {\n // sideStart is the anchor, 'anchor' is actual control point\n const sideDirection = getDirection(minus(sideStart, corner));\n const curveStart = plus(\n corner,\n times(times(sideDirection, actualRoundCut), f(1 + actualSmoothingValues)),\n );\n // We use an approximation to cut a part of the circle section proportional to 1 - smooth,\n // When smooth = 0, we take the full section, when smooth = 1, we take nothing.\n const p = interpolatePoint(\n circleSegmentIntersection,\n div(plus(circleSegmentIntersection, otherCircleSegmentIntersection), 2),\n actualSmoothingValues,\n );\n // The flanking curve ends on the circle\n const curveEnd = plus(\n circleCenter,\n times(directionVector(f(p.x - circleCenter.x), f(p.y - circleCenter.y)), actualR),\n );\n // The anchor on the circle segment side is in the intersection between the tangent to the\n // circle in the circle/flanking curve boundary and the linear segment.\n const circleTangent = rotate90(minus(curveEnd, circleCenter));\n const anchorEnd =\n lineIntersection(sideStart, sideDirection, curveEnd, circleTangent) ??\n circleSegmentIntersection;\n // From what remains, we pick a point for the start anchor.\n // 2/3 seems to come from design tools?\n const anchorStart = div(plus(curveStart, times(anchorEnd, 2)), 3);\n return Cubic.fromPoints(curveStart, anchorStart, anchorEnd, curveEnd);\n }\n}\n\n/**\n * Returns the intersection point of the two lines d0->d1 and p0->p1, or null if the lines do not\n * intersect\n */\nfunction lineIntersection(p0: Point, d0: Point, p1: Point, d1: Point): Point | null {\n const rotatedD1 = rotate90(d1);\n const den = dotProduct(d0, rotatedD1);\n if (Math.abs(den) < DistanceEpsilon) return null;\n const num = dotProduct(minus(p1, p0), rotatedD1);\n // Also check the relative value. This is equivalent to abs(den/num) < DistanceEpsilon,\n // but avoid doing a division\n if (Math.abs(den) < f(DistanceEpsilon * Math.abs(num))) return null;\n const k = f(num / den);\n return plus(p0, times(d0, k));\n}\n\nfunction verticesFromNumVerts(\n numVertices: number,\n radius: number,\n centerX: number,\n centerY: number,\n): number[] {\n const result: number[] = [];\n for (let i = 0; i < numVertices; i++) {\n const vertex = plus(\n radialToCartesian(f(radius), f(f(f(FloatPi / numVertices) * 2) * i)),\n point(centerX, centerY),\n );\n result.push(vertex.x, vertex.y);\n }\n return result;\n}\n","/*\n * Copyright 2022 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from commonMain/androidx/graphics/shapes/Shapes.kt@androidx.graphics:graphics-shapes:1.0.1 (sources jar)\n//\n// Kotlin companion extensions (`RoundedPolygon.circle(...)`) become free functions.\n\nimport { CornerRounding } from './corner-rounding.js';\nimport { type Point, plus, point } from './point.js';\nimport { RoundedPolygon } from './rounded-polygon.js';\nimport { FloatPi, TwoPi, f, interpolate, radialToCartesian } from './utils.js';\n\n/**\n * Creates a circular shape, approximating the rounding of the shape around the underlying polygon\n * vertices.\n */\nexport function circle(\n options: { numVertices?: number; radius?: number; centerX?: number; centerY?: number } = {},\n): RoundedPolygon {\n const { numVertices = 8 } = options;\n const radius = f(options.radius ?? 1);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (numVertices < 3) throw new Error('Circle must have at least three vertices');\n\n // Half of the angle between two adjacent vertices on the polygon\n const theta = f(FloatPi / numVertices);\n // Radius of the underlying RoundedPolygon object given the desired radius of the circle\n const polygonRadius = f(radius / f(Math.cos(theta)));\n return RoundedPolygon.fromVertexCount(numVertices, {\n rounding: new CornerRounding(radius),\n radius: polygonRadius,\n centerX,\n centerY,\n });\n}\n\n/** Creates a rectangular shape with the given width/height around the given center. */\nexport function rectangle(\n options: {\n width?: number;\n height?: number;\n rounding?: CornerRounding;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const { rounding = CornerRounding.Unrounded, perVertexRounding = null } = options;\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 2);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n const left = f(centerX - f(width / 2));\n const top = f(centerY - f(height / 2));\n const right = f(centerX + f(width / 2));\n const bottom = f(centerY + f(height / 2));\n return RoundedPolygon.fromVertices([right, bottom, left, bottom, left, top, right, top], {\n rounding,\n perVertexRounding,\n centerX,\n centerY,\n });\n}\n\n/**\n * Creates a star polygon, which is like a regular polygon except every other vertex is on either\n * an inner or outer radius.\n */\nexport function star(\n numVerticesPerRadius: number,\n options: {\n radius?: number;\n innerRadius?: number;\n rounding?: CornerRounding;\n innerRounding?: CornerRounding | null;\n perVertexRounding?: readonly CornerRounding[] | null;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const { rounding = CornerRounding.Unrounded, innerRounding = null } = options;\n const radius = f(options.radius ?? 1);\n const innerRadius = f(options.innerRadius ?? 0.5);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (radius <= 0 || innerRadius <= 0) throw new Error('Star radii must both be greater than 0');\n if (innerRadius >= radius) throw new Error('innerRadius must be less than radius');\n\n let pvRounding = options.perVertexRounding ?? null;\n // If no per-vertex rounding supplied and caller asked for inner rounding,\n // create per-vertex rounding list based on supplied outer/inner rounding parameters\n if (pvRounding === null && innerRounding !== null) {\n pvRounding = Array.from({ length: numVerticesPerRadius }, () => [\n rounding,\n innerRounding,\n ]).flat();\n }\n\n // Star polygon is just a polygon with all vertices supplied (where we generate\n // those vertices to be on the inner/outer radii)\n return RoundedPolygon.fromVertices(\n starVerticesFromNumVerts(numVerticesPerRadius, radius, innerRadius, centerX, centerY),\n { rounding, perVertexRounding: pvRounding, centerX, centerY },\n );\n}\n\n/**\n * A pill shape consists of a rectangle shape bounded by two semicircles at either of the long\n * ends of the rectangle.\n */\nexport function pill(\n options: {\n width?: number;\n height?: number;\n smoothing?: number;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 1);\n const smoothing = f(options.smoothing ?? 0);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (!(width > 0 && height > 0))\n throw new Error('Pill shapes must have positive width and height');\n const wHalf = f(width / 2);\n const hHalf = f(height / 2);\n return RoundedPolygon.fromVertices(\n [\n f(wHalf + centerX),\n f(hHalf + centerY),\n f(-wHalf + centerX),\n f(hHalf + centerY),\n f(-wHalf + centerX),\n f(-hHalf + centerY),\n f(wHalf + centerX),\n f(-hHalf + centerY),\n ],\n { rounding: new CornerRounding(Math.min(wHalf, hHalf), smoothing), centerX, centerY },\n );\n}\n\n/**\n * A pillStar shape is like a [pill] except it has inner and outer radii along its pill-shaped\n * outline, just like a [star] has inner and outer radii along its circular outline.\n */\nexport function pillStar(\n options: {\n width?: number;\n height?: number;\n numVerticesPerRadius?: number;\n innerRadiusRatio?: number;\n rounding?: CornerRounding;\n innerRounding?: CornerRounding | null;\n perVertexRounding?: readonly CornerRounding[] | null;\n vertexSpacing?: number;\n startLocation?: number;\n centerX?: number;\n centerY?: number;\n } = {},\n): RoundedPolygon {\n const {\n numVerticesPerRadius = 8,\n rounding = CornerRounding.Unrounded,\n innerRounding = null,\n } = options;\n const width = f(options.width ?? 2);\n const height = f(options.height ?? 1);\n const innerRadiusRatio = f(options.innerRadiusRatio ?? 0.5);\n const vertexSpacing = f(options.vertexSpacing ?? 0.5);\n const startLocation = f(options.startLocation ?? 0);\n const centerX = f(options.centerX ?? 0);\n const centerY = f(options.centerY ?? 0);\n if (!(width > 0 && height > 0))\n throw new Error('Pill shapes must have positive width and height');\n if (!(innerRadiusRatio > 0 && innerRadiusRatio <= 1)) {\n throw new Error('innerRadius must be between 0 and 1');\n }\n let pvRounding = options.perVertexRounding ?? null;\n // If no per-vertex rounding supplied and caller asked for inner rounding,\n // create per-vertex rounding list based on supplied outer/inner rounding parameters\n if (pvRounding === null && innerRounding !== null) {\n pvRounding = Array.from({ length: numVerticesPerRadius }, () => [\n rounding,\n innerRounding,\n ]).flat();\n }\n return RoundedPolygon.fromVertices(\n pillStarVerticesFromNumVerts(\n numVerticesPerRadius,\n width,\n height,\n innerRadiusRatio,\n vertexSpacing,\n startLocation,\n centerX,\n centerY,\n ),\n { rounding, perVertexRounding: pvRounding, centerX, centerY },\n );\n}\n\nfunction pillStarVerticesFromNumVerts(\n numVerticesPerRadius: number,\n width: number,\n height: number,\n innerRadius: number,\n vertexSpacing: number,\n startLocation: number,\n centerX: number,\n centerY: number,\n): number[] {\n // The general approach here is to get the perimeter of the underlying pill outline,\n // then the t value for each vertex as we walk that perimeter. This tells us where\n // on the outline to place that vertex, then we figure out where to place the vertex\n // depending on which \"section\" it is in. The possible sections are the vertical edges\n // on the sides, the circular sections on all four corners, or the horizontal edges\n // on the top and bottom. Note that either the vertical or horizontal edges will be\n // of length zero (whichever dimension is smaller gets only circular curvature for the\n // pill shape).\n const endcapRadius = Math.min(width, height);\n const vSegLen = Math.max(f(height - width), 0);\n const hSegLen = Math.max(f(width - height), 0);\n const vSegHalf = f(vSegLen / 2);\n const hSegHalf = f(hSegLen / 2);\n // vertexSpacing is used to position the vertices on the end caps. The caller has the choice\n // of spacing the inner (0) or outer (1) vertices like those along the edges, causing the\n // other vertices to be either further apart (0) or closer (1). The default is .5, which\n // averages things. The magnitude of the inner and rounding parameters may cause the caller\n // to want a different value.\n const circlePerimeter = f(f(TwoPi * endcapRadius) * interpolate(innerRadius, 1, vertexSpacing));\n // perimeter is circle perimeter plus horizontal and vertical sections of inner rectangle,\n // whether either (or even both) might be of length zero.\n const perimeter = f(f(f(2 * hSegLen) + f(2 * vSegLen)) + circlePerimeter);\n\n // The sections array holds the t start values of that part of the outline. We use these to\n // determine which section a given vertex lies in, based on its t value, as well as where\n // in that section it lies.\n const sections = new Float32Array(11);\n const quarter = f(circlePerimeter / 4);\n sections[0] = 0;\n sections[1] = vSegLen / 2;\n sections[2] = sections[1] + quarter;\n sections[3] = sections[2] + hSegLen;\n sections[4] = sections[3] + quarter;\n sections[5] = sections[4] + vSegLen;\n sections[6] = sections[5] + quarter;\n sections[7] = sections[6] + hSegLen;\n sections[8] = sections[7] + quarter;\n sections[9] = sections[8] + f(vSegLen / 2);\n sections[10] = perimeter;\n\n // \"t\" is the length along the entire pill outline for a given vertex. With vertices spaced\n // evenly along this contour, we can determine for any vertex where it should lie.\n const tPerVertex = f(perimeter / (2 * numVerticesPerRadius));\n // separate iteration for inner vs outer, unlike the other shapes, because\n // the vertices can lie in different quadrants so each needs their own calculation\n let inner = false;\n // Increment section index as we walk around the pill contour with our increasing t values\n let currSecIndex = 0;\n // secStart/End are used to determine how far along a given vertex is in the section\n // in which it lands\n let secStart = 0;\n let secEnd = sections[1];\n // t value is used to place each vertex. 0 is on the positive x axis,\n // moving into section 0 to begin with. startLocation, a value from 0 to 1, varies the location\n // anywhere on the perimeter of the shape\n let t = f(startLocation * perimeter);\n // The list of vertices to be returned\n const result: number[] = [];\n const rectBR = point(hSegHalf, vSegHalf);\n const rectBL = point(-hSegHalf, vSegHalf);\n const rectTL = point(-hSegHalf, -vSegHalf);\n const rectTR = point(hSegHalf, -vSegHalf);\n // Each iteration through this loop uses the next t value as we walk around the shape\n for (let i = 0; i < numVerticesPerRadius * 2; i++) {\n // t could start (and end) after 0; extra boundedT logic makes sure it does the right\n // thing when crossing the boundar past 0 again\n const boundedT = f(t % perimeter);\n if (boundedT < secStart) currSecIndex = 0;\n while (boundedT >= sections[(currSecIndex + 1) % sections.length]!) {\n currSecIndex = (currSecIndex + 1) % sections.length;\n secStart = sections[currSecIndex]!;\n secEnd = sections[(currSecIndex + 1) % sections.length]!;\n }\n // find t in section and its proportion of that section total length\n const tInSection = f(boundedT - secStart);\n const tProportion = f(tInSection / f(secEnd - secStart));\n const halfArc = f(f(tProportion * FloatPi) / 2);\n\n // The vertex placement in a section varies depending on whether it is on one of the\n // semicircle endcaps or along one of the straight edges. For the endcaps, we use\n // tProportion to get the angle along that circular cap and add\n // the starting angle for that section. For the edges we use a straight linear calculation\n // given tProportion and the start/end t values for that edge.\n const currRadius = inner ? f(endcapRadius * innerRadius) : endcapRadius;\n let vertex: Point;\n switch (currSecIndex) {\n case 0:\n vertex = point(currRadius, f(tProportion * vSegHalf));\n break;\n case 1:\n vertex = plus(radialToCartesian(currRadius, halfArc), rectBR);\n break;\n case 2:\n vertex = point(f(hSegHalf - f(tProportion * hSegLen)), currRadius);\n break;\n case 3:\n vertex = plus(radialToCartesian(currRadius, f(f(FloatPi / 2) + halfArc)), rectBL);\n break;\n case 4:\n vertex = point(-currRadius, f(vSegHalf - f(tProportion * vSegLen)));\n break;\n case 5:\n vertex = plus(radialToCartesian(currRadius, f(FloatPi + halfArc)), rectTL);\n break;\n case 6:\n vertex = point(f(-hSegHalf + f(tProportion * hSegLen)), -currRadius);\n break;\n case 7:\n vertex = plus(radialToCartesian(currRadius, f(f(FloatPi * 1.5) + halfArc)), rectTR);\n break;\n default: // 8\n vertex = point(currRadius, f(-vSegHalf + f(tProportion * vSegHalf)));\n }\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n t = f(t + tPerVertex);\n inner = !inner;\n }\n return result;\n}\n\nfunction starVerticesFromNumVerts(\n numVerticesPerRadius: number,\n radius: number,\n innerRadius: number,\n centerX: number,\n centerY: number,\n): number[] {\n const result: number[] = [];\n for (let i = 0; i < numVerticesPerRadius; i++) {\n let vertex = radialToCartesian(radius, f(f(f(FloatPi / numVerticesPerRadius) * 2) * i));\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n vertex = radialToCartesian(innerRadius, f(f(FloatPi / numVerticesPerRadius) * (2 * i + 1)));\n result.push(f(vertex.x + centerX), f(vertex.y + centerY));\n }\n return result;\n}\n","/*\n * Copyright 2020 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Matrix.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Only the subset MaterialShapes and ShapeUtil use: identity, rotateZ, scale and map(point).\n// Values are stored and computed as float32, like Compose's FloatArray math.\n\nconst f = Math.fround;\n\n/** A 4x4 matrix, row-major as in Compose (`this[row, column]`). Identity when created. */\nexport class Matrix {\n readonly values: Float32Array = new Float32Array([\n 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,\n ]);\n\n get(row: number, column: number): number {\n return this.values[row * 4 + column] ?? 0;\n }\n\n set(row: number, column: number, v: number): void {\n this.values[row * 4 + column] = v;\n }\n\n /** Does the 3D transform on the point and returns its `x` and `y` values. */\n map(x: number, y: number): readonly [number, number] {\n const v00 = this.get(0, 0);\n const v01 = this.get(0, 1);\n const v03 = this.get(0, 3);\n const v10 = this.get(1, 0);\n const v11 = this.get(1, 1);\n const v13 = this.get(1, 3);\n const v30 = this.get(3, 0);\n const v31 = this.get(3, 1);\n const v33 = this.get(3, 3);\n\n const z = f(f(f(v03 * x) + f(v13 * y)) + v33);\n const inverseZ = f(1 / z);\n const pZ = Number.isFinite(inverseZ) ? inverseZ : 0;\n\n return [\n f(pZ * f(f(f(v00 * x) + f(v10 * y)) + v30)),\n f(pZ * f(f(f(v01 * x) + f(v11 * y)) + v31)),\n ];\n }\n\n /** Applies a rotation of [degrees] around Z to `this`. */\n rotateZ(degrees: number): this {\n const r = f(degrees) * (Math.PI / 180);\n const s = Math.fround(Math.sin(r));\n const c = Math.fround(Math.cos(r));\n for (let column = 0; column < 4; column++) {\n const a0 = this.get(0, column);\n const a1 = this.get(1, column);\n this.set(0, column, f(c * a0) + f(s * a1));\n this.set(1, column, f(-s * a0) + f(c * a1));\n }\n return this;\n }\n\n /** Scales this matrix by [x], [y], [z]. */\n scale(x = 1, y = 1, z = 1): this {\n for (let column = 0; column < 4; column++) {\n this.set(0, column, this.get(0, column) * f(x));\n this.set(1, column, this.get(1, column) * f(y));\n this.set(2, column, this.get(2, column) * f(z));\n }\n return this;\n }\n}\n","// Minimal path model standing in for Compose's `Path` in the ShapeUtil/MaterialShapes ports: an\n// ordered command list (absolute coordinates) that serializes to an SVG `d` attribute.\nimport type { Matrix } from './matrix.js';\n\nexport type PathCommand =\n | readonly ['M', number, number]\n | readonly ['L', number, number]\n | readonly ['Q', number, number, number, number]\n | readonly ['C', number, number, number, number, number, number]\n | readonly ['Z'];\n\nconst mapPoints = (\n command: PathCommand,\n f: (x: number, y: number) => readonly [number, number],\n): PathCommand => {\n switch (command[0]) {\n case 'M':\n case 'L':\n return [command[0], ...f(command[1], command[2])];\n case 'Q':\n return ['Q', ...f(command[1], command[2]), ...f(command[3], command[4])];\n case 'C':\n return [\n 'C',\n ...f(command[1], command[2]),\n ...f(command[3], command[4]),\n ...f(command[5], command[6]),\n ];\n case 'Z':\n return command;\n }\n};\n\n/** Compose `Path.transform(matrix)`: maps every point. */\nexport const transformPath = (path: readonly PathCommand[], matrix: Matrix): PathCommand[] =>\n path.map((command) => mapPoints(command, (x, y) => matrix.map(x, y)));\n\n/** Compose `Path.translate(offset)`. */\nexport const translatePath = (\n path: readonly PathCommand[],\n dx: number,\n dy: number,\n): PathCommand[] => path.map((command) => mapPoints(command, (x, y) => [x + dx, y + dy]));\n\n/**\n * Compose `Path.getBounds()`: `[left, top, right, bottom]` over every point, control points\n * included (Skia's `SkPath::getBounds`). Empty paths give `[0, 0, 0, 0]`.\n */\nexport function pathBounds(path: readonly PathCommand[]): [number, number, number, number] {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const command of path) {\n for (let i = 1; i + 1 < command.length; i += 2) {\n const x = command[i] as number;\n const y = command[i + 1] as number;\n left = Math.min(left, x);\n top = Math.min(top, y);\n right = Math.max(right, x);\n bottom = Math.max(bottom, y);\n }\n }\n return left === Infinity ? [0, 0, 0, 0] : [left, top, right, bottom];\n}\n\nconst formatNumber = (value: number, fractionDigits: number): string => {\n const fixed = value.toFixed(fractionDigits);\n const text = fixed.includes('.') ? fixed.replace(/\\.?0+$/, '') : fixed;\n return text === '-0' ? '0' : text;\n};\n\n/**\n * Serializes a path to an SVG `d` attribute with absolute commands. [fractionDigits] bounds the\n * decimals per number (trailing zeros dropped).\n */\nexport function toSvgPathData(path: readonly PathCommand[], fractionDigits = 4): string {\n return path\n .map(([verb, ...values]) =>\n values.length === 0\n ? verb\n : `${verb}${values.map((v) => formatNumber(v, fractionDigits)).join(' ')}`,\n )\n .join('');\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/ShapeUtil.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n\nimport type { Cubic } from './graphics-shapes/cubic.js';\nimport type { Morph } from './graphics-shapes/morph.js';\nimport type { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, transformPath } from './path.js';\n\n/** Transforms a [RoundedPolygon] with the given [Matrix]. */\nexport const transformedByMatrix = (polygon: RoundedPolygon, matrix: Matrix): RoundedPolygon =>\n polygon.transformed((x, y) => matrix.map(x, y));\n\nexport interface PathOptions {\n /**\n * Angle in degrees the path starts drawing from. Note that, as in Compose, the path is rotated\n * around the origin; the pivot only measures the angle of the first anchor.\n */\n startAngle?: number;\n /** Draws the outline twice (for stroke animations). */\n repeatPath?: boolean;\n /** Closes the path. */\n closePath?: boolean;\n}\n\n// Defaults follow the public wrappers in MaterialShapes.kt (`startAngle = 0`: start at 3 o'clock);\n// the internal ShapeUtil functions default to 270 (12 o'clock).\n\n/** Path for a [RoundedPolygon]; the start angle is measured around its center. */\nexport function polygonToPath(polygon: RoundedPolygon, options: PathOptions = {}): PathCommand[] {\n const { startAngle = 0, repeatPath = false, closePath = true } = options;\n return pathFromCubics(\n startAngle,\n repeatPath,\n closePath,\n polygon.cubics,\n polygon.centerX,\n polygon.centerY,\n );\n}\n\nexport interface MorphPathOptions extends PathOptions {\n rotationPivotX?: number;\n rotationPivotY?: number;\n}\n\n/** Path for a [Morph] at [progress]; the start angle is measured around the rotation pivot. */\nexport function morphToPath(\n morph: Morph,\n progress: number,\n options: MorphPathOptions = {},\n): PathCommand[] {\n const {\n startAngle = 0,\n repeatPath = false,\n closePath = true,\n rotationPivotX = 0,\n rotationPivotY = 0,\n } = options;\n return pathFromCubics(\n startAngle,\n repeatPath,\n closePath,\n morph.asCubics(progress),\n rotationPivotX,\n rotationPivotY,\n );\n}\n\nfunction pathFromCubics(\n startAngle: number,\n repeatPath: boolean,\n closePath: boolean,\n cubics: readonly Cubic[],\n rotationPivotX: number,\n rotationPivotY: number,\n): PathCommand[] {\n const path: PathCommand[] = [];\n const first = cubics[0];\n if (first !== undefined) path.push(['M', first.anchor0X, first.anchor0Y]);\n const addCubics = () => {\n for (const it of cubics) {\n path.push([\n 'C',\n it.control0X,\n it.control0Y,\n it.control1X,\n it.control1Y,\n it.anchor1X,\n it.anchor1Y,\n ]);\n }\n };\n addCubics();\n if (repeatPath && first !== undefined) {\n path.push(['L', first.anchor0X, first.anchor0Y]);\n addCubics();\n }\n\n if (closePath) path.push(['Z']);\n\n if (startAngle !== 0 && first !== undefined) {\n const f = Math.fround;\n const angleToFirstCubic = radiansToDegrees(\n f(Math.atan2(f(first.anchor0Y - rotationPivotY), f(first.anchor0X - rotationPivotX))),\n );\n // Rotate the Path to to start from the given angle.\n return transformPath(path, new Matrix().rotateZ(f(-angleToFirstCubic + startAngle)));\n }\n return path;\n}\n\nconst radiansToDegrees = (radians: number): number => Math.fround((radians * 180) / Math.PI);\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/MaterialShapes.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// Float32-faithful like the graphics-shapes port (see graphics-shapes/utils.ts): Kotlin float\n// literals and every Float operation go through `f` (Math.fround).\n\nimport { CornerRounding } from './graphics-shapes/corner-rounding.js';\nimport { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { circle, rectangle, star } from './graphics-shapes/shapes.js';\nimport { FloatPi, f } from './graphics-shapes/utils.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, pathBounds, transformPath, translatePath } from './path.js';\nimport { polygonToPath, transformedByMatrix } from './shape-util.js';\n\n/**\n * The outline Compose's `RoundedPolygon.toShape(startAngle).createOutline(size, …)` produces: the\n * path scaled to [width] x [height], then centered by its control-point bounds.\n */\nexport function toShapeOutline(\n polygon: RoundedPolygon,\n width: number,\n height: number,\n startAngle = 0,\n): PathCommand[] {\n const shapePath = polygonToPath(polygon, { startAngle });\n // Scale and translate the path to align its center with the available size center.\n const path = transformPath(shapePath, new Matrix().scale(width, height));\n const [left, top, right, bottom] = pathBounds(path);\n return translatePath(path, width / 2 - (left + right) / 2, height / 2 - (top + bottom) / 2);\n}\n\n// Cache various roundings for use below\nconst cornerRound15 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.15));\nconst cornerRound20 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.2));\nconst cornerRound30 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.3));\nconst cornerRound50 = /* @__PURE__ */ new CornerRounding(/* @__PURE__ */ f(0.5));\nconst cornerRound100 = /* @__PURE__ */ new CornerRounding(1);\n\n// A function call, so the module constants below can carry a `@__PURE__` annotation (an\n// annotated `new Matrix().rotateZ(…)` chain is ambiguous to bundlers).\nconst rotationZ = (degrees: number): Matrix => new Matrix().rotateZ(degrees);\n\nconst rotateNeg45 = /* @__PURE__ */ rotationZ(-45);\nconst rotateNeg90 = /* @__PURE__ */ rotationZ(-90);\nconst rotateNeg135 = /* @__PURE__ */ rotationZ(-135);\n\ninterface PointNRound {\n readonly x: number;\n readonly y: number;\n readonly r: CornerRounding;\n}\n\n/** `PointNRound(Offset(x, y), r)` with Kotlin float literals. */\nconst pnr = (x: number, y: number, r: CornerRounding = CornerRounding.Unrounded): PointNRound => ({\n x: f(x),\n y: f(y),\n r,\n});\n\n/** `CornerRounding(radius, smoothing)` with Kotlin float literals. */\nconst cr = (radius: number, smoothing = 0): CornerRounding => new CornerRounding(radius, smoothing);\n\nconst toRadians = (degrees: number): number => f(f(f(degrees / 360) * 2) * FloatPi);\n\nconst angleDegrees = (x: number, y: number): number => f(f(f(Math.atan2(y, x)) * 180) / FloatPi);\n\nfunction rotateDegrees(\n p: PointNRound,\n angle: number,\n centerX: number,\n centerY: number,\n): PointNRound {\n const a = toRadians(angle);\n const cos = f(Math.cos(a));\n const sin = f(Math.sin(a));\n const offX = f(p.x - centerX);\n const offY = f(p.y - centerY);\n return {\n x: f(f(f(offX * cos) - f(offY * sin)) + centerX),\n y: f(f(f(offX * sin) + f(offY * cos)) + centerY),\n r: p.r,\n };\n}\n\nfunction doRepeat(\n points: readonly PointNRound[],\n reps: number,\n centerX: number,\n centerY: number,\n mirroring: boolean,\n): PointNRound[] {\n const out: PointNRound[] = [];\n if (mirroring) {\n const angles = points.map((it) => angleDegrees(f(it.x - centerX), f(it.y - centerY)));\n const distances = points.map((it) => {\n const x = f(it.x - centerX);\n const y = f(it.y - centerY);\n return f(Math.sqrt(f(f(x * x) + f(y * y))));\n });\n const actualReps = reps * 2;\n const sectionAngle = f(360 / actualReps);\n for (let it = 0; it < actualReps; it++) {\n for (let index = 0; index < points.length; index++) {\n const i = it % 2 === 0 ? index : points.length - 1 - index;\n if (i > 0 || it % 2 === 0) {\n const angle = angles[i] ?? 0;\n const a = toRadians(\n f(\n f(sectionAngle * it) +\n (it % 2 === 0 ? angle : f(f(sectionAngle - angle) + f(2 * (angles[0] ?? 0)))),\n ),\n );\n const distance = distances[i] ?? 0;\n out.push({\n x: f(f(f(Math.cos(a)) * distance) + centerX),\n y: f(f(f(Math.sin(a)) * distance) + centerY),\n r: points[i]?.r ?? CornerRounding.Unrounded,\n });\n }\n }\n }\n } else {\n const np = points.length;\n for (let it = 0; it < np * reps; it++) {\n const p = points[it % np];\n if (p) out.push(rotateDegrees(p, f((Math.trunc(it / np) * 360) / reps), centerX, centerY));\n }\n }\n return out;\n}\n\nfunction customPolygon(\n points: readonly PointNRound[],\n reps: number,\n mirroring = false,\n): RoundedPolygon {\n // Every MaterialShapes polygon uses the default center, Offset(0.5f, 0.5f).\n const centerX = 0.5;\n const centerY = 0.5;\n const actualPoints = doRepeat(points, reps, centerX, centerY, mirroring);\n return RoundedPolygon.fromVertices(\n actualPoints.flatMap((p) => [p.x, p.y]),\n { perVertexRounding: actualPoints.map((p) => p.r), centerX, centerY },\n );\n}\n\n// The builders, in MaterialShapes.kt order.\nconst builders = {\n Circle: () => circle({ numVertices: 10 }),\n Square: () => rectangle({ width: 1, height: 1, rounding: cornerRound30 }),\n Slanted: () =>\n customPolygon([pnr(0.926, 0.97, cr(0.189, 0.811)), pnr(-0.021, 0.967, cr(0.187, 0.057))], 2),\n Arch: () =>\n transformedByMatrix(\n RoundedPolygon.fromVertexCount(4, {\n perVertexRounding: [cornerRound100, cornerRound100, cornerRound20, cornerRound20],\n }),\n rotateNeg135,\n ),\n Fan: () =>\n customPolygon(\n [\n pnr(1.004, 1.0, cr(0.148, 0.417)),\n pnr(0.0, 1.0, cr(0.151)),\n pnr(0.0, -0.003, cr(0.148)),\n pnr(0.978, 0.02, cr(0.803)),\n ],\n 1,\n ),\n Arrow: () =>\n customPolygon(\n [\n pnr(0.5, 0.892, cr(0.313)),\n pnr(-0.216, 1.05, cr(0.207)),\n pnr(0.499, -0.16, cr(0.215, 1.0)),\n pnr(1.225, 1.06, cr(0.211)),\n ],\n 1,\n ),\n SemiCircle: () =>\n rectangle({\n width: f(1.6),\n height: 1,\n perVertexRounding: [cornerRound20, cornerRound20, cornerRound100, cornerRound100],\n }),\n Oval: () =>\n transformedByMatrix(transformedByMatrix(circle(), new Matrix().scale(1, f(0.64))), rotateNeg45),\n Pill: () =>\n customPolygon(\n [pnr(0.961, 0.039, cr(0.426)), pnr(1.001, 0.428), pnr(1.0, 0.609, cr(1.0))],\n 2,\n true,\n ),\n Triangle: () =>\n transformedByMatrix(\n RoundedPolygon.fromVertexCount(3, { rounding: cornerRound20 }),\n rotateNeg90,\n ),\n Diamond: () => customPolygon([pnr(0.5, 1.096, cr(0.151, 0.524)), pnr(0.04, 0.5, cr(0.159))], 2),\n ClamShell: () =>\n customPolygon(\n [pnr(0.171, 0.841, cr(0.159)), pnr(-0.02, 0.5, cr(0.14)), pnr(0.17, 0.159, cr(0.159))],\n 2,\n ),\n Pentagon: () =>\n customPolygon(\n [pnr(0.5, -0.009, cr(0.172)), pnr(1.03, 0.365, cr(0.164)), pnr(0.828, 0.97, cr(0.169))],\n 1,\n true,\n ),\n Gem: () =>\n customPolygon(\n [\n pnr(0.499, 1.023, cr(0.241, 0.778)),\n pnr(-0.005, 0.792, cr(0.208)),\n pnr(0.073, 0.258, cr(0.228)),\n pnr(0.433, -0.0, cr(0.491)),\n ],\n 1,\n true,\n ),\n Sunny: () => star(8, { innerRadius: f(0.8), rounding: cornerRound15 }),\n VerySunny: () => customPolygon([pnr(0.5, 1.08, cr(0.085)), pnr(0.358, 0.843, cr(0.085))], 8),\n Cookie4Sided: () => customPolygon([pnr(1.237, 1.236, cr(0.258)), pnr(0.5, 0.918, cr(0.233))], 4),\n // 6-point cookie\n Cookie6Sided: () => customPolygon([pnr(0.723, 0.884, cr(0.394)), pnr(0.5, 1.099, cr(0.398))], 6),\n // 7-point cookie\n Cookie7Sided: () =>\n transformedByMatrix(star(7, { innerRadius: f(0.75), rounding: cornerRound50 }), rotateNeg90),\n Cookie9Sided: () =>\n transformedByMatrix(star(9, { innerRadius: f(0.8), rounding: cornerRound50 }), rotateNeg90),\n Cookie12Sided: () =>\n transformedByMatrix(star(12, { innerRadius: f(0.8), rounding: cornerRound50 }), rotateNeg90),\n Ghostish: () =>\n customPolygon(\n [\n pnr(0.5, 0, cr(1.0)),\n pnr(1, 0, cr(1.0)),\n pnr(1, 1.14, cr(0.254, 0.106)),\n pnr(0.575, 0.906, cr(0.253)),\n ],\n 1,\n true,\n ),\n Clover4Leaf: () => customPolygon([pnr(0.5, 0.074), pnr(0.725, -0.099, cr(0.476))], 4, true),\n Clover8Leaf: () => customPolygon([pnr(0.5, 0.036), pnr(0.758, -0.101, cr(0.209))], 8),\n Burst: () => customPolygon([pnr(0.5, -0.006, cr(0.006)), pnr(0.592, 0.158, cr(0.006))], 12),\n SoftBurst: () => customPolygon([pnr(0.193, 0.277, cr(0.053)), pnr(0.176, 0.055, cr(0.053))], 10),\n Boom: () => customPolygon([pnr(0.457, 0.296, cr(0.007)), pnr(0.5, -0.051, cr(0.007))], 15),\n SoftBoom: () =>\n customPolygon(\n [\n pnr(0.733, 0.454),\n pnr(0.839, 0.437, cr(0.532)),\n pnr(0.949, 0.449, cr(0.439, 1.0)),\n pnr(0.998, 0.478, cr(0.174)),\n ],\n 16,\n true,\n ),\n Flower: () =>\n customPolygon(\n [pnr(0.37, 0.187), pnr(0.416, 0.049, cr(0.381)), pnr(0.479, 0.001, cr(0.095))],\n 8,\n true,\n ),\n Puffy: () =>\n transformedByMatrix(\n customPolygon(\n [\n pnr(0.5, 0.053),\n pnr(0.545, -0.04, cr(0.405)),\n pnr(0.67, -0.035, cr(0.426)),\n pnr(0.717, 0.066, cr(0.574)),\n pnr(0.722, 0.128),\n pnr(0.777, 0.002, cr(0.36)),\n pnr(0.914, 0.149, cr(0.66)),\n pnr(0.926, 0.289, cr(0.66)),\n pnr(0.881, 0.346),\n pnr(0.94, 0.344, cr(0.126)),\n pnr(1.003, 0.437, cr(0.255)),\n ],\n 2,\n true,\n ),\n new Matrix().scale(1, f(0.742)),\n ),\n PuffyDiamond: () =>\n customPolygon(\n [pnr(0.87, 0.13, cr(0.146)), pnr(0.818, 0.357), pnr(1.0, 0.332, cr(0.853))],\n 4,\n true,\n ),\n PixelCircle: () =>\n customPolygon(\n [\n pnr(0.5, 0.0),\n pnr(0.704, 0.0),\n pnr(0.704, 0.065),\n pnr(0.843, 0.065),\n pnr(0.843, 0.148),\n pnr(0.926, 0.148),\n pnr(0.926, 0.296),\n pnr(1.0, 0.296),\n ],\n 2,\n true,\n ),\n PixelTriangle: () =>\n customPolygon(\n [\n pnr(0.11, 0.5),\n pnr(0.113, 0.0),\n pnr(0.287, 0.0),\n pnr(0.287, 0.087),\n pnr(0.421, 0.087),\n pnr(0.421, 0.17),\n pnr(0.56, 0.17),\n pnr(0.56, 0.265),\n pnr(0.674, 0.265),\n pnr(0.675, 0.344),\n pnr(0.789, 0.344),\n pnr(0.789, 0.439),\n pnr(0.888, 0.439),\n ],\n 1,\n true,\n ),\n Bun: () =>\n customPolygon(\n [pnr(0.796, 0.5), pnr(0.853, 0.518, cr(1)), pnr(0.992, 0.631, cr(1)), pnr(0.968, 1.0, cr(1))],\n 2,\n true,\n ),\n Heart: () =>\n customPolygon(\n [\n pnr(0.5, 0.268, cr(0.016)),\n pnr(0.792, -0.066, cr(0.958)),\n pnr(1.064, 0.276, cr(1.0)),\n pnr(0.501, 0.946, cr(0.129)),\n ],\n 1,\n true,\n ),\n} satisfies Record<string, () => RoundedPolygon>;\n\nexport type MaterialShapeName = keyof typeof builders;\n\n/** The 35 Material shape names, in MaterialShapes.kt order. */\nexport const materialShapeNames = /* @__PURE__ */ Object.keys(builders) as MaterialShapeName[];\n\nconst cache = new Map<MaterialShapeName, RoundedPolygon>();\n\n/**\n * A predefined Material shape as a normalized [RoundedPolygon] (fits the unit square), created on\n * first use and cached, like the `MaterialShapes.<Name>` getters.\n */\nexport function materialShape(name: MaterialShapeName): RoundedPolygon {\n let polygon = cache.get(name);\n if (polygon === undefined) {\n polygon = builders[name]().normalized();\n cache.set(name, polygon);\n }\n return polygon;\n}\n","/*\n * Copyright 2024 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/LoadingIndicator.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The geometry of Compose's LoadingIndicator, float32-faithful: the default polygon lists\n// (LoadingIndicatorDefaults), morphSequence, calculateScaleFactor, processPath, and the\n// determinate draw step of LoadingIndicatorImpl. Timing (the indeterminate morph spring and the\n// global rotation) is in @kyralabs/m3e-motion; its values are generated tokens.\n\nimport { Morph } from './graphics-shapes/morph.js';\nimport type { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { f } from './graphics-shapes/utils.js';\nimport { type MaterialShapeName, materialShape } from './material-shapes.js';\nimport { Matrix } from './matrix.js';\nimport { type PathCommand, pathBounds, toSvgPathData, transformPath } from './path.js';\nimport { morphToPath, transformedByMatrix } from './shape-util.js';\n\nconst INDETERMINATE: readonly MaterialShapeName[] = [\n 'SoftBurst',\n 'Cookie9Sided',\n 'Pentagon',\n 'Pill',\n 'Sunny',\n 'Cookie4Sided',\n 'Oval',\n];\n\n/**\n * `LoadingIndicatorDefaults.IndeterminateIndicatorPolygons`: the seven shapes the indeterminate\n * indicator morphs between, in order.\n */\nexport const indeterminateIndicatorPolygons = (): RoundedPolygon[] =>\n INDETERMINATE.map(materialShape);\n\n/**\n * `LoadingIndicatorDefaults.DeterminateIndicatorPolygons`: a circle rotated by 360° / 20 (for a\n * smoother morph into the soft burst, which is rotated by the same angle) and the soft burst.\n */\nexport const determinateIndicatorPolygons = (): RoundedPolygon[] => [\n transformedByMatrix(materialShape('Circle'), new Matrix().rotateZ(f(360 / 20))),\n materialShape('SoftBurst'),\n];\n\n/**\n * A morph between each consecutive pair of polygons (each normalized) and, when\n * [circularSequence], a final morph from the last back to the first.\n */\nexport function morphSequence(\n polygons: readonly RoundedPolygon[],\n circularSequence: boolean,\n): Morph[] {\n const morphs: Morph[] = [];\n for (let i = 0; i < polygons.length; i++) {\n if (i + 1 < polygons.length) {\n morphs.push(new Morph(polygons[i]!.normalized(), polygons[i + 1]!.normalized()));\n } else if (circularSequence) {\n // Create a morph from the last shape to the first shape\n morphs.push(new Morph(polygons[i]!.normalized(), polygons[0]!.normalized()));\n }\n }\n return morphs;\n}\n\n/**\n * The scale factor that keeps every polygon inside its box while it rotates: the smallest\n * bounds-to-max-bounds ratio (using the larger of the x and y ratios, for pill-like shapes).\n */\nexport function calculateScaleFactor(polygons: readonly RoundedPolygon[]): number {\n let scaleFactor = 1;\n const bounds = [0, 0, 0, 0];\n const maxBounds = [0, 0, 0, 0];\n for (const polygon of polygons) {\n polygon.calculateBounds(bounds);\n polygon.calculateMaxBounds(maxBounds);\n const scaleX = f(f(bounds[2]! - bounds[0]!) / f(maxBounds[2]! - maxBounds[0]!));\n const scaleY = f(f(bounds[3]! - bounds[1]!) / f(maxBounds[3]! - maxBounds[1]!));\n // We use max(scaleX, scaleY) to handle cases like a pill-shape that can throw off the\n // entire calculation.\n scaleFactor = Math.min(scaleFactor, Math.max(scaleX, scaleY));\n }\n return scaleFactor;\n}\n\n/**\n * Scales a normalized path by `size × scaleFactor` and centers it (by its control-point bounds)\n * in a `width` x `height` box.\n */\nexport function processPath(\n path: readonly PathCommand[],\n width: number,\n height: number,\n scaleFactor: number,\n): PathCommand[] {\n // Scale to the desired size.\n const scaled = transformPath(\n path,\n new Matrix().scale(f(width * scaleFactor), f(height * scaleFactor)),\n );\n // Translate the path to align its center with the available size center.\n const [left, top, right, bottom] = pathBounds(scaled);\n const dx = f(f(width / 2) - f(left + f(f(right - left) / 2)));\n const dy = f(f(height / 2) - f(top + f(f(bottom - top) / 2)));\n return scaled.map((command): PathCommand => {\n switch (command[0]) {\n case 'M':\n case 'L':\n return [command[0], f(command[1] + dx), f(command[2] + dy)];\n case 'Q':\n return [\n 'Q',\n f(command[1] + dx),\n f(command[2] + dy),\n f(command[3] + dx),\n f(command[4] + dy),\n ];\n case 'C':\n return [\n 'C',\n f(command[1] + dx),\n f(command[2] + dy),\n f(command[3] + dx),\n f(command[4] + dy),\n f(command[5] + dx),\n f(command[6] + dy),\n ];\n case 'Z':\n return command;\n }\n });\n}\n\n/** What the indicator draws in one frame: a morph at a progress, rotated about the center. */\nexport interface LoadingIndicatorFrame {\n morphIndex: number;\n morphProgress: number;\n /** Degrees, clockwise. */\n rotation: number;\n}\n\n/**\n * The determinate draw step: picks the active morph for [progress] (coerced to 0..1), its local\n * progress, and rotates counterclockwise by half a turn over the whole range.\n */\nexport function determinateFrame(progress: number, morphCount: number): LoadingIndicatorFrame {\n const value = Number.isNaN(progress) ? 0 : Math.min(Math.max(f(progress), 0), 1);\n const scaled = f(morphCount * value);\n // Adjust the active morph index according to the progress.\n const morphIndex = Math.min(Math.trunc(scaled), morphCount - 1);\n // Prevents a zero when the progress is one and we are at the last shape morph.\n const morphProgress = value === 1 && morphIndex === morphCount - 1 ? 1 : scaled % 1;\n // Rotate counterclockwise.\n return { morphIndex, morphProgress, rotation: f(-value * 180) };\n}\n\n/**\n * A loading indicator's shapes, prepared once: the morph sequence and the scale factor\n * (`calculateScaleFactor × activeIndicatorScale`, where the active indicator scale is the token\n * ratio `ActiveSize / min(ContainerWidth, ContainerHeight)`).\n */\nexport class LoadingIndicatorShapes {\n readonly morphs: readonly Morph[];\n readonly scaleFactor: number;\n\n constructor(\n polygons: readonly RoundedPolygon[],\n circularSequence: boolean,\n activeIndicatorScale: number,\n ) {\n if (polygons.length < 2) {\n throw new Error('indicatorPolygons should have, at least, two RoundedPolygons');\n }\n this.morphs = morphSequence(polygons, circularSequence);\n this.scaleFactor = f(calculateScaleFactor(polygons) * f(activeIndicatorScale));\n }\n\n /** The processed path of morph [morphIndex] at [progress] in a [size]-sided square. */\n path(morphIndex: number, progress: number, size: number): PathCommand[] {\n const morph = this.morphs[morphIndex]!;\n return processPath(\n morphToPath(morph, progress, { startAngle: 0 }),\n size,\n size,\n this.scaleFactor,\n );\n }\n\n /** {@link path} as an SVG `d` attribute. */\n pathData(morphIndex: number, progress: number, size: number): string {\n return toSvgPathData(this.path(morphIndex, progress, size));\n }\n}\n\nconst defaultShapes = new Map<string, LoadingIndicatorShapes>();\nconst customShapes = new WeakMap<readonly RoundedPolygon[], Map<string, LoadingIndicatorShapes>>();\n\n/**\n * {@link LoadingIndicatorShapes} for an indicator, built once per polygon list (null = the\n * Compose defaults for the kind), kind and active indicator scale. Morph construction is the\n * expensive part, so every indicator on a page shares it.\n */\nexport function loadingIndicatorShapes(\n polygons: readonly RoundedPolygon[] | null,\n indeterminate: boolean,\n activeIndicatorScale: number,\n): LoadingIndicatorShapes {\n const key = `${String(indeterminate)}:${String(activeIndicatorScale)}`;\n let cache = defaultShapes;\n if (polygons) {\n cache = customShapes.get(polygons) ?? new Map<string, LoadingIndicatorShapes>();\n customShapes.set(polygons, cache);\n }\n let shapes = cache.get(key);\n if (!shapes) {\n const list =\n polygons ??\n (indeterminate ? indeterminateIndicatorPolygons() : determinateIndicatorPolygons());\n shapes = new LoadingIndicatorShapes(list, indeterminate, activeIndicatorScale);\n cache.set(key, shapes);\n }\n return shapes;\n}\n","// A Compose / Skia `PathMeasure` for the paths of this package: the length of a path's first\n// contour and `getSegment(startD, stopD)` (Skia SkContourMeasure semantics: distances are clamped\n// to [0, length], `startD > stopD` gives an empty path, and `startD == stopD` a zero-length line,\n// which a round-capped stroke draws as a dot). Like Skia, curves are measured on a table of\n// samples and cut at the parameter interpolated in it; Skia samples to a 0.5px tolerance, this\n// uses a fixed number of samples per curve, so lengths differ from Android's by well under a pixel.\nimport type { PathCommand } from './path.js';\n\ntype Pts = readonly number[];\ninterface Seg {\n /** Control polygon: 2 (line), 3 (quadratic) or 4 (cubic) points, flattened. */\n p: Pts;\n /** Cumulative distance at the end of each sample (SAMPLES + 1 entries, starting at the offset). */\n d: number[];\n}\n\nconst SAMPLES = 32;\n\n/** de Casteljau point at `t` of a control polygon. */\nfunction at(p: Pts, t: number): [number, number] {\n let q = [...p];\n while (q.length > 2) {\n const next: number[] = [];\n for (let i = 0; i + 3 < q.length; i += 2) {\n next.push(q[i]! + (q[i + 2]! - q[i]!) * t, q[i + 1]! + (q[i + 3]! - q[i + 1]!) * t);\n }\n q = next;\n }\n return [q[0]!, q[1]!];\n}\n\n/** The part of a control polygon from `t0` to `t1` (de Casteljau splits). */\nfunction sub(p: Pts, t0: number, t1: number): number[] {\n // Split at t1 keeping the left part, then at t0 / t1 keeping the right part.\n const left = (q: Pts, t: number): number[] => {\n const out: number[] = [q[0]!, q[1]!];\n let r = [...q];\n while (r.length > 2) {\n const next: number[] = [];\n for (let i = 0; i + 3 < r.length; i += 2) {\n next.push(r[i]! + (r[i + 2]! - r[i]!) * t, r[i + 1]! + (r[i + 3]! - r[i + 1]!) * t);\n }\n out.push(next[0]!, next[1]!);\n r = next;\n }\n return out;\n };\n const reverse = (q: Pts) => {\n const out: number[] = [];\n for (let i = q.length - 2; i >= 0; i -= 2) out.push(q[i]!, q[i + 1]!);\n return out;\n };\n const head = t1 < 1 ? left(p, t1) : [...p];\n const s = t1 > 0 ? t0 / t1 : 0;\n return s > 0 ? reverse(left(reverse(head), 1 - s)) : head;\n}\n\nconst command = (p: Pts): PathCommand =>\n p.length === 4\n ? ['L', p[2]!, p[3]!]\n : p.length === 6\n ? ['Q', p[2]!, p[3]!, p[4]!, p[5]!]\n : ['C', p[2]!, p[3]!, p[4]!, p[5]!, p[6]!, p[7]!];\n\nexport class PathMeasure {\n readonly #segs: Seg[] = [];\n /** Length of the first contour. */\n readonly length: number = 0;\n\n /**\n * Measures the first contour of `path`. With `forceClosed` (or a `Z`), a closing line back to\n * the contour's start is part of it.\n */\n constructor(path: readonly PathCommand[], forceClosed = false) {\n let x = 0;\n let y = 0;\n let startX = 0;\n let startY = 0;\n let total = 0;\n let started = false;\n let closed = forceClosed;\n const add = (p: Pts) => {\n const d = [total];\n let [px, py] = [p[0]!, p[1]!];\n for (let i = 1; i <= SAMPLES; i++) {\n const [qx, qy] = at(p, i / SAMPLES);\n total += Math.hypot(qx - px, qy - py);\n d.push(total);\n px = qx;\n py = qy;\n }\n // Zero-length segments are skipped, as in Skia.\n if (total > d[0]!) this.#segs.push({ p, d });\n };\n for (const c of path) {\n if (c[0] === 'M') {\n if (started) break;\n started = true;\n [x, y, startX, startY] = [c[1], c[2], c[1], c[2]];\n continue;\n }\n if (c[0] === 'Z') {\n closed = true;\n break;\n }\n const p = [x, y, ...c.slice(1)] as number[];\n add(p);\n x = p[p.length - 2]!;\n y = p[p.length - 1]!;\n }\n if (closed && (x !== startX || y !== startY)) add([x, y, startX, startY]);\n this.length = total;\n }\n\n /** The segment and its parameter at distance `d` (0 ≤ d ≤ length). */\n #find(d: number): [Seg, number] {\n const segs = this.#segs;\n let i = 0;\n while (i < segs.length - 1 && segs[i]!.d[SAMPLES]! < d) i++;\n const seg = segs[i]!;\n let k = 1;\n while (k < SAMPLES && seg.d[k]! < d) k++;\n const d0 = seg.d[k - 1]!;\n const d1 = seg.d[k]!;\n const t = (k - 1 + (d1 > d0 ? (d - d0) / (d1 - d0) : 0)) / SAMPLES;\n return [seg, Math.min(1, Math.max(0, t))];\n }\n\n /** Compose `PathMeasure.getSegment(startD, stopD, destination)` (moveTo first). */\n getSegment(startD: number, stopD: number): PathCommand[] {\n const start = Math.max(0, startD);\n const stop = Math.min(this.length, stopD);\n if (!(start <= stop) || this.#segs.length === 0) return [];\n const [seg0, t0] = this.#find(start);\n const [seg1, t1] = this.#find(stop);\n const [mx, my] = at(seg0.p, t0);\n const out: PathCommand[] = [['M', mx, my]];\n if (seg0 === seg1) {\n out.push(t0 === t1 ? ['L', mx, my] : command(sub(seg0.p, t0, t1)));\n return out;\n }\n const segs = this.#segs;\n out.push(command(sub(seg0.p, t0, 1)));\n for (let i = segs.indexOf(seg0) + 1; segs[i] !== seg1; i++) out.push(command(segs[i]!.p));\n out.push(command(sub(seg1.p, 0, t1)));\n return out;\n }\n}\n","/*\n * Copyright 2025 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/LinearWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n// Ported to TypeScript by Kyra Labs from compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/CircularWavyProgressModifiers.kt@19991f2c0858aadfcb442ce02b2c8e4743c96898\n//\n// The paths the wavy progress indicators draw (shared by m3e-elements and m3e-react), in pixels:\n// - linear (LinearProgressDrawingCache): a quadratic wave at full amplitude, a couple of\n// wavelengths longer than the indicator, measured once; each progress part is a segment of it by\n// arc length (shifted by the wave offset), flattened to the amplitude; the track runs from the\n// end back to the start, around the parts with the gap; plus the stop indicator;\n// - circular (CircularShapes + CircularProgressDrawingCache): a circle polygon (the track) and a\n// star with as many points as wavelengths fit the circumference (the wave), morphed by the\n// amplitude; the progress is a segment of it by arc length (the path is repeated so a wave\n// offset can shift the segment, which is then rotated back) and the track the rest of the circle\n// after the gap.\n\nimport { CornerRounding } from './graphics-shapes/corner-rounding.js';\nimport { Morph } from './graphics-shapes/morph.js';\nimport type { RoundedPolygon } from './graphics-shapes/rounded-polygon.js';\nimport { circle, star } from './graphics-shapes/shapes.js';\nimport { type PathCommand, pathBounds, transformPath, translatePath } from './path.js';\nimport { PathMeasure } from './path-measure.js';\nimport { Matrix } from './matrix.js';\nimport { morphToPath, polygonToPath } from './shape-util.js';\n\n/** Stroke widths (px) and whether the caps are round (StrokeCap.Round, the default). */\nexport interface ProgressStrokes {\n stroke: number;\n trackStroke: number;\n round?: boolean;\n}\n\n/** `currentStrokeCapWidth`: room the round caps need at each end (0 for butt caps or h > w). */\nconst capWidth = (s: ProgressStrokes, width: number, height: number) =>\n s.round === false || height > width ? 0 : Math.max(s.stroke / 2, s.trackStroke / 2);\n\nexport interface LinearWavyInput extends ProgressStrokes {\n width: number;\n height: number;\n /** Wavelength in px (applies when amplitude > 0). */\n wavelength: number;\n /** Pairs of [start, end] fractions (0–1): one pair (determinate) or two (indeterminate). */\n fractions: readonly number[];\n /** 0–1 of the room the height leaves the stroke. */\n amplitude: number;\n /** 0–1: how far along a wavelength the wave has travelled. */\n waveOffset: number;\n /** Gap between the progress and the track (px). */\n gap: number;\n}\n\nexport interface LinearWavyPaths {\n track: PathCommand[];\n /** One path per fraction pair (empty when the pair has no length). */\n progress: PathCommand[][];\n /** `currentStrokeCapWidth`. */\n capWidth: number;\n}\n\ninterface LinearFull {\n key: string;\n measure: PathMeasure;\n /** Path length per px of width (> 1 for a wave). */\n scale: number;\n}\n\n/**\n * Linear wavy paths, LTR (Compose rotates the drawing 180° for RTL). Reuse one instance per\n * indicator: like LinearProgressDrawingCache it caches the measured full path.\n */\nexport class LinearWavyPathCache {\n #full: LinearFull | null = null;\n\n /** `updateFullPaths`: the full wave (or line, at amplitude 0), measured. */\n #fullPath(input: LinearWavyInput): LinearFull {\n const { width, height, wavelength, stroke } = input;\n const wavy = input.amplitude !== 0;\n const key = [width, height, wavy ? wavelength : 0, stroke].join();\n if (this.#full?.key === key) return this.#full;\n const path: PathCommand[] = [['M', 0, height / 2]];\n if (!wavy) {\n path.push(['L', width, height / 2]);\n } else {\n const half = wavelength / 2;\n let anchorX = half;\n let controlX = half / 2;\n // The control point at the full height (less the stroke) peaks the wave at half of it.\n let controlY = height - stroke;\n const end = width + wavelength * 2;\n while (anchorX <= end) {\n path.push(['Q', controlX, controlY + height / 2, anchorX, height / 2]);\n anchorX += half;\n controlX += half;\n controlY *= -1;\n }\n }\n const measure = new PathMeasure(path, false);\n const [left, , right] = pathBounds(path);\n this.#full = { key, measure, scale: measure.length / (right - left + 0.00000001) };\n return this.#full;\n }\n\n /** `updateDrawPaths`: the progress parts and the track for these fractions. */\n paths(input: LinearWavyInput): LinearWavyPaths {\n const { width, height, fractions, amplitude, waveOffset, gap } = input;\n const { measure, scale } = this.#fullPath(input);\n const cap = capWidth(input, width, height);\n const halfHeight = height / 2;\n const wavelength = input.wavelength;\n const progress: PathCommand[][] = [];\n const track: PathCommand[] = [];\n let adjustedGap = gap;\n let activeVisible = false;\n let nextEnd = width - cap;\n track.push(['M', nextEnd, halfHeight]);\n for (let i = 0; i + 1 < fractions.length; i += 2) {\n const start = fractions[i]!;\n const end = fractions[i + 1]!;\n const barTail = start * width;\n const barHead = end * width;\n if (i === 0) {\n // Shorten the gap while the progress enters the track (round caps need room first).\n adjustedGap = barHead < cap ? 0 : Math.min(barHead - cap, gap);\n activeVisible = barHead >= cap;\n }\n const head = Math.min(Math.max(barHead, cap), width - cap);\n const tail = Math.min(Math.max(barTail, cap), width - cap);\n let part: PathCommand[] = [];\n if (Math.abs(end - start) > 0) {\n const shift = amplitude !== 0 ? waveOffset * wavelength : 0;\n part = measure.getSegment((tail + shift) * scale, (head + shift) * scale);\n // Translate by the shift and flatten the (full amplitude) wave to the amplitude.\n part = part.map((c) => mapY(c, -Math.max(0, shift), amplitude, halfHeight));\n }\n progress.push(part);\n const spacing = activeVisible ? adjustedGap + cap * 2 : adjustedGap;\n if (nextEnd > head + spacing) track.push(['L', Math.max(cap, head + spacing), halfHeight]);\n if (barHead > barTail) {\n nextEnd = Math.max(cap, tail - spacing);\n track.push(['M', nextEnd, halfHeight]);\n }\n }\n if (nextEnd > cap) track.push(['L', cap, halfHeight]);\n return { track, progress, capWidth: cap };\n }\n}\n\n/** x + dx; y scaled by `amplitude` about the vertical center (Matrix translate, then scale(y)). */\nfunction mapY(c: PathCommand, dx: number, amplitude: number, halfHeight: number): PathCommand {\n const y = (v: number) => amplitude * v + (1 - amplitude) * halfHeight;\n switch (c[0]) {\n case 'M':\n case 'L':\n return [c[0], c[1] + dx, y(c[2])];\n case 'Q':\n return ['Q', c[1] + dx, y(c[2]), c[3] + dx, y(c[4])];\n case 'C':\n return ['C', c[1] + dx, y(c[2]), c[3] + dx, y(c[4]), c[5] + dx, y(c[6])];\n case 'Z':\n return c;\n }\n}\n\n/**\n * The wavy linear stop indicator (`drawStopIndicator`): a dot of min(track stroke, `maxSize`) at the\n * end of the track that shrinks away as the progress reaches it. Returns its left edge and\n * diameter (LTR), or null when it has shrunk to nothing.\n */\nexport function linearWavyStopIndicator(\n progressEnd: number,\n width: number,\n maxSize: number,\n insets: number,\n trackStroke: number,\n): { x: number; size: number } | null {\n let size = Math.min(trackStroke, maxSize);\n const offset = size === trackStroke ? 0 : trackStroke / 4;\n let x = width - size - offset;\n const progressX = width * progressEnd + insets;\n if (x <= progressX) {\n size = Math.max(0, size - (progressX - x));\n x = progressX;\n }\n return size > 0 ? { x, size } : null;\n}\n\n// CircularShapes (L1269–1407).\nconst MIN_VERTICES = 5;\n\n/**\n * The wave count of a circular wavy indicator: as many wavelengths as fit around the circle (its\n * radius inset by half the stroke), at least 5 (`MinCircularVertexCount`).\n */\nexport const circularWavyVertexCount = (size: number, wavelength: number, stroke: number) =>\n Math.max(MIN_VERTICES, Math.round((2 * Math.PI * (size / 2 - stroke / 2)) / wavelength));\n\nexport interface CircularWavyInput extends ProgressStrokes {\n /** Square drawing size (px). */\n size: number;\n /** Preferred wavelength (px); the actual one fits a whole number of waves. */\n wavelength: number;\n start: number;\n end: number;\n amplitude: number;\n waveOffset: number;\n /** The wave offset applies (waveSpeed > 0 and a wave is drawn). */\n motion: boolean;\n gap: number;\n}\n\nexport interface CircularWavyPaths {\n track: PathCommand[];\n progress: PathCommand[];\n /** Wave count, which scales the circular wave travel duration. */\n vertexCount: number;\n}\n\ninterface CircularFull {\n key: string;\n progress: PathCommand[];\n measure: PathMeasure;\n length: number;\n center: readonly [number, number];\n track: PathMeasure;\n}\n\n/**\n * Circular wavy paths (CircularShapes + CircularProgressDrawingCache). Reuse one instance per\n * indicator: it caches the polygons, the morph (created the first time the amplitude is between 0\n * and 1, `requiresMorph`) and the measured full paths.\n */\nexport class CircularWavyPathCache {\n #shapesKey = '';\n #vertices = -1;\n #trackPolygon: RoundedPolygon | null = null;\n #activePolygon: RoundedPolygon | null = null;\n #morph: Morph | null = null;\n #full: CircularFull | null = null;\n\n /** `CircularShapes.update`. */\n #update(size: number, wavelength: number, stroke: number, requiresMorph: boolean): void {\n const key = [size, wavelength].join();\n if (key === this.#shapesKey) {\n if (requiresMorph && this.#morph === null)\n this.#morph = new Morph(this.#trackPolygon!, this.#activePolygon!);\n return;\n }\n const n = circularWavyVertexCount(size, wavelength, stroke);\n if (n !== this.#vertices) {\n this.#trackPolygon = circle({ numVertices: n }).normalized();\n this.#activePolygon = star(n, {\n innerRadius: 0.75,\n rounding: new CornerRounding(0.35, 0.4),\n innerRounding: new CornerRounding(0.5),\n }).normalized();\n this.#morph = requiresMorph ? new Morph(this.#trackPolygon, this.#activePolygon) : null;\n this.#full = null;\n }\n this.#shapesKey = key;\n this.#vertices = n;\n }\n\n /** The paths for `input`; `requiresMorph` as the Compose node passes it. */\n paths(input: CircularWavyInput, requiresMorph: boolean): CircularWavyPaths {\n const { size, wavelength, stroke, motion, start, end, gap } = input;\n this.#update(size, wavelength, stroke, requiresMorph);\n const full = this.#fullPaths(input);\n const cap = capWidth(input, size, size);\n const pStart = start * full.length;\n const pStop = end * full.length;\n const trackGap = Math.min(pStop, gap);\n const insets = Math.min(pStop, cap);\n const spacing = insets * 2 + trackGap;\n let progress: PathCommand[];\n if (motion) {\n const offset = Math.min(Math.max(input.waveOffset, 0), 1);\n const shift = offset * full.length;\n progress = full.measure.getSegment(pStart + shift, pStop + shift);\n const angle = (offset * 360) % 360;\n if (angle !== 0) {\n // Rotate the segment back about the full path's center to undo the shift.\n const [cx, cy] = full.center;\n progress = translatePath(\n transformPath(translatePath(progress, -cx, -cy), new Matrix().rotateZ(-angle)),\n cx,\n cy,\n );\n }\n } else {\n progress = full.measure.getSegment(pStart, pStop);\n }\n const trackLength = full.track.length;\n const track =\n trackLength > 0\n ? full.track.getSegment(end * trackLength + spacing, trackLength - spacing)\n : [];\n return { track, progress, vertexCount: this.#vertices };\n }\n\n /** `updateFullPaths` + `getProgressPath` / `getTrackPath` + `processPath`. */\n #fullPaths(input: CircularWavyInput): CircularFull {\n const { size, stroke, amplitude, motion } = input;\n const key = [size, stroke, amplitude, motion, this.#vertices, this.#morph !== null].join();\n if (this.#full?.key === key) return this.#full;\n const pivot = { rotationPivotX: 0.5, rotationPivotY: 0.5 };\n const raw =\n this.#morph !== null\n ? morphToPath(this.#morph, amplitude, { startAngle: 270, repeatPath: motion, ...pivot })\n : polygonToPath(amplitude === 1 ? this.#activePolygon! : this.#trackPolygon!, {\n startAngle: 270,\n repeatPath: motion,\n });\n const progress = processPath(raw, size, stroke);\n const measure = new PathMeasure(progress, true);\n const track = new PathMeasure(\n processPath(polygonToPath(this.#trackPolygon!, { startAngle: 270 }), size, stroke),\n true,\n );\n const [left, top, right, bottom] = pathBounds(progress);\n this.#full = {\n key,\n progress,\n measure,\n length: motion ? measure.length / 2 : measure.length,\n center: [(left + right) / 2, (top + bottom) / 2],\n track,\n };\n return this.#full;\n }\n}\n\n/** Scales a normalized path to the size less the stroke and centers it (`processPath`). */\nfunction processPath(path: readonly PathCommand[], size: number, stroke: number): PathCommand[] {\n const scaled = transformPath(path, new Matrix().scale(size - stroke, size - stroke));\n const [left, top, right, bottom] = pathBounds(scaled);\n return translatePath(scaled, size / 2 - (left + right) / 2, size / 2 - (top + bottom) / 2);\n}\n"]}
|