` with `premountFor` and `postmountFor` props does not support layout="none"');
}
const { style: passedStyle, from = 0, durationInFrames = Infinity, premountFor = 0, postmountFor = 0, styleWhilePremounted, styleWhilePostmounted, ...otherProps } = props;
const endThreshold = Math.ceil(from + durationInFrames - 1);
const premountingActive = frame < from && frame >= from - premountFor;
const postmountingActive = frame > endThreshold && frame <= endThreshold + postmountFor;
// Determine which freeze frame to use
const freezeFrame = premountingActive
? from
: postmountingActive
? from + durationInFrames - 1
: 0;
const isFreezingActive = premountingActive || postmountingActive;
const style = (0, react_1.useMemo)(() => {
var _a;
return {
...passedStyle,
opacity: premountingActive || postmountingActive ? 0 : 1,
pointerEvents: premountingActive || postmountingActive
? 'none'
: ((_a = passedStyle === null || passedStyle === void 0 ? void 0 : passedStyle.pointerEvents) !== null && _a !== void 0 ? _a : undefined),
...(premountingActive ? styleWhilePremounted : {}),
...(postmountingActive ? styleWhilePostmounted : {}),
};
}, [
passedStyle,
premountingActive,
postmountingActive,
styleWhilePremounted,
styleWhilePostmounted,
]);
return ((0, jsx_runtime_1.jsx)(freeze_js_1.Freeze, { frame: freezeFrame, active: isFreezingActive, children: (0, jsx_runtime_1.jsx)(exports.Sequence, { ref: ref, from: from, durationInFrames: durationInFrames, style: style, _remotionInternalPremountDisplay: premountFor, _remotionInternalPostmountDisplay: postmountFor, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, ...otherProps }) }));
};
const PremountedPostmountedSequence = (0, react_1.forwardRef)(PremountedPostmountedSequenceRefForwardingFunction);
const SequenceRefForwardingFunction = (props, ref) => {
const env = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
if (props.layout !== 'none' && !env.isRendering) {
if (props.premountFor || props.postmountFor) {
return (0, jsx_runtime_1.jsx)(PremountedPostmountedSequence, { ...props, ref: ref });
}
}
return (0, jsx_runtime_1.jsx)(RegularSequence, { ...props, ref: ref });
};
/*
* @description A component that time-shifts its children and wraps them in an absolutely positioned .
* @see [Documentation](https://www.remotion.dev/docs/sequence)
*/
exports.Sequence = (0, react_1.forwardRef)(SequenceRefForwardingFunction);