@@ -63,7 +63,7 @@ export function createLottieAdapter(params?: {
6363 const secondsIntoComposition = ( anim : unknown , pageTime : number ) : number =>
6464 Math . max ( 0 , pageTime - compositionStartSeconds ( anim ) ) ;
6565
66- const adapter : RuntimeDeterministicAdapter = {
66+ return {
6767 name : "lottie" ,
6868
6969 discover : ( ) => {
@@ -167,39 +167,38 @@ export function createLottieAdapter(params?: {
167167 // Just let them be garbage collected naturally.
168168 } ,
169169
170- getInferredDurationSeconds : ( ) => latestInstanceEnd ( ( _ , seconds ) => seconds ) ,
170+ getInferredDurationSeconds : ( ) => latestInstanceEnd ( ( _ , length ) => length ) ,
171171
172172 // Plays from its composition's start, as seek anchors it; a removed scene's instance stays registered.
173173 getAnimationCycleEndSeconds : ( ) =>
174- latestInstanceEnd ( ( anim , seconds ) =>
174+ latestInstanceEnd ( ( anim , length ) =>
175175 ( lottieElement ( anim ) as Node | undefined ) ?. isConnected === false
176176 ? null
177- : compositionStartSeconds ( anim ) + seconds ,
177+ : compositionStartSeconds ( anim ) + length ,
178178 ) ,
179179 } ;
180- return adapter ;
181180}
182181
183182/** Max of `endOf(instance, its length)` over registered instances; null skips an instance. */
184183function latestInstanceEnd (
185- endOf : ( anim : LottieWebAnimation | DotLottiePlayer , seconds : number ) => number | null ,
184+ endOf : ( anim : LottieWebAnimation | DotLottiePlayer , length : number ) => number | null ,
186185) : number | null {
187186 const instances = ( window as LottieWindow ) . __hfLottie ;
188187 if ( ! instances || instances . length === 0 ) return null ;
189188 let maxSeconds = 0 ;
190189 let sawAny = false ;
191190 for ( const anim of instances ) {
192- let seconds : number | null = null ;
191+ let end : number | null = null ;
193192 try {
194193 const length = inferAnimationDurationSeconds ( anim ) ;
195- seconds = length == null ? null : endOf ( anim , length ) ;
194+ end = length == null ? null : endOf ( anim , length ) ;
196195 } catch ( err ) {
197196 // ignore per-animation failures — keep going for other instances
198197 swallow ( "runtime.adapters.lottie.site4" , err ) ;
199198 }
200- if ( seconds == null ) continue ;
199+ if ( end == null ) continue ;
201200 sawAny = true ;
202- maxSeconds = Math . max ( maxSeconds , seconds ) ;
201+ maxSeconds = Math . max ( maxSeconds , end ) ;
203202 }
204203 // Not-yet-loaded animations report totalFrames=0 — return null (not 0)
205204 // so the caller doesn't treat "still loading" as "genuinely zero
0 commit comments