neon-activity-graph 0.1.1 → 0.1.3
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ground-light.ts","../src/neon.ts","../src/size.ts","../src/hover-hum.ts","../src/graph.ts","../src/overlay-math.ts","../src/overlay.ts","../src/sound.ts","../src/index.ts"],"sourcesContent":["import type * as T from \"three\";\n\n/**\n * The light that glass casts on the ground. Light theme: the sun through the glass, traced on the graphics card: the same optics as `lib/glass-caustics.ts` (which is the readable version, and the one the tests and the\n * comparison with a path tracer are run on), written as a vertex shader. Dark theme: baked templates (below). A ray is a point: the shader follows it through the glass of its block (Snell's law, Fresnel, total internal reflection, rounded edges), works out where it lands on the ground,\n * and puts the point THERE, with the light it carries as its colour; the points are added up in a float target (additive blending), which is then smoothed a little. Millions of rays take a few milliseconds, where\n * the processor took seconds, and it is a one-time draw per theme; it is also what would let the lights change (a blinking light would only redraw the points).\n */\n\n/** A block of glass and the light that goes through it, in world units. */\nexport interface GlassLight {\n c: [number, number, number];\n h: [number, number, number];\n r: number;\n /** A small tilt of the glass's normals (no two blocks are alike). */\n bias: [number, number, number];\n /** The colour of the light the block gives out (dark), or of its glass (light theme). */\n col: [number, number, number];\n /** How much one ray carries. */\n power: number;\n /** Where the light is at full strength and where it has faded out, from the block's centre. */\n near: number;\n far: number;\n /** Half width of the rod inside (dark), and a seed of the block's own (decorrelates the evenly spread rays of one block from another's). */\n rod: number;\n seed: [number, number, number, number, number];\n /** (dark theme) the soft pool of haze under the block, see `StampedBlock`. */\n pool?: { col: [number, number, number]; r: number };\n}\n\nexport interface Grid {\n /** The size of the target, in pixels, and the number of pixels per world unit. */\n w: number;\n h: number;\n scale: number;\n /** The world position of the target's corner (x, z). */\n x0: number;\n z0: number;\n}\n\nconst COMMON = /* glsl */ `\nconst float IOR = 1.5;\nconst float R0 = 0.04;\nfloat reflectance(float c) { c = clamp(c, 0., 1.); return R0 + (1. - R0) * pow(1. - c, 5.); }\nfloat sdf(vec3 p, vec3 h, float r) {\n vec3 q = abs(p) - (h - r);\n return length(max(q, 0.)) + min(max(q.x, max(q.y, q.z)), 0.) - r;\n}\n// where a ray enters and leaves the sharp box (x, y), y < x for a miss\nvec2 slab(vec3 o, vec3 d, vec3 h) {\n float t0 = -1e9; float t1 = 1e9;\n for (int i = 0; i < 3; i++) {\n float di = d[i]; float oi = o[i]; float hi = h[i];\n if (abs(di) < 1e-9) { if (abs(oi) > hi) return vec2(1., -1.); continue; }\n float a = (-hi - oi) / di; float b = (hi - oi) / di;\n t0 = max(t0, min(a, b)); t1 = min(t1, max(a, b));\n }\n return vec2(t0, t1);\n}\nvec3 roundedNormal(vec3 p, vec3 h, float r, vec3 bias) {\n vec3 q = abs(p) - (h - r);\n vec3 s = vec3(p.x >= 0. ? 1. : -1., p.y >= 0. ? 1. : -1., p.z >= 0. ? 1. : -1.);\n float m = max(q.x, max(q.y, q.z));\n vec3 n;\n if (m <= 0.) {\n n = q.x >= q.y && q.x >= q.z ? vec3(s.x, 0., 0.) : q.y >= q.z ? vec3(0., s.y, 0.) : vec3(0., 0., s.z);\n } else {\n n = normalize(max(q, 0.) * s);\n }\n return normalize(n + bias);\n}\n// from inside the glass, at p going along d: bounce until it gets out; where it lands on the ground (world y = 0), the share of its power that got out, the length it went through glass\nbool leaveGlass(vec3 p, vec3 dir, vec3 c, vec3 h, float r, vec3 bias, out vec3 land, out float share, out float path) {\n vec3 o = p; vec3 d = dir; share = 1.; path = 0.; land = vec3(0.);\n for (int b = 0; b < 12; b++) {\n vec2 s = slab(o, d, h);\n if (s.y < s.x) return false;\n float lo = 0.; float hi = s.y + 0.01;\n for (int k = 0; k < 14; k++) { float mid = .5 * (lo + hi); if (sdf(o + d * mid, h, r) < 0.) lo = mid; else hi = mid; }\n float t = .5 * (lo + hi);\n path += t;\n vec3 q = o + d * t;\n vec3 n = roundedNormal(q, h, r, bias);\n vec3 outd = refract(d, -n, IOR);\n if (dot(outd, outd) > 1e-8) {\n share *= 1. - reflectance(dot(outd, n));\n if (outd.y >= -1e-3) return false;\n float g = -(q.y + c.y) / outd.y;\n land = vec3(q.x + c.x + outd.x * g, 0., q.z + c.z + outd.z * g);\n return true;\n }\n d = reflect(d, n);\n o = q + d * 1e-4;\n }\n return false;\n}\nfloat reachFade(float dist, float near, float far) {\n if (dist <= near) return 1.;\n if (dist >= far) return 0.;\n float u = 1. - (dist - near) / (far - near);\n return u * u * (3. - 2. * u);\n}\n`;\n\nconst ATTRIBUTES = /* glsl */ `\nattribute float ray;\nattribute vec3 iC; attribute vec3 iH; attribute vec3 iBias; attribute vec3 iCol;\nattribute vec4 iA; // r, power, near, far\nattribute vec4 iB; // rod, seed0, seed1, seed2\nattribute vec2 iD; // seed3, seed4\nuniform vec4 uGrid; // pixels per unit, x0, z0, (unused)\nuniform vec2 uSize; // target size in pixels\nvarying vec3 vColor;\nvec4 toClip(vec3 land) {\n float gx = (land.x - uGrid.y) * uGrid.x;\n float gz = (land.z - uGrid.z) * uGrid.x;\n return vec4(gx / uSize.x * 2. - 1., 1. - gz / uSize.y * 2., 0., 1.);\n}\nvoid discardPoint() { gl_Position = vec4(2., 2., 2., 1.); gl_PointSize = 0.; vColor = vec3(0.); }\n`;\n\nconst SUN_VERT = /* glsl */ `\n${COMMON}\n${ATTRIBUTES}\nuniform vec3 uDir; // the way the light travels\nuniform float uN; // rays per side\nuniform float uFree; // 0: where the glass lands the ray (adds), 1: where it would have landed (takes away)\nuniform float uAbsorb;\nuniform float uStraight;\nuniform float uPerArea; // pixel area / cos\nfloat hash(float n) { return fract(sin(n * 12.9898 + 78.233) * 43758.5453); }\nvoid main() {\n float i = ray;\n float r = iA.x; float power = iA.y; float near = iA.z; float far = iA.w;\n vec3 h = iH;\n float R = length(h);\n float gi = mod(i, uN); float gj = floor(i / uN);\n float cell = 2. * R / uN;\n float a = -R + (gi + hash(i + iB.y)) * cell;\n float b = -R + (gj + hash(i * 1.37 + iB.z)) * cell;\n vec3 d = uDir;\n vec3 u = normalize(cross(d, vec3(0., 1., 0.)));\n vec3 v = cross(d, u);\n vec3 o = u * a + v * b - d * 2. * R;\n vec2 s = slab(o, d, h);\n if (s.y < s.x) { discardPoint(); return; }\n float area = cell * cell * uPerArea;\n if (uFree > .5) {\n float fy = -(o.y + iC.y) / d.y;\n vec3 free = vec3(o.x + iC.x + d.x * fy, 0., o.z + iC.z + d.z * fy);\n vec3 tint = vec3(1.) - uStraight * exp(-uAbsorb * (vec3(1.) - iCol));\n vColor = -area * tint;\n gl_Position = toClip(free);\n gl_PointSize = 1.;\n return;\n }\n // sphere tracing from where it enters the sharp box, to the rounded one\n float te = max(0., s.x - 1e-3);\n bool hit = false;\n for (int k = 0; k < 48; k++) {\n float sd = sdf(o + d * te, h, r);\n if (sd < 1e-4) { hit = true; break; }\n te += sd;\n if (te > s.y + 1e-3) break;\n }\n if (!hit) { discardPoint(); return; }\n vec3 q = o + d * te;\n vec3 nrm = roundedNormal(q, h, r, iBias);\n vec3 inside = refract(d, nrm, 1. / IOR);\n if (dot(inside, inside) < 1e-8) { discardPoint(); return; }\n float entered = 1. - reflectance(-dot(d, nrm));\n vec3 land; float share; float path;\n if (!leaveGlass(q + inside * 1e-4, inside, iC, h, r, iBias, land, share, path)) { discardPoint(); return; }\n float fade = reachFade(length(land.xz - iC.xz), near, far);\n if (fade <= 0.) { discardPoint(); return; }\n vColor = area * entered * share * fade * exp(-uAbsorb * (vec3(1.) - iCol) * path);\n gl_Position = toClip(land);\n gl_PointSize = 1.;\n}\n`;\n\nconst POINT_FRAG = /* glsl */ `varying vec3 vColor; void main() { gl_FragColor = vec4(vColor, 1.); }`;\n\nconst FULL_VERT = /* glsl */ `varying vec2 vUv; void main() { vUv = uv; gl_Position = vec4(position.xy, 0., 1.); }`;\n\n/**\n * The light one block casts on the ground, baked: a path tracer (Mitsuba, see `scripts/caustic-templates`) rendered a glass block with a rod of light in it, from above, for a few heights of block and a few heights above\n * the ground, and averaged it over the eight symmetries of the square (enough samples that it is clean). What is stored is one quarter of each (x, z >= 0), as the log of the light, in an 8-bit picture. The page draws\n * each block's light by laying the right template under it (interpolated between the classes): the structure the tracer found, a fan out of every face and a faint wide glow, as sharp as the ground it is drawn on.\n */\nexport interface CausticTemplates {\n texture: T.Texture;\n /** The heights of block and of its foot above the ground the templates were rendered for. */\n heights: number[];\n feet: number[];\n /** How far from the block's centre a template reaches, in world units. */\n extent: number;\n}\n\nexport const TEMPLATE_HEIGHTS = [0.5, 1.3, 2.4];\nexport const TEMPLATE_FEET = [0, 0.9, 1.8, 2.7];\nexport const TEMPLATE_EXTENT = 8;\n/** The exponent of the curve applied to the baked light when it is laid down (above 1: the wide faint glow is lowered more than the bright streaks). */\nexport const STAMP_CONTRAST = 2.4;\n/** How much of the light at the very foot of a block is kept (0 to 1; it rises to all of it by 3 units out). */\nexport const STAMP_FOOT = 0.04;\n/** The quarter of a template, in pixels, and how the log is stored: value = (exp(byte / 255 * LOG_RANGE) - 1) * LOG_FLOOR. */\nexport const TEMPLATE_SIZE = 128;\nexport const LOG_FLOOR = 1e-4;\nexport const LOG_RANGE = 10;\n\n/** Fetch and decode the templates picture into a half-float texture (the light itself, not its log). */\nexport async function loadCausticTemplates(THREE: typeof T, url: string): Promise<CausticTemplates> {\n const img = new Image();\n img.src = url;\n await img.decode();\n const canvas = document.createElement(\"canvas\");\n canvas.width = img.width;\n canvas.height = img.height;\n const ctx = canvas.getContext(\"2d\", { willReadFrequently: true })!;\n ctx.drawImage(img, 0, 0);\n const px = ctx.getImageData(0, 0, img.width, img.height).data;\n const half = new Uint16Array(img.width * img.height * 4);\n const one = THREE.DataUtils.toHalfFloat(1);\n for (let i = 0; i < img.width * img.height; i++) {\n const v = (Math.exp((px[i * 4]! / 255) * LOG_RANGE) - 1) * LOG_FLOOR;\n half[i * 4] = half[i * 4 + 1] = half[i * 4 + 2] = THREE.DataUtils.toHalfFloat(v);\n half[i * 4 + 3] = one;\n }\n const texture = new THREE.DataTexture(half, img.width, img.height, THREE.RGBAFormat, THREE.HalfFloatType);\n texture.minFilter = THREE.LinearFilter;\n texture.magFilter = THREE.LinearFilter;\n texture.needsUpdate = true;\n return { texture, heights: TEMPLATE_HEIGHTS, feet: TEMPLATE_FEET, extent: TEMPLATE_EXTENT };\n}\n\n/** A block whose baked light is to be laid on the ground: where it is, its height and the height of its foot, and the colour of its light with its strength. */\nexport interface StampedBlock {\n x: number;\n z: number;\n height: number;\n foot: number;\n col: [number, number, number];\n /** The soft pool of haze under the block (it is there when the rod is on): its colour already times its strength, and its radius. */\n poolCol: [number, number, number];\n poolRadius: number;\n}\n\nconst STAMP_VERT = /* glsl */ `\nattribute vec2 iPos; attribute vec3 iCol; attribute vec4 iIdx; attribute vec3 iPoolCol; attribute float iPoolR;\nuniform vec4 uGrid; uniform vec2 uSize; uniform float uExtent;\nvarying vec3 vCol; varying vec2 vLocal; varying vec4 vIdx; varying vec3 vPoolCol; varying float vPoolR;\nvoid main() {\n vPoolCol = iPoolCol; vPoolR = iPoolR;\n vLocal = position.xy * 2. * uExtent;\n vCol = iCol; vIdx = iIdx;\n vec2 world = iPos + vLocal;\n float gx = (world.x - uGrid.y) * uGrid.x;\n float gz = (world.y - uGrid.z) * uGrid.x;\n gl_Position = vec4(gx / uSize.x * 2. - 1., 1. - gz / uSize.y * 2., 0., 1.);\n}\n`;\n\nconst STAMP_FRAG = /* glsl */ `\nuniform sampler2D atlas; uniform float uContrast; uniform float uFoot; uniform float uExtent; uniform vec2 uCells; uniform float uQuarter;\nvarying vec3 vCol; varying vec2 vLocal; varying vec4 vIdx; varying vec3 vPoolCol; varying float vPoolR;\nfloat tap(float h, float f, vec2 u) {\n // the template of height class h, foot class f: the cell of the atlas, sampled inside it (never across its edge)\n vec2 inside = (clamp(u, 0., 1.) * (uQuarter - 1.) + .5) / uQuarter;\n return texture2D(atlas, (vec2(f, h) + inside) / uCells).r;\n}\nvoid main() {\n // the soft pool: a round spot of haze under the block, a third of its peak at 0.45 of its radius and out to nothing at the radius\n float pu = length(vLocal) / vPoolR;\n float pool = pu >= 1. ? 0. : (pu < .45 ? 1. - (pu / .45) * .65 : .35 * (1. - (pu - .45) / .55));\n vec2 u = abs(vLocal) / uExtent;\n float edge = length(u);\n if (edge >= 1.) discard;\n float h0 = vIdx.x; float fH = vIdx.y; float f0 = vIdx.z; float fF = vIdx.w;\n float h1 = min(h0 + 1., uCells.y - 1.); float f1 = min(f0 + 1., uCells.x - 1.);\n float v = mix(mix(tap(h0, f0, u), tap(h0, f1, u), fF), mix(tap(h1, f0, u), tap(h1, f1, u), fF), fH);\n // (a curve that keeps the bright structure and lowers the faint wide glow under it, so that the streaks are not drowned: where the template is a tenth of its peak, it is far less than a tenth)\n v = pow(max(v, 0.), uContrast);\n // (the template ends at its edge: let it fade out just before, not stop)\n v *= 1. - smoothstep(.5, 1., edge);\n // (the bright foot of a block is for a block on open ground: in the picture its neighbours stand in the way, and the ground between blocks is not lit like that; it is lowered near the block, and the light that goes further out is kept)\n v *= mix(uFoot, 1., smoothstep(1., 3., length(vLocal)));\n gl_FragColor = vec4(vCol * v + vPoolCol * pool * 0.04, 1.);\n}\n`;\n\n/** A drawing of the light of many blocks on the ground: build it, `draw` into it, read its `texture`, `dispose` it. */\nexport function createGroundLight(THREE: typeof T, renderer: T.WebGLRenderer, grid: Grid) {\n // (float targets add exactly; half floats are the fallback where float blending is not offered)\n const type = renderer.extensions.has(\"EXT_float_blend\") && renderer.extensions.has(\"EXT_color_buffer_float\") ? THREE.FloatType : THREE.HalfFloatType;\n const make = () => new THREE.WebGLRenderTarget(grid.w, grid.h, { type, depthBuffer: false, minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter });\n let target = make();\n let spare = make();\n const cam = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n const points = new THREE.Scene();\n const full = new THREE.Scene();\n const quad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2));\n full.add(quad);\n const blurMat = new THREE.ShaderMaterial({\n uniforms: { map: { value: null }, stepv: { value: new THREE.Vector2() } },\n vertexShader: FULL_VERT,\n fragmentShader: `uniform sampler2D map; uniform vec2 stepv; varying vec2 vUv;\nvoid main() { gl_FragColor = (texture2D(map, vUv - 2. * stepv) + 4. * texture2D(map, vUv - stepv) + 6. * texture2D(map, vUv) + 4. * texture2D(map, vUv + stepv) + texture2D(map, vUv + 2. * stepv)) / 16.; }`,\n depthTest: false,\n depthWrite: false,\n });\n const disposables: { dispose(): void }[] = [blurMat, quad.geometry];\n\n /** One draw of rays: `blocks` each send `rays` rays (an emitter's: the light of a rod; the sun's: a grid of `rays` = n x n parallel rays), added into the target. */\n const draw = (blocks: GlassLight[], rays: number, vertex: string, uniforms: Record<string, { value: unknown }>, keep: boolean) => {\n const geo = new THREE.InstancedBufferGeometry();\n geo.instanceCount = blocks.length;\n const ray = new Float32Array(rays);\n for (let i = 0; i < rays; i++) ray[i] = i;\n geo.setAttribute(\"ray\", new THREE.BufferAttribute(ray, 1));\n // (a position attribute the shader does not use, so that the draw has a count)\n geo.setAttribute(\"position\", new THREE.BufferAttribute(new Float32Array(rays * 3), 3));\n const inst = (size: number, fill: (b: GlassLight) => number[]) => {\n const a = new Float32Array(blocks.length * size);\n blocks.forEach((b, i) => a.set(fill(b), i * size));\n return new THREE.InstancedBufferAttribute(a, size);\n };\n geo.setAttribute(\"iC\", inst(3, (b) => b.c));\n geo.setAttribute(\"iH\", inst(3, (b) => b.h));\n geo.setAttribute(\"iBias\", inst(3, (b) => b.bias));\n geo.setAttribute(\"iCol\", inst(3, (b) => b.col));\n geo.setAttribute(\"iA\", inst(4, (b) => [b.r, b.power, b.near, b.far]));\n geo.setAttribute(\"iB\", inst(4, (b) => [b.rod, b.seed[0], b.seed[1], b.seed[2]]));\n geo.setAttribute(\"iD\", inst(2, (b) => [b.seed[3], b.seed[4]]));\n const mat = new THREE.ShaderMaterial({\n vertexShader: vertex,\n fragmentShader: POINT_FRAG,\n uniforms: { uGrid: { value: new THREE.Vector4(grid.scale, grid.x0, grid.z0, 0) }, uSize: { value: new THREE.Vector2(grid.w, grid.h) }, ...uniforms },\n blending: THREE.CustomBlending,\n blendEquation: THREE.AddEquation,\n blendSrc: THREE.OneFactor,\n blendDst: THREE.OneFactor,\n depthTest: false,\n depthWrite: false,\n transparent: true,\n });\n const mesh = new THREE.Points(geo, mat);\n mesh.frustumCulled = false;\n points.add(mesh);\n const prevTarget = renderer.getRenderTarget();\n const prevAuto = renderer.autoClear;\n renderer.setRenderTarget(target);\n renderer.autoClear = !keep;\n renderer.render(points, cam);\n renderer.autoClear = prevAuto;\n renderer.setRenderTarget(prevTarget);\n points.remove(mesh);\n geo.dispose();\n mat.dispose();\n };\n\n /** The sun through the blocks (light theme): the target holds the difference to what the ground would get without the glass. */\n const sun = (blocks: GlassLight[], n: number, dir: [number, number, number], absorb: number, straight: number, pixelPerArea: number) => {\n const common = { uDir: { value: new THREE.Vector3(...dir) }, uN: { value: n }, uAbsorb: { value: absorb }, uStraight: { value: straight }, uPerArea: { value: pixelPerArea } };\n draw(blocks, n * n, SUN_VERT, { ...common, uFree: { value: 0 } }, false);\n draw(blocks, n * n, SUN_VERT, { ...common, uFree: { value: 1 } }, true);\n };\n\n /**\n * The baked light of blocks (dark theme): a quad per block, textured with the template of its size, added into the target. Returns what changes it afterwards: `update(levels)` sets how much of its light each block\n * gives out (0 to 1, one per block, in the order they were given) and draws the ground's light again, which is one draw of a few hundred quads.\n */\n const stamps = (blocks: StampedBlock[], templates: CausticTemplates) => {\n const geo = new THREE.InstancedBufferGeometry();\n const plane = new THREE.PlaneGeometry(1, 1);\n geo.setAttribute(\"position\", plane.getAttribute(\"position\"));\n geo.setIndex(plane.getIndex());\n geo.instanceCount = blocks.length;\n const pos = new Float32Array(blocks.length * 2);\n const base = new Float32Array(blocks.length * 3);\n const idx = new Float32Array(blocks.length * 4);\n const poolBase = new Float32Array(blocks.length * 3);\n const poolR = new Float32Array(blocks.length);\n // (a value's place between two classes: the lower class and how far on to the next)\n const place = (v: number, classes: number[]): [number, number] => {\n if (v <= classes[0]!) return [0, 0];\n for (let i = 1; i < classes.length; i++) if (v <= classes[i]!) return [i - 1, (v - classes[i - 1]!) / (classes[i]! - classes[i - 1]!)];\n return [classes.length - 1, 0];\n };\n blocks.forEach((b, i) => {\n pos.set([b.x, b.z], i * 2);\n base.set(b.col, i * 3);\n const [h0, fh] = place(b.height, templates.heights);\n const [f0, ff] = place(b.foot, templates.feet);\n idx.set([h0, fh, f0, ff], i * 4);\n poolBase.set(b.poolCol, i * 3);\n poolR[i] = b.poolRadius;\n });\n const poolColours = new THREE.InstancedBufferAttribute(poolBase.slice(), 3);\n const colours = new THREE.InstancedBufferAttribute(base.slice(), 3);\n geo.setAttribute(\"iPos\", new THREE.InstancedBufferAttribute(pos, 2));\n geo.setAttribute(\"iCol\", colours);\n geo.setAttribute(\"iIdx\", new THREE.InstancedBufferAttribute(idx, 4));\n geo.setAttribute(\"iPoolCol\", poolColours);\n geo.setAttribute(\"iPoolR\", new THREE.InstancedBufferAttribute(poolR, 1));\n const mat = new THREE.ShaderMaterial({\n vertexShader: STAMP_VERT,\n fragmentShader: STAMP_FRAG,\n uniforms: {\n uGrid: { value: new THREE.Vector4(grid.scale, grid.x0, grid.z0, 0) },\n uSize: { value: new THREE.Vector2(grid.w, grid.h) },\n uExtent: { value: templates.extent },\n atlas: { value: templates.texture },\n uContrast: { value: STAMP_CONTRAST },\n uFoot: { value: STAMP_FOOT },\n uCells: { value: new THREE.Vector2(templates.feet.length, templates.heights.length) },\n uQuarter: { value: TEMPLATE_SIZE },\n },\n blending: THREE.CustomBlending,\n blendEquation: THREE.AddEquation,\n blendSrc: THREE.OneFactor,\n blendDst: THREE.OneFactor,\n depthTest: false,\n depthWrite: false,\n transparent: true,\n side: THREE.DoubleSide,\n });\n const mesh = new THREE.Mesh(geo, mat);\n mesh.frustumCulled = false;\n const scene = new THREE.Scene();\n scene.add(mesh);\n const draw = () => {\n const prevTarget = renderer.getRenderTarget();\n renderer.setRenderTarget(target);\n renderer.render(scene, cam);\n renderer.setRenderTarget(prevTarget);\n };\n disposables.push(geo, plane, mat);\n draw();\n return {\n update(levels: ArrayLike<number>) {\n const a = colours.array as Float32Array;\n for (let i = 0; i < blocks.length; i++) {\n const k = levels[i]!;\n a[i * 3] = base[i * 3]! * k;\n a[i * 3 + 1] = base[i * 3 + 1]! * k;\n a[i * 3 + 2] = base[i * 3 + 2]! * k;\n const p = poolColours.array as Float32Array;\n p[i * 3] = poolBase[i * 3]! * k;\n p[i * 3 + 1] = poolBase[i * 3 + 1]! * k;\n p[i * 3 + 2] = poolBase[i * 3 + 2]! * k;\n }\n colours.needsUpdate = true;\n poolColours.needsUpdate = true;\n draw();\n },\n };\n };\n\n /** A smoothing of a few pixels (the rays are a sample). */\n const smooth = (passes: number) => {\n const prevTarget = renderer.getRenderTarget();\n quad.material = blurMat;\n for (let i = 0; i < passes; i++) {\n for (const step of [new THREE.Vector2(1 / grid.w, 0), new THREE.Vector2(0, 1 / grid.h)]) {\n blurMat.uniforms.map!.value = target.texture;\n blurMat.uniforms.stepv!.value.copy(step);\n renderer.setRenderTarget(spare);\n renderer.render(full, cam);\n [target, spare] = [spare, target];\n }\n }\n renderer.setRenderTarget(prevTarget);\n };\n\n return {\n stamps,\n sun,\n smooth,\n get texture() {\n return target.texture;\n },\n dispose() {\n target.dispose();\n spare.dispose();\n disposables.forEach((d) => d.dispose());\n },\n };\n}\n","/**\n * The neon start-up of the dark theme's rods: when the picture appears the rods do not just come on, they flicker like a gas tube that is struggling to start (the blocks are divided into rectangular areas, each with its own\n * few stutters of light with gaps between, and then a short warm-up); with a faint low hum that dies away slowly and a few quiet bell-like dings. No file: the sound is synthesised (Web Audio), and only if the browser lets\n * the page make sound and the tab is in view (it does not before the visitor has interacted with the page; then it is silent and nothing else changes).\n *\n * This module only decides the levels (0 to 1, one per block, as a function of time) and the sound; what a level does to the picture is the scene's business (`apply`).\n */\nexport interface NeonBlock {\n /** Where the block is on the ground (world units, x across, z in depth), to put it in an area. */\n x: number;\n z: number;\n /** Where the block is across the picture, -1 (left) to 1 (right), for the sound's stereo place. */\n pan: number;\n /** 0..1, how busy the day was (a busier rod is likelier to be one of the flickering ones). */\n t: number;\n}\n\nexport interface NeonOptions {\n blocks: NeonBlock[];\n /** Called with the levels whenever any of them changed. */\n /** `idle` is true for the flickers after the start-up (a tube that is off is then seen as a dark gap in a lit sign, not as one lit by its neighbours as in the start-up). */\n apply: (levels: Float32Array, idle?: boolean) => void;\n /** Called once all the lights are steady. */\n done: () => void;\n sound: boolean;\n /** How often the picture is updated while the start-up runs (a weak device is given fewer). */\n fps?: number;\n /** How often the picture is updated while the wobble runs (frames a second; the wobble's fastest drift is 0.4 of it, so that it is never faster than the updates can show). */\n wobbleFps?: number;\n /** A seed, so that a run can be repeated. */\n seed?: number;\n /** Whether a flicker may be shown and heard now (the picture in view, the tab visible); the quirks of the idle neon check it each time. */\n canPlay?: () => boolean;\n}\n\n/** How many areas the rods are divided into, how many of them flicker (all of them now; a smaller number would leave the others on from the start), how long the start-up lasts, and how often the picture is updated while it does. */\nconst AREAS = 5;\nconst FLICKERING = AREAS;\nconst SPAN_MS = 2600;\nexport const NEON_FPS = 20;\n\ninterface Stutter {\n at: number;\n length: number;\n level: number;\n}\n\n/**\n * A tiny bell: a few partials that are not whole multiples of the pitch (1, 2.76, 5.4: the ratios of a small struck bar), each dying away on its own, the higher ones faster.\n */\nconst PARTIALS: [number, number, number][] = [[1, 1, 0.3], [2.76, 0.35, 0.14], [5.4, 0.12, 0.07]];\nexport function bell(c: AudioContext, dest: AudioNode, when: number, f0: number, pan: number, level: number) {\n const out = c.createGain();\n out.gain.value = 0.05 * level;\n const panner = c.createStereoPanner();\n panner.pan.value = pan * 0.8;\n out.connect(panner).connect(dest);\n for (const [ratio, gain, decay] of PARTIALS) {\n const f = f0 * ratio;\n if (f > 16000) continue;\n const o = c.createOscillator();\n o.type = \"sine\";\n o.frequency.value = f;\n const g = c.createGain();\n g.gain.setValueAtTime(0, when);\n g.gain.linearRampToValueAtTime(gain, when + 0.001);\n g.gain.exponentialRampToValueAtTime(0.0001, when + decay);\n o.connect(g).connect(out);\n o.start(when);\n o.stop(when + decay + 0.02);\n }\n}\n\nexport function createNeon({ blocks, apply, done, sound, fps = NEON_FPS, wobbleFps = 40, seed = 7, canPlay = () => true }: NeonOptions) {\n // (nothing to light: a controller that does nothing, rather than a search for the centres of areas among no blocks)\n if (blocks.length === 0) return { levels: new Float32Array(0), count: 0, start: () => done(), stop: () => {} };\n let s = seed;\n const random = () => ((s = (s * 16807) % 2147483647) / 2147483647);\n const levels = new Float32Array(blocks.length).fill(1);\n // The rods are divided into areas that are rectangles: the picture is cut in two across its longer side, then the biggest piece again (each cut at a random place near the middle, by the number of blocks), until there are `AREAS` pieces. So the\n // blocks of an area are next to each other and the areas are of different sizes; the pieces flicker each as one: a stuttering of its own, the same for all its blocks, each a few milliseconds off the others and not quite as bright, so that it reads as a patch of tubes on one circuit.\n const pieces: number[][] = [blocks.map((_, i) => i)];\n while (pieces.length < Math.min(AREAS, blocks.length)) {\n pieces.sort((p, q) => q.length - p.length);\n const piece = pieces.shift()!;\n if (piece.length < 2) {\n pieces.push(piece);\n break;\n }\n const xs = piece.map((i) => blocks[i]!.x);\n const zs = piece.map((i) => blocks[i]!.z);\n const alongX = Math.max(...xs) - Math.min(...xs) >= Math.max(...zs) - Math.min(...zs);\n const sorted = [...piece].sort((i, j) => (alongX ? blocks[i]!.x - blocks[j]!.x : blocks[i]!.z - blocks[j]!.z));\n const cut = Math.min(sorted.length - 1, Math.max(1, Math.round(sorted.length * (0.35 + random() * 0.3))));\n pieces.push(sorted.slice(0, cut), sorted.slice(cut));\n }\n const centres = pieces;\n const areaOf = new Array<number>(blocks.length).fill(0);\n pieces.forEach((p, k) => p.forEach((i) => (areaOf[i] = k)));\n const flickering = new Set([...centres.keys()].sort(() => random() - 0.5).slice(0, FLICKERING));\n const areaPlans = new Map<number, { start: number; stutters: Stutter[]; steady: number }>();\n flickering.forEach((k) => {\n const start = random() * (SPAN_MS - 1100);\n // (few stutters: the picture is not to be a nervous flicker; fewer, bigger circuits, each one with a few)\n const count = 2 + Math.floor(random() * 3);\n const stutters: Stutter[] = [];\n let at = start;\n for (let j = 0; j < count; j++) {\n const length = 30 + random() * 110;\n stutters.push({ at, length, level: 0.4 + random() * 0.6 });\n // (the gaps get shorter: the tubes are catching)\n at += length + (50 + random() * 240) * (1 - (j / count) * 0.6);\n }\n areaPlans.set(k, { start, stutters, steady: at + 60 });\n });\n // (the start-up begins at once: the whole plan is moved so that its first area stutters at the very start, not after a random wait. The picture has only just come into focus, and the time it took to load is enough of a wait)\n const lead = Math.min(...[...areaPlans.values()].map((p) => p.start));\n if (Number.isFinite(lead)) for (const p of areaPlans.values()) {\n p.start -= lead;\n p.steady -= lead;\n for (const st of p.stutters) st.at -= lead;\n }\n const plans = new Map<number, { start: number; stutters: Stutter[]; steady: number; shift: number; scale: number; area: number }>();\n blocks.forEach((_, i) => {\n const base = areaPlans.get(areaOf[i]!);\n if (base) plans.set(i, { ...base, shift: random() * 70, scale: 0.8 + random() * 0.2, area: areaOf[i]! });\n });\n const end = Math.max(0, ...[...areaPlans.values()].map((p) => p.steady + 380 + 70));\n const levelAt = (plan: { start: number; stutters: Stutter[]; steady: number; shift: number; scale: number }, at: number) => {\n const ms = at - plan.shift;\n if (ms < plan.start) return 0;\n if (ms >= plan.steady + 380) return 1;\n if (ms >= plan.steady) return 0.6 + 0.4 * ((ms - plan.steady) / 380);\n for (const st of plan.stutters) if (ms >= st.at && ms < st.at + st.length) return st.level * plan.scale;\n return 0;\n };\n // (the rods that flicker are off until their turn)\n plans.forEach((_, i) => (levels[i] = 0));\n let raf = 0;\n let t0 = 0;\n let last = -1;\n let dirty = false;\n let running = false;\n\n // --- the sound ---\n // In step with the picture: a light changed at time P (the picture's clock) is on the screen about a frame and a half later (the next frame is drawn, then shown), and a sound scheduled for the audio clock's time T is heard\n // `outputLatency` later (the speakers, the Bluetooth link). So a sound for P is scheduled at P + the frame's delay - the output latency, on the audio clock (the two clocks are tied at the moment of scheduling).\n const FRAME_LAG = 25;\n const audioTime = (c: AudioContext, perfStart: number) => c.currentTime - (performance.now() - perfStart) / 1000 + FRAME_LAG / 1000 - (c.outputLatency || c.baseLatency || 0);\n // (a browser that has not let the page make sound yet leaves the context suspended for ever: then nothing waits for it)\n const mayWait = () => (navigator as Navigator & { userActivation?: { hasBeenActive: boolean } }).userActivation?.hasBeenActive !== false;\n let ctx: AudioContext | null = null;\n let closeTimer = 0;\n const closeSound = () => {\n window.clearTimeout(closeTimer);\n document.removeEventListener(\"visibilitychange\", onVisibility);\n const c = ctx;\n ctx = null;\n // (a context that is closed already refuses to close again: nothing to do then)\n if (c && c.state !== \"closed\") c.close().catch(() => {});\n };\n // (the sound was scheduled in one go against the audio clock, and a tab that is not in view stops the picture's clock: when the tab goes out of view the sound goes too)\n const onVisibility = () => {\n if (document.hidden) closeSound();\n };\n // The context, ready before the start-up's clock starts (so that no sound of the first moments is late): null when there is to be no sound, or the browser does not let the page make one yet.\n const prepare = async (): Promise<AudioContext | null> => {\n if (!sound || typeof AudioContext === \"undefined\" || document.hidden || !mayWait()) return null;\n let c: AudioContext;\n try {\n c = new AudioContext();\n await Promise.race([c.resume(), new Promise((r) => setTimeout(r, 300))]);\n } catch {\n return null;\n }\n if (c.state !== \"running\" || document.hidden) {\n c.close().catch(() => {});\n return null;\n }\n return c;\n };\n const schedule = (c: AudioContext) => {\n ctx = c;\n const now = audioTime(c, t0);\n const master = c.createGain();\n master.gain.value = 0.5;\n const limiter = c.createDynamicsCompressor();\n master.connect(limiter).connect(c.destination);\n // The ballast's hum: one low tone (100 Hz, the mains' second harmonic, a sawtooth with its edges taken off) that follows how much of the tubes are lit, and that dies away slowly once the last one has settled.\n const lit: number[] = [];\n for (let ms = 0; ms <= end + 200; ms += 25) {\n let sum = 0;\n plans.forEach((p) => (sum += levelAt(p, ms)));\n lit.push(sum / Math.max(1, plans.size));\n }\n const settled = now + (end + 200) / 1000;\n const FADE = 10;\n const hum = c.createOscillator();\n hum.type = \"sawtooth\";\n hum.frequency.value = 100;\n const lowpass = c.createBiquadFilter();\n lowpass.type = \"lowpass\";\n lowpass.frequency.value = 520;\n const humGain = c.createGain();\n humGain.gain.setValueAtTime(0, c.currentTime);\n lit.forEach((v, i) => humGain.gain.linearRampToValueAtTime(0.004 * v, Math.max(now + (i * 25) / 1000, c.currentTime + 0.001)));\n // (the tail: an exponential, which is what a fading hum does; its time constant a third of its length)\n humGain.gain.setTargetAtTime(0, Math.max(settled, c.currentTime), FADE / 3);\n hum.connect(lowpass).connect(humGain).connect(master);\n hum.start(Math.max(now, c.currentTime));\n const stopAt = settled + FADE * 1.6;\n hum.stop(stopAt);\n const members = new Map<number, number[]>();\n plans.forEach((p, i) => (members.get(p.area) ?? members.set(p.area, []).get(p.area)!).push(i));\n // The tick of a tube lighting: not a crackle but a tiny bell, a very high, short, quiet ding; the pitch is a little different each time.\n // Not every tube dings, and no two dings are alike: each tube has its own voice, the same every time (most ding, a few are silent: in a sign of this many tubes some are quiet), its own band of pitch (some low, most high, some very high) and its own\n // loudness, and each ding is a little different again (pitch and volume).\n const voices = blocks.map(() => {\n const r = random();\n const band = random();\n const hz = band < 0.15 ? 1300 + random() * 250 : 2700 + random() * 650;\n return { quiet: r >= 0.85, hz, gain: 0.45 + random() * 0.95 };\n });\n // (the clicks are first collected, then thinned out evenly over the whole start-up if there are more than 40: a cap met in the order they are made would silence the last areas, and the sound would end before the last flicker)\n const heard: { at: number; pan: number; level: number; tube: number }[] = [];\n const click = (at: number, pan: number, level: number, tube: number) => {\n const voice = voices[tube];\n // (at the tube's own moment: its picture is a few ms off the others', and its sound goes with it)\n if (voice && !voice.quiet) heard.push({ at: at + (plans.get(tube)?.shift ?? 0), pan, level, tube });\n };\n // (a few clicks for each stutter of an area, from some of its tubes, a few milliseconds apart: the tubes switching on, and off again)\n areaPlans.forEach((plan, area) => {\n const own = members.get(area) ?? [];\n if (!own.length) return;\n plan.stutters.forEach((st) => {\n const n = 1 + Math.floor(random() * 3);\n for (let k = 0; k < n; k++) {\n const i = own[Math.floor(random() * own.length)]!;\n click(st.at, blocks[i]!.pan, st.level, i);\n if (random() < 0.6) click(st.at + st.length, blocks[i]!.pan, st.level * 0.35, i);\n }\n });\n // (the last light of the area, when it comes on for good: a few of its tubes say so, the stronger ones, at the moment the picture does it)\n const settle = 2 + Math.floor(random() * 3);\n for (let k = 0; k < settle; k++) {\n const i = own[Math.floor(random() * own.length)]!;\n click(plan.steady, blocks[i]!.pan, 0.85, i);\n }\n });\n const keep = Math.min(1, 40 / Math.max(1, heard.length));\n heard.forEach((h) => {\n if (random() > keep) return;\n const voice = voices[h.tube]!;\n const when = Math.max(now + h.at / 1000, c.currentTime);\n bell(c, master, when, voice.hz * (0.98 + random() * 0.04), h.pan, h.level * voice.gain * (0.6 + random() * 0.6));\n });\n closeTimer = window.setTimeout(closeSound, (stopAt - c.currentTime) * 1000 + 500);\n };\n\n\n // --- the idle neon: once everything is on, from time to time a small batch of tubes flickers, as a real sign does (one or two, a few at most, close to one another): out with a lower ding, a stutter, back on with a\n // higher one. Completely random, never the same twice, and no change to the picture once it is over. ---\n let idleTimer = 0;\n let idleRaf = 0;\n let idleCtx: AudioContext | null = null;\n let idleClose = 0;\n let idleOn = false;\n let idleSince = 0;\n const idleRandom = () => Math.random();\n // --- the wobble: a tube's gas is never perfectly steady, least of all while the ballast hums. Every tube's brightness drifts slowly (two slow sines of its own, its own strength: a few wobble a lot, most hardly at all), and how\n // much follows the hum's own loudness: it rises as the tubes light, is at its fullest when the start-up has settled, and dies away with the hum (the same decay, 2 s). No sound of its own. Tubes that are in a flicker are left to it. ---\n const busy = new Set<number>();\n // (fast, as the hum is: the two drifts at a quarter to a half, and at a half to all, of 0.4 of the update rate: 4-8 Hz and 8-16 Hz at 40 updates a second; a faster drift than half the rate cannot be shown)\n const fMax = wobbleFps * 0.4;\n const wobbleSeed = blocks.map(() => ({ s: random() < 0.18 ? 0.4 + random() * 0.6 : 0, f1: fMax * (0.25 + random() * 0.25), f2: fMax * (0.5 + random() * 0.5), p1: random() * 6.283, p2: random() * 6.283 }));\n const rate = Math.max(fps, wobbleFps);\n const HUM_STEP = 25;\n const humEnd = end + 200;\n const humLit: number[] = [];\n for (let ms = 0; ms <= humEnd; ms += HUM_STEP) {\n let sum = 0;\n plans.forEach((p) => (sum += levelAt(p, ms)));\n humLit.push(sum / Math.max(1, plans.size));\n }\n /** The hum's loudness, 0 to 1, `ms` after the start-up began (the sound's own envelope: the share of tubes lit, then an exponential fade of time constant 2 s). */\n const humAt = (ms: number) => (ms <= humEnd ? (humLit[Math.min(humLit.length - 1, Math.floor(ms / HUM_STEP))] ?? 0) : Math.exp(-(ms - humEnd) / 3333));\n /** Down to 55 % of its brightness, at the hum's loudest, for the strongest tube; only about one tube in five wobbles at all. */\n const WOBBLE_DEPTH = 0.45;\n const wob = (i: number, ms: number, hum: number) => {\n if (hum <= 0.005) return 1;\n const w = wobbleSeed[i]!;\n const sec = ms / 1000;\n const n = 0.5 + 0.5 * (0.6 * Math.sin(6.283 * w.f1 * sec + w.p1) + 0.4 * Math.sin(6.283 * w.f2 * sec + w.p2));\n return 1 - WOBBLE_DEPTH * hum * w.s * n;\n };\n let tailing = false;\n let tailRaf = 0;\n let tailLast = -1;\n const tail = (stamp: number) => {\n tailRaf = 0;\n if (!tailing) return;\n const ms = performance.now() - t0;\n const hum = humAt(ms);\n if (tailLast < 0 || stamp - tailLast >= 1000 / rate) {\n tailLast = stamp;\n // (only while the picture is in view: out of view the wobble goes on in time, unseen)\n if (canPlay() && !document.hidden) {\n for (let i = 0; i < blocks.length; i++) if (!busy.has(i)) levels[i] = wob(i, ms, hum);\n apply(levels);\n }\n }\n if (hum < 0.015) {\n tailing = false;\n for (let i = 0; i < blocks.length; i++) if (!busy.has(i)) levels[i] = 1;\n apply(levels);\n done();\n return;\n }\n tailRaf = requestAnimationFrame(tail);\n };\n const stopIdle = () => {\n idleOn = false;\n tailing = false;\n cancelAnimationFrame(tailRaf);\n busy.clear();\n window.clearTimeout(idleTimer);\n window.clearTimeout(idleClose);\n cancelAnimationFrame(idleRaf);\n const c = idleCtx;\n idleCtx = null;\n if (c && c.state !== \"closed\") c.close().catch(() => {});\n };\n // (the context first, and the flicker's picture only starts when it is ready, so that the first sound is not late; null: silent, and the picture does not wait)\n const idleContext = async (): Promise<AudioContext | null> => {\n if (!sound || typeof AudioContext === \"undefined\" || !mayWait()) return null;\n let c: AudioContext;\n try {\n c = new AudioContext();\n await Promise.race([c.resume(), new Promise((r) => setTimeout(r, 300))]);\n } catch {\n return null;\n }\n // (not allowed to make sound yet)\n if (c.state !== \"running\" || !idleOn) {\n c.close().catch(() => {});\n return null;\n }\n return c;\n };\n const idleSound = (c: AudioContext, edges: { at: number; on: boolean; level: number }[], pan: number, perfStart: number) => {\n idleCtx = c;\n const master = c.createGain();\n master.gain.value = 0.5;\n master.connect(c.createDynamicsCompressor()).connect(c.destination);\n // (every time the tube goes out, a lower bell; every time it lights, a higher one)\n const base = audioTime(c, perfStart);\n // (one pitch for going out and one for lighting, the same each time it happens in this flicker: it is the one tube, going out and on again)\n const outHz = 800 + idleRandom() * 150;\n const onHz = 2700 + idleRandom() * 350;\n edges.forEach((e) => bell(c, master, base + e.at / 1000, e.on ? onHz : outHz, pan, e.level));\n window.clearTimeout(idleClose);\n idleClose = window.setTimeout(() => {\n const x = idleCtx;\n idleCtx = null;\n if (x && x.state !== \"closed\") x.close().catch(() => {});\n }, (edges[edges.length - 1]?.at ?? 0) + 1500);\n };\n const flicker = () => {\n // (the wait to the next: from 3 to 20 s right after the start-up, more often short than long, and it stretches the longer the sign has been on, e^(t/45 s): about 7 times at 1.5 minutes, 55 times at 3: after a few minutes, hardly ever)\n const slow = Math.exp((performance.now() - idleSince) / 45000);\n idleTimer = window.setTimeout(flicker, (3000 + idleRandom() ** 1.6 * 17000) * slow);\n if (!idleOn || document.hidden || !canPlay()) return;\n // (a batch: often a whole segment of tubes next to one another, as if a stretch of the sign were failing; sometimes a few, rarely just the one)\n const r = idleRandom();\n const want = r < 0.2 ? 1 : r < 0.45 ? 2 + Math.floor(idleRandom() * 3) : r < 0.8 ? 5 + Math.floor(idleRandom() * 5) : 10 + Math.floor(idleRandom() * 9);\n const first = Math.floor(idleRandom() * blocks.length);\n const ranked = blocks\n .map((b, i) => ({ i, d: Math.hypot(b.x - blocks[first]!.x, b.z - blocks[first]!.z) }))\n .filter((o) => o.d <= 5)\n .sort((a, b) => a.d - b.d)\n .slice(0, want);\n const batch = ranked.map((o) => o.i);\n batch.forEach((i) => busy.add(i));\n // (out for a time that is short or long, from 0.12 to 2.5 s, more often short; then 0 to 3 stutters on the way back (a half-glow, and out again), then on; each tube a few ms off the others)\n const dark = 120 + idleRandom() ** 2 * 2400;\n let at = dark;\n const glows: [number, number, number][] = [];\n const stutters = idleRandom() < 0.55 ? 1 + Math.floor(idleRandom() * 3) : 0;\n for (let j = 0; j < stutters; j++) {\n const len = 40 + idleRandom() * 60;\n glows.push([at, at + len, 0.55 + idleRandom() * 0.3]);\n at += len + 40 + idleRandom() * 110;\n }\n const onAt = at;\n // (each a few ms off the others, the farther from the first the later: the failure runs along the segment)\n const shift = ranked.map((o) => o.d * 12 + idleRandom() * 30);\n const total = onAt + 40 + 40;\n // (one sound for each change: out, then each stutter lights and goes out, then the last light; the stutters a little fainter)\n const edges = [{ at: 0, on: false, level: 1 }];\n glows.forEach(([a, b, v]) => edges.push({ at: a, on: true, level: 0.5 * v + 0.2 }, { at: b, on: false, level: 0.6 }));\n edges.push({ at: onAt, on: true, level: 0.8 });\n const play = async () => {\n const c = await idleContext();\n if (!idleOn) {\n c?.close().catch(() => {});\n return;\n }\n const t0 = performance.now();\n if (c) idleSound(c, edges, blocks[first]!.pan, t0);\n let last = -1;\n const step = (stamp: number) => {\n idleRaf = 0;\n if (!idleOn) return;\n const ms = stamp - t0;\n // (drawn only when a light changed, and at once: the changes are the sound's, so they are not held to the update rate)\n let changed = false;\n batch.forEach((i, k) => {\n const m = ms - shift[k]!;\n let v = 1;\n if (m >= 0 && m < onAt) v = glows.find(([a, b]) => m >= a && m < b)?.[2] ?? 0;\n if (v !== levels[i] || last < 0) changed = true;\n levels[i] = v;\n });\n last = stamp;\n if (changed) apply(levels, true);\n if (ms >= total) {\n batch.forEach((i) => {\n levels[i] = 1;\n busy.delete(i);\n });\n apply(levels, true);\n done();\n return;\n }\n idleRaf = requestAnimationFrame(step);\n };\n idleRaf = requestAnimationFrame(step);\n };\n void play();\n };\n const startIdle = () => {\n idleOn = true;\n idleSince = performance.now();\n window.clearTimeout(idleTimer);\n idleTimer = window.setTimeout(flicker, 2500 + idleRandom() * 3500);\n };\n\n const tick = (stamp: number) => {\n raf = 0;\n if (!running) return;\n const ms = stamp - t0;\n // (the picture is updated often enough for the wobble to be seen drifting; the tubes' own stutters are timed, so they do not depend on it)\n // (the levels are worked out at every frame; a jump of a tube (the light going out, coming on) is drawn at once, so that it falls on the sound's moment, and the slow drift only at the update rate)\n let jump = false;\n const hum = humAt(ms);\n for (let i = 0; i < blocks.length; i++) {\n const plan = plans.get(i);\n const v = (plan ? levelAt(plan, ms) : 1) * wob(i, ms, hum);\n const d = Math.abs(v - levels[i]!);\n if (d > 1e-3) {\n if (d > 0.15) jump = true;\n levels[i] = v;\n dirty = true;\n }\n }\n if (dirty && (jump || last < 0 || stamp - last >= 1000 / rate)) {\n last = stamp;\n dirty = false;\n apply(levels);\n }\n if (ms >= end) {\n running = false;\n // (the sound's tail goes on a few seconds after the picture is done: it keeps its listener until it is let go)\n if (!ctx) document.removeEventListener(\"visibilitychange\", onVisibility);\n // (the lights are all on: the page is told so; the wobble goes on with the hum, which is at its fullest now, until it has died away)\n done();\n startIdle();\n tailing = true;\n tailLast = -1;\n tailRaf = requestAnimationFrame(tail);\n return;\n }\n raf = requestAnimationFrame(tick);\n };\n\n return {\n /** The levels as they stand (the scene reads them at once, to build the first frame with the flickering rods off). */\n levels,\n /** How many rods flicker. */\n count: plans.size,\n start() {\n if (running) return;\n running = true;\n dirty = false;\n apply(levels);\n document.addEventListener(\"visibilitychange\", onVisibility);\n // (the clock starts when the sound is ready, a few ms later at most: the picture and the sound start together)\n void prepare().then((c) => {\n if (!running || raf) {\n c?.close().catch(() => {});\n return;\n }\n last = -1;\n t0 = performance.now();\n if (c) schedule(c);\n raf = requestAnimationFrame(tick);\n });\n },\n stop() {\n running = false;\n cancelAnimationFrame(raf);\n document.removeEventListener(\"visibilitychange\", onVisibility);\n levels.fill(1);\n closeSound();\n stopIdle();\n },\n };\n}\n","/**\n * The size of the render, in device pixels: the container's size times the pixel ratio (up to `maxPixelRatio`, 1 on a `lite` device), scaled down if the picture would have more than `maxPixels` pixels or a side longer than\n * `maxSize` (what the graphics card can make a texture of). Pure.\n */\nexport function renderSize(input: { cssWidth: number; cssHeight: number; devicePixelRatio: number; lite: boolean; maxPixelRatio?: number; maxPixels?: number; maxSize?: number }): { width: number; height: number; ratio: number } {\n const { cssWidth, cssHeight, lite, maxPixelRatio = 2, maxPixels = 8_000_000, maxSize = 8192 } = input;\n let ratio = lite ? 1 : Math.min(input.devicePixelRatio || 1, maxPixelRatio);\n const area = Math.max(1, cssWidth) * Math.max(1, cssHeight);\n ratio = Math.min(ratio, Math.sqrt(maxPixels / area), maxSize / Math.max(1, cssWidth, cssHeight));\n return { width: Math.max(1, Math.round(cssWidth * ratio)), height: Math.max(1, Math.round(cssHeight * ratio)), ratio };\n}\n","/**\n * The hum of the neon under the pointer: a ballast's buzz (a sawtooth with its edges taken off, pitched by the neon's size: 112 Hz for the smallest down to 70 for the biggest) whose loudness (and brightness of tone) follows how bright the neon is, 0 when nothing is selected, the most when it is at full\n * brightness, and slowly back to 0 as it falls back. It is not one steady tone: two buzzing voices a fifth or so apart lie on top of each other and one ducks the other, as in a sidechain, at a slow rate of its own, so that the hum\n * breathes and beats as two real ballasts do. It is made on demand (a context only when the first neon is selected, and let go a few seconds after the last hum has died), only when the browser lets the page make sound (the visitor\n * has used the page), and it is the page's own business to say when (`level`).\n */\n// (as quiet as the start-up's own hum: its ballast is 0.004 through a master of 0.5; this is several voices, so a little under)\nconst MAX = 0.0030;\nconst IDLE_CLOSE_MS = 4500;\n/** How fast the hum swells with the light, and how slowly it dies away (time constants, seconds). */\nconst ATTACK = 0.09;\nconst RELEASE = 0.45;\n\n/** The pitch of a neon's hum by its size (0 the smallest, 1 the biggest): a small neon hums high and a big one low, as a short string or pipe does, from 112 Hz down to 70. */\nconst pitchOf = (size: number) => 112 - 42 * Math.max(0, Math.min(1, size));\n\n/** Each neon has a hum of its own, the same every time: from the neon's number come a little variety on its size's pitch (a few percent), the pitch of the second voice, the slow beat, the rate and depth of the ducking and the brightness of the tone. */\nfunction voiceOf(seed: number, size: number) {\n let a = (seed * 2654435761 + 0x9e3779b9) >>> 0;\n const rnd = () => {\n a = (a + 0x6d2b79f5) >>> 0;\n let t = a;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n const base = pitchOf(size) * (0.96 + rnd() * 0.08);\n const ratios = [1.5, 1.335, 1.26, 2.01];\n return {\n base,\n beat: 0.3 + rnd() * 1.1,\n second: base * ratios[Math.floor(rnd() * ratios.length)]!,\n lfo: 0.35 + rnd() * 1.3,\n depth: 0.5 + rnd() * 0.4,\n upper: 0.15 + rnd() * 0.35,\n tone: 0.85 + rnd() * 0.3,\n };\n}\n\nexport function createHoverHum() {\n let c: AudioContext | null = null;\n let gain: GainNode | null = null;\n let lp: BiquadFilterNode | null = null;\n let panner: StereoPannerNode | null = null;\n let closeTimer = 0;\n let oscs: OscillatorNode[] = [];\n let upperGain: GainNode | null = null;\n let duck: GainNode | null = null;\n let swell: GainNode | null = null;\n let voiceA: GainNode | null = null;\n let voiceB: GainNode | null = null;\n let seeded = -1;\n let seededSize = -1;\n let tone = 1;\n let prev = 0;\n const allowed = () => (navigator as Navigator & { userActivation?: { hasBeenActive: boolean } }).userActivation?.hasBeenActive !== false;\n const close = () => {\n window.clearTimeout(closeTimer);\n oscs.forEach((o) => {\n try {\n o.stop();\n } catch {\n /* (stopped already) */\n }\n });\n oscs = [];\n const x = c;\n c = null;\n gain = lp = panner = upperGain = duck = swell = voiceA = voiceB = null;\n seeded = -1;\n seededSize = -1;\n prev = 0;\n if (x && x.state !== \"closed\") x.close().catch(() => {});\n };\n const open = () => {\n const AC = window.AudioContext ?? (window as unknown as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AC || !allowed()) return false;\n c = new AC();\n void c.resume().catch(() => {});\n gain = c.createGain();\n gain.gain.value = 0;\n lp = c.createBiquadFilter();\n lp.type = \"lowpass\";\n lp.frequency.value = 380;\n lp.Q.value = 0.6;\n panner = c.createStereoPanner();\n const osc = (type: OscillatorType) => {\n const o = c!.createOscillator();\n o.type = type;\n o.frequency.value = 100;\n o.start();\n oscs.push(o);\n return o;\n };\n // voice A: two sawtooths a hair apart (the slow beat); voice B: a sawtooth at the second pitch; and a sine an octave above A\n voiceA = c.createGain();\n voiceA.gain.value = 0.7;\n osc(\"sawtooth\").connect(voiceA);\n osc(\"sawtooth\").connect(voiceA);\n voiceB = c.createGain();\n voiceB.gain.value = 0.4;\n osc(\"sawtooth\").connect(voiceB);\n upperGain = c.createGain();\n upperGain.gain.value = 0.3;\n osc(\"sine\").connect(upperGain);\n // the sidechain: a slow sine makes B swell as it makes A duck (the one keeps the other's level moving, never both loud or both quiet)\n const lfo = osc(\"sine\");\n lfo.frequency.value = 0.8;\n swell = c.createGain();\n swell.gain.value = 0.3;\n duck = c.createGain();\n duck.gain.value = -0.3;\n lfo.connect(swell).connect(voiceB.gain);\n lfo.connect(duck).connect(voiceA.gain);\n voiceA.connect(lp);\n voiceB.connect(lp);\n upperGain.connect(lp);\n lp.connect(gain).connect(panner).connect(c.destination);\n return true;\n };\n return {\n /**\n * The hum's strength, 0 to 1 (the selected neon's brightness above its normal, as a share of the most it gets). `pan` (-1 to 1), `seed` (the neon's number) and `size` (0 the smallest to 1 the biggest: it sets the pitch, small high and big low) say which neon it is, or `null` when none is under the pointer:\n * then the hum is the last neon's, as it was, and only fades.\n */\n set(level: number, pan: number | null = null, seed: number | null = null, size = 0.5) {\n const v = Math.max(0, Math.min(1, level));\n if (v < 0.01 && !c) return;\n if (!c && !open()) return;\n if (!c || !gain || !lp || !panner) return;\n const t = c.currentTime;\n if (c.state === \"suspended\") void c.resume().catch(() => {});\n if (seed !== null && pan !== null && (seed !== seeded || size !== seededSize)) {\n // (another neon: its own voice; the first time the pitch is set at once, after that it glides, so that moving across the blocks does not click)\n const vc = voiceOf(seed, size);\n const glide = seeded < 0 ? 0.001 : 0.12;\n oscs[0]?.frequency.setTargetAtTime(vc.base, t, glide);\n oscs[1]?.frequency.setTargetAtTime(vc.base + vc.beat, t, glide);\n oscs[2]?.frequency.setTargetAtTime(vc.second, t, glide);\n oscs[3]?.frequency.setTargetAtTime(vc.base * 2, t, glide);\n oscs[4]?.frequency.setTargetAtTime(vc.lfo, t, glide);\n upperGain?.gain.setTargetAtTime(vc.upper, t, glide);\n swell?.gain.setTargetAtTime(0.4 * vc.depth, t, glide);\n duck?.gain.setTargetAtTime(-0.4 * vc.depth, t, glide);\n tone = vc.tone;\n seeded = seed;\n seededSize = size;\n }\n if (pan !== null) panner.pan.setTargetAtTime(pan * 0.7, t, 0.15);\n // (a soft change: the hum swells with the light, and dies slowly, with the light, not with the frame)\n const tc = v >= prev ? ATTACK : RELEASE;\n prev = v;\n gain.gain.setTargetAtTime(MAX * v ** 1.5, t, tc);\n lp.frequency.setTargetAtTime((380 + 520 * v) * tone, t, tc);\n window.clearTimeout(closeTimer);\n if (v < 0.01) closeTimer = window.setTimeout(close, IDLE_CLOSE_MS);\n },\n /** Let the hum go at once (the picture is rebuilt or taken down). */\n stop: close,\n };\n}\n","import type { BufferGeometry, Color, Group, Mesh } from \"three\";\nimport { createGroundLight, loadCausticTemplates, type CausticTemplates, type GlassLight } from \"./ground-light\";\nimport { clampTone, sameColor } from \"./color\";\nimport { layoutGraph, type Matrix } from \"./layout\";\nimport { createNeon } from \"./neon\";\nimport { renderSize } from \"./size\";\nimport { createHoverHum } from \"./hover-hum\";\nimport type { ContentBounds, GraphData, GraphOptions, LayerColors, Startup, Tones } from \"./types\";\nimport { CAMERA_DIR, glassShades, lightBehind, roomFor, shiftsFromLayers, slabFor } from \"./view\";\n\n/** How much of the light behind a block of glass the glass takes (the whole of it covering), and the least that is let through however many there are in front. */\nconst GLASS_ABSORB = 0.45;\nconst GLASS_FLOOR = 0.3;\n\n/** How many jittered frames are averaged before the picture is final (soft shadows, anti-aliasing): the scene never moves, so it is drawn once, a frame at a time, and then not at all. */\nconst SAMPLES = 96;\n\nexport const DEFAULT_COLORS: { top: LayerColors; bottom: LayerColors } = {\n // each source has its own hue and the level of the day is the brightness: a quiet day is a dim dark shade, a busy one the brightest\n top: { light: [0x0a8f2c, 0x00d63c], dark: [0x0f8a2c, 0x0fbf3e] },\n bottom: { light: [0x1658b8, 0x1a8cff], dark: [0x0f5aa8, 0x1f9bff] },\n};\n\n/**\n * How much the device is asked to do: a phone, or a machine with few cores or little memory, gets the light version (a third of the frames, a lower resolution, simpler blocks, a smaller shadow map, a single bloom).\n */\nexport function resolveLite(lite: \"auto\" | boolean | undefined): boolean {\n if (typeof lite === \"boolean\") return lite;\n const nav = navigator as Navigator & { deviceMemory?: number };\n return window.matchMedia(\"(pointer: coarse)\").matches || (nav.hardwareConcurrency ?? 8) <= 4 || (nav.deviceMemory ?? 8) < 4;\n}\n\n/** The page's background as a CSS colour: the option's, or the nearest opaque background above the container, else white (light) or near black (dark). */\nfunction resolveBackground(el: HTMLElement, option: GraphOptions[\"background\"], theme: \"light\" | \"dark\"): string {\n const given = typeof option === \"function\" ? option(theme) : option;\n if (given) return given;\n for (let n: HTMLElement | null = el; n; n = n.parentElement) {\n const c = getComputedStyle(n).backgroundColor;\n if (c && c !== \"transparent\" && !/rgba\\(.*,\\s*0\\)$/.test(c)) return c;\n }\n return theme === \"dark\" ? \"#0b0b0e\" : \"#ffffff\";\n}\n\nexport interface SceneHandle {\n /** Where the blocks are, in CSS pixels of the container (null before the first layout). */\n bounds(): ContentBounds | null;\n stop(): void;\n rethink(recolour?: boolean): void;\n ready: Promise<void>;\n}\n\n/**\n * The activity of the year as two matrices of blocks seen from an isometric camera that never moves (the bottom layer at the bottom of each day's column, the top layer on top): the height\n * and the colour of a block follow the intensity of the day. Because nothing moves the picture is progressive: each animation frame renders the scene with the sun a little elsewhere\n * (an area light's soft shadow) and the camera a sub-pixel away (anti-aliasing) and adds it to an accumulation buffer; after `SAMPLES` frames the loop stops and the canvas keeps the\n * result. Translucent rounded blocks (transmission, refraction) lit by a room environment, on a ground that only receives the shadows, so it sits on the page's own background.\n */\nexport function mountScene(el: HTMLElement, opts: GraphOptions & { data: GraphData }, st: { theme: \"light\" | \"dark\" | \"auto\" }): SceneHandle {\n const api = { stop: () => {}, rethink: (_recolour?: boolean) => {}, bounds: (): ContentBounds | null => null };\n let cancelled = false;\n const dbg = opts.debug ?? {};\n const mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const isDark = () => (st.theme === \"auto\" ? mq.matches : st.theme === \"dark\");\n const colorOf = (layer: \"top\" | \"bottom\", dark: boolean): Tones => (opts.colors?.[layer]?.[dark ? \"dark\" : \"light\"] ?? DEFAULT_COLORS[layer][dark ? \"dark\" : \"light\"]);\n el.setAttribute(\"role\", \"group\");\n el.setAttribute(\"aria-roledescription\", \"interactive chart\");\n el.setAttribute(\"aria-label\", opts.label ?? \"Activity graph, one column a day. Use the arrow keys to move between days.\");\n const ready = (async () => {\n const THREE = await import(\"three\");\n const { RoundedBoxGeometry } = await import(\"three/examples/jsm/geometries/RoundedBoxGeometry.js\");\n const { mergeGeometries } = await import(\"three/examples/jsm/utils/BufferGeometryUtils.js\");\n const { RoomEnvironment } = await import(\"three/examples/jsm/environments/RoomEnvironment.js\");\n // The baked light of the dark theme (41 KB): fetched only when the dark theme is on, and a failure only means no baked light (the rods and the glass are drawn without it), never that there is no picture.\n let templates: CausticTemplates | null = null;\n let templatesFailed = false;\n const templatesSource = async () => opts.templatesUrl ?? (await import(\"./templates-data\")).TEMPLATES_DATA_URI;\n const wantTemplates = () => (templatesFailed ? Promise.resolve() : templatesSource().then((url) => loadCausticTemplates(THREE, url)).then((t) => void (templates = t)).catch(() => void (templatesFailed = true)));\n if (isDark()) await wantTemplates();\n if (cancelled) return;\n\n // Other code on the page may switch three.js's colour management off (it is global: the hex colours and the textures here would then not be converted to linear and the picture would come out far too light).\n // So everything here runs with it on, and puts the switch back as it found it: the page never sees it change (JavaScript does not interleave: the setup runs in one go and the later entry points are wrapped, `cm`).\n const cm = <T,>(fn: () => T): T => {\n const prev = THREE.ColorManagement.enabled;\n THREE.ColorManagement.enabled = true;\n try {\n return fn();\n } finally {\n THREE.ColorManagement.enabled = prev;\n }\n };\n cm(() => {\n\n const { onReady, onLit, onHover } = opts;\n const strips = opts.strips ?? 1;\n const layout = layoutGraph(opts.data, opts.weeks ?? 53);\n const lite = resolveLite(opts.lite);\n const samples = lite ? 32 : SAMPLES;\n const t0 = performance.now();\n const renderer = new THREE.WebGLRenderer({ antialias: false, alpha: true, powerPreference: \"high-performance\" });\n renderer.setClearColor(0x000000, 0);\n renderer.shadowMap.enabled = true;\n renderer.shadowMap.type = THREE.PCFShadowMap;\n el.appendChild(renderer.domElement);\n // (absolute, so that the canvas never decides the size of its box: with its own aspect it could make the box a pixel taller, the box's resize would redraw the picture, and so on, without end)\n if (getComputedStyle(el).position === \"static\") el.style.position = \"relative\";\n const CANVAS_FADE = \"filter .4s ease,opacity .4s ease\";\n renderer.domElement.style.cssText = `position:absolute;inset:0;display:block;width:100%;height:100%;transition:${CANVAS_FADE};opacity:0;filter:blur(7px)`;\n // (the canvas is born invisible and blurred, so that nothing of it can show before the picture is first drawn: it came in at full strength and was faded out by `soften` a moment later)\n // While the picture is redrawn (a resize, a change of scheme) the last one stays, blurred, and comes back into focus on the new one once it has a few frames in it\n let settling = false;\n const soften = (opacity = \"0.85\") => {\n settling = true;\n renderer.domElement.style.filter = \"blur(7px)\";\n renderer.domElement.style.opacity = opacity;\n };\n // (it comes in the same way the first time: invisible and blurred, then in focus; `onReady` tells the page to fade its place-holder out)\n let announced = false;\n // (the neon start-up begins when the picture first appears)\n let neonStart: (() => void) | null = null;\n // While the box is being resized the picture is not stretched with it: it keeps the size it was drawn at, centred, softened, until the new one is drawn (a stretched picture jumps, which is what the blur is there to hide)\n let shownW = 0;\n let shownH = 0;\n const holdSize = () => {\n if (!shownW || !shownH) return;\n const s = renderer.domElement.style;\n s.inset = \"auto\";\n s.width = `${shownW}px`;\n s.height = `${shownH}px`;\n s.left = `${(el.clientWidth - shownW) / 2}px`;\n s.top = `${(el.clientHeight - shownH) / 2}px`;\n };\n const releaseSize = () => {\n const s = renderer.domElement.style;\n s.inset = \"0\";\n s.left = \"\";\n s.top = \"\";\n s.width = \"100%\";\n s.height = \"100%\";\n shownW = el.clientWidth;\n shownH = el.clientHeight;\n };\n const sharpen = () => {\n settling = false;\n if (!announced) {\n announced = true;\n onReady?.();\n }\n renderer.domElement.style.transition = CANVAS_FADE;\n renderer.domElement.style.filter = \"\";\n renderer.domElement.style.opacity = \"\";\n opts.onRedrawn?.();\n // (once per build: the neon start-up begins when the picture comes into focus)\n const go = neonStart;\n neonStart = null;\n go?.();\n };\n soften(\"0\");\n\n // the room the glow of the outermost columns needs around the slab, so the picture does not cut it\n const ROOM = roomFor(strips);\n // The year is a long strip of weeks; on a narrow page it is cut into `strips` strips of equal length laid one behind the other, so the slab is closer to a square and fills the width\n // (on a phone each strip is moved so that the weight of its blocks, not only its rectangle, is centred on the page)\n const { width, total, at, corners } = slabFor(layout.top.weeks, strips, shiftsFromLayers([layout.top, layout.bottom], strips));\n\n const scene = new THREE.Scene();\n const pmrem = new THREE.PMREMGenerator(renderer);\n const env = pmrem.fromScene(new RoomEnvironment(), 0.04).texture;\n scene.environment = env;\n scene.environmentIntensity = 0.9;\n\n // glass: it transmits (refracts) what is behind it, the ground and the blocks' own colour tint what passes through\n /** The film grain's strength over the whole picture (0 for none). */\n const GRAIN = opts.grain ?? 0.012;\n /** (light theme) how strong the room's reflections (environment) and the clear coat's are, relative to what comes through the glass. */\n const LIGHT_ENV = 0.3;\n const LIGHT_COAT = 0.1;\n /** (light theme) how frosted the glass is (the core seen through it is a soft glow, not a hard bar) and how strong its specular glints are. */\n const LIGHT_GLASS_ROUGHNESS = 0.04;\n const LIGHT_SPECULAR = 0.35;\n const blockMaterial = new THREE.MeshPhysicalMaterial({\n vertexColors: true,\n roughness: 0.04,\n metalness: 0,\n transmission: 1,\n thickness: 1.6,\n ior: 1.5,\n dispersion: 0.35,\n attenuationColor: new THREE.Color(0xffffff),\n attenuationDistance: 4,\n clearcoat: 1,\n clearcoatRoughness: 0.03,\n specularIntensity: 1,\n envMapIntensity: 1.4,\n });\n // the empty days: a plain dull tile in the dark theme (not glass: glass reflects the room and is never dim)\n // (an unlit flat tile in the ground's own colour, a shade apart: it casts and receives nothing itself; the glow, the sun's shadows and the contact shadows are layers over it, as over the ground)\n const tileUnlit = new THREE.MeshBasicMaterial({ vertexColors: true, toneMapped: false, side: THREE.BackSide });\n // the page's own background, read as the browser resolves it: the ground is that colour (so there is something to refract, and no seam with the page)\n const pageColour = () => {\n const css = resolveBackground(el, opts.background, isDark() ? \"dark\" : \"light\");\n const probe = document.createElement(\"canvas\");\n probe.width = probe.height = 1;\n const ctx = probe.getContext(\"2d\")!;\n ctx.fillStyle = css;\n ctx.fillRect(0, 0, 1, 1);\n const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;\n return new THREE.Color().setRGB(r! / 255, g! / 255, b! / 255, THREE.SRGBColorSpace);\n };\n\n // each block is a glass shell around a smaller opaque core of the same colour: the core is what the glass refracts, so the block has depth instead of reading as a pale solid\n // (light theme: the core is a lamp too, not a lit bar: unlit, a little lifted toward white, and the frosted glass turns it into a soft glow)\n const LIGHT_CORE_LIFT = 0;\n // (light theme) the core's brightness: below 1 is deeper and more saturated\n const LIGHT_CORE_DEPTH = 0.78;\n // (light theme) how much of white the glass shell's tint is mixed with (1: clear)\n const LIGHT_SHELL_WHITE = 0.78;\n /** (light theme) double-sided glass: the back faces of the blocks behind tint what is seen, but an isolated block is tinted by its own back faces too. Kept as a fallback; off. */\n const LIGHT_DOUBLE_SIDED = false;\n /** (light theme) the ground, baked, as what the glass sees behind it (see `groundLayers`): false to compare. */\n const LIGHT_BACKDROP = true;\n // (dark theme: the glass sees the ground's glow, see groundLayers) and how much of it\n const DARK_BACKDROP = true;\n const DARK_BACKDROP_GAIN = 200;\n /** (dark) the most the light seen behind the glass can add, on its brightest channel (a soft cap that keeps the hue). */\n const DARK_BACKDROP_CAP = 0.15;\n /** (light theme) how much of the colour of the blocks behind a block (as the camera sees it) its glass takes, when they cover all of its outline. */\n const LIGHT_BEHIND_TINT = 0.85;\n const coreMaterial = new THREE.MeshBasicMaterial({ vertexColors: true });\n // (the glass is perfectly clear; it is the core that is soft: its colour fades toward a pale haze of itself toward its silhouette, so it is a blurred glow in the middle of the block, with no hard edge)\n coreMaterial.onBeforeCompile = (shader) => {\n shader.vertexShader = shader.vertexShader.replace(\"#include <common>\", \"#include <common>\\nvarying vec3 vCoreN;\").replace(\"#include <begin_vertex>\", \"#include <begin_vertex>\\n vCoreN = normalize(normalMatrix * normal);\");\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", \"#include <common>\\nvarying vec3 vCoreN;\")\n .replace(\"#include <color_fragment>\", \"#include <color_fragment>\\n float cf = pow(clamp(abs(normalize(vCoreN).z), 0.0, 1.0), 0.9);\\n diffuseColor.rgb = mix(mix(diffuseColor.rgb, vec3(1.0), CORE_HAZE), diffuseColor.rgb, cf);\".replace(\"CORE_HAZE\", \"0.5\"));\n };\n // (in the dark theme the cores are lights: unlit, their colour is the light they give out, brighter than 1 for a busy day, which the bloom and the glow on the ground turn into a glow)\n // (dark) a rod is an emitter, not an absorber: it is drawn ADDITIVELY (`transparent` stays false, so that it is in the opaque pass the glass sees, and three.js still blends it additively): it adds its light to what is behind it and takes none away, so a dim rod is a faint light over whatever is lit there and an off rod is not there at all\n /** (dark) a rod's brightest channel is compressed above `ROD_KNEE` towards `ROD_MAX` (any hue), and whitened by up to `ROD_WHITE` where it is brightest. */\n const ROD_KNEE = 0.7;\n const ROD_MAX = 1.5;\n const ROD_WHITE = 0.35;\n const glowMaterial = new THREE.MeshBasicMaterial({ vertexColors: true, toneMapped: false, blending: THREE.AdditiveBlending, depthWrite: false });\n /** (dark) how much of the ground's light the glass shows, 1 at rest, lower when the lights are dimmed (see `applyLevels`): shared with the backdrop's shader. */\n const backdropDim = { value: 1 };\n /** GLSL: the light seen behind, `g` (linear), scaled and then capped softly on its brightest channel, so a strong hue is not overexposed whatever the palette: its colour is kept, only its level is compressed. */\n const softSeen = `vec3 softSeen(vec3 g) { float m = max(g.r, max(g.g, g.b)); if (m < 1e-6) return g; float k = ${DARK_BACKDROP_CAP.toFixed(3)}; return g * (k * tanh(min(m * ${DARK_BACKDROP_GAIN.toFixed(3)} / k, 12.0)) / m); }`;\n // how much each rod gives out, 0 to 1, one number per block, read by the rod's vertices (`aBlock` is the block's number): the neon start-up changes them over time\n // what is left of a block when its rod is off, the same for all of them: the glass's own glow and the room's reflections in it, as absolute intensities\n /** (dark) how much glow the green glass has of its own, against 0.6 of the blue's: a slight tint (0 is a clear glass). Pure green, never whitened: a whitened glow is a grey one. */\n const DARK_GREEN_GLOW = 0.2;\n // (the green glass filters the light that goes through it, Beer-Lambert: it multiplies, so the bright light of a rod behind it is turned green and the dark parts stay dark; smaller distance = stronger)\n // (the filter's colour is the layer's own palette colour, whatever the palette: a grey or white layer is not filtered)\n const LAYER_FILTER_DISTANCE = 2;\n // (how much of the layer's colour the filter takes: 1 would absorb the other channels completely, so a red glass would stop a blue light dead; real tinted glass is never that pure)\n const LAYER_FILTER_PURITY = 0.72;\n /** (dark) how much of the light the neighbours give out the glass of a block glows with: inside a group of lamps no glass is dark, and an isolated block's is. */\n const NEIGHBOUR_GLOW = 0.22;\n /** How much light behind a block it takes to light its glass most of the way (the share is `1 - e^-(light behind / this)`). */\n const BEHIND_SCALE = 1.6;\n /** How far the neighbours' light is tinted by the block's own colour, 0 to 1. */\n const GLOW_TINT = 1.0;\n // (the tint grows with the glow's own brightness: the brighter part of the light is tinted in full, the faint part only this much)\n const GLOW_TINT_FAINT = 0.35;\n // (the light of several neighbours of different colours adds up towards grey: it is pushed back to its colour, so that the glass takes the colour of the lamps around it, not a milk)\n const GLOW_SATURATION = 2.5;\n /** (dark) the least a green rod gives out, in the units of `emit(t) * (1 + 1.1 t)` (0.5 for the quietest day, about 3 for the busiest): a quiet green day still shows green, even over a bright blue block, whose light would otherwise be most of what lights it. */\n const GREEN_MIN_LEVEL = 1.1;\n const DARK_GLASS_ROUGHNESS = 0.04;\n const OFF_EMISSIVE = 0.0012;\n const OFF_ENV = 0.004;\n const MAX_LEVELS = 1024;\n // (two numbers a block: what its own rod gives out, and how much of the light of the blocks around it, which are on, reaches it, 0 to 1, against all of them on)\n const levelData = new Float32Array(MAX_LEVELS * 2).fill(1);\n const levelTex = new THREE.DataTexture(levelData, MAX_LEVELS, 1, THREE.RGFormat, THREE.FloatType);\n levelTex.needsUpdate = true;\n glowMaterial.onBeforeCompile = (shader) => {\n shader.uniforms.uLevels = { value: levelTex };\n shader.vertexShader = shader.vertexShader\n .replace(\"#include <common>\", \"#include <common>\\nattribute float aBlock;\\nattribute vec3 aInc;\\nattribute vec2 aCtr;\\nvarying float vRodA;\\nuniform highp sampler2D uLevels;\")\n .replace(\"#include <color_vertex>\", \"#include <color_vertex>\\n#ifdef USE_COLOR\\n vec2 lv = texelFetch(uLevels, ivec2(int(aBlock + 0.5), 0), 0).rg;\\n float rodB = max(vColor.r, max(vColor.g, vColor.b)) * lv.r;\\n vColor.rgb = vColor.rgb * lv.r + vec3(0.029, 0.037, 0.053) * (1.0 - lv.r) + aInc * lv.g;\\n vRodA = smoothstep(0.0, 3.0, rodB);\\n float rodL = dot(vColor.rgb, vec3(0.299, 0.587, 0.114));\\n vColor.rgb = max(vec3(0.0), mix(vec3(rodL), vColor.rgb, 1.3 + 1.8 * (1.0 - clamp(lv.r, 0.0, 1.0))));\\n#endif\")\n .replace(\"#include <begin_vertex>\", \"#include <begin_vertex>\\n transformed.xz = aCtr + (transformed.xz - aCtr) * mix(0.6, 1.0, smoothstep(0.0, 2.5, rodB));\");\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", \"#include <common>\\nvarying float vRodA;\")\n .replace(\"#include <color_fragment>\", \"#include <color_fragment>\\n diffuseColor.rgb *= vRodA;\\n // (a very bright rod is not a flat blob of its colour: above the knee its level is compressed, whatever its hue, and what is left of it is whitened a little, as a real light too bright for the eye or the film turns to a hot white core with the colour round it; the faces' shading survives, as a smaller difference)\\n float rm = max(diffuseColor.r, max(diffuseColor.g, diffuseColor.b));\\n if (rm > \" + ROD_KNEE.toFixed(2) + \") {\\n float rc = \" + ROD_KNEE.toFixed(2) + \" + \" + (ROD_MAX - ROD_KNEE).toFixed(2) + \" * tanh(min((rm - \" + ROD_KNEE.toFixed(2) + \") / \" + (ROD_MAX - ROD_KNEE).toFixed(2) + \", 12.0));\\n // (only a SATURATED rod is held back: a pale one, like the stock blue whose brightness is light added to all three channels, is already a hot core and keeps its full power)\\n float rs = smoothstep(0.62, 0.85, (rm - min(diffuseColor.r, min(diffuseColor.g, diffuseColor.b))) / rm);\\n diffuseColor.rgb = mix(diffuseColor.rgb, mix(diffuseColor.rgb * (rc / rm), vec3(rc), \" + ROD_WHITE.toFixed(2) + \" * smoothstep(\" + ROD_KNEE.toFixed(2) + \", 3.0, rm)), rs);\\n }\");\n };\n glowMaterial.customProgramCacheKey = () => \"rod-levels\";\n // `shade` (dark theme): the faces of a block are not all lit alike, as if the light were from above and to the left of the camera, and a block is brighter toward its top: its top is the brightest face, then the side that\n // faces left, then the one that faces the viewer, and the foot is dimmer. An emissive block has no light on it to give it a form, so this puts the form back (without it a busy blue stretch is a field of flat boxes).\n const paint = (g: BufferGeometry, col: Color, glow = 0, shade = false) => {\n const n = g.getAttribute(\"position\").count;\n const colors = new Float32Array(n * 3);\n const pos = g.getAttribute(\"position\");\n const nor = g.getAttribute(\"normal\");\n let y0 = Infinity;\n let y1 = -Infinity;\n if (shade) for (let i = 0; i < n; i++) {\n y0 = Math.min(y0, pos.getY(i));\n y1 = Math.max(y1, pos.getY(i));\n }\n for (let i = 0; i < n; i++) {\n col.toArray(colors, i * 3);\n if (!shade || !nor) continue;\n const nx = nor.getX(i);\n const ny = nor.getY(i);\n const nz = nor.getZ(i);\n const face = 0.5 + 0.62 * Math.max(0, ny) + 0.3 * Math.max(0, -nx) + 0.08 * Math.max(0, -nz);\n const foot = 0.7 + 0.3 * (y1 > y0 ? (pos.getY(i) - y0) / (y1 - y0) : 1);\n const k = face * foot;\n colors[i * 3] = colors[i * 3]! * k;\n colors[i * 3 + 1] = colors[i * 3 + 1]! * k;\n colors[i * 3 + 2] = colors[i * 3 + 2]! * k;\n }\n g.setAttribute(\"color\", new THREE.BufferAttribute(colors, 3));\n g.setAttribute(\"aGlow\", new THREE.BufferAttribute(new Float32Array(n).fill(glow), 1));\n g.deleteAttribute(\"uv\");\n };\n // The glow a column casts on the ground (the dark theme's answer to the shadows of the light one): a soft additive spot under each layer's column in its colour, as bright as the day was busy, painted on a canvas laid on the ground\n const GLOW_PAD = 9;\n // both sources light the ground the same way (same reach); GROUND_LIGHT is the radiance of a busy day's spot at its centre\n const GROUND_REACH = 1.75;\n const GROUND_LIGHT = 0.5;\n // (dark theme) how much of the ground's light is the soft pool (haze, scatter) and how much the traced light of the rods through the glass, and the power of that (a busy day's rod, in all the directions it sends)\n const POOL = 0.15;\n // (dark theme) how far from its block the traced light is at full strength, and where it has faded out (world units): far, as a real glow is, which is faint but wide\n const CAUSTIC_NEAR = 7;\n const CAUSTIC_FAR = 18;\n const CAUSTIC_POWER = 0.055;\n // (light theme) how strongly the glass takes the light that is not its colour away, per unit of glass crossed, and how much the traced caustics count\n const ABSORB = 2.6;\n const LIGHT_CAUSTIC = 1.0;\n const STRAIGHT = 0.92;\n // how deep the shadows go (a share of the traced loss of light) and how much the caustics are pushed\n const SHADOW = 0.72;\n // (light theme) how far the shadows are pushed from grey toward the glass's colour (1 as traced)\n const SHADE_SATURATION = 2.4;\n // (light theme) how bright the brightest channel of a column's contact shadow is: low is deep, the colour of the glass\n const LIGHT_SHADOW_DEPTH = 0.45;\n const GLEAM = 4.8;\n // (light theme) how far from its block the sun's light is counted in full, and where it has faded out\n const NOISE_FLOOR = 0.03;\n const GLEAM_MAX = 0.8;\n const SUN_NEAR = 3.4;\n const SUN_FAR = 6;\n const PX = 22;\n // the traced light is counted on a grid half as fine: enough rays in each cell to look like light and not like grain\n const LPX = PX / 2;\n let neonNeighbours: { j: number[]; m: number[] }[] = [];\n let neonBlocks: { x: number; z: number; pan: number; t: number; cell: number; peak: number }[] = [];\n let stampCtl: { update(levels: ArrayLike<number>): void } | null = null;\n // (dark) sets how much of its lamps' light each pit has, from the blocks' levels (the pits' shading follows the neon, see `groundLayers`)\n let pitLight: ((levels: ArrayLike<number>) => void) | null = null;\n let rimLight: ((levels: ArrayLike<number>) => void) | null = null;\n // `rodColor`: every rod is lit in a colour the caller picks (a string of lights, say), the same for a day each time. Its colour is the day's and its brightness is the activity, as ever; the glass is left clear so that the rod's\n // colour is what is seen, and the baked light on the ground takes the rod's colour like any other. The dark theme only (the glass of the light theme, lit by the sun, does not take coloured lights; the scene is rebuilt when the theme changes).\n const customOn = () => !!opts.rodColor && isDark();\n /** A white rod is as bright as this share of a coloured one: a white rod adds up in all three channels, so at the same level it clips to a flat white blob with no shading. */\n const WHITE_ROD = 0.62;\n const customHue = (cell: number, src: \"bottom\" | \"top\", t: number): Color | null => {\n const rgb = opts.rodColor!({ layer: src, index: cell, date: layout.top.cells[cell]!.date, t });\n return rgb ? new THREE.Color(rgb[0], rgb[1], rgb[2]) : null;\n };\n // (`page`: the page's colour, read once a build by the caller: reading it makes a canvas and reads a pixel back)\n const groundLayers = (stack: { bottom: Matrix; top: Matrix }, tones: { bottom: [Color, Color]; top: [Color, Color] }, dark: boolean, page: Color) => {\n const cw = Math.ceil((width + GLOW_PAD * 2) * PX);\n const ch = Math.ceil((total + GLOW_PAD * 2) * PX);\n const lw = Math.ceil((width + GLOW_PAD * 2) * LPX);\n const lh = Math.ceil((total + GLOW_PAD * 2) * LPX);\n const canvas = () => {\n const c2 = document.createElement(\"canvas\");\n c2.width = cw;\n c2.height = ch;\n return c2;\n };\n // the contact shadow (ambient occlusion on the ground): a soft dark spot under every column, wider and darker for a taller one\n const ao = canvas();\n const actx = ao.getContext(\"2d\")!;\n const occlude = (x: number, z: number, height: number, tint = \"0,0,0\") => {\n const cx = (x + GLOW_PAD) * PX;\n const cy = (z + GLOW_PAD) * PX;\n const r = (0.75 + 0.22 * height) * PX;\n const g = actx.createRadialGradient(cx, cy, 0.3 * PX, cx, cy, r);\n const a = Math.min(0.85, (dark ? 0.5 : 0.28) + 0.06 * height);\n g.addColorStop(0, `rgba(${tint},${a})`);\n g.addColorStop(0.5, `rgba(${tint},${a * 0.4})`);\n g.addColorStop(1, `rgba(${tint},0)`);\n actx.fillStyle = g;\n actx.fillRect(cx - r, cy - r, r * 2, r * 2);\n };\n // An empty day is a pit: the light that lies over the ground must not light its floor as it lights the ground, or it reads as a flat plate. Its rim shades the floor (an inner shadow) on the side that faces the light, which is where the\n // near wall keeps the light off the floor (and the opposite wall is the lit one, and the lip there takes the highlight): the light is the lamps around the pit in the dark theme (there is no sun), the sun in the light theme (top right of the screen:\n // -x and +z). `(lx, lz)` is the direction to the light, `amount` how one-sided it is (0 all round, 1 from one side).\n const pitCells: { x: number; z: number }[] = [];\n const recess = (x: number, z: number, lx: number, lz: number, amount: number, ctx: CanvasRenderingContext2D = actx) => {\n const cx = (x + GLOW_PAD) * PX;\n const cy = (z + GLOW_PAD) * PX;\n const half = 0.44 * PX;\n const rr = 0.16 * PX;\n const path = new Path2D();\n path.roundRect(cx - half, cy - half, half * 2, half * 2, rr);\n const frame = new Path2D();\n frame.rect(cx - 2 * PX, cy - 2 * PX, 4 * PX, 4 * PX);\n frame.addPath(path);\n ctx.save();\n ctx.clip(path);\n ctx.shadowColor = `rgba(0,0,0,${dark ? 0.9 : 0.5})`;\n ctx.shadowBlur = 0.16 * PX;\n // (the frame is moved away from the light: its edge on the light's side goes into the pit and shades the floor there)\n ctx.shadowOffsetX = -lx * amount * 0.09 * PX;\n ctx.shadowOffsetY = -lz * amount * 0.09 * PX;\n ctx.fillStyle = \"#000\";\n ctx.fill(frame, \"evenodd\");\n ctx.restore();\n };\n stack.top.cells.forEach((g, i) => {\n const w = stack.bottom.cells[i]!;\n const { x, z } = at(g.week, g.day);\n if (w.value > 0 || g.value > 0) {\n // (light theme: the shadow of a column is the colour of its glass, deep and saturated, not grey: light that went through tinted glass lies on the ground in that colour)\n let tint = \"0,0,0\";\n if (!dark) {\n const ww = w.value > 0 ? 0.18 + w.t * LAYER_MAX : 0;\n const wg = g.value > 0 ? 0.18 + g.t * LAYER_MAX : 0;\n const c = tones.bottom[1].clone().multiplyScalar(ww).add(tones.top[1].clone().multiplyScalar(wg)).multiplyScalar(1 / (ww + wg));\n const m = Math.max(c.r, c.g, c.b, 1e-3);\n const deep = c.clone().multiplyScalar(LIGHT_SHADOW_DEPTH / m);\n tint = [deep.r, deep.g, deep.b].map((v) => Math.round(255 * Math.min(1, v) ** (1 / 2.2))).join(\",\");\n }\n occlude(x, z, (w.value > 0 ? 0.18 + w.t * LAYER_MAX : 0) + (g.value > 0 ? 0.18 + g.t * LAYER_MAX : 0), tint);\n }\n else pitCells.push({ x, z });\n });\n // The layers of glass of every column, each as a block of its own: WakaTime's at the bottom, GitHub's on top (what the picture draws, see `build`).\n const t0 = performance.now();\n const glass: GlassLight[] = [];\n neonBlocks = [];\n const variety = (() => {\n let seed = 987654;\n return () => ((seed = (seed * 16807) % 2147483647) / 2147483647);\n })();\n stack.top.cells.forEach((g, i) => {\n const w = stack.bottom.cells[i]!;\n const { x, z } = at(g.week, g.day);\n let top = 0;\n const add = (src: \"bottom\" | \"top\", y0: number, y1: number, t: number, [low, high]: [Color, Color], gain: number) => {\n const hy = (y1 - y0) / 2;\n const hue = (customOn() ? customHue(i, src, t) : null) ?? low.clone().lerp(high, t);\n // (dark) the light is the rod's, and the rod is near white where it is busy: its own chroma (as drawn, see `build`), normalised, the strength being `power`; (light) the colour of the glass\n const rod = customOn()\n ? // (`rodColor`: the light on the ground is the light's own colour, not lifted toward white as a busy rod is in the usual picture)\n hue.clone()\n : rodLight(src, hue, t, 1);\n // (how bright the rod is at its full level, as drawn: the selection lifts a quiet one to a minimum, see `focusOn`)\n const peak = Math.max(rod.r, rod.g, rod.b) * (customOn() ? 0.55 : 1);\n const col = dark ? rod.multiplyScalar(1 / Math.max(1e-4, rod.r, rod.g, rod.b)) : hue;\n // (`rodColor`: a white light adds to all three channels, so on the ground it washes out the colours around it: it lights the ground half as much)\n const whiteLight = customOn() && Math.max(hue.r, hue.g, hue.b) - Math.min(hue.r, hue.g, hue.b) < 0.15 * Math.max(hue.r, hue.g, hue.b) ? 0.5 : 1;\n // (no two blocks are alike: a small tilt of the glass of each, a strength and a reach of its own)\n const tilt = (): number => (variety() - 0.5) * 0.22;\n const luck = 0.6 + 0.8 * variety();\n const near = dark ? CAUSTIC_NEAR : SUN_NEAR;\n const far = dark ? CAUSTIC_FAR : SUN_FAR;\n neonBlocks.push({ x, z, // (the camera looks along -z, so the world's +x is on the LEFT of the screen: the stereo place is the other way round)\n pan: 1 - (x / width) * 2, t, cell: i, peak });\n glass.push({\n c: [x, y0 + hy, z],\n h: [0.46, hy, 0.46],\n r: Math.min(0.16, (2 * hy) / 2.2),\n bias: [tilt(), tilt() * 0.4, tilt()],\n col: [col.r, col.g, col.b],\n power: (0.05 + t * t) * gain * luck * CAUSTIC_POWER * whiteLight,\n near,\n far,\n // (the rod, as drawn: its width)\n rod: (0.5 - 0.2 * t ** 0.85) / 2,\n seed: [variety(), variety(), variety(), variety(), variety()],\n // (the soft pool: a haze under the block, as bright as its day was busy; it goes out with its rod)\n pool: (() => {\n const peak = POOL * GROUND_LIGHT * gain * (0.004 + 0.26 * t * t + 0.03 * t) * whiteLight;\n return { col: [hue.r * peak, hue.g * peak, hue.b * peak] as [number, number, number], r: 0.9 + GROUND_REACH * (0.5 + t * 1.5) };\n })(),\n });\n };\n if (w.value > 0) {\n add(\"bottom\", 0, 0.18 + w.t * LAYER_MAX, w.t, tones.bottom, 1);\n top = 0.18 + w.t * LAYER_MAX + 0.04;\n }\n if (g.value > 0) add(\"top\", top, top + 0.18 + g.t * LAYER_MAX, g.t, tones.top, 1.8);\n });\n // The light of the glass on the ground. (dark theme) There is no sun: the light is the rods'. What one block casts is baked (see `loadCausticTemplates`, from a path tracer): a fan out of every face and a faint wide glow;\n // here each block lays its own, in the colour of its rod and as strong as its day was busy, on the ground at the ground's own resolution. (light theme) The sun through the glass, traced on the graphics card\n // (see `ground-light.ts`), on a grid half as fine as the ground's other layers: parallel rays go through every block: refracted in, absorbed by the glass's colour (a blue block lets blue through and takes the rest),\n // refracted out, landing on the ground displaced and gathered. Where each lands the ground gets its power, and where it would have landed without the glass it loses it: so the ground is as bright as ever where no glass\n // reaches it, a shadow is a lack of light (in the glass's colour, not grey), and the caustics are its surplus. Two layers over the ground: one that multiplies it where it is darker, one that adds light where it is brighter.\n const ground = dark\n ? createGroundLight(THREE, renderer, { w: cw, h: ch, scale: PX, x0: -GLOW_PAD, z0: -GLOW_PAD })\n : createGroundLight(THREE, renderer, { w: lw, h: lh, scale: LPX, x0: -GLOW_PAD, z0: -GLOW_PAD });\n if (dark) {\n stampCtl = !templates ? null : ground.stamps(\n glass.map((g) => ({ x: g.c[0], z: g.c[2], height: 2 * g.h[1], foot: g.c[1] - g.h[1], col: [g.col[0] * g.power, g.col[1] * g.power, g.col[2] * g.power] as [number, number, number], poolCol: g.pool!.col, poolRadius: g.pool!.r })),\n templates,\n );\n } else {\n const sunDir = new THREE.Vector3().copy(sunBase).normalize().negate();\n ground.sun(glass, lite ? 40 : 64, [sunDir.x, sunDir.y, sunDir.z], ABSORB, STRAIGHT, (LPX * LPX) / -sunDir.y);\n ground.smooth(3);\n }\n if (dbg.metrics) console.info(`[activity] ground light drawn in ${Math.round(performance.now() - t0)} ms (${dark ? \"dark\" : \"light\"}, ${glass.length} blocks)`);\n const layers = new THREE.Group();\n const disposers: (() => void)[] = [];\n const plane = (tex: import(\"three\").Texture, material: (tex: import(\"three\").Texture) => import(\"three\").MeshBasicMaterial | import(\"three\").ShaderMaterial, order: number) => {\n const mat = material(tex);\n const mesh = new THREE.Mesh(new THREE.PlaneGeometry(cw / PX, ch / PX), mat);\n mesh.rotation.x = -Math.PI / 2;\n // (just above the empty tiles: the glow and the contact shadows lie over them as over the ground, so a tile is lit by its neighbours like the rest of the scene)\n mesh.position.set(width / 2, 0.11 + order * 0.002, total / 2);\n mesh.renderOrder = order;\n layers.add(mesh);\n disposers.push(() => {\n tex.dispose();\n mat.dispose();\n });\n };\n if (dark) plane(ground.texture, (map) => new THREE.MeshBasicMaterial({ map, transparent: true, blending: THREE.AdditiveBlending, depthWrite: false, toneMapped: false }), 1);\n else {\n // (the difference to the sun's light, turned into what multiplies the ground and what is added to it)\n const resolve = (shade: boolean) =>\n new THREE.ShaderMaterial({\n uniforms: { map: { value: ground.texture } },\n vertexShader: \"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.); }\",\n fragmentShader: `uniform sampler2D map; varying vec2 vUv;\nvoid main() {\n vec3 v = texture2D(map, vUv).rgb;\n // (the differences of overlapping shadows are summed, but light that has been through two blocks has lost the share of each, not both shares: the product, which the exponential of the sum is) (below a small difference there is only the noise of the rays: it is not light)\n vec3 f = exp(${(LIGHT_CAUSTIC * 1.2).toFixed(3)} * sign(v) * max(abs(v) - ${NOISE_FLOOR.toFixed(3)}, 0.));\n ${shade ? `vec3 d = 1. - min(f, vec3(1.)); d = max(vec3(0.), mix(vec3(dot(d, vec3(0.3333))), d, ${SHADE_SATURATION.toFixed(2)})); gl_FragColor = vec4(vec3(1. - ${SHADOW.toFixed(3)} * min(d, vec3(1.))), 1.);` : `vec3 g = max(f - 1., 0.) * ${GLEAM.toFixed(3)}; gl_FragColor = vec4(${GLEAM_MAX.toFixed(3)} * tanh(min(g / ${GLEAM_MAX.toFixed(3)}, vec3(12.))), 1.);`}\n}`,\n transparent: true,\n blending: shade ? THREE.MultiplyBlending : THREE.AdditiveBlending,\n premultipliedAlpha: shade,\n depthWrite: false,\n });\n plane(ground.texture, () => resolve(true), 0);\n plane(ground.texture, () => resolve(false), 1);\n }\n // (dark) The lamps around a pit shade its floor on the side that faces them, so with the lamps off there is nothing to shade it that way: the pits are drawn twice, with the shading of the lamps all on and with none (`aoSym`),\n // and the picture mixes the two by how much of their light there is, pit by pit (`pitLit`, set from the levels, see `layers.userData.setLevels`).\n const aoSym = dark ? canvas() : null;\n aoSym?.getContext(\"2d\")!.drawImage(ao, 0, 0);\n const pitNear: { gi: number; wx: number; wz: number; w: number }[][] = [];\n const pitBase: number[] = [];\n const pitStrength: number[] = [];\n // (how one-sided the light is, and how strong: lamps all round cancel out)\n const amountOf = (lxv: number, lzv: number, st: number) => Math.min(1, (Math.hypot(lxv, lzv) / Math.max(st, 1e-6)) * 1.4) * Math.min(1, st * 6);\n for (const pc of pitCells) {\n let lx = 0;\n let lz = 0;\n let strength = 0;\n const near: { gi: number; wx: number; wz: number; w: number }[] = [];\n if (dark) {\n glass.forEach((g, gi) => {\n const dx = g.c[0] - pc.x;\n const dz = g.c[2] - pc.z;\n const dist = Math.hypot(dx, dz);\n if (dist < 0.5 || dist > 5) return;\n const w = (g.col[0] + g.col[1] + g.col[2]) * g.power * Math.exp(-(dist * dist) / (2 * 1.8 * 1.8));\n lx += (dx / dist) * w;\n lz += (dz / dist) * w;\n strength += w;\n near.push({ gi, wx: (dx / dist) * w, wz: (dz / dist) * w, w });\n });\n } else {\n lx = -0.63;\n lz = 0.77;\n strength = 1;\n }\n const len = Math.hypot(lx, lz);\n // (how one-sided the light is: lamps all round cancel out)\n const amount = dark ? amountOf(lx, lz, strength) : 1;\n recess(pc.x, pc.z, len > 0 ? lx / len : 0, len > 0 ? lz / len : 0, amount);\n if (aoSym) recess(pc.x, pc.z, 0, 0, 0, aoSym.getContext(\"2d\")!);\n pitNear.push(near);\n pitBase.push(amount);\n pitStrength.push(strength);\n }\n const aoTex = new THREE.CanvasTexture(ao);\n aoTex.colorSpace = THREE.SRGBColorSpace;\n if (!aoSym) plane(aoTex, (map) => new THREE.MeshBasicMaterial({ map, transparent: true, depthWrite: false, toneMapped: false }), 2);\n else {\n const symTex = new THREE.CanvasTexture(aoSym);\n symTex.colorSpace = THREE.SRGBColorSpace;\n // (how much of its lamps' light each pit has, 4 texels a unit over the whole ground: 1 = all on, as baked)\n const LT = 4;\n const litW = Math.ceil((cw / PX) * LT);\n const litH = Math.ceil((ch / PX) * LT);\n const litData = new Float32Array(litW * litH).fill(1);\n const litTex = new THREE.DataTexture(litData, litW, litH, THREE.RedFormat, THREE.FloatType);\n litTex.minFilter = THREE.NearestFilter;\n litTex.magFilter = THREE.NearestFilter;\n litTex.needsUpdate = true;\n plane(aoTex, (map) => {\n const m = new THREE.ShaderMaterial({\n uniforms: { full: { value: map }, sym: { value: symTex }, lit: { value: litTex } },\n vertexShader: \"varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.); }\",\n fragmentShader: \"uniform sampler2D full; uniform sampler2D sym; uniform sampler2D lit; varying vec2 vUv; void main() { float a = mix(texture2D(sym, vUv).a, texture2D(full, vUv).a, clamp(texture2D(lit, vUv).r, 0., 1.)); gl_FragColor = vec4(0., 0., 0., a); }\",\n transparent: true,\n depthWrite: false,\n });\n return m;\n }, 2);\n disposers.push(() => {\n symTex.dispose();\n litTex.dispose();\n });\n layers.userData.setLevels = (levels: ArrayLike<number>) => {\n for (let k = 0; k < pitCells.length; k++) {\n let lx = 0;\n let lz = 0;\n let st = 0;\n for (const n of pitNear[k]!) {\n const lv = levels[n.gi] ?? 1;\n lx += n.wx * lv;\n lz += n.wz * lv;\n st += n.w * lv;\n }\n // (and in proportion to the light itself, not only to how one-sided it is: a lamp that is barely on does not give the full highlight)\n const lit = pitBase[k]! > 1e-4 && pitStrength[k]! > 1e-6 ? Math.min(1, (amountOf(lx, lz, st) / pitBase[k]!) * Math.min(1, st / pitStrength[k]!)) : 0;\n const u = pitCells[k]!.x + GLOW_PAD;\n const v = pitCells[k]!.z + GLOW_PAD;\n const i0 = Math.max(0, Math.floor((u - 0.44) * LT));\n const i1 = Math.min(litW - 1, Math.floor((u + 0.44) * LT));\n const j0 = Math.max(0, litH - 1 - Math.floor((v + 0.44) * LT));\n const j1 = Math.min(litH - 1, litH - 1 - Math.floor((v - 0.44) * LT));\n for (let jj = j0; jj <= j1; jj++) for (let ii = i0; ii <= i1; ii++) litData[jj * litW + ii] = lit;\n }\n litTex.needsUpdate = true;\n };\n }\n disposers.push(() => ground.dispose());\n if (!dark && LIGHT_BACKDROP) {\n // (light theme) What a glass sees behind it is only what three.js draws OPAQUE, and the shade, the caustics and the contact shadows are transparent layers over the paper: the glass would see bare paper where the ground is in shadow. So the ground\n // is baked once, from above (the paper, with every layer over it, as seen straight down), onto an opaque plane that is drawn ONLY into what the glass sees (it is thrown away in the picture itself, where the layers are as they were): the glass over\n // a shaded ground is seen through as shaded. The light theme's shadows never change (no lamp turns on or off), so it is baked once.\n const sizeX = cw / PX;\n const sizeZ = ch / PX;\n const bakeW = Math.min(2048, Math.ceil(sizeX * 48));\n const bakeH = Math.min(2048, Math.ceil((sizeZ / sizeX) * bakeW));\n const bake = new THREE.WebGLRenderTarget(bakeW, bakeH, { type: THREE.HalfFloatType, depthBuffer: false });\n const cam = new THREE.OrthographicCamera(-sizeX / 2, sizeX / 2, sizeZ / 2, -sizeZ / 2, 0.1, 20);\n cam.up.set(0, 0, -1);\n cam.position.set(width / 2, 5, total / 2);\n cam.lookAt(width / 2, 0, total / 2);\n const bakeScene = new THREE.Scene();\n bakeScene.add(layers);\n const prevTarget = renderer.getRenderTarget();\n const prevClear = renderer.getClearColor(new THREE.Color());\n const prevAlpha = renderer.getClearAlpha();\n renderer.setRenderTarget(bake);\n renderer.setClearColor(page, 1);\n renderer.clear();\n renderer.render(bakeScene, cam);\n renderer.setRenderTarget(prevTarget);\n renderer.setClearColor(prevClear, prevAlpha);\n bakeScene.remove(layers);\n const uBackdrop = { value: 0 };\n const proxyMat = new THREE.MeshBasicMaterial({ map: bake.texture, toneMapped: false });\n proxyMat.onBeforeCompile = (shader) => {\n shader.uniforms.uBackdrop = uBackdrop;\n shader.fragmentShader = shader.fragmentShader.replace(\"#include <common>\", \"#include <common>\\nuniform float uBackdrop;\").replace(\"void main() {\", \"void main() {\\n if (uBackdrop < 0.5) discard;\");\n };\n proxyMat.customProgramCacheKey = () => \"ground-backdrop\";\n const proxy = new THREE.Mesh(new THREE.PlaneGeometry(sizeX, sizeZ), proxyMat);\n proxy.rotation.x = -Math.PI / 2;\n proxy.position.set(width / 2, 0.01, total / 2);\n proxy.onBeforeRender = (r) => {\n uBackdrop.value = r.getRenderTarget() === sceneRT ? 0 : 1;\n };\n proxy.frustumCulled = false;\n layers.add(proxy);\n disposers.push(() => {\n bake.dispose();\n proxyMat.dispose();\n proxy.geometry.dispose();\n });\n }\n if (dark && DARK_BACKDROP) {\n // (dark theme) The same gap: the glow on the ground is an additive transparent layer, so the glass would see the bare dark ground behind it (black strips next to a lit floor). An opaque plane drawn ONLY into what the glass sees shows the dark ground plus the\n // very texture the glow is drawn from, which hover and the start-up update in place: the glass sees the live light, the picture itself is unchanged.\n const uBackdrop = { value: 0 };\n const proxyMat = new THREE.MeshBasicMaterial({ map: ground.texture, toneMapped: false });\n proxyMat.onBeforeCompile = (shader) => {\n shader.uniforms.uBackdrop = uBackdrop;\n shader.uniforms.uPage = { value: page };\n shader.uniforms.uDim = backdropDim;\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", \"#include <common>\\nuniform float uBackdrop;\\nuniform float uDim;\\nuniform vec3 uPage;\")\n .replace(\"void main() {\", softSeen + \"\\nvoid main() {\\n if (uBackdrop < 0.5) discard;\")\n .replace(\"#include <opaque_fragment>\", `outgoingLight = uPage + uDim * softSeen(outgoingLight);\\n#include <opaque_fragment>`);\n };\n proxyMat.customProgramCacheKey = () => \"ground-backdrop-dark\";\n const proxy = new THREE.Mesh(new THREE.PlaneGeometry(cw / PX, ch / PX), proxyMat);\n proxy.rotation.x = -Math.PI / 2;\n proxy.position.set(width / 2, 0.01, total / 2);\n proxy.onBeforeRender = (r) => {\n uBackdrop.value = r.getRenderTarget() === sceneRT ? 0 : 1;\n };\n proxy.frustumCulled = false;\n layers.add(proxy);\n disposers.push(() => {\n proxyMat.dispose();\n proxy.geometry.dispose();\n });\n }\n layers.userData.dispose = () => disposers.forEach((d) => d());\n return layers;\n };\n\n // One column a day: WakaTime's coding time at the bottom, GitHub's contributions on top of it. Each layer's height and its tint follow how busy the day was (pale and low when quiet, saturated and tall when busy).\n const LAYER_MAX = 2.3;\n const roundedSquare = (() => {\n const half = 0.46;\n const r = 0.16;\n const sh = new THREE.Shape();\n sh.moveTo(-half + r, -half);\n sh.lineTo(half - r, -half);\n sh.absarc(half - r, -half + r, r, -Math.PI / 2, 0, false);\n sh.lineTo(half, half - r);\n sh.absarc(half - r, half - r, r, 0, Math.PI / 2, false);\n sh.lineTo(-half + r, half);\n sh.absarc(-half + r, half - r, r, Math.PI / 2, Math.PI, false);\n sh.lineTo(-half, -half + r);\n sh.absarc(-half + r, -half + r, r, Math.PI, Math.PI * 1.5, false);\n return sh;\n })();\n let tallest = 1;\n // The blocks' shapes, kept from one build to the next: a new colour or theme rebuilds the picture, but its blocks are the same (the data has not changed), and a rounded box costs far more to make than to copy.\n const boxes = new Map<string, BufferGeometry>();\n /** `count` copies of the same 2 or 3 numbers, one after the other (an attribute that is the same on every vertex of a block): plain loops, a callback per number was a large part of the build on a phone. */\n const repeat = (count: number, ...v: number[]) => {\n const a = new Float32Array(count * v.length);\n for (let i = 0; i < a.length; i += v.length) for (let k = 0; k < v.length; k++) a[i + k] = v[k]!;\n return a;\n };\n const roundedBox = (w: number, h: number, d: number, seg: number, r: number): BufferGeometry => {\n const key = `${w.toFixed(4)}|${h.toFixed(4)}|${d.toFixed(4)}|${seg}|${r.toFixed(4)}`;\n let g = boxes.get(key);\n // (kept as a plain geometry: `clone` of a RoundedBoxGeometry builds a new rounded box from its parameters before copying, which made the cache cost more than no cache)\n if (!g) boxes.set(key, (g = new THREE.BufferGeometry().copy(new RoundedBoxGeometry(w, h, d, seg, r))));\n return g.clone();\n };\n // (whether a layer has the package's own colours: the rods' lift toward white is tuned to them; other colours get a generic one)\n const stock = { top: true, bottom: true };\n /** The rod's light, as a (dark theme) colour, for a day at busyness `t`, scaled by `level`. */\n const lum = (c: Color) => 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;\n const stockRod = (src: \"top\" | \"bottom\", hue: Color, t: number, level: number): Color =>\n src === \"bottom\"\n ? hue.clone().multiplyScalar(level * (0.5 + 0.45 * (1 - t) ** 2)).add(new THREE.Color(0.4, 0.56, 0.6).multiplyScalar(level * (0.06 + 1.32 * t * t)))\n : hue.clone().multiplyScalar(level * 1.25).add(new THREE.Color(0.22, 0.4, 0.24).multiplyScalar(level * (0.05 + 0.8 * t * t)));\n const rodLight = (src: \"top\" | \"bottom\", hue: Color, t: number, level: number): Color => {\n if (stock[src]) return stockRod(src, hue, t, level);\n // Any other colour keeps its hue (it is not lifted toward white, as the stock rods are), and is given the brightness of the stock rod on the same day: the same luminance, and never a brighter brightest channel\n // (a pale blue or a bright red would otherwise come out far brighter than the tuned defaults: a light colour has more luminance, a red needs a big red channel to match a green's).\n const [dl, dh] = DEFAULT_COLORS[src].dark;\n const ref = stockRod(src, new THREE.Color(dl).lerp(new THREE.Color(dh), t), t, level);\n const k = Math.min(lum(ref) / Math.max(lum(hue), 1e-3), Math.max(ref.r, ref.g, ref.b) / Math.max(hue.r, hue.g, hue.b, 1e-3));\n return hue.clone().multiplyScalar(k);\n };\n let bounds: ContentBounds | null = null;\n api.bounds = () => bounds;\n // the boxes a pointer can hit (one per layer of a column, one per empty day), for the picking\n interface PickBox { cell: number; x: number; z: number; y0: number; y1: number; pit?: boolean }\n let picks: PickBox[] = [];\n const LIFT = 0.04;\n // The scene's blocks, built in steps: the generator stops (`yield`) every few blocks, so that its runner (`runBuild`) can give the page back its main thread between them; run in one go it was a pause of a second on a phone.\n const build = function* (stack: { bottom: Matrix; top: Matrix }, tones: { bottom: [Color, Color]; top: [Color, Color] }, dark: boolean): Generator<void, Group> {\n const tb0 = performance.now();\n picks = [];\n let tileShape = null as BufferGeometry | null;\n let ringShape0 = null as BufferGeometry | null;\n const rims: BufferGeometry[] = [];\n const pitRims: { geom: BufferGeometry; x: number; z: number }[] = [];\n const pitLamps: { si: number; w: number }[][] = [];\n // (the page's colour is read from the browser once a build, not once a tile: it makes a canvas and reads a pixel back)\n const page = pageColour();\n const shellsBy = new Map<string, BufferGeometry[]>();\n const shellHue = new Map<string, import(\"three\").Color>();\n const shellTier = new Map<string, [\"bottom\" | \"top\", number]>();\n const cores: BufferGeometry[] = [];\n const tiles: BufferGeometry[] = [];\n // the layers are first only noted (where, how tall, how busy, which colour), so that each can be lit by the others before its geometry is made\n interface Spec { src: \"bottom\" | \"top\"; x: number; z: number; y0: number; h: number; t: number; hue: Color }\n const specs: Spec[] = [];\n // (a quiet day still has a faint light at its heart, an old bulb struggling: the floor of the emission)\n // (the lift is for the quietest days only: it fades out well before a busy one)\n const emit = (t: number) => 1.3 * (0.3 + 0.1 * (1 - t) ** 3 + 1.3 * t * t + 0.4 * t);\n const layer = (cell: number, src: \"bottom\" | \"top\", x: number, z: number, y0: number, t: number, [low, high]: [Color, Color]) => {\n const h = 0.18 + t * LAYER_MAX;\n picks.push({ cell, x, z, y0, y1: y0 + h });\n specs.push({ src, x, z, y0, h, t, hue: (customOn() ? customHue(cell, src, t) : null) ?? low.clone().lerp(high, t) });\n tallest = Math.max(tallest, y0 + h);\n return y0 + h;\n };\n for (let i = 0; i < stack.top.cells.length; i++) {\n const g = stack.top.cells[i]!;\n if (i % 48 === 47) yield;\n const w = stack.bottom.cells[i]!;\n const { x, z } = at(g.week, g.day);\n if (w.value <= 0 && g.value <= 0) {\n // an empty day is a soft square pit dug in the ground (the same rounded corners as the blocks): its inside is what is seen (the walls and the floor, from inside: back faces), its floor darker than the page, its walls lighter near the rim\n // (the glow of the neighbours lies over it, so it reflects their light), and a thin rim round its opening takes a highlight on the edges that face the light\n if (!tileShape) {\n const PIT = 0.07;\n const BEVEL = 0.025;\n const g = new THREE.ExtrudeGeometry(roundedSquare, { depth: PIT, bevelEnabled: true, bevelSize: BEVEL, bevelThickness: BEVEL, bevelSegments: lite ? 1 : 3, curveSegments: lite ? 3 : 6 });\n g.rotateX(-Math.PI / 2);\n g.deleteAttribute(\"uv\");\n g.translate(0, -(PIT + BEVEL), 0);\n const pos = g.getAttribute(\"position\");\n const col = new Float32Array(pos.count * 3);\n const floor = dark ? page.clone().multiplyScalar(0.3) : page.clone().multiplyScalar(0.8);\n const wall = dark ? page.clone().add(new THREE.Color(0.012, 0.013, 0.016)) : page.clone().multiplyScalar(0.97);\n const c3 = new THREE.Color();\n for (let q = 0; q < pos.count; q++) {\n const d = Math.min(1, Math.max(0, -pos.getY(q) / (PIT + BEVEL)));\n c3.copy(wall).lerp(floor, d * d);\n c3.toArray(col, q * 3);\n }\n g.setAttribute(\"color\", new THREE.BufferAttribute(col, 3));\n // (a plain geometry, so that each tile's `clone` copies arrays instead of extruding the shape again)\n tileShape = new THREE.BufferGeometry().copy(g);\n g.dispose();\n // the rim: a thin ring round the opening, brighter on the edges that face the sun's side (a soft specular line, not a frame)\n const outer = roundedSquare.getPoints(lite ? 3 : 6);\n const ringShape = new THREE.Shape(outer.map((v) => v.clone().multiplyScalar(1.05)));\n ringShape.holes.push(new THREE.Path(outer.map((v) => v.clone().multiplyScalar(0.955)).reverse()));\n const ring = new THREE.ShapeGeometry(ringShape);\n ring.rotateX(-Math.PI / 2);\n ring.translate(0, 0.004, 0);\n ring.deleteAttribute(\"uv\");\n const rp = ring.getAttribute(\"position\");\n const rc = new Float32Array(rp.count * 3);\n for (let q = 0; q < rp.count; q++) {\n // (the light is the scene's own: the sun of the light theme comes from the top right on the screen, so a pit's lip catches it where its slope faces the top right: on the LEFT edge (+x here: the screen's left is +x) in full, and on the near, lower edge only a hint, as that bevel is turned away from the camera and foreshortened; a vertex of the ring is on an edge by its direction from the middle)\n const rx = rp.getX(q);\n const rz = rp.getZ(q);\n const rl = Math.hypot(rx, rz) || 1;\n const w = Math.pow(Math.max(0, rx / rl), 3) + 0.3 * Math.pow(Math.max(0, -rz / rl), 3);\n if (dark) c3.copy(page).add(new THREE.Color(0.024, 0.026, 0.034).multiplyScalar(Math.min(1, w)));\n else c3.copy(page).lerp(new THREE.Color(1, 1, 1), 0.3 * Math.min(1, w));\n c3.toArray(rc, q * 3);\n }\n ring.setAttribute(\"color\", new THREE.BufferAttribute(rc, 3));\n ringShape0 = new THREE.BufferGeometry().copy(ring);\n ring.dispose();\n }\n const tile = tileShape.clone();\n tile.translate(x, 0, z);\n tiles.push(tile);\n const rim = ringShape0!.clone();\n rim.translate(x, 0, z);\n rims.push(rim);\n pitRims.push({ geom: rim, x, z });\n picks.push({ cell: i, x, z, y0: 0, y1: 0.04, pit: true });\n continue;\n }\n let y = 0;\n if (w.value > 0) y = layer(i, \"bottom\", x, z, 0, w.t, tones.bottom) + LIFT;\n if (g.value > 0) layer(i, \"top\", x, z, y, g.t, tones.top);\n }\n let blockIndex = 0;\n neonNeighbours = [];\n // (dark) the light of a rod that has glass in front of it, nearer the camera, is dimmed by that glass: a clump of bright blocks one in front of the other does not add up to one overexposed blob (the camera never moves, so it is known beforehand)\n const shades = dark ? glassShades(specs.map((q) => ({ x: q.x, z: q.z, y0: q.y0, h: q.h })), GLASS_ABSORB, GLASS_FLOOR) : [];\n const shadeOf = new Map(specs.map((q, k) => [q, shades[k] ?? 1] as const));\n // (dark) the glass is lit by what is behind it, as the camera sees it: lamps behind (their brightness, as much as they are covered by this block's outline) light it, a dark background does not; the share saturates (`1 - e^-x`) so that a stack\n // of bright blocks does not add up to one blob, and a block whose own rod is bright needs none\n const glowOf = new Map<(typeof specs)[number], number>();\n if (dark) {\n const bright = specs.map((q) => {\n const lv = Math.max(emit(q.t) * (1 + 1.1 * q.t), q.src === \"top\" ? GREEN_MIN_LEVEL : 0);\n const r = customOn() ? q.hue.clone().multiplyScalar(lv * 0.55) : rodLight(q.src, q.hue, q.t, lv);\n return Math.max(r.r, r.g, r.b);\n });\n const behind = lightBehind(specs.map((q) => ({ x: q.x, z: q.z, y0: q.y0, h: q.h })), bright);\n specs.forEach((q, k) => {\n const own = Math.min(1, Math.max(0, (bright[k]! - 0.5) / 1.5));\n glowOf.set(q, (1 - Math.exp(-(behind[k] ?? 0) / BEHIND_SCALE)) * (1 - own * own * (3 - 2 * own)));\n });\n }\n // (light) what is seen through a glass is what is behind it: where that is the paper it stays clear, where it is other blocks, the light that comes through them is tinted by them (they are not in what three.js lets the glass see). From the camera's view: the colour\n // of the blocks whose outline this one covers (weighted by how much of it they fill), and how much of it they cover.\n const behindTint = new Map<(typeof specs)[number], Color>();\n if (!dark && !LIGHT_DOUBLE_SIDED) {\n const boxes = specs.map((q) => ({ x: q.x, z: q.z, y0: q.y0, h: q.h }));\n const cover = lightBehind(boxes, specs.map(() => 1));\n const chans = [0, 1, 2].map((c) => lightBehind(boxes, specs.map((q) => [q.hue.r, q.hue.g, q.hue.b][c]!)));\n specs.forEach((q, k) => {\n const cv = cover[k] ?? 0;\n if (cv < 1e-3) return;\n const mean = new THREE.Color(chans[0]![k]! / cv, chans[1]![k]! / cv, chans[2]![k]! / cv);\n behindTint.set(q, new THREE.Color(1, 1, 1).lerp(mean, Math.min(1, cv) * LIGHT_BEHIND_TINT));\n });\n }\n let made = 0;\n for (const sp of specs) {\n if (++made % 24 === 0) yield;\n const { src, x, z, y0, h, t, hue: hue0 } = sp;\n // (`hue` is the glass's: `rodColor` lets a white glass be tainted by the lights around it; the rod in the middle (`hue0`) is always the light's own colour)\n let hue = hue0;\n // (dark) the light the other days give out reaches this one: each neighbour's colour and brightness, weakened with the distance between the two blocks; a dim block beside or under a bright one is lit by it\n const inc = new THREE.Color(0, 0, 0);\n const nb: { j: number[]; m: number[] } = { j: [], m: [] };\n if (dark) {\n for (let oi = 0; oi < specs.length; oi++) {\n const o = specs[oi]!;\n if (o === sp) continue;\n const dx = o.x - x;\n const dz = o.z - z;\n if (Math.abs(dx) > 4 || Math.abs(dz) > 4) continue;\n const dy = o.y0 + o.h / 2 - (y0 + h / 2);\n const k = Math.exp(-(dx * dx + dz * dz + dy * dy) / (2 * 1.2 * 1.2)) * 0.11;\n inc.add(o.hue.clone().multiplyScalar(emit(o.t) * k));\n nb.j.push(oi);\n nb.m.push(emit(o.t) * k * (o.hue.r + o.hue.g + o.hue.b));\n }\n }\n neonNeighbours.push(nb);\n // (`rodColor`: a white light beside or on a coloured one takes its colour, as a white bulb does: it must not stand out as a grey block among the bright ones)\n if (dark && customOn() && Math.max(hue.r, hue.g, hue.b) - Math.min(hue.r, hue.g, hue.b) < 0.15 * Math.max(hue.r, hue.g, hue.b)) {\n const m = Math.max(inc.r, inc.g, inc.b);\n if (m > 1e-4) hue = hue.clone().lerp(inc.clone().multiplyScalar(1 / m).multiplyScalar(Math.max(hue.r, hue.g, hue.b)), Math.min(0.75, m * 3));\n }\n inc.r = Math.min(inc.r, 0.6);\n inc.g = Math.min(inc.g, 0.6);\n inc.b = Math.min(inc.b, 0.6);\n const incLum = (inc.r + inc.g + inc.b) / 3;\n // (the light of the neighbours lifts a dim block, and leaves a bright one as it is: in a dense, busy stretch the glass must stay clear around its core)\n const tEff = t + (1 - t) * Math.min(1, Math.sqrt(incLum * 1.2));\n const shell = roundedBox(0.92, h, 0.92, lite ? 2 : 3, Math.min(0.16, h / 2.2));\n shell.translate(x, y0 + h / 2, z);\n // dark: the glass is nearly clear (the light of its core shows through it); light: tinted by the level\n paint(shell, (dark ? new THREE.Color(0xffffff) : hue.clone().lerp(new THREE.Color(0xffffff), LIGHT_SHELL_WHITE).multiply(behindTint.get(sp) ?? new THREE.Color(1, 1, 1))).add(inc.clone().multiplyScalar(dark && customOn() ? 0.35 : 0.08)), 0, dark);\n shell.setAttribute(\"aBlock\", new THREE.BufferAttribute(new Float32Array(shell.getAttribute(\"position\").count).fill(blockIndex), 1));\n // (the light of the neighbours, for the glass to glow with: see `NEIGHBOUR_GLOW`; only where there are lamps BEHIND the glass as the camera sees it, and none against a dark background, or the glass would look opaque and washed out)\n const nbShare = glowOf.get(sp) ?? 0;\n // (the light that comes from the neighbours is tinted by the block's own colour, as it passes the gas: a green block lit by a white or blue one is lit green: full 1 is the block's colour as it is, 0 the neighbours' light as it is)\n const glowTint = (() => {\n const m = Math.max(hue0.r, hue0.g, hue0.b, 1e-3);\n return new THREE.Color(1, 1, 1).lerp(new THREE.Color(hue0.r / m, hue0.g / m, hue0.b / m), GLOW_TINT);\n })();\n const vcount = shell.getAttribute(\"position\").count;\n shell.setAttribute(\"aInc\", new THREE.BufferAttribute(repeat(vcount, inc.r * nbShare, inc.g * nbShare, inc.b * nbShare), 3));\n shell.setAttribute(\"aTint\", new THREE.BufferAttribute(repeat(vcount, glowTint.r, glowTint.g, glowTint.b), 3));\n // the glass of a busy day glows on its own surface too (dark theme): three steps of emission per source, each its own material\n const tier = tEff < 0.34 ? 0 : tEff < 0.67 ? 1 : 2;\n const key = `${src}${tier}`;\n (shellsBy.get(key) ?? shellsBy.set(key, []).get(key)!).push(shell);\n shellTier.set(key, [src, tier]);\n if (!shellHue.has(key)) shellHue.set(key, hue0.clone());\n // (dark) the busier the day the thinner and the brighter its rod: a quiet one is as wide as before and dim, a busy one a slender, intense filament\n const cw = dark ? 0.5 - 0.2 * t ** 0.85 : 0.38;\n // (dark) the rod is the core of the block: as much glass above and below it as at its sides, so a tall block has a column, a block that is as tall as the rod is wide a cube, and a shorter one a flat core\n // (the gap is kept, down to a rod 0.1 high); the light theme keeps its rod at 80 % of the block\n const gap = (0.92 - cw) / 2;\n const hc = dark ? Math.max(0.1, h - 2 * Math.min(gap, (h - 0.1) / 2)) : h * 0.8;\n const core = roundedBox(cw, hc, cw, lite ? 1 : 2, Math.min(0.1, cw / 2.4, hc / 2.2));\n core.translate(x, y0 + h / 2, z);\n // A blue rod gets its brightness from light added to all three channels (not from more of the same blue, which only makes it bluer and more glowing): a brighter rod is a lighter, clearer blue, not a whiter one\n // (its hue is kept: the blue channel is the hue's own and the red and green rise with the busyness).\n const level = Math.max(emit(t) * (1 + 1.1 * t), src === \"top\" ? GREEN_MIN_LEVEL : 0);\n const rod = dark && customOn() ? hue0.clone().multiplyScalar(level * 0.55 * (Math.max(hue0.r, hue0.g, hue0.b) - Math.min(hue0.r, hue0.g, hue0.b) < 0.15 * Math.max(hue0.r, hue0.g, hue0.b) ? WHITE_ROD : 1)) : dark ? rodLight(src, hue, t, level) : hue;\n paint(core, dark ? rod.clone().multiplyScalar(shadeOf.get(sp) ?? 1) : hue.clone().lerp(new THREE.Color(0xffffff), LIGHT_CORE_LIFT).multiplyScalar(LIGHT_CORE_DEPTH));\n // (the light of the blocks around that reaches this rod when its own is off, on its own attribute: the shader adds it, as much as the neighbours that are on give)\n {\n const count = core.getAttribute(\"position\").count;\n const incs = new Float32Array(count * 3);\n if (dark) for (let q = 0; q < count; q++) inc.toArray(incs, q * 3);\n core.setAttribute(\"aInc\", new THREE.BufferAttribute(incs, 3));\n }\n core.setAttribute(\"aBlock\", new THREE.BufferAttribute(new Float32Array(core.getAttribute(\"position\").count).fill(blockIndex++), 1));\n // (where the rod stands, across: a dim rod is drawn thinner about it)\n core.setAttribute(\"aCtr\", new THREE.BufferAttribute(repeat(core.getAttribute(\"position\").count, x, z), 2));\n cores.push(core);\n }\n // (dark) there is no sun: the lip of a pit shines with the light of the neon around it, on the edge that faces the lamps (a lamp on one side lights the lip on the other side, whose slope faces it), in the lamps' colours; nothing where no lamp is near\n if (dark) {\n pitRims.forEach((pr, pi) => {\n pr.geom.setAttribute(\"aPit\", new THREE.BufferAttribute(new Float32Array(pr.geom.getAttribute(\"position\").count).fill(pi), 1));\n // (what the lamps give this pit's lip, by lamp: the lip's light follows them as they come on, see `rimLight`)\n // (the lamps near enough to light it, found once: every vertex of the lip then looks at these only, not at every block)\n const near: { si: number; dx: number; dz: number; dist: number; w: number }[] = [];\n specs.forEach((sp, si) => {\n const dx = sp.x - pr.x;\n const dz = sp.z - pr.z;\n const dist = Math.hypot(dx, dz);\n if (dist >= 0.5 && dist <= 4) near.push({ si, dx, dz, dist, w: emit(sp.t) * Math.exp(-(dist * dist) / (2 * 1.6 * 1.6)) });\n });\n pitLamps.push(near.map(({ si, w }) => ({ si, w })));\n const rp = pr.geom.getAttribute(\"position\");\n const rc = pr.geom.getAttribute(\"color\");\n for (let q = 0; q < rp.count; q++) {\n const rx = rp.getX(q) - pr.x;\n const rz = rp.getZ(q) - pr.z;\n const rl = Math.hypot(rx, rz) || 1;\n let r = 0;\n let gg = 0;\n let bb = 0;\n for (const { si, dx, dz, dist, w } of near) {\n const facing = Math.max(0, (-(rx / rl) * dx - (rz / rl) * dz) / dist);\n if (facing <= 0) continue;\n const k = w * facing * facing * 0.018;\n const hue = specs[si]!.hue;\n r += hue.r * k;\n gg += hue.g * k;\n bb += hue.b * k;\n }\n rc.setXYZ(q, page.r + Math.min(r, 0.1), page.g + Math.min(gg, 0.1), page.b + Math.min(bb, 0.1));\n }\n rc.needsUpdate = true;\n });\n }\n yield;\n const tb1 = performance.now();\n const group = new THREE.Group();\n const groundGroup = groundLayers(stack, tones, dark, page);\n pitLight = (groundGroup.userData.setLevels as typeof pitLight) ?? null;\n group.add(groundGroup);\n const tb2 = performance.now();\n yield;\n rimLight = null;\n if (tiles.length) {\n const tile = new THREE.Mesh(mergeGeometries(tiles), tileUnlit);\n group.add(tile);\n const rim = new THREE.Mesh(mergeGeometries(rims), tileUnlit.clone());\n const rimMat = rim.material as import(\"three\").MeshBasicMaterial;\n rimMat.side = THREE.FrontSide;\n if (dark && pitLamps.length === pitRims.length && pitRims.length > 0) {\n // (dark) the lip of a pit shines with the lamps around it, so it follows them: its colour above the ground's is scaled by how much of their light there is now (per pit, from the levels)\n const litData = new Float32Array(pitRims.length).fill(1);\n const litTex = new THREE.DataTexture(litData, pitRims.length, 1, THREE.RedFormat, THREE.FloatType);\n litTex.needsUpdate = true;\n rimMat.onBeforeCompile = (shader) => {\n shader.uniforms.uPitLit = { value: litTex };\n shader.uniforms.uPage = { value: page };\n shader.vertexShader = shader.vertexShader\n .replace(\"#include <common>\", \"#include <common>\\nattribute float aPit;\\nuniform highp sampler2D uPitLit;\\nuniform vec3 uPage;\")\n .replace(\"#include <color_vertex>\", \"#include <color_vertex>\\n#ifdef USE_COLOR\\n vColor.rgb = uPage + (vColor.rgb - uPage) * texelFetch(uPitLit, ivec2(int(aPit + 0.5), 0), 0).r;\\n#endif\");\n };\n rimMat.customProgramCacheKey = () => \"pit-rim-lit\";\n const totals = pitLamps.map((l) => l.reduce((acc, q) => acc + q.w, 0));\n rimLight = (levels) => {\n for (let k = 0; k < pitLamps.length; k++) {\n let on = 0;\n for (const q of pitLamps[k]!) on += q.w * Math.min(1, levels[q.si] ?? 1);\n litData[k] = totals[k]! > 1e-6 ? on / totals[k]! : 0;\n }\n litTex.needsUpdate = true;\n };\n }\n group.add(rim);\n }\n const materials: import(\"three\").MeshPhysicalMaterial[] = [];\n for (const [key, list] of shellsBy) {\n yield;\n const [src, tier] = shellTier.get(key)!;\n const mat = blockMaterial.clone();\n // (development only, `?wireframe`: the glass as a wire cage, to check that the rod is centred in it)\n if (dbg.wireframe) {\n mat.wireframe = true;\n mat.transmission = 0;\n mat.transparent = true;\n mat.opacity = 0.9;\n }\n mat.emissive.copy(customOn() ? new THREE.Color(0x000000) : tones[src][1]);\n // (dark) the glass absorbs what is not its own colour as the light goes through it: a green block lets a blue rod behind it show only dimly, and the other way round\n if (dark) {\n // (the glass is clear: it does not filter what is seen through it, the rods give the colour)\n // (only the GitHub layer filters, and in its own palette colour, lifted to its brightest channel; a layer with no hue stays clear)\n const lh = shellHue.get(key);\n const m = lh ? Math.max(lh.r, lh.g, lh.b, 1e-3) : 1;\n const sat = lh ? (m - Math.min(lh.r, lh.g, lh.b)) / m : 0;\n mat.attenuationColor.copy(lh && src === \"top\" ? new THREE.Color(1, 1, 1).lerp(new THREE.Color(lh.r / m, lh.g / m, lh.b / m), LAYER_FILTER_PURITY) : new THREE.Color(1, 1, 1));\n mat.attenuationDistance = src === \"top\" && sat > 0.15 ? LAYER_FILTER_DISTANCE / Math.min(1, sat * 1.5) : 1e3;\n }\n // (dark: the green glass has no glow of its own at all, it is clear; only the blue keeps a faint one: whatever glow a glass has is a tint, and grey where it should be black)\n mat.emissiveIntensity = dark ? [0.02, 0.08, 0.15][tier]! * (src === \"top\" ? DARK_GREEN_GLOW : 0.6) : 0;\n if (dark) {\n // the glass shines as its rod does, down to a little ambient light of the night (the floor 0.14): its own glow and the room's reflections in it follow the rod's level, so that a block whose rod is off is dark\n mat.onBeforeCompile = (shader) => {\n shader.uniforms.uLevels = { value: levelTex };\n // (what is left of the glow and of the reflections when the rod is off is the same for every block, whatever its size or its day: as a share of this tier's own intensities, whatever they are)\n shader.uniforms.uFloorEm = { value: OFF_EMISSIVE / Math.max(mat.emissiveIntensity, 1e-4) };\n shader.uniforms.uFloorEnv = { value: mat.envMapIntensity > 0 ? OFF_ENV / mat.envMapIntensity : 0 };\n shader.vertexShader = shader.vertexShader\n .replace(\"#include <common>\", \"#include <common>\\nattribute float aBlock;\\nattribute vec3 aInc;\\nattribute vec3 aTint;\\nvarying vec3 vInc;\\nvarying vec3 vTint;\\nuniform highp sampler2D uLevels;\\nuniform float uFloorEm;\\nuniform float uFloorEnv;\\nvarying float vLevelEm;\\nvarying float vLevelEnv;\\nvarying float vOn;\")\n .replace(\"#include <begin_vertex>\", \"#include <begin_vertex>\\n vec2 lv = texelFetch(uLevels, ivec2(int(aBlock + 0.5), 0), 0).rg;\\n float own = max(lv.r, 0.3 * lv.g);\\n vOn = clamp(own, 0.0, 1.0);\\n vLevelEm = max(own, uFloorEm);\\n vLevelEnv = max(own, uFloorEnv);\\n vInc = aInc * lv.g * lv.g * lv.g;\\n vTint = aTint;\");\n shader.fragmentShader = shader.fragmentShader\n .replace(\"#include <common>\", \"#include <common>\\nvarying float vLevelEm;\\nvarying float vLevelEnv;\\nvarying float vOn;\\nvarying vec3 vInc;\\nvarying vec3 vTint;\")\n .replace(\"#include <emissivemap_fragment>\", \"#include <emissivemap_fragment>\\n // (right off, the glass glows the same cool grey whatever its source; as soon as there is a light in it, its own colour, darker the dimmer the light: a dimmed block is a tinted, darker one, not a grey one)\\n float offGrey = 1.0 - smoothstep(0.05, 0.6, vOn);\\n totalEmissiveRadiance = mix(totalEmissiveRadiance, vec3(dot(totalEmissiveRadiance, vec3(0.333))) * vec3(0.85, 0.95, 1.15), offGrey) * mix(pow(vLevelEm, 2.0), vLevelEm, offGrey);\\n vec3 nb = min(vInc * \" + NEIGHBOUR_GLOW.toFixed(3) + \", vec3(0.1));\\n nb = max(vec3(0.0), mix(vec3(dot(nb, vec3(0.299, 0.587, 0.114))), nb, \" + GLOW_SATURATION.toFixed(2) + \"));\\n nb *= mix(vec3(1.0), vTint, smoothstep(0.05, 0.6, vOn) * mix(\" + GLOW_TINT_FAINT.toFixed(3) + \", 1.0, smoothstep(0.02, 0.1, max(nb.r, max(nb.g, nb.b)))));\\n totalEmissiveRadiance += nb;\")\n // (the glass's tint is the light of its rod made visible: with the rod off the glass is clear)\n .replace(\"#include <lights_physical_fragment>\", \"#include <lights_physical_fragment>\\n#ifdef USE_TRANSMISSION\\n material.attenuationColor = mix(vec3(1.0), material.attenuationColor, smoothstep(0.12, 0.9, vOn));\\n#endif\")\n .replace(\"#include <lights_fragment_maps>\", \"#include <lights_fragment_maps>\\n#if defined( RE_IndirectSpecular )\\n radiance *= vLevelEnv;\\n#ifdef USE_CLEARCOAT\\n clearcoatRadiance *= vLevelEnv;\\n#endif\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n iblIrradiance *= vLevelEnv;\\n#endif\");\n };\n mat.customProgramCacheKey = () => \"glass-levels\";\n }\n // (the room's reflections are a light too: a quiet day must not shine with them)\n // (a material's own `envMap` is what `envMapIntensity` scales; without it the scene's environment is used as it is)\n // (dark: the room's reflections in the glass and the clear coat's glint are kept, a little dimmer than they were, and tinted with the glass's own colour instead of white; the clear coat is a white layer, so it is made fainter)\n mat.envMap = dark ? env : null;\n mat.envMapIntensity = dark ? [0.02, 0.18, 0.55][tier]! * 0.1 : LIGHT_ENV;\n if (dark) {\n mat.specularColor = new THREE.Color(0xffffff);\n mat.clearcoat = 0.15;\n // (a little frosted: the transmission is blurred, so that the light of the rods spreads in the glass and the glass is not purely clear; the blur is a mip level of the picture seen through it, so it costs next to nothing)\n mat.roughness = DARK_GLASS_ROUGHNESS;\n }\n if (!dark) {\n // (light theme: the glass's own colour is what is seen, through it; the room's reflections on the top and the edges are fainter, and tinted by the glass instead of grey, so that they read as glass and not as polished metal)\n mat.clearcoat = LIGHT_COAT;\n mat.roughness = LIGHT_GLASS_ROUGHNESS;\n mat.specularIntensity = LIGHT_SPECULAR;\n mat.specularColor = tones[src][1].clone().lerp(new THREE.Color(0xffffff), 0.75);\n // (two-sided: three.js draws the BACK faces of a double-sided glass into what the glass in front of it sees, so a block behind another tints it)\n mat.side = LIGHT_DOUBLE_SIDED ? THREE.DoubleSide : THREE.FrontSide;\n }\n materials.push(mat);\n const glass = new THREE.Mesh(mergeGeometries(list)!, mat);\n glass.castShadow = true;\n glass.receiveShadow = true;\n group.add(glass);\n list.forEach((p) => p.dispose());\n }\n group.userData.dispose = () => materials.forEach((m) => m.dispose());\n if (cores.length) {\n const core = new THREE.Mesh(mergeGeometries(cores), dark ? glowMaterial : coreMaterial);\n // (after the opaque things it adds to, the ground's backdrop first: an additive rod drawn before it would be painted over)\n if (dark) core.renderOrder = 10;\n core.castShadow = false;\n group.add(core);\n }\n [...cores, ...tiles].forEach((p) => p.dispose());\n tileShape?.dispose();\n ringShape0?.dispose();\n if (dbg.metrics) console.info(`[activity] build: geometry ${Math.round(tb1 - tb0)} ms, ground ${Math.round(tb2 - tb1)} ms, merge ${Math.round(performance.now() - tb2)} ms`);\n return group;\n };\n\n const blocks = new THREE.Group();\n scene.add(blocks);\n const ground0 = () => ((ground.material as import(\"three\").ShadowMaterial).opacity = isDark() ? 0 : 0.05);\n // (a build in progress: its number, so that a newer one (a theme change, new colours) makes the older stop; and whether one is running, so that no frame is drawn of a scene half built)\n let buildToken = 0;\n let building = false;\n // (whether the canvas has had its first size: the first frames wait for it, `fit` starts them)\n let fitted = false;\n /** How long a step of the build may hold the main thread before the page gets it back (ms). */\n const BUILD_SLICE = 12;\n /** Builds the blocks in steps, a few milliseconds each, the page getting its main thread back between them; the old blocks stay until the new ones are all there, then `done` runs. */\n const buildBlocks = (done: () => void) => {\n const token = ++buildToken;\n building = true;\n // (the lights must not change while the blocks they light are being replaced: the neon and the selection are stopped, `done` starts them again)\n stopNeon();\n window.clearTimeout(focusTimer);\n window.clearTimeout(focusRaf);\n cancelAnimationFrame(raf);\n raf = 0;\n const dark = isDark();\n const pair = (layer: \"top\" | \"bottom\"): [Color, Color] => {\n const [low, high] = colorOf(layer, dark);\n const [dl, dh] = DEFAULT_COLORS[layer][dark ? \"dark\" : \"light\"];\n stock[layer] = sameColor(low, dl) && sameColor(high, dh);\n // (any other colour is brought into the range where the rods, the glass and the ground light look right: see `clampTone`)\n if (!stock[layer]) {\n const [lo, hi] = clampTone(high);\n return [new THREE.Color(lo), new THREE.Color(hi)];\n }\n return [new THREE.Color(low), new THREE.Color(high)];\n };\n const steps = cm(() => build({ bottom: layout.bottom, top: layout.top }, { bottom: pair(\"bottom\"), top: pair(\"top\") }, dark));\n const step = () => {\n if (cancelled || token !== buildToken) return;\n const t = performance.now();\n let result: IteratorResult<void, Group>;\n try {\n result = cm(() => {\n let r = steps.next();\n while (!r.done && performance.now() - t < BUILD_SLICE) r = steps.next();\n return r;\n });\n } catch (e) {\n // (a build that fails must not leave the picture waiting for it forever: the old blocks stay and the frames go on)\n building = false;\n throw e;\n }\n if (!result.done) return void window.setTimeout(step, 0);\n cm(() => {\n showMat.uniforms.bloom!.value = dark ? (customOn() ? 0.4 : 1) : 0;\n showMat.uniforms.veil!.value = customOn() ? 0.75 : 0;\n // night: no sun and no room, the only light is what the days give out\n scene.environmentIntensity = dark ? 0 : 0.9;\n sun.intensity = dark ? 0 : 2.2;\n ground0();\n blocks.traverse((o) => {\n (o as Mesh).geometry?.dispose();\n (o.userData.dispose as (() => void) | undefined)?.();\n });\n blocks.clear();\n blocks.add(result.value);\n building = false;\n done();\n });\n };\n step();\n };\n\n const floor = new THREE.Mesh(new THREE.PlaneGeometry(1200, 1200), new THREE.MeshBasicMaterial({ color: pageColour() }));\n floor.rotation.x = -Math.PI / 2;\n floor.position.set(width / 2, -0.02, total / 2);\n scene.add(floor);\n const ground = new THREE.Mesh(new THREE.PlaneGeometry(1200, 1200), new THREE.ShadowMaterial({ opacity: 0.32, depthWrite: false }));\n ground.rotation.x = -Math.PI / 2;\n // (above the empty tiles, under the glow and contact-shadow layers: the sun's shadows fall on a tile as on the ground)\n ground.position.set(width / 2, 0.06, total / 2);\n ground.receiveShadow = true;\n scene.add(ground);\n\n const sun = new THREE.DirectionalLight(0xffffff, 2.2);\n const sunBase = new THREE.Vector3(-0.45, 1, 0.55).normalize().multiplyScalar(60);\n sun.castShadow = true;\n sun.shadow.mapSize.set(lite ? 2048 : 4096, lite ? 2048 : 4096);\n sun.shadow.bias = -0.0004;\n sun.shadow.normalBias = 0.03;\n const sc = sun.shadow.camera;\n sc.left = -width * 1.4;\n sc.right = width * 1.4;\n sc.top = total * 6;\n sc.bottom = -total * 6;\n sc.near = 1;\n sc.far = 160;\n sun.target.position.set(width / 2, 0, total / 2);\n scene.add(sun, sun.target);\n\n // the isometric camera: from the front-right, above, looking at the middle of the slab; orthographic, so the grid stays a grid\n const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 1, 1900);\n const centre = new THREE.Vector3(width / 2, 1.2, total / 2);\n // (far away: the glass's refraction takes its view direction from the camera's position, as for a perspective camera, so with this camera orthographic a near one bends the view differently across the picture, and the cores sit off-centre on one side)\n camera.position.copy(centre).add(new THREE.Vector3(...CAMERA_DIR).normalize().multiplyScalar(900));\n camera.up.set(0, 1, 0);\n camera.lookAt(centre);\n\n // the accumulation: scene -> `sceneRT`, added into `accumRT`, shown as sum / n by a quad\n const sceneRT = new THREE.WebGLRenderTarget(1, 1, { type: THREE.HalfFloatType });\n const accumRT = new THREE.WebGLRenderTarget(1, 1, { type: THREE.HalfFloatType });\n const quadGeo = new THREE.PlaneGeometry(2, 2);\n const quadCam = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);\n const addMat = new THREE.ShaderMaterial({\n uniforms: { map: { value: sceneRT.texture } },\n vertexShader: \"varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy, 0., 1.); }\",\n fragmentShader: \"uniform sampler2D map; varying vec2 vUv; void main(){ gl_FragColor = texture2D(map, vUv); }\",\n // a running average (new * k + old * (1 - k), k = 1 / (n + 1)): the values stay in 0..1, where a half float is precise; a plain sum grows to ~100 and its rounding errors tint the whole picture\n blending: THREE.CustomBlending,\n blendEquation: THREE.AddEquation,\n blendSrc: THREE.ConstantAlphaFactor,\n blendDst: THREE.OneMinusConstantAlphaFactor,\n blendSrcAlpha: THREE.ConstantAlphaFactor,\n blendDstAlpha: THREE.OneMinusConstantAlphaFactor,\n depthTest: false,\n depthWrite: false,\n });\n // the bloom (dark theme): what is brighter than 1 is cut out of the picture, blurred wide (a separable gaussian at half and at quarter resolution: smooth, no streaks) and added back, so a glowing block gives off a halo\n const VERT = \"varying vec2 vUv; void main(){ vUv = uv; gl_Position = vec4(position.xy, 0., 1.); }\";\n const rt = () => new THREE.WebGLRenderTarget(1, 1, { type: THREE.HalfFloatType, depthBuffer: false });\n const halfA = rt();\n const halfB = rt();\n const quarterA = rt();\n const quarterB = rt();\n const brightMat = new THREE.ShaderMaterial({\n uniforms: { map: { value: accumRT.texture } },\n vertexShader: VERT,\n fragmentShader: \"uniform sampler2D map; varying vec2 vUv; void main(){ vec3 c = texture2D(map, vUv).rgb; gl_FragColor = vec4(max(c - 1.0, 0.), 1.); }\",\n depthTest: false,\n depthWrite: false,\n });\n const blurMat = new THREE.ShaderMaterial({\n uniforms: { map: { value: halfA.texture }, stepv: { value: new THREE.Vector2() } },\n vertexShader: VERT,\n fragmentShader: `uniform sampler2D map; uniform vec2 stepv; varying vec2 vUv;\nvoid main(){\n vec3 c = texture2D(map, vUv).rgb * 0.227027;\n c += (texture2D(map, vUv + stepv * 1.3846154).rgb + texture2D(map, vUv - stepv * 1.3846154).rgb) * 0.3162162;\n c += (texture2D(map, vUv + stepv * 3.2307692).rgb + texture2D(map, vUv - stepv * 3.2307692).rgb) * 0.0702703;\n gl_FragColor = vec4(c, 1.);\n}`,\n depthTest: false,\n depthWrite: false,\n });\n // what is shown: the average, with the bloom added in the dark theme\n const showMat = new THREE.ShaderMaterial({\n uniforms: { map: { value: accumRT.texture }, bloom: { value: 0 }, veil: { value: 0 }, grain: { value: GRAIN }, near: { value: halfA.texture }, far: { value: quarterA.texture } },\n vertexShader: VERT,\n fragmentShader: `uniform sampler2D map; uniform sampler2D near; uniform sampler2D far; uniform float bloom; uniform float veil; uniform float grain; varying vec2 vUv;\nvoid main(){\n vec4 c = texture2D(map, vUv);\n if (bloom > 0.) {\n vec3 halo = texture2D(near, vUv).rgb * 0.24 + texture2D(far, vUv).rgb * 0.17;\n // The halo is cut out of the picture before the rods are taken toward white, so it keeps the saturated blue of their raw light: a near-white rod would glow deep blue. It takes the rod's colour (the same pull toward white), only dimmer; green is left as it is.\n float hm = max(max(halo.r, halo.g), halo.b);\n float haloBlue = smoothstep(0., 0.25, (halo.b - halo.g) / max(hm, 1e-4));\n halo = mix(halo, vec3(hm), haloBlue * 0.6);\n // (the blue's halo is fainter, the green's a little stronger)\n c.rgb += bloom * halo * mix(1.3, 0.38, haloBlue);\n }\n // (rodColor: the grey-white veil that the glass's reflections, the halo and the emissive add to every channel is taken off: what is left is the rod's own colour, as saturated as it is, at the same brightness)\n if (veil > 0.) { float mx = max(c.r, max(c.g, c.b)); float mn = min(c.r, min(c.g, c.b)); float k = smoothstep(0.12, 0.5, (mx - mn) / max(mx, 1e-4)); c.rgb -= mn * veil * k; c.rgb *= mix(1., mix(0.15, 1., k), smoothstep(0.04, 0.2, mx) * (1. - smoothstep(0.2, 0.4, mx))); }\n // A hue-preserving soft clip: a channel past 1 (a busy blue: its blue is far over, its green and red are not) would clip alone and turn the colour pale; the whole colour is brought back so that its brightest channel\n // only just passes 1, and the hue and the saturation stay.\n float m = max(max(c.r, c.g), c.b);\n // A blue light far over 1 (a busy day's rod) is taken toward white as it rises, so the rod is whiter than the blue glass around it (whose reflections and refractions stay under 1); green is left as it is.\n float blueish = smoothstep(0., 0.25, (c.b - c.g) / max(m, 1e-4));\n float hot = smoothstep(1., 3., m);\n c.rgb = mix(c.rgb, vec3(m), blueish * hot * 0.55 * step(veil, 0.));\n if (m > 1.) c.rgb *= (1. + (m - 1.) * 0.12) / m;\n gl_FragColor = c;\n#include <colorspace_fragment>\n // Camera grain: a fine, fixed noise over the whole picture, added after the lighting (on what is shown, not in it). It is meant to read as the noise of a good camera, not as rendering noise: soft (the sum of three\n // uniform numbers, so close to a gaussian and not the harsh specks of a single one), the same for every colour of the picture (it is not gated by brightness: a coloured block gets as much as a grey one), growing with the light (as a sensor's does: the dark glows stay clean) and easing off in the highlights (so that a bright surface does not burn); brightness only, no colour noise.\n if (grain > 0.) {\n vec3 q = fract(vec3(gl_FragCoord.xyx) * vec3(.1031, .1030, .0973));\n q += dot(q, q.yzx + 33.33);\n vec3 h = fract((q.xxy + q.yzz) * q.zyx);\n float g = (h.x + h.y + h.z - 1.5) * 0.7;\n float lum = dot(gl_FragColor.rgb, vec3(0.2126, 0.7152, 0.0722));\n // (the noise of a sensor grows with the light it gets, as its square root: the dark glows stay clean, the lit surfaces carry the grain)\n // (and none at all in the near-blacks: in an 8-bit picture a tiny noise there only flips single pixels between two levels, which is a speckle, not a grain)\n float tone = sqrt(clamp(lum, 0., 1.)) * smoothstep(0.08, 0.3, lum) * (1. - smoothstep(0.7, 1.0, lum) * 0.8);\n // (a soft rise or loss of brightness, a few per cent, never a dark speck: the colour is scaled, its hue kept, and there is no colour noise)\n gl_FragColor.rgb *= 1. + g * grain * 5. * tone;\n }\n}`,\n depthTest: false,\n depthWrite: false,\n });\n const fsMesh = new THREE.Mesh(quadGeo, brightMat);\n const fsScene = new THREE.Scene();\n fsScene.add(fsMesh);\n const pass = (material: import(\"three\").ShaderMaterial, target: import(\"three\").WebGLRenderTarget | null) => {\n fsMesh.material = material;\n renderer.setRenderTarget(target);\n renderer.render(fsScene, quadCam);\n };\n const blur = (from: import(\"three\").WebGLRenderTarget, to: import(\"three\").WebGLRenderTarget, size: [number, number], radius: number) => {\n blurMat.uniforms.map!.value = from.texture;\n blurMat.uniforms.stepv!.value.set(radius / size[0], 0);\n pass(blurMat, to);\n blurMat.uniforms.map!.value = to.texture;\n blurMat.uniforms.stepv!.value.set(0, radius / size[1]);\n pass(blurMat, from);\n };\n const addQuad = new THREE.Mesh(quadGeo, addMat);\n const showQuad = new THREE.Mesh(quadGeo, showMat);\n const quadScene = new THREE.Scene();\n quadScene.add(addQuad);\n\n let w = 1;\n let h = 1;\n let n = 0;\n // (how many frames are added up before the loop stops: all of them, but only a few while the lights are changing, so that the picture keeps up with them)\n let samplesCap = samples;\n let raf = 0;\n const halton = (i: number, b: number) => {\n let f = 1;\n let r = 0;\n for (let k = i + 1; k > 0; k = Math.floor(k / b)) {\n f /= b;\n r += f * (k % b);\n }\n return r;\n };\n\n const fit = () => {\n fitted = true;\n const size = renderSize({ cssWidth: el.clientWidth, cssHeight: el.clientHeight, devicePixelRatio: window.devicePixelRatio, lite, maxPixelRatio: opts.maxPixelRatio, maxPixels: opts.maxPixels, maxSize: renderer.capabilities.maxTextureSize });\n w = size.width;\n h = size.height;\n renderer.setPixelRatio(1);\n renderer.setSize(w, h, false);\n sceneRT.setSize(w, h);\n accumRT.setSize(w, h);\n halfA.setSize(Math.max(1, w >> 1), Math.max(1, h >> 1));\n halfB.setSize(Math.max(1, w >> 1), Math.max(1, h >> 1));\n quarterA.setSize(Math.max(1, w >> 1), Math.max(1, h >> 1));\n quarterB.setSize(Math.max(1, w >> 1), Math.max(1, h >> 1));\n // the slab (with its tallest blocks) projected into the camera's frame fills the view, centred\n camera.updateMatrixWorld();\n const inv = camera.matrixWorldInverse;\n let x0 = Infinity, x1 = -Infinity, y0 = Infinity, y1 = -Infinity;\n for (const [cx, cz] of corners(ROOM)) for (const cy of [0, tallest]) {\n const p = new THREE.Vector3(cx, cy, cz).applyMatrix4(inv);\n x0 = Math.min(x0, p.x); x1 = Math.max(x1, p.x); y0 = Math.min(y0, p.y); y1 = Math.max(y1, p.y);\n }\n if (dbg.metrics) el.dataset.fit = ((x1 - x0) / (y1 - y0)).toFixed(3);\n const aspect = w / h;\n // With strips (a phone) the picture is centred on its rows' centre of gravity (each strip's middle, after `stripShifts` has brought the weight of its blocks there), not on its bounding box: the staggered rows make the box lopsided\n let gx = (x0 + x1) / 2;\n if (strips > 1) {\n const perStrip = Math.ceil(layout.top.weeks / strips);\n let sum = 0;\n for (let k = 0; k < strips; k++) {\n const c = at(k * perStrip + (perStrip - 1) / 2, 3);\n sum += new THREE.Vector3(c.x, 0, c.z).applyMatrix4(inv).x;\n }\n gx = sum / strips;\n }\n const halfH = Math.max((y1 - y0) / 2, Math.max(x1 - gx, gx - x0) / aspect) * 1.04;\n const mx = gx;\n const my = (y0 + y1) / 2;\n camera.left = mx - halfH * aspect;\n camera.right = mx + halfH * aspect;\n camera.top = my + halfH;\n camera.bottom = my - halfH;\n camera.updateProjectionMatrix();\n releaseSize();\n publishBounds();\n restart();\n };\n\n // Where the blocks are on the screen, in CSS pixels of the container: the footprints of the days that have a block (their left and right edges and their foot), and the top of the tallest column.\n // Written to the container as `--nag-content-left` / `-right` / `-top` / `-bottom` (px) and given to `onLayout`, so a caption can be lined up with the picture, not with the box.\n const publishBounds = () => {\n camera.updateMatrixWorld();\n let l = Infinity, r = -Infinity, t = Infinity, b = -Infinity;\n const cw = el.clientWidth;\n const ch = el.clientHeight;\n const px = (x: number, y: number, z: number) => {\n const p = new THREE.Vector3(x, y, z).project(camera);\n return { x: ((p.x + 1) / 2) * cw, y: ((1 - p.y) / 2) * ch };\n };\n layout.top.cells.forEach((g, i) => {\n if (g.value <= 0 && layout.bottom.cells[i]!.value <= 0) return;\n const { x, z } = at(g.week, g.day);\n for (const [dx, dz] of [[-0.46, -0.46], [0.46, -0.46], [-0.46, 0.46], [0.46, 0.46]] as const) {\n const foot = px(x + dx, 0, z + dz);\n l = Math.min(l, foot.x);\n r = Math.max(r, foot.x);\n b = Math.max(b, foot.y);\n }\n t = Math.min(t, px(x, topOf(i), z).y);\n });\n if (!Number.isFinite(l)) return;\n bounds = { left: l, right: r, top: t, bottom: b };\n for (const [k, v] of Object.entries(bounds)) el.style.setProperty(`--nag-content-${k}`, `${v.toFixed(1)}px`);\n opts.onLayout?.(bounds);\n };\n\n const frames: number[] = [];\n const frame = () => cm(() => frameBody());\n // `count` samples are added up before anything is shown (one, when the picture is converging frame by frame; a few at once for an update of the lights, so that the picture never shows its first, rawest samples in a row: that is a shimmer of the whole picture)\n // (`blendFloor`: the least weight a new sample has in the picture; `jitter`: where the sun and the camera are in their sequences, which goes on at every light update, so that the samples of an update are not the same few again)\n let blendFloor = 0;\n let jitter = 0;\n const frameBody = (count = 1) => {\n // (no frame of a scene half built: the build's end starts the frames again)\n if (building) return void (raf = 0);\n raf = 0;\n const f0 = performance.now();\n for (let c = 0; c < count; c++) {\n // the sun moves on a disc (the soft shadow), the camera a sub-pixel (the anti-aliasing)\n const a = halton(n + jitter, 2) * Math.PI * 2;\n const r = Math.sqrt(halton(n + jitter, 3)) * 9;\n sun.position.copy(sunBase).add(new THREE.Vector3(Math.cos(a) * r, 0, Math.sin(a) * r)).add(sun.target.position);\n camera.setViewOffset(w, h, halton(n + jitter, 5) - 0.5, halton(n + jitter, 7) - 0.5, w, h);\n renderer.setRenderTarget(sceneRT);\n renderer.setClearColor(0x000000, 0);\n renderer.clear();\n renderer.render(scene, camera);\n renderer.setRenderTarget(accumRT);\n renderer.autoClear = false;\n addMat.blendAlpha = Math.max(1 / (n + 1), blendFloor);\n renderer.render(quadScene, quadCam);\n renderer.autoClear = true;\n n++;\n }\n // (a light update while the picture settles caps the samples at 2 or 3: that is all it will get then, so it comes into focus on them rather than waiting for ten that never come)\n if (settling && n >= Math.min(10, samples, samplesCap)) sharpen();\n if (showMat.uniforms.bloom!.value > 0) {\n // bright part -> half resolution, blurred twice (near halo); that, blurred again at quarter resolution (far halo)\n pass(brightMat, halfA);\n blur(halfA, halfB, [w >> 1, h >> 1], 1.5);\n blur(halfA, halfB, [w >> 1, h >> 1], 3);\n blurMat.uniforms.map!.value = halfA.texture;\n blurMat.uniforms.stepv!.value.set(0, 0);\n pass(blurMat, quarterA);\n blur(quarterA, quarterB, [w >> 1, h >> 1], 3);\n if (!lite) blur(quarterA, quarterB, [w >> 1, h >> 1], 5);\n }\n renderer.setRenderTarget(null);\n renderer.clear();\n renderer.render(showQuad, quadCam);\n if (dbg.metrics) {\n // (development only: how long a frame takes, the GPU included: `finish` waits for it)\n renderer.getContext().finish();\n frames.push(performance.now() - f0);\n el.dataset.frameMs = (frames.reduce((x, y) => x + y, 0) / frames.length).toFixed(1);\n }\n if (n < samplesCap) raf = requestAnimationFrame(frame);\n else if (dbg.metrics) el.dataset.renderMs = String(Math.round(performance.now() - t0));\n };\n function restart() {\n n = 0;\n if (!raf) raf = requestAnimationFrame(frame);\n }\n // (an update of the lights while the picture is otherwise done: `k` samples drawn at once and shown together, then it stops)\n // An update of the lights, drawn as ONE sample blended into the picture (a running average, the new sample weighing at least `floor`): the camera does not move, so the last picture is a good start for the next, and the noise of the one sample\n // is averaged with the few before it, where `burst` drew several at once from nothing. A fifth of the cost of five samples, with the light changes a few frames late. `n` is kept low, so that the picture can go on to the full number from here.\n const ema = (floor = 0.3) => {\n cancelAnimationFrame(raf);\n raf = 0;\n n = Math.min(n, 6);\n jitter += 1;\n samplesCap = 0;\n blendFloor = floor;\n cm(() => frameBody(1));\n blendFloor = 0;\n };\n\n // --- the neon start-up of the dark theme (not for those who ask for less motion) ---\n let neon: ReturnType<typeof createNeon> | null = null;\n let neonApplyMs = 0;\n let neonTicks = 0;\n const neonAllowed = () => !(opts.reducedMotion === \"auto\" || opts.reducedMotion === undefined ? window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches : opts.reducedMotion);\n // (the idle flickers of the neon only when the picture is in view)\n let inView = true;\n const viewObserver = typeof IntersectionObserver === \"undefined\" ? null : new IntersectionObserver((entries) => (inView = entries.some((e) => e.isIntersecting)));\n viewObserver?.observe(el);\n // (the caller's own part of the start-up, `startup`: prepared with it, started with it, stopped with it)\n let hook: Startup | null = null;\n const stopNeon = () => {\n hook?.stop?.();\n hook = null;\n neon?.stop();\n neon = null;\n neonStart = null;\n samplesCap = samples;\n levelData.fill(1);\n levelTex.needsUpdate = true;\n };\n // the levels as numbers for the shaders: each block's own, and the light that reaches it from the neighbours that are on\n const uploadLevels = (levels: ArrayLike<number>, idle = false) => {\n for (let i = 0; i < neonNeighbours.length && i < MAX_LEVELS; i++) {\n const nb = neonNeighbours[i]!;\n let on = 0;\n let all = 0;\n for (let k = 0; k < nb.j.length; k++) {\n on += nb.m[k]! * levels[nb.j[k]!]!;\n all += nb.m[k]!;\n }\n levelData[i * 2] = levels[i]!;\n // (a tube out in a lit sign is a dimmer gap, not a black one: it gets a bit more than half of what its neighbours would give it at the start-up)\n levelData[i * 2 + 1] = all > 0 ? (idle ? 0.55 * (on / all) + 0.45 * Math.min(1, levels[i]!) : on / all) : 1;\n }\n levelTex.needsUpdate = true;\n };\n // --- the selected day (dark theme): its blocks glow brighter and the others dim, smoothly, a moment after the pointer has settled on it. It multiplies the neon's levels, so it works with the start-up and the flickers. ---\n const FOCUS_ON = 1.7;\n /** (dark) the least the brightest channel of a selected rod reaches (a rod's own full level is 0.5 for a quiet day to 3 for the busiest), so that a small block selected glows as remarkably as a big one; and the most it is lifted for it. */\n const FOCUS_MIN_PEAK = 1.7;\n const FOCUS_MAX_GAIN = 5;\n const FOCUS_OFF = 0.34;\n /** The power of the share of lit blocks that dims the backdrop (2: all dimmed to 0.34 leaves about an eighth). */\n const BACKDROP_DIM_POWER = 2;\n let focusCtl: { update(levels: ArrayLike<number>): void } | null = null;\n let focus = new Float32Array(0);\n let focusTo = new Float32Array(0);\n let effective = new Float32Array(0);\n let lastLevels: ArrayLike<number> = new Float32Array(0);\n let idleLook = false;\n let focusRaf = 0;\n let focusTimer = 0;\n const applyLevels = (levels: ArrayLike<number>) => {\n // (the blocks the levels are for are being replaced)\n if (building) return;\n lastLevels = levels;\n const n = neonBlocks.length;\n if (effective.length !== n) effective = new Float32Array(n).fill(1);\n for (let i = 0; i < n; i++) effective[i] = levels[i]! * (focus[i] ?? 1);\n uploadLevels(effective, idleLook);\n focusCtl?.update(effective);\n pitLight?.(effective);\n rimLight?.(effective);\n // (the ground's light seen through the glass follows how lit the scene is, and more than in proportion: with every light dimmed it all but goes out)\n let lit = 0;\n for (let i = 0; i < n; i++) lit += Math.min(1, effective[i]!);\n backdropDim.value = n > 0 ? (lit / n) ** BACKDROP_DIM_POWER : 1;\n };\n // (the hum of the selected neon follows its brightness, once the start-up is over and when the page may make sound)\n const hum = createHoverHum();\n let humOk = false;\n const humLevel = () => {\n if (!humOk || !(opts.sound ?? true)) return hum.set(0);\n // (the level is the brightest of the blocks, whichever, so that it dies with the light; the voice is the neon that is under the pointer, and none when none is: then the last one's hum only fades)\n let lvl = 0;\n let held = -1;\n for (let i = 0; i < focus.length; i++) {\n lvl = Math.max(lvl, Math.min(1, (focus[i]! - 1) / (FOCUS_ON - 1)));\n if (focusTo[i]! > 1 && (held < 0 || focusTo[i]! > focusTo[held]!)) held = i;\n }\n if (held < 0) return hum.set(lvl);\n hum.set(lvl, neonBlocks[held]!.pan, neonBlocks[held]!.cell, neonBlocks[held]!.t);\n };\n const stepFocus = () => {\n focusRaf = 0;\n let moving = false;\n for (let i = 0; i < focus.length; i++) {\n const d = focusTo[i]! - focus[i]!;\n if (Math.abs(d) > 0.01) {\n focus[i]! += d * 0.28;\n moving = true;\n } else focus[i] = focusTo[i]!;\n }\n applyLevels(lastLevels);\n humLevel();\n // (each step of the fade is drawn from a few samples at once and shown together, not sample by sample: the first of a restart, alone, is the noisiest picture there is)\n ema(lite ? 0.45 : 0.3);\n if (moving) focusRaf = window.setTimeout(stepFocus, 1000 / (lite ? 20 : 30)) as unknown as number;\n else {\n // (the fade is over: the picture goes on from the samples it has, up to the full number, it does not start again from one)\n samplesCap = samples;\n if (!raf) raf = requestAnimationFrame(frame);\n }\n };\n // (a debounce: the day is taken a moment after the pointer stops on it, and let go a moment after it leaves)\n const GHOST = 0.12;\n const focusOn = (cell: number, ghosts: number[] = []) => {\n window.clearTimeout(focusTimer);\n if (!focusCtl || building) return;\n focusTimer = window.setTimeout(() => {\n for (let i = 0; i < focusTo.length; i++) focusTo[i] = cell < 0 ? 1 : neonBlocks[i]!.cell === cell ? Math.min(FOCUS_MAX_GAIN, Math.max(FOCUS_ON, FOCUS_MIN_PEAK / Math.max(neonBlocks[i]!.peak, 1e-3))) : ghosts.includes(neonBlocks[i]!.cell) ? GHOST : FOCUS_OFF;\n window.clearTimeout(focusRaf);\n stepFocus();\n }, cell < 0 ? 140 : 70);\n };\n const prepareNeon = (skipStartup = false) => {\n stopNeon();\n humOk = false;\n hum.stop();\n // (`onLit`: whether the picture is lit, for the page's greeting: not while the start-up runs, always when there is none)\n onLit?.(false);\n window.clearTimeout(focusTimer);\n window.clearTimeout(focusRaf);\n focusCtl = isDark() && stampCtl && neonBlocks.length > 0 && neonBlocks.length <= MAX_LEVELS ? stampCtl : null;\n focus = new Float32Array(neonBlocks.length).fill(1);\n focusTo = new Float32Array(neonBlocks.length).fill(1);\n effective = new Float32Array(neonBlocks.length).fill(1);\n lastLevels = new Float32Array(neonBlocks.length).fill(1);\n idleLook = false;\n backdropDim.value = 1;\n if (focusCtl) applyLevels(lastLevels);\n if (!isDark() || !neonAllowed() || skipStartup || !stampCtl || neonBlocks.length === 0 || neonBlocks.length > MAX_LEVELS) return void ((humOk = true), onLit?.(true));\n const ctl = stampCtl;\n neonApplyMs = 0;\n neonTicks = 0;\n neon = createNeon({\n blocks: neonBlocks,\n sound: opts.sound ?? true,\n canPlay: () => inView,\n // (a weak device, a phone: half the updates, so half the redraws of the picture while the lights flicker)\n fps: lite ? 10 : 20,\n // (the wobble is redrawn more often than the flickers: 40 a second, 15 on a weak device)\n wobbleFps: lite ? 15 : 40,\n apply: (levels, idle) => {\n const a0 = performance.now();\n idleLook = !!idle;\n applyLevels(levels);\n neonApplyMs += performance.now() - a0;\n neonTicks++;\n if (dbg.metrics) {\n let mn = 1;\n let sum = 0;\n for (let q = 0; q < levels.length; q++) {\n mn = Math.min(mn, levels[q]!);\n sum += levels[q]!;\n }\n el.dataset.neonMin = mn.toFixed(2);\n el.dataset.neonMean = (sum / levels.length).toFixed(3);\n }\n ema(lite ? 0.45 : 0.3);\n },\n done: () => {\n humOk = true;\n onLit?.(true);\n // (the picture goes on from the samples it has to the full number: it does not start again from one, the noisiest picture there is)\n samplesCap = samples;\n if (!raf) raf = requestAnimationFrame(frame);\n if (dbg.metrics) {\n el.dataset.neonTicks = String(neonTicks);\n el.dataset.neonApplyMs = (neonApplyMs / Math.max(1, neonTicks)).toFixed(2);\n el.dataset.neonFrameMs = (frames.reduce((x, y) => x + y, 0) / Math.max(1, frames.length)).toFixed(1);\n el.dataset.neonDone = \"1\";\n }\n },\n });\n hook = opts.startup?.({ inView: () => inView }) ?? null;\n if (dbg.metrics) el.dataset.neonRods = String(neon.count);\n // (the flickering rods are off from the first frame: the picture is not seen before it starts)\n applyLevels(neon.levels);\n neonStart = () => {\n frames.length = 0;\n hook?.start?.();\n neon?.start();\n };\n // (development only, `?neonhold`: the start-up never begins, and the picture is held half on, half off, to look at it with rods off)\n if (dbg.neonHold) {\n neonStart = null;\n // (and the left part of the picture is on, the right part off: to see a block that is off beside blocks that are on)\n const half = Float32Array.from(neonBlocks, (b) => (b.pan > -0.1 ? 1 : Number(dbg.neonHold) > 0 && Number(dbg.neonHold) < 1 ? Number(dbg.neonHold) : 0));\n uploadLevels(half);\n ctl.update(half);\n }\n };\n // (the first picture: drawn once the blocks are all built, the start-up prepared with them)\n buildBlocks(() => {\n prepareNeon();\n if (fitted) restart();\n });\n // --- hovering: the day under the pointer (or the key) ---\n const dom = renderer.domElement;\n const ray = new THREE.Raycaster();\n const ndc = new THREE.Vector2();\n let current = -1;\n let pinned = false;\n const cells = layout.top.cells;\n const topOf = (cell: number) => picks.filter((b) => b.cell === cell).reduce((m, b) => Math.max(m, b.y1), 0);\n // every day under the point, the nearest first (a day behind a taller one is under the same point: it is reached by cycling through these)\n const pickAll = (cx: number, cy: number) => {\n const r = dom.getBoundingClientRect();\n ndc.set(((cx - r.left) / r.width) * 2 - 1, -((cy - r.top) / r.height) * 2 + 1);\n camera.updateMatrixWorld();\n ray.setFromCamera(ndc, camera);\n const o = ray.ray.origin;\n const d = ray.ray.direction;\n const hits = new Map<number, number>();\n for (const b of picks) {\n // the ray against the box (the slab method)\n let t0 = -Infinity;\n let t1 = Infinity;\n for (const [oo, dd, lo, hi] of [[o.x, d.x, b.x - 0.46, b.x + 0.46], [o.y, d.y, b.y0, b.y1], [o.z, d.z, b.z - 0.46, b.z + 0.46]] as const) {\n if (Math.abs(dd) < 1e-9) {\n if (oo < lo || oo > hi) t0 = Infinity;\n continue;\n }\n const a = (lo - oo) / dd;\n const c = (hi - oo) / dd;\n t0 = Math.max(t0, Math.min(a, c));\n t1 = Math.min(t1, Math.max(a, c));\n }\n if (t0 <= t1 && t0 < (hits.get(b.cell) ?? Infinity)) hits.set(b.cell, t0);\n }\n return [...hits.entries()].sort((x, y) => x[1] - y[1]).map(([cell]) => cell);\n };\n const toCss = (v: import(\"three\").Vector3) => {\n const p = v.clone().project(camera);\n return { x: ((p.x + 1) / 2) * el.clientWidth, y: ((1 - p.y) / 2) * el.clientHeight };\n };\n const hull = (pts: { x: number; y: number }[]) => {\n const s2 = [...pts].sort((a, b) => a.x - b.x || a.y - b.y);\n const cr = (o: { x: number; y: number }, a: { x: number; y: number }, b: { x: number; y: number }) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);\n const lower: typeof pts = [];\n for (const p of s2) {\n while (lower.length >= 2 && cr(lower[lower.length - 2]!, lower[lower.length - 1]!, p) <= 0) lower.pop();\n lower.push(p);\n }\n const upper: typeof pts = [];\n for (const p of [...s2].reverse()) {\n while (upper.length >= 2 && cr(upper[upper.length - 2]!, upper[upper.length - 1]!, p) <= 0) upper.pop();\n upper.push(p);\n }\n return [...lower.slice(0, -1), ...upper.slice(0, -1)];\n };\n // The outline is always 64 points along the silhouette from its top-most one, so that the outline of one day can glide into the next one's (a path with the same number of points is interpolated by the browser)\n const resample = (poly: { x: number; y: number }[], n: number) => {\n let start = 0;\n poly.forEach((p, i) => {\n if (p.y < poly[start]!.y) start = i;\n });\n const ring = [...poly.slice(start), ...poly.slice(0, start)];\n const lens = ring.map((p, i) => Math.hypot(ring[(i + 1) % ring.length]!.x - p.x, ring[(i + 1) % ring.length]!.y - p.y));\n const total = lens.reduce((x, y) => x + y, 0);\n const out: { x: number; y: number }[] = [];\n let seg = 0;\n let acc = 0;\n for (let k = 0; k < n; k++) {\n const target = (k / n) * total;\n while (acc + lens[seg]! < target && seg < ring.length - 1) acc += lens[seg++]!;\n const f = lens[seg]! > 0 ? (target - acc) / lens[seg]! : 0;\n const a2 = ring[seg]!;\n const b2 = ring[(seg + 1) % ring.length]!;\n out.push({ x: a2.x + (b2.x - a2.x) * f, y: a2.y + (b2.y - a2.y) * f });\n }\n return out;\n };\n // (days behind one another under the pointer: the stack, where the pointer was when it was made, and whether the visitor is cycling through it)\n let stack: number[] = [];\n let stackAt = { x: 0, y: 0 };\n let cycling = false;\n const announce = (cell: number, behind?: { index: number; count: number }) => {\n current = cell;\n // (the days in front of the one looked at are ghosts: it is seen through them)\n focusOn(cell, behind ? stack.slice(0, behind.index) : []);\n if (cell < 0 || !onHover) return onHover?.(null);\n const g = cells[cell]!;\n const { x, z } = at(g.week, g.day);\n const top = topOf(cell);\n // The silhouette of the day's rounded blocks: each block is a rounded box (corner radius `r`, as built), so its outline is that of its eight corner spheres, which the (orthographic) camera sees as circles of the same size; the hull of\n // them is the outline, with the rounded corners and no flat bevels.\n camera.updateMatrixWorld();\n const right = new THREE.Vector3().setFromMatrixColumn(camera.matrixWorld, 0);\n const origin = toCss(new THREE.Vector3(x, 0, z));\n const unit = Math.hypot(toCss(new THREE.Vector3(x, 0, z).add(right)).x - origin.x, toCss(new THREE.Vector3(x, 0, z).add(right)).y - origin.y);\n const corners: { x: number; y: number }[] = [];\n for (const b of picks) {\n if (b.cell !== cell) continue;\n // (a pit's outline is the rounded square it is, not the squashed box of its pick)\n const r = b.pit ? 0.16 : Math.min(0.16, (b.y1 - b.y0) / 2.2);\n for (const dx of [-1, 1]) for (const dz of [-1, 1]) for (const y of b.pit ? [0] : [b.y0 + r, b.y1 - r]) {\n const p = toCss(new THREE.Vector3(x + dx * (0.46 - r), y, z + dz * (0.46 - r)));\n for (let k = 0; k < 10; k++) corners.push({ x: p.x + r * unit * Math.cos((k / 10) * Math.PI * 2), y: p.y + r * unit * Math.sin((k / 10) * Math.PI * 2) });\n }\n }\n const c = toCss(new THREE.Vector3(x, top, z));\n onHover({ index: cell, date: g.date, top: g.value, bottom: layout.bottom.cells[cell]?.value ?? 0, outline: resample(hull(corners), 64).map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(\" \"), x: c.x, y: c.y, behind });\n };\n const onMove = (e: PointerEvent) => {\n if (e.pointerType === \"touch\" || settling) return;\n // (cycling holds the selection until the pointer moves away from where it was clicked)\n if (cycling && Math.hypot(e.clientX - stackAt.x, e.clientY - stackAt.y) > 8) {\n cycling = false;\n pinned = false;\n }\n if (pinned) return;\n const here = pickAll(e.clientX, e.clientY);\n const cell = here[0] ?? -1;\n if (cell !== current) {\n stack = here;\n stackAt = { x: e.clientX, y: e.clientY };\n announce(cell, here.length > 1 ? { index: 0, count: here.length } : undefined);\n }\n };\n const onLeave = () => {\n if (!pinned && current !== -1) announce(-1);\n };\n // (a tap on a phone pins a day; a second tap on it, or on nothing, lets it go)\n const onDown = (e: PointerEvent) => {\n if (settling) return;\n const here = pickAll(e.clientX, e.clientY);\n const sameSpot = Math.hypot(e.clientX - stackAt.x, e.clientY - stackAt.y) <= 8 && stack.length > 1;\n if (e.pointerType !== \"touch\") {\n // (a click on days that are behind one another: the next one behind; after the last, the nearest again)\n if (here.length < 2) return;\n if (!sameSpot || !stack.includes(current)) {\n stack = here;\n stackAt = { x: e.clientX, y: e.clientY };\n }\n const next = (Math.max(0, stack.indexOf(current)) + 1) % stack.length;\n cycling = true;\n pinned = true;\n announce(stack[next]!, { index: next, count: stack.length });\n return;\n }\n // (a tap pins a day; a tap on the same spot goes to the next one behind it, and after the last lets go; a tap elsewhere pins that spot's nearest)\n if (pinned && sameSpot && current >= 0) {\n const next = stack.indexOf(current) + 1;\n if (next < stack.length) return announce(stack[next]!, { index: next, count: stack.length });\n pinned = false;\n return announce(-1);\n }\n const cell = here[0] ?? -1;\n stack = here;\n stackAt = { x: e.clientX, y: e.clientY };\n pinned = cell !== -1 && cell !== current;\n announce(pinned ? cell : -1, pinned && here.length > 1 ? { index: 0, count: here.length } : undefined);\n };\n // (the keys: the arrows walk the days, Escape lets go)\n const onKey = (e: KeyboardEvent) => {\n const last = cells.length - 1;\n let next = current;\n if (e.key === \"Escape\") {\n pinned = false;\n return announce(-1);\n }\n const step = { ArrowLeft: -7, ArrowRight: 7, ArrowUp: -1, ArrowDown: 1 }[e.key];\n if (step === undefined) return;\n e.preventDefault();\n next = current < 0 ? last : Math.min(last, Math.max(0, current + step));\n pinned = true;\n announce(next);\n };\n // (not in the tab order: a focus ring round the whole picture is ugly; a click still focuses it, so the arrow keys walk the days after one)\n el.tabIndex = -1;\n dom.addEventListener(\"pointermove\", onMove);\n dom.addEventListener(\"pointerleave\", onLeave);\n dom.addEventListener(\"pointerdown\", onDown);\n el.addEventListener(\"keydown\", onKey);\n el.addEventListener(\"blur\", onLeave);\n // (the first size is taken at once; the next ones wait for the resizing to pause: the old picture is softened meanwhile)\n let first = true;\n let resizeTimer = 0;\n let seenW = 0;\n let seenH = 0;\n const ro = new ResizeObserver(() => {\n if (first) {\n first = false;\n seenW = el.clientWidth;\n seenH = el.clientHeight;\n fit();\n return;\n }\n // (a change of less than a pixel is not a resize: nothing is redrawn for it)\n if (Math.abs(el.clientWidth - seenW) < 1 && Math.abs(el.clientHeight - seenH) < 1) return;\n seenW = el.clientWidth;\n seenH = el.clientHeight;\n soften();\n holdSize();\n pinned = false;\n if (current !== -1) announce(-1);\n window.clearTimeout(resizeTimer);\n resizeTimer = window.setTimeout(fit, 180);\n });\n ro.observe(el);\n // `recolour`: the colours changed, nothing else: the blocks are built again, but the start-up does not play again (the tubes are simply on)\n const rethink = (recolour = false) => cm(() => rethinkBody(recolour));\n const rethinkBody = (recolour: boolean) => {\n // (a change of theme: the page has already changed, and the old picture, light on a dark page or the reverse, must not stay on it: it goes at once, with no fade: the rebuild blocks the page, and a fade would start only after it, with the old picture on show for its first frames)\n if (!recolour) renderer.domElement.style.transition = \"none\";\n soften(recolour ? \"0.85\" : \"0\");\n pinned = false;\n if (current !== -1) announce(-1);\n (floor.material as import(\"three\").MeshBasicMaterial).color.copy(pageColour());\n // (switching to the dark theme from the light one: the baked light is fetched first, and the blocks are built once, when it is there: built without it they had no neon to start up, so they were drawn lit, then built again, off, and flickered on)\n if (isDark() && !templates && !templatesFailed) {\n // (the old picture's frames must stop meanwhile: its accumulation would reach its tenth sample and bring the old, light picture back into focus on the dark page)\n cancelAnimationFrame(raf);\n raf = 0;\n void wantTemplates().then(() => !cancelled && rethink(recolour));\n return;\n }\n buildBlocks(() => {\n prepareNeon(recolour);\n restart();\n });\n };\n // (`theme: \"auto\"` follows the system's)\n const onScheme = () => st.theme === \"auto\" && rethink(false);\n mq.addEventListener(\"change\", onScheme);\n api.rethink = (recolour) => rethink(recolour);\n\n api.stop = () => {\n stopNeon();\n hum.stop();\n window.clearTimeout(focusTimer);\n window.clearTimeout(focusRaf);\n cancelAnimationFrame(raf);\n window.clearTimeout(resizeTimer);\n dom.removeEventListener(\"pointermove\", onMove);\n dom.removeEventListener(\"pointerleave\", onLeave);\n dom.removeEventListener(\"pointerdown\", onDown);\n el.removeEventListener(\"keydown\", onKey);\n el.removeEventListener(\"blur\", onLeave);\n onHover?.(null);\n ro.disconnect();\n mq.removeEventListener(\"change\", onScheme);\n el.removeAttribute(\"tabindex\");\n blocks.traverse((o) => {\n (o as Mesh).geometry?.dispose();\n (o.userData.dispose as (() => void) | undefined)?.();\n });\n boxes.forEach((g) => g.dispose());\n blockMaterial.dispose();\n coreMaterial.dispose();\n glowMaterial.dispose();\n levelTex.dispose();\n viewObserver?.disconnect();\n templates?.texture.dispose();\n tileUnlit.dispose();\n sceneRT.dispose();\n accumRT.dispose();\n [halfA, halfB, quarterA, quarterB].forEach((t) => t.dispose());\n env.dispose();\n pmrem.dispose();\n renderer.dispose();\n renderer.domElement.remove();\n };\n });\n\n })().catch((e) => console.error(\"[neon-activity-graph]\", e));\n return {\n stop() {\n cancelled = true;\n api.stop();\n el.removeAttribute(\"role\");\n el.removeAttribute(\"aria-roledescription\");\n el.removeAttribute(\"aria-label\");\n },\n rethink: (recolour?: boolean) => api.rethink(recolour),\n bounds: () => api.bounds(),\n ready,\n };\n}\n","import type { HoverInfo } from \"./types\";\n\n/** SVG path data for the `outline` points of a hover (`\"x,y x,y ...\"`, CSS pixels of the container). */\nexport function outlinePath(outline: string): string {\n const pts = outline.trim().split(/\\s+/).filter(Boolean);\n return pts.length ? `M${pts.join(\"L\").replaceAll(\",\", \" \")}Z` : \"\";\n}\n\n/** \"Thu 19 Nov 2026\" for an ISO date, read in UTC (the date has no time of day). */\nexport function formatDay(date: string, locale?: string): string {\n return new Date(`${date}T00:00:00Z`).toLocaleDateString(locale, { weekday: \"short\", day: \"numeric\", month: \"short\", year: \"numeric\", timeZone: \"UTC\" });\n}\n\n/**\n * Where a card hangs on a day: centred on the top of its column, above it (below it when there is no room above), kept `margin` px inside the box horizontally. Returns the card's top-left corner (CSS pixels of the box).\n */\nexport function cardPosition(info: Pick<HoverInfo, \"x\" | \"y\">, box: { width: number; height: number }, card: { width: number; height: number }, gap = 14, margin = 8): { x: number; y: number; below: boolean } {\n const half = card.width / 2;\n const x = box.width > card.width + 2 * margin ? Math.min(Math.max(info.x, half + margin), box.width - half - margin) : box.width / 2;\n const below = info.y - card.height - gap < 0;\n return { x: x - half, y: below ? info.y + gap : info.y - card.height - gap, below };\n}\n\n/** A number as the card shows it: whole numbers plainly, others with one decimal. */\nexport function formatValue(v: number): string {\n return Number.isInteger(v) ? String(v) : v.toFixed(1);\n}\n","import { cardPosition, formatDay, formatValue, outlinePath } from \"./overlay-math\";\nimport type { HoverInfo } from \"./types\";\n\nexport interface OverlayOptions {\n /** Draw the outline of the day's blocks (default true). */\n outline?: boolean;\n /** The day card: `true` for the default one, `false` for none, or a function that returns its content (text or a node). */\n card?: boolean | ((info: HoverInfo) => string | Node);\n /** Locale of the default card's date. */\n locale?: string;\n}\n\nexport interface HoverOverlay {\n update(info: HoverInfo | null): void;\n destroy(): void;\n}\n\n/**\n * The day under the pointer: an outline round its blocks (an SVG path over the picture) and a card hung on its column, both inside `container`, styled through CSS variables (set them on the container or above it):\n * `--nag-outline` (stroke, default the text colour), `--nag-outline-fill`, `--nag-card-bg`, `--nag-card-fg`, `--nag-card-muted`, `--nag-top` and `--nag-bottom` (the two layers' colours in the card), `--nag-card-radius`.\n * `labels` names the two layers in the default card. Days behind one another (the pointer is on several) show \"2 of 3, click for next\".\n */\nexport function createHoverOverlay(container: HTMLElement, options: OverlayOptions = {}, labels: () => { top?: { label?: string; unit?: string }; bottom?: { label?: string; unit?: string } } = () => ({})): HoverOverlay {\n const { outline = true, card = true, locale } = options;\n if (getComputedStyle(container).position === \"static\") container.style.position = \"relative\";\n const root = document.createElement(\"div\");\n root.className = \"nag-overlay\";\n // (the overlay is the container's size and clips what is outside it: a card can never widen the page)\n root.style.cssText = \"position:absolute;inset:0;pointer-events:none;z-index:2;overflow:clip\";\n root.innerHTML = `<style>\n.nag-overlay{--nag-top-default:#0a8f2c;--nag-bottom-default:#1a6fe0}\n@media (prefers-color-scheme:dark){.nag-overlay{--nag-top-default:#3ddc6a;--nag-bottom-default:#5aa9ff}}\n.nag-outline{fill:var(--nag-outline-fill,color-mix(in srgb,currentColor 7%,transparent));stroke:var(--nag-outline,currentColor);stroke-width:1.5;stroke-linejoin:round}\n.nag-card{position:absolute;left:0;top:0;padding:10px 14px;min-width:9.5em;border-radius:var(--nag-card-radius,12px);color:var(--nag-card-fg,inherit);font:13px/1.35 system-ui,sans-serif;white-space:nowrap;background:var(--nag-card-bg,color-mix(in srgb,Canvas 70%,transparent));-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);box-shadow:inset 0 0 0 1px color-mix(in srgb,currentColor 11%,transparent),0 14px 44px -12px rgb(0 0 0/.38),0 2px 10px -4px rgb(0 0 0/.22);transition:opacity .16s,transform .3s cubic-bezier(.2,.7,.2,1)}\n.nag-card .nag-day{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--nag-card-muted,color-mix(in srgb,currentColor 60%,transparent))}\n.nag-card .nag-figs{display:flex;gap:22px;margin-top:8px}\n.nag-card .nag-v{font-size:26px;font-weight:600;line-height:1;font-variant-numeric:tabular-nums}\n.nag-card .nag-l{margin-top:4px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--nag-card-muted,color-mix(in srgb,currentColor 60%,transparent))}\n.nag-card .nag-top{color:var(--nag-top,var(--nag-top-default))}.nag-card .nag-bottom{color:var(--nag-bottom,var(--nag-bottom-default))}\n.nag-card .nag-behind{margin-top:10px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--nag-card-muted,color-mix(in srgb,currentColor 60%,transparent))}\n@media (prefers-reduced-motion:reduce){.nag-card{transition:opacity .16s}}\n</style>`;\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n svg.style.cssText = \"position:absolute;inset:0;width:100%;height:100%;overflow:visible;opacity:0;transition:opacity .12s\";\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"class\", \"nag-outline\");\n svg.append(path);\n if (outline) root.append(svg);\n const cardEl = document.createElement(\"div\");\n cardEl.className = \"nag-card\";\n cardEl.style.opacity = \"0\";\n if (card) root.append(cardEl);\n const live = document.createElement(\"p\");\n live.setAttribute(\"aria-live\", \"polite\");\n live.style.cssText = \"position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;margin:0\";\n root.append(live);\n container.append(root);\n\n const fill = (info: HoverInfo) => {\n if (typeof card === \"function\") {\n const c = card(info);\n return void (typeof c === \"string\" ? (cardEl.textContent = c) : cardEl.replaceChildren(c));\n }\n const l = labels();\n const fig = (cls: string, v: number, name: string | undefined, unit: string | undefined) => `<div class=\"${cls}\"><div class=\"nag-v\">${formatValue(v)}${unit && unit.length <= 2 ? `<span style=\"font-size:13px;font-weight:400\"> ${unit}</span>` : \"\"}</div><div class=\"nag-l\">${name ?? \"\"}</div></div>`;\n const esc = (s: string | undefined) => (s ?? \"\").replace(/[&<>\"]/g, (c) => ({ \"&\": \"&\", \"<\": \"<\", \">\": \">\", '\"': \""\" })[c]!);\n cardEl.innerHTML = `<div class=\"nag-day\">${esc(formatDay(info.date, locale))}</div><div class=\"nag-figs\">${fig(\"nag-top\", info.top, esc(l.top?.label), l.top?.unit)}${fig(\"nag-bottom\", info.bottom, esc(l.bottom?.label), l.bottom?.unit)}</div>${info.behind && info.behind.count > 1 ? `<div class=\"nag-behind\">${info.behind.index + 1} of ${info.behind.count} · click for next</div>` : \"\"}`;\n };\n let seen = false;\n return {\n update(info) {\n if (!info) {\n svg.style.opacity = \"0\";\n cardEl.style.opacity = \"0\";\n live.textContent = \"\";\n return;\n }\n path.setAttribute(\"d\", outlinePath(info.outline));\n svg.style.opacity = \"1\";\n if (card) {\n fill(info);\n const p = cardPosition(info, { width: container.clientWidth, height: container.clientHeight }, { width: cardEl.offsetWidth, height: cardEl.offsetHeight });\n // (the card appears in place when it comes from nothing, and glides from one day to the next)\n if (!seen) cardEl.style.transition = \"opacity .16s\";\n cardEl.style.transform = `translate(${p.x}px, ${p.y}px)`;\n cardEl.style.opacity = \"1\";\n if (!seen) requestAnimationFrame(() => (cardEl.style.transition = \"\"));\n seen = true;\n }\n live.textContent = `${formatDay(info.date, locale)}: ${formatValue(info.top)} and ${formatValue(info.bottom)}`;\n },\n destroy() {\n root.remove();\n },\n };\n}\n","import { bell } from \"./neon\";\n\nlet ctx: AudioContext | null = null;\nlet master: GainNode | null = null;\n\n/**\n * One of the start-up's bell-like clicks, on demand (a \"cling\", for a change the visitor made: a new colour): a small one, or a big one (a deeper bell with a high one over it). It is made with the same synthesised bell as the\n * start-up's dings, quiet, and only if the browser lets the page make sound (an audio context made in a click is allowed to play; before any interaction it stays silent and nothing else happens). No file.\n */\nexport function cling(size: \"small\" | \"big\" = \"small\"): void {\n try {\n const AC = window.AudioContext ?? (window as unknown as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AC) return;\n if (!ctx) {\n ctx = new AC();\n master = ctx.createGain();\n master.gain.value = 1;\n master.connect(ctx.destination);\n }\n if (ctx.state === \"suspended\") void ctx.resume().catch(() => {});\n const when = ctx.currentTime + 0.01;\n const pitch = 2700 + Math.random() * 650;\n if (size === \"big\") {\n bell(ctx, master!, when, 1000 + Math.random() * 150, 0, 2.6);\n bell(ctx, master!, when + 0.03, pitch, 0, 1.6);\n } else {\n bell(ctx, master!, when, pitch, 0, 1.2);\n }\n } catch {\n /* (no audio: nothing to do) */\n }\n}\n","import { mountScene, type SceneHandle } from \"./graph\";\nimport { createHoverOverlay, type HoverOverlay } from \"./overlay\";\nimport { mountPlaceholder } from \"./placeholder\";\nimport { cling } from \"./sound\";\nimport { layoutGraph } from \"./layout\";\nimport { predictBounds, shiftsFromLayers, tallestOfLayers } from \"./view\";\nimport type { ActivityGraph, ContentBounds, GraphData, GraphOptions } from \"./types\";\n\n/**\n * Draws the graph into `container` (give it a size: the picture fills it; with `strips: 4`, an aspect of about 0.8). three.js is loaded on demand from the host's dependencies.\n *\n * ```ts\n * const graph = createActivityGraph(el, { data: { top: { days: [...] }, bottom: { days: [...] } } });\n * graph.update(newData);\n * graph.destroy();\n * ```\n */\nexport function createActivityGraph(container: HTMLElement, options: GraphOptions): ActivityGraph {\n const state = { theme: options.theme ?? \"auto\" };\n let opts = options;\n // (the strips of a narrow page are moved by the weight of their days, which the scene knows from the data: the place-holder and the predicted bounds are given the same, when the data is there, so that they are where the scene will be)\n const strips0 = options.strips ?? 1;\n const geometryOf = (data: GraphData | null | undefined) => {\n const known = data ? layoutGraph(data, options.weeks ?? 53) : null;\n return { shifts: known && strips0 > 1 ? shiftsFromLayers([known.top, known.bottom], strips0) : undefined, tallest: known ? tallestOfLayers(known.top, known.bottom) : undefined };\n };\n let { shifts, tallest } = geometryOf(options.data);\n // (is the theme dark: the place-holder's tiles are faint grey squares in the dark theme only; `undefined` while it is the system's and there is no way to ask, as in a prerender)\n const isDarkTheme = (): boolean | undefined => (state.theme === \"auto\" ? (typeof matchMedia === \"undefined\" ? undefined : matchMedia(\"(prefers-color-scheme: dark)\").matches) : state.theme === \"dark\");\n const holder = options.placeholder === false ? null : mountPlaceholder(container, { weeks: options.weeks, strips: options.strips, shifts, tallest, dark: isDarkTheme() });\n const overlay: HoverOverlay | null = options.overlay ? createHoverOverlay(container, options.overlay === true ? {} : options.overlay, () => ({ top: opts.data?.top, bottom: opts.data?.bottom })) : null;\n // (what the scene is given: the caller's callbacks, plus the place-holder's fade and the overlay's updates)\n const wrap = (o: GraphOptions): GraphOptions => ({\n ...o,\n onLayout,\n onReady: () => {\n holder?.fadeOut();\n o.onReady?.();\n },\n onHover: (i) => {\n overlay?.update(i);\n o.onHover?.(i);\n },\n });\n let sceneOpts: (GraphOptions & { data: GraphData }) | null = null;\n const start = (): SceneHandle => (opts.data ? mountScene(container, (sceneOpts = wrap({ ...opts, data: opts.data }) as GraphOptions & { data: GraphData }), state) : { stop() {}, rethink() {}, bounds: () => null, ready: Promise.resolve() });\n // The blocks' bounds are known at once, from the geometry alone, so a caption lined up with them (`--nag-content-left`) is placed at the first paint and does not move when the scene arrives; the scene's own bounds replace them.\n let measured = false;\n const predict = () => {\n if (measured || !container.clientWidth || !container.clientHeight) return;\n const b = predictBounds(options.weeks ?? 53, options.strips ?? 1, container.clientWidth, container.clientHeight, tallest, shifts);\n for (const [k, v] of Object.entries(b)) container.style.setProperty(`--nag-content-${k}`, `${v.toFixed(1)}px`);\n };\n predict();\n const predictObserver = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(predict);\n predictObserver?.observe(container);\n const onLayout = (b: ContentBounds) => {\n measured = true;\n predictObserver?.disconnect();\n options.onLayout?.(b);\n };\n let handle: SceneHandle = start();\n let destroyed = false;\n let colorTimer = 0;\n let colorDirty = false;\n return {\n get bounds() {\n return handle.bounds();\n },\n get ready() {\n return handle.ready;\n },\n update(data: GraphData) {\n if (destroyed) return;\n // (the place-holder, if it is still there, and the predicted bounds follow the new data: they are where the scene will be)\n ({ shifts, tallest } = geometryOf(data));\n holder?.setGeometry({ shifts, tallest });\n predict();\n handle.stop();\n opts = { ...opts, data };\n handle = start();\n },\n cling(size) {\n // (the bells belong to the neon: in the light theme the tubes are off, so there is nothing to ring)\n if (!destroyed && options.sound !== false && isDarkTheme()) cling(size);\n },\n setColors(colors) {\n if (destroyed) return;\n opts = { ...opts, colors: { top: { ...opts.colors?.top, ...colors.top }, bottom: { ...opts.colors?.bottom, ...colors.bottom } } };\n // (the mounted scene reads its colours from its own options object: it is given the new ones too)\n if (sceneOpts) sceneOpts.colors = opts.colors;\n // The first change in a quiet moment is applied at once (a click on a preset), the ones that follow within 120 ms (a drag on a colour input fires on every step) are folded into one more rebuild at the end of that window.\n if (colorTimer) {\n colorDirty = true;\n return;\n }\n handle.rethink(true);\n const settle = () => {\n colorTimer = 0;\n if (!colorDirty || destroyed) return;\n colorDirty = false;\n handle.rethink(true);\n colorTimer = window.setTimeout(settle, 120);\n };\n colorTimer = window.setTimeout(settle, 120);\n },\n setTheme(theme) {\n if (destroyed) return;\n state.theme = theme;\n holder?.setDark(isDarkTheme());\n handle.rethink();\n },\n destroy() {\n destroyed = true;\n window.clearTimeout(colorTimer);\n handle.stop();\n predictObserver?.disconnect();\n holder?.remove();\n overlay?.destroy();\n },\n };\n}\n\nexport * from \"./pure\";\nexport { createHoverOverlay } from \"./overlay\";\nexport type { HoverOverlay, OverlayOptions } from \"./overlay\";\nexport { cardPosition, formatDay, outlinePath } from \"./overlay-math\";\nexport { renderSize } from \"./size\";\nexport { DEFAULT_COLORS } from \"./graph\";\nexport type { ActivityGraph, ContentBounds, GraphOptions, HoverInfo, RodContext, Startup } from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA,IAAM;AAAA;AAAA,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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