(
durationSeconds: number,
existingRootTimeline: RuntimeTimelineLike | null,
)
| 797 | return compositeTimeline; |
| 798 | }; |
| 799 | const createDurationFloorTimeline = ( |
| 800 | durationSeconds: number, |
| 801 | existingRootTimeline: RuntimeTimelineLike | null, |
| 802 | ): RuntimeTimelineLike | null => { |
| 803 | if (!isUsableTimelineDuration(durationSeconds)) return null; |
| 804 | const gsapApi = window.gsap; |
| 805 | if (!gsapApi || typeof gsapApi.timeline !== "function") return null; |
| 806 | const fallbackTimeline = gsapApi.timeline({ paused: true }) as RuntimeTimelineLike; |
| 807 | if (existingRootTimeline) { |
| 808 | try { |
| 809 | fallbackTimeline.add(existingRootTimeline, 0); |
| 810 | } catch (err) { |
| 811 | // keep fallback resilient if root add fails |
| 812 | swallow("runtime.init.site2", err); |
| 813 | } |
| 814 | } |
| 815 | const withTween = fallbackTimeline as RuntimeTimelineLike & { |
| 816 | to?: (target: object, vars: { duration?: number }) => unknown; |
| 817 | }; |
| 818 | if (typeof withTween.to === "function") { |
| 819 | try { |
| 820 | withTween.to({}, { duration: durationSeconds }); |
| 821 | } catch (err) { |
| 822 | // no-op; if tween creation fails, caller will discard by unusable duration |
| 823 | swallow("runtime.init.site3", err); |
| 824 | } |
| 825 | } |
| 826 | return fallbackTimeline; |
| 827 | }; |
| 828 | const addMissingChildCandidatesToRootTimeline = ( |
| 829 | rootTimeline: RuntimeTimelineLike, |
| 830 | candidates: Array<{ |
no test coverage detected