{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"orb-swarm","type":"registry:component","title":"Orb Swarm","description":"Kinetic typography scene with glass orbs: a sentence told one beat at a time while four orbs burst out of it, split into eight and sixteen, wind into a clockwise vortex, collapse into a knot, pay out as a chain, loop around the closing words and shrink away bead by bead. Every phase was measured frame by frame off a 24fps reference and is replayed on the same clock; the orbs are shaded per pixel into a canvas (a scrolling band texture bowed like latitude lines, a soft glass edge) and the type is drawn into the same canvas four times finer than the frame so its baselines land between pixels.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/orb-swarm.tsx","type":"registry:component","target":"components/kuchi/orb-swarm.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport { getInfo } from \"@remotion/google-fonts/InterTight\";\r\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\r\nimport {\r\n  AbsoluteFill,\r\n  continueRender,\r\n  delayRender,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport {\r\n  oklchToRgb,\r\n  parseColor,\r\n  resolveFont,\r\n  rgbToOklch,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\n/**\r\n * A sentence told one beat at a time while a field of glass orbs splits,\r\n * swarms, and threads itself into a ring around the last words.\r\n *\r\n * Four orbs burst out of the first line, split into eight, then sixteen; the\r\n * sixteen drift out, wind into a vortex, collapse into a knot, pay out as a\r\n * chain, and the chain loops around the closing card before it shrinks away\r\n * bead by bead.\r\n *\r\n * ## Everything is on the reference's clock\r\n *\r\n * The choreography was measured off a 24fps recording, beat by beat, so every\r\n * table below is indexed in *beats* (1/24 s) and read at fractional beats —\r\n * a 30fps composition samples between them and gets motion the recording\r\n * could not show, rather than a pulldown judder it did.\r\n *\r\n * ## The orbs are drawn, not styled\r\n *\r\n * Each orb carries a band texture that scrolls down its face once every\r\n * fourteen beats, and the bands bow toward the rim like latitude lines on a\r\n * sphere. A CSS gradient cannot bend, so the orbs are shaded per pixel into a\r\n * canvas — the same function the reference was fitted with, which is the only\r\n * way the two can agree to the pixel.\r\n */\r\n\r\n/**\r\n * Inter Tight, registered as the variable face it is. The reference sets it a\r\n * hair under 500, and a canvas has no `font-variation-settings` — the weight\r\n * has to come from the face's own range, so the face declares the whole range.\r\n */\r\nconst FACE = \"Orb Swarm Inter Tight\";\r\nexport const WEIGHT = 490;\r\nlet faceLoad: Promise<unknown> | null = null;\r\nfunction loadFace(): Promise<unknown> {\r\n  if (faceLoad) return faceLoad;\r\n  const url = getInfo().fonts.normal?.[\"500\"]?.latin;\r\n  if (typeof FontFace === \"undefined\" || !url) {\r\n    faceLoad = Promise.resolve();\r\n    return faceLoad;\r\n  }\r\n  const face = new FontFace(FACE, `url(${url}) format(\"woff2\")`, {\r\n    weight: \"100 900\",\r\n  });\r\n  document.fonts.add(face);\r\n  faceLoad = face.load().catch(() => undefined);\r\n  return faceLoad;\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   The card, in the reference's own 714 × 392 pixels\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nexport const REF_W = 714;\r\nexport const REF_H = 392;\r\n/** The recording's frame rate: one beat. */\r\nexport const BEATS_PER_SECOND = 24;\r\n/** The recording runs out here. */\r\nexport const END_BEAT = 128;\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Tables\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\ntype Table = readonly number[];\r\n\r\n/**\r\n * Catmull-Rom through a table sampled at whole beats, clamped at both ends.\r\n * A frame between two beats gets the curve between them, not a straight line\r\n * with a corner at every beat.\r\n */\r\nexport function sample(table: Table, at: number): number {\r\n  const n = table.length;\r\n  if (n === 0) return 0;\r\n  if (at <= 0) return table[0] as number;\r\n  if (at >= n - 1) return table[n - 1] as number;\r\n  const i = Math.floor(at);\r\n  const t = at - i;\r\n  const p0 = table[Math.max(0, i - 1)] as number;\r\n  const p1 = table[i] as number;\r\n  const p2 = table[i + 1] as number;\r\n  const p3 = table[Math.min(n - 1, i + 2)] as number;\r\n  return (\r\n    0.5 *\r\n    (2 * p1 +\r\n      (-p0 + p2) * t +\r\n      (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t +\r\n      (-p0 + 3 * p1 - 3 * p2 + p3) * t * t * t)\r\n  );\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   The orb shader\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\n/** Radius the tables below are measured at, in card pixels. */\r\nexport const ORB_R = 20.12;\r\n/**\r\n * The band texture, one period, 32 RGB stops. Read with Catmull-Rom so the\r\n * bands have no facets however large the orb is drawn.\r\n */\r\nconst TEX: Table = [\r\n  227.8, 187.4, 247.2, 223.8, 183.2, 248.2, 220.8, 178.5, 247.4, 215.0, 173.3,\r\n  249.4, 210.4, 167.4, 249.1, 203.6, 161.0, 250.2, 196.9, 153.9, 250.2, 190.1,\r\n  146.9, 249.1, 182.7, 139.5, 249.2, 176.8, 132.8, 247.3, 169.6, 127.1, 247.9,\r\n  166.0, 122.7, 247.7, 161.7, 120.9, 247.8, 160.5, 119.9, 248.9, 159.3, 120.7,\r\n  248.6, 159.3, 122.5, 249.0, 160.7, 125.2, 250.3, 162.8, 130.6, 249.0, 168.1,\r\n  136.1, 252.8, 173.5, 145.6, 249.4, 181.0, 153.3, 253.1, 187.8, 162.6, 251.7,\r\n  196.0, 171.2, 252.9, 203.1, 179.4, 253.2, 211.3, 186.9, 252.9, 217.0, 192.7,\r\n  253.9, 223.1, 196.4, 252.2, 225.7, 198.1, 251.9, 228.6, 197.8, 250.7, 229.7,\r\n  196.6, 249.2, 230.2, 194.3, 248.6, 229.4, 191.3, 247.9,\r\n];\r\nconst TEX_N = TEX.length / 3;\r\n/**\r\n * How far the bands lag behind at radius r (every 2px from the centre), in\r\n * card pixels. Zero through the middle and nine at the rim: the bands bow.\r\n */\r\nconst WARP: Table = [\r\n  0.95, 0.9, 0.84, 0.75, 0.68, 0.68, 0.93, 1.95, 4.17, 7.59, 11.02, 11.14,\r\n];\r\n/** One band period, in card pixels, and the beats it takes to scroll by. */\r\nconst PERIOD = 40.98;\r\nconst SCROLL_BEATS = 14;\r\n/**\r\n * Coverage of the silhouette from r = 14.5 to 23 in half pixels: the orb's\r\n * edge is two pixels soft in the recording, and that softness is the look.\r\n * The last few pixels inside it are faintly see-through, which is what reads\r\n * as glass rather than paint.\r\n */\r\nconst COVER: Table = [\r\n  1, 0.9698, 0.9633, 0.9566, 0.949, 0.9435, 0.9351, 0.9343, 0.9346, 0.9115,\r\n  0.8077, 0.5824, 0.3101, 0.1139, 0.0331, 0, 0, 0,\r\n];\r\n/**\r\n * And a shade added on top across the same band, as a multiple of\r\n * `SHADE_TINT`: a dark ring just inside the edge, a breath of light outside.\r\n */\r\nconst SHADE: Table = [\r\n  0, -1.517, -1.692, -2.088, -2.275, -2.52, -2.843, -2.97, -2.758, -1.804,\r\n  -0.457, -0.016, -0.013, -0.206, 0.352, 0.088, 0.17, 0.211,\r\n];\r\nconst SHADE_TINT = [2.87, 1.67, 1.43] as const;\r\nconst COVER_FROM = 14.5;\r\n\r\n/**\r\n * The colour the orbs were measured in: the deep band of the texture. Every\r\n * accent in the scene — the bands, the letter tints, the washes — is turned\r\n * about the hue wheel by however far `orbColor` sits from this, in OKLCH, and\r\n * its chroma scaled the same way, so the glass keeps every one of its\r\n * lightnesses and only the colour changes.\r\n */\r\nexport const MEASURED_ORB = \"#9f77f8\";\r\n\r\nexport type Recolour = (\r\n  rgb: readonly [number, number, number],\r\n) => [number, number, number];\r\n\r\nexport function recolourer(target: string): Recolour {\r\n  const from = rgbToOklch(parseColor(MEASURED_ORB));\r\n  const to = rgbToOklch(parseColor(target));\r\n  const turn = (to.h ?? 0) - (from.h ?? 0);\r\n  const gain = from.c > 0 ? to.c / from.c : 1;\r\n  if (Math.abs(turn) < 0.01 && Math.abs(gain - 1) < 0.001) {\r\n    return ([r, g, b]) => [r, g, b];\r\n  }\r\n  return ([r, g, b]) => {\r\n    const o = rgbToOklch({ mode: \"rgb\", r: r / 255, g: g / 255, b: b / 255 });\r\n    const c = oklchToRgb(o.l, o.c * gain, (o.h ?? 0) + turn);\r\n    return [c.r * 255, c.g * 255, c.b * 255];\r\n  };\r\n}\r\n\r\nfunction recolourTable(tex: Table, f: Recolour): number[] {\r\n  const out: number[] = [];\r\n  for (let i = 0; i < tex.length; i += 3) {\r\n    out.push(\r\n      ...f([tex[i] as number, tex[i + 1] as number, tex[i + 2] as number]),\r\n    );\r\n  }\r\n  return out;\r\n}\r\n\r\nfunction recolourHex(hex: string, f: Recolour): string {\r\n  const c = parseColor(hex);\r\n  const [r, g, b] = f([c.r * 255, c.g * 255, c.b * 255]);\r\n  // Slice, not `padStart` (ES2017) — a stock Remotion project types ES2015.\r\n  const h = (v: number) =>\r\n    `0${Math.round(Math.max(0, Math.min(255, v))).toString(16)}`.slice(-2);\r\n  return `#${h(r)}${h(g)}${h(b)}`;\r\n}\r\n\r\n/**\r\n * A measured word tint, turned over for a dark page. The tints are dark\r\n * violets that read against the reference's white; on a dark page the same\r\n * lightness disappears, so it is mirrored and hue and chroma are kept.\r\n */\r\nfunction onDark(hex: string): string {\r\n  const o = rgbToOklch(parseColor(hex));\r\n  const c = oklchToRgb(1 - o.l, o.c, o.h ?? 0);\r\n  return recolourHex(hex, () => [c.r * 255, c.g * 255, c.b * 255]);\r\n}\r\n\r\nfunction texel(tex: Table, s: number, out: Float32Array) {\r\n  const x = (((s % 1) + 1) % 1) * TEX_N;\r\n  const i = Math.floor(x);\r\n  const t = x - i;\r\n  const t2 = t * t;\r\n  const t3 = t2 * t;\r\n  const a = (((i - 1) % TEX_N) + TEX_N) % TEX_N;\r\n  const b = i % TEX_N;\r\n  const c = (i + 1) % TEX_N;\r\n  const d = (i + 2) % TEX_N;\r\n  for (let k = 0; k < 3; k++) {\r\n    const p0 = tex[a * 3 + k] as number;\r\n    const p1 = tex[b * 3 + k] as number;\r\n    const p2 = tex[c * 3 + k] as number;\r\n    const p3 = tex[d * 3 + k] as number;\r\n    out[k] =\r\n      0.5 *\r\n      (2 * p1 +\r\n        (-p0 + p2) * t +\r\n        (2 * p0 - 5 * p1 + 4 * p2 - p3) * t2 +\r\n        (-p0 + 3 * p1 - 3 * p2 + p3) * t3);\r\n  }\r\n}\r\n\r\nfunction linear(table: Table, step: number, from: number, r: number) {\r\n  const x = (r - from) / step;\r\n  if (x <= 0) return table[0] as number;\r\n  const n = table.length - 1;\r\n  if (x >= n) return table[n] as number;\r\n  const i = Math.floor(x);\r\n  const t = x - i;\r\n  return (table[i] as number) * (1 - t) + (table[i + 1] as number) * t;\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Choreography\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\ntype Pt = readonly [number, number];\r\ntype Bead = { x: number; y: number; scale: number };\r\n\r\n/** Four orbs burst out of the first line: each on its own ease. */\r\nconst BURST: readonly { s: Pt; d: Pt; p: Table }[] = [\r\n  {\r\n    s: [259.135, 148.78],\r\n    d: [-52.97, -18.2],\r\n    p: [\r\n      0, 0.5593, 0.6832, 0.7541, 0.7975, 0.8274, 0.8509, 0.8667, 0.8808, 0.891,\r\n      0.9002, 0.9096, 0.9176, 0.9245, 0.9323, 0.9399, 0.9459, 0.9532, 0.9617,\r\n      0.9692, 0.9769, 0.9828, 0.9894, 1,\r\n    ],\r\n  },\r\n  {\r\n    s: [408.715, 157.87],\r\n    d: [34.78, -31.73],\r\n    p: [\r\n      0, 0.3817, 0.5072, 0.5909, 0.6524, 0.7043, 0.7449, 0.7807, 0.8101, 0.8347,\r\n      0.853, 0.8753, 0.8929, 0.9108, 0.926, 0.9383, 0.9522, 0.9618, 0.972,\r\n      0.9807, 0.9866, 0.9925, 0.9952, 1,\r\n    ],\r\n  },\r\n  {\r\n    s: [266.665, 218.19],\r\n    d: [-22.67, 55.67],\r\n    p: [\r\n      0, 0.4574, 0.5882, 0.6615, 0.7157, 0.7561, 0.7902, 0.8165, 0.8397, 0.8626,\r\n      0.881, 0.8962, 0.911, 0.9216, 0.9324, 0.9419, 0.9488, 0.9548, 0.9628,\r\n      0.9706, 0.9768, 0.9844, 0.9903, 1,\r\n    ],\r\n  },\r\n  {\r\n    s: [381.535, 239.21],\r\n    d: [37.81, 48.15],\r\n    p: [\r\n      0, 0.3837, 0.5085, 0.5894, 0.6517, 0.6991, 0.7415, 0.7754, 0.806, 0.8347,\r\n      0.8593, 0.8795, 0.8984, 0.9123, 0.9254, 0.9374, 0.9476, 0.9568, 0.9652,\r\n      0.9728, 0.9794, 0.9875, 0.9928, 1,\r\n    ],\r\n  },\r\n];\r\nconst BURST_AT = 10;\r\n\r\n/** Eight: every orb splits in two, and the halves share one ease. */\r\nconst SPLIT_AT = 34;\r\nconst SPLIT_S: Table = [\r\n  212.635, 110.64, 407.595, 119.44, 478.395, 122.11, 185.205, 148.69, 437.065,\r\n  247.54, 477.325, 275.42, 207.395, 277.85, 271.865, 299.96,\r\n];\r\nconst SPLIT_D: Table = [\r\n  11.69, -37.49, -65.36, -13.05, 63.35, -8.18, -37.95, 31.45, 32.18, -73.37,\r\n  105.26, -22.8, -66.18, 6.36, 50.69, 46.02,\r\n];\r\nconst SPLIT_P: Table = [\r\n  0, 0.2336, 0.4063, 0.5442, 0.6568, 0.7497, 0.8261, 0.8881, 0.9371, 0.9742, 1,\r\n];\r\n\r\n/** Sixteen: split again, drift out, then wind into a vortex. */\r\nconst SWARM_AT = 45;\r\nconst SWARM_S: Table = [\r\n  211.205, 57.29, 359.035, 87.85, 317.405, 96, 566.885, 99.48, 207.045, 104.52,\r\n  524.555, 122.65, 451.925, 158.7, 492.015, 192.36, 590.495, 228.02, 602.175,\r\n  268.76, 176.965, 286.1, 122.135, 299.41, 290.055, 347.33, 353.835, 346.23,\r\n  121.685, 158.39, 144.305, 153.96,\r\n];\r\nconst SWARM_D: Table = [\r\n  -39.77, -48.89, 51.39, -56.79, -74.84, -31.73, 76.25, -44.24, -52.26, 93.87,\r\n  -52.11, 26.16, -52.21, -47.74, 68.83, 54.85, 23.81, -74.78, 58.97, 48.87,\r\n  107.98, 5.27, -58.13, 45.24, -99.09, 3.39, 94.09, -0.04, -77.21, -67.1, -9.15,\r\n  -80.84,\r\n];\r\nconst SWARM_P: Table = [\r\n  0, 0.1423, 0.2519, 0.3426, 0.4214, 0.4906, 0.5529, 0.6089, 0.6597, 0.7054,\r\n  0.7474, 0.7853, 0.8198, 0.8509, 0.8788, 0.9037, 0.9259, 0.9452, 0.962, 0.9765,\r\n  0.9888, 0.9996,\r\n];\r\n/** The vortex: degrees clockwise and scale about the centre, per beat. */\r\nconst VORTEX_AT = 63;\r\nconst VORTEX_CENTRE: Pt = [358.79, 198.69];\r\nconst VORTEX_TURN: Table = [\r\n  0, 0.336, 0.822, 1.541, 2.539, 3.859, 5.563, 7.73, 10.461, 13.917, 18.355,\r\n  24.062, 31.779, 42.811, 60.412,\r\n];\r\nconst VORTEX_SCALE: Table = [\r\n  1, 1, 1.0001, 0.9998, 0.999, 0.9962, 0.9912, 0.9834, 0.9723, 0.9569, 0.9359,\r\n  0.907, 0.8662, 0.8047, 0.6993,\r\n];\r\nconst CHAIN_AT = 76;\r\n\r\nfunction swarm(beat: number): Bead[] {\r\n  const out: Bead[] = [];\r\n  const p = sample(SWARM_P, beat - SWARM_AT);\r\n  const v = beat - VORTEX_AT;\r\n  const turn = v > 0 ? (sample(VORTEX_TURN, v) * Math.PI) / 180 : 0;\r\n  const k = v > 0 ? sample(VORTEX_SCALE, v) : 1;\r\n  const cos = Math.cos(turn);\r\n  const sin = Math.sin(turn);\r\n  // The orbs shrink with the vortex, a fifth as fast: they fall away as well\r\n  // as in.\r\n  const size = 0.81 + 0.19 * k;\r\n  for (let i = 0; i < SWARM_S.length / 2; i++) {\r\n    const x = (SWARM_S[2 * i] as number) + (SWARM_D[2 * i] as number) * p;\r\n    const y =\r\n      (SWARM_S[2 * i + 1] as number) + (SWARM_D[2 * i + 1] as number) * p;\r\n    const dx = x - VORTEX_CENTRE[0];\r\n    const dy = y - VORTEX_CENTRE[1];\r\n    out.push({\r\n      x: VORTEX_CENTRE[0] + k * (cos * dx - sin * dy),\r\n      y: VORTEX_CENTRE[1] + k * (sin * dx + cos * dy),\r\n      scale: size,\r\n    });\r\n  }\r\n  return out;\r\n}\r\n\r\n/**\r\n * The constellation is turned this far about the vortex centre, in degrees\r\n * (negative is counter-clockwise), while the orbs are free — so the layout is\r\n * this scene's own, not the reference's; only the motion is measured. It eases\r\n * back to zero as they collapse into the knot, turning the same way the vortex\r\n * already spins, and the chain and the ring are exactly as measured.\r\n *\r\n * Twelve degrees is the most either way that keeps every orb on screen and no\r\n * closer to the type than the reference's own layout comes, within 2px.\r\n */\r\nexport const LAYOUT_TURN = -12;\r\nconst TURN_UNTIL = 82;\r\nconst TURN_EASE = 6;\r\n\r\n/** Every orb on screen at `beat`, bottom first. */\r\nexport function orbsAt(beat: number, turn: number = LAYOUT_TURN): Bead[] {\r\n  const beads = measuredAt(beat);\r\n  const f = Math.min(1, Math.max(0, (TURN_UNTIL - beat) / TURN_EASE));\r\n  const a = (turn * f * Math.PI) / 180;\r\n  if (a === 0) return beads;\r\n  const cos = Math.cos(a);\r\n  const sin = Math.sin(a);\r\n  return beads.map((b) => {\r\n    const dx = b.x - VORTEX_CENTRE[0];\r\n    const dy = b.y - VORTEX_CENTRE[1];\r\n    return {\r\n      x: VORTEX_CENTRE[0] + cos * dx - sin * dy,\r\n      y: VORTEX_CENTRE[1] + sin * dx + cos * dy,\r\n      scale: b.scale,\r\n    };\r\n  });\r\n}\r\n\r\nfunction measuredAt(beat: number): Bead[] {\r\n  if (beat < BURST_AT) return [];\r\n  if (beat < SPLIT_AT) {\r\n    return BURST.map(({ s, d, p }) => {\r\n      const q = sample(p, beat - BURST_AT);\r\n      return { x: s[0] + d[0] * q, y: s[1] + d[1] * q, scale: 1 };\r\n    });\r\n  }\r\n  if (beat < SWARM_AT) {\r\n    const q = sample(SPLIT_P, beat - SPLIT_AT);\r\n    const out: Bead[] = [];\r\n    for (let i = 0; i < SPLIT_S.length / 2; i++) {\r\n      out.push({\r\n        x: (SPLIT_S[2 * i] as number) + (SPLIT_D[2 * i] as number) * q,\r\n        y: (SPLIT_S[2 * i + 1] as number) + (SPLIT_D[2 * i + 1] as number) * q,\r\n        scale: 1,\r\n      });\r\n    }\r\n    return out;\r\n  }\r\n  if (beat < CHAIN_AT) return swarm(beat);\r\n  return chainAt(beat);\r\n}\r\n\r\n/**\r\n * The chain, bead by bead: position and size per beat, head first.\r\n *\r\n * From the collapse to the last bead there is no rule the recording follows\r\n * closely enough to be worth a formula — the knot pays out as a stack, the\r\n * stack is swept left while its head swings round, the chain reaches round the\r\n * last card and shrinks away from the tail — so this is the measurement\r\n * itself, sixteen beads a beat, read with the same curve as every other table.\r\n */\r\nconst CHAIN_BEATS = 52;\r\nconst CHAIN: Table = [\r\n  // 76\r\n  231.89, -36.56, 0.963, 295.34, 2.29, 0.963, 352.17, -16.08, 0.963, 363.62,\r\n  55.8, 0.963, 238.47, 86.94, 0.963, 430.84, 169.3, 0.963, 480.83, 127.97,\r\n  0.963, 453.1, 231.4, 0.963, 534.38, 311.6, 0.963, 264.41, 212.99, 0.963,\r\n  451.45, 337.8, 0.963, 104.89, 123.65, 0.963, 176.52, 196.68, 0.963, 330.64,\r\n  334.49, 0.963, 472.15, 434.23, 0.963, 604.98, 269.5, 0.963,\r\n  // 77\r\n  315.5, -29.53, 0.943, 357.19, 18.33, 0.947, 409.53, 17.86, 0.942, 400.21,\r\n  80.66, 0.943, 287.4, 74.23, 0.941, 426.57, 192.62, 0.947, 479.19, 171.25,\r\n  0.943, 428.85, 250.15, 0.944, 475.86, 338.09, 0.945, 276.04, 185.98, 0.943,\r\n  399.62, 338.47, 0.945, 166.15, 70.12, 0.942, 206.88, 149.55, 0.944, 299.51,\r\n  304.4, 0.943, 390.8, 423.58, 0.943, 545.85, 321.3, 0.94,\r\n  // 78\r\n  411.48, 41.63, 0.905, 420.56, 86.89, 0.903, 453.11, 105.09, 0.901, 425.15,\r\n  140.46, 0.903, 357.92, 96.76, 0.901, 401.75, 218.83, 0.901, 441.81, 224.08,\r\n  0.901, 382.75, 255.13, 0.903, 380.54, 325.89, 0.901, 311.29, 161.65, 0.901,\r\n  333.42, 299.18, 0.902, 284.59, 51.53, 0.903, 281.59, 114.78, 0.902, 283.8,\r\n  242.97, 0.902, 298.2, 349.21, 0.904, 429.65, 340.14, 0.904,\r\n  // 79\r\n  428.61, 133.66, 0.861, 420.18, 159.59, 0.875, 432.74, 179.44, 0.792, 406.51,\r\n  188.43, 0.862, 384.75, 146.18, 0.862, 371.38, 221.96, 0.862, 390.33, 236.25,\r\n  0.862, 350.7, 234.86, 0.863, 328.79, 270.71, 0.862, 341.66, 165.76, 0.863,\r\n  312.34, 243.13, 0.86, 360.38, 101.36, 0.86, 340.14, 133.04, 0.86, 303.42,\r\n  199.61, 0.861, 279.41, 258.52, 0.86, 349.75, 292.49, 0.86,\r\n  // 80\r\n  407.88, 172.4, 0.836, 404.23, 186.67, 0.514, 400.44, 200.26, 0.866, 383.05,\r\n  202.31, 0.841, 379.47, 172.44, 0.849, 356.35, 219.26, 0.987, 363.63, 228.7,\r\n  0.857, 340.21, 219.84, 0.866, 314.88, 238.09, 0.705, 349.17, 180.94, 1.1,\r\n  325.22, 219.34, 1.083, 371.4, 138.99, 0.844, 353.79, 155.71, 0.908, 316.86,\r\n  189.74, 0.864, 290.05, 221.41, 0.843, 327.3, 256.38, 0.841,\r\n  // 81\r\n  384.87, 188.05, 0.759, 373.83, 205.28, 0.904, 374.42, 200.36, 0.834, 363.32,\r\n  205.89, 0.826, 381.75, 189.07, 0.837, 330.94, 212.24, 0.844, 345.95, 221.33,\r\n  0.815, 343.23, 211.54, 0.849, 317.68, 234.94, 0.82, 341.66, 183.53, 0.843,\r\n  322.5, 212.49, 1.1, 362.99, 161.21, 0.827, 349.52, 173.03, 1.011, 319.36,\r\n  188.8, 0.863, 296.67, 206.22, 0.822, 318.36, 221.14, 1.036,\r\n  // 82\r\n  363.41, 194.89, 0.578, 354.73, 205.18, 0.959, 361.27, 207.01, 0.993, 349.74,\r\n  204.27, 0.974, 358.07, 197.25, 0.848, 320.05, 207.07, 0.83, 329.37, 215.37,\r\n  0.778, 308.62, 221.21, 0.802, 309.55, 214.36, 0.968, 323.93, 187.06, 0.718,\r\n  322.68, 202.19, 1.1, 346.33, 174.98, 0.816, 338.28, 184.29, 1.1, 315.83,\r\n  193.52, 1.037, 296.33, 199.83, 0.814, 307.39, 222.72, 0.75,\r\n  // 83\r\n  365.43, 220.18, 0.596, 366.92, 215.6, 0.684, 361.34, 211.92, 0.931, 367.65,\r\n  211.9, 0.656, 360.06, 214.16, 0.94, 356.43, 213.71, 0.87, 350.76, 209.49,\r\n  1.003, 347.56, 208.96, 0.93, 341.77, 206.27, 0.997, 339.03, 206.52, 0.918,\r\n  329.53, 202.16, 1.033, 313.67, 201.82, 1.096, 319.94, 203.15, 0.758, 311.07,\r\n  192.31, 1.096, 290, 198.16, 0.901, 299.82, 207.85, 1.065,\r\n  // 84\r\n  359.41, 221.69, 0.989, 354.89, 220.22, 0.968, 348.72, 217.63, 1, 344.69,\r\n  216.32, 0.941, 337.96, 213.58, 0.993, 333.01, 211.77, 0.966, 327.1, 209.53,\r\n  0.994, 322.39, 207.67, 0.967, 316.42, 205.83, 0.985, 310.4, 203.7, 0.995,\r\n  305.86, 202.84, 0.947, 299.82, 201.59, 0.94, 294.96, 190.41, 0.879, 290.41,\r\n  203.59, 0.875, 279.87, 190.9, 0.708, 275.3, 201.44, 1.079,\r\n  // 85\r\n  355.88, 231.99, 0.992, 347.7, 229.23, 1.01, 334, 224.09, 1.005, 325.98,\r\n  221.08, 0.989, 309.48, 214.58, 0.988, 318.5, 218.49, 0.993, 297.61, 210.25,\r\n  1.002, 304.32, 213.53, 0.958, 287.95, 206.87, 0.995, 278.96, 202.58, 0.924,\r\n  280.77, 204.63, 0.978, 272.74, 201.84, 0.989, 265.4, 200.46, 0.969, 260.06,\r\n  196.73, 0.994, 249, 199.44, 1.035, 249.8, 201.37, 0.883,\r\n  // 86\r\n  349.51, 243.07, 0.992, 339.17, 240.2, 0.999, 328.64, 236.93, 1, 319.55,\r\n  234.69, 0.951, 318.36, 232.13, 0.928, 308.53, 230.22, 0.995, 298.01, 226.27,\r\n  0.995, 288, 222.69, 0.997, 277.73, 218.84, 0.992, 267.53, 214.8, 0.995,\r\n  257.42, 211.16, 0.992, 247.43, 207.29, 0.991, 237.29, 203.85, 0.993, 226.48,\r\n  200.67, 0.996, 215.64, 198.6, 0.995, 208.41, 199.29, 0.946,\r\n  // 87\r\n  339.22, 253.48, 1.002, 325.35, 250.74, 0.998, 311.5, 247.87, 0.996, 297.13,\r\n  249.52, 0.753, 298.11, 243.8, 0.972, 283.83, 240.43, 0.995, 270.36, 236.14,\r\n  0.999, 256.65, 231.62, 0.997, 243.35, 226.79, 0.998, 229.97, 221.91, 1,\r\n  216.62, 216.86, 0.995, 203.05, 211.71, 1, 189.85, 206.85, 0.999, 176.06,\r\n  202.29, 0.999, 162.46, 199.07, 0.995, 154, 199.31, 0.896,\r\n  // 88\r\n  325.39, 258.9, 0.996, 307.09, 258.24, 0.999, 288.61, 256.6, 1.002, 270.03,\r\n  254.02, 1.001, 253.33, 243.44, 0.598, 251.99, 250.66, 0.994, 234.12, 246.53,\r\n  1.002, 216.13, 241.64, 1, 198.2, 236.29, 1.002, 180.7, 230.4, 1.002, 163.61,\r\n  224.25, 0.995, 146.18, 217.67, 1.001, 128.76, 211.08, 0.998, 111.31, 204.78,\r\n  1.001, 93.77, 199.79, 1.003, 81.97, 198.9, 0.848,\r\n  // 89\r\n  312.27, 251.51, 1.003, 287.94, 256.23, 1.034, 253.85, 259.25, 1.1, 218.38,\r\n  258.04, 1.018, 187.57, 254.6, 1.1, 153.76, 248.18, 1.087, 124.47, 240.04,\r\n  1.024, 95.7, 230.44, 1.1, 63.61, 219.14, 1.088, 35.91, 208.6, 1.013, 12.75,\r\n  200.82, 1.004, -19.77, 190.47, 1.089, -47.4, 163.54, 1.061, -72.83, 145.84,\r\n  1.061, -97.92, 126.62, 1.061, -122.7, 105.86, 1.061,\r\n  // 90\r\n  311.54, 219.2, 0.998, 284.19, 232.03, 0.996, 255.97, 243.04, 1, 226.26, 251.8,\r\n  1.022, 186.6, 257.35, 1.1, 143.73, 259.02, 1.1, 107.35, 255.62, 1.013, 77.01,\r\n  250.12, 1.006, 47.57, 242.88, 1.007, 18.4, 233.91, 1.007, -10.8, 223.37,\r\n  1.027, -46.71, 203.51, 1.02, -75.97, 186.53, 1.02, -104.16, 168.11, 1.02,\r\n  -132.49, 147.6, 1.02, -159.74, 126.02, 1.02,\r\n  // 91\r\n  335.25, 163.48, 1.001, 302.76, 183.63, 1.002, 269.88, 202.73, 1.002, 236.15,\r\n  220.56, 1.002, 201.45, 236.25, 1.002, 165.44, 248.64, 1.002, 128.12, 256.2,\r\n  1.004, 90.09, 259, 1.003, 52, 257.54, 1.006, 14.4, 252.14, 1.004, -16.56,\r\n  246.65, 0.985, -50, 237, 1, -82, 230, 1, -113, 222, 1, -143, 215, 1, -174,\r\n  208, 1,\r\n  // 92\r\n  388.42, 94.19, 1.003, 348.25, 119.02, 1.002, 308.54, 144.62, 1.002, 268.71,\r\n  170, 1.001, 228.35, 194.5, 1.003, 186.92, 217.12, 1.003, 143.97, 236.76,\r\n  1.005, 99.05, 251.31, 1.003, 52.26, 258.19, 1.004, 5.23, 258.22, 0.999,\r\n  -29.62, 258.47, 1, -70.53, 258.41, 1, -111.44, 258.35, 1, -152.35, 258.29, 1,\r\n  -193.26, 258.23, 1, -234.17, 258.17, 1,\r\n  // 93\r\n  473.27, 47.97, 1.002, 417.8, 57.86, 0.999, 366.62, 82.42, 1.003, 317.8,\r\n  111.56, 0.999, 270.03, 142.15, 1.001, 222.15, 172.71, 1, 173.35, 201.76,\r\n  1.001, 122.82, 227.68, 1.001, 69.76, 247.93, 1.003, 13.98, 258.06, 0.998,\r\n  -37.86, 268.35, 1, -91.63, 278.42, 1, -145.4, 288.49, 1, -199.17, 298.56, 1,\r\n  -252.94, 308.63, 1, -306.71, 318.7, 1,\r\n  // 94\r\n  554.45, 102.54, 0.999, 503.59, 62.08, 0.998, 439.85, 47.93, 1, 376.27, 61.8,\r\n  0.998, 318.01, 92.04, 0.999, 262.28, 126.72, 0.996, 207.04, 162.24, 0.998,\r\n  151, 196.41, 0.999, 92.93, 226.94, 0.999, 31.42, 249.76, 0.999, -30.18,\r\n  272.85, 1, -91.73, 295.8, 1, -153.28, 318.75, 1, -214.83, 341.7, 1, -276.38,\r\n  364.65, 1, -337.93, 387.6, 1,\r\n  // 95\r\n  559.83, 207.85, 1, 549.14, 136.34, 0.998, 506.63, 78.21, 0.997, 439.96, 50.22,\r\n  0.999, 368.05, 55.77, 0.997, 302.36, 87.3, 0.998, 240.18, 125.58, 0.998,\r\n  178.81, 165, 0.997, 116.23, 202.6, 1, 50.79, 234.94, 0.999, -15.71, 254.5,\r\n  0.858, -80.06, 299.41, 1, -145.48, 331.68, 1, -210.9, 363.95, 1, -276.32,\r\n  396.22, 1, -341.74, 428.49, 1,\r\n  // 96\r\n  515.86, 294.25, 0.997, 541.2, 220.94, 0.999, 533.88, 143.4, 1, 490.35, 79.37,\r\n  0.997, 418.57, 49.61, 1, 341.5, 58.99, 1, 271.65, 94.84, 0.999, 205.13,\r\n  136.75, 1, 138.82, 178.89, 0.997, 70.41, 217.54, 0.997, -2.08, 247.46, 0.995,\r\n  -54.82, 277.3, 1, -117.42, 307.17, 1, -180.02, 337.04, 1, -242.62, 366.91, 1,\r\n  -305.22, 396.78, 1,\r\n  // 97\r\n  444.69, 338.22, 0.999, 507.61, 287.2, 0.999, 529.1, 208.44, 1.001, 514.97,\r\n  127.94, 0.998, 460.32, 67.77, 0.998, 380.95, 47.76, 0.999, 302.35, 70.7,\r\n  0.997, 230.78, 111.97, 0.998, 161.18, 156.63, 0.998, 90.61, 199.64, 0.997,\r\n  16.54, 236.32, 0.996, -55.73, 272.8, 1, -128.88, 309.39, 1, -202.03, 345.98,\r\n  1, -275.18, 382.57, 1, -348.33, 419.16, 1,\r\n  // 98\r\n  376.97, 349.09, 0.999, 458.52, 327.06, 0.997, 510.52, 261.7, 0.999, 519.17,\r\n  177.68, 0.999, 488.39, 99.46, 0.999, 417.84, 53.93, 0.997, 333.7, 53.92,\r\n  0.999, 256.86, 90.59, 0.998, 184.5, 135.81, 0.998, 112.42, 181.5, 0.994,\r\n  37.77, 222.79, 0.988, -37.04, 263.93, 1, -111.72, 305.21, 1, -186.4, 346.49,\r\n  1, -261.08, 387.77, 1, -335.76, 429.05, 1,\r\n  // 99\r\n  322.95, 345.61, 0.999, 409.11, 344.24, 0.998, 482.62, 301.22, 0.997, 513.26,\r\n  221.55, 0.996, 503.47, 136.32, 0.998, 449.61, 70.24, 0.996, 366.97, 47.64,\r\n  0.998, 284.54, 72.09, 0.996, 209.64, 115.85, 0.996, 136.66, 162.72, 0.989,\r\n  62.16, 207.16, 0.982, -19.29, 243.58, 1.1, -87.07, 295.71, 1, -161.63, 340.07,\r\n  1, -236.19, 384.43, 1, -310.75, 428.79, 1,\r\n  // 100\r\n  282.45, 333.52, 0.997, 367.3, 349.04, 1, 450.38, 326.5, 0.998, 502.23, 258.97,\r\n  0.998, 509.43, 173.03, 0.998, 475.17, 94.57, 0.999, 400.82, 51.9, 0.997,\r\n  315.19, 57.04, 0.995, 237.67, 96.45, 0.991, 164.17, 142.95, 0.984, 90.43,\r\n  189.15, 0.971, 13.35, 229.8, 0.955, -59.83, 270.25, 1, -134.96, 310.85, 1,\r\n  -210.09, 351.45, 1, -285.22, 392.05, 1,\r\n  // 101\r\n  252.94, 314.94, 0.999, 331.47, 347.44, 1, 416.99, 341.01, 1, 485.5, 291.51, 1,\r\n  509.84, 209.93, 0.999, 494.79, 125.88, 0.998, 436.03, 64.87, 0.995, 352.29,\r\n  47.81, 0.989, 271.47, 76.6, 0.982, 197.37, 120.84, 0.971, 124.73, 167.46,\r\n  0.956, 50.33, 211.22, 0.935, -24.15, 254.98, 1, -98.57, 298.78, 1, -172.99,\r\n  342.58, 1, -247.41, 386.38, 1,\r\n  // 102\r\n  234.21, 294.27, 1, 302.5, 341.5, 1, 386.54, 347.36, 1, 463.87, 315.84, 1,\r\n  505.37, 243.77, 1, 506.14, 159.77, 0.996, 466.53, 86.48, 0.994, 391.31, 50.16,\r\n  0.983, 308.32, 59.26, 0.971, 233.22, 98.44, 0.957, 161.74, 143.82, 0.935,\r\n  89.94, 188.7, 0.908, 15.06, 228.44, 0.871, -58.26, 268.23, 0, -132.36, 307.95,\r\n  0, -206.46, 347.67, 0,\r\n  // 103\r\n  222.91, 274.73, 1, 279.46, 332.59, 1, 359.7, 349.13, 1, 439.69, 331.85, 1,\r\n  495.54, 273.33, 0.996, 509.98, 192.88, 0.993, 488.55, 114.27, 0.985, 427.38,\r\n  60.86, 0.974, 346.51, 48.52, 0.959, 269.65, 77.57, 0.938, 198.84, 119.95,\r\n  0.907, 129.34, 164.55, 0.868, 58.41, 206.82, 0.807, -12.52, 249.18, 0, -83.42,\r\n  291.45, 0, -154.32, 333.72, 0,\r\n  // 104\r\n  216.38, 258.17, 1, 262.16, 322.1, 1, 337.15, 348.04, 1, 416.66, 341.02, 0.998,\r\n  481.79, 296.64, 0.994, 508.82, 222.24, 0.985, 501.64, 143.02, 0.978, 456.71,\r\n  78.08, 0.961, 382.92, 49.01, 0.939, 304.61, 60.77, 0.91, 233.69, 98.15, 0.867,\r\n  165.94, 141.14, 0.809, 98.14, 183.85, 0.708, 27.84, 222.66, 0.503, -42.34,\r\n  261.5, 0, -112.56, 300.19, 0,\r\n  // 105\r\n  212.72, 245.03, 1, 249.87, 312.15, 1, 319.21, 345.54, 1, 396.88, 345.86,\r\n  0.996, 466.65, 313.27, 0.988, 504.67, 246.67, 0.976, 507.89, 169.34, 0.96,\r\n  477.6, 98.61, 0.939, 413.7, 55.74, 0.91, 336.68, 50.25, 0.872, 264.87, 80.19,\r\n  0.807, 198.07, 120.48, 0.706, 132.47, 162.71, 0.501, 65.53, 202.98, 0.301,\r\n  -0.96, 243.23, 0, -67.61, 283.34, 0,\r\n  // 106\r\n  210.7, 235.34, 1, 241.57, 303.59, 0.999, 305.56, 342.48, 0.993, 380.99,\r\n  348.15, 0.986, 452.44, 324.46, 0.973, 498.74, 265.78, 0.957, 509.96, 191.24,\r\n  0.939, 491.02, 118.53, 0.911, 437.77, 65.98, 0.866, 364.66, 47.8, 0.808,\r\n  291.69, 66.55, 0.705, 225.31, 103.37, 0.503, 161.18, 144.47, 0.297, 96.59,\r\n  184.93, 0.194, 32.3, 225.18, 0, -32.12, 265.45, 0,\r\n  // 107\r\n  209.68, 228.78, 0.998, 236.2, 297.08, 0.991, 295.68, 339.49, 0.985, 368.92,\r\n  349.04, 0.973, 440.45, 331.56, 0.959, 492.25, 280.19, 0.937, 509.83, 208.82,\r\n  0.907, 499.07, 136.19, 0.868, 455.53, 77.39, 0.807, 387.42, 49.78, 0.706,\r\n  314.52, 57.02, 0.504, 248.11, 89.82, 0.295, 185.36, 128.95, 0.199, 122.06,\r\n  167.97, 0, 59.09, 206.95, 0, -3.88, 245.93, 0,\r\n  // 108\r\n  209.22, 225.08, 0.989, 233.05, 292.73, 0.983, 289.11, 337.04, 0.972, 360.21,\r\n  349.31, 0.958, 431.09, 335.99, 0.935, 486.21, 290.54, 0.908, 508.82, 222.44,\r\n  0.865, 503.84, 150.65, 0.806, 468.26, 88.43, 0.705, 405.57, 53.58, 0.501,\r\n  333.9, 51.08, 0.307, 267, 79.02, 0.209, 200.02, 107.42, 0, 133.17, 135.52, 0,\r\n  66.32, 163.62, 0, -0.53, 191.72, 0,\r\n  // 109\r\n  208.91, 222.65, 0.98, 230.95, 289.5, 0.971, 284.3, 334.99, 0.955, 353.49,\r\n  349.23, 0.935, 423.58, 338.91, 0.908, 480.75, 298.18, 0.866, 507.41, 233.17,\r\n  0.804, 506.66, 162.55, 0.702, 477.49, 98.56, 0.5, 420.16, 58.16, 0.29, 350.06,\r\n  48.49, 0.194, 279.79, 38.81, 0, 209.7, 29.15, 0, 139.61, 19.49, 0, 69.52,\r\n  9.83, 0, -0.57, 0.17, 0,\r\n  // 110\r\n  208.65, 220.38, 0.968, 229.22, 286.58, 0.956, 280.15, 333.02, 0.934, 347.81,\r\n  349.01, 0.905, 417.03, 341.15, 0.864, 475.63, 304.39, 0.804, 505.79, 242.25,\r\n  0.705, 508.47, 172.76, 0.5, 484.48, 107.94, 0.296, 431.96, 62.7, 0.199, 379.1,\r\n  18.24, 0, 326.48, -26.52, 0, 273.86, -71.28, 0, 221.24, -116.04, 0, 168.62,\r\n  -160.8, 0, 116, -205.56, 0,\r\n  // 111\r\n  208.57, 218.23, 0.954, 227.61, 283.88, 0.932, 276.55, 331.17, 0.904, 342.83,\r\n  348.68, 0.864, 411.38, 342.76, 0.804, 470.96, 309.39, 0.701, 504.08, 249.89,\r\n  0.502, 509.68, 181.49, 0.297, 489.93, 116.01, 0.209, 469.6, 50.8, 0, 449.77,\r\n  -14.48, 0, 429.94, -79.76, 0, 410.11, -145.04, 0, 390.28, -210.32, 0, 370.45,\r\n  -275.6, 0, 350.62, -340.88, 0,\r\n  // 112\r\n  208.38, 216.13, 0.932, 226.26, 281.39, 0.905, 273.43, 329.44, 0.865, 338.47,\r\n  348.35, 0.804, 406.42, 344.02, 0.703, 466.72, 313.59, 0.502, 502.25, 256.41,\r\n  0.301, 510.03, 188.98, 0.209, 517.45, 121.54, 0, 525.2, 54.21, 0, 532.95,\r\n  -13.12, 0, 540.7, -80.45, 0, 548.45, -147.78, 0, 556.2, -215.11, 0, 563.95,\r\n  -282.44, 0, 571.7, -349.77, 0,\r\n  // 113\r\n  208.24, 214.25, 0.904, 225.06, 279.06, 0.864, 270.57, 327.73, 0.802, 334.69,\r\n  347.92, 0.705, 402.16, 345.11, 0.505, 463.11, 317.22, 0.304, 500.49, 262,\r\n  0.197, 537.52, 206.37, 0, 574.9, 151.19, 0, 612.28, 96.01, 0, 649.66, 40.83,\r\n  0, 687.04, -14.35, 0, 724.42, -69.53, 0, 761.8, -124.71, 0, 799.18, -179.89,\r\n  0, 836.56, -235.07, 0,\r\n  // 114\r\n  208.12, 212.24, 0.863, 223.99, 276.94, 0.805, 268.12, 326.21, 0.705, 331.35,\r\n  347.57, 0.501, 398.37, 345.86, 0.3, 459.46, 319.93, 0.196, 520.13, 293.43, 0,\r\n  581.16, 267.36, 0, 642.19, 241.29, 0, 703.22, 215.22, 0, 764.25, 189.15, 0,\r\n  825.28, 163.08, 0, 886.31, 137.01, 0, 947.34, 110.94, 0, 1008.37, 84.87, 0,\r\n  1069.4, 58.8, 0,\r\n  // 115\r\n  208.03, 210.4, 0.804, 223, 274.88, 0.706, 265.9, 324.95, 0.505, 328.37,\r\n  347.36, 0.302, 394.91, 346.62, 0.206, 461.17, 345.52, 0, 527.65, 344.75, 0,\r\n  594.13, 343.98, 0, 660.61, 343.21, 0, 727.09, 342.44, 0, 793.57, 341.67, 0,\r\n  860.05, 340.9, 0, 926.53, 340.13, 0, 993.01, 339.36, 0, 1059.49, 338.59, 0,\r\n  1125.97, 337.82, 0,\r\n  // 116\r\n  207.92, 208.25, 0.705, 222.21, 272.76, 0.504, 263.98, 323.5, 0.311, 325.69,\r\n  346.7, 0.208, 386.92, 369.81, 0, 448.46, 393.16, 0, 510, 416.51, 0, 571.54,\r\n  439.86, 0, 633.08, 463.21, 0, 694.62, 486.56, 0, 756.16, 509.91, 0, 817.7,\r\n  533.26, 0, 879.24, 556.61, 0, 940.78, 579.96, 0, 1002.32, 603.31, 0, 1063.86,\r\n  626.66, 0,\r\n  // 117\r\n  207.9, 205.78, 0.502, 221.41, 270.17, 0.3, 262.03, 321.64, 0.218, 302.67,\r\n  372.28, 0, 343.35, 423.39, 0, 384.03, 474.5, 0, 424.71, 525.61, 0, 465.39,\r\n  576.72, 0, 506.07, 627.83, 0, 546.75, 678.94, 0, 587.43, 730.05, 0, 628.11,\r\n  781.16, 0, 668.79, 832.27, 0, 709.47, 883.38, 0, 750.15, 934.49, 0, 790.83,\r\n  985.6, 0,\r\n  // 118\r\n  207.96, 202.75, 0.29, 220.54, 266.99, 0.198, 233.19, 330.94, 0, 245.93,\r\n  394.99, 0, 258.67, 459.04, 0, 271.41, 523.09, 0, 284.15, 587.14, 0, 296.89,\r\n  651.19, 0, 309.63, 715.24, 0, 322.37, 779.29, 0, 335.11, 843.34, 0, 347.85,\r\n  907.39, 0, 360.59, 971.44, 0, 373.33, 1035.49, 0, 386.07, 1099.54, 0, 398.81,\r\n  1163.59, 0,\r\n  // 119\r\n  207.94, 198.97, 0.21, 207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0,\r\n  207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0,\r\n  207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0,\r\n  207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0, 207.65, 198.96, 0,\r\n  // 120\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 121\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 122\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 123\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 124\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 125\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  208, 200, 0, 208, 200, 0, 208, 200, 0, 208, 200, 0,\r\n  // 126\r\n  305.31, 118.88, 0, 376.91, 118.45, 0, 444.9, 118.65, 0, 516.65, 118.86, 0,\r\n  588.4, 119.07, 0, 660.15, 119.28, 0, 731.9, 119.49, 0, 803.65, 119.7, 0,\r\n  875.4, 119.91, 0, 947.15, 120.12, 0, 1018.9, 120.33, 0, 1090.65, 120.54, 0,\r\n  1162.4, 120.75, 0, 1234.15, 120.96, 0, 1305.9, 121.17, 0, 1377.65, 121.38, 0,\r\n  // 127\r\n  340.65, 61.56, 0, 339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0,\r\n  339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0,\r\n  339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0,\r\n  339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0, 339.06, 61.24, 0,\r\n];\r\n/** Draw order per beat, bottom first, as chain indices in hex. */\r\nconst CHAIN_ORDER: readonly string[] = [\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"0123456789abcdef\",\r\n  \"10dcb9e8a574f362\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"0123456789abcdef\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n  \"fedcba9876543210\",\r\n];\r\n\r\nfunction chainAt(beat: number): Bead[] {\r\n  const at = Math.min(Math.max(beat - CHAIN_AT, 0), CHAIN_BEATS - 1);\r\n  const i = Math.floor(at);\r\n  const t = at - i;\r\n  const out: Bead[] = [];\r\n  const read = (b: number, k: number, c: number) =>\r\n    CHAIN[Math.max(0, Math.min(CHAIN_BEATS - 1, b)) * 48 + k * 3 + c] as number;\r\n  for (let k = 0; k < 16; k++) {\r\n    const pos = (c: number) => {\r\n      const p0 = read(i - 1, k, c);\r\n      const p1 = read(i, k, c);\r\n      const p2 = read(i + 1, k, c);\r\n      const p3 = read(i + 2, k, c);\r\n      return (\r\n        0.5 *\r\n        (2 * p1 +\r\n          (-p0 + p2) * t +\r\n          (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t +\r\n          (-p0 + 3 * p1 - 3 * p2 + p3) * t * t * t)\r\n      );\r\n    };\r\n    const scale = Math.max(0, read(i, k, 2) * (1 - t) + read(i + 1, k, 2) * t);\r\n    out.push({ x: pos(0), y: pos(1), scale });\r\n  }\r\n  // While the chain is a stack the tail lies on top; once it opens out, the\r\n  // head. The knot in between is whatever the recording shows.\r\n  const order = CHAIN_ORDER[i] ?? \"\";\r\n  return Array.from(order, (c) => out[Number.parseInt(c, 16)] as Bead);\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   The canvas\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\n/** One letter, ready to paint: card pixels, its baseline, and its scale. */\r\nexport type Glyph = {\r\n  ch: string;\r\n  x: number;\r\n  y: number;\r\n  scale: number;\r\n  colour: string;\r\n};\r\n\r\n/** The type is drawn this many times finer than the frame, then reduced. */\r\nconst TYPE_SUPERSAMPLE = 4;\r\n\r\nfunction Stage({\r\n  beat,\r\n  width,\r\n  height,\r\n  k,\r\n  left,\r\n  top,\r\n  background,\r\n  glyphs,\r\n  font,\r\n  alpha,\r\n  blur,\r\n  tex,\r\n}: {\r\n  beat: number;\r\n  width: number;\r\n  height: number;\r\n  k: number;\r\n  left: number;\r\n  top: number;\r\n  background: readonly [number, number, number];\r\n  glyphs: readonly Glyph[];\r\n  font: string;\r\n  alpha: number;\r\n  blur: number;\r\n  tex: Table;\r\n}) {\r\n  const ref = useRef<HTMLCanvasElement>(null);\r\n  const typeRef = useRef<HTMLCanvasElement | null>(null);\r\n  const softRef = useRef<HTMLCanvasElement | null>(null);\r\n  const beads = useMemo(() => orbsAt(beat), [beat]);\r\n  useLayoutEffect(() => {\r\n    const canvas = ref.current;\r\n    const ctx = canvas?.getContext(\"2d\");\r\n    if (!canvas || !ctx) return;\r\n    ctx.clearRect(0, 0, width, height);\r\n    paintOrbs(ctx, beads, beat, width, height, k, left, top, background, tex);\r\n    if (glyphs.length === 0 || alpha <= 0) return;\r\n    // Glyph baselines snap to whole device pixels, in a canvas as on the\r\n    // page; drawn four times finer and reduced, they land where they were\r\n    // measured to within a quarter of one.\r\n    const type = typeRef.current ?? document.createElement(\"canvas\");\r\n    typeRef.current = type;\r\n    const tctx = type.getContext(\"2d\");\r\n    if (!tctx) return;\r\n    let x0 = Infinity;\r\n    let x1 = -Infinity;\r\n    let y0 = Infinity;\r\n    let y1 = -Infinity;\r\n    for (const g of glyphs) {\r\n      x0 = Math.min(x0, g.x - FONT_SIZE * g.scale);\r\n      x1 = Math.max(x1, g.x + 2 * FONT_SIZE * g.scale);\r\n      y0 = Math.min(y0, g.y - 1.4 * FONT_SIZE * g.scale);\r\n      y1 = Math.max(y1, g.y + 0.8 * FONT_SIZE * g.scale);\r\n    }\r\n    const ss = TYPE_SUPERSAMPLE;\r\n    // Whole device pixels at both ends, so the reduction is exact.\r\n    const X0 = Math.floor(left + x0 * k);\r\n    const Y0 = Math.floor(top + y0 * k);\r\n    const W = Math.ceil(left + x1 * k) - X0;\r\n    const H = Math.ceil(top + y1 * k) - Y0;\r\n    type.width = W * ss;\r\n    type.height = H * ss;\r\n    tctx.clearRect(0, 0, type.width, type.height);\r\n    tctx.font = font;\r\n    tctx.textBaseline = \"alphabetic\";\r\n    for (const g of glyphs) {\r\n      const f = ss * k * g.scale;\r\n      tctx.setTransform(\r\n        f,\r\n        0,\r\n        0,\r\n        f,\r\n        (left + g.x * k - X0) * ss,\r\n        (top + g.y * k - Y0) * ss,\r\n      );\r\n      tctx.fillStyle = g.colour;\r\n      tctx.fillText(g.ch, 0, 0);\r\n    }\r\n    // Blur at the fine scale too: a blur of under a pixel is a no-op in\r\n    // Skia, and a coarse one steps in whole-kernel jumps that a quarter\r\n    // pixel hides.\r\n    let src: HTMLCanvasElement = type;\r\n    if (blur > 0) {\r\n      const soft = softRef.current ?? document.createElement(\"canvas\");\r\n      softRef.current = soft;\r\n      const sctx = soft.getContext(\"2d\");\r\n      if (sctx) {\r\n        soft.width = type.width;\r\n        soft.height = type.height;\r\n        sctx.clearRect(0, 0, soft.width, soft.height);\r\n        sctx.filter = `blur(${blur * k * ss}px)`;\r\n        sctx.drawImage(type, 0, 0);\r\n        src = soft;\r\n      }\r\n    }\r\n    ctx.save();\r\n    ctx.globalAlpha = alpha;\r\n    ctx.imageSmoothingEnabled = true;\r\n    ctx.imageSmoothingQuality = \"high\";\r\n    ctx.drawImage(src, X0, Y0, W, H);\r\n    ctx.restore();\r\n  }, [\r\n    beads,\r\n    beat,\r\n    width,\r\n    height,\r\n    k,\r\n    left,\r\n    top,\r\n    background,\r\n    glyphs,\r\n    font,\r\n    alpha,\r\n    blur,\r\n    tex,\r\n  ]);\r\n  return (\r\n    <canvas\r\n      ref={ref}\r\n      width={width}\r\n      height={height}\r\n      style={{ position: \"absolute\", inset: 0, width, height }}\r\n    />\r\n  );\r\n}\r\n\r\nfunction paintOrbs(\r\n  ctx: CanvasRenderingContext2D,\r\n  beads: readonly Bead[],\r\n  beat: number,\r\n  width: number,\r\n  height: number,\r\n  k: number,\r\n  left: number,\r\n  top: number,\r\n  background: readonly [number, number, number],\r\n  tex: Table,\r\n) {\r\n  // Each orb's box in device pixels, then boxes that touch merged into one\r\n  // region: overlapping orbs have to be painted into the same pixels in draw\r\n  // order, and orbs that do not overlap should not cost a frame-sized buffer.\r\n  type Box = { x0: number; y0: number; x1: number; y1: number; of: number[] };\r\n  const boxes: Box[] = [];\r\n  beads.forEach((b, i) => {\r\n    if (b.scale <= 0.001) return;\r\n    const reach = (COVER_FROM + 8) * b.scale;\r\n    const x0 = Math.max(0, Math.floor(left + (b.x - reach) * k));\r\n    const y0 = Math.max(0, Math.floor(top + (b.y - reach) * k));\r\n    const x1 = Math.min(width, Math.ceil(left + (b.x + reach) * k));\r\n    const y1 = Math.min(height, Math.ceil(top + (b.y + reach) * k));\r\n    if (x1 > x0 && y1 > y0) boxes.push({ x0, y0, x1, y1, of: [i] });\r\n  });\r\n  for (let merged = true; merged; ) {\r\n    merged = false;\r\n    for (let i = 0; i < boxes.length && !merged; i++) {\r\n      for (let j = i + 1; j < boxes.length && !merged; j++) {\r\n        const a = boxes[i] as Box;\r\n        const c = boxes[j] as Box;\r\n        if (a.x0 < c.x1 && c.x0 < a.x1 && a.y0 < c.y1 && c.y0 < a.y1) {\r\n          a.x0 = Math.min(a.x0, c.x0);\r\n          a.y0 = Math.min(a.y0, c.y0);\r\n          a.x1 = Math.max(a.x1, c.x1);\r\n          a.y1 = Math.max(a.y1, c.y1);\r\n          a.of = a.of.concat(c.of).sort((m, n) => m - n);\r\n          boxes.splice(j, 1);\r\n          merged = true;\r\n        }\r\n      }\r\n    }\r\n  }\r\n  const col = new Float32Array(3);\r\n  const phase = beat / SCROLL_BEATS;\r\n  for (const box of boxes) {\r\n    const w = box.x1 - box.x0;\r\n    const h = box.y1 - box.y0;\r\n    const buf = new Float32Array(w * h * 3);\r\n    for (let i = 0; i < w * h; i++) {\r\n      buf[i * 3] = background[0];\r\n      buf[i * 3 + 1] = background[1];\r\n      buf[i * 3 + 2] = background[2];\r\n    }\r\n    for (const index of box.of) {\r\n      const b = beads[index] as Bead;\r\n      const reach = (COVER_FROM + 8) * b.scale;\r\n      const bx0 = Math.max(box.x0, Math.floor(left + (b.x - reach) * k));\r\n      const by0 = Math.max(box.y0, Math.floor(top + (b.y - reach) * k));\r\n      const bx1 = Math.min(box.x1, Math.ceil(left + (b.x + reach) * k));\r\n      const by1 = Math.min(box.y1, Math.ceil(top + (b.y + reach) * k));\r\n      for (let py = by0; py < by1; py++) {\r\n        // Card-pixel coordinates of this device pixel's centre, in the\r\n        // orb's own frame (its scale shrinks the whole orb, texture and all).\r\n        const ly = ((py + 0.5 - top) / k - b.y) / b.scale;\r\n        for (let px = bx0; px < bx1; px++) {\r\n          const lx = ((px + 0.5 - left) / k - b.x) / b.scale;\r\n          const r = Math.hypot(lx, ly);\r\n          if (r >= COVER_FROM + 8) continue;\r\n          const cov = linear(COVER, 0.5, COVER_FROM, r);\r\n          const shade = linear(SHADE, 0.5, COVER_FROM, r);\r\n          texel(\r\n            tex,\r\n            (ly - linear(WARP, 2, 0, Math.min(r, 22))) / PERIOD - phase,\r\n            col,\r\n          );\r\n          const o = ((py - box.y0) * w + (px - box.x0)) * 3;\r\n          for (let c = 0; c < 3; c++) {\r\n            buf[o + c] =\r\n              (buf[o + c] as number) * (1 - cov) +\r\n              (col[c] as number) * cov +\r\n              shade * (SHADE_TINT[c] as number);\r\n          }\r\n        }\r\n      }\r\n    }\r\n    const img = ctx.createImageData(w, h);\r\n    for (let i = 0; i < w * h; i++) {\r\n      img.data[i * 4] = buf[i * 3] as number;\r\n      img.data[i * 4 + 1] = buf[i * 3 + 1] as number;\r\n      img.data[i * 4 + 2] = buf[i * 3 + 2] as number;\r\n      img.data[i * 4 + 3] = 255;\r\n    }\r\n    ctx.putImageData(img, box.x0, box.y0);\r\n  }\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Type\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\n/** Font size and the line's advance-box centre and baseline, in card pixels. */\r\nexport const FONT_SIZE = 28.54;\r\nexport const LINE_CX = 358.87;\r\nexport const BASELINE = 206.46;\r\n/** The scale pivot: the middle of the x-height, above the baseline. */\r\nconst PIVOT = 7.8;\r\n\r\n/** One beat of the script: which card, how many of its words are showing. */\r\ntype Segment = {\r\n  at: number;\r\n  card: number;\r\n  /** Words of the card on screen; more than the card has means all of them. */\r\n  words: number;\r\n  /** Line scale per beat from `at`, about the middle of the x-height. */\r\n  scale: Table;\r\n  /** Advance-box centre offset from `LINE_CX` per beat from `at`. */\r\n  dx: Table;\r\n  /** Baseline offset from `BASELINE` per beat from `at`. */\r\n  dy?: Table;\r\n  /**\r\n   * Letters thrown off the baseline, in card pixels per beat from `at`. On the\r\n   * way out they alternate up and down by the full amount; on the way in they\r\n   * rise from below by it, weighted per letter by `rise`.\r\n   */\r\n  wave?: { amp: Table; enter: boolean };\r\n  /**\r\n   * The words this segment adds wear these, letter by letter, left to right —\r\n   * a few indigos and a violet, never the same twice in a row — and turn to\r\n   * ink the moment the next word lands.\r\n   */\r\n  tint?: readonly string[];\r\n  /** The whole line in one colour, per beat from `at`; `\"\"` is no override. */\r\n  wash?: readonly string[];\r\n  /** Opacity per beat from `at`. */\r\n  alpha?: Table;\r\n  /** Extra blur in card pixels per beat from `at`. */\r\n  blur?: Table;\r\n};\r\n\r\n/**\r\n * How far each letter of an arriving card sits below the line, relative to\r\n * the card's mean: every second letter twice as far, and the left of the\r\n * line lower than the right.\r\n */\r\nexport function rise(j: number, n: number): number {\r\n  const w = (i: number) =>\r\n    (i % 2 ? 2.1 : 1) * (1 - (0.6 * i) / Math.max(1, n - 1));\r\n  let sum = 0;\r\n  for (let i = 0; i < n; i++) sum += w(i);\r\n  return (w(j) * n) / sum;\r\n}\r\n\r\nconst PINK = \"#e5d1e4\";\r\nconst LAVENDER = \"#a495d9\";\r\nconst WASH = \"#8b7cc0\";\r\n\r\nconst SEGMENTS: readonly Segment[] = [\r\n  {\r\n    at: 0,\r\n    card: 0,\r\n    words: 99,\r\n    scale: [\r\n      1.0003, 1.0008, 1.0017, 1.0049, 1.0086, 1.0159, 1.0261, 1.0422, 1.0688,\r\n      1.1476,\r\n    ],\r\n    dx: [0.41],\r\n    wave: {\r\n      amp: [0, 0, 0, 0.02, 0.35, 0.56, 0.85, 1.34, 2.3, 5.4],\r\n      enter: false,\r\n    },\r\n  },\r\n  {\r\n    at: 10,\r\n    card: 1,\r\n    words: 99,\r\n    scale: [\r\n      0.8914, 0.9367, 0.9577, 0.9689, 0.9759, 0.9813, 0.9868, 0.9897, 0.9933,\r\n      0.9965, 0.9997, 1.0004,\r\n    ],\r\n    dx: [0.04, 0, 0, 0.02, -0.02, -0.02, 0, -0.05, -0.18, -0.54, -1.18, -3.8],\r\n    dy: [0.42],\r\n    wave: { amp: [3.94, 2.04, 1.15, 0.71, 0.33, 0.21, 0.08, 0], enter: true },\r\n    tint: [\"#232232\", \"#2b2546\", \"#503878\", \"#46347a\", \"#2e2a4a\", \"#1d193f\"],\r\n  },\r\n  {\r\n    at: 22,\r\n    card: 2,\r\n    words: 1,\r\n    scale: [1.0052, 1.0081, 1.0091, 1.0109, 1.0119, 1.0138],\r\n    dx: [2.2, 1.02, 0.43, -0.12, -1.0, -3.67],\r\n    tint: [\"#3a3450\", \"#625881\", \"#5c417f\", \"#432b61\", \"#30284a\"],\r\n  },\r\n  {\r\n    at: 28,\r\n    card: 2,\r\n    words: 2,\r\n    scale: [0.9819, 0.9969, 1.0021, 1.0061, 1.0088, 1.011],\r\n    dx: [1.32, 0.61, 0.2, -0.3, -1.12, -3.78],\r\n    tint: [\"#473b61\", \"#453c6a\", \"#322c5e\"],\r\n  },\r\n  {\r\n    at: 34,\r\n    card: 3,\r\n    words: 1,\r\n    scale: [1.0183, 1.0186, 1.0175],\r\n    dx: [-0.6, -1.41, -3.97],\r\n    tint: [\"#433861\", \"#3d3357\"],\r\n  },\r\n  {\r\n    at: 37,\r\n    card: 3,\r\n    words: 2,\r\n    scale: [0.9867, 1.0046, 1.0131, 1.0177, 1.0202, 1.0248, 1.0259, 1.0283],\r\n    dx: [0.85, 0.49, 0.31, 0.23, 0.08, -0.36, -1.12, -3.75],\r\n    tint: [\"#2f2941\", \"#483a5e\", \"#553f79\", \"#30274c\"],\r\n  },\r\n  {\r\n    at: 45,\r\n    card: 4,\r\n    words: 1,\r\n    scale: [1.0351, 1.0367, 1.0381],\r\n    dx: [1.86, -0.06, -3.13],\r\n    tint: [\"#463961\", \"#4f3b75\", \"#47376e\"],\r\n  },\r\n  {\r\n    at: 48,\r\n    card: 4,\r\n    words: 2,\r\n    scale: [1.0023, 1.0216, 1.0289, 1.0318],\r\n    dx: [1.49, 0.56, -0.51, -3.31],\r\n    tint: [\"#372a5b\", \"#493e6b\"],\r\n  },\r\n  {\r\n    at: 52,\r\n    card: 4,\r\n    words: 3,\r\n    scale: [\r\n      1.0193, 1.031, 1.0357, 1.0393, 1.0416, 1.0445, 1.046, 1.0476, 1.0496,\r\n      1.0504, 1.0514, 1.0524, 1.053, 1.0544, 1.0554, 1.0563, 1.0575, 1.0578,\r\n      1.0596, 1.0601,\r\n    ],\r\n    dx: [\r\n      1.15, 0.56, 0.35, 0.24, 0.22, 0.16, 0.12, 0.1, 0.08, 0.05, 0.05, 0.04,\r\n      0.04, 0.04, 0.05, 0.04, 0.03, 0.02, 0.03,\r\n    ],\r\n    tint: [\"#322a4c\", \"#584670\", \"#78609b\", \"#5e4a82\", \"#3a2f58\", \"#3d3751\"],\r\n  },\r\n  {\r\n    // The card washes to lavender and is gone in three beats.\r\n    at: 71,\r\n    card: 4,\r\n    words: 3,\r\n    scale: [1.0601, 1.0601, 1.0608],\r\n    dx: [0.08, 0.08, 0.03],\r\n    wash: [WASH],\r\n    alpha: [1, 1, 0.5, 0],\r\n  },\r\n  { at: 74, card: -1, words: 0, scale: [1], dx: [0] },\r\n  {\r\n    // The last card slides in from the right, holds, and lifts away.\r\n    at: 88,\r\n    card: 5,\r\n    words: 99,\r\n    scale: [1.0023],\r\n    dx: [\r\n      659.98, 362.82, 214.9, 141.01, 96.92, 67.35, 46.34, 31.09, 19.81, 11.74,\r\n      6.09, 2.35, 0.36, -0.22,\r\n    ],\r\n    dy: [\r\n      2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7,\r\n      2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.7, 2.53,\r\n      1.71, 0.27, -1.9, -5.05, -9.35, -15.23, -23.3, -34.65, -51.57, -75,\r\n    ],\r\n    wash: [PINK, PINK, PINK, LAVENDER, LAVENDER, \"\"],\r\n    blur: [\r\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\r\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, 0.45, 0.6, 0.87, 1.2,\r\n    ],\r\n    alpha: [\r\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\r\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.62, 0,\r\n    ],\r\n  },\r\n];\r\n\r\n/** Step lookup: the value at the last whole beat, holding past the end. */\r\nfunction step<T>(list: readonly T[] | undefined, at: number): T | undefined {\r\n  if (!list || list.length === 0) return undefined;\r\n  return list[Math.max(0, Math.min(list.length - 1, Math.floor(at + 1e-6)))];\r\n}\r\n\r\ntype Letter = { ch: string; x: number; word: number };\r\n/** Letters with their advance from the card's left edge, and the advance\r\n * width of the card with its first n words showing. */\r\ntype LineLayout = { letters: Letter[]; ends: number[] };\r\n\r\nfunction layoutCard(\r\n  words: readonly string[],\r\n  measure: (s: string) => number,\r\n): LineLayout {\r\n  const text = words.join(\" \");\r\n  const letters: Letter[] = [];\r\n  let word = 0;\r\n  for (let i = 0; i < text.length; i++) {\r\n    const ch = text[i] as string;\r\n    if (ch === \" \") {\r\n      word++;\r\n      continue;\r\n    }\r\n    letters.push({ ch, x: measure(text.slice(0, i)), word });\r\n  }\r\n  return {\r\n    letters,\r\n    ends: words.map((_, n) => measure(words.slice(0, n + 1).join(\" \"))),\r\n  };\r\n}\r\n\r\n/** Parse `a b | c d | …` into cards of words. */\r\nexport function parseScript(script: string): string[][] {\r\n  return script\r\n    .split(\"|\")\r\n    .map((c) => c.trim().split(/\\s+/).filter(Boolean))\r\n    .filter((c) => c.length > 0);\r\n}\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   The component\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nexport interface OrbSwarmProps {\r\n  /**\r\n   * Six cards, split with `|`. Cards three to five reveal word by word on the\r\n   * reference's beats; the first, second and last arrive whole.\r\n   */\r\n  script?: string;\r\n  /** The page. Defaults to the theme's `background`. */\r\n  background?: string;\r\n  /** The type, once a word has settled. Defaults to the theme's `foreground`. */\r\n  ink?: string;\r\n  /**\r\n   * The orbs' colour. The whole glass — its bands, its rim, and the tints the\r\n   * newest words wear — is turned to this hue and chroma; every lightness\r\n   * stays as measured. `#9f77f8` is the reference's own violet. Defaults to\r\n   * the theme's `primary`.\r\n   */\r\n  orbColor?: string;\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  fontFamily?: string;\r\n  /**\r\n   * How soft the type is, in card pixels of blur. The reference is a screen\r\n   * capture and its type is this soft; 0 is crisp.\r\n   */\r\n  softness?: number;\r\n  speed?: number;\r\n  className?: string;\r\n}\r\n\r\nconst DEFAULT_SCRIPT =\r\n  \"one command | what if | every launch | you shipped | got a video | in seconds\";\r\n\r\nexport function OrbSwarm({\r\n  script = DEFAULT_SCRIPT,\r\n  background: backgroundProp,\r\n  ink: inkProp,\r\n  orbColor: orbProp,\r\n  fontFamily,\r\n  softness = 0.7,\r\n  speed = 1,\r\n  className,\r\n  theme,\r\n  mode,\r\n}: OrbSwarmProps) {\r\n  const t = useKuchiTheme(theme, mode);\r\n  const background = backgroundProp ?? t.background;\r\n  const ink = inkProp ?? t.foreground;\r\n  const orbColor = orbProp ?? t.primary;\r\n  // Read off the page, not the prop: a provider or a dark `background` alone\r\n  // must flip the tints too.\r\n  const dark = rgbToOklch(parseColor(background)).l < 0.5;\r\n  const frame = useCurrentFrame();\r\n  const { width, height, fps } = useVideoConfig();\r\n  const beat = (frame / fps) * BEATS_PER_SECOND * speed;\r\n  const custom = resolveFont(fontFamily);\r\n  const font = `${WEIGHT} ${FONT_SIZE}px ${custom ?? `\"${FACE}\"`}`;\r\n  const bg = useMemo((): readonly [number, number, number] => {\r\n    const c = parseColor(background);\r\n    return [c.r * 255, c.g * 255, c.b * 255];\r\n  }, [background]);\r\n  const tex = useMemo(\r\n    () => recolourTable(TEX, recolourer(orbColor)),\r\n    [orbColor],\r\n  );\r\n\r\n  // `cover`, so a 16:9 composition crops the card rather than letterboxing it.\r\n  const k = Math.max(width / REF_W, height / REF_H);\r\n  const left = (width - REF_W * k) / 2;\r\n  const top = (height - REF_H * k) / 2;\r\n\r\n  const cards = useMemo(() => parseScript(script), [script]);\r\n\r\n  // Letter advances come from the face itself, so the measurement waits for\r\n  // it — and the frame waits for the measurement.\r\n  const [handle] = useState(() => delayRender(\"orb-swarm: measuring type\"));\r\n  const [layouts, setLayouts] = useState<LineLayout[] | null>(null);\r\n  useEffect(() => {\r\n    let live = true;\r\n    const run = async () => {\r\n      await loadFace();\r\n      await document.fonts.load(font).catch(() => undefined);\r\n      const ctx = document.createElement(\"canvas\").getContext(\"2d\");\r\n      if (!ctx || !live) return;\r\n      ctx.font = font;\r\n      setLayouts(\r\n        cards.map((c) => layoutCard(c, (s) => ctx.measureText(s).width)),\r\n      );\r\n    };\r\n    run();\r\n    return () => {\r\n      live = false;\r\n    };\r\n  }, [cards, font]);\r\n  useEffect(() => {\r\n    if (layouts) continueRender(handle);\r\n  }, [layouts, handle]);\r\n\r\n  const { glyphs, alpha, blur } = useMemo(\r\n    () => typeAt(beat, layouts, ink, orbColor, dark),\r\n    [beat, layouts, ink, orbColor, dark],\r\n  );\r\n\r\n  return (\r\n    <AbsoluteFill\r\n      className={className}\r\n      style={{ background, overflow: \"hidden\" }}\r\n    >\r\n      <Stage\r\n        beat={beat}\r\n        width={width}\r\n        height={height}\r\n        k={k}\r\n        left={left}\r\n        top={top}\r\n        background={bg}\r\n        glyphs={glyphs}\r\n        font={font}\r\n        alpha={alpha}\r\n        blur={Math.hypot(blur, softness)}\r\n        tex={tex}\r\n      />\r\n    </AbsoluteFill>\r\n  );\r\n}\r\n\r\n/** Every letter on screen at `beat`, and the line's opacity and extra blur. */\r\nexport function typeAt(\r\n  beat: number,\r\n  layouts: readonly LineLayout[] | null,\r\n  ink: string,\r\n  orbColor: string = MEASURED_ORB,\r\n  dark = false,\r\n): { glyphs: Glyph[]; alpha: number; blur: number } {\r\n  const f = recolourer(orbColor);\r\n  const paint = (hex: string) =>\r\n    dark ? onDark(recolourHex(hex, f)) : recolourHex(hex, f);\r\n  const none = { glyphs: [], alpha: 1, blur: 0 };\r\n  let segment: Segment | null = null;\r\n  for (const seg of SEGMENTS) if (beat >= seg.at) segment = seg;\r\n  if (!layouts || !segment || segment.card < 0) return none;\r\n  const layout = layouts[segment.card];\r\n  if (!layout) return none;\r\n  const local = beat - segment.at;\r\n  const s = sample(segment.scale, local);\r\n  const dx = sample(segment.dx, local);\r\n  const dy = segment.dy ? sample(segment.dy, local) : 0;\r\n  const blur = segment.blur ? Math.max(0, sample(segment.blur, local)) : 0;\r\n  const alpha = segment.alpha\r\n    ? Math.max(0, Math.min(1, step(segment.alpha, local) ?? 1))\r\n    : 1;\r\n  const shown = layout.letters.filter((l) => l.word < segment.words);\r\n  const n = Math.min(segment.words, layout.ends.length);\r\n  const span = layout.ends[n - 1] ?? 0;\r\n  const cx = LINE_CX + dx;\r\n  const x0 = cx - span / 2;\r\n  const y = BASELINE + dy - PIVOT + PIVOT * s;\r\n  const amp = segment.wave ? sample(segment.wave.amp, local) : 0;\r\n  // The words this segment adds, as opposed to the ones already down.\r\n  const before = SEGMENTS.filter(\r\n    (g) => g.card === segment.card && g.at < segment.at,\r\n  ).reduce((m, g) => Math.max(m, Math.min(g.words, layout.ends.length)), 0);\r\n  const fresh = shown.filter((l) => l.word >= before);\r\n  const wash = step(segment.wash, local) || \"\";\r\n  const glyphs = shown.map((l, i): Glyph => {\r\n    const lift = !segment.wave\r\n      ? 0\r\n      : segment.wave.enter\r\n        ? amp * rise(i, shown.length)\r\n        : i % 2\r\n          ? -amp\r\n          : amp;\r\n    let colour = ink;\r\n    if (wash) colour = paint(wash);\r\n    else if (segment.tint && l.word >= before) {\r\n      const j = fresh.indexOf(l);\r\n      const m = segment.tint.length;\r\n      const at =\r\n        fresh.length > 1 ? Math.round((j * (m - 1)) / (fresh.length - 1)) : 0;\r\n      const tint = segment.tint[at];\r\n      colour = tint ? paint(tint) : ink;\r\n    }\r\n    return {\r\n      ch: l.ch,\r\n      x: cx + (x0 + l.x - cx) * s,\r\n      y: y + lift,\r\n      scale: s,\r\n      colour,\r\n    };\r\n  });\r\n  return { glyphs, alpha, blur };\r\n}\r\n"}]}