@framefields/compositions 0.0.0-stage → 2.0.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.
- package/LICENCE +202 -0
- package/dist/index.d.mts +81 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +898 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layer-logic-DBs4NHoi.mjs +162 -0
- package/dist/layer-logic-DBs4NHoi.mjs.map +1 -0
- package/dist/program/index.d.mts +3401 -0
- package/dist/program/index.d.mts.map +1 -0
- package/dist/program/index.mjs +5454 -0
- package/dist/program/index.mjs.map +1 -0
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +3 -0
- package/dist/timing-CHy-6wsp.d.mts +53 -0
- package/dist/timing-CHy-6wsp.d.mts.map +1 -0
- package/package.json +63 -3
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["x2","rawName","name","rawDir","dir","count","z","deriv","length","pos","nx","ny","segLUT","durationMs"],"sources":["../../src/utils/layout/resolve-layout.ts","../../src/program/inline-signals.ts","../../src/program/animation.ts","../../src/program/evaluator.ts","../../src/program/text-animations/advanced-builder.ts","../../src/program/text-animations/advanced-types.ts","../../src/program/text-animations/types.ts","../../src/program/text-animations/builder.ts","../../src/program/text-animations/math.ts","../../src/program/text-animations/path.ts","../../src/program/text-animations/selectors.ts","../../src/program/text-animations/typewriter.ts","../../src/program/schema.ts","../../src/program/sequence.ts","../../src/program/stagger.ts","../../src/program/to-virtual-media.ts","../../src/program/validate.ts"],"sourcesContent":["/**\n * Yoga-backed layout pass for the v2 program document.\n *\n * `computeLayout(input)` is a PURE async function: structure + viewport\n * (+ measure) → per-node rects. No React, no GPU, no DOM, no clock.\n *\n * This replaces the hand-rolled flexbox engine with Facebook's Yoga layout\n * (WASM-backed, `yoga-layout@3.x`). Yoga is the same engine powering React\n * Native and Satori.\n *\n * Semantics (unchanged contract):\n * - `flex`: children along `dir` (row/column) with gap/padding/justify\n * (main) / align (cross) / wrap / grow / shrink.\n * - `block`: vertical stack; container width defaults to \"fill\".\n * - `box`: styled rectangle; with children behaves as a column stack\n * (content over the fill), without children is a leaf.\n * - `text` / `media`: leaves — intrinsics come from the injected measure.\n * - `position: \"absolute\"`: out of flow, placed at the node's x/y relative\n * to the parent's content origin.\n * - SizeSpec: number px | \"auto\" (intrinsic) | \"fit\" (intrinsic) |\n * \"fill\" (parent extent, split by `grow`).\n */\n\nimport type { Yoga, Node as YogaNode } from \"yoga-layout/load\";\nexport type { Yoga };\n\nimport { loadYoga } from \"yoga-layout/load\";\nimport type {\n\tCompositionNodeBase,\n\tLayoutNode,\n\tSizeSpec,\n} from \"../../program/schema.js\";\n\n/**\n * A node as layout reads it. Camera, light and model nodes carry only some\n * of the base layout fields; the rest read as undefined, which layout handles.\n */\ntype LaidOutNode = LayoutNode & Partial<CompositionNodeBase>;\ntype YogaPosition = number | `${number}%`;\n\nexport interface Rect {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n}\n\nexport interface LayoutResult {\n\t/** Final rect per node id (post-layout, pre-affine-transform). */\n\trects: Record<string, Rect>;\n\t/** Resolved outer size per node id. */\n\tsizes: Record<string, { width: number; height: number }>;\n}\n\n/**\n * Intrinsic (\"auto\"/\"fit\") size for a leaf node. Return null when the node\n * has no measurable content. In the compositor this is backed by text\n * measurement / media metadata — the layout pass never measures itself.\n */\nexport type MeasureFn = (\n\tnode: LayoutNode,\n\tconstraintWidth?: number,\n) => { width: number; height: number } | null;\n\nexport interface LayoutInput {\n\t/** Document roots — the only structural input. Size comes from `viewport`. */\n\tlayout: LayoutNode[];\n\tviewport: { width: number; height: number };\n\tmeasure?: MeasureFn;\n}\n\n// ── Yoga singleton ────────────────────────────────────────────────────\n\nlet yogaInstance: Yoga | null = null;\n\n/**\n * Ensure the Yoga WASM module is loaded. Safe to call multiple times —\n * subsequent calls return the cached instance immediately.\n */\nexport async function initLayout(): Promise<Yoga> {\n\tif (yogaInstance) return yogaInstance;\n\tyogaInstance = await loadYoga();\n\treturn yogaInstance;\n}\n\n// ── Yoga enum helpers ─────────────────────────────────────────────────\n\nfunction mapJustify(\n\tyoga: Yoga,\n\tvalue?: \"start\" | \"center\" | \"end\" | \"space-between\" | \"space-around\",\n): number {\n\tswitch (value) {\n\t\tcase \"center\":\n\t\t\treturn yoga.JUSTIFY_CENTER;\n\t\tcase \"end\":\n\t\t\treturn yoga.JUSTIFY_FLEX_END;\n\t\tcase \"space-between\":\n\t\t\treturn yoga.JUSTIFY_SPACE_BETWEEN;\n\t\tcase \"space-around\":\n\t\t\treturn yoga.JUSTIFY_SPACE_AROUND;\n\t\tdefault:\n\t\t\treturn yoga.JUSTIFY_FLEX_START;\n\t}\n}\n\nfunction mapAlign(\n\tyoga: Yoga,\n\tvalue?: \"start\" | \"center\" | \"end\" | \"stretch\",\n): number {\n\tswitch (value) {\n\t\tcase \"center\":\n\t\t\treturn yoga.ALIGN_CENTER;\n\t\tcase \"end\":\n\t\t\treturn yoga.ALIGN_FLEX_END;\n\t\tcase \"stretch\":\n\t\t\treturn yoga.ALIGN_STRETCH;\n\t\tdefault:\n\t\t\treturn yoga.ALIGN_FLEX_START;\n\t}\n}\n\nfunction mapAlignSelf(\n\tyoga: Yoga,\n\tvalue?:\n\t\t| \"auto\"\n\t\t| \"start\"\n\t\t| \"center\"\n\t\t| \"end\"\n\t\t| \"stretch\"\n\t\t| \"baseline\"\n\t\t| undefined,\n): number {\n\tswitch (value) {\n\t\tcase \"start\":\n\t\t\treturn yoga.ALIGN_FLEX_START;\n\t\tcase \"center\":\n\t\t\treturn yoga.ALIGN_CENTER;\n\t\tcase \"end\":\n\t\t\treturn yoga.ALIGN_FLEX_END;\n\t\tcase \"stretch\":\n\t\t\treturn yoga.ALIGN_STRETCH;\n\t\tcase \"baseline\":\n\t\t\treturn yoga.ALIGN_BASELINE;\n\t\tdefault:\n\t\t\treturn yoga.ALIGN_AUTO;\n\t}\n}\n\n// ── Helpers ───────────────────────────────────────────────────────────\n\nfunction toYogaValue(val: unknown): number | string | undefined {\n\tif (val === undefined || val === null) return undefined;\n\tif (typeof val === \"number\" || typeof val === \"string\") return val;\n\tif (typeof val === \"object\") {\n\t\tif (\n\t\t\t\"unit\" in (val as Record<string, unknown>) &&\n\t\t\ttypeof (val as Record<string, unknown>).unit === \"number\"\n\t\t) {\n\t\t\treturn val as unknown as number | string;\n\t\t}\n\t\tconst num = Number(val);\n\t\tif (!Number.isNaN(num)) return num;\n\t}\n\treturn undefined;\n}\n\n/** Container main dir; leaves return null. */\nfunction dirOf(node: LayoutNode): \"row\" | \"column\" | null {\n\tswitch (node.kind) {\n\t\tcase \"flex\":\n\t\t\treturn node.dir ?? \"row\";\n\t\tcase \"block\":\n\t\t\treturn \"column\";\n\t\tcase \"box\":\n\t\t\treturn node.children && node.children.length > 0 ? \"column\" : null;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\n/** Container default width spec (block fills like HTML). */\nfunction defaultWidthSpec(node: LayoutNode): SizeSpec | undefined {\n\tif (node.kind === \"block\") return \"fill\";\n\treturn undefined;\n}\n\nfunction containerStyle(node: LayoutNode): {\n\tgap: number;\n\tpadding: number;\n\tjustify: \"start\" | \"center\" | \"end\" | \"space-between\" | \"space-around\";\n\talign: \"start\" | \"center\" | \"end\" | \"stretch\";\n\twrap: boolean;\n} {\n\tlet gap = 0;\n\tif (node.kind === \"flex\" || node.kind === \"block\") {\n\t\tconst g = toYogaValue(node.gap);\n\t\tgap = typeof g === \"number\" ? g : 0;\n\t}\n\n\tlet padding = 0;\n\tif (\n\t\tnode.kind === \"flex\" ||\n\t\tnode.kind === \"block\" ||\n\t\tnode.kind === \"box\" ||\n\t\tnode.kind === \"text\"\n\t) {\n\t\tconst p = toYogaValue(node.padding);\n\t\tpadding = typeof p === \"number\" ? p : 0;\n\t}\n\n\tlet justify: \"start\" | \"center\" | \"end\" | \"space-between\" | \"space-around\" =\n\t\t\"start\";\n\tif (node.kind === \"flex\") {\n\t\tjustify = node.justify ?? \"start\";\n\t}\n\n\tlet align: \"start\" | \"center\" | \"end\" | \"stretch\" = \"start\";\n\tif (node.kind === \"flex\" || node.kind === \"block\") {\n\t\talign = node.align ?? \"start\";\n\t}\n\n\tlet wrap = false;\n\tif (node.kind === \"flex\") {\n\t\twrap = typeof node.wrap === \"boolean\" ? node.wrap : false;\n\t}\n\n\treturn {\n\t\tgap,\n\t\tpadding,\n\t\tjustify,\n\t\talign,\n\t\twrap,\n\t};\n}\n\nfunction isAbsolutePositioned(layoutNode: LayoutNode): boolean {\n\tconst node = layoutNode as LaidOutNode;\n\treturn (\n\t\tnode.position === \"absolute\" ||\n\t\t(node.position === undefined &&\n\t\t\t(node.x !== undefined || node.y !== undefined))\n\t);\n}\n\n/** Flow children (non-absolute). */\nfunction flowChildren(node: LayoutNode): LayoutNode[] {\n\tif (\"children\" in node && node.children) {\n\t\treturn node.children.filter(\n\t\t\t(c: LayoutNode) => !isAbsolutePositioned(c),\n\t\t) as LayoutNode[];\n\t}\n\treturn [];\n}\n\nfunction absoluteChildren(node: LayoutNode): LayoutNode[] {\n\tif (\"children\" in node && node.children) {\n\t\treturn node.children.filter((c: LayoutNode) =>\n\t\t\tisAbsolutePositioned(c),\n\t\t) as LayoutNode[];\n\t}\n\treturn [];\n}\n\n// ── Build Yoga tree ───────────────────────────────────────────────────\n\ninterface NodeMapping {\n\tyogaNode: YogaNode;\n\tlayoutNode: LayoutNode;\n\tchildren: NodeMapping[];\n}\n\nfunction buildYogaNode(\n\tyoga: Yoga,\n\tlayoutNode: LayoutNode,\n\tparentExtent: { width?: number; height?: number } | undefined,\n\tmeasure: MeasureFn | undefined,\n\tparentDir: \"row\" | \"column\" | null,\n): NodeMapping {\n\tconst node = layoutNode as LaidOutNode;\n\tconst yn = yoga.Node.create();\n\tconst dir = dirOf(node);\n\tconst isContainer = dir !== null;\n\tconst children: NodeMapping[] = [];\n\n\t// ── Position ──────────────────────────────────────────────────\n\tconst isAbsolute = isAbsolutePositioned(node);\n\n\tif (isAbsolute) {\n\t\tyn.setPositionType(yoga.POSITION_TYPE_ABSOLUTE);\n\t\tconst posX = toYogaValue(node.x);\n\t\tconst posY = toYogaValue(node.y);\n\t\tif (posX !== undefined)\n\t\t\tyn.setPosition(yoga.EDGE_LEFT, posX as YogaPosition);\n\t\tif (posY !== undefined) yn.setPosition(yoga.EDGE_TOP, posY as YogaPosition);\n\t} else {\n\t\tyn.setPositionType(yoga.POSITION_TYPE_RELATIVE);\n\t\t// Do not set EDGE_LEFT/EDGE_TOP offsets on the Yoga node itself;\n\t\t// we will apply relative offsets manually after the layout pass.\n\t}\n\n\t// ── Flex child props ─────────────────────────────────────────\n\tconst grow = toYogaValue(node.grow);\n\tif (grow !== undefined) {\n\t\tyn.setFlexGrow(typeof grow === \"number\" ? grow : parseFloat(grow));\n\t}\n\tconst flexShrink = toYogaValue(node.flexShrink);\n\tif (flexShrink !== undefined) {\n\t\tyn.setFlexShrink(\n\t\t\ttypeof flexShrink === \"number\" ? flexShrink : parseFloat(flexShrink),\n\t\t);\n\t} else {\n\t\t// Yoga defaults shrink to 0, but CSS defaults to 1 for flex children.\n\t\t// For flow children (parentDir !== null), default to 1 so items shrink to fit when container is constrained.\n\t\tyn.setFlexShrink(parentDir !== null ? 1 : 0);\n\t}\n\tif (node.flexBasis !== undefined) {\n\t\tyn.setFlexBasis(node.flexBasis);\n\t}\n\tif (node.alignSelf !== undefined) {\n\t\tyn.setAlignSelf(mapAlignSelf(yoga, node.alignSelf));\n\t}\n\n\t// ── Size ─────────────────────────────────────────────────────\n\tconst wSpec = node.width ?? defaultWidthSpec(node);\n\tconst hSpec = node.height;\n\n\tconst isWidthMain = parentDir === \"row\";\n\tconst isHeightMain = parentDir === \"column\";\n\n\tapplySizeSpec(yn, \"width\", wSpec, parentExtent?.width, isWidthMain);\n\tapplySizeSpec(yn, \"height\", hSpec, parentExtent?.height, isHeightMain);\n\n\t// ── Container layout ─────────────────────────────────────────\n\tif (isContainer) {\n\t\tconst cs = containerStyle(node);\n\n\t\tyn.setFlexDirection(\n\t\t\tdir === \"row\" ? yoga.FLEX_DIRECTION_ROW : yoga.FLEX_DIRECTION_COLUMN,\n\t\t);\n\t\tyn.setJustifyContent(mapJustify(yoga, cs.justify));\n\t\tyn.setAlignItems(mapAlign(yoga, cs.align));\n\t\tyn.setFlexWrap(cs.wrap ? yoga.WRAP_WRAP : yoga.WRAP_NO_WRAP);\n\n\t\tif (cs.padding > 0) yn.setPadding(yoga.EDGE_ALL, cs.padding);\n\t\tif (cs.gap > 0) yn.setGap(yoga.GUTTER_ALL, cs.gap);\n\n\t\t// Build child Yoga nodes\n\t\tconst flow = flowChildren(node);\n\t\tconst abs = absoluteChildren(node);\n\t\tconst allChildren = [...flow, ...abs];\n\n\t\tfor (let i = 0; i < allChildren.length; i++) {\n\t\t\tconst childMapping = buildYogaNode(\n\t\t\t\tyoga,\n\t\t\t\tallChildren[i],\n\t\t\t\tundefined,\n\t\t\t\tmeasure,\n\t\t\t\tisAbsolutePositioned(node) ? null : dir,\n\t\t\t);\n\t\t\tyn.insertChild(childMapping.yogaNode, i);\n\t\t\tchildren.push(childMapping);\n\t\t}\n\t} else if (\n\t\tnode.kind === \"text\" ||\n\t\t(node.kind === \"media\" && (node as any).dataType === \"Caption\")\n\t) {\n\t\t// Leaf: text node uses dynamic setMeasureFunc for intrinsic sizing\n\t\tyn.setMeasureFunc((width, widthMode, height, heightMode) => {\n\t\t\tlet constraintWidth: number | undefined;\n\t\t\t// 1 = Exactly, 2 = AtMost. We only wrap when width is constrained.\n\t\t\tif (widthMode === 1 || widthMode === 2) {\n\t\t\t\tconstraintWidth = width;\n\t\t\t}\n\t\t\tconst measured = measure?.(node, constraintWidth) ?? {\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0,\n\t\t\t};\n\t\t\tlet resolvedWidth = measured.width;\n\t\t\tlet resolvedHeight = measured.height;\n\t\t\tif (widthMode === 1) resolvedWidth = width;\n\t\t\tif (heightMode === 1) resolvedHeight = height;\n\t\t\treturn { width: resolvedWidth, height: resolvedHeight };\n\t\t});\n\t} else {\n\t\t// Leaf: use measure function for intrinsic sizing (media, etc.)\n\t\tconst measured = measure?.(node) ?? null;\n\t\tif (measured) {\n\t\t\tconst hasRatio = node.aspectRatio !== undefined;\n\t\t\tconst isCaption = (node as any).dataType === \"Caption\";\n\t\t\tconst intrinsicRatio =\n\t\t\t\tmeasured.height > 0 ? measured.width / measured.height : 1;\n\n\t\t\tif (node.kind === \"media\" && !isCaption && !hasRatio) {\n\t\t\t\tyn.setAspectRatio(intrinsicRatio);\n\t\t\t}\n\n\t\t\tconst isWAuto =\n\t\t\t\twSpec === undefined || wSpec === \"auto\" || wSpec === \"fit\";\n\t\t\tconst isHAuto =\n\t\t\t\thSpec === undefined || hSpec === \"auto\" || hSpec === \"fit\";\n\n\t\t\tif (isWAuto && isHAuto) {\n\t\t\t\t// Both are auto: use dynamic measure function so Yoga can size media\n\t\t\t\t// proportionally to container constraints (cross-axis stretch, flex-shrink, max bounds)\n\t\t\t\tconst ar =\n\t\t\t\t\tnode.aspectRatio ??\n\t\t\t\t\t(node.kind === \"media\" ? intrinsicRatio : undefined) ??\n\t\t\t\t\t1;\n\n\t\t\t\tyn.setMeasureFunc((width, widthMode, height, heightMode) => {\n\t\t\t\t\tlet resW = measured.width;\n\t\t\t\t\tlet resH = measured.height;\n\n\t\t\t\t\tif (widthMode === 1 && heightMode === 1) {\n\t\t\t\t\t\tresW = width;\n\t\t\t\t\t\tresH = height;\n\t\t\t\t\t} else if (widthMode === 1) {\n\t\t\t\t\t\tresW = width;\n\t\t\t\t\t\tresH = ar > 0 ? Math.round(width / ar) : measured.height;\n\t\t\t\t\t} else if (heightMode === 1) {\n\t\t\t\t\t\tresH = height;\n\t\t\t\t\t\tresW = ar > 0 ? Math.round(height * ar) : measured.width;\n\t\t\t\t\t} else if (widthMode === 2 && heightMode === 2) {\n\t\t\t\t\t\tconst scale = Math.min(\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\twidth / measured.width,\n\t\t\t\t\t\t\theight / measured.height,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tresW = Math.round(measured.width * scale);\n\t\t\t\t\t\tresH = Math.round(measured.height * scale);\n\t\t\t\t\t} else if (widthMode === 2) {\n\t\t\t\t\t\tif (measured.width > width) {\n\t\t\t\t\t\t\tresW = width;\n\t\t\t\t\t\t\tresH = ar > 0 ? Math.round(width / ar) : measured.height;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (heightMode === 2) {\n\t\t\t\t\t\tif (measured.height > height) {\n\t\t\t\t\t\t\tresH = height;\n\t\t\t\t\t\t\tresW = ar > 0 ? Math.round(height * ar) : measured.width;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { width: resW, height: resH };\n\t\t\t\t});\n\t\t\t} else if (isWAuto) {\n\t\t\t\t// Width is auto, Height is fixed/fill: let Yoga resolve width via aspect ratio if available,\n\t\t\t\t// otherwise fallback to measured width.\n\t\t\t\tconst ar =\n\t\t\t\t\tnode.aspectRatio ??\n\t\t\t\t\t(node.kind === \"media\" ? intrinsicRatio : undefined);\n\t\t\t\tif (ar === undefined || ar <= 0) {\n\t\t\t\t\tyn.setWidth(measured.width);\n\t\t\t\t}\n\t\t\t} else if (isHAuto) {\n\t\t\t\t// Height is auto, Width is fixed/fill: let Yoga resolve height via aspect ratio if available,\n\t\t\t\t// otherwise fallback to measured height.\n\t\t\t\tconst ar =\n\t\t\t\t\tnode.aspectRatio ??\n\t\t\t\t\t(node.kind === \"media\" ? intrinsicRatio : undefined);\n\t\t\t\tif (ar === undefined || ar <= 0) {\n\t\t\t\t\tyn.setHeight(measured.height);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { yogaNode: yn, layoutNode: node, children };\n}\n\nfunction applySizeSpec(\n\tyn: YogaNode,\n\tdim: \"width\" | \"height\",\n\tspec: SizeSpec | undefined,\n\tparentExtent: number | undefined,\n\tisFlexChild: boolean,\n): void {\n\tif (spec === undefined || spec === \"auto\" || spec === \"fit\") {\n\t\t// Yoga defaults to auto — leave undefined to trigger measure or\n\t\t// content-based sizing.\n\t\treturn;\n\t}\n\tconst resolvedSpec = toYogaValue(spec);\n\tif (typeof resolvedSpec === \"number\") {\n\t\tif (dim === \"width\") yn.setWidth(resolvedSpec);\n\t\telse yn.setHeight(resolvedSpec);\n\t\treturn;\n\t}\n\tif (resolvedSpec === \"fill\") {\n\t\t// \"fill\" on a flex child along the main axis = flex-grow (take\n\t\t// leftover space), matching the old engine. On root or cross axis\n\t\t// it means \"stretch to 100%\".\n\t\tif (isFlexChild) {\n\t\t\t// Set flex-grow if not already explicitly set via the `grow` prop.\n\t\t\t// flexBasis=0 ensures the item starts from zero and grows into\n\t\t\t// the leftover, so two \"fill\" children split 50/50 by default.\n\t\t\tif (yn.getFlexGrow() === 0) {\n\t\t\t\tyn.setFlexGrow(1);\n\t\t\t}\n\t\t\tyn.setFlexBasis(0);\n\t\t\treturn;\n\t\t}\n\t\tif (parentExtent !== undefined) {\n\t\t\tif (dim === \"width\") yn.setWidth(parentExtent);\n\t\t\telse yn.setHeight(parentExtent);\n\t\t} else {\n\t\t\tif (dim === \"width\") yn.setWidthPercent(100);\n\t\t\telse yn.setHeightPercent(100);\n\t\t}\n\t}\n}\n\n// ── Read results ──────────────────────────────────────────────────────\n\nfunction readLayout(\n\tmapping: NodeMapping,\n\tparentX: number,\n\tparentY: number,\n\trects: Record<string, Rect>,\n\tsizes: Record<string, { width: number; height: number }>,\n): void {\n\tconst layout = mapping.yogaNode.getComputedLayout();\n\tlet x = parentX + layout.left;\n\tlet y = parentY + layout.top;\n\tconst width = layout.width;\n\tconst height = layout.height;\n\n\tconst node = mapping.layoutNode;\n\tif (!isAbsolutePositioned(node)) {\n\t\tx += Number(node.x ?? 0);\n\t\ty += Number(node.y ?? 0);\n\t}\n\n\trects[mapping.layoutNode.id] = {\n\t\tx: Math.round(x * 1000) / 1000,\n\t\ty: Math.round(y * 1000) / 1000,\n\t\twidth: Math.round(width * 1000) / 1000,\n\t\theight: Math.round(height * 1000) / 1000,\n\t};\n\tsizes[mapping.layoutNode.id] = {\n\t\twidth: Math.round(width * 1000) / 1000,\n\t\theight: Math.round(height * 1000) / 1000,\n\t};\n\n\tfor (const child of mapping.children) {\n\t\treadLayout(child, x, y, rects, sizes);\n\t}\n}\n\nfunction freeYogaTree(mapping: NodeMapping): void {\n\tfor (const child of mapping.children) {\n\t\tfreeYogaTree(child);\n\t}\n\tmapping.yogaNode.free();\n}\n\n// ── Public API ────────────────────────────────────────────────────────\n\n/** Deterministic layout (synchronous): document + viewport (+ measure) → rects. */\nexport function computeLayoutSync(\n\tyoga: Yoga,\n\tinput: LayoutInput,\n): LayoutResult {\n\tconst { layout, viewport, measure } = input;\n\n\tconst rects: Record<string, Rect> = {};\n\tconst sizesMap: Record<string, { width: number; height: number }> = {};\n\n\tfor (const root of layout) {\n\t\t// Create a wrapper root node at the viewport dimensions so that\n\t\t// \"fill\" on root nodes resolves to the viewport size.\n\t\tconst wrapperNode = yoga.Node.create();\n\t\twrapperNode.setWidth(viewport.width);\n\t\twrapperNode.setHeight(viewport.height);\n\t\twrapperNode.setFlexDirection(yoga.FLEX_DIRECTION_COLUMN);\n\n\t\tconst mapping = buildYogaNode(\n\t\t\tyoga,\n\t\t\troot,\n\t\t\t{ width: viewport.width, height: viewport.height },\n\t\t\tmeasure,\n\t\t\tnull,\n\t\t);\n\t\twrapperNode.insertChild(mapping.yogaNode, 0);\n\n\t\twrapperNode.calculateLayout(viewport.width, viewport.height);\n\n\t\tconst rootLayout = mapping.yogaNode.getComputedLayout();\n\t\tconst isRootAbsolute =\n\t\t\t(root as LaidOutNode).position === \"absolute\" ||\n\t\t\t((root as LaidOutNode).position === undefined &&\n\t\t\t\t(root.x !== undefined || root.y !== undefined));\n\t\tconst rootX = isRootAbsolute ? rootLayout.left : Number(root.x ?? 0);\n\t\tconst rootY = isRootAbsolute ? rootLayout.top : Number(root.y ?? 0);\n\n\t\trects[root.id] = {\n\t\t\tx: Math.round(rootX * 1000) / 1000,\n\t\t\ty: Math.round(rootY * 1000) / 1000,\n\t\t\twidth: Math.round(rootLayout.width * 1000) / 1000,\n\t\t\theight: Math.round(rootLayout.height * 1000) / 1000,\n\t\t};\n\t\tsizesMap[root.id] = {\n\t\t\twidth: Math.round(rootLayout.width * 1000) / 1000,\n\t\t\theight: Math.round(rootLayout.height * 1000) / 1000,\n\t\t};\n\n\t\tfor (const child of mapping.children) {\n\t\t\treadLayout(child, rootX, rootY, rects, sizesMap);\n\t\t}\n\n\t\t// Clean up Yoga nodes\n\t\tfreeYogaTree(mapping);\n\t\twrapperNode.free();\n\t}\n\n\treturn { rects, sizes: sizesMap };\n}\n\n/** Deterministic layout: document + viewport (+ measure) → rects. */\nexport async function computeLayout(input: LayoutInput): Promise<LayoutResult> {\n\tconst yoga = await initLayout();\n\treturn computeLayoutSync(yoga, input);\n}\n","/**\n * Inline signal objects on animation tracks.\n *\n * `LayerAnimation.signal(prop, Signal.fromArray(...))` binds a track to a\n * signal object instead of a name registered with `comp.addSignal`. The spec\n * stays plain data: the track's `inputHandleId` gets a generated name and the\n * object rides on the source under a non-enumerable symbol (invisible to JSON,\n * zod and hashing). `compositorToProgram` walks the layout and folds those\n * objects into the program's `signals` map under their generated names, so\n * every evaluator (which only looks signals up by name) sees them.\n */\n\nconst INLINE_SIGNAL = Symbol.for(\"framefields.inlineSignal\");\n\nconst handleIds = new WeakMap<object, string>();\nlet nextHandle = 0;\n\n/**\n * The generated handle id for a signal object. The same object always gets\n * the same id, so reusing one signal across tracks registers it once.\n */\nfunction inlineSignalHandleId(signal: object): string {\n\tlet id = handleIds.get(signal);\n\tif (id === undefined) {\n\t\tid = `inline_signal_${nextHandle++}`;\n\t\thandleIds.set(signal, id);\n\t}\n\treturn id;\n}\n\n/**\n * Resolves the `signalOrHandleId` argument of `LayerAnimation.signal` /\n * `colorSignal` to a handle id, plus the signal object to carry inline (when\n * it is not a registered name).\n */\nexport function resolveSignalArg(signalOrHandleId: unknown): {\n\thandleId: string;\n\tinline?: object;\n} {\n\tif (typeof signalOrHandleId === \"string\") {\n\t\treturn { handleId: signalOrHandleId };\n\t}\n\tif (\n\t\tsignalOrHandleId === null ||\n\t\t(typeof signalOrHandleId !== \"object\" &&\n\t\t\ttypeof signalOrHandleId !== \"function\")\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`LayerAnimation.signal: expected a signal object or a signal name, got ${String(signalOrHandleId)}. ` +\n\t\t\t\t`Pass a signal (Signal.fromArray / Signal.builder / an audio channel …) or register it with comp.addSignal(name, signal) and pass the name.`,\n\t\t);\n\t}\n\tconst obj = signalOrHandleId as {\n\t\tinputHandleId?: unknown;\n\t\tgpuBinding?: { nodeId?: unknown };\n\t\tget?: unknown;\n\t};\n\t// Graph source descriptors (audio extractors …) are resolved by their own\n\t// handle at render time.\n\tif (typeof obj.inputHandleId === \"string\") {\n\t\treturn { handleId: obj.inputHandleId };\n\t}\n\t// GPU-bound signals keep their node id as the handle; their CPU `get()`\n\t// still rides inline, so the track animates even when nothing registers\n\t// that node id (an explicit registration under the same id wins).\n\tif (typeof obj.gpuBinding?.nodeId === \"string\") {\n\t\treturn typeof obj.get === \"function\"\n\t\t\t? { handleId: obj.gpuBinding.nodeId, inline: signalOrHandleId }\n\t\t\t: { handleId: obj.gpuBinding.nodeId };\n\t}\n\treturn {\n\t\thandleId: inlineSignalHandleId(signalOrHandleId),\n\t\tinline: signalOrHandleId,\n\t};\n}\n\n/** Attaches an inline signal object to a track source without making it enumerable. */\nexport function attachInlineSignal(source: object, signal: object): void {\n\tObject.defineProperty(source, INLINE_SIGNAL, {\n\t\tvalue: signal,\n\t\tenumerable: false,\n\t\tconfigurable: true,\n\t\twritable: true,\n\t});\n}\n\n/** The inline signal object carried by a track source, if any. */\nexport function getInlineSignal(source: unknown): object | undefined {\n\tif (!source || typeof source !== \"object\") return undefined;\n\treturn (source as { [INLINE_SIGNAL]?: object })[INLINE_SIGNAL];\n}\n\n/**\n * Collects every inline signal object under `nodes` (animation tracks of each\n * node, recursing into `children`) keyed by its generated handle id.\n */\nexport function collectInlineSignals(\n\tnodes: readonly unknown[],\n\tout: Record<string, unknown> = {},\n): Record<string, unknown> {\n\tfor (const node of nodes) {\n\t\tif (!node || typeof node !== \"object\") continue;\n\t\tconst { animation, children } = node as {\n\t\t\tanimation?: { tracks?: unknown };\n\t\t\tchildren?: unknown;\n\t\t};\n\t\tconst tracks = animation?.tracks;\n\t\tif (Array.isArray(tracks)) {\n\t\t\tfor (const track of tracks) {\n\t\t\t\tconst source = (track as { source?: { inputHandleId?: unknown } })\n\t\t\t\t\t?.source;\n\t\t\t\tconst signal = getInlineSignal(source);\n\t\t\t\tif (signal && typeof source?.inputHandleId === \"string\") {\n\t\t\t\t\tout[source.inputHandleId] = signal;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(children)) collectInlineSignals(children, out);\n\t}\n\treturn out;\n}\n","import { attachInlineSignal, resolveSignalArg } from \"./inline-signals.js\";\nimport type {\n\tAnimatableProp,\n\tAnimationTrack,\n\tEaseRef,\n\tLayerAnimationSpec,\n\tTrackSource,\n} from \"./schema.js\";\n\n/**\n * One keyframe as a tuple: `[frame, value]` or `[frame, value, ease]`. The\n * ease shapes the motion arriving at this keyframe from the one before.\n */\nexport type KeyframeTuple = readonly [\n\tframe: number,\n\tvalue: number | string | boolean,\n\tease?: string | EaseRef,\n];\n\nexport interface FromToOptions {\n\tfrom?: number;\n\tto?: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tdurationFrames?: number;\n\tease?: string | EaseRef;\n}\n\nexport interface Tilt3DOptions {\n\tfrom?: {\n\t\trotateX?: number;\n\t\trotateY?: number;\n\t\trotateZ?: number;\n\t\ttranslateZ?: number;\n\t\tperspective?: number;\n\t};\n\tto: {\n\t\trotateX?: number;\n\t\trotateY?: number;\n\t\trotateZ?: number;\n\t\ttranslateZ?: number;\n\t\tperspective?: number;\n\t};\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tease?: string | EaseRef;\n}\n\nexport interface SignalTrackOptions {\n\tmultiplier?: number;\n\toffset?: number;\n\tsmoothing?: number;\n\tchannel?: string;\n\tmode?: \"continuous\" | \"accumulate\";\n\tthreshold?: number;\n\tdebounceFrames?: number;\n}\n\nexport interface ColorSignalOptions {\n\tcolorA: string;\n\tcolorB: string;\n\tcolorMode?: \"interpolate\" | \"hueRotate\" | \"threshold\";\n\tthreshold?: number;\n\tsmoothing?: number;\n}\n\nexport interface WiggleOptions {\n\tfrequency?: number;\n\tamplitude?: number;\n\toctaves?: number;\n\tseed?: number;\n}\n\nexport interface SpringOptions {\n\tdamping?: number;\n\tstiffness?: number;\n\tmass?: number;\n}\n\nexport interface PathLike3D {\n\tgetPointAt(u: number): {\n\t\tposition: [number, number, number];\n\t\ttangent?: [number, number, number];\n\t};\n\tgetFrameAt?(u: number): {\n\t\tposition: [number, number, number];\n\t\ttangent: [number, number, number];\n\t\tnormal?: [number, number, number];\n\t\tbinormal?: [number, number, number];\n\t\trotation?: [number, number, number];\n\t};\n\ttotalLength?: number;\n}\n\nexport interface FollowPathOptions {\n\tfromDistance?: number;\n\ttoDistance?: number;\n\tfromProgress?: number;\n\ttoProgress?: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tautoOrient?: boolean;\n\tbanking?: number;\n\tpitchOffset?: number;\n\tyawOffset?: number;\n\trollOffset?: number;\n\tsamples?: number;\n\tease?: string | EaseRef;\n}\n\nexport interface CameraFollowPathOptions {\n\tfromProgress?: number;\n\ttoProgress?: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tmode?: \"orientAlongPath\" | \"lookAtTarget\" | \"leadTarget\";\n\ttarget?: [number, number, number];\n\tlookAhead?: number;\n\tsamples?: number;\n\tease?: string | EaseRef;\n}\n\nfunction evaluateEasingProgress(\n\tease: string | EaseRef | undefined,\n\tt: number,\n): number {\n\tif (!ease) return t;\n\tconst ref = parseEase(ease);\n\tif (!ref || ref.name === \"none\") return t;\n\n\tconst { name, dir, params } = ref;\n\tconst s = Math.max(0, Math.min(1, t));\n\n\tconst applyDir = (fn: (x: number) => number): number => {\n\t\tif (dir === \"in\") return fn(s);\n\t\tif (dir === \"out\") return 1 - fn(1 - s);\n\t\treturn s < 0.5 ? fn(s * 2) / 2 : 1 - fn((1 - s) * 2) / 2;\n\t};\n\n\tswitch (name) {\n\t\tcase \"power1\":\n\t\t\treturn applyDir((x) => x * x);\n\t\tcase \"power2\":\n\t\t\treturn applyDir((x) => x * x * x);\n\t\tcase \"power3\":\n\t\t\treturn applyDir((x) => x * x * x * x);\n\t\tcase \"sine\":\n\t\t\treturn applyDir((x) => 1 - Math.cos((x * Math.PI) / 2));\n\t\tcase \"circ\":\n\t\t\treturn applyDir((x) => 1 - Math.sqrt(Math.max(0, 1 - x * x)));\n\t\tcase \"expo\":\n\t\t\treturn applyDir((x) => (x === 0 ? 0 : 2 ** (10 * (x - 1))));\n\t\tcase \"back\": {\n\t\t\tconst c1 = params?.[0] ?? 1.70158;\n\t\t\tconst c3 = c1 + 1;\n\t\t\treturn applyDir((x) => c3 * x * x * x - c1 * x * x);\n\t\t}\n\t\tcase \"bounce\": {\n\t\t\tconst bounceOut = (x: number): number => {\n\t\t\t\tconst n1 = 7.5625;\n\t\t\t\tconst d1 = 2.75;\n\t\t\t\tif (x < 1 / d1) return n1 * x * x;\n\t\t\t\tif (x < 2 / d1) {\n\t\t\t\t\tconst x2 = x - 1.5 / d1;\n\t\t\t\t\treturn n1 * x2 * x2 + 0.75;\n\t\t\t\t}\n\t\t\t\tif (x < 2.5 / d1) {\n\t\t\t\t\tconst x2 = x - 2.25 / d1;\n\t\t\t\t\treturn n1 * x2 * x2 + 0.9375;\n\t\t\t\t}\n\t\t\t\tconst x2 = x - 2.625 / d1;\n\t\t\t\treturn n1 * x2 * x2 + 0.984375;\n\t\t\t};\n\t\t\tif (dir === \"out\") return bounceOut(s);\n\t\t\tif (dir === \"in\") return 1 - bounceOut(1 - s);\n\t\t\treturn s < 0.5\n\t\t\t\t? (1 - bounceOut(1 - 2 * s)) / 2\n\t\t\t\t: (1 + bounceOut(2 * s - 1)) / 2;\n\t\t}\n\t\tdefault:\n\t\t\treturn s;\n\t}\n}\n\nfunction parseEase(ease?: string | EaseRef): EaseRef | undefined {\n\tif (!ease) return undefined;\n\tif (typeof ease === \"object\" && \"name\" in ease && \"dir\" in ease) return ease;\n\tif (typeof ease === \"string\") {\n\t\tconst trimmed = ease.trim();\n\t\tconst match = trimmed.match(\n\t\t\t/^([a-zA-Z0-9]+)(?:\\.([a-zA-Z]+))?(?:\\(([^)]+)\\))?$/,\n\t\t);\n\t\tif (match) {\n\t\t\tconst rawName = match[1].toLowerCase();\n\t\t\tconst name = (rawName === \"linear\" ? \"none\" : rawName) as EaseRef[\"name\"];\n\t\t\tconst rawDir = (match[2] || \"out\").toLowerCase();\n\t\t\tlet dir: EaseRef[\"dir\"] = \"out\";\n\t\t\tif (rawDir === \"in\") dir = \"in\";\n\t\t\telse if (rawDir === \"out\") dir = \"out\";\n\t\t\telse if (rawDir === \"inout\") dir = \"inOut\";\n\n\t\t\tlet params: number[] | undefined;\n\t\t\tif (match[3]) {\n\t\t\t\tparams = match[3]\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.map((s) => Number.parseFloat(s.trim()))\n\t\t\t\t\t.filter((n) => !Number.isNaN(n));\n\t\t\t}\n\t\t\treturn { name, dir, ...(params && params.length > 0 ? { params } : {}) };\n\t\t}\n\t\tconst dotIdx = trimmed.indexOf(\".\");\n\t\tif (dotIdx === -1) {\n\t\t\tconst raw = trimmed.toLowerCase();\n\t\t\tconst name = (raw === \"linear\" ? \"none\" : raw) as EaseRef[\"name\"];\n\t\t\treturn { name, dir: \"out\" };\n\t\t}\n\t\tconst rawName = trimmed.slice(0, dotIdx).toLowerCase();\n\t\tconst name = (rawName === \"linear\" ? \"none\" : rawName) as EaseRef[\"name\"];\n\t\tconst rawDir = trimmed.slice(dotIdx + 1).toLowerCase();\n\t\tlet dir: EaseRef[\"dir\"] = \"out\";\n\t\tif (rawDir === \"in\") dir = \"in\";\n\t\telse if (rawDir === \"out\") dir = \"out\";\n\t\telse if (rawDir === \"inout\") dir = \"inOut\";\n\t\treturn { name, dir };\n\t}\n\treturn undefined;\n}\n\n/**\n * Fluent builder and runtime representation for layer animations.\n * Supports chainable keyframes, reactive signal binding, Perlin wiggles, and springs.\n */\nexport class LayerAnimation implements LayerAnimationSpec {\n\tpublic tracks: AnimationTrack[] = [];\n\n\tconstructor(tracks: AnimationTrack[] = []) {\n\t\tthis.tracks = [...tracks];\n\t}\n\n\tpublic static create(): LayerAnimation {\n\t\treturn new LayerAnimation();\n\t}\n\n\tpublic static fromTo(\n\t\tprop: AnimatableProp,\n\t\tfromValue: number | string | boolean,\n\t\ttoValue: number | string | boolean,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(prop, fromValue, toValue, options);\n\t}\n\n\t/** A track from a list of `[frame, value, ease?]` keyframes; see {@link LayerAnimation.keys}. */\n\tpublic static keys(\n\t\tprop: AnimatableProp,\n\t\tkeyframes: readonly KeyframeTuple[],\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().keys(prop, keyframes);\n\t}\n\n\tpublic static signal(\n\t\tprop: AnimatableProp,\n\t\tsignalOrHandleId: unknown,\n\t\toptions: SignalTrackOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().signal(prop, signalOrHandleId, options);\n\t}\n\n\tpublic static colorSignal(\n\t\tprop: AnimatableProp,\n\t\tsignalOrHandleId: unknown,\n\t\toptions: ColorSignalOptions,\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().colorSignal(prop, signalOrHandleId, options);\n\t}\n\n\tpublic static kineticSweep(\n\t\tfromOffset = -1,\n\t\ttoOffset = 1,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().kineticSweep(\n\t\t\tfromOffset,\n\t\t\ttoOffset,\n\t\t\tstartFrame,\n\t\t\tendFrame,\n\t\t\tease,\n\t\t);\n\t}\n\n\tpublic static typewriter(\n\t\tstartFrame = 0,\n\t\tendFrame = 30,\n\t\tease: string | EaseRef = \"linear\",\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().typewriter(startFrame, endFrame, ease);\n\t}\n\n\tpublic static letterSpacing(\n\t\tfromSpacing: number,\n\t\ttoSpacing: number,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().letterSpacing(\n\t\t\tfromSpacing,\n\t\t\ttoSpacing,\n\t\t\tstartFrame,\n\t\t\tendFrame,\n\t\t\tease,\n\t\t);\n\t}\n\n\tpublic static wiggle(\n\t\tprop: AnimatableProp,\n\t\toptions: WiggleOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().wiggle(prop, options);\n\t}\n\n\tpublic static spring(\n\t\tprop: AnimatableProp,\n\t\toptions: SpringOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().spring(prop, options);\n\t}\n\n\tpublic static firstMargin(\n\t\tfromMargin: number,\n\t\ttoMargin: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().firstMargin(fromMargin, toMargin, options);\n\t}\n\n\tpublic static strokeWidth(\n\t\tfromWidth: number,\n\t\ttoWidth: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(\n\t\t\t\"strokeWidth\",\n\t\t\tfromWidth,\n\t\t\ttoWidth,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic static rotateX(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(\"rotateX\", fromAngle, toAngle, options);\n\t}\n\n\tpublic static rotateY(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(\"rotateY\", fromAngle, toAngle, options);\n\t}\n\n\tpublic static rotateZ(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(\"rotateZ\", fromAngle, toAngle, options);\n\t}\n\n\tpublic static rotation(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): LayerAnimation {\n\t\treturn new LayerAnimation().fromTo(\"rotation\", fromAngle, toAngle, options);\n\t}\n\n\tpublic addTrack(track: AnimationTrack): this {\n\t\tthis.tracks.push(track);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a keyframed track animating from fromValue to toValue.\n\t */\n\tpublic fromTo(\n\t\tprop: AnimatableProp,\n\t\tfromValue: number | string | boolean,\n\t\ttoValue: number | string | boolean,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\tconst start = options.from ?? options.start ?? options.fromFrame ?? 0;\n\t\tconst end =\n\t\t\toptions.to ??\n\t\t\toptions.end ??\n\t\t\toptions.toFrame ??\n\t\t\t(options.durationFrames !== undefined\n\t\t\t\t? start + options.durationFrames\n\t\t\t\t: start + 24);\n\t\tconst ease = parseEase(options.ease);\n\n\t\tlet track = this.tracks.find(\n\t\t\t(t) => t.prop === prop && (!t.source || t.source.type === \"keyframe\"),\n\t\t);\n\t\tif (!track) {\n\t\t\ttrack = {\n\t\t\t\tid: `${prop}_fromTo_${this.tracks.length}`,\n\t\t\t\tprop,\n\t\t\t\tkeyframes: [],\n\t\t\t};\n\t\t\tthis.tracks.push(track);\n\t\t}\n\n\t\tconst id = track.id;\n\n\t\t// If this is the initial keyframe on the track and start > 0, hold fromValue from frame 0\n\t\t// so that the layer does not flash its un-animated base value before the animation starts.\n\t\tif (track.keyframes.length === 0 && start > 0) {\n\t\t\ttrack.keyframes.push({\n\t\t\t\tid: `${id}_k0`,\n\t\t\t\tframe: 0,\n\t\t\t\tvalue: fromValue,\n\t\t\t});\n\t\t}\n\n\t\t// Anchor the start of this transition\n\t\tif (\n\t\t\ttrack.keyframes.length === 0 ||\n\t\t\ttrack.keyframes[track.keyframes.length - 1].frame < start\n\t\t) {\n\t\t\ttrack.keyframes.push({\n\t\t\t\tid: `${id}_k_${start}`,\n\t\t\t\tframe: start,\n\t\t\t\tvalue: fromValue,\n\t\t\t});\n\t\t}\n\n\t\t// Destination keyframe at end with easing\n\t\ttrack.keyframes.push({\n\t\t\tid: `${id}_k_${end}`,\n\t\t\tframe: end,\n\t\t\tvalue: toValue,\n\t\t\t...(ease && { ease }),\n\t\t});\n\n\t\ttrack.keyframes.sort((a, b) => a.frame - b.frame);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Appends a keyframe to an existing track for prop, or creates a new track.\n\t */\n\tpublic keyframe(\n\t\tprop: AnimatableProp,\n\t\tframe: number,\n\t\tvalue: number | string | boolean,\n\t\tease?: string | EaseRef,\n\t): this {\n\t\tlet track = this.tracks.find(\n\t\t\t(t) => t.prop === prop && (!t.source || t.source.type === \"keyframe\"),\n\t\t);\n\t\tif (!track) {\n\t\t\ttrack = {\n\t\t\t\tid: `${prop}_track_${this.tracks.length}`,\n\t\t\t\tprop,\n\t\t\t\tkeyframes: [],\n\t\t\t};\n\t\t\tthis.tracks.push(track);\n\t\t}\n\n\t\tconst parsedEase = parseEase(ease);\n\t\ttrack.keyframes.push({\n\t\t\tid: `k_${track.keyframes.length}_f${frame}`,\n\t\t\tframe,\n\t\t\tvalue,\n\t\t\t...(parsedEase && { ease: parsedEase }),\n\t\t});\n\n\t\ttrack.keyframes.sort((a, b) => a.frame - b.frame);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds several keyframes to prop's track at once:\n\t * `.keys(\"scale\", [[0, 0], [12, 1.1, \"back.out\"], [20, 1]])`.\n\t * Frames are rounded to whole frames, so beat math can be passed straight in.\n\t */\n\tpublic keys(prop: AnimatableProp, keyframes: readonly KeyframeTuple[]): this {\n\t\tfor (const [frame, value, ease] of keyframes) {\n\t\t\tthis.keyframe(prop, Math.round(frame), value, ease);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Animates opacity from 0 to 1 between startFrame and endFrame.\n\t */\n\tpublic fadeIn(\n\t\tstartFrame = 0,\n\t\tendFrame = 20,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): this {\n\t\treturn this.fromTo(\"opacity\", 0, 1, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Animates opacity from 1 to 0 between startFrame and endFrame.\n\t */\n\tpublic fadeOut(\n\t\tstartFrame: number,\n\t\tendFrame: number,\n\t\tease: string | EaseRef = \"power2.in\",\n\t): this {\n\t\treturn this.fromTo(\"opacity\", 1, 0, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Slides in Y coordinate from fromY to toY.\n\t */\n\tpublic slideInY(\n\t\tfromY: number,\n\t\ttoY: number,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): this {\n\t\treturn this.fromTo(\"y\", fromY, toY, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Slides in X coordinate from fromX to toX.\n\t */\n\tpublic slideInX(\n\t\tfromX: number,\n\t\ttoX: number,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): this {\n\t\treturn this.fromTo(\"x\", fromX, toX, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Sweeps kinetic typography animator offset from fromOffset to toOffset.\n\t * Cascades per-glyph or per-word transforms across the text.\n\t */\n\tpublic kineticSweep(\n\t\tfromOffset = -1,\n\t\ttoOffset = 1,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): this {\n\t\treturn this.fromTo(\"offset\", fromOffset, toOffset, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Progressive character write-on / typewriter text reveal.\n\t */\n\tpublic typewriter(\n\t\tstartFrame = 0,\n\t\tendFrame = 30,\n\t\tease: string | EaseRef = \"linear\",\n\t): this {\n\t\treturn this.fromTo(\"text\", 0, 1, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Animates letter-spacing (tracking expansion or compression).\n\t */\n\tpublic letterSpacing(\n\t\tfromSpacing: number,\n\t\ttoSpacing: number,\n\t\tstartFrame = 0,\n\t\tendFrame = 24,\n\t\tease: string | EaseRef = \"power2.out\",\n\t): this {\n\t\treturn this.fromTo(\"letterSpacing\", fromSpacing, toSpacing, {\n\t\t\tfrom: startFrame,\n\t\t\tto: endFrame,\n\t\t\tease,\n\t\t});\n\t}\n\n\t/**\n\t * Animates text position along a path via First Margin.\n\t */\n\tpublic firstMargin(\n\t\tfromMargin: number,\n\t\ttoMargin: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"firstMargin\", fromMargin, toMargin, options);\n\t}\n\n\t/**\n\t * Animates Last Margin spatial limit along a path.\n\t */\n\tpublic lastMargin(\n\t\tfromMargin: number,\n\t\ttoMargin: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"lastMargin\", fromMargin, toMargin, options);\n\t}\n\n\t/**\n\t * Animates baseline shift perpendicular to curve tangent.\n\t */\n\tpublic baselineShift(\n\t\tfromShift: number,\n\t\ttoShift: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"baselineShift\", fromShift, toShift, options);\n\t}\n\n\t/**\n\t * Animate rotateX from fromAngle to toAngle.\n\t */\n\tpublic rotateX(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"rotateX\", fromAngle, toAngle, options);\n\t}\n\n\t/**\n\t * Animate rotateY from fromAngle to toAngle.\n\t */\n\tpublic rotateY(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"rotateY\", fromAngle, toAngle, options);\n\t}\n\n\t/**\n\t * Animate rotateZ from fromAngle to toAngle.\n\t */\n\tpublic rotateZ(\n\t\tfromAngle: number,\n\t\ttoAngle: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"rotateZ\", fromAngle, toAngle, options);\n\t}\n\n\t/**\n\t * Animate perspective camera distance in pixels.\n\t */\n\tpublic perspective(\n\t\tfromDist: number,\n\t\ttoDist: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"perspective\", fromDist, toDist, options);\n\t}\n\n\t/**\n\t * Animate depth translation (translateZ) in pixels.\n\t */\n\tpublic translateZ(\n\t\tfromZ: number,\n\t\ttoZ: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"translateZ\", fromZ, toZ, options);\n\t}\n\n\t/**\n\t * Composite helper to tilt a container across multiple 3D axes simultaneously.\n\t */\n\tpublic tilt3D(options: Tilt3DOptions): this {\n\t\tconst start = options.start ?? options.fromFrame;\n\t\tconst end = options.end ?? options.toFrame;\n\t\tconst ease = options.ease;\n\t\tconst from = options.from ?? {};\n\t\tconst to = options.to;\n\n\t\tconst props = [\n\t\t\t\"rotateX\",\n\t\t\t\"rotateY\",\n\t\t\t\"rotateZ\",\n\t\t\t\"translateZ\",\n\t\t\t\"perspective\",\n\t\t] as const;\n\n\t\tfor (const prop of props) {\n\t\t\tconst toVal = to[prop];\n\t\t\tif (toVal !== undefined) {\n\t\t\t\tconst fromVal = from[prop] ?? 0;\n\t\t\t\tthis.fromTo(prop, fromVal, toVal, {\n\t\t\t\t\tfrom: start,\n\t\t\t\t\tto: end,\n\t\t\t\t\tfromFrame: start,\n\t\t\t\t\ttoFrame: end,\n\t\t\t\t\tease,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Binds an animatable property to a reactive continuous Signal (e.g. LFO, speech energy, audio pitch).\n\t *\n\t * `signalOrHandleId` is either a signal object (`Signal.fromArray`,\n\t * `Signal.builder`, an audio channel …) — carried on the track and\n\t * registered with the program automatically — or the name of a signal\n\t * registered with `comp.addSignal(name, signal)`.\n\t */\n\tpublic signal(\n\t\tprop: AnimatableProp,\n\t\tsignalOrHandleId: unknown,\n\t\toptions: SignalTrackOptions = {},\n\t): this {\n\t\tconst { handleId, inline } = resolveSignalArg(signalOrHandleId);\n\t\tconst id = `${prop}_sig_${handleId}_${this.tracks.length}`;\n\n\t\tconst source: TrackSource = {\n\t\t\ttype: \"signal\",\n\t\t\tinputHandleId: handleId,\n\t\t\tmultiplier: options.multiplier ?? 1.0,\n\t\t\toffset: options.offset ?? 0.0,\n\t\t\tsmoothingWindowFrames: options.smoothing ?? 0,\n\t\t\tsignalMode: options.mode ?? \"continuous\",\n\t\t\tthreshold: options.threshold ?? 0.15,\n\t\t\taccumulateThreshold: options.threshold ?? 0.15,\n\t\t\tdebounceFrames: options.debounceFrames ?? 2,\n\t\t\tchannel: options.channel ?? \"primary\",\n\t\t};\n\t\tif (inline) attachInlineSignal(source, inline);\n\n\t\tthis.tracks.push({\n\t\t\tid,\n\t\t\tprop,\n\t\t\tsource,\n\t\t\tkeyframes: [],\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Modulates color interpolation based on an active signal (object or\n\t * registered name, as in {@link LayerAnimation.signal}).\n\t */\n\tpublic colorSignal(\n\t\tprop: AnimatableProp,\n\t\tsignalOrHandleId: unknown,\n\t\toptions: ColorSignalOptions,\n\t): this {\n\t\tconst { handleId, inline } = resolveSignalArg(signalOrHandleId);\n\t\tconst id = `${prop}_colorSig_${handleId}_${this.tracks.length}`;\n\n\t\tconst source: TrackSource = {\n\t\t\ttype: \"signal\",\n\t\t\tinputHandleId: handleId,\n\t\t\tmultiplier: 1.0,\n\t\t\toffset: 0.0,\n\t\t\tsmoothingWindowFrames: options.smoothing ?? 0,\n\t\t\tcolorMode: options.colorMode ?? \"interpolate\",\n\t\t\tcolorA: options.colorA,\n\t\t\tcolorB: options.colorB,\n\t\t\tcolorThreshold: options.threshold,\n\t\t\tchannel: \"primary\",\n\t\t};\n\t\tif (inline) attachInlineSignal(source, inline);\n\n\t\tthis.tracks.push({\n\t\t\tid,\n\t\t\tprop,\n\t\t\tsource,\n\t\t\tkeyframes: [],\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds organic Perlin noise wiggling to a property.\n\t */\n\tpublic wiggle(prop: AnimatableProp, options: WiggleOptions = {}): this {\n\t\tconst id = `${prop}_wiggle_${this.tracks.length}`;\n\t\tconst source: TrackSource = {\n\t\t\ttype: \"wiggle\",\n\t\t\tfrequency: options.frequency ?? 2.0,\n\t\t\tamplitude: options.amplitude ?? 20.0,\n\t\t\toctaves: options.octaves ?? 1,\n\t\t\tseed: options.seed ?? 1234,\n\t\t};\n\n\t\tthis.tracks.push({\n\t\t\tid,\n\t\t\tprop,\n\t\t\tsource,\n\t\t\tkeyframes: [],\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds physical harmonic spring overshoot behavior to a property transition.\n\t */\n\tpublic spring(prop: AnimatableProp, options: SpringOptions = {}): this {\n\t\tconst id = `${prop}_spring_${this.tracks.length}`;\n\t\tconst source: TrackSource = {\n\t\t\ttype: \"springOvershoot\",\n\t\t\tdamping: options.damping ?? 12,\n\t\t\tstiffness: options.stiffness ?? 180,\n\t\t\tmass: options.mass ?? 1,\n\t\t};\n\n\t\tthis.tracks.push({\n\t\t\tid,\n\t\t\tprop,\n\t\t\tsource,\n\t\t\tkeyframes: [],\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Follows a 2D or 3D path with constant arc-length velocity, automatic orientation,\n\t * banking into turns, and optional easing.\n\t */\n\tpublic followPath(path: PathLike3D, options: FollowPathOptions = {}): this {\n\t\tconst startFrame = options.start ?? options.fromFrame ?? 0;\n\t\tconst endFrame = options.end ?? options.toFrame ?? 60;\n\t\tconst duration = Math.max(1, endFrame - startFrame);\n\t\tconst sampleCount =\n\t\t\toptions.samples ?? Math.max(8, Math.min(60, Math.round(duration / 2)));\n\n\t\tconst totalLen = path.totalLength ?? 1;\n\t\tlet fromProg = options.fromProgress ?? 0;\n\t\tlet toProg = options.toProgress ?? 1;\n\t\tif (options.fromDistance !== undefined && totalLen > 0) {\n\t\t\tfromProg = options.fromDistance / totalLen;\n\t\t}\n\t\tif (options.toDistance !== undefined && totalLen > 0) {\n\t\t\ttoProg = options.toDistance / totalLen;\n\t\t}\n\n\t\tconst autoOrient = options.autoOrient ?? true;\n\t\tconst banking = options.banking ?? 0;\n\t\tconst pitchOffset = options.pitchOffset ?? 0;\n\t\tconst yawOffset = options.yawOffset ?? 0;\n\t\tconst rollOffset = options.rollOffset ?? 0;\n\n\t\tlet hasZ = false;\n\t\tlet hasRx = false;\n\t\tlet hasRy = false;\n\n\t\tconst samples: Array<{\n\t\t\tf: number;\n\t\t\tx: number;\n\t\t\ty: number;\n\t\t\tz: number;\n\t\t\trx: number;\n\t\t\try: number;\n\t\t\trz: number;\n\t\t}> = [];\n\n\t\tfor (let i = 0; i <= sampleCount; i++) {\n\t\t\tconst t = i / sampleCount;\n\t\t\tconst easedT = evaluateEasingProgress(options.ease, t);\n\t\t\tconst u = fromProg + easedT * (toProg - fromProg);\n\t\t\tconst f = Math.round(startFrame + t * duration);\n\n\t\t\tlet pos: [number, number, number] = [0, 0, 0];\n\t\t\tlet tan: [number, number, number] = [1, 0, 0];\n\t\t\tlet rot: [number, number, number] = [0, 0, 0];\n\n\t\t\tif (typeof path.getFrameAt === \"function\") {\n\t\t\t\tconst frameData = path.getFrameAt(u);\n\t\t\t\tpos = frameData.position;\n\t\t\t\ttan = frameData.tangent;\n\t\t\t\trot = frameData.rotation ?? [0, 0, 0];\n\t\t\t} else {\n\t\t\t\tconst pt = path.getPointAt(u);\n\t\t\t\tpos = pt.position;\n\t\t\t\tif (pt.tangent) tan = pt.tangent;\n\t\t\t\tconst pitch =\n\t\t\t\t\tMath.asin(Math.max(-1, Math.min(1, -tan[1]))) * (180 / Math.PI);\n\t\t\t\tconst yaw = Math.atan2(tan[0], tan[2]) * (180 / Math.PI);\n\t\t\t\tconst roll = Math.atan2(tan[1], tan[0]) * (180 / Math.PI);\n\t\t\t\trot = [pitch, yaw, roll];\n\t\t\t}\n\n\t\t\tconst rx = rot[0] + pitchOffset;\n\t\t\tconst ry = rot[1] + yawOffset;\n\t\t\tlet rz =\n\t\t\t\t(Math.abs(tan[2]) < 1e-4\n\t\t\t\t\t? Math.atan2(tan[1], tan[0]) * (180 / Math.PI)\n\t\t\t\t\t: rot[2]) + rollOffset;\n\n\t\t\tif (banking !== 0) {\n\t\t\t\tconst uAhead = Math.min(1, u + 0.02);\n\t\t\t\tconst uBehind = Math.max(0, u - 0.02);\n\t\t\t\tconst ptAhead = path.getPointAt(uAhead);\n\t\t\t\tconst ptBehind = path.getPointAt(uBehind);\n\t\t\t\tconst tAhead = ptAhead.tangent ?? [1, 0, 0];\n\t\t\t\tconst tBehind = ptBehind.tangent ?? [1, 0, 0];\n\t\t\t\tconst yawAhead = Math.atan2(tAhead[0], tAhead[2]);\n\t\t\t\tconst yawBehind = Math.atan2(tBehind[0], tBehind[2]);\n\t\t\t\tconst dYaw = yawAhead - yawBehind;\n\t\t\t\trz -= dYaw * banking * 57.2958;\n\t\t\t}\n\n\t\t\tif (Math.abs(pos[2]) > 1e-4) hasZ = true;\n\t\t\tif (Math.abs(rx) > 1e-4) hasRx = true;\n\t\t\tif (Math.abs(ry) > 1e-4) hasRy = true;\n\n\t\t\tsamples.push({ f, x: pos[0], y: pos[1], z: pos[2], rx, ry, rz });\n\t\t}\n\n\t\tfor (const s of samples) {\n\t\t\tthis.keyframe(\"x\", s.f, s.x);\n\t\t\tthis.keyframe(\"y\", s.f, s.y);\n\t\t\tif (hasZ) {\n\t\t\t\tthis.keyframe(\"z\", s.f, s.z);\n\t\t\t}\n\t\t\tif (autoOrient) {\n\t\t\t\tthis.keyframe(\"rotateZ\", s.f, s.rz);\n\t\t\t\tif (hasRx) this.keyframe(\"rotateX\", s.f, s.rx);\n\t\t\t\tif (hasRy) this.keyframe(\"rotateY\", s.f, s.ry);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Attaches this animation to a target LayoutNode and returns the node.\n\t */\n\tpublic applyTo<T extends { animation?: LayerAnimationSpec }>(node: T): T {\n\t\tnode.animation = this.toSpec();\n\t\treturn node;\n\t}\n\n\t/**\n\t * Returns the validated LayerAnimation specification object.\n\t */\n\tpublic toSpec(): LayerAnimationSpec {\n\t\treturn {\n\t\t\ttracks: this.tracks,\n\t\t};\n\t}\n\n\tpublic toJSON(): LayerAnimationSpec {\n\t\treturn this.toSpec();\n\t}\n}\n\nexport interface DollyOptions {\n\tfromDistance: number;\n\ttoDistance: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tease?: string;\n}\n\nexport interface OrbitOptions {\n\tradius?: { from?: number; to: number };\n\tazimuth?: { from?: number; to: number };\n\televation?: { from?: number; to: number };\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tease?: string;\n}\n\nexport interface RackFocusOptions {\n\tfromDistance: number;\n\ttoDistance: number;\n\tfromFStop?: number;\n\ttoFStop?: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n\tease?: string;\n}\n\nexport interface HandheldOptions {\n\ttranslationAmplitude: number;\n\trotationAmplitude: number;\n\tstart?: number;\n\tend?: number;\n\tfromFrame?: number;\n\ttoFrame?: number;\n}\n\nexport class CameraAnimation extends LayerAnimation {\n\tpublic static camera(): CameraAnimation {\n\t\treturn new CameraAnimation();\n\t}\n\n\tpublic dolly(\n\t\tfromDistanceOrOptions: number | DollyOptions,\n\t\ttoDistance?: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\tif (typeof fromDistanceOrOptions === \"object\") {\n\t\t\tconst opts = fromDistanceOrOptions;\n\t\t\tconst start = opts.start ?? opts.fromFrame ?? 0;\n\t\t\tconst end = opts.end ?? opts.toFrame ?? 0;\n\t\t\treturn this.fromTo(\"cameraZ\", opts.fromDistance, opts.toDistance, {\n\t\t\t\tfrom: start,\n\t\t\t\tto: end,\n\t\t\t\tease: opts.ease,\n\t\t\t});\n\t\t}\n\t\treturn this.fromTo(\n\t\t\t\"cameraZ\",\n\t\t\tfromDistanceOrOptions,\n\t\t\ttoDistance ?? fromDistanceOrOptions,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic orbit(options: OrbitOptions): this {\n\t\tconst start = options.start ?? options.fromFrame ?? 0;\n\t\tconst end = options.end ?? options.toFrame ?? 0;\n\t\tif (options.azimuth) {\n\t\t\tthis.fromTo(\n\t\t\t\t\"orbitAzimuth\",\n\t\t\t\toptions.azimuth.from ?? 0,\n\t\t\t\toptions.azimuth.to,\n\t\t\t\t{\n\t\t\t\t\tfrom: start,\n\t\t\t\t\tto: end,\n\t\t\t\t\tease: options.ease,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tif (options.elevation) {\n\t\t\tthis.fromTo(\n\t\t\t\t\"orbitElevation\",\n\t\t\t\toptions.elevation.from ?? 0,\n\t\t\t\toptions.elevation.to,\n\t\t\t\t{\n\t\t\t\t\tfrom: start,\n\t\t\t\t\tto: end,\n\t\t\t\t\tease: options.ease,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tif (options.radius) {\n\t\t\tthis.fromTo(\n\t\t\t\t\"orbitRadius\",\n\t\t\t\toptions.radius.from ?? 1500,\n\t\t\t\toptions.radius.to,\n\t\t\t\t{\n\t\t\t\t\tfrom: start,\n\t\t\t\t\tto: end,\n\t\t\t\t\tease: options.ease,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic truck(fromX: number, toX: number, options: FromToOptions = {}): this {\n\t\treturn this.fromTo(\"cameraX\", fromX, toX, options);\n\t}\n\n\tpublic pedestal(\n\t\tfromY: number,\n\t\ttoY: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"cameraY\", fromY, toY, options);\n\t}\n\n\tpublic pan(\n\t\tfromAngleDeg: number,\n\t\ttoAngleDeg: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"cameraYaw\", fromAngleDeg, toAngleDeg, options);\n\t}\n\n\tpublic tilt(\n\t\tfromAngleDeg: number,\n\t\ttoAngleDeg: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"cameraPitch\", fromAngleDeg, toAngleDeg, options);\n\t}\n\n\tpublic roll(\n\t\tfromAngleDeg: number,\n\t\ttoAngleDeg: number,\n\t\toptions: FromToOptions = {},\n\t): this {\n\t\treturn this.fromTo(\"cameraRoll\", fromAngleDeg, toAngleDeg, options);\n\t}\n\n\tpublic rackFocus(options: RackFocusOptions): this {\n\t\tconst start = options.start ?? options.fromFrame ?? 0;\n\t\tconst end = options.end ?? options.toFrame ?? 0;\n\t\tthis.fromTo(\"focusDistance\", options.fromDistance, options.toDistance, {\n\t\t\tfrom: start,\n\t\t\tto: end,\n\t\t\tease: options.ease ?? \"power2.inOut\",\n\t\t});\n\t\tif (options.toFStop !== undefined) {\n\t\t\tthis.fromTo(\"fStop\", options.fromFStop ?? 2.8, options.toFStop, {\n\t\t\t\tfrom: start,\n\t\t\t\tto: end,\n\t\t\t\tease: options.ease ?? \"power2.inOut\",\n\t\t\t});\n\t\t}\n\t\treturn this;\n\t}\n\n\tpublic handheld(options: HandheldOptions): this {\n\t\tconst start = options.start ?? options.fromFrame ?? 0;\n\t\tconst end = options.end ?? options.toFrame ?? 0;\n\t\tthis.fromTo(\"shakeTranslation\", 0, options.translationAmplitude, {\n\t\t\tfrom: start,\n\t\t\tto: end,\n\t\t});\n\t\tthis.fromTo(\"shakeRotation\", 0, options.rotationAmplitude, {\n\t\t\tfrom: start,\n\t\t\tto: end,\n\t\t});\n\t\treturn this;\n\t}\n\n\t/**\n\t * Animates camera eye and lookAt target along a 3D path with constant velocity,\n\t * leading target look-ahead, or path tangent orientation.\n\t */\n\tpublic followPath3D(\n\t\tpath: PathLike3D,\n\t\toptions: CameraFollowPathOptions = {},\n\t): this {\n\t\tconst startFrame = options.start ?? options.fromFrame ?? 0;\n\t\tconst endFrame = options.end ?? options.toFrame ?? 60;\n\t\tconst duration = Math.max(1, endFrame - startFrame);\n\t\tconst sampleCount =\n\t\t\toptions.samples ?? Math.max(8, Math.min(60, Math.round(duration / 2)));\n\t\tconst mode =\n\t\t\toptions.mode ?? (options.target ? \"lookAtTarget\" : \"leadTarget\");\n\t\tconst fromProg = options.fromProgress ?? 0;\n\t\tconst toProg = options.toProgress ?? 1;\n\t\tconst lookAhead = options.lookAhead ?? 0.05;\n\n\t\tfor (let i = 0; i <= sampleCount; i++) {\n\t\t\tconst t = i / sampleCount;\n\t\t\tconst easedT = evaluateEasingProgress(options.ease, t);\n\t\t\tconst u = fromProg + easedT * (toProg - fromProg);\n\t\t\tconst f = Math.round(startFrame + t * duration);\n\n\t\t\tlet pos: [number, number, number] = [0, 0, 0];\n\t\t\tlet rot: [number, number, number] = [0, 0, 0];\n\n\t\t\tif (typeof path.getFrameAt === \"function\") {\n\t\t\t\tconst frameData = path.getFrameAt(u);\n\t\t\t\tpos = frameData.position;\n\t\t\t\trot = frameData.rotation ?? [0, 0, 0];\n\t\t\t} else {\n\t\t\t\tconst pt = path.getPointAt(u);\n\t\t\t\tpos = pt.position;\n\t\t\t}\n\n\t\t\tthis.keyframe(\"cameraX\", f, pos[0]);\n\t\t\tthis.keyframe(\"cameraY\", f, pos[1]);\n\t\t\tthis.keyframe(\"cameraZ\", f, pos[2]);\n\n\t\t\tif (mode === \"lookAtTarget\") {\n\t\t\t\tconst tgt = options.target ?? [pos[0], pos[1], 0];\n\t\t\t\tthis.keyframe(\"targetX\", f, tgt[0]);\n\t\t\t\tthis.keyframe(\"targetY\", f, tgt[1]);\n\t\t\t\tthis.keyframe(\"targetZ\", f, tgt[2]);\n\t\t\t} else if (mode === \"leadTarget\") {\n\t\t\t\tconst leadU = Math.min(1, u + lookAhead);\n\t\t\t\tconst leadPt = path.getPointAt(leadU);\n\t\t\t\tthis.keyframe(\"targetX\", f, leadPt.position[0]);\n\t\t\t\tthis.keyframe(\"targetY\", f, leadPt.position[1]);\n\t\t\t\tthis.keyframe(\"targetZ\", f, leadPt.position[2]);\n\t\t\t} else if (mode === \"orientAlongPath\") {\n\t\t\t\tthis.keyframe(\"cameraPitch\", f, rot[0]);\n\t\t\t\tthis.keyframe(\"cameraYaw\", f, rot[1]);\n\t\t\t\tthis.keyframe(\"cameraRoll\", f, rot[2]);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n}\n","import { signalRegistry } from \"@framefields/webgpu-renderers\";\nimport type {\n\tAnimationTrack,\n\tLayerAnimationSpec as LayerAnimation,\n\tTrackSource,\n} from \"./schema.js\";\n\nexport type SignalDataSource = unknown;\n\nexport interface TrackEvaluationContext {\n\t/** Root frame (timeline frame). */\n\trootFrame?: number;\n\t/** Layer start frame offset. */\n\tstartFrame?: number;\n\t/** Base layer property fallback values. */\n\tbaseValues?: Record<string, unknown>;\n\t/** Connected signal providers indexed by inputHandleId. */\n\tsignals?: Record<string, SignalDataSource>;\n}\n\n// ── 1D Coherent Gradient Noise for Wiggle ─────────────────────────────\n\nfunction hash1D(n: number, seed: number): number {\n\tlet x = (Math.floor(n) ^ (seed * 1013)) | 0;\n\tx = Math.imul(x ^ (x >>> 15), x | 1);\n\tx ^= x + Math.imul(x ^ (x >>> 7), x | 61);\n\treturn (((x ^ (x >>> 14)) >>> 0) / 4294967295) * 2 - 1;\n}\n\nfunction smoothNoise1D(x: number, seed: number): number {\n\tconst i0 = Math.floor(x);\n\tconst i1 = i0 + 1;\n\tconst f = x - i0;\n\n\t// Hermite cubic smoothstep\n\tconst u = f * f * (3 - 2 * f);\n\n\tconst g0 = hash1D(i0, seed);\n\tconst g1 = hash1D(i1, seed);\n\n\tconst v0 = g0 * f;\n\tconst v1 = g1 * (f - 1);\n\n\t// Scaled to roughly [-1, 1]\n\treturn (v0 * (1 - u) + v1 * u) * 2;\n}\n\n/**\n * Procedural wiggle generator using multi-octave coherent 1D gradient noise.\n */\nexport function evaluateWiggle(\n\tsource: {\n\t\tfrequency?: number;\n\t\tamplitude?: number;\n\t\toctaves?: number;\n\t\tseed?: number;\n\t},\n\ttSec: number,\n\tbaseValue = 0,\n): number {\n\tconst freq = source.frequency ?? 2.0;\n\tconst amp = source.amplitude ?? 50.0;\n\tconst octaves = Math.max(1, Math.min(4, source.octaves ?? 1));\n\tconst seed = source.seed ?? 1234;\n\n\tlet total = 0;\n\tlet maxAmp = 0;\n\tlet currentAmp = 1.0;\n\tlet currentFreq = freq;\n\n\tfor (let i = 0; i < octaves; i++) {\n\t\tconst noiseVal = smoothNoise1D(tSec * currentFreq, seed + i * 7919);\n\t\ttotal += noiseVal * currentAmp;\n\t\tmaxAmp += currentAmp;\n\t\tcurrentAmp *= 0.5;\n\t\tcurrentFreq *= 2.0;\n\t}\n\n\tconst normalized = maxAmp > 0 ? total / maxAmp : 0;\n\treturn baseValue + normalized * amp;\n}\n\n// ── Spring Overshoot ODE Evaluator ────────────────────────────────────\n\n/**\n * Analytical solution to the second-order damped harmonic oscillator ODE:\n * m*x'' + c*x' + k*x = 0\n */\nexport function evaluateSpringOvershoot(\n\tsource: {\n\t\tdamping?: number;\n\t\tstiffness?: number;\n\t\tmass?: number;\n\t},\n\ttSec: number,\n\tv0: number,\n\tv1: number,\n): number {\n\tif (tSec <= 0) return v0;\n\n\tconst m = Math.max(0.001, source.mass ?? 1);\n\tconst k = Math.max(0.001, source.stiffness ?? 180);\n\tconst c = Math.max(0.001, source.damping ?? 12);\n\n\tconst w0 = Math.sqrt(k / m);\n\tconst zeta = c / (2 * Math.sqrt(k * m));\n\n\tlet progress = 1;\n\n\tif (zeta < 1) {\n\t\t// Underdamped (oscillates and overshoots)\n\t\tconst wd = w0 * Math.sqrt(1 - zeta * zeta);\n\t\tconst A = -1;\n\t\tconst B = (-zeta * w0) / wd;\n\t\tconst x =\n\t\t\tMath.exp(-zeta * w0 * tSec) *\n\t\t\t(A * Math.cos(wd * tSec) + B * Math.sin(wd * tSec));\n\t\tprogress = 1 + x;\n\t} else if (Math.abs(zeta - 1) < 1e-4) {\n\t\t// Critically damped\n\t\tconst x = Math.exp(-w0 * tSec) * (-1 - w0 * tSec);\n\t\tprogress = 1 + x;\n\t} else {\n\t\t// Overdamped\n\t\tconst sq = Math.sqrt(zeta * zeta - 1);\n\t\tconst r1 = -w0 * (zeta - sq);\n\t\tconst r2 = -w0 * (zeta + sq);\n\t\tconst c1 = -1 / (1 - r1 / r2);\n\t\tconst c2 = -1 - c1;\n\t\tprogress = 1 + c1 * Math.exp(r1 * tSec) + c2 * Math.exp(r2 * tSec);\n\t}\n\n\treturn v0 + (v1 - v0) * progress;\n}\n\n// ── Signal Sampler & Filter ───────────────────────────────────────────\n\nfunction extractRawSignalSample(\n\tsignalData: SignalDataSource,\n\tframe: number,\n\tfps: number,\n): number {\n\tif (signalData === null || signalData === undefined) return 0;\n\n\tif (typeof signalData === \"number\") return signalData;\n\n\tif (typeof signalData === \"function\") {\n\t\treturn Number(signalData(frame, fps)) || 0;\n\t}\n\n\t// Array of frame samples (e.g. from FFT analysis buffer or AudioSignalExtractor channel)\n\tif (Array.isArray(signalData) || ArrayBuffer.isView(signalData)) {\n\t\tconst arr = signalData as ArrayLike<number>;\n\t\tif (arr.length === 0) return 0;\n\t\tconst idx = Math.max(0, Math.min(arr.length - 1, Math.round(frame)));\n\t\treturn Number(arr[idx]) || 0;\n\t}\n\n\t// Object with frame-indexed samples or channel streams\n\tif (typeof signalData === \"object\") {\n\t\tconst sd = signalData as Record<string, unknown>;\n\t\tif (typeof sd.get === \"function\") {\n\t\t\treturn (\n\t\t\t\tNumber(\n\t\t\t\t\t(sd.get as (ctx: unknown) => unknown)({\n\t\t\t\t\t\tframe,\n\t\t\t\t\t\tfps,\n\t\t\t\t\t\ttime: fps > 0 ? frame / fps : 0,\n\t\t\t\t\t}),\n\t\t\t\t) || 0\n\t\t\t);\n\t\t}\n\n\t\tif (sd.type === \"Signal\" && sd.data) {\n\t\t\treturn extractRawSignalSample(sd.data as SignalDataSource, frame, fps);\n\t\t}\n\n\t\t// Array of samples inside an object, or audio_extractor descriptor\n\t\tconst rawSamples =\n\t\t\tsd.samples ??\n\t\t\t(typeof sd.channel === \"string\" && sd[sd.channel] !== undefined\n\t\t\t\t? sd[sd.channel]\n\t\t\t\t: undefined);\n\n\t\tif (Array.isArray(rawSamples) || ArrayBuffer.isView(rawSamples)) {\n\t\t\tconst arr = rawSamples as ArrayLike<number>;\n\t\t\tif (arr.length === 0) return 0;\n\t\t\tconst srcFps = Number(sd.fps) || 24;\n\t\t\tconst compFps = fps > 0 ? fps : 24;\n\t\t\tconst t = frame / compFps;\n\t\t\tconst idx = Math.max(0, Math.min(arr.length - 1, Math.round(t * srcFps)));\n\t\t\treturn Number(arr[idx]) || 0;\n\t\t}\n\n\t\tif (sd.type === \"audio_extractor\" || sd.extractionMode !== undefined) {\n\t\t\tconst nodeId = sd.nodeId as string | undefined;\n\t\t\tif (nodeId) {\n\t\t\t\tconst ch = (sd.channel as string) ?? \"primary\";\n\t\t\t\tconst channelSamples = signalRegistry.getChannelSamples(nodeId, ch);\n\t\t\t\tif (channelSamples && channelSamples.length > 0) {\n\t\t\t\t\tconst srcFps = Number(sd.fps) || 24;\n\t\t\t\t\tconst compFps = fps > 0 ? fps : 24;\n\t\t\t\t\tconst t = frame / compFps;\n\t\t\t\t\tconst idx = Math.max(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\tMath.min(channelSamples.length - 1, Math.round(t * srcFps)),\n\t\t\t\t\t);\n\t\t\t\t\treturn Number(channelSamples[idx]) || 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\n\t\t// Generator descriptor (customWGSL, mathematical formula, LFO, etc.)\n\t\tif (sd.type === \"generator\") {\n\t\t\tconst amp = typeof sd.amplitude === \"number\" ? sd.amplitude : 1.0;\n\t\t\tlet freq = typeof sd.frequency === \"number\" ? sd.frequency : 1.0;\n\t\t\tif (sd.syncToBpm && typeof sd.bpm === \"number\" && sd.bpm > 0) {\n\t\t\t\tconst bars = typeof sd.bars === \"number\" && sd.bars > 0 ? sd.bars : 1;\n\t\t\t\tfreq = sd.bpm / 60 / bars;\n\t\t\t}\n\t\t\tconst phase = typeof sd.phase === \"number\" ? sd.phase : 0.0;\n\t\t\tconst offset = typeof sd.offset === \"number\" ? sd.offset : 0.0;\n\t\t\tconst t = frame / (fps > 0 ? fps : 24);\n\t\t\tconst baseType = sd.baseType ?? \"sine\";\n\n\t\t\t// FM modulation support\n\t\t\tconst fmEnabled = Boolean(sd.fmEnabled);\n\t\t\tlet tMod = t;\n\t\t\tif (fmEnabled) {\n\t\t\t\tconst fmAmp = Number(sd.fmAmplitude) || 1.0;\n\t\t\t\tconst fmFreq = Number(sd.fmFrequency) || 0.5;\n\t\t\t\ttMod = t + Math.sin(t * fmFreq * Math.PI * 2) * fmAmp;\n\t\t\t}\n\n\t\t\tlet val = 0;\n\t\t\tconst phaseNorm = (tMod * freq + phase / (Math.PI * 2)) % 1;\n\t\t\tconst normT = phaseNorm < 0 ? phaseNorm + 1 : phaseNorm;\n\t\t\tconst fract = (x: number) => ((x % 1) + 1) % 1;\n\n\t\t\tswitch (baseType) {\n\t\t\t\tcase \"triangle\":\n\t\t\t\t\tval = 4 * Math.abs(normT - 0.5) - 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"sawtooth\":\n\t\t\t\t\tval = 2 * normT - 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"square\":\n\t\t\t\t\tval = normT < 0.5 ? 1 : -1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"constant\":\n\t\t\t\t\tval = 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"noise_smooth\": {\n\t\t\t\t\tconst noiseT = tMod * freq + phase;\n\t\t\t\t\tconst noiseI = Math.floor(noiseT);\n\t\t\t\t\tconst noiseF = noiseT - noiseI;\n\t\t\t\t\tconst noiseU = noiseF * noiseF * (3.0 - 2.0 * noiseF);\n\t\t\t\t\tconst n0 = fract(Math.sin(noiseI * 12.9898) * 43758.5453);\n\t\t\t\t\tconst n1 = fract(Math.sin((noiseI + 1.0) * 12.9898) * 43758.5453);\n\t\t\t\t\tval = (n0 * (1.0 - noiseU) + n1 * noiseU) * 2.0 - 1.0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"noise_white\":\n\t\t\t\t\tval =\n\t\t\t\t\t\tfract(Math.sin(tMod * 12.9898 + phase) * 43758.5453) * 2.0 - 1.0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"pulse\": {\n\t\t\t\t\tconst pulseDuty =\n\t\t\t\t\t\tphase === 0 ? 0.5 : Math.max(0.01, Math.min(0.99, phase));\n\t\t\t\t\tval = fract(tMod * freq) < pulseDuty ? 1.0 : -1.0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"bounce\":\n\t\t\t\t\tval = Math.abs(Math.sin(tMod * freq * Math.PI + phase));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"staircase\":\n\t\t\t\t\tval = (Math.floor(normT * 8.0) / 7.0) * 2.0 - 1.0;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tval = Math.sin(tMod * freq * Math.PI * 2 + phase);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn val * amp + offset;\n\t\t}\n\n\t\t// Signal Gate / Trigger node descriptor\n\t\tif (sd.type === \"gate\") {\n\t\t\tconst source = (sd.sourceSignal ?? sd.signal) as SignalDataSource;\n\t\t\tconst thresh = typeof sd.threshold === \"number\" ? sd.threshold : 0.5;\n\t\t\tconst mode = (sd.mode as string) ?? \"gate\";\n\t\t\tconst invert = Boolean(sd.invert);\n\t\t\tconst debounceMs = typeof sd.debounceMs === \"number\" ? sd.debounceMs : 0;\n\t\t\tconst debounceFrames = Math.max(1, Math.round((debounceMs / 1000) * fps));\n\t\t\tconst holdFrames = Math.max(1, Number(sd.holdFrames) || 4);\n\n\t\t\tlet output = 0.0;\n\t\t\tif (mode === \"gate\") {\n\t\t\t\tconst src = extractRawSignalSample(source, frame, fps);\n\t\t\t\toutput = src >= thresh ? 1.0 : 0.0;\n\t\t\t} else if (mode === \"trigger\") {\n\t\t\t\tlet lastTrigger = -Infinity;\n\t\t\t\tconst startF = Math.max(0, frame - 300);\n\t\t\t\tfor (let f = startF; f <= frame; f++) {\n\t\t\t\t\tconst val = extractRawSignalSample(source, f, fps);\n\t\t\t\t\tconst prev = f > 0 ? extractRawSignalSample(source, f - 1, fps) : 0;\n\t\t\t\t\tif (\n\t\t\t\t\t\tval >= thresh &&\n\t\t\t\t\t\tprev < thresh &&\n\t\t\t\t\t\tf - lastTrigger >= debounceFrames\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastTrigger = f;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toutput =\n\t\t\t\t\tframe >= lastTrigger && frame < lastTrigger + holdFrames ? 1.0 : 0.0;\n\t\t\t} else if (mode === \"toggle\") {\n\t\t\t\tlet toggleCount = 0;\n\t\t\t\tlet lastTrigger = -Infinity;\n\t\t\t\tfor (let f = 0; f <= frame; f++) {\n\t\t\t\t\tconst val = extractRawSignalSample(source, f, fps);\n\t\t\t\t\tconst prev = f > 0 ? extractRawSignalSample(source, f - 1, fps) : 0;\n\t\t\t\t\tif (\n\t\t\t\t\t\tval >= thresh &&\n\t\t\t\t\t\tprev < thresh &&\n\t\t\t\t\t\tf - lastTrigger >= debounceFrames\n\t\t\t\t\t) {\n\t\t\t\t\t\ttoggleCount++;\n\t\t\t\t\t\tlastTrigger = f;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toutput = toggleCount % 2 === 1 ? 1.0 : 0.0;\n\t\t\t}\n\t\t\treturn invert ? 1.0 - output : output;\n\t\t}\n\n\t\t// Signal Math node descriptor\n\t\tif (sd.type === \"signal_math\") {\n\t\t\tconst valA = extractRawSignalSample(\n\t\t\t\tsd.signalA as SignalDataSource,\n\t\t\t\tframe,\n\t\t\t\tfps,\n\t\t\t);\n\t\t\tconst hasB = sd.signalB !== undefined;\n\t\t\tconst valB = hasB\n\t\t\t\t? extractRawSignalSample(sd.signalB as SignalDataSource, frame, fps)\n\t\t\t\t: Number(sd.bValue) || 0.0;\n\n\t\t\tswitch (sd.operation) {\n\t\t\t\tcase \"add\":\n\t\t\t\t\treturn valA + valB;\n\t\t\t\tcase \"subtract\":\n\t\t\t\t\treturn valA - valB;\n\t\t\t\tcase \"multiply\":\n\t\t\t\t\treturn valA * valB;\n\t\t\t\tcase \"divide\":\n\t\t\t\t\treturn valB !== 0 ? valA / valB : 0;\n\t\t\t\tcase \"min\":\n\t\t\t\t\treturn Math.min(valA, valB);\n\t\t\t\tcase \"max\":\n\t\t\t\t\treturn Math.max(valA, valB);\n\t\t\t\tcase \"clamp\": {\n\t\t\t\t\tconst cMin = Number(sd.clampMin) || 0;\n\t\t\t\t\tconst cMax = Number(sd.clampMax) || 1;\n\t\t\t\t\treturn Math.max(cMin, Math.min(cMax, valA));\n\t\t\t\t}\n\t\t\t\tcase \"abs\":\n\t\t\t\t\treturn Math.abs(valA);\n\t\t\t\tcase \"negate\":\n\t\t\t\t\treturn -valA;\n\t\t\t\tcase \"invert\":\n\t\t\t\t\treturn 1.0 - valA;\n\t\t\t\tcase \"power\":\n\t\t\t\t\treturn valA ** (Number(sd.exponent) || 2);\n\t\t\t\tcase \"modulo\":\n\t\t\t\t\treturn valB !== 0 ? valA % valB : 0;\n\t\t\t\tcase \"remap\": {\n\t\t\t\t\tconst inMin = Number(sd.inMin) || 0;\n\t\t\t\t\tconst inMax = Number(sd.inMax) || 1;\n\t\t\t\t\tconst outMin = Number(sd.outMin) || 0;\n\t\t\t\t\tconst outMax = Number(sd.outMax) || 1;\n\t\t\t\t\tconst rangeIn = inMax - inMin;\n\t\t\t\t\tconst norm = rangeIn !== 0 ? (valA - inMin) / rangeIn : 0;\n\t\t\t\t\treturn outMin + norm * (outMax - outMin);\n\t\t\t\t}\n\t\t\t\tcase \"normalize\": {\n\t\t\t\t\tconst minVal = Number(sd.aMin ?? sd.inMin) || 0.0;\n\t\t\t\t\tconst maxVal = Number(sd.aMax ?? sd.inMax) || 1.0;\n\t\t\t\t\tconst range = maxVal - minVal;\n\t\t\t\t\treturn range !== 0\n\t\t\t\t\t\t? Math.max(0, Math.min(1, (valA - minVal) / range))\n\t\t\t\t\t\t: 0;\n\t\t\t\t}\n\t\t\t\tcase \"smoothstep\": {\n\t\t\t\t\tconst e0 = Number(sd.edge0) || 0;\n\t\t\t\t\tconst e1 = Number(sd.edge1) || 1;\n\t\t\t\t\tconst range = e1 - e0;\n\t\t\t\t\tconst x =\n\t\t\t\t\t\trange !== 0 ? Math.max(0, Math.min(1, (valA - e0) / range)) : 0;\n\t\t\t\t\treturn x * x * (3 - 2 * x);\n\t\t\t\t}\n\t\t\t\tcase \"custom\":\n\t\t\t\t\treturn valA;\n\t\t\t\tdefault:\n\t\t\t\t\treturn valA;\n\t\t\t}\n\t\t}\n\n\t\tif (typeof sd.value === \"number\") {\n\t\t\treturn sd.value;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\n/**\n * Evaluates an external Signal as an event accumulator / integrator.\n * On each rising edge above `threshold` (with `debounceFrames` guard),\n * the accumulator increments by 1.\n */\nexport function evaluateSignalAccumulator(\n\trawSource: unknown,\n\tcurrentFrame: number,\n\tfps: number,\n\tthreshold = 0.15,\n\tdebounceFrames = 2,\n): number {\n\tif (currentFrame < 0 || !rawSource) return 0;\n\tconst src = rawSource as SignalDataSource;\n\n\tlet count = 0;\n\tlet lastTriggerFrame = -Infinity;\n\n\tfor (let f = 0; f <= currentFrame; f++) {\n\t\tconst val = extractRawSignalSample(src, f, fps);\n\t\tconst prevVal = f > 0 ? extractRawSignalSample(src, f - 1, fps) : 0;\n\n\t\t// Rising edge crossing the threshold with debounce protection\n\t\tif (\n\t\t\tval >= threshold &&\n\t\t\tprevVal < threshold &&\n\t\t\tf - lastTriggerFrame >= debounceFrames\n\t\t) {\n\t\t\tcount++;\n\t\t\tlastTriggerFrame = f;\n\t\t}\n\t}\n\n\treturn count;\n}\n\n/**\n * Evaluates an external Signal with smoothing window and linear remapping,\n * or as a discrete event accumulator.\n */\nexport function evaluateSignal(\n\tsource: {\n\t\tinputHandleId: string;\n\t\tmultiplier?: number;\n\t\toffset?: number;\n\t\tsmoothingWindowFrames?: number;\n\t\tsignalMode?: \"continuous\" | \"accumulate\";\n\t\tthreshold?: number;\n\t\taccumulateThreshold?: number;\n\t\tdebounceFrames?: number;\n\t\tchannel?: string;\n\t},\n\tframe: number,\n\tfps: number,\n\tsignals: Record<string, SignalDataSource> = {},\n): number {\n\tlet rawSource = signals[source.inputHandleId];\n\tif (rawSource === undefined && signals) {\n\t\tconst signalKeys = Object.keys(signals);\n\t\tif (signalKeys.length === 1) {\n\t\t\trawSource = signals[signalKeys[0]];\n\t\t} else if (signalKeys.length > 1) {\n\t\t\tconst matched = signalKeys.find((k) => k === source.inputHandleId);\n\t\t\trawSource = matched ? signals[matched] : signals[signalKeys[0]];\n\t\t}\n\t}\n\n\tif (source.channel && rawSource && typeof rawSource === \"object\") {\n\t\tconst candidate = (rawSource as Record<string, unknown>)[source.channel];\n\t\tif (candidate !== undefined) {\n\t\t\trawSource = candidate as SignalDataSource;\n\t\t} else if (typeof (rawSource as { get?: unknown }).get !== \"function\") {\n\t\t\trawSource = { ...(rawSource as object), channel: source.channel };\n\t\t}\n\t}\n\n\tif (source.signalMode === \"accumulate\") {\n\t\tconst threshold = source.threshold ?? source.accumulateThreshold ?? 0.15;\n\t\tconst debounce = source.debounceFrames ?? 2;\n\t\tconst count = evaluateSignalAccumulator(\n\t\t\trawSource,\n\t\t\tframe,\n\t\t\tfps,\n\t\t\tthreshold,\n\t\t\tdebounce,\n\t\t);\n\t\tconst mult = source.multiplier ?? 1.0;\n\t\tconst off = source.offset ?? 0.0;\n\t\treturn count * mult + off;\n\t}\n\n\tconst multiplier = source.multiplier ?? 1.0;\n\tconst offset = source.offset ?? 0.0;\n\tconst windowFrames = Math.max(\n\t\t0,\n\t\tMath.round(source.smoothingWindowFrames ?? 0),\n\t);\n\n\tif (windowFrames <= 1) {\n\t\tconst rawVal = extractRawSignalSample(rawSource, frame, fps);\n\t\treturn rawVal * multiplier + offset;\n\t}\n\n\t// Moving-average smoothing filter\n\tlet sum = 0;\n\tlet count = 0;\n\tconst startF = Math.max(0, frame - windowFrames + 1);\n\tfor (let f = startF; f <= frame; f++) {\n\t\tsum += extractRawSignalSample(rawSource, f, fps);\n\t\tcount++;\n\t}\n\n\tconst avg = count > 0 ? sum / count : 0;\n\treturn avg * multiplier + offset;\n}\n\n// ── Keyframe Interpolation ────────────────────────────────────────────\n\nfunction lerp(a: number, b: number, t: number): number {\n\treturn a + (b - a) * t;\n}\n\nfunction parseHexColor(hex: string): [number, number, number, number] {\n\tlet h = hex.trim().replace(\"#\", \"\");\n\tif (h.length === 3) {\n\t\th = h[0] + h[0] + h[1] + h[1] + h[2] + h[2];\n\t}\n\tif (h.length === 6) {\n\t\tconst num = parseInt(h, 16);\n\t\treturn [(num >> 16) & 255, (num >> 8) & 255, num & 255, 1];\n\t}\n\tif (h.length === 8) {\n\t\tconst num = parseInt(h, 16);\n\t\treturn [\n\t\t\t(num >> 24) & 255,\n\t\t\t(num >> 16) & 255,\n\t\t\t(num >> 8) & 255,\n\t\t\t(num & 255) / 255,\n\t\t];\n\t}\n\treturn [255, 255, 255, 1];\n}\n\nfunction lerpColor(c1: string, c2: string, t: number): string {\n\tif (!c1.startsWith(\"#\") || !c2.startsWith(\"#\")) return t < 0.5 ? c1 : c2;\n\tconst [r1, g1, b1, a1] = parseHexColor(c1);\n\tconst [r2, g2, b2, a2] = parseHexColor(c2);\n\tconst r = Math.round(lerp(r1, r2, t));\n\tconst g = Math.round(lerp(g1, g2, t));\n\tconst b = Math.round(lerp(b1, b2, t));\n\tconst a = lerp(a1, a2, t);\n\n\tconst toHex = (n: number) => n.toString(16).padStart(2, \"0\");\n\tif (a >= 0.999) {\n\t\treturn `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n\t}\n\treturn `rgba(${r}, ${g}, ${b}, ${Math.round(a * 100) / 100})`;\n}\n\nfunction hueToRgb(p: number, q: number, t: number): number {\n\tlet tt = t;\n\tif (tt < 0) tt += 1;\n\tif (tt > 1) tt -= 1;\n\tif (tt < 1 / 6) return p + (q - p) * 6 * tt;\n\tif (tt < 1 / 2) return q;\n\tif (tt < 2 / 3) return p + (q - p) * (2 / 3 - tt) * 6;\n\treturn p;\n}\n\nexport function rotateHue(hex: string, delta: number): string {\n\tconst [r255, g255, b255, a] = parseHexColor(hex);\n\tconst r = r255 / 255;\n\tconst g = g255 / 255;\n\tconst b = b255 / 255;\n\tconst max = Math.max(r, g, b);\n\tconst min = Math.min(r, g, b);\n\tlet h = 0;\n\tlet s = 0;\n\tconst l = (max + min) / 2;\n\n\tif (max !== min) {\n\t\tconst d = max - min;\n\t\ts = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\t\tswitch (max) {\n\t\t\tcase r:\n\t\t\t\th = (g - b) / d + (g < b ? 6 : 0);\n\t\t\t\tbreak;\n\t\t\tcase g:\n\t\t\t\th = (b - r) / d + 2;\n\t\t\t\tbreak;\n\t\t\tcase b:\n\t\t\t\th = (r - g) / d + 4;\n\t\t\t\tbreak;\n\t\t}\n\t\th /= 6;\n\t}\n\n\th = (h + (delta % 1) + 1) % 1;\n\n\tlet newR = l;\n\tlet newG = l;\n\tlet newB = l;\n\n\tif (s !== 0) {\n\t\tconst q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\tconst p = 2 * l - q;\n\t\tnewR = hueToRgb(p, q, h + 1 / 3);\n\t\tnewG = hueToRgb(p, q, h);\n\t\tnewB = hueToRgb(p, q, h - 1 / 3);\n\t}\n\n\tconst toHex = (n: number) =>\n\t\tMath.round(Math.max(0, Math.min(255, n * 255)))\n\t\t\t.toString(16)\n\t\t\t.padStart(2, \"0\");\n\tif (a >= 0.999) {\n\t\treturn `#${toHex(newR)}${toHex(newG)}${toHex(newB)}`;\n\t}\n\treturn `rgba(${Math.round(newR * 255)}, ${Math.round(newG * 255)}, ${Math.round(newB * 255)}, ${Math.round(a * 100) / 100})`;\n}\n\nconst COLOR_PROPS = new Set([\n\t\"fill\",\n\t\"fillColor\",\n\t\"strokeColor\",\n\t\"textBackgroundColor\",\n\t\"color\",\n]);\n\n/**\n * Standard keyframe track evaluation.\n */\nexport function evaluateKeyframes(\n\ttrack: AnimationTrack,\n\tlocalFrame: number,\n): number | boolean | string {\n\tconst keyframes = track.keyframes ?? [];\n\tif (keyframes.length === 0) return 0;\n\tif (keyframes.length === 1) return keyframes[0].value;\n\n\tif (localFrame <= keyframes[0].frame) {\n\t\treturn keyframes[0].value;\n\t}\n\tif (localFrame >= keyframes[keyframes.length - 1].frame) {\n\t\treturn keyframes[keyframes.length - 1].value;\n\t}\n\n\tfor (let i = 0; i < keyframes.length - 1; i++) {\n\t\tconst kf0 = keyframes[i];\n\t\tconst kf1 = keyframes[i + 1];\n\n\t\tif (localFrame >= kf0.frame && localFrame <= kf1.frame) {\n\t\t\tconst delta = kf1.frame - kf0.frame;\n\t\t\tconst t = delta > 0 ? (localFrame - kf0.frame) / delta : 0;\n\n\t\t\tif (typeof kf0.value === \"boolean\") {\n\t\t\t\treturn t >= 1 ? kf1.value : kf0.value;\n\t\t\t}\n\n\t\t\tif (typeof kf0.value === \"string\" && typeof kf1.value === \"string\") {\n\t\t\t\treturn lerpColor(kf0.value, kf1.value, t);\n\t\t\t}\n\n\t\t\tconst n0 = Number(kf0.value) || 0;\n\t\t\tconst n1 = Number(kf1.value) || 0;\n\t\t\treturn lerp(n0, n1, t);\n\t\t}\n\t}\n\n\treturn keyframes[keyframes.length - 1].value;\n}\n\n// ── Master Track Evaluator ────────────────────────────────────────────\n\n/**\n * Evaluates an AnimationTrack at a given global or local frame.\n */\nexport function evaluateTrackAtFrame(\n\ttrack: AnimationTrack,\n\tframe: number,\n\tfps = 24,\n\tcontext: TrackEvaluationContext = {},\n): number | boolean | string {\n\tconst startFrame = context.startFrame ?? 0;\n\tconst localFrame = frame - startFrame;\n\tconst source: TrackSource = track.source ?? { type: \"keyframe\" };\n\tconst basePropVal = context.baseValues?.[track.prop];\n\n\tswitch (source.type) {\n\t\tcase \"keyframe\":\n\t\t\treturn evaluateKeyframes(track, localFrame);\n\n\t\tcase \"wiggle\": {\n\t\t\tconst fallbackNum = typeof basePropVal === \"number\" ? basePropVal : 0;\n\t\t\tconst base =\n\t\t\t\ttrack.keyframes && track.keyframes.length > 0\n\t\t\t\t\t? Number(evaluateKeyframes(track, localFrame)) || 0\n\t\t\t\t\t: fallbackNum;\n\t\t\tconst tSec = localFrame / (fps > 0 ? fps : 24);\n\t\t\treturn evaluateWiggle(source, tSec, base);\n\t\t}\n\n\t\tcase \"springOvershoot\": {\n\t\t\tlet v0 = 0;\n\t\t\tlet v1 = 1;\n\t\t\tif (track.keyframes && track.keyframes.length >= 2) {\n\t\t\t\tv0 = Number(track.keyframes[0].value) || 0;\n\t\t\t\tv1 = Number(track.keyframes[1].value) || 1;\n\t\t\t} else if (track.keyframes && track.keyframes.length === 1) {\n\t\t\t\tv0 = Number(basePropVal) || 0;\n\t\t\t\tv1 = Number(track.keyframes[0].value) || 0;\n\t\t\t} else if (typeof basePropVal === \"number\") {\n\t\t\t\tv0 = basePropVal;\n\t\t\t\tv1 = basePropVal;\n\t\t\t}\n\t\t\tconst tSec = localFrame / (fps > 0 ? fps : 24);\n\t\t\treturn evaluateSpringOvershoot(source, tSec, v0, v1);\n\t\t}\n\n\t\tcase \"signal\": {\n\t\t\tconst sigVal = evaluateSignal(source, frame, fps, context.signals);\n\t\t\tif (COLOR_PROPS.has(track.prop)) {\n\t\t\t\tconst src = source as {\n\t\t\t\t\tcolorMode?: \"interpolate\" | \"hueRotate\" | \"threshold\";\n\t\t\t\t\tcolorA?: string;\n\t\t\t\t\tcolorB?: string;\n\t\t\t\t\tcolorThreshold?: number;\n\t\t\t\t};\n\t\t\t\tconst colorA = src.colorA ?? \"#ffffff\";\n\t\t\t\tconst colorB = src.colorB ?? \"#ffffff\";\n\t\t\t\tconst mode = src.colorMode ?? \"interpolate\";\n\t\t\t\tif (mode === \"threshold\") {\n\t\t\t\t\tconst threshold = src.colorThreshold ?? 0.5;\n\t\t\t\t\treturn sigVal >= threshold ? colorB : colorA;\n\t\t\t\t}\n\t\t\t\tif (mode === \"hueRotate\") {\n\t\t\t\t\treturn rotateHue(colorA, sigVal);\n\t\t\t\t}\n\t\t\t\t// Default interpolate\n\t\t\t\tconst t = Math.max(0, Math.min(1, sigVal));\n\t\t\t\treturn lerpColor(colorA, colorB, t);\n\t\t\t}\n\t\t\treturn sigVal;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn evaluateKeyframes(track, localFrame);\n\t}\n}\n\n/**\n * Evaluates all animation tracks for a layer at `frame`.\n */\nexport function evaluateAnimationAtFrame(\n\tanimation: LayerAnimation | undefined,\n\tframe: number,\n\tfps = 24,\n\tcontext: TrackEvaluationContext = {},\n): Record<string, number | boolean | string> {\n\tconst result: Record<string, number | boolean | string> = {};\n\tif (!animation?.tracks) return result;\n\n\tfor (const track of animation.tracks) {\n\t\tresult[track.prop] = evaluateTrackAtFrame(track, frame, fps, context);\n\t}\n\n\treturn result;\n}\n","/**\n * @file packages/compositions/src/program/text-animations/advanced-builder.ts\n * Fluent builder for Advanced Motion Design & After Effects Extended Typography Animators.\n */\n\nimport type {\n\tAnchorGrouping,\n\tAnchorPreset,\n\tExpressionSelector,\n\tExtendedGlyphProperties,\n\tVariableFontAxes,\n\tVolumetricFormationMode,\n} from \"./advanced-types.js\";\n\n/**\n * Fluent Builder for Extended Text Animators.\n */\nexport class AdvancedTextAnimatorBuilder {\n\tprivate readonly name: string;\n\tprivate props: ExtendedGlyphProperties = {};\n\tprivate selectors: (ExpressionSelector | Record<string, unknown>)[] = [];\n\n\tconstructor(name: string) {\n\t\tthis.name = name;\n\t}\n\n\tstatic create(name: string): AdvancedTextAnimatorBuilder {\n\t\treturn new AdvancedTextAnimatorBuilder(name);\n\t}\n\n\t/** Directional Skew */\n\tskew(angleDeg: number, axisDeg = 0): this {\n\t\tthis.props.skew = angleDeg;\n\t\tthis.props.skewAxis = axisDeg;\n\t\treturn this;\n\t}\n\n\t/** Anchor Point Grouping and Preset Pivot */\n\tanchor(\n\t\tpreset: AnchorPreset,\n\t\tgrouping: AnchorGrouping = \"character\",\n\t\toffsetX = 0,\n\t\toffsetY = 0,\n\t): this {\n\t\tthis.props.anchor = {\n\t\t\tgrouping,\n\t\t\tpreset,\n\t\t\tanchorX: 0.5,\n\t\t\tanchorY: 0.5,\n\t\t\toffsetX,\n\t\t\toffsetY,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Custom Anchor Point Coordinates (0 to 1 normalized) */\n\tanchorNormalized(\n\t\tax: number,\n\t\tay: number,\n\t\tgrouping: AnchorGrouping = \"character\",\n\t): this {\n\t\tthis.props.anchor = {\n\t\t\tgrouping,\n\t\t\tpreset: \"custom\",\n\t\t\tanchorX: ax,\n\t\t\tanchorY: ay,\n\t\t\toffsetX: 0,\n\t\t\toffsetY: 0,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** 3D Spatial Z-Depth */\n\ttranslateZ(zPixels: number): this {\n\t\tthis.props.translateZ = zPixels;\n\t\treturn this;\n\t}\n\n\t/** 3D Tilts */\n\ttilt3D(rx = 0, ry = 0, rz = 0): this {\n\t\tthis.props.rotationX = rx;\n\t\tthis.props.rotationY = ry;\n\t\tthis.props.rotationZ = rz;\n\t\treturn this;\n\t}\n\n\t/** 3D Rotation along X axis */\n\trotationX(deg: number): this {\n\t\tthis.props.rotationX = deg;\n\t\treturn this;\n\t}\n\n\t/** 3D Rotation along Y axis */\n\trotationY(deg: number): this {\n\t\tthis.props.rotationY = deg;\n\t\treturn this;\n\t}\n\n\t/** 3D Rotation along Z axis */\n\trotationZ(deg: number): this {\n\t\tthis.props.rotationZ = deg;\n\t\treturn this;\n\t}\n\n\t/** 3D Volumetric Formations */\n\tvolumetricFormation(\n\t\tmode: VolumetricFormationMode = \"cylinder\",\n\t\tradius = 300,\n\t\tpitch = 120,\n\t\ttotalAngle = 360,\n\t\tperspective = 1200,\n\t\taxis: \"x\" | \"y\" | \"z\" = \"y\",\n\t): this {\n\t\tthis.props.formation = {\n\t\t\tmode,\n\t\t\tradius,\n\t\t\tpitch,\n\t\t\ttotalAngle,\n\t\t\tperspective,\n\t\t\taxis,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Dynamic Line Spacing (Leading) */\n\tlineSpacing(extraLeadingPixels: number, lineAnchor = 0): this {\n\t\tthis.props.lineSpacing = extraLeadingPixels;\n\t\tthis.props.lineAnchor = lineAnchor;\n\t\treturn this;\n\t}\n\n\t/** Normalized Line Anchor (0=top, 0.5=center, 1=bottom) */\n\tlineAnchor(anchor: number): this {\n\t\tthis.props.lineAnchor = anchor;\n\t\treturn this;\n\t}\n\n\t/** Inertial Spring Settling Physics */\n\tspring(stiffness = 180, damping = 12, mass = 1.0, initialVelocity = 0): this {\n\t\tthis.props.spring = {\n\t\t\tstiffness,\n\t\t\tdamping,\n\t\t\tmass,\n\t\t\tinitialVelocity,\n\t\t\tovershootMultiplier: 1.0,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Dynamic Stroke & Wireframe Properties */\n\tstroke(widthPixels: number, color = \"#ffffff\", fillOpacity = 1.0): this {\n\t\tthis.props.stroke = {\n\t\t\tstrokeWidth: widthPixels,\n\t\t\tstrokeColor: color,\n\t\t\tstrokeAlign: \"center\",\n\t\t\tfillOpacity,\n\t\t\tdashOffset: 0,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Variable Font Axes */\n\tvariableFont(axes: VariableFontAxes): this {\n\t\tthis.props.variableAxes = axes;\n\t\treturn this;\n\t}\n\n\t/** Chromatic Aberration / Cyberpunk Glitch */\n\tchromaticGlitch(\n\t\tredShiftX: number,\n\t\tredShiftY = 0,\n\t\tblueShiftX = -redShiftX,\n\t\tblueShiftY = 0,\n\t): this {\n\t\tthis.props.chromaticGlitch = {\n\t\t\tredShiftX,\n\t\t\tredShiftY,\n\t\t\tblueShiftX,\n\t\t\tblueShiftY,\n\t\t\tsliceProbability: 0,\n\t\t\tsliceAmplitude: 0,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Multi-Band Audio Spectrum Equalizer */\n\taudioSpectrum(\n\t\tsignalChannel: string,\n\t\tminFreqHz = 60,\n\t\tmaxFreqHz = 16000,\n\t\tmaxScale = 2.5,\n\t): this {\n\t\tthis.props.audioSpectrum = {\n\t\t\tsignalChannel,\n\t\t\tminFreqHz,\n\t\t\tmaxFreqHz,\n\t\t\tscaleAxis: \"scaleY\",\n\t\t\tminScale: 0.2,\n\t\t\tmaxScale,\n\t\t\tpeakDecay: 0.8,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Long Shadow Extrusion */\n\tlongShadow(\n\t\tangle = 45,\n\t\tlength = 40,\n\t\tcolor = \"#000000\",\n\t\tstartOpacity = 0.8,\n\t\tendOpacity = 0.0,\n\t\tsteps = 16,\n\t): this {\n\t\tthis.props.longShadow = {\n\t\t\tangle,\n\t\t\tlength,\n\t\t\tcolor,\n\t\t\tstartOpacity,\n\t\t\tendOpacity,\n\t\t\tsteps,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Particle Dust / Quantum Dissolve */\n\tparticleDissolve(\n\t\tprogress = 0,\n\t\tdispersalAngle = 90,\n\t\tmaxDisplacement = 120,\n\t): this {\n\t\tthis.props.particleDissolve = {\n\t\t\tprogress,\n\t\t\tdispersalAngle,\n\t\t\tmaxDisplacement,\n\t\t\tturbulence: 0.5,\n\t\t\tparticleSize: 2.0,\n\t\t};\n\t\treturn this;\n\t}\n\n\t/** Add Expression Selector */\n\taddExpressionSelector(\n\t\texpression: string,\n\t\tmode: \"add\" | \"subtract\" | \"intersect\" = \"add\",\n\t): this {\n\t\tthis.selectors.push({\n\t\t\ttype: \"expression\",\n\t\t\texpression,\n\t\t\tmode,\n\t\t\tamount: 1.0,\n\t\t});\n\t\treturn this;\n\t}\n\n\t/** Alias for addExpressionSelector */\n\texpressionSelector(\n\t\texpression: string,\n\t\tmode: \"add\" | \"subtract\" | \"intersect\" = \"add\",\n\t): this {\n\t\treturn this.addExpressionSelector(expression, mode);\n\t}\n\n\t/** Standard 2D Transforms */\n\tx(v: number): this {\n\t\tthis.props.x = v;\n\t\treturn this;\n\t}\n\ty(v: number): this {\n\t\tthis.props.y = v;\n\t\treturn this;\n\t}\n\tscale(v: number): this {\n\t\tthis.props.scale = v;\n\t\treturn this;\n\t}\n\tscaleX(v: number): this {\n\t\tthis.props.scaleX = v;\n\t\treturn this;\n\t}\n\tscaleY(v: number): this {\n\t\tthis.props.scaleY = v;\n\t\treturn this;\n\t}\n\trotation(deg: number): this {\n\t\tthis.props.rotation = deg;\n\t\treturn this;\n\t}\n\topacity(v: number): this {\n\t\tthis.props.opacity = v;\n\t\treturn this;\n\t}\n\tblur(v: number): this {\n\t\tthis.props.blur = v;\n\t\treturn this;\n\t}\n\tfillColor(hex: string): this {\n\t\tthis.props.fillColor = hex;\n\t\treturn this;\n\t}\n\n\tbuild(): {\n\t\tname: string;\n\t\tselectors: (ExpressionSelector | Record<string, unknown>)[];\n\t\tprops: ExtendedGlyphProperties;\n\t} {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tselectors: this.selectors,\n\t\t\tprops: this.props,\n\t\t};\n\t}\n}\n","/**\n * @file packages/compositions/src/program/text-animations/advanced-types.ts\n * Data contracts and Zod schemas for Advanced Motion Design & After Effects Extended Typography Engine.\n */\n\nimport { z } from \"zod\";\n\n// ==============================================================================================\n// 1. ANCHOR POINT GROUPING & CUSTOM PIVOT ALIGNMENT\n// ==============================================================================================\n\nexport const AnchorGroupingSchema = z.enum([\n\t\"character\",\n\t\"word\",\n\t\"line\",\n\t\"all\",\n]);\nexport type AnchorGrouping = z.infer<typeof AnchorGroupingSchema>;\n\nexport const AnchorPresetSchema = z.enum([\n\t\"center\",\n\t\"baseline\",\n\t\"bottom_left\",\n\t\"bottom_center\",\n\t\"bottom_right\",\n\t\"top_left\",\n\t\"top_center\",\n\t\"top_right\",\n\t\"custom\",\n]);\nexport type AnchorPreset = z.infer<typeof AnchorPresetSchema>;\n\nexport const TextAnchorConfigSchema = z.object({\n\t/** Grouping scope */\n\tgrouping: AnchorGroupingSchema.default(\"character\"),\n\t/** Preset pivot location */\n\tpreset: AnchorPresetSchema.default(\"center\"),\n\t/** Normalized horizontal anchor point (0 = left, 0.5 = center, 1 = right) */\n\tanchorX: z.number().default(0.5),\n\t/** Normalized vertical anchor point (0 = top, 0.5 = middle, 1 = baseline/bottom) */\n\tanchorY: z.number().default(0.5),\n\t/** Pixel offset added to the calculated anchor point */\n\toffsetX: z.number().default(0),\n\toffsetY: z.number().default(0),\n});\nexport type TextAnchorConfig = z.infer<typeof TextAnchorConfigSchema>;\n\n// ==============================================================================================\n// 2. DIRECTIONAL SKEW & SKEW AXIS\n// ==============================================================================================\n\nexport const SkewPropertiesSchema = z.object({\n\t/** Skew angle in degrees (-90 to +90). Positive shears to the right. */\n\tskew: z.number().min(-90).max(90),\n\t/** Skew axis angle in degrees (0 to 360). 0 = horizontal shear, 90 = vertical shear. */\n\tskewAxis: z.number().default(0),\n});\nexport type SkewProperties = z.infer<typeof SkewPropertiesSchema>;\n\n// ==============================================================================================\n// 3. DYNAMIC LINE SPACING (LEADING) & LINE ANCHORS\n// ==============================================================================================\n\nexport const LineSpacingDynamicsSchema = z.object({\n\t/** Additional inter-line leading offset in pixels (can be negative for overlap). */\n\tlineSpacing: z.number(),\n\t/**\n\t * Normalized line anchor defining the stationary pivot line:\n\t * 0.0 = Top line remains stationary, subsequent lines push downwards.\n\t * 0.5 = Center line remains stationary, lines expand outward symmetrically (accordion).\n\t * 1.0 = Bottom line remains stationary, upper lines push upwards.\n\t */\n\tlineAnchor: z.number().min(0).max(1).default(0),\n});\nexport type LineSpacingDynamics = z.infer<typeof LineSpacingDynamicsSchema>;\n\n// ==============================================================================================\n// 4. PER-CHARACTER 3D SPATIAL DEPTH & VOLUMETRIC FORMATIONS\n// ==============================================================================================\n\nexport const VolumetricFormationModeSchema = z.enum([\n\t\"planar\", // Individual translateZ camera depth offset\n\t\"vortex\", // Logarithmic spiral into the screen along Z axis\n\t\"cylinder\", // Cylindrical drum carousel around horizontal or vertical axis\n\t\"helix\", // 3D corkscrew DNA helix twisting along an axis\n]);\nexport type VolumetricFormationMode = z.infer<\n\ttypeof VolumetricFormationModeSchema\n>;\n\nexport const VolumetricFormationConfigSchema = z.object({\n\tmode: VolumetricFormationModeSchema.default(\"planar\"),\n\t/** Radius for cylinder / vortex / helix in pixels */\n\tradius: z.number().default(300),\n\t/** Pitch / axial spacing per revolution for helix / vortex in pixels */\n\tpitch: z.number().default(120),\n\t/** Total angular rotation across all characters in degrees */\n\ttotalAngle: z.number().default(360),\n\t/** Cylinder rotation axis */\n\taxis: z.enum([\"x\", \"y\", \"z\"]).default(\"y\"),\n\t/** Perspective distance in pixels (defaults to 1200) */\n\tperspective: z.number().positive().default(1200),\n});\nexport type VolumetricFormationConfig = z.infer<\n\ttypeof VolumetricFormationConfigSchema\n>;\n\nexport const Spatial3DPropertiesSchema = z.object({\n\t/** Translation along the camera Z axis (pixels; positive = towards camera) */\n\ttranslateZ: z.number().optional(),\n\t/** Rotation around the 3D X axis in degrees (flip-down pitch) */\n\trotationX: z.number().optional(),\n\t/** Rotation around the 3D Y axis in degrees (card-turn yaw) */\n\trotationY: z.number().optional(),\n\t/** Rotation around the 3D Z axis in degrees (planar roll) */\n\trotationZ: z.number().optional(),\n\t/** Volumetric 3D arrangement configuration */\n\tformation: VolumetricFormationConfigSchema.optional(),\n});\nexport type Spatial3DProperties = z.infer<typeof Spatial3DPropertiesSchema>;\n\n// ==============================================================================================\n// 5. INERTIAL SPRING & ELASTIC BOUNCE PHYSICS\n// ==============================================================================================\n\nexport const SpringPhysicsSchema = z.object({\n\t/** Spring stiffness constant (k > 0). Higher values oscillate faster. Default: 180. */\n\tstiffness: z.number().positive().default(180),\n\t/** Damping coefficient (c > 0). Controls energy dissipation. Default: 12. */\n\tdamping: z.number().positive().default(12),\n\t/** Mass of each glyph (m > 0). Heavier glyphs have more inertia. Default: 1.0. */\n\tmass: z.number().positive().default(1.0),\n\t/** Initial velocity imparted on the glyph upon selector contact. Default: 0. */\n\tinitialVelocity: z.number().default(0),\n\t/** Optional elastic overshoot factor multiplier (> 1 boosts bounce). Default: 1.0. */\n\tovershootMultiplier: z.number().min(0.5).max(3.0).default(1.0),\n});\nexport type SpringPhysics = z.infer<typeof SpringPhysicsSchema>;\n\n// ==============================================================================================\n// 6. EXPRESSION SELECTORS (PROGRAMMATIC PER-GLYPH EVALUATION)\n// ==============================================================================================\n\nexport interface ExpressionEvaluationContext {\n\t/** 0-based index of the current character */\n\tcharIndex: number;\n\t/** 0-based index of the current word */\n\twordIndex: number;\n\t/** 0-based index of the current line */\n\tlineIndex: number;\n\t/** Total count of characters in paragraph */\n\ttotalChars: number;\n\t/** Total count of words in paragraph */\n\ttotalWords: number;\n\t/** Total count of lines in paragraph */\n\ttotalLines: number;\n\t/** Current timeline frame number */\n\tframe: number;\n\t/** Timeline frame rate */\n\tfps: number;\n\t/** Current timeline timestamp in seconds */\n\ttime: number;\n\t/** Bound reactive signals map */\n\tsignals?: Record<string, unknown>;\n}\n\nexport const ExpressionSelectorSchema = z.object({\n\ttype: z.literal(\"expression\"),\n\tname: z.string().optional(),\n\t/**\n\t * Mathematical formula expression string.\n\t * Available variables: textIndex, textTotal, wordIndex, wordTotal, lineIndex, lineTotal, time, frame, fps, sin, cos, abs, min, max, clamp, noise.\n\t */\n\texpression: z.string(),\n\t/** Selection combination mode with prior selectors in stack */\n\tmode: z\n\t\t.enum([\"add\", \"subtract\", \"intersect\", \"min\", \"max\", \"difference\"])\n\t\t.default(\"add\"),\n\t/** Amount multiplier applied to output weight */\n\tamount: z.number().default(1.0),\n});\nexport type ExpressionSelector = z.infer<typeof ExpressionSelectorSchema>;\n\n// ==============================================================================================\n// 7. DYNAMIC STROKE & WIREFRAME EXPANSION\n// ==============================================================================================\n\nexport const DynamicStrokePropertiesSchema = z.object({\n\t/** Stroke outline thickness in pixels */\n\tstrokeWidth: z.number().min(0).default(0),\n\t/** Stroke outline color in hex/rgb */\n\tstrokeColor: z.string().default(\"#ffffff\"),\n\t/** Stroke alignment relative to glyph boundary */\n\tstrokeAlign: z.enum([\"center\", \"inside\", \"outside\"]).default(\"center\"),\n\t/** Fill opacity (0 = transparent wireframe, 1 = fully filled solid) */\n\tfillOpacity: z.number().min(0).max(1).default(1.0),\n\t/** Dashed stroke pattern: [dashLength, gapLength] in pixels */\n\tdashArray: z.tuple([z.number(), z.number()]).optional(),\n\t/** Dashed stroke animated offset in pixels */\n\tdashOffset: z.number().default(0),\n});\nexport type DynamicStrokeProperties = z.infer<\n\ttypeof DynamicStrokePropertiesSchema\n>;\n\n// ==============================================================================================\n// 8. INFINITE KINETIC MARQUEE & CYLINDRICAL DRUM (SLOT MACHINE)\n// ==============================================================================================\n\nexport const KineticMarqueeConfigSchema = z.object({\n\t/** Motion flow direction */\n\tdirection: z.enum([\"left\", \"right\", \"up\", \"down\"]).default(\"left\"),\n\t/** Continuous scroll velocity in pixels per second */\n\tvelocity: z.number().default(120),\n\t/** Seamless loop wrapping within container bounds */\n\tloop: z.boolean().default(true),\n\t/** Gap between looping text duplicates in pixels */\n\trepeatGap: z.number().default(80),\n\t/**\n\t * Slot Machine / Drum Snap:\n\t * When enabled, scrolling decelerates and snaps to discrete character or word boundaries.\n\t */\n\tsnap: z\n\t\t.object({\n\t\t\tenabled: z.boolean().default(false),\n\t\t\t/** Granularity of snap stops */\n\t\t\tgranularity: z.enum([\"character\", \"word\", \"line\"]).default(\"word\"),\n\t\t\t/** Target stop index */\n\t\t\tstopIndex: z.number().default(0),\n\t\t\t/** Deceleration easing curve name */\n\t\t\tdecelEase: z.string().default(\"cubic.out\"),\n\t\t})\n\t\t.optional(),\n});\nexport type KineticMarqueeConfig = z.infer<typeof KineticMarqueeConfigSchema>;\n\n// ==============================================================================================\n// 9. KINETIC VARIABLE FONT AXIS MODULATION\n// ==============================================================================================\n\nexport const VariableFontAxesSchema = z.object({\n\t/** Weight axis ('wght'): 100 (Thin) to 900 (Black) */\n\tweight: z.number().min(100).max(1000).optional(),\n\t/** Width axis ('wdth'): 50% (Ultra-Condensed) to 200% (Ultra-Expanded) */\n\twidth: z.number().min(50).max(200).optional(),\n\t/** Slant axis ('slnt'): -15 to +15 degrees */\n\tslant: z.number().min(-25).max(25).optional(),\n\t/** Italic binary axis ('ital'): 0 or 1 */\n\titalic: z.number().min(0).max(1).optional(),\n\t/** Optical size axis ('opsz'): 6 to 72 points */\n\topticalSize: z.number().min(6).max(144).optional(),\n});\nexport type VariableFontAxes = z.infer<typeof VariableFontAxesSchema>;\n\n// ==============================================================================================\n// 10. HIGH-END GPU & SHADER-NATIVE TYPOGRAPHY (VFX PAYLOAD)\n// ==============================================================================================\n\nexport const ChromaticGlitchConfigSchema = z.object({\n\t/** Horizontal red-channel displacement offset in pixels */\n\tredShiftX: z.number().default(0),\n\t/** Vertical red-channel displacement offset in pixels */\n\tredShiftY: z.number().default(0),\n\t/** Horizontal blue-channel displacement offset in pixels */\n\tblueShiftX: z.number().default(0),\n\t/** Vertical blue-channel displacement offset in pixels */\n\tblueShiftY: z.number().default(0),\n\t/** Random slice scanline displacement probability per frame (0 to 1) */\n\tsliceProbability: z.number().min(0).max(1).default(0),\n\t/** Maximum slice pixel displacement */\n\tsliceAmplitude: z.number().default(0),\n});\nexport type ChromaticGlitchConfig = z.infer<typeof ChromaticGlitchConfigSchema>;\n\nexport const AudioSpectrumTypographySchema = z.object({\n\t/** Audio stem or FFT signal registry channel name */\n\tsignalChannel: z.string(),\n\t/** Minimum audio frequency in Hz mapped to the first glyph */\n\tminFreqHz: z.number().default(60),\n\t/** Maximum audio frequency in Hz mapped to the last glyph */\n\tmaxFreqHz: z.number().default(16000),\n\t/** Scale axis to modulate */\n\tscaleAxis: z.enum([\"scaleY\", \"scaleX\", \"scale\", \"y\"]).default(\"scaleY\"),\n\t/** Minimum scale factor at silence */\n\tminScale: z.number().default(0.2),\n\t/** Maximum scale factor at peak magnitude */\n\tmaxScale: z.number().default(2.5),\n\t/** Peak decay smoothing (0 = instantaneous, 0.9 = long decay) */\n\tpeakDecay: z.number().min(0).max(0.99).default(0.8),\n});\nexport type AudioSpectrumTypography = z.infer<\n\ttypeof AudioSpectrumTypographySchema\n>;\n\nexport const LongShadowConfigSchema = z.object({\n\t/** Projection angle in degrees (e.g. 45 = bottom-right, 135 = bottom-left) */\n\tangle: z.number().default(45),\n\t/** Shadow extrusion length in pixels */\n\tlength: z.number().min(0).default(0),\n\t/** Shadow color in hex/rgb */\n\tcolor: z.string().default(\"#000000\"),\n\t/** Shadow start opacity (0 to 1) */\n\tstartOpacity: z.number().min(0).max(1).default(0.8),\n\t/** Shadow terminal opacity (0 to 1, default 0 for soft fade) */\n\tendOpacity: z.number().min(0).max(1).default(0.0),\n\t/** Number of extrusion shadow slices (higher = smoother, 4 to 64) */\n\tsteps: z.number().int().min(4).max(64).default(16),\n});\nexport type LongShadowConfig = z.infer<typeof LongShadowConfigSchema>;\n\nexport const ParticleDissolveConfigSchema = z.object({\n\t/** Dissolution progress (0 = solid glyph, 1 = fully disintegrated into particles) */\n\tprogress: z.number().min(0).max(1).default(0),\n\t/** Dispersal directional angle in degrees (e.g. 90 = drifting upwards) */\n\tdispersalAngle: z.number().default(90),\n\t/** Maximum dispersal displacement distance in pixels */\n\tmaxDisplacement: z.number().default(120),\n\t/** Turbulence noise frequency for erratic particle paths */\n\tturbulence: z.number().default(0.5),\n\t/** Particle size in pixels */\n\tparticleSize: z.number().default(2.0),\n});\nexport type ParticleDissolveConfig = z.infer<\n\ttypeof ParticleDissolveConfigSchema\n>;\n\n// ==============================================================================================\n// 11. UNIFIED EXTENDED ANIMATOR PROPERTY CONTRACT\n// ==============================================================================================\n\nexport const ExtendedGlyphPropertiesSchema = z.object({\n\t// Spatial 2D & 3D\n\tx: z.number().optional(),\n\ty: z.number().optional(),\n\ttranslateZ: z.number().optional(),\n\tscale: z.number().optional(),\n\tscaleX: z.number().optional(),\n\tscaleY: z.number().optional(),\n\trotation: z.number().optional(),\n\trotationX: z.number().optional(),\n\trotationY: z.number().optional(),\n\trotationZ: z.number().optional(),\n\t/** Volumetric 3D arrangement (set by `volumetricFormation()`) */\n\tformation: VolumetricFormationConfigSchema.optional(),\n\tskew: z.number().optional(),\n\tskewAxis: z.number().optional(),\n\n\t// Typography & Metrics\n\ttracking: z.number().optional(),\n\tlineSpacing: z.number().optional(),\n\tlineAnchor: z.number().optional(),\n\tanchor: TextAnchorConfigSchema.optional(),\n\n\t// Optical & Material\n\topacity: z.number().optional(),\n\tblur: z.number().optional(),\n\tfillColor: z.string().optional(),\n\tstroke: DynamicStrokePropertiesSchema.optional(),\n\n\t// Variable Fonts\n\tvariableAxes: VariableFontAxesSchema.optional(),\n\n\t// GPU Shader VFX\n\tchromaticGlitch: ChromaticGlitchConfigSchema.optional(),\n\tlongShadow: LongShadowConfigSchema.optional(),\n\tparticleDissolve: ParticleDissolveConfigSchema.optional(),\n\taudioSpectrum: AudioSpectrumTypographySchema.optional(),\n\n\t// Dynamics & Physics\n\tspring: SpringPhysicsSchema.optional(),\n});\nexport type ExtendedGlyphProperties = z.infer<\n\ttypeof ExtendedGlyphPropertiesSchema\n>;\n\nexport const AdvancedTextAnimatorSchema = z.object({\n\tname: z.string().default(\"AdvancedAnimator\"),\n\tselectors: z.array(z.record(z.string(), z.unknown())).default([]),\n\tprops: ExtendedGlyphPropertiesSchema,\n});\nexport type AdvancedTextAnimator = z.infer<typeof AdvancedTextAnimatorSchema>;\n","/**\n * @file packages/compositions/src/program/text-animations/types.ts\n * Data contracts and Zod schemas for After Effects Parity Text Animation Engine.\n */\n\nimport { z } from \"zod\";\n\n// ==============================================================================================\n// 1. PATH-FOLLOWING TEXT DATA CONTRACTS & SCHEMAS\n// ==============================================================================================\n\nexport const Vec2Schema = z.object({\n\tx: z.number(),\n\ty: z.number(),\n});\nexport type Vec2 = z.infer<typeof Vec2Schema>;\n\nexport const CubicBezierSegmentSchema = z.object({\n\tp0: Vec2Schema,\n\tp1: Vec2Schema,\n\tp2: Vec2Schema,\n\tp3: Vec2Schema,\n});\nexport type CubicBezierSegment = z.infer<typeof CubicBezierSegmentSchema>;\n\nexport const TextPathSourceSchema = z.discriminatedUnion(\"type\", [\n\tz.object({\n\t\ttype: z.literal(\"svg\"),\n\t\td: z.string().min(1, \"SVG path string cannot be empty\"),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"bezier\"),\n\t\tsegments: z.array(CubicBezierSegmentSchema).min(1),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"ellipse\"),\n\t\tcx: z.number(),\n\t\tcy: z.number(),\n\t\trx: z.number().positive(),\n\t\try: z.number().positive(),\n\t\tstartAngleDeg: z.number().default(0),\n\t\tendAngleDeg: z.number().default(360),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"wave\"),\n\t\tstartX: z.number(),\n\t\tstartY: z.number(),\n\t\tlength: z.number().positive(),\n\t\tamplitude: z.number(),\n\t\tfrequency: z.number().positive(),\n\t\tphaseDeg: z.number().default(0),\n\t}),\n]);\nexport type TextPathSource = z.infer<typeof TextPathSourceSchema>;\n\nexport const TextPathOptionsSchema = z.object({\n\tpath: TextPathSourceSchema,\n\tfirstMargin: z.number().default(0),\n\tlastMargin: z.number().default(0),\n\treversePath: z.boolean().default(false),\n\tperpendicularToPath: z.boolean().default(true),\n\tforceAlignment: z.boolean().default(false),\n\tloop: z.boolean().default(false),\n\tbaselineOffset: z\n\t\t.enum([\"baseline\", \"center\", \"ascender\", \"descender\"])\n\t\t.default(\"baseline\"),\n\tbaselineShift: z.number().default(0),\n});\nexport type TextPathOptions = z.infer<typeof TextPathOptionsSchema>;\n\n// ==============================================================================================\n// 2. TYPEWRITER & DISCRETE REVEAL SCHEMAS\n// ==============================================================================================\n\nexport const TextCursorStyleSchema = z.enum([\n\t\"bar\",\n\t\"underscore\",\n\t\"block\",\n\t\"custom\",\n]);\nexport type TextCursorStyle = z.infer<typeof TextCursorStyleSchema>;\n\nexport const TextCursorConfigSchema = z.object({\n\tenabled: z.boolean().default(true),\n\tstyle: TextCursorStyleSchema.default(\"bar\"),\n\tcustomChar: z.string().default(\"|\"),\n\tcolor: z.string().optional(),\n\tblinkFrequency: z.number().min(0).default(2.0),\n\thideOnComplete: z.boolean().default(false),\n\twidth: z.number().positive().default(2.5),\n\tspacing: z.number().default(3.0),\n});\nexport type TextCursorConfig = z.infer<typeof TextCursorConfigSchema>;\n\nexport const TypingCadenceSchema = z.discriminatedUnion(\"mode\", [\n\tz.object({\n\t\tmode: z.literal(\"constant\"),\n\t}),\n\tz.object({\n\t\tmode: z.literal(\"human\"),\n\t\tjitter: z.number().min(0).max(1).default(0.35),\n\t\tcommaPauseMultiplier: z.number().min(1).default(3.0),\n\t\tsentencePauseMultiplier: z.number().min(1).default(5.5),\n\t\tparagraphPauseMultiplier: z.number().min(1).default(7.0),\n\t}),\n]);\nexport type TypingCadence = z.infer<typeof TypingCadenceSchema>;\n\nexport const TextScrambleConfigSchema = z.object({\n\tenabled: z.boolean().default(false),\n\tcharset: z\n\t\t.enum([\"ascii\", \"alphanumeric\", \"matrix\", \"binary\", \"hex\", \"custom\"])\n\t\t.default(\"alphanumeric\"),\n\tcustomCharset: z.string().optional(),\n\tscrambleFramesPerChar: z.number().int().min(1).default(8),\n\thighlightProbability: z.number().min(0).max(1).default(0.25),\n\tscrambleColor: z.string().optional(),\n});\nexport type TextScrambleConfig = z.infer<typeof TextScrambleConfigSchema>;\n\nexport const TypewriterAnimatorSchema = z.object({\n\tgranularity: z.enum([\"character\", \"word\", \"line\"]).default(\"character\"),\n\tcursor: TextCursorConfigSchema.default({\n\t\tenabled: true,\n\t\tstyle: \"bar\",\n\t\tcustomChar: \"|\",\n\t\tblinkFrequency: 2.0,\n\t\thideOnComplete: false,\n\t\twidth: 2.5,\n\t\tspacing: 3.0,\n\t}),\n\tcadence: TypingCadenceSchema.default({\n\t\tmode: \"human\",\n\t\tjitter: 0.35,\n\t\tcommaPauseMultiplier: 3.0,\n\t\tsentencePauseMultiplier: 5.5,\n\t\tparagraphPauseMultiplier: 7.0,\n\t}),\n\tscramble: TextScrambleConfigSchema.default({\n\t\tenabled: false,\n\t\tcharset: \"alphanumeric\",\n\t\tscrambleFramesPerChar: 8,\n\t\thighlightProbability: 0.25,\n\t}),\n\tsoundSync: z.boolean().default(false),\n});\nexport type TypewriterAnimator = z.infer<typeof TypewriterAnimatorSchema>;\n\n// ==============================================================================================\n// 3. AFTER EFFECTS PROCEDURAL SELECTORS\n// ==============================================================================================\n\nexport const SelectorBasedOnSchema = z.enum([\n\t\"characters\",\n\t\"characters_excluding_spaces\",\n\t\"words\",\n\t\"lines\",\n]);\nexport type SelectorBasedOn = z.infer<typeof SelectorBasedOnSchema>;\n\nexport const SelectorUnitsSchema = z.enum([\"percentage\", \"index\"]);\nexport type SelectorUnits = z.infer<typeof SelectorUnitsSchema>;\n\nexport const SelectorShapeSchema = z.enum([\n\t\"square\",\n\t\"ramp_up\",\n\t\"ramp_down\",\n\t\"triangle\",\n\t\"round\",\n\t\"smooth\",\n]);\nexport type SelectorShape = z.infer<typeof SelectorShapeSchema>;\n\nexport const SelectorModeSchema = z.enum([\n\t\"add\",\n\t\"subtract\",\n\t\"intersect\",\n\t\"min\",\n\t\"max\",\n\t\"difference\",\n]);\nexport type SelectorMode = z.infer<typeof SelectorModeSchema>;\n\nexport const TextRangeSelectorSchema = z.object({\n\ttype: z.literal(\"range\"),\n\tstart: z.number().default(0),\n\tend: z.number().default(1),\n\toffset: z.number().default(0),\n\tunits: SelectorUnitsSchema.default(\"percentage\"),\n\tbasedOn: SelectorBasedOnSchema.default(\"characters\"),\n\tshape: SelectorShapeSchema.default(\"square\"),\n\tmode: SelectorModeSchema.default(\"add\"),\n\tamount: z.number().min(-1).max(1).default(1),\n\teaseHigh: z.number().min(-1).max(1).default(0),\n\teaseLow: z.number().min(-1).max(1).default(0),\n\trandomizeOrder: z.boolean().default(false),\n\trandomSeed: z.number().int().default(12345),\n});\nexport type TextRangeSelector = z.infer<typeof TextRangeSelectorSchema>;\n\nexport const TextWigglySelectorSchema = z.object({\n\ttype: z.literal(\"wiggly\"),\n\twigglesPerSecond: z.number().positive().default(2.0),\n\tcorrelation: z.number().min(0).max(1).default(0.5),\n\ttemporalPhaseDeg: z.number().default(0),\n\tspatialPhaseDeg: z.number().default(0),\n\tminAmount: z.number().min(-1).max(1).default(-1.0),\n\tmaxAmount: z.number().min(-1).max(1).default(1.0),\n\trandomSeed: z.number().int().default(42),\n\tbasedOn: SelectorBasedOnSchema.default(\"characters\"),\n\tmode: SelectorModeSchema.default(\"intersect\"),\n});\nexport type TextWigglySelector = z.infer<typeof TextWigglySelectorSchema>;\n\nexport const TextSignalSelectorSchema = z.object({\n\ttype: z.literal(\"signal\"),\n\tsignalId: z.string(),\n\tmultiplier: z.number().default(1.0),\n\toffset: z.number().default(0.0),\n\tphaseSpread: z.number().default(0.0),\n\tbasedOn: SelectorBasedOnSchema.default(\"characters\"),\n\tmode: SelectorModeSchema.default(\"add\"),\n});\nexport type TextSignalSelector = z.infer<typeof TextSignalSelectorSchema>;\n\nexport const TextSelectorSchema = z.discriminatedUnion(\"type\", [\n\tTextRangeSelectorSchema,\n\tTextWigglySelectorSchema,\n\tTextSignalSelectorSchema,\n]);\nexport type TextSelector = z.infer<typeof TextSelectorSchema>;\n\n// ==============================================================================================\n// 4. ANIMATABLE GLYPH PROPERTIES (TRANSFORM PAYLOAD)\n// ==============================================================================================\n\nexport const AnimatableGlyphPropsSchema = z.object({\n\tx: z.number().optional(),\n\ty: z.number().optional(),\n\tz: z.number().optional(),\n\tscale: z.number().optional(),\n\tscaleX: z.number().optional(),\n\tscaleY: z.number().optional(),\n\trotation: z.number().optional(),\n\trotationX: z.number().optional(),\n\trotationY: z.number().optional(),\n\tskew: z.number().optional(),\n\tskewAxis: z.number().optional(),\n\ttracking: z.number().optional(),\n\tlineSpacing: z.number().optional(),\n\topacity: z.number().min(0).max(1).optional(),\n\tfillColor: z.string().optional(),\n\tstrokeColor: z.string().optional(),\n\tstrokeWidth: z.number().min(0).optional(),\n\tblur: z.number().min(0).optional(),\n\tcharacterOffset: z.number().int().optional(),\n});\nexport type AnimatableGlyphProps = z.infer<typeof AnimatableGlyphPropsSchema>;\n\nexport const GlyphAnchorGroupingSchema = z.enum([\n\t\"character\",\n\t\"word\",\n\t\"line\",\n\t\"all\",\n]);\nexport type GlyphAnchorGrouping = z.infer<typeof GlyphAnchorGroupingSchema>;\n\nexport const GlyphAnchorPointSchema = z.object({\n\tgrouping: GlyphAnchorGroupingSchema.default(\"character\"),\n\tanchorX: z.number().default(0.5),\n\tanchorY: z.number().default(0.8),\n});\nexport type GlyphAnchorPoint = z.infer<typeof GlyphAnchorPointSchema>;\n\nexport const AETextAnimatorSchema = z.object({\n\tname: z.string().default(\"Animator\"),\n\tselectors: z.array(TextSelectorSchema).min(1),\n\tprops: AnimatableGlyphPropsSchema,\n\tanchor: GlyphAnchorPointSchema.default({\n\t\tgrouping: \"character\",\n\t\tanchorX: 0.5,\n\t\tanchorY: 0.8,\n\t}),\n});\nexport type AETextAnimator = z.infer<typeof AETextAnimatorSchema>;\n\nexport const EnhancedTextNodeSchema = z.object({\n\ttext: z.string(),\n\tfontFamily: z.string().default(\"Inter\"),\n\tfontSize: z.number().positive().default(24),\n\tfontWeight: z.union([z.number(), z.string()]).default(400),\n\tfill: z.string().default(\"#ffffff\"),\n\tletterSpacing: z.number().default(0),\n\tlineHeight: z.number().positive().default(1.2),\n\ttextAlign: z.enum([\"left\", \"center\", \"right\"]).default(\"left\"),\n\tpathOptions: TextPathOptionsSchema.optional(),\n\ttypewriter: TypewriterAnimatorSchema.optional(),\n\tanimators: z.array(AETextAnimatorSchema).default([]),\n});\nexport type EnhancedTextNode = z.infer<typeof EnhancedTextNodeSchema>;\n","/**\n * @file packages/compositions/src/program/text-animations/builder.ts\n * Fluent builders for Path-Following Text and After Effects Text Animators.\n */\n\nimport {\n\ttype AETextAnimator,\n\tAETextAnimatorSchema,\n\ttype AnimatableGlyphProps,\n\ttype CubicBezierSegment,\n\ttype GlyphAnchorGrouping,\n\ttype GlyphAnchorPoint,\n\ttype SelectorBasedOn,\n\ttype SelectorMode,\n\ttype SelectorShape,\n\ttype TextPathOptions,\n\tTextPathOptionsSchema,\n\ttype TextSelector,\n} from \"./types.js\";\n\n/**\n * Fluent builder for creating Path-Following Text configurations.\n */\nexport class TextPathBuilder {\n\tprivate options: Partial<TextPathOptions> = {\n\t\tfirstMargin: 0,\n\t\tlastMargin: 0,\n\t\treversePath: false,\n\t\tperpendicularToPath: true,\n\t\tforceAlignment: false,\n\t\tloop: false,\n\t\tbaselineOffset: \"baseline\",\n\t\tbaselineShift: 0,\n\t};\n\n\tstatic fromSvg(svgPath: string): TextPathBuilder {\n\t\tconst builder = new TextPathBuilder();\n\t\tbuilder.options.path = { type: \"svg\", d: svgPath };\n\t\treturn builder;\n\t}\n\n\tstatic fromBezier(segments: CubicBezierSegment[]): TextPathBuilder {\n\t\tconst builder = new TextPathBuilder();\n\t\tbuilder.options.path = { type: \"bezier\", segments };\n\t\treturn builder;\n\t}\n\n\tstatic fromCurve(curve: CubicBezierSegment): TextPathBuilder {\n\t\treturn TextPathBuilder.fromBezier([curve]);\n\t}\n\n\tstatic circularBadge(\n\t\tcx: number,\n\t\tcy: number,\n\t\tradius: number,\n\t): TextPathBuilder {\n\t\tconst builder = new TextPathBuilder();\n\t\tbuilder.options.path = {\n\t\t\ttype: \"ellipse\",\n\t\t\tcx,\n\t\t\tcy,\n\t\t\trx: radius,\n\t\t\try: radius,\n\t\t\tstartAngleDeg: 0,\n\t\t\tendAngleDeg: 360,\n\t\t};\n\t\tbuilder.options.loop = true;\n\t\treturn builder;\n\t}\n\n\tstatic ellipse(\n\t\tcx: number,\n\t\tcy: number,\n\t\trx: number,\n\t\try: number,\n\t\tstartAngleDeg = 0,\n\t\tendAngleDeg = 360,\n\t): TextPathBuilder {\n\t\tconst builder = new TextPathBuilder();\n\t\tbuilder.options.path = {\n\t\t\ttype: \"ellipse\",\n\t\t\tcx,\n\t\t\tcy,\n\t\t\trx,\n\t\t\try,\n\t\t\tstartAngleDeg,\n\t\t\tendAngleDeg,\n\t\t};\n\t\tbuilder.options.loop = Math.abs(endAngleDeg - startAngleDeg) >= 360;\n\t\treturn builder;\n\t}\n\n\tstatic wave(\n\t\tstartX: number,\n\t\tstartY: number,\n\t\tlength: number,\n\t\tamplitude: number,\n\t\tfrequency: number,\n\t\tphaseDeg = 0,\n\t): TextPathBuilder {\n\t\tconst builder = new TextPathBuilder();\n\t\tbuilder.options.path = {\n\t\t\ttype: \"wave\",\n\t\t\tstartX,\n\t\t\tstartY,\n\t\t\tlength,\n\t\t\tamplitude,\n\t\t\tfrequency,\n\t\t\tphaseDeg,\n\t\t};\n\t\treturn builder;\n\t}\n\n\tfirstMargin(margin: number): this {\n\t\tthis.options.firstMargin = margin;\n\t\treturn this;\n\t}\n\n\tlastMargin(margin: number): this {\n\t\tthis.options.lastMargin = margin;\n\t\treturn this;\n\t}\n\n\treversePath(reverse: boolean): this {\n\t\tthis.options.reversePath = reverse;\n\t\treturn this;\n\t}\n\n\tperpendicularToPath(perpendicular: boolean): this {\n\t\tthis.options.perpendicularToPath = perpendicular;\n\t\treturn this;\n\t}\n\n\tforceAlignment(force: boolean): this {\n\t\tthis.options.forceAlignment = force;\n\t\treturn this;\n\t}\n\n\tloop(isLoop: boolean): this {\n\t\tthis.options.loop = isLoop;\n\t\treturn this;\n\t}\n\n\tbaselineOffset(\n\t\toffset: \"baseline\" | \"center\" | \"ascender\" | \"descender\",\n\t): this {\n\t\tthis.options.baselineOffset = offset;\n\t\treturn this;\n\t}\n\n\tbaselineShift(shiftPixels: number): this {\n\t\tthis.options.baselineShift = shiftPixels;\n\t\treturn this;\n\t}\n\n\tbuild(): TextPathOptions {\n\t\treturn TextPathOptionsSchema.parse(this.options);\n\t}\n}\n\n/**\n * Fluent builder for After Effects Range, Wiggly, and Signal Animators.\n */\nexport class TextAnimatorBuilder {\n\tprivate name = \"Animator\";\n\tprivate selectors: TextSelector[] = [];\n\tprivate props: AnimatableGlyphProps = {};\n\tprivate anchor: GlyphAnchorPoint = {\n\t\tgrouping: \"character\",\n\t\tanchorX: 0.5,\n\t\tanchorY: 0.8,\n\t};\n\n\tstatic create(name: string): TextAnimatorBuilder {\n\t\tconst builder = new TextAnimatorBuilder();\n\t\tbuilder.name = name;\n\t\treturn builder;\n\t}\n\n\t/** Adds an After Effects Range Selector */\n\taddRangeSelector(config: {\n\t\tstart?: number;\n\t\tend?: number;\n\t\toffset?: number;\n\t\tshape?: SelectorShape;\n\t\tbasedOn?: SelectorBasedOn;\n\t\tmode?: SelectorMode;\n\t\teaseHigh?: number;\n\t\teaseLow?: number;\n\t\trandomizeOrder?: boolean;\n\t\trandomSeed?: number;\n\t}): this {\n\t\tconst rawHigh = config.easeHigh ?? 0;\n\t\tconst easeHigh = Math.abs(rawHigh) > 1 ? rawHigh / 100 : rawHigh;\n\t\tconst rawLow = config.easeLow ?? 0;\n\t\tconst easeLow = Math.abs(rawLow) > 1 ? rawLow / 100 : rawLow;\n\n\t\tthis.selectors.push({\n\t\t\ttype: \"range\",\n\t\t\tstart: config.start ?? 0,\n\t\t\tend: config.end ?? 1,\n\t\t\toffset: config.offset ?? 0,\n\t\t\tunits: \"percentage\",\n\t\t\tbasedOn: config.basedOn ?? \"characters\",\n\t\t\tshape: config.shape ?? \"smooth\",\n\t\t\tmode: config.mode ?? \"add\",\n\t\t\tamount: 1,\n\t\t\teaseHigh: Math.max(-1, Math.min(1, easeHigh)),\n\t\t\teaseLow: Math.max(-1, Math.min(1, easeLow)),\n\t\t\trandomizeOrder: config.randomizeOrder ?? false,\n\t\t\trandomSeed: config.randomSeed ?? 12345,\n\t\t});\n\t\treturn this;\n\t}\n\n\t/** Adds an After Effects Wiggly Selector for procedural organic flutter */\n\taddWigglySelector(config: {\n\t\twigglesPerSecond?: number;\n\t\tcorrelation?: number;\n\t\tminAmount?: number;\n\t\tmaxAmount?: number;\n\t\trandomSeed?: number;\n\t\tmode?: SelectorMode;\n\t}): this {\n\t\tthis.selectors.push({\n\t\t\ttype: \"wiggly\",\n\t\t\twigglesPerSecond: config.wigglesPerSecond ?? 2.0,\n\t\t\tcorrelation: config.correlation ?? 0.5,\n\t\t\ttemporalPhaseDeg: 0,\n\t\t\tspatialPhaseDeg: 0,\n\t\t\tminAmount: config.minAmount ?? -1.0,\n\t\t\tmaxAmount: config.maxAmount ?? 1.0,\n\t\t\trandomSeed: config.randomSeed ?? 42,\n\t\t\tbasedOn: \"characters\",\n\t\t\tmode: config.mode ?? \"intersect\",\n\t\t});\n\t\treturn this;\n\t}\n\n\t/** Adds a reactive signal selector */\n\taddSignalSelector(\n\t\tsignalId: string,\n\t\tmultiplier = 1.0,\n\t\tphaseSpread = 0.0,\n\t\toffset = 0.0,\n\t\tmode: SelectorMode = \"add\",\n\t): this {\n\t\tthis.selectors.push({\n\t\t\ttype: \"signal\",\n\t\t\tsignalId,\n\t\t\tmultiplier,\n\t\t\toffset,\n\t\t\tphaseSpread,\n\t\t\tbasedOn: \"characters\",\n\t\t\tmode,\n\t\t});\n\t\treturn this;\n\t}\n\n\t// --- Animatable Target Properties ---\n\tx(pixels: number): this {\n\t\tthis.props.x = pixels;\n\t\treturn this;\n\t}\n\n\ty(pixels: number): this {\n\t\tthis.props.y = pixels;\n\t\treturn this;\n\t}\n\n\tz(pixels: number): this {\n\t\tthis.props.z = pixels;\n\t\treturn this;\n\t}\n\n\tscale(scaleValue: number): this {\n\t\tthis.props.scale = scaleValue;\n\t\treturn this;\n\t}\n\n\tscaleX(scaleValue: number): this {\n\t\tthis.props.scaleX = scaleValue;\n\t\treturn this;\n\t}\n\n\tscaleY(scaleValue: number): this {\n\t\tthis.props.scaleY = scaleValue;\n\t\treturn this;\n\t}\n\n\trotation(degrees: number): this {\n\t\tthis.props.rotation = degrees;\n\t\treturn this;\n\t}\n\n\trotationX(degrees: number): this {\n\t\tthis.props.rotationX = degrees;\n\t\treturn this;\n\t}\n\n\trotationY(degrees: number): this {\n\t\tthis.props.rotationY = degrees;\n\t\treturn this;\n\t}\n\n\tskew(degrees: number): this {\n\t\tthis.props.skew = degrees;\n\t\treturn this;\n\t}\n\n\tskewAxis(degrees: number): this {\n\t\tthis.props.skewAxis = degrees;\n\t\treturn this;\n\t}\n\n\topacity(value: number): this {\n\t\tthis.props.opacity = value;\n\t\treturn this;\n\t}\n\n\tblur(pixels: number): this {\n\t\tthis.props.blur = pixels;\n\t\treturn this;\n\t}\n\n\tfill(colorHex: string): this {\n\t\treturn this.fillColor(colorHex);\n\t}\n\n\tfillColor(colorHex: string): this {\n\t\tthis.props.fillColor = colorHex;\n\t\treturn this;\n\t}\n\n\tstrokeColor(colorHex: string): this {\n\t\tthis.props.strokeColor = colorHex;\n\t\treturn this;\n\t}\n\n\tstrokeWidth(pixels: number): this {\n\t\tthis.props.strokeWidth = pixels;\n\t\treturn this;\n\t}\n\n\ttracking(spacingPixels: number): this {\n\t\tthis.props.tracking = spacingPixels;\n\t\treturn this;\n\t}\n\n\tlineSpacing(spacingPixels: number): this {\n\t\tthis.props.lineSpacing = spacingPixels;\n\t\treturn this;\n\t}\n\n\tcharacterOffset(offset: number): this {\n\t\tthis.props.characterOffset = offset;\n\t\treturn this;\n\t}\n\n\tanchorGrouping(\n\t\tgrouping: GlyphAnchorGrouping,\n\t\tanchorX = 0.5,\n\t\tanchorY = 0.8,\n\t): this {\n\t\tthis.anchor = { grouping, anchorX, anchorY };\n\t\treturn this;\n\t}\n\n\tbuild(): AETextAnimator {\n\t\treturn AETextAnimatorSchema.parse({\n\t\t\tname: this.name,\n\t\t\tselectors: this.selectors,\n\t\t\tprops: this.props,\n\t\t\tanchor: this.anchor,\n\t\t});\n\t}\n}\n","/**\n * @file packages/compositions/src/program/text-animations/math.ts\n * Mathematical formulations, closed-form physics, affine matrices, and evaluation algorithms.\n */\n\nimport type {\n\tAudioSpectrumTypography,\n\tExpressionEvaluationContext,\n\tKineticMarqueeConfig,\n\tTextAnchorConfig,\n\tVolumetricFormationConfig,\n} from \"./advanced-types.js\";\n\n/**\n * Evaluates closed-form underdamped harmonic oscillator for spring physics:\n *\n * x(t) = target + (x0 - target) * exp(-zeta * omega_n * t) *\n * [ cos(omega_d * t) + (zeta / sqrt(1 - zeta^2)) * sin(omega_d * t) ]\n *\n * @param t Time in seconds since excitation\n * @param stiffness Spring stiffness (k)\n * @param damping Damping coefficient (c)\n * @param mass Mass of glyph (m)\n * @param initialVelocity Initial velocity (v0)\n * @returns Settled scalar progress in [0, 1] with overshoot\n */\nexport function evaluateSpringProgress(\n\tt: number,\n\tstiffness = 180,\n\tdamping = 12,\n\tmass = 1.0,\n\tinitialVelocity = 0,\n): number {\n\tif (t <= 0) return 0;\n\n\tconst omega_n = Math.sqrt(Math.max(1e-4, stiffness) / Math.max(1e-4, mass)); // Natural frequency\n\tconst zeta = damping / (2 * Math.sqrt(Math.max(1e-4, stiffness * mass))); // Damping ratio\n\n\tif (zeta < 1.0) {\n\t\t// Underdamped (oscillates and overshoots target)\n\t\tconst omega_d = omega_n * Math.sqrt(1.0 - zeta * zeta); // Damped frequency\n\t\tconst decay = Math.exp(-zeta * omega_n * t);\n\t\tconst c1 = -1.0;\n\t\tconst c2 =\n\t\t\t(initialVelocity - zeta * omega_n * -1.0) / Math.max(1e-6, omega_d);\n\t\tconst displacement =\n\t\t\tdecay * (c1 * Math.cos(omega_d * t) + c2 * Math.sin(omega_d * t));\n\t\treturn Math.min(2.0, Math.max(-1.0, 1.0 + displacement));\n\t} else if (Math.abs(zeta - 1.0) < 1e-4) {\n\t\t// Critically damped (fastest settle without overshoot)\n\t\tconst decay = Math.exp(-omega_n * t);\n\t\tconst displacement = (-1.0 + (initialVelocity - omega_n) * t) * decay;\n\t\treturn 1.0 + displacement;\n\t} else {\n\t\t// Overdamped\n\t\tconst s1 = -omega_n * (zeta - Math.sqrt(zeta * zeta - 1.0));\n\t\tconst s2 = -omega_n * (zeta + Math.sqrt(zeta * zeta - 1.0));\n\t\tconst c1 = (initialVelocity + s2) / Math.max(1e-6, s1 - s2);\n\t\tconst c2 = -1.0 - c1;\n\t\treturn 1.0 + (c1 * Math.exp(s1 * t) + c2 * Math.exp(s2 * t));\n\t}\n}\n\n/**\n * Evaluates 2D Directional Skew matrix components:\n *\n * S(theta, phi) = R(phi) * [ 1 tan(theta) ] * R(-phi)\n * [ 0 1 ]\n *\n * @param skewDeg Skew angle in degrees\n * @param skewAxisDeg Skew axis in degrees\n * @returns 2x2 affine shear matrix components [m00, m01, m10, m11]\n */\nexport function evaluateSkewMatrix(\n\tskewDeg: number,\n\tskewAxisDeg = 0,\n): [number, number, number, number] {\n\tif (skewDeg === 0) return [1, 0, 0, 1];\n\n\tconst theta = (skewDeg * Math.PI) / 180;\n\tconst phi = (skewAxisDeg * Math.PI) / 180;\n\n\tconst cosPhi = Math.cos(phi);\n\tconst sinPhi = Math.sin(phi);\n\tconst tanTheta = Math.tan(theta);\n\n\t// Multiplied rotation and shear matrices\n\tconst m00 = 1 - tanTheta * cosPhi * sinPhi;\n\tconst m01 = tanTheta * cosPhi * cosPhi;\n\tconst m10 = -tanTheta * sinPhi * sinPhi;\n\tconst m11 = 1 + tanTheta * sinPhi * cosPhi;\n\n\treturn [m00, m01, m10, m11];\n}\n\n/**\n * Computes anchor pivot coordinates relative to glyph bounding box:\n *\n * @param bbox Glyph bounding box { width, height, ascender, descender }\n * @param config Text anchor configuration\n * @returns Pivot offset (px, py) relative to glyph quad center\n */\nexport function computeAnchorPivotOffset(\n\tbbox: { width: number; height: number; ascender: number; descender: number },\n\tconfig: TextAnchorConfig,\n): { px: number; py: number } {\n\tlet normX = config.anchorX;\n\tlet normY = config.anchorY;\n\n\tswitch (config.preset) {\n\t\tcase \"center\":\n\t\t\tnormX = 0.5;\n\t\t\tnormY = 0.5;\n\t\t\tbreak;\n\t\tcase \"baseline\":\n\t\t\tnormX = 0.5;\n\t\t\tnormY = bbox.height > 0 ? bbox.ascender / bbox.height : 0.8;\n\t\t\tbreak;\n\t\tcase \"bottom_left\":\n\t\t\tnormX = 0.0;\n\t\t\tnormY = 1.0;\n\t\t\tbreak;\n\t\tcase \"bottom_center\":\n\t\t\tnormX = 0.5;\n\t\t\tnormY = 1.0;\n\t\t\tbreak;\n\t\tcase \"bottom_right\":\n\t\t\tnormX = 1.0;\n\t\t\tnormY = 1.0;\n\t\t\tbreak;\n\t\tcase \"top_left\":\n\t\t\tnormX = 0.0;\n\t\t\tnormY = 0.0;\n\t\t\tbreak;\n\t\tcase \"top_center\":\n\t\t\tnormX = 0.5;\n\t\t\tnormY = 0.0;\n\t\t\tbreak;\n\t\tcase \"top_right\":\n\t\t\tnormX = 1.0;\n\t\t\tnormY = 0.0;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tnormX = 0.5;\n\t\t\tnormY = 0.5;\n\t\t\tbreak;\n\t}\n\n\t// Offset relative to quad center (-0.5 to +0.5 of quad dimensions)\n\tconst px = (normX - 0.5) * bbox.width + config.offsetX;\n\tconst py = (normY - 0.5) * bbox.height + config.offsetY;\n\n\treturn { px, py };\n}\n\n/**\n * Computes leading displacement per line based on lineAnchor:\n *\n * @param lineIndex 0-based index of current line\n * @param lineCount Total lines in paragraph\n * @param lineSpacing Additional leading in pixels\n * @param lineAnchor Pivot line anchor in [0, 1]\n * @returns Y displacement in pixels\n */\nexport function computeLineLeadingDisplacement(\n\tlineIndex: number,\n\tlineCount: number,\n\tlineSpacing: number,\n\tlineAnchor = 0,\n): number {\n\tif (lineSpacing === 0 || lineCount <= 1) return 0;\n\tconst pivotIndex = lineAnchor * (lineCount - 1);\n\treturn (lineIndex - pivotIndex) * lineSpacing;\n}\n\n/**\n * Evaluates an Expression Selector formula safely in a sandboxed numeric scope.\n *\n * @param expression Formula string (e.g. \"Math.sin(time * 4 + textIndex * 0.2)\")\n * @param ctx Glyph evaluation context\n * @returns Numeric selector weight clamped to [-1, 1]\n */\nexport function evaluateExpressionSelector(\n\texpression: string,\n\tctx: ExpressionEvaluationContext,\n): number {\n\ttry {\n\t\tconst scope = {\n\t\t\ttextIndex: ctx.charIndex,\n\t\t\ttextTotal: Math.max(1, ctx.totalChars),\n\t\t\twordIndex: ctx.wordIndex,\n\t\t\twordTotal: Math.max(1, ctx.totalWords),\n\t\t\tlineIndex: ctx.lineIndex,\n\t\t\tlineTotal: Math.max(1, ctx.totalLines),\n\t\t\ttime: ctx.time,\n\t\t\tframe: ctx.frame,\n\t\t\tfps: ctx.fps,\n\t\t\tsin: Math.sin,\n\t\t\tcos: Math.cos,\n\t\t\ttan: Math.tan,\n\t\t\texp: Math.exp,\n\t\t\tlog: Math.log,\n\t\t\tabs: Math.abs,\n\t\t\tmin: Math.min,\n\t\t\tmax: Math.max,\n\t\t\tsqrt: Math.sqrt,\n\t\t\tpow: Math.pow,\n\t\t\tfloor: Math.floor,\n\t\t\tceil: Math.ceil,\n\t\t\tround: Math.round,\n\t\t\tPI: Math.PI,\n\t\t\tclamp: (v: number, lo: number, hi: number) =>\n\t\t\t\tMath.max(lo, Math.min(hi, v)),\n\t\t\tnoise: (seed: number) => {\n\t\t\t\tconst n = Math.sin(seed * 12.9898 + ctx.frame * 0.1) * 43758.5453;\n\t\t\t\treturn (n - Math.floor(n)) * 2 - 1;\n\t\t\t},\n\t\t\tsignals: ctx.signals ?? {},\n\t\t};\n\n\t\tconst keys = Object.keys(scope);\n\t\tconst values = Object.values(scope);\n\t\tconst fn = new Function(...keys, `return (${expression});`);\n\t\tconst result = Number(fn(...values));\n\n\t\treturn Number.isFinite(result) ? Math.max(-1, Math.min(1, result)) : 0;\n\t} catch {\n\t\treturn 0;\n\t}\n}\n\n/**\n * 3D Volumetric arrangement transformation output.\n */\nexport interface Volumetric3DTransform {\n\tx: number;\n\ty: number;\n\tz: number;\n\trotX: number;\n\trotY: number;\n\trotZ: number;\n\tscaleMult: number;\n\tdepthOpacity?: number;\n}\n\n/**\n * Evaluates 3D Volumetric Formation parametric coordinates.\n */\nexport function evaluateVolumetricFormation(\n\tglyphIndex: number,\n\ttotalGlyphs: number,\n\tconfig: VolumetricFormationConfig,\n): Volumetric3DTransform {\n\tconst n = Math.max(1, totalGlyphs);\n\tconst norm = n > 1 ? glyphIndex / (n - 1) : 0;\n\tconst totalAngleRad = (config.totalAngle * Math.PI) / 180;\n\tconst phi = norm * totalAngleRad;\n\n\tlet x = 0;\n\tlet y = 0;\n\tlet z = 0;\n\tlet rotX = 0;\n\tlet rotY = 0;\n\tlet rotZ = 0;\n\tlet depthOpacity = 1.0;\n\n\tswitch (config.mode) {\n\t\tcase \"cylinder\": {\n\t\t\t// Center arc around front-facing camera when totalAngle < 360; otherwise sweep full circle\n\t\t\tconst theta =\n\t\t\t\tconfig.totalAngle < 360 ? (norm - 0.5) * totalAngleRad : phi;\n\t\t\tif (config.axis === \"y\") {\n\t\t\t\tx = config.radius * Math.sin(theta);\n\t\t\t\tz = config.radius * Math.cos(theta) - config.radius;\n\t\t\t\trotY = (theta * 180) / Math.PI;\n\t\t\t} else if (config.axis === \"x\") {\n\t\t\t\ty = config.radius * Math.sin(theta);\n\t\t\t\tz = config.radius * Math.cos(theta) - config.radius;\n\t\t\t\trotX = (theta * 180) / Math.PI;\n\t\t\t} else {\n\t\t\t\tx = config.radius * Math.sin(theta);\n\t\t\t\ty = config.radius * Math.cos(theta);\n\t\t\t\trotZ = (theta * 180) / Math.PI;\n\t\t\t}\n\t\t\tconst facing = Math.cos(theta);\n\t\t\tdepthOpacity = Math.max(0.25, (facing + 1) * 0.5);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"vortex\": {\n\t\t\tconst startAngleRad = -Math.PI / 2; // Start upright at 12 o'clock\n\t\t\tconst spiralPhi = startAngleRad + phi;\n\t\t\t// Smooth radius decay from R down to 0.65 * R to keep inner characters cleanly separated\n\t\t\tconst r = config.radius * (1 - norm * 0.35);\n\t\t\tx = r * Math.cos(spiralPhi);\n\t\t\ty = r * Math.sin(spiralPhi);\n\t\t\tz = -glyphIndex * config.pitch || 0;\n\n\t\t\t// Exact analytical tangent orientation along spiral curve\n\t\t\tconst dr = (-0.35 * config.radius) / (totalAngleRad || 1);\n\t\t\tconst dx = dr * Math.cos(spiralPhi) - r * Math.sin(spiralPhi);\n\t\t\tconst dy = dr * Math.sin(spiralPhi) + r * Math.cos(spiralPhi);\n\t\t\trotZ = (Math.atan2(dy, dx) * 180) / Math.PI;\n\n\t\t\tdepthOpacity = Math.max(0.65, 1 - norm * 0.35);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"helix\": {\n\t\t\tif (config.axis === \"x\") {\n\t\t\t\t// Horizontal DNA ribbon advancing along reading axis X\n\t\t\t\tconst pitchX = config.pitch > 10 ? config.pitch : 28;\n\t\t\t\tx = (glyphIndex - (n - 1) / 2) * pitchX;\n\t\t\t\ty = config.radius * Math.sin(phi);\n\t\t\t\tz = config.radius * Math.cos(phi) - config.radius;\n\t\t\t\t// Subtle 3D wave tilt (max 22°) along surface normal\n\t\t\t\trotX = Math.sin(phi) * 22;\n\t\t\t\tconst facing = Math.cos(phi);\n\t\t\t\tdepthOpacity = 0.75 + 0.25 * ((facing + 1) * 0.5);\n\t\t\t} else {\n\t\t\t\t// Vertical helix advancing along Y\n\t\t\t\tconst theta = (norm - 0.5) * totalAngleRad;\n\t\t\t\tx = config.radius * Math.sin(theta);\n\t\t\t\ty = (glyphIndex - (n - 1) / 2) * config.pitch;\n\t\t\t\tz = config.radius * Math.cos(theta) - config.radius;\n\t\t\t\trotY = (theta * 180) / Math.PI;\n\t\t\t\tconst facing = Math.cos(theta);\n\t\t\t\tdepthOpacity = Math.max(0.65, (facing + 1) * 0.5);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tz = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst perspective = Math.max(100, config.perspective ?? 1200);\n\tconst depthDist = perspective - z;\n\tconst scaleMult = depthDist > 1 ? perspective / depthDist : 1;\n\n\treturn {\n\t\tx: x * scaleMult,\n\t\ty: y * scaleMult,\n\t\tz,\n\t\trotX,\n\t\trotY,\n\t\trotZ,\n\t\tscaleMult: Math.max(0.1, scaleMult),\n\t\tdepthOpacity,\n\t};\n}\n\n/**\n * Evaluates infinite kinetic marquee translation and snapping.\n */\nexport function evaluateMarqueeOffset(\n\tbaseX: number,\n\tcontainerWidth: number,\n\tcontentWidth: number,\n\tconfig: KineticMarqueeConfig,\n\telapsedSec: number,\n): number {\n\tconst effectiveWidth =\n\t\tcontainerWidth > 0 ? Math.max(containerWidth, contentWidth) : contentWidth;\n\tconst totalSpan = effectiveWidth + config.repeatGap;\n\tif (totalSpan <= 0) return baseX;\n\n\tlet travel = config.velocity * elapsedSec;\n\n\tif (config.snap?.enabled) {\n\t\tconst targetStop = config.snap.stopIndex ?? 0;\n\t\tconst snapUnit = config.snap.granularity === \"character\" ? 40 : 120;\n\t\tconst targetPos = targetStop * snapUnit;\n\t\tconst decelFactor = Math.min(1.0, elapsedSec * 1.5);\n\t\ttravel = travel * (1.0 - decelFactor) + targetPos * decelFactor;\n\t}\n\n\tif (config.direction === \"right\" || config.direction === \"down\") {\n\t\ttravel = -travel;\n\t}\n\n\tif (config.loop) {\n\t\tconst wrapped = (baseX - travel) % totalSpan;\n\t\treturn wrapped < -contentWidth ? wrapped + totalSpan : wrapped;\n\t}\n\n\treturn baseX - travel;\n}\n\n/**\n * Samples audio FFT frequency bin and computes scale factor for Audio Spectrum Typography.\n */\nexport function sampleAudioSpectrumScale(\n\tglyphIndex: number,\n\ttotalGlyphs: number,\n\tconfig: AudioSpectrumTypography,\n\tsignals: Record<string, unknown> | undefined,\n\tframe: number,\n\tfps: number,\n): number {\n\tconst n = Math.max(1, totalGlyphs);\n\tconst norm = n > 1 ? glyphIndex / (n - 1) : 0.5;\n\n\tconst minFreq = Math.max(20, config.minFreqHz);\n\tconst maxFreq = Math.max(minFreq + 100, config.maxFreqHz);\n\tconst targetFreq = minFreq * (maxFreq / minFreq) ** norm;\n\n\tlet magnitude = 0;\n\n\tif (signals) {\n\t\tconst sig = signals[config.signalChannel];\n\t\tif (typeof sig === \"number\") {\n\t\t\tmagnitude = sig;\n\t\t} else if (typeof sig === \"function\") {\n\t\t\tmagnitude = Number(sig(frame, fps, targetFreq)) || 0;\n\t\t} else if (typeof sig === \"object\" && sig !== null) {\n\t\t\tconst sObj = sig as Record<string, unknown>;\n\t\t\tif (typeof sObj.get === \"function\") {\n\t\t\t\tmagnitude =\n\t\t\t\t\tNumber(\n\t\t\t\t\t\t(sObj.get as (ctx: unknown) => unknown)({\n\t\t\t\t\t\t\tframe,\n\t\t\t\t\t\t\tfps,\n\t\t\t\t\t\t\tfreq: targetFreq,\n\t\t\t\t\t\t}),\n\t\t\t\t\t) || 0;\n\t\t\t} else if (\n\t\t\t\tArray.isArray(sObj.samples) ||\n\t\t\t\tArrayBuffer.isView(sObj.samples)\n\t\t\t) {\n\t\t\t\tconst arr = sObj.samples as ArrayLike<number>;\n\t\t\t\tconst binIdx = Math.floor(norm * (arr.length - 1));\n\t\t\t\tmagnitude = Number(arr[binIdx]) || 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst clampedMag = Math.max(0, Math.min(1, magnitude));\n\treturn config.minScale + clampedMag * (config.maxScale - config.minScale);\n}\n","/**\n * @file packages/compositions/src/program/text-animations/path.ts\n * Mathematical curve parameterization, Arc-Length LUTs, and path generators.\n */\n\nimport type { CubicBezierSegment, TextPathSource, Vec2 } from \"./types.js\";\n\nexport interface ArcLengthLUTEntry {\n\tdistance: number;\n\tt: number;\n}\n\nexport interface PathChainLUTEntry {\n\tdistance: number;\n\tsegmentIndex: number;\n\tt: number;\n}\n\nexport interface PathSegmentLUT {\n\tsegmentIndex: number;\n\tstartDistance: number;\n\tlength: number;\n\tlut: ArcLengthLUTEntry[];\n}\n\nexport interface PathChainLUT {\n\ttotalLength: number;\n\tentries: PathChainLUTEntry[];\n\tsegments?: PathSegmentLUT[];\n}\n\n/**\n * Evaluates a point on a cubic Bezier curve at parameter t in [0, 1].\n */\nexport function evaluateCubicBezier(\n\tsegment: CubicBezierSegment,\n\tt: number,\n): Vec2 {\n\tconst u = 1 - t;\n\tconst tt = t * t;\n\tconst uu = u * u;\n\tconst uuu = uu * u;\n\tconst ttt = tt * t;\n\n\treturn {\n\t\tx:\n\t\t\tuuu * segment.p0.x +\n\t\t\t3 * uu * t * segment.p1.x +\n\t\t\t3 * u * tt * segment.p2.x +\n\t\t\tttt * segment.p3.x,\n\t\ty:\n\t\t\tuuu * segment.p0.y +\n\t\t\t3 * uu * t * segment.p1.y +\n\t\t\t3 * u * tt * segment.p2.y +\n\t\t\tttt * segment.p3.y,\n\t};\n}\n\n/**\n * Evaluates the first derivative (tangent velocity vector) of a cubic Bezier curve at parameter t.\n */\nexport function evaluateCubicBezierDerivative(\n\tsegment: CubicBezierSegment,\n\tt: number,\n): Vec2 {\n\tconst u = 1 - t;\n\treturn {\n\t\tx:\n\t\t\t3 * u * u * (segment.p1.x - segment.p0.x) +\n\t\t\t6 * u * t * (segment.p2.x - segment.p1.x) +\n\t\t\t3 * t * t * (segment.p3.x - segment.p2.x),\n\t\ty:\n\t\t\t3 * u * u * (segment.p1.y - segment.p0.y) +\n\t\t\t6 * u * t * (segment.p2.y - segment.p1.y) +\n\t\t\t3 * t * t * (segment.p3.y - segment.p2.y),\n\t};\n}\n\n/**\n * Generates an arc-length parameterization lookup table (LUT) for a cubic Bezier segment.\n * Ensures glyphs travel with uniform speed and do not bunch up on tight curve bends.\n */\nexport function generateArcLengthLUT(\n\tsegment: CubicBezierSegment,\n\tsamples = 100,\n): { lut: ArcLengthLUTEntry[]; totalLength: number } {\n\tconst lut: ArcLengthLUTEntry[] = [{ distance: 0, t: 0 }];\n\tlet accumulatedDist = 0;\n\tlet prevPoint = segment.p0;\n\n\tfor (let i = 1; i <= samples; i++) {\n\t\tconst t = i / samples;\n\t\tconst currentPoint = evaluateCubicBezier(segment, t);\n\t\tconst dx = currentPoint.x - prevPoint.x;\n\t\tconst dy = currentPoint.y - prevPoint.y;\n\t\tconst dist = Math.hypot(dx, dy);\n\t\taccumulatedDist += dist;\n\t\tlut.push({ distance: accumulatedDist, t });\n\t\tprevPoint = currentPoint;\n\t}\n\n\treturn { lut, totalLength: accumulatedDist };\n}\n\n/**\n * Maps a distance along the curve (in pixels) to normalized curve parameter t via binary search on the LUT.\n */\nexport function distanceToCurveParameter(\n\tlut: ArcLengthLUTEntry[],\n\tdistance: number,\n\ttotalLength: number,\n): number {\n\tif (distance <= 0) return 0;\n\tif (distance >= totalLength) return 1;\n\n\tlet low = 0;\n\tlet high = lut.length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = (low + high) >> 1;\n\t\tif (lut[mid].distance < distance) {\n\t\t\tlow = mid + 1;\n\t\t} else {\n\t\t\thigh = mid - 1;\n\t\t}\n\t}\n\n\tconst index = Math.max(1, Math.min(low, lut.length - 1));\n\tconst prev = lut[index - 1];\n\tconst curr = lut[index];\n\tconst segmentDist = curr.distance - prev.distance;\n\n\tif (segmentDist <= 1e-6) return prev.t;\n\tconst ratio = (distance - prev.distance) / segmentDist;\n\treturn prev.t + ratio * (curr.t - prev.t);\n}\n\n/**\n * Samples position and baseline tangent orientation angle along a curve at distance `dist`.\n */\nexport function sampleCurveGeometry(\n\tsegment: CubicBezierSegment,\n\tlut: ArcLengthLUTEntry[],\n\ttotalLength: number,\n\tdistance: number,\n): { position: Vec2; tangentAngleDeg: number; normal: Vec2 } {\n\tconst t = distanceToCurveParameter(lut, distance, totalLength);\n\tconst pos = evaluateCubicBezier(segment, t);\n\tconst deriv = evaluateCubicBezierDerivative(segment, t);\n\tconst length = Math.hypot(deriv.x, deriv.y);\n\tconst nx = length > 1e-6 ? -deriv.y / length : 0;\n\tconst ny = length > 1e-6 ? deriv.x / length : 1;\n\tconst tangentAngleDeg = (Math.atan2(deriv.y, deriv.x) * 180) / Math.PI;\n\n\treturn {\n\t\tposition: pos,\n\t\ttangentAngleDeg,\n\t\tnormal: { x: nx, y: ny },\n\t};\n}\n\n/**\n * Builds a cumulative Arc-Length LUT across a chain of Cubic Bezier segments.\n */\nexport function buildPathLUT(\n\tsegments: CubicBezierSegment[],\n\tsamplesPerSegment = 50,\n): PathChainLUT {\n\tif (segments.length === 0) {\n\t\treturn {\n\t\t\ttotalLength: 0,\n\t\t\tentries: [{ distance: 0, segmentIndex: 0, t: 0 }],\n\t\t\tsegments: [],\n\t\t};\n\t}\n\n\tconst segLuts: PathSegmentLUT[] = [];\n\tconst entries: PathChainLUTEntry[] = [];\n\tlet accumulatedDist = 0;\n\n\tfor (let segIdx = 0; segIdx < segments.length; segIdx++) {\n\t\tconst seg = segments[segIdx];\n\t\tconst { lut: segLut, totalLength: segLength } = generateArcLengthLUT(\n\t\t\tseg,\n\t\t\tsamplesPerSegment,\n\t\t);\n\n\t\tsegLuts.push({\n\t\t\tsegmentIndex: segIdx,\n\t\t\tstartDistance: accumulatedDist,\n\t\t\tlength: segLength,\n\t\t\tlut: segLut,\n\t\t});\n\n\t\tfor (let i = 0; i < segLut.length; i++) {\n\t\t\tentries.push({\n\t\t\t\tdistance: accumulatedDist + segLut[i].distance,\n\t\t\t\tsegmentIndex: segIdx,\n\t\t\t\tt: segLut[i].t,\n\t\t\t});\n\t\t}\n\n\t\taccumulatedDist += segLength;\n\t}\n\n\treturn {\n\t\ttotalLength: accumulatedDist,\n\t\tentries,\n\t\tsegments: segLuts,\n\t};\n}\n\n/**\n * Samples position, tangent angle, and normal across a chain of Cubic Bezier segments.\n */\nexport function samplePathChainGeometry(\n\tsegments: CubicBezierSegment[],\n\tchainLUT: PathChainLUT,\n\tdistance: number,\n): { position: Vec2; tangentAngleDeg: number; normal: Vec2 } {\n\tif (segments.length === 0) {\n\t\treturn {\n\t\t\tposition: { x: 0, y: 0 },\n\t\t\ttangentAngleDeg: 0,\n\t\t\tnormal: { x: 0, y: 1 },\n\t\t};\n\t}\n\n\tconst totalLength = chainLUT.totalLength;\n\n\tif (distance <= 0) {\n\t\tconst seg = segments[0];\n\t\tconst deriv = evaluateCubicBezierDerivative(seg, 0);\n\t\tconst length = Math.hypot(deriv.x, deriv.y);\n\t\tconst ux = length > 1e-6 ? deriv.x / length : 1;\n\t\tconst uy = length > 1e-6 ? deriv.y / length : 0;\n\t\tconst pos = {\n\t\t\tx: seg.p0.x + ux * distance,\n\t\t\ty: seg.p0.y + uy * distance,\n\t\t};\n\t\tconst nx = length > 1e-6 ? -deriv.y / length : 0;\n\t\tconst ny = length > 1e-6 ? deriv.x / length : 1;\n\t\treturn {\n\t\t\tposition: pos,\n\t\t\ttangentAngleDeg: (Math.atan2(deriv.y, deriv.x) * 180) / Math.PI,\n\t\t\tnormal: { x: nx, y: ny },\n\t\t};\n\t}\n\n\tif (distance >= totalLength) {\n\t\tconst lastSeg = segments[segments.length - 1];\n\t\tconst deriv = evaluateCubicBezierDerivative(lastSeg, 1);\n\t\tconst length = Math.hypot(deriv.x, deriv.y);\n\t\tconst ux = length > 1e-6 ? deriv.x / length : 1;\n\t\tconst uy = length > 1e-6 ? deriv.y / length : 0;\n\t\tconst overflow = distance - totalLength;\n\t\tconst pos = {\n\t\t\tx: lastSeg.p3.x + ux * overflow,\n\t\t\ty: lastSeg.p3.y + uy * overflow,\n\t\t};\n\t\tconst nx = length > 1e-6 ? -deriv.y / length : 0;\n\t\tconst ny = length > 1e-6 ? deriv.x / length : 1;\n\t\treturn {\n\t\t\tposition: pos,\n\t\t\ttangentAngleDeg: (Math.atan2(deriv.y, deriv.x) * 180) / Math.PI,\n\t\t\tnormal: { x: nx, y: ny },\n\t\t};\n\t}\n\n\tlet segIdx = 0;\n\tlet t = 0;\n\n\tif (chainLUT.segments && chainLUT.segments.length > 0) {\n\t\tlet low = 0;\n\t\tlet high = chainLUT.segments.length - 1;\n\t\twhile (low <= high) {\n\t\t\tconst mid = (low + high) >> 1;\n\t\t\tconst segLUT = chainLUT.segments[mid];\n\t\t\tif (distance < segLUT.startDistance) {\n\t\t\t\thigh = mid - 1;\n\t\t\t} else if (distance > segLUT.startDistance + segLUT.length) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\tlow = mid;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tconst sIdx = Math.max(0, Math.min(low, chainLUT.segments.length - 1));\n\t\tconst segLUT = chainLUT.segments[sIdx];\n\t\tsegIdx = segLUT.segmentIndex;\n\t\tconst localDist = distance - segLUT.startDistance;\n\t\tt = distanceToCurveParameter(segLUT.lut, localDist, segLUT.length);\n\t} else {\n\t\tlet low = 0;\n\t\tlet high = chainLUT.entries.length - 1;\n\t\twhile (low <= high) {\n\t\t\tconst mid = (low + high) >> 1;\n\t\t\tif (chainLUT.entries[mid].distance < distance) {\n\t\t\t\tlow = mid + 1;\n\t\t\t} else {\n\t\t\t\thigh = mid - 1;\n\t\t\t}\n\t\t}\n\t\tconst index = Math.max(1, Math.min(low, chainLUT.entries.length - 1));\n\t\tconst prev = chainLUT.entries[index - 1];\n\t\tconst curr = chainLUT.entries[index];\n\t\tconst segmentDist = curr.distance - prev.distance;\n\t\tconst ratio =\n\t\t\tsegmentDist > 1e-6 ? (distance - prev.distance) / segmentDist : 0;\n\t\tsegIdx = curr.segmentIndex;\n\t\tt =\n\t\t\tprev.segmentIndex === curr.segmentIndex\n\t\t\t\t? prev.t + ratio * (curr.t - prev.t)\n\t\t\t\t: curr.t;\n\t}\n\n\tconst segment = segments[segIdx] ?? segments[0];\n\tconst pos = evaluateCubicBezier(segment, t);\n\tconst deriv = evaluateCubicBezierDerivative(segment, t);\n\tconst length = Math.hypot(deriv.x, deriv.y);\n\tconst nx = length > 1e-6 ? -deriv.y / length : 0;\n\tconst ny = length > 1e-6 ? deriv.x / length : 1;\n\tconst tangentAngleDeg = (Math.atan2(deriv.y, deriv.x) * 180) / Math.PI;\n\n\treturn {\n\t\tposition: pos,\n\t\ttangentAngleDeg,\n\t\tnormal: { x: nx, y: ny },\n\t};\n}\n\n/**\n * Converts an ellipse arc into cubic Bezier segments (up to 90 degrees per segment).\n */\nexport function ellipseToCubicBeziers(\n\tcx: number,\n\tcy: number,\n\trx: number,\n\try: number,\n\tstartAngleDeg = 0,\n\tendAngleDeg = 360,\n): CubicBezierSegment[] {\n\tconst startRad = (startAngleDeg * Math.PI) / 180;\n\tconst endRad = (endAngleDeg * Math.PI) / 180;\n\tconst totalSweep = endRad - startRad;\n\n\t// Keep sign, split into chunks of at most pi/2 (90 deg)\n\tconst numSegments = Math.max(\n\t\t1,\n\t\tMath.ceil(Math.abs(totalSweep) / (Math.PI / 2)),\n\t);\n\tconst sweepStep = totalSweep / numSegments;\n\tconst segments: CubicBezierSegment[] = [];\n\n\tfor (let i = 0; i < numSegments; i++) {\n\t\tconst a0 = startRad + i * sweepStep;\n\t\tconst a1 = a0 + sweepStep;\n\t\tconst halfSweep = sweepStep / 2;\n\t\t// Standard constant for cubic approximation of circular/elliptical arc\n\t\tconst k = (4 / 3) * Math.tan(halfSweep / 2);\n\n\t\tconst cos0 = Math.cos(a0);\n\t\tconst sin0 = Math.sin(a0);\n\t\tconst cos1 = Math.cos(a1);\n\t\tconst sin1 = Math.sin(a1);\n\n\t\tconst p0: Vec2 = { x: cx + rx * cos0, y: cy + ry * sin0 };\n\t\tconst p1: Vec2 = { x: p0.x - k * rx * sin0, y: p0.y + k * ry * cos0 };\n\t\tconst p3: Vec2 = { x: cx + rx * cos1, y: cy + ry * sin1 };\n\t\tconst p2: Vec2 = { x: p3.x + k * rx * sin1, y: p3.y - k * ry * cos1 };\n\n\t\tsegments.push({ p0, p1, p2, p3 });\n\t}\n\n\treturn segments;\n}\n\n/**\n * Converts a sinusoidal wave into cubic Bezier segments per half-cycle.\n */\nexport function waveToCubicBeziers(\n\tstartX: number,\n\tstartY: number,\n\tlength: number,\n\tamplitude: number,\n\tfrequency: number,\n\tphaseDeg = 0,\n): CubicBezierSegment[] {\n\tconst phaseRad = (phaseDeg * Math.PI) / 180;\n\tconst totalCycles =\n\t\tfrequency < 0.1 && frequency * length >= 0.25\n\t\t\t? frequency * length\n\t\t\t: Math.max(0.5, frequency);\n\tconst halfCycles = Math.max(1, Math.round(totalCycles * 2));\n\tconst dx = length / halfCycles;\n\tconst segments: CubicBezierSegment[] = [];\n\n\tfor (let i = 0; i < halfCycles; i++) {\n\t\tconst t0 = (i / halfCycles) * (2 * Math.PI * totalCycles) + phaseRad;\n\t\tconst t1 = ((i + 1) / halfCycles) * (2 * Math.PI * totalCycles) + phaseRad;\n\n\t\tconst x0 = startX + i * dx;\n\t\tconst x3 = startX + (i + 1) * dx;\n\t\tconst y0 = startY + amplitude * Math.sin(t0);\n\t\tconst y3 = startY + amplitude * Math.sin(t1);\n\n\t\tconst slope0 = amplitude * Math.cos(t0) * (Math.PI / 3);\n\t\tconst slope1 = amplitude * Math.cos(t1) * (Math.PI / 3);\n\n\t\tconst p0: Vec2 = { x: x0, y: y0 };\n\t\tconst p1: Vec2 = { x: x0 + dx / 3, y: y0 + slope0 };\n\t\tconst p2: Vec2 = { x: x3 - dx / 3, y: y3 - slope1 };\n\t\tconst p3: Vec2 = { x: x3, y: y3 };\n\n\t\tsegments.push({ p0, p1, p2, p3 });\n\t}\n\n\treturn segments;\n}\n\n/**\n * An SVG elliptical arc (endpoint form, SVG 1.1 F.6.5) as cubic Bezier\n * segments of at most 90° each.\n */\nexport function svgArcToCubicBeziers(\n\tx1: number,\n\ty1: number,\n\trxIn: number,\n\tryIn: number,\n\trotationDeg: number,\n\tlargeArc: boolean,\n\tsweep: boolean,\n\tx2: number,\n\ty2: number,\n): CubicBezierSegment[] {\n\tif (x1 === x2 && y1 === y2) return [];\n\tlet rx = Math.abs(rxIn);\n\tlet ry = Math.abs(ryIn);\n\tif (rx === 0 || ry === 0) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tp0: { x: x1, y: y1 },\n\t\t\t\tp1: { x: x1 + (x2 - x1) / 3, y: y1 + (y2 - y1) / 3 },\n\t\t\t\tp2: { x: x1 + (2 * (x2 - x1)) / 3, y: y1 + (2 * (y2 - y1)) / 3 },\n\t\t\t\tp3: { x: x2, y: y2 },\n\t\t\t},\n\t\t];\n\t}\n\tconst phi = (rotationDeg * Math.PI) / 180;\n\tconst cosPhi = Math.cos(phi);\n\tconst sinPhi = Math.sin(phi);\n\t// Step 1: the midpoint in the ellipse's own axes.\n\tconst dx = (x1 - x2) / 2;\n\tconst dy = (y1 - y2) / 2;\n\tconst x1p = cosPhi * dx + sinPhi * dy;\n\tconst y1p = -sinPhi * dx + cosPhi * dy;\n\t// Radii too small to reach the endpoint scale up (F.6.6).\n\tconst lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);\n\tif (lambda > 1) {\n\t\trx *= Math.sqrt(lambda);\n\t\try *= Math.sqrt(lambda);\n\t}\n\t// Step 2: the centre in the ellipse's axes, then in user space.\n\tconst num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;\n\tconst den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;\n\tconst coef = (largeArc !== sweep ? 1 : -1) * Math.sqrt(Math.max(0, num / den));\n\tconst cxp = (coef * rx * y1p) / ry;\n\tconst cyp = (-coef * ry * x1p) / rx;\n\tconst cx = cosPhi * cxp - sinPhi * cyp + (x1 + x2) / 2;\n\tconst cy = sinPhi * cxp + cosPhi * cyp + (y1 + y2) / 2;\n\t// Step 3: start angle and sweep.\n\tconst angle = (ux: number, uy: number, vx: number, vy: number) =>\n\t\tMath.atan2(ux * vy - uy * vx, ux * vx + uy * vy);\n\tconst theta1 = angle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);\n\tlet delta = angle(\n\t\t(x1p - cxp) / rx,\n\t\t(y1p - cyp) / ry,\n\t\t(-x1p - cxp) / rx,\n\t\t(-y1p - cyp) / ry,\n\t);\n\tif (!sweep && delta > 0) delta -= 2 * Math.PI;\n\tif (sweep && delta < 0) delta += 2 * Math.PI;\n\n\tconst n = Math.max(1, Math.ceil(Math.abs(delta) / (Math.PI / 2)));\n\tconst step = delta / n;\n\tconst k = (4 / 3) * Math.tan(step / 4);\n\tconst point = (a: number): Vec2 => ({\n\t\tx: cx + rx * Math.cos(a) * cosPhi - ry * Math.sin(a) * sinPhi,\n\t\ty: cy + rx * Math.cos(a) * sinPhi + ry * Math.sin(a) * cosPhi,\n\t});\n\tconst tangent = (a: number): Vec2 => ({\n\t\tx: -rx * Math.sin(a) * cosPhi - ry * Math.cos(a) * sinPhi,\n\t\ty: -rx * Math.sin(a) * sinPhi + ry * Math.cos(a) * cosPhi,\n\t});\n\tconst segments: CubicBezierSegment[] = [];\n\tfor (let s = 0; s < n; s++) {\n\t\tconst a0 = theta1 + s * step;\n\t\tconst a1 = a0 + step;\n\t\tconst p0 = point(a0);\n\t\tconst p3 = point(a1);\n\t\tconst t0 = tangent(a0);\n\t\tconst t1 = tangent(a1);\n\t\tsegments.push({\n\t\t\tp0,\n\t\t\tp1: { x: p0.x + k * t0.x, y: p0.y + k * t0.y },\n\t\t\tp2: { x: p3.x - k * t1.x, y: p3.y - k * t1.y },\n\t\t\tp3,\n\t\t});\n\t}\n\t// Land exactly on the endpoint the path asked for.\n\tsegments[segments.length - 1]!.p3 = { x: x2, y: y2 };\n\treturn segments;\n}\n\n/**\n * Converts SVG path data string into a chain of Cubic Bezier segments.\n */\nexport function parseSvgPathToCubicBeziers(d: string): CubicBezierSegment[] {\n\tconst segments: CubicBezierSegment[] = [];\n\tconst tokens = d.match(/[a-df-z]|[-+]?(?:\\d*\\.\\d+|\\d+)(?:[eE][-+]?\\d+)?/gi);\n\tif (!tokens || tokens.length === 0) return segments;\n\n\tlet currentX = 0;\n\tlet currentY = 0;\n\tlet startX = 0;\n\tlet startY = 0;\n\tlet lastControlX = 0;\n\tlet lastControlY = 0;\n\tlet lastCommand = \"\";\n\n\tlet i = 0;\n\tconst nextNum = (): number => {\n\t\tif (i >= tokens.length) return 0;\n\t\treturn Number.parseFloat(tokens[i++]);\n\t};\n\n\twhile (i < tokens.length) {\n\t\tconst token = tokens[i++];\n\t\tconst isCommand = /^[a-df-z]$/i.test(token);\n\t\tconst cmd = isCommand ? token : lastCommand;\n\t\tif (!isCommand) i--; // put number back if repeated coords\n\n\t\tswitch (cmd) {\n\t\t\tcase \"M\": {\n\t\t\t\tcurrentX = nextNum();\n\t\t\t\tcurrentY = nextNum();\n\t\t\t\tstartX = currentX;\n\t\t\t\tstartY = currentY;\n\t\t\t\tlastCommand = \"L\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"m\": {\n\t\t\t\tcurrentX += nextNum();\n\t\t\t\tcurrentY += nextNum();\n\t\t\t\tstartX = currentX;\n\t\t\t\tstartY = currentY;\n\t\t\t\tlastCommand = \"l\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"L\": {\n\t\t\t\tconst x = nextNum();\n\t\t\t\tconst y = nextNum();\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: {\n\t\t\t\t\t\tx: currentX + (x - currentX) / 3,\n\t\t\t\t\t\ty: currentY + (y - currentY) / 3,\n\t\t\t\t\t},\n\t\t\t\t\tp2: {\n\t\t\t\t\t\tx: currentX + (2 * (x - currentX)) / 3,\n\t\t\t\t\t\ty: currentY + (2 * (y - currentY)) / 3,\n\t\t\t\t\t},\n\t\t\t\t\tp3: { x, y },\n\t\t\t\t});\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"L\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"l\": {\n\t\t\t\tconst dx = nextNum();\n\t\t\t\tconst dy = nextNum();\n\t\t\t\tconst x = currentX + dx;\n\t\t\t\tconst y = currentY + dy;\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: currentX + dx / 3, y: currentY + dy / 3 },\n\t\t\t\t\tp2: { x: currentX + (2 * dx) / 3, y: currentY + (2 * dy) / 3 },\n\t\t\t\t\tp3: { x, y },\n\t\t\t\t});\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"l\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"H\": {\n\t\t\t\tconst x = nextNum();\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: currentX + (x - currentX) / 3, y: currentY },\n\t\t\t\t\tp2: { x: currentX + (2 * (x - currentX)) / 3, y: currentY },\n\t\t\t\t\tp3: { x, y: currentY },\n\t\t\t\t});\n\t\t\t\tcurrentX = x;\n\t\t\t\tlastCommand = \"H\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"h\": {\n\t\t\t\tconst dx = nextNum();\n\t\t\t\tconst x = currentX + dx;\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: currentX + dx / 3, y: currentY },\n\t\t\t\t\tp2: { x: currentX + (2 * dx) / 3, y: currentY },\n\t\t\t\t\tp3: { x, y: currentY },\n\t\t\t\t});\n\t\t\t\tcurrentX = x;\n\t\t\t\tlastCommand = \"h\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"V\": {\n\t\t\t\tconst y = nextNum();\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: currentX, y: currentY + (y - currentY) / 3 },\n\t\t\t\t\tp2: { x: currentX, y: currentY + (2 * (y - currentY)) / 3 },\n\t\t\t\t\tp3: { x: currentX, y },\n\t\t\t\t});\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"V\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"v\": {\n\t\t\t\tconst dy = nextNum();\n\t\t\t\tconst y = currentY + dy;\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: currentX, y: currentY + dy / 3 },\n\t\t\t\t\tp2: { x: currentX, y: currentY + (2 * dy) / 3 },\n\t\t\t\t\tp3: { x: currentX, y },\n\t\t\t\t});\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"v\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"C\": {\n\t\t\t\tconst x1 = nextNum();\n\t\t\t\tconst y1 = nextNum();\n\t\t\t\tconst x2 = nextNum();\n\t\t\t\tconst y2 = nextNum();\n\t\t\t\tconst x = nextNum();\n\t\t\t\tconst y = nextNum();\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: x1, y: y1 },\n\t\t\t\t\tp2: { x: x2, y: y2 },\n\t\t\t\t\tp3: { x, y },\n\t\t\t\t});\n\t\t\t\tlastControlX = x2;\n\t\t\t\tlastControlY = y2;\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"C\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"c\": {\n\t\t\t\tconst dx1 = nextNum();\n\t\t\t\tconst dy1 = nextNum();\n\t\t\t\tconst dx2 = nextNum();\n\t\t\t\tconst dy2 = nextNum();\n\t\t\t\tconst dx = nextNum();\n\t\t\t\tconst dy = nextNum();\n\t\t\t\tconst x1 = currentX + dx1;\n\t\t\t\tconst y1 = currentY + dy1;\n\t\t\t\tconst x2 = currentX + dx2;\n\t\t\t\tconst y2 = currentY + dy2;\n\t\t\t\tconst x = currentX + dx;\n\t\t\t\tconst y = currentY + dy;\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: x1, y: y1 },\n\t\t\t\t\tp2: { x: x2, y: y2 },\n\t\t\t\t\tp3: { x, y },\n\t\t\t\t});\n\t\t\t\tlastControlX = x2;\n\t\t\t\tlastControlY = y2;\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = \"c\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"S\":\n\t\t\tcase \"s\": {\n\t\t\t\tconst isRel = cmd === \"s\";\n\t\t\t\tconst dx2 = nextNum();\n\t\t\t\tconst dy2 = nextNum();\n\t\t\t\tconst dx = nextNum();\n\t\t\t\tconst dy = nextNum();\n\t\t\t\tconst x2 = isRel ? currentX + dx2 : dx2;\n\t\t\t\tconst y2 = isRel ? currentY + dy2 : dy2;\n\t\t\t\tconst x = isRel ? currentX + dx : dx;\n\t\t\t\tconst y = isRel ? currentY + dy : dy;\n\n\t\t\t\t// Reflect last control point if previous was C/c/S/s\n\t\t\t\tlet x1 = currentX;\n\t\t\t\tlet y1 = currentY;\n\t\t\t\tif (/^[cs]$/i.test(lastCommand)) {\n\t\t\t\t\tx1 = 2 * currentX - lastControlX;\n\t\t\t\t\ty1 = 2 * currentY - lastControlY;\n\t\t\t\t}\n\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: x1, y: y1 },\n\t\t\t\t\tp2: { x: x2, y: y2 },\n\t\t\t\t\tp3: { x, y },\n\t\t\t\t});\n\t\t\t\tlastControlX = x2;\n\t\t\t\tlastControlY = y2;\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastCommand = cmd;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"Q\":\n\t\t\tcase \"q\": {\n\t\t\t\tconst isRel = cmd === \"q\";\n\t\t\t\tconst qx = nextNum();\n\t\t\t\tconst qy = nextNum();\n\t\t\t\tconst x = nextNum();\n\t\t\t\tconst y = nextNum();\n\t\t\t\tconst cx1 = isRel ? currentX + qx : qx;\n\t\t\t\tconst cy1 = isRel ? currentY + qy : qy;\n\t\t\t\tconst ex = isRel ? currentX + x : x;\n\t\t\t\tconst ey = isRel ? currentY + y : y;\n\n\t\t\t\t// Quadratic to cubic conversion\n\t\t\t\tconst p1x = currentX + (2 / 3) * (cx1 - currentX);\n\t\t\t\tconst p1y = currentY + (2 / 3) * (cy1 - currentY);\n\t\t\t\tconst p2x = ex + (2 / 3) * (cx1 - ex);\n\t\t\t\tconst p2y = ey + (2 / 3) * (cy1 - ey);\n\n\t\t\t\tsegments.push({\n\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\tp1: { x: p1x, y: p1y },\n\t\t\t\t\tp2: { x: p2x, y: p2y },\n\t\t\t\t\tp3: { x: ex, y: ey },\n\t\t\t\t});\n\t\t\t\tlastControlX = cx1;\n\t\t\t\tlastControlY = cy1;\n\t\t\t\tcurrentX = ex;\n\t\t\t\tcurrentY = ey;\n\t\t\t\tlastCommand = cmd;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"A\":\n\t\t\tcase \"a\": {\n\t\t\t\tconst rx = nextNum();\n\t\t\t\tconst ry = nextNum();\n\t\t\t\tconst rotation = nextNum();\n\t\t\t\tconst largeArc = nextNum() !== 0;\n\t\t\t\tconst sweep = nextNum() !== 0;\n\t\t\t\tlet x = nextNum();\n\t\t\t\tlet y = nextNum();\n\t\t\t\tif (cmd === \"a\") {\n\t\t\t\t\tx += currentX;\n\t\t\t\t\ty += currentY;\n\t\t\t\t}\n\t\t\t\tsegments.push(\n\t\t\t\t\t...svgArcToCubicBeziers(currentX, currentY, rx, ry, rotation, largeArc, sweep, x, y),\n\t\t\t\t);\n\t\t\t\tcurrentX = x;\n\t\t\t\tcurrentY = y;\n\t\t\t\tlastControlX = x;\n\t\t\t\tlastControlY = y;\n\t\t\t\tlastCommand = cmd;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"Z\":\n\t\t\tcase \"z\": {\n\t\t\t\tif (currentX !== startX || currentY !== startY) {\n\t\t\t\t\tsegments.push({\n\t\t\t\t\t\tp0: { x: currentX, y: currentY },\n\t\t\t\t\t\tp1: {\n\t\t\t\t\t\t\tx: currentX + (startX - currentX) / 3,\n\t\t\t\t\t\t\ty: currentY + (startY - currentY) / 3,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tp2: {\n\t\t\t\t\t\t\tx: currentX + (2 * (startX - currentX)) / 3,\n\t\t\t\t\t\t\ty: currentY + (2 * (startY - currentY)) / 3,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tp3: { x: startX, y: startY },\n\t\t\t\t\t});\n\t\t\t\t\tcurrentX = startX;\n\t\t\t\t\tcurrentY = startY;\n\t\t\t\t}\n\t\t\t\tlastCommand = cmd;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn segments;\n}\n\n/**\n * Universal path source converter to Cubic Bezier segments.\n */\nexport function generatePathSegments(\n\tsource: TextPathSource,\n): CubicBezierSegment[] {\n\tswitch (source.type) {\n\t\tcase \"bezier\":\n\t\t\treturn source.segments;\n\t\tcase \"svg\":\n\t\t\treturn parseSvgPathToCubicBeziers(source.d);\n\t\tcase \"ellipse\":\n\t\t\treturn ellipseToCubicBeziers(\n\t\t\t\tsource.cx,\n\t\t\t\tsource.cy,\n\t\t\t\tsource.rx,\n\t\t\t\tsource.ry,\n\t\t\t\tsource.startAngleDeg ?? 0,\n\t\t\t\tsource.endAngleDeg ?? 360,\n\t\t\t);\n\t\tcase \"wave\":\n\t\t\treturn waveToCubicBeziers(\n\t\t\t\tsource.startX,\n\t\t\t\tsource.startY,\n\t\t\t\tsource.length,\n\t\t\t\tsource.amplitude,\n\t\t\t\tsource.frequency,\n\t\t\t\tsource.phaseDeg ?? 0,\n\t\t\t);\n\t}\n}\n","/**\n * @file packages/compositions/src/program/text-animations/selectors.ts\n * After Effects Range, Wiggly, and Signal selector weight evaluators.\n */\n\nimport type { SelectorMode, SelectorShape } from \"./types.js\";\n\n/**\n * Computes After Effects Range Selector weight for a single glyph index.\n *\n * @param index Normalized position of the glyph in the string (0.0 to 1.0)\n * @param start Start boundary (0.0 to 1.0)\n * @param end End boundary (0.0 to 1.0)\n * @param offset Window shift (-1.0 to 1.0)\n * @param shape Falloff curve\n * @param easeHigh Non-linear easing for high values\n * @param easeLow Non-linear easing for low values\n * @returns Weight in [0.0, 1.0]\n */\nexport function computeRangeSelectorWeight(\n\tindex: number,\n\tstart: number,\n\tend: number,\n\toffset: number,\n\tshape: SelectorShape,\n\teaseHigh = 0,\n\teaseLow = 0,\n): number {\n\tconst effStart = start + offset;\n\tconst effEnd = end + offset;\n\n\tif (effEnd <= effStart) return 0;\n\n\tconst relativePos = (index - effStart) / (effEnd - effStart);\n\n\tlet baseWeight = 0;\n\tswitch (shape) {\n\t\tcase \"square\":\n\t\t\tbaseWeight = relativePos >= 0 && relativePos <= 1 ? 1 : 0;\n\t\t\tbreak;\n\t\tcase \"ramp_up\":\n\t\t\tbaseWeight = Math.max(0, Math.min(1, relativePos));\n\t\t\tbreak;\n\t\tcase \"ramp_down\":\n\t\t\tbaseWeight = 1 - Math.max(0, Math.min(1, relativePos));\n\t\t\tbreak;\n\t\tcase \"triangle\": {\n\t\t\tif (relativePos < 0 || relativePos > 1) {\n\t\t\t\tbaseWeight = 0;\n\t\t\t} else if (relativePos < 0.5) {\n\t\t\t\tbaseWeight = relativePos * 2;\n\t\t\t} else {\n\t\t\t\tbaseWeight = (1 - relativePos) * 2;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"round\": {\n\t\t\t// Half-cosine bell curve\n\t\t\tif (relativePos < 0 || relativePos > 1) {\n\t\t\t\tbaseWeight = 0;\n\t\t\t} else {\n\t\t\t\tbaseWeight = 0.5 - 0.5 * Math.cos(relativePos * 2 * Math.PI);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"smooth\": {\n\t\t\t// Hermite smoothstep S-curve\n\t\t\tif (relativePos <= 0) baseWeight = 0;\n\t\t\telse if (relativePos >= 1) baseWeight = 1;\n\t\t\telse baseWeight = relativePos * relativePos * (3 - 2 * relativePos);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Apply Ease High / Ease Low non-linear power shaping\n\tif (baseWeight > 0 && baseWeight < 1) {\n\t\tif (easeHigh !== 0 && baseWeight > 0.5) {\n\t\t\tconst norm = (baseWeight - 0.5) * 2;\n\t\t\tconst power = easeHigh > 0 ? 1 + easeHigh * 3 : 1 / (1 - easeHigh * 3);\n\t\t\tbaseWeight = 0.5 + 0.5 * norm ** power;\n\t\t}\n\t\tif (easeLow !== 0 && baseWeight <= 0.5) {\n\t\t\tconst norm = baseWeight * 2;\n\t\t\tconst power = easeLow > 0 ? 1 + easeLow * 3 : 1 / (1 - easeLow * 3);\n\t\t\tbaseWeight = 0.5 * norm ** power;\n\t\t}\n\t}\n\n\treturn Math.max(0, Math.min(1, baseWeight));\n}\n\n/**\n * 1D Gradient deterministic hash noise for Wiggly Selectors.\n */\nexport function deterministicWigglyNoise(\n\tseed: number,\n\tglyphIndex: number,\n\tphase: number,\n\tcorrelation: number,\n): number {\n\tconst coord =\n\t\t(glyphIndex * (1 - correlation) + correlation) * 12.9898 +\n\t\tphase +\n\t\tseed * 78.233;\n\tconst raw = Math.sin(coord) * 43758.5453;\n\treturn (raw - Math.floor(raw)) * 2 - 1; // Range [-1.0, 1.0]\n}\n\n/**\n * Deterministic pseudo-random number generator for seeded order shuffling.\n */\nexport function getShuffledOrder(count: number, seed: number): number[] {\n\tlet s = seed;\n\tconst nextRand = () => {\n\t\ts = (s * 9301 + 49297) % 233280;\n\t\treturn s / 233280;\n\t};\n\n\tconst arr = Array.from({ length: count }, (_, i) => i);\n\tfor (let i = arr.length - 1; i > 0; i--) {\n\t\tconst j = Math.floor(nextRand() * (i + 1));\n\t\tconst temp = arr[i];\n\t\tarr[i] = arr[j];\n\t\tarr[j] = temp;\n\t}\n\treturn arr;\n}\n\n/**\n * Combines consecutive selector weights using After Effects Selector Mode logic.\n */\nexport function evaluateSelectorCombination(\n\tprevWeight: number,\n\tcurrWeight: number,\n\tmode: SelectorMode,\n): number {\n\tswitch (mode) {\n\t\tcase \"add\":\n\t\t\treturn Math.max(0, Math.min(1, prevWeight + currWeight));\n\t\tcase \"subtract\":\n\t\t\treturn Math.max(0, Math.min(1, prevWeight - currWeight));\n\t\tcase \"intersect\":\n\t\t\treturn prevWeight * currWeight;\n\t\tcase \"min\":\n\t\t\treturn Math.min(prevWeight, currWeight);\n\t\tcase \"max\":\n\t\t\treturn Math.max(prevWeight, currWeight);\n\t\tcase \"difference\":\n\t\t\treturn Math.abs(prevWeight - currWeight);\n\t}\n}\n","/**\n * @file packages/compositions/src/program/text-animations/typewriter.ts\n * Realistic human cadence typewriter simulation, matrix scramble cipher, and blinking cursor.\n */\n\nimport type { TextScrambleConfig, TypingCadence } from \"./types.js\";\n\nconst SCRAMBLE_POOLS: Record<string, string> = {\n\tascii: \"!@#$%^&*()_+{}[]:;<>,.?\",\n\talphanumeric: \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\",\n\tmatrix: \"010101<>[]{}+=*~#%&!?/\\\\:;|X0123456789\",\n\tbinary: \"01\",\n\thex: \"0123456789ABCDEF\",\n};\n\nexport function getScramblePool(\n\tcharset: string,\n\tcustomCharset?: string,\n): string {\n\tif (charset === \"custom\" && customCharset && customCharset.length > 0) {\n\t\treturn customCharset;\n\t}\n\treturn SCRAMBLE_POOLS[charset] ?? SCRAMBLE_POOLS.alphanumeric;\n}\n\n/**\n * Evaluates typewriter visible character count and scramble state for frame `currentFrame`.\n */\nexport function evaluateTypewriterState(\n\tfullText: string,\n\tcurrentFrame: number,\n\tstartFrame: number,\n\tdurationFrames: number,\n\tcadence: TypingCadence = {\n\t\tmode: \"human\",\n\t\tjitter: 0.35,\n\t\tcommaPauseMultiplier: 3.0,\n\t\tsentencePauseMultiplier: 5.5,\n\t\tparagraphPauseMultiplier: 7.0,\n\t},\n\tscramble: TextScrambleConfig = {\n\t\tenabled: false,\n\t\tcharset: \"alphanumeric\",\n\t\tscrambleFramesPerChar: 8,\n\t\thighlightProbability: 0.25,\n\t},\n\tblinkFrequency = 2.0,\n\tgranularity: \"character\" | \"word\" | \"line\" = \"character\",\n\tprogressOverride?: number,\n): {\n\tvisibleChars: number;\n\tcurrentDisplayString: string;\n\tisCursorVisible: boolean;\n} {\n\tif (progressOverride === undefined && currentFrame < startFrame) {\n\t\treturn {\n\t\t\tvisibleChars: 0,\n\t\t\tcurrentDisplayString: \"\",\n\t\t\tisCursorVisible: false,\n\t\t};\n\t}\n\n\tconst progress =\n\t\tprogressOverride !== undefined\n\t\t\t? Math.max(0, Math.min(1, progressOverride))\n\t\t\t: Math.min(1, (currentFrame - startFrame) / Math.max(1, durationFrames));\n\tconst elapsed =\n\t\tprogressOverride !== undefined\n\t\t\t? progress * durationFrames\n\t\t\t: currentFrame - startFrame;\n\tconst totalChars = fullText.length;\n\n\tlet visibleCount = Math.floor(progress * totalChars);\n\n\tif (granularity === \"word\") {\n\t\tconst tokens = fullText.split(/(\\s+)/);\n\t\tconst wordIndices: number[] = [];\n\t\ttokens.forEach((t, i) => {\n\t\t\tif (t.trim().length > 0) wordIndices.push(i);\n\t\t});\n\t\tconst visibleWords = Math.min(\n\t\t\twordIndices.length,\n\t\t\tMath.floor(progress * (wordIndices.length + 1)),\n\t\t);\n\t\tif (visibleWords <= 0) {\n\t\t\tvisibleCount = 0;\n\t\t} else {\n\t\t\tconst lastIdx =\n\t\t\t\twordIndices[Math.min(wordIndices.length - 1, visibleWords - 1)];\n\t\t\tvisibleCount = tokens.slice(0, lastIdx + 1).join(\"\").length;\n\t\t}\n\t} else if (granularity === \"line\") {\n\t\tconst lines = fullText.split(\"\\n\");\n\t\tconst visibleLines = Math.min(\n\t\t\tlines.length,\n\t\t\tMath.floor(progress * (lines.length + 1)),\n\t\t);\n\t\tvisibleCount = lines.slice(0, visibleLines).join(\"\\n\").length;\n\t} else if (cadence.mode === \"human\" && progress < 1) {\n\t\t// Apply punctuation cadence delays if human mode is enabled\n\t\tlet simulatedCharIndex = 0;\n\t\tlet simulatedElapsed = 0;\n\t\tconst baseFramesPerChar = durationFrames / Math.max(1, totalChars);\n\n\t\tfor (let i = 0; i < totalChars; i++) {\n\t\t\tconst char = fullText[i];\n\t\t\tlet multiplier = 1.0;\n\t\t\tconst commaMult = cadence.commaPauseMultiplier ?? 3.0;\n\t\t\tconst sentenceMult = cadence.sentencePauseMultiplier ?? 5.5;\n\t\t\tconst paraMult = cadence.paragraphPauseMultiplier ?? 7.0;\n\t\t\tconst jitter = cadence.jitter ?? 0.35;\n\n\t\t\tif (char === \",\" || char === \";\") multiplier = commaMult;\n\t\t\telse if (char === \".\" || char === \"!\" || char === \"?\")\n\t\t\t\tmultiplier = sentenceMult;\n\t\t\telse if (char === \"\\n\") multiplier = paraMult;\n\n\t\t\t// Add small deterministic jitter\n\t\t\tconst jitterVal = 1 + Math.sin(i * 17.3 + 42) * 0.5 * jitter;\n\t\t\tconst charDuration = baseFramesPerChar * multiplier * jitterVal;\n\n\t\t\tsimulatedElapsed += charDuration;\n\t\t\tif (simulatedElapsed <= elapsed) {\n\t\t\t\tsimulatedCharIndex = i + 1;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvisibleCount = Math.min(totalChars, simulatedCharIndex);\n\t}\n\n\tlet displayStr = fullText.slice(0, visibleCount);\n\n\t// Scramble pool substitution on the trailing edge of typed characters\n\tif (scramble.enabled && visibleCount < totalChars && visibleCount > 0) {\n\t\tconst pool = getScramblePool(scramble.charset, scramble.customCharset);\n\t\tconst trailCount = Math.min(\n\t\t\tvisibleCount,\n\t\t\tMath.max(1, scramble.scrambleFramesPerChar > 4 ? 3 : 2),\n\t\t);\n\t\tlet scrambledTail = \"\";\n\t\tfor (let t = 0; t < trailCount; t++) {\n\t\t\tconst idx =\n\t\t\t\tMath.floor(\n\t\t\t\t\tMath.abs(Math.sin(currentFrame * 7 + t * 13)) * pool.length,\n\t\t\t\t) % pool.length;\n\t\t\tscrambledTail += pool[idx];\n\t\t}\n\t\tdisplayStr =\n\t\t\tdisplayStr.slice(0, displayStr.length - trailCount) + scrambledTail;\n\t}\n\n\t// Cursor blink based on frequency (Hz)\n\t// At 30fps and 2Hz -> 15 frames per cycle (7.5 on, 7.5 off)\n\tlet isCursorVisible = true;\n\tif (blinkFrequency > 0) {\n\t\tconst halfPeriodFrames = Math.max(1, Math.round(30 / (2 * blinkFrequency)));\n\t\tisCursorVisible = Math.floor(elapsed / halfPeriodFrames) % 2 === 0;\n\t}\n\n\treturn {\n\t\tvisibleChars: visibleCount,\n\t\tcurrentDisplayString: displayStr,\n\t\tisCursorVisible,\n\t};\n}\n","/**\n * Compositor program document v2 — THE single source of truth for a\n * composition (spec: `nodes/node-compositor/SKILL.md`).\n *\n * The config IS a tree of HTML-like layout nodes (`layout`), replacing the\n * v1 flat `layers[]`. No `layers`, no `layerUpdates`, no aliases: the tree\n * is what agents write, what the editor edits, what the renderer renders.\n *\n * Design rules (hard):\n * - strict zod, `.strict()` everywhere; unknown keys are rejected by the\n * pre-parse scan in `validate.ts` (zod alone would silently strip them)\n * - recursive container fields use `z.lazy`; leaf kinds are plain objects\n * - every field that can animate is in `AnimatablePropSchema`\n * - no backwards compatibility: v1 shapes fail fast with E-codes\n */\n\nimport type {\n\tMeshAudioDeformConfig,\n\tTextSpan,\n\tTextSpanMark,\n} from \"@framefields/core\";\nimport { ColorSchema } from \"@framefields/node-sdk\";\nexport type { TextSpan, TextSpanMark };\n\nimport { z } from \"zod\";\nimport {\n\ttype AdvancedTextAnimator,\n\tAdvancedTextAnimatorSchema,\n\ttype AETextAnimator,\n\tAETextAnimatorSchema,\n\ttype KineticMarqueeConfig,\n\tKineticMarqueeConfigSchema,\n\ttype TextPathOptions,\n\tTextPathOptionsSchema,\n\ttype TypewriterAnimator,\n\tTypewriterAnimatorSchema,\n} from \"./text-animations/index.js\";\n\nexport * from \"./text-animations/index.js\";\n\n// ── shared leaf primitives ────────────────────────────────────────────\n\n/** number px | \"auto\" (intrinsic) | \"fit\" (shrink-wrap) | \"fill\" (parent extent). */\nexport const SizeSpecSchema = z.union([\n\tz.number().min(0),\n\tz.enum([\"auto\", \"fit\", \"fill\"]),\n\tz.custom<unknown>(),\n]);\nexport type SizeSpec = z.infer<typeof SizeSpecSchema>;\n\nexport const ShapeTypeSchema = z.enum([\n\t\"rect\",\n\t\"circle\",\n\t\"ellipse\",\n\t\"polygon\",\n\t\"star\",\n\t\"arrow\",\n\t\"path\",\n]);\nexport type ShapeType = z.infer<typeof ShapeTypeSchema>;\n\nexport const AnimatablePropSchema = z.enum([\n\t\"x\",\n\t\"y\",\n\t\"scale\",\n\t\"rotation\",\n\t\"opacity\",\n\t\"width\",\n\t\"height\",\n\t\"volume\",\n\t\"hidden\",\n\t\"muted\",\n\t\"gap\",\n\t\"padding\",\n\t\"borderRadius\",\n\t\"fontSize\",\n\t\"text\",\n\t\"fill\",\n\t\"color\",\n\t\"letterSpacing\",\n\t// Vector Shape & Stroke properties\n\t\"trimStart\",\n\t\"trimEnd\",\n\t\"trimOffset\",\n\t\"strokeWidth\",\n\t\"strokeDashOffset\",\n\t\"cornerRadius\",\n\t\"starInnerRadiusRatio\",\n\t\"fillColor\",\n\t\"strokeColor\",\n\t\"borderColor\",\n\t\"borderWidth\",\n\t\"motionBlurShutter\",\n\t// Kinetic Typography properties\n\t\"rangeStart\",\n\t\"rangeEnd\",\n\t\"offset\",\n\t\"animatorRangeStart\",\n\t\"animatorRangeEnd\",\n\t\"animatorOffset\",\n\t// Path-following text properties\n\t\"firstMargin\",\n\t\"lastMargin\",\n\t\"baselineShift\",\n\t// 3D Perspective & Transform properties\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"perspective\",\n\t\"translateZ\",\n\t\"perspectiveOriginX\",\n\t\"perspectiveOriginY\",\n\t// 3D Camera & Scene properties\n\t\"cameraX\",\n\t\"cameraY\",\n\t\"cameraZ\",\n\t\"targetX\",\n\t\"targetY\",\n\t\"targetZ\",\n\t\"cameraPitch\",\n\t\"cameraYaw\",\n\t\"cameraRoll\",\n\t\"cameraFov\",\n\t\"cameraZoom\",\n\t\"focalLength\",\n\t\"focusDistance\",\n\t\"fStop\",\n\t\"maxBlurRadius\",\n\t\"shakeTranslation\",\n\t\"shakeRotation\",\n\t\"orbitRadius\",\n\t\"orbitAzimuth\",\n\t\"orbitElevation\",\n\t\"z\",\n\t\"scaleZ\",\n\t// 3D Lighting & Material properties\n\t\"intensity\",\n\t\"angle\",\n\t\"radius\",\n\t\"penumbra\",\n\t\"decay\",\n\t\"shininess\",\n\t\"roughness\",\n\t\"specularIntensity\",\n\t\"ambientIntensity\",\n\t\"metallic\",\n\t\"ior\",\n\t\"dispersion\",\n\t\"transmission\",\n\t\"fresnelPower\",\n\t\"envIntensity\",\n\t// 3D Model & Animation properties\n\t\"animationProgress\",\n\t\"animationTime\",\n\t\"animationSpeed\",\n\t\"wireframe\",\n\t\"scaleX\",\n\t\"scaleY\",\n]);\nexport type AnimatableProp = z.infer<typeof AnimatablePropSchema>;\n\nexport const MaterialTypeSchema = z.enum([\n\t\"lit\",\n\t\"unlit\",\n\t\"toon\",\n\t\"glass\",\n\t\"acrylic\",\n\t\"frosted\",\n\t\"metallic\",\n]);\nexport type MaterialType = z.infer<typeof MaterialTypeSchema>;\n\nexport const EXTENDED_3D_ANIMATABLE_PROPS = [\n\t\"rotateX\",\n\t\"rotateY\",\n\t\"rotateZ\",\n\t\"perspective\",\n\t\"translateZ\",\n\t\"perspectiveOriginX\",\n\t\"perspectiveOriginY\",\n\t\"cameraX\",\n\t\"cameraY\",\n\t\"cameraZ\",\n\t\"targetX\",\n\t\"targetY\",\n\t\"targetZ\",\n\t\"cameraPitch\",\n\t\"cameraYaw\",\n\t\"cameraRoll\",\n\t\"cameraFov\",\n\t\"cameraZoom\",\n\t\"focalLength\",\n\t\"focusDistance\",\n\t\"fStop\",\n\t\"maxBlurRadius\",\n\t\"shakeTranslation\",\n\t\"shakeRotation\",\n\t\"orbitRadius\",\n\t\"orbitAzimuth\",\n\t\"orbitElevation\",\n\t\"z\",\n\t\"scaleZ\",\n\t\"intensity\",\n\t\"angle\",\n\t\"radius\",\n\t\"penumbra\",\n\t\"decay\",\n\t\"shininess\",\n\t\"roughness\",\n\t\"specularIntensity\",\n\t\"ambientIntensity\",\n\t\"metallic\",\n] as const;\nexport type Extended3DAnimatableProp =\n\t(typeof EXTENDED_3D_ANIMATABLE_PROPS)[number];\n\nexport const SignalColorModeSchema = z.enum([\n\t\"interpolate\",\n\t\"hueRotate\",\n\t\"threshold\",\n]);\nexport type SignalColorMode = z.infer<typeof SignalColorModeSchema>;\n\nexport const EaseRefSchema = z\n\t.object({\n\t\tname: z.enum([\n\t\t\t\"none\",\n\t\t\t\"power1\",\n\t\t\t\"power2\",\n\t\t\t\"power3\",\n\t\t\t\"sine\",\n\t\t\t\"circ\",\n\t\t\t\"expo\",\n\t\t\t\"back\",\n\t\t\t\"elastic\",\n\t\t\t\"bounce\",\n\t\t\t\"spring\",\n\t\t\t\"cubic\",\n\t\t\t\"hold\",\n\t\t]),\n\t\tdir: z.enum([\"in\", \"out\", \"inOut\"]),\n\t\tparams: z.array(z.number()).optional(),\n\t})\n\t.strict()\n\t.superRefine((data, ctx) => {\n\t\tif (data.name === \"spring\" && data.params) {\n\t\t\tconst [damping, stiffness, mass] = data.params;\n\t\t\tif (damping !== undefined && damping <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tmessage: \"Spring damping must be greater than 0.\",\n\t\t\t\t\tpath: [\"params\", 0],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (stiffness !== undefined && stiffness <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tmessage: \"Spring stiffness must be greater than 0.\",\n\t\t\t\t\tpath: [\"params\", 1],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (mass !== undefined && mass <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tmessage: \"Spring mass must be greater than 0.\",\n\t\t\t\t\tpath: [\"params\", 2],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\nexport type EaseRef = z.infer<typeof EaseRefSchema>;\n\nexport const KeyframeSchema = z\n\t.object({\n\t\tid: z.string().min(1),\n\t\tframe: z.number().int().min(0),\n\t\tvalue: z.union([z.number(), z.boolean(), z.string()]),\n\t\tease: EaseRefSchema.optional(),\n\t\tpresetGroupId: z.string().optional(),\n\t\tpresetType: z.string().optional(),\n\t\tspatialTangentIn: z.object({ x: z.number(), y: z.number() }).optional(),\n\t\tspatialTangentOut: z.object({ x: z.number(), y: z.number() }).optional(),\n\t})\n\t.strict();\nexport type Keyframe = z.infer<typeof KeyframeSchema>;\n\nexport const SignalModeSchema = z.enum([\"continuous\", \"accumulate\"]);\nexport type SignalMode = z.infer<typeof SignalModeSchema>;\n\nconst RawTrackSourceSchema = z.discriminatedUnion(\"type\", [\n\tz.object({\n\t\ttype: z.literal(\"keyframe\"),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"signal\"),\n\t\tinputHandleId: z.string(),\n\t\tmultiplier: z.number().default(1.0),\n\t\toffset: z.number().default(0.0),\n\t\tsmoothingWindowFrames: z.number().min(0).default(0),\n\t\tcolorMode: SignalColorModeSchema.optional(),\n\t\tcolorA: z.string().optional(),\n\t\tcolorB: z.string().optional(),\n\t\tcolorThreshold: z.number().optional(),\n\t\tsignalMode: SignalModeSchema.optional(),\n\t\tthreshold: z.number().optional(),\n\t\taccumulateThreshold: z.number().optional(),\n\t\tdebounceFrames: z.number().int().min(0).optional(),\n\t\tchannel: z.string().optional(),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"wiggle\"),\n\t\tfrequency: z.number().default(2.0),\n\t\tamplitude: z.number().default(50.0),\n\t\toctaves: z.number().int().min(1).max(4).default(1),\n\t\tseed: z.number().default(1234),\n\t}),\n\tz.object({\n\t\ttype: z.literal(\"springOvershoot\"),\n\t\tdamping: z.number().default(12),\n\t\tstiffness: z.number().default(180),\n\t\tmass: z.number().default(1),\n\t}),\n]);\n\nexport const TrackSourceSchema = z.preprocess((val: unknown) => {\n\tif (!val || typeof val !== \"object\") return val;\n\tconst obj = val as Record<string, unknown>;\n\tif (obj.type === \"signal\") {\n\t\tconst thresh =\n\t\t\ttypeof obj.threshold === \"number\"\n\t\t\t\t? obj.threshold\n\t\t\t\t: typeof obj.accumulateThreshold === \"number\"\n\t\t\t\t\t? obj.accumulateThreshold\n\t\t\t\t\t: 0.15;\n\t\treturn {\n\t\t\ttype: \"signal\",\n\t\t\tinputHandleId: obj.inputHandleId ?? obj.handleId,\n\t\t\tmultiplier: obj.multiplier ?? obj.amplitude ?? 1.0,\n\t\t\toffset: obj.offset ?? 0.0,\n\t\t\tsmoothingWindowFrames: obj.smoothingWindowFrames ?? obj.smoothing ?? 0,\n\t\t\tcolorMode: obj.colorMode,\n\t\t\tcolorA: obj.colorA,\n\t\t\tcolorB: obj.colorB,\n\t\t\tcolorThreshold: obj.colorThreshold,\n\t\t\tsignalMode: obj.signalMode ?? \"continuous\",\n\t\t\tthreshold: thresh,\n\t\t\taccumulateThreshold: thresh,\n\t\t\tdebounceFrames: obj.debounceFrames ?? 2,\n\t\t\tchannel: typeof obj.channel === \"string\" ? obj.channel : \"primary\",\n\t\t};\n\t}\n\treturn val;\n}, RawTrackSourceSchema) as unknown as typeof RawTrackSourceSchema;\nexport type TrackSource = z.infer<typeof RawTrackSourceSchema>;\nexport type SignalTrackSource = Extract<TrackSource, { type: \"signal\" }>;\n\nconst animationInvariants = (\n\tanim: {\n\t\ttracks?: Array<{\n\t\t\tprop: string;\n\t\t\tsource?: { type: string };\n\t\t\tkeyframes?: Array<{ value: unknown; frame: number }>;\n\t\t}>;\n\t},\n\tctx: z.RefinementCtx,\n) => {\n\tif (!anim?.tracks) return;\n\tlet totalKeyframes = 0;\n\tfor (let tIdx = 0; tIdx < anim.tracks.length; tIdx++) {\n\t\tconst track = anim.tracks[tIdx];\n\t\tconst keyframes = track.keyframes ?? [];\n\t\ttotalKeyframes += keyframes.length;\n\n\t\tconst isKeyframeSource = !track.source || track.source.type === \"keyframe\";\n\t\tif (isKeyframeSource && keyframes.length < 1) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\tmessage: `Track for property '${track.prop}' must have at least 1 keyframe.`,\n\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\"],\n\t\t\t});\n\t\t}\n\n\t\tconst isDiscrete = track.prop === \"hidden\" || track.prop === \"muted\";\n\t\tconst isColor =\n\t\t\ttrack.prop === \"fillColor\" ||\n\t\t\ttrack.prop === \"strokeColor\" ||\n\t\t\ttrack.prop === \"fill\" ||\n\t\t\ttrack.prop === \"color\";\n\t\tfor (let kIdx = 0; kIdx < keyframes.length; kIdx++) {\n\t\t\tconst kf = keyframes[kIdx];\n\t\t\tif (kIdx > 0) {\n\t\t\t\tconst prevKf = keyframes[kIdx - 1];\n\t\t\t\tif (kf.frame < prevKf.frame) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\t\tmessage: \"Keyframes must be sorted in ascending order of frame.\",\n\t\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx],\n\t\t\t\t\t});\n\t\t\t\t} else if (kf.frame === prevKf.frame) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\t\tmessage: \"Duplicate keyframes at the same frame are not allowed.\",\n\t\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst valType = typeof kf.value;\n\t\t\tif (isDiscrete) {\n\t\t\t\tif (valType !== \"boolean\") {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\t\tmessage: `Keyframe value for discrete property '${track.prop}' must be a boolean.`,\n\t\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx, \"value\"],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (isColor) {\n\t\t\t\tif (valType !== \"string\") {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\t\tmessage: `Keyframe value for color property '${track.prop}' must be a string.`,\n\t\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx, \"value\"],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tvalType !== \"number\" ||\n\t\t\t\tNumber.isNaN(kf.value as number) ||\n\t\t\t\t!Number.isFinite(kf.value as number)\n\t\t\t) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tmessage: `Keyframe value for numeric property '${track.prop}' must be a finite number.`,\n\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx, \"value\"],\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\t(track.prop === \"volume\" ||\n\t\t\t\t\ttrack.prop === \"trimStart\" ||\n\t\t\t\t\ttrack.prop === \"trimEnd\") &&\n\t\t\t\t((kf.value as number) < 0 || (kf.value as number) > 1)\n\t\t\t) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tmessage: `Keyframe value for property '${track.prop}' must be between 0 and 1.`,\n\t\t\t\t\tpath: [\"tracks\", tIdx, \"keyframes\", kIdx, \"value\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\tif (totalKeyframes > 128) {\n\t\tctx.addIssue({\n\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\tmessage: `Total keyframes across all tracks (${totalKeyframes}) exceeds the limit of 128.`,\n\t\t\tpath: [\"tracks\"],\n\t\t});\n\t}\n};\n\nexport const AnimationTrackSchema = z\n\t.object({\n\t\tid: z.string().min(1),\n\t\tprop: AnimatablePropSchema,\n\t\tsource: TrackSourceSchema.optional(),\n\t\tkeyframes: z.array(KeyframeSchema).default([]),\n\t\trepeat: z.number().int().optional(),\n\t\tyoyo: z.boolean().optional(),\n\t\tdurationFrames: z.number().int().min(1).optional(),\n\t})\n\t.strict();\nexport type AnimationTrack = z.infer<typeof AnimationTrackSchema>;\n\nexport const LayerAnimationSchema = z\n\t.object({\n\t\ttracks: z.array(AnimationTrackSchema).max(24),\n\t})\n\t.strict()\n\t.superRefine(animationInvariants);\nexport type LayerAnimationSpec = z.infer<typeof LayerAnimationSchema>;\n\n// ── layout node tree ──────────────────────────────────────────────────\n// Hand-written interfaces anchor the mutual recursion (schema + type).\n// Container `children` fields use z.lazy closures; the union schema is\n// cast to z.ZodType<LayoutNode> — the documented pattern (zod-recursion).\n\nconst BaseNodeFields = {\n\tid: z.string().min(1),\n\t/** Graph binding — which connected input this node renders (for text/media nodes). */\n\tinputHandleId: z.string().optional(),\n\t/** \"absolute\" = out of flow, placed at x/y of the parent's content box. */\n\tposition: z.enum([\"relative\", \"absolute\"]).default(\"relative\"),\n\tx: z.union([z.number(), z.custom<unknown>()]).default(0),\n\ty: z.union([z.number(), z.custom<unknown>()]).default(0),\n\twidth: SizeSpecSchema.optional(),\n\theight: SizeSpecSchema.optional(),\n\t/** Main-axis leftover share on the parent flex. */\n\tgrow: z.number().min(0).optional(),\n\t/** Flex shrink factor (Yoga). Defaults to 1 in Yoga when unset. */\n\tflexShrink: z.number().min(0).optional(),\n\t/** Flex basis in px (Yoga). */\n\tflexBasis: z.number().min(0).optional(),\n\t/** Per-child cross-axis override (Yoga alignSelf). */\n\talignSelf: z\n\t\t.enum([\"auto\", \"start\", \"center\", \"end\", \"stretch\", \"baseline\"])\n\t\t.optional(),\n\t/** Intrinsic aspect ratio (width / height). */\n\taspectRatio: z.number().positive().optional(),\n\tzIndex: z.number().int().default(0),\n\thidden: z.boolean().default(false),\n\topacity: z.number().min(0).max(1).default(1),\n\tblendMode: z.string().optional(),\n\t/** Per-node WebGPU effect chain (`layer.withEffect(s)`); resolved to operations in to-virtual-media. */\n\teffects: z.array(z.unknown()).optional(),\n\trotation: z.number().default(0),\n\tscale: z.number().min(0).default(1),\n\t/** Transform pivot, 0–1 fraction of the node box (0.5 = center). */\n\tanchorX: z.number().min(0).max(1).default(0.5),\n\tanchorY: z.number().min(0).max(1).default(0.5),\n\t/** Clip timing — frames, clip-relative. */\n\tstartFrame: z.number().int().min(0).default(0),\n\tdurationFrames: z.number().int().min(1).optional(),\n\t/** Directional velocity motion blur shutter angle (0..360, e.g. 180). */\n\tmotionBlurShutter: z.number().min(0).max(360).optional(),\n\t/** 3D rotation around horizontal X axis in degrees. Range: [-180, 180], default: 0 */\n\trotateX: z.number().default(0),\n\t/** 3D rotation around vertical Y axis in degrees. Range: [-180, 180], default: 0 */\n\trotateY: z.number().default(0),\n\t/** 3D rotation around depth Z axis in degrees. Range: [-360, 360], default: 0 */\n\trotateZ: z.number().default(0),\n\t/** Perspective viewing distance in pixels (0 = orthographic / disabled). */\n\tperspective: z.number().min(0).default(0),\n\t/** Perspective origin X anchor (0..1, default 0.5). */\n\tperspectiveOriginX: z.number().default(0.5),\n\t/** Perspective origin Y anchor (0..1, default 0.5). */\n\tperspectiveOriginY: z.number().default(0.5),\n\t/** Translation along depth Z axis in pixels. */\n\ttranslateZ: z.number().default(0),\n\t/** Backface visibility when rotated > 90deg away from camera. */\n\tbackfaceVisibility: z.enum([\"visible\", \"hidden\"]).default(\"visible\"),\n\t/** Transform rendering style (flat buffer vs shared 3D space). */\n\ttransformStyle: z.enum([\"flat\", \"preserve-3d\"]).default(\"flat\"),\n\t/** Whether this layer lives in unified 3D camera space. */\n\tis3D: z.boolean().default(false),\n\t/** 3D position Z in pixels. */\n\tz: z.union([z.number(), z.custom<unknown>()]).default(0),\n\t/** 3D scale along Z axis. */\n\tscaleZ: z.number().default(1.0),\n\t/** Render both front and back faces in 3D passes. */\n\ttwoSided: z.boolean().default(true),\n\t/** Material shading mode (\"lit\" | \"unlit\" | \"glass\" | \"acrylic\" | \"frosted\" | \"metallic\"). Default \"lit\". */\n\tmaterial: MaterialTypeSchema.default(\"lit\"),\n\t/** Index of Refraction for glass/acrylic (1.0..3.0, default 1.49). */\n\tior: z.number().min(1.0).max(3.0).optional(),\n\t/** Surface roughness factor [0, 1]. */\n\troughness: z.number().min(0).max(1).optional(),\n\t/** Specular shininess / glossiness exponent for Blinn-Phong shading (default 32.0). */\n\tshininess: z.number().min(1).max(512).default(32.0),\n\t/** Specular highlight intensity multiplier [0, 10] (default 0.5). */\n\tspecularIntensity: z.number().min(0).default(0.5),\n\t/** Metallic factor [0, 1]. */\n\tmetallic: z.number().min(0).max(1).optional(),\n\t/** Ambient light reflection multiplier [0, 10] (default 1.0). */\n\tambientIntensity: z.number().min(0).default(1.0),\n\t/** Glass transmission transparency factor [0, 1]. */\n\ttransmission: z.number().min(0).max(1).optional(),\n\t/** Chromatic dispersion coefficient for glass refraction bevels. */\n\tdispersion: z.number().min(0).max(1.0).optional(),\n\t/** Fresnel rim grazing highlight power [1, 10]. */\n\tfresnelPower: z.number().min(1.0).max(10.0).optional(),\n\t/** Environment reflection intensity [0, 10]. */\n\tenvIntensity: z.number().min(0).max(10.0).optional(),\n\t/** Per-node motion: tracks keyed by node id. */\n\tanimation: LayerAnimationSchema.default({ tracks: [] }),\n\t/** Vision configuration or effect attached directly to the node. */\n\tvision: z.unknown().optional(),\n\t/** Relighting configuration attached directly to the node. */\n\trelighting: z.unknown().optional(),\n} as const;\n\nexport interface CompositionNodeBase {\n\tid: string;\n\tinputHandleId?: string;\n\tposition?: \"relative\" | \"absolute\";\n\tx?: number | unknown;\n\ty?: number | unknown;\n\twidth?: SizeSpec;\n\theight?: SizeSpec;\n\tgrow?: number;\n\tflexShrink?: number;\n\tflexBasis?: number;\n\talignSelf?: \"auto\" | \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\";\n\taspectRatio?: number;\n\tzIndex?: number;\n\thidden?: boolean;\n\topacity?: number;\n\tblendMode?: string;\n\trotation?: number;\n\tscale?: number;\n\tanchorX?: number;\n\tanchorY?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tperspective?: number;\n\tperspectiveOriginX?: number;\n\tperspectiveOriginY?: number;\n\ttranslateZ?: number;\n\tbackfaceVisibility?: \"visible\" | \"hidden\";\n\ttransformStyle?: \"flat\" | \"preserve-3d\";\n\tis3D?: boolean;\n\tz?: number | unknown;\n\tscaleZ?: number;\n\ttwoSided?: boolean;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tmetallic?: number;\n\tambientIntensity?: number;\n\tior?: number;\n\ttransmission?: number;\n\tdispersion?: number;\n\tfresnelPower?: number;\n\tenvIntensity?: number;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n\tmotionBlurShutter?: number;\n\tanimation?: LayerAnimationSpec;\n\tvision?: unknown;\n\trelighting?: unknown;\n}\n\nexport interface FlexNode extends CompositionNodeBase {\n\tkind: \"flex\";\n\tdir?: \"row\" | \"column\";\n\tgap?: number;\n\tpadding?: number;\n\tjustify?: \"start\" | \"center\" | \"end\" | \"space-between\" | \"space-around\";\n\talign?: \"start\" | \"center\" | \"end\" | \"stretch\";\n\twrap?: boolean;\n\tstaggerFrames?: number;\n\tstaggerDirection?: \"forward\" | \"reverse\" | \"center-out\";\n\toverflow?: \"visible\" | \"hidden\";\n\tbackground?: string;\n\tborderRadius?: number;\n\tborderColor?: string;\n\tborderWidth?: number;\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\tstrokeRadius?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport interface BlockNode extends CompositionNodeBase {\n\tkind: \"block\";\n\tgap?: number;\n\tpadding?: number;\n\talign?: \"start\" | \"center\" | \"end\" | \"stretch\";\n\tstaggerFrames?: number;\n\tstaggerDirection?: \"forward\" | \"reverse\" | \"center-out\";\n\toverflow?: \"visible\" | \"hidden\";\n\tbackground?: string;\n\tborderRadius?: number;\n\tborderColor?: string;\n\tborderWidth?: number;\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\tstrokeRadius?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport interface BoxNode extends CompositionNodeBase {\n\tkind: \"box\";\n\tbackground?: string;\n\tborderRadius?: number;\n\tpadding?: number;\n\tstaggerFrames?: number;\n\tstaggerDirection?: \"forward\" | \"reverse\" | \"center-out\";\n\toverflow?: \"visible\" | \"hidden\";\n\tborderColor?: string;\n\tborderWidth?: number;\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\tstrokeRadius?: number;\n\tchildren?: LayoutNode[];\n}\n\nexport const TextShadowSchema = z\n\t.object({\n\t\tcolor: ColorSchema,\n\t\toffset: z\n\t\t\t.object({\n\t\t\t\tx: z.number(),\n\t\t\t\ty: z.number(),\n\t\t\t})\n\t\t\t.optional(),\n\t\tblurRadius: z.number().min(0).optional(),\n\t})\n\t.strict();\nexport type TextShadow = z.infer<typeof TextShadowSchema>;\n\nexport const TextAnimatorTransformSchema = z\n\t.object({\n\t\tx: z.number().optional(),\n\t\ty: z.number().optional(),\n\t\tscale: z.number().optional(),\n\t\tscaleX: z.number().optional(),\n\t\tscaleY: z.number().optional(),\n\t\trotation: z.number().optional(),\n\t\trotationX: z.number().optional(),\n\t\trotationY: z.number().optional(),\n\t\topacity: z.number().optional(),\n\t\tblur: z.number().optional(),\n\t\tcolor: z.string().optional(),\n\t})\n\t.strict();\nexport type TextAnimatorTransform = z.infer<typeof TextAnimatorTransformSchema>;\n\nexport const TextAnimatorSchema = z.object({\n\tid: z.string(),\n\tunit: z.enum([\"character\", \"word\", \"line\"]).default(\"character\"),\n\trangeStart: z.number().min(0).max(1).default(0),\n\trangeEnd: z.number().min(0).max(1).default(1),\n\toffset: z.number().min(-1).max(1).default(0),\n\teasing: z.string().default(\"power2.out\"),\n\ttransform: TextAnimatorTransformSchema.optional(),\n});\nexport type TextAnimator = z.infer<typeof TextAnimatorSchema>;\n\nexport const TextAnimator = {\n\t/**\n\t * Per-character staggered wave rise with baseline tilt and fade.\n\t */\n\twaveRise(\n\t\toptions: {\n\t\t\tid?: string;\n\t\t\tunit?: \"character\" | \"word\" | \"line\";\n\t\t\ty?: number;\n\t\t\trotationX?: number;\n\t\t\topacity?: number;\n\t\t\tblur?: number;\n\t\t\teasing?: string;\n\t\t\trangeStart?: number;\n\t\t\trangeEnd?: number;\n\t\t\toffset?: number;\n\t\t} = {},\n\t): TextAnimator {\n\t\treturn {\n\t\t\tid: options.id ?? \"wave-rise\",\n\t\t\tunit: options.unit ?? \"character\",\n\t\t\trangeStart: options.rangeStart ?? 0,\n\t\t\trangeEnd: options.rangeEnd ?? 1,\n\t\t\toffset: options.offset ?? -1,\n\t\t\teasing: options.easing ?? \"power2.out\",\n\t\t\ttransform: {\n\t\t\t\ty: options.y ?? 40,\n\t\t\t\trotationX: options.rotationX ?? 45,\n\t\t\t\topacity: options.opacity ?? 0,\n\t\t\t\tblur: options.blur ?? 0,\n\t\t\t},\n\t\t};\n\t},\n\n\t/**\n\t * Per-word or per-character pop / scale bounce.\n\t */\n\twordPop(\n\t\toptions: { id?: string; scale?: number; y?: number; easing?: string } = {},\n\t): TextAnimator {\n\t\treturn {\n\t\t\tid: options.id ?? \"word-pop\",\n\t\t\tunit: \"word\",\n\t\t\trangeStart: 0,\n\t\t\trangeEnd: 1,\n\t\t\toffset: -1,\n\t\t\teasing: options.easing ?? \"back.out(1.6)\",\n\t\t\ttransform: {\n\t\t\t\tscale: options.scale ?? 0,\n\t\t\t\ty: options.y ?? 20,\n\t\t\t\topacity: 0,\n\t\t\t},\n\t\t};\n\t},\n\n\t/**\n\t * Per-character cinematic optical blur to crisp reveal.\n\t */\n\tblurIn(\n\t\toptions: {\n\t\t\tid?: string;\n\t\t\tunit?: \"character\" | \"word\";\n\t\t\tblur?: number;\n\t\t\ty?: number;\n\t\t\topacity?: number;\n\t\t\teasing?: string;\n\t\t} = {},\n\t): TextAnimator {\n\t\treturn {\n\t\t\tid: options.id ?? \"blur-in\",\n\t\t\tunit: options.unit ?? \"character\",\n\t\t\trangeStart: 0,\n\t\t\trangeEnd: 1,\n\t\t\toffset: -1,\n\t\t\teasing: options.easing ?? \"power3.out\",\n\t\t\ttransform: {\n\t\t\t\tblur: options.blur ?? 16,\n\t\t\t\ty: options.y ?? 20,\n\t\t\t\topacity: options.opacity ?? 0,\n\t\t\t},\n\t\t};\n\t},\n\n\t/**\n\t * 3D letter flip (like airport split-flap display or 3D letter roll).\n\t */\n\tflip3D(\n\t\toptions: {\n\t\t\tid?: string;\n\t\t\tunit?: \"character\" | \"word\";\n\t\t\trotationX?: number;\n\t\t\teasing?: string;\n\t\t} = {},\n\t): TextAnimator {\n\t\treturn {\n\t\t\tid: options.id ?? \"flip-3d\",\n\t\t\tunit: options.unit ?? \"character\",\n\t\t\trangeStart: 0,\n\t\t\trangeEnd: 1,\n\t\t\toffset: -1,\n\t\t\teasing: options.easing ?? \"back.out(1.4)\",\n\t\t\ttransform: {\n\t\t\t\trotationX: options.rotationX ?? 90,\n\t\t\t\topacity: 0,\n\t\t\t},\n\t\t};\n\t},\n\n\t/**\n\t * Color sweep passing across glyphs/words.\n\t */\n\tcolorSweep(options: {\n\t\tid?: string;\n\t\tcolor: string;\n\t\tunit?: \"character\" | \"word\";\n\t\teasing?: string;\n\t}): TextAnimator {\n\t\treturn {\n\t\t\tid: options.id ?? \"color-sweep\",\n\t\t\tunit: options.unit ?? \"character\",\n\t\t\trangeStart: 0,\n\t\t\trangeEnd: 0.5,\n\t\t\toffset: -0.5,\n\t\t\teasing: options.easing ?? \"power2.inOut\",\n\t\t\ttransform: {\n\t\t\t\tcolor: options.color,\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport interface TextNode extends CompositionNodeBase {\n\tkind: \"text\";\n\ttext?: string;\n\tspans?: TextSpan[];\n\tfontFamily?: string;\n\tfontSize?: number;\n\tfontWeight?: number | string;\n\tfontStyle?: string;\n\tfill?: string;\n\talign?: \"start\" | \"center\" | \"end\";\n\tverticalAlign?: \"top\" | \"middle\" | \"bottom\";\n\tlineHeight?: number;\n\tletterSpacing?: number;\n\tbackground?: string;\n\tborderRadius?: number;\n\tpadding?: number;\n\tstroke?: string;\n\tstrokeWidth?: number;\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\ttextShadow?: string;\n\tshadows?: TextShadow[];\n\tpathOptions?: TextPathOptions;\n\ttypewriter?: TypewriterAnimator;\n\tmarquee?: KineticMarqueeConfig;\n\tanimators?: (TextAnimator | AETextAnimator | AdvancedTextAnimator)[];\n}\n\nexport interface MediaNode extends CompositionNodeBase {\n\tkind: \"media\";\n\tinputHandleId: string;\n\tdataType?: string;\n\tfit?: \"cover\" | \"contain\" | \"fill\" | \"none\";\n\tborderRadius?: number;\n\tborderColor?: string;\n\tborderWidth?: number;\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\tstrokeRadius?: number;\n\tvolume?: number;\n\tmuted?: boolean;\n\t/** Source in-point: seconds into the clip that play at the layer's startFrame. */\n\ttrimStartSec?: number;\n\t// Caption styling\n\tfontFamily?: string;\n\tfontSize?: number;\n\tfontWeight?: number | string;\n\tfontStyle?: string;\n\tfill?: string;\n\talign?: \"start\" | \"center\" | \"end\";\n\tverticalAlign?: \"top\" | \"middle\" | \"bottom\";\n\tlineHeight?: number;\n\tletterSpacing?: number;\n\tbackground?: string;\n\tpadding?: number;\n\tstroke?: string;\n\tstrokeWidth?: number;\n\ttextShadow?: string;\n\tshadows?: TextShadow[];\n\tmaxWidth?: number;\n}\n\nexport interface ShapeNode extends CompositionNodeBase {\n\tkind: \"shape\";\n\tshapeType?: ShapeType;\n\tborderRadius?: number;\n\tradiusTL?: number;\n\tradiusTR?: number;\n\tradiusBR?: number;\n\tradiusBL?: number;\n\tpolygonSides?: number;\n\tstarPoints?: number;\n\tstarInnerRadiusRatio?: number;\n\tarrowHeadWidth?: number;\n\tarrowHeadLength?: number;\n\tarrowShaftWidth?: number;\n\td?: string;\n\tfillType?: \"solid\" | \"linear\" | \"radial\" | \"none\";\n\tfillColor?: string;\n\tgradientEndColor?: string;\n\tgradientAngle?: number;\n\tstrokeColor?: string;\n\tstrokeWidth?: number;\n\tstrokeDashArray?: string;\n\tstrokeDashOffset?: number;\n\tstrokeLineCap?: \"butt\" | \"round\" | \"square\";\n\tstrokeLineJoin?: \"miter\" | \"round\" | \"bevel\";\n\tstrokeAlign?: \"inside\" | \"center\" | \"outside\";\n\ttrimStart?: number;\n\ttrimEnd?: number;\n\ttrimOffset?: number;\n}\n\nexport const CameraLensSchema = z\n\t.object({\n\t\tfocalLength: z.number().min(5).max(500).default(50),\n\t\tfov: z.number().min(5).max(160).optional(),\n\t\tsensorWidth: z.number().default(36),\n\t\tnear: z.number().min(0.1).default(1),\n\t\tfar: z.number().min(10).default(50000),\n\t\tzoom: z.number().min(0.01).default(1.0),\n\t})\n\t.strict();\n\nexport type CameraLens = z.infer<typeof CameraLensSchema>;\n\nexport const CameraDoFSchema = z\n\t.object({\n\t\tenabled: z.boolean().default(false),\n\t\tfocusDistance: z.number().min(1).default(1000),\n\t\tfStop: z.number().min(0.5).max(64).default(2.8),\n\t\tmaxBlurRadius: z.number().min(0).max(128).default(32),\n\t\tapertureBlades: z.number().int().min(0).max(12).default(0),\n\t\tanamorphicRatio: z.number().min(0.5).max(3.0).default(1.0),\n\t})\n\t.strict();\n\n/** Depth of field as authored: fields with schema defaults may be left out. */\nexport type CameraDoF = z.input<typeof CameraDoFSchema>;\n\nexport const CameraShakeSchema = z\n\t.object({\n\t\ttranslationAmplitude: z.number().min(0).default(0),\n\t\trotationAmplitude: z.number().min(0).default(0),\n\t\tfrequency: z.number().min(0.1).max(60).default(2.5),\n\t\toctaves: z.number().int().min(1).max(6).default(3),\n\t\tseed: z.number().default(42),\n\t})\n\t.strict();\n\nexport type CameraShake = z.infer<typeof CameraShakeSchema>;\n\nexport interface CameraNode {\n\tid: string;\n\tkind: \"camera\";\n\tmode?: \"lookAt\" | \"free\" | \"orbit\";\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\ttargetX?: number;\n\ttargetY?: number;\n\ttargetZ?: number;\n\tpitch?: number;\n\tyaw?: number;\n\troll?: number;\n\tlens?: CameraLens;\n\tdof?: CameraDoF;\n\tshake?: CameraShake;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n\tanimation?: LayerAnimationSpec;\n}\n\nexport const CameraNodeSchema: z.ZodType<CameraNode> = z\n\t.object({\n\t\tid: z.string().min(1),\n\t\tkind: z.literal(\"camera\"),\n\t\tmode: z.enum([\"lookAt\", \"free\", \"orbit\"]).default(\"lookAt\"),\n\t\tx: z.number().optional(),\n\t\ty: z.number().optional(),\n\t\tz: z.number().optional(),\n\t\ttargetX: z.number().optional(),\n\t\ttargetY: z.number().optional(),\n\t\ttargetZ: z.number().optional(),\n\t\tpitch: z.number().default(0),\n\t\tyaw: z.number().default(0),\n\t\troll: z.number().default(0),\n\t\tlens: CameraLensSchema.optional(),\n\t\tdof: CameraDoFSchema.optional(),\n\t\tshake: CameraShakeSchema.optional(),\n\t\tstartFrame: z.number().int().min(0).default(0),\n\t\tdurationFrames: z.number().int().min(1).optional(),\n\t\tanimation: LayerAnimationSchema.default({ tracks: [] }),\n\t})\n\t.strict() as unknown as z.ZodType<CameraNode>;\n\nexport type LightType = \"ambient\" | \"directional\" | \"point\" | \"spot\";\nexport const LightTypeSchema = z.enum([\n\t\"ambient\",\n\t\"directional\",\n\t\"point\",\n\t\"spot\",\n]);\n\nexport interface LightNode {\n\tid: string;\n\tkind: \"light\";\n\tlightType?: LightType;\n\tcolor?: string;\n\tintensity?: number;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\ttargetX?: number;\n\ttargetY?: number;\n\ttargetZ?: number;\n\tdirection?: [number, number, number];\n\tradius?: number;\n\tdecay?: number;\n\tangle?: number;\n\tpenumbra?: number;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n\tanimation?: LayerAnimationSpec;\n}\n\nexport const LightNodeSchema: z.ZodType<LightNode> = z\n\t.object({\n\t\tid: z.string().min(1),\n\t\tkind: z.literal(\"light\"),\n\t\tlightType: LightTypeSchema.default(\"directional\"),\n\t\tcolor: ColorSchema.default(\"#ffffff\"),\n\t\tintensity: z.number().default(1.0),\n\t\tx: z.number().optional(),\n\t\ty: z.number().optional(),\n\t\tz: z.number().optional(),\n\t\ttargetX: z.number().optional(),\n\t\ttargetY: z.number().optional(),\n\t\ttargetZ: z.number().optional(),\n\t\tdirection: z.tuple([z.number(), z.number(), z.number()]).optional(),\n\t\tradius: z.number().min(0).default(1000),\n\t\tdecay: z.number().min(0).default(2.0),\n\t\tangle: z.number().min(0).max(180).default(45),\n\t\tpenumbra: z.number().min(0).max(1).default(0.2),\n\t\tstartFrame: z.number().int().min(0).default(0),\n\t\tdurationFrames: z.number().int().min(1).optional(),\n\t\tanimation: LayerAnimationSchema.default({ tracks: [] }),\n\t})\n\t.strict() as unknown as z.ZodType<LightNode>;\n\nexport interface Model3DNode {\n\tid: string;\n\tkind: \"model3d\";\n\tsrc?: string;\n\tmodelFormat?:\n\t\t| \"obj\"\n\t\t| \"fbx\"\n\t\t| \"gltf\"\n\t\t| \"glb\"\n\t\t| \"stl\"\n\t\t| \"ply\"\n\t\t| \"vox\"\n\t\t| \"3ds\"\n\t\t| \"off\"\n\t\t| \"auto\";\n\tmodelData?: unknown;\n\tanimationName?: string;\n\tanimationProgress?: number;\n\tanimationTime?: number;\n\tanimationSpeed?: number;\n\tloop?: boolean;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\trotateX?: number;\n\trotateY?: number;\n\trotateZ?: number;\n\tscale?: number;\n\tscaleX?: number;\n\tscaleY?: number;\n\tscaleZ?: number;\n\tmaterial?: MaterialType;\n\tshininess?: number;\n\troughness?: number;\n\tspecularIntensity?: number;\n\tambientIntensity?: number;\n\tmetallic?: number;\n\tcolor?: string;\n\tcolorTint?: string;\n\topacity?: number;\n\ttwoSided?: boolean;\n\twireframe?: boolean;\n\tis3D?: boolean;\n\ttexture?: string;\n\tcenter?: boolean;\n\tnormalizeSize?: number;\n\tstartFrame?: number;\n\tdurationFrames?: number;\n\tanimation?: LayerAnimationSpec;\n\taudioDeform?: MeshAudioDeformConfig;\n\ttext3dOptions?: unknown;\n}\n\nexport type LayoutNode =\n\t| FlexNode\n\t| BlockNode\n\t| BoxNode\n\t| TextNode\n\t| MediaNode\n\t| ShapeNode\n\t| CameraNode\n\t| LightNode\n\t| Model3DNode;\n\nexport const containerChildren = (): z.ZodType<LayoutNode[]> =>\n\tz.array(z.lazy((): z.ZodType<LayoutNode> => LayoutNodeSchema));\n\nexport const FlexNodeSchema: z.ZodType<FlexNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\tkind: z.literal(\"flex\"),\n\t\tdir: z.enum([\"row\", \"column\"]).default(\"row\"),\n\t\tgap: z.number().min(0).default(0),\n\t\tpadding: z.number().min(0).default(0),\n\t\tjustify: z\n\t\t\t.enum([\"start\", \"center\", \"end\", \"space-between\", \"space-around\"])\n\t\t\t.default(\"start\"),\n\t\talign: z.enum([\"start\", \"center\", \"end\", \"stretch\"]).default(\"start\"),\n\t\twrap: z.boolean().default(false),\n\t\tstaggerFrames: z.number().min(0).default(0),\n\t\tstaggerDirection: z\n\t\t\t.enum([\"forward\", \"reverse\", \"center-out\"])\n\t\t\t.default(\"forward\"),\n\t\toverflow: z.enum([\"visible\", \"hidden\"]).default(\"hidden\"),\n\t\tbackground: ColorSchema.optional(),\n\t\tborderRadius: z.number().min(0).optional(),\n\t\tborderColor: ColorSchema.optional(),\n\t\tborderWidth: z.number().min(0).optional(),\n\t\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\t\tstrokeRadius: z.number().min(0).optional(),\n\t\tchildren: containerChildren().optional(),\n\t})\n\t.strict() as unknown as z.ZodType<FlexNode>;\n\nexport const BlockNodeSchema: z.ZodType<BlockNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\tkind: z.literal(\"block\"),\n\t\tgap: z.number().min(0).default(0),\n\t\tpadding: z.number().min(0).default(0),\n\t\talign: z.enum([\"start\", \"center\", \"end\", \"stretch\"]).default(\"start\"),\n\t\tstaggerFrames: z.number().min(0).default(0),\n\t\tstaggerDirection: z\n\t\t\t.enum([\"forward\", \"reverse\", \"center-out\"])\n\t\t\t.default(\"forward\"),\n\t\toverflow: z.enum([\"visible\", \"hidden\"]).default(\"hidden\"),\n\t\tbackground: ColorSchema.optional(),\n\t\tborderRadius: z.number().min(0).optional(),\n\t\tborderColor: ColorSchema.optional(),\n\t\tborderWidth: z.number().min(0).optional(),\n\t\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\t\tstrokeRadius: z.number().min(0).optional(),\n\t\tchildren: containerChildren().optional(),\n\t})\n\t.strict() as unknown as z.ZodType<BlockNode>;\n\nexport const BoxNodeSchema: z.ZodType<BoxNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\tkind: z.literal(\"box\"),\n\t\t/** Fill color of the rectangle (DSL `fill:` on box). */\n\t\tbackground: ColorSchema,\n\t\tborderRadius: z.number().min(0).optional(),\n\t\tpadding: z.number().min(0).default(0),\n\t\tstaggerFrames: z.number().min(0).default(0),\n\t\tstaggerDirection: z\n\t\t\t.enum([\"forward\", \"reverse\", \"center-out\"])\n\t\t\t.default(\"forward\"),\n\t\toverflow: z.enum([\"visible\", \"hidden\"]).default(\"hidden\"),\n\t\tborderColor: ColorSchema.optional(),\n\t\tborderWidth: z.number().min(0).optional(),\n\t\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\t\tstrokeRadius: z.number().min(0).optional(),\n\t\tchildren: containerChildren().optional(),\n\t})\n\t.strict() as unknown as z.ZodType<BoxNode>;\n\nexport const TextSpanMarkSchema = z\n\t.object({\n\t\tbackground: ColorSchema,\n\t\tborderRadius: z.number().min(0).optional(),\n\t\tpaddingX: z.number().min(0).optional(),\n\t\tpaddingY: z.number().min(0).optional(),\n\t})\n\t.strict();\n\nexport const TextSpanSchema = z\n\t.object({\n\t\ttext: z.union([\n\t\t\tz.string(),\n\t\t\tz.custom<{ get: (ctx?: unknown) => string }>((v) =>\n\t\t\t\tBoolean(v && typeof v === \"object\" && \"get\" in v),\n\t\t\t),\n\t\t]),\n\t\tfontFamily: z.string().optional(),\n\t\tfontSize: z\n\t\t\t.union([\n\t\t\t\tz.number().positive(),\n\t\t\t\tz.custom<{ get: (ctx?: unknown) => number }>((v) =>\n\t\t\t\t\tBoolean(v && typeof v === \"object\" && \"get\" in v),\n\t\t\t\t),\n\t\t\t])\n\t\t\t.optional(),\n\t\tfontWeight: z.union([z.number().int(), z.string()]).optional(),\n\t\tfontStyle: z.enum([\"normal\", \"italic\"]).optional(),\n\t\tfill: z\n\t\t\t.union([\n\t\t\t\tColorSchema,\n\t\t\t\tz.custom<{ get: (ctx?: unknown) => string }>((v) =>\n\t\t\t\t\tBoolean(v && typeof v === \"object\" && \"get\" in v),\n\t\t\t\t),\n\t\t\t])\n\t\t\t.optional(),\n\t\tletterSpacing: z.number().optional(),\n\t\tbaselineShift: z.number().optional(),\n\t\topacity: z\n\t\t\t.union([\n\t\t\t\tz.number().min(0).max(1),\n\t\t\t\tz.custom<{ get: (ctx?: unknown) => number }>((v) =>\n\t\t\t\t\tBoolean(v && typeof v === \"object\" && \"get\" in v),\n\t\t\t\t),\n\t\t\t])\n\t\t\t.optional(),\n\t\tmark: TextSpanMarkSchema.optional(),\n\t})\n\t.strict();\n\nconst TextFields = {\n\ttext: z.string().default(\"\"),\n\tspans: z.array(TextSpanSchema).optional(),\n\tfontFamily: z.string().optional(),\n\tfontSize: z.number().positive().optional(),\n\tfontWeight: z.union([z.number().int(), z.string()]).optional(),\n\tfontStyle: z.string().optional(),\n\t/** Text color (v1 name kept). */\n\tfill: ColorSchema,\n\talign: z.enum([\"start\", \"center\", \"end\"]).optional(),\n\tverticalAlign: z.enum([\"top\", \"middle\", \"bottom\"]).optional(),\n\tlineHeight: z.number().positive().optional(),\n\tletterSpacing: z.number().optional(),\n\tbackground: ColorSchema,\n\tborderRadius: z.number().min(0).optional(),\n\tpadding: z.number().min(0).optional(),\n\tstroke: ColorSchema,\n\tstrokeWidth: z.number().min(0).optional(),\n\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\ttextShadow: z.string().optional(),\n\tshadows: z.array(TextShadowSchema).optional(),\n\tpathOptions: TextPathOptionsSchema.optional(),\n\ttypewriter: TypewriterAnimatorSchema.optional(),\n\tmarquee: KineticMarqueeConfigSchema.optional(),\n\tanimators: z\n\t\t.array(\n\t\t\tz.union([\n\t\t\t\tTextAnimatorSchema,\n\t\t\t\tAETextAnimatorSchema,\n\t\t\t\tAdvancedTextAnimatorSchema,\n\t\t\t]),\n\t\t)\n\t\t.optional(),\n} as const;\n\nexport const TextNodeSchema: z.ZodType<TextNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\t...TextFields,\n\t\tkind: z.literal(\"text\"),\n\t})\n\t.strict() as unknown as z.ZodType<TextNode>;\n\nexport const MediaNodeSchema: z.ZodType<MediaNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\tkind: z.literal(\"media\"),\n\t\t/** Graph binding — which connected input this node renders. */\n\t\tinputHandleId: z.string().min(1),\n\t\tdataType: z.string().optional(),\n\t\tfit: z.enum([\"cover\", \"contain\", \"fill\", \"none\"]).default(\"contain\"),\n\t\tborderRadius: z.number().min(0).optional(),\n\t\tborderColor: ColorSchema.optional(),\n\t\tborderWidth: z.number().min(0).optional(),\n\t\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\t\tstrokeRadius: z.number().min(0).optional(),\n\t\tvolume: z.number().min(0).max(1).default(1),\n\t\tmuted: z.boolean().default(false),\n\t\ttrimStartSec: z.number().min(0).optional(),\n\t\t// Caption styling\n\t\tfontFamily: z.string().optional(),\n\t\tfontSize: z.number().positive().optional(),\n\t\tfontWeight: z.union([z.number().int(), z.string()]).optional(),\n\t\tfontStyle: z.string().optional(),\n\t\tfill: ColorSchema,\n\t\talign: z.enum([\"start\", \"center\", \"end\"]).optional(),\n\t\tverticalAlign: z.enum([\"top\", \"middle\", \"bottom\"]).optional(),\n\t\tlineHeight: z.number().positive().optional(),\n\t\tletterSpacing: z.number().optional(),\n\t\tbackground: ColorSchema,\n\t\tpadding: z.number().min(0).optional(),\n\t\tstroke: ColorSchema,\n\t\tstrokeWidth: z.number().min(0).optional(),\n\t\ttextShadow: z.string().optional(),\n\t\tshadows: z.array(TextShadowSchema).optional(),\n\t\tmaxWidth: z.number().optional(),\n\t})\n\t.strict() as unknown as z.ZodType<MediaNode>;\n\nexport const ShapeFields = {\n\tshapeType: ShapeTypeSchema.default(\"rect\"),\n\tborderRadius: z.number().min(0).optional(),\n\tradiusTL: z.number().min(0).optional(),\n\tradiusTR: z.number().min(0).optional(),\n\tradiusBR: z.number().min(0).optional(),\n\tradiusBL: z.number().min(0).optional(),\n\tpolygonSides: z.number().int().min(3).max(64).optional(),\n\tstarPoints: z.number().int().min(3).max(64).optional(),\n\tstarInnerRadiusRatio: z.number().min(0.01).max(0.99).optional(),\n\tarrowHeadWidth: z.number().min(0).optional(),\n\tarrowHeadLength: z.number().min(0).optional(),\n\tarrowShaftWidth: z.number().min(1).optional(),\n\td: z.string().optional(),\n\tfillType: z.enum([\"solid\", \"linear\", \"radial\", \"none\"]).default(\"solid\"),\n\tfillColor: ColorSchema.default(\"#3b82f6\"),\n\tgradientEndColor: ColorSchema.optional(),\n\tgradientAngle: z.number().default(0),\n\tstrokeColor: ColorSchema.default(\"#ffffff\"),\n\tstrokeWidth: z.number().min(0).default(0),\n\tstrokeDashArray: z.string().optional(),\n\tstrokeDashOffset: z.number().default(0),\n\tstrokeLineCap: z.enum([\"butt\", \"round\", \"square\"]).default(\"round\"),\n\tstrokeLineJoin: z.enum([\"miter\", \"round\", \"bevel\"]).default(\"round\"),\n\tstrokeAlign: z.enum([\"inside\", \"center\", \"outside\"]).optional(),\n\ttrimStart: z.number().min(0).max(1).default(0),\n\ttrimEnd: z.number().min(0).max(1).default(1),\n\ttrimOffset: z.number().default(0),\n} as const;\n\nexport const ShapeNodeSchema: z.ZodType<ShapeNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\t...ShapeFields,\n\t\tkind: z.literal(\"shape\"),\n\t})\n\t.strict() as unknown as z.ZodType<ShapeNode>;\n\nexport const ColorStopSchema = z.object({\n\toffset: z.number().min(0).max(1),\n\tcolor: z.string(),\n});\nexport type ColorStop = z.infer<typeof ColorStopSchema>;\n\nexport const Model3DNodeSchema: z.ZodType<Model3DNode> = z\n\t.object({\n\t\t...BaseNodeFields,\n\t\tkind: z.literal(\"model3d\"),\n\t\tsrc: z.string().default(\"\"),\n\t\tmodelFormat: z\n\t\t\t.enum([\n\t\t\t\t\"obj\",\n\t\t\t\t\"fbx\",\n\t\t\t\t\"gltf\",\n\t\t\t\t\"glb\",\n\t\t\t\t\"stl\",\n\t\t\t\t\"ply\",\n\t\t\t\t\"vox\",\n\t\t\t\t\"3ds\",\n\t\t\t\t\"off\",\n\t\t\t\t\"auto\",\n\t\t\t])\n\t\t\t.default(\"auto\"),\n\t\tmodelData: z.unknown().optional(),\n\t\tanimationName: z.string().optional(),\n\t\tanimationProgress: z.number().min(0).max(1).default(0),\n\t\tanimationTime: z.number().min(0).default(0),\n\t\tanimationSpeed: z.number().default(1.0),\n\t\tloop: z.boolean().default(true),\n\t\twireframe: z.boolean().default(false),\n\t\ttexture: z.string().optional(),\n\t\tcenter: z.boolean().optional(),\n\t\tnormalizeSize: z.number().optional(),\n\t\tscaleX: z.number().default(1.0),\n\t\tscaleY: z.number().default(1.0),\n\t\taudioDeform: z.record(z.string(), z.unknown()).optional(),\n\t\ttext3dOptions: z.unknown().optional(),\n\t})\n\t.strict() as unknown as z.ZodType<Model3DNode>;\n\nexport const LayoutNodeSchema = z.lazy(() =>\n\tz.union([\n\t\tFlexNodeSchema,\n\t\tBlockNodeSchema,\n\t\tBoxNodeSchema,\n\t\tTextNodeSchema,\n\t\tMediaNodeSchema,\n\t\tShapeNodeSchema,\n\t\tCameraNodeSchema,\n\t\tLightNodeSchema,\n\t\tModel3DNodeSchema,\n\t]),\n) as unknown as z.ZodType<LayoutNode>;\n\n// ── the program document ──────────────────────────────────────────────\n\nexport const CompositorProgramSchema = z\n\t.object({\n\t\twidth: z.number().int().min(1).max(4096),\n\t\theight: z.number().int().min(1).max(4096),\n\t\tbackgroundColor: ColorSchema,\n\t\tvolume: z.number().min(0).max(1).default(1),\n\t\tfps: z.number().int().min(1).max(120).default(24),\n\t\tmode: z.enum([\"Video\", \"Image\"]).default(\"Video\"),\n\t\t/**\n\t\t * Multisample the 3D pass (4 samples per pixel) so mesh edges are smooth.\n\t\t * Default true; false saves the extra target memory (~60-125 MB at 1080p).\n\t\t */\n\t\tantialias3d: z.boolean().optional(),\n\t\tlayout: z.array(LayoutNodeSchema).default([]),\n\t\tfonts: z.array(z.string()).optional(),\n\t\tsignals: z.record(z.string(), z.unknown()).optional(),\n\t\t/** Composition-wide effect chain (`comp.apply(effect)`); resolved to operations downstream. */\n\t\teffects: z.array(z.unknown()).optional(),\n\t\t/** Composition-wide vision config or bundle. */\n\t\tvision: z.unknown().optional(),\n\t\t/** Per-frame notification hook. */\n\t\tonRequestFrame: z.custom<unknown>().optional(),\n\t})\n\t.strict();\n\nexport type CompositorProgramConfig = z.infer<typeof CompositorProgramSchema>;\n","/**\n * @file program/sequence.ts\n * @module @framefields/compositions/program/sequence\n *\n * Multi-Scene Timeline Orchestration, Camera Choreography & Carrier Match Cuts.\n * Complies with specs/cinematic-sequencing.ts.\n */\n\nimport { z } from \"zod\";\nimport type { CompositorProgramConfig, LayoutNode } from \"./schema.js\";\n\n// ==============================================================================================\n// 1. DATA SCHEMAS & CONFIGURATION\n// ==============================================================================================\n\n/**\n * Camera Transition Type across scene boundaries.\n */\nexport const SceneTransitionTypeSchema = z.enum([\n\t\"cut\", // Instant zero-frame hard cut\n\t\"carrierMatchCut\", // Smooth position/velocity continuous carrier handoff\n\t\"cameraWhip\", // Fast motion-blurred spatial pan transition\n\t\"focusPullDissolve\", // Optical DoF defocus -> refocus dissolve\n\t\"irisAperture\", // Non-linear optical circle zoom reveal\n\t\"pushDirectional\", // Spatial slide push along dominant motion axis\n]);\n\nexport type SceneTransitionType = z.infer<typeof SceneTransitionTypeSchema>;\n\n/**\n * Carrier Object Handoff Configuration Schema.\n */\nexport const CarrierHandoffConfigSchema = z\n\t.object({\n\t\t/** Layer ID of the carrier element in the outgoing scene */\n\t\tsourceLayerId: z.string(),\n\n\t\t/** Layer ID of the recipient element in the incoming scene */\n\t\ttargetLayerId: z.string(),\n\n\t\t/**\n\t\t * Spatial continuity mode:\n\t\t * - \"exact\": Preserves exact screen-space (x, y, scale) across the cut.\n\t\t * - \"preserveVelocity\": Preserves directional derivative dx/dt across cut.\n\t\t * - \"morph\": Interpolates geometry bounds across transition overlap.\n\t\t * Default: \"preserveVelocity\"\n\t\t */\n\t\tmode: z\n\t\t\t.enum([\"exact\", \"preserveVelocity\", \"morph\"])\n\t\t\t.default(\"preserveVelocity\"),\n\n\t\t/** Transition blend duration in frames (0 for instant zero-overlap cut) */\n\t\tblendFrames: z.number().int().min(0).max(30).default(0),\n\t})\n\t.strict();\n\nexport type CarrierHandoffConfig = z.infer<typeof CarrierHandoffConfigSchema>;\n\n/**\n * Individual Scene Definition Schema.\n */\nexport const SceneDefinitionSchema = z\n\t.object({\n\t\t/** Unique identifier for the scene (e.g. \"act-1-kinetic-hook\") */\n\t\tid: z.string(),\n\n\t\t/** Narrative chapter classification */\n\t\tchapter: z\n\t\t\t.enum([\n\t\t\t\t\"hook\",\n\t\t\t\t\"tension\",\n\t\t\t\t\"solution\",\n\t\t\t\t\"feature_spotlight\",\n\t\t\t\t\"outro\",\n\t\t\t\t\"custom\",\n\t\t\t])\n\t\t\t.default(\"custom\"),\n\n\t\t/** Scene duration in milliseconds or frames */\n\t\tdurationMs: z.number().positive().optional(),\n\t\tdurationFrames: z.number().int().positive().optional(),\n\n\t\t/** Transition into the next scene */\n\t\ttransitionOut: z\n\t\t\t.object({\n\t\t\t\ttype: SceneTransitionTypeSchema.default(\"cut\"),\n\t\t\t\tdurationFrames: z.number().int().min(0).default(0),\n\t\t\t\tcarrier: CarrierHandoffConfigSchema.optional(),\n\t\t\t\twhipDirection: z.enum([\"left\", \"right\", \"up\", \"down\"]).default(\"left\"),\n\t\t\t})\n\t\t\t.default({ type: \"cut\", durationFrames: 0, whipDirection: \"left\" }),\n\t})\n\t.passthrough();\n\nexport type SceneDefinition = z.infer<typeof SceneDefinitionSchema>;\n\n// ==============================================================================================\n// 2. MATHEMATICAL MODEL FOR CARRIER MATCH CUTS\n// ==============================================================================================\n\nexport interface CarrierState {\n\tx: number;\n\ty: number;\n\tscale: number;\n\tvx: number;\n\tvy: number;\n}\n\nexport function computeCarrierContinuity(\n\tstateAtCut: CarrierState,\n\ttargetInitialState: Partial<CarrierState>,\n): CarrierState {\n\treturn {\n\t\tx: stateAtCut.x,\n\t\ty: stateAtCut.y,\n\t\tscale: stateAtCut.scale,\n\t\tvx: stateAtCut.vx,\n\t\tvy: stateAtCut.vy,\n\t\t...targetInitialState,\n\t};\n}\n\n// ==============================================================================================\n// 3. MULTI-ACT SEQUENCE BUILDER & TIMELINE ORCHESTRATION\n// ==============================================================================================\n\nexport interface SequenceTimelineResult {\n\ttotalFrames: number;\n\ttotalDurationMs: number;\n\tsceneOffsets: Array<{\n\t\tsceneId: string;\n\t\tstartFrame: number;\n\t\tdurationFrames: number;\n\t}>;\n}\n\n/**\n * Calculates global scene offsets and handoff frames across a sequence.\n */\nexport function calculateSequenceTimeline(\n\tscenes: Array<{\n\t\tid: string;\n\t\tdurationFrames?: number;\n\t\tdurationMs?: number;\n\t\ttransitionOverlap?: number;\n\t\ttransitionOut?: { durationFrames?: number };\n\t}>,\n\tfps = 60,\n): SequenceTimelineResult {\n\tlet accumulatedFrame = 0;\n\tconst offsets: Array<{\n\t\tsceneId: string;\n\t\tstartFrame: number;\n\t\tdurationFrames: number;\n\t}> = [];\n\n\tfor (const scene of scenes) {\n\t\tconst startFrame = accumulatedFrame;\n\t\tconst dur =\n\t\t\tscene.durationFrames ??\n\t\t\t(scene.durationMs ? Math.round((scene.durationMs / 1000) * fps) : 60);\n\n\t\toffsets.push({ sceneId: scene.id, startFrame, durationFrames: dur });\n\t\tconst overlap =\n\t\t\tscene.transitionOverlap ?? scene.transitionOut?.durationFrames ?? 0;\n\t\taccumulatedFrame += Math.max(1, dur - overlap);\n\t}\n\n\tconst totalFrames = accumulatedFrame;\n\tconst totalDurationMs = Math.round((totalFrames / fps) * 1000);\n\n\treturn {\n\t\ttotalFrames,\n\t\ttotalDurationMs,\n\t\tsceneOffsets: offsets,\n\t};\n}\n\nexport interface SceneOptions {\n\tid: string;\n\tchapter?:\n\t\t| \"hook\"\n\t\t| \"tension\"\n\t\t| \"solution\"\n\t\t| \"feature_spotlight\"\n\t\t| \"outro\"\n\t\t| \"custom\";\n\tdurationMs?: number;\n\tdurationFrames?: number;\n\ttransitionOut?: {\n\t\ttype?: SceneTransitionType;\n\t\tdurationFrames?: number;\n\t\tcarrier?: CarrierHandoffConfig;\n\t\twhipDirection?: \"left\" | \"right\" | \"up\" | \"down\";\n\t};\n\tlayout?: LayoutNode[];\n}\n\nexport class Scene {\n\tpublic id: string;\n\tpublic chapter:\n\t\t| \"hook\"\n\t\t| \"tension\"\n\t\t| \"solution\"\n\t\t| \"feature_spotlight\"\n\t\t| \"outro\"\n\t\t| \"custom\";\n\tpublic durationMs?: number;\n\tpublic durationFrames?: number;\n\tpublic transitionOut: {\n\t\ttype: SceneTransitionType;\n\t\tdurationFrames: number;\n\t\tcarrier?: CarrierHandoffConfig;\n\t\twhipDirection: \"left\" | \"right\" | \"up\" | \"down\";\n\t};\n\tpublic layout: LayoutNode[];\n\n\tconstructor(options: SceneOptions) {\n\t\tthis.id = options.id;\n\t\tthis.chapter = options.chapter ?? \"custom\";\n\t\tthis.durationMs = options.durationMs;\n\t\tthis.durationFrames = options.durationFrames;\n\t\tthis.transitionOut = {\n\t\t\ttype: options.transitionOut?.type ?? \"cut\",\n\t\t\tdurationFrames: options.transitionOut?.durationFrames ?? 0,\n\t\t\tcarrier: options.transitionOut?.carrier,\n\t\t\twhipDirection: options.transitionOut?.whipDirection ?? \"left\",\n\t\t};\n\t\tthis.layout = options.layout ?? [];\n\t}\n\n\tstatic create(options: SceneOptions): Scene {\n\t\treturn new Scene(options);\n\t}\n}\n\nexport interface SequenceOptions {\n\tfps?: number;\n\twidth?: number;\n\theight?: number;\n\tbackgroundColor?: string;\n\tfonts?: string[];\n\tsignals?: Record<string, unknown>;\n\tscenes?: Scene[];\n}\n\nexport class Sequence {\n\tpublic fps: number;\n\tpublic width: number;\n\tpublic height: number;\n\tpublic backgroundColor: string;\n\tpublic fonts?: string[];\n\tpublic signals?: Record<string, unknown>;\n\tprivate scenes: Scene[] = [];\n\n\tconstructor(options: SequenceOptions = {}) {\n\t\tthis.fps = options.fps ?? 60;\n\t\tthis.width = options.width ?? 1920;\n\t\tthis.height = options.height ?? 1080;\n\t\tthis.backgroundColor = options.backgroundColor ?? \"#ffffff\";\n\t\tthis.fonts = options.fonts;\n\t\tthis.signals = options.signals;\n\t\tif (options.scenes) {\n\t\t\tfor (const sc of options.scenes) {\n\t\t\t\tthis.addScene(sc);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic create(options: SequenceOptions = {}): Sequence {\n\t\treturn new Sequence(options);\n\t}\n\n\taddScene(scene: Scene | SceneOptions): this {\n\t\tconst s = scene instanceof Scene ? scene : new Scene(scene);\n\t\tthis.scenes.push(s);\n\t\treturn this;\n\t}\n\n\tgetScenes(): readonly Scene[] {\n\t\treturn this.scenes;\n\t}\n\n\tcalculateTimeline(): SequenceTimelineResult {\n\t\treturn calculateSequenceTimeline(this.scenes, this.fps);\n\t}\n\n\ttoProgram(): CompositorProgramConfig {\n\t\tconst timeline = this.calculateTimeline();\n\t\tconst rootLayout: LayoutNode[] = [];\n\n\t\tfor (let i = 0; i < this.scenes.length; i++) {\n\t\t\tconst scene = this.scenes[i];\n\t\t\tconst offset = timeline.sceneOffsets[i];\n\t\t\tif (!offset) continue;\n\n\t\t\t// Wrap scene elements inside a temporal container or offset their startFrames\n\t\t\tfor (const node of scene.layout) {\n\t\t\t\tconst cloned = { ...node } as LayoutNode;\n\t\t\t\tcloned.startFrame = (cloned.startFrame ?? 0) + offset.startFrame;\n\t\t\t\tif (cloned.durationFrames === undefined) {\n\t\t\t\t\tcloned.durationFrames = offset.durationFrames;\n\t\t\t\t}\n\t\t\t\trootLayout.push(cloned);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tbackgroundColor: this.backgroundColor,\n\t\t\tfps: this.fps,\n\t\t\tvolume: 1,\n\t\t\tmode: \"Video\",\n\t\t\tlayout: rootLayout,\n\t\t\tfonts: this.fonts,\n\t\t\tsignals: this.signals,\n\t\t};\n\t}\n}\n","export type StaggerDirection = \"forward\" | \"reverse\" | \"center-out\";\n\n/**\n * Calculates the frame delay offset for a child at `index` in a container of `totalCount` items.\n */\nexport function computeStaggerDelay(\n\tindex: number,\n\ttotalCount: number,\n\tstaggerFrames: number,\n\tdirection: StaggerDirection = \"forward\",\n): number {\n\tif (staggerFrames <= 0 || totalCount <= 1) return 0;\n\n\tswitch (direction) {\n\t\tcase \"reverse\":\n\t\t\treturn (totalCount - 1 - index) * staggerFrames;\n\t\tcase \"center-out\": {\n\t\t\tconst center = (totalCount - 1) / 2;\n\t\t\tconst dist = Math.abs(index - center);\n\t\t\treturn Math.round(dist * staggerFrames);\n\t\t}\n\t\tcase \"forward\":\n\t\tdefault:\n\t\t\treturn index * staggerFrames;\n\t}\n}\n\n/**\n * Applies stagger timing offsets to child nodes, returning cloned objects with adjusted `startFrame`.\n */\nexport function applyStaggerToChildren<T extends { startFrame?: number }>(\n\tchildren: T[],\n\tstaggerFrames: number,\n\tdirection: StaggerDirection = \"forward\",\n\tbaseOffset = 0,\n): T[] {\n\tif (!children || children.length === 0) return [];\n\tif (staggerFrames <= 0 && baseOffset === 0) return [...children];\n\n\treturn children.map((child, idx) => {\n\t\tconst delay = computeStaggerDelay(\n\t\t\tidx,\n\t\t\tchildren.length,\n\t\t\tstaggerFrames,\n\t\t\tdirection,\n\t\t);\n\t\tconst currentStart = child.startFrame ?? 0;\n\t\treturn {\n\t\t\t...child,\n\t\t\tstartFrame: currentStart + delay + baseOffset,\n\t\t};\n\t});\n}\n","/**\n * The ONE constructor from document to render tree (spec: SKILL.md).\n *\n * A validated v2 program (`CompositorProgramConfig`) becomes the\n * `VirtualMediaData` tree the compositor renderer consumes. Every layout node\n * becomes a `CompositorLayer` op carrying its document fields verbatim\n * (id/kind/style/timing/animation); containers carry nested node ops as\n * children; media nodes bind their graph source as the content child when\n * resolved.\n *\n * Pure + deterministic: same doc → same tree. No width/height resolution\n * here — geometry comes from `computeLayout` at render time.\n */\nimport {\n\tcreateVirtualMedia,\n\ttype DataType,\n\tgetActiveMediaMetadata,\n\ttype VirtualMediaData,\n} from \"@framefields/core\";\nimport { collectInlineSignals } from \"./inline-signals.js\";\nimport type { CompositorProgramConfig, LayoutNode } from \"./schema.js\";\n\nimport { computeStaggerDelay } from \"./stagger.js\";\n\nexport interface CompositorToProgramOptions {\n\tisVideoMode: boolean;\n\tfps: number;\n\t/** Comp duration in ms (metadata only; derived upstream). */\n\tdurationMs?: number;\n\t/** Bind a media node's `inputHandleId` to its graph source item. */\n\tresolveMedia?: (inputHandleId: string) => VirtualMediaData | undefined;\n\t/** External signals mapped by inputHandleId. */\n\tsignals?: Record<string, any>;\n}\n\nfunction nodeToVirtualMedia(\n\tnode: LayoutNode,\n\tresolveMedia: CompositorToProgramOptions[\"resolveMedia\"],\n\tfps: number,\n\tinheritedOffset = 0,\n\tcompDurationMs?: number,\n\tinheritedDurationFrames?: number,\n): VirtualMediaData {\n\tlet children: VirtualMediaData[] = [];\n\tconst sourceRef = (node as any).src ?? (node as any).inputHandleId;\n\tconst isDirectMediaSource = (s: unknown) =>\n\t\ttypeof s === \"string\" &&\n\t\t(s.startsWith(\"http://\") ||\n\t\t\ts.startsWith(\"https://\") ||\n\t\t\ts.startsWith(\"file://\") ||\n\t\t\ts.startsWith(\"/\") ||\n\t\t\ts.startsWith(\"./\") ||\n\t\t\ts.startsWith(\"blob:\") ||\n\t\t\ts.startsWith(\"data:\") ||\n\t\t\t/\\.(png|jpe?g|webp|gif|svg|mp4|webm|mov|mkv|mp3|wav|ogg|m4a|srt|vtt)$/i.test(\n\t\t\t\ts,\n\t\t\t));\n\n\tlet media: VirtualMediaData | undefined;\n\tif (node.kind === \"media\") {\n\t\tif (resolveMedia) {\n\t\t\tmedia = resolveMedia(node.inputHandleId);\n\t\t}\n\t\tif (\n\t\t\t!media &&\n\t\t\tsourceRef &&\n\t\t\t(isDirectMediaSource(sourceRef) || (node as any).src)\n\t\t) {\n\t\t\tmedia = createVirtualMedia(\n\t\t\t\tsourceRef,\n\t\t\t\t(node.dataType as DataType) ?? \"Video\",\n\t\t\t);\n\t\t}\n\t\tif (media && (node as any).crop) {\n\t\t\tconst cropRaw = (node as any).crop;\n\t\t\tconst cropOp =\n\t\t\t\ttypeof cropRaw.toOperation === \"function\"\n\t\t\t\t\t? cropRaw.toOperation()\n\t\t\t\t\t: cropRaw;\n\t\t\tmedia = {\n\t\t\t\tmetadata: { ...media.metadata },\n\t\t\t\toperation: {\n\t\t\t\t\top: \"Crop\",\n\t\t\t\t\t...cropOp,\n\t\t\t\t\tdataType: media.operation.dataType,\n\t\t\t\t},\n\t\t\t\tchildren: [media],\n\t\t\t} as unknown as VirtualMediaData;\n\t\t}\n\t\tif (media && Array.isArray((node as any).effects)) {\n\t\t\tfor (const eff of (node as any).effects) {\n\t\t\t\tconst effOp =\n\t\t\t\t\ttypeof eff.toOperation === \"function\" ? eff.toOperation() : eff;\n\t\t\t\tmedia = {\n\t\t\t\t\tmetadata: { ...media.metadata },\n\t\t\t\t\toperation: {\n\t\t\t\t\t\tid: (node as any).id\n\t\t\t\t\t\t\t? `${(node as any).id}-${effOp.op ?? \"effect\"}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\teffect: eff,\n\t\t\t\t\t\t...effOp,\n\t\t\t\t\t\tdataType: media.operation.dataType,\n\t\t\t\t\t},\n\t\t\t\t\tchildren: [media],\n\t\t\t\t} as unknown as VirtualMediaData;\n\t\t\t}\n\t\t}\n\t\tif (media && (node as any).vision) {\n\t\t\tconst visionRaw = (node as any).vision;\n\t\t\tconst visionOp =\n\t\t\t\ttypeof visionRaw.toOperation === \"function\"\n\t\t\t\t\t? visionRaw.toOperation()\n\t\t\t\t\t: visionRaw;\n\t\t\tmedia = {\n\t\t\t\tmetadata: { ...media.metadata },\n\t\t\t\toperation: {\n\t\t\t\t\top: \"Vision\",\n\t\t\t\t\tid: (node as any).id,\n\t\t\t\t\teffect: visionRaw,\n\t\t\t\t\t...visionOp,\n\t\t\t\t\tdataType: media.operation.dataType,\n\t\t\t\t},\n\t\t\t\tchildren: [media],\n\t\t\t} as unknown as VirtualMediaData;\n\t\t}\n\t}\n\n\tif (node.kind === \"media\") {\n\t\tchildren = media ? [media] : [];\n\t} else if (\"children\" in node && node.children) {\n\t\tconst staggerFrames =\n\t\t\t\"staggerFrames\" in node && typeof (node as any).staggerFrames === \"number\"\n\t\t\t\t? (node as any).staggerFrames\n\t\t\t\t: 0;\n\t\tconst staggerDirection =\n\t\t\t\"staggerDirection\" in node &&\n\t\t\ttypeof (node as any).staggerDirection === \"string\"\n\t\t\t\t? (node as any).staggerDirection\n\t\t\t\t: \"forward\";\n\n\t\tconst nodeStart =\n\t\t\ttypeof node.startFrame === \"number\" && Number.isFinite(node.startFrame)\n\t\t\t\t? Math.round(node.startFrame)\n\t\t\t\t: 0;\n\t\tconst nodeDuration =\n\t\t\ttypeof node.durationFrames === \"number\" &&\n\t\t\tNumber.isFinite(node.durationFrames)\n\t\t\t\t? Math.round(node.durationFrames)\n\t\t\t\t: inheritedDurationFrames;\n\t\tchildren = node.children.map((c, idx) => {\n\t\t\tconst delay = computeStaggerDelay(\n\t\t\t\tidx,\n\t\t\t\tnode.children!.length,\n\t\t\t\tstaggerFrames,\n\t\t\t\tstaggerDirection,\n\t\t\t);\n\t\t\tconst childOffset = inheritedOffset + nodeStart + delay;\n\t\t\treturn nodeToVirtualMedia(\n\t\t\t\tc,\n\t\t\t\tresolveMedia,\n\t\t\t\tfps,\n\t\t\t\tchildOffset,\n\t\t\t\tcompDurationMs,\n\t\t\t\tc.durationFrames === undefined ? nodeDuration : undefined,\n\t\t\t);\n\t\t});\n\t}\n\n\tlet dataType: DataType = \"Image\";\n\tlet limit: number | undefined;\n\tif (media) {\n\t\tdataType = media.operation?.dataType ?? \"Image\";\n\t\tconst isStaticAsset = dataType === \"Image\" || dataType === \"SVG\";\n\t\tconst durationMs = isStaticAsset\n\t\t\t? undefined\n\t\t\t: getActiveMediaMetadata(media)?.durationMs;\n\t\tif (durationMs !== undefined && durationMs !== null) {\n\t\t\tlimit = Math.max(1, Math.round((durationMs / 1000) * fps));\n\t\t}\n\t}\n\n\tconst isCaption = media?.operation?.dataType === \"Caption\";\n\tconst isContainer =\n\t\tnode.kind === \"flex\" || node.kind === \"block\" || node.kind === \"box\";\n\tconst startFrame =\n\t\t(typeof node.startFrame === \"number\" &&\n\t\tNumber.isFinite(node.startFrame) &&\n\t\tnode.startFrame >= 0\n\t\t\t? Math.round(node.startFrame)\n\t\t\t: 0) + inheritedOffset;\n\tlet dur =\n\t\ttypeof node.durationFrames === \"number\" &&\n\t\tNumber.isFinite(node.durationFrames) &&\n\t\tnode.durationFrames > 0\n\t\t\t? Math.round(node.durationFrames)\n\t\t\t: undefined;\n\n\tconst defaultCompDuration =\n\t\tinheritedDurationFrames ??\n\t\tMath.round(((compDurationMs ?? 10000) / 1000) * fps);\n\n\tif (isContainer && children.length > 0) {\n\t\t// A container without its own timing keeps its parent's clock — its keyframes\n\t\t// are authored parent-relative and its background shows before its first child\n\t\t// arrives — and stays active until its last child ends.\n\t\t// Also when its own durationFrames is unusable (0, NaN): `dur` is unset then.\n\t\tif (dur === undefined) {\n\t\t\tconst childEnds = children.map(\n\t\t\t\t(c) =>\n\t\t\t\t\t((c.operation as any)?.startFrame ?? 0) +\n\t\t\t\t\t((c.operation as any)?.durationFrames ?? defaultCompDuration),\n\t\t\t);\n\t\t\tdur = Math.max(1, Math.max(...childEnds) - startFrame);\n\t\t}\n\t} else {\n\t\tif (isCaption && limit !== undefined && limit > 0) {\n\t\t\tdur = limit;\n\t\t} else if (dur !== undefined) {\n\t\t\tif (\n\t\t\t\t(dataType === \"Video\" || dataType === \"Audio\") &&\n\t\t\t\tlimit !== undefined &&\n\t\t\t\tlimit > 0\n\t\t\t) {\n\t\t\t\tdur = Math.min(dur, limit);\n\t\t\t}\n\t\t} else {\n\t\t\tdur =\n\t\t\t\tlimit ??\n\t\t\t\tinheritedDurationFrames ??\n\t\t\t\tMath.round(((compDurationMs ?? 10000) / 1000) * fps);\n\t\t}\n\t}\n\n\tconst durationMs = (dur / fps) * 1000;\n\n\tif (node.kind === \"media\" && media) {\n\t\tif (!media.metadata?.durationMs || media.metadata.durationMs <= 0) {\n\t\t\tif (!media.metadata)\n\t\t\t\t(media as unknown as { metadata: Record<string, unknown> }).metadata =\n\t\t\t\t\t{};\n\t\t\tmedia.metadata.durationMs = durationMs;\n\t\t}\n\t}\n\n\treturn {\n\t\tmetadata: {\n\t\t\tdurationMs,\n\t\t},\n\t\toperation: {\n\t\t\top: \"CompositorLayer\",\n\t\t\t...node,\n\t\t\tstartFrame,\n\t\t\tdurationFrames: dur,\n\t\t\tdataType,\n\t\t},\n\t\tchildren,\n\t} as unknown as VirtualMediaData;\n}\n\nexport function compositorToProgram(\n\tconfig: CompositorProgramConfig,\n\toptions: CompositorToProgramOptions,\n): VirtualMediaData {\n\tconst { isVideoMode, fps, durationMs, resolveMedia, signals } = options;\n\n\tlet rootMedia: VirtualMediaData = {\n\t\tmetadata: {\n\t\t\twidth: config.width,\n\t\t\theight: config.height,\n\t\t\tfps,\n\t\t\t...(durationMs !== undefined && { durationMs }),\n\t\t},\n\t\toperation: {\n\t\t\top: \"Compositor\",\n\t\t\twidth: config.width,\n\t\t\theight: config.height,\n\t\t\tfps,\n\t\t\tmode: config.mode ?? \"Video\",\n\t\t\tbackgroundColor: config.backgroundColor,\n\t\t\t...(config.antialias3d !== undefined && {\n\t\t\t\tantialias3d: config.antialias3d,\n\t\t\t}),\n\t\t\t// Master gain — consumed by the compositor's audio processor when\n\t\t\t// the extractor dispatches the root op (audio-processor.ts).\n\t\t\tvolume: config.volume ?? 1,\n\t\t\tdataType: isVideoMode ? \"Video\" : \"Image\",\n\t\t\t// Debug-only snapshot of the document (L7): the render tree is\n\t\t\t// `children`; this copy exists for tree inspection in devtools and\n\t\t\t// is NOT read by the renderer — do not treat it as the source of\n\t\t\t// truth (the config is).\n\t\t\tlayout: config.layout,\n\t\t\t// Signal objects passed straight to `LayerAnimation.signal` ride on\n\t\t\t// their tracks; fold them in under their generated handle ids.\n\t\t\tsignals: {\n\t\t\t\t...collectInlineSignals(config.layout),\n\t\t\t\t...(signals ?? (config as any).signals ?? {}),\n\t\t\t},\n\t\t\t...(((config as any).onRequestFrame ||\n\t\t\t\t(options as any).onRequestFrame) && {\n\t\t\t\tonRequestFrame:\n\t\t\t\t\t(config as any).onRequestFrame ?? (options as any).onRequestFrame,\n\t\t\t}),\n\t\t},\n\t\tchildren: config.layout.map((n) =>\n\t\t\tnodeToVirtualMedia(n, resolveMedia, fps, 0, durationMs),\n\t\t),\n\t} as unknown as VirtualMediaData;\n\n\tconst effectsList: any[] = Array.isArray((options as any).effects)\n\t\t? (options as any).effects\n\t\t: Array.isArray((config as any).effects)\n\t\t\t? (config as any).effects\n\t\t\t: [];\n\tfor (const eff of effectsList) {\n\t\tconst effOp =\n\t\t\ttypeof eff.toOperation === \"function\" ? eff.toOperation() : eff;\n\t\trootMedia = {\n\t\t\tmetadata: { ...rootMedia.metadata },\n\t\t\toperation: {\n\t\t\t\t...effOp,\n\t\t\t\tdataType: rootMedia.operation.dataType,\n\t\t\t},\n\t\t\tchildren: [rootMedia],\n\t\t} as unknown as VirtualMediaData;\n\t}\n\n\tconst visionRaw = (config as any).vision ?? (options as any).vision;\n\tif (visionRaw) {\n\t\tconst visionOp =\n\t\t\ttypeof visionRaw.toOperation === \"function\"\n\t\t\t\t? visionRaw.toOperation()\n\t\t\t\t: visionRaw;\n\t\trootMedia = {\n\t\t\tmetadata: { ...rootMedia.metadata },\n\t\t\toperation: {\n\t\t\t\top: \"Vision\",\n\t\t\t\t...visionOp,\n\t\t\t\tdataType: rootMedia.operation.dataType,\n\t\t\t},\n\t\t\tchildren: [rootMedia],\n\t\t} as unknown as VirtualMediaData;\n\t}\n\n\treturn rootMedia;\n}\n\n/** Recursively gather every node op from a render tree (in order). */\nexport function collectNodeOps(nodes: VirtualMediaData[]): VirtualMediaData[] {\n\tconst out: VirtualMediaData[] = [];\n\tconst walk = (vm: VirtualMediaData) => {\n\t\tif (vm?.operation?.op === \"CompositorLayer\") {\n\t\t\tout.push(vm);\n\t\t}\n\t\tfor (const c of vm?.children ?? []) walk(c);\n\t};\n\tfor (const n of nodes) walk(n);\n\treturn out;\n}\n","/**\n * Coded validation for the v2 program document (spec: SKILL.md).\n *\n * Runs on the RAW input BEFORE zod: zod strips unknown keys silently, so\n * v1 shapes (`layers`, `layerUpdates`, `FPS`) and structural errors must be\n * caught in a pre-parse walk or the E-codes never fire. The zod schema then\n * handles shape/refinement errors (mapped to E1xxx-style issues).\n */\nimport {\n\ttype CompositorProgramConfig,\n\tCompositorProgramSchema,\n\ttype LayoutNode,\n} from \"./schema.js\";\n\nexport interface ProgramIssue {\n\tcode: string;\n\tpath: (string | number)[];\n\tmessage: string;\n}\n\nexport type ProgramValidationResult =\n\t| { ok: true }\n\t| { ok: false; issues: ProgramIssue[] };\n\nconst KIND_SET = new Set([\n\t\"flex\",\n\t\"block\",\n\t\"box\",\n\t\"text\",\n\t\"media\",\n\t\"shape\",\n]);\nconst MAX_NODES = 512;\nconst MAX_DEPTH = 64;\n\nconst issue = (\n\tcode: string,\n\tpath: (string | number)[],\n\tmessage: string,\n): ProgramIssue => ({ code, path, message });\n\nexport function validateLayoutProgram(raw: unknown): ProgramValidationResult {\n\tconst issues: ProgramIssue[] = [];\n\n\tif (!raw || typeof raw !== \"object\" || Array.isArray(raw)) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tissues: [issue(\"E1001\", [], \"Compositor config must be an object.\")],\n\t\t};\n\t}\n\tconst obj = raw as Record<string, unknown>;\n\n\t// v1 shapes die here (no backwards compatibility).\n\tif (\"layers\" in obj) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\t\"E1001\",\n\t\t\t\t[\"layers\"],\n\t\t\t\t\"Config v2 uses `layout` — `layers` is removed.\",\n\t\t\t),\n\t\t);\n\t}\n\tif (\"layerUpdates\" in obj) {\n\t\tissues.push(\n\t\t\tissue(\n\t\t\t\t\"E1001\",\n\t\t\t\t[\"layerUpdates\"],\n\t\t\t\t\"Config v2 uses `layout` — `layerUpdates` is removed.\",\n\t\t\t),\n\t\t);\n\t}\n\tif (\"FPS\" in obj) {\n\t\tissues.push(\n\t\t\tissue(\"E1001\", [\"FPS\"], \"Config v2 uses `fps` — `FPS` is removed.\"),\n\t\t);\n\t}\n\n\tconst seenIds = new Set<string>();\n\tlet nodeCount = 0;\n\tconst isImageMode = obj.mode === \"Image\";\n\n\tconst walk = (node: unknown, path: (string | number)[], depth: number) => {\n\t\tif (depth > MAX_DEPTH) {\n\t\t\tissues.push(\n\t\t\t\tissue(\n\t\t\t\t\t\"E1212\",\n\t\t\t\t\t[...path, \"children\"],\n\t\t\t\t\t`Layout nesting exceeds ${MAX_DEPTH} levels.`,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tif (!node || typeof node !== \"object\" || Array.isArray(node)) {\n\t\t\tissues.push(issue(\"E1201\", path, \"Layout node must be an object.\"));\n\t\t\treturn;\n\t\t}\n\t\tnodeCount += 1;\n\t\tif (nodeCount > MAX_NODES) {\n\t\t\tissues.push(\n\t\t\t\tissue(\"E1211\", path, `Composition exceeds ${MAX_NODES} nodes.`),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst n = node as Record<string, unknown>;\n\t\tconst kind = n.kind;\n\n\t\tif (typeof kind !== \"string\" || !KIND_SET.has(kind)) {\n\t\t\tissues.push(\n\t\t\t\tissue(\n\t\t\t\t\t\"E1201\",\n\t\t\t\t\t[...path, \"kind\"],\n\t\t\t\t\t`Unknown layout node kind '${String(kind)}'. Expected one of: flex, block, box, text, media, shape.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tconst id = n.id;\n\t\tif (typeof id !== \"string\" || id.length === 0) {\n\t\t\tissues.push(\n\t\t\t\tissue(\n\t\t\t\t\t\"E1203\",\n\t\t\t\t\t[...path, \"id\"],\n\t\t\t\t\t\"Layout node requires a non-empty `id`.\",\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (seenIds.has(id)) {\n\t\t\tissues.push(\n\t\t\t\tissue(\"E1202\", [...path, \"id\"], `Duplicate node id '${id}'.`),\n\t\t\t);\n\t\t} else {\n\t\t\tseenIds.add(id);\n\t\t}\n\n\t\t// SizeSpec sanity: numeric sizes must be finite and >= 0.\n\t\tfor (const axis of [\"width\", \"height\"] as const) {\n\t\t\tconst v = n[axis];\n\t\t\tif (typeof v === \"number\" && (!Number.isFinite(v) || v < 0)) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(\n\t\t\t\t\t\t\"E1205\",\n\t\t\t\t\t\t[...path, axis],\n\t\t\t\t\t\t`SizeSpec must be a finite number >= 0 or one of \"auto\" | \"fit\" | \"fill\".`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\ttypeof v === \"string\" &&\n\t\t\t\tv !== \"auto\" &&\n\t\t\t\tv !== \"fit\" &&\n\t\t\t\tv !== \"fill\"\n\t\t\t) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(\n\t\t\t\t\t\t\"E1205\",\n\t\t\t\t\t\t[...path, axis],\n\t\t\t\t\t\t`SizeSpec must be a finite number >= 0 or one of \"auto\" | \"fit\" | \"fill\".`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst position = n.position;\n\t\tconst isAbsolute = position === \"absolute\";\n\t\tif (isAbsolute) {\n\t\t\tif (typeof n.x !== \"number\" || typeof n.y !== \"number\") {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(\n\t\t\t\t\t\t\"E1206\",\n\t\t\t\t\t\t[...path],\n\t\t\t\t\t\t\"An absolute node requires numeric `x` and `y`.\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (n.grow !== undefined) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(\n\t\t\t\t\t\t\"E1209\",\n\t\t\t\t\t\t[...path, \"grow\"],\n\t\t\t\t\t\t\"`grow` is not allowed on an absolute node (it is out of flow).\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tkind === \"media\" &&\n\t\t\t(typeof n.inputHandleId !== \"string\" || n.inputHandleId.length === 0)\n\t\t) {\n\t\t\tissues.push(\n\t\t\t\tissue(\n\t\t\t\t\t\"E1204\",\n\t\t\t\t\t[...path, \"inputHandleId\"],\n\t\t\t\t\t\"A media node requires a non-empty `inputHandleId`.\",\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (kind === \"text\" && typeof n.fontSize === \"number\" && n.fontSize <= 0) {\n\t\t\tissues.push(\n\t\t\t\tissue(\n\t\t\t\t\t\"E1210\",\n\t\t\t\t\t[...path, \"fontSize\"],\n\t\t\t\t\t\"A text node requires fontSize > 0.\",\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (kind === \"shape\") {\n\t\t\tif (n.trimStart !== undefined) {\n\t\t\t\tconst ts = n.trimStart;\n\t\t\t\tif (\n\t\t\t\t\ttypeof ts !== \"number\" ||\n\t\t\t\t\t!Number.isFinite(ts) ||\n\t\t\t\t\tNumber.isNaN(ts) ||\n\t\t\t\t\tts < 0 ||\n\t\t\t\t\tts > 1\n\t\t\t\t) {\n\t\t\t\t\tissues.push(\n\t\t\t\t\t\tissue(\n\t\t\t\t\t\t\t\"E1208\",\n\t\t\t\t\t\t\t[...path, \"trimStart\"],\n\t\t\t\t\t\t\t\"`trimStart` must be a finite number between 0 and 1.\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (n.trimEnd !== undefined) {\n\t\t\t\tconst te = n.trimEnd;\n\t\t\t\tif (\n\t\t\t\t\ttypeof te !== \"number\" ||\n\t\t\t\t\t!Number.isFinite(te) ||\n\t\t\t\t\tNumber.isNaN(te) ||\n\t\t\t\t\tte < 0 ||\n\t\t\t\t\tte > 1\n\t\t\t\t) {\n\t\t\t\t\tissues.push(\n\t\t\t\t\t\tissue(\n\t\t\t\t\t\t\t\"E1208\",\n\t\t\t\t\t\t\t[...path, \"trimEnd\"],\n\t\t\t\t\t\t\t\"`trimEnd` must be a finite number between 0 and 1.\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Timing fields only apply to Video mode; Image mode ignores duration/startFrame.\n\t\tif (!isImageMode) {\n\t\t\tif (n.durationFrames !== undefined) {\n\t\t\t\tconst df = n.durationFrames;\n\t\t\t\tif (\n\t\t\t\t\ttypeof df !== \"number\" ||\n\t\t\t\t\t!Number.isFinite(df) ||\n\t\t\t\t\tNumber.isNaN(df) ||\n\t\t\t\t\tdf < 1 ||\n\t\t\t\t\t!Number.isInteger(df)\n\t\t\t\t) {\n\t\t\t\t\tissues.push(\n\t\t\t\t\t\tissue(\n\t\t\t\t\t\t\t\"E1207\",\n\t\t\t\t\t\t\t[...path, \"durationFrames\"],\n\t\t\t\t\t\t\t`\\`durationFrames\\` must be a positive integer (>= 1). Received: ${String(df)}.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (n.startFrame !== undefined) {\n\t\t\t\tconst sf = n.startFrame;\n\t\t\t\tif (\n\t\t\t\t\ttypeof sf !== \"number\" ||\n\t\t\t\t\t!Number.isFinite(sf) ||\n\t\t\t\t\tNumber.isNaN(sf) ||\n\t\t\t\t\tsf < 0 ||\n\t\t\t\t\t!Number.isInteger(sf)\n\t\t\t\t) {\n\t\t\t\t\tissues.push(\n\t\t\t\t\t\tissue(\n\t\t\t\t\t\t\t\"E1207\",\n\t\t\t\t\t\t\t[...path, \"startFrame\"],\n\t\t\t\t\t\t\t`\\`startFrame\\` must be a non-negative integer (>= 0). Received: ${String(sf)}.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (n.opacity !== undefined) {\n\t\t\tconst op = n.opacity;\n\t\t\tif (\n\t\t\t\ttypeof op !== \"number\" ||\n\t\t\t\t!Number.isFinite(op) ||\n\t\t\t\tNumber.isNaN(op) ||\n\t\t\t\top < 0 ||\n\t\t\t\top > 1\n\t\t\t) {\n\t\t\t\tissues.push(\n\t\t\t\t\tissue(\n\t\t\t\t\t\t\"E1213\",\n\t\t\t\t\t\t[...path, \"opacity\"],\n\t\t\t\t\t\t`\\`opacity\\` must be a number between 0 and 1. Received: ${String(op)}.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// duplicate (id, prop) tracks\n\t\tconst anim = n.animation as\n\t\t\t| { tracks?: Array<{ prop?: unknown }> }\n\t\t\t| undefined;\n\t\tif (anim && Array.isArray(anim.tracks) && kind !== undefined) {\n\t\t\tconst props = new Set<string>();\n\t\t\tfor (let tIdx = 0; tIdx < anim.tracks.length; tIdx++) {\n\t\t\t\tconst prop = anim.tracks[tIdx]?.prop;\n\t\t\t\tif (typeof prop === \"string\") {\n\t\t\t\t\tif (props.has(prop)) {\n\t\t\t\t\t\tissues.push(\n\t\t\t\t\t\t\tissue(\n\t\t\t\t\t\t\t\t\"E1208\",\n\t\t\t\t\t\t\t\t[...path, \"animation\", \"tracks\", tIdx],\n\t\t\t\t\t\t\t\t`Duplicate track property '${prop}' on node '${String(id)}'.`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tprops.add(prop);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// recurse into children\n\t\tconst children = n.children;\n\t\tif (Array.isArray(children)) {\n\t\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\t\twalk(children[i], [...path, \"children\", i], depth + 1);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst layout = obj.layout;\n\tif (Array.isArray(layout)) {\n\t\tfor (let i = 0; i < layout.length; i++) {\n\t\t\twalk(layout[i], [\"layout\", i], 0);\n\t\t}\n\t} else if (layout !== undefined) {\n\t\tissues.push(\n\t\t\tissue(\"E1001\", [\"layout\"], \"`layout` must be an array of nodes.\"),\n\t\t);\n\t}\n\n\tif (issues.length > 0) return { ok: false, issues };\n\treturn { ok: true };\n}\n\nfunction cleanImageModeTiming(raw: unknown): unknown {\n\tif (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return raw;\n\tconst obj = raw as Record<string, unknown>;\n\tif (obj.mode !== \"Image\" || !Array.isArray(obj.layout)) return raw;\n\n\tconst sanitizeNode = (node: unknown): unknown => {\n\t\tif (!node || typeof node !== \"object\" || Array.isArray(node)) return node;\n\t\tconst n = { ...(node as Record<string, unknown>) };\n\t\tif (\n\t\t\tn.durationFrames !== undefined &&\n\t\t\t(typeof n.durationFrames !== \"number\" ||\n\t\t\t\t!Number.isFinite(n.durationFrames) ||\n\t\t\t\tn.durationFrames < 1 ||\n\t\t\t\t!Number.isInteger(n.durationFrames))\n\t\t) {\n\t\t\tdelete n.durationFrames;\n\t\t}\n\t\tif (\n\t\t\tn.startFrame !== undefined &&\n\t\t\t(typeof n.startFrame !== \"number\" ||\n\t\t\t\t!Number.isFinite(n.startFrame) ||\n\t\t\t\tn.startFrame < 0 ||\n\t\t\t\t!Number.isInteger(n.startFrame))\n\t\t) {\n\t\t\tdelete n.startFrame;\n\t\t}\n\t\tif (Array.isArray(n.children)) {\n\t\t\tn.children = n.children.map(sanitizeNode);\n\t\t}\n\t\treturn n;\n\t};\n\n\treturn {\n\t\t...obj,\n\t\tlayout: obj.layout.map(sanitizeNode),\n\t};\n}\n\n/** Fast-fail shape gate used by processors: validate raw config then parse. */\nexport function parseProgram(raw: unknown): {\n\tok: boolean;\n\tissues?: ProgramIssue[];\n\tconfig?: CompositorProgramConfig;\n} {\n\tconst pre = validateLayoutProgram(raw);\n\tif (!pre.ok) return { ok: false, issues: pre.issues };\n\n\tconst cleaned = cleanImageModeTiming(raw);\n\tconst parsed = CompositorProgramSchema.safeParse(cleaned);\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tissues: parsed.error.issues.map((i) =>\n\t\t\t\tissue(\n\t\t\t\t\t\"E1001\",\n\t\t\t\t\ti.path.map((p) => (typeof p === \"symbol\" ? p.toString() : p)),\n\t\t\t\t\ti.message,\n\t\t\t\t),\n\t\t\t),\n\t\t};\n\t}\n\treturn { ok: true, config: parsed.data };\n}\n\n/** Collect every node id in the tree (depth-first, in order). */\nexport function collectNodeIds(nodes: LayoutNode[]): string[] {\n\tconst ids: string[] = [];\n\tconst walk = (n: LayoutNode) => {\n\t\tids.push(n.id);\n\t\tif (\"children\" in n && n.children) walkChildren(n.children);\n\t};\n\tconst walkChildren = (list: LayoutNode[]) => {\n\t\tfor (const n of list) walk(n);\n\t};\n\twalkChildren(nodes);\n\treturn ids;\n}\n\n/** Collect media node bindings: inputHandleId -> node id. */\nexport function collectMediaBindings(nodes: LayoutNode[]): Map<string, string> {\n\tconst bindings = new Map<string, string>();\n\tconst walk = (n: LayoutNode) => {\n\t\tif (n.kind === \"media\") bindings.set(n.inputHandleId, n.id);\n\t\tif (\"children\" in n && n.children) {\n\t\t\tfor (const c of n.children) walk(c);\n\t\t}\n\t};\n\tfor (const n of nodes) walk(n);\n\treturn bindings;\n}\n"],"mappings":";;;;;;;AAyEA,IAAI,eAA4B;;;;;AAMhC,eAAsB,aAA4B;AACjD,KAAI,aAAc,QAAO;AACzB,gBAAe,MAAM,UAAU;AAC/B,QAAO;;AAKR,SAAS,WACR,MACA,OACS;AACT,SAAQ,OAAR;EACC,KAAK,SACJ,QAAO,KAAK;EACb,KAAK,MACJ,QAAO,KAAK;EACb,KAAK,gBACJ,QAAO,KAAK;EACb,KAAK,eACJ,QAAO,KAAK;EACb,QACC,QAAO,KAAK;;;AAIf,SAAS,SACR,MACA,OACS;AACT,SAAQ,OAAR;EACC,KAAK,SACJ,QAAO,KAAK;EACb,KAAK,MACJ,QAAO,KAAK;EACb,KAAK,UACJ,QAAO,KAAK;EACb,QACC,QAAO,KA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AQ,CAAC,IAAI,EAAE;CACjB,EAAE,KAAK;EAAC;EAAQ;EAAO;EAAO,CAAC;CAC/B,EAAE,QAAiB;CACnB,CAAC;AAGF,MAAa,kBAAkB,EAAE,KAAK;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAGF,MAAa,uBAAuB,EAAE,KAAK;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAGF,MAAa,qBAAqB,EAAE,KAAK;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAGF,MAAa,+BAA+B;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAID,MAAa,wBAAwB,EAAE,KAAK;CAC3C;CACA;CACA;CACA,CAAC;AAGF,MAAa,gBAAgB,EAC3B,OAAO;CACP,MAAM,EAAE,KAAK;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,CAAC;CACF,KAAK,EAAE,KAAK;EAAC;EAAM;EAAO;EAAQ,CAAC;CACnC,QAAQ,EAAE,MAAM,EAA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