import { K as Keyframe, V as ValidationResult } from './types-ewozML_N.js'; import { PropertyGroupName } from './gsapConstants.js'; /** * Recast-free GSAP helpers: serialization, keyframe<->animation conversion, * validation, and shared types. * * This module MUST NOT import recast / @babel/parser. It is part of the * isomorphic core layer that the barrel and browser code depend on. AST * parsing of GSAP source lives in the Node-only `./gsapParser` module. */ type GsapMethod = "set" | "to" | "from" | "fromTo"; /** How a tween was constructed in source — drives display classification and editability. */ type GsapProvenanceKind = "literal" | "helper" | "loop" | "runtime-dynamic"; /** * Origin of a parsed tween. `literal` tweens map 1:1 to a source call and edit * directly; `helper`/`loop` tweens are expanded from a reused construct (unroll * to edit); `runtime-dynamic` tweens come from live introspection (override to * edit). Absent provenance is treated as `literal`. */ interface GsapProvenance { kind: GsapProvenanceKind; /** Helper function name (kind === "helper"). */ fn?: string; /** 1-based ordinal of the originating call site / loop construct in source order. */ callSite?: number; /** 0-based iteration index (kind === "loop"). */ iteration?: number; /** Source offset [start, end] of the originating call/loop, when known. */ sourceRange?: [number, number]; } /** How a tween's keyframes can be edited, derived from its provenance. */ type KeyframeEditability = "direct" | "unroll" | "source"; /** * Map provenance to an editing strategy: * - `direct` — literal tween, maps 1:1 to source; edit in place. * - `unroll` — helper/loop expansion; unroll to literal tweens, then edit. * - `source` — runtime-dynamic value; not statically editable, edit the code. */ declare function editabilityForProvenance(provenance?: GsapProvenance): KeyframeEditability; interface GsapAnimation { id: string; targetSelector: string; /** Stable parser-only identity for non-DOM targets whose display label is not unique. */ targetIdentity?: string; method: GsapMethod; position: number | string; properties: Record; fromProperties?: Record; duration?: number; ease?: string; /** Non-editable GSAP config (stagger, yoyo, repeat, etc.) preserved for round-trips. */ extras?: Record; /** Native GSAP keyframes data — present when the tween uses keyframes: { ... }. */ keyframes?: GsapKeyframesData; /** Arc motion path config — present when the tween uses motionPath for curved position interpolation. */ arcPath?: ArcPathConfig; /** True when the tween has a `keyframes` property that couldn't be statically resolved (dynamic). */ hasUnresolvedKeyframes?: boolean; /** True when the tween's target selector couldn't be statically resolved (dynamic). */ hasUnresolvedSelector?: boolean; /** Absolute start time computed by walking the timeline chain (handles +=, -=, <, >, labels). */ resolvedStart?: number; /** True when no position arg was authored — the tween is sequentially placed by GSAP. */ implicitPosition?: boolean; /** Which property group this tween belongs to (position, scale, size, rotation, visual, other). * Undefined for legacy mixed tweens that bundle multiple groups. */ propertyGroup?: PropertyGroupName; /** True for a base `gsap.set(...)` (a static hold that runs immediately, OFF the * timeline) rather than `tl.set(...)`. Carries no timeline position and shows no * keyframe marker — used to persist a static value (e.g. a 3D transform) without * introducing a 0% keyframe. */ global?: boolean; /** How this tween was constructed in source. Absent ⇒ literal. */ provenance?: GsapProvenance; } interface GsapPercentageKeyframe { percentage: number; properties: Record; ease?: string; } /** * A keyframe that still knows which tween emitted it, and where inside that * tween it sat. Merging several tweens onto one timeline row drops that * provenance unless it rides along on the keyframe, and an editor needs it to * route an edit back to the animation the user actually clicked. Required, not * optional: a keyframe that reaches a merge without it cannot be attributed at * all, and silently treating that as "no collision" is how an edit lands on the * wrong tween. */ interface SourcedGsapPercentageKeyframe extends GsapPercentageKeyframe { animationId: string; tweenPercentage: number; } type GsapKeyframeFormat = "percentage" | "object-array" | "simple-array"; interface GsapKeyframesData { format: GsapKeyframeFormat; keyframes: K[]; ease?: string; easeEach?: string; } interface ArcPathSegment { curviness: number; cp1?: { x: number; y: number; }; cp2?: { x: number; y: number; }; } interface ArcPathConfig { enabled: boolean; autoRotate: boolean | number; segments: ArcPathSegment[]; } interface MotionPathShape { arcPath: ArcPathConfig; waypoints: Array<{ x: number; y: number; }>; } /** * Build arcPath segments + waypoints from resolved path coordinates. Shared by * the AST parser (coords from literal nodes) and the runtime scanner (coords * from a live `vars.motionPath`), so both produce identical arc config. */ declare function buildArcPath(coords: Array<{ x: number; y: number; }>, curviness: number, autoRotate: boolean | number, isCubic: boolean): MotionPathShape | undefined; interface ParsedGsap { animations: GsapAnimation[]; timelineVar: string; preamble: string; postamble: string; multipleTimelines?: boolean; unsupportedTimelinePattern?: boolean; } interface SplitAnimationsOptions { originalId: string; newId: string; splitTime: number; elementStart: number; elementDuration: number; } interface SplitAnimationsResult { script: string; /** Non-ID-selector animations that the engine cannot safely retarget. */ skippedSelectors: string[]; } declare function serializeGsapAnimations(animations: GsapAnimation[], timelineVar?: string, options?: { includeMediaSync?: boolean; preamble?: string; postamble?: string; }): string; /** * Filter animations to those targeting `#` (id-only match). For the * studio panel's id-OR-selector matching, see `getAnimationsForElement` in * `useGsapTweenCache.ts` — distinct on purpose, hence the distinct name. */ declare function getAnimationsForElementId(animations: GsapAnimation[], elementId: string): GsapAnimation[]; declare function validateCompositionGsap(script: string): ValidationResult; declare function keyframesToGsapAnimations(elementId: string, keyframes: Keyframe[], elementStartTime: number, base?: { x?: number; y?: number; scale?: number; }): GsapAnimation[]; declare function gsapAnimationsToKeyframes(animations: GsapAnimation[], elementStartTime: number, options?: { baseX?: number; baseY?: number; baseScale?: number; clampTimeToZero?: boolean; skipBaseSet?: boolean; }): Keyframe[]; export { type ArcPathConfig as A, type GsapAnimation as G, type KeyframeEditability as K, type MotionPathShape as M, type ParsedGsap as P, type SourcedGsapPercentageKeyframe as S, type ArcPathSegment as a, type GsapKeyframesData as b, type GsapMethod as c, type GsapPercentageKeyframe as d, type GsapProvenance as e, type GsapProvenanceKind as f, type SplitAnimationsOptions as g, type SplitAnimationsResult as h, editabilityForProvenance as i, getAnimationsForElementId as j, gsapAnimationsToKeyframes as k, keyframesToGsapAnimations as l, buildArcPath as m, type GsapKeyframeFormat as n, serializeGsapAnimations as s, validateCompositionGsap as v };