framer-motion
Advanced tools
| 'use strict'; | ||
| var motionDom = require('motion-dom'); | ||
| var React = require('react'); | ||
| var index = require('./index-6W16WHlG.js'); | ||
| var motionUtils = require('motion-utils'); | ||
| var jsxRuntime = require('react/jsx-runtime'); | ||
| /** | ||
| * When a component is the child of `AnimatePresence`, it can use `usePresence` | ||
| * to access information about whether it's still present in the React tree. | ||
| * | ||
| * ```jsx | ||
| * import { usePresence } from "framer-motion" | ||
| * | ||
| * export const Component = () => { | ||
| * const [isPresent, safeToRemove] = usePresence() | ||
| * | ||
| * useEffect(() => { | ||
| * !isPresent && setTimeout(safeToRemove, 1000) | ||
| * }, [isPresent]) | ||
| * | ||
| * return <div /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * If `isPresent` is `false`, it means that a component has been removed from the tree, | ||
| * but `AnimatePresence` won't really remove it until `safeToRemove` has been called. | ||
| * | ||
| * @public | ||
| */ | ||
| function usePresence(subscribe = true) { | ||
| const context = React.useContext(index.PresenceContext); | ||
| if (context === null) | ||
| return [true, null]; | ||
| const { isPresent, onExitComplete, register } = context; | ||
| // It's safe to call the following hooks conditionally (after an early return) because the context will always | ||
| // either be null or non-null for the lifespan of the component. | ||
| const id = React.useId(); | ||
| React.useEffect(() => { | ||
| if (subscribe) { | ||
| return register(id); | ||
| } | ||
| }, [subscribe]); | ||
| const safeToRemove = React.useCallback(() => subscribe && onExitComplete && onExitComplete(id), [id, onExitComplete, subscribe]); | ||
| return !isPresent && onExitComplete ? [false, safeToRemove] : [true]; | ||
| } | ||
| /** | ||
| * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present. | ||
| * There is no `safeToRemove` function. | ||
| * | ||
| * ```jsx | ||
| * import { useIsPresent } from "framer-motion" | ||
| * | ||
| * export const Component = () => { | ||
| * const isPresent = useIsPresent() | ||
| * | ||
| * useEffect(() => { | ||
| * !isPresent && console.log("I've been removed!") | ||
| * }, [isPresent]) | ||
| * | ||
| * return <div /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| function useIsPresent() { | ||
| return isPresent(React.useContext(index.PresenceContext)); | ||
| } | ||
| function isPresent(context) { | ||
| return context === null ? true : context.isPresent; | ||
| } | ||
| const createDomVisualElement = (Component, options) => { | ||
| /** | ||
| * Use explicit isSVG override if provided, otherwise auto-detect | ||
| */ | ||
| const isSVG = options.isSVG ?? index.isSVGComponent(Component); | ||
| return isSVG | ||
| ? new motionDom.SVGVisualElement(options) | ||
| : new motionDom.HTMLVisualElement(options, { | ||
| allowProjection: Component !== React.Fragment, | ||
| }); | ||
| }; | ||
| class AnimationFeature extends motionDom.Feature { | ||
| /** | ||
| * We dynamically generate the AnimationState manager as it contains a reference | ||
| * to the underlying animation library. We only want to load that if we load this, | ||
| * so people can optionally code split it out using the `m` component. | ||
| */ | ||
| constructor(node) { | ||
| super(node); | ||
| node.animationState || (node.animationState = motionDom.createAnimationState(node)); | ||
| } | ||
| updateAnimationControlsSubscription() { | ||
| const { animate } = this.node.getProps(); | ||
| if (motionDom.isAnimationControls(animate)) { | ||
| this.unmountControls = animate.subscribe(this.node); | ||
| } | ||
| } | ||
| /** | ||
| * Subscribe any provided AnimationControls to the component's VisualElement | ||
| */ | ||
| mount() { | ||
| this.updateAnimationControlsSubscription(); | ||
| } | ||
| update() { | ||
| const { animate } = this.node.getProps(); | ||
| const { animate: prevAnimate } = this.node.prevProps || {}; | ||
| if (animate !== prevAnimate) { | ||
| this.updateAnimationControlsSubscription(); | ||
| } | ||
| } | ||
| unmount() { | ||
| this.node.animationState.reset(); | ||
| this.unmountControls?.(); | ||
| } | ||
| } | ||
| let id = 0; | ||
| class ExitAnimationFeature extends motionDom.Feature { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.id = id++; | ||
| this.isExitComplete = false; | ||
| } | ||
| update() { | ||
| if (!this.node.presenceContext) | ||
| return; | ||
| const { isPresent, onExitComplete } = this.node.presenceContext; | ||
| const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}; | ||
| if (!this.node.animationState || isPresent === prevIsPresent) { | ||
| return; | ||
| } | ||
| if (isPresent && prevIsPresent === false) { | ||
| /** | ||
| * When re-entering, if the exit animation already completed | ||
| * (element is at rest), reset to initial values so the enter | ||
| * animation replays from the correct position. | ||
| */ | ||
| if (this.isExitComplete) { | ||
| const { initial, custom } = this.node.getProps(); | ||
| if (typeof initial === "string" || | ||
| (typeof initial === "object" && | ||
| initial !== null && | ||
| !Array.isArray(initial))) { | ||
| const resolved = motionDom.resolveVariant(this.node, initial, custom); | ||
| if (resolved) { | ||
| const { transition, transitionEnd, ...target } = resolved; | ||
| for (const key in target) { | ||
| this.node | ||
| .getValue(key) | ||
| ?.jump(target[key]); | ||
| } | ||
| } | ||
| } | ||
| this.node.animationState.reset(); | ||
| this.node.animationState.animateChanges(); | ||
| } | ||
| else { | ||
| this.node.animationState.setActive("exit", false); | ||
| } | ||
| this.isExitComplete = false; | ||
| return; | ||
| } | ||
| const exitAnimation = this.node.animationState.setActive("exit", !isPresent); | ||
| if (onExitComplete && !isPresent) { | ||
| exitAnimation.then(() => { | ||
| this.isExitComplete = true; | ||
| onExitComplete(this.id); | ||
| }); | ||
| } | ||
| } | ||
| mount() { | ||
| const { register, onExitComplete } = this.node.presenceContext || {}; | ||
| if (onExitComplete) { | ||
| onExitComplete(this.id); | ||
| } | ||
| if (register) { | ||
| this.unmount = register(this.id); | ||
| } | ||
| } | ||
| unmount() { } | ||
| } | ||
| const animations = { | ||
| animation: { | ||
| Feature: AnimationFeature, | ||
| }, | ||
| exit: { | ||
| Feature: ExitAnimationFeature, | ||
| }, | ||
| }; | ||
| function extractEventInfo(event) { | ||
| return { | ||
| point: { | ||
| x: event.pageX, | ||
| y: event.pageY, | ||
| }, | ||
| }; | ||
| } | ||
| const addPointerInfo = (handler) => (event) => motionDom.isPrimaryPointer(event) && handler(event, extractEventInfo(event)); | ||
| function addPointerEvent(target, eventName, handler, options) { | ||
| return motionDom.addDomEvent(target, eventName, addPointerInfo(handler), options); | ||
| } | ||
| // Fixes https://github.com/motiondivision/motion/issues/2270 | ||
| const getContextWindow = ({ current }) => { | ||
| return current ? current.ownerDocument.defaultView : null; | ||
| }; | ||
| const distance = (a, b) => Math.abs(a - b); | ||
| function distance2D(a, b) { | ||
| // Multi-dimensional | ||
| const xDelta = distance(a.x, b.x); | ||
| const yDelta = distance(a.y, b.y); | ||
| return Math.sqrt(xDelta ** 2 + yDelta ** 2); | ||
| } | ||
| const overflowStyles = /*#__PURE__*/ new Set(["auto", "scroll"]); | ||
| /** | ||
| * @internal | ||
| */ | ||
| class PanSession { | ||
| constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element, } = {}) { | ||
| /** | ||
| * @internal | ||
| */ | ||
| this.startEvent = null; | ||
| /** | ||
| * @internal | ||
| */ | ||
| this.lastMoveEvent = null; | ||
| /** | ||
| * @internal | ||
| */ | ||
| this.lastMoveEventInfo = null; | ||
| /** | ||
| * Raw (untransformed) event info, re-transformed each frame | ||
| * so transformPagePoint sees the current parent matrix. | ||
| * @internal | ||
| */ | ||
| this.lastRawMoveEventInfo = null; | ||
| /** | ||
| * @internal | ||
| */ | ||
| this.handlers = {}; | ||
| /** | ||
| * @internal | ||
| */ | ||
| this.contextWindow = window; | ||
| /** | ||
| * Scroll positions of scrollable ancestors and window. | ||
| * @internal | ||
| */ | ||
| this.scrollPositions = new Map(); | ||
| /** | ||
| * Cleanup function for scroll listeners. | ||
| * @internal | ||
| */ | ||
| this.removeScrollListeners = null; | ||
| this.onElementScroll = (event) => { | ||
| this.handleScroll(event.target); | ||
| }; | ||
| this.onWindowScroll = () => { | ||
| this.handleScroll(window); | ||
| }; | ||
| this.updatePoint = () => { | ||
| if (!(this.lastMoveEvent && this.lastMoveEventInfo)) | ||
| return; | ||
| // Re-transform raw point through current transformPagePoint so | ||
| // animated parent transforms (e.g. rotation) are picked up each frame | ||
| if (this.lastRawMoveEventInfo) { | ||
| this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint); | ||
| } | ||
| const info = getPanInfo(this.lastMoveEventInfo, this.history); | ||
| const isPanStarted = this.startEvent !== null; | ||
| // Only start panning if the offset is larger than 3 pixels. If we make it | ||
| // any larger than this we'll want to reset the pointer history | ||
| // on the first update to avoid visual snapping to the cursor. | ||
| const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold; | ||
| if (!isPanStarted && !isDistancePastThreshold) | ||
| return; | ||
| const { point } = info; | ||
| const { timestamp } = motionDom.frameData; | ||
| this.history.push({ ...point, timestamp }); | ||
| const { onStart, onMove } = this.handlers; | ||
| if (!isPanStarted) { | ||
| onStart && onStart(this.lastMoveEvent, info); | ||
| this.startEvent = this.lastMoveEvent; | ||
| } | ||
| onMove && onMove(this.lastMoveEvent, info); | ||
| }; | ||
| this.handlePointerMove = (event, info) => { | ||
| this.lastMoveEvent = event; | ||
| this.lastRawMoveEventInfo = info; | ||
| this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint); | ||
| // Throttle mouse move event to once per frame | ||
| motionDom.frame.update(this.updatePoint, true); | ||
| }; | ||
| this.handlePointerUp = (event, info) => { | ||
| this.end(); | ||
| const { onEnd, onSessionEnd, resumeAnimation } = this.handlers; | ||
| // Resume animation if dragSnapToOrigin is set OR if no drag started (user just clicked) | ||
| // This ensures constraint animations continue when interrupted by a click | ||
| if (this.dragSnapToOrigin || !this.startEvent) { | ||
| resumeAnimation && resumeAnimation(); | ||
| } | ||
| if (!(this.lastMoveEvent && this.lastMoveEventInfo)) | ||
| return; | ||
| const panInfo = getPanInfo(event.type === "pointercancel" | ||
| ? this.lastMoveEventInfo | ||
| : transformPoint(info, this.transformPagePoint), this.history); | ||
| if (this.startEvent && onEnd) { | ||
| onEnd(event, panInfo); | ||
| } | ||
| onSessionEnd && onSessionEnd(event, panInfo); | ||
| }; | ||
| // If we have more than one touch, don't start detecting this gesture | ||
| if (!motionDom.isPrimaryPointer(event)) | ||
| return; | ||
| this.dragSnapToOrigin = dragSnapToOrigin; | ||
| this.handlers = handlers; | ||
| this.transformPagePoint = transformPagePoint; | ||
| this.distanceThreshold = distanceThreshold; | ||
| this.contextWindow = contextWindow || window; | ||
| const info = extractEventInfo(event); | ||
| const initialInfo = transformPoint(info, this.transformPagePoint); | ||
| const { point } = initialInfo; | ||
| const { timestamp } = motionDom.frameData; | ||
| this.history = [{ ...point, timestamp }]; | ||
| const { onSessionStart } = handlers; | ||
| onSessionStart && | ||
| onSessionStart(event, getPanInfo(initialInfo, this.history)); | ||
| this.removeListeners = motionUtils.pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp)); | ||
| // Start scroll tracking if element provided | ||
| if (element) { | ||
| this.startScrollTracking(element); | ||
| } | ||
| } | ||
| /** | ||
| * Start tracking scroll on ancestors and window. | ||
| */ | ||
| startScrollTracking(element) { | ||
| // Store initial scroll positions for scrollable ancestors | ||
| let current = element.parentElement; | ||
| while (current) { | ||
| const style = getComputedStyle(current); | ||
| if (overflowStyles.has(style.overflowX) || | ||
| overflowStyles.has(style.overflowY)) { | ||
| this.scrollPositions.set(current, { | ||
| x: current.scrollLeft, | ||
| y: current.scrollTop, | ||
| }); | ||
| } | ||
| current = current.parentElement; | ||
| } | ||
| // Track window scroll | ||
| this.scrollPositions.set(window, { | ||
| x: window.scrollX, | ||
| y: window.scrollY, | ||
| }); | ||
| // Capture listener catches element scroll events as they bubble | ||
| window.addEventListener("scroll", this.onElementScroll, { | ||
| capture: true, | ||
| }); | ||
| // Direct window scroll listener (window scroll doesn't bubble) | ||
| window.addEventListener("scroll", this.onWindowScroll); | ||
| this.removeScrollListeners = () => { | ||
| window.removeEventListener("scroll", this.onElementScroll, { | ||
| capture: true, | ||
| }); | ||
| window.removeEventListener("scroll", this.onWindowScroll); | ||
| }; | ||
| } | ||
| /** | ||
| * Handle scroll compensation during drag. | ||
| * | ||
| * For element scroll: adjusts history origin since pageX/pageY doesn't change. | ||
| * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change. | ||
| */ | ||
| handleScroll(target) { | ||
| const initial = this.scrollPositions.get(target); | ||
| if (!initial) | ||
| return; | ||
| const isWindow = target === window; | ||
| const current = isWindow | ||
| ? { x: window.scrollX, y: window.scrollY } | ||
| : { | ||
| x: target.scrollLeft, | ||
| y: target.scrollTop, | ||
| }; | ||
| const delta = { x: current.x - initial.x, y: current.y - initial.y }; | ||
| if (delta.x === 0 && delta.y === 0) | ||
| return; | ||
| if (isWindow) { | ||
| // Window scroll: pageX/pageY changes, so update lastMoveEventInfo | ||
| if (this.lastMoveEventInfo) { | ||
| this.lastMoveEventInfo.point.x += delta.x; | ||
| this.lastMoveEventInfo.point.y += delta.y; | ||
| } | ||
| } | ||
| else { | ||
| // Element scroll: pageX/pageY unchanged, so adjust history origin | ||
| if (this.history.length > 0) { | ||
| this.history[0].x -= delta.x; | ||
| this.history[0].y -= delta.y; | ||
| } | ||
| } | ||
| this.scrollPositions.set(target, current); | ||
| motionDom.frame.update(this.updatePoint, true); | ||
| } | ||
| updateHandlers(handlers) { | ||
| this.handlers = handlers; | ||
| } | ||
| end() { | ||
| this.removeListeners && this.removeListeners(); | ||
| this.removeScrollListeners && this.removeScrollListeners(); | ||
| this.scrollPositions.clear(); | ||
| motionDom.cancelFrame(this.updatePoint); | ||
| } | ||
| } | ||
| function transformPoint(info, transformPagePoint) { | ||
| return transformPagePoint ? { point: transformPagePoint(info.point) } : info; | ||
| } | ||
| function subtractPoint(a, b) { | ||
| return { x: a.x - b.x, y: a.y - b.y }; | ||
| } | ||
| function getPanInfo({ point }, history) { | ||
| return { | ||
| point, | ||
| delta: subtractPoint(point, lastDevicePoint(history)), | ||
| offset: subtractPoint(point, startDevicePoint(history)), | ||
| velocity: getVelocity(history, 0.1), | ||
| }; | ||
| } | ||
| function startDevicePoint(history) { | ||
| return history[0]; | ||
| } | ||
| function lastDevicePoint(history) { | ||
| return history[history.length - 1]; | ||
| } | ||
| function getVelocity(history, timeDelta) { | ||
| if (history.length < 2) { | ||
| return { x: 0, y: 0 }; | ||
| } | ||
| let i = history.length - 1; | ||
| let timestampedPoint = null; | ||
| const lastPoint = lastDevicePoint(history); | ||
| while (i >= 0) { | ||
| timestampedPoint = history[i]; | ||
| if (lastPoint.timestamp - timestampedPoint.timestamp > | ||
| motionUtils.secondsToMilliseconds(timeDelta)) { | ||
| break; | ||
| } | ||
| i--; | ||
| } | ||
| if (!timestampedPoint) { | ||
| return { x: 0, y: 0 }; | ||
| } | ||
| /** | ||
| * If the selected point is the pointer-down origin (history[0]), | ||
| * there are better movement points available, and the time gap | ||
| * is suspiciously large (>2x timeDelta), use the next point instead. | ||
| * This prevents stale pointer-down points from diluting velocity | ||
| * in hold-then-flick gestures. | ||
| */ | ||
| if (timestampedPoint === history[0] && | ||
| history.length > 2 && | ||
| lastPoint.timestamp - timestampedPoint.timestamp > | ||
| motionUtils.secondsToMilliseconds(timeDelta) * 2) { | ||
| timestampedPoint = history[1]; | ||
| } | ||
| const time = motionUtils.millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp); | ||
| if (time === 0) { | ||
| return { x: 0, y: 0 }; | ||
| } | ||
| const currentVelocity = { | ||
| x: (lastPoint.x - timestampedPoint.x) / time, | ||
| y: (lastPoint.y - timestampedPoint.y) / time, | ||
| }; | ||
| if (currentVelocity.x === Infinity) { | ||
| currentVelocity.x = 0; | ||
| } | ||
| if (currentVelocity.y === Infinity) { | ||
| currentVelocity.y = 0; | ||
| } | ||
| return currentVelocity; | ||
| } | ||
| /** | ||
| * Apply constraints to a point. These constraints are both physical along an | ||
| * axis, and an elastic factor that determines how much to constrain the point | ||
| * by if it does lie outside the defined parameters. | ||
| */ | ||
| function applyConstraints(point, { min, max }, elastic) { | ||
| if (min !== undefined && point < min) { | ||
| // If we have a min point defined, and this is outside of that, constrain | ||
| point = elastic | ||
| ? motionDom.mixNumber(min, point, elastic.min) | ||
| : Math.max(point, min); | ||
| } | ||
| else if (max !== undefined && point > max) { | ||
| // If we have a max point defined, and this is outside of that, constrain | ||
| point = elastic | ||
| ? motionDom.mixNumber(max, point, elastic.max) | ||
| : Math.min(point, max); | ||
| } | ||
| return point; | ||
| } | ||
| /** | ||
| * Calculate constraints in terms of the viewport when defined relatively to the | ||
| * measured axis. This is measured from the nearest edge, so a max constraint of 200 | ||
| * on an axis with a max value of 300 would return a constraint of 500 - axis length | ||
| */ | ||
| function calcRelativeAxisConstraints(axis, min, max) { | ||
| return { | ||
| min: min !== undefined ? axis.min + min : undefined, | ||
| max: max !== undefined | ||
| ? axis.max + max - (axis.max - axis.min) | ||
| : undefined, | ||
| }; | ||
| } | ||
| /** | ||
| * Calculate constraints in terms of the viewport when | ||
| * defined relatively to the measured bounding box. | ||
| */ | ||
| function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) { | ||
| return { | ||
| x: calcRelativeAxisConstraints(layoutBox.x, left, right), | ||
| y: calcRelativeAxisConstraints(layoutBox.y, top, bottom), | ||
| }; | ||
| } | ||
| /** | ||
| * Calculate viewport constraints when defined as another viewport-relative axis | ||
| */ | ||
| function calcViewportAxisConstraints(layoutAxis, constraintsAxis) { | ||
| let min = constraintsAxis.min - layoutAxis.min; | ||
| let max = constraintsAxis.max - layoutAxis.max; | ||
| // If the constraints axis is actually smaller than the layout axis then we can | ||
| // flip the constraints | ||
| if (constraintsAxis.max - constraintsAxis.min < | ||
| layoutAxis.max - layoutAxis.min) { | ||
| [min, max] = [max, min]; | ||
| } | ||
| return { min, max }; | ||
| } | ||
| /** | ||
| * Calculate viewport constraints when defined as another viewport-relative box | ||
| */ | ||
| function calcViewportConstraints(layoutBox, constraintsBox) { | ||
| return { | ||
| x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x), | ||
| y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y), | ||
| }; | ||
| } | ||
| /** | ||
| * Calculate a transform origin relative to the source axis, between 0-1, that results | ||
| * in an asthetically pleasing scale/transform needed to project from source to target. | ||
| */ | ||
| function calcOrigin(source, target) { | ||
| let origin = 0.5; | ||
| const sourceLength = motionDom.calcLength(source); | ||
| const targetLength = motionDom.calcLength(target); | ||
| if (targetLength > sourceLength) { | ||
| origin = motionUtils.progress(target.min, target.max - sourceLength, source.min); | ||
| } | ||
| else if (sourceLength > targetLength) { | ||
| origin = motionUtils.progress(source.min, source.max - targetLength, target.min); | ||
| } | ||
| return motionUtils.clamp(0, 1, origin); | ||
| } | ||
| /** | ||
| * Rebase the calculated viewport constraints relative to the layout.min point. | ||
| */ | ||
| function rebaseAxisConstraints(layout, constraints) { | ||
| const relativeConstraints = {}; | ||
| if (constraints.min !== undefined) { | ||
| relativeConstraints.min = constraints.min - layout.min; | ||
| } | ||
| if (constraints.max !== undefined) { | ||
| relativeConstraints.max = constraints.max - layout.min; | ||
| } | ||
| return relativeConstraints; | ||
| } | ||
| const defaultElastic = 0.35; | ||
| /** | ||
| * Accepts a dragElastic prop and returns resolved elastic values for each axis. | ||
| */ | ||
| function resolveDragElastic(dragElastic = defaultElastic) { | ||
| if (dragElastic === false) { | ||
| dragElastic = 0; | ||
| } | ||
| else if (dragElastic === true) { | ||
| dragElastic = defaultElastic; | ||
| } | ||
| return { | ||
| x: resolveAxisElastic(dragElastic, "left", "right"), | ||
| y: resolveAxisElastic(dragElastic, "top", "bottom"), | ||
| }; | ||
| } | ||
| function resolveAxisElastic(dragElastic, minLabel, maxLabel) { | ||
| return { | ||
| min: resolvePointElastic(dragElastic, minLabel), | ||
| max: resolvePointElastic(dragElastic, maxLabel), | ||
| }; | ||
| } | ||
| function resolvePointElastic(dragElastic, label) { | ||
| return typeof dragElastic === "number" | ||
| ? dragElastic | ||
| : dragElastic[label] || 0; | ||
| } | ||
| const elementDragControls = new WeakMap(); | ||
| class VisualElementDragControls { | ||
| constructor(visualElement) { | ||
| this.openDragLock = null; | ||
| this.isDragging = false; | ||
| this.currentDirection = null; | ||
| this.originPoint = { x: 0, y: 0 }; | ||
| /** | ||
| * The permitted boundaries of travel, in pixels. | ||
| */ | ||
| this.constraints = false; | ||
| this.hasMutatedConstraints = false; | ||
| /** | ||
| * The per-axis resolved elastic values. | ||
| */ | ||
| this.elastic = motionDom.createBox(); | ||
| /** | ||
| * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments. | ||
| */ | ||
| this.latestPointerEvent = null; | ||
| /** | ||
| * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments. | ||
| */ | ||
| this.latestPanInfo = null; | ||
| this.visualElement = visualElement; | ||
| } | ||
| start(originEvent, { snapToCursor = false, distanceThreshold } = {}) { | ||
| /** | ||
| * Don't start dragging if this component is exiting | ||
| */ | ||
| const { presenceContext } = this.visualElement; | ||
| if (presenceContext && presenceContext.isPresent === false) | ||
| return; | ||
| const onSessionStart = (event) => { | ||
| if (snapToCursor) { | ||
| this.snapToCursor(extractEventInfo(event).point); | ||
| } | ||
| this.stopAnimation(); | ||
| }; | ||
| const onStart = (event, info) => { | ||
| // Attempt to grab the global drag gesture lock - maybe make this part of PanSession | ||
| const { drag, dragPropagation, onDragStart } = this.getProps(); | ||
| if (drag && !dragPropagation) { | ||
| if (this.openDragLock) | ||
| this.openDragLock(); | ||
| this.openDragLock = motionDom.setDragLock(drag); | ||
| // If we don 't have the lock, don't start dragging | ||
| if (!this.openDragLock) | ||
| return; | ||
| } | ||
| this.latestPointerEvent = event; | ||
| this.latestPanInfo = info; | ||
| this.isDragging = true; | ||
| this.currentDirection = null; | ||
| this.resolveConstraints(); | ||
| if (this.visualElement.projection) { | ||
| this.visualElement.projection.isAnimationBlocked = true; | ||
| this.visualElement.projection.target = undefined; | ||
| } | ||
| /** | ||
| * Record gesture origin and pointer offset | ||
| */ | ||
| motionDom.eachAxis((axis) => { | ||
| let current = this.getAxisMotionValue(axis).get() || 0; | ||
| /** | ||
| * If the MotionValue is a percentage value convert to px | ||
| */ | ||
| if (motionDom.percent.test(current)) { | ||
| const { projection } = this.visualElement; | ||
| if (projection && projection.layout) { | ||
| const measuredAxis = projection.layout.layoutBox[axis]; | ||
| if (measuredAxis) { | ||
| const length = motionDom.calcLength(measuredAxis); | ||
| current = length * (parseFloat(current) / 100); | ||
| } | ||
| } | ||
| } | ||
| this.originPoint[axis] = current; | ||
| }); | ||
| // Fire onDragStart event | ||
| if (onDragStart) { | ||
| motionDom.frame.update(() => onDragStart(event, info), false, true); | ||
| } | ||
| motionDom.addValueToWillChange(this.visualElement, "transform"); | ||
| const { animationState } = this.visualElement; | ||
| animationState && animationState.setActive("whileDrag", true); | ||
| }; | ||
| const onMove = (event, info) => { | ||
| this.latestPointerEvent = event; | ||
| this.latestPanInfo = info; | ||
| const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps(); | ||
| // If we didn't successfully receive the gesture lock, early return. | ||
| if (!dragPropagation && !this.openDragLock) | ||
| return; | ||
| const { offset } = info; | ||
| // Attempt to detect drag direction if directionLock is true | ||
| if (dragDirectionLock && this.currentDirection === null) { | ||
| this.currentDirection = getCurrentDirection(offset); | ||
| // If we've successfully set a direction, notify listener | ||
| if (this.currentDirection !== null) { | ||
| onDirectionLock && onDirectionLock(this.currentDirection); | ||
| } | ||
| return; | ||
| } | ||
| // Update each point with the latest position | ||
| this.updateAxis("x", info.point, offset); | ||
| this.updateAxis("y", info.point, offset); | ||
| /** | ||
| * Ideally we would leave the renderer to fire naturally at the end of | ||
| * this frame but if the element is about to change layout as the result | ||
| * of a re-render we want to ensure the browser can read the latest | ||
| * bounding box to ensure the pointer and element don't fall out of sync. | ||
| */ | ||
| this.visualElement.render(); | ||
| /** | ||
| * This must fire after the render call as it might trigger a state | ||
| * change which itself might trigger a layout update. | ||
| */ | ||
| if (onDrag) { | ||
| motionDom.frame.update(() => onDrag(event, info), false, true); | ||
| } | ||
| }; | ||
| const onSessionEnd = (event, info) => { | ||
| this.latestPointerEvent = event; | ||
| this.latestPanInfo = info; | ||
| this.stop(event, info); | ||
| this.latestPointerEvent = null; | ||
| this.latestPanInfo = null; | ||
| }; | ||
| const resumeAnimation = () => { | ||
| const { dragSnapToOrigin: snap } = this.getProps(); | ||
| if (snap || this.constraints) { | ||
| this.startAnimation({ x: 0, y: 0 }); | ||
| } | ||
| }; | ||
| const { dragSnapToOrigin } = this.getProps(); | ||
| this.panSession = new PanSession(originEvent, { | ||
| onSessionStart, | ||
| onStart, | ||
| onMove, | ||
| onSessionEnd, | ||
| resumeAnimation, | ||
| }, { | ||
| transformPagePoint: this.visualElement.getTransformPagePoint(), | ||
| dragSnapToOrigin, | ||
| distanceThreshold, | ||
| contextWindow: getContextWindow(this.visualElement), | ||
| element: this.visualElement.current, | ||
| }); | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| stop(event, panInfo) { | ||
| const finalEvent = event || this.latestPointerEvent; | ||
| const finalPanInfo = panInfo || this.latestPanInfo; | ||
| const isDragging = this.isDragging; | ||
| this.cancel(); | ||
| if (!isDragging || !finalPanInfo || !finalEvent) | ||
| return; | ||
| const { velocity } = finalPanInfo; | ||
| this.startAnimation(velocity); | ||
| const { onDragEnd } = this.getProps(); | ||
| if (onDragEnd) { | ||
| motionDom.frame.postRender(() => onDragEnd(finalEvent, finalPanInfo)); | ||
| } | ||
| } | ||
| /** | ||
| * @internal | ||
| */ | ||
| cancel() { | ||
| this.isDragging = false; | ||
| const { projection, animationState } = this.visualElement; | ||
| if (projection) { | ||
| projection.isAnimationBlocked = false; | ||
| } | ||
| this.endPanSession(); | ||
| const { dragPropagation } = this.getProps(); | ||
| if (!dragPropagation && this.openDragLock) { | ||
| this.openDragLock(); | ||
| this.openDragLock = null; | ||
| } | ||
| animationState && animationState.setActive("whileDrag", false); | ||
| } | ||
| /** | ||
| * Clean up the pan session without modifying other drag state. | ||
| * This is used during unmount to ensure event listeners are removed | ||
| * without affecting projection animations or drag locks. | ||
| * @internal | ||
| */ | ||
| endPanSession() { | ||
| this.panSession && this.panSession.end(); | ||
| this.panSession = undefined; | ||
| } | ||
| updateAxis(axis, _point, offset) { | ||
| const { drag } = this.getProps(); | ||
| // If we're not dragging this axis, do an early return. | ||
| if (!offset || !shouldDrag(axis, drag, this.currentDirection)) | ||
| return; | ||
| const axisValue = this.getAxisMotionValue(axis); | ||
| let next = this.originPoint[axis] + offset[axis]; | ||
| // Apply constraints | ||
| if (this.constraints && this.constraints[axis]) { | ||
| next = applyConstraints(next, this.constraints[axis], this.elastic[axis]); | ||
| } | ||
| axisValue.set(next); | ||
| } | ||
| resolveConstraints() { | ||
| const { dragConstraints, dragElastic } = this.getProps(); | ||
| const layout = this.visualElement.projection && | ||
| !this.visualElement.projection.layout | ||
| ? this.visualElement.projection.measure(false) | ||
| : this.visualElement.projection?.layout; | ||
| const prevConstraints = this.constraints; | ||
| if (dragConstraints && index.isRefObject(dragConstraints)) { | ||
| if (!this.constraints) { | ||
| this.constraints = this.resolveRefConstraints(); | ||
| } | ||
| } | ||
| else { | ||
| if (dragConstraints && layout) { | ||
| this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints); | ||
| } | ||
| else { | ||
| this.constraints = false; | ||
| } | ||
| } | ||
| this.elastic = resolveDragElastic(dragElastic); | ||
| /** | ||
| * If we're outputting to external MotionValues, we want to rebase the measured constraints | ||
| * from viewport-relative to component-relative. This only applies to relative (non-ref) | ||
| * constraints, as ref-based constraints from calcViewportConstraints are already in the | ||
| * correct coordinate space for the motion value transform offset. | ||
| */ | ||
| if (prevConstraints !== this.constraints && | ||
| !index.isRefObject(dragConstraints) && | ||
| layout && | ||
| this.constraints && | ||
| !this.hasMutatedConstraints) { | ||
| motionDom.eachAxis((axis) => { | ||
| if (this.constraints !== false && | ||
| this.getAxisMotionValue(axis)) { | ||
| this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| resolveRefConstraints() { | ||
| const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps(); | ||
| if (!constraints || !index.isRefObject(constraints)) | ||
| return false; | ||
| const constraintsElement = constraints.current; | ||
| motionUtils.invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref"); | ||
| const { projection } = this.visualElement; | ||
| // TODO | ||
| if (!projection || !projection.layout) | ||
| return false; | ||
| /** | ||
| * Refresh the root scroll offset so the constraint's viewport box | ||
| * translates to correct page coordinates. The scroll captured at | ||
| * drag mount can be stale if the document was scrolled afterwards — | ||
| * e.g. via the browser restoring scroll on refresh, or an ancestor | ||
| * layout effect running after this element's mount (#2829). | ||
| * | ||
| * Clear the cached scroll first so `updateScroll` bypasses its | ||
| * per-animationId cache and re-reads the live value. | ||
| */ | ||
| if (projection.root) { | ||
| projection.root.scroll = undefined; | ||
| projection.root.updateScroll(); | ||
| } | ||
| const constraintsBox = motionDom.measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint()); | ||
| let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox); | ||
| /** | ||
| * If there's an onMeasureDragConstraints listener we call it and | ||
| * if different constraints are returned, set constraints to that | ||
| */ | ||
| if (onMeasureDragConstraints) { | ||
| const userConstraints = onMeasureDragConstraints(motionDom.convertBoxToBoundingBox(measuredConstraints)); | ||
| this.hasMutatedConstraints = !!userConstraints; | ||
| if (userConstraints) { | ||
| measuredConstraints = motionDom.convertBoundingBoxToBox(userConstraints); | ||
| } | ||
| } | ||
| return measuredConstraints; | ||
| } | ||
| startAnimation(velocity) { | ||
| const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps(); | ||
| const constraints = this.constraints || {}; | ||
| const momentumAnimations = motionDom.eachAxis((axis) => { | ||
| if (!shouldDrag(axis, drag, this.currentDirection)) { | ||
| return; | ||
| } | ||
| let transition = (constraints && constraints[axis]) || {}; | ||
| if (dragSnapToOrigin === true || | ||
| dragSnapToOrigin === axis) | ||
| transition = { min: 0, max: 0 }; | ||
| /** | ||
| * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame | ||
| * of spring animations so we should look into adding a disable spring option to `inertia`. | ||
| * We could do something here where we affect the `bounceStiffness` and `bounceDamping` | ||
| * using the value of `dragElastic`. | ||
| */ | ||
| const bounceStiffness = dragElastic ? 200 : 1000000; | ||
| const bounceDamping = dragElastic ? 40 : 10000000; | ||
| const inertia = { | ||
| type: "inertia", | ||
| velocity: dragMomentum ? velocity[axis] : 0, | ||
| bounceStiffness, | ||
| bounceDamping, | ||
| timeConstant: 750, | ||
| restDelta: 1, | ||
| restSpeed: 10, | ||
| ...dragTransition, | ||
| ...transition, | ||
| }; | ||
| // If we're not animating on an externally-provided `MotionValue` we can use the | ||
| // component's animation controls which will handle interactions with whileHover (etc), | ||
| // otherwise we just have to animate the `MotionValue` itself. | ||
| return this.startAxisValueAnimation(axis, inertia); | ||
| }); | ||
| // Run all animations and then resolve the new drag constraints. | ||
| return Promise.all(momentumAnimations).then(onDragTransitionEnd); | ||
| } | ||
| startAxisValueAnimation(axis, transition) { | ||
| const axisValue = this.getAxisMotionValue(axis); | ||
| motionDom.addValueToWillChange(this.visualElement, axis); | ||
| return axisValue.start(motionDom.animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false)); | ||
| } | ||
| stopAnimation() { | ||
| motionDom.eachAxis((axis) => this.getAxisMotionValue(axis).stop()); | ||
| } | ||
| /** | ||
| * Drag works differently depending on which props are provided. | ||
| * | ||
| * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. | ||
| * - Otherwise, we apply the delta to the x/y motion values. | ||
| */ | ||
| getAxisMotionValue(axis) { | ||
| const dragKey = `_drag${axis.toUpperCase()}`; | ||
| const props = this.visualElement.getProps(); | ||
| const externalMotionValue = props[dragKey]; | ||
| return externalMotionValue | ||
| ? externalMotionValue | ||
| : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0); | ||
| } | ||
| snapToCursor(point) { | ||
| motionDom.eachAxis((axis) => { | ||
| const { drag } = this.getProps(); | ||
| // If we're not dragging this axis, do an early return. | ||
| if (!shouldDrag(axis, drag, this.currentDirection)) | ||
| return; | ||
| const { projection } = this.visualElement; | ||
| const axisValue = this.getAxisMotionValue(axis); | ||
| if (projection && projection.layout) { | ||
| const { min, max } = projection.layout.layoutBox[axis]; | ||
| /** | ||
| * The layout measurement includes the current transform value, | ||
| * so we need to add it back to get the correct snap position. | ||
| * This fixes an issue where elements with initial coordinates | ||
| * would snap to the wrong position on the first drag. | ||
| */ | ||
| const current = axisValue.get() || 0; | ||
| axisValue.set(point[axis] - motionDom.mixNumber(min, max, 0.5) + current); | ||
| } | ||
| }); | ||
| } | ||
| /** | ||
| * When the viewport resizes we want to check if the measured constraints | ||
| * have changed and, if so, reposition the element within those new constraints | ||
| * relative to where it was before the resize. | ||
| */ | ||
| scalePositionWithinConstraints() { | ||
| if (!this.visualElement.current) | ||
| return; | ||
| const { drag, dragConstraints } = this.getProps(); | ||
| const { projection } = this.visualElement; | ||
| if (!index.isRefObject(dragConstraints) || !projection || !this.constraints) | ||
| return; | ||
| /** | ||
| * Stop current animations as there can be visual glitching if we try to do | ||
| * this mid-animation | ||
| */ | ||
| this.stopAnimation(); | ||
| /** | ||
| * Record the relative position of the dragged element relative to the | ||
| * constraints box and save as a progress value. | ||
| */ | ||
| const boxProgress = { x: 0, y: 0 }; | ||
| motionDom.eachAxis((axis) => { | ||
| const axisValue = this.getAxisMotionValue(axis); | ||
| if (axisValue && this.constraints !== false) { | ||
| const latest = axisValue.get(); | ||
| boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]); | ||
| } | ||
| }); | ||
| /** | ||
| * Update the layout of this element and resolve the latest drag constraints | ||
| */ | ||
| const { transformTemplate } = this.visualElement.getProps(); | ||
| this.visualElement.current.style.transform = transformTemplate | ||
| ? transformTemplate({}, "") | ||
| : "none"; | ||
| projection.root && projection.root.updateScroll(); | ||
| projection.updateLayout(); | ||
| /** | ||
| * Reset constraints so resolveConstraints() will recalculate them | ||
| * with the freshly measured layout rather than returning the cached value. | ||
| */ | ||
| this.constraints = false; | ||
| this.resolveConstraints(); | ||
| /** | ||
| * For each axis, calculate the current progress of the layout axis | ||
| * within the new constraints. | ||
| */ | ||
| motionDom.eachAxis((axis) => { | ||
| if (!shouldDrag(axis, drag, null)) | ||
| return; | ||
| /** | ||
| * Calculate a new transform based on the previous box progress | ||
| */ | ||
| const axisValue = this.getAxisMotionValue(axis); | ||
| const { min, max } = this.constraints[axis]; | ||
| axisValue.set(motionDom.mixNumber(min, max, boxProgress[axis])); | ||
| }); | ||
| /** | ||
| * Flush the updated transform to the DOM synchronously to prevent | ||
| * a visual flash at the element's CSS layout position (0,0) when | ||
| * the transform was stripped for measurement. | ||
| */ | ||
| this.visualElement.render(); | ||
| } | ||
| addListeners() { | ||
| if (!this.visualElement.current) | ||
| return; | ||
| elementDragControls.set(this.visualElement, this); | ||
| const element = this.visualElement.current; | ||
| /** | ||
| * Attach a pointerdown event listener on this DOM element to initiate drag tracking. | ||
| */ | ||
| const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => { | ||
| const { drag, dragListener = true } = this.getProps(); | ||
| const target = event.target; | ||
| /** | ||
| * Only block drag if clicking on a text input child element | ||
| * (input, textarea, select, contenteditable) where users might | ||
| * want to select text or interact with the control. | ||
| * | ||
| * Buttons and links don't block drag since they don't have | ||
| * click-and-move actions of their own. | ||
| */ | ||
| const isClickingTextInputChild = target !== element && motionDom.isElementTextInput(target); | ||
| if (drag && dragListener && !isClickingTextInputChild) { | ||
| this.start(event); | ||
| } | ||
| }); | ||
| /** | ||
| * If using ref-based constraints, observe both the draggable element | ||
| * and the constraint container for size changes via ResizeObserver. | ||
| * Setup is deferred because dragConstraints.current is null when | ||
| * addListeners first runs (React hasn't committed the ref yet). | ||
| */ | ||
| let stopResizeObservers; | ||
| const measureDragConstraints = () => { | ||
| const { dragConstraints } = this.getProps(); | ||
| if (index.isRefObject(dragConstraints) && dragConstraints.current) { | ||
| this.constraints = this.resolveRefConstraints(); | ||
| if (!stopResizeObservers) { | ||
| stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints()); | ||
| } | ||
| } | ||
| }; | ||
| const { projection } = this.visualElement; | ||
| const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints); | ||
| if (projection && !projection.layout) { | ||
| projection.root && projection.root.updateScroll(); | ||
| projection.updateLayout(); | ||
| } | ||
| motionDom.frame.read(measureDragConstraints); | ||
| /** | ||
| * Attach a window resize listener to scale the draggable target within its defined | ||
| * constraints as the window resizes. | ||
| */ | ||
| const stopResizeListener = motionDom.addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()); | ||
| /** | ||
| * If the element's layout changes, calculate the delta and apply that to | ||
| * the drag gesture's origin point. | ||
| */ | ||
| const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => { | ||
| if (this.isDragging && hasLayoutChanged) { | ||
| motionDom.eachAxis((axis) => { | ||
| const motionValue = this.getAxisMotionValue(axis); | ||
| if (!motionValue) | ||
| return; | ||
| this.originPoint[axis] += delta[axis].translate; | ||
| motionValue.set(motionValue.get() + delta[axis].translate); | ||
| }); | ||
| this.visualElement.render(); | ||
| } | ||
| })); | ||
| return () => { | ||
| stopResizeListener(); | ||
| stopPointerListener(); | ||
| stopMeasureLayoutListener(); | ||
| stopLayoutUpdateListener && stopLayoutUpdateListener(); | ||
| stopResizeObservers && stopResizeObservers(); | ||
| }; | ||
| } | ||
| getProps() { | ||
| const props = this.visualElement.getProps(); | ||
| const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props; | ||
| return { | ||
| ...props, | ||
| drag, | ||
| dragDirectionLock, | ||
| dragPropagation, | ||
| dragConstraints, | ||
| dragElastic, | ||
| dragMomentum, | ||
| }; | ||
| } | ||
| } | ||
| function skipFirstCall(callback) { | ||
| let isFirst = true; | ||
| return () => { | ||
| if (isFirst) { | ||
| isFirst = false; | ||
| return; | ||
| } | ||
| callback(); | ||
| }; | ||
| } | ||
| function startResizeObservers(element, constraintsElement, onResize) { | ||
| const stopElement = motionDom.resize(element, skipFirstCall(onResize)); | ||
| const stopContainer = motionDom.resize(constraintsElement, skipFirstCall(onResize)); | ||
| return () => { | ||
| stopElement(); | ||
| stopContainer(); | ||
| }; | ||
| } | ||
| function shouldDrag(direction, drag, currentDirection) { | ||
| return ((drag === true || drag === direction) && | ||
| (currentDirection === null || currentDirection === direction)); | ||
| } | ||
| /** | ||
| * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower | ||
| * than the provided threshold, return `null`. | ||
| * | ||
| * @param offset - The x/y offset from origin. | ||
| * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction. | ||
| */ | ||
| function getCurrentDirection(offset, lockThreshold = 10) { | ||
| let direction = null; | ||
| if (Math.abs(offset.y) > lockThreshold) { | ||
| direction = "y"; | ||
| } | ||
| else if (Math.abs(offset.x) > lockThreshold) { | ||
| direction = "x"; | ||
| } | ||
| return direction; | ||
| } | ||
| class DragGesture extends motionDom.Feature { | ||
| constructor(node) { | ||
| super(node); | ||
| this.removeGroupControls = motionUtils.noop; | ||
| this.removeListeners = motionUtils.noop; | ||
| this.controls = new VisualElementDragControls(node); | ||
| } | ||
| mount() { | ||
| // If we've been provided a DragControls for manual control over the drag gesture, | ||
| // subscribe this component to it on mount. | ||
| const { dragControls } = this.node.getProps(); | ||
| if (dragControls) { | ||
| this.removeGroupControls = dragControls.subscribe(this.controls); | ||
| } | ||
| this.removeListeners = this.controls.addListeners() || motionUtils.noop; | ||
| } | ||
| update() { | ||
| const { dragControls } = this.node.getProps(); | ||
| const { dragControls: prevDragControls } = this.node.prevProps || {}; | ||
| if (dragControls !== prevDragControls) { | ||
| this.removeGroupControls(); | ||
| if (dragControls) { | ||
| this.removeGroupControls = dragControls.subscribe(this.controls); | ||
| } | ||
| } | ||
| } | ||
| unmount() { | ||
| this.removeGroupControls(); | ||
| this.removeListeners(); | ||
| /** | ||
| * In React 19, during list reorder reconciliation, components may | ||
| * briefly unmount and remount while the drag is still active. If we're | ||
| * actively dragging, we should NOT end the pan session - it will | ||
| * continue tracking pointer events via its window-level listeners. | ||
| * | ||
| * The pan session will be properly cleaned up when: | ||
| * 1. The drag ends naturally (pointerup/pointercancel) | ||
| * 2. The component is truly removed from the DOM | ||
| */ | ||
| if (!this.controls.isDragging) { | ||
| this.controls.endPanSession(); | ||
| } | ||
| } | ||
| } | ||
| const asyncHandler = (handler) => (event, info) => { | ||
| if (handler) { | ||
| motionDom.frame.update(() => handler(event, info), false, true); | ||
| } | ||
| }; | ||
| class PanGesture extends motionDom.Feature { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.removePointerDownListener = motionUtils.noop; | ||
| } | ||
| onPointerDown(pointerDownEvent) { | ||
| this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), { | ||
| transformPagePoint: this.node.getTransformPagePoint(), | ||
| contextWindow: getContextWindow(this.node), | ||
| }); | ||
| } | ||
| createPanHandlers() { | ||
| const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps(); | ||
| return { | ||
| onSessionStart: asyncHandler(onPanSessionStart), | ||
| onStart: asyncHandler(onPanStart), | ||
| onMove: asyncHandler(onPan), | ||
| onEnd: (event, info) => { | ||
| delete this.session; | ||
| if (onPanEnd) { | ||
| motionDom.frame.postRender(() => onPanEnd(event, info)); | ||
| } | ||
| }, | ||
| }; | ||
| } | ||
| mount() { | ||
| this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event)); | ||
| } | ||
| update() { | ||
| this.session && this.session.updateHandlers(this.createPanHandlers()); | ||
| } | ||
| unmount() { | ||
| this.removePointerDownListener(); | ||
| this.session && this.session.end(); | ||
| } | ||
| } | ||
| /** | ||
| * Track whether we've taken any snapshots yet. If not, | ||
| * we can safely skip notification of didUpdate. | ||
| * | ||
| * Difficult to capture in a test but to prevent flickering | ||
| * we must set this to true either on update or unmount. | ||
| * Running `next-env/layout-id` in Safari will show this behaviour if broken. | ||
| */ | ||
| let hasTakenAnySnapshot = false; | ||
| class MeasureLayoutWithContext extends React.Component { | ||
| /** | ||
| * This only mounts projection nodes for components that | ||
| * need measuring, we might want to do it for all components | ||
| * in order to incorporate transforms | ||
| */ | ||
| componentDidMount() { | ||
| const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props; | ||
| const { projection } = visualElement; | ||
| if (projection) { | ||
| if (layoutGroup.group) | ||
| layoutGroup.group.add(projection); | ||
| if (switchLayoutGroup && switchLayoutGroup.register && layoutId) { | ||
| switchLayoutGroup.register(projection); | ||
| } | ||
| if (hasTakenAnySnapshot) { | ||
| projection.root.didUpdate(); | ||
| } | ||
| projection.addEventListener("animationComplete", () => { | ||
| this.safeToRemove(); | ||
| }); | ||
| projection.setOptions({ | ||
| ...projection.options, | ||
| layoutDependency: this.props.layoutDependency, | ||
| onExitComplete: () => this.safeToRemove(), | ||
| }); | ||
| } | ||
| motionDom.globalProjectionState.hasEverUpdated = true; | ||
| } | ||
| getSnapshotBeforeUpdate(prevProps) { | ||
| const { layoutDependency, visualElement, drag, isPresent } = this.props; | ||
| const { projection } = visualElement; | ||
| if (!projection) | ||
| return null; | ||
| /** | ||
| * TODO: We use this data in relegate to determine whether to | ||
| * promote a previous element. There's no guarantee its presence data | ||
| * will have updated by this point - if a bug like this arises it will | ||
| * have to be that we markForRelegation and then find a new lead some other way, | ||
| * perhaps in didUpdate | ||
| */ | ||
| projection.isPresent = isPresent; | ||
| if (prevProps.layoutDependency !== layoutDependency) { | ||
| projection.setOptions({ | ||
| ...projection.options, | ||
| layoutDependency, | ||
| }); | ||
| } | ||
| hasTakenAnySnapshot = true; | ||
| if (drag || | ||
| prevProps.layoutDependency !== layoutDependency || | ||
| layoutDependency === undefined || | ||
| prevProps.isPresent !== isPresent) { | ||
| projection.willUpdate(); | ||
| } | ||
| else { | ||
| this.safeToRemove(); | ||
| } | ||
| if (prevProps.isPresent !== isPresent) { | ||
| if (isPresent) { | ||
| projection.promote(); | ||
| } | ||
| else if (!projection.relegate()) { | ||
| /** | ||
| * If there's another stack member taking over from this one, | ||
| * it's in charge of the exit animation and therefore should | ||
| * be in charge of the safe to remove. Otherwise we call it here. | ||
| */ | ||
| motionDom.frame.postRender(() => { | ||
| const stack = projection.getStack(); | ||
| if (!stack || !stack.members.length) { | ||
| this.safeToRemove(); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| componentDidUpdate() { | ||
| const { visualElement, layoutAnchor } = this.props; | ||
| const { projection } = visualElement; | ||
| if (projection) { | ||
| projection.options.layoutAnchor = layoutAnchor; | ||
| projection.root.didUpdate(); | ||
| motionDom.microtask.postRender(() => { | ||
| if (!projection.currentAnimation && projection.isLead()) { | ||
| this.safeToRemove(); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| componentWillUnmount() { | ||
| const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props; | ||
| const { projection } = visualElement; | ||
| hasTakenAnySnapshot = true; | ||
| if (projection) { | ||
| projection.scheduleCheckAfterUnmount(); | ||
| if (layoutGroup && layoutGroup.group) | ||
| layoutGroup.group.remove(projection); | ||
| if (promoteContext && promoteContext.deregister) | ||
| promoteContext.deregister(projection); | ||
| } | ||
| } | ||
| safeToRemove() { | ||
| const { safeToRemove } = this.props; | ||
| safeToRemove && safeToRemove(); | ||
| } | ||
| render() { | ||
| return null; | ||
| } | ||
| } | ||
| function MeasureLayout(props) { | ||
| const [isPresent, safeToRemove] = usePresence(); | ||
| const layoutGroup = React.useContext(index.LayoutGroupContext); | ||
| return (jsxRuntime.jsx(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: React.useContext(index.SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })); | ||
| } | ||
| const drag = { | ||
| pan: { | ||
| Feature: PanGesture, | ||
| }, | ||
| drag: { | ||
| Feature: DragGesture, | ||
| ProjectionNode: motionDom.HTMLProjectionNode, | ||
| MeasureLayout, | ||
| }, | ||
| }; | ||
| function handleHoverEvent(node, event, lifecycle) { | ||
| const { props } = node; | ||
| if (node.animationState && props.whileHover) { | ||
| node.animationState.setActive("whileHover", lifecycle === "Start"); | ||
| } | ||
| const eventName = ("onHover" + lifecycle); | ||
| const callback = props[eventName]; | ||
| if (callback) { | ||
| motionDom.frame.postRender(() => callback(event, extractEventInfo(event))); | ||
| } | ||
| } | ||
| class HoverGesture extends motionDom.Feature { | ||
| mount() { | ||
| const { current } = this.node; | ||
| if (!current) | ||
| return; | ||
| this.unmount = motionDom.hover(current, (_element, startEvent) => { | ||
| handleHoverEvent(this.node, startEvent, "Start"); | ||
| return (endEvent) => handleHoverEvent(this.node, endEvent, "End"); | ||
| }); | ||
| } | ||
| unmount() { } | ||
| } | ||
| class FocusGesture extends motionDom.Feature { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.isActive = false; | ||
| } | ||
| onFocus() { | ||
| let isFocusVisible = false; | ||
| /** | ||
| * If this element doesn't match focus-visible then don't | ||
| * apply whileHover. But, if matches throws that focus-visible | ||
| * is not a valid selector then in that browser outline styles will be applied | ||
| * to the element by default and we want to match that behaviour with whileFocus. | ||
| */ | ||
| try { | ||
| isFocusVisible = this.node.current.matches(":focus-visible"); | ||
| } | ||
| catch (e) { | ||
| isFocusVisible = true; | ||
| } | ||
| if (!isFocusVisible || !this.node.animationState) | ||
| return; | ||
| this.node.animationState.setActive("whileFocus", true); | ||
| this.isActive = true; | ||
| } | ||
| onBlur() { | ||
| if (!this.isActive || !this.node.animationState) | ||
| return; | ||
| this.node.animationState.setActive("whileFocus", false); | ||
| this.isActive = false; | ||
| } | ||
| mount() { | ||
| this.unmount = motionUtils.pipe(motionDom.addDomEvent(this.node.current, "focus", () => this.onFocus()), motionDom.addDomEvent(this.node.current, "blur", () => this.onBlur())); | ||
| } | ||
| unmount() { } | ||
| } | ||
| function handlePressEvent(node, event, lifecycle) { | ||
| const { props } = node; | ||
| if (node.current instanceof HTMLButtonElement && node.current.disabled) { | ||
| return; | ||
| } | ||
| if (node.animationState && props.whileTap) { | ||
| node.animationState.setActive("whileTap", lifecycle === "Start"); | ||
| } | ||
| const eventName = ("onTap" + (lifecycle === "End" ? "" : lifecycle)); | ||
| const callback = props[eventName]; | ||
| if (callback) { | ||
| motionDom.frame.postRender(() => callback(event, extractEventInfo(event))); | ||
| } | ||
| } | ||
| class PressGesture extends motionDom.Feature { | ||
| mount() { | ||
| const { current } = this.node; | ||
| if (!current) | ||
| return; | ||
| const { globalTapTarget, propagate } = this.node.props; | ||
| this.unmount = motionDom.press(current, (_element, startEvent) => { | ||
| handlePressEvent(this.node, startEvent, "Start"); | ||
| return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel"); | ||
| }, { | ||
| useGlobalTarget: globalTapTarget, | ||
| stopPropagation: propagate?.tap === false, | ||
| }); | ||
| } | ||
| unmount() { } | ||
| } | ||
| /** | ||
| * Map an IntersectionHandler callback to an element. We only ever make one handler for one | ||
| * element, so even though these handlers might all be triggered by different | ||
| * observers, we can keep them in the same map. | ||
| */ | ||
| const observerCallbacks = new WeakMap(); | ||
| /** | ||
| * Multiple observers can be created for multiple element/document roots. Each with | ||
| * different settings. So here we store dictionaries of observers to each root, | ||
| * using serialised settings (threshold/margin) as lookup keys. | ||
| */ | ||
| const observers = new WeakMap(); | ||
| const fireObserverCallback = (entry) => { | ||
| const callback = observerCallbacks.get(entry.target); | ||
| callback && callback(entry); | ||
| }; | ||
| const fireAllObserverCallbacks = (entries) => { | ||
| entries.forEach(fireObserverCallback); | ||
| }; | ||
| function initIntersectionObserver({ root, ...options }) { | ||
| const lookupRoot = root || document; | ||
| /** | ||
| * If we don't have an observer lookup map for this root, create one. | ||
| */ | ||
| if (!observers.has(lookupRoot)) { | ||
| observers.set(lookupRoot, {}); | ||
| } | ||
| const rootObservers = observers.get(lookupRoot); | ||
| const key = JSON.stringify(options); | ||
| /** | ||
| * If we don't have an observer for this combination of root and settings, | ||
| * create one. | ||
| */ | ||
| if (!rootObservers[key]) { | ||
| rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options }); | ||
| } | ||
| return rootObservers[key]; | ||
| } | ||
| function observeIntersection(element, options, callback) { | ||
| const rootInteresectionObserver = initIntersectionObserver(options); | ||
| observerCallbacks.set(element, callback); | ||
| rootInteresectionObserver.observe(element); | ||
| return () => { | ||
| observerCallbacks.delete(element); | ||
| rootInteresectionObserver.unobserve(element); | ||
| }; | ||
| } | ||
| const thresholdNames = { | ||
| some: 0, | ||
| all: 1, | ||
| }; | ||
| class InViewFeature extends motionDom.Feature { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.hasEnteredView = false; | ||
| this.isInView = false; | ||
| } | ||
| startObserver() { | ||
| this.stopObserver?.(); | ||
| const { viewport = {} } = this.node.getProps(); | ||
| const { root, margin: rootMargin, amount = "some", once } = viewport; | ||
| const options = { | ||
| root: root ? root.current : undefined, | ||
| rootMargin, | ||
| threshold: typeof amount === "number" ? amount : thresholdNames[amount], | ||
| }; | ||
| const onIntersectionUpdate = (entry) => { | ||
| const { isIntersecting } = entry; | ||
| /** | ||
| * If there's been no change in the viewport state, early return. | ||
| */ | ||
| if (this.isInView === isIntersecting) | ||
| return; | ||
| this.isInView = isIntersecting; | ||
| /** | ||
| * Handle hasEnteredView. If this is only meant to run once, and | ||
| * element isn't visible, early return. Otherwise set hasEnteredView to true. | ||
| */ | ||
| if (once && !isIntersecting && this.hasEnteredView) { | ||
| return; | ||
| } | ||
| else if (isIntersecting) { | ||
| this.hasEnteredView = true; | ||
| } | ||
| if (this.node.animationState) { | ||
| this.node.animationState.setActive("whileInView", isIntersecting); | ||
| } | ||
| /** | ||
| * Use the latest committed props rather than the ones in scope | ||
| * when this observer is created | ||
| */ | ||
| const { onViewportEnter, onViewportLeave } = this.node.getProps(); | ||
| const callback = isIntersecting ? onViewportEnter : onViewportLeave; | ||
| callback && callback(entry); | ||
| }; | ||
| this.stopObserver = observeIntersection(this.node.current, options, onIntersectionUpdate); | ||
| } | ||
| mount() { | ||
| this.startObserver(); | ||
| } | ||
| update() { | ||
| if (typeof IntersectionObserver === "undefined") | ||
| return; | ||
| const { props, prevProps } = this.node; | ||
| const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps)); | ||
| if (hasOptionsChanged) { | ||
| this.startObserver(); | ||
| } | ||
| } | ||
| unmount() { | ||
| this.stopObserver?.(); | ||
| this.hasEnteredView = false; | ||
| this.isInView = false; | ||
| } | ||
| } | ||
| function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) { | ||
| return (name) => viewport[name] !== prevViewport[name]; | ||
| } | ||
| const gestureAnimations = { | ||
| inView: { | ||
| Feature: InViewFeature, | ||
| }, | ||
| tap: { | ||
| Feature: PressGesture, | ||
| }, | ||
| focus: { | ||
| Feature: FocusGesture, | ||
| }, | ||
| hover: { | ||
| Feature: HoverGesture, | ||
| }, | ||
| }; | ||
| const layout = { | ||
| layout: { | ||
| ProjectionNode: motionDom.HTMLProjectionNode, | ||
| MeasureLayout, | ||
| }, | ||
| }; | ||
| const featureBundle = { | ||
| ...animations, | ||
| ...gestureAnimations, | ||
| ...drag, | ||
| ...layout, | ||
| }; | ||
| exports.addPointerEvent = addPointerEvent; | ||
| exports.addPointerInfo = addPointerInfo; | ||
| exports.animations = animations; | ||
| exports.createDomVisualElement = createDomVisualElement; | ||
| exports.distance = distance; | ||
| exports.distance2D = distance2D; | ||
| exports.drag = drag; | ||
| exports.featureBundle = featureBundle; | ||
| exports.gestureAnimations = gestureAnimations; | ||
| exports.layout = layout; | ||
| exports.useIsPresent = useIsPresent; | ||
| exports.usePresence = usePresence; | ||
| //# sourceMappingURL=feature-bundle-frRcWALD.js.map |
Sorry, the diff of this file is too big to display
| 'use strict'; | ||
| var jsxRuntime = require('react/jsx-runtime'); | ||
| var motionUtils = require('motion-utils'); | ||
| var React = require('react'); | ||
| var motionDom = require('motion-dom'); | ||
| const LayoutGroupContext = React.createContext({}); | ||
| /** | ||
| * Creates a constant value over the lifecycle of a component. | ||
| * | ||
| * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer | ||
| * a guarantee that it won't re-run for performance reasons later on. By using `useConstant` | ||
| * you can ensure that initialisers don't execute twice or more. | ||
| */ | ||
| function useConstant(init) { | ||
| const ref = React.useRef(null); | ||
| if (ref.current === null) { | ||
| ref.current = init(); | ||
| } | ||
| return ref.current; | ||
| } | ||
| const isBrowser = typeof window !== "undefined"; | ||
| const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect; | ||
| /** | ||
| * @public | ||
| */ | ||
| const PresenceContext = | ||
| /* @__PURE__ */ React.createContext(null); | ||
| /** | ||
| * @public | ||
| */ | ||
| const MotionConfigContext = React.createContext({ | ||
| transformPagePoint: (p) => p, | ||
| isStatic: false, | ||
| reducedMotion: "never", | ||
| }); | ||
| const LazyContext = React.createContext({ strict: false }); | ||
| const featureProps = { | ||
| animation: [ | ||
| "animate", | ||
| "variants", | ||
| "whileHover", | ||
| "whileTap", | ||
| "exit", | ||
| "whileInView", | ||
| "whileFocus", | ||
| "whileDrag", | ||
| ], | ||
| exit: ["exit"], | ||
| drag: ["drag", "dragControls"], | ||
| focus: ["whileFocus"], | ||
| hover: ["whileHover", "onHoverStart", "onHoverEnd"], | ||
| tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], | ||
| pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], | ||
| inView: ["whileInView", "onViewportEnter", "onViewportLeave"], | ||
| layout: ["layout", "layoutId"], | ||
| }; | ||
| let isInitialized = false; | ||
| /** | ||
| * Initialize feature definitions with isEnabled checks. | ||
| * This must be called before any motion components are rendered. | ||
| */ | ||
| function initFeatureDefinitions() { | ||
| if (isInitialized) | ||
| return; | ||
| const initialFeatureDefinitions = {}; | ||
| for (const key in featureProps) { | ||
| initialFeatureDefinitions[key] = { | ||
| isEnabled: (props) => featureProps[key].some((name) => !!props[name]), | ||
| }; | ||
| } | ||
| motionDom.setFeatureDefinitions(initialFeatureDefinitions); | ||
| isInitialized = true; | ||
| } | ||
| /** | ||
| * Get the current feature definitions, initializing if needed. | ||
| */ | ||
| function getInitializedFeatureDefinitions() { | ||
| initFeatureDefinitions(); | ||
| return motionDom.getFeatureDefinitions(); | ||
| } | ||
| function loadFeatures(features) { | ||
| const featureDefinitions = getInitializedFeatureDefinitions(); | ||
| for (const key in features) { | ||
| featureDefinitions[key] = { | ||
| ...featureDefinitions[key], | ||
| ...features[key], | ||
| }; | ||
| } | ||
| motionDom.setFeatureDefinitions(featureDefinitions); | ||
| } | ||
| /** | ||
| * A list of all valid MotionProps. | ||
| * | ||
| * @privateRemarks | ||
| * This doesn't throw if a `MotionProp` name is missing - it should. | ||
| */ | ||
| const validMotionProps = new Set([ | ||
| "animate", | ||
| "exit", | ||
| "variants", | ||
| "initial", | ||
| "style", | ||
| "values", | ||
| "variants", | ||
| "transition", | ||
| "transformTemplate", | ||
| "custom", | ||
| "inherit", | ||
| "onBeforeLayoutMeasure", | ||
| "onAnimationStart", | ||
| "onAnimationComplete", | ||
| "onUpdate", | ||
| "onDragStart", | ||
| "onDrag", | ||
| "onDragEnd", | ||
| "onMeasureDragConstraints", | ||
| "onDirectionLock", | ||
| "onDragTransitionEnd", | ||
| "_dragX", | ||
| "_dragY", | ||
| "onHoverStart", | ||
| "onHoverEnd", | ||
| "onViewportEnter", | ||
| "onViewportLeave", | ||
| "globalTapTarget", | ||
| "propagate", | ||
| "ignoreStrict", | ||
| "viewport", | ||
| ]); | ||
| /** | ||
| * Check whether a prop name is a valid `MotionProp` key. | ||
| * | ||
| * @param key - Name of the property to check | ||
| * @returns `true` is key is a valid `MotionProp`. | ||
| * | ||
| * @public | ||
| */ | ||
| function isValidMotionProp(key) { | ||
| return (key.startsWith("while") || | ||
| (key.startsWith("drag") && key !== "draggable") || | ||
| key.startsWith("layout") || | ||
| key.startsWith("onTap") || | ||
| key.startsWith("onPan") || | ||
| key.startsWith("onLayout") || | ||
| validMotionProps.has(key)); | ||
| } | ||
| let shouldForward = (key) => !isValidMotionProp(key); | ||
| function loadExternalIsValidProp(isValidProp) { | ||
| if (typeof isValidProp !== "function") | ||
| return; | ||
| // Explicitly filter our events | ||
| shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key); | ||
| } | ||
| /** | ||
| * Emotion and Styled Components both allow users to pass through arbitrary props to their components | ||
| * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which | ||
| * of these should be passed to the underlying DOM node. | ||
| * | ||
| * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props | ||
| * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props | ||
| * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of | ||
| * `@emotion/is-prop-valid`, however to fix this problem we need to use it. | ||
| * | ||
| * By making it an optionalDependency we can offer this functionality only in the situations where it's | ||
| * actually required. | ||
| */ | ||
| try { | ||
| /** | ||
| * We attempt to import this package but require won't be defined in esm environments, in that case | ||
| * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed | ||
| * in favour of explicit injection. | ||
| * | ||
| * String concatenation prevents bundlers like webpack (e.g. Storybook) | ||
| * from statically resolving this optional dependency at build time. | ||
| */ | ||
| const emotionPkg = "@emotion/is-prop-" + "valid"; | ||
| loadExternalIsValidProp(require(emotionPkg).default); | ||
| } | ||
| catch { | ||
| // We don't need to actually do anything here - the fallback is the existing `isPropValid`. | ||
| } | ||
| function filterProps(props, isDom, forwardMotionProps) { | ||
| const filteredProps = {}; | ||
| for (const key in props) { | ||
| /** | ||
| * values is considered a valid prop by Emotion, so if it's present | ||
| * this will be rendered out to the DOM unless explicitly filtered. | ||
| * | ||
| * We check the type as it could be used with the `feColorMatrix` | ||
| * element, which we support. | ||
| */ | ||
| if (key === "values" && typeof props.values === "object") | ||
| continue; | ||
| if (motionDom.isMotionValue(props[key])) | ||
| continue; | ||
| if (shouldForward(key) || | ||
| (forwardMotionProps === true && isValidMotionProp(key)) || | ||
| (!isDom && !isValidMotionProp(key)) || | ||
| // If trying to use native HTML drag events, forward drag listeners | ||
| (props["draggable"] && | ||
| key.startsWith("onDrag"))) { | ||
| filteredProps[key] = | ||
| props[key]; | ||
| } | ||
| } | ||
| return filteredProps; | ||
| } | ||
| /** | ||
| * We keep these listed separately as we use the lowercase tag names as part | ||
| * of the runtime bundle to detect SVG components | ||
| */ | ||
| const lowercaseSVGElements = [ | ||
| "animate", | ||
| "circle", | ||
| "defs", | ||
| "desc", | ||
| "ellipse", | ||
| "g", | ||
| "image", | ||
| "line", | ||
| "filter", | ||
| "marker", | ||
| "mask", | ||
| "metadata", | ||
| "path", | ||
| "pattern", | ||
| "polygon", | ||
| "polyline", | ||
| "rect", | ||
| "stop", | ||
| "switch", | ||
| "symbol", | ||
| "svg", | ||
| "text", | ||
| "tspan", | ||
| "use", | ||
| "view", | ||
| ]; | ||
| function isSVGComponent(Component) { | ||
| if ( | ||
| /** | ||
| * If it's not a string, it's a custom React component. Currently we only support | ||
| * HTML custom React components. | ||
| */ | ||
| typeof Component !== "string" || | ||
| /** | ||
| * If it contains a dash, the element is a custom HTML webcomponent. | ||
| */ | ||
| Component.includes("-")) { | ||
| return false; | ||
| } | ||
| else if ( | ||
| /** | ||
| * If it's in our list of lowercase SVG tags, it's an SVG component | ||
| */ | ||
| lowercaseSVGElements.indexOf(Component) > -1 || | ||
| /** | ||
| * If it contains a capital letter, it's an SVG component | ||
| */ | ||
| /[A-Z]/u.test(Component)) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| const MotionContext = /* @__PURE__ */ React.createContext({}); | ||
| function getCurrentTreeVariants(props, context) { | ||
| if (motionDom.isControllingVariants(props)) { | ||
| const { initial, animate } = props; | ||
| return { | ||
| initial: initial === false || motionDom.isVariantLabel(initial) | ||
| ? initial | ||
| : undefined, | ||
| animate: motionDom.isVariantLabel(animate) ? animate : undefined, | ||
| }; | ||
| } | ||
| return props.inherit !== false ? context : {}; | ||
| } | ||
| function useCreateMotionContext(props) { | ||
| const { initial, animate } = getCurrentTreeVariants(props, React.useContext(MotionContext)); | ||
| return React.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]); | ||
| } | ||
| function variantLabelsAsDependency(prop) { | ||
| return Array.isArray(prop) ? prop.join(" ") : prop; | ||
| } | ||
| const createHtmlRenderState = () => ({ | ||
| style: {}, | ||
| transform: {}, | ||
| transformOrigin: {}, | ||
| vars: {}, | ||
| }); | ||
| function copyRawValuesOnly(target, source, props) { | ||
| for (const key in source) { | ||
| if (!motionDom.isMotionValue(source[key]) && !motionDom.isForcedMotionValue(key, props)) { | ||
| target[key] = source[key]; | ||
| } | ||
| } | ||
| } | ||
| function useInitialMotionValues({ transformTemplate }, visualState) { | ||
| return React.useMemo(() => { | ||
| const state = createHtmlRenderState(); | ||
| motionDom.buildHTMLStyles(state, visualState, transformTemplate); | ||
| return Object.assign({}, state.vars, state.style); | ||
| }, [visualState]); | ||
| } | ||
| function useStyle(props, visualState) { | ||
| const styleProp = props.style || {}; | ||
| const style = {}; | ||
| /** | ||
| * Copy non-Motion Values straight into style | ||
| */ | ||
| copyRawValuesOnly(style, styleProp, props); | ||
| Object.assign(style, useInitialMotionValues(props, visualState)); | ||
| return style; | ||
| } | ||
| function useHTMLProps(props, visualState) { | ||
| // The `any` isn't ideal but it is the type of createElement props argument | ||
| const htmlProps = {}; | ||
| const style = useStyle(props, visualState); | ||
| if (props.drag && props.dragListener !== false) { | ||
| // Disable the ghost element when a user drags | ||
| htmlProps.draggable = false; | ||
| // Disable text selection | ||
| style.userSelect = | ||
| style.WebkitUserSelect = | ||
| style.WebkitTouchCallout = | ||
| "none"; | ||
| // Disable scrolling on the draggable direction | ||
| style.touchAction = | ||
| props.drag === true | ||
| ? "none" | ||
| : `pan-${props.drag === "x" ? "y" : "x"}`; | ||
| } | ||
| if (props.tabIndex === undefined && | ||
| (props.onTap || props.onTapStart || props.whileTap)) { | ||
| htmlProps.tabIndex = 0; | ||
| } | ||
| htmlProps.style = style; | ||
| return htmlProps; | ||
| } | ||
| const createSvgRenderState = () => ({ | ||
| ...createHtmlRenderState(), | ||
| attrs: {}, | ||
| }); | ||
| function useSVGProps(props, visualState, _isStatic, Component) { | ||
| const visualProps = React.useMemo(() => { | ||
| const state = createSvgRenderState(); | ||
| motionDom.buildSVGAttrs(state, visualState, motionDom.isSVGTag(Component), props.transformTemplate, props.style); | ||
| return { | ||
| ...state.attrs, | ||
| style: { ...state.style }, | ||
| }; | ||
| }, [visualState]); | ||
| if (props.style) { | ||
| const rawStyles = {}; | ||
| copyRawValuesOnly(rawStyles, props.style, props); | ||
| visualProps.style = { ...rawStyles, ...visualProps.style }; | ||
| } | ||
| return visualProps; | ||
| } | ||
| function useRender(Component, props, ref, { latestValues, }, isStatic, forwardMotionProps = false, isSVG) { | ||
| const useVisualProps = (isSVG ?? isSVGComponent(Component)) ? useSVGProps : useHTMLProps; | ||
| const visualProps = useVisualProps(props, latestValues, isStatic, Component); | ||
| const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps); | ||
| const elementProps = Component !== React.Fragment ? { ...filteredProps, ...visualProps, ref } : {}; | ||
| /** | ||
| * If component has been handed a motion value as its child, | ||
| * memoise its initial value and render that. Subsequent updates | ||
| * will be handled by the onChange handler | ||
| */ | ||
| const { children } = props; | ||
| const renderedChildren = React.useMemo(() => (motionDom.isMotionValue(children) ? children.get() : children), [children]); | ||
| return React.createElement(Component, { | ||
| ...elementProps, | ||
| children: renderedChildren, | ||
| }); | ||
| } | ||
| function makeState({ scrapeMotionValuesFromProps, createRenderState, }, props, context, presenceContext) { | ||
| const state = { | ||
| latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps), | ||
| renderState: createRenderState(), | ||
| }; | ||
| return state; | ||
| } | ||
| function makeLatestValues(props, context, presenceContext, scrapeMotionValues) { | ||
| const values = {}; | ||
| const motionValues = scrapeMotionValues(props, {}); | ||
| for (const key in motionValues) { | ||
| values[key] = motionDom.resolveMotionValue(motionValues[key]); | ||
| } | ||
| let { initial, animate } = props; | ||
| const isControllingVariants = motionDom.isControllingVariants(props); | ||
| const isVariantNode = motionDom.isVariantNode(props); | ||
| if (context && | ||
| isVariantNode && | ||
| !isControllingVariants && | ||
| props.inherit !== false) { | ||
| if (initial === undefined) | ||
| initial = context.initial; | ||
| if (animate === undefined) | ||
| animate = context.animate; | ||
| } | ||
| let isInitialAnimationBlocked = presenceContext | ||
| ? presenceContext.initial === false | ||
| : false; | ||
| isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false; | ||
| const variantToSet = isInitialAnimationBlocked ? animate : initial; | ||
| if (variantToSet && | ||
| typeof variantToSet !== "boolean" && | ||
| !motionDom.isAnimationControls(variantToSet)) { | ||
| const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]; | ||
| for (let i = 0; i < list.length; i++) { | ||
| const resolved = motionDom.resolveVariantFromProps(props, list[i]); | ||
| if (resolved) { | ||
| const { transitionEnd, transition, ...target } = resolved; | ||
| for (const key in target) { | ||
| let valueTarget = target[key]; | ||
| if (Array.isArray(valueTarget)) { | ||
| /** | ||
| * Take final keyframe if the initial animation is blocked because | ||
| * we want to initialise at the end of that blocked animation. | ||
| */ | ||
| const index = isInitialAnimationBlocked | ||
| ? valueTarget.length - 1 | ||
| : 0; | ||
| valueTarget = valueTarget[index]; | ||
| } | ||
| if (valueTarget !== null) { | ||
| values[key] = valueTarget; | ||
| } | ||
| } | ||
| for (const key in transitionEnd) { | ||
| values[key] = transitionEnd[key]; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return values; | ||
| } | ||
| const makeUseVisualState = (config) => (props, isStatic) => { | ||
| const context = React.useContext(MotionContext); | ||
| const presenceContext = React.useContext(PresenceContext); | ||
| const make = () => makeState(config, props, context, presenceContext); | ||
| return isStatic ? make() : useConstant(make); | ||
| }; | ||
| const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({ | ||
| scrapeMotionValuesFromProps: motionDom.scrapeHTMLMotionValuesFromProps, | ||
| createRenderState: createHtmlRenderState, | ||
| }); | ||
| const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({ | ||
| scrapeMotionValuesFromProps: motionDom.scrapeSVGMotionValuesFromProps, | ||
| createRenderState: createSvgRenderState, | ||
| }); | ||
| const motionComponentSymbol = Symbol.for("motionComponentSymbol"); | ||
| /** | ||
| * Creates a ref function that, when called, hydrates the provided | ||
| * external ref and VisualElement. | ||
| */ | ||
| function useMotionRef(visualState, visualElement, externalRef) { | ||
| /** | ||
| * Store externalRef in a ref to avoid including it in the useCallback | ||
| * dependency array. Including externalRef in dependencies causes issues | ||
| * with libraries like Radix UI that create new callback refs on each render | ||
| * when using asChild - this would cause the callback to be recreated, | ||
| * triggering element remounts and breaking AnimatePresence exit animations. | ||
| */ | ||
| const externalRefContainer = React.useRef(externalRef); | ||
| React.useInsertionEffect(() => { | ||
| externalRefContainer.current = externalRef; | ||
| }); | ||
| // Store cleanup function returned by callback refs (React 19 feature) | ||
| const refCleanup = React.useRef(null); | ||
| return React.useCallback((instance) => { | ||
| if (instance) { | ||
| visualState.onMount?.(instance); | ||
| } | ||
| if (visualElement) { | ||
| instance ? visualElement.mount(instance) : visualElement.unmount(); | ||
| } | ||
| const ref = externalRefContainer.current; | ||
| if (typeof ref === "function") { | ||
| if (instance) { | ||
| const cleanup = ref(instance); | ||
| if (typeof cleanup === "function") { | ||
| refCleanup.current = cleanup; | ||
| } | ||
| } | ||
| else if (refCleanup.current) { | ||
| refCleanup.current(); | ||
| refCleanup.current = null; | ||
| } | ||
| else { | ||
| ref(instance); | ||
| } | ||
| } | ||
| else if (ref) { | ||
| ref.current = instance; | ||
| } | ||
| }, [visualElement]); | ||
| } | ||
| /** | ||
| * Internal, exported only for usage in Framer | ||
| */ | ||
| const SwitchLayoutGroupContext = React.createContext({}); | ||
| function isRefObject(ref) { | ||
| return (ref && | ||
| typeof ref === "object" && | ||
| Object.prototype.hasOwnProperty.call(ref, "current")); | ||
| } | ||
| function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) { | ||
| const { visualElement: parent } = React.useContext(MotionContext); | ||
| const lazyContext = React.useContext(LazyContext); | ||
| const presenceContext = React.useContext(PresenceContext); | ||
| const motionConfig = React.useContext(MotionConfigContext); | ||
| const reducedMotionConfig = motionConfig.reducedMotion; | ||
| const skipAnimations = motionConfig.skipAnimations; | ||
| const visualElementRef = React.useRef(null); | ||
| /** | ||
| * Track whether the component has been through React's commit phase. | ||
| * Used to detect when LazyMotion features load after the component has mounted. | ||
| */ | ||
| const hasMountedOnce = React.useRef(false); | ||
| /** | ||
| * If we haven't preloaded a renderer, check to see if we have one lazy-loaded | ||
| */ | ||
| createVisualElement = | ||
| createVisualElement || | ||
| lazyContext.renderer; | ||
| if (!visualElementRef.current && createVisualElement) { | ||
| visualElementRef.current = createVisualElement(Component, { | ||
| visualState, | ||
| parent, | ||
| props, | ||
| presenceContext, | ||
| blockInitialAnimation: presenceContext | ||
| ? presenceContext.initial === false | ||
| : false, | ||
| reducedMotionConfig, | ||
| skipAnimations, | ||
| isSVG, | ||
| }); | ||
| /** | ||
| * If the component has already mounted before features loaded (e.g. via | ||
| * LazyMotion with async feature loading), we need to force the initial | ||
| * animation to run. Otherwise state changes that occurred before features | ||
| * loaded will be lost and the element will snap to its final state. | ||
| */ | ||
| if (hasMountedOnce.current && visualElementRef.current) { | ||
| visualElementRef.current.manuallyAnimateOnMount = true; | ||
| } | ||
| } | ||
| const visualElement = visualElementRef.current; | ||
| /** | ||
| * Load Motion gesture and animation features. These are rendered as renderless | ||
| * components so each feature can optionally make use of React lifecycle methods. | ||
| */ | ||
| const initialLayoutGroupConfig = React.useContext(SwitchLayoutGroupContext); | ||
| if (visualElement && | ||
| !visualElement.projection && | ||
| ProjectionNodeConstructor && | ||
| (visualElement.type === "html" || visualElement.type === "svg")) { | ||
| createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig); | ||
| } | ||
| const isMounted = React.useRef(false); | ||
| React.useInsertionEffect(() => { | ||
| /** | ||
| * Check the component has already mounted before calling | ||
| * `update` unnecessarily. This ensures we skip the initial update. | ||
| */ | ||
| if (visualElement && isMounted.current) { | ||
| visualElement.update(props, presenceContext); | ||
| } | ||
| }); | ||
| /** | ||
| * Cache this value as we want to know whether HandoffAppearAnimations | ||
| * was present on initial render - it will be deleted after this. | ||
| */ | ||
| const optimisedAppearId = props[motionDom.optimizedAppearDataAttribute]; | ||
| const wantsHandoff = React.useRef(Boolean(optimisedAppearId) && | ||
| typeof window !== "undefined" && | ||
| !window.MotionHandoffIsComplete?.(optimisedAppearId) && | ||
| window.MotionHasOptimisedAnimation?.(optimisedAppearId)); | ||
| useIsomorphicLayoutEffect(() => { | ||
| /** | ||
| * Track that this component has mounted. This is used to detect when | ||
| * LazyMotion features load after the component has already committed. | ||
| */ | ||
| hasMountedOnce.current = true; | ||
| if (!visualElement) | ||
| return; | ||
| isMounted.current = true; | ||
| window.MotionIsMounted = true; | ||
| visualElement.updateFeatures(); | ||
| visualElement.scheduleRenderMicrotask(); | ||
| /** | ||
| * Ideally this function would always run in a useEffect. | ||
| * | ||
| * However, if we have optimised appear animations to handoff from, | ||
| * it needs to happen synchronously to ensure there's no flash of | ||
| * incorrect styles in the event of a hydration error. | ||
| * | ||
| * So if we detect a situtation where optimised appear animations | ||
| * are running, we use useLayoutEffect to trigger animations. | ||
| */ | ||
| if (wantsHandoff.current && visualElement.animationState) { | ||
| visualElement.animationState.animateChanges(); | ||
| } | ||
| }); | ||
| React.useEffect(() => { | ||
| if (!visualElement) | ||
| return; | ||
| if (!wantsHandoff.current && visualElement.animationState) { | ||
| visualElement.animationState.animateChanges(); | ||
| } | ||
| if (wantsHandoff.current) { | ||
| // This ensures all future calls to animateChanges() in this component will run in useEffect | ||
| queueMicrotask(() => { | ||
| window.MotionHandoffMarkAsComplete?.(optimisedAppearId); | ||
| }); | ||
| wantsHandoff.current = false; | ||
| } | ||
| /** | ||
| * Now we've finished triggering animations for this element we | ||
| * can wipe the enteringChildren set for the next render. | ||
| */ | ||
| visualElement.enteringChildren = undefined; | ||
| }); | ||
| return visualElement; | ||
| } | ||
| function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) { | ||
| const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutAnchor, layoutCrossfade, } = props; | ||
| visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] | ||
| ? undefined | ||
| : getClosestProjectingNode(visualElement.parent)); | ||
| visualElement.projection.setOptions({ | ||
| layoutId, | ||
| layout, | ||
| alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)), | ||
| visualElement, | ||
| /** | ||
| * TODO: Update options in an effect. This could be tricky as it'll be too late | ||
| * to update by the time layout animations run. | ||
| * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, | ||
| * ensuring it gets called if there's no potential layout animations. | ||
| * | ||
| */ | ||
| animationType: typeof layout === "string" ? layout : "both", | ||
| initialPromotionConfig, | ||
| crossfade: layoutCrossfade, | ||
| layoutScroll, | ||
| layoutRoot, | ||
| layoutAnchor, | ||
| }); | ||
| } | ||
| function getClosestProjectingNode(visualElement) { | ||
| if (!visualElement) | ||
| return undefined; | ||
| return visualElement.options.allowProjection !== false | ||
| ? visualElement.projection | ||
| : getClosestProjectingNode(visualElement.parent); | ||
| } | ||
| /** | ||
| * Create a `motion` component. | ||
| * | ||
| * This function accepts a Component argument, which can be either a string (ie "div" | ||
| * for `motion.div`), or an actual React component. | ||
| * | ||
| * Alongside this is a config option which provides a way of rendering the provided | ||
| * component "offline", or outside the React render cycle. | ||
| */ | ||
| function createMotionComponent(Component, { forwardMotionProps = false, type } = {}, preloadedFeatures, createVisualElement) { | ||
| preloadedFeatures && loadFeatures(preloadedFeatures); | ||
| /** | ||
| * Determine whether to use SVG or HTML rendering based on: | ||
| * 1. Explicit `type` option (highest priority) | ||
| * 2. Auto-detection via `isSVGComponent` | ||
| */ | ||
| const isSVG = type ? type === "svg" : isSVGComponent(Component); | ||
| const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState; | ||
| function MotionDOMComponent(props, externalRef) { | ||
| /** | ||
| * If we need to measure the element we load this functionality in a | ||
| * separate class component in order to gain access to getSnapshotBeforeUpdate. | ||
| */ | ||
| let MeasureLayout; | ||
| const configAndProps = { | ||
| ...React.useContext(MotionConfigContext), | ||
| ...props, | ||
| layoutId: useLayoutId(props), | ||
| }; | ||
| const { isStatic } = configAndProps; | ||
| const context = useCreateMotionContext(props); | ||
| const visualState = useVisualState(props, isStatic); | ||
| if (!isStatic && typeof window !== "undefined") { | ||
| useStrictMode(configAndProps, preloadedFeatures); | ||
| const layoutProjection = getProjectionFunctionality(configAndProps); | ||
| MeasureLayout = layoutProjection.MeasureLayout; | ||
| /** | ||
| * Create a VisualElement for this component. A VisualElement provides a common | ||
| * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as | ||
| * providing a way of rendering to these APIs outside of the React render loop | ||
| * for more performant animations and interactions | ||
| */ | ||
| context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG); | ||
| } | ||
| /** | ||
| * The mount order and hierarchy is specific to ensure our element ref | ||
| * is hydrated by the time features fire their effects. | ||
| */ | ||
| return (jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsxRuntime.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)] })); | ||
| } | ||
| MotionDOMComponent.displayName = `motion.${typeof Component === "string" | ||
| ? Component | ||
| : `create(${Component.displayName ?? Component.name ?? ""})`}`; | ||
| const ForwardRefMotionComponent = React.forwardRef(MotionDOMComponent); | ||
| ForwardRefMotionComponent[motionComponentSymbol] = Component; | ||
| return ForwardRefMotionComponent; | ||
| } | ||
| function useLayoutId({ layoutId }) { | ||
| const layoutGroupId = React.useContext(LayoutGroupContext).id; | ||
| return layoutGroupId && layoutId !== undefined | ||
| ? layoutGroupId + "-" + layoutId | ||
| : layoutId; | ||
| } | ||
| function useStrictMode(configAndProps, preloadedFeatures) { | ||
| const isStrict = React.useContext(LazyContext).strict; | ||
| /** | ||
| * If we're in development mode, check to make sure we're not rendering a motion component | ||
| * as a child of LazyMotion, as this will break the file-size benefits of using it. | ||
| */ | ||
| if (process.env.NODE_ENV !== "production" && | ||
| preloadedFeatures && | ||
| isStrict) { | ||
| const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead."; | ||
| configAndProps.ignoreStrict | ||
| ? motionUtils.warning(false, strictMessage, "lazy-strict-mode") | ||
| : motionUtils.invariant(false, strictMessage, "lazy-strict-mode"); | ||
| } | ||
| } | ||
| function getProjectionFunctionality(props) { | ||
| const featureDefinitions = getInitializedFeatureDefinitions(); | ||
| const { drag, layout } = featureDefinitions; | ||
| if (!drag && !layout) | ||
| return {}; | ||
| const combined = { ...drag, ...layout }; | ||
| return { | ||
| MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props) | ||
| ? combined.MeasureLayout | ||
| : undefined, | ||
| ProjectionNode: combined.ProjectionNode, | ||
| }; | ||
| } | ||
| exports.LayoutGroupContext = LayoutGroupContext; | ||
| exports.LazyContext = LazyContext; | ||
| exports.MotionConfigContext = MotionConfigContext; | ||
| exports.MotionContext = MotionContext; | ||
| exports.PresenceContext = PresenceContext; | ||
| exports.SwitchLayoutGroupContext = SwitchLayoutGroupContext; | ||
| exports.createMotionComponent = createMotionComponent; | ||
| exports.filterProps = filterProps; | ||
| exports.isBrowser = isBrowser; | ||
| exports.isRefObject = isRefObject; | ||
| exports.isSVGComponent = isSVGComponent; | ||
| exports.isValidMotionProp = isValidMotionProp; | ||
| exports.loadExternalIsValidProp = loadExternalIsValidProp; | ||
| exports.loadFeatures = loadFeatures; | ||
| exports.makeUseVisualState = makeUseVisualState; | ||
| exports.motionComponentSymbol = motionComponentSymbol; | ||
| exports.useConstant = useConstant; | ||
| exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; | ||
| //# sourceMappingURL=index-6W16WHlG.js.map |
Sorry, the diff of this file is too big to display
+367
| import { CSSProperties, PropsWithoutRef, RefAttributes, JSX, SVGAttributes } from 'react'; | ||
| import { MotionNodeOptions, MotionValue, TransformProperties, SVGPathProperties } from 'motion-dom'; | ||
| type MotionValueString = MotionValue<string>; | ||
| type MotionValueNumber = MotionValue<number>; | ||
| type MotionValueAny = MotionValue<any>; | ||
| type AnyMotionValue = MotionValueNumber | MotionValueString | MotionValueAny; | ||
| type MotionValueHelper<T> = T | AnyMotionValue; | ||
| type MakeMotionHelper<T> = { | ||
| [K in keyof T]: MotionValueHelper<T[K]>; | ||
| }; | ||
| type MakeCustomValueTypeHelper<T> = MakeMotionHelper<T>; | ||
| type MakeMotion<T> = MakeCustomValueTypeHelper<T>; | ||
| type MotionCSS = MakeMotion<Omit<CSSProperties, "rotate" | "scale" | "perspective" | "x" | "y" | "z">>; | ||
| /** | ||
| * @public | ||
| */ | ||
| type MotionTransform = MakeMotion<TransformProperties>; | ||
| type MotionSVGProps = MakeMotion<SVGPathProperties>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface MotionStyle$1 extends MotionCSS, MotionTransform, MotionSVGProps { | ||
| } | ||
| /** | ||
| * Props for `motion` components. | ||
| * | ||
| * @public | ||
| */ | ||
| interface MotionProps extends MotionNodeOptions { | ||
| /** | ||
| * | ||
| * The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(0) | ||
| * | ||
| * return <motion.div style={{ x, opacity: 1, scale: 0.5 }} /> | ||
| * } | ||
| * ``` | ||
| */ | ||
| style?: MotionStyle$1; | ||
| children?: React.ReactNode | MotionValueNumber | MotionValueString; | ||
| } | ||
| interface HTMLElements { | ||
| a: HTMLAnchorElement; | ||
| abbr: HTMLElement; | ||
| address: HTMLElement; | ||
| area: HTMLAreaElement; | ||
| article: HTMLElement; | ||
| aside: HTMLElement; | ||
| audio: HTMLAudioElement; | ||
| b: HTMLElement; | ||
| base: HTMLBaseElement; | ||
| bdi: HTMLElement; | ||
| bdo: HTMLElement; | ||
| big: HTMLElement; | ||
| blockquote: HTMLQuoteElement; | ||
| body: HTMLBodyElement; | ||
| br: HTMLBRElement; | ||
| button: HTMLButtonElement; | ||
| canvas: HTMLCanvasElement; | ||
| caption: HTMLElement; | ||
| center: HTMLElement; | ||
| cite: HTMLElement; | ||
| code: HTMLElement; | ||
| col: HTMLTableColElement; | ||
| colgroup: HTMLTableColElement; | ||
| data: HTMLDataElement; | ||
| datalist: HTMLDataListElement; | ||
| dd: HTMLElement; | ||
| del: HTMLModElement; | ||
| details: HTMLDetailsElement; | ||
| dfn: HTMLElement; | ||
| dialog: HTMLDialogElement; | ||
| div: HTMLDivElement; | ||
| dl: HTMLDListElement; | ||
| dt: HTMLElement; | ||
| em: HTMLElement; | ||
| embed: HTMLEmbedElement; | ||
| fieldset: HTMLFieldSetElement; | ||
| figcaption: HTMLElement; | ||
| figure: HTMLElement; | ||
| footer: HTMLElement; | ||
| form: HTMLFormElement; | ||
| h1: HTMLHeadingElement; | ||
| h2: HTMLHeadingElement; | ||
| h3: HTMLHeadingElement; | ||
| h4: HTMLHeadingElement; | ||
| h5: HTMLHeadingElement; | ||
| h6: HTMLHeadingElement; | ||
| head: HTMLHeadElement; | ||
| header: HTMLElement; | ||
| hgroup: HTMLElement; | ||
| hr: HTMLHRElement; | ||
| html: HTMLHtmlElement; | ||
| i: HTMLElement; | ||
| iframe: HTMLIFrameElement; | ||
| img: HTMLImageElement; | ||
| input: HTMLInputElement; | ||
| ins: HTMLModElement; | ||
| kbd: HTMLElement; | ||
| keygen: HTMLElement; | ||
| label: HTMLLabelElement; | ||
| legend: HTMLLegendElement; | ||
| li: HTMLLIElement; | ||
| link: HTMLLinkElement; | ||
| main: HTMLElement; | ||
| map: HTMLMapElement; | ||
| mark: HTMLElement; | ||
| menu: HTMLElement; | ||
| menuitem: HTMLElement; | ||
| meta: HTMLMetaElement; | ||
| meter: HTMLMeterElement; | ||
| nav: HTMLElement; | ||
| noindex: HTMLElement; | ||
| noscript: HTMLElement; | ||
| object: HTMLObjectElement; | ||
| ol: HTMLOListElement; | ||
| optgroup: HTMLOptGroupElement; | ||
| option: HTMLOptionElement; | ||
| output: HTMLOutputElement; | ||
| p: HTMLParagraphElement; | ||
| param: HTMLParamElement; | ||
| picture: HTMLElement; | ||
| pre: HTMLPreElement; | ||
| progress: HTMLProgressElement; | ||
| q: HTMLQuoteElement; | ||
| rp: HTMLElement; | ||
| rt: HTMLElement; | ||
| ruby: HTMLElement; | ||
| s: HTMLElement; | ||
| samp: HTMLElement; | ||
| search: HTMLElement; | ||
| slot: HTMLSlotElement; | ||
| script: HTMLScriptElement; | ||
| section: HTMLElement; | ||
| select: HTMLSelectElement; | ||
| small: HTMLElement; | ||
| source: HTMLSourceElement; | ||
| span: HTMLSpanElement; | ||
| strong: HTMLElement; | ||
| style: HTMLStyleElement; | ||
| sub: HTMLElement; | ||
| summary: HTMLElement; | ||
| sup: HTMLElement; | ||
| table: HTMLTableElement; | ||
| template: HTMLTemplateElement; | ||
| tbody: HTMLTableSectionElement; | ||
| td: HTMLTableDataCellElement; | ||
| textarea: HTMLTextAreaElement; | ||
| tfoot: HTMLTableSectionElement; | ||
| th: HTMLTableHeaderCellElement; | ||
| thead: HTMLTableSectionElement; | ||
| time: HTMLTimeElement; | ||
| title: HTMLTitleElement; | ||
| tr: HTMLTableRowElement; | ||
| track: HTMLTrackElement; | ||
| u: HTMLElement; | ||
| ul: HTMLUListElement; | ||
| var: HTMLElement; | ||
| video: HTMLVideoElement; | ||
| wbr: HTMLElement; | ||
| webview: HTMLWebViewElement; | ||
| } | ||
| /** | ||
| * @public | ||
| */ | ||
| type ForwardRefComponent<T, P> = { | ||
| readonly $$typeof: symbol; | ||
| } & ((props: PropsWithoutRef<P> & RefAttributes<T>) => JSX.Element); | ||
| type AttributesWithoutMotionProps<Attributes> = { | ||
| [K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K]; | ||
| }; | ||
| /** | ||
| * @public | ||
| */ | ||
| type HTMLMotionProps<Tag extends keyof HTMLElements> = AttributesWithoutMotionProps<JSX.IntrinsicElements[Tag]> & MotionProps; | ||
| interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> { | ||
| } | ||
| /** | ||
| * Blanket-accept any SVG attribute as a `MotionValue` | ||
| * @public | ||
| */ | ||
| type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps { | ||
| } | ||
| /** | ||
| * HTML components | ||
| */ | ||
| declare const MotionA: ForwardRefComponent<HTMLAnchorElement, HTMLMotionProps<"a">>; | ||
| declare const MotionAbbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"abbr">>; | ||
| declare const MotionAddress: ForwardRefComponent<HTMLElement, HTMLMotionProps<"address">>; | ||
| declare const MotionArea: ForwardRefComponent<HTMLAreaElement, HTMLMotionProps<"area">>; | ||
| declare const MotionArticle: ForwardRefComponent<HTMLElement, HTMLMotionProps<"article">>; | ||
| declare const MotionAside: ForwardRefComponent<HTMLElement, HTMLMotionProps<"aside">>; | ||
| declare const MotionAudio: ForwardRefComponent<HTMLAudioElement, HTMLMotionProps<"audio">>; | ||
| declare const MotionB: ForwardRefComponent<HTMLElement, HTMLMotionProps<"b">>; | ||
| declare const MotionBase: ForwardRefComponent<HTMLBaseElement, HTMLMotionProps<"base">>; | ||
| declare const MotionBdi: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdi">>; | ||
| declare const MotionBdo: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdo">>; | ||
| declare const MotionBig: ForwardRefComponent<HTMLElement, HTMLMotionProps<"big">>; | ||
| declare const MotionBlockquote: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"blockquote">>; | ||
| declare const MotionBody: ForwardRefComponent<HTMLBodyElement, HTMLMotionProps<"body">>; | ||
| declare const MotionButton: ForwardRefComponent<HTMLButtonElement, HTMLMotionProps<"button">>; | ||
| declare const MotionCanvas: ForwardRefComponent<HTMLCanvasElement, HTMLMotionProps<"canvas">>; | ||
| declare const MotionCaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"caption">>; | ||
| declare const MotionCite: ForwardRefComponent<HTMLElement, HTMLMotionProps<"cite">>; | ||
| declare const MotionCode: ForwardRefComponent<HTMLElement, HTMLMotionProps<"code">>; | ||
| declare const MotionCol: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"col">>; | ||
| declare const MotionColgroup: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"colgroup">>; | ||
| declare const MotionData: ForwardRefComponent<HTMLDataElement, HTMLMotionProps<"data">>; | ||
| declare const MotionDatalist: ForwardRefComponent<HTMLDataListElement, HTMLMotionProps<"datalist">>; | ||
| declare const MotionDd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dd">>; | ||
| declare const MotionDel: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"del">>; | ||
| declare const MotionDetails: ForwardRefComponent<HTMLDetailsElement, HTMLMotionProps<"details">>; | ||
| declare const MotionDfn: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dfn">>; | ||
| declare const MotionDialog: ForwardRefComponent<HTMLDialogElement, HTMLMotionProps<"dialog">>; | ||
| declare const MotionDiv: ForwardRefComponent<HTMLDivElement, HTMLMotionProps<"div">>; | ||
| declare const MotionDl: ForwardRefComponent<HTMLDListElement, HTMLMotionProps<"dl">>; | ||
| declare const MotionDt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dt">>; | ||
| declare const MotionEm: ForwardRefComponent<HTMLElement, HTMLMotionProps<"em">>; | ||
| declare const MotionEmbed: ForwardRefComponent<HTMLEmbedElement, HTMLMotionProps<"embed">>; | ||
| declare const MotionFieldset: ForwardRefComponent<HTMLFieldSetElement, HTMLMotionProps<"fieldset">>; | ||
| declare const MotionFigcaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figcaption">>; | ||
| declare const MotionFigure: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figure">>; | ||
| declare const MotionFooter: ForwardRefComponent<HTMLElement, HTMLMotionProps<"footer">>; | ||
| declare const MotionForm: ForwardRefComponent<HTMLFormElement, HTMLMotionProps<"form">>; | ||
| declare const MotionH1: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h1">>; | ||
| declare const MotionH2: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h2">>; | ||
| declare const MotionH3: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h3">>; | ||
| declare const MotionH4: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h4">>; | ||
| declare const MotionH5: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h5">>; | ||
| declare const MotionH6: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h6">>; | ||
| declare const MotionHead: ForwardRefComponent<HTMLHeadElement, HTMLMotionProps<"head">>; | ||
| declare const MotionHeader: ForwardRefComponent<HTMLElement, HTMLMotionProps<"header">>; | ||
| declare const MotionHgroup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"hgroup">>; | ||
| declare const MotionHr: ForwardRefComponent<HTMLHRElement, HTMLMotionProps<"hr">>; | ||
| declare const MotionHtml: ForwardRefComponent<HTMLHtmlElement, HTMLMotionProps<"html">>; | ||
| declare const MotionI: ForwardRefComponent<HTMLElement, HTMLMotionProps<"i">>; | ||
| declare const MotionIframe: ForwardRefComponent<HTMLIFrameElement, HTMLMotionProps<"iframe">>; | ||
| declare const MotionImg: ForwardRefComponent<HTMLImageElement, HTMLMotionProps<"img">>; | ||
| declare const MotionInput: ForwardRefComponent<HTMLInputElement, HTMLMotionProps<"input">>; | ||
| declare const MotionIns: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"ins">>; | ||
| declare const MotionKbd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"kbd">>; | ||
| declare const MotionKeygen: ForwardRefComponent<HTMLElement, HTMLMotionProps<"keygen">>; | ||
| declare const MotionLabel: ForwardRefComponent<HTMLLabelElement, HTMLMotionProps<"label">>; | ||
| declare const MotionLegend: ForwardRefComponent<HTMLLegendElement, HTMLMotionProps<"legend">>; | ||
| declare const MotionLi: ForwardRefComponent<HTMLLIElement, HTMLMotionProps<"li">>; | ||
| declare const MotionLink: ForwardRefComponent<HTMLLinkElement, HTMLMotionProps<"link">>; | ||
| declare const MotionMain: ForwardRefComponent<HTMLElement, HTMLMotionProps<"main">>; | ||
| declare const MotionMap: ForwardRefComponent<HTMLMapElement, HTMLMotionProps<"map">>; | ||
| declare const MotionMark: ForwardRefComponent<HTMLElement, HTMLMotionProps<"mark">>; | ||
| declare const MotionMenu: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menu">>; | ||
| declare const MotionMenuitem: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menuitem">>; | ||
| declare const MotionMeter: ForwardRefComponent<HTMLMeterElement, HTMLMotionProps<"meter">>; | ||
| declare const MotionNav: ForwardRefComponent<HTMLElement, HTMLMotionProps<"nav">>; | ||
| declare const MotionObject: ForwardRefComponent<HTMLObjectElement, HTMLMotionProps<"object">>; | ||
| declare const MotionOl: ForwardRefComponent<HTMLOListElement, HTMLMotionProps<"ol">>; | ||
| declare const MotionOptgroup: ForwardRefComponent<HTMLOptGroupElement, HTMLMotionProps<"optgroup">>; | ||
| declare const MotionOption: ForwardRefComponent<HTMLOptionElement, HTMLMotionProps<"option">>; | ||
| declare const MotionOutput: ForwardRefComponent<HTMLOutputElement, HTMLMotionProps<"output">>; | ||
| declare const MotionP: ForwardRefComponent<HTMLParagraphElement, HTMLMotionProps<"p">>; | ||
| declare const MotionParam: ForwardRefComponent<HTMLParamElement, HTMLMotionProps<"param">>; | ||
| declare const MotionPicture: ForwardRefComponent<HTMLElement, HTMLMotionProps<"picture">>; | ||
| declare const MotionPre: ForwardRefComponent<HTMLPreElement, HTMLMotionProps<"pre">>; | ||
| declare const MotionProgress: ForwardRefComponent<HTMLProgressElement, HTMLMotionProps<"progress">>; | ||
| declare const MotionQ: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"q">>; | ||
| declare const MotionRp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rp">>; | ||
| declare const MotionRt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rt">>; | ||
| declare const MotionRuby: ForwardRefComponent<HTMLElement, HTMLMotionProps<"ruby">>; | ||
| declare const MotionS: ForwardRefComponent<HTMLElement, HTMLMotionProps<"s">>; | ||
| declare const MotionSamp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"samp">>; | ||
| declare const MotionScript: ForwardRefComponent<HTMLScriptElement, HTMLMotionProps<"script">>; | ||
| declare const MotionSection: ForwardRefComponent<HTMLElement, HTMLMotionProps<"section">>; | ||
| declare const MotionSelect: ForwardRefComponent<HTMLSelectElement, HTMLMotionProps<"select">>; | ||
| declare const MotionSmall: ForwardRefComponent<HTMLElement, HTMLMotionProps<"small">>; | ||
| declare const MotionSource: ForwardRefComponent<HTMLSourceElement, HTMLMotionProps<"source">>; | ||
| declare const MotionSpan: ForwardRefComponent<HTMLSpanElement, HTMLMotionProps<"span">>; | ||
| declare const MotionStrong: ForwardRefComponent<HTMLElement, HTMLMotionProps<"strong">>; | ||
| declare const MotionStyle: ForwardRefComponent<HTMLStyleElement, HTMLMotionProps<"style">>; | ||
| declare const MotionSub: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sub">>; | ||
| declare const MotionSummary: ForwardRefComponent<HTMLElement, HTMLMotionProps<"summary">>; | ||
| declare const MotionSup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sup">>; | ||
| declare const MotionTable: ForwardRefComponent<HTMLTableElement, HTMLMotionProps<"table">>; | ||
| declare const MotionTbody: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tbody">>; | ||
| declare const MotionTd: ForwardRefComponent<HTMLTableDataCellElement, HTMLMotionProps<"td">>; | ||
| declare const MotionTextarea: ForwardRefComponent<HTMLTextAreaElement, HTMLMotionProps<"textarea">>; | ||
| declare const MotionTfoot: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tfoot">>; | ||
| declare const MotionTh: ForwardRefComponent<HTMLTableHeaderCellElement, HTMLMotionProps<"th">>; | ||
| declare const MotionThead: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"thead">>; | ||
| declare const MotionTime: ForwardRefComponent<HTMLTimeElement, HTMLMotionProps<"time">>; | ||
| declare const MotionTitle: ForwardRefComponent<HTMLTitleElement, HTMLMotionProps<"title">>; | ||
| declare const MotionTr: ForwardRefComponent<HTMLTableRowElement, HTMLMotionProps<"tr">>; | ||
| declare const MotionTrack: ForwardRefComponent<HTMLTrackElement, HTMLMotionProps<"track">>; | ||
| declare const MotionU: ForwardRefComponent<HTMLElement, HTMLMotionProps<"u">>; | ||
| declare const MotionUl: ForwardRefComponent<HTMLUListElement, HTMLMotionProps<"ul">>; | ||
| declare const MotionVideo: ForwardRefComponent<HTMLVideoElement, HTMLMotionProps<"video">>; | ||
| declare const MotionWbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"wbr">>; | ||
| declare const MotionWebview: ForwardRefComponent<HTMLWebViewElement, HTMLMotionProps<"webview">>; | ||
| /** | ||
| * SVG components | ||
| */ | ||
| declare const MotionAnimate: ForwardRefComponent<SVGElement, SVGMotionProps<SVGElement>>; | ||
| declare const MotionCircle: ForwardRefComponent<SVGCircleElement, SVGMotionProps<SVGCircleElement>>; | ||
| declare const MotionDefs: ForwardRefComponent<SVGDefsElement, SVGMotionProps<SVGDefsElement>>; | ||
| declare const MotionDesc: ForwardRefComponent<SVGDescElement, SVGMotionProps<SVGDescElement>>; | ||
| declare const MotionEllipse: ForwardRefComponent<SVGEllipseElement, SVGMotionProps<SVGEllipseElement>>; | ||
| declare const MotionG: ForwardRefComponent<SVGGElement, SVGMotionProps<SVGGElement>>; | ||
| declare const MotionImage: ForwardRefComponent<SVGImageElement, SVGMotionProps<SVGImageElement>>; | ||
| declare const MotionLine: ForwardRefComponent<SVGLineElement, SVGMotionProps<SVGLineElement>>; | ||
| declare const MotionFilter: ForwardRefComponent<SVGFilterElement, SVGMotionProps<SVGFilterElement>>; | ||
| declare const MotionMarker: ForwardRefComponent<SVGMarkerElement, SVGMotionProps<SVGMarkerElement>>; | ||
| declare const MotionMask: ForwardRefComponent<SVGMaskElement, SVGMotionProps<SVGMaskElement>>; | ||
| declare const MotionMetadata: ForwardRefComponent<SVGMetadataElement, SVGMotionProps<SVGMetadataElement>>; | ||
| declare const MotionPath: ForwardRefComponent<SVGPathElement, SVGMotionProps<SVGPathElement>>; | ||
| declare const MotionPattern: ForwardRefComponent<SVGPatternElement, SVGMotionProps<SVGPatternElement>>; | ||
| declare const MotionPolygon: ForwardRefComponent<SVGPolygonElement, SVGMotionProps<SVGPolygonElement>>; | ||
| declare const MotionPolyline: ForwardRefComponent<SVGPolylineElement, SVGMotionProps<SVGPolylineElement>>; | ||
| declare const MotionRect: ForwardRefComponent<SVGRectElement, SVGMotionProps<SVGRectElement>>; | ||
| declare const MotionStop: ForwardRefComponent<SVGStopElement, SVGMotionProps<SVGStopElement>>; | ||
| declare const MotionSvg: ForwardRefComponent<SVGSVGElement, SVGMotionProps<SVGSVGElement>>; | ||
| declare const MotionSymbol: ForwardRefComponent<SVGSymbolElement, SVGMotionProps<SVGSymbolElement>>; | ||
| declare const MotionText: ForwardRefComponent<SVGTextElement, SVGMotionProps<SVGTextElement>>; | ||
| declare const MotionTspan: ForwardRefComponent<SVGTSpanElement, SVGMotionProps<SVGTSpanElement>>; | ||
| declare const MotionUse: ForwardRefComponent<SVGUseElement, SVGMotionProps<SVGUseElement>>; | ||
| declare const MotionView: ForwardRefComponent<SVGViewElement, SVGMotionProps<SVGViewElement>>; | ||
| declare const MotionClipPath: ForwardRefComponent<SVGClipPathElement, SVGMotionProps<SVGClipPathElement>>; | ||
| declare const MotionFeBlend: ForwardRefComponent<SVGFEBlendElement, SVGMotionProps<SVGFEBlendElement>>; | ||
| declare const MotionFeColorMatrix: ForwardRefComponent<SVGFEColorMatrixElement, SVGMotionProps<SVGFEColorMatrixElement>>; | ||
| declare const MotionFeComponentTransfer: ForwardRefComponent<SVGFEComponentTransferElement, SVGMotionProps<SVGFEComponentTransferElement>>; | ||
| declare const MotionFeComposite: ForwardRefComponent<SVGFECompositeElement, SVGMotionProps<SVGFECompositeElement>>; | ||
| declare const MotionFeConvolveMatrix: ForwardRefComponent<SVGFEConvolveMatrixElement, SVGMotionProps<SVGFEConvolveMatrixElement>>; | ||
| declare const MotionFeDiffuseLighting: ForwardRefComponent<SVGFEDiffuseLightingElement, SVGMotionProps<SVGFEDiffuseLightingElement>>; | ||
| declare const MotionFeDisplacementMap: ForwardRefComponent<SVGFEDisplacementMapElement, SVGMotionProps<SVGFEDisplacementMapElement>>; | ||
| declare const MotionFeDistantLight: ForwardRefComponent<SVGFEDistantLightElement, SVGMotionProps<SVGFEDistantLightElement>>; | ||
| declare const MotionFeDropShadow: ForwardRefComponent<SVGFEDropShadowElement, SVGMotionProps<SVGFEDropShadowElement>>; | ||
| declare const MotionFeFlood: ForwardRefComponent<SVGFEFloodElement, SVGMotionProps<SVGFEFloodElement>>; | ||
| declare const MotionFeFuncA: ForwardRefComponent<SVGFEFuncAElement, SVGMotionProps<SVGFEFuncAElement>>; | ||
| declare const MotionFeFuncB: ForwardRefComponent<SVGFEFuncBElement, SVGMotionProps<SVGFEFuncBElement>>; | ||
| declare const MotionFeFuncG: ForwardRefComponent<SVGFEFuncGElement, SVGMotionProps<SVGFEFuncGElement>>; | ||
| declare const MotionFeFuncR: ForwardRefComponent<SVGFEFuncRElement, SVGMotionProps<SVGFEFuncRElement>>; | ||
| declare const MotionFeGaussianBlur: ForwardRefComponent<SVGFEGaussianBlurElement, SVGMotionProps<SVGFEGaussianBlurElement>>; | ||
| declare const MotionFeImage: ForwardRefComponent<SVGFEImageElement, SVGMotionProps<SVGFEImageElement>>; | ||
| declare const MotionFeMerge: ForwardRefComponent<SVGFEMergeElement, SVGMotionProps<SVGFEMergeElement>>; | ||
| declare const MotionFeMergeNode: ForwardRefComponent<SVGFEMergeNodeElement, SVGMotionProps<SVGFEMergeNodeElement>>; | ||
| declare const MotionFeMorphology: ForwardRefComponent<SVGFEMorphologyElement, SVGMotionProps<SVGFEMorphologyElement>>; | ||
| declare const MotionFeOffset: ForwardRefComponent<SVGFEOffsetElement, SVGMotionProps<SVGFEOffsetElement>>; | ||
| declare const MotionFePointLight: ForwardRefComponent<SVGFEPointLightElement, SVGMotionProps<SVGFEPointLightElement>>; | ||
| declare const MotionFeSpecularLighting: ForwardRefComponent<SVGFESpecularLightingElement, SVGMotionProps<SVGFESpecularLightingElement>>; | ||
| declare const MotionFeSpotLight: ForwardRefComponent<SVGFESpotLightElement, SVGMotionProps<SVGFESpotLightElement>>; | ||
| declare const MotionFeTile: ForwardRefComponent<SVGFETileElement, SVGMotionProps<SVGFETileElement>>; | ||
| declare const MotionFeTurbulence: ForwardRefComponent<SVGFETurbulenceElement, SVGMotionProps<SVGFETurbulenceElement>>; | ||
| declare const MotionForeignObject: ForwardRefComponent<SVGForeignObjectElement, SVGMotionProps<SVGForeignObjectElement>>; | ||
| declare const MotionLinearGradient: ForwardRefComponent<SVGLinearGradientElement, SVGMotionProps<SVGLinearGradientElement>>; | ||
| declare const MotionRadialGradient: ForwardRefComponent<SVGRadialGradientElement, SVGMotionProps<SVGRadialGradientElement>>; | ||
| declare const MotionTextPath: ForwardRefComponent<SVGTextPathElement, SVGMotionProps<SVGTextPathElement>>; | ||
| export { MotionA as a, MotionAbbr as abbr, MotionAddress as address, MotionAnimate as animate, MotionArea as area, MotionArticle as article, MotionAside as aside, MotionAudio as audio, MotionB as b, MotionBase as base, MotionBdi as bdi, MotionBdo as bdo, MotionBig as big, MotionBlockquote as blockquote, MotionBody as body, MotionButton as button, MotionCanvas as canvas, MotionCaption as caption, MotionCircle as circle, MotionCite as cite, MotionClipPath as clipPath, MotionCode as code, MotionCol as col, MotionColgroup as colgroup, MotionData as data, MotionDatalist as datalist, MotionDd as dd, MotionDefs as defs, MotionDel as del, MotionDesc as desc, MotionDetails as details, MotionDfn as dfn, MotionDialog as dialog, MotionDiv as div, MotionDl as dl, MotionDt as dt, MotionEllipse as ellipse, MotionEm as em, MotionEmbed as embed, MotionFeBlend as feBlend, MotionFeColorMatrix as feColorMatrix, MotionFeComponentTransfer as feComponentTransfer, MotionFeComposite as feComposite, MotionFeConvolveMatrix as feConvolveMatrix, MotionFeDiffuseLighting as feDiffuseLighting, MotionFeDisplacementMap as feDisplacementMap, MotionFeDistantLight as feDistantLight, MotionFeDropShadow as feDropShadow, MotionFeFlood as feFlood, MotionFeFuncA as feFuncA, MotionFeFuncB as feFuncB, MotionFeFuncG as feFuncG, MotionFeFuncR as feFuncR, MotionFeGaussianBlur as feGaussianBlur, MotionFeImage as feImage, MotionFeMerge as feMerge, MotionFeMergeNode as feMergeNode, MotionFeMorphology as feMorphology, MotionFeOffset as feOffset, MotionFePointLight as fePointLight, MotionFeSpecularLighting as feSpecularLighting, MotionFeSpotLight as feSpotLight, MotionFeTile as feTile, MotionFeTurbulence as feTurbulence, MotionFieldset as fieldset, MotionFigcaption as figcaption, MotionFigure as figure, MotionFilter as filter, MotionFooter as footer, MotionForeignObject as foreignObject, MotionForm as form, MotionG as g, MotionH1 as h1, MotionH2 as h2, MotionH3 as h3, MotionH4 as h4, MotionH5 as h5, MotionH6 as h6, MotionHead as head, MotionHeader as header, MotionHgroup as hgroup, MotionHr as hr, MotionHtml as html, MotionI as i, MotionIframe as iframe, MotionImage as image, MotionImg as img, MotionInput as input, MotionIns as ins, MotionKbd as kbd, MotionKeygen as keygen, MotionLabel as label, MotionLegend as legend, MotionLi as li, MotionLine as line, MotionLinearGradient as linearGradient, MotionLink as link, MotionMain as main, MotionMap as map, MotionMark as mark, MotionMarker as marker, MotionMask as mask, MotionMenu as menu, MotionMenuitem as menuitem, MotionMetadata as metadata, MotionMeter as meter, MotionNav as nav, MotionObject as object, MotionOl as ol, MotionOptgroup as optgroup, MotionOption as option, MotionOutput as output, MotionP as p, MotionParam as param, MotionPath as path, MotionPattern as pattern, MotionPicture as picture, MotionPolygon as polygon, MotionPolyline as polyline, MotionPre as pre, MotionProgress as progress, MotionQ as q, MotionRadialGradient as radialGradient, MotionRect as rect, MotionRp as rp, MotionRt as rt, MotionRuby as ruby, MotionS as s, MotionSamp as samp, MotionScript as script, MotionSection as section, MotionSelect as select, MotionSmall as small, MotionSource as source, MotionSpan as span, MotionStop as stop, MotionStrong as strong, MotionStyle as style, MotionSub as sub, MotionSummary as summary, MotionSup as sup, MotionSvg as svg, MotionSymbol as symbol, MotionTable as table, MotionTbody as tbody, MotionTd as td, MotionText as text, MotionTextPath as textPath, MotionTextarea as textarea, MotionTfoot as tfoot, MotionTh as th, MotionThead as thead, MotionTime as time, MotionTitle as title, MotionTr as tr, MotionTrack as track, MotionTspan as tspan, MotionU as u, MotionUl as ul, MotionUse as use, MotionVideo as video, MotionView as view, MotionWbr as wbr, MotionWebview as webview }; |
| /** | ||
| * Currently, we only support element tracking with `scrollInfo`, though in | ||
| * the future we can also offer ViewTimeline support. | ||
| */ | ||
| function isElementTracking(options) { | ||
| return options && (options.target || options.offset); | ||
| } | ||
| export { isElementTracking }; | ||
| //# sourceMappingURL=is-element-tracking.mjs.map |
| {"version":3,"file":"is-element-tracking.mjs","sources":["../../../../../../src/render/dom/scroll/utils/is-element-tracking.ts"],"sourcesContent":["import { ScrollOptionsWithDefaults } from \"../types\"\n\n/**\n * Currently, we only support element tracking with `scrollInfo`, though in\n * the future we can also offer ViewTimeline support.\n */\nexport function isElementTracking(options?: ScrollOptionsWithDefaults) {\n return options && (options.target || options.offset)\n}\n"],"names":[],"mappings":"AAEA;;;AAGG;AACG,SAAU,iBAAiB,CAAC,OAAmC,EAAA;IACjE,OAAO,OAAO,KAAK,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;AACxD;;;;"} |
Sorry, the diff of this file is too big to display
| { | ||
| "private": true, | ||
| "types": "../dist/types/client.d.ts", | ||
| "types": "../dist/client.d.ts", | ||
| "main": "../dist/cjs/client.js", | ||
| "module": "../dist/es/client.mjs" | ||
| } |
@@ -5,10 +5,11 @@ 'use strict'; | ||
| var featureBundle = require('./feature-bundle-BieBX2Jn.js'); | ||
| require('motion-dom'); | ||
| require('react'); | ||
| var index = require('./index-6W16WHlG.js'); | ||
| var featureBundle = require('./feature-bundle-frRcWALD.js'); | ||
| require('react/jsx-runtime'); | ||
| require('motion-utils'); | ||
| require('react'); | ||
| require('motion-dom'); | ||
| function createMotionComponentWithFeatures(Component, options) { | ||
| return featureBundle.createMotionComponent(Component, options, featureBundle.featureBundle, featureBundle.createDomVisualElement); | ||
| return index.createMotionComponent(Component, options, featureBundle.featureBundle, featureBundle.createDomVisualElement); | ||
| } | ||
@@ -15,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"client.js","sources":["../../src/render/components/motion/create.ts","../../src/render/components/motion/elements.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { createDomVisualElement } from \"../../dom/create-visual-element\"\nimport { DOMMotionComponents } from \"../../dom/types\"\nimport { CreateVisualElement } from \"../../types\"\nimport { featureBundle } from \"./feature-bundle\"\n\nexport function createMotionComponentWithFeatures<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(\n Component,\n options,\n featureBundle,\n createDomVisualElement as CreateVisualElement<Props, TagName>\n )\n}\n","\"use client\"\n\nimport { createMotionComponentWithFeatures as createMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMotionComponent(\"abbr\")\nexport const MotionAddress = /*@__PURE__*/ createMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMotionComponent(\"area\")\nexport const MotionArticle = /*@__PURE__*/ createMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMotionComponent(\"canvas\")\nexport const MotionCaption = /*@__PURE__*/ createMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMotionComponent(\"col\")\nexport const MotionColgroup = /*@__PURE__*/ createMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMotionComponent(\"data\")\nexport const MotionDatalist = /*@__PURE__*/ createMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMotionComponent(\"del\")\nexport const MotionDetails = /*@__PURE__*/ createMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMotionComponent(\"embed\")\nexport const MotionFieldset = /*@__PURE__*/ createMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMotionComponent(\"menu\")\nexport const MotionMenuitem = /*@__PURE__*/ createMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMotionComponent(\"ol\")\nexport const MotionOptgroup = /*@__PURE__*/ createMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMotionComponent(\"param\")\nexport const MotionPicture = /*@__PURE__*/ createMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMotionComponent(\"pre\")\nexport const MotionProgress = /*@__PURE__*/ createMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMotionComponent(\"script\")\nexport const MotionSection = /*@__PURE__*/ createMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMotionComponent(\"sub\")\nexport const MotionSummary = /*@__PURE__*/ createMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMotionComponent(\"td\")\nexport const MotionTextarea = /*@__PURE__*/ createMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMotionComponent(\"wbr\")\nexport const MotionWebview = /*@__PURE__*/ createMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate = /*@__PURE__*/ createMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMotionComponent(\"desc\")\nexport const MotionEllipse = /*@__PURE__*/ createMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMotionComponent(\"mask\")\nexport const MotionMetadata = /*@__PURE__*/ createMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMotionComponent(\"path\")\nexport const MotionPattern = /*@__PURE__*/ createMotionComponent(\"pattern\")\nexport const MotionPolygon = /*@__PURE__*/ createMotionComponent(\"polygon\")\nexport const MotionPolyline = /*@__PURE__*/ createMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMotionComponent(\"view\")\nexport const MotionClipPath = /*@__PURE__*/ createMotionComponent(\"clipPath\")\nexport const MotionFeBlend = /*@__PURE__*/ createMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer = /*@__PURE__*/ createMotionComponent(\n \"feComponentTransfer\"\n)\nexport const MotionFeComposite =\n /*@__PURE__*/ createMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood = /*@__PURE__*/ createMotionComponent(\"feFlood\")\nexport const MotionFeFuncA = /*@__PURE__*/ createMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB = /*@__PURE__*/ createMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG = /*@__PURE__*/ createMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR = /*@__PURE__*/ createMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage = /*@__PURE__*/ createMotionComponent(\"feImage\")\nexport const MotionFeMerge = /*@__PURE__*/ createMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMotionComponent(\"feMorphology\")\nexport const MotionFeOffset = /*@__PURE__*/ createMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMotionComponent(\"radialGradient\")\nexport const MotionTextPath = /*@__PURE__*/ createMotionComponent(\"textPath\")\n"],"names":["createMotionComponent","featureBundle","createDomVisualElement"],"mappings":";;;;;;;;;;AAMM,SAAU,iCAAiC,CAI7C,SAAwD,EACxD,OAAgC,EAAA;IAEhC,OAAOA,mCAAqB,CACxB,SAAS,EACT,OAAO,EACPC,2BAAa,EACbC,oCAA6D,CAChE;AACL;;ACfA;;AAEG;AACI,MAAM,OAAO,iBAAiBF,iCAAqB,CAAC,GAAG;AACvD,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,aAAa,iBAAiBA,iCAAqB,CAAC,SAAS;AACnE,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,aAAa,iBAAiBA,iCAAqB,CAAC,SAAS;AACnE,MAAM,WAAW,iBAAiBA,iCAAqB,CAAC,OAAO;AAC/D,MAAM,WAAW,iBAAiBA,iCAAqB,CAAC,OAAO;AAC/D,MAAM,OAAO,iBAAiBA,iCAAqB,CAAC,GAAG;AACvD,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,SAAS,iBAAiBA,iCAAqB,CAAC,KAAK;AAC3D,MAAM,SAAS,iBAAiBA,iCAAqB,CAAC,KAAK;AAC3D,MAAM,SAAS,iBAAiBA,iCAAqB,CAAC,KAAK;MACrD,gBAAgB;AACzB,cAAcA,iCAAqB,CAAC,YAAY;AAC7C,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,YAAY,iBAAiBA,iCAAqB,CAAC,QAAQ;AACjE,MAAM,YAAY,iBAAiBA,iCAAqB,CAAC,QAAQ;AACjE,MAAM,aAAa,iBAAiBA,iCAAqB,CAAC,SAAS;AACnE,MAAM,UAAU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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} | ||
| {"version":3,"file":"client.js","sources":["../../src/render/components/motion/create.ts","../../src/render/components/motion/elements.ts"],"sourcesContent":["import { createMotionComponent, MotionComponentOptions } from \"../../../motion\"\nimport { createDomVisualElement } from \"../../dom/create-visual-element\"\nimport { DOMMotionComponents } from \"../../dom/types\"\nimport { CreateVisualElement } from \"../../types\"\nimport { featureBundle } from \"./feature-bundle\"\n\nexport function createMotionComponentWithFeatures<\n Props,\n TagName extends keyof DOMMotionComponents | string = \"div\"\n>(\n Component: TagName | string | React.ComponentType<Props>,\n options?: MotionComponentOptions\n) {\n return createMotionComponent(\n Component,\n options,\n featureBundle,\n createDomVisualElement as CreateVisualElement<Props, TagName>\n )\n}\n","\"use client\"\n\nimport { createMotionComponentWithFeatures as createMotionComponent } from \"./create\"\n\n/**\n * HTML components\n */\nexport const MotionA = /*@__PURE__*/ createMotionComponent(\"a\")\nexport const MotionAbbr = /*@__PURE__*/ createMotionComponent(\"abbr\")\nexport const MotionAddress = /*@__PURE__*/ createMotionComponent(\"address\")\nexport const MotionArea = /*@__PURE__*/ createMotionComponent(\"area\")\nexport const MotionArticle = /*@__PURE__*/ createMotionComponent(\"article\")\nexport const MotionAside = /*@__PURE__*/ createMotionComponent(\"aside\")\nexport const MotionAudio = /*@__PURE__*/ createMotionComponent(\"audio\")\nexport const MotionB = /*@__PURE__*/ createMotionComponent(\"b\")\nexport const MotionBase = /*@__PURE__*/ createMotionComponent(\"base\")\nexport const MotionBdi = /*@__PURE__*/ createMotionComponent(\"bdi\")\nexport const MotionBdo = /*@__PURE__*/ createMotionComponent(\"bdo\")\nexport const MotionBig = /*@__PURE__*/ createMotionComponent(\"big\")\nexport const MotionBlockquote =\n /*@__PURE__*/ createMotionComponent(\"blockquote\")\nexport const MotionBody = /*@__PURE__*/ createMotionComponent(\"body\")\nexport const MotionButton = /*@__PURE__*/ createMotionComponent(\"button\")\nexport const MotionCanvas = /*@__PURE__*/ createMotionComponent(\"canvas\")\nexport const MotionCaption = /*@__PURE__*/ createMotionComponent(\"caption\")\nexport const MotionCite = /*@__PURE__*/ createMotionComponent(\"cite\")\nexport const MotionCode = /*@__PURE__*/ createMotionComponent(\"code\")\nexport const MotionCol = /*@__PURE__*/ createMotionComponent(\"col\")\nexport const MotionColgroup = /*@__PURE__*/ createMotionComponent(\"colgroup\")\nexport const MotionData = /*@__PURE__*/ createMotionComponent(\"data\")\nexport const MotionDatalist = /*@__PURE__*/ createMotionComponent(\"datalist\")\nexport const MotionDd = /*@__PURE__*/ createMotionComponent(\"dd\")\nexport const MotionDel = /*@__PURE__*/ createMotionComponent(\"del\")\nexport const MotionDetails = /*@__PURE__*/ createMotionComponent(\"details\")\nexport const MotionDfn = /*@__PURE__*/ createMotionComponent(\"dfn\")\nexport const MotionDialog = /*@__PURE__*/ createMotionComponent(\"dialog\")\nexport const MotionDiv = /*@__PURE__*/ createMotionComponent(\"div\")\nexport const MotionDl = /*@__PURE__*/ createMotionComponent(\"dl\")\nexport const MotionDt = /*@__PURE__*/ createMotionComponent(\"dt\")\nexport const MotionEm = /*@__PURE__*/ createMotionComponent(\"em\")\nexport const MotionEmbed = /*@__PURE__*/ createMotionComponent(\"embed\")\nexport const MotionFieldset = /*@__PURE__*/ createMotionComponent(\"fieldset\")\nexport const MotionFigcaption =\n /*@__PURE__*/ createMotionComponent(\"figcaption\")\nexport const MotionFigure = /*@__PURE__*/ createMotionComponent(\"figure\")\nexport const MotionFooter = /*@__PURE__*/ createMotionComponent(\"footer\")\nexport const MotionForm = /*@__PURE__*/ createMotionComponent(\"form\")\nexport const MotionH1 = /*@__PURE__*/ createMotionComponent(\"h1\")\nexport const MotionH2 = /*@__PURE__*/ createMotionComponent(\"h2\")\nexport const MotionH3 = /*@__PURE__*/ createMotionComponent(\"h3\")\nexport const MotionH4 = /*@__PURE__*/ createMotionComponent(\"h4\")\nexport const MotionH5 = /*@__PURE__*/ createMotionComponent(\"h5\")\nexport const MotionH6 = /*@__PURE__*/ createMotionComponent(\"h6\")\nexport const MotionHead = /*@__PURE__*/ createMotionComponent(\"head\")\nexport const MotionHeader = /*@__PURE__*/ createMotionComponent(\"header\")\nexport const MotionHgroup = /*@__PURE__*/ createMotionComponent(\"hgroup\")\nexport const MotionHr = /*@__PURE__*/ createMotionComponent(\"hr\")\nexport const MotionHtml = /*@__PURE__*/ createMotionComponent(\"html\")\nexport const MotionI = /*@__PURE__*/ createMotionComponent(\"i\")\nexport const MotionIframe = /*@__PURE__*/ createMotionComponent(\"iframe\")\nexport const MotionImg = /*@__PURE__*/ createMotionComponent(\"img\")\nexport const MotionInput = /*@__PURE__*/ createMotionComponent(\"input\")\nexport const MotionIns = /*@__PURE__*/ createMotionComponent(\"ins\")\nexport const MotionKbd = /*@__PURE__*/ createMotionComponent(\"kbd\")\nexport const MotionKeygen = /*@__PURE__*/ createMotionComponent(\"keygen\")\nexport const MotionLabel = /*@__PURE__*/ createMotionComponent(\"label\")\nexport const MotionLegend = /*@__PURE__*/ createMotionComponent(\"legend\")\nexport const MotionLi = /*@__PURE__*/ createMotionComponent(\"li\")\nexport const MotionLink = /*@__PURE__*/ createMotionComponent(\"link\")\nexport const MotionMain = /*@__PURE__*/ createMotionComponent(\"main\")\nexport const MotionMap = /*@__PURE__*/ createMotionComponent(\"map\")\nexport const MotionMark = /*@__PURE__*/ createMotionComponent(\"mark\")\nexport const MotionMenu = /*@__PURE__*/ createMotionComponent(\"menu\")\nexport const MotionMenuitem = /*@__PURE__*/ createMotionComponent(\"menuitem\")\nexport const MotionMeter = /*@__PURE__*/ createMotionComponent(\"meter\")\nexport const MotionNav = /*@__PURE__*/ createMotionComponent(\"nav\")\nexport const MotionObject = /*@__PURE__*/ createMotionComponent(\"object\")\nexport const MotionOl = /*@__PURE__*/ createMotionComponent(\"ol\")\nexport const MotionOptgroup = /*@__PURE__*/ createMotionComponent(\"optgroup\")\nexport const MotionOption = /*@__PURE__*/ createMotionComponent(\"option\")\nexport const MotionOutput = /*@__PURE__*/ createMotionComponent(\"output\")\nexport const MotionP = /*@__PURE__*/ createMotionComponent(\"p\")\nexport const MotionParam = /*@__PURE__*/ createMotionComponent(\"param\")\nexport const MotionPicture = /*@__PURE__*/ createMotionComponent(\"picture\")\nexport const MotionPre = /*@__PURE__*/ createMotionComponent(\"pre\")\nexport const MotionProgress = /*@__PURE__*/ createMotionComponent(\"progress\")\nexport const MotionQ = /*@__PURE__*/ createMotionComponent(\"q\")\nexport const MotionRp = /*@__PURE__*/ createMotionComponent(\"rp\")\nexport const MotionRt = /*@__PURE__*/ createMotionComponent(\"rt\")\nexport const MotionRuby = /*@__PURE__*/ createMotionComponent(\"ruby\")\nexport const MotionS = /*@__PURE__*/ createMotionComponent(\"s\")\nexport const MotionSamp = /*@__PURE__*/ createMotionComponent(\"samp\")\nexport const MotionScript = /*@__PURE__*/ createMotionComponent(\"script\")\nexport const MotionSection = /*@__PURE__*/ createMotionComponent(\"section\")\nexport const MotionSelect = /*@__PURE__*/ createMotionComponent(\"select\")\nexport const MotionSmall = /*@__PURE__*/ createMotionComponent(\"small\")\nexport const MotionSource = /*@__PURE__*/ createMotionComponent(\"source\")\nexport const MotionSpan = /*@__PURE__*/ createMotionComponent(\"span\")\nexport const MotionStrong = /*@__PURE__*/ createMotionComponent(\"strong\")\nexport const MotionStyle = /*@__PURE__*/ createMotionComponent(\"style\")\nexport const MotionSub = /*@__PURE__*/ createMotionComponent(\"sub\")\nexport const MotionSummary = /*@__PURE__*/ createMotionComponent(\"summary\")\nexport const MotionSup = /*@__PURE__*/ createMotionComponent(\"sup\")\nexport const MotionTable = /*@__PURE__*/ createMotionComponent(\"table\")\nexport const MotionTbody = /*@__PURE__*/ createMotionComponent(\"tbody\")\nexport const MotionTd = /*@__PURE__*/ createMotionComponent(\"td\")\nexport const MotionTextarea = /*@__PURE__*/ createMotionComponent(\"textarea\")\nexport const MotionTfoot = /*@__PURE__*/ createMotionComponent(\"tfoot\")\nexport const MotionTh = /*@__PURE__*/ createMotionComponent(\"th\")\nexport const MotionThead = /*@__PURE__*/ createMotionComponent(\"thead\")\nexport const MotionTime = /*@__PURE__*/ createMotionComponent(\"time\")\nexport const MotionTitle = /*@__PURE__*/ createMotionComponent(\"title\")\nexport const MotionTr = /*@__PURE__*/ createMotionComponent(\"tr\")\nexport const MotionTrack = /*@__PURE__*/ createMotionComponent(\"track\")\nexport const MotionU = /*@__PURE__*/ createMotionComponent(\"u\")\nexport const MotionUl = /*@__PURE__*/ createMotionComponent(\"ul\")\nexport const MotionVideo = /*@__PURE__*/ createMotionComponent(\"video\")\nexport const MotionWbr = /*@__PURE__*/ createMotionComponent(\"wbr\")\nexport const MotionWebview = /*@__PURE__*/ createMotionComponent(\"webview\")\n\n/**\n * SVG components\n */\nexport const MotionAnimate = /*@__PURE__*/ createMotionComponent(\"animate\")\nexport const MotionCircle = /*@__PURE__*/ createMotionComponent(\"circle\")\nexport const MotionDefs = /*@__PURE__*/ createMotionComponent(\"defs\")\nexport const MotionDesc = /*@__PURE__*/ createMotionComponent(\"desc\")\nexport const MotionEllipse = /*@__PURE__*/ createMotionComponent(\"ellipse\")\nexport const MotionG = /*@__PURE__*/ createMotionComponent(\"g\")\nexport const MotionImage = /*@__PURE__*/ createMotionComponent(\"image\")\nexport const MotionLine = /*@__PURE__*/ createMotionComponent(\"line\")\nexport const MotionFilter = /*@__PURE__*/ createMotionComponent(\"filter\")\nexport const MotionMarker = /*@__PURE__*/ createMotionComponent(\"marker\")\nexport const MotionMask = /*@__PURE__*/ createMotionComponent(\"mask\")\nexport const MotionMetadata = /*@__PURE__*/ createMotionComponent(\"metadata\")\nexport const MotionPath = /*@__PURE__*/ createMotionComponent(\"path\")\nexport const MotionPattern = /*@__PURE__*/ createMotionComponent(\"pattern\")\nexport const MotionPolygon = /*@__PURE__*/ createMotionComponent(\"polygon\")\nexport const MotionPolyline = /*@__PURE__*/ createMotionComponent(\"polyline\")\nexport const MotionRect = /*@__PURE__*/ createMotionComponent(\"rect\")\nexport const MotionStop = /*@__PURE__*/ createMotionComponent(\"stop\")\nexport const MotionSvg = /*@__PURE__*/ createMotionComponent(\"svg\")\nexport const MotionSymbol = /*@__PURE__*/ createMotionComponent(\"symbol\")\nexport const MotionText = /*@__PURE__*/ createMotionComponent(\"text\")\nexport const MotionTspan = /*@__PURE__*/ createMotionComponent(\"tspan\")\nexport const MotionUse = /*@__PURE__*/ createMotionComponent(\"use\")\nexport const MotionView = /*@__PURE__*/ createMotionComponent(\"view\")\nexport const MotionClipPath = /*@__PURE__*/ createMotionComponent(\"clipPath\")\nexport const MotionFeBlend = /*@__PURE__*/ createMotionComponent(\"feBlend\")\nexport const MotionFeColorMatrix =\n /*@__PURE__*/ createMotionComponent(\"feColorMatrix\")\nexport const MotionFeComponentTransfer = /*@__PURE__*/ createMotionComponent(\n \"feComponentTransfer\"\n)\nexport const MotionFeComposite =\n /*@__PURE__*/ createMotionComponent(\"feComposite\")\nexport const MotionFeConvolveMatrix =\n /*@__PURE__*/ createMotionComponent(\"feConvolveMatrix\")\nexport const MotionFeDiffuseLighting =\n /*@__PURE__*/ createMotionComponent(\"feDiffuseLighting\")\nexport const MotionFeDisplacementMap =\n /*@__PURE__*/ createMotionComponent(\"feDisplacementMap\")\nexport const MotionFeDistantLight =\n /*@__PURE__*/ createMotionComponent(\"feDistantLight\")\nexport const MotionFeDropShadow =\n /*@__PURE__*/ createMotionComponent(\"feDropShadow\")\nexport const MotionFeFlood = /*@__PURE__*/ createMotionComponent(\"feFlood\")\nexport const MotionFeFuncA = /*@__PURE__*/ createMotionComponent(\"feFuncA\")\nexport const MotionFeFuncB = /*@__PURE__*/ createMotionComponent(\"feFuncB\")\nexport const MotionFeFuncG = /*@__PURE__*/ createMotionComponent(\"feFuncG\")\nexport const MotionFeFuncR = /*@__PURE__*/ createMotionComponent(\"feFuncR\")\nexport const MotionFeGaussianBlur =\n /*@__PURE__*/ createMotionComponent(\"feGaussianBlur\")\nexport const MotionFeImage = /*@__PURE__*/ createMotionComponent(\"feImage\")\nexport const MotionFeMerge = /*@__PURE__*/ createMotionComponent(\"feMerge\")\nexport const MotionFeMergeNode =\n /*@__PURE__*/ createMotionComponent(\"feMergeNode\")\nexport const MotionFeMorphology =\n /*@__PURE__*/ createMotionComponent(\"feMorphology\")\nexport const MotionFeOffset = /*@__PURE__*/ createMotionComponent(\"feOffset\")\nexport const MotionFePointLight =\n /*@__PURE__*/ createMotionComponent(\"fePointLight\")\nexport const MotionFeSpecularLighting =\n /*@__PURE__*/ createMotionComponent(\"feSpecularLighting\")\nexport const MotionFeSpotLight =\n /*@__PURE__*/ createMotionComponent(\"feSpotLight\")\nexport const MotionFeTile = /*@__PURE__*/ createMotionComponent(\"feTile\")\nexport const MotionFeTurbulence =\n /*@__PURE__*/ createMotionComponent(\"feTurbulence\")\nexport const MotionForeignObject =\n /*@__PURE__*/ createMotionComponent(\"foreignObject\")\nexport const MotionLinearGradient =\n /*@__PURE__*/ createMotionComponent(\"linearGradient\")\nexport const MotionRadialGradient =\n /*@__PURE__*/ createMotionComponent(\"radialGradient\")\nexport const MotionTextPath = /*@__PURE__*/ createMotionComponent(\"textPath\")\n"],"names":["createMotionComponent","featureBundle","createDomVisualElement"],"mappings":";;;;;;;;;;;AAMM,SAAU,iCAAiC,CAI7C,SAAwD,EACxD,OAAgC,EAAA;IAEhC,OAAOA,2BAAqB,CACxB,SAAS,EACT,OAAO,EACPC,2BAAa,EACbC,oCAA6D,CAChE;AACL;;ACfA;;AAEG;AACI,MAAM,OAAO,iBAAiBF,iCAAqB,CAAC,GAAG;AACvD,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,aAAa,iBAAiBA,iCAAqB,CAAC,SAAS;AACnE,MAAM,UAAU,iBAAiBA,iCAAqB,CAAC,MAAM;AAC7D,MAAM,aAAa,iBAAiBA,iCAAqB,CAAC,SAAS;AACnE,MAAM,WAAW,iBAAiBA,iCAAqB,CAAC,OAAO;AAC/D,MAAM,WAAW,iBAAiBA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AcA,iCAAqB,CAAC,oBAAoB;MAC/C,iBAAiB;AAC1B,cAAcA,iCAAqB,CAAC,aAAa;AAC9C,MAAM,YAAY,iBAAiBA,iCAAqB,CAAC,QAAQ;MAC3D,kBAAkB;AAC3B,cAAcA,iCAAqB,CAAC,cAAc;MACzC,mBAAmB;AAC5B,cAAcA,iCAAqB,CAAC,eAAe;MAC1C,oBAAoB;AAC7B,cAAcA,iCAAqB,CAAC,gBAAgB;MAC3C,oBAAoB;AAC7B,cAAcA,iCAAqB,CAAC,gBAAgB;AACjD,MAAM,cAAc,iBAAiBA,iCAAqB,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
+64
-12
@@ -30,4 +30,4 @@ 'use strict'; | ||
| function calculateRepeatDuration(duration, repeat, _repeatDelay) { | ||
| return duration * (repeat + 1); | ||
| function calculateRepeatDuration(duration, repeat, repeatDelay) { | ||
| return duration * (repeat + 1) + repeatDelay * repeat; | ||
| } | ||
@@ -88,6 +88,10 @@ | ||
| * down to a 0-1 scale. | ||
| * | ||
| * `repeatDelayUnits` is the repeatDelay expressed in units of a single | ||
| * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`. | ||
| */ | ||
| function normalizeTimes(times, repeat) { | ||
| function normalizeTimes(times, repeat, repeatDelayUnits = 0) { | ||
| const totalUnits = repeat + 1 + repeat * repeatDelayUnits; | ||
| for (let i = 0; i < times.length; i++) { | ||
| times[i] = times[i] / (repeat + 1); | ||
| times[i] = times[i] / totalUnits; | ||
| } | ||
@@ -213,7 +217,17 @@ } | ||
| /** | ||
| * Handle repeat options | ||
| * Segments can't express `repeat: Infinity` or very large | ||
| * counts — they'd leave dead time after the segment or | ||
| * explode the keyframe array. Ignore with a warning. | ||
| */ | ||
| if (repeat) { | ||
| motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high"); | ||
| duration = calculateRepeatDuration(duration, repeat); | ||
| motionUtils.warning(repeat < MAX_REPEAT, `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`); | ||
| } | ||
| if (repeat && repeat < MAX_REPEAT) { | ||
| /** | ||
| * Express repeatDelay in units of a single iteration's duration | ||
| * so it can be added to the per-iteration time offsets below | ||
| * before they're normalized to 0-1. | ||
| */ | ||
| const repeatDelayUnits = duration > 0 ? repeatDelay / duration : 0; | ||
| duration = calculateRepeatDuration(duration, repeat, repeatDelay); | ||
| const originalKeyframes = [...valueKeyframesAsList]; | ||
@@ -223,12 +237,50 @@ const originalTimes = [...times]; | ||
| const originalEase = [...ease]; | ||
| /** | ||
| * For reverse/mirror, alternate iterations play the segment | ||
| * backwards. mirror matches JSAnimation's mirroredGenerator: | ||
| * reversed keyframes, easings unchanged. reverse matches | ||
| * JSAnimation's iterationProgress = 1 - p: reversed | ||
| * keyframes, easing array reversed AND each function easing | ||
| * mapped through reverseEasing (string easings unchanged — | ||
| * they're resolved later by the keyframes engine). | ||
| */ | ||
| const isFlipping = repeatType === "reverse" || repeatType === "mirror"; | ||
| let flippedKeyframes = originalKeyframes; | ||
| let flippedEases = originalEase; | ||
| if (isFlipping) { | ||
| flippedKeyframes = [...originalKeyframes].reverse(); | ||
| if (repeatType === "reverse") { | ||
| flippedEases = [...originalEase] | ||
| .reverse() | ||
| .map((e) => typeof e === "function" | ||
| ? motionUtils.reverseEasing(e) | ||
| : e); | ||
| } | ||
| } | ||
| for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) { | ||
| valueKeyframesAsList.push(...originalKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + (repeatIndex + 1)); | ||
| const isFlipped = isFlipping && repeatIndex % 2 === 0; | ||
| const iterKeyframes = isFlipped | ||
| ? flippedKeyframes | ||
| : originalKeyframes; | ||
| const iterEase = isFlipped ? flippedEases : originalEase; | ||
| const iterStartOffset = (repeatIndex + 1) * (1 + repeatDelayUnits); | ||
| /** | ||
| * If repeatDelay is set, hold the previous iteration's | ||
| * final value through the delay by inserting a keyframe | ||
| * at the moment the next iteration begins. | ||
| */ | ||
| if (repeatDelayUnits > 0) { | ||
| valueKeyframesAsList.push(valueKeyframesAsList[valueKeyframesAsList.length - 1]); | ||
| times.push(iterStartOffset); | ||
| ease.push("linear"); | ||
| } | ||
| valueKeyframesAsList.push(...iterKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < iterKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + iterStartOffset); | ||
| ease.push(keyframeIndex === 0 | ||
| ? "linear" | ||
| : motionUtils.getEasingForSegment(originalEase, keyframeIndex - 1)); | ||
| : motionUtils.getEasingForSegment(iterEase, keyframeIndex - 1)); | ||
| } | ||
| } | ||
| normalizeTimes(times, repeat); | ||
| normalizeTimes(times, repeat, repeatDelayUnits); | ||
| } | ||
@@ -235,0 +287,0 @@ const targetTime = startTime + duration; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"dom-mini.js","sources":["../../src/animation/utils/is-dom-keyframes.ts","../../src/animation/animate/resolve-subjects.ts","../../src/animation/sequence/utils/calc-repeat-duration.ts","../../src/animation/sequence/utils/calc-time.ts","../../src/animation/sequence/utils/edit.ts","../../src/animation/sequence/utils/normalize-times.ts","../../src/animation/sequence/utils/sort.ts","../../src/animation/sequence/create.ts","../../src/animation/animators/waapi/animate-elements.ts","../../src/animation/animators/waapi/animate-sequence.ts","../../src/animation/animators/waapi/animate-style.ts"],"sourcesContent":["import { DOMKeyframesDefinition } from \"motion-dom\"\n\nexport function isDOMKeyframes(\n keyframes: unknown\n): keyframes is DOMKeyframesDefinition {\n return typeof keyframes === \"object\" && !Array.isArray(keyframes)\n}\n","import {\n AnimationScope,\n DOMKeyframesDefinition,\n SelectorCache,\n resolveElements,\n} from \"motion-dom\"\nimport { ObjectTarget } from \"../sequence/types\"\nimport { isDOMKeyframes } from \"../utils/is-dom-keyframes\"\n\nexport function resolveSubjects<O extends {}>(\n subject:\n | string\n | Element\n | Element[]\n | NodeListOf<Element>\n | O\n | O[]\n | null\n | undefined,\n keyframes: DOMKeyframesDefinition | ObjectTarget<O>,\n scope?: AnimationScope,\n selectorCache?: SelectorCache\n) {\n if (subject == null) {\n return []\n }\n\n if (typeof subject === \"string\" && isDOMKeyframes(keyframes)) {\n return resolveElements(subject, scope, selectorCache)\n } else if (subject instanceof NodeList) {\n return Array.from(subject)\n } else if (Array.isArray(subject)) {\n return subject.filter((s) => s != null)\n } else {\n return [subject]\n }\n}\n","export function calculateRepeatDuration(\n duration: number,\n repeat: number,\n _repeatDelay: number\n): number {\n return duration * (repeat + 1)\n}\n","import { SequenceTime } from \"../types\"\n\n/**\n * Given a absolute or relative time definition and current/prev time state of the sequence,\n * calculate an absolute time for the next keyframes.\n */\nexport function calcNextTime(\n current: number,\n next: SequenceTime,\n prev: number,\n labels: Map<string, number>\n): number {\n if (typeof next === \"number\") {\n return next\n } else if (next.startsWith(\"-\") || next.startsWith(\"+\")) {\n return Math.max(0, current + parseFloat(next))\n } else if (next === \"<\") {\n return prev\n } else if (next.startsWith(\"<\")) {\n return Math.max(0, prev + parseFloat(next.slice(1)))\n } else {\n return labels.get(next) ?? current\n }\n}\n","import { mixNumber, UnresolvedValueKeyframe } from \"motion-dom\"\nimport { Easing, getEasingForSegment, removeItem } from \"motion-utils\"\nimport type { ValueSequence } from \"../types\"\n\nexport function eraseKeyframes(\n sequence: ValueSequence,\n startTime: number,\n endTime: number\n): void {\n for (let i = 0; i < sequence.length; i++) {\n const keyframe = sequence[i]\n\n if (keyframe.at > startTime && keyframe.at < endTime) {\n removeItem(sequence, keyframe)\n\n // If we remove this item we have to push the pointer back one\n i--\n }\n }\n}\n\nexport function addKeyframes(\n sequence: ValueSequence,\n keyframes: UnresolvedValueKeyframe[],\n easing: Easing | Easing[],\n offset: number[],\n startTime: number,\n endTime: number\n): void {\n /**\n * Erase every existing value between currentTime and targetTime,\n * this will essentially splice this timeline into any currently\n * defined ones.\n */\n eraseKeyframes(sequence, startTime, endTime)\n\n for (let i = 0; i < keyframes.length; i++) {\n sequence.push({\n value: keyframes[i],\n at: mixNumber(startTime, endTime, offset[i]),\n easing: getEasingForSegment(easing, i),\n })\n }\n}\n","/**\n * Take an array of times that represent repeated keyframes. For instance\n * if we have original times of [0, 0.5, 1] then our repeated times will\n * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back\n * down to a 0-1 scale.\n */\nexport function normalizeTimes(times: number[], repeat: number): void {\n for (let i = 0; i < times.length; i++) {\n times[i] = times[i] / (repeat + 1)\n }\n}\n","import { AbsoluteKeyframe } from \"../types\"\n\nexport function compareByTime(\n a: AbsoluteKeyframe,\n b: AbsoluteKeyframe\n): number {\n if (a.at === b.at) {\n if (a.value === null) return 1\n if (b.value === null) return -1\n return 0\n } else {\n return a.at - b.at\n }\n}\n","import {\n AnimationScope,\n createGeneratorEasing,\n defaultOffset,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n fillOffset,\n GeneratorFactory,\n isGenerator,\n isMotionValue,\n Transition,\n UnresolvedValueKeyframe,\n type AnyResolvedKeyframe,\n type MotionValue,\n} from \"motion-dom\"\nimport {\n Easing,\n getEasingForSegment,\n invariant,\n progress,\n secondsToMilliseconds,\n} from \"motion-utils\"\nimport { resolveSubjects } from \"../animate/resolve-subjects\"\nimport {\n AnimationSequence,\n At,\n ResolvedAnimationDefinitions,\n SequenceMap,\n SequenceOptions,\n ValueSequence,\n} from \"./types\"\nimport { calculateRepeatDuration } from \"./utils/calc-repeat-duration\"\nimport { calcNextTime } from \"./utils/calc-time\"\nimport { addKeyframes } from \"./utils/edit\"\nimport { normalizeTimes } from \"./utils/normalize-times\"\nimport { compareByTime } from \"./utils/sort\"\n\nconst defaultSegmentEasing = \"easeInOut\"\n\nconst MAX_REPEAT = 20\n\nexport function createAnimationsFromSequence(\n sequence: AnimationSequence,\n { defaultTransition = {}, ...sequenceTransition }: SequenceOptions = {},\n scope?: AnimationScope,\n generators?: { [key: string]: GeneratorFactory }\n): ResolvedAnimationDefinitions {\n const defaultDuration = defaultTransition.duration || 0.3\n const animationDefinitions: ResolvedAnimationDefinitions = new Map()\n const sequences = new Map<Element | MotionValue, SequenceMap>()\n const elementCache = {}\n const timeLabels = new Map<string, number>()\n\n let prevTime = 0\n let currentTime = 0\n let totalDuration = 0\n\n /**\n * Build the timeline by mapping over the sequence array and converting\n * the definitions into keyframes and offsets with absolute time values.\n * These will later get converted into relative offsets in a second pass.\n */\n for (let i = 0; i < sequence.length; i++) {\n const segment = sequence[i]\n\n /**\n * If this is a timeline label, mark it and skip the rest of this iteration.\n */\n if (typeof segment === \"string\") {\n timeLabels.set(segment, currentTime)\n continue\n } else if (!Array.isArray(segment)) {\n timeLabels.set(\n segment.name,\n calcNextTime(currentTime, segment.at, prevTime, timeLabels)\n )\n continue\n }\n\n let [subject, keyframes, transition = {}] = segment\n\n /**\n * If a relative or absolute time value has been specified we need to resolve\n * it in relation to the currentTime.\n */\n if (transition.at !== undefined) {\n currentTime = calcNextTime(\n currentTime,\n transition.at,\n prevTime,\n timeLabels\n )\n }\n\n /**\n * Keep track of the maximum duration in this definition. This will be\n * applied to currentTime once the definition has been parsed.\n */\n let maxDuration = 0\n\n const resolveValueSequence = (\n valueKeyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[],\n valueTransition: Transition | DynamicAnimationOptions,\n valueSequence: ValueSequence,\n elementIndex = 0,\n numSubjects = 0\n ) => {\n const valueKeyframesAsList = keyframesAsList(valueKeyframes)\n const {\n delay = 0,\n times = defaultOffset(valueKeyframesAsList),\n type = defaultTransition.type || \"keyframes\",\n repeat,\n repeatType,\n repeatDelay = 0,\n ...remainingTransition\n } = valueTransition\n let { ease = defaultTransition.ease || \"easeOut\", duration } =\n valueTransition\n\n /**\n * Resolve stagger() if defined.\n */\n const calculatedDelay =\n typeof delay === \"function\"\n ? delay(elementIndex, numSubjects)\n : delay\n\n /**\n * If this animation should and can use a spring, generate a spring easing function.\n */\n const numKeyframes = valueKeyframesAsList.length\n const createGenerator = isGenerator(type)\n ? type\n : generators?.[type || \"keyframes\"]\n\n if (numKeyframes <= 2 && createGenerator) {\n /**\n * As we're creating an easing function from a spring,\n * ideally we want to generate it using the real distance\n * between the two keyframes. However this isn't always\n * possible - in these situations we use 0-100.\n */\n let absoluteDelta = 100\n if (\n numKeyframes === 2 &&\n isNumberKeyframesArray(valueKeyframesAsList)\n ) {\n const delta =\n valueKeyframesAsList[1] - valueKeyframesAsList[0]\n absoluteDelta = Math.abs(delta)\n }\n\n const springTransition = {\n ...defaultTransition,\n ...remainingTransition,\n }\n if (duration !== undefined) {\n springTransition.duration = secondsToMilliseconds(duration)\n }\n\n const springEasing = createGeneratorEasing(\n springTransition,\n absoluteDelta,\n createGenerator\n )\n\n ease = springEasing.ease\n duration = springEasing.duration\n }\n\n duration ??= defaultDuration\n\n const startTime = currentTime + calculatedDelay\n\n /**\n * If there's only one time offset of 0, fill in a second with length 1\n */\n if (times.length === 1 && times[0] === 0) {\n times[1] = 1\n }\n\n /**\n * Fill out if offset if fewer offsets than keyframes\n */\n const remainder = times.length - valueKeyframesAsList.length\n remainder > 0 && fillOffset(times, remainder)\n\n /**\n * If only one value has been set, ie [1], push a null to the start of\n * the keyframe array. This will let us mark a keyframe at this point\n * that will later be hydrated with the previous value.\n */\n valueKeyframesAsList.length === 1 &&\n valueKeyframesAsList.unshift(null)\n\n /**\n * Handle repeat options\n */\n if (repeat) {\n invariant(\n repeat < MAX_REPEAT,\n \"Repeat count too high, must be less than 20\",\n \"repeat-count-high\"\n )\n\n duration = calculateRepeatDuration(\n duration,\n repeat,\n repeatDelay\n )\n\n const originalKeyframes = [...valueKeyframesAsList]\n const originalTimes = [...times]\n ease = Array.isArray(ease) ? [...ease] : [ease]\n const originalEase = [...ease]\n\n for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {\n valueKeyframesAsList.push(...originalKeyframes)\n\n for (\n let keyframeIndex = 0;\n keyframeIndex < originalKeyframes.length;\n keyframeIndex++\n ) {\n times.push(\n originalTimes[keyframeIndex] + (repeatIndex + 1)\n )\n ease.push(\n keyframeIndex === 0\n ? \"linear\"\n : getEasingForSegment(\n originalEase,\n keyframeIndex - 1\n )\n )\n }\n }\n\n normalizeTimes(times, repeat)\n }\n\n const targetTime = startTime + duration\n\n /**\n * Add keyframes, mapping offsets to absolute time.\n */\n addKeyframes(\n valueSequence,\n valueKeyframesAsList,\n ease as Easing | Easing[],\n times,\n startTime,\n targetTime\n )\n\n maxDuration = Math.max(calculatedDelay + duration, maxDuration)\n totalDuration = Math.max(targetTime, totalDuration)\n }\n\n if (isMotionValue(subject)) {\n const subjectSequence = getSubjectSequence(subject, sequences)\n resolveValueSequence(\n keyframes as AnyResolvedKeyframe,\n transition,\n getValueSequence(\"default\", subjectSequence)\n )\n } else {\n const subjects = resolveSubjects(\n subject,\n keyframes as DOMKeyframesDefinition,\n scope,\n elementCache\n )\n\n const numSubjects = subjects.length\n\n /**\n * For every element in this segment, process the defined values.\n */\n for (\n let subjectIndex = 0;\n subjectIndex < numSubjects;\n subjectIndex++\n ) {\n /**\n * Cast necessary, but we know these are of this type\n */\n keyframes = keyframes as DOMKeyframesDefinition\n transition = transition as DynamicAnimationOptions\n\n const thisSubject = subjects[subjectIndex]\n const subjectSequence = getSubjectSequence(\n thisSubject,\n sequences\n )\n\n for (const key in keyframes) {\n resolveValueSequence(\n keyframes[\n key as keyof typeof keyframes\n ] as UnresolvedValueKeyframe,\n getValueTransition(transition, key),\n getValueSequence(key, subjectSequence),\n subjectIndex,\n numSubjects\n )\n }\n }\n }\n\n prevTime = currentTime\n currentTime += maxDuration\n }\n\n /**\n * For every element and value combination create a new animation.\n */\n sequences.forEach((valueSequences, element) => {\n for (const key in valueSequences) {\n const valueSequence = valueSequences[key]\n\n /**\n * Arrange all the keyframes in ascending time order.\n */\n valueSequence.sort(compareByTime)\n\n const keyframes: UnresolvedValueKeyframe[] = []\n const valueOffset: number[] = []\n const valueEasing: Easing[] = []\n\n /**\n * For each keyframe, translate absolute times into\n * relative offsets based on the total duration of the timeline.\n */\n for (let i = 0; i < valueSequence.length; i++) {\n const { at, value, easing } = valueSequence[i]\n keyframes.push(value)\n valueOffset.push(progress(0, totalDuration, at))\n valueEasing.push(easing || \"easeOut\")\n }\n\n /**\n * If the first keyframe doesn't land on offset: 0\n * provide one by duplicating the initial keyframe. This ensures\n * it snaps to the first keyframe when the animation starts.\n */\n if (valueOffset[0] !== 0) {\n valueOffset.unshift(0)\n keyframes.unshift(keyframes[0])\n valueEasing.unshift(defaultSegmentEasing)\n }\n\n /**\n * If the last keyframe doesn't land on offset: 1\n * provide one with a null wildcard value. This will ensure it\n * stays static until the end of the animation.\n */\n if (valueOffset[valueOffset.length - 1] !== 1) {\n valueOffset.push(1)\n keyframes.push(null)\n }\n\n if (!animationDefinitions.has(element)) {\n animationDefinitions.set(element, {\n keyframes: {},\n transition: {},\n })\n }\n\n const definition = animationDefinitions.get(element)!\n\n definition.keyframes[key] = keyframes\n\n /**\n * Exclude `type` from defaultTransition since springs have been\n * converted to duration-based easing functions in resolveValueSequence.\n * Including `type: \"spring\"` would cause JSAnimation to error when\n * the merged keyframes array has more than 2 keyframes.\n */\n const { type: _type, ...remainingDefaultTransition } =\n defaultTransition\n definition.transition[key] = {\n ...remainingDefaultTransition,\n duration: totalDuration,\n ease: valueEasing,\n times: valueOffset,\n ...sequenceTransition,\n }\n }\n })\n\n return animationDefinitions\n}\n\nfunction getSubjectSequence<O extends {}>(\n subject: Element | MotionValue | O,\n sequences: Map<Element | MotionValue | O, SequenceMap>\n): SequenceMap {\n !sequences.has(subject) && sequences.set(subject, {})\n return sequences.get(subject)!\n}\n\nfunction getValueSequence(name: string, sequences: SequenceMap): ValueSequence {\n if (!sequences[name]) sequences[name] = []\n return sequences[name]\n}\n\nfunction keyframesAsList(\n keyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n): UnresolvedValueKeyframe[] {\n return Array.isArray(keyframes) ? keyframes : [keyframes]\n}\n\nexport function getValueTransition(\n transition: DynamicAnimationOptions & At,\n key: string\n): DynamicAnimationOptions {\n return transition && transition[key as keyof typeof transition]\n ? {\n ...transition,\n ...(transition[key as keyof typeof transition] as Transition),\n }\n : { ...transition }\n}\n\nconst isNumber = (keyframe: unknown) => typeof keyframe === \"number\"\nconst isNumberKeyframesArray = (\n keyframes: UnresolvedValueKeyframe[]\n): keyframes is number[] => keyframes.every(isNumber)\n","import {\n animationMapKey,\n AnimationPlaybackControls,\n AnimationScope,\n applyPxDefaults,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n fillWildcards,\n getAnimationMap,\n getComputedStyle,\n getValueTransition,\n NativeAnimation,\n NativeAnimationOptions,\n resolveElements,\n UnresolvedValueKeyframe,\n ValueKeyframe,\n} from \"motion-dom\"\nimport { invariant, secondsToMilliseconds } from \"motion-utils\"\n\ninterface AnimationDefinition {\n map: Map<string, NativeAnimation<any>>\n key: string\n unresolvedKeyframes: UnresolvedValueKeyframe[]\n options: Omit<NativeAnimationOptions, \"keyframes\"> & {\n keyframes?: ValueKeyframe[]\n }\n}\n\nexport function animateElements(\n elementOrSelector: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions,\n scope?: AnimationScope\n) {\n // Gracefully handle null/undefined elements (e.g., from querySelector returning null)\n if (elementOrSelector == null) {\n return []\n }\n\n const elements = resolveElements(elementOrSelector, scope) as Array<\n HTMLElement | SVGElement\n >\n const numElements = elements.length\n\n invariant(\n Boolean(numElements),\n \"No valid elements provided.\",\n \"no-valid-elements\"\n )\n\n /**\n * WAAPI doesn't support interrupting animations.\n *\n * Therefore, starting animations requires a three-step process:\n * 1. Stop existing animations (write styles to DOM)\n * 2. Resolve keyframes (read styles from DOM)\n * 3. Create new animations (write styles to DOM)\n *\n * The hybrid `animate()` function uses AsyncAnimation to resolve\n * keyframes before creating new animations, which removes style\n * thrashing. Here, we have much stricter filesize constraints.\n * Therefore we do this in a synchronous way that ensures that\n * at least within `animate()` calls there is no style thrashing.\n *\n * In the motion-native-animate-mini-interrupt benchmark this\n * was 80% faster than a single loop.\n */\n const animationDefinitions: AnimationDefinition[] = []\n\n /**\n * Step 1: Build options and stop existing animations (write)\n */\n for (let i = 0; i < numElements; i++) {\n const element = elements[i]\n const elementTransition: DynamicAnimationOptions = { ...options }\n\n /**\n * Resolve stagger function if provided.\n */\n if (typeof elementTransition.delay === \"function\") {\n elementTransition.delay = elementTransition.delay(i, numElements)\n }\n\n for (const valueName in keyframes) {\n let valueKeyframes = keyframes[valueName as keyof typeof keyframes]!\n\n if (!Array.isArray(valueKeyframes)) {\n valueKeyframes = [valueKeyframes]\n }\n\n const valueOptions = {\n ...getValueTransition(elementTransition as any, valueName),\n }\n\n valueOptions.duration &&= secondsToMilliseconds(\n valueOptions.duration\n )\n\n valueOptions.delay &&= secondsToMilliseconds(valueOptions.delay)\n\n /**\n * If there's an existing animation playing on this element then stop it\n * before creating a new one.\n */\n const map = getAnimationMap(element)\n const key = animationMapKey(\n valueName,\n valueOptions.pseudoElement || \"\"\n )\n const currentAnimation = map.get(key)\n currentAnimation && currentAnimation.stop()\n\n animationDefinitions.push({\n map,\n key,\n unresolvedKeyframes: valueKeyframes,\n options: {\n ...valueOptions,\n element,\n name: valueName,\n allowFlatten:\n !elementTransition.type && !elementTransition.ease,\n },\n })\n }\n }\n\n /**\n * Step 2: Resolve keyframes (read)\n */\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { unresolvedKeyframes, options: animationOptions } =\n animationDefinitions[i]\n\n const { element, name, pseudoElement } = animationOptions\n if (!pseudoElement && unresolvedKeyframes[0] === null) {\n unresolvedKeyframes[0] = getComputedStyle(element, name)\n }\n\n fillWildcards(unresolvedKeyframes)\n applyPxDefaults(unresolvedKeyframes, name)\n\n /**\n * If we only have one keyframe, explicitly read the initial keyframe\n * from the computed style. This is to ensure consistency with WAAPI behaviour\n * for restarting animations, for instance .play() after finish, when it\n * has one vs two keyframes.\n */\n if (!pseudoElement && unresolvedKeyframes.length < 2) {\n unresolvedKeyframes.unshift(getComputedStyle(element, name))\n }\n\n animationOptions.keyframes = unresolvedKeyframes as ValueKeyframe[]\n }\n\n /**\n * Step 3: Create new animations (write)\n */\n const animations: AnimationPlaybackControls[] = []\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { map, key, options: animationOptions } = animationDefinitions[i]\n const animation = new NativeAnimation(\n animationOptions as NativeAnimationOptions\n )\n\n map.set(key, animation)\n animation.finished.finally(() => map.delete(key))\n\n animations.push(animation)\n }\n\n return animations\n}\n","import { AnimationPlaybackControls, GroupAnimationWithThen } from \"motion-dom\"\nimport { createAnimationsFromSequence } from \"../../sequence/create\"\nimport { AnimationSequence, SequenceOptions } from \"../../sequence/types\"\nimport { animateElements } from \"./animate-elements\"\n\nexport function animateSequence(\n definition: AnimationSequence,\n options?: SequenceOptions\n) {\n const animations: AnimationPlaybackControls[] = []\n\n createAnimationsFromSequence(definition, options).forEach(\n ({ keyframes, transition }, element: Element) => {\n animations.push(...animateElements(element, keyframes, transition))\n }\n )\n\n return new GroupAnimationWithThen(animations)\n}\n","import {\n AnimationPlaybackControlsWithThen,\n AnimationScope,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n GroupAnimationWithThen,\n} from \"motion-dom\"\nimport { animateElements } from \"./animate-elements\"\n\nexport const createScopedWaapiAnimate = (scope?: AnimationScope) => {\n function scopedAnimate(\n elementOrSelector: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen {\n return new GroupAnimationWithThen(\n animateElements(\n elementOrSelector,\n keyframes as DOMKeyframesDefinition,\n options,\n scope\n )\n )\n }\n\n return scopedAnimate\n}\n\nexport const animateMini = /*@__PURE__*/ createScopedWaapiAnimate()\n"],"names":["resolveElements","removeItem","mixNumber","getEasingForSegment","defaultOffset","isGenerator","secondsToMilliseconds","createGeneratorEasing","fillOffset","invariant","isMotionValue","progress","getValueTransition","getAnimationMap","animationMapKey","getComputedStyle","fillWildcards","applyPxDefaults","NativeAnimation","GroupAnimationWithThen"],"mappings":";;;;;;;AAEM,SAAU,cAAc,CAC1B,SAAkB,EAAA;AAElB,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AACrE;;ACGM,SAAU,eAAe,CAC3B,OAQe,EACf,SAAmD,EACnD,KAAsB,EACtB,aAA6B,EAAA;AAE7B,IAAA,IAAI,OAAO,IAAI,IAAI,EAAE;AACjB,QAAA,OAAO,EAAE;IACb;IAEA,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;QAC1D,OAAOA,yBAAe,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC;IACzD;AAAO,SAAA,IAAI,OAAO,YAAY,QAAQ,EAAE;AACpC,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IAC9B;AAAO,SAAA,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAC/B,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAC3C;SAAO;QACH,OAAO,CAAC,OAAO,CAAC;IACpB;AACJ;;SCpCgB,uBAAuB,CACnC,QAAgB,EAChB,MAAc,EACd,YAAoB,EAAA;AAEpB,IAAA,OAAO,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC;AAClC;;ACJA;;;AAGG;AACG,SAAU,YAAY,CACxB,OAAe,EACf,IAAkB,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AAO,EAAE,gBAAgB,EAAE,GAAG,oBAAoB,CAAC,CAAC,CAAC;AACvE,QAAA,MAAM,SAAS,GAAG,IAAIG,yBAAe,CACjC,gBAA0C,CAC7C;AAED,QAAA,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC;AACvB,QAAA,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAEjD,QAAA,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;IAC9B;AAEA,IAAA,OAAO,UAAU;AACrB;;ACxKM,SAAU,eAAe,CAC3B,UAA6B,EAC7B,OAAyB,EAAA;IAEzB,MAAM,UAAU,GAAgC,EAAE;AAElD,IAAA,4BAA4B,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,OAAO,CACrD,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,OAAgB,KAAI;AAC5C,QAAA,UAAU,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACvE,IAAA,CAAC,CACJ;AAED,IAAA,OAAO,IAAIC,gCAAsB,CAAC,UAAU,CAAC;AACjD;;ACRO,MAAM,wBAAwB,GAAG,CAAC,KAAsB,KAAI;AAC/D,IAAA,SAAS,aAAa,CAClB,iBAAoC,EACpC,SAAiC,EACjC,OAAiC,EAAA;AAEjC,QAAA,OAAO,IAAIA,gCAAsB,CAC7B,eAAe,CACX,iBAAiB,EACjB,SAAmC,EACnC,OAAO,EACP,KAAK,CACR,CACJ;IACL;AAEA,IAAA,OAAO,aAAa;AACxB,CAAC;MAEY,WAAW,iBAAiB,wBAAwB;;;;;"} | ||
| {"version":3,"file":"dom-mini.js","sources":["../../src/animation/utils/is-dom-keyframes.ts","../../src/animation/animate/resolve-subjects.ts","../../src/animation/sequence/utils/calc-repeat-duration.ts","../../src/animation/sequence/utils/calc-time.ts","../../src/animation/sequence/utils/edit.ts","../../src/animation/sequence/utils/normalize-times.ts","../../src/animation/sequence/utils/sort.ts","../../src/animation/sequence/create.ts","../../src/animation/animators/waapi/animate-elements.ts","../../src/animation/animators/waapi/animate-sequence.ts","../../src/animation/animators/waapi/animate-style.ts"],"sourcesContent":["import { DOMKeyframesDefinition } from \"motion-dom\"\n\nexport function isDOMKeyframes(\n keyframes: unknown\n): keyframes is DOMKeyframesDefinition {\n return typeof keyframes === \"object\" && !Array.isArray(keyframes)\n}\n","import {\n AnimationScope,\n DOMKeyframesDefinition,\n SelectorCache,\n resolveElements,\n} from \"motion-dom\"\nimport { ObjectTarget } from \"../sequence/types\"\nimport { isDOMKeyframes } from \"../utils/is-dom-keyframes\"\n\nexport function resolveSubjects<O extends {}>(\n subject:\n | string\n | Element\n | Element[]\n | NodeListOf<Element>\n | O\n | O[]\n | null\n | undefined,\n keyframes: DOMKeyframesDefinition | ObjectTarget<O>,\n scope?: AnimationScope,\n selectorCache?: SelectorCache\n) {\n if (subject == null) {\n return []\n }\n\n if (typeof subject === \"string\" && isDOMKeyframes(keyframes)) {\n return resolveElements(subject, scope, selectorCache)\n } else if (subject instanceof NodeList) {\n return Array.from(subject)\n } else if (Array.isArray(subject)) {\n return subject.filter((s) => s != null)\n } else {\n return [subject]\n }\n}\n","export function calculateRepeatDuration(\n duration: number,\n repeat: number,\n repeatDelay: number\n): number {\n return duration * (repeat + 1) + repeatDelay * repeat\n}\n","import { SequenceTime } from \"../types\"\n\n/**\n * Given a absolute or relative time definition and current/prev time state of the sequence,\n * calculate an absolute time for the next keyframes.\n */\nexport function calcNextTime(\n current: number,\n next: SequenceTime,\n prev: number,\n labels: Map<string, number>\n): number {\n if (typeof next === \"number\") {\n return next\n } else if (next.startsWith(\"-\") || next.startsWith(\"+\")) {\n return Math.max(0, current + parseFloat(next))\n } else if (next === \"<\") {\n return prev\n } else if (next.startsWith(\"<\")) {\n return Math.max(0, prev + parseFloat(next.slice(1)))\n } else {\n return labels.get(next) ?? current\n }\n}\n","import { mixNumber, UnresolvedValueKeyframe } from \"motion-dom\"\nimport { Easing, getEasingForSegment, removeItem } from \"motion-utils\"\nimport type { ValueSequence } from \"../types\"\n\nexport function eraseKeyframes(\n sequence: ValueSequence,\n startTime: number,\n endTime: number\n): void {\n for (let i = 0; i < sequence.length; i++) {\n const keyframe = sequence[i]\n\n if (keyframe.at > startTime && keyframe.at < endTime) {\n removeItem(sequence, keyframe)\n\n // If we remove this item we have to push the pointer back one\n i--\n }\n }\n}\n\nexport function addKeyframes(\n sequence: ValueSequence,\n keyframes: UnresolvedValueKeyframe[],\n easing: Easing | Easing[],\n offset: number[],\n startTime: number,\n endTime: number\n): void {\n /**\n * Erase every existing value between currentTime and targetTime,\n * this will essentially splice this timeline into any currently\n * defined ones.\n */\n eraseKeyframes(sequence, startTime, endTime)\n\n for (let i = 0; i < keyframes.length; i++) {\n sequence.push({\n value: keyframes[i],\n at: mixNumber(startTime, endTime, offset[i]),\n easing: getEasingForSegment(easing, i),\n })\n }\n}\n","/**\n * Take an array of times that represent repeated keyframes. For instance\n * if we have original times of [0, 0.5, 1] then our repeated times will\n * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back\n * down to a 0-1 scale.\n *\n * `repeatDelayUnits` is the repeatDelay expressed in units of a single\n * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`.\n */\nexport function normalizeTimes(\n times: number[],\n repeat: number,\n repeatDelayUnits = 0\n): void {\n const totalUnits = repeat + 1 + repeat * repeatDelayUnits\n for (let i = 0; i < times.length; i++) {\n times[i] = times[i] / totalUnits\n }\n}\n","import { AbsoluteKeyframe } from \"../types\"\n\nexport function compareByTime(\n a: AbsoluteKeyframe,\n b: AbsoluteKeyframe\n): number {\n if (a.at === b.at) {\n if (a.value === null) return 1\n if (b.value === null) return -1\n return 0\n } else {\n return a.at - b.at\n }\n}\n","import {\n AnimationScope,\n createGeneratorEasing,\n defaultOffset,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n fillOffset,\n GeneratorFactory,\n isGenerator,\n isMotionValue,\n Transition,\n UnresolvedValueKeyframe,\n type AnyResolvedKeyframe,\n type MotionValue,\n} from \"motion-dom\"\nimport {\n Easing,\n getEasingForSegment,\n progress,\n reverseEasing,\n secondsToMilliseconds,\n warning,\n} from \"motion-utils\"\nimport { resolveSubjects } from \"../animate/resolve-subjects\"\nimport {\n AnimationSequence,\n At,\n ResolvedAnimationDefinitions,\n SequenceMap,\n SequenceOptions,\n ValueSequence,\n} from \"./types\"\nimport { calculateRepeatDuration } from \"./utils/calc-repeat-duration\"\nimport { calcNextTime } from \"./utils/calc-time\"\nimport { addKeyframes } from \"./utils/edit\"\nimport { normalizeTimes } from \"./utils/normalize-times\"\nimport { compareByTime } from \"./utils/sort\"\n\nconst defaultSegmentEasing = \"easeInOut\"\n\nconst MAX_REPEAT = 20\n\nexport function createAnimationsFromSequence(\n sequence: AnimationSequence,\n { defaultTransition = {}, ...sequenceTransition }: SequenceOptions = {},\n scope?: AnimationScope,\n generators?: { [key: string]: GeneratorFactory }\n): ResolvedAnimationDefinitions {\n const defaultDuration = defaultTransition.duration || 0.3\n const animationDefinitions: ResolvedAnimationDefinitions = new Map()\n const sequences = new Map<Element | MotionValue, SequenceMap>()\n const elementCache = {}\n const timeLabels = new Map<string, number>()\n\n let prevTime = 0\n let currentTime = 0\n let totalDuration = 0\n\n /**\n * Build the timeline by mapping over the sequence array and converting\n * the definitions into keyframes and offsets with absolute time values.\n * These will later get converted into relative offsets in a second pass.\n */\n for (let i = 0; i < sequence.length; i++) {\n const segment = sequence[i]\n\n /**\n * If this is a timeline label, mark it and skip the rest of this iteration.\n */\n if (typeof segment === \"string\") {\n timeLabels.set(segment, currentTime)\n continue\n } else if (!Array.isArray(segment)) {\n timeLabels.set(\n segment.name,\n calcNextTime(currentTime, segment.at, prevTime, timeLabels)\n )\n continue\n }\n\n let [subject, keyframes, transition = {}] = segment\n\n /**\n * If a relative or absolute time value has been specified we need to resolve\n * it in relation to the currentTime.\n */\n if (transition.at !== undefined) {\n currentTime = calcNextTime(\n currentTime,\n transition.at,\n prevTime,\n timeLabels\n )\n }\n\n /**\n * Keep track of the maximum duration in this definition. This will be\n * applied to currentTime once the definition has been parsed.\n */\n let maxDuration = 0\n\n const resolveValueSequence = (\n valueKeyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[],\n valueTransition: Transition | DynamicAnimationOptions,\n valueSequence: ValueSequence,\n elementIndex = 0,\n numSubjects = 0\n ) => {\n const valueKeyframesAsList = keyframesAsList(valueKeyframes)\n const {\n delay = 0,\n times = defaultOffset(valueKeyframesAsList),\n type = defaultTransition.type || \"keyframes\",\n repeat,\n repeatType,\n repeatDelay = 0,\n ...remainingTransition\n } = valueTransition\n let { ease = defaultTransition.ease || \"easeOut\", duration } =\n valueTransition\n\n /**\n * Resolve stagger() if defined.\n */\n const calculatedDelay =\n typeof delay === \"function\"\n ? delay(elementIndex, numSubjects)\n : delay\n\n /**\n * If this animation should and can use a spring, generate a spring easing function.\n */\n const numKeyframes = valueKeyframesAsList.length\n const createGenerator = isGenerator(type)\n ? type\n : generators?.[type || \"keyframes\"]\n\n if (numKeyframes <= 2 && createGenerator) {\n /**\n * As we're creating an easing function from a spring,\n * ideally we want to generate it using the real distance\n * between the two keyframes. However this isn't always\n * possible - in these situations we use 0-100.\n */\n let absoluteDelta = 100\n if (\n numKeyframes === 2 &&\n isNumberKeyframesArray(valueKeyframesAsList)\n ) {\n const delta =\n valueKeyframesAsList[1] - valueKeyframesAsList[0]\n absoluteDelta = Math.abs(delta)\n }\n\n const springTransition = {\n ...defaultTransition,\n ...remainingTransition,\n }\n if (duration !== undefined) {\n springTransition.duration = secondsToMilliseconds(duration)\n }\n\n const springEasing = createGeneratorEasing(\n springTransition,\n absoluteDelta,\n createGenerator\n )\n\n ease = springEasing.ease\n duration = springEasing.duration\n }\n\n duration ??= defaultDuration\n\n const startTime = currentTime + calculatedDelay\n\n /**\n * If there's only one time offset of 0, fill in a second with length 1\n */\n if (times.length === 1 && times[0] === 0) {\n times[1] = 1\n }\n\n /**\n * Fill out if offset if fewer offsets than keyframes\n */\n const remainder = times.length - valueKeyframesAsList.length\n remainder > 0 && fillOffset(times, remainder)\n\n /**\n * If only one value has been set, ie [1], push a null to the start of\n * the keyframe array. This will let us mark a keyframe at this point\n * that will later be hydrated with the previous value.\n */\n valueKeyframesAsList.length === 1 &&\n valueKeyframesAsList.unshift(null)\n\n /**\n * Segments can't express `repeat: Infinity` or very large\n * counts — they'd leave dead time after the segment or\n * explode the keyframe array. Ignore with a warning.\n */\n if (repeat) {\n warning(\n repeat < MAX_REPEAT,\n `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`\n )\n }\n\n if (repeat && repeat < MAX_REPEAT) {\n /**\n * Express repeatDelay in units of a single iteration's duration\n * so it can be added to the per-iteration time offsets below\n * before they're normalized to 0-1.\n */\n const repeatDelayUnits =\n duration > 0 ? repeatDelay / duration : 0\n\n duration = calculateRepeatDuration(\n duration,\n repeat,\n repeatDelay\n )\n\n const originalKeyframes = [...valueKeyframesAsList]\n const originalTimes = [...times]\n ease = Array.isArray(ease) ? [...ease] : [ease]\n const originalEase = [...ease]\n\n /**\n * For reverse/mirror, alternate iterations play the segment\n * backwards. mirror matches JSAnimation's mirroredGenerator:\n * reversed keyframes, easings unchanged. reverse matches\n * JSAnimation's iterationProgress = 1 - p: reversed\n * keyframes, easing array reversed AND each function easing\n * mapped through reverseEasing (string easings unchanged —\n * they're resolved later by the keyframes engine).\n */\n const isFlipping =\n repeatType === \"reverse\" || repeatType === \"mirror\"\n let flippedKeyframes = originalKeyframes\n let flippedEases = originalEase\n if (isFlipping) {\n flippedKeyframes = [...originalKeyframes].reverse()\n if (repeatType === \"reverse\") {\n flippedEases = [...originalEase]\n .reverse()\n .map((e) =>\n typeof e === \"function\"\n ? reverseEasing(e)\n : e\n )\n }\n }\n\n for (\n let repeatIndex = 0;\n repeatIndex < repeat;\n repeatIndex++\n ) {\n const isFlipped = isFlipping && repeatIndex % 2 === 0\n const iterKeyframes = isFlipped\n ? flippedKeyframes\n : originalKeyframes\n const iterEase = isFlipped ? flippedEases : originalEase\n const iterStartOffset =\n (repeatIndex + 1) * (1 + repeatDelayUnits)\n\n /**\n * If repeatDelay is set, hold the previous iteration's\n * final value through the delay by inserting a keyframe\n * at the moment the next iteration begins.\n */\n if (repeatDelayUnits > 0) {\n valueKeyframesAsList.push(\n valueKeyframesAsList[\n valueKeyframesAsList.length - 1\n ]\n )\n times.push(iterStartOffset)\n ease.push(\"linear\")\n }\n\n valueKeyframesAsList.push(...iterKeyframes)\n\n for (\n let keyframeIndex = 0;\n keyframeIndex < iterKeyframes.length;\n keyframeIndex++\n ) {\n times.push(\n originalTimes[keyframeIndex] + iterStartOffset\n )\n ease.push(\n keyframeIndex === 0\n ? \"linear\"\n : getEasingForSegment(\n iterEase,\n keyframeIndex - 1\n )\n )\n }\n }\n\n normalizeTimes(times, repeat, repeatDelayUnits)\n }\n\n const targetTime = startTime + duration\n\n /**\n * Add keyframes, mapping offsets to absolute time.\n */\n addKeyframes(\n valueSequence,\n valueKeyframesAsList,\n ease as Easing | Easing[],\n times,\n startTime,\n targetTime\n )\n\n maxDuration = Math.max(calculatedDelay + duration, maxDuration)\n totalDuration = Math.max(targetTime, totalDuration)\n }\n\n if (isMotionValue(subject)) {\n const subjectSequence = getSubjectSequence(subject, sequences)\n resolveValueSequence(\n keyframes as AnyResolvedKeyframe,\n transition,\n getValueSequence(\"default\", subjectSequence)\n )\n } else {\n const subjects = resolveSubjects(\n subject,\n keyframes as DOMKeyframesDefinition,\n scope,\n elementCache\n )\n\n const numSubjects = subjects.length\n\n /**\n * For every element in this segment, process the defined values.\n */\n for (\n let subjectIndex = 0;\n subjectIndex < numSubjects;\n subjectIndex++\n ) {\n /**\n * Cast necessary, but we know these are of this type\n */\n keyframes = keyframes as DOMKeyframesDefinition\n transition = transition as DynamicAnimationOptions\n\n const thisSubject = subjects[subjectIndex]\n const subjectSequence = getSubjectSequence(\n thisSubject,\n sequences\n )\n\n for (const key in keyframes) {\n resolveValueSequence(\n keyframes[\n key as keyof typeof keyframes\n ] as UnresolvedValueKeyframe,\n getValueTransition(transition, key),\n getValueSequence(key, subjectSequence),\n subjectIndex,\n numSubjects\n )\n }\n }\n }\n\n prevTime = currentTime\n currentTime += maxDuration\n }\n\n /**\n * For every element and value combination create a new animation.\n */\n sequences.forEach((valueSequences, element) => {\n for (const key in valueSequences) {\n const valueSequence = valueSequences[key]\n\n /**\n * Arrange all the keyframes in ascending time order.\n */\n valueSequence.sort(compareByTime)\n\n const keyframes: UnresolvedValueKeyframe[] = []\n const valueOffset: number[] = []\n const valueEasing: Easing[] = []\n\n /**\n * For each keyframe, translate absolute times into\n * relative offsets based on the total duration of the timeline.\n */\n for (let i = 0; i < valueSequence.length; i++) {\n const { at, value, easing } = valueSequence[i]\n keyframes.push(value)\n valueOffset.push(progress(0, totalDuration, at))\n valueEasing.push(easing || \"easeOut\")\n }\n\n /**\n * If the first keyframe doesn't land on offset: 0\n * provide one by duplicating the initial keyframe. This ensures\n * it snaps to the first keyframe when the animation starts.\n */\n if (valueOffset[0] !== 0) {\n valueOffset.unshift(0)\n keyframes.unshift(keyframes[0])\n valueEasing.unshift(defaultSegmentEasing)\n }\n\n /**\n * If the last keyframe doesn't land on offset: 1\n * provide one with a null wildcard value. This will ensure it\n * stays static until the end of the animation.\n */\n if (valueOffset[valueOffset.length - 1] !== 1) {\n valueOffset.push(1)\n keyframes.push(null)\n }\n\n if (!animationDefinitions.has(element)) {\n animationDefinitions.set(element, {\n keyframes: {},\n transition: {},\n })\n }\n\n const definition = animationDefinitions.get(element)!\n\n definition.keyframes[key] = keyframes\n\n /**\n * Exclude `type` from defaultTransition since springs have been\n * converted to duration-based easing functions in resolveValueSequence.\n * Including `type: \"spring\"` would cause JSAnimation to error when\n * the merged keyframes array has more than 2 keyframes.\n */\n const { type: _type, ...remainingDefaultTransition } =\n defaultTransition\n definition.transition[key] = {\n ...remainingDefaultTransition,\n duration: totalDuration,\n ease: valueEasing,\n times: valueOffset,\n ...sequenceTransition,\n }\n }\n })\n\n return animationDefinitions\n}\n\nfunction getSubjectSequence<O extends {}>(\n subject: Element | MotionValue | O,\n sequences: Map<Element | MotionValue | O, SequenceMap>\n): SequenceMap {\n !sequences.has(subject) && sequences.set(subject, {})\n return sequences.get(subject)!\n}\n\nfunction getValueSequence(name: string, sequences: SequenceMap): ValueSequence {\n if (!sequences[name]) sequences[name] = []\n return sequences[name]\n}\n\nfunction keyframesAsList(\n keyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n): UnresolvedValueKeyframe[] {\n return Array.isArray(keyframes) ? keyframes : [keyframes]\n}\n\nexport function getValueTransition(\n transition: DynamicAnimationOptions & At,\n key: string\n): DynamicAnimationOptions {\n return transition && transition[key as keyof typeof transition]\n ? {\n ...transition,\n ...(transition[key as keyof typeof transition] as Transition),\n }\n : { ...transition }\n}\n\nconst isNumber = (keyframe: unknown) => typeof keyframe === \"number\"\nconst isNumberKeyframesArray = (\n keyframes: UnresolvedValueKeyframe[]\n): keyframes is number[] => keyframes.every(isNumber)\n","import {\n animationMapKey,\n AnimationPlaybackControls,\n AnimationScope,\n applyPxDefaults,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n fillWildcards,\n getAnimationMap,\n getComputedStyle,\n getValueTransition,\n NativeAnimation,\n NativeAnimationOptions,\n resolveElements,\n UnresolvedValueKeyframe,\n ValueKeyframe,\n} from \"motion-dom\"\nimport { invariant, secondsToMilliseconds } from \"motion-utils\"\n\ninterface AnimationDefinition {\n map: Map<string, NativeAnimation<any>>\n key: string\n unresolvedKeyframes: UnresolvedValueKeyframe[]\n options: Omit<NativeAnimationOptions, \"keyframes\"> & {\n keyframes?: ValueKeyframe[]\n }\n}\n\nexport function animateElements(\n elementOrSelector: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions,\n scope?: AnimationScope\n) {\n // Gracefully handle null/undefined elements (e.g., from querySelector returning null)\n if (elementOrSelector == null) {\n return []\n }\n\n const elements = resolveElements(elementOrSelector, scope) as Array<\n HTMLElement | SVGElement\n >\n const numElements = elements.length\n\n invariant(\n Boolean(numElements),\n \"No valid elements provided.\",\n \"no-valid-elements\"\n )\n\n /**\n * WAAPI doesn't support interrupting animations.\n *\n * Therefore, starting animations requires a three-step process:\n * 1. Stop existing animations (write styles to DOM)\n * 2. Resolve keyframes (read styles from DOM)\n * 3. Create new animations (write styles to DOM)\n *\n * The hybrid `animate()` function uses AsyncAnimation to resolve\n * keyframes before creating new animations, which removes style\n * thrashing. Here, we have much stricter filesize constraints.\n * Therefore we do this in a synchronous way that ensures that\n * at least within `animate()` calls there is no style thrashing.\n *\n * In the motion-native-animate-mini-interrupt benchmark this\n * was 80% faster than a single loop.\n */\n const animationDefinitions: AnimationDefinition[] = []\n\n /**\n * Step 1: Build options and stop existing animations (write)\n */\n for (let i = 0; i < numElements; i++) {\n const element = elements[i]\n const elementTransition: DynamicAnimationOptions = { ...options }\n\n /**\n * Resolve stagger function if provided.\n */\n if (typeof elementTransition.delay === \"function\") {\n elementTransition.delay = elementTransition.delay(i, numElements)\n }\n\n for (const valueName in keyframes) {\n let valueKeyframes = keyframes[valueName as keyof typeof keyframes]!\n\n if (!Array.isArray(valueKeyframes)) {\n valueKeyframes = [valueKeyframes]\n }\n\n const valueOptions = {\n ...getValueTransition(elementTransition as any, valueName),\n }\n\n valueOptions.duration &&= secondsToMilliseconds(\n valueOptions.duration\n )\n\n valueOptions.delay &&= secondsToMilliseconds(valueOptions.delay)\n\n /**\n * If there's an existing animation playing on this element then stop it\n * before creating a new one.\n */\n const map = getAnimationMap(element)\n const key = animationMapKey(\n valueName,\n valueOptions.pseudoElement || \"\"\n )\n const currentAnimation = map.get(key)\n currentAnimation && currentAnimation.stop()\n\n animationDefinitions.push({\n map,\n key,\n unresolvedKeyframes: valueKeyframes,\n options: {\n ...valueOptions,\n element,\n name: valueName,\n allowFlatten:\n !elementTransition.type && !elementTransition.ease,\n },\n })\n }\n }\n\n /**\n * Step 2: Resolve keyframes (read)\n */\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { unresolvedKeyframes, options: animationOptions } =\n animationDefinitions[i]\n\n const { element, name, pseudoElement } = animationOptions\n if (!pseudoElement && unresolvedKeyframes[0] === null) {\n unresolvedKeyframes[0] = getComputedStyle(element, name)\n }\n\n fillWildcards(unresolvedKeyframes)\n applyPxDefaults(unresolvedKeyframes, name)\n\n /**\n * If we only have one keyframe, explicitly read the initial keyframe\n * from the computed style. This is to ensure consistency with WAAPI behaviour\n * for restarting animations, for instance .play() after finish, when it\n * has one vs two keyframes.\n */\n if (!pseudoElement && unresolvedKeyframes.length < 2) {\n unresolvedKeyframes.unshift(getComputedStyle(element, name))\n }\n\n animationOptions.keyframes = unresolvedKeyframes as ValueKeyframe[]\n }\n\n /**\n * Step 3: Create new animations (write)\n */\n const animations: AnimationPlaybackControls[] = []\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { map, key, options: animationOptions } = animationDefinitions[i]\n const animation = new NativeAnimation(\n animationOptions as NativeAnimationOptions\n )\n\n map.set(key, animation)\n animation.finished.finally(() => map.delete(key))\n\n animations.push(animation)\n }\n\n return animations\n}\n","import { AnimationPlaybackControls, GroupAnimationWithThen } from \"motion-dom\"\nimport { createAnimationsFromSequence } from \"../../sequence/create\"\nimport { AnimationSequence, SequenceOptions } from \"../../sequence/types\"\nimport { animateElements } from \"./animate-elements\"\n\nexport function animateSequence(\n definition: AnimationSequence,\n options?: SequenceOptions\n) {\n const animations: AnimationPlaybackControls[] = []\n\n createAnimationsFromSequence(definition, options).forEach(\n ({ keyframes, transition }, element: Element) => {\n animations.push(...animateElements(element, keyframes, transition))\n }\n )\n\n return new GroupAnimationWithThen(animations)\n}\n","import {\n AnimationPlaybackControlsWithThen,\n AnimationScope,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n GroupAnimationWithThen,\n} from \"motion-dom\"\nimport { animateElements } from \"./animate-elements\"\n\nexport const createScopedWaapiAnimate = (scope?: AnimationScope) => {\n function scopedAnimate(\n elementOrSelector: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen {\n return new GroupAnimationWithThen(\n animateElements(\n elementOrSelector,\n keyframes as DOMKeyframesDefinition,\n options,\n scope\n )\n )\n }\n\n return scopedAnimate\n}\n\nexport const animateMini = /*@__PURE__*/ createScopedWaapiAnimate()\n"],"names":["resolveElements","removeItem","mixNumber","getEasingForSegment","defaultOffset","isGenerator","secondsToMilliseconds","createGeneratorEasing","fillOffset","warning","reverseEasing","isMotionValue","progress","invariant","getValueTransition","getAnimationMap","animationMapKey","getComputedStyle","fillWildcards","applyPxDefaults","NativeAnimation","GroupAnimationWithThen"],"mappings":";;;;;;;AAEM,SAAU,cAAc,CAC1B,SAAkB,EAAA;AAElB,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AACrE;;ACGM,SAAU,eAAe,CAC3B,OAQe,EACf,SAAmD,EACnD,KAAsB,EACtB,aAA6B,EAAA;AAE7B,IAAA,IAAI,OAAO,IAAI,IAAI,EAAE;AACjB,QAAA,OAAO,EAAE;IACb;IAEA,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,cAAc,CAAC,SAAS,CAAC,EAAE;QAC1D,OAAOA,yBAAe,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC;IACzD;AAAO,SAAA,IAAI,OAAO,YAAY,QAAQ,EAAE;AACpC,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IAC9B;AAAO,SAAA,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;AAC/B,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC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,OAAO,IAAIA,gCAAsB,CAC7B,eAAe,CACX,iBAAiB,EACjB,SAAmC,EACnC,OAAO,EACP,KAAK,CACR,CACJ;IACL;AAEA,IAAA,OAAO,aAAa;AACxB,CAAC;MAEY,WAAW,iBAAiB,wBAAwB;;;;;"} |
+89
-22
@@ -30,4 +30,4 @@ 'use strict'; | ||
| function calculateRepeatDuration(duration, repeat, _repeatDelay) { | ||
| return duration * (repeat + 1); | ||
| function calculateRepeatDuration(duration, repeat, repeatDelay) { | ||
| return duration * (repeat + 1) + repeatDelay * repeat; | ||
| } | ||
@@ -88,6 +88,10 @@ | ||
| * down to a 0-1 scale. | ||
| * | ||
| * `repeatDelayUnits` is the repeatDelay expressed in units of a single | ||
| * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`. | ||
| */ | ||
| function normalizeTimes(times, repeat) { | ||
| function normalizeTimes(times, repeat, repeatDelayUnits = 0) { | ||
| const totalUnits = repeat + 1 + repeat * repeatDelayUnits; | ||
| for (let i = 0; i < times.length; i++) { | ||
| times[i] = times[i] / (repeat + 1); | ||
| times[i] = times[i] / totalUnits; | ||
| } | ||
@@ -213,7 +217,17 @@ } | ||
| /** | ||
| * Handle repeat options | ||
| * Segments can't express `repeat: Infinity` or very large | ||
| * counts — they'd leave dead time after the segment or | ||
| * explode the keyframe array. Ignore with a warning. | ||
| */ | ||
| if (repeat) { | ||
| motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high"); | ||
| duration = calculateRepeatDuration(duration, repeat); | ||
| motionUtils.warning(repeat < MAX_REPEAT, `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`); | ||
| } | ||
| if (repeat && repeat < MAX_REPEAT) { | ||
| /** | ||
| * Express repeatDelay in units of a single iteration's duration | ||
| * so it can be added to the per-iteration time offsets below | ||
| * before they're normalized to 0-1. | ||
| */ | ||
| const repeatDelayUnits = duration > 0 ? repeatDelay / duration : 0; | ||
| duration = calculateRepeatDuration(duration, repeat, repeatDelay); | ||
| const originalKeyframes = [...valueKeyframesAsList]; | ||
@@ -223,12 +237,50 @@ const originalTimes = [...times]; | ||
| const originalEase = [...ease]; | ||
| /** | ||
| * For reverse/mirror, alternate iterations play the segment | ||
| * backwards. mirror matches JSAnimation's mirroredGenerator: | ||
| * reversed keyframes, easings unchanged. reverse matches | ||
| * JSAnimation's iterationProgress = 1 - p: reversed | ||
| * keyframes, easing array reversed AND each function easing | ||
| * mapped through reverseEasing (string easings unchanged — | ||
| * they're resolved later by the keyframes engine). | ||
| */ | ||
| const isFlipping = repeatType === "reverse" || repeatType === "mirror"; | ||
| let flippedKeyframes = originalKeyframes; | ||
| let flippedEases = originalEase; | ||
| if (isFlipping) { | ||
| flippedKeyframes = [...originalKeyframes].reverse(); | ||
| if (repeatType === "reverse") { | ||
| flippedEases = [...originalEase] | ||
| .reverse() | ||
| .map((e) => typeof e === "function" | ||
| ? motionUtils.reverseEasing(e) | ||
| : e); | ||
| } | ||
| } | ||
| for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) { | ||
| valueKeyframesAsList.push(...originalKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + (repeatIndex + 1)); | ||
| const isFlipped = isFlipping && repeatIndex % 2 === 0; | ||
| const iterKeyframes = isFlipped | ||
| ? flippedKeyframes | ||
| : originalKeyframes; | ||
| const iterEase = isFlipped ? flippedEases : originalEase; | ||
| const iterStartOffset = (repeatIndex + 1) * (1 + repeatDelayUnits); | ||
| /** | ||
| * If repeatDelay is set, hold the previous iteration's | ||
| * final value through the delay by inserting a keyframe | ||
| * at the moment the next iteration begins. | ||
| */ | ||
| if (repeatDelayUnits > 0) { | ||
| valueKeyframesAsList.push(valueKeyframesAsList[valueKeyframesAsList.length - 1]); | ||
| times.push(iterStartOffset); | ||
| ease.push("linear"); | ||
| } | ||
| valueKeyframesAsList.push(...iterKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < iterKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + iterStartOffset); | ||
| ease.push(keyframeIndex === 0 | ||
| ? "linear" | ||
| : motionUtils.getEasingForSegment(originalEase, keyframeIndex - 1)); | ||
| : motionUtils.getEasingForSegment(iterEase, keyframeIndex - 1)); | ||
| } | ||
| } | ||
| normalizeTimes(times, repeat); | ||
| normalizeTimes(times, repeat, repeatDelayUnits); | ||
| } | ||
@@ -481,3 +533,3 @@ const targetTime = startTime + duration; | ||
| function createScopedAnimate(options = {}) { | ||
| const { scope, reduceMotion } = options; | ||
| const { scope, reduceMotion, skipAnimations } = options; | ||
| /** | ||
@@ -489,2 +541,7 @@ * Implementation | ||
| let animationOnComplete; | ||
| const inherited = {}; | ||
| if (reduceMotion !== undefined) | ||
| inherited.reduceMotion = reduceMotion; | ||
| if (skipAnimations !== undefined) | ||
| inherited.skipAnimations = skipAnimations; | ||
| if (isSequence(subjectOrSequence)) { | ||
@@ -495,5 +552,3 @@ const { onComplete, ...sequenceOptions } = optionsOrKeyframes || {}; | ||
| } | ||
| animations = animateSequence(subjectOrSequence, reduceMotion !== undefined | ||
| ? { reduceMotion, ...sequenceOptions } | ||
| : sequenceOptions, scope); | ||
| animations = animateSequence(subjectOrSequence, { ...inherited, ...sequenceOptions }, scope); | ||
| } | ||
@@ -506,5 +561,3 @@ else { | ||
| } | ||
| animations = animateSubject(subjectOrSequence, optionsOrKeyframes, (reduceMotion !== undefined | ||
| ? { reduceMotion, ...rest } | ||
| : rest), scope); | ||
| animations = animateSubject(subjectOrSequence, optionsOrKeyframes, { ...inherited, ...rest }, scope); | ||
| } | ||
@@ -911,6 +964,12 @@ const animation = new motionDom.GroupAnimationWithThen(animations); | ||
| * In development mode ensure scroll containers aren't position: static as this makes | ||
| * it difficult to measure their relative positions. | ||
| * it difficult to measure their relative positions. The document scrolling element | ||
| * is exempt: offsetParent measurements naturally resolve relative to the document. | ||
| */ | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (container && target && target !== container) { | ||
| if (container && | ||
| target && | ||
| target !== container && | ||
| container !== document.documentElement && | ||
| container !== document.scrollingElement && | ||
| container !== document.body) { | ||
| motionUtils.warnOnce(getComputedStyle(container).position !== "static", "Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly."); | ||
@@ -1198,2 +1257,10 @@ } | ||
| /** | ||
| * Currently, we only support element tracking with `scrollInfo`, though in | ||
| * the future we can also offer ViewTimeline support. | ||
| */ | ||
| function isElementTracking(options) { | ||
| return options && (options.target || options.offset); | ||
| } | ||
| /** | ||
| * If the onScroll function has two arguments, it's expecting | ||
@@ -1206,3 +1273,3 @@ * more specific information about the scroll from scrollInfo. | ||
| function attachToFunction(onScroll, options) { | ||
| if (isOnScrollWithInfo(onScroll)) { | ||
| if (isOnScrollWithInfo(onScroll) || isElementTracking(options)) { | ||
| return scrollInfo((info) => { | ||
@@ -1209,0 +1276,0 @@ onScroll(info[options.axis].progress, info); |
+5
-762
@@ -5,767 +5,10 @@ 'use strict'; | ||
| var jsxRuntime = require('react/jsx-runtime'); | ||
| var index = require('./index-6W16WHlG.js'); | ||
| require('react/jsx-runtime'); | ||
| require('motion-utils'); | ||
| var react = require('react'); | ||
| var motionDom = require('motion-dom'); | ||
| require('react'); | ||
| require('motion-dom'); | ||
| const LayoutGroupContext = react.createContext({}); | ||
| const LazyContext = react.createContext({ strict: false }); | ||
| /** | ||
| * @public | ||
| */ | ||
| const MotionConfigContext = react.createContext({ | ||
| transformPagePoint: (p) => p, | ||
| isStatic: false, | ||
| reducedMotion: "never", | ||
| }); | ||
| const MotionContext = /* @__PURE__ */ react.createContext({}); | ||
| function getCurrentTreeVariants(props, context) { | ||
| if (motionDom.isControllingVariants(props)) { | ||
| const { initial, animate } = props; | ||
| return { | ||
| initial: initial === false || motionDom.isVariantLabel(initial) | ||
| ? initial | ||
| : undefined, | ||
| animate: motionDom.isVariantLabel(animate) ? animate : undefined, | ||
| }; | ||
| } | ||
| return props.inherit !== false ? context : {}; | ||
| } | ||
| function useCreateMotionContext(props) { | ||
| const { initial, animate } = getCurrentTreeVariants(props, react.useContext(MotionContext)); | ||
| return react.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]); | ||
| } | ||
| function variantLabelsAsDependency(prop) { | ||
| return Array.isArray(prop) ? prop.join(" ") : prop; | ||
| } | ||
| const createHtmlRenderState = () => ({ | ||
| style: {}, | ||
| transform: {}, | ||
| transformOrigin: {}, | ||
| vars: {}, | ||
| }); | ||
| function copyRawValuesOnly(target, source, props) { | ||
| for (const key in source) { | ||
| if (!motionDom.isMotionValue(source[key]) && !motionDom.isForcedMotionValue(key, props)) { | ||
| target[key] = source[key]; | ||
| } | ||
| } | ||
| } | ||
| function useInitialMotionValues({ transformTemplate }, visualState) { | ||
| return react.useMemo(() => { | ||
| const state = createHtmlRenderState(); | ||
| motionDom.buildHTMLStyles(state, visualState, transformTemplate); | ||
| return Object.assign({}, state.vars, state.style); | ||
| }, [visualState]); | ||
| } | ||
| function useStyle(props, visualState) { | ||
| const styleProp = props.style || {}; | ||
| const style = {}; | ||
| /** | ||
| * Copy non-Motion Values straight into style | ||
| */ | ||
| copyRawValuesOnly(style, styleProp, props); | ||
| Object.assign(style, useInitialMotionValues(props, visualState)); | ||
| return style; | ||
| } | ||
| function useHTMLProps(props, visualState) { | ||
| // The `any` isn't ideal but it is the type of createElement props argument | ||
| const htmlProps = {}; | ||
| const style = useStyle(props, visualState); | ||
| if (props.drag && props.dragListener !== false) { | ||
| // Disable the ghost element when a user drags | ||
| htmlProps.draggable = false; | ||
| // Disable text selection | ||
| style.userSelect = | ||
| style.WebkitUserSelect = | ||
| style.WebkitTouchCallout = | ||
| "none"; | ||
| // Disable scrolling on the draggable direction | ||
| style.touchAction = | ||
| props.drag === true | ||
| ? "none" | ||
| : `pan-${props.drag === "x" ? "y" : "x"}`; | ||
| } | ||
| if (props.tabIndex === undefined && | ||
| (props.onTap || props.onTapStart || props.whileTap)) { | ||
| htmlProps.tabIndex = 0; | ||
| } | ||
| htmlProps.style = style; | ||
| return htmlProps; | ||
| } | ||
| const createSvgRenderState = () => ({ | ||
| ...createHtmlRenderState(), | ||
| attrs: {}, | ||
| }); | ||
| function useSVGProps(props, visualState, _isStatic, Component) { | ||
| const visualProps = react.useMemo(() => { | ||
| const state = createSvgRenderState(); | ||
| motionDom.buildSVGAttrs(state, visualState, motionDom.isSVGTag(Component), props.transformTemplate, props.style); | ||
| return { | ||
| ...state.attrs, | ||
| style: { ...state.style }, | ||
| }; | ||
| }, [visualState]); | ||
| if (props.style) { | ||
| const rawStyles = {}; | ||
| copyRawValuesOnly(rawStyles, props.style, props); | ||
| visualProps.style = { ...rawStyles, ...visualProps.style }; | ||
| } | ||
| return visualProps; | ||
| } | ||
| /** | ||
| * A list of all valid MotionProps. | ||
| * | ||
| * @privateRemarks | ||
| * This doesn't throw if a `MotionProp` name is missing - it should. | ||
| */ | ||
| const validMotionProps = new Set([ | ||
| "animate", | ||
| "exit", | ||
| "variants", | ||
| "initial", | ||
| "style", | ||
| "values", | ||
| "variants", | ||
| "transition", | ||
| "transformTemplate", | ||
| "custom", | ||
| "inherit", | ||
| "onBeforeLayoutMeasure", | ||
| "onAnimationStart", | ||
| "onAnimationComplete", | ||
| "onUpdate", | ||
| "onDragStart", | ||
| "onDrag", | ||
| "onDragEnd", | ||
| "onMeasureDragConstraints", | ||
| "onDirectionLock", | ||
| "onDragTransitionEnd", | ||
| "_dragX", | ||
| "_dragY", | ||
| "onHoverStart", | ||
| "onHoverEnd", | ||
| "onViewportEnter", | ||
| "onViewportLeave", | ||
| "globalTapTarget", | ||
| "propagate", | ||
| "ignoreStrict", | ||
| "viewport", | ||
| ]); | ||
| /** | ||
| * Check whether a prop name is a valid `MotionProp` key. | ||
| * | ||
| * @param key - Name of the property to check | ||
| * @returns `true` is key is a valid `MotionProp`. | ||
| * | ||
| * @public | ||
| */ | ||
| function isValidMotionProp(key) { | ||
| return (key.startsWith("while") || | ||
| (key.startsWith("drag") && key !== "draggable") || | ||
| key.startsWith("layout") || | ||
| key.startsWith("onTap") || | ||
| key.startsWith("onPan") || | ||
| key.startsWith("onLayout") || | ||
| validMotionProps.has(key)); | ||
| } | ||
| let shouldForward = (key) => !isValidMotionProp(key); | ||
| function loadExternalIsValidProp(isValidProp) { | ||
| if (typeof isValidProp !== "function") | ||
| return; | ||
| // Explicitly filter our events | ||
| shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key); | ||
| } | ||
| /** | ||
| * Emotion and Styled Components both allow users to pass through arbitrary props to their components | ||
| * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which | ||
| * of these should be passed to the underlying DOM node. | ||
| * | ||
| * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props | ||
| * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props | ||
| * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of | ||
| * `@emotion/is-prop-valid`, however to fix this problem we need to use it. | ||
| * | ||
| * By making it an optionalDependency we can offer this functionality only in the situations where it's | ||
| * actually required. | ||
| */ | ||
| try { | ||
| /** | ||
| * We attempt to import this package but require won't be defined in esm environments, in that case | ||
| * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed | ||
| * in favour of explicit injection. | ||
| * | ||
| * String concatenation prevents bundlers like webpack (e.g. Storybook) | ||
| * from statically resolving this optional dependency at build time. | ||
| */ | ||
| const emotionPkg = "@emotion/is-prop-" + "valid"; | ||
| loadExternalIsValidProp(require(emotionPkg).default); | ||
| } | ||
| catch { | ||
| // We don't need to actually do anything here - the fallback is the existing `isPropValid`. | ||
| } | ||
| function filterProps(props, isDom, forwardMotionProps) { | ||
| const filteredProps = {}; | ||
| for (const key in props) { | ||
| /** | ||
| * values is considered a valid prop by Emotion, so if it's present | ||
| * this will be rendered out to the DOM unless explicitly filtered. | ||
| * | ||
| * We check the type as it could be used with the `feColorMatrix` | ||
| * element, which we support. | ||
| */ | ||
| if (key === "values" && typeof props.values === "object") | ||
| continue; | ||
| if (motionDom.isMotionValue(props[key])) | ||
| continue; | ||
| if (shouldForward(key) || | ||
| (forwardMotionProps === true && isValidMotionProp(key)) || | ||
| (!isDom && !isValidMotionProp(key)) || | ||
| // If trying to use native HTML drag events, forward drag listeners | ||
| (props["draggable"] && | ||
| key.startsWith("onDrag"))) { | ||
| filteredProps[key] = | ||
| props[key]; | ||
| } | ||
| } | ||
| return filteredProps; | ||
| } | ||
| /** | ||
| * We keep these listed separately as we use the lowercase tag names as part | ||
| * of the runtime bundle to detect SVG components | ||
| */ | ||
| const lowercaseSVGElements = [ | ||
| "animate", | ||
| "circle", | ||
| "defs", | ||
| "desc", | ||
| "ellipse", | ||
| "g", | ||
| "image", | ||
| "line", | ||
| "filter", | ||
| "marker", | ||
| "mask", | ||
| "metadata", | ||
| "path", | ||
| "pattern", | ||
| "polygon", | ||
| "polyline", | ||
| "rect", | ||
| "stop", | ||
| "switch", | ||
| "symbol", | ||
| "svg", | ||
| "text", | ||
| "tspan", | ||
| "use", | ||
| "view", | ||
| ]; | ||
| function isSVGComponent(Component) { | ||
| if ( | ||
| /** | ||
| * If it's not a string, it's a custom React component. Currently we only support | ||
| * HTML custom React components. | ||
| */ | ||
| typeof Component !== "string" || | ||
| /** | ||
| * If it contains a dash, the element is a custom HTML webcomponent. | ||
| */ | ||
| Component.includes("-")) { | ||
| return false; | ||
| } | ||
| else if ( | ||
| /** | ||
| * If it's in our list of lowercase SVG tags, it's an SVG component | ||
| */ | ||
| lowercaseSVGElements.indexOf(Component) > -1 || | ||
| /** | ||
| * If it contains a capital letter, it's an SVG component | ||
| */ | ||
| /[A-Z]/u.test(Component)) { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| function useRender(Component, props, ref, { latestValues, }, isStatic, forwardMotionProps = false, isSVG) { | ||
| const useVisualProps = (isSVG ?? isSVGComponent(Component)) ? useSVGProps : useHTMLProps; | ||
| const visualProps = useVisualProps(props, latestValues, isStatic, Component); | ||
| const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps); | ||
| const elementProps = Component !== react.Fragment ? { ...filteredProps, ...visualProps, ref } : {}; | ||
| /** | ||
| * If component has been handed a motion value as its child, | ||
| * memoise its initial value and render that. Subsequent updates | ||
| * will be handled by the onChange handler | ||
| */ | ||
| const { children } = props; | ||
| const renderedChildren = react.useMemo(() => (motionDom.isMotionValue(children) ? children.get() : children), [children]); | ||
| return react.createElement(Component, { | ||
| ...elementProps, | ||
| children: renderedChildren, | ||
| }); | ||
| } | ||
| /** | ||
| * @public | ||
| */ | ||
| const PresenceContext = | ||
| /* @__PURE__ */ react.createContext(null); | ||
| /** | ||
| * Creates a constant value over the lifecycle of a component. | ||
| * | ||
| * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer | ||
| * a guarantee that it won't re-run for performance reasons later on. By using `useConstant` | ||
| * you can ensure that initialisers don't execute twice or more. | ||
| */ | ||
| function useConstant(init) { | ||
| const ref = react.useRef(null); | ||
| if (ref.current === null) { | ||
| ref.current = init(); | ||
| } | ||
| return ref.current; | ||
| } | ||
| function makeState({ scrapeMotionValuesFromProps, createRenderState, }, props, context, presenceContext) { | ||
| const state = { | ||
| latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps), | ||
| renderState: createRenderState(), | ||
| }; | ||
| return state; | ||
| } | ||
| function makeLatestValues(props, context, presenceContext, scrapeMotionValues) { | ||
| const values = {}; | ||
| const motionValues = scrapeMotionValues(props, {}); | ||
| for (const key in motionValues) { | ||
| values[key] = motionDom.resolveMotionValue(motionValues[key]); | ||
| } | ||
| let { initial, animate } = props; | ||
| const isControllingVariants = motionDom.isControllingVariants(props); | ||
| const isVariantNode = motionDom.isVariantNode(props); | ||
| if (context && | ||
| isVariantNode && | ||
| !isControllingVariants && | ||
| props.inherit !== false) { | ||
| if (initial === undefined) | ||
| initial = context.initial; | ||
| if (animate === undefined) | ||
| animate = context.animate; | ||
| } | ||
| let isInitialAnimationBlocked = presenceContext | ||
| ? presenceContext.initial === false | ||
| : false; | ||
| isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false; | ||
| const variantToSet = isInitialAnimationBlocked ? animate : initial; | ||
| if (variantToSet && | ||
| typeof variantToSet !== "boolean" && | ||
| !motionDom.isAnimationControls(variantToSet)) { | ||
| const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]; | ||
| for (let i = 0; i < list.length; i++) { | ||
| const resolved = motionDom.resolveVariantFromProps(props, list[i]); | ||
| if (resolved) { | ||
| const { transitionEnd, transition, ...target } = resolved; | ||
| for (const key in target) { | ||
| let valueTarget = target[key]; | ||
| if (Array.isArray(valueTarget)) { | ||
| /** | ||
| * Take final keyframe if the initial animation is blocked because | ||
| * we want to initialise at the end of that blocked animation. | ||
| */ | ||
| const index = isInitialAnimationBlocked | ||
| ? valueTarget.length - 1 | ||
| : 0; | ||
| valueTarget = valueTarget[index]; | ||
| } | ||
| if (valueTarget !== null) { | ||
| values[key] = valueTarget; | ||
| } | ||
| } | ||
| for (const key in transitionEnd) { | ||
| values[key] = transitionEnd[key]; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return values; | ||
| } | ||
| const makeUseVisualState = (config) => (props, isStatic) => { | ||
| const context = react.useContext(MotionContext); | ||
| const presenceContext = react.useContext(PresenceContext); | ||
| const make = () => makeState(config, props, context, presenceContext); | ||
| return isStatic ? make() : useConstant(make); | ||
| }; | ||
| const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({ | ||
| scrapeMotionValuesFromProps: motionDom.scrapeHTMLMotionValuesFromProps, | ||
| createRenderState: createHtmlRenderState, | ||
| }); | ||
| const useSVGVisualState = /*@__PURE__*/ makeUseVisualState({ | ||
| scrapeMotionValuesFromProps: motionDom.scrapeSVGMotionValuesFromProps, | ||
| createRenderState: createSvgRenderState, | ||
| }); | ||
| const featureProps = { | ||
| animation: [ | ||
| "animate", | ||
| "variants", | ||
| "whileHover", | ||
| "whileTap", | ||
| "exit", | ||
| "whileInView", | ||
| "whileFocus", | ||
| "whileDrag", | ||
| ], | ||
| exit: ["exit"], | ||
| drag: ["drag", "dragControls"], | ||
| focus: ["whileFocus"], | ||
| hover: ["whileHover", "onHoverStart", "onHoverEnd"], | ||
| tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"], | ||
| pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"], | ||
| inView: ["whileInView", "onViewportEnter", "onViewportLeave"], | ||
| layout: ["layout", "layoutId"], | ||
| }; | ||
| let isInitialized = false; | ||
| /** | ||
| * Initialize feature definitions with isEnabled checks. | ||
| * This must be called before any motion components are rendered. | ||
| */ | ||
| function initFeatureDefinitions() { | ||
| if (isInitialized) | ||
| return; | ||
| const initialFeatureDefinitions = {}; | ||
| for (const key in featureProps) { | ||
| initialFeatureDefinitions[key] = { | ||
| isEnabled: (props) => featureProps[key].some((name) => !!props[name]), | ||
| }; | ||
| } | ||
| motionDom.setFeatureDefinitions(initialFeatureDefinitions); | ||
| isInitialized = true; | ||
| } | ||
| /** | ||
| * Get the current feature definitions, initializing if needed. | ||
| */ | ||
| function getInitializedFeatureDefinitions() { | ||
| initFeatureDefinitions(); | ||
| return motionDom.getFeatureDefinitions(); | ||
| } | ||
| const motionComponentSymbol = Symbol.for("motionComponentSymbol"); | ||
| /** | ||
| * Creates a ref function that, when called, hydrates the provided | ||
| * external ref and VisualElement. | ||
| */ | ||
| function useMotionRef(visualState, visualElement, externalRef) { | ||
| /** | ||
| * Store externalRef in a ref to avoid including it in the useCallback | ||
| * dependency array. Including externalRef in dependencies causes issues | ||
| * with libraries like Radix UI that create new callback refs on each render | ||
| * when using asChild - this would cause the callback to be recreated, | ||
| * triggering element remounts and breaking AnimatePresence exit animations. | ||
| */ | ||
| const externalRefContainer = react.useRef(externalRef); | ||
| react.useInsertionEffect(() => { | ||
| externalRefContainer.current = externalRef; | ||
| }); | ||
| // Store cleanup function returned by callback refs (React 19 feature) | ||
| const refCleanup = react.useRef(null); | ||
| return react.useCallback((instance) => { | ||
| if (instance) { | ||
| visualState.onMount?.(instance); | ||
| } | ||
| const ref = externalRefContainer.current; | ||
| if (typeof ref === "function") { | ||
| if (instance) { | ||
| const cleanup = ref(instance); | ||
| if (typeof cleanup === "function") { | ||
| refCleanup.current = cleanup; | ||
| } | ||
| } | ||
| else if (refCleanup.current) { | ||
| refCleanup.current(); | ||
| refCleanup.current = null; | ||
| } | ||
| else { | ||
| ref(instance); | ||
| } | ||
| } | ||
| else if (ref) { | ||
| ref.current = instance; | ||
| } | ||
| if (visualElement) { | ||
| instance ? visualElement.mount(instance) : visualElement.unmount(); | ||
| } | ||
| }, [visualElement]); | ||
| } | ||
| /** | ||
| * Internal, exported only for usage in Framer | ||
| */ | ||
| const SwitchLayoutGroupContext = react.createContext({}); | ||
| function isRefObject(ref) { | ||
| return (ref && | ||
| typeof ref === "object" && | ||
| Object.prototype.hasOwnProperty.call(ref, "current")); | ||
| } | ||
| const isBrowser = typeof window !== "undefined"; | ||
| const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect; | ||
| function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) { | ||
| const { visualElement: parent } = react.useContext(MotionContext); | ||
| const lazyContext = react.useContext(LazyContext); | ||
| const presenceContext = react.useContext(PresenceContext); | ||
| const motionConfig = react.useContext(MotionConfigContext); | ||
| const reducedMotionConfig = motionConfig.reducedMotion; | ||
| const skipAnimations = motionConfig.skipAnimations; | ||
| const visualElementRef = react.useRef(null); | ||
| /** | ||
| * Track whether the component has been through React's commit phase. | ||
| * Used to detect when LazyMotion features load after the component has mounted. | ||
| */ | ||
| const hasMountedOnce = react.useRef(false); | ||
| /** | ||
| * If we haven't preloaded a renderer, check to see if we have one lazy-loaded | ||
| */ | ||
| createVisualElement = | ||
| createVisualElement || | ||
| lazyContext.renderer; | ||
| if (!visualElementRef.current && createVisualElement) { | ||
| visualElementRef.current = createVisualElement(Component, { | ||
| visualState, | ||
| parent, | ||
| props, | ||
| presenceContext, | ||
| blockInitialAnimation: presenceContext | ||
| ? presenceContext.initial === false | ||
| : false, | ||
| reducedMotionConfig, | ||
| skipAnimations, | ||
| isSVG, | ||
| }); | ||
| /** | ||
| * If the component has already mounted before features loaded (e.g. via | ||
| * LazyMotion with async feature loading), we need to force the initial | ||
| * animation to run. Otherwise state changes that occurred before features | ||
| * loaded will be lost and the element will snap to its final state. | ||
| */ | ||
| if (hasMountedOnce.current && visualElementRef.current) { | ||
| visualElementRef.current.manuallyAnimateOnMount = true; | ||
| } | ||
| } | ||
| const visualElement = visualElementRef.current; | ||
| /** | ||
| * Load Motion gesture and animation features. These are rendered as renderless | ||
| * components so each feature can optionally make use of React lifecycle methods. | ||
| */ | ||
| const initialLayoutGroupConfig = react.useContext(SwitchLayoutGroupContext); | ||
| if (visualElement && | ||
| !visualElement.projection && | ||
| ProjectionNodeConstructor && | ||
| (visualElement.type === "html" || visualElement.type === "svg")) { | ||
| createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig); | ||
| } | ||
| const isMounted = react.useRef(false); | ||
| react.useInsertionEffect(() => { | ||
| /** | ||
| * Check the component has already mounted before calling | ||
| * `update` unnecessarily. This ensures we skip the initial update. | ||
| */ | ||
| if (visualElement && isMounted.current) { | ||
| visualElement.update(props, presenceContext); | ||
| } | ||
| }); | ||
| /** | ||
| * Cache this value as we want to know whether HandoffAppearAnimations | ||
| * was present on initial render - it will be deleted after this. | ||
| */ | ||
| const optimisedAppearId = props[motionDom.optimizedAppearDataAttribute]; | ||
| const wantsHandoff = react.useRef(Boolean(optimisedAppearId) && | ||
| typeof window !== "undefined" && | ||
| !window.MotionHandoffIsComplete?.(optimisedAppearId) && | ||
| window.MotionHasOptimisedAnimation?.(optimisedAppearId)); | ||
| useIsomorphicLayoutEffect(() => { | ||
| /** | ||
| * Track that this component has mounted. This is used to detect when | ||
| * LazyMotion features load after the component has already committed. | ||
| */ | ||
| hasMountedOnce.current = true; | ||
| if (!visualElement) | ||
| return; | ||
| isMounted.current = true; | ||
| window.MotionIsMounted = true; | ||
| visualElement.updateFeatures(); | ||
| visualElement.scheduleRenderMicrotask(); | ||
| /** | ||
| * Ideally this function would always run in a useEffect. | ||
| * | ||
| * However, if we have optimised appear animations to handoff from, | ||
| * it needs to happen synchronously to ensure there's no flash of | ||
| * incorrect styles in the event of a hydration error. | ||
| * | ||
| * So if we detect a situtation where optimised appear animations | ||
| * are running, we use useLayoutEffect to trigger animations. | ||
| */ | ||
| if (wantsHandoff.current && visualElement.animationState) { | ||
| visualElement.animationState.animateChanges(); | ||
| } | ||
| }); | ||
| react.useEffect(() => { | ||
| if (!visualElement) | ||
| return; | ||
| if (!wantsHandoff.current && visualElement.animationState) { | ||
| visualElement.animationState.animateChanges(); | ||
| } | ||
| if (wantsHandoff.current) { | ||
| // This ensures all future calls to animateChanges() in this component will run in useEffect | ||
| queueMicrotask(() => { | ||
| window.MotionHandoffMarkAsComplete?.(optimisedAppearId); | ||
| }); | ||
| wantsHandoff.current = false; | ||
| } | ||
| /** | ||
| * Now we've finished triggering animations for this element we | ||
| * can wipe the enteringChildren set for the next render. | ||
| */ | ||
| visualElement.enteringChildren = undefined; | ||
| }); | ||
| return visualElement; | ||
| } | ||
| function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) { | ||
| const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutAnchor, layoutCrossfade, } = props; | ||
| visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] | ||
| ? undefined | ||
| : getClosestProjectingNode(visualElement.parent)); | ||
| visualElement.projection.setOptions({ | ||
| layoutId, | ||
| layout, | ||
| alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)), | ||
| visualElement, | ||
| /** | ||
| * TODO: Update options in an effect. This could be tricky as it'll be too late | ||
| * to update by the time layout animations run. | ||
| * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, | ||
| * ensuring it gets called if there's no potential layout animations. | ||
| * | ||
| */ | ||
| animationType: typeof layout === "string" ? layout : "both", | ||
| initialPromotionConfig, | ||
| crossfade: layoutCrossfade, | ||
| layoutScroll, | ||
| layoutRoot, | ||
| layoutAnchor, | ||
| }); | ||
| } | ||
| function getClosestProjectingNode(visualElement) { | ||
| if (!visualElement) | ||
| return undefined; | ||
| return visualElement.options.allowProjection !== false | ||
| ? visualElement.projection | ||
| : getClosestProjectingNode(visualElement.parent); | ||
| } | ||
| /** | ||
| * Create a `motion` component. | ||
| * | ||
| * This function accepts a Component argument, which can be either a string (ie "div" | ||
| * for `motion.div`), or an actual React component. | ||
| * | ||
| * Alongside this is a config option which provides a way of rendering the provided | ||
| * component "offline", or outside the React render cycle. | ||
| */ | ||
| function createMotionComponent(Component, { forwardMotionProps = false, type } = {}, preloadedFeatures, createVisualElement) { | ||
| /** | ||
| * Determine whether to use SVG or HTML rendering based on: | ||
| * 1. Explicit `type` option (highest priority) | ||
| * 2. Auto-detection via `isSVGComponent` | ||
| */ | ||
| const isSVG = type ? type === "svg" : isSVGComponent(Component); | ||
| const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState; | ||
| function MotionDOMComponent(props, externalRef) { | ||
| /** | ||
| * If we need to measure the element we load this functionality in a | ||
| * separate class component in order to gain access to getSnapshotBeforeUpdate. | ||
| */ | ||
| let MeasureLayout; | ||
| const configAndProps = { | ||
| ...react.useContext(MotionConfigContext), | ||
| ...props, | ||
| layoutId: useLayoutId(props), | ||
| }; | ||
| const { isStatic } = configAndProps; | ||
| const context = useCreateMotionContext(props); | ||
| const visualState = useVisualState(props, isStatic); | ||
| if (!isStatic && typeof window !== "undefined") { | ||
| useStrictMode(configAndProps, preloadedFeatures); | ||
| const layoutProjection = getProjectionFunctionality(configAndProps); | ||
| MeasureLayout = layoutProjection.MeasureLayout; | ||
| /** | ||
| * Create a VisualElement for this component. A VisualElement provides a common | ||
| * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as | ||
| * providing a way of rendering to these APIs outside of the React render loop | ||
| * for more performant animations and interactions | ||
| */ | ||
| context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG); | ||
| } | ||
| /** | ||
| * The mount order and hierarchy is specific to ensure our element ref | ||
| * is hydrated by the time features fire their effects. | ||
| */ | ||
| return (jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsxRuntime.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG)] })); | ||
| } | ||
| MotionDOMComponent.displayName = `motion.${typeof Component === "string" | ||
| ? Component | ||
| : `create(${Component.displayName ?? Component.name ?? ""})`}`; | ||
| const ForwardRefMotionComponent = react.forwardRef(MotionDOMComponent); | ||
| ForwardRefMotionComponent[motionComponentSymbol] = Component; | ||
| return ForwardRefMotionComponent; | ||
| } | ||
| function useLayoutId({ layoutId }) { | ||
| const layoutGroupId = react.useContext(LayoutGroupContext).id; | ||
| return layoutGroupId && layoutId !== undefined | ||
| ? layoutGroupId + "-" + layoutId | ||
| : layoutId; | ||
| } | ||
| function useStrictMode(configAndProps, preloadedFeatures) { | ||
| react.useContext(LazyContext).strict; | ||
| /** | ||
| * If we're in development mode, check to make sure we're not rendering a motion component | ||
| * as a child of LazyMotion, as this will break the file-size benefits of using it. | ||
| */ | ||
| if (process.env.NODE_ENV !== "production" && | ||
| preloadedFeatures) ; | ||
| } | ||
| function getProjectionFunctionality(props) { | ||
| const featureDefinitions = getInitializedFeatureDefinitions(); | ||
| const { drag, layout } = featureDefinitions; | ||
| if (!drag && !layout) | ||
| return {}; | ||
| const combined = { ...drag, ...layout }; | ||
| return { | ||
| MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props) | ||
| ? combined.MeasureLayout | ||
| : undefined, | ||
| ProjectionNode: combined.ProjectionNode, | ||
| }; | ||
| } | ||
| function createMinimalMotionComponent(Component, options) { | ||
| return createMotionComponent(Component, options); | ||
| return index.createMotionComponent(Component, options); | ||
| } | ||
@@ -772,0 +15,0 @@ |
@@ -61,2 +61,3 @@ import { UnresolvedValueKeyframe, AnimationOptions, MotionValue, Transition, ElementOrSelector, DOMKeyframesDefinition, AnimationPlaybackOptions, GroupAnimationWithThen, AnimationPlaybackControlsWithThen } from 'motion-dom'; | ||
| reduceMotion?: boolean; | ||
| skipAnimations?: boolean; | ||
| onComplete?: () => void; | ||
@@ -63,0 +64,0 @@ } |
+1
-1
@@ -1,1 +0,1 @@ | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,function(t){"use strict";function e(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}let n=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(n=(t,e,n)=>{if(!t)throw new Error(function(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}(e,n))});const i=t=>t,s=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i},o=t=>1e3*t,a=t=>t/1e3;function r(t,e){return n=t,Array.isArray(n)&&"number"!=typeof n[0]?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t;var n}const l=(t,e,n)=>t+(e-t)*n,u=2e4;function h(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(function(t){let e=0,n=t.next(e);for(;!n.done&&e<u;)e+=50,n=t.next(e);return e>=u?1/0:e}(i),u);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:a(s)}}function c(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const o=s(0,e,i);t.push(l(n,1,o))}}function f(t){const e=[0];return c(e,t.length-1),e}const d=t=>null!==t;class m{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function p(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const g=t=>t.startsWith("--");const y={};function A(t,e){const n=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return()=>y[e]??n()}const T=A(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),b=A(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),v=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,k={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:v([0,.65,.55,1]),circOut:v([.55,0,1,.45]),backIn:v([.31,.01,.66,-.59]),backOut:v([.33,1.53,.69,.99])};function S(t,e){return t?"function"==typeof t?b()?((t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`})(t,e):"ease-out":(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?v(t):Array.isArray(t)?t.map(t=>S(t,e)||k.easeOut):k[t]:void 0}function E(t){return"function"==typeof t&&"applyToOptions"in t}class w extends m{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:i,keyframes:s,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:r,onComplete:l}=t;this.isPseudoElement=Boolean(o),this.allowFlatten=a,this.options=t,n("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=function({type:t,...e}){return E(t)&&b()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=function(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:a="loop",ease:r="easeOut",times:l}={},u){const h={[e]:n};l&&(h.offset=l);const c=S(r,s);Array.isArray(c)&&(h.easing=c);const f={delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===a?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(h,f)}(e,i,s,u,o),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const t=function(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(d),a=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return a&&void 0!==i?i:o[a]}(s,this.options,r,this.speed);this.updateMotionValue&&this.updateMotionValue(t),function(t,e,n){g(e)?t.style.setProperty(e,n):t.style[e]=n}(e,i,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return a(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+a(t)}get time(){return a(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=o(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:n,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&T()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),i):s(this)}}class M{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return B(this.animations,"duration")}get iterationDuration(){return B(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function B(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t[i][e];null!==s&&s>n&&(n=s)}return n}class x extends M{then(t,e){return this.finished.finally(t).then(()=>{})}}const I=new WeakMap,O=(t,e="")=>`${t}:${e}`;function R(t){let e=I.get(t);return e||(e=new Map,I.set(t,e)),e}function F(t,e){const n=t?.[e]??t?.default??t;return n!==t?function(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}(n,t):n}const W=t=>Boolean(t&&t.getVelocity),P=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function $(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&P.has(e)&&(t[n]=t[n]+"px")}function N(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}function V(t,e){const n=window.getComputedStyle(t);return g(e)?n.getPropertyValue(e):n[e]}function L(t,e,n,i){return null==t?[]:"string"==typeof t&&function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?N(t,0,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function D(t,e,n){return t*(e+1)}function C(t,e,n,i){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):i.get(e)??t}function K(t,n,i,s,o,a){!function(t,n,i){for(let s=0;s<t.length;s++){const o=t[s];o.at>n&&o.at<i&&(e(t,o),s--)}}(t,o,a);for(let e=0;e<n.length;e++)t.push({value:n[e],at:l(o,a,s[e]),easing:r(i,e)})}function _(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function j(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function q(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function z(t,e){return e[t]||(e[t]=[]),e[t]}function H(t){return Array.isArray(t)?t:[t]}function X(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const Y=t=>"number"==typeof t,G=t=>t.every(Y);function J(t,e,i,s){if(null==t)return[];const a=N(t),r=a.length;n(Boolean(r),"No valid elements provided.","no-valid-elements");const l=[];for(let t=0;t<r;t++){const n=a[t],s={...i};"function"==typeof s.delay&&(s.delay=s.delay(t,r));for(const t in e){let i=e[t];Array.isArray(i)||(i=[i]);const a={...F(s,t)};a.duration&&(a.duration=o(a.duration)),a.delay&&(a.delay=o(a.delay));const r=R(n),u=O(t,a.pseudoElement||""),h=r.get(u);h&&h.stop(),l.push({map:r,key:u,unresolvedKeyframes:i,options:{...a,element:n,name:t,allowFlatten:!s.type&&!s.ease}})}}for(let t=0;t<l.length;t++){const{unresolvedKeyframes:e,options:n}=l[t],{element:i,name:s,pseudoElement:o}=n;o||null!==e[0]||(e[0]=V(i,s)),p(e),$(e,s),!o&&e.length<2&&e.unshift(V(i,s)),n.keyframes=e}const u=[];for(let t=0;t<l.length;t++){const{map:e,key:n,options:i}=l[t],s=new w(i);e.set(n,s),s.finished.finally(()=>e.delete(n)),u.push(s)}return u}const Q=(()=>function(t,e,n){return new x(J(t,e,n))})();t.animate=Q,t.animateSequence=function(t,e){const i=[];return function(t,{defaultTransition:e={},...i}={},a,l){const u=e.duration||.3,d=new Map,m=new Map,p={},g=new Map;let y=0,A=0,T=0;for(let i=0;i<t.length;i++){const s=t[i];if("string"==typeof s){g.set(s,A);continue}if(!Array.isArray(s)){g.set(s.name,C(A,s.at,y,g));continue}let[a,d,b={}]=s;void 0!==b.at&&(A=C(A,b.at,y,g));let v=0;const k=(t,i,s,a=0,d=0)=>{const m=H(t),{delay:p=0,times:g=f(m),type:y=e.type||"keyframes",repeat:b,repeatType:k,repeatDelay:S=0,...w}=i;let{ease:M=e.ease||"easeOut",duration:B}=i;const x="function"==typeof p?p(a,d):p,I=m.length,O=E(y)?y:l?.[y||"keyframes"];if(I<=2&&O){let t=100;if(2===I&&G(m)){const e=m[1]-m[0];t=Math.abs(e)}const n={...e,...w};void 0!==B&&(n.duration=o(B));const i=h(n,t,O);M=i.ease,B=i.duration}B??(B=u);const R=A+x;1===g.length&&0===g[0]&&(g[1]=1);const F=g.length-m.length;if(F>0&&c(g,F),1===m.length&&m.unshift(null),b){n(b<20,"Repeat count too high, must be less than 20","repeat-count-high"),B=D(B,b);const t=[...m],e=[...g];M=Array.isArray(M)?[...M]:[M];const i=[...M];for(let n=0;n<b;n++){m.push(...t);for(let s=0;s<t.length;s++)g.push(e[s]+(n+1)),M.push(0===s?"linear":r(i,s-1))}_(g,b)}const W=R+B;K(s,m,M,g,R,W),v=Math.max(x+B,v),T=Math.max(W,T)};if(W(a))k(d,b,z("default",q(a,m)));else{const t=L(a,d,0,p),e=t.length;for(let n=0;n<e;n++){const i=q(t[n],m);for(const t in d)k(d[t],X(b,t),z(t,i),n,e)}}y=A,A+=v}return m.forEach((t,n)=>{for(const o in t){const a=t[o];a.sort(j);const r=[],l=[],u=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:i}=a[t];r.push(n),l.push(s(0,T,e)),u.push(i||"easeOut")}0!==l[0]&&(l.unshift(0),r.unshift(r[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),r.push(null)),d.has(n)||d.set(n,{keyframes:{},transition:{}});const h=d.get(n);h.keyframes[o]=r;const{type:c,...f}=e;h.transition[o]={...f,duration:T,ease:u,times:l,...i}}}),d}(t,e).forEach(({keyframes:t,transition:e},n)=>{i.push(...J(n,t,e))}),new x(i)}}); | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,function(t){"use strict";function e(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function n(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let i=()=>{},s=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(i=(t,e,i)=>{t||"undefined"==typeof console||console.warn(n(e,i))},s=(t,e,i)=>{if(!t)throw new Error(n(e,i))});const o=t=>t,a=(t,e,n)=>{const i=e-t;return i?(n-t)/i:1},r=t=>1e3*t,l=t=>t/1e3;function u(t,e){return n=t,Array.isArray(n)&&"number"!=typeof n[0]?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t;var n}const h=(t,e,n)=>t+(e-t)*n,c=2e4;function f(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(function(t){let e=0,n=t.next(e);for(;!n.done&&e<c;)e+=50,n=t.next(e);return e>=c?1/0:e}(i),c);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:l(s)}}function d(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=a(0,e,i);t.push(h(n,1,s))}}function m(t){const e=[0];return d(e,t.length-1),e}const p=t=>null!==t;class g{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}function y(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const A=t=>t.startsWith("--");const T={};function b(t,e){const n=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return()=>T[e]??n()}const v=b(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),S=b(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),k=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,E={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:k([0,.65,.55,1]),circOut:k([.55,0,1,.45]),backIn:k([.31,.01,.66,-.59]),backOut:k([.33,1.53,.69,.99])};function w(t,e){return t?"function"==typeof t?S()?((t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`})(t,e):"ease-out":(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?k(t):Array.isArray(t)?t.map(t=>w(t,e)||E.easeOut):E[t]:void 0}function M(t){return"function"==typeof t&&"applyToOptions"in t}class B extends g{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:o,allowFlatten:a=!1,finalKeyframe:r,onComplete:l}=t;this.isPseudoElement=Boolean(o),this.allowFlatten=a,this.options=t,s("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=function({type:t,...e}){return M(t)&&S()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=function(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:a="loop",ease:r="easeOut",times:l}={},u){const h={[e]:n};l&&(h.offset=l);const c=w(r,s);Array.isArray(c)&&(h.easing=c);const f={delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===a?"alternate":"normal"};return u&&(f.pseudoElement=u),t.animate(h,f)}(e,n,i,u,o),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const t=function(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(p),a=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return a&&void 0!==i?i:o[a]}(i,this.options,r,this.speed);this.updateMotionValue&&this.updateMotionValue(t),function(t,e,n){A(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return l(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+l(t)}get time(){return l(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=r(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:n,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&v()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),o):i(this)}}class x{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return I(this.animations,"duration")}get iterationDuration(){return I(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function I(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t[i][e];null!==s&&s>n&&(n=s)}return n}class O extends x{then(t,e){return this.finished.finally(t).then(()=>{})}}const F=new WeakMap,R=(t,e="")=>`${t}:${e}`;function W(t){let e=F.get(t);return e||(e=new Map,F.set(t,e)),e}function $(t,e){const n=t?.[e]??t?.default??t;return n!==t?function(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}(n,t):n}const P=t=>Boolean(t&&t.getVelocity),N=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","fontSize","backgroundPositionX","backgroundPositionY"]);function V(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&N.has(e)&&(t[n]=t[n]+"px")}function L(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}function D(t,e){const n=window.getComputedStyle(t);return A(e)?n.getPropertyValue(e):n[e]}function q(t,e,n,i){return null==t?[]:"string"==typeof t&&function(t){return"object"==typeof t&&!Array.isArray(t)}(e)?L(t,0,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function C(t,e,n){return t*(e+1)+n*e}function K(t,e,n,i){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):i.get(e)??t}function _(t,n,i,s,o,a){!function(t,n,i){for(let s=0;s<t.length;s++){const o=t[s];o.at>n&&o.at<i&&(e(t,o),s--)}}(t,o,a);for(let e=0;e<n.length;e++)t.push({value:n[e],at:h(o,a,s[e]),easing:u(i,e)})}function j(t,e,n=0){const i=e+1+e*n;for(let e=0;e<t.length;e++)t[e]=t[e]/i}function z(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function H(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function U(t,e){return e[t]||(e[t]=[]),e[t]}function X(t){return Array.isArray(t)?t:[t]}function Y(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const G=t=>"number"==typeof t,J=t=>t.every(G);function Q(t,e,n,i){if(null==t)return[];const o=L(t),a=o.length;s(Boolean(a),"No valid elements provided.","no-valid-elements");const l=[];for(let t=0;t<a;t++){const i=o[t],s={...n};"function"==typeof s.delay&&(s.delay=s.delay(t,a));for(const t in e){let n=e[t];Array.isArray(n)||(n=[n]);const o={...$(s,t)};o.duration&&(o.duration=r(o.duration)),o.delay&&(o.delay=r(o.delay));const a=W(i),u=R(t,o.pseudoElement||""),h=a.get(u);h&&h.stop(),l.push({map:a,key:u,unresolvedKeyframes:n,options:{...o,element:i,name:t,allowFlatten:!s.type&&!s.ease}})}}for(let t=0;t<l.length;t++){const{unresolvedKeyframes:e,options:n}=l[t],{element:i,name:s,pseudoElement:o}=n;o||null!==e[0]||(e[0]=D(i,s)),y(e),V(e,s),!o&&e.length<2&&e.unshift(D(i,s)),n.keyframes=e}const u=[];for(let t=0;t<l.length;t++){const{map:e,key:n,options:i}=l[t],s=new B(i);e.set(n,s),s.finished.finally(()=>e.delete(n)),u.push(s)}return u}const Z=(()=>function(t,e,n){return new O(Q(t,e,n))})();t.animate=Z,t.animateSequence=function(t,e){const n=[];return function(t,{defaultTransition:e={},...n}={},s,o){const l=e.duration||.3,h=new Map,c=new Map,p={},g=new Map;let y=0,A=0,T=0;for(let n=0;n<t.length;n++){const s=t[n];if("string"==typeof s){g.set(s,A);continue}if(!Array.isArray(s)){g.set(s.name,K(A,s.at,y,g));continue}let[a,h,b={}]=s;void 0!==b.at&&(A=K(A,b.at,y,g));let v=0;const S=(t,n,s,a=0,h=0)=>{const c=X(t),{delay:p=0,times:g=m(c),type:y=e.type||"keyframes",repeat:b,repeatType:S,repeatDelay:k=0,...E}=n;let{ease:w=e.ease||"easeOut",duration:B}=n;const x="function"==typeof p?p(a,h):p,I=c.length,O=M(y)?y:o?.[y||"keyframes"];if(I<=2&&O){let t=100;if(2===I&&J(c)){const e=c[1]-c[0];t=Math.abs(e)}const n={...e,...E};void 0!==B&&(n.duration=r(B));const i=f(n,t,O);w=i.ease,B=i.duration}B??(B=l);const F=A+x;1===g.length&&0===g[0]&&(g[1]=1);const R=g.length-c.length;if(R>0&&d(g,R),1===c.length&&c.unshift(null),b&&i(b<20,`Sequence segments can't repeat ${b} times — ignoring repeat option. Use a value below 20 or apply repeat at the sequence level instead.`),b&&b<20){const t=B>0?k/B:0;B=C(B,b,k);const e=[...c],n=[...g];w=Array.isArray(w)?[...w]:[w];const i=[...w],s="reverse"===S||"mirror"===S;let o=e,a=i;s&&(o=[...e].reverse(),"reverse"===S&&(a=[...i].reverse().map(t=>{return"function"==typeof t?(e=t,t=>1-e(1-t)):t;var e})));for(let r=0;r<b;r++){const l=s&&r%2==0,h=l?o:e,f=l?a:i,d=(r+1)*(1+t);t>0&&(c.push(c[c.length-1]),g.push(d),w.push("linear")),c.push(...h);for(let t=0;t<h.length;t++)g.push(n[t]+d),w.push(0===t?"linear":u(f,t-1))}j(g,b,t)}const W=F+B;_(s,c,w,g,F,W),v=Math.max(x+B,v),T=Math.max(W,T)};if(P(a))S(h,b,U("default",H(a,c)));else{const t=q(a,h,0,p),e=t.length;for(let n=0;n<e;n++){const i=H(t[n],c);for(const t in h)S(h[t],Y(b,t),U(t,i),n,e)}}y=A,A+=v}return c.forEach((t,i)=>{for(const s in t){const o=t[s];o.sort(z);const r=[],l=[],u=[];for(let t=0;t<o.length;t++){const{at:e,value:n,easing:i}=o[t];r.push(n),l.push(a(0,T,e)),u.push(i||"easeOut")}0!==l[0]&&(l.unshift(0),r.unshift(r[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),r.push(null)),h.has(i)||h.set(i,{keyframes:{},transition:{}});const c=h.get(i);c.keyframes[s]=r;const{type:f,...d}=e;c.transition[s]={...d,duration:T,ease:u,times:l,...n}}}),h}(t,e).forEach(({keyframes:t,transition:e},i)=>{n.push(...Q(i,t,e))}),new O(n)}}); |
+2
-0
@@ -65,2 +65,3 @@ import { AnyResolvedKeyframe, UnresolvedValueKeyframe, AnimationOptions, MotionValue, Transition, ElementOrSelector, DOMKeyframesDefinition, AnimationPlaybackOptions, AnimationPlaybackControlsWithThen, ValueAnimationTransition, AnimationScope, AnimationPlaybackControls } from 'motion-dom'; | ||
| reduceMotion?: boolean; | ||
| skipAnimations?: boolean; | ||
| onComplete?: () => void; | ||
@@ -90,2 +91,3 @@ } | ||
| reduceMotion?: boolean; | ||
| skipAnimations?: boolean; | ||
| } | ||
@@ -92,0 +94,0 @@ /** |
@@ -14,3 +14,3 @@ import { GroupAnimationWithThen } from 'motion-dom'; | ||
| function createScopedAnimate(options = {}) { | ||
| const { scope, reduceMotion } = options; | ||
| const { scope, reduceMotion, skipAnimations } = options; | ||
| /** | ||
@@ -22,2 +22,7 @@ * Implementation | ||
| let animationOnComplete; | ||
| const inherited = {}; | ||
| if (reduceMotion !== undefined) | ||
| inherited.reduceMotion = reduceMotion; | ||
| if (skipAnimations !== undefined) | ||
| inherited.skipAnimations = skipAnimations; | ||
| if (isSequence(subjectOrSequence)) { | ||
@@ -28,5 +33,3 @@ const { onComplete, ...sequenceOptions } = optionsOrKeyframes || {}; | ||
| } | ||
| animations = animateSequence(subjectOrSequence, reduceMotion !== undefined | ||
| ? { reduceMotion, ...sequenceOptions } | ||
| : sequenceOptions, scope); | ||
| animations = animateSequence(subjectOrSequence, { ...inherited, ...sequenceOptions }, scope); | ||
| } | ||
@@ -39,5 +42,3 @@ else { | ||
| } | ||
| animations = animateSubject(subjectOrSequence, optionsOrKeyframes, (reduceMotion !== undefined | ||
| ? { reduceMotion, ...rest } | ||
| : rest), scope); | ||
| animations = animateSubject(subjectOrSequence, optionsOrKeyframes, { ...inherited, ...rest }, scope); | ||
| } | ||
@@ -44,0 +45,0 @@ const animation = new GroupAnimationWithThen(animations); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.mjs","sources":["../../../../src/animation/animate/index.ts"],"sourcesContent":["import type {\n AnimationPlaybackControlsWithThen,\n AnimationScope,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n MotionValue,\n UnresolvedValueKeyframe,\n ValueAnimationTransition,\n} from \"motion-dom\"\nimport { GroupAnimationWithThen } from \"motion-dom\"\nimport { removeItem } from \"motion-utils\"\nimport {\n AnimationSequence,\n ObjectTarget,\n SequenceOptions,\n} from \"../sequence/types\"\nimport { animateSequence } from \"./sequence\"\nimport { animateSubject } from \"./subject\"\n\nfunction isSequence(value: unknown): value is AnimationSequence {\n return Array.isArray(value) && value.some(Array.isArray)\n}\n\ninterface ScopedAnimateOptions {\n scope?: AnimationScope\n reduceMotion?: boolean\n}\n\n/**\n * Creates an animation function that is optionally scoped\n * to a specific element.\n */\nexport function createScopedAnimate(options: ScopedAnimateOptions = {}) {\n const { scope, reduceMotion } = options\n /**\n * Animate a sequence\n */\n function scopedAnimate(\n sequence: AnimationSequence,\n options?: SequenceOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a string\n */\n function scopedAnimate(\n value: string | MotionValue<string>,\n keyframes: string | UnresolvedValueKeyframe<string>[],\n options?: ValueAnimationTransition<string>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a number\n */\n function scopedAnimate(\n value: number | MotionValue<number>,\n keyframes: number | UnresolvedValueKeyframe<number>[],\n options?: ValueAnimationTransition<number>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a generic motion value\n */\n function scopedAnimate<V extends string | number>(\n value: V | MotionValue<V>,\n keyframes: V | UnresolvedValueKeyframe<V>[],\n options?: ValueAnimationTransition<V>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate an Element\n */\n function scopedAnimate(\n element: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate an object\n */\n function scopedAnimate<O extends {}>(\n object: O | O[],\n keyframes: ObjectTarget<O>,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Implementation\n */\n function scopedAnimate<O extends {}>(\n subjectOrSequence:\n | AnimationSequence\n | MotionValue<number>\n | MotionValue<string>\n | number\n | string\n | ElementOrSelector\n | O\n | O[],\n optionsOrKeyframes?:\n | SequenceOptions\n | number\n | string\n | UnresolvedValueKeyframe<number>[]\n | UnresolvedValueKeyframe<string>[]\n | DOMKeyframesDefinition\n | ObjectTarget<O>,\n options?:\n | ValueAnimationTransition<number>\n | ValueAnimationTransition<string>\n | DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen {\n let animations: AnimationPlaybackControlsWithThen[] = []\n let animationOnComplete: VoidFunction | undefined\n\n if (isSequence(subjectOrSequence)) {\n const { onComplete, ...sequenceOptions } =\n (optionsOrKeyframes as SequenceOptions) || {}\n if (typeof onComplete === \"function\") {\n animationOnComplete = onComplete as VoidFunction\n }\n animations = animateSequence(\n subjectOrSequence,\n reduceMotion !== undefined\n ? { reduceMotion, ...sequenceOptions }\n : (sequenceOptions as SequenceOptions),\n scope\n )\n } else {\n // Extract top-level onComplete so it doesn't get applied per-value\n const { onComplete, ...rest } = options || {}\n if (typeof onComplete === \"function\") {\n animationOnComplete = onComplete as VoidFunction\n }\n animations = animateSubject(\n subjectOrSequence as ElementOrSelector,\n optionsOrKeyframes as DOMKeyframesDefinition,\n (reduceMotion !== undefined\n ? { reduceMotion, ...rest }\n : rest) as DynamicAnimationOptions,\n scope\n )\n }\n\n const animation = new GroupAnimationWithThen(animations)\n\n if (animationOnComplete) {\n animation.finished.then(animationOnComplete)\n }\n\n if (scope) {\n scope.animations.push(animation)\n animation.finished.then(() => {\n removeItem(scope.animations, animation)\n })\n }\n\n return animation\n }\n\n return scopedAnimate\n}\n\nexport const animate = createScopedAnimate()\n"],"names":[],"mappings":";;;;;AAoBA,SAAS,UAAU,CAAC,KAAc,EAAA;AAC9B,IAAA,OAA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AA,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;AAChC,YAAA,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAK;AACzB,gBAAA,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC;AAC3C,YAAA,CAAC,CAAC;QACN;AAEA,QAAA,OAAO,SAAS;IACpB;AAEA,IAAA,OAAO,aAAa;AACxB;AAEO,MAAM,OAAO,GAAG,mBAAmB;;;;"} | ||
| {"version":3,"file":"index.mjs","sources":["../../../../src/animation/animate/index.ts"],"sourcesContent":["import type {\n AnimationPlaybackControlsWithThen,\n AnimationScope,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n ElementOrSelector,\n MotionValue,\n UnresolvedValueKeyframe,\n ValueAnimationTransition,\n} from \"motion-dom\"\nimport { GroupAnimationWithThen } from \"motion-dom\"\nimport { removeItem } from \"motion-utils\"\nimport {\n AnimationSequence,\n ObjectTarget,\n SequenceOptions,\n} from \"../sequence/types\"\nimport { animateSequence } from \"./sequence\"\nimport { animateSubject } from \"./subject\"\n\nfunction isSequence(value: unknown): value is AnimationSequence {\n return Array.isArray(value) && value.some(Array.isArray)\n}\n\ninterface ScopedAnimateOptions {\n scope?: AnimationScope\n reduceMotion?: boolean\n skipAnimations?: boolean\n}\n\n/**\n * Creates an animation function that is optionally scoped\n * to a specific element.\n */\nexport function createScopedAnimate(options: ScopedAnimateOptions = {}) {\n const { scope, reduceMotion, skipAnimations } = options\n /**\n * Animate a sequence\n */\n function scopedAnimate(\n sequence: AnimationSequence,\n options?: SequenceOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a string\n */\n function scopedAnimate(\n value: string | MotionValue<string>,\n keyframes: string | UnresolvedValueKeyframe<string>[],\n options?: ValueAnimationTransition<string>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a number\n */\n function scopedAnimate(\n value: number | MotionValue<number>,\n keyframes: number | UnresolvedValueKeyframe<number>[],\n options?: ValueAnimationTransition<number>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate a generic motion value\n */\n function scopedAnimate<V extends string | number>(\n value: V | MotionValue<V>,\n keyframes: V | UnresolvedValueKeyframe<V>[],\n options?: ValueAnimationTransition<V>\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate an Element\n */\n function scopedAnimate(\n element: ElementOrSelector,\n keyframes: DOMKeyframesDefinition,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Animate an object\n */\n function scopedAnimate<O extends {}>(\n object: O | O[],\n keyframes: ObjectTarget<O>,\n options?: DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen\n /**\n * Implementation\n */\n function scopedAnimate<O extends {}>(\n subjectOrSequence:\n | AnimationSequence\n | MotionValue<number>\n | MotionValue<string>\n | number\n | string\n | ElementOrSelector\n | O\n | O[],\n optionsOrKeyframes?:\n | SequenceOptions\n | number\n | string\n | UnresolvedValueKeyframe<number>[]\n | UnresolvedValueKeyframe<string>[]\n | DOMKeyframesDefinition\n | ObjectTarget<O>,\n options?:\n | ValueAnimationTransition<number>\n | ValueAnimationTransition<string>\n | DynamicAnimationOptions\n ): AnimationPlaybackControlsWithThen {\n let animations: AnimationPlaybackControlsWithThen[] = []\n let animationOnComplete: VoidFunction | undefined\n\n const inherited: { reduceMotion?: boolean; skipAnimations?: boolean } =\n {}\n if (reduceMotion !== undefined) inherited.reduceMotion = reduceMotion\n if (skipAnimations !== undefined)\n inherited.skipAnimations = skipAnimations\n\n if (isSequence(subjectOrSequence)) {\n const { onComplete, ...sequenceOptions } =\n (optionsOrKeyframes as SequenceOptions) || {}\n if (typeof onComplete === \"function\") {\n animationOnComplete = onComplete as VoidFunction\n }\n animations = animateSequence(\n subjectOrSequence,\n { ...inherited, ...sequenceOptions } as SequenceOptions,\n scope\n )\n } else {\n // Extract top-level onComplete so it doesn't get applied per-value\n const { onComplete, ...rest } = options || {}\n if (typeof onComplete === \"function\") {\n animationOnComplete = onComplete as VoidFunction\n }\n animations = animateSubject(\n subjectOrSequence as ElementOrSelector,\n optionsOrKeyframes as DOMKeyframesDefinition,\n { ...inherited, ...rest } as DynamicAnimationOptions,\n scope\n )\n }\n\n const animation = new GroupAnimationWithThen(animations)\n\n if (animationOnComplete) {\n animation.finished.then(animationOnComplete)\n }\n\n if (scope) {\n scope.animations.push(animation)\n animation.finished.then(() => {\n removeItem(scope.animations, animation)\n })\n }\n\n return animation\n }\n\n return scopedAnimate\n}\n\nexport const animate = createScopedAnimate()\n"],"names":[],"mappings":";;;;;AAoBA,SAAS,UAAU,CAAC,KAAc,EAAA;AAC9B,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5D;AAQA;;;AAGG;AACG,SAAU,mBAAmB,CAAC,OAAA,GAAgC,EAAE,EAAA;IAClE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,OAAO;AAgDvD;;AAEG;AACH,IAAA,SAAS,aAAa,CAClB,iBAQS,EACT,kBAOqB,EACrB,OAG6B,EAAA;QAE7B,IAAI,UAAU,GAAwC,EAAE;AACxD,QAAA,IAAI,mBAA6C;QAEjD,MAAM,SAAS,GACX,EAAE;QACN,IAAI,YAAY,KAAK,SAAS;AAAE,YAAA,SAAS,CAAC,YAAY,GAAG,YAAY;QACrE,IAAI,cAAc,KAAK,SAAS;AAC5B,YAAA,SAAS,CAAC,cAAc,GAAG,cAAc;AAE7C,QAAA,IAAI,UAAU,CAAC,iBAAiB,CAAC,EAAE;YAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,GACnC,kBAAsC,IAAI,EAAE;AACjD,YAAA,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;gBAClC,mBAAmB,GAAG,UAA0B;YACpD;AACA,YAAA,UAAU,GAAG,eAAe,CACxB,iBAAiB,EACjB,EAAE,GAAG,SAAS,EAAE,GAAG,eAAe,EAAqB,EACvD,KAAK,CACR;QACL;aAAO;;YAEH,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE;AAC7C,YAAA,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;gBAClC,mBAAmB,GAAG,UAA0B;YACpD;AACA,YAAA,UAAU,GAAG,cAAc,CACvB,iBAAsC,EACtC,kBAA4C,EAC5C,EAAE,GAAG,SAAS,EAAE,GAAG,IAAI,EAA6B,EACpD,KAAK,CACR;QACL;AAEA,QAAA,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAAC,UAAU,CAAC;QAExD,IAAI,mBAAmB,EAAE;AACrB,YAAA,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC;QAChD;QAEA,IAAI,KAAK,EAAE;AACP,YAAA,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;AAChC,YAAA,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAK;AACzB,gBAAA,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,CAAC;AAC3C,YAAA,CAAC,CAAC;QACN;AAEA,QAAA,OAAO,SAAS;IACpB;AAEA,IAAA,OAAO,aAAa;AACxB;AAEO,MAAM,OAAO,GAAG,mBAAmB;;;;"} |
| "use client"; | ||
| import { useMemo } from 'react'; | ||
| import { useContext, useMemo } from 'react'; | ||
| import { useConstant } from '../../utils/use-constant.mjs'; | ||
| import { useUnmountEffect } from '../../utils/use-unmount-effect.mjs'; | ||
| import { useReducedMotionConfig } from '../../utils/reduced-motion/use-reduced-motion-config.mjs'; | ||
| import { MotionConfigContext } from '../../context/MotionConfigContext.mjs'; | ||
| import { createScopedAnimate } from '../animate/index.mjs'; | ||
@@ -14,3 +15,4 @@ | ||
| const reduceMotion = useReducedMotionConfig() ?? undefined; | ||
| const animate = useMemo(() => createScopedAnimate({ scope, reduceMotion }), [scope, reduceMotion]); | ||
| const { skipAnimations } = useContext(MotionConfigContext); | ||
| const animate = useMemo(() => createScopedAnimate({ scope, reduceMotion, skipAnimations }), [scope, reduceMotion, skipAnimations]); | ||
| useUnmountEffect(() => { | ||
@@ -17,0 +19,0 @@ scope.animations.forEach((animation) => animation.stop()); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"use-animate.mjs","sources":["../../../../src/animation/hooks/use-animate.ts"],"sourcesContent":["\"use client\"\n\nimport { useMemo } from \"react\"\nimport { AnimationScope } from \"motion-dom\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { useUnmountEffect } from \"../../utils/use-unmount-effect\"\nimport { useReducedMotionConfig } from \"../../utils/reduced-motion/use-reduced-motion-config\"\nimport { createScopedAnimate } from \"../animate\"\n\nexport function useAnimate<T extends Element = any>() {\n const scope: AnimationScope<T> = useConstant(() => ({\n current: null!, // Will be hydrated by React\n animations: [],\n }))\n\n const reduceMotion = useReducedMotionConfig() ?? undefined\n\n const animate = useMemo(\n () => createScopedAnimate({ scope, reduceMotion }),\n [scope, reduceMotion]\n )\n\n useUnmountEffect(() => {\n scope.animations.forEach((animation) => animation.stop())\n scope.animations.length = 0\n })\n\n return [scope, animate] as [AnimationScope<T>, typeof animate]\n}\n"],"names":[],"mappings":";;;;;;;;AAUI;;AAEI;AACH;AAED;;;AAQI;AACA;AACJ;AAEA;AACJ;;"} | ||
| {"version":3,"file":"use-animate.mjs","sources":["../../../../src/animation/hooks/use-animate.ts"],"sourcesContent":["\"use client\"\n\nimport { useContext, useMemo } from \"react\"\nimport { AnimationScope } from \"motion-dom\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { useUnmountEffect } from \"../../utils/use-unmount-effect\"\nimport { useReducedMotionConfig } from \"../../utils/reduced-motion/use-reduced-motion-config\"\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { createScopedAnimate } from \"../animate\"\n\nexport function useAnimate<T extends Element = any>() {\n const scope: AnimationScope<T> = useConstant(() => ({\n current: null!, // Will be hydrated by React\n animations: [],\n }))\n\n const reduceMotion = useReducedMotionConfig() ?? undefined\n const { skipAnimations } = useContext(MotionConfigContext)\n\n const animate = useMemo(\n () => createScopedAnimate({ scope, reduceMotion, skipAnimations }),\n [scope, reduceMotion, skipAnimations]\n )\n\n useUnmountEffect(() => {\n scope.animations.forEach((animation) => animation.stop())\n scope.animations.length = 0\n })\n\n return [scope, animate] as [AnimationScope<T>, typeof animate]\n}\n"],"names":[],"mappings":";;;;;;;;;AAWI;;AAEI;AACH;AAED;;;;AASI;AACA;AACJ;AAEA;AACJ;;"} |
| import { isMotionValue, defaultOffset, isGenerator, createGeneratorEasing, fillOffset } from 'motion-dom'; | ||
| import { progress, secondsToMilliseconds, invariant, getEasingForSegment } from 'motion-utils'; | ||
| import { progress, secondsToMilliseconds, warning, reverseEasing, getEasingForSegment } from 'motion-utils'; | ||
| import { resolveSubjects } from '../animate/resolve-subjects.mjs'; | ||
@@ -114,7 +114,17 @@ import { calculateRepeatDuration } from './utils/calc-repeat-duration.mjs'; | ||
| /** | ||
| * Handle repeat options | ||
| * Segments can't express `repeat: Infinity` or very large | ||
| * counts — they'd leave dead time after the segment or | ||
| * explode the keyframe array. Ignore with a warning. | ||
| */ | ||
| if (repeat) { | ||
| invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high"); | ||
| duration = calculateRepeatDuration(duration, repeat); | ||
| warning(repeat < MAX_REPEAT, `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`); | ||
| } | ||
| if (repeat && repeat < MAX_REPEAT) { | ||
| /** | ||
| * Express repeatDelay in units of a single iteration's duration | ||
| * so it can be added to the per-iteration time offsets below | ||
| * before they're normalized to 0-1. | ||
| */ | ||
| const repeatDelayUnits = duration > 0 ? repeatDelay / duration : 0; | ||
| duration = calculateRepeatDuration(duration, repeat, repeatDelay); | ||
| const originalKeyframes = [...valueKeyframesAsList]; | ||
@@ -124,12 +134,50 @@ const originalTimes = [...times]; | ||
| const originalEase = [...ease]; | ||
| /** | ||
| * For reverse/mirror, alternate iterations play the segment | ||
| * backwards. mirror matches JSAnimation's mirroredGenerator: | ||
| * reversed keyframes, easings unchanged. reverse matches | ||
| * JSAnimation's iterationProgress = 1 - p: reversed | ||
| * keyframes, easing array reversed AND each function easing | ||
| * mapped through reverseEasing (string easings unchanged — | ||
| * they're resolved later by the keyframes engine). | ||
| */ | ||
| const isFlipping = repeatType === "reverse" || repeatType === "mirror"; | ||
| let flippedKeyframes = originalKeyframes; | ||
| let flippedEases = originalEase; | ||
| if (isFlipping) { | ||
| flippedKeyframes = [...originalKeyframes].reverse(); | ||
| if (repeatType === "reverse") { | ||
| flippedEases = [...originalEase] | ||
| .reverse() | ||
| .map((e) => typeof e === "function" | ||
| ? reverseEasing(e) | ||
| : e); | ||
| } | ||
| } | ||
| for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) { | ||
| valueKeyframesAsList.push(...originalKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < originalKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + (repeatIndex + 1)); | ||
| const isFlipped = isFlipping && repeatIndex % 2 === 0; | ||
| const iterKeyframes = isFlipped | ||
| ? flippedKeyframes | ||
| : originalKeyframes; | ||
| const iterEase = isFlipped ? flippedEases : originalEase; | ||
| const iterStartOffset = (repeatIndex + 1) * (1 + repeatDelayUnits); | ||
| /** | ||
| * If repeatDelay is set, hold the previous iteration's | ||
| * final value through the delay by inserting a keyframe | ||
| * at the moment the next iteration begins. | ||
| */ | ||
| if (repeatDelayUnits > 0) { | ||
| valueKeyframesAsList.push(valueKeyframesAsList[valueKeyframesAsList.length - 1]); | ||
| times.push(iterStartOffset); | ||
| ease.push("linear"); | ||
| } | ||
| valueKeyframesAsList.push(...iterKeyframes); | ||
| for (let keyframeIndex = 0; keyframeIndex < iterKeyframes.length; keyframeIndex++) { | ||
| times.push(originalTimes[keyframeIndex] + iterStartOffset); | ||
| ease.push(keyframeIndex === 0 | ||
| ? "linear" | ||
| : getEasingForSegment(originalEase, keyframeIndex - 1)); | ||
| : getEasingForSegment(iterEase, keyframeIndex - 1)); | ||
| } | ||
| } | ||
| normalizeTimes(times, repeat); | ||
| normalizeTimes(times, repeat, repeatDelayUnits); | ||
| } | ||
@@ -136,0 +184,0 @@ const targetTime = startTime + duration; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"create.mjs","sources":["../../../../src/animation/sequence/create.ts"],"sourcesContent":["import {\n AnimationScope,\n createGeneratorEasing,\n defaultOffset,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n fillOffset,\n GeneratorFactory,\n isGenerator,\n isMotionValue,\n Transition,\n UnresolvedValueKeyframe,\n type AnyResolvedKeyframe,\n type MotionValue,\n} from \"motion-dom\"\nimport {\n Easing,\n getEasingForSegment,\n invariant,\n progress,\n secondsToMilliseconds,\n} from \"motion-utils\"\nimport { resolveSubjects } from \"../animate/resolve-subjects\"\nimport {\n AnimationSequence,\n At,\n ResolvedAnimationDefinitions,\n SequenceMap,\n SequenceOptions,\n ValueSequence,\n} from \"./types\"\nimport { calculateRepeatDuration } from \"./utils/calc-repeat-duration\"\nimport { calcNextTime } from \"./utils/calc-time\"\nimport { addKeyframes } from \"./utils/edit\"\nimport { normalizeTimes } from \"./utils/normalize-times\"\nimport { compareByTime } from \"./utils/sort\"\n\nconst defaultSegmentEasing = \"easeInOut\"\n\nconst MAX_REPEAT = 20\n\nexport function createAnimationsFromSequence(\n sequence: AnimationSequence,\n { defaultTransition = {}, ...sequenceTransition }: SequenceOptions = {},\n scope?: AnimationScope,\n generators?: { [key: string]: GeneratorFactory }\n): ResolvedAnimationDefinitions {\n const defaultDuration = defaultTransition.duration || 0.3\n const animationDefinitions: ResolvedAnimationDefinitions = new Map()\n const sequences = new Map<Element | MotionValue, SequenceMap>()\n const elementCache = {}\n const timeLabels = new Map<string, number>()\n\n let prevTime = 0\n let currentTime = 0\n let totalDuration = 0\n\n /**\n * Build the timeline by mapping over the sequence array and converting\n * the definitions into keyframes and offsets with absolute time values.\n * These will later get converted into relative offsets in a second pass.\n */\n for (let i = 0; i < sequence.length; i++) {\n const segment = sequence[i]\n\n /**\n * If this is a timeline label, mark it and skip the rest of this iteration.\n */\n if (typeof segment === \"string\") {\n timeLabels.set(segment, currentTime)\n continue\n } else if (!Array.isArray(segment)) {\n timeLabels.set(\n segment.name,\n calcNextTime(currentTime, segment.at, prevTime, timeLabels)\n )\n continue\n }\n\n let [subject, keyframes, transition = {}] = segment\n\n /**\n * If a relative or absolute time value has been specified we need to resolve\n * it in relation to the currentTime.\n */\n if (transition.at !== undefined) {\n currentTime = calcNextTime(\n currentTime,\n transition.at,\n prevTime,\n timeLabels\n )\n }\n\n /**\n * Keep track of the maximum duration in this definition. This will be\n * applied to currentTime once the definition has been parsed.\n */\n let maxDuration = 0\n\n const resolveValueSequence = (\n valueKeyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[],\n valueTransition: Transition | DynamicAnimationOptions,\n valueSequence: ValueSequence,\n elementIndex = 0,\n numSubjects = 0\n ) => {\n const valueKeyframesAsList = keyframesAsList(valueKeyframes)\n const {\n delay = 0,\n times = defaultOffset(valueKeyframesAsList),\n type = defaultTransition.type || \"keyframes\",\n repeat,\n repeatType,\n repeatDelay = 0,\n ...remainingTransition\n } = valueTransition\n let { ease = defaultTransition.ease || \"easeOut\", duration } =\n valueTransition\n\n /**\n * Resolve stagger() if defined.\n */\n const calculatedDelay =\n typeof delay === \"function\"\n ? delay(elementIndex, numSubjects)\n : delay\n\n /**\n * If this animation should and can use a spring, generate a spring easing function.\n */\n const numKeyframes = valueKeyframesAsList.length\n const createGenerator = isGenerator(type)\n ? type\n : generators?.[type || \"keyframes\"]\n\n if (numKeyframes <= 2 && createGenerator) {\n /**\n * As we're creating an easing function from a spring,\n * ideally we want to generate it using the real distance\n * between the two keyframes. However this isn't always\n * possible - in these situations we use 0-100.\n */\n let absoluteDelta = 100\n if (\n numKeyframes === 2 &&\n isNumberKeyframesArray(valueKeyframesAsList)\n ) {\n const delta =\n valueKeyframesAsList[1] - valueKeyframesAsList[0]\n absoluteDelta = Math.abs(delta)\n }\n\n const springTransition = {\n ...defaultTransition,\n ...remainingTransition,\n }\n if (duration !== undefined) {\n springTransition.duration = secondsToMilliseconds(duration)\n }\n\n const springEasing = createGeneratorEasing(\n springTransition,\n absoluteDelta,\n createGenerator\n )\n\n ease = springEasing.ease\n duration = springEasing.duration\n }\n\n duration ??= defaultDuration\n\n const startTime = currentTime + calculatedDelay\n\n /**\n * If there's only one time offset of 0, fill in a second with length 1\n */\n if (times.length === 1 && times[0] === 0) {\n times[1] = 1\n }\n\n /**\n * Fill out if offset if fewer offsets than keyframes\n */\n const remainder = times.length - valueKeyframesAsList.length\n remainder > 0 && fillOffset(times, remainder)\n\n /**\n * If only one value has been set, ie [1], push a null to the start of\n * the keyframe array. This will let us mark a keyframe at this point\n * that will later be hydrated with the previous value.\n */\n valueKeyframesAsList.length === 1 &&\n valueKeyframesAsList.unshift(null)\n\n /**\n * Handle repeat options\n */\n if (repeat) {\n invariant(\n repeat < MAX_REPEAT,\n \"Repeat count too high, must be less than 20\",\n \"repeat-count-high\"\n )\n\n duration = calculateRepeatDuration(\n duration,\n repeat,\n repeatDelay\n )\n\n const originalKeyframes = [...valueKeyframesAsList]\n const originalTimes = [...times]\n ease = Array.isArray(ease) ? [...ease] : [ease]\n const originalEase = [...ease]\n\n for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {\n valueKeyframesAsList.push(...originalKeyframes)\n\n for (\n let keyframeIndex = 0;\n keyframeIndex < originalKeyframes.length;\n keyframeIndex++\n ) {\n times.push(\n originalTimes[keyframeIndex] + (repeatIndex + 1)\n )\n ease.push(\n keyframeIndex === 0\n ? \"linear\"\n : getEasingForSegment(\n originalEase,\n keyframeIndex - 1\n )\n )\n }\n }\n\n normalizeTimes(times, repeat)\n }\n\n const targetTime = startTime + duration\n\n /**\n * Add keyframes, mapping offsets to absolute time.\n */\n addKeyframes(\n valueSequence,\n valueKeyframesAsList,\n ease as Easing | Easing[],\n times,\n startTime,\n targetTime\n )\n\n maxDuration = Math.max(calculatedDelay + duration, maxDuration)\n totalDuration = Math.max(targetTime, totalDuration)\n }\n\n if (isMotionValue(subject)) {\n const subjectSequence = getSubjectSequence(subject, sequences)\n resolveValueSequence(\n keyframes as AnyResolvedKeyframe,\n transition,\n getValueSequence(\"default\", subjectSequence)\n )\n } else {\n const subjects = resolveSubjects(\n subject,\n keyframes as DOMKeyframesDefinition,\n scope,\n elementCache\n )\n\n const numSubjects = subjects.length\n\n /**\n * For every element in this segment, process the defined values.\n */\n for (\n let subjectIndex = 0;\n subjectIndex < numSubjects;\n subjectIndex++\n ) {\n /**\n * Cast necessary, but we know these are of this type\n */\n keyframes = keyframes as DOMKeyframesDefinition\n transition = transition as DynamicAnimationOptions\n\n const thisSubject = subjects[subjectIndex]\n const subjectSequence = getSubjectSequence(\n thisSubject,\n sequences\n )\n\n for (const key in keyframes) {\n resolveValueSequence(\n keyframes[\n key as keyof typeof keyframes\n ] as UnresolvedValueKeyframe,\n getValueTransition(transition, key),\n getValueSequence(key, subjectSequence),\n subjectIndex,\n numSubjects\n )\n }\n }\n }\n\n prevTime = currentTime\n currentTime += maxDuration\n }\n\n /**\n * For every element and value combination create a new animation.\n */\n sequences.forEach((valueSequences, element) => {\n for (const key in valueSequences) {\n const valueSequence = valueSequences[key]\n\n /**\n * Arrange all the keyframes in ascending time order.\n */\n valueSequence.sort(compareByTime)\n\n const keyframes: UnresolvedValueKeyframe[] = []\n const valueOffset: number[] = []\n const valueEasing: Easing[] = []\n\n /**\n * For each keyframe, translate absolute times into\n * relative offsets based on the total duration of the timeline.\n */\n for (let i = 0; i < valueSequence.length; i++) {\n const { at, value, easing } = valueSequence[i]\n keyframes.push(value)\n valueOffset.push(progress(0, totalDuration, at))\n valueEasing.push(easing || \"easeOut\")\n }\n\n /**\n * If the first keyframe doesn't land on offset: 0\n * provide one by duplicating the initial keyframe. This ensures\n * it snaps to the first keyframe when the animation starts.\n */\n if (valueOffset[0] !== 0) {\n valueOffset.unshift(0)\n keyframes.unshift(keyframes[0])\n valueEasing.unshift(defaultSegmentEasing)\n }\n\n /**\n * If the last keyframe doesn't land on offset: 1\n * provide one with a null wildcard value. This will ensure it\n * stays static until the end of the animation.\n */\n if (valueOffset[valueOffset.length - 1] !== 1) {\n valueOffset.push(1)\n keyframes.push(null)\n }\n\n if (!animationDefinitions.has(element)) {\n animationDefinitions.set(element, {\n keyframes: {},\n transition: {},\n })\n }\n\n const definition = animationDefinitions.get(element)!\n\n definition.keyframes[key] = keyframes\n\n /**\n * Exclude `type` from defaultTransition since springs have been\n * converted to duration-based easing functions in resolveValueSequence.\n * Including `type: \"spring\"` would cause JSAnimation to error when\n * the merged keyframes array has more than 2 keyframes.\n */\n const { type: _type, ...remainingDefaultTransition } =\n defaultTransition\n definition.transition[key] = {\n ...remainingDefaultTransition,\n duration: totalDuration,\n ease: valueEasing,\n times: valueOffset,\n ...sequenceTransition,\n }\n }\n })\n\n return animationDefinitions\n}\n\nfunction getSubjectSequence<O extends {}>(\n subject: Element | MotionValue | O,\n sequences: Map<Element | MotionValue | O, SequenceMap>\n): SequenceMap {\n !sequences.has(subject) && sequences.set(subject, {})\n return sequences.get(subject)!\n}\n\nfunction getValueSequence(name: string, sequences: SequenceMap): ValueSequence {\n if (!sequences[name]) sequences[name] = []\n return sequences[name]\n}\n\nfunction keyframesAsList(\n keyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n): UnresolvedValueKeyframe[] {\n return Array.isArray(keyframes) ? keyframes : [keyframes]\n}\n\nexport function getValueTransition(\n transition: DynamicAnimationOptions & At,\n key: string\n): DynamicAnimationOptions {\n return transition && transition[key as keyof typeof transition]\n ? {\n ...transition,\n ...(transition[key as keyof typeof transition] as Transition),\n }\n : { ...transition }\n}\n\nconst isNumber = (keyframe: unknown) => typeof keyframe === \"number\"\nconst isNumberKeyframesArray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BAAA,QAAQ,EAAE,aAAa;AACvB,gBAAA,IAAI,EAAE,WAAW;AACjB,gBAAA,KAAK,EAAE,WAAW;AAClB,gBAAA,GAAG,kBAAkB;aACxB;QACL;AACJ,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,oBAAoB;AAC/B;AAEA,SAAS,kBAAkB,CACvB,OAAkC,EAClC,SAAsD,EAAA;AAEtD,IAAA,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;AACrD,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC,OAAO,CAAE;AAClC;AAEA,SAAS,gBAAgB,CAAC,IAAY,EAAE,SAAsB,EAAA;AAC1D,IAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;AAAE,QAAA,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;AAC1C,IAAA,OAAO,SAAS,CAAC,IAAI,CAAC;AAC1B;AAEA,SAAS,eAAe,CACpB,SAA8D,EAAA;AAE9D,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,CAAC,SAAS,CAAC;AAC7D;AAEM,SAAU,kBAAkB,CAC9B,UAAwC,EACxC,GAAW,EAAA;AAEX,IAAA,OAAO,UAAU,IAAI,UAAU,CAAC,GAA8B;AAC1D,UAAE;AACI,YAAA,GAAG,UAAU;YACb,GAAI,UAAU,CAAC,GAA8B,CAAgB;AAChE;AACH,UAAE,EAAE,GAAG,UAAU,EAAE;AAC3B;AAEA,MAAM,QAAQ,GAAG,CAAC,QAAiB,KAAK,OAAO,QAAQ,KAAK,QAAQ;AACpE,MAAM,sBAAsB,GAAG,CAC3B,SAAoC,KACZ,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;;;;"} | ||
| {"version":3,"file":"create.mjs","sources":["../../../../src/animation/sequence/create.ts"],"sourcesContent":["import {\n AnimationScope,\n createGeneratorEasing,\n defaultOffset,\n DOMKeyframesDefinition,\n AnimationOptions as DynamicAnimationOptions,\n fillOffset,\n GeneratorFactory,\n isGenerator,\n isMotionValue,\n Transition,\n UnresolvedValueKeyframe,\n type AnyResolvedKeyframe,\n type MotionValue,\n} from \"motion-dom\"\nimport {\n Easing,\n getEasingForSegment,\n progress,\n reverseEasing,\n secondsToMilliseconds,\n warning,\n} from \"motion-utils\"\nimport { resolveSubjects } from \"../animate/resolve-subjects\"\nimport {\n AnimationSequence,\n At,\n ResolvedAnimationDefinitions,\n SequenceMap,\n SequenceOptions,\n ValueSequence,\n} from \"./types\"\nimport { calculateRepeatDuration } from \"./utils/calc-repeat-duration\"\nimport { calcNextTime } from \"./utils/calc-time\"\nimport { addKeyframes } from \"./utils/edit\"\nimport { normalizeTimes } from \"./utils/normalize-times\"\nimport { compareByTime } from \"./utils/sort\"\n\nconst defaultSegmentEasing = \"easeInOut\"\n\nconst MAX_REPEAT = 20\n\nexport function createAnimationsFromSequence(\n sequence: AnimationSequence,\n { defaultTransition = {}, ...sequenceTransition }: SequenceOptions = {},\n scope?: AnimationScope,\n generators?: { [key: string]: GeneratorFactory }\n): ResolvedAnimationDefinitions {\n const defaultDuration = defaultTransition.duration || 0.3\n const animationDefinitions: ResolvedAnimationDefinitions = new Map()\n const sequences = new Map<Element | MotionValue, SequenceMap>()\n const elementCache = {}\n const timeLabels = new Map<string, number>()\n\n let prevTime = 0\n let currentTime = 0\n let totalDuration = 0\n\n /**\n * Build the timeline by mapping over the sequence array and converting\n * the definitions into keyframes and offsets with absolute time values.\n * These will later get converted into relative offsets in a second pass.\n */\n for (let i = 0; i < sequence.length; i++) {\n const segment = sequence[i]\n\n /**\n * If this is a timeline label, mark it and skip the rest of this iteration.\n */\n if (typeof segment === \"string\") {\n timeLabels.set(segment, currentTime)\n continue\n } else if (!Array.isArray(segment)) {\n timeLabels.set(\n segment.name,\n calcNextTime(currentTime, segment.at, prevTime, timeLabels)\n )\n continue\n }\n\n let [subject, keyframes, transition = {}] = segment\n\n /**\n * If a relative or absolute time value has been specified we need to resolve\n * it in relation to the currentTime.\n */\n if (transition.at !== undefined) {\n currentTime = calcNextTime(\n currentTime,\n transition.at,\n prevTime,\n timeLabels\n )\n }\n\n /**\n * Keep track of the maximum duration in this definition. This will be\n * applied to currentTime once the definition has been parsed.\n */\n let maxDuration = 0\n\n const resolveValueSequence = (\n valueKeyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[],\n valueTransition: Transition | DynamicAnimationOptions,\n valueSequence: ValueSequence,\n elementIndex = 0,\n numSubjects = 0\n ) => {\n const valueKeyframesAsList = keyframesAsList(valueKeyframes)\n const {\n delay = 0,\n times = defaultOffset(valueKeyframesAsList),\n type = defaultTransition.type || \"keyframes\",\n repeat,\n repeatType,\n repeatDelay = 0,\n ...remainingTransition\n } = valueTransition\n let { ease = defaultTransition.ease || \"easeOut\", duration } =\n valueTransition\n\n /**\n * Resolve stagger() if defined.\n */\n const calculatedDelay =\n typeof delay === \"function\"\n ? delay(elementIndex, numSubjects)\n : delay\n\n /**\n * If this animation should and can use a spring, generate a spring easing function.\n */\n const numKeyframes = valueKeyframesAsList.length\n const createGenerator = isGenerator(type)\n ? type\n : generators?.[type || \"keyframes\"]\n\n if (numKeyframes <= 2 && createGenerator) {\n /**\n * As we're creating an easing function from a spring,\n * ideally we want to generate it using the real distance\n * between the two keyframes. However this isn't always\n * possible - in these situations we use 0-100.\n */\n let absoluteDelta = 100\n if (\n numKeyframes === 2 &&\n isNumberKeyframesArray(valueKeyframesAsList)\n ) {\n const delta =\n valueKeyframesAsList[1] - valueKeyframesAsList[0]\n absoluteDelta = Math.abs(delta)\n }\n\n const springTransition = {\n ...defaultTransition,\n ...remainingTransition,\n }\n if (duration !== undefined) {\n springTransition.duration = secondsToMilliseconds(duration)\n }\n\n const springEasing = createGeneratorEasing(\n springTransition,\n absoluteDelta,\n createGenerator\n )\n\n ease = springEasing.ease\n duration = springEasing.duration\n }\n\n duration ??= defaultDuration\n\n const startTime = currentTime + calculatedDelay\n\n /**\n * If there's only one time offset of 0, fill in a second with length 1\n */\n if (times.length === 1 && times[0] === 0) {\n times[1] = 1\n }\n\n /**\n * Fill out if offset if fewer offsets than keyframes\n */\n const remainder = times.length - valueKeyframesAsList.length\n remainder > 0 && fillOffset(times, remainder)\n\n /**\n * If only one value has been set, ie [1], push a null to the start of\n * the keyframe array. This will let us mark a keyframe at this point\n * that will later be hydrated with the previous value.\n */\n valueKeyframesAsList.length === 1 &&\n valueKeyframesAsList.unshift(null)\n\n /**\n * Segments can't express `repeat: Infinity` or very large\n * counts — they'd leave dead time after the segment or\n * explode the keyframe array. Ignore with a warning.\n */\n if (repeat) {\n warning(\n repeat < MAX_REPEAT,\n `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`\n )\n }\n\n if (repeat && repeat < MAX_REPEAT) {\n /**\n * Express repeatDelay in units of a single iteration's duration\n * so it can be added to the per-iteration time offsets below\n * before they're normalized to 0-1.\n */\n const repeatDelayUnits =\n duration > 0 ? repeatDelay / duration : 0\n\n duration = calculateRepeatDuration(\n duration,\n repeat,\n repeatDelay\n )\n\n const originalKeyframes = [...valueKeyframesAsList]\n const originalTimes = [...times]\n ease = Array.isArray(ease) ? [...ease] : [ease]\n const originalEase = [...ease]\n\n /**\n * For reverse/mirror, alternate iterations play the segment\n * backwards. mirror matches JSAnimation's mirroredGenerator:\n * reversed keyframes, easings unchanged. reverse matches\n * JSAnimation's iterationProgress = 1 - p: reversed\n * keyframes, easing array reversed AND each function easing\n * mapped through reverseEasing (string easings unchanged —\n * they're resolved later by the keyframes engine).\n */\n const isFlipping =\n repeatType === \"reverse\" || repeatType === \"mirror\"\n let flippedKeyframes = originalKeyframes\n let flippedEases = originalEase\n if (isFlipping) {\n flippedKeyframes = [...originalKeyframes].reverse()\n if (repeatType === \"reverse\") {\n flippedEases = [...originalEase]\n .reverse()\n .map((e) =>\n typeof e === \"function\"\n ? reverseEasing(e)\n : e\n )\n }\n }\n\n for (\n let repeatIndex = 0;\n repeatIndex < repeat;\n repeatIndex++\n ) {\n const isFlipped = isFlipping && repeatIndex % 2 === 0\n const iterKeyframes = isFlipped\n ? flippedKeyframes\n : originalKeyframes\n const iterEase = isFlipped ? flippedEases : originalEase\n const iterStartOffset =\n (repeatIndex + 1) * (1 + repeatDelayUnits)\n\n /**\n * If repeatDelay is set, hold the previous iteration's\n * final value through the delay by inserting a keyframe\n * at the moment the next iteration begins.\n */\n if (repeatDelayUnits > 0) {\n valueKeyframesAsList.push(\n valueKeyframesAsList[\n valueKeyframesAsList.length - 1\n ]\n )\n times.push(iterStartOffset)\n ease.push(\"linear\")\n }\n\n valueKeyframesAsList.push(...iterKeyframes)\n\n for (\n let keyframeIndex = 0;\n keyframeIndex < iterKeyframes.length;\n keyframeIndex++\n ) {\n times.push(\n originalTimes[keyframeIndex] + iterStartOffset\n )\n ease.push(\n keyframeIndex === 0\n ? \"linear\"\n : getEasingForSegment(\n iterEase,\n keyframeIndex - 1\n )\n )\n }\n }\n\n normalizeTimes(times, repeat, repeatDelayUnits)\n }\n\n const targetTime = startTime + duration\n\n /**\n * Add keyframes, mapping offsets to absolute time.\n */\n addKeyframes(\n valueSequence,\n valueKeyframesAsList,\n ease as Easing | Easing[],\n times,\n startTime,\n targetTime\n )\n\n maxDuration = Math.max(calculatedDelay + duration, maxDuration)\n totalDuration = Math.max(targetTime, totalDuration)\n }\n\n if (isMotionValue(subject)) {\n const subjectSequence = getSubjectSequence(subject, sequences)\n resolveValueSequence(\n keyframes as AnyResolvedKeyframe,\n transition,\n getValueSequence(\"default\", subjectSequence)\n )\n } else {\n const subjects = resolveSubjects(\n subject,\n keyframes as DOMKeyframesDefinition,\n scope,\n elementCache\n )\n\n const numSubjects = subjects.length\n\n /**\n * For every element in this segment, process the defined values.\n */\n for (\n let subjectIndex = 0;\n subjectIndex < numSubjects;\n subjectIndex++\n ) {\n /**\n * Cast necessary, but we know these are of this type\n */\n keyframes = keyframes as DOMKeyframesDefinition\n transition = transition as DynamicAnimationOptions\n\n const thisSubject = subjects[subjectIndex]\n const subjectSequence = getSubjectSequence(\n thisSubject,\n sequences\n )\n\n for (const key in keyframes) {\n resolveValueSequence(\n keyframes[\n key as keyof typeof keyframes\n ] as UnresolvedValueKeyframe,\n getValueTransition(transition, key),\n getValueSequence(key, subjectSequence),\n subjectIndex,\n numSubjects\n )\n }\n }\n }\n\n prevTime = currentTime\n currentTime += maxDuration\n }\n\n /**\n * For every element and value combination create a new animation.\n */\n sequences.forEach((valueSequences, element) => {\n for (const key in valueSequences) {\n const valueSequence = valueSequences[key]\n\n /**\n * Arrange all the keyframes in ascending time order.\n */\n valueSequence.sort(compareByTime)\n\n const keyframes: UnresolvedValueKeyframe[] = []\n const valueOffset: number[] = []\n const valueEasing: Easing[] = []\n\n /**\n * For each keyframe, translate absolute times into\n * relative offsets based on the total duration of the timeline.\n */\n for (let i = 0; i < valueSequence.length; i++) {\n const { at, value, easing } = valueSequence[i]\n keyframes.push(value)\n valueOffset.push(progress(0, totalDuration, at))\n valueEasing.push(easing || \"easeOut\")\n }\n\n /**\n * If the first keyframe doesn't land on offset: 0\n * provide one by duplicating the initial keyframe. This ensures\n * it snaps to the first keyframe when the animation starts.\n */\n if (valueOffset[0] !== 0) {\n valueOffset.unshift(0)\n keyframes.unshift(keyframes[0])\n valueEasing.unshift(defaultSegmentEasing)\n }\n\n /**\n * If the last keyframe doesn't land on offset: 1\n * provide one with a null wildcard value. This will ensure it\n * stays static until the end of the animation.\n */\n if (valueOffset[valueOffset.length - 1] !== 1) {\n valueOffset.push(1)\n keyframes.push(null)\n }\n\n if (!animationDefinitions.has(element)) {\n animationDefinitions.set(element, {\n keyframes: {},\n transition: {},\n })\n }\n\n const definition = animationDefinitions.get(element)!\n\n definition.keyframes[key] = keyframes\n\n /**\n * Exclude `type` from defaultTransition since springs have been\n * converted to duration-based easing functions in resolveValueSequence.\n * Including `type: \"spring\"` would cause JSAnimation to error when\n * the merged keyframes array has more than 2 keyframes.\n */\n const { type: _type, ...remainingDefaultTransition } =\n defaultTransition\n definition.transition[key] = {\n ...remainingDefaultTransition,\n duration: totalDuration,\n ease: valueEasing,\n times: valueOffset,\n ...sequenceTransition,\n }\n }\n })\n\n return animationDefinitions\n}\n\nfunction getSubjectSequence<O extends {}>(\n subject: Element | MotionValue | O,\n sequences: Map<Element | MotionValue | O, SequenceMap>\n): SequenceMap {\n !sequences.has(subject) && sequences.set(subject, {})\n return sequences.get(subject)!\n}\n\nfunction getValueSequence(name: string, sequences: SequenceMap): ValueSequence {\n if (!sequences[name]) sequences[name] = []\n return sequences[name]\n}\n\nfunction keyframesAsList(\n keyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n): UnresolvedValueKeyframe[] {\n return Array.isArray(keyframes) ? keyframes : [keyframes]\n}\n\nexport function getValueTransition(\n transition: DynamicAnimationOptions & At,\n key: string\n): DynamicAnimationOptions {\n return transition && transition[key as keyof typeof transition]\n ? {\n ...transition,\n ...(transition[key as keyof typeof transition] as Transition),\n }\n : { ...transition }\n}\n\nconst isNumber = (keyframe: unknown) => typeof keyframe === \"number\"\nconst isNumberKeyframesArray = (\n keyframes: UnresolvedValueKeyframe[]\n): keyframes is number[] => keyframes.every(isNumber)\n"],"names":[],"mappings":";;;;;;;;;AAsCA,MAAM,oBAAoB,GAAG,WAAW;AAExC,MAAM,UAAU,GAAG,EAAE;SAEL,4BAA4B,CACxC,QAA2B,EAC3B,EAAE,iBAAiB,GAAG,EAAE,EAAE,GAAG,kBAAkB,EAAA,GAAsB,EAAE,EACvE,KAAsB,EACtB,UAAgD,EAAA;AAEhD,IAAA,MAAM,eAAe,GAAG,iBAAiB,CAAC,QAAQ,IAAI,GAAG;AACzD,IAAA,MAAM,oBAAoB,GAAiC,IAAI,GAAG,EAAE;AACpE,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsC;IAC/D,MAAM,YAAY,GAAG,EAAE;AACvB,IAAA,MAAM,UAAU,GAAG,IAAI,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AI,CAAC,GAAG,EAAE;AAC1C,IAAA,OAAO,SAAS,CAAC,IAAI,CAAC;AAC1B;AAEA,SAAS,eAAe,CACpB,SAA8D,EAAA;AAE9D,IAAA,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,CAAC,SAAS,CAAC;AAC7D;AAEM,SAAU,kBAAkB,CAC9B,UAAwC,EACxC,GAAW,EAAA;AAEX,IAAA,OAAO,UAAU,IAAI,UAAU,CAAC,GAA8B;AAC1D,UAAE;AACI,YAAA,GAAG,UAAU;YACb,GAAI,UAAU,CAAC,GAA8B,CAAgB;AAChE;AACH,UAAE,EAAE,GAAG,UAAU,EAAE;AAC3B;AAEA,MAAM,QAAQ,GAAG,CAAC,QAAiB,KAAK,OAAO,QAAQ,KAAK,QAAQ;AACpE,MAAM,sBAAsB,GAAG,CAC3B,SAAoC,KACZ,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;;;;"} |
@@ -1,3 +0,3 @@ | ||
| function calculateRepeatDuration(duration, repeat, _repeatDelay) { | ||
| return duration * (repeat + 1); | ||
| function calculateRepeatDuration(duration, repeat, repeatDelay) { | ||
| return duration * (repeat + 1) + repeatDelay * repeat; | ||
| } | ||
@@ -4,0 +4,0 @@ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"calc-repeat-duration.mjs","sources":["../../../../../src/animation/sequence/utils/calc-repeat-duration.ts"],"sourcesContent":["export function calculateRepeatDuration(\n duration: number,\n repeat: number,\n _repeatDelay: number\n): number {\n return duration * (repeat + 1)\n}\n"],"names":[],"mappings":"SAAgB,uBAAuB,CACnC,QAAgB,EAChB,MAAc,EACd,YAAoB,EAAA;AAEpB,IAAA,OAAO,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC;AAClC;;;;"} | ||
| {"version":3,"file":"calc-repeat-duration.mjs","sources":["../../../../../src/animation/sequence/utils/calc-repeat-duration.ts"],"sourcesContent":["export function calculateRepeatDuration(\n duration: number,\n repeat: number,\n repeatDelay: number\n): number {\n return duration * (repeat + 1) + repeatDelay * repeat\n}\n"],"names":[],"mappings":"SAAgB,uBAAuB,CACnC,QAAgB,EAChB,MAAc,EACd,WAAmB,EAAA;IAEnB,OAAO,QAAQ,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,WAAW,GAAG,MAAM;AACzD;;;;"} |
@@ -6,6 +6,10 @@ /** | ||
| * down to a 0-1 scale. | ||
| * | ||
| * `repeatDelayUnits` is the repeatDelay expressed in units of a single | ||
| * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`. | ||
| */ | ||
| function normalizeTimes(times, repeat) { | ||
| function normalizeTimes(times, repeat, repeatDelayUnits = 0) { | ||
| const totalUnits = repeat + 1 + repeat * repeatDelayUnits; | ||
| for (let i = 0; i < times.length; i++) { | ||
| times[i] = times[i] / (repeat + 1); | ||
| times[i] = times[i] / totalUnits; | ||
| } | ||
@@ -12,0 +16,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"normalize-times.mjs","sources":["../../../../../src/animation/sequence/utils/normalize-times.ts"],"sourcesContent":["/**\n * Take an array of times that represent repeated keyframes. For instance\n * if we have original times of [0, 0.5, 1] then our repeated times will\n * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back\n * down to a 0-1 scale.\n */\nexport function normalizeTimes(times: number[], repeat: number): void {\n for (let i = 0; i < times.length; i++) {\n times[i] = times[i] / (repeat + 1)\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACG,SAAU,cAAc,CAAC,KAAe,EAAE,MAAc,EAAA;AAC1D,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACnC,QAAA,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;IACtC;AACJ;;;;"} | ||
| {"version":3,"file":"normalize-times.mjs","sources":["../../../../../src/animation/sequence/utils/normalize-times.ts"],"sourcesContent":["/**\n * Take an array of times that represent repeated keyframes. For instance\n * if we have original times of [0, 0.5, 1] then our repeated times will\n * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back\n * down to a 0-1 scale.\n *\n * `repeatDelayUnits` is the repeatDelay expressed in units of a single\n * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`.\n */\nexport function normalizeTimes(\n times: number[],\n repeat: number,\n repeatDelayUnits = 0\n): void {\n const totalUnits = repeat + 1 + repeat * repeatDelayUnits\n for (let i = 0; i < times.length; i++) {\n times[i] = times[i] / totalUnits\n }\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AACG,SAAU,cAAc,CAC1B,KAAe,EACf,MAAc,EACd,gBAAgB,GAAG,CAAC,EAAA;IAEpB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,gBAAgB;AACzD,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU;IACpC;AACJ;;;;"} |
@@ -32,2 +32,3 @@ "use client"; | ||
| size.bottom = parentHeight - size.height - size.top; | ||
| size.direction = computedStyle.direction; | ||
| } | ||
@@ -54,2 +55,3 @@ return null; | ||
| bottom: 0, | ||
| direction: "ltr", | ||
| }); | ||
@@ -74,6 +76,9 @@ const { nonce } = useContext(MotionConfigContext); | ||
| useInsertionEffect(() => { | ||
| const { width, height, top, left, right, bottom } = size.current; | ||
| const { width, height, top, left, right, bottom, direction } = size.current; | ||
| if (isPresent || pop === false || !ref.current || !width || !height) | ||
| return; | ||
| const x = anchorX === "left" ? `left: ${left}` : `right: ${right}`; | ||
| const isRTL = direction === "rtl"; | ||
| const x = anchorX === "left" | ||
| ? (isRTL ? `right: ${right}` : `left: ${left}`) | ||
| : (isRTL ? `left: ${left}` : `right: ${right}`); | ||
| const y = anchorY === "bottom" ? `bottom: ${bottom}` : `top: ${top}`; | ||
@@ -80,0 +85,0 @@ ref.current.dataset.motionPopId = id; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"PopChild.mjs","sources":["../../../../src/components/AnimatePresence/PopChild.tsx"],"sourcesContent":["\"use client\"\n\nimport { isHTMLElement } from \"motion-dom\"\nimport * as React from \"react\"\nimport { useContext, useId, useInsertionEffect, useRef } from \"react\"\n\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { useComposedRefs } from \"../../utils/use-composed-ref\"\n\ninterface Size {\n width: number\n height: number\n top: number\n left: number\n right: number\n bottom: number\n}\n\ninterface Props {\n children: React.ReactElement\n isPresent: boolean\n anchorX?: \"left\" | \"right\"\n anchorY?: \"top\" | \"bottom\"\n root?: HTMLElement | ShadowRoot\n pop?: boolean\n}\n\ninterface MeasureProps extends Props {\n childRef: React.RefObject<HTMLElement | null>\n sizeRef: React.RefObject<Size>\n}\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component<MeasureProps> {\n getSnapshotBeforeUpdate(prevProps: MeasureProps) {\n const element = this.props.childRef.current\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0\n\n const computedStyle = getComputedStyle(element)\n const size = this.props.sizeRef.current!\n size.height = parseFloat(computedStyle.height)\n size.width = parseFloat(computedStyle.width)\n size.top = element.offsetTop\n size.left = element.offsetLeft\n size.right = parentWidth - size.width - size.left\n size.bottom = parentHeight - size.height - size.top\n }\n\n return null\n }\n\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() {}\n\n render() {\n return this.props.children\n }\n}\n\nexport function PopChild({ children, isPresent, anchorX, anchorY, root, pop }: Props) {\n const id = useId()\n const ref = useRef<HTMLElement>(null)\n const size = useRef<Size>({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n })\n const { nonce } = useContext(MotionConfigContext)\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef =\n (children.props as { ref?: React.Ref<HTMLElement> })?.ref ??\n (children as unknown as { ref?: React.Ref<HTMLElement> })?.ref\n const composedRef = useComposedRefs(ref, childRef)\n\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom } = size.current\n if (isPresent || pop === false || !ref.current || !width || !height) return\n\n const x = anchorX === \"left\" ? `left: ${left}` : `right: ${right}`\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`\n\n ref.current.dataset.motionPopId = id\n\n const style = document.createElement(\"style\")\n if (nonce) style.nonce = nonce\n\n const parent = root ?? document.head\n parent.appendChild(style)\n\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `)\n }\n\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\")\n if (parent.contains(style)) {\n parent.removeChild(style)\n }\n }\n }, [isPresent])\n\n return (\n <PopChildMeasure isPresent={isPresent} childRef={ref} sizeRef={size} pop={pop}>\n {pop === false\n ? children\n : React.cloneElement(children as any, { ref: composedRef })}\n </PopChildMeasure>\n )\n}\n"],"names":[],"mappings":";;;;;;;;AAgCA;;;AAGG;AACH;AACI;;;AAGQ;AACA;AACI;;AAEJ;AACI;;AAGJ;;;;AAIA;AACA;AACA;AACA;;AAGJ;;AAGJ;;AAEG;AACH;;AAGI;;AAEP;AAEK;AACF;AACA;;AAEI;AACA;AACA;AACA;AACA;AACA;AACH;;AAED;;;AAGG;AACH;;;AAKA;;;;;;;;AAQG;;AAEC;AACA;;AAEA;AACA;;;AAKA;AAAW;AAEX;AACA;AAEA;AACI;;;;;;;;AAQH;;AAGD;AACI;AACA;AACI;;AAER;AACJ;;AAKY;AACA;AAGhB;;"} | ||
| {"version":3,"file":"PopChild.mjs","sources":["../../../../src/components/AnimatePresence/PopChild.tsx"],"sourcesContent":["\"use client\"\n\nimport { isHTMLElement } from \"motion-dom\"\nimport * as React from \"react\"\nimport { useContext, useId, useInsertionEffect, useRef } from \"react\"\n\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport { useComposedRefs } from \"../../utils/use-composed-ref\"\n\ninterface Size {\n width: number\n height: number\n top: number\n left: number\n right: number\n bottom: number\n direction: string\n}\n\ninterface Props {\n children: React.ReactElement\n isPresent: boolean\n anchorX?: \"left\" | \"right\"\n anchorY?: \"top\" | \"bottom\"\n root?: HTMLElement | ShadowRoot\n pop?: boolean\n}\n\ninterface MeasureProps extends Props {\n childRef: React.RefObject<HTMLElement | null>\n sizeRef: React.RefObject<Size>\n}\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component<MeasureProps> {\n getSnapshotBeforeUpdate(prevProps: MeasureProps) {\n const element = this.props.childRef.current\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0\n\n const computedStyle = getComputedStyle(element)\n const size = this.props.sizeRef.current!\n size.height = parseFloat(computedStyle.height)\n size.width = parseFloat(computedStyle.width)\n size.top = element.offsetTop\n size.left = element.offsetLeft\n size.right = parentWidth - size.width - size.left\n size.bottom = parentHeight - size.height - size.top\n size.direction = computedStyle.direction\n }\n\n return null\n }\n\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() {}\n\n render() {\n return this.props.children\n }\n}\n\nexport function PopChild({ children, isPresent, anchorX, anchorY, root, pop }: Props) {\n const id = useId()\n const ref = useRef<HTMLElement>(null)\n const size = useRef<Size>({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n })\n const { nonce } = useContext(MotionConfigContext)\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef =\n (children.props as { ref?: React.Ref<HTMLElement> })?.ref ??\n (children as unknown as { ref?: React.Ref<HTMLElement> })?.ref\n const composedRef = useComposedRefs(ref, childRef)\n\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current\n if (isPresent || pop === false || !ref.current || !width || !height) return\n\n const isRTL = direction === \"rtl\"\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`)\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`\n\n ref.current.dataset.motionPopId = id\n\n const style = document.createElement(\"style\")\n if (nonce) style.nonce = nonce\n\n const parent = root ?? document.head\n parent.appendChild(style)\n\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `)\n }\n\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\")\n if (parent.contains(style)) {\n parent.removeChild(style)\n }\n }\n }, [isPresent])\n\n return (\n <PopChildMeasure isPresent={isPresent} childRef={ref} sizeRef={size} pop={pop}>\n {pop === false\n ? children\n : React.cloneElement(children as any, { ref: composedRef })}\n </PopChildMeasure>\n )\n}\n"],"names":[],"mappings":";;;;;;;;AAiCA;;;AAGG;AACH;AACI;;;AAGQ;AACA;AACI;;AAEJ;AACI;;AAGJ;;;;AAIA;AACA;AACA;AACA;AACA;;AAGJ;;AAGJ;;AAEG;AACH;;AAGI;;AAEP;AAEK;AACF;AACA;;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACH;;AAED;;;AAGG;AACH;;;AAKA;;;;;;;;AAQG;;AAEC;AACA;;AAEA;AACA;AACI;AACA;AACJ;;;AAKA;AAAW;AAEX;AACA;AAEA;AACI;;;;;;;;AAQH;;AAGD;AACI;AACA;AACI;;AAER;AACJ;;AAKY;AACA;AAGhB;;"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"Group.mjs","sources":["../../../../src/components/Reorder/Group.tsx"],"sourcesContent":["\"use client\"\n\nimport { invariant } from \"motion-utils\"\nimport * as React from \"react\"\nimport { forwardRef, FunctionComponent, JSX, useEffect, useRef } from \"react\"\nimport { ReorderContext } from \"../../context/ReorderContext\"\nimport { motion } from \"../../render/components/motion/proxy\"\nimport { HTMLMotionProps } from \"../../render/html/types\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport {\n DefaultGroupElement,\n ItemData,\n ReorderContextProps,\n ReorderElementTag,\n} from \"./types\"\nimport { checkReorder } from \"./utils/check-reorder\"\n\nexport interface Props<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> {\n /**\n * A HTML element to render this component as. Defaults to `\"ul\"`.\n *\n * @public\n */\n as?: TagName\n\n /**\n * The axis to reorder along. By default, items will be draggable on this axis.\n * To make draggable on both axes, set `<Reorder.Item drag />`\n *\n * @public\n */\n axis?: \"x\" | \"y\"\n\n /**\n * A callback to fire with the new value order. For instance, if the values\n * are provided as a state from `useState`, this could be the set state function.\n *\n * @public\n */\n onReorder: (newOrder: V[]) => void\n\n /**\n * The latest values state.\n *\n * ```jsx\n * function Component() {\n * const [items, setItems] = useState([0, 1, 2])\n *\n * return (\n * <Reorder.Group values={items} onReorder={setItems}>\n * {items.map((item) => <Reorder.Item key={item} value={item} />)}\n * </Reorder.Group>\n * )\n * }\n * ```\n *\n * @public\n */\n values: V[]\n}\n\ntype ReorderGroupProps<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> = Props<V, TagName> &\n Omit<HTMLMotionProps<TagName>, \"values\"> &\n React.PropsWithChildren<{}>\n\nexport function ReorderGroupComponent<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n {\n children,\n as = \"ul\" as TagName,\n axis = \"y\",\n onReorder,\n values,\n ...props\n }: ReorderGroupProps<V, TagName>,\n externalRef?: React.ForwardedRef<any>\n): JSX.Element {\n const Component = useConstant(\n () => motion[as as keyof typeof motion]\n ) as FunctionComponent<\n React.PropsWithChildren<HTMLMotionProps<any> & { ref?: React.Ref<any> }>\n >\n\n const order: ItemData<V>[] = []\n const isReordering = useRef(false)\n const groupRef = useRef<Element>(null)\n\n invariant(\n Boolean(values),\n \"Reorder.Group must be provided a values prop\",\n \"reorder-values\"\n )\n\n const context: ReorderContextProps<V> = {\n axis,\n groupRef,\n registerItem: (value, layout) => {\n // If the entry was already added, update it rather than adding it again\n const idx = order.findIndex((entry) => value === entry.value)\n if (idx !== -1) {\n order[idx].layout = layout[axis]\n } else {\n order.push({ value: value, layout: layout[axis] })\n }\n order.sort(compareMin)\n },\n updateOrder: (item, offset, velocity) => {\n if (isReordering.current) return\n\n const newOrder = checkReorder(order, item, offset, velocity)\n\n if (order !== newOrder) {\n isReordering.current = true\n\n // Find which two values swapped and apply that swap\n // to the full values array. This preserves unmeasured\n // items (e.g. in virtualized lists).\n const newValues = [...values]\n for (let i = 0; i < newOrder.length; i++) {\n if (order[i].value !== newOrder[i].value) {\n const a = values.indexOf(order[i].value)\n const b = values.indexOf(newOrder[i].value)\n if (a !== -1 && b !== -1) {\n ;[newValues[a], newValues[b]] = [newValues[b], newValues[a]]\n }\n break\n }\n }\n onReorder(newValues)\n }\n },\n }\n\n useEffect(() => {\n isReordering.current = false\n })\n\n // Combine refs if external ref is provided\n const setRef = (element: Element | null) => {\n ;(groupRef as React.MutableRefObject<Element | null>).current = element\n if (typeof externalRef === \"function\") {\n externalRef(element)\n } else if (externalRef) {\n ;(\n externalRef as React.MutableRefObject<Element | null>\n ).current = element\n }\n }\n\n /**\n * Disable browser scroll anchoring on the group container.\n * When items reorder, scroll anchoring can cause the browser to adjust\n * the scroll position, which interferes with drag position calculations.\n */\n const groupStyle = {\n overflowAnchor: \"none\" as const,\n ...props.style,\n }\n\n return (\n <Component {...props} style={groupStyle} ref={setRef} ignoreStrict>\n <ReorderContext.Provider value={context}>\n {children}\n </ReorderContext.Provider>\n </Component>\n )\n}\n\nexport const ReorderGroup = /*@__PURE__*/ forwardRef(ReorderGroupComponent) as <\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n props: ReorderGroupProps<V, TagName> & { ref?: React.ForwardedRef<any> }\n) => ReturnType<typeof ReorderGroupComponent>\n\nfunction compareMin<V>(a: ItemData<V>, b: ItemData<V>) {\n return a.layout.min - b.layout.min\n}\n"],"names":[],"mappings":";;;;;;;;;AAuEM;AAcF;;AAOA;AACA;;AAQA;;;AAGI;;AAEI;AACA;;;;AAGI;;AAEJ;;;;;AAKA;AAEA;AACI;;;;AAKA;AACA;AACI;AACI;AACA;;;;;;;;;;;;AAahB;AACJ;;AAGA;AACM;AACF;;;;AAIQ;;AAGZ;AAEA;;;;AAIG;AACH;AACI;;;AAIJ;AAOJ;AAEO;AAOP;;AAEA;;"} | ||
| {"version":3,"file":"Group.mjs","sources":["../../../../src/components/Reorder/Group.tsx"],"sourcesContent":["\"use client\"\n\nimport { invariant } from \"motion-utils\"\nimport * as React from \"react\"\nimport { forwardRef, FunctionComponent, JSX, useEffect, useRef } from \"react\"\nimport { ReorderContext } from \"../../context/ReorderContext\"\nimport { motion } from \"../../render/components/motion/proxy\"\nimport { HTMLMotionProps } from \"../../render/html/types\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport {\n DefaultGroupElement,\n ItemData,\n ReorderContextProps,\n ReorderElementTag,\n} from \"./types\"\nimport { checkReorder } from \"./utils/check-reorder\"\n\nexport interface Props<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> {\n /**\n * A HTML element to render this component as. Defaults to `\"ul\"`.\n *\n * @public\n */\n as?: TagName\n\n /**\n * The axis to reorder along. By default, items will be draggable on this axis.\n * To make draggable on both axes, set `<Reorder.Item drag />`\n *\n * @public\n */\n axis?: \"x\" | \"y\"\n\n /**\n * A callback to fire with the new value order. For instance, if the values\n * are provided as a state from `useState`, this could be the set state function.\n *\n * @public\n */\n onReorder: (newOrder: V[]) => void\n\n /**\n * The latest values state.\n *\n * ```jsx\n * function Component() {\n * const [items, setItems] = useState([0, 1, 2])\n *\n * return (\n * <Reorder.Group values={items} onReorder={setItems}>\n * {items.map((item) => <Reorder.Item key={item} value={item} />)}\n * </Reorder.Group>\n * )\n * }\n * ```\n *\n * @public\n */\n values: V[]\n}\n\ntype ReorderGroupProps<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> = Props<V, TagName> &\n Omit<HTMLMotionProps<TagName>, \"values\"> &\n React.PropsWithChildren<{}>\n\nexport function ReorderGroupComponent<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n {\n children,\n as = \"ul\" as TagName,\n axis = \"y\",\n onReorder,\n values,\n ...props\n }: ReorderGroupProps<V, TagName>,\n externalRef?: React.ForwardedRef<any>\n): JSX.Element {\n const Component = useConstant(\n () => motion[as as keyof typeof motion]\n ) as FunctionComponent<\n React.PropsWithChildren<HTMLMotionProps<any> & { ref?: React.Ref<any> }>\n >\n\n const order: ItemData<V>[] = []\n const isReordering = useRef(false)\n const groupRef = useRef<Element>(null)\n\n invariant(\n Boolean(values),\n \"Reorder.Group must be provided a values prop\",\n \"reorder-values\"\n )\n\n const context: ReorderContextProps<V> = {\n axis,\n groupRef,\n registerItem: (value, layout) => {\n // If the entry was already added, update it rather than adding it again\n const idx = order.findIndex((entry) => value === entry.value)\n if (idx !== -1) {\n order[idx].layout = layout[axis]\n } else {\n order.push({ value: value, layout: layout[axis] })\n }\n order.sort(compareMin)\n },\n updateOrder: (item, offset, velocity) => {\n if (isReordering.current) return\n\n const newOrder = checkReorder(order, item, offset, velocity)\n\n if (order !== newOrder) {\n isReordering.current = true\n\n // Find which two values swapped and apply that swap\n // to the full values array. This preserves unmeasured\n // items (e.g. in virtualized lists).\n const newValues = [...values]\n for (let i = 0; i < newOrder.length; i++) {\n if (order[i].value !== newOrder[i].value) {\n const a = values.indexOf(order[i].value)\n const b = values.indexOf(newOrder[i].value)\n if (a !== -1 && b !== -1) {\n ;[newValues[a], newValues[b]] = [newValues[b], newValues[a]]\n }\n break\n }\n }\n onReorder(newValues)\n }\n },\n }\n\n useEffect(() => {\n isReordering.current = false\n })\n\n // Combine refs if external ref is provided\n const setRef = (element: Element | null) => {\n ;(groupRef as React.MutableRefObject<Element | null>).current = element\n if (typeof externalRef === \"function\") {\n externalRef(element)\n } else if (externalRef) {\n ;(\n externalRef as React.MutableRefObject<Element | null>\n ).current = element\n }\n }\n\n /**\n * Disable browser scroll anchoring on the group container.\n * When items reorder, scroll anchoring can cause the browser to adjust\n * the scroll position, which interferes with drag position calculations.\n */\n const groupStyle = {\n overflowAnchor: \"none\" as const,\n ...props.style,\n }\n\n return (\n <Component {...props} style={groupStyle} ref={setRef} ignoreStrict>\n <ReorderContext.Provider value={context}>\n {children}\n </ReorderContext.Provider>\n </Component>\n )\n}\n\nexport const ReorderGroup = /*@__PURE__*/ forwardRef(ReorderGroupComponent) as <\n Values extends any[],\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n props: Omit<\n ReorderGroupProps<Values[number], TagName>,\n \"values\" | \"onReorder\"\n > & {\n values: Values\n onReorder: (newOrder: Values) => void\n } & { ref?: React.ForwardedRef<any> }\n) => ReturnType<typeof ReorderGroupComponent>\n\nfunction compareMin<V>(a: ItemData<V>, b: ItemData<V>) {\n return a.layout.min - b.layout.min\n}\n"],"names":[],"mappings":";;;;;;;;;AAuEM;AAcF;;AAOA;AACA;;AAQA;;;AAGI;;AAEI;AACA;;;;AAGI;;AAEJ;;;;;AAKA;AAEA;AACI;;;;AAKA;AACA;AACI;AACI;AACA;;;;;;;;;;;;AAahB;AACJ;;AAGA;AACM;AACF;;;;AAIQ;;AAGZ;AAEA;;;;AAIG;AACH;AACI;;;AAIJ;AAOJ;AAEO;AAaP;;AAEA;;"} |
@@ -267,2 +267,16 @@ import { createBox, frame, eachAxis, measurePageBox, convertBoxToBoundingBox, convertBoundingBoxToBox, addValueToWillChange, animateMotionValue, mixNumber, addDomEvent, setDragLock, percent, calcLength, resize, isElementTextInput } from 'motion-dom'; | ||
| return false; | ||
| /** | ||
| * Refresh the root scroll offset so the constraint's viewport box | ||
| * translates to correct page coordinates. The scroll captured at | ||
| * drag mount can be stale if the document was scrolled afterwards — | ||
| * e.g. via the browser restoring scroll on refresh, or an ancestor | ||
| * layout effect running after this element's mount (#2829). | ||
| * | ||
| * Clear the cached scroll first so `updateScroll` bypasses its | ||
| * per-animationId cache and re-reads the live value. | ||
| */ | ||
| if (projection.root) { | ||
| projection.root.scroll = undefined; | ||
| projection.root.updateScroll(); | ||
| } | ||
| const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint()); | ||
@@ -341,5 +355,3 @@ let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox); | ||
| ? externalMotionValue | ||
| : this.visualElement.getValue(axis, (props.initial | ||
| ? props.initial[axis] | ||
| : undefined) || 0); | ||
| : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0); | ||
| } | ||
@@ -346,0 +358,0 @@ snapToCursor(point) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"VisualElementDragControls.mjs","sources":["../../../../src/gestures/drag/VisualElementDragControls.ts"],"sourcesContent":["import {\n addValueToWillChange,\n animateMotionValue,\n calcLength,\n convertBoundingBoxToBox,\n convertBoxToBoundingBox,\n createBox,\n eachAxis,\n frame,\n isElementTextInput,\n measurePageBox,\n mixNumber,\n PanInfo,\n percent,\n ResolvedConstraints,\n resize,\n setDragLock,\n Transition,\n type VisualElement,\n} from \"motion-dom\"\nimport { Axis, Point, invariant } from \"motion-utils\"\nimport { addDomEvent, type LayoutUpdateData } from \"motion-dom\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { PanSession } from \"../pan/PanSession\"\nimport {\n applyConstraints,\n calcOrigin,\n calcRelativeConstraints,\n calcViewportConstraints,\n defaultElastic,\n rebaseAxisConstraints,\n resolveDragElastic,\n} from \"./utils/constraints\"\n\nexport const elementDragControls = new WeakMap<\n VisualElement,\n VisualElementDragControls\n>()\n\nexport interface DragControlOptions {\n /**\n * This distance after which dragging starts and a direction is locked in.\n *\n * @public\n */\n distanceThreshold?: number\n\n /**\n * Whether to immediately snap to the cursor when dragging starts.\n *\n * @public\n */\n snapToCursor?: boolean\n}\n\ntype DragDirection = \"x\" | \"y\"\n\nexport class VisualElementDragControls {\n private visualElement: VisualElement<HTMLElement>\n\n private panSession?: PanSession\n\n private openDragLock: VoidFunction | null = null\n\n isDragging = false\n private currentDirection: DragDirection | null = null\n\n private originPoint: Point = { x: 0, y: 0 }\n\n /**\n * The permitted boundaries of travel, in pixels.\n */\n private constraints: ResolvedConstraints | false = false\n\n private hasMutatedConstraints = false\n\n /**\n * The per-axis resolved elastic values.\n */\n private elastic = createBox()\n\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPointerEvent: PointerEvent | null = null\n\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPanInfo: PanInfo | null = null\n\n constructor(visualElement: VisualElement<HTMLElement>) {\n this.visualElement = visualElement\n }\n\n start(\n originEvent: PointerEvent,\n { snapToCursor = false, distanceThreshold }: DragControlOptions = {}\n ) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement\n if (presenceContext && presenceContext.isPresent === false) return\n\n const onSessionStart = (event: PointerEvent) => {\n if (snapToCursor) {\n this.snapToCursor(extractEventInfo(event).point)\n }\n this.stopAnimation()\n }\n\n const onStart = (event: PointerEvent, info: PanInfo) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps()\n\n if (drag && !dragPropagation) {\n if (this.openDragLock) this.openDragLock()\n\n this.openDragLock = setDragLock(drag)\n\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock) return\n }\n\n this.latestPointerEvent = event\n this.latestPanInfo = info\n this.isDragging = true\n\n this.currentDirection = null\n\n this.resolveConstraints()\n\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true\n this.visualElement.projection.target = undefined\n }\n\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0\n\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n const { projection } = this.visualElement\n\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis]\n\n if (measuredAxis) {\n const length = calcLength(measuredAxis)\n current = length * (parseFloat(current) / 100)\n }\n }\n }\n\n this.originPoint[axis] = current\n })\n\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true)\n }\n\n addValueToWillChange(this.visualElement, \"transform\")\n\n const { animationState } = this.visualElement\n animationState && animationState.setActive(\"whileDrag\", true)\n }\n\n const onMove = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n const {\n dragPropagation,\n dragDirectionLock,\n onDirectionLock,\n onDrag,\n } = this.getProps()\n\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock) return\n\n const { offset } = info\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset)\n\n // If we've successfully set a direction, notify listener\n if (this.currentDirection !== null) {\n onDirectionLock && onDirectionLock(this.currentDirection)\n }\n\n return\n }\n\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset)\n this.updateAxis(\"y\", info.point, offset)\n\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render()\n\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true)\n }\n }\n\n const onSessionEnd = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n this.stop(event, info)\n\n this.latestPointerEvent = null\n this.latestPanInfo = null\n }\n\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps()\n if (snap || this.constraints) {\n this.startAnimation({ x: 0, y: 0 })\n }\n }\n\n const { dragSnapToOrigin } = this.getProps()\n this.panSession = new PanSession(\n originEvent,\n {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n },\n {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: getContextWindow(this.visualElement),\n element: this.visualElement.current,\n }\n )\n }\n\n /**\n * @internal\n */\n stop(event?: PointerEvent, panInfo?: PanInfo) {\n const finalEvent = event || this.latestPointerEvent\n const finalPanInfo = panInfo || this.latestPanInfo\n\n const isDragging = this.isDragging\n this.cancel()\n if (!isDragging || !finalPanInfo || !finalEvent) return\n\n const { velocity } = finalPanInfo\n this.startAnimation(velocity)\n\n const { onDragEnd } = this.getProps()\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo))\n }\n }\n\n /**\n * @internal\n */\n cancel() {\n this.isDragging = false\n\n const { projection, animationState } = this.visualElement\n\n if (projection) {\n projection.isAnimationBlocked = false\n }\n\n this.endPanSession()\n\n const { dragPropagation } = this.getProps()\n\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock()\n this.openDragLock = null\n }\n\n animationState && animationState.setActive(\"whileDrag\", false)\n }\n\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n * @internal\n */\n endPanSession() {\n this.panSession && this.panSession.end()\n this.panSession = undefined\n }\n\n private updateAxis(axis: DragDirection, _point: Point, offset?: Point) {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return\n\n const axisValue = this.getAxisMotionValue(axis)\n let next = this.originPoint[axis] + offset[axis]\n\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(\n next,\n this.constraints[axis],\n this.elastic[axis]\n )\n }\n\n axisValue.set(next)\n }\n\n private resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps()\n\n const layout =\n this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout\n\n const prevConstraints = this.constraints\n\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints()\n }\n } else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(\n layout.layoutBox,\n dragConstraints\n )\n } else {\n this.constraints = false\n }\n }\n\n this.elastic = resolveDragElastic(dragElastic)\n\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (\n prevConstraints !== this.constraints &&\n !isRefObject(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints\n ) {\n eachAxis((axis) => {\n if (\n this.constraints !== false &&\n this.getAxisMotionValue(axis)\n ) {\n this.constraints[axis] = rebaseAxisConstraints(\n layout.layoutBox[axis],\n this.constraints[axis]\n )\n }\n })\n }\n }\n\n private resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } =\n this.getProps()\n if (!constraints || !isRefObject(constraints)) return false\n\n const constraintsElement = constraints.current as HTMLElement\n\n invariant(\n constraintsElement !== null,\n \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\",\n \"drag-constraints-ref\"\n )\n\n const { projection } = this.visualElement\n\n // TODO\n if (!projection || !projection.layout) return false\n\n const constraintsBox = measurePageBox(\n constraintsElement,\n projection.root!,\n this.visualElement.getTransformPagePoint()\n )\n\n let measuredConstraints = calcViewportConstraints(\n projection.layout.layoutBox,\n constraintsBox\n )\n\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(\n convertBoxToBoundingBox(measuredConstraints)\n )\n\n this.hasMutatedConstraints = !!userConstraints\n\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints)\n }\n }\n\n return measuredConstraints\n }\n\n private startAnimation(velocity: Point) {\n const {\n drag,\n dragMomentum,\n dragElastic,\n dragTransition,\n dragSnapToOrigin,\n onDragTransitionEnd,\n } = this.getProps()\n\n const constraints: Partial<ResolvedConstraints> = this.constraints || {}\n\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection)) {\n return\n }\n\n let transition = (constraints && constraints[axis]) || {}\n\n if (\n dragSnapToOrigin === true ||\n (dragSnapToOrigin as unknown) === axis\n )\n transition = { min: 0, max: 0 }\n\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000\n const bounceDamping = dragElastic ? 40 : 10000000\n\n const inertia: Transition = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n }\n\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia)\n })\n\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd)\n }\n\n private startAxisValueAnimation(\n axis: DragDirection,\n transition: Transition\n ) {\n const axisValue = this.getAxisMotionValue(axis)\n\n addValueToWillChange(this.visualElement, axis)\n\n return axisValue.start(\n animateMotionValue(\n axis,\n axisValue,\n 0,\n transition,\n this.visualElement,\n false\n )\n )\n }\n\n private stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop())\n }\n\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n private getAxisMotionValue(axis: DragDirection) {\n const dragKey =\n `_drag${axis.toUpperCase()}` as `_drag${Uppercase<DragDirection>}`\n const props = this.visualElement.getProps()\n const externalMotionValue = props[dragKey]\n\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(\n axis,\n (props.initial\n ? props.initial[axis as keyof typeof props.initial]\n : undefined) || 0\n )\n }\n\n private snapToCursor(point: Point) {\n eachAxis((axis) => {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, this.currentDirection)) return\n\n const { projection } = this.visualElement\n const axisValue = this.getAxisMotionValue(axis)\n\n if (projection && projection.layout) {\n const { min, max } = projection.layout.layoutBox[axis]\n\n /**\n * The layout measurement includes the current transform value,\n * so we need to add it back to get the correct snap position.\n * This fixes an issue where elements with initial coordinates\n * would snap to the wrong position on the first drag.\n */\n const current = axisValue.get() || 0\n\n axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current)\n }\n })\n }\n\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current) return\n\n const { drag, dragConstraints } = this.getProps()\n const { projection } = this.visualElement\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return\n\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation()\n\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const boxProgress = { x: 0, y: 0 }\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis)\n if (axisValue && this.constraints !== false) {\n const latest = axisValue.get()\n boxProgress[axis] = calcOrigin(\n { min: latest, max: latest },\n this.constraints[axis] as Axis\n )\n }\n })\n\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps()\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\"\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false\n this.resolveConstraints()\n\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, null)) return\n\n /**\n * Calculate a new transform based on the previous box progress\n */\n const axisValue = this.getAxisMotionValue(axis)\n const { min, max } = (this.constraints as ResolvedConstraints)[\n axis\n ] as Axis\n axisValue.set(mixNumber(min, max, boxProgress[axis]))\n })\n\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render()\n }\n\n addListeners() {\n if (!this.visualElement.current) return\n elementDragControls.set(this.visualElement, this)\n const element = this.visualElement.current\n\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(\n element,\n \"pointerdown\",\n (event) => {\n const { drag, dragListener = true } = this.getProps()\n const target = event.target as Element\n\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild =\n target !== element && isElementTextInput(target)\n\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event)\n }\n }\n )\n\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers: VoidFunction | undefined\n\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps()\n if (isRefObject(dragConstraints) && dragConstraints.current) {\n this.constraints = this.resolveRefConstraints()\n\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(\n element,\n dragConstraints.current as HTMLElement,\n () => this.scalePositionWithinConstraints()\n )\n }\n }\n }\n\n const { projection } = this.visualElement\n\n const stopMeasureLayoutListener = projection!.addEventListener(\n \"measure\",\n measureDragConstraints\n )\n\n if (projection && !projection!.layout) {\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n }\n\n frame.read(measureDragConstraints)\n\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () =>\n this.scalePositionWithinConstraints()\n )\n\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection!.addEventListener(\n \"didUpdate\",\n (({ delta, hasLayoutChanged }: LayoutUpdateData) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n const motionValue = this.getAxisMotionValue(axis)\n if (!motionValue) return\n\n this.originPoint[axis] += delta[axis].translate\n motionValue.set(\n motionValue.get() + delta[axis].translate\n )\n })\n\n this.visualElement.render()\n }\n }) as any\n )\n\n return () => {\n stopResizeListener()\n stopPointerListener()\n stopMeasureLayoutListener()\n stopLayoutUpdateListener && stopLayoutUpdateListener()\n stopResizeObservers && stopResizeObservers()\n }\n }\n\n getProps(): MotionProps {\n const props = this.visualElement.getProps()\n const {\n drag = false,\n dragDirectionLock = false,\n dragPropagation = false,\n dragConstraints = false,\n dragElastic = defaultElastic,\n dragMomentum = true,\n } = props\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n }\n }\n}\n\nfunction skipFirstCall(callback: VoidFunction): VoidFunction {\n let isFirst = true\n return () => {\n if (isFirst) {\n isFirst = false\n return\n }\n callback()\n }\n}\n\nfunction startResizeObservers(\n element: HTMLElement,\n constraintsElement: HTMLElement,\n onResize: VoidFunction\n): VoidFunction {\n const stopElement = resize(element, skipFirstCall(onResize))\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize))\n return () => {\n stopElement()\n stopContainer()\n }\n}\n\nfunction shouldDrag(\n direction: DragDirection,\n drag: boolean | DragDirection | undefined,\n currentDirection: null | DragDirection\n) {\n return (\n (drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction)\n )\n}\n\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(\n offset: Point,\n lockThreshold = 10\n): DragDirection | null {\n let direction: DragDirection | null = null\n\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\"\n } else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\"\n }\n\n return direction\n}\n\nexport function expectsResolvedDragConstraints({\n dragConstraints,\n onMeasureDragConstraints,\n}: MotionProps) {\n return isRefObject(dragConstraints) && !!onMeasureDragConstraints\n}\n"],"names":[],"mappings":";;;;;;;;;AAsCO,MAAM,mBAAmB,GAAG,IAAI,OAAO;MAuBjC,yBAAyB,CAAA;AAkClC,IAAA,WAAA,CAAY,aAAyC,EAAA;QA7B7C,IAAA,CAAA,YAAY,GAAwB,IAAI;QAEhD,IAAA,CAAA,UAAU,GAAG,KAAK;QACV,IAAA,CAAA,gBAAgB,GAAyB,IAAI;QAE7C,IAAA,CAAA,WAAW,GAAU,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAE3C;;AAEG;QACK,IAAA,CAAA,WAAW,GAAgC,KAAK;QAEhD,IAAA,CAAA,qBAAqB,GAAG,KAAK;AAErC;;AAEG;QACK,IAAA,CAAA,OAAO,GAAG,SAAS,EAAE;AAE7B;;AAEG;QACK,IAAA,CAAA,kBAAkB,GAAwB,IAAI;AAEtD;;AAEG;QACK,IAAA,CAAA,aAAa,GAAmB,IAAI;AAGxC,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa;IACtC;IAEA,KAAK,CACD,WAAyB,EACzB,EAAE,YAAY,GAAG,KAAK,EAAE,iBAAiB,EAAA,GAAyB,EAAE,EAAA;AAEpE;;AAEG;AACH,QAAA,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,aAAa;AAC9C,QAAA,IAAI,eAAe,IAAI,eAAe,CAAC,SAAS,KAAK,KAAK;YAAE;AAE5D,QAAA,MAAM,cAAc,GAAG,CAAC,KAAmB,KAAI;YAC3C,IAAI,YAAY,EAAE;gBACd,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;YACpD;YACA,IAAI,CAAC,aAAa,E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MAAM,aAAa,GAAG,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;AACzE,IAAA,OAAO,MAAK;AACR,QAAA,WAAW,EAAE;AACb,QAAA,aAAa,EAAE;AACnB,IAAA,CAAC;AACL;AAEA,SAAS,UAAU,CACf,SAAwB,EACxB,IAAyC,EACzC,gBAAsC,EAAA;IAEtC,QACI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;SACnC,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,SAAS,CAAC;AAErE;AAEA;;;;;;AAMG;AACH,SAAS,mBAAmB,CACxB,MAAa,EACb,aAAa,GAAG,EAAE,EAAA;IAElB,IAAI,SAAS,GAAyB,IAAI;IAE1C,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QACpC,SAAS,GAAG,GAAG;IACnB;SAAO,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QAC3C,SAAS,GAAG,GAAG;IACnB;AAEA,IAAA,OAAO,SAAS;AACpB;;;;"} | ||
| {"version":3,"file":"VisualElementDragControls.mjs","sources":["../../../../src/gestures/drag/VisualElementDragControls.ts"],"sourcesContent":["import {\n addValueToWillChange,\n animateMotionValue,\n calcLength,\n convertBoundingBoxToBox,\n convertBoxToBoundingBox,\n createBox,\n eachAxis,\n frame,\n isElementTextInput,\n measurePageBox,\n mixNumber,\n PanInfo,\n percent,\n ResolvedConstraints,\n resize,\n setDragLock,\n Transition,\n type VisualElement,\n} from \"motion-dom\"\nimport { Axis, Point, invariant } from \"motion-utils\"\nimport { addDomEvent, type LayoutUpdateData } from \"motion-dom\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { PanSession } from \"../pan/PanSession\"\nimport {\n applyConstraints,\n calcOrigin,\n calcRelativeConstraints,\n calcViewportConstraints,\n defaultElastic,\n rebaseAxisConstraints,\n resolveDragElastic,\n} from \"./utils/constraints\"\n\nexport const elementDragControls = new WeakMap<\n VisualElement,\n VisualElementDragControls\n>()\n\nexport interface DragControlOptions {\n /**\n * This distance after which dragging starts and a direction is locked in.\n *\n * @public\n */\n distanceThreshold?: number\n\n /**\n * Whether to immediately snap to the cursor when dragging starts.\n *\n * @public\n */\n snapToCursor?: boolean\n}\n\ntype DragDirection = \"x\" | \"y\"\n\nexport class VisualElementDragControls {\n private visualElement: VisualElement<HTMLElement>\n\n private panSession?: PanSession\n\n private openDragLock: VoidFunction | null = null\n\n isDragging = false\n private currentDirection: DragDirection | null = null\n\n private originPoint: Point = { x: 0, y: 0 }\n\n /**\n * The permitted boundaries of travel, in pixels.\n */\n private constraints: ResolvedConstraints | false = false\n\n private hasMutatedConstraints = false\n\n /**\n * The per-axis resolved elastic values.\n */\n private elastic = createBox()\n\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPointerEvent: PointerEvent | null = null\n\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPanInfo: PanInfo | null = null\n\n constructor(visualElement: VisualElement<HTMLElement>) {\n this.visualElement = visualElement\n }\n\n start(\n originEvent: PointerEvent,\n { snapToCursor = false, distanceThreshold }: DragControlOptions = {}\n ) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement\n if (presenceContext && presenceContext.isPresent === false) return\n\n const onSessionStart = (event: PointerEvent) => {\n if (snapToCursor) {\n this.snapToCursor(extractEventInfo(event).point)\n }\n this.stopAnimation()\n }\n\n const onStart = (event: PointerEvent, info: PanInfo) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps()\n\n if (drag && !dragPropagation) {\n if (this.openDragLock) this.openDragLock()\n\n this.openDragLock = setDragLock(drag)\n\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock) return\n }\n\n this.latestPointerEvent = event\n this.latestPanInfo = info\n this.isDragging = true\n\n this.currentDirection = null\n\n this.resolveConstraints()\n\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true\n this.visualElement.projection.target = undefined\n }\n\n /**\n * Record gesture origin and pointer offset\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0\n\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n const { projection } = this.visualElement\n\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis]\n\n if (measuredAxis) {\n const length = calcLength(measuredAxis)\n current = length * (parseFloat(current) / 100)\n }\n }\n }\n\n this.originPoint[axis] = current\n })\n\n // Fire onDragStart event\n if (onDragStart) {\n frame.update(() => onDragStart(event, info), false, true)\n }\n\n addValueToWillChange(this.visualElement, \"transform\")\n\n const { animationState } = this.visualElement\n animationState && animationState.setActive(\"whileDrag\", true)\n }\n\n const onMove = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n const {\n dragPropagation,\n dragDirectionLock,\n onDirectionLock,\n onDrag,\n } = this.getProps()\n\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock) return\n\n const { offset } = info\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset)\n\n // If we've successfully set a direction, notify listener\n if (this.currentDirection !== null) {\n onDirectionLock && onDirectionLock(this.currentDirection)\n }\n\n return\n }\n\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset)\n this.updateAxis(\"y\", info.point, offset)\n\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render()\n\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n if (onDrag) {\n frame.update(() => onDrag(event, info), false, true)\n }\n }\n\n const onSessionEnd = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n this.stop(event, info)\n\n this.latestPointerEvent = null\n this.latestPanInfo = null\n }\n\n const resumeAnimation = () => {\n const { dragSnapToOrigin: snap } = this.getProps()\n if (snap || this.constraints) {\n this.startAnimation({ x: 0, y: 0 })\n }\n }\n\n const { dragSnapToOrigin } = this.getProps()\n this.panSession = new PanSession(\n originEvent,\n {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n },\n {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: getContextWindow(this.visualElement),\n element: this.visualElement.current,\n }\n )\n }\n\n /**\n * @internal\n */\n stop(event?: PointerEvent, panInfo?: PanInfo) {\n const finalEvent = event || this.latestPointerEvent\n const finalPanInfo = panInfo || this.latestPanInfo\n\n const isDragging = this.isDragging\n this.cancel()\n if (!isDragging || !finalPanInfo || !finalEvent) return\n\n const { velocity } = finalPanInfo\n this.startAnimation(velocity)\n\n const { onDragEnd } = this.getProps()\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo))\n }\n }\n\n /**\n * @internal\n */\n cancel() {\n this.isDragging = false\n\n const { projection, animationState } = this.visualElement\n\n if (projection) {\n projection.isAnimationBlocked = false\n }\n\n this.endPanSession()\n\n const { dragPropagation } = this.getProps()\n\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock()\n this.openDragLock = null\n }\n\n animationState && animationState.setActive(\"whileDrag\", false)\n }\n\n /**\n * Clean up the pan session without modifying other drag state.\n * This is used during unmount to ensure event listeners are removed\n * without affecting projection animations or drag locks.\n * @internal\n */\n endPanSession() {\n this.panSession && this.panSession.end()\n this.panSession = undefined\n }\n\n private updateAxis(axis: DragDirection, _point: Point, offset?: Point) {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return\n\n const axisValue = this.getAxisMotionValue(axis)\n let next = this.originPoint[axis] + offset[axis]\n\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(\n next,\n this.constraints[axis],\n this.elastic[axis]\n )\n }\n\n axisValue.set(next)\n }\n\n private resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps()\n\n const layout =\n this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout\n\n const prevConstraints = this.constraints\n\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints()\n }\n } else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(\n layout.layoutBox,\n dragConstraints\n )\n } else {\n this.constraints = false\n }\n }\n\n this.elastic = resolveDragElastic(dragElastic)\n\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative. This only applies to relative (non-ref)\n * constraints, as ref-based constraints from calcViewportConstraints are already in the\n * correct coordinate space for the motion value transform offset.\n */\n if (\n prevConstraints !== this.constraints &&\n !isRefObject(dragConstraints) &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints\n ) {\n eachAxis((axis) => {\n if (\n this.constraints !== false &&\n this.getAxisMotionValue(axis)\n ) {\n this.constraints[axis] = rebaseAxisConstraints(\n layout.layoutBox[axis],\n this.constraints[axis]\n )\n }\n })\n }\n }\n\n private resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } =\n this.getProps()\n if (!constraints || !isRefObject(constraints)) return false\n\n const constraintsElement = constraints.current as HTMLElement\n\n invariant(\n constraintsElement !== null,\n \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\",\n \"drag-constraints-ref\"\n )\n\n const { projection } = this.visualElement\n\n // TODO\n if (!projection || !projection.layout) return false\n\n /**\n * Refresh the root scroll offset so the constraint's viewport box\n * translates to correct page coordinates. The scroll captured at\n * drag mount can be stale if the document was scrolled afterwards —\n * e.g. via the browser restoring scroll on refresh, or an ancestor\n * layout effect running after this element's mount (#2829).\n *\n * Clear the cached scroll first so `updateScroll` bypasses its\n * per-animationId cache and re-reads the live value.\n */\n if (projection.root) {\n projection.root.scroll = undefined\n projection.root.updateScroll()\n }\n\n const constraintsBox = measurePageBox(\n constraintsElement,\n projection.root!,\n this.visualElement.getTransformPagePoint()\n )\n\n let measuredConstraints = calcViewportConstraints(\n projection.layout.layoutBox,\n constraintsBox\n )\n\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(\n convertBoxToBoundingBox(measuredConstraints)\n )\n\n this.hasMutatedConstraints = !!userConstraints\n\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints)\n }\n }\n\n return measuredConstraints\n }\n\n private startAnimation(velocity: Point) {\n const {\n drag,\n dragMomentum,\n dragElastic,\n dragTransition,\n dragSnapToOrigin,\n onDragTransitionEnd,\n } = this.getProps()\n\n const constraints: Partial<ResolvedConstraints> = this.constraints || {}\n\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection)) {\n return\n }\n\n let transition = (constraints && constraints[axis]) || {}\n\n if (\n dragSnapToOrigin === true ||\n (dragSnapToOrigin as unknown) === axis\n )\n transition = { min: 0, max: 0 }\n\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000\n const bounceDamping = dragElastic ? 40 : 10000000\n\n const inertia: Transition = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n }\n\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia)\n })\n\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd)\n }\n\n private startAxisValueAnimation(\n axis: DragDirection,\n transition: Transition\n ) {\n const axisValue = this.getAxisMotionValue(axis)\n\n addValueToWillChange(this.visualElement, axis)\n\n return axisValue.start(\n animateMotionValue(\n axis,\n axisValue,\n 0,\n transition,\n this.visualElement,\n false\n )\n )\n }\n\n private stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop())\n }\n\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n private getAxisMotionValue(axis: DragDirection) {\n const dragKey =\n `_drag${axis.toUpperCase()}` as `_drag${Uppercase<DragDirection>}`\n const props = this.visualElement.getProps()\n const externalMotionValue = props[dragKey]\n\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(\n axis,\n this.visualElement.latestValues[axis] ?? 0\n )\n }\n\n private snapToCursor(point: Point) {\n eachAxis((axis) => {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, this.currentDirection)) return\n\n const { projection } = this.visualElement\n const axisValue = this.getAxisMotionValue(axis)\n\n if (projection && projection.layout) {\n const { min, max } = projection.layout.layoutBox[axis]\n\n /**\n * The layout measurement includes the current transform value,\n * so we need to add it back to get the correct snap position.\n * This fixes an issue where elements with initial coordinates\n * would snap to the wrong position on the first drag.\n */\n const current = axisValue.get() || 0\n\n axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current)\n }\n })\n }\n\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current) return\n\n const { drag, dragConstraints } = this.getProps()\n const { projection } = this.visualElement\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return\n\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation()\n\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const boxProgress = { x: 0, y: 0 }\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis)\n if (axisValue && this.constraints !== false) {\n const latest = axisValue.get()\n boxProgress[axis] = calcOrigin(\n { min: latest, max: latest },\n this.constraints[axis] as Axis\n )\n }\n })\n\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps()\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\"\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n\n /**\n * Reset constraints so resolveConstraints() will recalculate them\n * with the freshly measured layout rather than returning the cached value.\n */\n this.constraints = false\n this.resolveConstraints()\n\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, null)) return\n\n /**\n * Calculate a new transform based on the previous box progress\n */\n const axisValue = this.getAxisMotionValue(axis)\n const { min, max } = (this.constraints as ResolvedConstraints)[\n axis\n ] as Axis\n axisValue.set(mixNumber(min, max, boxProgress[axis]))\n })\n\n /**\n * Flush the updated transform to the DOM synchronously to prevent\n * a visual flash at the element's CSS layout position (0,0) when\n * the transform was stripped for measurement.\n */\n this.visualElement.render()\n }\n\n addListeners() {\n if (!this.visualElement.current) return\n elementDragControls.set(this.visualElement, this)\n const element = this.visualElement.current\n\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(\n element,\n \"pointerdown\",\n (event) => {\n const { drag, dragListener = true } = this.getProps()\n const target = event.target as Element\n\n /**\n * Only block drag if clicking on a text input child element\n * (input, textarea, select, contenteditable) where users might\n * want to select text or interact with the control.\n *\n * Buttons and links don't block drag since they don't have\n * click-and-move actions of their own.\n */\n const isClickingTextInputChild =\n target !== element && isElementTextInput(target)\n\n if (drag && dragListener && !isClickingTextInputChild) {\n this.start(event)\n }\n }\n )\n\n /**\n * If using ref-based constraints, observe both the draggable element\n * and the constraint container for size changes via ResizeObserver.\n * Setup is deferred because dragConstraints.current is null when\n * addListeners first runs (React hasn't committed the ref yet).\n */\n let stopResizeObservers: VoidFunction | undefined\n\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps()\n if (isRefObject(dragConstraints) && dragConstraints.current) {\n this.constraints = this.resolveRefConstraints()\n\n if (!stopResizeObservers) {\n stopResizeObservers = startResizeObservers(\n element,\n dragConstraints.current as HTMLElement,\n () => this.scalePositionWithinConstraints()\n )\n }\n }\n }\n\n const { projection } = this.visualElement\n\n const stopMeasureLayoutListener = projection!.addEventListener(\n \"measure\",\n measureDragConstraints\n )\n\n if (projection && !projection!.layout) {\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n }\n\n frame.read(measureDragConstraints)\n\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () =>\n this.scalePositionWithinConstraints()\n )\n\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection!.addEventListener(\n \"didUpdate\",\n (({ delta, hasLayoutChanged }: LayoutUpdateData) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n const motionValue = this.getAxisMotionValue(axis)\n if (!motionValue) return\n\n this.originPoint[axis] += delta[axis].translate\n motionValue.set(\n motionValue.get() + delta[axis].translate\n )\n })\n\n this.visualElement.render()\n }\n }) as any\n )\n\n return () => {\n stopResizeListener()\n stopPointerListener()\n stopMeasureLayoutListener()\n stopLayoutUpdateListener && stopLayoutUpdateListener()\n stopResizeObservers && stopResizeObservers()\n }\n }\n\n getProps(): MotionProps {\n const props = this.visualElement.getProps()\n const {\n drag = false,\n dragDirectionLock = false,\n dragPropagation = false,\n dragConstraints = false,\n dragElastic = defaultElastic,\n dragMomentum = true,\n } = props\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n }\n }\n}\n\nfunction skipFirstCall(callback: VoidFunction): VoidFunction {\n let isFirst = true\n return () => {\n if (isFirst) {\n isFirst = false\n return\n }\n callback()\n }\n}\n\nfunction startResizeObservers(\n element: HTMLElement,\n constraintsElement: HTMLElement,\n onResize: VoidFunction\n): VoidFunction {\n const stopElement = resize(element, skipFirstCall(onResize))\n const stopContainer = resize(constraintsElement, skipFirstCall(onResize))\n return () => {\n stopElement()\n stopContainer()\n }\n}\n\nfunction shouldDrag(\n direction: DragDirection,\n drag: boolean | DragDirection | undefined,\n currentDirection: null | DragDirection\n) {\n return (\n (drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction)\n )\n}\n\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(\n offset: Point,\n lockThreshold = 10\n): DragDirection | null {\n let direction: DragDirection | null = null\n\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\"\n } else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\"\n }\n\n return direction\n}\n\nexport function expectsResolvedDragConstraints({\n dragConstraints,\n onMeasureDragConstraints,\n}: MotionProps) {\n return isRefObject(dragConstraints) && !!onMeasureDragConstraints\n}\n"],"names":[],"mappings":";;;;;;;;;AAsCO,MAAM,mBAAmB,GAAG,IAAI,OAAO;MAuBjC,yBAAyB,CAAA;AAkClC,IAAA,WAAA,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;AAEA,SAAS,UAAU,CACf,SAAwB,EACxB,IAAyC,EACzC,gBAAsC,EAAA;IAEtC,QACI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;SACnC,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,SAAS,CAAC;AAErE;AAEA;;;;;;AAMG;AACH,SAAS,mBAAmB,CACxB,MAAa,EACb,aAAa,GAAG,EAAE,EAAA;IAElB,IAAI,SAAS,GAAyB,IAAI;IAE1C,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QACpC,SAAS,GAAG,GAAG;IACnB;SAAO,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QAC3C,SAAS,GAAG,GAAG;IACnB;AAEA,IAAA,OAAO,SAAS;AACpB;;;;"} |
@@ -26,3 +26,6 @@ import { Feature, resolveVariant } from 'motion-dom'; | ||
| const { initial, custom } = this.node.getProps(); | ||
| if (typeof initial === "string") { | ||
| if (typeof initial === "string" || | ||
| (typeof initial === "object" && | ||
| initial !== null && | ||
| !Array.isArray(initial))) { | ||
| const resolved = resolveVariant(this.node, initial, custom); | ||
@@ -29,0 +32,0 @@ if (resolved) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"exit.mjs","sources":["../../../../../src/motion/features/animation/exit.ts"],"sourcesContent":["import { Feature, resolveVariant } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n private isExitComplete = false\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n if (isPresent && prevIsPresent === false) {\n /**\n * When re-entering, if the exit animation already completed\n * (element is at rest), reset to initial values so the enter\n * animation replays from the correct position.\n */\n if (this.isExitComplete) {\n const { initial, custom } = this.node.getProps()\n\n if (typeof initial === \"string\") {\n const resolved = resolveVariant(\n this.node,\n initial,\n custom\n )\n if (resolved) {\n const { transition, transitionEnd, ...target } =\n resolved\n for (const key in target) {\n this.node\n .getValue(key)\n ?.jump(\n target[\n key as keyof typeof target\n ] as any\n )\n }\n }\n }\n\n this.node.animationState.reset()\n this.node.animationState.animateChanges()\n } else {\n this.node.animationState.setActive(\"exit\", false)\n }\n\n this.isExitComplete = false\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n this.isExitComplete = true\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;AAEA,IAAI,EAAE,GAAG,CAAC;AAEJ,MAAO,oBAAqB,SAAQ,OAAgB,CAAA;AAA1D,IAAA,WAAA,GAAA;;QACY,IAAA,CAAA,EAAE,GAAW,EAAE,EAAE;QACjB,IAAA,CAAA,cAAc,GAAG,KAAK;IA8ElC;IA5EI,MAAM,GAAA;AACF,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE;QAEhC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe;AAC/D,QAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE;QAExE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,SAAS,KAAK,aAAa,EAAE;YAC1D;QACJ;AAEA,QAAA,IAAI,SAAS,IAAI,aAAa,KAAK,KAAK,EAAE;AACtC;;;;AAIG;AACH,YAAA,IAAI,IAAI,CAAC,cAAc,EAAE;AACrB,g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AAc,EAAE;AAChB,YAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B;QAEA,IAAI,QAAQ,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC;IACJ;AAEA,IAAA,OAAO,KAAI;AACd;;;;"} | ||
| {"version":3,"file":"exit.mjs","sources":["../../../../../src/motion/features/animation/exit.ts"],"sourcesContent":["import { Feature, resolveVariant } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n private isExitComplete = false\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n if (isPresent && prevIsPresent === false) {\n /**\n * When re-entering, if the exit animation already completed\n * (element is at rest), reset to initial values so the enter\n * animation replays from the correct position.\n */\n if (this.isExitComplete) {\n const { initial, custom } = this.node.getProps()\n\n if (\n typeof initial === \"string\" ||\n (typeof initial === \"object\" &&\n initial !== null &&\n !Array.isArray(initial))\n ) {\n const resolved = resolveVariant(\n this.node,\n initial,\n custom\n )\n if (resolved) {\n const { transition, transitionEnd, ...target } =\n resolved\n for (const key in target) {\n this.node\n .getValue(key)\n ?.jump(\n target[\n key as keyof typeof target\n ] as any\n )\n }\n }\n }\n\n this.node.animationState.reset()\n this.node.animationState.animateChanges()\n } else {\n this.node.animationState.setActive(\"exit\", false)\n }\n\n this.isExitComplete = false\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n this.isExitComplete = true\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unm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AAI,CACF,MAAM,CACF,GAA0B,CACtB,CACX;wBACT;oBACJ;gBACJ;AAEA,gBAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE;AAChC,gBAAA,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE;YAC7C;iBAAO;gBACH,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC;YACrD;AAEA,YAAA,IAAI,CAAC,cAAc,GAAG,KAAK;YAC3B;QACJ;AAEA,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CACpD,MAAM,EACN,CAAC,SAAS,CACb;AAED,QAAA,IAAI,cAAc,IAAI,CAAC,SAAS,EAAE;AAC9B,YAAA,aAAa,CAAC,IAAI,CAAC,MAAK;AACpB,gBAAA,IAAI,CAAC,cAAc,GAAG,IAAI;AAC1B,gBAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3B,YAAA,CAAC,CAAC;QACN;IACJ;IAEA,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE;QAEpE,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B;QAEA,IAAI,QAAQ,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC;IACJ;AAEA,IAAA,OAAO,KAAI;AACd;;;;"} |
@@ -26,2 +26,5 @@ "use client"; | ||
| } | ||
| if (visualElement) { | ||
| instance ? visualElement.mount(instance) : visualElement.unmount(); | ||
| } | ||
| const ref = externalRefContainer.current; | ||
@@ -46,5 +49,2 @@ if (typeof ref === "function") { | ||
| } | ||
| if (visualElement) { | ||
| instance ? visualElement.mount(instance) : visualElement.unmount(); | ||
| } | ||
| }, [visualElement]); | ||
@@ -51,0 +51,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"use-motion-ref.mjs","sources":["../../../../src/motion/utils/use-motion-ref.ts"],"sourcesContent":["\"use client\"\n\nimport type { VisualElement } from \"motion-dom\"\nimport * as React from \"react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\nimport { VisualState } from \"./use-visual-state\"\n\n/**\n * Creates a ref function that, when called, hydrates the provided\n * external ref and VisualElement.\n */\nexport function useMotionRef<Instance, RenderState>(\n visualState: VisualState<Instance, RenderState>,\n visualElement?: VisualElement<Instance> | null,\n externalRef?: React.Ref<Instance>\n): React.Ref<Instance> {\n /**\n * Store externalRef in a ref to avoid including it in the useCallback\n * dependency array. Including externalRef in dependencies causes issues\n * with libraries like Radix UI that create new callback refs on each render\n * when using asChild - this would cause the callback to be recreated,\n * triggering element remounts and breaking AnimatePresence exit animations.\n */\n const externalRefContainer = useRef(externalRef)\n useInsertionEffect(() => {\n externalRefContainer.current = externalRef\n })\n\n // Store cleanup function returned by callback refs (React 19 feature)\n const refCleanup = useRef<(() => void) | null>(null)\n\n return useCallback(\n (instance: Instance) => {\n if (instance) {\n visualState.onMount?.(instance)\n }\n\n const ref = externalRefContainer.current\n if (typeof ref === \"function\") {\n if (instance) {\n const cleanup = ref(instance)\n if (typeof cleanup === \"function\") {\n refCleanup.current = cleanup\n }\n } else if (refCleanup.current) {\n refCleanup.current()\n refCleanup.current = null\n } else {\n ref(instance)\n }\n } else if (ref) {\n ;(ref as React.MutableRefObject<Instance>).current = instance\n }\n\n if (visualElement) {\n instance ? visualElement.mount(instance) : visualElement.unmount()\n }\n },\n [visualElement]\n )\n}\n"],"names":[],"mappings":";;;AAOA;;;AAGG;;AAMC;;;;;;AAMG;AACH;;AAEI;AACJ;;AAGA;AAEA;;AAGY;;AAGJ;AACA;;AAEQ;AACA;AACI;;;AAED;;AAEH;;;;;;;AAKF;;;AAIF;;AAER;AAGR;;"} | ||
| {"version":3,"file":"use-motion-ref.mjs","sources":["../../../../src/motion/utils/use-motion-ref.ts"],"sourcesContent":["\"use client\"\n\nimport type { VisualElement } from \"motion-dom\"\nimport * as React from \"react\"\nimport { useCallback, useInsertionEffect, useRef } from \"react\"\nimport { VisualState } from \"./use-visual-state\"\n\n/**\n * Creates a ref function that, when called, hydrates the provided\n * external ref and VisualElement.\n */\nexport function useMotionRef<Instance, RenderState>(\n visualState: VisualState<Instance, RenderState>,\n visualElement?: VisualElement<Instance> | null,\n externalRef?: React.Ref<Instance>\n): React.Ref<Instance> {\n /**\n * Store externalRef in a ref to avoid including it in the useCallback\n * dependency array. Including externalRef in dependencies causes issues\n * with libraries like Radix UI that create new callback refs on each render\n * when using asChild - this would cause the callback to be recreated,\n * triggering element remounts and breaking AnimatePresence exit animations.\n */\n const externalRefContainer = useRef(externalRef)\n useInsertionEffect(() => {\n externalRefContainer.current = externalRef\n })\n\n // Store cleanup function returned by callback refs (React 19 feature)\n const refCleanup = useRef<(() => void) | null>(null)\n\n return useCallback(\n (instance: Instance) => {\n if (instance) {\n visualState.onMount?.(instance)\n }\n\n if (visualElement) {\n instance ? visualElement.mount(instance) : visualElement.unmount()\n }\n\n const ref = externalRefContainer.current\n if (typeof ref === \"function\") {\n if (instance) {\n const cleanup = ref(instance)\n if (typeof cleanup === \"function\") {\n refCleanup.current = cleanup\n }\n } else if (refCleanup.current) {\n refCleanup.current()\n refCleanup.current = null\n } else {\n ref(instance)\n }\n } else if (ref) {\n ;(ref as React.MutableRefObject<Instance>).current = instance\n }\n },\n [visualElement]\n )\n}\n"],"names":[],"mappings":";;;AAOA;;;AAGG;;AAMC;;;;;;AAMG;AACH;;AAEI;AACJ;;AAGA;AAEA;;AAGY;;;AAIA;;AAGJ;AACA;;AAEQ;AACA;AACI;;;AAED;;AAEH;;;;;;;AAKF;;AAEV;AAGR;;"} |
| import { observeTimeline } from 'motion-dom'; | ||
| import { scrollInfo } from './track.mjs'; | ||
| import { getTimeline } from './utils/get-timeline.mjs'; | ||
| import { isElementTracking } from './utils/is-element-tracking.mjs'; | ||
@@ -13,3 +14,3 @@ /** | ||
| function attachToFunction(onScroll, options) { | ||
| if (isOnScrollWithInfo(onScroll)) { | ||
| if (isOnScrollWithInfo(onScroll) || isElementTracking(options)) { | ||
| return scrollInfo((info) => { | ||
@@ -16,0 +17,0 @@ onScroll(info[options.axis].progress, info); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"attach-function.mjs","sources":["../../../../../src/render/dom/scroll/attach-function.ts"],"sourcesContent":["import { observeTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"./track\"\nimport { OnScroll, OnScrollWithInfo, ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\n\n/**\n * If the onScroll function has two arguments, it's expecting\n * more specific information about the scroll from scrollInfo.\n */\nfunction isOnScrollWithInfo(onScroll: OnScroll): onScroll is OnScrollWithInfo {\n return onScroll.length === 2\n}\n\nexport function attachToFunction(\n onScroll: OnScroll,\n options: ScrollOptionsWithDefaults\n) {\n if (isOnScrollWithInfo(onScroll)) {\n return scrollInfo((info) => {\n onScroll(info[options.axis!].progress, info)\n }, options)\n } else {\n return observeTimeline(onScroll, getTimeline(options))\n }\n}\n"],"names":[],"mappings":";;;;AAKA;;;AAGG;AACH,SAAS,kBAAkB,CAAC,QAAkB,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC;AAChC;AAEM,SAAU,gBAAgB,CAC5B,QAAkB,EAClB,OAAkC,EAAA;AAElC,IAAA,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE;AAC9B,QAAA,OAAO,UAAU,CAAC,CAAC,IAAI,KAAI;AACvB,YAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC;QAChD,CAAC,EAAE,OAAO,CAAC;IACf;SAAO;QACH,OAAO,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1D;AACJ;;;;"} | ||
| {"version":3,"file":"attach-function.mjs","sources":["../../../../../src/render/dom/scroll/attach-function.ts"],"sourcesContent":["import { observeTimeline } from \"motion-dom\"\nimport { scrollInfo } from \"./track\"\nimport { OnScroll, OnScrollWithInfo, ScrollOptionsWithDefaults } from \"./types\"\nimport { getTimeline } from \"./utils/get-timeline\"\nimport { isElementTracking } from \"./utils/is-element-tracking\"\n\n/**\n * If the onScroll function has two arguments, it's expecting\n * more specific information about the scroll from scrollInfo.\n */\nfunction isOnScrollWithInfo(onScroll: OnScroll): onScroll is OnScrollWithInfo {\n return onScroll.length === 2\n}\n\nexport function attachToFunction(\n onScroll: OnScroll,\n options: ScrollOptionsWithDefaults\n) {\n if (isOnScrollWithInfo(onScroll) || isElementTracking(options)) {\n return scrollInfo((info) => {\n onScroll(info[options.axis!].progress, info)\n }, options)\n } else {\n return observeTimeline(onScroll, getTimeline(options))\n }\n}\n"],"names":[],"mappings":";;;;;AAMA;;;AAGG;AACH,SAAS,kBAAkB,CAAC,QAAkB,EAAA;AAC1C,IAAA,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC;AAChC;AAEM,SAAU,gBAAgB,CAC5B,QAAkB,EAClB,OAAkC,EAAA;IAElC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE;AAC5D,QAAA,OAAO,UAAU,CAAC,CAAC,IAAI,KAAI;AACvB,YAAA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC;QAChD,CAAC,EAAE,OAAO,CAAC;IACf;SAAO;QACH,OAAO,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC1D;AACJ;;;;"} |
@@ -27,6 +27,12 @@ import { warnOnce } from 'motion-utils'; | ||
| * In development mode ensure scroll containers aren't position: static as this makes | ||
| * it difficult to measure their relative positions. | ||
| * it difficult to measure their relative positions. The document scrolling element | ||
| * is exempt: offsetParent measurements naturally resolve relative to the document. | ||
| */ | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (container && target && target !== container) { | ||
| if (container && | ||
| target && | ||
| target !== container && | ||
| container !== document.documentElement && | ||
| container !== document.scrollingElement && | ||
| container !== document.body) { | ||
| warnOnce(getComputedStyle(container).position !== "static", "Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly."); | ||
@@ -33,0 +39,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"on-scroll-handler.mjs","sources":["../../../../../src/render/dom/scroll/on-scroll-handler.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { updateScrollInfo } from \"./info\"\nimport { resolveOffsets } from \"./offsets/index\"\nimport {\n OnScrollHandler,\n OnScrollInfo,\n ScrollInfo,\n ScrollInfoOptions,\n} from \"./types\"\n\nfunction measure(\n container: Element,\n target: Element = container,\n info: ScrollInfo\n) {\n /**\n * Find inset of target within scrollable container\n */\n info.x.targetOffset = 0\n info.y.targetOffset = 0\n if (target !== container) {\n let node = target as HTMLElement\n while (node && node !== container) {\n info.x.targetOffset += node.offsetLeft\n info.y.targetOffset += node.offsetTop\n node = node.offsetParent as HTMLElement\n }\n }\n\n info.x.targetLength =\n target === container ? target.scrollWidth : target.clientWidth\n info.y.targetLength =\n target === container ? target.scrollHeight : target.clientHeight\n info.x.containerLength = container.clientWidth\n info.y.containerLength = container.clientHeight\n\n /**\n * In development mode ensure scroll containers aren't position: static as this makes\n * it difficult to measure their relative positions.\n */\n if (process.env.NODE_ENV !== \"production\") {\n if (container && target && target !== container) {\n warnOnce(\n getComputedStyle(container).position !== \"static\",\n \"Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.\"\n )\n }\n }\n}\n\nexport function createOnScrollHandler(\n element: Element,\n onScroll: OnScrollInfo,\n info: ScrollInfo,\n options: ScrollInfoOptions = {}\n): OnScrollHandler {\n return {\n measure: (time) => {\n measure(element, options.target, info)\n updateScrollInfo(element, info, time)\n\n if (options.offset || options.target) {\n resolveOffsets(element, info, options)\n }\n },\n notify: () => onScroll(info),\n }\n}\n"],"names":[],"mappings":";;;;AAUA,SAAS,OAAO,CACZ,SAAkB,EAClB,MAAA,GAAkB,SAAS,EAC3B,IAAgB,EAAA;AAEhB;;AAEG;AACH,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,IAAI,IAAI,GAAG,MAAqB;AAChC,QAAA,OAAO,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YAC/B,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU;YACtC,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS;AACrC,YAAA,IAAI,GAAG,IAAI,CAAC,YAA2B;QAC3C;IACJ;IAEA,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW;IAClE,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;IACpE,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,WAAW;IAC9C,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY;AAE/C;;;AAGG;IACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACvC,IAAI,SAAS,IAAI,MAAM,IAAI,MAAM,KAAK,SAAS,EAAE;AAC7C,YAAA,QAAQ,CACJ,gBAAgB,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,QAAQ,EACjD,sJAAsJ,CACzJ;QACL;IACJ;AACJ;AAEM,SAAU,qBAAqB,CACjC,OAAgB,EAChB,QAAsB,EACtB,IAAgB,EAChB,OAAA,GAA6B,EAAE,EAAA;IAE/B,OAAO;AACH,QAAA,OAAO,EAAE,CAAC,IAAI,KAAI;YACd,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;AACtC,YAAA,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;YAErC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;AAClC,gBAAA,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;YAC1C;QACJ,CAAC;AACD,QAAA,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC;KAC/B;AACL;;;;"} | ||
| {"version":3,"file":"on-scroll-handler.mjs","sources":["../../../../../src/render/dom/scroll/on-scroll-handler.ts"],"sourcesContent":["import { warnOnce } from \"motion-utils\"\nimport { updateScrollInfo } from \"./info\"\nimport { resolveOffsets } from \"./offsets/index\"\nimport {\n OnScrollHandler,\n OnScrollInfo,\n ScrollInfo,\n ScrollInfoOptions,\n} from \"./types\"\n\nfunction measure(\n container: Element,\n target: Element = container,\n info: ScrollInfo\n) {\n /**\n * Find inset of target within scrollable container\n */\n info.x.targetOffset = 0\n info.y.targetOffset = 0\n if (target !== container) {\n let node = target as HTMLElement\n while (node && node !== container) {\n info.x.targetOffset += node.offsetLeft\n info.y.targetOffset += node.offsetTop\n node = node.offsetParent as HTMLElement\n }\n }\n\n info.x.targetLength =\n target === container ? target.scrollWidth : target.clientWidth\n info.y.targetLength =\n target === container ? target.scrollHeight : target.clientHeight\n info.x.containerLength = container.clientWidth\n info.y.containerLength = container.clientHeight\n\n /**\n * In development mode ensure scroll containers aren't position: static as this makes\n * it difficult to measure their relative positions. The document scrolling element\n * is exempt: offsetParent measurements naturally resolve relative to the document.\n */\n if (process.env.NODE_ENV !== \"production\") {\n if (\n container &&\n target &&\n target !== container &&\n container !== document.documentElement &&\n container !== document.scrollingElement &&\n container !== document.body\n ) {\n warnOnce(\n getComputedStyle(container).position !== \"static\",\n \"Please ensure that the container has a non-static position, like 'relative', 'fixed', or 'absolute' to ensure scroll offset is calculated correctly.\"\n )\n }\n }\n}\n\nexport function createOnScrollHandler(\n element: Element,\n onScroll: OnScrollInfo,\n info: ScrollInfo,\n options: ScrollInfoOptions = {}\n): OnScrollHandler {\n return {\n measure: (time) => {\n measure(element, options.target, info)\n updateScrollInfo(element, info, time)\n\n if (options.offset || options.target) {\n resolveOffsets(element, info, options)\n }\n },\n notify: () => onScroll(info),\n }\n}\n"],"names":[],"mappings":";;;;AAUA,SAAS,OAAO,CACZ,SAAkB,EAClB,MAAA,GAAkB,SAAS,EAC3B,IAAgB,EAAA;AAEhB;;AAEG;AACH,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC;AACvB,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,IAAI,IAAI,GAAG,MAAqB;AAChC,QAAA,OAAO,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;YAC/B,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU;YACtC,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS;AACrC,YAAA,IAAI,GAAG,IAAI,CAAC,YAA2B;QAC3C;IACJ;IAEA,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW;IAClE,IAAI,CAAC,CAAC,CAAC,YAAY;AACf,QAAA,MAAM,KAAK,SAAS,GAAG,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY;IACpE,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,WAAW;IAC9C,IAAI,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY;AAE/C;;;;AAIG;IACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AACvC,QAAA,IACI,SAAS;YACT,MAAM;AACN,YAAA,MAAM,KAAK,SAAS;YACpB,SAAS,KAAK,QAAQ,CAAC,eAAe;YACtC,SAAS,KAAK,QAAQ,CAAC,gBAAgB;AACvC,YAAA,SAAS,KAAK,QAAQ,CAAC,IAAI,EAC7B;AACE,YAAA,QAAQ,CACJ,gBAAgB,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,QAAQ,EACjD,sJAAsJ,CACzJ;QACL;IACJ;AACJ;AAEM,SAAU,qBAAqB,CACjC,OAAgB,EAChB,QAAsB,EACtB,IAAgB,EAChB,OAAA,GAA6B,EAAE,EAAA;IAE/B,OAAO;AACH,QAAA,OAAO,EAAE,CAAC,IAAI,KAAI;YACd,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;AACtC,YAAA,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC;YAErC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE;AAClC,gBAAA,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;YAC1C;QACJ,CAAC;AACD,QAAA,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC;KAC/B;AACL;;;;"} |
| "use client"; | ||
| import { supportsViewTimeline, supportsScrollTimeline, motionValue } from 'motion-dom'; | ||
| import { microtask, cancelMicrotask, supportsViewTimeline, supportsScrollTimeline, motionValue } from 'motion-dom'; | ||
| import { invariant } from 'motion-utils'; | ||
@@ -23,8 +23,28 @@ import { useRef, useCallback, useEffect } from 'react'; | ||
| return { | ||
| factory: (animation) => scroll(animation, { | ||
| ...options, | ||
| axis, | ||
| container: container?.current || undefined, | ||
| target: target?.current || undefined, | ||
| }), | ||
| // Refs attach child-first; defer so target.current is populated | ||
| // before scroll() reads it. | ||
| factory: (animation) => { | ||
| let cleanup; | ||
| const start = () => { | ||
| // A provided ref may be hydrated by an effect declared after | ||
| // useScroll (or in a parent). Don't attach to the window | ||
| // scroll in the meantime — that result gets cached and would | ||
| // permanently mistrack. Wait until the ref resolves. | ||
| if (isRefPending(container) || isRefPending(target)) { | ||
| microtask.read(start); | ||
| return; | ||
| } | ||
| cleanup = scroll(animation, { | ||
| ...options, | ||
| axis, | ||
| container: container?.current || undefined, | ||
| target: target?.current || undefined, | ||
| }); | ||
| }; | ||
| microtask.read(start); | ||
| return () => { | ||
| cancelMicrotask(start); | ||
| cleanup?.(); | ||
| }; | ||
| }, | ||
| times: [0, 1], | ||
@@ -77,10 +97,20 @@ keyframes: [0, 1], | ||
| useEffect(() => { | ||
| if (needsStart.current) { | ||
| invariant(!isRefPending(container), "Container ref is defined but not hydrated", "use-scroll-ref"); | ||
| invariant(!isRefPending(target), "Target ref is defined but not hydrated", "use-scroll-ref"); | ||
| return start(); | ||
| } | ||
| else { | ||
| if (!needsStart.current) | ||
| return; | ||
| } | ||
| // Defer to a microtask so any sibling/parent effect that hydrates the | ||
| // ref has a chance to run first. | ||
| let cleanup; | ||
| const tryStart = () => { | ||
| const containerPending = isRefPending(container); | ||
| const targetPending = isRefPending(target); | ||
| invariant(!containerPending, "Container ref is defined but not hydrated", "use-scroll-ref"); | ||
| invariant(!targetPending, "Target ref is defined but not hydrated", "use-scroll-ref"); | ||
| if (!containerPending && !targetPending) | ||
| cleanup = start(); | ||
| }; | ||
| microtask.read(tryStart); | ||
| return () => { | ||
| cancelMicrotask(tryStart); | ||
| cleanup?.(); | ||
| }; | ||
| }, [start]); | ||
@@ -87,0 +117,0 @@ return values; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"use-scroll.mjs","sources":["../../../src/value/use-scroll.ts"],"sourcesContent":["\"use client\"\n\nimport {\n AnimationPlaybackControls,\n motionValue,\n supportsScrollTimeline,\n supportsViewTimeline,\n} from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\nimport { RefObject, useCallback, useEffect, useRef } from \"react\"\nimport { scroll } from \"../render/dom/scroll\"\nimport { ScrollInfoOptions } from \"../render/dom/scroll/types\"\nimport { offsetToViewTimelineRange } from \"../render/dom/scroll/utils/offset-to-range\"\nimport { useConstant } from \"../utils/use-constant\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\n\nexport interface UseScrollOptions\n extends Omit<ScrollInfoOptions, \"container\" | \"target\"> {\n container?: RefObject<HTMLElement | null>\n target?: RefObject<HTMLElement | null>\n}\n\nconst createScrollMotionValues = () => ({\n scrollX: motionValue(0),\n scrollY: motionValue(0),\n scrollXProgress: motionValue(0),\n scrollYProgress: motionValue(0),\n})\n\nconst isRefPending = (ref?: RefObject<HTMLElement | null>) => {\n if (!ref) return false\n return !ref.current\n}\n\nfunction makeAccelerateConfig(\n axis: \"x\" | \"y\",\n options: Omit<UseScrollOptions, \"container\" | \"target\">,\n container?: RefObject<HTMLElement | null>,\n target?: RefObject<HTMLElement | null>\n) {\n return {\n factory: (animation: AnimationPlaybackControls) =>\n scroll(animation, {\n ...options,\n axis,\n container: container?.current || undefined,\n target: target?.current || undefined,\n }),\n times: [0, 1],\n keyframes: [0, 1],\n ease: (v: number) => v,\n duration: 1,\n }\n}\n\nfunction canAccelerateScroll(\n target?: RefObject<HTMLElement | null>,\n offset?: ScrollInfoOptions[\"offset\"]\n) {\n if (typeof window === \"undefined\") return false\n return target\n ? supportsViewTimeline() && !!offsetToViewTimelineRange(offset)\n : supportsScrollTimeline()\n}\n\nexport function useScroll({\n container,\n target,\n ...options\n}: UseScrollOptions = {}) {\n const values = useConstant(createScrollMotionValues)\n\n if (canAccelerateScroll(target, options.offset)) {\n values.scrollXProgress.accelerate = makeAccelerateConfig(\n \"x\",\n options,\n container,\n target\n )\n values.scrollYProgress.accelerate = makeAccelerateConfig(\n \"y\",\n options,\n container,\n target\n )\n }\n\n const scrollAnimation = useRef<VoidFunction | null>(null)\n const needsStart = useRef(false)\n\n const start = useCallback(() => {\n scrollAnimation.current = scroll(\n (\n _progress: number,\n {\n x,\n y,\n }: {\n x: { current: number; progress: number }\n y: { current: number; progress: number }\n }\n ) => {\n values.scrollX.set(x.current)\n values.scrollXProgress.set(x.progress)\n values.scrollY.set(y.current)\n values.scrollYProgress.set(y.progress)\n },\n {\n ...options,\n container: container?.current || undefined,\n target: target?.current || undefined,\n }\n )\n\n return () => {\n scrollAnimation.current?.()\n }\n }, [container, target, JSON.stringify(options.offset)])\n\n useIsomorphicLayoutEffect(() => {\n needsStart.current = false\n\n if (isRefPending(container) || isRefPending(target)) {\n needsStart.current = true\n return\n } else {\n return start()\n }\n }, [start])\n\n useEffect(() => {\n if (needsStart.current) {\n invariant(\n !isRefPending(container),\n \"Container ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n invariant(\n !isRefPending(target),\n \"Target ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n return start()\n } else {\n return\n }\n }, [start])\n\n return values\n}\n"],"names":[],"mappings":";;;;;;;;;AAsBA;AACI;AACA;AACA;AACA;AACH;AAED;AACI;AAAU;AACV;AACJ;AAEA;;;AASgB;;AAEA;AACA;;AAER;AACA;AACA;AACA;;AAER;AAEA;;AAIuC;AACnC;;;AAGJ;AAEM;AAKF;;AAGI;AAMA;;AAQJ;AACA;AAEA;AACI;;;;;AAeI;AAEI;AACA;AACA;AACH;AAGL;AACI;AACJ;AACJ;;AAGI;;AAGI;;;;;;AAKR;;AAGI;;;;;;;;AAeJ;AAEA;AACJ;;"} | ||
| {"version":3,"file":"use-scroll.mjs","sources":["../../../src/value/use-scroll.ts"],"sourcesContent":["\"use client\"\n\nimport {\n AnimationPlaybackControls,\n cancelMicrotask,\n microtask,\n motionValue,\n supportsScrollTimeline,\n supportsViewTimeline,\n} from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\nimport { RefObject, useCallback, useEffect, useRef } from \"react\"\nimport { scroll } from \"../render/dom/scroll\"\nimport { ScrollInfoOptions } from \"../render/dom/scroll/types\"\nimport { offsetToViewTimelineRange } from \"../render/dom/scroll/utils/offset-to-range\"\nimport { useConstant } from \"../utils/use-constant\"\nimport { useIsomorphicLayoutEffect } from \"../utils/use-isomorphic-effect\"\n\nexport interface UseScrollOptions\n extends Omit<ScrollInfoOptions, \"container\" | \"target\"> {\n container?: RefObject<HTMLElement | null>\n target?: RefObject<HTMLElement | null>\n}\n\nconst createScrollMotionValues = () => ({\n scrollX: motionValue(0),\n scrollY: motionValue(0),\n scrollXProgress: motionValue(0),\n scrollYProgress: motionValue(0),\n})\n\nconst isRefPending = (ref?: RefObject<HTMLElement | null>) => {\n if (!ref) return false\n return !ref.current\n}\n\nfunction makeAccelerateConfig(\n axis: \"x\" | \"y\",\n options: Omit<UseScrollOptions, \"container\" | \"target\">,\n container?: RefObject<HTMLElement | null>,\n target?: RefObject<HTMLElement | null>\n) {\n return {\n // Refs attach child-first; defer so target.current is populated\n // before scroll() reads it.\n factory: (animation: AnimationPlaybackControls) => {\n let cleanup: VoidFunction | undefined\n const start = () => {\n // A provided ref may be hydrated by an effect declared after\n // useScroll (or in a parent). Don't attach to the window\n // scroll in the meantime — that result gets cached and would\n // permanently mistrack. Wait until the ref resolves.\n if (isRefPending(container) || isRefPending(target)) {\n microtask.read(start)\n return\n }\n cleanup = scroll(animation, {\n ...options,\n axis,\n container: container?.current || undefined,\n target: target?.current || undefined,\n })\n }\n microtask.read(start)\n return () => {\n cancelMicrotask(start)\n cleanup?.()\n }\n },\n times: [0, 1],\n keyframes: [0, 1],\n ease: (v: number) => v,\n duration: 1,\n }\n}\n\nfunction canAccelerateScroll(\n target?: RefObject<HTMLElement | null>,\n offset?: ScrollInfoOptions[\"offset\"]\n) {\n if (typeof window === \"undefined\") return false\n return target\n ? supportsViewTimeline() && !!offsetToViewTimelineRange(offset)\n : supportsScrollTimeline()\n}\n\nexport function useScroll({\n container,\n target,\n ...options\n}: UseScrollOptions = {}) {\n const values = useConstant(createScrollMotionValues)\n\n if (canAccelerateScroll(target, options.offset)) {\n values.scrollXProgress.accelerate = makeAccelerateConfig(\n \"x\",\n options,\n container,\n target\n )\n values.scrollYProgress.accelerate = makeAccelerateConfig(\n \"y\",\n options,\n container,\n target\n )\n }\n\n const scrollAnimation = useRef<VoidFunction | null>(null)\n const needsStart = useRef(false)\n\n const start = useCallback(() => {\n scrollAnimation.current = scroll(\n (\n _progress: number,\n {\n x,\n y,\n }: {\n x: { current: number; progress: number }\n y: { current: number; progress: number }\n }\n ) => {\n values.scrollX.set(x.current)\n values.scrollXProgress.set(x.progress)\n values.scrollY.set(y.current)\n values.scrollYProgress.set(y.progress)\n },\n {\n ...options,\n container: container?.current || undefined,\n target: target?.current || undefined,\n }\n )\n\n return () => {\n scrollAnimation.current?.()\n }\n }, [container, target, JSON.stringify(options.offset)])\n\n useIsomorphicLayoutEffect(() => {\n needsStart.current = false\n\n if (isRefPending(container) || isRefPending(target)) {\n needsStart.current = true\n return\n } else {\n return start()\n }\n }, [start])\n\n useEffect(() => {\n if (!needsStart.current) return\n\n // Defer to a microtask so any sibling/parent effect that hydrates the\n // ref has a chance to run first.\n let cleanup: VoidFunction | undefined\n const tryStart = () => {\n const containerPending = isRefPending(container)\n const targetPending = isRefPending(target)\n invariant(\n !containerPending,\n \"Container ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n invariant(\n !targetPending,\n \"Target ref is defined but not hydrated\",\n \"use-scroll-ref\"\n )\n if (!containerPending && !targetPending) cleanup = start()\n }\n microtask.read(tryStart)\n\n return () => {\n cancelMicrotask(tryStart)\n cleanup?.()\n }\n }, [start])\n\n return values\n}\n"],"names":[],"mappings":";;;;;;;;;AAwBA;AACI;AACA;AACA;AACA;AACH;AAED;AACI;AAAU;AACV;AACJ;AAEA;;;;AASQ;AACI;;;;;;;AAOQ;;;AAGJ;AACI;;AAEA;AACA;AACH;AACL;AACA;AACA;;;AAGA;;AAEJ;AACA;AACA;AACA;;AAER;AAEA;;AAIuC;AACnC;;;AAGJ;AAEM;AAKF;;AAGI;AAMA;;AAQJ;AACA;AAEA;AACI;;;;;AAeI;AAEI;AACA;AACA;AACH;AAGL;AACI;AACJ;AACJ;;AAGI;;AAGI;;;;;;AAKR;;;;;;AAOI;;AAEI;AACA;;;AAWA;;AACJ;AACA;AAEA;;;AAGA;AACJ;AAEA;AACJ;;"} |
@@ -1,2 +0,2 @@ | ||
| function t(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const e=(t,e,n)=>n>e?e:n<t?t:n;function n(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let s=()=>{},i=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(s=(t,e,s)=>{t||"undefined"==typeof console||console.warn(n(e,s))},i=(t,e,s)=>{if(!t)throw new Error(n(e,s))});const r={},a=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);const o=t=>/^0[^.\s]+$/u.test(t);function l(t){let e;return()=>(void 0===e&&(e=t()),e)}const u=t=>t,h=(t,e)=>n=>e(t(n)),c=(...t)=>t.reduce(h),d=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};class p{constructor(){this.subscriptions=[]}add(e){var n,s;return n=this.subscriptions,s=e,-1===n.indexOf(s)&&n.push(s),()=>t(this.subscriptions,e)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const m=t=>1e3*t,f=t=>t/1e3;function g(t,e){return e?t*(1e3/e):0}const y=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function v(t,e,n,s){if(t===e&&n===s)return u;const i=e=>function(t,e,n,s,i){let r,a,o=0;do{a=e+(n-e)/2,r=y(a,s,i)-t,r>0?n=a:e=a}while(Math.abs(r)>1e-7&&++o<12);return a}(e,0,1,t,n);return t=>0===t||1===t?t:y(i(t),e,s)}const b=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,T=t=>e=>1-t(1-e),w=v(.33,1.53,.69,.99),M=T(w),S=b(M),x=t=>t>=1?1:(t*=2)<1?.5*M(t):.5*(2-Math.pow(2,-10*(t-1))),A=t=>1-Math.sin(Math.acos(t)),V=T(A),k=b(A),C=v(.42,0,1,1),F=v(0,0,.58,1),P=v(.42,0,.58,1),B=t=>Array.isArray(t)&&"number"!=typeof t[0];function E(t,e){return B(t)?t[((t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t})(0,t.length,e)]:t}const R=t=>Array.isArray(t)&&"number"==typeof t[0],D={linear:u,easeIn:C,easeInOut:P,easeOut:F,circIn:A,circInOut:k,circOut:V,backIn:M,backInOut:S,backOut:w,anticipate:x},I=t=>{if(R(t)){i(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,s,r]=t;return v(e,n,s,r)}return"string"==typeof t?(i(void 0!==D[t],`Invalid easing type '${t}'`,"invalid-easing-type"),D[t]):t},O=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function N(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=O.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(l.schedule(e),t()),e(a)}const l={schedule:(t,i=!1,a=!1)=>{const o=a&&s?e:n;return i&&r.add(t),o.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{if(a=t,s)return void(i=!0);s=!0;const r=e;e=n,n=r,e.forEach(o),e.clear(),s=!1,i&&(i=!1,l.process(t))}};return l}(a),t),{}),{setup:l,read:u,resolveKeyframes:h,preUpdate:c,update:d,preRender:p,render:m,postRender:f}=o,g=()=>{const a=r.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=s?1e3/60:Math.max(Math.min(o-i.timestamp,40),1)),i.timestamp=o,i.isProcessing=!0,l.process(i),u.process(i),h.process(i),c.process(i),d.process(i),p.process(i),m.process(i),f.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(g))};return{schedule:O.reduce((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(g)),a.schedule(e,r,o)),e},{}),cancel:t=>{for(let e=0;e<O.length;e++)o[O[e]].cancel(t)},state:i,steps:o}}const{schedule:$,cancel:K,state:j}=N("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:u,!0);let W;function L(){W=void 0}const Y={now:()=>(void 0===W&&Y.set(j.isProcessing||r.useManualTiming?j.timestamp:performance.now()),W),set:t=>{W=t,queueMicrotask(L)}},U=t=>e=>"string"==typeof e&&e.startsWith(t),X=U("--"),q=U("var(--"),z=t=>!!q(t)&&Z.test(t.split("/*")[0].trim()),Z=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function _(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const H={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},G={...H,transform:t=>e(0,1,t)},J={...H,default:1},Q=t=>Math.round(1e5*t)/1e5,tt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const et=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,nt=(t,e)=>n=>Boolean("string"==typeof n&&et.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),st=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(tt);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},it={...H,transform:t=>Math.round((t=>e(0,255,t))(t))},rt={test:nt("rgb","red"),parse:st("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+it.transform(t)+", "+it.transform(e)+", "+it.transform(n)+", "+Q(G.transform(s))+")"};const at={test:nt("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:rt.transform},ot=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),lt=ot("deg"),ut=ot("%"),ht=ot("px"),ct=ot("vh"),dt=ot("vw"),pt=(()=>({...ut,parse:t=>ut.parse(t)/100,transform:t=>ut.transform(100*t)}))(),mt={test:nt("hsl","hue"),parse:st("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+ut.transform(Q(e))+", "+ut.transform(Q(n))+", "+Q(G.transform(s))+")"},ft={test:t=>rt.test(t)||at.test(t)||mt.test(t),parse:t=>rt.test(t)?rt.parse(t):mt.test(t)?mt.parse(t):at.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?rt.transform(t):mt.transform(t),getAnimatableNone:t=>{const e=ft.parse(t);return e.alpha=0,ft.transform(e)}},gt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const yt="number",vt="color",bt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Tt(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(bt,t=>(ft.test(t)?(s.color.push(r),i.push(vt),n.push(ft.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(yt),n.push(parseFloat(t))),++r,"${}")).split("${}");return{values:n,split:a,indexes:s,types:i}}function wt({split:t,types:e}){const n=t.length;return s=>{let i="";for(let r=0;r<n;r++)if(i+=t[r],void 0!==s[r]){const t=e[r];i+=t===yt?Q(s[r]):t===vt?ft.transform(s[r]):s[r]}return i}}const Mt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(n=t)?0:ft.test(n)?ft.getAnimatableNone(n):n;var n};const St={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(tt)?.length||0)+(t.match(gt)?.length||0)>0},parse:function(t){return Tt(t).values},createTransformer:function(t){return wt(Tt(t))},getAnimatableNone:function(t){const e=Tt(t);return wt(e)(e.values.map((t,n)=>Mt(t,e.split[n])))}};function xt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function At(t,e){return n=>n>0?e:t}const Vt=(t,e,n)=>t+(e-t)*n,kt=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},Ct=[at,rt,mt];function Ft(t){const e=(n=t,Ct.find(t=>t.test(n)));var n;if(s(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===mt&&(i=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,a=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,o=2*n-s;i=xt(o,s,t+1/3),r=xt(o,s,t),a=xt(o,s,t-1/3)}else i=r=a=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*a),alpha:s}}(i)),i}const Pt=(t,e)=>{const n=Ft(t),s=Ft(e);if(!n||!s)return At(t,e);const i={...n};return t=>(i.red=kt(n.red,s.red,t),i.green=kt(n.green,s.green,t),i.blue=kt(n.blue,s.blue,t),i.alpha=Vt(n.alpha,s.alpha,t),rt.transform(i))},Bt=new Set(["none","hidden"]);function Et(t,e){return n=>Vt(t,e,n)}function Rt(t){return"number"==typeof t?Et:"string"==typeof t?z(t)?At:ft.test(t)?Pt:Ot:Array.isArray(t)?Dt:"object"==typeof t?ft.test(t)?Pt:It:At}function Dt(t,e){const n=[...t],s=n.length,i=t.map((t,n)=>Rt(t)(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function It(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=Rt(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const Ot=(t,e)=>{const n=St.createTransformer(e),i=Tt(t),r=Tt(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Bt.has(t)&&!r.values.length||Bt.has(e)&&!i.values.length?function(t,e){return Bt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):c(Dt(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],a=t.indexes[r][s[r]],o=t.values[a]??0;n[i]=o,s[r]++}return n}(i,r),r.values),n):(s(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),At(t,e))};function Nt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Vt(t,e,n);return Rt(t)(t,e)}const $t=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>$.update(e,t),stop:()=>K(e),now:()=>j.isProcessing?j.timestamp:Y.now()}},Kt=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},jt=2e4;function Wt(t){let e=0;let n=t.next(e);for(;!n.done&&e<jt;)e+=50,n=t.next(e);return e>=jt?1/0:e}function Lt(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(Wt(s),jt);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:f(i)}}const Yt=100,Ut=10,Xt=1,qt=0,zt=800,Zt=.3,_t=.3,Ht={granular:.01,default:2},Gt={granular:.005,default:.5},Jt=.01,Qt=10,te=.05,ee=1;function ne(t,e){return t*Math.sqrt(1-e*e)}const se=.001;const ie=["duration","bounce"],re=["stiffness","damping","mass"];function ae(t,e){return e.some(e=>void 0!==t[e])}function oe(t){let n={velocity:qt,stiffness:Yt,damping:Ut,mass:Xt,isResolvedFromDuration:!1,...t};if(!ae(t,re)&&ae(t,ie))if(n.velocity=0,t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),r=i*i,a=2*e(.05,1,1-(t.bounce||0))*Math.sqrt(r);n={...n,mass:Xt,stiffness:r,damping:a}}else{const i=function({duration:t=zt,bounce:n=Zt,velocity:i=qt,mass:r=Xt}){let a,o;s(t<=m(Qt),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-n;l=e(te,ee,l),t=e(Jt,Qt,f(t)),l<1?(a=e=>{const n=e*l,s=n*t,r=n-i,a=ne(e,l),o=Math.exp(-s);return se-r/a*o},o=e=>{const n=e*l*t,s=n*i+i,r=Math.pow(l,2)*Math.pow(e,2)*t,o=Math.exp(-n),u=ne(Math.pow(e,2),l);return(-a(e)+se>0?-1:1)*((s-r)*o)/u}):(a=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(i-e)));const u=function(t,e,n){let s=n;for(let n=1;n<12;n++)s-=t(s)/e(s);return s}(a,o,5/t);if(t=m(t),isNaN(u))return{stiffness:Yt,damping:Ut,duration:t};{const e=Math.pow(u,2)*r;return{stiffness:e,damping:2*l*Math.sqrt(r*e),duration:t}}}({...t,velocity:0});n={...n,...i,mass:Xt},n.isResolvedFromDuration=!0}return n}function le(t=_t,e=Zt){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:r},{stiffness:l,damping:u,mass:h,duration:c,velocity:d,isResolvedFromDuration:p}=oe({...n,velocity:-f(n.velocity||0)}),g=d||0,y=u/(2*Math.sqrt(l*h)),v=a-r,b=f(Math.sqrt(l/h)),T=Math.abs(v)<5;let w,M,S,x,A,V;if(s||(s=T?Ht.granular:Ht.default),i||(i=T?Gt.granular:Gt.default),y<1)S=ne(b,y),x=(g+y*b*v)/S,w=t=>{const e=Math.exp(-y*b*t);return a-e*(x*Math.sin(S*t)+v*Math.cos(S*t))},A=y*b*x+v*S,V=y*b*v-x*S,M=t=>Math.exp(-y*b*t)*(A*Math.sin(S*t)+V*Math.cos(S*t));else if(1===y){w=t=>a-Math.exp(-b*t)*(v+(g+b*v)*t);const t=g+b*v;M=e=>Math.exp(-b*e)*(b*t*e-g)}else{const t=b*Math.sqrt(y*y-1);w=e=>{const n=Math.exp(-y*b*e),s=Math.min(t*e,300);return a-n*((g+y*b*v)*Math.sinh(s)+t*v*Math.cosh(s))/t};const e=(g+y*b*v)/t,n=y*b*e-v*t,s=y*b*v-e*t;M=e=>{const i=Math.exp(-y*b*e),r=Math.min(t*e,300);return i*(n*Math.sinh(r)+s*Math.cosh(r))}}const k={calculatedDuration:p&&c||null,velocity:t=>m(M(t)),next:t=>{if(!p&&y<1){const e=Math.exp(-y*b*t),n=Math.sin(S*t),r=Math.cos(S*t),l=a-e*(x*n+v*r),u=m(e*(A*n+V*r));return o.done=Math.abs(u)<=s&&Math.abs(a-l)<=i,o.value=o.done?a:l,o}const e=w(t);if(p)o.done=t>=c;else{const n=m(M(t));o.done=Math.abs(n)<=s&&Math.abs(a-e)<=i}return o.value=o.done?a:e,o},toString:()=>{const t=Math.min(Wt(k),jt),e=Kt(e=>k.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return k}le.applyToOptions=t=>{const e=Lt(t,100,le);return t.ease=e.ease,t.duration=m(e.duration),t.type="keyframes",t};function ue(t,e,n){const s=Math.max(e-5,0);return g(n-t(s),e-s)}function he({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let m=n*e;const f=c+m,g=void 0===a?f:a(f);g!==f&&(m=g-c);const y=t=>-m*Math.exp(-t/s),v=t=>g+y(t),b=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let T,w;const M=t=>{var e;(e=d.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(T=t,w=le({keyframes:[d.value,p(d.value)],velocity:ue(v,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:h}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,b(t),M(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&b(t),d)}}}function ce(t,n,{clamp:s=!0,ease:a,mixer:o}={}){const l=t.length;if(i(l===n.length,"Both input and output ranges must be the same length","range-length"),1===l)return()=>n[0];if(2===l&&n[0]===n[1])return()=>n[1];const h=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),n=[...n].reverse());const p=function(t,e,n){const s=[],i=n||r.mix||Nt,a=t.length-1;for(let n=0;n<a;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||u:e;r=c(t,r)}s.push(r)}return s}(n,a,o),m=p.length,f=e=>{if(h&&e<t[0])return n[0];let s=0;if(m>1)for(;s<t.length-2&&!(e<t[s+1]);s++);const i=d(t[s],t[s+1],e);return p[s](i)};return s?n=>f(e(t[0],t[l-1],n)):f}function de(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=d(0,e,s);t.push(Vt(n,1,i))}}function pe(t){const e=[0];return de(e,t.length-1),e}function me({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=B(s)?s.map(I):I(s),r={done:!1,value:e[0]},a=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:pe(e),t),o=ce(a,e,{ease:Array.isArray(i)?i:(l=e,u=i,l.map(()=>u||P).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(r.value=o(e),r.done=e>=t,r)}}const fe=t=>null!==t;function ge(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(fe),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const ye={decay:he,inertia:he,tween:me,keyframes:me,spring:le};function ve(t){"string"==typeof t.type&&(t.type=ye[t.type])}class be{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const Te=t=>t/100;class we extends be{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==Y.now()&&this.tick(Y.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;ve(t);const{type:e=me,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:r=0}=t;let{keyframes:a}=t;const o=e||me;o!==me&&"number"!=typeof a[0]&&(this.mixKeyframes=c(Te,Nt(a[0],a[1])),a=[0,100]);const l=o({...t,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...t,keyframes:[...a].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=Wt(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);const{delay:u=0,keyframes:h,repeat:c,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let b,T=this.currentTime,w=s;if(c){const t=Math.min(this.currentTime,i)/o;let n=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&n--,n=Math.min(n,c+1);Boolean(n%2)&&("reverse"===d?(s=1-s,p&&(s-=p/o)):"mirror"===d&&(w=a)),T=e(0,1,s)*o}v?(this.delayState.value=h[0],b=this.delayState):b=w.next(T),r&&!v&&(b.value=r(b.value));let{done:M}=b;v||null===l||(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return S&&m!==he&&(b.value=ge(h,this.options,g,this.speed)),f&&f(b.value),S&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return f(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+f(t)}get time(){return f(this.currentTime)}set time(t){t=m(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return ue(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(Y.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=f(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=$t,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Y.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const Me=t=>180*t/Math.PI,Se=t=>{const e=Me(Math.atan2(t[1],t[0]));return Ae(e)},xe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Se,rotateZ:Se,skewX:t=>Me(Math.atan(t[1])),skewY:t=>Me(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ae=t=>((t%=360)<0&&(t+=360),t),Ve=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ke=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ce={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ve,scaleY:ke,scale:t=>(Ve(t)+ke(t))/2,rotateX:t=>Ae(Me(Math.atan2(t[6],t[5]))),rotateY:t=>Ae(Me(Math.atan2(-t[2],t[0]))),rotateZ:Se,rotate:Se,skewX:t=>Me(Math.atan(t[4])),skewY:t=>Me(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Fe(t){return t.includes("scale")?1:0}function Pe(t,e){if(!t||"none"===t)return Fe(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Ce,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=xe,i=e}if(!i)return Fe(e);const r=s[e],a=i[1].split(",").map(Be);return"function"==typeof r?r(a):a[r]}function Be(t){return parseFloat(t.trim())}const Ee=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Re=(()=>new Set(Ee))(),De=t=>t===H||t===ht,Ie=new Set(["x","y","z"]),Oe=Ee.filter(t=>!Ie.has(t));const Ne={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Pe(e,"x"),y:(t,{transform:e})=>Pe(e,"y")};Ne.translateX=Ne.x,Ne.translateY=Ne.y;const $e=new Set;let Ke=!1,je=!1,We=!1;function Le(){if(je){const t=Array.from($e).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),n=new Map;e.forEach(t=>{const e=function(t){const e=[];return Oe.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}(t);e.length&&(n.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=n.get(t);e&&e.forEach(([e,n])=>{t.getValue(e)?.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}je=!1,Ke=!1,$e.forEach(t=>t.complete(We)),$e.clear()}function Ye(){$e.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(je=!0)})}class Ue{constructor(t,e,n,s,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?($e.add(this),Ke||(Ke=!0,$.read(Ye),$.resolveKeyframes(Le))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),$e.delete(this)}cancel(){"scheduled"===this.state&&($e.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function Xe(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}const qe={};function ze(t,e){const n=l(t);return()=>qe[e]??n()}const Ze=ze(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),_e=ze(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),He=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,Ge={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:He([0,.65,.55,1]),circOut:He([.55,0,1,.45]),backIn:He([.31,.01,.66,-.59]),backOut:He([.33,1.53,.69,.99])};function Je(t,e){return t?"function"==typeof t?_e()?Kt(t,e):"ease-out":R(t)?He(t):Array.isArray(t)?t.map(t=>Je(t,e)||Ge.easeOut):Ge[t]:void 0}function Qe(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const h={[e]:n};l&&(h.offset=l);const c=Je(o,i);Array.isArray(c)&&(h.easing=c);const d={delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};u&&(d.pseudoElement=u);return t.animate(h,d)}function tn(t){return"function"==typeof t&&"applyToOptions"in t}class en extends be{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:s,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,i("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=function({type:t,...e}){return tn(t)&&_e()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Qe(e,n,s,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=ge(s,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Xe(e,n,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return f(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+f(t)}get time(){return f(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=m(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:n,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Ze()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),u):s(this)}}const nn={anticipate:x,backInOut:S,circInOut:k};function sn(t){"string"==typeof t.ease&&t.ease in nn&&(t.ease=nn[t.ease])}class rn extends en{constructor(t){sn(t),ve(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...a}=this.options;if(!n)return;if(void 0!==t)return void n.set(t);const o=new we({...a,autoplay:!1}),l=Math.max(10,Y.now()-this.startTime),u=e(0,10,l-10),h=o.sample(l).value,{name:c}=this.options;r&&c&&Xe(r,c,h),n.setWithVelocity(o.sample(Math.max(0,l-u)).value,h,u),o.stop()}}const an=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!St.test(t)&&"0"!==t||t.startsWith("url(")));function on(t){t.duration=0,t.type="keyframes"}const ln=new Set(["opacity","clipPath","filter","transform"]),un=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const hn=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),cn=l(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function dn(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:a,keyframes:o}=t,l=e?.owner?.current;if(!(l instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:h}=e.owner.getProps();return cn()&&n&&(ln.has(n)||hn.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&un.test(t[e]))return!0;return!1}(o))&&("transform"!==n||!h)&&!u&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class pn extends be{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Y.now();const c={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,name:o,motionValue:l,element:u,...h},d=u?.KeyframeResolver||Ue;this.keyframeResolver=new d(a,(t,e,n)=>this.onKeyframesResolved(t,e,c,!n),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:h,isHandoff:c,onUpdate:d}=n;this.resolvedAt=Y.now();let p=!0;(function(t,e,n,i){const r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;const a=t[t.length-1],o=an(r,e),l=an(a,e);return s(o===l,`You are trying to animate ${e} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!(!o||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||tn(n))&&i)})(t,a,o,l)||(p=!1,!r.instantAnimations&&h||d?.(ge(t,n,e)),t[0]=t[t.length-1],on(n),n.repeat=0);const m={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},f=p&&!c&&dn(m),g=m.motionValue?.owner?.current;let y;if(f)try{y=new rn({...m,element:g})}catch{y=new we(m)}else y=new we(m);y.finished.then(()=>{this.notifyFinished()}).catch(u),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),We=!0,Ye(),Le(),We=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class mn{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return fn(this.animations,"duration")}get iterationDuration(){return fn(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function fn(t,e){let n=0;for(let s=0;s<t.length;s++){const i=t[s][e];null!==i&&i>n&&(n=i)}return n}class gn extends mn{then(t,e){return this.finished.finally(t).then(()=>{})}}const yn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vn(t,e,n=1){i(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=function(t){const e=yn.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return a(t)?parseFloat(t):t}return z(r)?vn(r,e,n+1):r}const bn={type:"spring",stiffness:500,damping:25,restSpeed:10},Tn={type:"keyframes",duration:.8},wn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Mn=(t,{keyframes:e})=>e.length>2?Tn:Re.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:bn:wn;function Sn(t,e){if(t?.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function xn(t,e){const n=t?.[e]??t?.default??t;return n!==t?Sn(n,t):n}const An=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Vn=(t,e,n,s={},i,a)=>o=>{const l=xn(s,t)||{},u=l.delay||s.delay||0;let{elapsed:h=0}=s;h-=m(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-h,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:a?void 0:i};(function(t){for(const e in t)if(!An.has(e))return!0;return!1})(l)||Object.assign(c,Mn(t,c)),c.duration&&(c.duration=m(c.duration)),c.repeatDelay&&(c.repeatDelay=m(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(on(c),0===c.delay&&(d=!0)),(r.instantAnimations||r.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,on(c),c.delay=0),c.allowFlatten=!l.type&&!l.ease,d&&!a&&void 0!==e.get()){const t=ge(c.keyframes,l);if(void 0!==t)return void $.update(()=>{c.onUpdate(t),c.onComplete()})}return l.isSync?new we(c):new pn(c)};function kn(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function Cn(t,e,n,s){if("function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}return e}const Fn=new Set(["width","height","top","left","right","bottom",...Ee]);class Pn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=Y.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Y.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new p);const n=this.events[t].add(e);return"change"===t?()=>{n(),$.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Y.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return g(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Bn(t,e){return new Pn(t,e)}function En(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Bn(n))}function Rn(t){return(t=>Array.isArray(t))(t)?t[t.length-1]||0:t}function Dn(t,e){const n=function(t,e){const n=t.getProps();return Cn(n,e,n.custom,t)}(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const e in r){En(t,e,Rn(r[e]))}}const In=t=>Boolean(t&&t.getVelocity);function On(t,e){const n=t.getValue("willChange");if(s=n,Boolean(In(s)&&s.add))return n.add(e);if(!n&&r.WillChange){const n=new r.WillChange("auto");t.addValue("willChange",n),n.add(e)}var s}function Nn(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const $n="data-"+Nn("framerAppearId");function Kn(t){return t.props[$n]}function jn({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function Wn(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();r=r?Sn(r,l):l;const u=r?.reduceMotion;s&&(r=s);const h=[],c=i&&t.animationState&&t.animationState.getState()[i];for(const e in o){const s=t.getValue(e,t.latestValues[e]??null),i=o[e];if(void 0===i||c&&jn(c,e))continue;const a={delay:n,...xn(r||{},e)},l=s.get();if(void 0!==l&&!s.isAnimating()&&!Array.isArray(i)&&i===l&&!a.velocity){$.update(()=>s.set(i));continue}let d=!1;if(window.MotionHandoffAnimation){const n=Kn(t);if(n){const t=window.MotionHandoffAnimation(n,e,$);null!==t&&(a.startTime=t,d=!0)}}On(t,e);const p=u??t.shouldReduceMotion;s.start(Vn(e,s,i,p&&Fn.has(e)?{type:!1}:a,t,d));const m=s.animation;m&&h.push(m)}if(a){const e=()=>$.update(()=>{a&&Dn(t,a)});h.length?Promise.all(h).then(e):e()}return h}const Ln=t=>e=>e.test(t),Yn=[H,ht,ut,lt,dt,ct,{test:t=>"auto"===t,parse:t=>t}],Un=t=>Yn.find(Ln(t));function Xn(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||o(t))}const qn=new Set(["brightness","contrast","saturate","opacity"]);function zn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(tt)||[];if(!s)return t;const i=n.replace(s,"");let r=qn.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Zn=/\b([a-z-]*)\(.*?\)/gu,_n={...St,getAnimatableNone:t=>{const e=t.match(Zn);return e?e.map(zn).join(" "):t}},Hn={...St,getAnimatableNone:t=>{const e=St.parse(t);return St.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},Gn={...H,transform:Math.round},Jn={borderWidth:ht,borderTopWidth:ht,borderRightWidth:ht,borderBottomWidth:ht,borderLeftWidth:ht,borderRadius:ht,borderTopLeftRadius:ht,borderTopRightRadius:ht,borderBottomRightRadius:ht,borderBottomLeftRadius:ht,width:ht,maxWidth:ht,height:ht,maxHeight:ht,top:ht,right:ht,bottom:ht,left:ht,inset:ht,insetBlock:ht,insetBlockStart:ht,insetBlockEnd:ht,insetInline:ht,insetInlineStart:ht,insetInlineEnd:ht,padding:ht,paddingTop:ht,paddingRight:ht,paddingBottom:ht,paddingLeft:ht,paddingBlock:ht,paddingBlockStart:ht,paddingBlockEnd:ht,paddingInline:ht,paddingInlineStart:ht,paddingInlineEnd:ht,margin:ht,marginTop:ht,marginRight:ht,marginBottom:ht,marginLeft:ht,marginBlock:ht,marginBlockStart:ht,marginBlockEnd:ht,marginInline:ht,marginInlineStart:ht,marginInlineEnd:ht,fontSize:ht,backgroundPositionX:ht,backgroundPositionY:ht,...{rotate:lt,rotateX:lt,rotateY:lt,rotateZ:lt,scale:J,scaleX:J,scaleY:J,scaleZ:J,skew:lt,skewX:lt,skewY:lt,distance:ht,translateX:ht,translateY:ht,translateZ:ht,x:ht,y:ht,z:ht,perspective:ht,transformPerspective:ht,opacity:G,originX:pt,originY:pt,originZ:ht},zIndex:Gn,fillOpacity:G,strokeOpacity:G,numOctaves:Gn},Qn={...Jn,color:ft,backgroundColor:ft,outlineColor:ft,fill:ft,stroke:ft,borderColor:ft,borderTopColor:ft,borderRightColor:ft,borderBottomColor:ft,borderLeftColor:ft,filter:_n,WebkitFilter:_n,mask:Hn,WebkitMask:Hn},ts=t=>Qn[t],es=new Set([_n,Hn]);function ns(t,e){let n=ts(t);return es.has(n)||(n=St),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ss=new Set(["auto","none","0"]);class is extends Ue{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let s=t[n];if("string"==typeof s&&(s=s.trim(),z(s))){const i=vn(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!Fn.has(n)||2!==t.length)return;const[s,i]=t,r=Un(s),a=Un(i);if(_(s)!==_(i)&&Ne[n])this.needsMeasurement=!0;else if(r!==a)if(De(r)&&De(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else Ne[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Xn(t[e]))&&n.push(e);n.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!ss.has(e)&&Tt(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=ns(n,s)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ne[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=Ne[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const rs=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:as}=N(queueMicrotask,!1);function os(t){return"object"==typeof(e=t)&&null!==e&&"ownerSVGElement"in t;var e}const ls=[...Yn,ft,St],us=()=>({x:{min:0,max:0},y:{min:0,max:0}}),hs=new WeakMap;const cs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function ds(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||cs.some(e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e]));var e}const ps={current:null},ms={current:!1},fs="undefined"!=typeof window;const gs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ys={};class vs{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ue,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Y.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,$.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=ds(e),this.isVariantNode=function(t){return Boolean(ds(t)||t.variants)}(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==l[t]&&In(e)&&e.set(l[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,hs.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ms.current||function(){if(ms.current=!0,fs)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ps.current=t.matches;t.addEventListener("change",e),e()}else ps.current=!1}(),this.shouldReduceMotion=ps.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),K(this.notifyUpdate),K(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&ln.has(t)&&this.current instanceof HTMLElement){const{factory:n,keyframes:s,times:i,ease:r,duration:a}=e.accelerate,o=new en({element:this.current,name:t,keyframes:s,times:i,ease:r,duration:m(a)}),l=n(o);return void this.valueSubscriptions.set(t,()=>{l(),o.cancel()})}const n=Re.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&$.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),i&&i(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in ys){const e=ys[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<gs.length;e++){const n=gs[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){for(const s in e){const i=e[s],r=n[s];if(In(i))t.addValue(s,i);else if(In(r))t.addValue(s,Bn(i,{owner:t}));else if(r!==i)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(s);t.addValue(s,Bn(void 0!==e?e:i,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Bn(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var s;return null!=n&&("string"==typeof n&&(a(n)||o(n))?n=parseFloat(n):(s=n,!ls.find(Ln(s))&&St.test(e)&&(n=ns(t,e))),this.setBaseTarget(t,In(n)?n.get():n)),In(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let n;if("string"==typeof e||"object"==typeof e){const s=Cn(this.props,e,this.presenceContext?.custom);s&&(n=s[t])}if(e&&void 0!==n)return n;const s=this.getBaseTargetFromProps(this.props,t);return void 0===s||In(s)?void 0!==this.initialValues[t]&&void 0===n?void 0:this.baseTarget[t]:s}on(t,e){return this.events[t]||(this.events[t]=new p),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){as.render(this.render)}}class bs extends vs{constructor(){super(...arguments),this.KeyframeResolver=is}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;In(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}const Ts={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ws=Ee.length;function Ms(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const n=e[t];if(Re.has(t))a=!0;else if(X(t))i[t]=n;else{const e=rs(n,Jn[t]);t.startsWith("origin")?(o=!0,r[t]=e):s[t]=e}}if(e.transform||(a||n?s.transform=function(t,e,n){let s="",i=!0;for(let r=0;r<ws;r++){const a=Ee[r],o=t[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);l=a.startsWith("scale")?1===t:0===t}if(!l||n){const t=rs(o,Jn[a]);l||(i=!1,s+=`${Ts[a]||a}(${t}) `),n&&(e[a]=t)}}return s=s.trim(),n?s=n(e,i?"":s):i&&(s="none"),s}(e,t.transform,n):s.transform&&(s.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:n=0}=r;s.transformOrigin=`${t} ${e} ${n}`}}function Ss(t,{style:e,vars:n},s,i){const r=t.style;let a;for(a in e)r[a]=e[a];for(a in i?.applyProjectionStyles(r,s),n)r.setProperty(a,n[a])}function xs(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const As={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!ht.test(t))return t;t=parseFloat(t)}return`${xs(t,e.target.x)}% ${xs(t,e.target.y)}%`}},Vs={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=St.parse(t);if(i.length>5)return s;const r=St.createTransformer(t),a="number"!=typeof i[0]?1:0,o=n.x.scale*e.x,l=n.y.scale*e.y;i[0+a]/=o,i[1+a]/=l;const u=Vt(o,l,.5);return"number"==typeof i[2+a]&&(i[2+a]/=u),"number"==typeof i[3+a]&&(i[3+a]/=u),r(i)}},ks={borderRadius:{...As,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:As,borderTopRightRadius:As,borderBottomLeftRadius:As,borderBottomRightRadius:As,boxShadow:Vs};function Cs(t,{layout:e,layoutId:n}){return Re.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ks[t]||"opacity"===t)}function Fs(t,e,n){const s=t.style,i=e?.style,r={};if(!s)return r;for(const e in s)(In(s[e])||i&&In(i[e])||Cs(e,t)||void 0!==n?.getValue(e)?.liveStyle)&&(r[e]=s[e]);return r}class Ps extends bs{constructor(){super(...arguments),this.type="html",this.renderInstance=Ss}readValueFromInstance(t,e){if(Re.has(e))return this.projection?.isProjecting?Fe(e):((t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Pe(n,e)})(t,e);{const s=(n=t,window.getComputedStyle(n)),i=(X(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){Ms(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Fs(t,e,n)}}class Bs extends vs{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}const Es={offset:"stroke-dashoffset",array:"stroke-dasharray"},Rs={offset:"strokeDashoffset",array:"strokeDasharray"};const Ds=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Is(t,{attrX:e,attrY:n,attrScale:s,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},l,u,h){if(Ms(t,o,u),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=h?.transformBox??"fill-box",delete c.transformBox);for(const t of Ds)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==n&&(c.y=n),void 0!==s&&(c.scale=s),void 0!==i&&function(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Es:Rs;t[r.offset]=""+-s,t[r.array]=`${e} ${n}`}(c,i,r,a,!1)}const Os=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class Ns extends bs{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=us}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Re.has(e)){const t=ts(e);return t&&t.default||0}return e=Os.has(e)?e:Nn(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return function(t,e,n){const s=Fs(t,e,n);for(const n in t)(In(t[n])||In(e[n]))&&(s[-1!==Ee.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]);return s}(t,e,n)}build(t,e,n){Is(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,s){!function(t,e,n,s){Ss(t,e,void 0,s);for(const n in e.attrs)t.setAttribute(Os.has(n)?n:Nn(n),e.attrs[n])}(t,e,0,s)}mount(t){var e;this.isSVGTag="string"==typeof(e=t.tagName)&&"svg"===e.toLowerCase(),super.mount(t)}}function $s(t){return"object"==typeof t&&!Array.isArray(t)}function Ks(t,e,n,s){return null==t?[]:"string"==typeof t&&$s(e)?function(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}(t,n,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function js(t,e,n){return t*(e+1)}function Ws(t,e,n,s){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):s.get(e)??t}function Ls(e,n,s,i,r,a){!function(e,n,s){for(let i=0;i<e.length;i++){const r=e[i];r.at>n&&r.at<s&&(t(e,r),i--)}}(e,r,a);for(let t=0;t<n.length;t++)e.push({value:n[t],at:Vt(r,a,i[t]),easing:E(s,t)})}function Ys(t,e){for(let n=0;n<t.length;n++)t[n]=t[n]/(e+1)}function Us(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function Xs(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function qs(t,e){return e[t]||(e[t]=[]),e[t]}function zs(t){return Array.isArray(t)?t:[t]}function Zs(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const _s=t=>"number"==typeof t,Hs=t=>t.every(_s);function Gs(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=os(t)&&!function(t){return os(t)&&"svg"===t.tagName}(t)?new Ns(e):new Ps(e);n.mount(t),hs.set(t,n)}function Js(t){const e=new Bs({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),hs.set(t,e)}function Qs(t,e,n,s){const r=[];if(function(t,e){return In(t)||"number"==typeof t||"string"==typeof t&&!$s(e)}(t,e))r.push(function(t,e,n){const s=In(t)?t:Bn(t);return s.start(Vn("",s,e,n)),s.animation}(t,$s(e)&&e.default||e,n&&n.default||n));else{if(null==t)return r;const a=Ks(t,e,s),o=a.length;i(Boolean(o),"No valid elements provided.","no-valid-elements");for(let t=0;t<o;t++){const s=a[t],i=s instanceof Element?Gs:Js;hs.has(s)||i(s);const l=hs.get(s),u={...n};"delay"in u&&"function"==typeof u.delay&&(u.delay=u.delay(t,o)),r.push(...Wn(l,{...e,transition:u},{}))}}return r}function ti(t,e,n){const s=[],r=function(t,{defaultTransition:e={},...n}={},s,r){const a=e.duration||.3,o=new Map,l=new Map,u={},h=new Map;let c=0,p=0,f=0;for(let n=0;n<t.length;n++){const o=t[n];if("string"==typeof o){h.set(o,p);continue}if(!Array.isArray(o)){h.set(o.name,Ws(p,o.at,c,h));continue}let[d,g,y={}]=o;void 0!==y.at&&(p=Ws(p,y.at,c,h));let v=0;const b=(t,n,s,o=0,l=0)=>{const u=zs(t),{delay:h=0,times:c=pe(u),type:d=e.type||"keyframes",repeat:g,repeatType:y,repeatDelay:b=0,...T}=n;let{ease:w=e.ease||"easeOut",duration:M}=n;const S="function"==typeof h?h(o,l):h,x=u.length,A=tn(d)?d:r?.[d||"keyframes"];if(x<=2&&A){let t=100;if(2===x&&Hs(u)){const e=u[1]-u[0];t=Math.abs(e)}const n={...e,...T};void 0!==M&&(n.duration=m(M));const s=Lt(n,t,A);w=s.ease,M=s.duration}M??(M=a);const V=p+S;1===c.length&&0===c[0]&&(c[1]=1);const k=c.length-u.length;if(k>0&&de(c,k),1===u.length&&u.unshift(null),g){i(g<20,"Repeat count too high, must be less than 20","repeat-count-high"),M=js(M,g);const t=[...u],e=[...c];w=Array.isArray(w)?[...w]:[w];const n=[...w];for(let s=0;s<g;s++){u.push(...t);for(let i=0;i<t.length;i++)c.push(e[i]+(s+1)),w.push(0===i?"linear":E(n,i-1))}Ys(c,g)}const C=V+M;Ls(s,u,w,c,V,C),v=Math.max(S+M,v),f=Math.max(C,f)};if(In(d))b(g,y,qs("default",Xs(d,l)));else{const t=Ks(d,g,s,u),e=t.length;for(let n=0;n<e;n++){const s=Xs(t[n],l);for(const t in g)b(g[t],Zs(y,t),qs(t,s),n,e)}}c=p,p+=v}return l.forEach((t,s)=>{for(const i in t){const r=t[i];r.sort(Us);const a=[],l=[],u=[];for(let t=0;t<r.length;t++){const{at:e,value:n,easing:s}=r[t];a.push(n),l.push(d(0,f,e)),u.push(s||"easeOut")}0!==l[0]&&(l.unshift(0),a.unshift(a[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),a.push(null)),o.has(s)||o.set(s,{keyframes:{},transition:{}});const h=o.get(s);h.keyframes[i]=a;const{type:c,...p}=e;h.transition[i]={...p,duration:f,ease:u,times:l,...n}}}),o}(t.map(t=>{if(Array.isArray(t)&&"function"==typeof t[0]){const e=t[0],n=Bn(0);return n.on("change",e),1===t.length?[n,[0,1]]:2===t.length?[n,[0,1],t[1]]:[n,t[1],t[2]]}return t}),e,n,{spring:le});return r.forEach(({keyframes:t,transition:e},n)=>{s.push(...Qs(n,t,e))}),s}function ei(e={}){const{scope:n,reduceMotion:s}=e;return function(e,i,r){let a,o=[];if(l=e,Array.isArray(l)&&l.some(Array.isArray)){const{onComplete:t,...r}=i||{};"function"==typeof t&&(a=t),o=ti(e,void 0!==s?{reduceMotion:s,...r}:r,n)}else{const{onComplete:t,...l}=r||{};"function"==typeof t&&(a=t),o=Qs(e,i,void 0!==s?{reduceMotion:s,...l}:l,n)}var l;const u=new gn(o);return a&&u.finished.then(a),n&&(n.animations.push(u),u.finished.then(()=>{t(n.animations,u)})),u}}const ni=ei();export{ni as animate,ei as createScopedAnimate}; | ||
| function t(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const e=(t,e,n)=>n>e?e:n<t?t:n;function n(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let s=()=>{},i=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(s=(t,e,s)=>{t||"undefined"==typeof console||console.warn(n(e,s))},i=(t,e,s)=>{if(!t)throw new Error(n(e,s))});const r={},a=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),o=t=>/^0[^.\s]+$/u.test(t);function l(t){let e;return()=>(void 0===e&&(e=t()),e)}const u=t=>t,h=(...t)=>t.reduce((t,e)=>n=>e(t(n))),c=(t,e,n)=>{const s=e-t;return s?(n-t)/s:1};class d{constructor(){this.subscriptions=[]}add(e){var n,s;return n=this.subscriptions,s=e,-1===n.indexOf(s)&&n.push(s),()=>t(this.subscriptions,e)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const p=t=>1e3*t,m=t=>t/1e3,f=(t,e)=>e?t*(1e3/e):0,g=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function y(t,e,n,s){if(t===e&&n===s)return u;const i=e=>function(t,e,n,s,i){let r,a,o=0;do{a=e+(n-e)/2,r=g(a,s,i)-t,r>0?n=a:e=a}while(Math.abs(r)>1e-7&&++o<12);return a}(e,0,1,t,n);return t=>0===t||1===t?t:g(i(t),e,s)}const v=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b=t=>e=>1-t(1-e),T=y(.33,1.53,.69,.99),w=b(T),M=v(w),S=t=>t>=1?1:(t*=2)<1?.5*w(t):.5*(2-Math.pow(2,-10*(t-1))),x=t=>1-Math.sin(Math.acos(t)),A=b(x),k=v(x),V=y(.42,0,1,1),C=y(0,0,.58,1),F=y(.42,0,.58,1),P=t=>Array.isArray(t)&&"number"!=typeof t[0];function B(t,e){return P(t)?t[((t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t})(0,t.length,e)]:t}const E=t=>Array.isArray(t)&&"number"==typeof t[0],R={linear:u,easeIn:V,easeInOut:F,easeOut:C,circIn:x,circInOut:k,circOut:A,backIn:w,backInOut:M,backOut:T,anticipate:S},D=t=>{if(E(t)){i(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,s,r]=t;return y(e,n,s,r)}return"string"==typeof t?(i(void 0!==R[t],`Invalid easing type '${t}'`,"invalid-easing-type"),R[t]):t},I=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function O(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=I.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(l.schedule(e),t()),e(a)}const l={schedule:(t,i=!1,a=!1)=>{const o=a&&s?e:n;return i&&r.add(t),o.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{if(a=t,s)return void(i=!0);s=!0;const r=e;e=n,n=r,e.forEach(o),e.clear(),s=!1,i&&(i=!1,l.process(t))}};return l}(a),t),{}),{setup:l,read:u,resolveKeyframes:h,preUpdate:c,update:d,preRender:p,render:m,postRender:f}=o,g=()=>{const a=r.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=s?1e3/60:Math.max(Math.min(o-i.timestamp,40),1)),i.timestamp=o,i.isProcessing=!0,l.process(i),u.process(i),h.process(i),c.process(i),d.process(i),p.process(i),m.process(i),f.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(g))};return{schedule:I.reduce((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(g)),a.schedule(e,r,o)),e},{}),cancel:t=>{for(let e=0;e<I.length;e++)o[I[e]].cancel(t)},state:i,steps:o}}const{schedule:N,cancel:$,state:K}=O("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:u,!0);let j;function W(){j=void 0}const L={now:()=>(void 0===j&&L.set(K.isProcessing||r.useManualTiming?K.timestamp:performance.now()),j),set:t=>{j=t,queueMicrotask(W)}},Y=t=>e=>"string"==typeof e&&e.startsWith(t),U=Y("--"),X=Y("var(--"),q=t=>!!X(t)&&z.test(t.split("/*")[0].trim()),z=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Z(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const _={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},H={..._,transform:t=>e(0,1,t)},G={..._,default:1},J=t=>Math.round(1e5*t)/1e5,Q=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const tt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,et=(t,e)=>n=>Boolean("string"==typeof n&&tt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),nt=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(Q);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},st={..._,transform:t=>Math.round((t=>e(0,255,t))(t))},it={test:et("rgb","red"),parse:nt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+st.transform(t)+", "+st.transform(e)+", "+st.transform(n)+", "+J(H.transform(s))+")"};const rt={test:et("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:it.transform},at=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ot=at("deg"),lt=at("%"),ut=at("px"),ht=at("vh"),ct=at("vw"),dt=(()=>({...lt,parse:t=>lt.parse(t)/100,transform:t=>lt.transform(100*t)}))(),pt={test:et("hsl","hue"),parse:nt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+lt.transform(J(e))+", "+lt.transform(J(n))+", "+J(H.transform(s))+")"},mt={test:t=>it.test(t)||rt.test(t)||pt.test(t),parse:t=>it.test(t)?it.parse(t):pt.test(t)?pt.parse(t):rt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?it.transform(t):pt.transform(t),getAnimatableNone:t=>{const e=mt.parse(t);return e.alpha=0,mt.transform(e)}},ft=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const gt="number",yt="color",vt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bt(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(vt,t=>(mt.test(t)?(s.color.push(r),i.push(yt),n.push(mt.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(gt),n.push(parseFloat(t))),++r,"${}")).split("${}");return{values:n,split:a,indexes:s,types:i}}function Tt({split:t,types:e}){const n=t.length;return s=>{let i="";for(let r=0;r<n;r++)if(i+=t[r],void 0!==s[r]){const t=e[r];i+=t===gt?J(s[r]):t===yt?mt.transform(s[r]):s[r]}return i}}const wt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(n=t)?0:mt.test(n)?mt.getAnimatableNone(n):n;var n};const Mt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(Q)?.length||0)+(t.match(ft)?.length||0)>0},parse:function(t){return bt(t).values},createTransformer:function(t){return Tt(bt(t))},getAnimatableNone:function(t){const e=bt(t);return Tt(e)(e.values.map((t,n)=>wt(t,e.split[n])))}};function St(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function xt(t,e){return n=>n>0?e:t}const At=(t,e,n)=>t+(e-t)*n,kt=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},Vt=[rt,it,pt];function Ct(t){const e=(n=t,Vt.find(t=>t.test(n)));var n;if(s(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===pt&&(i=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,a=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,o=2*n-s;i=St(o,s,t+1/3),r=St(o,s,t),a=St(o,s,t-1/3)}else i=r=a=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*a),alpha:s}}(i)),i}const Ft=(t,e)=>{const n=Ct(t),s=Ct(e);if(!n||!s)return xt(t,e);const i={...n};return t=>(i.red=kt(n.red,s.red,t),i.green=kt(n.green,s.green,t),i.blue=kt(n.blue,s.blue,t),i.alpha=At(n.alpha,s.alpha,t),it.transform(i))},Pt=new Set(["none","hidden"]);function Bt(t,e){return n=>At(t,e,n)}function Et(t){return"number"==typeof t?Bt:"string"==typeof t?q(t)?xt:mt.test(t)?Ft:It:Array.isArray(t)?Rt:"object"==typeof t?mt.test(t)?Ft:Dt:xt}function Rt(t,e){const n=[...t],s=n.length,i=t.map((t,n)=>Et(t)(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function Dt(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=Et(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const It=(t,e)=>{const n=Mt.createTransformer(e),i=bt(t),r=bt(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Pt.has(t)&&!r.values.length||Pt.has(e)&&!i.values.length?function(t,e){return Pt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):h(Rt(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],a=t.indexes[r][s[r]],o=t.values[a]??0;n[i]=o,s[r]++}return n}(i,r),r.values),n):(s(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),xt(t,e))};function Ot(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return At(t,e,n);return Et(t)(t,e)}const Nt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>N.update(e,t),stop:()=>$(e),now:()=>K.isProcessing?K.timestamp:L.now()}},$t=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Kt=2e4;function jt(t){let e=0;let n=t.next(e);for(;!n.done&&e<Kt;)e+=50,n=t.next(e);return e>=Kt?1/0:e}function Wt(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(jt(s),Kt);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:m(i)}}const Lt=100,Yt=10,Ut=1,Xt=0,qt=800,zt=.3,Zt=.3,_t={granular:.01,default:2},Ht={granular:.005,default:.5},Gt=.01,Jt=10,Qt=.05,te=1;function ee(t,e){return t*Math.sqrt(1-e*e)}const ne=.001;const se=["duration","bounce"],ie=["stiffness","damping","mass"];function re(t,e){return e.some(e=>void 0!==t[e])}function ae(t){let n={velocity:Xt,stiffness:Lt,damping:Yt,mass:Ut,isResolvedFromDuration:!1,...t};if(!re(t,ie)&&re(t,se))if(n.velocity=0,t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),r=i*i,a=2*e(.05,1,1-(t.bounce||0))*Math.sqrt(r);n={...n,mass:Ut,stiffness:r,damping:a}}else{const i=function({duration:t=qt,bounce:n=zt,velocity:i=Xt,mass:r=Ut}){let a,o;s(t<=p(Jt),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-n;l=e(Qt,te,l),t=e(Gt,Jt,m(t)),l<1?(a=e=>{const n=e*l,s=n*t,r=n-i,a=ee(e,l),o=Math.exp(-s);return ne-r/a*o},o=e=>{const n=e*l*t,s=n*i+i,r=Math.pow(l,2)*Math.pow(e,2)*t,o=Math.exp(-n),u=ee(Math.pow(e,2),l);return(-a(e)+ne>0?-1:1)*((s-r)*o)/u}):(a=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(i-e)));const u=function(t,e,n){let s=n;for(let n=1;n<12;n++)s-=t(s)/e(s);return s}(a,o,5/t);if(t=p(t),isNaN(u))return{stiffness:Lt,damping:Yt,duration:t};{const e=Math.pow(u,2)*r;return{stiffness:e,damping:2*l*Math.sqrt(r*e),duration:t}}}({...t,velocity:0});n={...n,...i,mass:Ut},n.isResolvedFromDuration=!0}return n}function oe(t=Zt,e=zt){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:r},{stiffness:l,damping:u,mass:h,duration:c,velocity:d,isResolvedFromDuration:f}=ae({...n,velocity:-m(n.velocity||0)}),g=d||0,y=u/(2*Math.sqrt(l*h)),v=a-r,b=m(Math.sqrt(l/h)),T=Math.abs(v)<5;let w,M,S,x,A,k;if(s||(s=T?_t.granular:_t.default),i||(i=T?Ht.granular:Ht.default),y<1)S=ee(b,y),x=(g+y*b*v)/S,w=t=>{const e=Math.exp(-y*b*t);return a-e*(x*Math.sin(S*t)+v*Math.cos(S*t))},A=y*b*x+v*S,k=y*b*v-x*S,M=t=>Math.exp(-y*b*t)*(A*Math.sin(S*t)+k*Math.cos(S*t));else if(1===y){w=t=>a-Math.exp(-b*t)*(v+(g+b*v)*t);const t=g+b*v;M=e=>Math.exp(-b*e)*(b*t*e-g)}else{const t=b*Math.sqrt(y*y-1);w=e=>{const n=Math.exp(-y*b*e),s=Math.min(t*e,300);return a-n*((g+y*b*v)*Math.sinh(s)+t*v*Math.cosh(s))/t};const e=(g+y*b*v)/t,n=y*b*e-v*t,s=y*b*v-e*t;M=e=>{const i=Math.exp(-y*b*e),r=Math.min(t*e,300);return i*(n*Math.sinh(r)+s*Math.cosh(r))}}const V={calculatedDuration:f&&c||null,velocity:t=>p(M(t)),next:t=>{if(!f&&y<1){const e=Math.exp(-y*b*t),n=Math.sin(S*t),r=Math.cos(S*t),l=a-e*(x*n+v*r),u=p(e*(A*n+k*r));return o.done=Math.abs(u)<=s&&Math.abs(a-l)<=i,o.value=o.done?a:l,o}const e=w(t);if(f)o.done=t>=c;else{const n=p(M(t));o.done=Math.abs(n)<=s&&Math.abs(a-e)<=i}return o.value=o.done?a:e,o},toString:()=>{const t=Math.min(jt(V),Kt),e=$t(e=>V.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return V}oe.applyToOptions=t=>{const e=Wt(t,100,oe);return t.ease=e.ease,t.duration=p(e.duration),t.type="keyframes",t};function le(t,e,n){const s=Math.max(e-5,0);return f(n-t(s),e-s)}function ue({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let m=n*e;const f=c+m,g=void 0===a?f:a(f);g!==f&&(m=g-c);const y=t=>-m*Math.exp(-t/s),v=t=>g+y(t),b=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let T,w;const M=t=>{var e;(e=d.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(T=t,w=oe({keyframes:[d.value,p(d.value)],velocity:le(v,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:h}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,b(t),M(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&b(t),d)}}}function he(t,n,{clamp:s=!0,ease:a,mixer:o}={}){const l=t.length;if(i(l===n.length,"Both input and output ranges must be the same length","range-length"),1===l)return()=>n[0];if(2===l&&n[0]===n[1])return()=>n[1];const d=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),n=[...n].reverse());const p=function(t,e,n){const s=[],i=n||r.mix||Ot,a=t.length-1;for(let n=0;n<a;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||u:e;r=h(t,r)}s.push(r)}return s}(n,a,o),m=p.length,f=e=>{if(d&&e<t[0])return n[0];let s=0;if(m>1)for(;s<t.length-2&&!(e<t[s+1]);s++);const i=c(t[s],t[s+1],e);return p[s](i)};return s?n=>f(e(t[0],t[l-1],n)):f}function ce(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=c(0,e,s);t.push(At(n,1,i))}}function de(t){const e=[0];return ce(e,t.length-1),e}function pe({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=P(s)?s.map(D):D(s),r={done:!1,value:e[0]},a=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:de(e),t),o=he(a,e,{ease:Array.isArray(i)?i:(l=e,u=i,l.map(()=>u||F).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(r.value=o(e),r.done=e>=t,r)}}const me=t=>null!==t;function fe(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(me),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const ge={decay:ue,inertia:ue,tween:pe,keyframes:pe,spring:oe};function ye(t){"string"==typeof t.type&&(t.type=ge[t.type])}class ve{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const be=t=>t/100;class Te extends ve{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==L.now()&&this.tick(L.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;ye(t);const{type:e=pe,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:r=0}=t;let{keyframes:a}=t;const o=e||pe;o!==pe&&"number"!=typeof a[0]&&(this.mixKeyframes=h(be,Ot(a[0],a[1])),a=[0,100]);const l=o({...t,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...t,keyframes:[...a].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=jt(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);const{delay:u=0,keyframes:h,repeat:c,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let b,T=this.currentTime,w=s;if(c){const t=Math.min(this.currentTime,i)/o;let n=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&n--,n=Math.min(n,c+1);Boolean(n%2)&&("reverse"===d?(s=1-s,p&&(s-=p/o)):"mirror"===d&&(w=a)),T=e(0,1,s)*o}v?(this.delayState.value=h[0],b=this.delayState):b=w.next(T),r&&!v&&(b.value=r(b.value));let{done:M}=b;v||null===l||(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return S&&m!==ue&&(b.value=fe(h,this.options,g,this.speed)),f&&f(b.value),S&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return m(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+m(t)}get time(){return m(this.currentTime)}set time(t){t=p(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return le(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(L.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=m(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Nt,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(L.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const we=t=>180*t/Math.PI,Me=t=>{const e=we(Math.atan2(t[1],t[0]));return xe(e)},Se={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Me,rotateZ:Me,skewX:t=>we(Math.atan(t[1])),skewY:t=>we(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},xe=t=>((t%=360)<0&&(t+=360),t),Ae=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ke=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ve={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ae,scaleY:ke,scale:t=>(Ae(t)+ke(t))/2,rotateX:t=>xe(we(Math.atan2(t[6],t[5]))),rotateY:t=>xe(we(Math.atan2(-t[2],t[0]))),rotateZ:Me,rotate:Me,skewX:t=>we(Math.atan(t[4])),skewY:t=>we(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ce(t){return t.includes("scale")?1:0}function Fe(t,e){if(!t||"none"===t)return Ce(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Ve,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Se,i=e}if(!i)return Ce(e);const r=s[e],a=i[1].split(",").map(Pe);return"function"==typeof r?r(a):a[r]}function Pe(t){return parseFloat(t.trim())}const Be=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ee=(()=>new Set(Be))(),Re=t=>t===_||t===ut,De=new Set(["x","y","z"]),Ie=Be.filter(t=>!De.has(t));const Oe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Fe(e,"x"),y:(t,{transform:e})=>Fe(e,"y")};Oe.translateX=Oe.x,Oe.translateY=Oe.y;const Ne=new Set;let $e=!1,Ke=!1,je=!1;function We(){if(Ke){const t=Array.from(Ne).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),n=new Map;e.forEach(t=>{const e=function(t){const e=[];return Ie.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}(t);e.length&&(n.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=n.get(t);e&&e.forEach(([e,n])=>{t.getValue(e)?.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Ke=!1,$e=!1,Ne.forEach(t=>t.complete(je)),Ne.clear()}function Le(){Ne.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ke=!0)})}class Ye{constructor(t,e,n,s,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Ne.add(this),$e||($e=!0,N.read(Le),N.resolveKeyframes(We))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ne.delete(this)}cancel(){"scheduled"===this.state&&(Ne.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function Ue(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}const Xe={};function qe(t,e){const n=l(t);return()=>Xe[e]??n()}const ze=qe(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Ze=qe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),_e=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,He={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:_e([0,.65,.55,1]),circOut:_e([.55,0,1,.45]),backIn:_e([.31,.01,.66,-.59]),backOut:_e([.33,1.53,.69,.99])};function Ge(t,e){return t?"function"==typeof t?Ze()?$t(t,e):"ease-out":E(t)?_e(t):Array.isArray(t)?t.map(t=>Ge(t,e)||He.easeOut):He[t]:void 0}function Je(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const h={[e]:n};l&&(h.offset=l);const c=Ge(o,i);Array.isArray(c)&&(h.easing=c);const d={delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};u&&(d.pseudoElement=u);return t.animate(h,d)}function Qe(t){return"function"==typeof t&&"applyToOptions"in t}class tn extends ve{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:s,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,i("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=function({type:t,...e}){return Qe(t)&&Ze()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Je(e,n,s,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=fe(s,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Ue(e,n,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return m(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+m(t)}get time(){return m(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=p(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:n,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&ze()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),u):s(this)}}const en={anticipate:S,backInOut:M,circInOut:k};function nn(t){"string"==typeof t.ease&&t.ease in en&&(t.ease=en[t.ease])}class sn extends tn{constructor(t){nn(t),ye(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...a}=this.options;if(!n)return;if(void 0!==t)return void n.set(t);const o=new Te({...a,autoplay:!1}),l=Math.max(10,L.now()-this.startTime),u=e(0,10,l-10),h=o.sample(l).value,{name:c}=this.options;r&&c&&Ue(r,c,h),n.setWithVelocity(o.sample(Math.max(0,l-u)).value,h,u),o.stop()}}const rn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Mt.test(t)&&"0"!==t||t.startsWith("url(")));function an(t){t.duration=0,t.type="keyframes"}const on=new Set(["opacity","clipPath","filter","transform"]),ln=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const un=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),hn=l(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function cn(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:a,keyframes:o}=t,l=e?.owner?.current;if(!(l instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:h}=e.owner.getProps();return hn()&&n&&(on.has(n)||un.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&ln.test(t[e]))return!0;return!1}(o))&&("transform"!==n||!h)&&!u&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class dn extends ve{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=L.now();const c={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,name:o,motionValue:l,element:u,...h},d=u?.KeyframeResolver||Ye;this.keyframeResolver=new d(a,(t,e,n)=>this.onKeyframesResolved(t,e,c,!n),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:h,isHandoff:c,onUpdate:d}=n;this.resolvedAt=L.now();let p=!0;(function(t,e,n,i){const r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;const a=t[t.length-1],o=rn(r,e),l=rn(a,e);return s(o===l,`You are trying to animate ${e} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!(!o||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||Qe(n))&&i)})(t,a,o,l)||(p=!1,!r.instantAnimations&&h||d?.(fe(t,n,e)),t[0]=t[t.length-1],an(n),n.repeat=0);const m={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},f=p&&!c&&cn(m),g=m.motionValue?.owner?.current;let y;if(f)try{y=new sn({...m,element:g})}catch{y=new Te(m)}else y=new Te(m);y.finished.then(()=>{this.notifyFinished()}).catch(u),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),je=!0,Le(),We(),je=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class pn{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return mn(this.animations,"duration")}get iterationDuration(){return mn(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function mn(t,e){let n=0;for(let s=0;s<t.length;s++){const i=t[s][e];null!==i&&i>n&&(n=i)}return n}class fn extends pn{then(t,e){return this.finished.finally(t).then(()=>{})}}const gn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function yn(t,e,n=1){i(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=function(t){const e=gn.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return a(t)?parseFloat(t):t}return q(r)?yn(r,e,n+1):r}const vn={type:"spring",stiffness:500,damping:25,restSpeed:10},bn={type:"keyframes",duration:.8},Tn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},wn=(t,{keyframes:e})=>e.length>2?bn:Ee.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:vn:Tn;function Mn(t,e){if(t?.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function Sn(t,e){const n=t?.[e]??t?.default??t;return n!==t?Mn(n,t):n}const xn=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const An=(t,e,n,s={},i,a)=>o=>{const l=Sn(s,t)||{},u=l.delay||s.delay||0;let{elapsed:h=0}=s;h-=p(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-h,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:a?void 0:i};(function(t){for(const e in t)if(!xn.has(e))return!0;return!1})(l)||Object.assign(c,wn(t,c)),c.duration&&(c.duration=p(c.duration)),c.repeatDelay&&(c.repeatDelay=p(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(an(c),0===c.delay&&(d=!0)),(r.instantAnimations||r.skipAnimations||i?.shouldSkipAnimations||l.skipAnimations)&&(d=!0,an(c),c.delay=0),c.allowFlatten=!l.type&&!l.ease,d&&!a&&void 0!==e.get()){const t=fe(c.keyframes,l);if(void 0!==t)return void N.update(()=>{c.onUpdate(t),c.onComplete()})}return l.isSync?new Te(c):new dn(c)};function kn(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function Vn(t,e,n,s){if("function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}return e}const Cn=new Set(["width","height","top","left","right","bottom",...Be]);class Fn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=L.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=L.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new d);const n=this.events[t].add(e);return"change"===t?()=>{n(),N.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=L.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return f(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Pn(t,e){return new Fn(t,e)}function Bn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Pn(n))}function En(t){return(t=>Array.isArray(t))(t)?t[t.length-1]||0:t}function Rn(t,e){const n=function(t,e){const n=t.getProps();return Vn(n,e,n.custom,t)}(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const e in r){Bn(t,e,En(r[e]))}}const Dn=t=>Boolean(t&&t.getVelocity);function In(t,e){const n=t.getValue("willChange");if(s=n,Boolean(Dn(s)&&s.add))return n.add(e);if(!n&&r.WillChange){const n=new r.WillChange("auto");t.addValue("willChange",n),n.add(e)}var s}function On(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Nn="data-"+On("framerAppearId");function $n(t){return t.props[Nn]}function Kn({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function jn(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();r=r?Mn(r,l):l;const u=r?.reduceMotion,h=r?.skipAnimations;s&&(r=s);const c=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const e in o){const s=t.getValue(e,t.latestValues[e]??null),i=o[e];if(void 0===i||d&&Kn(d,e))continue;const a={delay:n,...Sn(r||{},e)};h&&(a.skipAnimations=!0);const l=s.get();if(void 0!==l&&!s.isAnimating()&&!Array.isArray(i)&&i===l&&!a.velocity){N.update(()=>s.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){const n=$n(t);if(n){const t=window.MotionHandoffAnimation(n,e,N);null!==t&&(a.startTime=t,p=!0)}}In(t,e);const m=u??t.shouldReduceMotion;s.start(An(e,s,i,m&&Cn.has(e)?{type:!1}:a,t,p));const f=s.animation;f&&c.push(f)}if(a){const e=()=>N.update(()=>{a&&Rn(t,a)});c.length?Promise.all(c).then(e):e()}return c}const Wn=t=>e=>e.test(t),Ln=[_,ut,lt,ot,ct,ht,{test:t=>"auto"===t,parse:t=>t}],Yn=t=>Ln.find(Wn(t));function Un(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||o(t))}const Xn=new Set(["brightness","contrast","saturate","opacity"]);function qn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(Q)||[];if(!s)return t;const i=n.replace(s,"");let r=Xn.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const zn=/\b([a-z-]*)\(.*?\)/gu,Zn={...Mt,getAnimatableNone:t=>{const e=t.match(zn);return e?e.map(qn).join(" "):t}},_n={...Mt,getAnimatableNone:t=>{const e=Mt.parse(t);return Mt.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},Hn={..._,transform:Math.round},Gn={borderWidth:ut,borderTopWidth:ut,borderRightWidth:ut,borderBottomWidth:ut,borderLeftWidth:ut,borderRadius:ut,borderTopLeftRadius:ut,borderTopRightRadius:ut,borderBottomRightRadius:ut,borderBottomLeftRadius:ut,width:ut,maxWidth:ut,height:ut,maxHeight:ut,top:ut,right:ut,bottom:ut,left:ut,inset:ut,insetBlock:ut,insetBlockStart:ut,insetBlockEnd:ut,insetInline:ut,insetInlineStart:ut,insetInlineEnd:ut,padding:ut,paddingTop:ut,paddingRight:ut,paddingBottom:ut,paddingLeft:ut,paddingBlock:ut,paddingBlockStart:ut,paddingBlockEnd:ut,paddingInline:ut,paddingInlineStart:ut,paddingInlineEnd:ut,margin:ut,marginTop:ut,marginRight:ut,marginBottom:ut,marginLeft:ut,marginBlock:ut,marginBlockStart:ut,marginBlockEnd:ut,marginInline:ut,marginInlineStart:ut,marginInlineEnd:ut,fontSize:ut,backgroundPositionX:ut,backgroundPositionY:ut,...{rotate:ot,rotateX:ot,rotateY:ot,rotateZ:ot,scale:G,scaleX:G,scaleY:G,scaleZ:G,skew:ot,skewX:ot,skewY:ot,distance:ut,translateX:ut,translateY:ut,translateZ:ut,x:ut,y:ut,z:ut,perspective:ut,transformPerspective:ut,opacity:H,originX:dt,originY:dt,originZ:ut},zIndex:Hn,fillOpacity:H,strokeOpacity:H,numOctaves:Hn},Jn={...Gn,color:mt,backgroundColor:mt,outlineColor:mt,fill:mt,stroke:mt,borderColor:mt,borderTopColor:mt,borderRightColor:mt,borderBottomColor:mt,borderLeftColor:mt,filter:Zn,WebkitFilter:Zn,mask:_n,WebkitMask:_n},Qn=t=>Jn[t],ts=new Set([Zn,_n]);function es(t,e){let n=Qn(t);return ts.has(n)||(n=Mt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ns=new Set(["auto","none","0"]);class ss extends Ye{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let s=t[n];if("string"==typeof s&&(s=s.trim(),q(s))){const i=yn(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!Cn.has(n)||2!==t.length)return;const[s,i]=t,r=Yn(s),a=Yn(i);if(Z(s)!==Z(i)&&Oe[n])this.needsMeasurement=!0;else if(r!==a)if(Re(r)&&Re(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else Oe[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Un(t[e]))&&n.push(e);n.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!ns.has(e)&&bt(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=es(n,s)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Oe[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=Oe[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const is=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:rs}=O(queueMicrotask,!1);function as(t){return"object"==typeof(e=t)&&null!==e&&"ownerSVGElement"in t;var e}const os=[...Ln,mt,Mt],ls=()=>({x:{min:0,max:0},y:{min:0,max:0}}),us=new WeakMap;const hs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function cs(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||hs.some(e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e]));var e}const ds={current:null},ps={current:!1},ms="undefined"!=typeof window;const fs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gs={};class ys{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ye,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=L.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,N.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=cs(e),this.isVariantNode=function(t){return Boolean(cs(t)||t.variants)}(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==l[t]&&Dn(e)&&e.set(l[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,us.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ps.current||function(){if(ps.current=!0,ms)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ds.current=t.matches;t.addEventListener("change",e),e()}else ds.current=!1}(),this.shouldReduceMotion=ds.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),$(this.notifyUpdate),$(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&on.has(t)&&this.current instanceof HTMLElement){const{factory:n,keyframes:s,times:i,ease:r,duration:a}=e.accelerate,o=new tn({element:this.current,name:t,keyframes:s,times:i,ease:r,duration:p(a)}),l=n(o);return void this.valueSubscriptions.set(t,()=>{l(),o.cancel()})}const n=Ee.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&N.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),i&&i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in gs){const e=gs[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<fs.length;e++){const n=fs[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){for(const s in e){const i=e[s],r=n[s];if(Dn(i))t.addValue(s,i);else if(Dn(r))t.addValue(s,Pn(i,{owner:t}));else if(r!==i)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(s);t.addValue(s,Pn(void 0!==e?e:i,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Pn(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var s;return null!=n&&("string"==typeof n&&(a(n)||o(n))?n=parseFloat(n):(s=n,!os.find(Wn(s))&&Mt.test(e)&&(n=es(t,e))),this.setBaseTarget(t,Dn(n)?n.get():n)),Dn(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let n;if("string"==typeof e||"object"==typeof e){const s=Vn(this.props,e,this.presenceContext?.custom);s&&(n=s[t])}if(e&&void 0!==n)return n;const s=this.getBaseTargetFromProps(this.props,t);return void 0===s||Dn(s)?void 0!==this.initialValues[t]&&void 0===n?void 0:this.baseTarget[t]:s}on(t,e){return this.events[t]||(this.events[t]=new d),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){rs.render(this.render)}}class vs extends ys{constructor(){super(...arguments),this.KeyframeResolver=ss}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Dn(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}const bs={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Ts=Be.length;function ws(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const n=e[t];if(Ee.has(t))a=!0;else if(U(t))i[t]=n;else{const e=is(n,Gn[t]);t.startsWith("origin")?(o=!0,r[t]=e):s[t]=e}}if(e.transform||(a||n?s.transform=function(t,e,n){let s="",i=!0;for(let r=0;r<Ts;r++){const a=Be[r],o=t[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);l=a.startsWith("scale")?1===t:0===t}if(!l||n){const t=is(o,Gn[a]);l||(i=!1,s+=`${bs[a]||a}(${t}) `),n&&(e[a]=t)}}return s=s.trim(),n?s=n(e,i?"":s):i&&(s="none"),s}(e,t.transform,n):s.transform&&(s.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:n=0}=r;s.transformOrigin=`${t} ${e} ${n}`}}function Ms(t,{style:e,vars:n},s,i){const r=t.style;let a;for(a in e)r[a]=e[a];for(a in i?.applyProjectionStyles(r,s),n)r.setProperty(a,n[a])}function Ss(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const xs={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!ut.test(t))return t;t=parseFloat(t)}return`${Ss(t,e.target.x)}% ${Ss(t,e.target.y)}%`}},As={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=Mt.parse(t);if(i.length>5)return s;const r=Mt.createTransformer(t),a="number"!=typeof i[0]?1:0,o=n.x.scale*e.x,l=n.y.scale*e.y;i[0+a]/=o,i[1+a]/=l;const u=At(o,l,.5);return"number"==typeof i[2+a]&&(i[2+a]/=u),"number"==typeof i[3+a]&&(i[3+a]/=u),r(i)}},ks={borderRadius:{...xs,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:xs,borderTopRightRadius:xs,borderBottomLeftRadius:xs,borderBottomRightRadius:xs,boxShadow:As};function Vs(t,{layout:e,layoutId:n}){return Ee.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ks[t]||"opacity"===t)}function Cs(t,e,n){const s=t.style,i=e?.style,r={};if(!s)return r;for(const e in s)(Dn(s[e])||i&&Dn(i[e])||Vs(e,t)||void 0!==n?.getValue(e)?.liveStyle)&&(r[e]=s[e]);return r}class Fs extends vs{constructor(){super(...arguments),this.type="html",this.renderInstance=Ms}readValueFromInstance(t,e){if(Ee.has(e))return this.projection?.isProjecting?Ce(e):((t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Fe(n,e)})(t,e);{const s=(n=t,window.getComputedStyle(n)),i=(U(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){ws(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Cs(t,e,n)}}class Ps extends ys{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}const Bs={offset:"stroke-dashoffset",array:"stroke-dasharray"},Es={offset:"strokeDashoffset",array:"strokeDasharray"};const Rs=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Ds(t,{attrX:e,attrY:n,attrScale:s,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},l,u,h){if(ws(t,o,u),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=h?.transformBox??"fill-box",delete c.transformBox);for(const t of Rs)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==n&&(c.y=n),void 0!==s&&(c.scale=s),void 0!==i&&function(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Bs:Es;t[r.offset]=""+-s,t[r.array]=`${e} ${n}`}(c,i,r,a,!1)}const Is=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class Os extends vs{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ls}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(Ee.has(e)){const t=Qn(e);return t&&t.default||0}return e=Is.has(e)?e:On(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return function(t,e,n){const s=Cs(t,e,n);for(const n in t)(Dn(t[n])||Dn(e[n]))&&(s[-1!==Be.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]);return s}(t,e,n)}build(t,e,n){Ds(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,s){!function(t,e,n,s){Ms(t,e,void 0,s);for(const n in e.attrs)t.setAttribute(Is.has(n)?n:On(n),e.attrs[n])}(t,e,0,s)}mount(t){var e;this.isSVGTag="string"==typeof(e=t.tagName)&&"svg"===e.toLowerCase(),super.mount(t)}}function Ns(t){return"object"==typeof t&&!Array.isArray(t)}function $s(t,e,n,s){return null==t?[]:"string"==typeof t&&Ns(e)?function(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let s=document;e&&(s=e.current);const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}(t,n,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function Ks(t,e,n){return t*(e+1)+n*e}function js(t,e,n,s){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):s.get(e)??t}function Ws(e,n,s,i,r,a){!function(e,n,s){for(let i=0;i<e.length;i++){const r=e[i];r.at>n&&r.at<s&&(t(e,r),i--)}}(e,r,a);for(let t=0;t<n.length;t++)e.push({value:n[t],at:At(r,a,i[t]),easing:B(s,t)})}function Ls(t,e,n=0){const s=e+1+e*n;for(let e=0;e<t.length;e++)t[e]=t[e]/s}function Ys(t,e){return t.at===e.at?null===t.value?1:null===e.value?-1:0:t.at-e.at}function Us(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function Xs(t,e){return e[t]||(e[t]=[]),e[t]}function qs(t){return Array.isArray(t)?t:[t]}function zs(t,e){return t&&t[e]?{...t,...t[e]}:{...t}}const Zs=t=>"number"==typeof t,_s=t=>t.every(Zs);function Hs(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=as(t)&&!function(t){return as(t)&&"svg"===t.tagName}(t)?new Os(e):new Fs(e);n.mount(t),us.set(t,n)}function Gs(t){const e=new Ps({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),us.set(t,e)}function Js(t,e,n,s){const r=[];if(function(t,e){return Dn(t)||"number"==typeof t||"string"==typeof t&&!Ns(e)}(t,e))r.push(function(t,e,n){const s=Dn(t)?t:Pn(t);return s.start(An("",s,e,n)),s.animation}(t,Ns(e)&&e.default||e,n&&n.default||n));else{if(null==t)return r;const a=$s(t,e,s),o=a.length;i(Boolean(o),"No valid elements provided.","no-valid-elements");for(let t=0;t<o;t++){const s=a[t],i=s instanceof Element?Hs:Gs;us.has(s)||i(s);const l=us.get(s),u={...n};"delay"in u&&"function"==typeof u.delay&&(u.delay=u.delay(t,o)),r.push(...jn(l,{...e,transition:u},{}))}}return r}function Qs(t,e,n){const i=[],r=function(t,{defaultTransition:e={},...n}={},i,r){const a=e.duration||.3,o=new Map,l=new Map,u={},h=new Map;let d=0,m=0,f=0;for(let n=0;n<t.length;n++){const o=t[n];if("string"==typeof o){h.set(o,m);continue}if(!Array.isArray(o)){h.set(o.name,js(m,o.at,d,h));continue}let[c,g,y={}]=o;void 0!==y.at&&(m=js(m,y.at,d,h));let v=0;const T=(t,n,i,o=0,l=0)=>{const u=qs(t),{delay:h=0,times:c=de(u),type:d=e.type||"keyframes",repeat:g,repeatType:y,repeatDelay:T=0,...w}=n;let{ease:M=e.ease||"easeOut",duration:S}=n;const x="function"==typeof h?h(o,l):h,A=u.length,k=Qe(d)?d:r?.[d||"keyframes"];if(A<=2&&k){let t=100;if(2===A&&_s(u)){const e=u[1]-u[0];t=Math.abs(e)}const n={...e,...w};void 0!==S&&(n.duration=p(S));const s=Wt(n,t,k);M=s.ease,S=s.duration}S??(S=a);const V=m+x;1===c.length&&0===c[0]&&(c[1]=1);const C=c.length-u.length;if(C>0&&ce(c,C),1===u.length&&u.unshift(null),g&&s(g<20,`Sequence segments can't repeat ${g} times — ignoring repeat option. Use a value below 20 or apply repeat at the sequence level instead.`),g&&g<20){const t=S>0?T/S:0;S=Ks(S,g,T);const e=[...u],n=[...c];M=Array.isArray(M)?[...M]:[M];const s=[...M],i="reverse"===y||"mirror"===y;let r=e,a=s;i&&(r=[...e].reverse(),"reverse"===y&&(a=[...s].reverse().map(t=>"function"==typeof t?b(t):t)));for(let o=0;o<g;o++){const l=i&&o%2==0,h=l?r:e,d=l?a:s,p=(o+1)*(1+t);t>0&&(u.push(u[u.length-1]),c.push(p),M.push("linear")),u.push(...h);for(let t=0;t<h.length;t++)c.push(n[t]+p),M.push(0===t?"linear":B(d,t-1))}Ls(c,g,t)}const F=V+S;Ws(i,u,M,c,V,F),v=Math.max(x+S,v),f=Math.max(F,f)};if(Dn(c))T(g,y,Xs("default",Us(c,l)));else{const t=$s(c,g,i,u),e=t.length;for(let n=0;n<e;n++){const s=Us(t[n],l);for(const t in g)T(g[t],zs(y,t),Xs(t,s),n,e)}}d=m,m+=v}return l.forEach((t,s)=>{for(const i in t){const r=t[i];r.sort(Ys);const a=[],l=[],u=[];for(let t=0;t<r.length;t++){const{at:e,value:n,easing:s}=r[t];a.push(n),l.push(c(0,f,e)),u.push(s||"easeOut")}0!==l[0]&&(l.unshift(0),a.unshift(a[0]),u.unshift("easeInOut")),1!==l[l.length-1]&&(l.push(1),a.push(null)),o.has(s)||o.set(s,{keyframes:{},transition:{}});const h=o.get(s);h.keyframes[i]=a;const{type:d,...p}=e;h.transition[i]={...p,duration:f,ease:u,times:l,...n}}}),o}(t.map(t=>{if(Array.isArray(t)&&"function"==typeof t[0]){const e=t[0],n=Pn(0);return n.on("change",e),1===t.length?[n,[0,1]]:2===t.length?[n,[0,1],t[1]]:[n,t[1],t[2]]}return t}),e,n,{spring:oe});return r.forEach(({keyframes:t,transition:e},n)=>{i.push(...Js(n,t,e))}),i}function ti(e={}){const{scope:n,reduceMotion:s,skipAnimations:i}=e;return function(e,r,a){let o,l=[];const u={};if(void 0!==s&&(u.reduceMotion=s),void 0!==i&&(u.skipAnimations=i),h=e,Array.isArray(h)&&h.some(Array.isArray)){const{onComplete:t,...s}=r||{};"function"==typeof t&&(o=t),l=Qs(e,{...u,...s},n)}else{const{onComplete:t,...s}=a||{};"function"==typeof t&&(o=t),l=Js(e,r,{...u,...s},n)}var h;const c=new fn(l);return o&&c.finished.then(o),n&&(n.animations.push(c),c.finished.then(()=>{t(n.animations,c)})),c}}const ei=ti();export{ei as animate,ti as createScopedAnimate}; | ||
| //# sourceMappingURL=size-rollup-animate.js.map |
@@ -1,1 +0,1 @@ | ||
| const t=(t,e,s)=>s>e?e:s<t?t:s;function e(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let s=()=>{},n=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(s=(t,s,n)=>{t||"undefined"==typeof console||console.warn(e(s,n))},n=(t,s,n)=>{if(!t)throw new Error(e(s,n))});const i={},r=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),a=t=>/^0[^.\s]+$/u.test(t);function o(t){let e;return()=>(void 0===e&&(e=t()),e)}const h=t=>t;class l{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>function(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const u=t=>1e3*t,c=t=>t/1e3;function d(t,e){return e?t*(1e3/e):0}const p=t=>Array.isArray(t)&&"number"==typeof t[0],f=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function m(t,e){let s=!1,n=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,o=f.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(h.schedule(e),t()),e(a)}const h={schedule:(t,i=!1,a=!1)=>{const o=a&&n?e:s;return i&&r.add(t),o.add(t),t},cancel:t=>{s.delete(t),r.delete(t)},process:t=>{if(a=t,n)return void(i=!0);n=!0;const r=e;e=s,s=r,e.forEach(o),e.clear(),n=!1,i&&(i=!1,h.process(t))}};return h}(a),t),{}),{setup:h,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:p,render:m,postRender:g}=o,v=()=>{const a=i.useManualTiming,o=a?r.timestamp:performance.now();s=!1,a||(r.delta=n?1e3/60:Math.max(Math.min(o-r.timestamp,40),1)),r.timestamp=o,r.isProcessing=!0,h.process(r),l.process(r),u.process(r),c.process(r),d.process(r),p.process(r),m.process(r),g.process(r),r.isProcessing=!1,s&&e&&(n=!1,t(v))};return{schedule:f.reduce((e,i)=>{const a=o[i];return e[i]=(e,i=!1,o=!1)=>(s||(s=!0,n=!0,r.isProcessing||t(v)),a.schedule(e,i,o)),e},{}),cancel:t=>{for(let e=0;e<f.length;e++)o[f[e]].cancel(t)},state:r,steps:o}}const{schedule:g,cancel:v,state:y}=m("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:h,!0);let b;function w(){b=void 0}const V={now:()=>(void 0===b&&V.set(y.isProcessing||i.useManualTiming?y.timestamp:performance.now()),b),set:t=>{b=t,queueMicrotask(w)}},S=t=>e=>"string"==typeof e&&e.startsWith(t),M=S("--"),T=S("var(--"),A=t=>!!T(t)&&x.test(t.split("/*")[0].trim()),x=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function C(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const k={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},F={...k,transform:e=>t(0,1,e)},E={...k,default:1},B=t=>Math.round(1e5*t)/1e5,P=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const R=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I=(t,e)=>s=>Boolean("string"==typeof s&&R.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),N=(t,e,s)=>n=>{if("string"!=typeof n)return n;const[i,r,a,o]=n.match(P);return{[t]:parseFloat(i),[e]:parseFloat(r),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},O={...k,transform:e=>Math.round((e=>t(0,255,e))(e))},$={test:I("rgb","red"),parse:N("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+O.transform(t)+", "+O.transform(e)+", "+O.transform(s)+", "+B(F.transform(n))+")"};const L={test:I("#"),parse:function(t){let e="",s="",n="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:$.transform},Y=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),W=Y("deg"),X=Y("%"),j=Y("px"),z=Y("vh"),K=Y("vw"),U=(()=>({...X,parse:t=>X.parse(t)/100,transform:t=>X.transform(100*t)}))(),Z={test:I("hsl","hue"),parse:N("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+X.transform(B(e))+", "+X.transform(B(s))+", "+B(F.transform(n))+")"},D={test:t=>$.test(t)||L.test(t)||Z.test(t),parse:t=>$.test(t)?$.parse(t):Z.test(t)?Z.parse(t):L.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?$.transform(t):Z.transform(t),getAnimatableNone:t=>{const e=D.parse(t);return e.alpha=0,D.transform(e)}},q=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const H="number",_="color",G=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function J(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(G,t=>(D.test(t)?(n.color.push(r),i.push(_),s.push(D.parse(t))):t.startsWith("var(")?(n.var.push(r),i.push("var"),s.push(t)):(n.number.push(r),i.push(H),s.push(parseFloat(t))),++r,"${}")).split("${}");return{values:s,split:a,indexes:n,types:i}}function Q({split:t,types:e}){const s=t.length;return n=>{let i="";for(let r=0;r<s;r++)if(i+=t[r],void 0!==n[r]){const t=e[r];i+=t===H?B(n[r]):t===_?D.transform(n[r]):n[r]}return i}}const tt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(s=t)?0:D.test(s)?D.getAnimatableNone(s):s;var s};const et={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(P)?.length||0)+(t.match(q)?.length||0)>0},parse:function(t){return J(t).values},createTransformer:function(t){return Q(J(t))},getAnimatableNone:function(t){const e=J(t);return Q(e)(e.values.map((t,s)=>tt(t,e.split[s])))}},st=(t,e,s)=>t+(e-t)*s,nt=(t,e,s=10)=>{let n="";const i=Math.max(Math.round(e/s),2);for(let e=0;e<i;e++)n+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},it=t=>null!==t;function rt(t,{repeat:e,repeatType:s="loop"},n,i=1){const r=t.filter(it),a=i<0||e&&"loop"!==s&&e%2==1?0:r.length-1;return a&&void 0!==n?n:r[a]}class at{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const ot=t=>180*t/Math.PI,ht=t=>{const e=ot(Math.atan2(t[1],t[0]));return ut(e)},lt={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:ht,rotateZ:ht,skewX:t=>ot(Math.atan(t[1])),skewY:t=>ot(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},ut=t=>((t%=360)<0&&(t+=360),t),ct=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),dt=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),pt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ct,scaleY:dt,scale:t=>(ct(t)+dt(t))/2,rotateX:t=>ut(ot(Math.atan2(t[6],t[5]))),rotateY:t=>ut(ot(Math.atan2(-t[2],t[0]))),rotateZ:ht,rotate:ht,skewX:t=>ot(Math.atan(t[4])),skewY:t=>ot(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ft(t){return t.includes("scale")?1:0}function mt(t,e){if(!t||"none"===t)return ft(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(s)n=pt,i=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=lt,i=e}if(!i)return ft(e);const r=n[e],a=i[1].split(",").map(vt);return"function"==typeof r?r(a):a[r]}const gt=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return mt(s,e)};function vt(t){return parseFloat(t.trim())}const yt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bt=(()=>new Set(yt))(),wt=t=>t===k||t===j,Vt=new Set(["x","y","z"]),St=yt.filter(t=>!Vt.has(t));const Mt={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>mt(e,"x"),y:(t,{transform:e})=>mt(e,"y")};Mt.translateX=Mt.x,Mt.translateY=Mt.y;const Tt=new Set;let At=!1,xt=!1,Ct=!1;function kt(){if(xt){const t=Array.from(Tt).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),s=new Map;e.forEach(t=>{const e=function(t){const e=[];return St.forEach(s=>{const n=t.getValue(s);void 0!==n&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}(t);e.length&&(s.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=s.get(t);e&&e.forEach(([e,s])=>{t.getValue(e)?.set(s)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}xt=!1,At=!1,Tt.forEach(t=>t.complete(Ct)),Tt.clear()}function Ft(){Tt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(xt=!0)})}function Et(){Ct=!0,Ft(),kt(),Ct=!1}class Bt{constructor(t,e,s,n,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=n,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Tt.add(this),At||(At=!0,g.read(Ft),g.resolveKeyframes(kt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:n}=this;if(null===t[0]){const i=n?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(s&&e){const n=s.readValue(e,r);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=r),n&&void 0===i&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Tt.delete(this)}cancel(){"scheduled"===this.state&&(Tt.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function Pt(t,e,s){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,s):t.style[e]=s}const Rt={};function It(t,e){const s=o(t);return()=>Rt[e]??s()}const Nt=It(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Ot=It(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),$t=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,Lt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$t([0,.65,.55,1]),circOut:$t([.55,0,1,.45]),backIn:$t([.31,.01,.66,-.59]),backOut:$t([.33,1.53,.69,.99])};function Yt(t,e){return t?"function"==typeof t?Ot()?nt(t,e):"ease-out":p(t)?$t(t):Array.isArray(t)?t.map(t=>Yt(t,e)||Lt.easeOut):Lt[t]:void 0}function Wt(t,e,s,{delay:n=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:h}={},l=void 0){const u={[e]:s};h&&(u.offset=h);const c=Yt(o,i);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};l&&(d.pseudoElement=l);return t.animate(u,d)}function Xt(t){return"function"==typeof t&&"applyToOptions"in t}class jt extends at{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:s,keyframes:i,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:h}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,n("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return Xt(t)&&Ot()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Wt(e,s,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=rt(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Pt(e,s,t),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return c(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+c(t)}get time(){return c(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=u(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:s,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Nt()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),s&&(this.animation.rangeEnd=s),h):n(this)}}const zt=new Set(["opacity","clipPath","filter","transform"]);function Kt(t){const e=[{},{}];return t?.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function Ut(t,e,s,n){if("function"==typeof e){const[i,r]=Kt(n);e=e(void 0!==s?s:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Kt(n);e=e(void 0!==s?s:t.custom,i,r)}return e}class Zt{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=V.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=V.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new l);const s=this.events[t].add(e);return"change"===t?()=>{s(),g.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=V.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return d(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dt(t,e){return new Zt(t,e)}const qt=t=>Boolean(t&&t.getVelocity);function Ht(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const _t="data-"+Ht("framerAppearId"),Gt=t=>e=>e.test(t),Jt=[k,j,X,W,K,z,{test:t=>"auto"===t,parse:t=>t}],Qt=t=>Jt.find(Gt(t)),te=new Set(["brightness","contrast","saturate","opacity"]);function ee(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match(P)||[];if(!n)return t;const i=s.replace(n,"");let r=te.has(e)?1:0;return n!==s&&(r*=100),e+"("+r+i+")"}const se=/\b([a-z-]*)\(.*?\)/gu,ne={...et,getAnimatableNone:t=>{const e=t.match(se);return e?e.map(ee).join(" "):t}},ie={...et,getAnimatableNone:t=>{const e=et.parse(t);return et.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},re={...k,transform:Math.round},ae={borderWidth:j,borderTopWidth:j,borderRightWidth:j,borderBottomWidth:j,borderLeftWidth:j,borderRadius:j,borderTopLeftRadius:j,borderTopRightRadius:j,borderBottomRightRadius:j,borderBottomLeftRadius:j,width:j,maxWidth:j,height:j,maxHeight:j,top:j,right:j,bottom:j,left:j,inset:j,insetBlock:j,insetBlockStart:j,insetBlockEnd:j,insetInline:j,insetInlineStart:j,insetInlineEnd:j,padding:j,paddingTop:j,paddingRight:j,paddingBottom:j,paddingLeft:j,paddingBlock:j,paddingBlockStart:j,paddingBlockEnd:j,paddingInline:j,paddingInlineStart:j,paddingInlineEnd:j,margin:j,marginTop:j,marginRight:j,marginBottom:j,marginLeft:j,marginBlock:j,marginBlockStart:j,marginBlockEnd:j,marginInline:j,marginInlineStart:j,marginInlineEnd:j,fontSize:j,backgroundPositionX:j,backgroundPositionY:j,...{rotate:W,rotateX:W,rotateY:W,rotateZ:W,scale:E,scaleX:E,scaleY:E,scaleZ:E,skew:W,skewX:W,skewY:W,distance:j,translateX:j,translateY:j,translateZ:j,x:j,y:j,z:j,perspective:j,transformPerspective:j,opacity:F,originX:U,originY:U,originZ:j},zIndex:re,fillOpacity:F,strokeOpacity:F,numOctaves:re},oe={...ae,color:D,backgroundColor:D,outlineColor:D,fill:D,stroke:D,borderColor:D,borderTopColor:D,borderRightColor:D,borderBottomColor:D,borderLeftColor:D,filter:ne,WebkitFilter:ne,mask:ie,WebkitMask:ie},he=t=>oe[t],le=new Set([ne,ie]);function ue(t,e){let s=he(t);return le.has(s)||(s=et),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const ce=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:de}=m(queueMicrotask,!1),pe=[...Jt,D,et],fe=()=>({x:{min:0,max:0},y:{min:0,max:0}}),me=new WeakMap;function ge(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function ve(t){return"string"==typeof t||Array.isArray(t)}const ye=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],be=["initial",...ye];function we(t){return ge(t.animate)||be.some(e=>ve(t[e]))}function Ve(t){return Boolean(we(t)||t.variants)}const Se={current:null},Me={current:!1},Te="undefined"!=typeof window;const Ae=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let xe={};function Ce(t){xe=t}function ke(){return xe}class Fe{scrapeMotionValuesFromProps(t,e,s){return{}}constructor({parent:t,props:e,presenceContext:s,reducedMotionConfig:n,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Bt,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=V.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,g.render(this.render,!1,!0))};const{latestValues:h,renderState:l}=a;this.latestValues=h,this.baseTarget={...h},this.initialValues=e.initial?{...h}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=we(e),this.isVariantNode=Ve(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==h[t]&&qt(e)&&e.set(h[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,me.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Me.current||function(){if(Me.current=!0,Te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Se.current=t.matches;t.addEventListener("change",e),e()}else Se.current=!1}(),this.shouldReduceMotion=Se.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),v(this.notifyUpdate),v(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&zt.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:n,times:i,ease:r,duration:a}=e.accelerate,o=new jt({element:this.current,name:t,keyframes:n,times:i,ease:r,duration:u(a)}),h=s(o);return void this.valueSubscriptions.set(t,()=>{h(),o.cancel()})}const s=bt.has(t);s&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&g.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),i&&i(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in xe){const e=xe[t];if(!e)continue;const{isEnabled:s,Feature:n}=e;if(!this.features[t]&&n&&s(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Ae.length;e++){const s=Ae[e];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const n=t["on"+s];n&&(this.propEventSubscriptions[s]=this.on(s,n))}this.prevMotionValues=function(t,e,s){for(const n in e){const i=e[n],r=s[n];if(qt(i))t.addValue(n,i);else if(qt(r))t.addValue(n,Dt(i,{owner:t}));else if(r!==i)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(n);t.addValue(n,Dt(void 0!==e?e:i,{owner:t}))}}for(const n in s)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const s=this.values.get(t);e!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return void 0===s&&void 0!==e&&(s=Dt(null===e?void 0:e,{owner:this}),this.addValue(t,s)),s}readValue(t,e){let s=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(r(s)||a(s))?s=parseFloat(s):(n=s,!pe.find(Gt(n))&&et.test(e)&&(s=ue(t,e))),this.setBaseTarget(t,qt(s)?s.get():s)),qt(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let s;if("string"==typeof e||"object"==typeof e){const n=Ut(this.props,e,this.presenceContext?.custom);n&&(s=n[t])}if(e&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||qt(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new l),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){de.render(this.render)}}const Ee={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Be=yt.length;function Pe(t,e,s){const{style:n,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const s=e[t];if(bt.has(t))a=!0;else if(M(t))i[t]=s;else{const e=ce(s,ae[t]);t.startsWith("origin")?(o=!0,r[t]=e):n[t]=e}}if(e.transform||(a||s?n.transform=function(t,e,s){let n="",i=!0;for(let r=0;r<Be;r++){const a=yt[r],o=t[a];if(void 0===o)continue;let h=!0;if("number"==typeof o)h=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);h=a.startsWith("scale")?1===t:0===t}if(!h||s){const t=ce(o,ae[a]);h||(i=!1,n+=`${Ee[a]||a}(${t}) `),s&&(e[a]=t)}}return n=n.trim(),s?n=s(e,i?"":n):i&&(n="none"),n}(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:s=0}=r;n.transformOrigin=`${t} ${e} ${s}`}}function Re(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ie={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!j.test(t))return t;t=parseFloat(t)}return`${Re(t,e.target.x)}% ${Re(t,e.target.y)}%`}},Ne={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,i=et.parse(t);if(i.length>5)return n;const r=et.createTransformer(t),a="number"!=typeof i[0]?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;i[0+a]/=o,i[1+a]/=h;const l=st(o,h,.5);return"number"==typeof i[2+a]&&(i[2+a]/=l),"number"==typeof i[3+a]&&(i[3+a]/=l),r(i)}},Oe={borderRadius:{...Ie,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomLeftRadius:Ie,borderBottomRightRadius:Ie,boxShadow:Ne};function $e(t,{layout:e,layoutId:s}){return bt.has(t)||t.startsWith("origin")||(e||void 0!==s)&&(!!Oe[t]||"opacity"===t)}function Le(t,e,s){const n=t.style,i=e?.style,r={};if(!n)return r;for(const e in n)(qt(n[e])||i&&qt(i[e])||$e(e,t)||void 0!==s?.getValue(e)?.liveStyle)&&(r[e]=n[e]);return r}const Ye={offset:"stroke-dashoffset",array:"stroke-dasharray"},We={offset:"strokeDashoffset",array:"strokeDasharray"};const Xe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function je(t,{attrX:e,attrY:s,attrScale:n,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},h,l,u){if(Pe(t,o,l),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete c.transformBox);for(const t of Xe)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==s&&(c.y=s),void 0!==n&&(c.scale=n),void 0!==i&&function(t,e,s=1,n=0,i=!0){t.pathLength=1;const r=i?Ye:We;t[r.offset]=""+-n,t[r.array]=`${e} ${s}`}(c,i,r,a,!1)}const ze=t=>"string"==typeof t&&"svg"===t.toLowerCase();function Ke(t,e,s){const n=Le(t,e,s);for(const s in t)if(qt(t[s])||qt(e[s])){n[-1!==yt.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=t[s]}return n}const Ue=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ze(t){return"string"==typeof t&&!t.includes("-")&&!!(Ue.indexOf(t)>-1||/[A-Z]/u.test(t))}export{Qt as $,et as A,J as B,y as C,V as D,v as E,g as F,c as G,t as H,nt as I,u as J,d as K,rt as L,i as M,jt as N,Pt as O,Xt as P,zt as Q,o as R,Bt as S,Et as T,r as U,bt as V,at as W,yt as X,Dt as Y,a as Z,ue as _,we as a,C as a0,Mt as a1,wt as a2,Fe as a3,ft as a4,gt as a5,M as a6,Ht as a7,fe as a8,he as a9,be as aa,ye as ab,ve as b,$e as c,Pe as d,je as e,ze as f,Ze as g,Ve as h,qt as i,ge as j,Ke as k,ke as l,Ce as m,h as n,_t as o,p,n as q,Ut as r,Le as s,st as t,$ as u,Z as v,L as w,s as x,A as y,D as z}; | ||
| const t=(t,e,s)=>s>e?e:s<t?t:s;function e(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let s=()=>{},n=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(s=(t,s,n)=>{t||"undefined"==typeof console||console.warn(e(s,n))},n=(t,s,n)=>{if(!t)throw new Error(e(s,n))});const i={},r=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),a=t=>/^0[^.\s]+$/u.test(t);function o(t){let e;return()=>(void 0===e&&(e=t()),e)}const h=t=>t;class l{constructor(){this.subscriptions=[]}add(t){var e,s;return e=this.subscriptions,s=t,-1===e.indexOf(s)&&e.push(s),()=>function(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const u=t=>1e3*t,c=t=>t/1e3,d=(t,e)=>e?t*(1e3/e):0,p=t=>Array.isArray(t)&&"number"==typeof t[0],f=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function m(t,e){let s=!1,n=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,o=f.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(h.schedule(e),t()),e(a)}const h={schedule:(t,i=!1,a=!1)=>{const o=a&&n?e:s;return i&&r.add(t),o.add(t),t},cancel:t=>{s.delete(t),r.delete(t)},process:t=>{if(a=t,n)return void(i=!0);n=!0;const r=e;e=s,s=r,e.forEach(o),e.clear(),n=!1,i&&(i=!1,h.process(t))}};return h}(a),t),{}),{setup:h,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:p,render:m,postRender:g}=o,v=()=>{const a=i.useManualTiming,o=a?r.timestamp:performance.now();s=!1,a||(r.delta=n?1e3/60:Math.max(Math.min(o-r.timestamp,40),1)),r.timestamp=o,r.isProcessing=!0,h.process(r),l.process(r),u.process(r),c.process(r),d.process(r),p.process(r),m.process(r),g.process(r),r.isProcessing=!1,s&&e&&(n=!1,t(v))};return{schedule:f.reduce((e,i)=>{const a=o[i];return e[i]=(e,i=!1,o=!1)=>(s||(s=!0,n=!0,r.isProcessing||t(v)),a.schedule(e,i,o)),e},{}),cancel:t=>{for(let e=0;e<f.length;e++)o[f[e]].cancel(t)},state:r,steps:o}}const{schedule:g,cancel:v,state:y}=m("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:h,!0);let b;function w(){b=void 0}const V={now:()=>(void 0===b&&V.set(y.isProcessing||i.useManualTiming?y.timestamp:performance.now()),b),set:t=>{b=t,queueMicrotask(w)}},S=t=>e=>"string"==typeof e&&e.startsWith(t),M=S("--"),T=S("var(--"),A=t=>!!T(t)&&x.test(t.split("/*")[0].trim()),x=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function C(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const k={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},F={...k,transform:e=>t(0,1,e)},E={...k,default:1},B=t=>Math.round(1e5*t)/1e5,P=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const R=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,I=(t,e)=>s=>Boolean("string"==typeof s&&R.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),N=(t,e,s)=>n=>{if("string"!=typeof n)return n;const[i,r,a,o]=n.match(P);return{[t]:parseFloat(i),[e]:parseFloat(r),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},O={...k,transform:e=>Math.round((e=>t(0,255,e))(e))},$={test:I("rgb","red"),parse:N("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+O.transform(t)+", "+O.transform(e)+", "+O.transform(s)+", "+B(F.transform(n))+")"};const L={test:I("#"),parse:function(t){let e="",s="",n="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:$.transform},Y=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),W=Y("deg"),X=Y("%"),j=Y("px"),z=Y("vh"),K=Y("vw"),U=(()=>({...X,parse:t=>X.parse(t)/100,transform:t=>X.transform(100*t)}))(),Z={test:I("hsl","hue"),parse:N("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+X.transform(B(e))+", "+X.transform(B(s))+", "+B(F.transform(n))+")"},D={test:t=>$.test(t)||L.test(t)||Z.test(t),parse:t=>$.test(t)?$.parse(t):Z.test(t)?Z.parse(t):L.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?$.transform(t):Z.transform(t),getAnimatableNone:t=>{const e=D.parse(t);return e.alpha=0,D.transform(e)}},q=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const H="number",_="color",G=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function J(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(G,t=>(D.test(t)?(n.color.push(r),i.push(_),s.push(D.parse(t))):t.startsWith("var(")?(n.var.push(r),i.push("var"),s.push(t)):(n.number.push(r),i.push(H),s.push(parseFloat(t))),++r,"${}")).split("${}");return{values:s,split:a,indexes:n,types:i}}function Q({split:t,types:e}){const s=t.length;return n=>{let i="";for(let r=0;r<s;r++)if(i+=t[r],void 0!==n[r]){const t=e[r];i+=t===H?B(n[r]):t===_?D.transform(n[r]):n[r]}return i}}const tt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(s=t)?0:D.test(s)?D.getAnimatableNone(s):s;var s};const et={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(P)?.length||0)+(t.match(q)?.length||0)>0},parse:function(t){return J(t).values},createTransformer:function(t){return Q(J(t))},getAnimatableNone:function(t){const e=J(t);return Q(e)(e.values.map((t,s)=>tt(t,e.split[s])))}},st=(t,e,s)=>t+(e-t)*s,nt=(t,e,s=10)=>{let n="";const i=Math.max(Math.round(e/s),2);for(let e=0;e<i;e++)n+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},it=t=>null!==t;function rt(t,{repeat:e,repeatType:s="loop"},n,i=1){const r=t.filter(it),a=i<0||e&&"loop"!==s&&e%2==1?0:r.length-1;return a&&void 0!==n?n:r[a]}class at{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const ot=t=>180*t/Math.PI,ht=t=>{const e=ot(Math.atan2(t[1],t[0]));return ut(e)},lt={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:ht,rotateZ:ht,skewX:t=>ot(Math.atan(t[1])),skewY:t=>ot(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},ut=t=>((t%=360)<0&&(t+=360),t),ct=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),dt=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),pt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ct,scaleY:dt,scale:t=>(ct(t)+dt(t))/2,rotateX:t=>ut(ot(Math.atan2(t[6],t[5]))),rotateY:t=>ut(ot(Math.atan2(-t[2],t[0]))),rotateZ:ht,rotate:ht,skewX:t=>ot(Math.atan(t[4])),skewY:t=>ot(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function ft(t){return t.includes("scale")?1:0}function mt(t,e){if(!t||"none"===t)return ft(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(s)n=pt,i=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=lt,i=e}if(!i)return ft(e);const r=n[e],a=i[1].split(",").map(vt);return"function"==typeof r?r(a):a[r]}const gt=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return mt(s,e)};function vt(t){return parseFloat(t.trim())}const yt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bt=(()=>new Set(yt))(),wt=t=>t===k||t===j,Vt=new Set(["x","y","z"]),St=yt.filter(t=>!Vt.has(t));const Mt={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>mt(e,"x"),y:(t,{transform:e})=>mt(e,"y")};Mt.translateX=Mt.x,Mt.translateY=Mt.y;const Tt=new Set;let At=!1,xt=!1,Ct=!1;function kt(){if(xt){const t=Array.from(Tt).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),s=new Map;e.forEach(t=>{const e=function(t){const e=[];return St.forEach(s=>{const n=t.getValue(s);void 0!==n&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}(t);e.length&&(s.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=s.get(t);e&&e.forEach(([e,s])=>{t.getValue(e)?.set(s)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}xt=!1,At=!1,Tt.forEach(t=>t.complete(Ct)),Tt.clear()}function Ft(){Tt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(xt=!0)})}function Et(){Ct=!0,Ft(),kt(),Ct=!1}class Bt{constructor(t,e,s,n,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=n,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Tt.add(this),At||(At=!0,g.read(Ft),g.resolveKeyframes(kt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:n}=this;if(null===t[0]){const i=n?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(s&&e){const n=s.readValue(e,r);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=r),n&&void 0===i&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Tt.delete(this)}cancel(){"scheduled"===this.state&&(Tt.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function Pt(t,e,s){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,s):t.style[e]=s}const Rt={};function It(t,e){const s=o(t);return()=>Rt[e]??s()}const Nt=It(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Ot=It(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),$t=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,Lt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$t([0,.65,.55,1]),circOut:$t([.55,0,1,.45]),backIn:$t([.31,.01,.66,-.59]),backOut:$t([.33,1.53,.69,.99])};function Yt(t,e){return t?"function"==typeof t?Ot()?nt(t,e):"ease-out":p(t)?$t(t):Array.isArray(t)?t.map(t=>Yt(t,e)||Lt.easeOut):Lt[t]:void 0}function Wt(t,e,s,{delay:n=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:h}={},l=void 0){const u={[e]:s};h&&(u.offset=h);const c=Yt(o,i);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};l&&(d.pseudoElement=l);return t.animate(u,d)}function Xt(t){return"function"==typeof t&&"applyToOptions"in t}class jt extends at{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:s,keyframes:i,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:h}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,n("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return Xt(t)&&Ot()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Wt(e,s,i,l,r),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=rt(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Pt(e,s,t),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return c(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+c(t)}get time(){return c(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=u(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:s,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Nt()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),s&&(this.animation.rangeEnd=s),h):n(this)}}const zt=new Set(["opacity","clipPath","filter","transform"]);function Kt(t){const e=[{},{}];return t?.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function Ut(t,e,s,n){if("function"==typeof e){const[i,r]=Kt(n);e=e(void 0!==s?s:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Kt(n);e=e(void 0!==s?s:t.custom,i,r)}return e}class Zt{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=V.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=V.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new l);const s=this.events[t].add(e);return"change"===t?()=>{s(),g.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=V.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return d(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dt(t,e){return new Zt(t,e)}const qt=t=>Boolean(t&&t.getVelocity);function Ht(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const _t="data-"+Ht("framerAppearId"),Gt=t=>e=>e.test(t),Jt=[k,j,X,W,K,z,{test:t=>"auto"===t,parse:t=>t}],Qt=t=>Jt.find(Gt(t)),te=new Set(["brightness","contrast","saturate","opacity"]);function ee(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match(P)||[];if(!n)return t;const i=s.replace(n,"");let r=te.has(e)?1:0;return n!==s&&(r*=100),e+"("+r+i+")"}const se=/\b([a-z-]*)\(.*?\)/gu,ne={...et,getAnimatableNone:t=>{const e=t.match(se);return e?e.map(ee).join(" "):t}},ie={...et,getAnimatableNone:t=>{const e=et.parse(t);return et.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},re={...k,transform:Math.round},ae={borderWidth:j,borderTopWidth:j,borderRightWidth:j,borderBottomWidth:j,borderLeftWidth:j,borderRadius:j,borderTopLeftRadius:j,borderTopRightRadius:j,borderBottomRightRadius:j,borderBottomLeftRadius:j,width:j,maxWidth:j,height:j,maxHeight:j,top:j,right:j,bottom:j,left:j,inset:j,insetBlock:j,insetBlockStart:j,insetBlockEnd:j,insetInline:j,insetInlineStart:j,insetInlineEnd:j,padding:j,paddingTop:j,paddingRight:j,paddingBottom:j,paddingLeft:j,paddingBlock:j,paddingBlockStart:j,paddingBlockEnd:j,paddingInline:j,paddingInlineStart:j,paddingInlineEnd:j,margin:j,marginTop:j,marginRight:j,marginBottom:j,marginLeft:j,marginBlock:j,marginBlockStart:j,marginBlockEnd:j,marginInline:j,marginInlineStart:j,marginInlineEnd:j,fontSize:j,backgroundPositionX:j,backgroundPositionY:j,...{rotate:W,rotateX:W,rotateY:W,rotateZ:W,scale:E,scaleX:E,scaleY:E,scaleZ:E,skew:W,skewX:W,skewY:W,distance:j,translateX:j,translateY:j,translateZ:j,x:j,y:j,z:j,perspective:j,transformPerspective:j,opacity:F,originX:U,originY:U,originZ:j},zIndex:re,fillOpacity:F,strokeOpacity:F,numOctaves:re},oe={...ae,color:D,backgroundColor:D,outlineColor:D,fill:D,stroke:D,borderColor:D,borderTopColor:D,borderRightColor:D,borderBottomColor:D,borderLeftColor:D,filter:ne,WebkitFilter:ne,mask:ie,WebkitMask:ie},he=t=>oe[t],le=new Set([ne,ie]);function ue(t,e){let s=he(t);return le.has(s)||(s=et),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const ce=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:de}=m(queueMicrotask,!1),pe=[...Jt,D,et],fe=()=>({x:{min:0,max:0},y:{min:0,max:0}}),me=new WeakMap;function ge(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function ve(t){return"string"==typeof t||Array.isArray(t)}const ye=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],be=["initial",...ye];function we(t){return ge(t.animate)||be.some(e=>ve(t[e]))}function Ve(t){return Boolean(we(t)||t.variants)}const Se={current:null},Me={current:!1},Te="undefined"!=typeof window;const Ae=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let xe={};function Ce(t){xe=t}function ke(){return xe}class Fe{scrapeMotionValuesFromProps(t,e,s){return{}}constructor({parent:t,props:e,presenceContext:s,reducedMotionConfig:n,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Bt,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=V.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,g.render(this.render,!1,!0))};const{latestValues:h,renderState:l}=a;this.latestValues=h,this.baseTarget={...h},this.initialValues=e.initial?{...h}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=we(e),this.isVariantNode=Ve(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==h[t]&&qt(e)&&e.set(h[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,me.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Me.current||function(){if(Me.current=!0,Te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Se.current=t.matches;t.addEventListener("change",e),e()}else Se.current=!1}(),this.shouldReduceMotion=Se.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),v(this.notifyUpdate),v(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&zt.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:n,times:i,ease:r,duration:a}=e.accelerate,o=new jt({element:this.current,name:t,keyframes:n,times:i,ease:r,duration:u(a)}),h=s(o);return void this.valueSubscriptions.set(t,()=>{h(),o.cancel()})}const s=bt.has(t);s&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&g.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),i&&i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in xe){const e=xe[t];if(!e)continue;const{isEnabled:s,Feature:n}=e;if(!this.features[t]&&n&&s(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Ae.length;e++){const s=Ae[e];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const n=t["on"+s];n&&(this.propEventSubscriptions[s]=this.on(s,n))}this.prevMotionValues=function(t,e,s){for(const n in e){const i=e[n],r=s[n];if(qt(i))t.addValue(n,i);else if(qt(r))t.addValue(n,Dt(i,{owner:t}));else if(r!==i)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(n);t.addValue(n,Dt(void 0!==e?e:i,{owner:t}))}}for(const n in s)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const s=this.values.get(t);e!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return void 0===s&&void 0!==e&&(s=Dt(null===e?void 0:e,{owner:this}),this.addValue(t,s)),s}readValue(t,e){let s=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(r(s)||a(s))?s=parseFloat(s):(n=s,!pe.find(Gt(n))&&et.test(e)&&(s=ue(t,e))),this.setBaseTarget(t,qt(s)?s.get():s)),qt(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let s;if("string"==typeof e||"object"==typeof e){const n=Ut(this.props,e,this.presenceContext?.custom);n&&(s=n[t])}if(e&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||qt(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new l),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){de.render(this.render)}}const Ee={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Be=yt.length;function Pe(t,e,s){const{style:n,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const s=e[t];if(bt.has(t))a=!0;else if(M(t))i[t]=s;else{const e=ce(s,ae[t]);t.startsWith("origin")?(o=!0,r[t]=e):n[t]=e}}if(e.transform||(a||s?n.transform=function(t,e,s){let n="",i=!0;for(let r=0;r<Be;r++){const a=yt[r],o=t[a];if(void 0===o)continue;let h=!0;if("number"==typeof o)h=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);h=a.startsWith("scale")?1===t:0===t}if(!h||s){const t=ce(o,ae[a]);h||(i=!1,n+=`${Ee[a]||a}(${t}) `),s&&(e[a]=t)}}return n=n.trim(),s?n=s(e,i?"":n):i&&(n="none"),n}(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:s=0}=r;n.transformOrigin=`${t} ${e} ${s}`}}function Re(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ie={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!j.test(t))return t;t=parseFloat(t)}return`${Re(t,e.target.x)}% ${Re(t,e.target.y)}%`}},Ne={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,i=et.parse(t);if(i.length>5)return n;const r=et.createTransformer(t),a="number"!=typeof i[0]?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;i[0+a]/=o,i[1+a]/=h;const l=st(o,h,.5);return"number"==typeof i[2+a]&&(i[2+a]/=l),"number"==typeof i[3+a]&&(i[3+a]/=l),r(i)}},Oe={borderRadius:{...Ie,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomLeftRadius:Ie,borderBottomRightRadius:Ie,boxShadow:Ne};function $e(t,{layout:e,layoutId:s}){return bt.has(t)||t.startsWith("origin")||(e||void 0!==s)&&(!!Oe[t]||"opacity"===t)}function Le(t,e,s){const n=t.style,i=e?.style,r={};if(!n)return r;for(const e in n)(qt(n[e])||i&&qt(i[e])||$e(e,t)||void 0!==s?.getValue(e)?.liveStyle)&&(r[e]=n[e]);return r}const Ye={offset:"stroke-dashoffset",array:"stroke-dasharray"},We={offset:"strokeDashoffset",array:"strokeDasharray"};const Xe=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function je(t,{attrX:e,attrY:s,attrScale:n,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},h,l,u){if(Pe(t,o,l),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete c.transformBox);for(const t of Xe)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==s&&(c.y=s),void 0!==n&&(c.scale=n),void 0!==i&&function(t,e,s=1,n=0,i=!0){t.pathLength=1;const r=i?Ye:We;t[r.offset]=""+-n,t[r.array]=`${e} ${s}`}(c,i,r,a,!1)}const ze=t=>"string"==typeof t&&"svg"===t.toLowerCase();function Ke(t,e,s){const n=Le(t,e,s);for(const s in t)if(qt(t[s])||qt(e[s])){n[-1!==yt.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=t[s]}return n}const Ue=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ze(t){return"string"==typeof t&&!t.includes("-")&&!!(Ue.indexOf(t)>-1||/[A-Z]/u.test(t))}export{Qt as $,et as A,J as B,y as C,V as D,v as E,g as F,c as G,t as H,nt as I,u as J,d as K,rt as L,i as M,jt as N,Pt as O,Xt as P,zt as Q,o as R,Bt as S,Et as T,r as U,bt as V,at as W,yt as X,Dt as Y,a as Z,ue as _,we as a,C as a0,Mt as a1,wt as a2,Fe as a3,ft as a4,gt as a5,M as a6,Ht as a7,fe as a8,he as a9,be as aa,ye as ab,ve as b,$e as c,Pe as d,je as e,ze as f,Ze as g,Ve as h,qt as i,ge as j,Ke as k,ke as l,Ce as m,h as n,_t as o,p,n as q,Ut as r,Le as s,st as t,$ as u,Z as v,L as w,s as x,A as y,D as z}; |
@@ -1,1 +0,1 @@ | ||
| import{jsxs as t,jsx as n}from"react/jsx-runtime";import{createContext as o,useContext as e,useMemo as r,Fragment as a,createElement as i,useRef as s,useInsertionEffect as u,useCallback as c,useLayoutEffect as l,useEffect as d,forwardRef as f}from"react";import{i as m,a as p,b as y,c as g,d as v,e as h,f as w,g as S,P as M,r as b,h as E,j as P,k as A,s as T,l as C,m as j,n as V,S as x,o as I,p as L,L as k}from"./size-rollup-dom-max-assets.js";const W=o({strict:!1}),H=o({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),O=o({});function D(t){const{initial:n,animate:o}=function(t,n){if(m(t)){const{initial:n,animate:o}=t;return{initial:!1===n||p(n)?n:void 0,animate:p(o)?o:void 0}}return!1!==t.inherit?n:{}}(t,e(O));return r(()=>({initial:n,animate:o}),[F(n),F(o)])}function F(t){return Array.isArray(t)?t.join(" "):t}const R=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function N(t,n,o){for(const e in n)y(n[e])||g(e,o)||(t[e]=n[e])}function B(t,n){const o={};return N(o,t.style||{},t),Object.assign(o,function({transformTemplate:t},n){return r(()=>{const o={style:{},transform:{},transformOrigin:{},vars:{}};return v(o,n,t),Object.assign({},o.vars,o.style)},[n])}(t,n)),o}function q(t,n){const o={},e=B(t,n);return t.drag&&!1!==t.dragListener&&(o.draggable=!1,e.userSelect=e.WebkitUserSelect=e.WebkitTouchCallout="none",e.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=e,o}const U=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function $(t,n,o,e){const a=r(()=>{const o={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return h(o,n,w(e),t.transformTemplate,t.style),{...o.attrs,style:{...o.style}}},[n]);if(t.style){const n={};N(n,t.style,t),a.style={...n,...a.style}}return a}const _=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function z(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||_.has(t)}let G=t=>!z(t);try{"function"==typeof(X=require("@emotion/is-prop-valid").default)&&(G=t=>t.startsWith("on")?!z(t):X(t))}catch{}var X;function Y(t,n,o,{latestValues:e},s,u=!1,c){const l=(c??S(t)?$:q)(n,e,s,t),d=function(t,n,o){const e={};for(const r in t)"values"===r&&"object"==typeof t.values||y(t[r])||(G(r)||!0===o&&z(r)||!n&&!z(r)||t.draggable&&r.startsWith("onDrag"))&&(e[r]=t[r]);return e}(n,"string"==typeof t,u),f=t!==a?{...d,...l,ref:o}:{},{children:m}=n,p=r(()=>y(m)?m.get():m,[m]);return i(t,{...f,children:p})}function J(t,n,o,e){const r={},a=e(t,{});for(const t in a)r[t]=b(a[t]);let{initial:i,animate:s}=t;const u=m(t),c=E(t);n&&c&&!u&&!1!==t.inherit&&(void 0===i&&(i=n.initial),void 0===s&&(s=n.animate));let l=!!o&&!1===o.initial;l=l||!1===i;const d=l?s:i;if(d&&"boolean"!=typeof d&&!P(d)){const n=Array.isArray(d)?d:[d];for(let o=0;o<n.length;o++){const e=A(t,n[o]);if(e){const{transitionEnd:t,transition:n,...o}=e;for(const t in o){let n=o[t];if(Array.isArray(n)){n=n[l?n.length-1:0]}null!==n&&(r[t]=n)}for(const n in t)r[n]=t[n]}}}return r}const K=t=>(n,o)=>{const r=e(O),a=e(M),i=()=>function({scrapeMotionValuesFromProps:t,createRenderState:n},o,e,r){return{latestValues:J(o,e,r,t),renderState:n()}}(t,n,r,a);return o?i():function(t){const n=s(null);return null===n.current&&(n.current=t()),n.current}(i)},Q=K({scrapeMotionValuesFromProps:T,createRenderState:R}),Z=K({scrapeMotionValuesFromProps:C,createRenderState:U}),tt={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let nt=!1;function ot(){return function(){if(nt)return;const t={};for(const n in tt)t[n]={isEnabled:t=>tt[n].some(n=>!!t[n])};V(t),nt=!0}(),j()}const et=Symbol.for("motionComponentSymbol");function rt(t,n,o){const e=s(o);u(()=>{e.current=o});const r=s(null);return c(o=>{o&&t.onMount?.(o);const a=e.current;if("function"==typeof a)if(o){const t=a(o);"function"==typeof t&&(r.current=t)}else r.current?(r.current(),r.current=null):a(o);else a&&(a.current=o);n&&(o?n.mount(o):n.unmount())},[n])}const at="undefined"!=typeof window?l:d;function it(t,n,o,r,a,i){const{visualElement:c}=e(O),l=e(W),f=e(M),m=e(H),p=m.reducedMotion,y=m.skipAnimations,g=s(null),v=s(!1);r=r||l.renderer,!g.current&&r&&(g.current=r(t,{visualState:n,parent:c,props:o,presenceContext:f,blockInitialAnimation:!!f&&!1===f.initial,reducedMotionConfig:p,skipAnimations:y,isSVG:i}),v.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const h=g.current,w=e(x);!h||h.projection||!a||"html"!==h.type&&"svg"!==h.type||function(t,n,o,e){const{layoutId:r,layout:a,drag:i,dragConstraints:s,layoutScroll:u,layoutRoot:c,layoutAnchor:l,layoutCrossfade:d}=n;t.projection=new o(t.latestValues,n["data-framer-portal-id"]?void 0:st(t.parent)),t.projection.setOptions({layoutId:r,layout:a,alwaysMeasureLayout:Boolean(i)||s&&L(s),visualElement:t,animationType:"string"==typeof a?a:"both",initialPromotionConfig:e,crossfade:d,layoutScroll:u,layoutRoot:c,layoutAnchor:l})}(g.current,o,a,w);const S=s(!1);u(()=>{h&&S.current&&h.update(o,f)});const b=o[I],E=s(Boolean(b)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return at(()=>{v.current=!0,h&&(S.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),E.current&&h.animationState&&h.animationState.animateChanges())}),d(()=>{h&&(!E.current&&h.animationState&&h.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),E.current=!1),h.enteringChildren=void 0)}),h}function st(t){if(t)return!1!==t.options.allowProjection?t.projection:st(t.parent)}function ut(o,{forwardMotionProps:r=!1,type:a}={},i,s){const u=a?"svg"===a:S(o),c=u?Z:Q;function l(a,i){let l;const d={...e(H),...a,layoutId:ct(a)},{isStatic:f}=d,m=D(a),p=c(a,f);if(!f&&"undefined"!=typeof window){e(W).strict;const t=function(t){const n=ot(),{drag:o,layout:e}=n;if(!o&&!e)return{};const r={...o,...e};return{MeasureLayout:o?.isEnabled(t)||e?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(d);l=t.MeasureLayout,m.visualElement=it(o,p,d,s,t.ProjectionNode,u)}return t(O.Provider,{value:m,children:[l&&m.visualElement?n(l,{visualElement:m.visualElement,...d}):null,Y(o,a,rt(p,m.visualElement,i),p,f,r,u)]})}l.displayName=`motion.${"string"==typeof o?o:`create(${o.displayName??o.name??""})`}`;const d=f(l);return d[et]=o,d}function ct({layoutId:t}){const n=e(k).id;return n&&void 0!==t?n+"-"+t:t}function lt(t,n){return ut(t,n)}const dt=lt("div");export{dt as MotionDiv}; | ||
| import{jsxs as t,jsx as n}from"react/jsx-runtime";import{createContext as o,useContext as e,useMemo as r,Fragment as a,createElement as i,useRef as s,useInsertionEffect as u,useCallback as c,useLayoutEffect as l,useEffect as d,forwardRef as f}from"react";import{i as m,a as p,b as y,c as g,d as v,e as h,f as w,g as S,P as M,r as b,h as E,j as P,k as A,s as T,l as C,m as j,n as V,S as x,o as I,p as L,L as k}from"./size-rollup-dom-max-assets.js";const W=o({strict:!1}),H=o({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),O=o({});function D(t){const{initial:n,animate:o}=function(t,n){if(m(t)){const{initial:n,animate:o}=t;return{initial:!1===n||p(n)?n:void 0,animate:p(o)?o:void 0}}return!1!==t.inherit?n:{}}(t,e(O));return r(()=>({initial:n,animate:o}),[F(n),F(o)])}function F(t){return Array.isArray(t)?t.join(" "):t}const R=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function N(t,n,o){for(const e in n)y(n[e])||g(e,o)||(t[e]=n[e])}function B(t,n){const o={};return N(o,t.style||{},t),Object.assign(o,function({transformTemplate:t},n){return r(()=>{const o={style:{},transform:{},transformOrigin:{},vars:{}};return v(o,n,t),Object.assign({},o.vars,o.style)},[n])}(t,n)),o}function q(t,n){const o={},e=B(t,n);return t.drag&&!1!==t.dragListener&&(o.draggable=!1,e.userSelect=e.WebkitUserSelect=e.WebkitTouchCallout="none",e.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=e,o}const U=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function $(t,n,o,e){const a=r(()=>{const o={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return h(o,n,w(e),t.transformTemplate,t.style),{...o.attrs,style:{...o.style}}},[n]);if(t.style){const n={};N(n,t.style,t),a.style={...n,...a.style}}return a}const _=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function z(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||_.has(t)}let G=t=>!z(t);try{"function"==typeof(X=require("@emotion/is-prop-valid").default)&&(G=t=>t.startsWith("on")?!z(t):X(t))}catch{}var X;function Y(t,n,o,{latestValues:e},s,u=!1,c){const l=(c??S(t)?$:q)(n,e,s,t),d=function(t,n,o){const e={};for(const r in t)"values"===r&&"object"==typeof t.values||y(t[r])||(G(r)||!0===o&&z(r)||!n&&!z(r)||t.draggable&&r.startsWith("onDrag"))&&(e[r]=t[r]);return e}(n,"string"==typeof t,u),f=t!==a?{...d,...l,ref:o}:{},{children:m}=n,p=r(()=>y(m)?m.get():m,[m]);return i(t,{...f,children:p})}function J(t,n,o,e){const r={},a=e(t,{});for(const t in a)r[t]=b(a[t]);let{initial:i,animate:s}=t;const u=m(t),c=E(t);n&&c&&!u&&!1!==t.inherit&&(void 0===i&&(i=n.initial),void 0===s&&(s=n.animate));let l=!!o&&!1===o.initial;l=l||!1===i;const d=l?s:i;if(d&&"boolean"!=typeof d&&!P(d)){const n=Array.isArray(d)?d:[d];for(let o=0;o<n.length;o++){const e=A(t,n[o]);if(e){const{transitionEnd:t,transition:n,...o}=e;for(const t in o){let n=o[t];if(Array.isArray(n)){n=n[l?n.length-1:0]}null!==n&&(r[t]=n)}for(const n in t)r[n]=t[n]}}}return r}const K=t=>(n,o)=>{const r=e(O),a=e(M),i=()=>function({scrapeMotionValuesFromProps:t,createRenderState:n},o,e,r){return{latestValues:J(o,e,r,t),renderState:n()}}(t,n,r,a);return o?i():function(t){const n=s(null);return null===n.current&&(n.current=t()),n.current}(i)},Q=K({scrapeMotionValuesFromProps:T,createRenderState:R}),Z=K({scrapeMotionValuesFromProps:C,createRenderState:U}),tt={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let nt=!1;function ot(){return function(){if(nt)return;const t={};for(const n in tt)t[n]={isEnabled:t=>tt[n].some(n=>!!t[n])};V(t),nt=!0}(),j()}const et=Symbol.for("motionComponentSymbol");function rt(t,n,o){const e=s(o);u(()=>{e.current=o});const r=s(null);return c(o=>{o&&t.onMount?.(o),n&&(o?n.mount(o):n.unmount());const a=e.current;if("function"==typeof a)if(o){const t=a(o);"function"==typeof t&&(r.current=t)}else r.current?(r.current(),r.current=null):a(o);else a&&(a.current=o)},[n])}const at="undefined"!=typeof window?l:d;function it(t,n,o,r,a,i){const{visualElement:c}=e(O),l=e(W),f=e(M),m=e(H),p=m.reducedMotion,y=m.skipAnimations,g=s(null),v=s(!1);r=r||l.renderer,!g.current&&r&&(g.current=r(t,{visualState:n,parent:c,props:o,presenceContext:f,blockInitialAnimation:!!f&&!1===f.initial,reducedMotionConfig:p,skipAnimations:y,isSVG:i}),v.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const h=g.current,w=e(x);!h||h.projection||!a||"html"!==h.type&&"svg"!==h.type||function(t,n,o,e){const{layoutId:r,layout:a,drag:i,dragConstraints:s,layoutScroll:u,layoutRoot:c,layoutAnchor:l,layoutCrossfade:d}=n;t.projection=new o(t.latestValues,n["data-framer-portal-id"]?void 0:st(t.parent)),t.projection.setOptions({layoutId:r,layout:a,alwaysMeasureLayout:Boolean(i)||s&&L(s),visualElement:t,animationType:"string"==typeof a?a:"both",initialPromotionConfig:e,crossfade:d,layoutScroll:u,layoutRoot:c,layoutAnchor:l})}(g.current,o,a,w);const S=s(!1);u(()=>{h&&S.current&&h.update(o,f)});const b=o[I],E=s(Boolean(b)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return at(()=>{v.current=!0,h&&(S.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),E.current&&h.animationState&&h.animationState.animateChanges())}),d(()=>{h&&(!E.current&&h.animationState&&h.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),E.current=!1),h.enteringChildren=void 0)}),h}function st(t){if(t)return!1!==t.options.allowProjection?t.projection:st(t.parent)}function ut(o,{forwardMotionProps:r=!1,type:a}={},i,s){const u=a?"svg"===a:S(o),c=u?Z:Q;function l(a,i){let l;const d={...e(H),...a,layoutId:ct(a)},{isStatic:f}=d,m=D(a),p=c(a,f);if(!f&&"undefined"!=typeof window){e(W).strict;const t=function(t){const n=ot(),{drag:o,layout:e}=n;if(!o&&!e)return{};const r={...o,...e};return{MeasureLayout:o?.isEnabled(t)||e?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(d);l=t.MeasureLayout,m.visualElement=it(o,p,d,s,t.ProjectionNode,u)}return t(O.Provider,{value:m,children:[l&&m.visualElement?n(l,{visualElement:m.visualElement,...d}):null,Y(o,a,rt(p,m.visualElement,i),p,f,r,u)]})}l.displayName=`motion.${"string"==typeof o?o:`create(${o.displayName??o.name??""})`}`;const d=f(l);return d[et]=o,d}function ct({layoutId:t}){const n=e(k).id;return n&&void 0!==t?n+"-"+t:t}function lt(t,n){return ut(t,n)}const dt=lt("div");export{dt as MotionDiv}; |
@@ -1,1 +0,1 @@ | ||
| import{n as t,p as e,q as n,t as i,u as s,v as r,w as o,x as a,y as u,z as l,A as c,B as h,C as d,D as p,E as m,F as f,G as y,H as v,I as g,J as w,K as b,M as T,W as x,L as S,N as A,O as M,P as k,Q as C,R as E,S as V,T as P,U as D,V as O,r as I,X as F,Y as L,i as R,o as K,Z as B,_ as j,$ as q,a0 as N,a1 as U,a2 as G,a3 as H,a4 as $,a5 as W,a6 as _,d as z,s as Y,a7 as X,a8 as J,k as Z,e as Q,f as tt,a9 as et,b as nt,aa as it,j as st,ab as rt,g as ot}from"./size-rollup-dom-animation-assets.js";import{Fragment as at}from"react";const ut=(t,e)=>n=>e(t(n)),lt=(...t)=>t.reduce(ut),ct=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i},ht=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function dt(e,n,i,s){if(e===n&&i===s)return t;const r=t=>function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=ht(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(t,0,1,e,i);return t=>0===t||1===t?t:ht(r(t),n,s)}const pt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,mt=t=>e=>1-t(1-e),ft=dt(.33,1.53,.69,.99),yt=mt(ft),vt=pt(yt),gt=t=>t>=1?1:(t*=2)<1?.5*yt(t):.5*(2-Math.pow(2,-10*(t-1))),wt=t=>1-Math.sin(Math.acos(t)),bt=mt(wt),Tt=pt(wt),xt=dt(.42,0,1,1),St=dt(0,0,.58,1),At=dt(.42,0,.58,1),Mt={linear:t,easeIn:xt,easeInOut:At,easeOut:St,circIn:wt,circInOut:Tt,circOut:bt,backIn:yt,backInOut:vt,backOut:ft,anticipate:gt},kt=t=>{if(e(t)){n(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,s,r]=t;return dt(e,i,s,r)}return"string"==typeof t?(n(void 0!==Mt[t],`Invalid easing type '${t}'`,"invalid-easing-type"),Mt[t]):t};function Ct(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Et(t,e){return n=>n>0?e:t}const Vt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Pt=[o,s,r];function Dt(t){const e=(n=t,Pt.find(t=>t.test(n)));var n;if(a(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===r&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,r=0,o=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Ct(a,i,t+1/3),r=Ct(a,i,t),o=Ct(a,i,t-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}(i)),i}const Ot=(t,e)=>{const n=Dt(t),r=Dt(e);if(!n||!r)return Et(t,e);const o={...n};return t=>(o.red=Vt(n.red,r.red,t),o.green=Vt(n.green,r.green,t),o.blue=Vt(n.blue,r.blue,t),o.alpha=i(n.alpha,r.alpha,t),s.transform(o))},It=new Set(["none","hidden"]);function Ft(t,e){return n=>i(t,e,n)}function Lt(t){return"number"==typeof t?Ft:"string"==typeof t?u(t)?Et:l.test(t)?Ot:Bt:Array.isArray(t)?Rt:"object"==typeof t?l.test(t)?Ot:Kt:Et}function Rt(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>Lt(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Kt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Lt(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Bt=(t,e)=>{const n=c.createTransformer(e),i=h(t),s=h(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?It.has(t)&&!s.values.length||It.has(e)&&!i.values.length?function(t,e){return It.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):lt(Rt(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const r=e.types[s],o=t.indexes[r][i[r]],a=t.values[o]??0;n[s]=a,i[r]++}return n}(i,s),s.values),n):(a(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Et(t,e))};function jt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return i(t,e,n);return Lt(t)(t,e)}const qt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>f.update(e,t),stop:()=>m(e),now:()=>d.isProcessing?d.timestamp:p.now()}},Nt=2e4;function Ut(t){let e=0;let n=t.next(e);for(;!n.done&&e<Nt;)e+=50,n=t.next(e);return e>=Nt?1/0:e}const Gt=100,Ht=10,$t=1,Wt=0,_t=800,zt=.3,Yt=.3,Xt={granular:.01,default:2},Jt={granular:.005,default:.5},Zt=.01,Qt=10,te=.05,ee=1;function ne(t,e){return t*Math.sqrt(1-e*e)}const ie=.001;const se=["duration","bounce"],re=["stiffness","damping","mass"];function oe(t,e){return e.some(e=>void 0!==t[e])}function ae(t){let e={velocity:Wt,stiffness:Gt,damping:Ht,mass:$t,isResolvedFromDuration:!1,...t};if(!oe(t,re)&&oe(t,se))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,r=2*v(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:$t,stiffness:s,damping:r}}else{const n=function({duration:t=_t,bounce:e=zt,velocity:n=Wt,mass:i=$t}){let s,r;a(t<=w(Qt),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=v(te,ee,o),t=v(Zt,Qt,y(t)),o<1?(s=e=>{const i=e*o,s=i*t,r=i-n,a=ne(e,o),u=Math.exp(-s);return ie-r/a*u},r=e=>{const i=e*o*t,r=i*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,u=Math.exp(-i),l=ne(Math.pow(e,2),o);return(-s(e)+ie>0?-1:1)*((r-a)*u)/l}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const u=function(t,e,n){let i=n;for(let n=1;n<12;n++)i-=t(i)/e(i);return i}(s,r,5/t);if(t=w(t),isNaN(u))return{stiffness:Gt,damping:Ht,duration:t};{const e=Math.pow(u,2)*i;return{stiffness:e,damping:2*o*Math.sqrt(i*e),duration:t}}}({...t,velocity:0});e={...e,...n,mass:$t},e.isResolvedFromDuration=!0}return e}function ue(t=Yt,e=zt){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:u,damping:l,mass:c,duration:h,velocity:d,isResolvedFromDuration:p}=ae({...n,velocity:-y(n.velocity||0)}),m=d||0,f=l/(2*Math.sqrt(u*c)),v=o-r,b=y(Math.sqrt(u/c)),T=Math.abs(v)<5;let x,S,A,M,k,C;if(i||(i=T?Xt.granular:Xt.default),s||(s=T?Jt.granular:Jt.default),f<1)A=ne(b,f),M=(m+f*b*v)/A,x=t=>{const e=Math.exp(-f*b*t);return o-e*(M*Math.sin(A*t)+v*Math.cos(A*t))},k=f*b*M+v*A,C=f*b*v-M*A,S=t=>Math.exp(-f*b*t)*(k*Math.sin(A*t)+C*Math.cos(A*t));else if(1===f){x=t=>o-Math.exp(-b*t)*(v+(m+b*v)*t);const t=m+b*v;S=e=>Math.exp(-b*e)*(b*t*e-m)}else{const t=b*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*b*e),i=Math.min(t*e,300);return o-n*((m+f*b*v)*Math.sinh(i)+t*v*Math.cosh(i))/t};const e=(m+f*b*v)/t,n=f*b*e-v*t,i=f*b*v-e*t;S=e=>{const s=Math.exp(-f*b*e),r=Math.min(t*e,300);return s*(n*Math.sinh(r)+i*Math.cosh(r))}}const E={calculatedDuration:p&&h||null,velocity:t=>w(S(t)),next:t=>{if(!p&&f<1){const e=Math.exp(-f*b*t),n=Math.sin(A*t),r=Math.cos(A*t),u=o-e*(M*n+v*r),l=w(e*(k*n+C*r));return a.done=Math.abs(l)<=i&&Math.abs(o-u)<=s,a.value=a.done?o:u,a}const e=x(t);if(p)a.done=t>=h;else{const n=w(S(t));a.done=Math.abs(n)<=i&&Math.abs(o-e)<=s}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(Ut(E),Nt),e=g(e=>E.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return E}ue.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(Ut(i),Nt);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:y(s)}}(t,100,ue);return t.ease=e.ease,t.duration=w(e.duration),t.type="keyframes",t};function le(t,e,n){const i=Math.max(e-5,0);return b(n-t(i),e-i)}function ce({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?u:void 0===u||Math.abs(a-t)<Math.abs(u-t)?a:u;let m=n*e;const f=h+m,y=void 0===o?f:o(f);y!==f&&(m=y-h);const v=t=>-m*Math.exp(-t/i),g=t=>y+v(t),w=t=>{const e=v(t),n=g(t);d.done=Math.abs(e)<=l,d.value=d.done?y:n};let b,T;const x=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==u&&e>u)&&(b=t,T=ue({keyframes:[d.value,p(d.value)],velocity:le(g,t,d.value),damping:s,stiffness:r,restDelta:l,restSpeed:c}))};return x(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==b||(e=!0,w(t),x(t)),void 0!==b&&t>=b?T.next(t-b):(!e&&w(t),d)}}}function he(e,i,{clamp:s=!0,ease:r,mixer:o}={}){const a=e.length;if(n(a===i.length,"Both input and output ranges must be the same length","range-length"),1===a)return()=>i[0];if(2===a&&i[0]===i[1])return()=>i[1];const u=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),i=[...i].reverse());const l=function(e,n,i){const s=[],r=i||T.mix||jt,o=e.length-1;for(let i=0;i<o;i++){let o=r(e[i],e[i+1]);if(n){const e=Array.isArray(n)?n[i]||t:n;o=lt(e,o)}s.push(o)}return s}(i,r,o),c=l.length,h=t=>{if(u&&t<e[0])return i[0];let n=0;if(c>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=ct(e[n],e[n+1],t);return l[n](s)};return s?t=>h(v(e[0],e[a-1],t)):h}function de(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=ct(0,e,s);t.push(i(n,1,r))}}(e,t.length-1),e}function pe({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(kt):kt(i),r={done:!1,value:e[0]},o=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:de(e),t),a=he(o,e,{ease:Array.isArray(s)?s:(u=e,l=s,u.map(()=>l||At).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}const me={decay:ce,inertia:ce,tween:pe,keyframes:pe,spring:ue};function fe(t){"string"==typeof t.type&&(t.type=me[t.type])}const ye=t=>t/100;class ve extends x{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==p.now()&&this.tick(p.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;fe(t);const{type:e=pe,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=t;let{keyframes:o}=t;const a=e||pe;a!==pe&&"number"!=typeof o[0]&&(this.mixKeyframes=lt(ye,jt(o[0],o[1])),o=[0,100]);const u=a({...t,keyframes:o});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...o].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=Ut(u));const{calculatedDuration:l}=u;this.calculatedDuration=l,this.resolvedDuration=l+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=u}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:o,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:u=0,keyframes:l,repeat:c,repeatType:h,repeatDelay:d,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let w,b=this.currentTime,T=n;if(c){const t=Math.min(this.currentTime,i)/o;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,c+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/o)):"mirror"===h&&(T=r)),b=v(0,1,n)*o}g?(this.delayState.value=l[0],w=this.delayState):w=T.next(b),s&&!g&&(w.value=s(w.value));let{done:x}=w;g||null===a||(x=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const A=null===this.holdTime&&("finished"===this.state||"running"===this.state&&x);return A&&p!==ce&&(w.value=S(l,this.options,f,this.speed)),m&&m(w.value),A&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return y(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+y(t)}get time(){return y(this.currentTime)}set time(t){t=w(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return le(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(p.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=y(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=qt,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(p.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const ge={anticipate:gt,backInOut:vt,circInOut:Tt};function we(t){"string"==typeof t.ease&&t.ease in ge&&(t.ease=ge[t.ease])}class be extends A{constructor(t){we(t),fe(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...r}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const o=new ve({...r,autoplay:!1}),a=Math.max(10,p.now()-this.startTime),u=v(0,10,a-10),l=o.sample(a).value,{name:c}=this.options;s&&c&&M(s,c,l),e.setWithVelocity(o.sample(Math.max(0,a-u)).value,l,u),o.stop()}}const Te=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!c.test(t)&&"0"!==t||t.startsWith("url(")));function xe(t){t.duration=0,t.type="keyframes"}const Se=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const Ae=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Me=E(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ke(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:r,type:o,keyframes:a}=t,u=e?.owner?.current;if(!(u instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Me()&&n&&(C.has(n)||Ae.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&Se.test(t[e]))return!0;return!1}(a))&&("transform"!==n||!c)&&!l&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}class Ce extends x{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:a,motionValue:u,element:l,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=p.now();const h={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:r,name:a,motionValue:u,element:l,...c},d=l?.KeyframeResolver||V;this.keyframeResolver=new d(o,(t,e,n)=>this.onKeyframesResolved(t,e,h,!n),a,u,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:r,type:o,velocity:u,delay:l,isHandoff:c,onUpdate:h}=i;this.resolvedAt=p.now();let d=!0;(function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=Te(s,e),u=Te(r,e);return a(o===u,`You are trying to animate ${e} from "${s}" to "${r}". "${o?r:s}" is not an animatable value.`,"value-not-animatable"),!(!o||!u)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||k(n))&&i)})(e,r,o,u)||(d=!1,!T.instantAnimations&&l||h?.(S(e,i,n)),e[0]=e[e.length-1],xe(i),i.repeat=0);const m={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},f=d&&!c&&ke(m),y=m.motionValue?.owner?.current;let v;if(f)try{v=new be({...m,element:y})}catch{v=new ve(m)}else v=new ve(m);v.finished.then(()=>{this.notifyFinished()}).catch(t),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),P()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Ee(t,e,n,i=0,s=1){const r=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),o=t.size,a=(o-1)*i;return"function"==typeof n?n(r,o):1===s?r*i:a-r*i}const Ve=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Pe(t,e,i=1){n(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=function(t){const e=Ve.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return D(t)?parseFloat(t):t}return u(r)?Pe(r,e,i+1):r}const De={type:"spring",stiffness:500,damping:25,restSpeed:10},Oe={type:"keyframes",duration:.8},Ie={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Fe=(t,{keyframes:e})=>e.length>2?Oe:O.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:De:Ie;function Le(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function Re(t,e){const n=t?.[e]??t?.default??t;return n!==t?Le(n,t):n}const Ke=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Be=(t,e,n,i={},s,r)=>o=>{const a=Re(i,t)||{},u=a.delay||i.delay||0;let{elapsed:l=0}=i;l-=w(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:s};(function(t){for(const e in t)if(!Ke.has(e))return!0;return!1})(a)||Object.assign(c,Fe(t,c)),c.duration&&(c.duration=w(c.duration)),c.repeatDelay&&(c.repeatDelay=w(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let h=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(xe(c),0===c.delay&&(h=!0)),(T.instantAnimations||T.skipAnimations||s?.shouldSkipAnimations)&&(h=!0,xe(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,h&&!r&&void 0!==e.get()){const t=S(c.keyframes,a);if(void 0!==t)return void f.update(()=>{c.onUpdate(t),c.onComplete()})}return a.isSync?new ve(c):new Ce(c)};function je(t,e,n){const i=t.getProps();return I(i,e,void 0!==n?n:i.custom,t)}const qe=new Set(["width","height","top","left","right","bottom",...F]),Ne=t=>Array.isArray(t);function Ue(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,L(n))}function Ge(t){return Ne(t)?t[t.length-1]||0:t}function He(t,e){const n=t.getValue("willChange");if(i=n,Boolean(R(i)&&i.add))return n.add(e);if(!n&&T.WillChange){const n=new T.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function $e(t){return t.props[K]}function We({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function _e(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:r,transitionEnd:o,...a}=e;const u=t.getDefaultTransition();r=r?Le(r,u):u;const l=r?.reduceMotion;i&&(r=i);const c=[],h=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||h&&We(h,e))continue;const o={delay:n,...Re(r||{},e)},u=i.get();if(void 0!==u&&!i.isAnimating()&&!Array.isArray(s)&&s===u&&!o.velocity){f.update(()=>i.set(s));continue}let d=!1;if(window.MotionHandoffAnimation){const n=$e(t);if(n){const t=window.MotionHandoffAnimation(n,e,f);null!==t&&(o.startTime=t,d=!0)}}He(t,e);const p=l??t.shouldReduceMotion;i.start(Be(e,i,s,p&&qe.has(e)?{type:!1}:o,t,d));const m=i.animation;m&&c.push(m)}if(o){const e=()=>f.update(()=>{o&&function(t,e){const n=je(t,e);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const e in r)Ue(t,e,Ge(r[e]))}(t,o)});c.length?Promise.all(c).then(e):e()}return c}function ze(t,e,n={}){const i=je(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const r=i?()=>Promise.all(_e(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:r=0,staggerChildren:o,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=0,r=1,o){const a=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),a.push(ze(u,e,{...o,delay:n+("function"==typeof i?0:i)+Ee(t.variantChildren,u,i,s,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,i,r,o,a,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[r,o]:[o,r];return t().then(()=>e())}return Promise.all([r(),o(n.delay)])}function Ye(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||B(t))}const Xe=new Set(["auto","none","0"]);class Je extends V{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),u(i))){const s=Pe(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!qe.has(n)||2!==t.length)return;const[i,s]=t,r=q(i),o=q(s);if(N(i)!==N(s)&&U[n])this.needsMeasurement=!0;else if(r!==o)if(G(r)&&G(o))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else U[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Ye(t[e]))&&n.push(e);n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Xe.has(e)&&h(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=j(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=U[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,r=n[s];n[s]=U[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const Ze=!1;function Qe(t,e){const n=function(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function tn(t){return!("touch"===t.pointerType||Ze)}function en(t,e,n={}){const[i,s,r]=Qe(t,n);return i.forEach(t=>{let n,i=!1,r=!1;const o=e=>{n&&(n(e),n=void 0),t.removeEventListener("pointerleave",u)},a=t=>{i=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),r&&(r=!1,o(t))},u=t=>{"touch"!==t.pointerType&&(i?r=!0:o(t))};t.addEventListener("pointerenter",i=>{if(!tn(i))return;r=!1;const o=e(t,i);"function"==typeof o&&(n=o,t.addEventListener("pointerleave",u,s))},s),t.addEventListener("pointerdown",()=>{i=!0,window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",a,s)},s)}),r}const nn=(t,e)=>!!e&&(t===e||nn(t,e.parentElement)),sn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const rn=new WeakSet;function on(t){return e=>{"Enter"===e.key&&t(e)}}function an(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function un(t){return(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(t)&&!0}const ln=new WeakSet;function cn(t,e,n={}){const[i,s,r]=Qe(t,n),o=t=>{const i=t.currentTarget;if(!un(t))return;if(ln.has(t))return;rn.add(i),n.stopPropagation&&ln.add(t);const r=e(i,t),o=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",u),rn.has(i)&&rn.delete(i),un(t)&&"function"==typeof r&&r(t,{success:e})},a=t=>{o(t,i===window||i===document||n.useGlobalTarget||nn(i,t.target))},u=t=>{o(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",u,s)};return i.forEach(t=>{var e,i;(n.useGlobalTarget?window:t).addEventListener("pointerdown",o,s),"object"==typeof(i=e=t)&&null!==i&&"offsetHeight"in e&&!("ownerSVGElement"in e)&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=on(()=>{if(rn.has(n))return;an(n,"down");const t=on(()=>{an(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>an(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s)),function(t){return sn.has(t.tagName)||!0===t.isContentEditable}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),r}class hn extends H{constructor(){super(...arguments),this.KeyframeResolver=Je}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;R(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class dn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function pn(t,{style:e,vars:n},i,s){const r=t.style;let o;for(o in e)r[o]=e[o];for(o in s?.applyProjectionStyles(r,i),n)r.setProperty(o,n[o])}class mn extends hn{constructor(){super(...arguments),this.type="html",this.renderInstance=pn}readValueFromInstance(t,e){if(O.has(e))return this.projection?.isProjecting?$(e):W(t,e);{const i=(n=t,window.getComputedStyle(n)),s=(_(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){z(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Y(t,e,n)}}const fn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class yn extends hn{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=J}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(O.has(e)){const t=et(e);return t&&t.default||0}return e=fn.has(e)?e:X(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Z(t,e,n)}build(t,e,n){Q(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,i){!function(t,e,n,i){pn(t,e,void 0,i);for(const n in e.attrs)t.setAttribute(fn.has(n)?n:X(n),e.attrs[n])}(t,e,0,i)}mount(t){this.isSVGTag=tt(t.tagName),super.mount(t)}}const vn=it.length;function gn(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&gn(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<vn;n++){const i=it[n],s=t.props[i];(nt(s)||!1===s)&&(e[i]=s)}return e}function wn(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const bn=[...rt].reverse(),Tn=rt.length;function xn(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>ze(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=ze(t,e,n);else{const s="function"==typeof e?je(t,e,n.custom):e;i=Promise.all(_e(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}(t,e,n)))}function Sn(t){let e=xn(t),n=kn(),i=!0,s=!1;const r=e=>(n,i)=>{const s=je(t,i,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...i}=s;n={...n,...i,...e}}return n};function o(o){const{props:a}=t,u=gn(t.parent)||{},l=[],c=new Set;let h={},d=1/0;for(let e=0;e<Tn;e++){const p=bn[e],m=n[p],f=void 0!==a[p]?a[p]:u[p],y=nt(f),v=p===o?m.isActive:null;!1===v&&(d=e);let g=f===u[p]&&f!==a[p]&&y;if(g&&(i||s)&&t.manuallyAnimateOnMount&&(g=!1),m.protectedKeys={...h},!m.isActive&&null===v||!f&&!m.prevProp||st(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(h={...h,...m.prevResolvedValues});continue}const w=An(m.prevProp,f);let b=w||p===o&&m.isActive&&!g&&y||e>d&&y,T=!1;const x=Array.isArray(f)?f:[f];let S=x.reduce(r(p),{});!1===v&&(S={});const{prevResolvedValues:A={}}=m,M={...A,...S},k=e=>{b=!0,c.has(e)&&(T=!0,c.delete(e)),m.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in M){const e=S[t],n=A[t];if(h.hasOwnProperty(t))continue;let i=!1;i=Ne(e)&&Ne(n)?!wn(e,n):e!==n,i?null!=e?k(t):c.add(t):void 0!==e&&c.has(t)?k(t):m.protectedKeys[t]=!0}m.prevProp=f,m.prevResolvedValues=S,m.isActive&&(h={...h,...S}),(i||s)&&t.blockInitialAnimation&&(b=!1);const C=g&&w;b&&(!C||T)&&l.push(...x.map(e=>{const n={type:p};if("string"==typeof e&&(i||s)&&!C&&t.manuallyAnimateOnMount&&t.parent){const{parent:i}=t,s=je(i,e);if(i.enteringChildren&&s){const{delayChildren:e}=s.transition||{};n.delay=Ee(i.enteringChildren,t,e)}}return{animation:e,options:n}}))}if(c.size){const e={};if("boolean"!=typeof a.initial){const n=je(t,Array.isArray(a.initial)?a.initial[0]:a.initial);n&&n.transition&&(e.transition=n.transition)}c.forEach(n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=i??null}),l.push({animation:e})}let p=Boolean(l.length);return!i||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),i=!1,s=!1,p?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,i)),n[e].isActive=i;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=kn(),s=!0}}}function An(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!wn(e,t)}function Mn(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function kn(){return{animate:Mn(!0),whileInView:Mn(),whileHover:Mn(),whileTap:Mn(),whileDrag:Mn(),whileFocus:Mn(),exit:Mn()}}function Cn(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}let En=0;const Vn={animation:{Feature:class extends dn{constructor(t){super(t),t.animationState||(t.animationState=Sn(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();st(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends dn{constructor(){super(...arguments),this.id=En++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;if(t&&!1===n){if(this.isExitComplete){const{initial:t,custom:e}=this.node.getProps();if("string"==typeof t){const n=je(this.node,t,e);if(n){const{transition:t,transitionEnd:e,...i}=n;for(const t in i)this.node.getValue(t)?.jump(i[t])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const i=this.node.animationState.setActive("exit",!t);e&&!t&&i.then(()=>{this.isExitComplete=!0,e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Pn(t){return{point:{x:t.pageX,y:t.pageY}}}function Dn(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover","Start"===n);const s=i["onHover"+n];s&&f.postRender(()=>s(e,Pn(e)))}function On(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap","Start"===n);const s=i["onTap"+("End"===n?"":n)];s&&f.postRender(()=>s(e,Pn(e)))}const In=new WeakMap,Fn=new WeakMap,Ln=t=>{const e=In.get(t.target);e&&e(t)},Rn=t=>{t.forEach(Ln)};function Kn(t,e,n){const i=function({root:t,...e}){const n=t||document;Fn.has(n)||Fn.set(n,{});const i=Fn.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(Rn,{root:t,...e})),i[s]}(e);return In.set(t,n),i.observe(t),()=>{In.delete(t),i.unobserve(t)}}const Bn={some:0,all:1};const jn={renderer:(t,e)=>e.isSVG??ot(t)?new yn(e):new mn(e,{allowProjection:t!==at}),...Vn,...{inView:{Feature:class extends dn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:i="some",once:s}=t,r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:Bn[i]};this.stopObserver=Kn(this.node.current,r,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),r=e?n:i;r&&r(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends dn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:e,propagate:n}=this.node.props;this.unmount=cn(t,(t,e)=>(On(this.node,e,"Start"),(t,{success:e})=>On(this.node,t,e?"End":"Cancel")),{useGlobalTarget:e,stopPropagation:!1===n?.tap})}unmount(){}}},focus:{Feature:class extends dn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=lt(Cn(this.node.current,"focus",()=>this.onFocus()),Cn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends dn{mount(){const{current:t}=this.node;t&&(this.unmount=en(t,(t,e)=>(Dn(this.node,e,"Start"),t=>Dn(this.node,t,"End"))))}unmount(){}}}}};export{jn as domAnimation}; | ||
| import{n as t,p as e,q as n,t as i,u as s,v as r,w as o,x as a,y as u,z as l,A as c,B as h,C as d,D as p,E as m,F as f,G as y,H as v,I as g,J as w,K as b,M as T,W as x,L as A,N as S,O as M,P as k,Q as C,R as E,S as V,T as P,U as D,V as O,r as I,X as F,Y as L,i as R,o as K,Z as B,_ as j,$ as q,a0 as N,a1 as U,a2 as G,a3 as H,a4 as $,a5 as W,a6 as _,d as z,s as Y,a7 as X,a8 as J,k as Z,e as Q,f as tt,a9 as et,b as nt,aa as it,j as st,ab as rt,g as ot}from"./size-rollup-dom-animation-assets.js";import{Fragment as at}from"react";const ut=(...t)=>t.reduce((t,e)=>n=>e(t(n))),lt=(t,e,n)=>{const i=e-t;return i?(n-t)/i:1},ct=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function ht(e,n,i,s){if(e===n&&i===s)return t;const r=t=>function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=ct(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(t,0,1,e,i);return t=>0===t||1===t?t:ct(r(t),n,s)}const dt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,pt=t=>e=>1-t(1-e),mt=ht(.33,1.53,.69,.99),ft=pt(mt),yt=dt(ft),vt=t=>t>=1?1:(t*=2)<1?.5*ft(t):.5*(2-Math.pow(2,-10*(t-1))),gt=t=>1-Math.sin(Math.acos(t)),wt=pt(gt),bt=dt(gt),Tt=ht(.42,0,1,1),xt=ht(0,0,.58,1),At=ht(.42,0,.58,1),St={linear:t,easeIn:Tt,easeInOut:At,easeOut:xt,circIn:gt,circInOut:bt,circOut:wt,backIn:ft,backInOut:yt,backOut:mt,anticipate:vt},Mt=t=>{if(e(t)){n(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,i,s,r]=t;return ht(e,i,s,r)}return"string"==typeof t?(n(void 0!==St[t],`Invalid easing type '${t}'`,"invalid-easing-type"),St[t]):t};function kt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Ct(t,e){return n=>n>0?e:t}const Et=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Vt=[o,s,r];function Pt(t){const e=(n=t,Vt.find(t=>t.test(n)));var n;if(a(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===r&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,r=0,o=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=kt(a,i,t+1/3),r=kt(a,i,t),o=kt(a,i,t-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}(i)),i}const Dt=(t,e)=>{const n=Pt(t),r=Pt(e);if(!n||!r)return Ct(t,e);const o={...n};return t=>(o.red=Et(n.red,r.red,t),o.green=Et(n.green,r.green,t),o.blue=Et(n.blue,r.blue,t),o.alpha=i(n.alpha,r.alpha,t),s.transform(o))},Ot=new Set(["none","hidden"]);function It(t,e){return n=>i(t,e,n)}function Ft(t){return"number"==typeof t?It:"string"==typeof t?u(t)?Ct:l.test(t)?Dt:Kt:Array.isArray(t)?Lt:"object"==typeof t?l.test(t)?Dt:Rt:Ct}function Lt(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>Ft(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Rt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Ft(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Kt=(t,e)=>{const n=c.createTransformer(e),i=h(t),s=h(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?Ot.has(t)&&!s.values.length||Ot.has(e)&&!i.values.length?function(t,e){return Ot.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):ut(Lt(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const r=e.types[s],o=t.indexes[r][i[r]],a=t.values[o]??0;n[s]=a,i[r]++}return n}(i,s),s.values),n):(a(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Ct(t,e))};function Bt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return i(t,e,n);return Ft(t)(t,e)}const jt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>f.update(e,t),stop:()=>m(e),now:()=>d.isProcessing?d.timestamp:p.now()}},qt=2e4;function Nt(t){let e=0;let n=t.next(e);for(;!n.done&&e<qt;)e+=50,n=t.next(e);return e>=qt?1/0:e}const Ut=100,Gt=10,Ht=1,$t=0,Wt=800,_t=.3,zt=.3,Yt={granular:.01,default:2},Xt={granular:.005,default:.5},Jt=.01,Zt=10,Qt=.05,te=1;function ee(t,e){return t*Math.sqrt(1-e*e)}const ne=.001;const ie=["duration","bounce"],se=["stiffness","damping","mass"];function re(t,e){return e.some(e=>void 0!==t[e])}function oe(t){let e={velocity:$t,stiffness:Ut,damping:Gt,mass:Ht,isResolvedFromDuration:!1,...t};if(!re(t,se)&&re(t,ie))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,r=2*v(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Ht,stiffness:s,damping:r}}else{const n=function({duration:t=Wt,bounce:e=_t,velocity:n=$t,mass:i=Ht}){let s,r;a(t<=w(Zt),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=v(Qt,te,o),t=v(Jt,Zt,y(t)),o<1?(s=e=>{const i=e*o,s=i*t,r=i-n,a=ee(e,o),u=Math.exp(-s);return ne-r/a*u},r=e=>{const i=e*o*t,r=i*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,u=Math.exp(-i),l=ee(Math.pow(e,2),o);return(-s(e)+ne>0?-1:1)*((r-a)*u)/l}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const u=function(t,e,n){let i=n;for(let n=1;n<12;n++)i-=t(i)/e(i);return i}(s,r,5/t);if(t=w(t),isNaN(u))return{stiffness:Ut,damping:Gt,duration:t};{const e=Math.pow(u,2)*i;return{stiffness:e,damping:2*o*Math.sqrt(i*e),duration:t}}}({...t,velocity:0});e={...e,...n,mass:Ht},e.isResolvedFromDuration=!0}return e}function ae(t=zt,e=_t){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:u,damping:l,mass:c,duration:h,velocity:d,isResolvedFromDuration:p}=oe({...n,velocity:-y(n.velocity||0)}),m=d||0,f=l/(2*Math.sqrt(u*c)),v=o-r,b=y(Math.sqrt(u/c)),T=Math.abs(v)<5;let x,A,S,M,k,C;if(i||(i=T?Yt.granular:Yt.default),s||(s=T?Xt.granular:Xt.default),f<1)S=ee(b,f),M=(m+f*b*v)/S,x=t=>{const e=Math.exp(-f*b*t);return o-e*(M*Math.sin(S*t)+v*Math.cos(S*t))},k=f*b*M+v*S,C=f*b*v-M*S,A=t=>Math.exp(-f*b*t)*(k*Math.sin(S*t)+C*Math.cos(S*t));else if(1===f){x=t=>o-Math.exp(-b*t)*(v+(m+b*v)*t);const t=m+b*v;A=e=>Math.exp(-b*e)*(b*t*e-m)}else{const t=b*Math.sqrt(f*f-1);x=e=>{const n=Math.exp(-f*b*e),i=Math.min(t*e,300);return o-n*((m+f*b*v)*Math.sinh(i)+t*v*Math.cosh(i))/t};const e=(m+f*b*v)/t,n=f*b*e-v*t,i=f*b*v-e*t;A=e=>{const s=Math.exp(-f*b*e),r=Math.min(t*e,300);return s*(n*Math.sinh(r)+i*Math.cosh(r))}}const E={calculatedDuration:p&&h||null,velocity:t=>w(A(t)),next:t=>{if(!p&&f<1){const e=Math.exp(-f*b*t),n=Math.sin(S*t),r=Math.cos(S*t),u=o-e*(M*n+v*r),l=w(e*(k*n+C*r));return a.done=Math.abs(l)<=i&&Math.abs(o-u)<=s,a.value=a.done?o:u,a}const e=x(t);if(p)a.done=t>=h;else{const n=w(A(t));a.done=Math.abs(n)<=i&&Math.abs(o-e)<=s}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(Nt(E),qt),e=g(e=>E.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return E}ae.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(Nt(i),qt);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:y(s)}}(t,100,ae);return t.ease=e.ease,t.duration=w(e.duration),t.type="keyframes",t};function ue(t,e,n){const i=Math.max(e-5,0);return b(n-t(i),e-i)}function le({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:c}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?u:void 0===u||Math.abs(a-t)<Math.abs(u-t)?a:u;let m=n*e;const f=h+m,y=void 0===o?f:o(f);y!==f&&(m=y-h);const v=t=>-m*Math.exp(-t/i),g=t=>y+v(t),w=t=>{const e=v(t),n=g(t);d.done=Math.abs(e)<=l,d.value=d.done?y:n};let b,T;const x=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==u&&e>u)&&(b=t,T=ae({keyframes:[d.value,p(d.value)],velocity:ue(g,t,d.value),damping:s,stiffness:r,restDelta:l,restSpeed:c}))};return x(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==b||(e=!0,w(t),x(t)),void 0!==b&&t>=b?T.next(t-b):(!e&&w(t),d)}}}function ce(e,i,{clamp:s=!0,ease:r,mixer:o}={}){const a=e.length;if(n(a===i.length,"Both input and output ranges must be the same length","range-length"),1===a)return()=>i[0];if(2===a&&i[0]===i[1])return()=>i[1];const u=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),i=[...i].reverse());const l=function(e,n,i){const s=[],r=i||T.mix||Bt,o=e.length-1;for(let i=0;i<o;i++){let o=r(e[i],e[i+1]);if(n){const e=Array.isArray(n)?n[i]||t:n;o=ut(e,o)}s.push(o)}return s}(i,r,o),c=l.length,h=t=>{if(u&&t<e[0])return i[0];let n=0;if(c>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=lt(e[n],e[n+1],t);return l[n](s)};return s?t=>h(v(e[0],e[a-1],t)):h}function he(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=lt(0,e,s);t.push(i(n,1,r))}}(e,t.length-1),e}function de({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(Mt):Mt(i),r={done:!1,value:e[0]},o=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:he(e),t),a=ce(o,e,{ease:Array.isArray(s)?s:(u=e,l=s,u.map(()=>l||At).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}const pe={decay:le,inertia:le,tween:de,keyframes:de,spring:ae};function me(t){"string"==typeof t.type&&(t.type=pe[t.type])}const fe=t=>t/100;class ye extends x{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==p.now()&&this.tick(p.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;me(t);const{type:e=de,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=t;let{keyframes:o}=t;const a=e||de;a!==de&&"number"!=typeof o[0]&&(this.mixKeyframes=ut(fe,Bt(o[0],o[1])),o=[0,100]);const u=a({...t,keyframes:o});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...o].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=Nt(u));const{calculatedDuration:l}=u;this.calculatedDuration=l,this.resolvedDuration=l+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=u}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:o,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:u=0,keyframes:l,repeat:c,repeatType:h,repeatDelay:d,type:p,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let w,b=this.currentTime,T=n;if(c){const t=Math.min(this.currentTime,i)/o;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,c+1);Boolean(e%2)&&("reverse"===h?(n=1-n,d&&(n-=d/o)):"mirror"===h&&(T=r)),b=v(0,1,n)*o}g?(this.delayState.value=l[0],w=this.delayState):w=T.next(b),s&&!g&&(w.value=s(w.value));let{done:x}=w;g||null===a||(x=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&x);return S&&p!==le&&(w.value=A(l,this.options,f,this.speed)),m&&m(w.value),S&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return y(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+y(t)}get time(){return y(this.currentTime)}set time(t){t=w(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return ue(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(p.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=y(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=jt,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(p.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const ve={anticipate:vt,backInOut:yt,circInOut:bt};function ge(t){"string"==typeof t.ease&&t.ease in ve&&(t.ease=ve[t.ease])}class we extends S{constructor(t){ge(t),me(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...r}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const o=new ye({...r,autoplay:!1}),a=Math.max(10,p.now()-this.startTime),u=v(0,10,a-10),l=o.sample(a).value,{name:c}=this.options;s&&c&&M(s,c,l),e.setWithVelocity(o.sample(Math.max(0,a-u)).value,l,u),o.stop()}}const be=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!c.test(t)&&"0"!==t||t.startsWith("url(")));function Te(t){t.duration=0,t.type="keyframes"}const xe=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const Ae=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Se=E(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Me(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:r,type:o,keyframes:a}=t,u=e?.owner?.current;if(!(u instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Se()&&n&&(C.has(n)||Ae.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&xe.test(t[e]))return!0;return!1}(a))&&("transform"!==n||!c)&&!l&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}class ke extends x{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:a,motionValue:u,element:l,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=p.now();const h={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:r,name:a,motionValue:u,element:l,...c},d=l?.KeyframeResolver||V;this.keyframeResolver=new d(o,(t,e,n)=>this.onKeyframesResolved(t,e,h,!n),a,u,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:r,type:o,velocity:u,delay:l,isHandoff:c,onUpdate:h}=i;this.resolvedAt=p.now();let d=!0;(function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=be(s,e),u=be(r,e);return a(o===u,`You are trying to animate ${e} from "${s}" to "${r}". "${o?r:s}" is not an animatable value.`,"value-not-animatable"),!(!o||!u)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||k(n))&&i)})(e,r,o,u)||(d=!1,!T.instantAnimations&&l||h?.(A(e,i,n)),e[0]=e[e.length-1],Te(i),i.repeat=0);const m={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},f=d&&!c&&Me(m),y=m.motionValue?.owner?.current;let v;if(f)try{v=new we({...m,element:y})}catch{v=new ye(m)}else v=new ye(m);v.finished.then(()=>{this.notifyFinished()}).catch(t),this.pendingTimeline&&(this.stopTimeline=v.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=v}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),P()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Ce(t,e,n,i=0,s=1){const r=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),o=t.size,a=(o-1)*i;return"function"==typeof n?n(r,o):1===s?r*i:a-r*i}const Ee=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Ve(t,e,i=1){n(i<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=function(t){const e=Ee.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return D(t)?parseFloat(t):t}return u(r)?Ve(r,e,i+1):r}const Pe={type:"spring",stiffness:500,damping:25,restSpeed:10},De={type:"keyframes",duration:.8},Oe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ie=(t,{keyframes:e})=>e.length>2?De:O.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Pe:Oe;function Fe(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function Le(t,e){const n=t?.[e]??t?.default??t;return n!==t?Fe(n,t):n}const Re=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const Ke=(t,e,n,i={},s,r)=>o=>{const a=Le(i,t)||{},u=a.delay||i.delay||0;let{elapsed:l=0}=i;l-=w(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:s};(function(t){for(const e in t)if(!Re.has(e))return!0;return!1})(a)||Object.assign(c,Ie(t,c)),c.duration&&(c.duration=w(c.duration)),c.repeatDelay&&(c.repeatDelay=w(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let h=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(Te(c),0===c.delay&&(h=!0)),(T.instantAnimations||T.skipAnimations||s?.shouldSkipAnimations||a.skipAnimations)&&(h=!0,Te(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,h&&!r&&void 0!==e.get()){const t=A(c.keyframes,a);if(void 0!==t)return void f.update(()=>{c.onUpdate(t),c.onComplete()})}return a.isSync?new ye(c):new ke(c)};function Be(t,e,n){const i=t.getProps();return I(i,e,void 0!==n?n:i.custom,t)}const je=new Set(["width","height","top","left","right","bottom",...F]),qe=t=>Array.isArray(t);function Ne(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,L(n))}function Ue(t){return qe(t)?t[t.length-1]||0:t}function Ge(t,e){const n=t.getValue("willChange");if(i=n,Boolean(R(i)&&i.add))return n.add(e);if(!n&&T.WillChange){const n=new T.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function He(t){return t.props[K]}function $e({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function We(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:r,transitionEnd:o,...a}=e;const u=t.getDefaultTransition();r=r?Fe(r,u):u;const l=r?.reduceMotion,c=r?.skipAnimations;i&&(r=i);const h=[],d=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||d&&$e(d,e))continue;const o={delay:n,...Le(r||{},e)};c&&(o.skipAnimations=!0);const u=i.get();if(void 0!==u&&!i.isAnimating()&&!Array.isArray(s)&&s===u&&!o.velocity){f.update(()=>i.set(s));continue}let p=!1;if(window.MotionHandoffAnimation){const n=He(t);if(n){const t=window.MotionHandoffAnimation(n,e,f);null!==t&&(o.startTime=t,p=!0)}}Ge(t,e);const m=l??t.shouldReduceMotion;i.start(Ke(e,i,s,m&&je.has(e)?{type:!1}:o,t,p));const y=i.animation;y&&h.push(y)}if(o){const e=()=>f.update(()=>{o&&function(t,e){const n=Be(t,e);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const e in r)Ne(t,e,Ue(r[e]))}(t,o)});h.length?Promise.all(h).then(e):e()}return h}function _e(t,e,n={}){const i=Be(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const r=i?()=>Promise.all(We(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:r=0,staggerChildren:o,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=0,r=1,o){const a=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),a.push(_e(u,e,{...o,delay:n+("function"==typeof i?0:i)+Ce(t.variantChildren,u,i,s,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,i,r,o,a,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[r,o]:[o,r];return t().then(()=>e())}return Promise.all([r(),o(n.delay)])}function ze(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||B(t))}const Ye=new Set(["auto","none","0"]);class Xe extends V{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),u(i))){const s=Ve(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!je.has(n)||2!==t.length)return;const[i,s]=t,r=q(i),o=q(s);if(N(i)!==N(s)&&U[n])this.needsMeasurement=!0;else if(r!==o)if(G(r)&&G(o))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else U[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||ze(t[e]))&&n.push(e);n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Ye.has(e)&&h(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=j(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=U[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,r=n[s];n[s]=U[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const Je=!1;function Ze(t,e){const n=function(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document;const i=n?.[t]??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(t=>null!=t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function Qe(t){return!("touch"===t.pointerType||Je)}function tn(t,e,n={}){const[i,s,r]=Ze(t,n);return i.forEach(t=>{let n,i=!1,r=!1;const o=e=>{n&&(n(e),n=void 0),t.removeEventListener("pointerleave",u)},a=t=>{i=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),r&&(r=!1,o(t))},u=t=>{"touch"!==t.pointerType&&(i?r=!0:o(t))};t.addEventListener("pointerenter",i=>{if(!Qe(i))return;r=!1;const o=e(t,i);"function"==typeof o&&(n=o,t.addEventListener("pointerleave",u,s))},s),t.addEventListener("pointerdown",()=>{i=!0,window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",a,s)},s)}),r}const en=(t,e)=>!!e&&(t===e||en(t,e.parentElement)),nn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const sn=new WeakSet;function rn(t){return e=>{"Enter"===e.key&&t(e)}}function on(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function an(t){return(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(t)&&!0}const un=new WeakSet;function ln(t,e,n={}){const[i,s,r]=Ze(t,n),o=t=>{const i=t.currentTarget;if(!an(t))return;if(un.has(t))return;sn.add(i),n.stopPropagation&&un.add(t);const r=e(i,t),o=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",u),sn.has(i)&&sn.delete(i),an(t)&&"function"==typeof r&&r(t,{success:e})},a=t=>{o(t,i===window||i===document||n.useGlobalTarget||en(i,t.target))},u=t=>{o(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",u,s)};return i.forEach(t=>{var e,i;(n.useGlobalTarget?window:t).addEventListener("pointerdown",o,s),"object"==typeof(i=e=t)&&null!==i&&"offsetHeight"in e&&!("ownerSVGElement"in e)&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=rn(()=>{if(sn.has(n))return;on(n,"down");const t=rn(()=>{on(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>on(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s)),function(t){return nn.has(t.tagName)||!0===t.isContentEditable}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),r}class cn extends H{constructor(){super(...arguments),this.KeyframeResolver=Xe}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;R(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class hn{constructor(t){this.isMounted=!1,this.node=t}update(){}}function dn(t,{style:e,vars:n},i,s){const r=t.style;let o;for(o in e)r[o]=e[o];for(o in s?.applyProjectionStyles(r,i),n)r.setProperty(o,n[o])}class pn extends cn{constructor(){super(...arguments),this.type="html",this.renderInstance=dn}readValueFromInstance(t,e){if(O.has(e))return this.projection?.isProjecting?$(e):W(t,e);{const i=(n=t,window.getComputedStyle(n)),s=(_(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){z(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return Y(t,e,n)}}const mn=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class fn extends cn{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=J}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(O.has(e)){const t=et(e);return t&&t.default||0}return e=mn.has(e)?e:X(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return Z(t,e,n)}build(t,e,n){Q(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,i){!function(t,e,n,i){dn(t,e,void 0,i);for(const n in e.attrs)t.setAttribute(mn.has(n)?n:X(n),e.attrs[n])}(t,e,0,i)}mount(t){this.isSVGTag=tt(t.tagName),super.mount(t)}}const yn=it.length;function vn(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&vn(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let n=0;n<yn;n++){const i=it[n],s=t.props[i];(nt(s)||!1===s)&&(e[i]=s)}return e}function gn(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const wn=[...rt].reverse(),bn=rt.length;function Tn(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>_e(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=_e(t,e,n);else{const s="function"==typeof e?Be(t,e,n.custom):e;i=Promise.all(We(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}(t,e,n)))}function xn(t){let e=Tn(t),n=Mn(),i=!0,s=!1;const r=e=>(n,i)=>{const s=Be(t,i,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...i}=s;n={...n,...i,...e}}return n};function o(o){const{props:a}=t,u=vn(t.parent)||{},l=[],c=new Set;let h={},d=1/0;for(let e=0;e<bn;e++){const p=wn[e],m=n[p],f=void 0!==a[p]?a[p]:u[p],y=nt(f),v=p===o?m.isActive:null;!1===v&&(d=e);let g=f===u[p]&&f!==a[p]&&y;if(g&&(i||s)&&t.manuallyAnimateOnMount&&(g=!1),m.protectedKeys={...h},!m.isActive&&null===v||!f&&!m.prevProp||st(f)||"boolean"==typeof f)continue;if("exit"===p&&m.isActive&&!0!==v){m.prevResolvedValues&&(h={...h,...m.prevResolvedValues});continue}const w=An(m.prevProp,f);let b=w||p===o&&m.isActive&&!g&&y||e>d&&y,T=!1;const x=Array.isArray(f)?f:[f];let A=x.reduce(r(p),{});!1===v&&(A={});const{prevResolvedValues:S={}}=m,M={...S,...A},k=e=>{b=!0,c.has(e)&&(T=!0,c.delete(e)),m.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in M){const e=A[t],n=S[t];if(h.hasOwnProperty(t))continue;let i=!1;i=qe(e)&&qe(n)?!gn(e,n)||w:e!==n,i?null!=e?k(t):c.add(t):void 0!==e&&c.has(t)?k(t):m.protectedKeys[t]=!0}m.prevProp=f,m.prevResolvedValues=A,m.isActive&&(h={...h,...A}),(i||s)&&t.blockInitialAnimation&&(b=!1);const C=g&&w;b&&(!C||T)&&l.push(...x.map(e=>{const n={type:p};if("string"==typeof e&&(i||s)&&!C&&t.manuallyAnimateOnMount&&t.parent){const{parent:i}=t,s=Be(i,e);if(i.enteringChildren&&s){const{delayChildren:e}=s.transition||{};n.delay=Ce(i.enteringChildren,t,e)}}return{animation:e,options:n}}))}if(c.size){const e={};if("boolean"!=typeof a.initial){const n=Be(t,Array.isArray(a.initial)?a.initial[0]:a.initial);n&&n.transition&&(e.transition=n.transition)}c.forEach(n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=i??null}),l.push({animation:e})}let p=Boolean(l.length);return!i||!1!==a.initial&&a.initial!==a.animate||t.manuallyAnimateOnMount||(p=!1),i=!1,s=!1,p?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,i)),n[e].isActive=i;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=Mn(),s=!0}}}function An(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!gn(e,t)}function Sn(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Mn(){return{animate:Sn(!0),whileInView:Sn(),whileHover:Sn(),whileTap:Sn(),whileDrag:Sn(),whileFocus:Sn(),exit:Sn()}}function kn(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}let Cn=0;const En={animation:{Feature:class extends hn{constructor(t){super(t),t.animationState||(t.animationState=xn(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();st(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends hn{constructor(){super(...arguments),this.id=Cn++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;if(t&&!1===n){if(this.isExitComplete){const{initial:t,custom:e}=this.node.getProps();if("string"==typeof t||"object"==typeof t&&null!==t&&!Array.isArray(t)){const n=Be(this.node,t,e);if(n){const{transition:t,transitionEnd:e,...i}=n;for(const t in i)this.node.getValue(t)?.jump(i[t])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);return void(this.isExitComplete=!1)}const i=this.node.animationState.setActive("exit",!t);e&&!t&&i.then(()=>{this.isExitComplete=!0,e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Vn(t){return{point:{x:t.pageX,y:t.pageY}}}function Pn(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover","Start"===n);const s=i["onHover"+n];s&&f.postRender(()=>s(e,Vn(e)))}function Dn(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap","Start"===n);const s=i["onTap"+("End"===n?"":n)];s&&f.postRender(()=>s(e,Vn(e)))}const On=new WeakMap,In=new WeakMap,Fn=t=>{const e=On.get(t.target);e&&e(t)},Ln=t=>{t.forEach(Fn)};function Rn(t,e,n){const i=function({root:t,...e}){const n=t||document;In.has(n)||In.set(n,{});const i=In.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(Ln,{root:t,...e})),i[s]}(e);return On.set(t,n),i.observe(t),()=>{On.delete(t),i.unobserve(t)}}const Kn={some:0,all:1};const Bn={renderer:(t,e)=>e.isSVG??ot(t)?new fn(e):new pn(e,{allowProjection:t!==at}),...En,...{inView:{Feature:class extends hn{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:i="some",once:s}=t,r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:Kn[i]};this.stopObserver=Rn(this.node.current,r,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),r=e?n:i;r&&r(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends hn{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:e,propagate:n}=this.node.props;this.unmount=ln(t,(t,e)=>(Dn(this.node,e,"Start"),(t,{success:e})=>Dn(this.node,t,e?"End":"Cancel")),{useGlobalTarget:e,stopPropagation:!1===n?.tap})}unmount(){}}},focus:{Feature:class extends hn{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ut(kn(this.node.current,"focus",()=>this.onFocus()),kn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends hn{mount(){const{current:t}=this.node;t&&(this.unmount=tn(t,(t,e)=>(Pn(this.node,e,"Start"),t=>Pn(this.node,t,"End"))))}unmount(){}}}}};export{Bn as domAnimation}; |
@@ -1,1 +0,1 @@ | ||
| import{createContext as t}from"react";function e(t,e){-1===t.indexOf(e)&&t.push(e)}function s(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const n=(t,e,s)=>s>e?e:s<t?t:s;function i(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let r=()=>{},a=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(r=(t,e,s)=>{t||"undefined"==typeof console||console.warn(i(e,s))},a=(t,e,s)=>{if(!t)throw new Error(i(e,s))});const o={},h=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),l=t=>/^0[^.\s]+$/u.test(t);function u(t){let e;return()=>(void 0===e&&(e=t()),e)}const c=t=>t;class d{constructor(){this.subscriptions=[]}add(t){return e(this.subscriptions,t),()=>s(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const p=t=>1e3*t,f=t=>t/1e3;function m(t,e){return e?t*(1e3/e):0}const g=t=>Array.isArray(t)&&"number"==typeof t[0],v=t({}),y=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function b(t,e){let s=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>s=!0,a=y.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(h.schedule(e),t()),e(a)}const h={schedule:(t,i=!1,a=!1)=>{const o=a&&n?e:s;return i&&r.add(t),o.add(t),t},cancel:t=>{s.delete(t),r.delete(t)},process:t=>{if(a=t,n)return void(i=!0);n=!0;const r=e;e=s,s=r,e.forEach(o),e.clear(),n=!1,i&&(i=!1,h.process(t))}};return h}(r),t),{}),{setup:h,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:p,render:f,postRender:m}=a,g=()=>{const r=o.useManualTiming,a=r?i.timestamp:performance.now();s=!1,r||(i.delta=n?1e3/60:Math.max(Math.min(a-i.timestamp,40),1)),i.timestamp=a,i.isProcessing=!0,h.process(i),l.process(i),u.process(i),c.process(i),d.process(i),p.process(i),f.process(i),m.process(i),i.isProcessing=!1,s&&e&&(n=!1,t(g))};return{schedule:y.reduce((e,r)=>{const o=a[r];return e[r]=(e,r=!1,a=!1)=>(s||(s=!0,n=!0,i.isProcessing||t(g)),o.schedule(e,r,a)),e},{}),cancel:t=>{for(let e=0;e<y.length;e++)a[y[e]].cancel(t)},state:i,steps:a}}const{schedule:w,cancel:V,state:S,steps:M}=b("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:c,!0);let T;function x(){T=void 0}const A={now:()=>(void 0===T&&A.set(S.isProcessing||o.useManualTiming?S.timestamp:performance.now()),T),set:t=>{T=t,queueMicrotask(x)}},C=t=>e=>"string"==typeof e&&e.startsWith(t),k=C("--"),F=C("var(--"),E=t=>!!F(t)&&P.test(t.split("/*")[0].trim()),P=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function B(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const R={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},I={...R,transform:t=>n(0,1,t)},N={...R,default:1},O=t=>Math.round(1e5*t)/1e5,$=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const L=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Y=(t,e)=>s=>Boolean("string"==typeof s&&L.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),W=(t,e,s)=>n=>{if("string"!=typeof n)return n;const[i,r,a,o]=n.match($);return{[t]:parseFloat(i),[e]:parseFloat(r),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},X={...R,transform:t=>Math.round((t=>n(0,255,t))(t))},j={test:Y("rgb","red"),parse:W("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+X.transform(t)+", "+X.transform(e)+", "+X.transform(s)+", "+O(I.transform(n))+")"};const z={test:Y("#"),parse:function(t){let e="",s="",n="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:j.transform},K=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),U=K("deg"),Z=K("%"),D=K("px"),q=K("vh"),H=K("vw"),_=(()=>({...Z,parse:t=>Z.parse(t)/100,transform:t=>Z.transform(100*t)}))(),G={test:Y("hsl","hue"),parse:W("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+Z.transform(O(e))+", "+Z.transform(O(s))+", "+O(I.transform(n))+")"},J={test:t=>j.test(t)||z.test(t)||G.test(t),parse:t=>j.test(t)?j.parse(t):G.test(t)?G.parse(t):z.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?j.transform(t):G.transform(t),getAnimatableNone:t=>{const e=J.parse(t);return e.alpha=0,J.transform(e)}},Q=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const tt="number",et="color",st=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function nt(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(st,t=>(J.test(t)?(n.color.push(r),i.push(et),s.push(J.parse(t))):t.startsWith("var(")?(n.var.push(r),i.push("var"),s.push(t)):(n.number.push(r),i.push(tt),s.push(parseFloat(t))),++r,"${}")).split("${}");return{values:s,split:a,indexes:n,types:i}}function it({split:t,types:e}){const s=t.length;return n=>{let i="";for(let r=0;r<s;r++)if(i+=t[r],void 0!==n[r]){const t=e[r];i+=t===tt?O(n[r]):t===et?J.transform(n[r]):n[r]}return i}}const rt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(s=t)?0:J.test(s)?J.getAnimatableNone(s):s;var s};const at={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match($)?.length||0)+(t.match(Q)?.length||0)>0},parse:function(t){return nt(t).values},createTransformer:function(t){return it(nt(t))},getAnimatableNone:function(t){const e=nt(t);return it(e)(e.values.map((t,s)=>rt(t,e.split[s])))}},ot=(t,e,s)=>t+(e-t)*s,ht=(t,e,s=10)=>{let n="";const i=Math.max(Math.round(e/s),2);for(let e=0;e<i;e++)n+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},lt=t=>null!==t;function ut(t,{repeat:e,repeatType:s="loop"},n,i=1){const r=t.filter(lt),a=i<0||e&&"loop"!==s&&e%2==1?0:r.length-1;return a&&void 0!==n?n:r[a]}class ct{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const dt=t=>180*t/Math.PI,pt=t=>{const e=dt(Math.atan2(t[1],t[0]));return mt(e)},ft={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:pt,rotateZ:pt,skewX:t=>dt(Math.atan(t[1])),skewY:t=>dt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},mt=t=>((t%=360)<0&&(t+=360),t),gt=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),vt=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),yt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gt,scaleY:vt,scale:t=>(gt(t)+vt(t))/2,rotateX:t=>mt(dt(Math.atan2(t[6],t[5]))),rotateY:t=>mt(dt(Math.atan2(-t[2],t[0]))),rotateZ:pt,rotate:pt,skewX:t=>dt(Math.atan(t[4])),skewY:t=>dt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function bt(t){return t.includes("scale")?1:0}function wt(t,e){if(!t||"none"===t)return bt(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(s)n=yt,i=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=ft,i=e}if(!i)return bt(e);const r=n[e],a=i[1].split(",").map(St);return"function"==typeof r?r(a):a[r]}const Vt=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return wt(s,e)};function St(t){return parseFloat(t.trim())}const Mt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tt=(()=>new Set(Mt))(),xt=t=>t===R||t===D,At=new Set(["x","y","z"]),Ct=Mt.filter(t=>!At.has(t));const kt={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>wt(e,"x"),y:(t,{transform:e})=>wt(e,"y")};kt.translateX=kt.x,kt.translateY=kt.y;const Ft=new Set;let Et=!1,Pt=!1,Bt=!1;function Rt(){if(Pt){const t=Array.from(Ft).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),s=new Map;e.forEach(t=>{const e=function(t){const e=[];return Ct.forEach(s=>{const n=t.getValue(s);void 0!==n&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}(t);e.length&&(s.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=s.get(t);e&&e.forEach(([e,s])=>{t.getValue(e)?.set(s)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Pt=!1,Et=!1,Ft.forEach(t=>t.complete(Bt)),Ft.clear()}function It(){Ft.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pt=!0)})}function Nt(){Bt=!0,It(),Rt(),Bt=!1}class Ot{constructor(t,e,s,n,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=n,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Ft.add(this),Et||(Et=!0,w.read(It),w.resolveKeyframes(Rt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:n}=this;if(null===t[0]){const i=n?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(s&&e){const n=s.readValue(e,r);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=r),n&&void 0===i&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ft.delete(this)}cancel(){"scheduled"===this.state&&(Ft.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function $t(t,e,s){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,s):t.style[e]=s}const Lt={};function Yt(t,e){const s=u(t);return()=>Lt[e]??s()}const Wt=Yt(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Xt=Yt(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),jt=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,zt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:jt([0,.65,.55,1]),circOut:jt([.55,0,1,.45]),backIn:jt([.31,.01,.66,-.59]),backOut:jt([.33,1.53,.69,.99])};function Kt(t,e){return t?"function"==typeof t?Xt()?ht(t,e):"ease-out":g(t)?jt(t):Array.isArray(t)?t.map(t=>Kt(t,e)||zt.easeOut):zt[t]:void 0}function Ut(t,e,s,{delay:n=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:h}={},l=void 0){const u={[e]:s};h&&(u.offset=h);const c=Kt(o,i);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};l&&(d.pseudoElement=l);return t.animate(u,d)}function Zt(t){return"function"==typeof t&&"applyToOptions"in t}class Dt extends ct{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:s,keyframes:n,pseudoElement:i,allowFlatten:r=!1,finalKeyframe:o,onComplete:h}=t;this.isPseudoElement=Boolean(i),this.allowFlatten=r,this.options=t,a("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return Zt(t)&&Xt()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Ut(e,s,n,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const t=ut(n,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),$t(e,s,t),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return f(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+f(t)}get time(){return f(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=p(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:s,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Wt()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),s&&(this.animation.rangeEnd=s),c):n(this)}}const qt=new Set(["opacity","clipPath","filter","transform"]);function Ht(t){const e=[{},{}];return t?.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function _t(t,e,s,n){if("function"==typeof e){const[i,r]=Ht(n);e=e(void 0!==s?s:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Ht(n);e=e(void 0!==s?s:t.custom,i,r)}return e}class Gt{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=A.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=A.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new d);const s=this.events[t].add(e);return"change"===t?()=>{s(),w.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=A.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return m(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Jt(t,e){return new Gt(t,e)}const Qt=t=>Boolean(t&&t.getVelocity);function te(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const ee="data-"+te("framerAppearId"),se=t=>e=>e.test(t),ne=[R,D,Z,U,H,q,{test:t=>"auto"===t,parse:t=>t}],ie=t=>ne.find(se(t)),re=new Set(["brightness","contrast","saturate","opacity"]);function ae(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match($)||[];if(!n)return t;const i=s.replace(n,"");let r=re.has(e)?1:0;return n!==s&&(r*=100),e+"("+r+i+")"}const oe=/\b([a-z-]*)\(.*?\)/gu,he={...at,getAnimatableNone:t=>{const e=t.match(oe);return e?e.map(ae).join(" "):t}},le={...at,getAnimatableNone:t=>{const e=at.parse(t);return at.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},ue={...R,transform:Math.round},ce={borderWidth:D,borderTopWidth:D,borderRightWidth:D,borderBottomWidth:D,borderLeftWidth:D,borderRadius:D,borderTopLeftRadius:D,borderTopRightRadius:D,borderBottomRightRadius:D,borderBottomLeftRadius:D,width:D,maxWidth:D,height:D,maxHeight:D,top:D,right:D,bottom:D,left:D,inset:D,insetBlock:D,insetBlockStart:D,insetBlockEnd:D,insetInline:D,insetInlineStart:D,insetInlineEnd:D,padding:D,paddingTop:D,paddingRight:D,paddingBottom:D,paddingLeft:D,paddingBlock:D,paddingBlockStart:D,paddingBlockEnd:D,paddingInline:D,paddingInlineStart:D,paddingInlineEnd:D,margin:D,marginTop:D,marginRight:D,marginBottom:D,marginLeft:D,marginBlock:D,marginBlockStart:D,marginBlockEnd:D,marginInline:D,marginInlineStart:D,marginInlineEnd:D,fontSize:D,backgroundPositionX:D,backgroundPositionY:D,...{rotate:U,rotateX:U,rotateY:U,rotateZ:U,scale:N,scaleX:N,scaleY:N,scaleZ:N,skew:U,skewX:U,skewY:U,distance:D,translateX:D,translateY:D,translateZ:D,x:D,y:D,z:D,perspective:D,transformPerspective:D,opacity:I,originX:_,originY:_,originZ:D},zIndex:ue,fillOpacity:I,strokeOpacity:I,numOctaves:ue},de={...ce,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:he,WebkitFilter:he,mask:le,WebkitMask:le},pe=t=>de[t],fe=new Set([he,le]);function me(t,e){let s=pe(t);return fe.has(s)||(s=at),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const ge=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:ve}=b(queueMicrotask,!1),ye=[...ne,J,at],be=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),we=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Ve=new WeakMap;function Se(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Me(t){return"string"==typeof t||Array.isArray(t)}const Te=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],xe=["initial",...Te];function Ae(t){return Se(t.animate)||xe.some(e=>Me(t[e]))}function Ce(t){return Boolean(Ae(t)||t.variants)}const ke={current:null},Fe={current:!1},Ee="undefined"!=typeof window;const Pe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Be={};function Re(t){Be=t}function Ie(){return Be}class Ne{scrapeMotionValuesFromProps(t,e,s){return{}}constructor({parent:t,props:e,presenceContext:s,reducedMotionConfig:n,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ot,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=A.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,w.render(this.render,!1,!0))};const{latestValues:h,renderState:l}=a;this.latestValues=h,this.baseTarget={...h},this.initialValues=e.initial?{...h}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=Ae(e),this.isVariantNode=Ce(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==h[t]&&Qt(e)&&e.set(h[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,Ve.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Fe.current||function(){if(Fe.current=!0,Ee)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ke.current=t.matches;t.addEventListener("change",e),e()}else ke.current=!1}(),this.shouldReduceMotion=ke.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),V(this.notifyUpdate),V(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&qt.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:n,times:i,ease:r,duration:a}=e.accelerate,o=new Dt({element:this.current,name:t,keyframes:n,times:i,ease:r,duration:p(a)}),h=s(o);return void this.valueSubscriptions.set(t,()=>{h(),o.cancel()})}const s=Tt.has(t);s&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&w.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),i&&i(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Be){const e=Be[t];if(!e)continue;const{isEnabled:s,Feature:n}=e;if(!this.features[t]&&n&&s(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Pe.length;e++){const s=Pe[e];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const n=t["on"+s];n&&(this.propEventSubscriptions[s]=this.on(s,n))}this.prevMotionValues=function(t,e,s){for(const n in e){const i=e[n],r=s[n];if(Qt(i))t.addValue(n,i);else if(Qt(r))t.addValue(n,Jt(i,{owner:t}));else if(r!==i)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(n);t.addValue(n,Jt(void 0!==e?e:i,{owner:t}))}}for(const n in s)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const s=this.values.get(t);e!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return void 0===s&&void 0!==e&&(s=Jt(null===e?void 0:e,{owner:this}),this.addValue(t,s)),s}readValue(t,e){let s=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(h(s)||l(s))?s=parseFloat(s):(n=s,!ye.find(se(n))&&at.test(e)&&(s=me(t,e))),this.setBaseTarget(t,Qt(s)?s.get():s)),Qt(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let s;if("string"==typeof e||"object"==typeof e){const n=_t(this.props,e,this.presenceContext?.custom);n&&(s=n[t])}if(e&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||Qt(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new d),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){ve.render(this.render)}}const Oe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$e=Mt.length;function Le(t,e,s){const{style:n,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const s=e[t];if(Tt.has(t))a=!0;else if(k(t))i[t]=s;else{const e=ge(s,ce[t]);t.startsWith("origin")?(o=!0,r[t]=e):n[t]=e}}if(e.transform||(a||s?n.transform=function(t,e,s){let n="",i=!0;for(let r=0;r<$e;r++){const a=Mt[r],o=t[a];if(void 0===o)continue;let h=!0;if("number"==typeof o)h=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);h=a.startsWith("scale")?1===t:0===t}if(!h||s){const t=ge(o,ce[a]);h||(i=!1,n+=`${Oe[a]||a}(${t}) `),s&&(e[a]=t)}}return n=n.trim(),s?n=s(e,i?"":n):i&&(n="none"),n}(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:s=0}=r;n.transformOrigin=`${t} ${e} ${s}`}}function Ye(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const We={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!D.test(t))return t;t=parseFloat(t)}return`${Ye(t,e.target.x)}% ${Ye(t,e.target.y)}%`}},Xe={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,i=at.parse(t);if(i.length>5)return n;const r=at.createTransformer(t),a="number"!=typeof i[0]?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;i[0+a]/=o,i[1+a]/=h;const l=ot(o,h,.5);return"number"==typeof i[2+a]&&(i[2+a]/=l),"number"==typeof i[3+a]&&(i[3+a]/=l),r(i)}},je={borderRadius:{...We,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:We,borderTopRightRadius:We,borderBottomLeftRadius:We,borderBottomRightRadius:We,boxShadow:Xe};function ze(t,{layout:e,layoutId:s}){return Tt.has(t)||t.startsWith("origin")||(e||void 0!==s)&&(!!je[t]||"opacity"===t)}function Ke(t,e,s){const n=t.style,i=e?.style,r={};if(!n)return r;for(const e in n)(Qt(n[e])||i&&Qt(i[e])||ze(e,t)||void 0!==s?.getValue(e)?.liveStyle)&&(r[e]=n[e]);return r}const Ue={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ze={offset:"strokeDashoffset",array:"strokeDasharray"};const De=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function qe(t,{attrX:e,attrY:s,attrScale:n,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},h,l,u){if(Le(t,o,l),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete c.transformBox);for(const t of De)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==s&&(c.y=s),void 0!==n&&(c.scale=n),void 0!==i&&function(t,e,s=1,n=0,i=!0){t.pathLength=1;const r=i?Ue:Ze;t[r.offset]=""+-n,t[r.array]=`${e} ${s}`}(c,i,r,a,!1)}const He=t=>"string"==typeof t&&"svg"===t.toLowerCase();function _e(t,e,s){const n=Ke(t,e,s);for(const s in t)if(Qt(t[s])||Qt(e[s])){n[-1!==Mt.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=t[s]}return n}function Ge(t){return Qt(t)?t.get():t}const Je=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Qe(t){return"string"==typeof t&&!t.includes("-")&&!!(Je.indexOf(t)>-1||/[A-Z]/u.test(t))}const ts=t(null),es=t({});function ss(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}export{Tt as $,E as A,J as B,at as C,nt as D,S as E,A as F,V as G,w as H,f as I,n as J,ht as K,v as L,p as M,m as N,o as O,ts as P,ut as Q,Dt as R,es as S,$t as T,Zt as U,u as V,ct as W,qt as X,Ot as Y,Nt as Z,h as _,Me as a,Mt as a0,Jt as a1,l as a2,me as a3,ie as a4,B as a5,kt as a6,xt as a7,Ne as a8,bt as a9,Vt as aa,k as ab,te as ac,we as ad,pe as ae,xe as af,Te as ag,Z as ah,D as ai,e as aj,s as ak,d as al,M as am,ve as an,be as ao,je as ap,Qt as b,ze as c,Le as d,qe as e,He as f,Qe as g,Ce as h,Ae as i,Se as j,_t as k,_e as l,Ie as m,Re as n,ee as o,ss as p,c as q,Ge as r,Ke as s,g as t,a as u,ot as v,j as w,G as x,z as y,r as z}; | ||
| import{createContext as t}from"react";function e(t,e){-1===t.indexOf(e)&&t.push(e)}function s(t,e){const s=t.indexOf(e);s>-1&&t.splice(s,1)}const n=(t,e,s)=>s>e?e:s<t?t:s;function i(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let r=()=>{},a=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(r=(t,e,s)=>{t||"undefined"==typeof console||console.warn(i(e,s))},a=(t,e,s)=>{if(!t)throw new Error(i(e,s))});const o={},h=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),l=t=>/^0[^.\s]+$/u.test(t);function u(t){let e;return()=>(void 0===e&&(e=t()),e)}const c=t=>t;class d{constructor(){this.subscriptions=[]}add(t){return e(this.subscriptions,t),()=>s(this.subscriptions,t)}notify(t,e,s){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](t,e,s);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(t,e,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const p=t=>1e3*t,f=t=>t/1e3,m=(t,e)=>e?t*(1e3/e):0,g=t=>Array.isArray(t)&&"number"==typeof t[0],v=t({}),y=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function b(t,e){let s=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>s=!0,a=y.reduce((t,e)=>(t[e]=function(t){let e=new Set,s=new Set,n=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(h.schedule(e),t()),e(a)}const h={schedule:(t,i=!1,a=!1)=>{const o=a&&n?e:s;return i&&r.add(t),o.add(t),t},cancel:t=>{s.delete(t),r.delete(t)},process:t=>{if(a=t,n)return void(i=!0);n=!0;const r=e;e=s,s=r,e.forEach(o),e.clear(),n=!1,i&&(i=!1,h.process(t))}};return h}(r),t),{}),{setup:h,read:l,resolveKeyframes:u,preUpdate:c,update:d,preRender:p,render:f,postRender:m}=a,g=()=>{const r=o.useManualTiming,a=r?i.timestamp:performance.now();s=!1,r||(i.delta=n?1e3/60:Math.max(Math.min(a-i.timestamp,40),1)),i.timestamp=a,i.isProcessing=!0,h.process(i),l.process(i),u.process(i),c.process(i),d.process(i),p.process(i),f.process(i),m.process(i),i.isProcessing=!1,s&&e&&(n=!1,t(g))};return{schedule:y.reduce((e,r)=>{const o=a[r];return e[r]=(e,r=!1,a=!1)=>(s||(s=!0,n=!0,i.isProcessing||t(g)),o.schedule(e,r,a)),e},{}),cancel:t=>{for(let e=0;e<y.length;e++)a[y[e]].cancel(t)},state:i,steps:a}}const{schedule:w,cancel:V,state:S,steps:M}=b("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:c,!0);let T;function x(){T=void 0}const A={now:()=>(void 0===T&&A.set(S.isProcessing||o.useManualTiming?S.timestamp:performance.now()),T),set:t=>{T=t,queueMicrotask(x)}},C=t=>e=>"string"==typeof e&&e.startsWith(t),k=C("--"),F=C("var(--"),E=t=>!!F(t)&&P.test(t.split("/*")[0].trim()),P=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function B(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const R={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},I={...R,transform:t=>n(0,1,t)},N={...R,default:1},O=t=>Math.round(1e5*t)/1e5,$=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const L=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Y=(t,e)=>s=>Boolean("string"==typeof s&&L.test(s)&&s.startsWith(t)||e&&!function(t){return null==t}(s)&&Object.prototype.hasOwnProperty.call(s,e)),W=(t,e,s)=>n=>{if("string"!=typeof n)return n;const[i,r,a,o]=n.match($);return{[t]:parseFloat(i),[e]:parseFloat(r),[s]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},X={...R,transform:t=>Math.round((t=>n(0,255,t))(t))},j={test:Y("rgb","red"),parse:W("red","green","blue"),transform:({red:t,green:e,blue:s,alpha:n=1})=>"rgba("+X.transform(t)+", "+X.transform(e)+", "+X.transform(s)+", "+O(I.transform(n))+")"};const z={test:Y("#"),parse:function(t){let e="",s="",n="",i="";return t.length>5?(e=t.substring(1,3),s=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),s=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,s+=s,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(s,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:j.transform},K=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),U=K("deg"),Z=K("%"),D=K("px"),q=K("vh"),H=K("vw"),_=(()=>({...Z,parse:t=>Z.parse(t)/100,transform:t=>Z.transform(100*t)}))(),G={test:Y("hsl","hue"),parse:W("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:s,alpha:n=1})=>"hsla("+Math.round(t)+", "+Z.transform(O(e))+", "+Z.transform(O(s))+", "+O(I.transform(n))+")"},J={test:t=>j.test(t)||z.test(t)||G.test(t),parse:t=>j.test(t)?j.parse(t):G.test(t)?G.parse(t):z.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?j.transform(t):G.transform(t),getAnimatableNone:t=>{const e=J.parse(t);return e.alpha=0,J.transform(e)}},Q=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const tt="number",et="color",st=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function nt(t){const e=t.toString(),s=[],n={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(st,t=>(J.test(t)?(n.color.push(r),i.push(et),s.push(J.parse(t))):t.startsWith("var(")?(n.var.push(r),i.push("var"),s.push(t)):(n.number.push(r),i.push(tt),s.push(parseFloat(t))),++r,"${}")).split("${}");return{values:s,split:a,indexes:n,types:i}}function it({split:t,types:e}){const s=t.length;return n=>{let i="";for(let r=0;r<s;r++)if(i+=t[r],void 0!==n[r]){const t=e[r];i+=t===tt?O(n[r]):t===et?J.transform(n[r]):n[r]}return i}}const rt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(s=t)?0:J.test(s)?J.getAnimatableNone(s):s;var s};const at={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match($)?.length||0)+(t.match(Q)?.length||0)>0},parse:function(t){return nt(t).values},createTransformer:function(t){return it(nt(t))},getAnimatableNone:function(t){const e=nt(t);return it(e)(e.values.map((t,s)=>rt(t,e.split[s])))}},ot=(t,e,s)=>t+(e-t)*s,ht=(t,e,s=10)=>{let n="";const i=Math.max(Math.round(e/s),2);for(let e=0;e<i;e++)n+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},lt=t=>null!==t;function ut(t,{repeat:e,repeatType:s="loop"},n,i=1){const r=t.filter(lt),a=i<0||e&&"loop"!==s&&e%2==1?0:r.length-1;return a&&void 0!==n?n:r[a]}class ct{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const dt=t=>180*t/Math.PI,pt=t=>{const e=dt(Math.atan2(t[1],t[0]));return mt(e)},ft={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:pt,rotateZ:pt,skewX:t=>dt(Math.atan(t[1])),skewY:t=>dt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},mt=t=>((t%=360)<0&&(t+=360),t),gt=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),vt=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),yt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gt,scaleY:vt,scale:t=>(gt(t)+vt(t))/2,rotateX:t=>mt(dt(Math.atan2(t[6],t[5]))),rotateY:t=>mt(dt(Math.atan2(-t[2],t[0]))),rotateZ:pt,rotate:pt,skewX:t=>dt(Math.atan(t[4])),skewY:t=>dt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function bt(t){return t.includes("scale")?1:0}function wt(t,e){if(!t||"none"===t)return bt(e);const s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,i;if(s)n=yt,i=s;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=ft,i=e}if(!i)return bt(e);const r=n[e],a=i[1].split(",").map(St);return"function"==typeof r?r(a):a[r]}const Vt=(t,e)=>{const{transform:s="none"}=getComputedStyle(t);return wt(s,e)};function St(t){return parseFloat(t.trim())}const Mt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tt=(()=>new Set(Mt))(),xt=t=>t===R||t===D,At=new Set(["x","y","z"]),Ct=Mt.filter(t=>!At.has(t));const kt={width:({x:t},{paddingLeft:e="0",paddingRight:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},height:({y:t},{paddingTop:e="0",paddingBottom:s="0",boxSizing:n})=>{const i=t.max-t.min;return"border-box"===n?i:i-parseFloat(e)-parseFloat(s)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>wt(e,"x"),y:(t,{transform:e})=>wt(e,"y")};kt.translateX=kt.x,kt.translateY=kt.y;const Ft=new Set;let Et=!1,Pt=!1,Bt=!1;function Rt(){if(Pt){const t=Array.from(Ft).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),s=new Map;e.forEach(t=>{const e=function(t){const e=[];return Ct.forEach(s=>{const n=t.getValue(s);void 0!==n&&(e.push([s,n.get()]),n.set(s.startsWith("scale")?1:0))}),e}(t);e.length&&(s.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=s.get(t);e&&e.forEach(([e,s])=>{t.getValue(e)?.set(s)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Pt=!1,Et=!1,Ft.forEach(t=>t.complete(Bt)),Ft.clear()}function It(){Ft.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Pt=!0)})}function Nt(){Bt=!0,It(),Rt(),Bt=!1}class Ot{constructor(t,e,s,n,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=s,this.motionValue=n,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Ft.add(this),Et||(Et=!0,w.read(It),w.resolveKeyframes(Rt))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:s,motionValue:n}=this;if(null===t[0]){const i=n?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(s&&e){const n=s.readValue(e,r);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=r),n&&void 0===i&&n.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ft.delete(this)}cancel(){"scheduled"===this.state&&(Ft.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function $t(t,e,s){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,s):t.style[e]=s}const Lt={};function Yt(t,e){const s=u(t);return()=>Lt[e]??s()}const Wt=Yt(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Xt=Yt(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),jt=([t,e,s,n])=>`cubic-bezier(${t}, ${e}, ${s}, ${n})`,zt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:jt([0,.65,.55,1]),circOut:jt([.55,0,1,.45]),backIn:jt([.31,.01,.66,-.59]),backOut:jt([.33,1.53,.69,.99])};function Kt(t,e){return t?"function"==typeof t?Xt()?ht(t,e):"ease-out":g(t)?jt(t):Array.isArray(t)?t.map(t=>Kt(t,e)||zt.easeOut):zt[t]:void 0}function Ut(t,e,s,{delay:n=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:h}={},l=void 0){const u={[e]:s};h&&(u.offset=h);const c=Kt(o,i);Array.isArray(c)&&(u.easing=c);const d={delay:n,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};l&&(d.pseudoElement=l);return t.animate(u,d)}function Zt(t){return"function"==typeof t&&"applyToOptions"in t}class Dt extends ct{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:s,keyframes:n,pseudoElement:i,allowFlatten:r=!1,finalKeyframe:o,onComplete:h}=t;this.isPseudoElement=Boolean(i),this.allowFlatten=r,this.options=t,a("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:t,...e}){return Zt(t)&&Xt()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Ut(e,s,n,l,i),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const t=ut(n,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),$t(e,s,t),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return f(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+f(t)}get time(){return f(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=p(t),e&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:e,rangeEnd:s,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Wt()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),s&&(this.animation.rangeEnd=s),c):n(this)}}const qt=new Set(["opacity","clipPath","filter","transform"]);function Ht(t){const e=[{},{}];return t?.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function _t(t,e,s,n){if("function"==typeof e){const[i,r]=Ht(n);e=e(void 0!==s?s:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Ht(n);e=e(void 0!==s?s:t.custom,i,r)}return e}class Gt{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=A.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=A.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new d);const s=this.events[t].add(e);return"change"===t?()=>{s(),w.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,s){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-s}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=A.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return m(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Jt(t,e){return new Gt(t,e)}const Qt=t=>Boolean(t&&t.getVelocity);function te(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const ee="data-"+te("framerAppearId"),se=t=>e=>e.test(t),ne=[R,D,Z,U,H,q,{test:t=>"auto"===t,parse:t=>t}],ie=t=>ne.find(se(t)),re=new Set(["brightness","contrast","saturate","opacity"]);function ae(t){const[e,s]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[n]=s.match($)||[];if(!n)return t;const i=s.replace(n,"");let r=re.has(e)?1:0;return n!==s&&(r*=100),e+"("+r+i+")"}const oe=/\b([a-z-]*)\(.*?\)/gu,he={...at,getAnimatableNone:t=>{const e=t.match(oe);return e?e.map(ae).join(" "):t}},le={...at,getAnimatableNone:t=>{const e=at.parse(t);return at.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},ue={...R,transform:Math.round},ce={borderWidth:D,borderTopWidth:D,borderRightWidth:D,borderBottomWidth:D,borderLeftWidth:D,borderRadius:D,borderTopLeftRadius:D,borderTopRightRadius:D,borderBottomRightRadius:D,borderBottomLeftRadius:D,width:D,maxWidth:D,height:D,maxHeight:D,top:D,right:D,bottom:D,left:D,inset:D,insetBlock:D,insetBlockStart:D,insetBlockEnd:D,insetInline:D,insetInlineStart:D,insetInlineEnd:D,padding:D,paddingTop:D,paddingRight:D,paddingBottom:D,paddingLeft:D,paddingBlock:D,paddingBlockStart:D,paddingBlockEnd:D,paddingInline:D,paddingInlineStart:D,paddingInlineEnd:D,margin:D,marginTop:D,marginRight:D,marginBottom:D,marginLeft:D,marginBlock:D,marginBlockStart:D,marginBlockEnd:D,marginInline:D,marginInlineStart:D,marginInlineEnd:D,fontSize:D,backgroundPositionX:D,backgroundPositionY:D,...{rotate:U,rotateX:U,rotateY:U,rotateZ:U,scale:N,scaleX:N,scaleY:N,scaleZ:N,skew:U,skewX:U,skewY:U,distance:D,translateX:D,translateY:D,translateZ:D,x:D,y:D,z:D,perspective:D,transformPerspective:D,opacity:I,originX:_,originY:_,originZ:D},zIndex:ue,fillOpacity:I,strokeOpacity:I,numOctaves:ue},de={...ce,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:he,WebkitFilter:he,mask:le,WebkitMask:le},pe=t=>de[t],fe=new Set([he,le]);function me(t,e){let s=pe(t);return fe.has(s)||(s=at),s.getAnimatableNone?s.getAnimatableNone(e):void 0}const ge=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:ve}=b(queueMicrotask,!1),ye=[...ne,J,at],be=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),we=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Ve=new WeakMap;function Se(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function Me(t){return"string"==typeof t||Array.isArray(t)}const Te=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],xe=["initial",...Te];function Ae(t){return Se(t.animate)||xe.some(e=>Me(t[e]))}function Ce(t){return Boolean(Ae(t)||t.variants)}const ke={current:null},Fe={current:!1},Ee="undefined"!=typeof window;const Pe=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Be={};function Re(t){Be=t}function Ie(){return Be}class Ne{scrapeMotionValuesFromProps(t,e,s){return{}}constructor({parent:t,props:e,presenceContext:s,reducedMotionConfig:n,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ot,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=A.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,w.render(this.render,!1,!0))};const{latestValues:h,renderState:l}=a;this.latestValues=h,this.baseTarget={...h},this.initialValues=e.initial?{...h}:{},this.renderState=l,this.parent=t,this.props=e,this.presenceContext=s,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=Ae(e),this.isVariantNode=Ce(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==h[t]&&Qt(e)&&e.set(h[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,Ve.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Fe.current||function(){if(Fe.current=!0,Ee)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ke.current=t.matches;t.addEventListener("change",e),e()}else ke.current=!1}(),this.shouldReduceMotion=ke.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),V(this.notifyUpdate),V(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&qt.has(t)&&this.current instanceof HTMLElement){const{factory:s,keyframes:n,times:i,ease:r,duration:a}=e.accelerate,o=new Dt({element:this.current,name:t,keyframes:n,times:i,ease:r,duration:p(a)}),h=s(o);return void this.valueSubscriptions.set(t,()=>{h(),o.cancel()})}const s=Tt.has(t);s&&this.onBindTransform&&this.onBindTransform();const n=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&w.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{n(),i&&i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in Be){const e=Be[t];if(!e)continue;const{isEnabled:s,Feature:n}=e;if(!this.features[t]&&n&&s(this.props)&&(this.features[t]=new n(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Pe.length;e++){const s=Pe[e];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const n=t["on"+s];n&&(this.propEventSubscriptions[s]=this.on(s,n))}this.prevMotionValues=function(t,e,s){for(const n in e){const i=e[n],r=s[n];if(Qt(i))t.addValue(n,i);else if(Qt(r))t.addValue(n,Jt(i,{owner:t}));else if(r!==i)if(t.hasValue(n)){const e=t.getValue(n);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(n);t.addValue(n,Jt(void 0!==e?e:i,{owner:t}))}}for(const n in s)void 0===e[n]&&t.removeValue(n);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const s=this.values.get(t);e!==s&&(s&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let s=this.values.get(t);return void 0===s&&void 0!==e&&(s=Jt(null===e?void 0:e,{owner:this}),this.addValue(t,s)),s}readValue(t,e){let s=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(h(s)||l(s))?s=parseFloat(s):(n=s,!ye.find(se(n))&&at.test(e)&&(s=me(t,e))),this.setBaseTarget(t,Qt(s)?s.get():s)),Qt(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let s;if("string"==typeof e||"object"==typeof e){const n=_t(this.props,e,this.presenceContext?.custom);n&&(s=n[t])}if(e&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||Qt(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new d),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){ve.render(this.render)}}const Oe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$e=Mt.length;function Le(t,e,s){const{style:n,vars:i,transformOrigin:r}=t;let a=!1,o=!1;for(const t in e){const s=e[t];if(Tt.has(t))a=!0;else if(k(t))i[t]=s;else{const e=ge(s,ce[t]);t.startsWith("origin")?(o=!0,r[t]=e):n[t]=e}}if(e.transform||(a||s?n.transform=function(t,e,s){let n="",i=!0;for(let r=0;r<$e;r++){const a=Mt[r],o=t[a];if(void 0===o)continue;let h=!0;if("number"==typeof o)h=o===(a.startsWith("scale")?1:0);else{const t=parseFloat(o);h=a.startsWith("scale")?1===t:0===t}if(!h||s){const t=ge(o,ce[a]);h||(i=!1,n+=`${Oe[a]||a}(${t}) `),s&&(e[a]=t)}}return n=n.trim(),s?n=s(e,i?"":n):i&&(n="none"),n}(e,t.transform,s):n.transform&&(n.transform="none")),o){const{originX:t="50%",originY:e="50%",originZ:s=0}=r;n.transformOrigin=`${t} ${e} ${s}`}}function Ye(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const We={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!D.test(t))return t;t=parseFloat(t)}return`${Ye(t,e.target.x)}% ${Ye(t,e.target.y)}%`}},Xe={correct:(t,{treeScale:e,projectionDelta:s})=>{const n=t,i=at.parse(t);if(i.length>5)return n;const r=at.createTransformer(t),a="number"!=typeof i[0]?1:0,o=s.x.scale*e.x,h=s.y.scale*e.y;i[0+a]/=o,i[1+a]/=h;const l=ot(o,h,.5);return"number"==typeof i[2+a]&&(i[2+a]/=l),"number"==typeof i[3+a]&&(i[3+a]/=l),r(i)}},je={borderRadius:{...We,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:We,borderTopRightRadius:We,borderBottomLeftRadius:We,borderBottomRightRadius:We,boxShadow:Xe};function ze(t,{layout:e,layoutId:s}){return Tt.has(t)||t.startsWith("origin")||(e||void 0!==s)&&(!!je[t]||"opacity"===t)}function Ke(t,e,s){const n=t.style,i=e?.style,r={};if(!n)return r;for(const e in n)(Qt(n[e])||i&&Qt(i[e])||ze(e,t)||void 0!==s?.getValue(e)?.liveStyle)&&(r[e]=n[e]);return r}const Ue={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ze={offset:"strokeDashoffset",array:"strokeDasharray"};const De=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function qe(t,{attrX:e,attrY:s,attrScale:n,pathLength:i,pathSpacing:r=1,pathOffset:a=0,...o},h,l,u){if(Le(t,o,l),h)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:c,style:d}=t;c.transform&&(d.transform=c.transform,delete c.transform),(d.transform||c.transformOrigin)&&(d.transformOrigin=c.transformOrigin??"50% 50%",delete c.transformOrigin),d.transform&&(d.transformBox=u?.transformBox??"fill-box",delete c.transformBox);for(const t of De)void 0!==c[t]&&(d[t]=c[t],delete c[t]);void 0!==e&&(c.x=e),void 0!==s&&(c.y=s),void 0!==n&&(c.scale=n),void 0!==i&&function(t,e,s=1,n=0,i=!0){t.pathLength=1;const r=i?Ue:Ze;t[r.offset]=""+-n,t[r.array]=`${e} ${s}`}(c,i,r,a,!1)}const He=t=>"string"==typeof t&&"svg"===t.toLowerCase();function _e(t,e,s){const n=Ke(t,e,s);for(const s in t)if(Qt(t[s])||Qt(e[s])){n[-1!==Mt.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=t[s]}return n}function Ge(t){return Qt(t)?t.get():t}const Je=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Qe(t){return"string"==typeof t&&!t.includes("-")&&!!(Je.indexOf(t)>-1||/[A-Z]/u.test(t))}const ts=t(null),es=t({});function ss(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}export{Tt as $,E as A,J as B,at as C,nt as D,S as E,A as F,V as G,w as H,f as I,n as J,ht as K,v as L,p as M,m as N,o as O,ts as P,ut as Q,Dt as R,es as S,$t as T,Zt as U,u as V,ct as W,qt as X,Ot as Y,Nt as Z,h as _,Me as a,Mt as a0,Jt as a1,l as a2,me as a3,ie as a4,B as a5,kt as a6,xt as a7,Ne as a8,bt as a9,Vt as aa,k as ab,te as ac,we as ad,pe as ae,xe as af,Te as ag,Z as ah,D as ai,e as aj,s as ak,d as al,M as am,ve as an,be as ao,je as ap,Qt as b,ze as c,Le as d,qe as e,He as f,Qe as g,Ce as h,Ae as i,Se as j,_t as k,_e as l,Ie as m,Re as n,ee as o,ss as p,c as q,Ge as r,Ke as s,g as t,a as u,ot as v,j as w,G as x,z as y,r as z}; |
@@ -1,2 +0,2 @@ | ||
| import{jsxs as t,jsx as n}from"react/jsx-runtime";import{createContext as r,useContext as e,useMemo as o,Fragment as a,createElement as s,useRef as i,useInsertionEffect as l,useCallback as u,useLayoutEffect as c,useEffect as f,forwardRef as d}from"react";const p=(t,n,r)=>r>n?n:r<t?t:r,m=r({}),g=r({strict:!1}),h=r({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),y=r({}),v=(t=>n=>"string"==typeof n&&n.startsWith(t))("--"),b={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},w={...b,transform:t=>p(0,1,t)},S={...b,default:1},x=t=>Math.round(1e5*t)/1e5,k=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const B=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,R=(t,n)=>r=>Boolean("string"==typeof r&&B.test(r)&&r.startsWith(t)||n&&!function(t){return null==t}(r)&&Object.prototype.hasOwnProperty.call(r,n)),T=(t,n,r)=>e=>{if("string"!=typeof e)return e;const[o,a,s,i]=e.match(k);return{[t]:parseFloat(o),[n]:parseFloat(a),[r]:parseFloat(s),alpha:void 0!==i?parseFloat(i):1}},I={...b,transform:t=>Math.round((t=>p(0,255,t))(t))},A={test:R("rgb","red"),parse:T("red","green","blue"),transform:({red:t,green:n,blue:r,alpha:e=1})=>"rgba("+I.transform(t)+", "+I.transform(n)+", "+I.transform(r)+", "+x(w.transform(e))+")"};const M={test:R("#"),parse:function(t){let n="",r="",e="",o="";return t.length>5?(n=t.substring(1,3),r=t.substring(3,5),e=t.substring(5,7),o=t.substring(7,9)):(n=t.substring(1,2),r=t.substring(2,3),e=t.substring(3,4),o=t.substring(4,5),n+=n,r+=r,e+=e,o+=o),{red:parseInt(n,16),green:parseInt(r,16),blue:parseInt(e,16),alpha:o?parseInt(o,16)/255:1}},transform:A.transform},O=t=>({test:n=>"string"==typeof n&&n.endsWith(t)&&1===n.split(" ").length,parse:parseFloat,transform:n=>`${n}${t}`}),P=O("deg"),W=O("%"),E=O("px"),L=(()=>({...W,parse:t=>W.parse(t)/100,transform:t=>W.transform(100*t)}))(),C={test:R("hsl","hue"),parse:T("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:r,alpha:e=1})=>"hsla("+Math.round(t)+", "+W.transform(x(n))+", "+W.transform(x(r))+", "+x(w.transform(e))+")"},j={test:t=>A.test(t)||M.test(t)||C.test(t),parse:t=>A.test(t)?A.parse(t):C.test(t)?C.parse(t):M.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?A.transform(t):C.transform(t),getAnimatableNone:t=>{const n=j.parse(t);return n.alpha=0,j.transform(n)}},V=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const $="number",F="color",X=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Y(t){const n=t.toString(),r=[],e={color:[],number:[],var:[]},o=[];let a=0;const s=n.replace(X,t=>(j.test(t)?(e.color.push(a),o.push(F),r.push(j.parse(t))):t.startsWith("var(")?(e.var.push(a),o.push("var"),r.push(t)):(e.number.push(a),o.push($),r.push(parseFloat(t))),++a,"${}")).split("${}");return{values:r,split:s,indexes:e,types:o}}function D({split:t,types:n}){const r=t.length;return e=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],void 0!==e[a]){const t=n[a];o+=t===$?x(e[a]):t===F?j.transform(e[a]):e[a]}return o}}const H=(t,n)=>{return"number"==typeof t?n?.trim().endsWith("/")?t:0:"number"==typeof(r=t)?0:j.test(r)?j.getAnimatableNone(r):r;var r};const N={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(k)?.length||0)+(t.match(V)?.length||0)>0},parse:function(t){return Y(t).values},createTransformer:function(t){return D(Y(t))},getAnimatableNone:function(t){const n=Y(t);return D(n)(n.values.map((t,r)=>H(t,n.split[r])))}},Z=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],z=(()=>new Set(Z))();function U(t,n,r,e){if("function"==typeof n){const[r,e]=[{},{}];n=n(t.custom,r,e)}if("string"==typeof n&&(n=t.variants&&t.variants[n]),"function"==typeof n){const[r,e]=[{},{}];n=n(t.custom,r,e)}return n}const q=t=>Boolean(t&&t.getVelocity);const _="data-"+"framerAppearId".replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`);const G={...b,transform:Math.round},J={borderWidth:E,borderTopWidth:E,borderRightWidth:E,borderBottomWidth:E,borderLeftWidth:E,borderRadius:E,borderTopLeftRadius:E,borderTopRightRadius:E,borderBottomRightRadius:E,borderBottomLeftRadius:E,width:E,maxWidth:E,height:E,maxHeight:E,top:E,right:E,bottom:E,left:E,inset:E,insetBlock:E,insetBlockStart:E,insetBlockEnd:E,insetInline:E,insetInlineStart:E,insetInlineEnd:E,padding:E,paddingTop:E,paddingRight:E,paddingBottom:E,paddingLeft:E,paddingBlock:E,paddingBlockStart:E,paddingBlockEnd:E,paddingInline:E,paddingInlineStart:E,paddingInlineEnd:E,margin:E,marginTop:E,marginRight:E,marginBottom:E,marginLeft:E,marginBlock:E,marginBlockStart:E,marginBlockEnd:E,marginInline:E,marginInlineStart:E,marginInlineEnd:E,fontSize:E,backgroundPositionX:E,backgroundPositionY:E,...{rotate:P,rotateX:P,rotateY:P,rotateZ:P,scale:S,scaleX:S,scaleY:S,scaleZ:S,skew:P,skewX:P,skewY:P,distance:E,translateX:E,translateY:E,translateZ:E,x:E,y:E,z:E,perspective:E,transformPerspective:E,opacity:w,originX:L,originY:L,originZ:E},zIndex:G,fillOpacity:w,strokeOpacity:w,numOctaves:G},K=(t,n)=>n&&"number"==typeof t?n.transform(t):t;function Q(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function tt(t){return"string"==typeof t||Array.isArray(t)}const nt=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function rt(t){return Q(t.animate)||nt.some(n=>tt(t[n]))}let et={};const ot={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},at=Z.length;function st(t,n,r){const{style:e,vars:o,transformOrigin:a}=t;let s=!1,i=!1;for(const t in n){const r=n[t];if(z.has(t))s=!0;else if(v(t))o[t]=r;else{const n=K(r,J[t]);t.startsWith("origin")?(i=!0,a[t]=n):e[t]=n}}if(n.transform||(s||r?e.transform=function(t,n,r){let e="",o=!0;for(let a=0;a<at;a++){const s=Z[a],i=t[s];if(void 0===i)continue;let l=!0;if("number"==typeof i)l=i===(s.startsWith("scale")?1:0);else{const t=parseFloat(i);l=s.startsWith("scale")?1===t:0===t}if(!l||r){const t=K(i,J[s]);l||(o=!1,e+=`${ot[s]||s}(${t}) `),r&&(n[s]=t)}}return e=e.trim(),r?e=r(n,o?"":e):o&&(e="none"),e}(n,t.transform,r):e.transform&&(e.transform="none")),i){const{originX:t="50%",originY:n="50%",originZ:r=0}=a;e.transformOrigin=`${t} ${n} ${r}`}}function it(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const lt={correct:(t,n)=>{if(!n.target)return t;if("string"==typeof t){if(!E.test(t))return t;t=parseFloat(t)}return`${it(t,n.target.x)}% ${it(t,n.target.y)}%`}},ut={correct:(t,{treeScale:n,projectionDelta:r})=>{const e=t,o=N.parse(t);if(o.length>5)return e;const a=N.createTransformer(t),s="number"!=typeof o[0]?1:0,i=r.x.scale*n.x,l=r.y.scale*n.y;o[0+s]/=i,o[1+s]/=l;const u=(c=i)+(l-c)*.5;var c;return"number"==typeof o[2+s]&&(o[2+s]/=u),"number"==typeof o[3+s]&&(o[3+s]/=u),a(o)}},ct={borderRadius:{...lt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lt,borderTopRightRadius:lt,borderBottomLeftRadius:lt,borderBottomRightRadius:lt,boxShadow:ut};function ft(t,{layout:n,layoutId:r}){return z.has(t)||t.startsWith("origin")||(n||void 0!==r)&&(!!ct[t]||"opacity"===t)}function dt(t,n,r){const e=t.style,o=n?.style,a={};if(!e)return a;for(const n in e)(q(e[n])||o&&q(o[n])||ft(n,t)||void 0!==r?.getValue(n)?.liveStyle)&&(a[n]=e[n]);return a}const pt={offset:"stroke-dashoffset",array:"stroke-dasharray"},mt={offset:"strokeDashoffset",array:"strokeDasharray"};const gt=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function ht(t,{attrX:n,attrY:r,attrScale:e,pathLength:o,pathSpacing:a=1,pathOffset:s=0,...i},l,u,c){if(st(t,i,u),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:f,style:d}=t;f.transform&&(d.transform=f.transform,delete f.transform),(d.transform||f.transformOrigin)&&(d.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),d.transform&&(d.transformBox=c?.transformBox??"fill-box",delete f.transformBox);for(const t of gt)void 0!==f[t]&&(d[t]=f[t],delete f[t]);void 0!==n&&(f.x=n),void 0!==r&&(f.y=r),void 0!==e&&(f.scale=e),void 0!==o&&function(t,n,r=1,e=0,o=!0){t.pathLength=1;const a=o?pt:mt;t[a.offset]=""+-e,t[a.array]=`${n} ${r}`}(f,o,a,s,!1)}function yt(t){return q(t)?t.get():t}function vt(t){const{initial:n,animate:r}=function(t,n){if(rt(t)){const{initial:n,animate:r}=t;return{initial:!1===n||tt(n)?n:void 0,animate:tt(r)?r:void 0}}return!1!==t.inherit?n:{}}(t,e(y));return o(()=>({initial:n,animate:r}),[bt(n),bt(r)])}function bt(t){return Array.isArray(t)?t.join(" "):t}const wt=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function St(t,n,r){for(const e in n)q(n[e])||ft(e,r)||(t[e]=n[e])}function xt(t,n){const r={};return St(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return o(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return st(r,n,t),Object.assign({},r.vars,r.style)},[n])}(t,n)),r}function kt(t,n){const r={},e=xt(t,n);return t.drag&&!1!==t.dragListener&&(r.draggable=!1,e.userSelect=e.WebkitUserSelect=e.WebkitTouchCallout="none",e.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=e,r}const Bt=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function Rt(t,n,r,e){const a=o(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};var o;return ht(r,n,"string"==typeof(o=e)&&"svg"===o.toLowerCase(),t.transformTemplate,t.style),{...r.attrs,style:{...r.style}}},[n]);if(t.style){const n={};St(n,t.style,t),a.style={...n,...a.style}}return a}const Tt=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function It(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Tt.has(t)}let At=t=>!It(t);try{"function"==typeof(Mt=require("@emotion/is-prop-valid").default)&&(At=t=>t.startsWith("on")?!It(t):Mt(t))}catch{}var Mt;const Ot=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Pt(t){return"string"==typeof t&&!t.includes("-")&&!!(Ot.indexOf(t)>-1||/[A-Z]/u.test(t))}function Wt(t,n,r,{latestValues:e},i,l=!1,u){const c=(u??Pt(t)?Rt:kt)(n,e,i,t),f=function(t,n,r){const e={};for(const o in t)"values"===o&&"object"==typeof t.values||q(t[o])||(At(o)||!0===r&&It(o)||!n&&!It(o)||t.draggable&&o.startsWith("onDrag"))&&(e[o]=t[o]);return e}(n,"string"==typeof t,l),d=t!==a?{...f,...c,ref:r}:{},{children:p}=n,m=o(()=>q(p)?p.get():p,[p]);return s(t,{...d,children:m})}const Et=r(null);function Lt(t,n,r,e){const o={},a=e(t,{});for(const t in a)o[t]=yt(a[t]);let{initial:s,animate:i}=t;const l=rt(t),u=function(t){return Boolean(rt(t)||t.variants)}(t);n&&u&&!l&&!1!==t.inherit&&(void 0===s&&(s=n.initial),void 0===i&&(i=n.animate));let c=!!r&&!1===r.initial;c=c||!1===s;const f=c?i:s;if(f&&"boolean"!=typeof f&&!Q(f)){const n=Array.isArray(f)?f:[f];for(let r=0;r<n.length;r++){const e=U(t,n[r]);if(e){const{transitionEnd:t,transition:n,...r}=e;for(const t in r){let n=r[t];if(Array.isArray(n)){n=n[c?n.length-1:0]}null!==n&&(o[t]=n)}for(const n in t)o[n]=t[n]}}}return o}const Ct=t=>(n,r)=>{const o=e(y),a=e(Et),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:n},r,e,o){return{latestValues:Lt(r,e,o,t),renderState:n()}}(t,n,o,a);return r?s():function(t){const n=i(null);return null===n.current&&(n.current=t()),n.current}(s)},jt=Ct({scrapeMotionValuesFromProps:dt,createRenderState:wt}),Vt=Ct({scrapeMotionValuesFromProps:function(t,n,r){const e=dt(t,n,r);for(const r in t)if(q(t[r])||q(n[r])){e[-1!==Z.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=t[r]}return e},createRenderState:Bt}),$t={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Ft=!1;function Xt(){if(Ft)return;const t={};for(const n in $t)t[n]={isEnabled:t=>$t[n].some(n=>!!t[n])};et=t,Ft=!0}function Yt(){return Xt(),et}const Dt=Symbol.for("motionComponentSymbol");function Ht(t,n,r){const e=i(r);l(()=>{e.current=r});const o=i(null);return u(r=>{r&&t.onMount?.(r);const a=e.current;if("function"==typeof a)if(r){const t=a(r);"function"==typeof t&&(o.current=t)}else o.current?(o.current(),o.current=null):a(r);else a&&(a.current=r);n&&(r?n.mount(r):n.unmount())},[n])}const Nt=r({});function Zt(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const zt="undefined"!=typeof window?c:f;function Ut(t,n,r,o,a,s){const{visualElement:u}=e(y),c=e(g),d=e(Et),p=e(h),m=p.reducedMotion,v=p.skipAnimations,b=i(null),w=i(!1);o=o||c.renderer,!b.current&&o&&(b.current=o(t,{visualState:n,parent:u,props:r,presenceContext:d,blockInitialAnimation:!!d&&!1===d.initial,reducedMotionConfig:m,skipAnimations:v,isSVG:s}),w.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const S=b.current,x=e(Nt);!S||S.projection||!a||"html"!==S.type&&"svg"!==S.type||function(t,n,r,e){const{layoutId:o,layout:a,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:f}=n;t.projection=new r(t.latestValues,n["data-framer-portal-id"]?void 0:qt(t.parent)),t.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:Boolean(s)||i&&Zt(i),visualElement:t,animationType:"string"==typeof a?a:"both",initialPromotionConfig:e,crossfade:f,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}(b.current,r,a,x);const k=i(!1);l(()=>{S&&k.current&&S.update(r,d)});const B=r[_],R=i(Boolean(B)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(B)&&window.MotionHasOptimisedAnimation?.(B));return zt(()=>{w.current=!0,S&&(k.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),R.current&&S.animationState&&S.animationState.animateChanges())}),f(()=>{S&&(!R.current&&S.animationState&&S.animationState.animateChanges(),R.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(B)}),R.current=!1),S.enteringChildren=void 0)}),S}function qt(t){if(t)return!1!==t.options.allowProjection?t.projection:qt(t.parent)}function _t(r,{forwardMotionProps:o=!1,type:a}={},s,i){const l=a?"svg"===a:Pt(r),u=l?Vt:jt;function c(a,s){let c;const f={...e(h),...a,layoutId:Gt(a)},{isStatic:d}=f,p=vt(a),m=u(a,d);if(!d&&"undefined"!=typeof window){e(g).strict;const t=function(t){const n=Yt(),{drag:r,layout:e}=n;if(!r&&!e)return{};const o={...r,...e};return{MeasureLayout:r?.isEnabled(t)||e?.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}(f);c=t.MeasureLayout,p.visualElement=Ut(r,m,f,i,t.ProjectionNode,l)}return t(y.Provider,{value:p,children:[c&&p.visualElement?n(c,{visualElement:p.visualElement,...f}):null,Wt(r,a,Ht(m,p.visualElement,s),m,d,o,l)]})}c.displayName=`motion.${"string"==typeof r?r:`create(${r.displayName??r.name??""})`}`;const f=d(c);return f[Dt]=r,f}function Gt({layoutId:t}){const n=e(m).id;return n&&void 0!==t?n+"-"+t:t}function Jt(t,n){return _t(t,n)}const Kt=Jt("div");export{Kt as MotionDiv}; | ||
| import{jsxs as t,jsx as n}from"react/jsx-runtime";import{createContext as r,useContext as e,useMemo as o,Fragment as a,createElement as s,useRef as i,useInsertionEffect as l,useCallback as u,useLayoutEffect as c,useEffect as f,forwardRef as d}from"react";const p=(t,n,r)=>r>n?n:r<t?t:r,m=r({}),g=r({strict:!1}),h=r({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),y=r({}),v=(t=>n=>"string"==typeof n&&n.startsWith(t))("--"),b={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},w={...b,transform:t=>p(0,1,t)},S={...b,default:1},x=t=>Math.round(1e5*t)/1e5,k=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const B=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,R=(t,n)=>r=>Boolean("string"==typeof r&&B.test(r)&&r.startsWith(t)||n&&!function(t){return null==t}(r)&&Object.prototype.hasOwnProperty.call(r,n)),T=(t,n,r)=>e=>{if("string"!=typeof e)return e;const[o,a,s,i]=e.match(k);return{[t]:parseFloat(o),[n]:parseFloat(a),[r]:parseFloat(s),alpha:void 0!==i?parseFloat(i):1}},I={...b,transform:t=>Math.round((t=>p(0,255,t))(t))},A={test:R("rgb","red"),parse:T("red","green","blue"),transform:({red:t,green:n,blue:r,alpha:e=1})=>"rgba("+I.transform(t)+", "+I.transform(n)+", "+I.transform(r)+", "+x(w.transform(e))+")"};const M={test:R("#"),parse:function(t){let n="",r="",e="",o="";return t.length>5?(n=t.substring(1,3),r=t.substring(3,5),e=t.substring(5,7),o=t.substring(7,9)):(n=t.substring(1,2),r=t.substring(2,3),e=t.substring(3,4),o=t.substring(4,5),n+=n,r+=r,e+=e,o+=o),{red:parseInt(n,16),green:parseInt(r,16),blue:parseInt(e,16),alpha:o?parseInt(o,16)/255:1}},transform:A.transform},O=t=>({test:n=>"string"==typeof n&&n.endsWith(t)&&1===n.split(" ").length,parse:parseFloat,transform:n=>`${n}${t}`}),P=O("deg"),W=O("%"),E=O("px"),L=(()=>({...W,parse:t=>W.parse(t)/100,transform:t=>W.transform(100*t)}))(),C={test:R("hsl","hue"),parse:T("hue","saturation","lightness"),transform:({hue:t,saturation:n,lightness:r,alpha:e=1})=>"hsla("+Math.round(t)+", "+W.transform(x(n))+", "+W.transform(x(r))+", "+x(w.transform(e))+")"},j={test:t=>A.test(t)||M.test(t)||C.test(t),parse:t=>A.test(t)?A.parse(t):C.test(t)?C.parse(t):M.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?A.transform(t):C.transform(t),getAnimatableNone:t=>{const n=j.parse(t);return n.alpha=0,j.transform(n)}},V=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const $="number",F="color",X=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Y(t){const n=t.toString(),r=[],e={color:[],number:[],var:[]},o=[];let a=0;const s=n.replace(X,t=>(j.test(t)?(e.color.push(a),o.push(F),r.push(j.parse(t))):t.startsWith("var(")?(e.var.push(a),o.push("var"),r.push(t)):(e.number.push(a),o.push($),r.push(parseFloat(t))),++a,"${}")).split("${}");return{values:r,split:s,indexes:e,types:o}}function D({split:t,types:n}){const r=t.length;return e=>{let o="";for(let a=0;a<r;a++)if(o+=t[a],void 0!==e[a]){const t=n[a];o+=t===$?x(e[a]):t===F?j.transform(e[a]):e[a]}return o}}const H=(t,n)=>{return"number"==typeof t?n?.trim().endsWith("/")?t:0:"number"==typeof(r=t)?0:j.test(r)?j.getAnimatableNone(r):r;var r};const N={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(k)?.length||0)+(t.match(V)?.length||0)>0},parse:function(t){return Y(t).values},createTransformer:function(t){return D(Y(t))},getAnimatableNone:function(t){const n=Y(t);return D(n)(n.values.map((t,r)=>H(t,n.split[r])))}},Z=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],z=(()=>new Set(Z))();function U(t,n,r,e){if("function"==typeof n){const[r,e]=[{},{}];n=n(t.custom,r,e)}if("string"==typeof n&&(n=t.variants&&t.variants[n]),"function"==typeof n){const[r,e]=[{},{}];n=n(t.custom,r,e)}return n}const q=t=>Boolean(t&&t.getVelocity);const _="data-"+"framerAppearId".replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`);const G={...b,transform:Math.round},J={borderWidth:E,borderTopWidth:E,borderRightWidth:E,borderBottomWidth:E,borderLeftWidth:E,borderRadius:E,borderTopLeftRadius:E,borderTopRightRadius:E,borderBottomRightRadius:E,borderBottomLeftRadius:E,width:E,maxWidth:E,height:E,maxHeight:E,top:E,right:E,bottom:E,left:E,inset:E,insetBlock:E,insetBlockStart:E,insetBlockEnd:E,insetInline:E,insetInlineStart:E,insetInlineEnd:E,padding:E,paddingTop:E,paddingRight:E,paddingBottom:E,paddingLeft:E,paddingBlock:E,paddingBlockStart:E,paddingBlockEnd:E,paddingInline:E,paddingInlineStart:E,paddingInlineEnd:E,margin:E,marginTop:E,marginRight:E,marginBottom:E,marginLeft:E,marginBlock:E,marginBlockStart:E,marginBlockEnd:E,marginInline:E,marginInlineStart:E,marginInlineEnd:E,fontSize:E,backgroundPositionX:E,backgroundPositionY:E,...{rotate:P,rotateX:P,rotateY:P,rotateZ:P,scale:S,scaleX:S,scaleY:S,scaleZ:S,skew:P,skewX:P,skewY:P,distance:E,translateX:E,translateY:E,translateZ:E,x:E,y:E,z:E,perspective:E,transformPerspective:E,opacity:w,originX:L,originY:L,originZ:E},zIndex:G,fillOpacity:w,strokeOpacity:w,numOctaves:G},K=(t,n)=>n&&"number"==typeof t?n.transform(t):t;function Q(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function tt(t){return"string"==typeof t||Array.isArray(t)}const nt=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function rt(t){return Q(t.animate)||nt.some(n=>tt(t[n]))}let et={};const ot={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},at=Z.length;function st(t,n,r){const{style:e,vars:o,transformOrigin:a}=t;let s=!1,i=!1;for(const t in n){const r=n[t];if(z.has(t))s=!0;else if(v(t))o[t]=r;else{const n=K(r,J[t]);t.startsWith("origin")?(i=!0,a[t]=n):e[t]=n}}if(n.transform||(s||r?e.transform=function(t,n,r){let e="",o=!0;for(let a=0;a<at;a++){const s=Z[a],i=t[s];if(void 0===i)continue;let l=!0;if("number"==typeof i)l=i===(s.startsWith("scale")?1:0);else{const t=parseFloat(i);l=s.startsWith("scale")?1===t:0===t}if(!l||r){const t=K(i,J[s]);l||(o=!1,e+=`${ot[s]||s}(${t}) `),r&&(n[s]=t)}}return e=e.trim(),r?e=r(n,o?"":e):o&&(e="none"),e}(n,t.transform,r):e.transform&&(e.transform="none")),i){const{originX:t="50%",originY:n="50%",originZ:r=0}=a;e.transformOrigin=`${t} ${n} ${r}`}}function it(t,n){return n.max===n.min?0:t/(n.max-n.min)*100}const lt={correct:(t,n)=>{if(!n.target)return t;if("string"==typeof t){if(!E.test(t))return t;t=parseFloat(t)}return`${it(t,n.target.x)}% ${it(t,n.target.y)}%`}},ut={correct:(t,{treeScale:n,projectionDelta:r})=>{const e=t,o=N.parse(t);if(o.length>5)return e;const a=N.createTransformer(t),s="number"!=typeof o[0]?1:0,i=r.x.scale*n.x,l=r.y.scale*n.y;o[0+s]/=i,o[1+s]/=l;const u=(c=i)+(l-c)*.5;var c;return"number"==typeof o[2+s]&&(o[2+s]/=u),"number"==typeof o[3+s]&&(o[3+s]/=u),a(o)}},ct={borderRadius:{...lt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:lt,borderTopRightRadius:lt,borderBottomLeftRadius:lt,borderBottomRightRadius:lt,boxShadow:ut};function ft(t,{layout:n,layoutId:r}){return z.has(t)||t.startsWith("origin")||(n||void 0!==r)&&(!!ct[t]||"opacity"===t)}function dt(t,n,r){const e=t.style,o=n?.style,a={};if(!e)return a;for(const n in e)(q(e[n])||o&&q(o[n])||ft(n,t)||void 0!==r?.getValue(n)?.liveStyle)&&(a[n]=e[n]);return a}const pt={offset:"stroke-dashoffset",array:"stroke-dasharray"},mt={offset:"strokeDashoffset",array:"strokeDasharray"};const gt=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function ht(t,{attrX:n,attrY:r,attrScale:e,pathLength:o,pathSpacing:a=1,pathOffset:s=0,...i},l,u,c){if(st(t,i,u),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:f,style:d}=t;f.transform&&(d.transform=f.transform,delete f.transform),(d.transform||f.transformOrigin)&&(d.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),d.transform&&(d.transformBox=c?.transformBox??"fill-box",delete f.transformBox);for(const t of gt)void 0!==f[t]&&(d[t]=f[t],delete f[t]);void 0!==n&&(f.x=n),void 0!==r&&(f.y=r),void 0!==e&&(f.scale=e),void 0!==o&&function(t,n,r=1,e=0,o=!0){t.pathLength=1;const a=o?pt:mt;t[a.offset]=""+-e,t[a.array]=`${n} ${r}`}(f,o,a,s,!1)}function yt(t){return q(t)?t.get():t}function vt(t){const{initial:n,animate:r}=function(t,n){if(rt(t)){const{initial:n,animate:r}=t;return{initial:!1===n||tt(n)?n:void 0,animate:tt(r)?r:void 0}}return!1!==t.inherit?n:{}}(t,e(y));return o(()=>({initial:n,animate:r}),[bt(n),bt(r)])}function bt(t){return Array.isArray(t)?t.join(" "):t}const wt=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function St(t,n,r){for(const e in n)q(n[e])||ft(e,r)||(t[e]=n[e])}function xt(t,n){const r={};return St(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},n){return o(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{}};return st(r,n,t),Object.assign({},r.vars,r.style)},[n])}(t,n)),r}function kt(t,n){const r={},e=xt(t,n);return t.drag&&!1!==t.dragListener&&(r.draggable=!1,e.userSelect=e.WebkitUserSelect=e.WebkitTouchCallout="none",e.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=e,r}const Bt=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}});function Rt(t,n,r,e){const a=o(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};var o;return ht(r,n,"string"==typeof(o=e)&&"svg"===o.toLowerCase(),t.transformTemplate,t.style),{...r.attrs,style:{...r.style}}},[n]);if(t.style){const n={};St(n,t.style,t),a.style={...n,...a.style}}return a}const Tt=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function It(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Tt.has(t)}let At=t=>!It(t);try{"function"==typeof(Mt=require("@emotion/is-prop-valid").default)&&(At=t=>t.startsWith("on")?!It(t):Mt(t))}catch{}var Mt;const Ot=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Pt(t){return"string"==typeof t&&!t.includes("-")&&!!(Ot.indexOf(t)>-1||/[A-Z]/u.test(t))}function Wt(t,n,r,{latestValues:e},i,l=!1,u){const c=(u??Pt(t)?Rt:kt)(n,e,i,t),f=function(t,n,r){const e={};for(const o in t)"values"===o&&"object"==typeof t.values||q(t[o])||(At(o)||!0===r&&It(o)||!n&&!It(o)||t.draggable&&o.startsWith("onDrag"))&&(e[o]=t[o]);return e}(n,"string"==typeof t,l),d=t!==a?{...f,...c,ref:r}:{},{children:p}=n,m=o(()=>q(p)?p.get():p,[p]);return s(t,{...d,children:m})}const Et=r(null);function Lt(t,n,r,e){const o={},a=e(t,{});for(const t in a)o[t]=yt(a[t]);let{initial:s,animate:i}=t;const l=rt(t),u=function(t){return Boolean(rt(t)||t.variants)}(t);n&&u&&!l&&!1!==t.inherit&&(void 0===s&&(s=n.initial),void 0===i&&(i=n.animate));let c=!!r&&!1===r.initial;c=c||!1===s;const f=c?i:s;if(f&&"boolean"!=typeof f&&!Q(f)){const n=Array.isArray(f)?f:[f];for(let r=0;r<n.length;r++){const e=U(t,n[r]);if(e){const{transitionEnd:t,transition:n,...r}=e;for(const t in r){let n=r[t];if(Array.isArray(n)){n=n[c?n.length-1:0]}null!==n&&(o[t]=n)}for(const n in t)o[n]=t[n]}}}return o}const Ct=t=>(n,r)=>{const o=e(y),a=e(Et),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:n},r,e,o){return{latestValues:Lt(r,e,o,t),renderState:n()}}(t,n,o,a);return r?s():function(t){const n=i(null);return null===n.current&&(n.current=t()),n.current}(s)},jt=Ct({scrapeMotionValuesFromProps:dt,createRenderState:wt}),Vt=Ct({scrapeMotionValuesFromProps:function(t,n,r){const e=dt(t,n,r);for(const r in t)if(q(t[r])||q(n[r])){e[-1!==Z.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=t[r]}return e},createRenderState:Bt}),$t={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Ft=!1;function Xt(){if(Ft)return;const t={};for(const n in $t)t[n]={isEnabled:t=>$t[n].some(n=>!!t[n])};et=t,Ft=!0}function Yt(){return Xt(),et}const Dt=Symbol.for("motionComponentSymbol");function Ht(t,n,r){const e=i(r);l(()=>{e.current=r});const o=i(null);return u(r=>{r&&t.onMount?.(r),n&&(r?n.mount(r):n.unmount());const a=e.current;if("function"==typeof a)if(r){const t=a(r);"function"==typeof t&&(o.current=t)}else o.current?(o.current(),o.current=null):a(r);else a&&(a.current=r)},[n])}const Nt=r({});function Zt(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}const zt="undefined"!=typeof window?c:f;function Ut(t,n,r,o,a,s){const{visualElement:u}=e(y),c=e(g),d=e(Et),p=e(h),m=p.reducedMotion,v=p.skipAnimations,b=i(null),w=i(!1);o=o||c.renderer,!b.current&&o&&(b.current=o(t,{visualState:n,parent:u,props:r,presenceContext:d,blockInitialAnimation:!!d&&!1===d.initial,reducedMotionConfig:m,skipAnimations:v,isSVG:s}),w.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const S=b.current,x=e(Nt);!S||S.projection||!a||"html"!==S.type&&"svg"!==S.type||function(t,n,r,e){const{layoutId:o,layout:a,drag:s,dragConstraints:i,layoutScroll:l,layoutRoot:u,layoutAnchor:c,layoutCrossfade:f}=n;t.projection=new r(t.latestValues,n["data-framer-portal-id"]?void 0:qt(t.parent)),t.projection.setOptions({layoutId:o,layout:a,alwaysMeasureLayout:Boolean(s)||i&&Zt(i),visualElement:t,animationType:"string"==typeof a?a:"both",initialPromotionConfig:e,crossfade:f,layoutScroll:l,layoutRoot:u,layoutAnchor:c})}(b.current,r,a,x);const k=i(!1);l(()=>{S&&k.current&&S.update(r,d)});const B=r[_],R=i(Boolean(B)&&"undefined"!=typeof window&&!window.MotionHandoffIsComplete?.(B)&&window.MotionHasOptimisedAnimation?.(B));return zt(()=>{w.current=!0,S&&(k.current=!0,window.MotionIsMounted=!0,S.updateFeatures(),S.scheduleRenderMicrotask(),R.current&&S.animationState&&S.animationState.animateChanges())}),f(()=>{S&&(!R.current&&S.animationState&&S.animationState.animateChanges(),R.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(B)}),R.current=!1),S.enteringChildren=void 0)}),S}function qt(t){if(t)return!1!==t.options.allowProjection?t.projection:qt(t.parent)}function _t(r,{forwardMotionProps:o=!1,type:a}={},s,i){const l=a?"svg"===a:Pt(r),u=l?Vt:jt;function c(a,s){let c;const f={...e(h),...a,layoutId:Gt(a)},{isStatic:d}=f,p=vt(a),m=u(a,d);if(!d&&"undefined"!=typeof window){e(g).strict;const t=function(t){const n=Yt(),{drag:r,layout:e}=n;if(!r&&!e)return{};const o={...r,...e};return{MeasureLayout:r?.isEnabled(t)||e?.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}(f);c=t.MeasureLayout,p.visualElement=Ut(r,m,f,i,t.ProjectionNode,l)}return t(y.Provider,{value:p,children:[c&&p.visualElement?n(c,{visualElement:p.visualElement,...f}):null,Wt(r,a,Ht(m,p.visualElement,s),m,d,o,l)]})}c.displayName=`motion.${"string"==typeof r?r:`create(${r.displayName??r.name??""})`}`;const f=d(c);return f[Dt]=r,f}function Gt({layoutId:t}){const n=e(m).id;return n&&void 0!==t?n+"-"+t:t}function Jt(t,n){return _t(t,n)}const Kt=Jt("div");export{Kt as MotionDiv}; | ||
| //# sourceMappingURL=size-rollup-m.js.map |
@@ -1,2 +0,2 @@ | ||
| const e=(e,t,n)=>n>t?t:n<e?e:n;function t(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let n=()=>{},r=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(n=(e,n,r)=>{e||"undefined"==typeof console||console.warn(t(n,r))},r=(e,n,r)=>{if(!e)throw new Error(t(n,r))});const s={};function o(e){return"object"==typeof e&&null!==e}const i=e=>e,a=(e,t)=>n=>t(e(n)),c=(...e)=>e.reduce(a),l=(e,t,n)=>{const r=t-e;return 0===r?1:(n-e)/r};const u=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function f(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=u.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,s=!1;const o=new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function a(t){o.has(t)&&(c.schedule(t),e()),t(i)}const c={schedule:(e,s=!1,i=!1)=>{const a=i&&r?t:n;return s&&o.add(e),a.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(i=e,r)return void(s=!0);r=!0;const o=t;t=n,n=o,t.forEach(a),t.clear(),r=!1,s&&(s=!1,c.process(e))}};return c}(i),e),{}),{setup:c,read:l,resolveKeyframes:f,preUpdate:d,update:g,preRender:h,render:p,postRender:m}=a,v=()=>{const i=s.useManualTiming,a=i?o.timestamp:performance.now();n=!1,i||(o.delta=r?1e3/60:Math.max(Math.min(a-o.timestamp,40),1)),o.timestamp=a,o.isProcessing=!0,c.process(o),l.process(o),f.process(o),d.process(o),g.process(o),h.process(o),p.process(o),m.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(v))};return{schedule:u.reduce((t,s)=>{const i=a[s];return t[s]=(t,s=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||e(v)),i.schedule(t,s,a)),t},{}),cancel:e=>{for(let t=0;t<u.length;t++)a[u[t]].cancel(e)},state:o,steps:a}}const{schedule:d,cancel:g,state:h}=f("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:i,!0),p=(e=>t=>"string"==typeof t&&t.startsWith(e))("var(--"),m=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,v={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},y={...v,transform:t=>e(0,1,t)},w=e=>Math.round(1e5*e)/1e5,b=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const x=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,E=(e,t)=>n=>Boolean("string"==typeof n&&x.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),W=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[s,o,i,a]=r.match(b);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:void 0!==a?parseFloat(a):1}},L={...v,transform:t=>Math.round((t=>e(0,255,t))(t))},A={test:E("rgb","red"),parse:W("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+L.transform(e)+", "+L.transform(t)+", "+L.transform(n)+", "+w(y.transform(r))+")"};const S={test:E("#"),parse:function(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}},transform:A.transform},M=(e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}))("%"),B={test:E("hsl","hue"),parse:W("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+M.transform(w(t))+", "+M.transform(w(n))+", "+w(y.transform(r))+")"},T={test:e=>A.test(e)||S.test(e)||B.test(e),parse:e=>A.test(e)?A.parse(e):B.test(e)?B.parse(e):S.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?A.transform(e):B.transform(e),getAnimatableNone:e=>{const t=T.parse(e);return t.alpha=0,T.transform(t)}},$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const O="number",H="color",z=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function F(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const i=t.replace(z,e=>(T.test(e)?(r.color.push(o),s.push(H),n.push(T.parse(e))):e.startsWith("var(")?(r.var.push(o),s.push("var"),n.push(e)):(r.number.push(o),s.push(O),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:i,indexes:r,types:s}}function N({split:e,types:t}){const n=e.length;return r=>{let s="";for(let o=0;o<n;o++)if(s+=e[o],void 0!==r[o]){const e=t[o];s+=e===O?w(r[o]):e===H?T.transform(r[o]):r[o]}return s}}const k=(e,t)=>{return"number"==typeof e?t?.trim().endsWith("/")?e:0:"number"==typeof(n=e)?0:T.test(n)?T.getAnimatableNone(n):n;var n};const P={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(b)?.length||0)+(e.match($)?.length||0)>0},parse:function(e){return F(e).values},createTransformer:function(e){return N(F(e))},getAnimatableNone:function(e){const t=F(e);return N(t)(t.values.map((e,n)=>k(e,t.split[n])))}};function R(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function q(e,t){return n=>n>0?t:e}const V=(e,t,n)=>e+(t-e)*n,j=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},U=[S,A,B];function C(e){const t=(r=e,U.find(e=>e.test(r)));var r;if(n(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let s=t.parse(e);return t===B&&(s=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let s=0,o=0,i=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;s=R(a,r,e+1/3),o=R(a,r,e),i=R(a,r,e-1/3)}else s=o=i=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*i),alpha:r}}(s)),s}const G=(e,t)=>{const n=C(e),r=C(t);if(!n||!r)return q(e,t);const s={...n};return e=>(s.red=j(n.red,r.red,e),s.green=j(n.green,r.green,e),s.blue=j(n.blue,r.blue,e),s.alpha=V(n.alpha,r.alpha,e),A.transform(s))},I=new Set(["none","hidden"]);function D(e,t){return n=>V(e,t,n)}function K(e){return"number"==typeof e?D:"string"==typeof e?p(t=e)&&m.test(t.split("/*")[0].trim())?q:T.test(e)?G:Q:Array.isArray(e)?_:"object"==typeof e?T.test(e)?G:J:q;var t}function _(e,t){const n=[...e],r=n.length,s=e.map((e,n)=>K(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=s[t](e);return n}}function J(e,t){const n={...e,...t},r={};for(const s in n)void 0!==e[s]&&void 0!==t[s]&&(r[s]=K(e[s])(e[s],t[s]));return e=>{for(const t in r)n[t]=r[t](e);return n}}const Q=(e,t)=>{const r=P.createTransformer(t),s=F(e),o=F(t);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?I.has(e)&&!o.values.length||I.has(t)&&!s.values.length?function(e,t){return I.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):c(_(function(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][r[o]],a=e.values[i]??0;n[s]=a,r[o]++}return n}(s,o),o.values),r):(n(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),q(e,t))};function X(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return V(e,t,n);return K(e)(e,t)}function Y(t,n,{clamp:o=!0,ease:a,mixer:u}={}){const f=t.length;if(r(f===n.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>n[0];if(2===f&&n[0]===n[1])return()=>n[1];const d=t[0]===t[1];t[0]>t[f-1]&&(t=[...t].reverse(),n=[...n].reverse());const g=function(e,t,n){const r=[],o=n||s.mix||X,a=e.length-1;for(let n=0;n<a;n++){let s=o(e[n],e[n+1]);if(t){const e=Array.isArray(t)?t[n]||i:t;s=c(e,s)}r.push(s)}return r}(n,a,u),h=g.length,p=e=>{if(d&&e<t[0])return n[0];let r=0;if(h>1)for(;r<t.length-2&&!(e<t[r+1]);r++);const s=l(t[r],t[r+1],e);return g[r](s)};return o?n=>p(e(t[0],t[f-1],n)):p}function Z(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=l(0,t,r);e.push(V(n,1,s))}}(t,e.length-1),t}const ee={};function te(e,t){const n=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(e);return()=>ee[t]??n()}const ne=te(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),re=te(()=>void 0!==window.ViewTimeline,"viewTimeline");function se(e){return o(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const oe=new WeakMap;let ie;const ae=(e,t,n)=>(r,s)=>{return s&&s[0]?s[0][e+"Size"]:o(i=r)&&"ownerSVGElement"in i&&"getBBox"in r?r.getBBox()[t]:r[n];var i},ce=ae("inline","width","offsetWidth"),le=ae("block","height","offsetHeight");function ue({target:e,borderBoxSize:t}){oe.get(e)?.forEach(n=>{n(e,{get width(){return ce(e,t)},get height(){return le(e,t)}})})}function fe(e){e.forEach(ue)}function de(e,t){ie||"undefined"!=typeof ResizeObserver&&(ie=new ResizeObserver(fe));const n=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter(e=>null!=e)}(e);return n.forEach(e=>{let n=oe.get(e);n||(n=new Set,oe.set(e,n)),n.add(t),ie?.observe(e)}),()=>{n.forEach(e=>{const n=oe.get(e);n?.delete(t),n?.size||ie?.unobserve(e)})}}const ge=new Set;let he;function pe(e){return ge.add(e),he||(he=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ge.forEach(t=>t(e))},window.addEventListener("resize",he)),()=>{ge.delete(e),ge.size||"function"!=typeof he||(window.removeEventListener("resize",he),he=void 0)}}function me(e,t){let n;const r=()=>{const{currentTime:r}=t,s=(null===r?0:r.value)/100;n!==s&&e(s),n=s};return d.preUpdate(r,!0),()=>g(r)}function ve(e){return"undefined"!=typeof window&&(e?re():ne())}const ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function we(e,t,n,r){const s=n[t],{length:o,position:i}=ye[t],a=s.current,c=n.time;s.current=Math.abs(e[`scroll${i}`]),s.scrollLength=e[`scroll${o}`]-e[`client${o}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=l(0,s.scrollLength,s.current);const u=r-c;var f,d;s.velocity=u>50?0:(f=s.current-a,(d=u)?f*(1e3/d):0)}const be={start:0,center:.5,end:1};function xe(e,t,n=0){let r=0;if(e in be&&(e=be[e]),"string"==typeof e){const t=parseFloat(e);e.endsWith("px")?r=t:e.endsWith("%")?e=t/100:e.endsWith("vw")?r=t/100*document.documentElement.clientWidth:e.endsWith("vh")?r=t/100*document.documentElement.clientHeight:e=t}return"number"==typeof e&&(r=t*e),n+r}const Ee=[0,0];function We(e,t,n,r){let s=Array.isArray(e)?e:Ee,o=0,i=0;return"number"==typeof e?s=[e,e]:"string"==typeof e&&(s=(e=e.trim()).includes(" ")?e.split(" "):[e,be[e]?e:"0"]),o=xe(s[0],n,r),i=xe(s[1],t),o-i}const Le={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Ae={x:0,y:0};function Se(t,n,r){const{offset:s=Le.All}=r,{target:o=t,axis:i="y"}=r,a="y"===i?"height":"width",c=o!==t?function(e,t){const n={x:0,y:0};let r=e;for(;r&&r!==t;)if(se(r))n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if("svg"===r.tagName){const e=r.getBoundingClientRect();r=r.parentElement;const t=r.getBoundingClientRect();n.x+=e.left-t.left,n.y+=e.top-t.top}else{if(!(r instanceof SVGGraphicsElement))break;{const{x:e,y:t}=r.getBBox();n.x+=e,n.y+=t;let s=null,o=r.parentNode;for(;!s;)"svg"===o.tagName&&(s=o),o=r.parentNode;r=s}}return n}(o,t):Ae,l=o===t?{width:t.scrollWidth,height:t.scrollHeight}:function(e){return"getBBox"in e&&"svg"!==e.tagName?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}(o),u={width:t.clientWidth,height:t.clientHeight};n[i].offset.length=0;let f=!n[i].interpolate;const d=s.length;for(let e=0;e<d;e++){const t=We(s[e],u[a],l[a],c[i]);f||t===n[i].interpolatorOffsets[e]||(f=!0),n[i].offset[e]=t}f&&(n[i].interpolate=Y(n[i].offset,Z(s),{clamp:!1}),n[i].interpolatorOffsets=[...n[i].offset]),n[i].progress=e(0,1,n[i].interpolate(n[i].current))}function Me(e,t,n,r={}){return{measure:t=>{!function(e,t=e,n){if(n.x.targetOffset=0,n.y.targetOffset=0,t!==e){let r=t;for(;r&&r!==e;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=t===e?t.scrollWidth:t.clientWidth,n.y.targetLength=t===e?t.scrollHeight:t.clientHeight,n.x.containerLength=e.clientWidth,n.y.containerLength=e.clientHeight}(e,r.target,n),function(e,t,n){we(e,"x",t,n),we(e,"y",t,n),t.time=n}(e,n,t),(r.offset||r.target)&&Se(e,n,r)},notify:()=>t(n)}}const Be=new WeakMap,Te=new WeakMap,$e=new WeakMap,Oe=new WeakMap,He=new WeakMap,ze=e=>e===document.scrollingElement?window:e;function Fe(e,{container:t=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!t)return i;let s=$e.get(t);s||(s=new Set,$e.set(t,s));const o=Me(t,e,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},r);if(s.add(o),!Be.has(t)){const e=()=>{for(const e of s)e.measure(h.timestamp);d.preUpdate(n)},n=()=>{for(const e of s)e.notify()},r=()=>d.read(e);Be.set(t,r);const o=ze(t);window.addEventListener("resize",r),t!==document.documentElement&&Te.set(t,(c=r,"function"==typeof(a=t)?pe(a):de(a,c))),o.addEventListener("scroll",r),r()}var a,c;if(n&&!He.has(t)){const e=Be.get(t),n={width:t.scrollWidth,height:t.scrollHeight};Oe.set(t,n);const r=()=>{const r=t.scrollWidth,s=t.scrollHeight;n.width===r&&n.height===s||(e(),n.width=r,n.height=s)},s=d.read(r,!0);He.set(t,s)}const l=Be.get(t);return d.read(l,!1,!0),()=>{g(l);const e=$e.get(t);if(!e)return;if(e.delete(o),e.size)return;const n=Be.get(t);Be.delete(t),n&&(ze(t).removeEventListener("scroll",n),Te.get(t)?.(),window.removeEventListener("resize",n));const r=He.get(t);r&&(g(r),He.delete(t)),Oe.delete(t)}}const Ne=[[Le.Enter,"entry"],[Le.Exit,"exit"],[Le.Any,"cover"],[Le.All,"contain"]],ke={start:0,end:1};function Pe(e){const t=e.trim().split(/\s+/);if(2!==t.length)return;const n=ke[t[0]],r=ke[t[1]];return void 0!==n&&void 0!==r?[n,r]:void 0}function Re(e,t){const n=function(e){if(2!==e.length)return;const t=[];for(const n of e)if(Array.isArray(n))t.push(n);else{if("string"!=typeof n)return;{const e=Pe(n);if(!e)return;t.push(e)}}return t}(e);if(!n)return!1;for(let e=0;e<2;e++){const r=n[e],s=t[e];if(r[0]!==s[0]||r[1]!==s[1])return!1}return!0}function qe(e){if(!e)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[t,n]of Ne)if(Re(e,t))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const Ve=new Map;function je(e){const t={value:0},n=Fe(n=>{t.value=100*n[e.axis].progress},e);return{currentTime:t,cancel:n}}function Ue({source:e,container:t,...n}){const{axis:r}=n;e&&(t=e);let s=Ve.get(t);s||(s=new Map,Ve.set(t,s));const o=n.target??"self";let i=s.get(o);i||(i={},s.set(o,i));const a=r+(n.offset??[]).join(",");if(!i[a])if(n.target&&ve(n.target)){const e=qe(n.offset);i[a]=e?new ViewTimeline({subject:n.target,axis:r}):je({container:t,...n})}else ve()?i[a]=new ScrollTimeline({source:t,axis:r}):i[a]=je({container:t,...n});return i[a]}function Ce(e,{axis:t="y",container:n=document.scrollingElement,...r}={}){if(!n)return i;const s={axis:t,container:n,...r};return"function"==typeof e?function(e,t){return function(e){return 2===e.length}(e)?Fe(n=>{e(n[t.axis].progress,n)},t):me(e,Ue(t))}(e,s):function(e,t){const n=Ue(t),r=t.target?qe(t.offset):void 0,s=t.target?ve(t.target)&&!!r:ve();return e.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:e=>(e.pause(),me(t=>{e.time=e.iterationDuration*t},n))})}(e,s)}export{Ce as scroll}; | ||
| const e=(e,t,n)=>n>t?t:n<e?e:n;function t(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let n=()=>{},r=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(n=(e,n,r)=>{e||"undefined"==typeof console||console.warn(t(n,r))},r=(e,n,r)=>{if(!e)throw new Error(t(n,r))});const s={},o=e=>"object"==typeof e&&null!==e;const i=e=>e,a=(...e)=>e.reduce((e,t)=>n=>t(e(n))),c=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1},l=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function u(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=l.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,s=!1;const o=new WeakSet;let i={delta:0,timestamp:0,isProcessing:!1};function a(t){o.has(t)&&(c.schedule(t),e()),t(i)}const c={schedule:(e,s=!1,i=!1)=>{const a=i&&r?t:n;return s&&o.add(e),a.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(i=e,r)return void(s=!0);r=!0;const o=t;t=n,n=o,t.forEach(a),t.clear(),r=!1,s&&(s=!1,c.process(e))}};return c}(i),e),{}),{setup:c,read:u,resolveKeyframes:f,preUpdate:d,update:g,preRender:h,render:p,postRender:m}=a,v=()=>{const i=s.useManualTiming,a=i?o.timestamp:performance.now();n=!1,i||(o.delta=r?1e3/60:Math.max(Math.min(a-o.timestamp,40),1)),o.timestamp=a,o.isProcessing=!0,c.process(o),u.process(o),f.process(o),d.process(o),g.process(o),h.process(o),p.process(o),m.process(o),o.isProcessing=!1,n&&t&&(r=!1,e(v))};return{schedule:l.reduce((t,s)=>{const i=a[s];return t[s]=(t,s=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||e(v)),i.schedule(t,s,a)),t},{}),cancel:e=>{for(let t=0;t<l.length;t++)a[l[t]].cancel(e)},state:o,steps:a}}const{schedule:f,cancel:d,state:g}=u("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:i,!0),h=(e=>t=>"string"==typeof t&&t.startsWith(e))("var(--"),p=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,m={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},v={...m,transform:t=>e(0,1,t)},y=e=>Math.round(1e5*e)/1e5,w=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const b=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,x=(e,t)=>n=>Boolean("string"==typeof n&&b.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),E=(e,t,n)=>r=>{if("string"!=typeof r)return r;const[s,o,i,a]=r.match(w);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(i),alpha:void 0!==a?parseFloat(a):1}},W={...m,transform:t=>Math.round((t=>e(0,255,t))(t))},L={test:x("rgb","red"),parse:E("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+W.transform(e)+", "+W.transform(t)+", "+W.transform(n)+", "+y(v.transform(r))+")"};const A={test:x("#"),parse:function(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}},transform:L.transform},S=(e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}))("%"),M={test:x("hsl","hue"),parse:E("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+S.transform(y(t))+", "+S.transform(y(n))+", "+y(v.transform(r))+")"},B={test:e=>L.test(e)||A.test(e)||M.test(e),parse:e=>L.test(e)?L.parse(e):M.test(e)?M.parse(e):A.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?L.transform(e):M.transform(e),getAnimatableNone:e=>{const t=B.parse(e);return t.alpha=0,B.transform(t)}},T=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const $="number",O="color",H=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function z(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let o=0;const i=t.replace(H,e=>(B.test(e)?(r.color.push(o),s.push(O),n.push(B.parse(e))):e.startsWith("var(")?(r.var.push(o),s.push("var"),n.push(e)):(r.number.push(o),s.push($),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:i,indexes:r,types:s}}function F({split:e,types:t}){const n=e.length;return r=>{let s="";for(let o=0;o<n;o++)if(s+=e[o],void 0!==r[o]){const e=t[o];s+=e===$?y(r[o]):e===O?B.transform(r[o]):r[o]}return s}}const N=(e,t)=>{return"number"==typeof e?t?.trim().endsWith("/")?e:0:"number"==typeof(n=e)?0:B.test(n)?B.getAnimatableNone(n):n;var n};const k={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(w)?.length||0)+(e.match(T)?.length||0)>0},parse:function(e){return z(e).values},createTransformer:function(e){return F(z(e))},getAnimatableNone:function(e){const t=z(e);return F(t)(t.values.map((e,n)=>N(e,t.split[n])))}};function P(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function R(e,t){return n=>n>0?t:e}const q=(e,t,n)=>e+(t-e)*n,V=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},j=[A,L,M];function U(e){const t=(r=e,j.find(e=>e.test(r)));var r;if(n(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(t))return!1;let s=t.parse(e);return t===M&&(s=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let s=0,o=0,i=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;s=P(a,r,e+1/3),o=P(a,r,e),i=P(a,r,e-1/3)}else s=o=i=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*i),alpha:r}}(s)),s}const C=(e,t)=>{const n=U(e),r=U(t);if(!n||!r)return R(e,t);const s={...n};return e=>(s.red=V(n.red,r.red,e),s.green=V(n.green,r.green,e),s.blue=V(n.blue,r.blue,e),s.alpha=q(n.alpha,r.alpha,e),L.transform(s))},G=new Set(["none","hidden"]);function I(e,t){return n=>q(e,t,n)}function D(e){return"number"==typeof e?I:"string"==typeof e?h(t=e)&&p.test(t.split("/*")[0].trim())?R:B.test(e)?C:J:Array.isArray(e)?K:"object"==typeof e?B.test(e)?C:_:R;var t}function K(e,t){const n=[...e],r=n.length,s=e.map((e,n)=>D(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=s[t](e);return n}}function _(e,t){const n={...e,...t},r={};for(const s in n)void 0!==e[s]&&void 0!==t[s]&&(r[s]=D(e[s])(e[s],t[s]));return e=>{for(const t in r)n[t]=r[t](e);return n}}const J=(e,t)=>{const r=k.createTransformer(t),s=z(e),o=z(t);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?G.has(e)&&!o.values.length||G.has(t)&&!s.values.length?function(e,t){return G.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):a(K(function(e,t){const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][r[o]],a=e.values[i]??0;n[s]=a,r[o]++}return n}(s,o),o.values),r):(n(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),R(e,t))};function Q(e,t,n){if("number"==typeof e&&"number"==typeof t&&"number"==typeof n)return q(e,t,n);return D(e)(e,t)}function X(t,n,{clamp:o=!0,ease:l,mixer:u}={}){const f=t.length;if(r(f===n.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>n[0];if(2===f&&n[0]===n[1])return()=>n[1];const d=t[0]===t[1];t[0]>t[f-1]&&(t=[...t].reverse(),n=[...n].reverse());const g=function(e,t,n){const r=[],o=n||s.mix||Q,c=e.length-1;for(let n=0;n<c;n++){let s=o(e[n],e[n+1]);if(t){const e=Array.isArray(t)?t[n]||i:t;s=a(e,s)}r.push(s)}return r}(n,l,u),h=g.length,p=e=>{if(d&&e<t[0])return n[0];let r=0;if(h>1)for(;r<t.length-2&&!(e<t[r+1]);r++);const s=c(t[r],t[r+1],e);return g[r](s)};return o?n=>p(e(t[0],t[f-1],n)):p}function Y(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=c(0,t,r);e.push(q(n,1,s))}}(t,e.length-1),t}const Z={};function ee(e,t){const n=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(e);return()=>Z[t]??n()}const te=ee(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),ne=ee(()=>void 0!==window.ViewTimeline,"viewTimeline");function re(e){return o(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const se=new WeakMap;let oe;const ie=(e,t,n)=>(r,s)=>{return s&&s[0]?s[0][e+"Size"]:o(i=r)&&"ownerSVGElement"in i&&"getBBox"in r?r.getBBox()[t]:r[n];var i},ae=ie("inline","width","offsetWidth"),ce=ie("block","height","offsetHeight");function le({target:e,borderBoxSize:t}){se.get(e)?.forEach(n=>{n(e,{get width(){return ae(e,t)},get height(){return ce(e,t)}})})}function ue(e){e.forEach(le)}function fe(e,t){oe||"undefined"!=typeof ResizeObserver&&(oe=new ResizeObserver(ue));const n=function(e){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){const t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e).filter(e=>null!=e)}(e);return n.forEach(e=>{let n=se.get(e);n||(n=new Set,se.set(e,n)),n.add(t),oe?.observe(e)}),()=>{n.forEach(e=>{const n=se.get(e);n?.delete(t),n?.size||oe?.unobserve(e)})}}const de=new Set;let ge;function he(e){return de.add(e),ge||(ge=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};de.forEach(t=>t(e))},window.addEventListener("resize",ge)),()=>{de.delete(e),de.size||"function"!=typeof ge||(window.removeEventListener("resize",ge),ge=void 0)}}function pe(e,t){let n;const r=()=>{const{currentTime:r}=t,s=(null===r?0:r.value)/100;n!==s&&e(s),n=s};return f.preUpdate(r,!0),()=>d(r)}function me(e){return"undefined"!=typeof window&&(e?ne():te())}const ve={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function ye(e,t,n,r){const s=n[t],{length:o,position:i}=ve[t],a=s.current,l=n.time;s.current=Math.abs(e[`scroll${i}`]),s.scrollLength=e[`scroll${o}`]-e[`client${o}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=c(0,s.scrollLength,s.current);const u=r-l;var f,d;s.velocity=u>50?0:(f=s.current-a,(d=u)?f*(1e3/d):0)}const we={start:0,center:.5,end:1};function be(e,t,n=0){let r=0;if(e in we&&(e=we[e]),"string"==typeof e){const t=parseFloat(e);e.endsWith("px")?r=t:e.endsWith("%")?e=t/100:e.endsWith("vw")?r=t/100*document.documentElement.clientWidth:e.endsWith("vh")?r=t/100*document.documentElement.clientHeight:e=t}return"number"==typeof e&&(r=t*e),n+r}const xe=[0,0];function Ee(e,t,n,r){let s=Array.isArray(e)?e:xe,o=0,i=0;return"number"==typeof e?s=[e,e]:"string"==typeof e&&(s=(e=e.trim()).includes(" ")?e.split(" "):[e,we[e]?e:"0"]),o=be(s[0],n,r),i=be(s[1],t),o-i}const We={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Le={x:0,y:0};function Ae(t,n,r){const{offset:s=We.All}=r,{target:o=t,axis:i="y"}=r,a="y"===i?"height":"width",c=o!==t?function(e,t){const n={x:0,y:0};let r=e;for(;r&&r!==t;)if(re(r))n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if("svg"===r.tagName){const e=r.getBoundingClientRect();r=r.parentElement;const t=r.getBoundingClientRect();n.x+=e.left-t.left,n.y+=e.top-t.top}else{if(!(r instanceof SVGGraphicsElement))break;{const{x:e,y:t}=r.getBBox();n.x+=e,n.y+=t;let s=null,o=r.parentNode;for(;!s;)"svg"===o.tagName&&(s=o),o=r.parentNode;r=s}}return n}(o,t):Le,l=o===t?{width:t.scrollWidth,height:t.scrollHeight}:function(e){return"getBBox"in e&&"svg"!==e.tagName?e.getBBox():{width:e.clientWidth,height:e.clientHeight}}(o),u={width:t.clientWidth,height:t.clientHeight};n[i].offset.length=0;let f=!n[i].interpolate;const d=s.length;for(let e=0;e<d;e++){const t=Ee(s[e],u[a],l[a],c[i]);f||t===n[i].interpolatorOffsets[e]||(f=!0),n[i].offset[e]=t}f&&(n[i].interpolate=X(n[i].offset,Y(s),{clamp:!1}),n[i].interpolatorOffsets=[...n[i].offset]),n[i].progress=e(0,1,n[i].interpolate(n[i].current))}function Se(e,t,n,r={}){return{measure:t=>{!function(e,t=e,n){if(n.x.targetOffset=0,n.y.targetOffset=0,t!==e){let r=t;for(;r&&r!==e;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=t===e?t.scrollWidth:t.clientWidth,n.y.targetLength=t===e?t.scrollHeight:t.clientHeight,n.x.containerLength=e.clientWidth,n.y.containerLength=e.clientHeight}(e,r.target,n),function(e,t,n){ye(e,"x",t,n),ye(e,"y",t,n),t.time=n}(e,n,t),(r.offset||r.target)&&Ae(e,n,r)},notify:()=>t(n)}}const Me=new WeakMap,Be=new WeakMap,Te=new WeakMap,$e=new WeakMap,Oe=new WeakMap,He=e=>e===document.scrollingElement?window:e;function ze(e,{container:t=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!t)return i;let s=Te.get(t);s||(s=new Set,Te.set(t,s));const o=Se(t,e,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},r);if(s.add(o),!Me.has(t)){const e=()=>{for(const e of s)e.measure(g.timestamp);f.preUpdate(n)},n=()=>{for(const e of s)e.notify()},r=()=>f.read(e);Me.set(t,r);const o=He(t);window.addEventListener("resize",r),t!==document.documentElement&&Be.set(t,(c=r,"function"==typeof(a=t)?he(a):fe(a,c))),o.addEventListener("scroll",r),r()}var a,c;if(n&&!Oe.has(t)){const e=Me.get(t),n={width:t.scrollWidth,height:t.scrollHeight};$e.set(t,n);const r=()=>{const r=t.scrollWidth,s=t.scrollHeight;n.width===r&&n.height===s||(e(),n.width=r,n.height=s)},s=f.read(r,!0);Oe.set(t,s)}const l=Me.get(t);return f.read(l,!1,!0),()=>{d(l);const e=Te.get(t);if(!e)return;if(e.delete(o),e.size)return;const n=Me.get(t);Me.delete(t),n&&(He(t).removeEventListener("scroll",n),Be.get(t)?.(),window.removeEventListener("resize",n));const r=Oe.get(t);r&&(d(r),Oe.delete(t)),$e.delete(t)}}const Fe=[[We.Enter,"entry"],[We.Exit,"exit"],[We.Any,"cover"],[We.All,"contain"]],Ne={start:0,end:1};function ke(e){const t=e.trim().split(/\s+/);if(2!==t.length)return;const n=Ne[t[0]],r=Ne[t[1]];return void 0!==n&&void 0!==r?[n,r]:void 0}function Pe(e,t){const n=function(e){if(2!==e.length)return;const t=[];for(const n of e)if(Array.isArray(n))t.push(n);else{if("string"!=typeof n)return;{const e=ke(n);if(!e)return;t.push(e)}}return t}(e);if(!n)return!1;for(let e=0;e<2;e++){const r=n[e],s=t[e];if(r[0]!==s[0]||r[1]!==s[1])return!1}return!0}function Re(e){if(!e)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[t,n]of Fe)if(Pe(e,t))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const qe=new Map;function Ve(e){const t={value:0},n=ze(n=>{t.value=100*n[e.axis].progress},e);return{currentTime:t,cancel:n}}function je({source:e,container:t,...n}){const{axis:r}=n;e&&(t=e);let s=qe.get(t);s||(s=new Map,qe.set(t,s));const o=n.target??"self";let i=s.get(o);i||(i={},s.set(o,i));const a=r+(n.offset??[]).join(",");if(!i[a])if(n.target&&me(n.target)){const e=Re(n.offset);i[a]=e?new ViewTimeline({subject:n.target,axis:r}):Ve({container:t,...n})}else me()?i[a]=new ScrollTimeline({source:t,axis:r}):i[a]=Ve({container:t,...n});return i[a]}function Ue(e,{axis:t="y",container:n=document.scrollingElement,...r}={}){if(!n)return i;const s={axis:t,container:n,...r};return"function"==typeof e?function(e,t){return function(e){return 2===e.length}(e)||function(e){return e&&(e.target||e.offset)}(t)?ze(n=>{e(n[t.axis].progress,n)},t):pe(e,je(t))}(e,s):function(e,t){const n=je(t),r=t.target?Re(t.offset):void 0,s=t.target?me(t.target)&&!!r:me();return e.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:e=>(e.pause(),pe(t=>{e.time=e.iterationDuration*t},n))})}(e,s)}export{Ue as scroll}; | ||
| //# sourceMappingURL=size-rollup-scroll.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"size-rollup-waapi-animate.js","sources":["../../motion-utils/dist/es/errors.mjs","../../motion-utils/dist/es/format-error-message.mjs","../../motion-utils/dist/es/noop.mjs","../../motion-utils/dist/es/time-conversion.mjs","../../motion-dom/dist/es/animation/keyframes/get-final.mjs","../../motion-dom/dist/es/animation/utils/WithPromise.mjs","../../motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs","../../motion-dom/dist/es/render/dom/is-css-var.mjs","../../motion-dom/dist/es/utils/supports/flags.mjs","../../motion-dom/dist/es/utils/supports/memo.mjs","../../motion-utils/dist/es/memo.mjs","../../motion-dom/dist/es/utils/supports/scroll-timeline.mjs","../../motion-dom/dist/es/utils/supports/linear-easing.mjs","../../motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs","../../motion-dom/dist/es/animation/waapi/easing/supported.mjs","../../motion-dom/dist/es/animation/waapi/easing/map-easing.mjs","../../motion-dom/dist/es/animation/waapi/utils/linear.mjs","../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs","../../motion-dom/dist/es/animation/NativeAnimation.mjs","../../motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs","../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs","../../motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs","../../motion-dom/dist/es/render/dom/style-set.mjs","../../motion-dom/dist/es/animation/GroupAnimation.mjs","../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs","../../motion-dom/dist/es/animation/utils/active-animations.mjs","../../motion-dom/dist/es/animation/utils/get-value-transition.mjs","../../motion-dom/dist/es/animation/utils/resolve-transition.mjs","../../motion-dom/dist/es/animation/waapi/utils/px-values.mjs","../../motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs","../../motion-dom/dist/es/render/dom/style-computed.mjs","../lib/animation/animators/waapi/animate-elements.js","../../motion-dom/dist/es/utils/resolve-elements.mjs","../lib/animation/animators/waapi/animate-style.js"],"sourcesContent":["import { formatErrorMessage } from './format-error-message.mjs';\n\nlet warning = () => { };\nlet invariant = () => { };\nif (typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\") {\n warning = (check, message, errorCode) => {\n if (!check && typeof console !== \"undefined\") {\n console.warn(formatErrorMessage(message, errorCode));\n }\n };\n invariant = (check, message, errorCode) => {\n if (!check) {\n throw new Error(formatErrorMessage(message, errorCode));\n }\n };\n}\n\nexport { invariant, warning };\n//# sourceMappingURL=errors.mjs.map\n","function formatErrorMessage(message, errorCode) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message;\n}\n\nexport { formatErrorMessage };\n//# sourceMappingURL=format-error-message.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n//# sourceMappingURL=noop.mjs.map\n","/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\n/*#__NO_SIDE_EFFECTS__*/\nconst secondsToMilliseconds = (seconds) => seconds * 1000;\n/*#__NO_SIDE_EFFECTS__*/\nconst millisecondsToSeconds = (milliseconds) => milliseconds / 1000;\n\nexport { millisecondsToSeconds, secondsToMilliseconds };\n//# sourceMappingURL=time-conversion.mjs.map\n","const isNotNull = (value) => value !== null;\nfunction getFinalKeyframe(keyframes, { repeat, repeatType = \"loop\" }, finalKeyframe, speed = 1) {\n const resolvedKeyframes = keyframes.filter(isNotNull);\n const useFirstKeyframe = speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1);\n const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1;\n return !index || finalKeyframe === undefined\n ? resolvedKeyframes[index]\n : finalKeyframe;\n}\n\nexport { getFinalKeyframe };\n//# sourceMappingURL=get-final.mjs.map\n","class WithPromise {\n constructor() {\n this.updateFinished();\n }\n get finished() {\n return this._finished;\n }\n updateFinished() {\n this._finished = new Promise((resolve) => {\n this.resolve = resolve;\n });\n }\n notifyFinished() {\n this.resolve();\n }\n /**\n * Allows the animation to be awaited.\n *\n * @deprecated Use `finished` instead.\n */\n then(onResolve, onReject) {\n return this.finished.then(onResolve, onReject);\n }\n}\n\nexport { WithPromise };\n//# sourceMappingURL=WithPromise.mjs.map\n","function fillWildcards(keyframes) {\n for (let i = 1; i < keyframes.length; i++) {\n keyframes[i] ?? (keyframes[i] = keyframes[i - 1]);\n }\n}\n\nexport { fillWildcards };\n//# sourceMappingURL=fill-wildcards.mjs.map\n","const isCSSVar = (name) => name.startsWith(\"--\");\n\nexport { isCSSVar };\n//# sourceMappingURL=is-css-var.mjs.map\n","/**\n * Add the ability for test suites to manually set support flags\n * to better test more environments.\n */\nconst supportsFlags = {};\n\nexport { supportsFlags };\n//# sourceMappingURL=flags.mjs.map\n","import { memo } from 'motion-utils';\nimport { supportsFlags } from './flags.mjs';\n\nfunction memoSupports(callback, supportsFlag) {\n const memoized = memo(callback);\n return () => supportsFlags[supportsFlag] ?? memoized();\n}\n\nexport { memoSupports };\n//# sourceMappingURL=memo.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nfunction memo(callback) {\n let result;\n return () => {\n if (result === undefined)\n result = callback();\n return result;\n };\n}\n\nexport { memo };\n//# sourceMappingURL=memo.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, \"scrollTimeline\");\nconst supportsViewTimeline = /* @__PURE__ */ memoSupports(() => window.ViewTimeline !== undefined, \"viewTimeline\");\n\nexport { supportsScrollTimeline, supportsViewTimeline };\n//# sourceMappingURL=scroll-timeline.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {\n try {\n document\n .createElement(\"div\")\n .animate({ opacity: 0 }, { easing: \"linear(0, 1)\" });\n }\n catch (e) {\n return false;\n }\n return true;\n}, \"linearEasing\");\n\nexport { supportsLinearEasing };\n//# sourceMappingURL=linear-easing.mjs.map\n","const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;\n\nexport { cubicBezierAsString };\n//# sourceMappingURL=cubic-bezier.mjs.map\n","import { cubicBezierAsString } from './cubic-bezier.mjs';\n\nconst supportedWaapiEasing = {\n linear: \"linear\",\n ease: \"ease\",\n easeIn: \"ease-in\",\n easeOut: \"ease-out\",\n easeInOut: \"ease-in-out\",\n circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),\n circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),\n backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),\n backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),\n};\n\nexport { supportedWaapiEasing };\n//# sourceMappingURL=supported.mjs.map\n","import { isBezierDefinition } from 'motion-utils';\nimport { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { generateLinearEasing } from '../utils/linear.mjs';\nimport { cubicBezierAsString } from './cubic-bezier.mjs';\nimport { supportedWaapiEasing } from './supported.mjs';\n\nfunction mapEasingToNativeEasing(easing, duration) {\n if (!easing) {\n return undefined;\n }\n else if (typeof easing === \"function\") {\n return supportsLinearEasing()\n ? generateLinearEasing(easing, duration)\n : \"ease-out\";\n }\n else if (isBezierDefinition(easing)) {\n return cubicBezierAsString(easing);\n }\n else if (Array.isArray(easing)) {\n return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||\n supportedWaapiEasing.easeOut);\n }\n else {\n return supportedWaapiEasing[easing];\n }\n}\n\nexport { mapEasingToNativeEasing };\n//# sourceMappingURL=map-easing.mjs.map\n","const generateLinearEasing = (easing, duration, // as milliseconds\nresolution = 10 // as milliseconds\n) => {\n let points = \"\";\n const numPoints = Math.max(Math.round(duration / resolution), 2);\n for (let i = 0; i < numPoints; i++) {\n points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + \", \";\n }\n return `linear(${points.substring(0, points.length - 2)})`;\n};\n\nexport { generateLinearEasing };\n//# sourceMappingURL=linear.mjs.map\n","const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === \"number\";\n\nexport { isBezierDefinition };\n//# sourceMappingURL=is-bezier-definition.mjs.map\n","import { invariant, millisecondsToSeconds, secondsToMilliseconds, noop } from 'motion-utils';\nimport { setStyle } from '../render/dom/style-set.mjs';\nimport { supportsScrollTimeline } from '../utils/supports/scroll-timeline.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\nimport { startWaapiAnimation } from './waapi/start-waapi-animation.mjs';\nimport { applyGeneratorOptions } from './waapi/utils/apply-generator.mjs';\n\n/**\n * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.\n */\nclass NativeAnimation extends WithPromise {\n constructor(options) {\n super();\n this.finishedTime = null;\n this.isStopped = false;\n /**\n * Tracks a manually-set start time that takes precedence over WAAPI's\n * dynamic startTime. This is cleared when play() or time setter is called,\n * allowing WAAPI to take over timing.\n */\n this.manualStartTime = null;\n if (!options)\n return;\n const { element, name, keyframes, pseudoElement, allowFlatten = false, finalKeyframe, onComplete, } = options;\n this.isPseudoElement = Boolean(pseudoElement);\n this.allowFlatten = allowFlatten;\n this.options = options;\n invariant(typeof options.type !== \"string\", `Mini animate() doesn't support \"type\" as a string.`, \"mini-spring\");\n const transition = applyGeneratorOptions(options);\n this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement);\n if (transition.autoplay === false) {\n this.animation.pause();\n }\n this.animation.onfinish = () => {\n this.finishedTime = this.time;\n if (!pseudoElement) {\n const keyframe = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n if (this.updateMotionValue) {\n this.updateMotionValue(keyframe);\n }\n /**\n * If we can, we want to commit the final style as set by the user,\n * rather than the computed keyframe value supplied by the animation.\n * We always do this, even when a motion value is present, to prevent\n * a visual flash in Firefox where the WAAPI animation's fill is removed\n * during cancel() before the scheduled render can apply the correct value.\n */\n setStyle(element, name, keyframe);\n this.animation.cancel();\n }\n onComplete?.();\n this.notifyFinished();\n };\n }\n play() {\n if (this.isStopped)\n return;\n this.manualStartTime = null;\n this.animation.play();\n if (this.state === \"finished\") {\n this.updateFinished();\n }\n }\n pause() {\n this.animation.pause();\n }\n complete() {\n this.animation.finish?.();\n }\n cancel() {\n try {\n this.animation.cancel();\n }\n catch (e) { }\n }\n stop() {\n if (this.isStopped)\n return;\n this.isStopped = true;\n const { state } = this;\n if (state === \"idle\" || state === \"finished\") {\n return;\n }\n if (this.updateMotionValue) {\n this.updateMotionValue();\n }\n else {\n this.commitStyles();\n }\n if (!this.isPseudoElement)\n this.cancel();\n }\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * In this method, we commit styles back to the DOM before cancelling\n * the animation.\n *\n * This is designed to be overridden by NativeAnimationExtended, which\n * will create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to also correctly calculate velocity for any subsequent animation\n * while deferring the commit until the next animation frame.\n */\n commitStyles() {\n const element = this.options?.element;\n if (!this.isPseudoElement && element?.isConnected) {\n this.animation.commitStyles?.();\n }\n }\n get duration() {\n const duration = this.animation.effect?.getComputedTiming?.().duration || 0;\n return millisecondsToSeconds(Number(duration));\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(Number(this.animation.currentTime) || 0);\n }\n set time(newTime) {\n const wasFinished = this.finishedTime !== null;\n this.manualStartTime = null;\n this.finishedTime = null;\n this.animation.currentTime = secondsToMilliseconds(newTime);\n if (wasFinished) {\n this.animation.pause();\n }\n }\n /**\n * The playback speed of the animation.\n * 1 = normal speed, 2 = double speed, 0.5 = half speed.\n */\n get speed() {\n return this.animation.playbackRate;\n }\n set speed(newSpeed) {\n // Allow backwards playback after finishing\n if (newSpeed < 0)\n this.finishedTime = null;\n this.animation.playbackRate = newSpeed;\n }\n get state() {\n return this.finishedTime !== null\n ? \"finished\"\n : this.animation.playState;\n }\n get startTime() {\n return this.manualStartTime ?? Number(this.animation.startTime);\n }\n set startTime(newStartTime) {\n this.manualStartTime = this.animation.startTime = newStartTime;\n }\n /**\n * Attaches a timeline to the animation, for instance the `ScrollTimeline`.\n */\n attachTimeline({ timeline, rangeStart, rangeEnd, observe, }) {\n if (this.allowFlatten) {\n this.animation.effect?.updateTiming({ easing: \"linear\" });\n }\n this.animation.onfinish = null;\n if (timeline && supportsScrollTimeline()) {\n this.animation.timeline = timeline;\n if (rangeStart)\n this.animation.rangeStart = rangeStart;\n if (rangeEnd)\n this.animation.rangeEnd = rangeEnd;\n return noop;\n }\n else {\n return observe(this);\n }\n }\n}\n\nexport { NativeAnimation };\n//# sourceMappingURL=NativeAnimation.mjs.map\n","import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { isGenerator } from '../../generators/utils/is-generator.mjs';\n\nfunction applyGeneratorOptions({ type, ...options }) {\n if (isGenerator(type) && supportsLinearEasing()) {\n return type.applyToOptions(options);\n }\n else {\n options.duration ?? (options.duration = 300);\n options.ease ?? (options.ease = \"easeOut\");\n }\n return options;\n}\n\nexport { applyGeneratorOptions };\n//# sourceMappingURL=apply-generator.mjs.map\n","function isGenerator(type) {\n return typeof type === \"function\" && \"applyToOptions\" in type;\n}\n\nexport { isGenerator };\n//# sourceMappingURL=is-generator.mjs.map\n","import { activeAnimations } from '../../stats/animation-count.mjs';\nimport { statsBuffer } from '../../stats/buffer.mjs';\nimport { mapEasingToNativeEasing } from './easing/map-easing.mjs';\n\nfunction startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = \"loop\", ease = \"easeOut\", times, } = {}, pseudoElement = undefined) {\n const keyframeOptions = {\n [valueName]: keyframes,\n };\n if (times)\n keyframeOptions.offset = times;\n const easing = mapEasingToNativeEasing(ease, duration);\n /**\n * If this is an easing array, apply to keyframes, not animation as a whole\n */\n if (Array.isArray(easing))\n keyframeOptions.easing = easing;\n if (statsBuffer.value) {\n activeAnimations.waapi++;\n }\n const options = {\n delay,\n duration,\n easing: !Array.isArray(easing) ? easing : \"linear\",\n fill: \"both\",\n iterations: repeat + 1,\n direction: repeatType === \"reverse\" ? \"alternate\" : \"normal\",\n };\n if (pseudoElement)\n options.pseudoElement = pseudoElement;\n const animation = element.animate(keyframeOptions, options);\n if (statsBuffer.value) {\n animation.finished.finally(() => {\n activeAnimations.waapi--;\n });\n }\n return animation;\n}\n\nexport { startWaapiAnimation };\n//# sourceMappingURL=start-waapi-animation.mjs.map\n","import { isCSSVar } from './is-css-var.mjs';\n\nfunction setStyle(element, name, value) {\n isCSSVar(name)\n ? element.style.setProperty(name, value)\n : (element.style[name] = value);\n}\n\nexport { setStyle };\n//# sourceMappingURL=style-set.mjs.map\n","class GroupAnimation {\n constructor(animations) {\n // Bound to accomadate common `return animation.stop` pattern\n this.stop = () => this.runAll(\"stop\");\n this.animations = animations.filter(Boolean);\n }\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n /**\n * TODO: Filter out cancelled or stopped animations before returning\n */\n getAll(propName) {\n return this.animations[0][propName];\n }\n setAll(propName, newValue) {\n for (let i = 0; i < this.animations.length; i++) {\n this.animations[i][propName] = newValue;\n }\n }\n attachTimeline(timeline) {\n const subscriptions = this.animations.map((animation) => animation.attachTimeline(timeline));\n return () => {\n subscriptions.forEach((cancel, i) => {\n cancel && cancel();\n this.animations[i].stop();\n });\n };\n }\n get time() {\n return this.getAll(\"time\");\n }\n set time(time) {\n this.setAll(\"time\", time);\n }\n get speed() {\n return this.getAll(\"speed\");\n }\n set speed(speed) {\n this.setAll(\"speed\", speed);\n }\n get state() {\n return this.getAll(\"state\");\n }\n get startTime() {\n return this.getAll(\"startTime\");\n }\n get duration() {\n return getMax(this.animations, \"duration\");\n }\n get iterationDuration() {\n return getMax(this.animations, \"iterationDuration\");\n }\n runAll(methodName) {\n this.animations.forEach((controls) => controls[methodName]());\n }\n play() {\n this.runAll(\"play\");\n }\n pause() {\n this.runAll(\"pause\");\n }\n cancel() {\n this.runAll(\"cancel\");\n }\n complete() {\n this.runAll(\"complete\");\n }\n}\nfunction getMax(animations, propName) {\n let max = 0;\n for (let i = 0; i < animations.length; i++) {\n const value = animations[i][propName];\n if (value !== null && value > max) {\n max = value;\n }\n }\n return max;\n}\n\nexport { GroupAnimation };\n//# sourceMappingURL=GroupAnimation.mjs.map\n","import { GroupAnimation } from './GroupAnimation.mjs';\n\nclass GroupAnimationWithThen extends GroupAnimation {\n then(onResolve, _onReject) {\n return this.finished.finally(onResolve).then(() => { });\n }\n}\n\nexport { GroupAnimationWithThen };\n//# sourceMappingURL=GroupAnimationWithThen.mjs.map\n","const animationMaps = new WeakMap();\nconst animationMapKey = (name, pseudoElement = \"\") => `${name}:${pseudoElement}`;\nfunction getAnimationMap(element) {\n let map = animationMaps.get(element);\n if (!map) {\n map = new Map();\n animationMaps.set(element, map);\n }\n return map;\n}\n\nexport { animationMapKey, getAnimationMap };\n//# sourceMappingURL=active-animations.mjs.map\n","import { resolveTransition } from './resolve-transition.mjs';\n\nfunction getValueTransition(transition, key) {\n const valueTransition = transition?.[key] ??\n transition?.[\"default\"] ??\n transition;\n if (valueTransition !== transition) {\n return resolveTransition(valueTransition, transition);\n }\n return valueTransition;\n}\n\nexport { getValueTransition };\n//# sourceMappingURL=get-value-transition.mjs.map\n","/**\n * If `transition` has `inherit: true`, shallow-merge it with\n * `parentTransition` (child keys win) and strip the `inherit` key.\n * Otherwise return `transition` unchanged.\n */\nfunction resolveTransition(transition, parentTransition) {\n if (transition?.inherit && parentTransition) {\n const { inherit: _, ...rest } = transition;\n return { ...parentTransition, ...rest };\n }\n return transition;\n}\n\nexport { resolveTransition };\n//# sourceMappingURL=resolve-transition.mjs.map\n","const pxValues = new Set([\n // Border props\n \"borderWidth\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n // Positioning props\n \"width\",\n \"maxWidth\",\n \"height\",\n \"maxHeight\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"inset\",\n \"insetBlock\",\n \"insetBlockStart\",\n \"insetBlockEnd\",\n \"insetInline\",\n \"insetInlineStart\",\n \"insetInlineEnd\",\n // Spacing props\n \"padding\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"paddingBlock\",\n \"paddingBlockStart\",\n \"paddingBlockEnd\",\n \"paddingInline\",\n \"paddingInlineStart\",\n \"paddingInlineEnd\",\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n \"marginBlock\",\n \"marginBlockStart\",\n \"marginBlockEnd\",\n \"marginInline\",\n \"marginInlineStart\",\n \"marginInlineEnd\",\n // Typography\n \"fontSize\",\n // Misc\n \"backgroundPositionX\",\n \"backgroundPositionY\",\n]);\n\nexport { pxValues };\n//# sourceMappingURL=px-values.mjs.map\n","import { pxValues } from '../../waapi/utils/px-values.mjs';\n\nfunction applyPxDefaults(keyframes, name) {\n for (let i = 0; i < keyframes.length; i++) {\n if (typeof keyframes[i] === \"number\" && pxValues.has(name)) {\n keyframes[i] = keyframes[i] + \"px\";\n }\n }\n}\n\nexport { applyPxDefaults };\n//# sourceMappingURL=apply-px-defaults.mjs.map\n","import { isCSSVar } from './is-css-var.mjs';\n\nfunction getComputedStyle(element, name) {\n const computedStyle = window.getComputedStyle(element);\n return isCSSVar(name)\n ? computedStyle.getPropertyValue(name)\n : computedStyle[name];\n}\n\nexport { getComputedStyle };\n//# sourceMappingURL=style-computed.mjs.map\n","import { animationMapKey, applyPxDefaults, fillWildcards, getAnimationMap, getComputedStyle, getValueTransition, NativeAnimation, resolveElements, } from \"motion-dom\";\nimport { invariant, secondsToMilliseconds } from \"motion-utils\";\nexport function animateElements(elementOrSelector, keyframes, options, scope) {\n // Gracefully handle null/undefined elements (e.g., from querySelector returning null)\n if (elementOrSelector == null) {\n return [];\n }\n const elements = resolveElements(elementOrSelector, scope);\n const numElements = elements.length;\n invariant(Boolean(numElements), \"No valid elements provided.\", \"no-valid-elements\");\n /**\n * WAAPI doesn't support interrupting animations.\n *\n * Therefore, starting animations requires a three-step process:\n * 1. Stop existing animations (write styles to DOM)\n * 2. Resolve keyframes (read styles from DOM)\n * 3. Create new animations (write styles to DOM)\n *\n * The hybrid `animate()` function uses AsyncAnimation to resolve\n * keyframes before creating new animations, which removes style\n * thrashing. Here, we have much stricter filesize constraints.\n * Therefore we do this in a synchronous way that ensures that\n * at least within `animate()` calls there is no style thrashing.\n *\n * In the motion-native-animate-mini-interrupt benchmark this\n * was 80% faster than a single loop.\n */\n const animationDefinitions = [];\n /**\n * Step 1: Build options and stop existing animations (write)\n */\n for (let i = 0; i < numElements; i++) {\n const element = elements[i];\n const elementTransition = { ...options };\n /**\n * Resolve stagger function if provided.\n */\n if (typeof elementTransition.delay === \"function\") {\n elementTransition.delay = elementTransition.delay(i, numElements);\n }\n for (const valueName in keyframes) {\n let valueKeyframes = keyframes[valueName];\n if (!Array.isArray(valueKeyframes)) {\n valueKeyframes = [valueKeyframes];\n }\n const valueOptions = {\n ...getValueTransition(elementTransition, valueName),\n };\n valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));\n valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));\n /**\n * If there's an existing animation playing on this element then stop it\n * before creating a new one.\n */\n const map = getAnimationMap(element);\n const key = animationMapKey(valueName, valueOptions.pseudoElement || \"\");\n const currentAnimation = map.get(key);\n currentAnimation && currentAnimation.stop();\n animationDefinitions.push({\n map,\n key,\n unresolvedKeyframes: valueKeyframes,\n options: {\n ...valueOptions,\n element,\n name: valueName,\n allowFlatten: !elementTransition.type && !elementTransition.ease,\n },\n });\n }\n }\n /**\n * Step 2: Resolve keyframes (read)\n */\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { unresolvedKeyframes, options: animationOptions } = animationDefinitions[i];\n const { element, name, pseudoElement } = animationOptions;\n if (!pseudoElement && unresolvedKeyframes[0] === null) {\n unresolvedKeyframes[0] = getComputedStyle(element, name);\n }\n fillWildcards(unresolvedKeyframes);\n applyPxDefaults(unresolvedKeyframes, name);\n /**\n * If we only have one keyframe, explicitly read the initial keyframe\n * from the computed style. This is to ensure consistency with WAAPI behaviour\n * for restarting animations, for instance .play() after finish, when it\n * has one vs two keyframes.\n */\n if (!pseudoElement && unresolvedKeyframes.length < 2) {\n unresolvedKeyframes.unshift(getComputedStyle(element, name));\n }\n animationOptions.keyframes = unresolvedKeyframes;\n }\n /**\n * Step 3: Create new animations (write)\n */\n const animations = [];\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { map, key, options: animationOptions } = animationDefinitions[i];\n const animation = new NativeAnimation(animationOptions);\n map.set(key, animation);\n animation.finished.finally(() => map.delete(key));\n animations.push(animation);\n }\n return animations;\n}\n//# sourceMappingURL=animate-elements.js.map","function resolveElements(elementOrSelector, scope, selectorCache) {\n if (elementOrSelector == null) {\n return [];\n }\n if (elementOrSelector instanceof EventTarget) {\n return [elementOrSelector];\n }\n else if (typeof elementOrSelector === \"string\") {\n let root = document;\n if (scope) {\n root = scope.current;\n }\n const elements = selectorCache?.[elementOrSelector] ??\n root.querySelectorAll(elementOrSelector);\n return elements ? Array.from(elements) : [];\n }\n return Array.from(elementOrSelector).filter((element) => element != null);\n}\n\nexport { resolveElements };\n//# sourceMappingURL=resolve-elements.mjs.map\n","import { GroupAnimationWithThen, } from \"motion-dom\";\nimport { animateElements } from \"./animate-elements\";\nexport const createScopedWaapiAnimate = (scope) => {\n function scopedAnimate(elementOrSelector, keyframes, options) {\n return new GroupAnimationWithThen(animateElements(elementOrSelector, keyframes, options, scope));\n }\n return scopedAnimate;\n};\nexport const animateMini = /*@__PURE__*/ createScopedWaapiAnimate();\n//# sourceMappingURL=animate-style.js.map"],"names":["invariant","process","env","NODE_ENV","check","message","errorCode","Error","formatErrorMessage","noop","any","secondsToMilliseconds","seconds","millisecondsToSeconds","milliseconds","isNotNull","value","WithPromise","constructor","this","updateFinished","finished","_finished","Promise","resolve","notifyFinished","then","onResolve","onReject","fillWildcards","keyframes","i","length","isCSSVar","name","startsWith","supportsFlags","memoSupports","callback","supportsFlag","memoized","result","undefined","memo","supportsScrollTimeline","window","ScrollTimeline","supportsLinearEasing","document","createElement","animate","opacity","easing","e","cubicBezierAsString","a","b","c","d","supportedWaapiEasing","linear","ease","easeIn","easeOut","easeInOut","circIn","circOut","backIn","backOut","mapEasingToNativeEasing","duration","resolution","points","numPoints","Math","max","round","substring","generateLinearEasing","Array","isArray","isBezierDefinition","map","segmentEasing","NativeAnimation","options","super","finishedTime","isStopped","manualStartTime","element","pseudoElement","allowFlatten","finalKeyframe","onComplete","isPseudoElement","Boolean","type","transition","isGenerator","applyToOptions","applyGeneratorOptions","animation","valueName","delay","repeat","repeatType","times","keyframeOptions","offset","fill","iterations","direction","startWaapiAnimation","autoplay","pause","onfinish","time","keyframe","speed","resolvedKeyframes","filter","index","getFinalKeyframe","updateMotionValue","style","setProperty","setStyle","cancel","play","state","complete","finish","stop","commitStyles","isConnected","effect","getComputedTiming","Number","iterationDuration","currentTime","newTime","wasFinished","playbackRate","newSpeed","playState","startTime","newStartTime","attachTimeline","timeline","rangeStart","rangeEnd","observe","updateTiming","GroupAnimation","animations","runAll","all","getAll","propName","setAll","newValue","subscriptions","forEach","getMax","methodName","controls","GroupAnimationWithThen","_onReject","finally","animationMaps","WeakMap","animationMapKey","getAnimationMap","get","Map","set","getValueTransition","key","valueTransition","parentTransition","inherit","_","rest","resolveTransition","pxValues","Set","applyPxDefaults","has","getComputedStyle","computedStyle","getPropertyValue","animateElements","elementOrSelector","scope","elements","EventTarget","root","current","querySelectorAll","from","resolveElements","numElements","animationDefinitions","elementTransition","valueKeyframes","valueOptions","currentAnimation","push","unresolvedKeyframes","animationOptions","unshift","delete","createScopedWaapiAnimate","animateMini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oH,EAAmB7H,EAAI4F,IAAII,GACjC6B,GAAoBA,EAAiB1E,OACrCsE,EAAqBK,KAAK,CACtB9H,MACAgG,MACA+B,oBAAqBJ,EACrBxH,QAAS,IACFyH,EACHpH,UACAxD,KAAMqE,EACNX,cAAegH,EAAkB3G,OAAS2G,EAAkB/I,OAGxE,CACJ,CAIA,IAAK,IAAI9B,EAAI,EAAGA,EAAI4K,EAAqB3K,OAAQD,IAAK,CAClD,MAAMkL,oBAAEA,EAAqB5H,QAAS6H,GAAqBP,EAAqB5K,IAC1E2D,QAAEA,EAAOxD,KAAEA,EAAIyD,cAAEA,GAAkBuH,EACpCvH,GAA4C,OAA3BsH,EAAoB,KACtCA,EAAoB,GAAKpB,EAAiBnG,EAASxD,IAEvDL,EAAcoL,GACdtB,EAAgBsB,EAAqB/K,IAOhCyD,GAAiBsH,EAAoBjL,OAAS,GAC/CiL,EAAoBE,QAAQtB,EAAiBnG,EAASxD,IAE1DgL,EAAiBpL,UAAYmL,CACjC,CAIA,MAAMtD,EAAa,GACnB,IAAK,IAAI5H,EAAI,EAAGA,EAAI4K,EAAqB3K,OAAQD,IAAK,CAClD,MAAMmD,IAAEA,EAAGgG,IAAEA,EAAK7F,QAAS6H,GAAqBP,EAAqB5K,GAC/DuE,EAAY,IAAIlB,EAAgB8H,GACtChI,EAAI8F,IAAIE,EAAK5E,GACbA,EAAUjF,SAASoJ,QAAQ,IAAMvF,EAAIkI,OAAOlC,IAC5CvB,EAAWqD,KAAK1G,EACpB,CACA,OAAOqD,CACX,CEvGY,MAAC0D,EAA4BnB,GACrC,SAAuBD,EAAmBnK,EAAWuD,GACjD,OAAO,IAAIkF,EAAuByB,EAAgBC,EAAmBnK,EAAWuD,EAAS6G,GAC7F,EAGSoB,EAA4BD"} | ||
| {"version":3,"file":"size-rollup-waapi-animate.js","sources":["../../motion-utils/dist/es/errors.mjs","../../motion-utils/dist/es/format-error-message.mjs","../../motion-utils/dist/es/noop.mjs","../../motion-utils/dist/es/time-conversion.mjs","../../motion-dom/dist/es/animation/keyframes/get-final.mjs","../../motion-dom/dist/es/animation/utils/WithPromise.mjs","../../motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs","../../motion-dom/dist/es/render/dom/is-css-var.mjs","../../motion-dom/dist/es/utils/supports/flags.mjs","../../motion-dom/dist/es/utils/supports/memo.mjs","../../motion-utils/dist/es/memo.mjs","../../motion-dom/dist/es/utils/supports/scroll-timeline.mjs","../../motion-dom/dist/es/utils/supports/linear-easing.mjs","../../motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs","../../motion-dom/dist/es/animation/waapi/easing/supported.mjs","../../motion-dom/dist/es/animation/waapi/easing/map-easing.mjs","../../motion-dom/dist/es/animation/waapi/utils/linear.mjs","../../motion-utils/dist/es/easing/utils/is-bezier-definition.mjs","../../motion-dom/dist/es/animation/NativeAnimation.mjs","../../motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs","../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs","../../motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs","../../motion-dom/dist/es/render/dom/style-set.mjs","../../motion-dom/dist/es/animation/GroupAnimation.mjs","../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs","../../motion-dom/dist/es/animation/utils/active-animations.mjs","../../motion-dom/dist/es/animation/utils/get-value-transition.mjs","../../motion-dom/dist/es/animation/utils/resolve-transition.mjs","../../motion-dom/dist/es/animation/waapi/utils/px-values.mjs","../../motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs","../../motion-dom/dist/es/render/dom/style-computed.mjs","../lib/animation/animators/waapi/animate-elements.js","../../motion-dom/dist/es/utils/resolve-elements.mjs","../lib/animation/animators/waapi/animate-style.js"],"sourcesContent":["import { formatErrorMessage } from './format-error-message.mjs';\n\nlet warning = () => { };\nlet invariant = () => { };\nif (typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\") {\n warning = (check, message, errorCode) => {\n if (!check && typeof console !== \"undefined\") {\n console.warn(formatErrorMessage(message, errorCode));\n }\n };\n invariant = (check, message, errorCode) => {\n if (!check) {\n throw new Error(formatErrorMessage(message, errorCode));\n }\n };\n}\n\nexport { invariant, warning };\n//# sourceMappingURL=errors.mjs.map\n","function formatErrorMessage(message, errorCode) {\n return errorCode\n ? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`\n : message;\n}\n\nexport { formatErrorMessage };\n//# sourceMappingURL=format-error-message.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nconst noop = (any) => any;\n\nexport { noop };\n//# sourceMappingURL=noop.mjs.map\n","/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\n/*#__NO_SIDE_EFFECTS__*/\nconst secondsToMilliseconds = (seconds) => seconds * 1000;\n/*#__NO_SIDE_EFFECTS__*/\nconst millisecondsToSeconds = (milliseconds) => milliseconds / 1000;\n\nexport { millisecondsToSeconds, secondsToMilliseconds };\n//# sourceMappingURL=time-conversion.mjs.map\n","const isNotNull = (value) => value !== null;\nfunction getFinalKeyframe(keyframes, { repeat, repeatType = \"loop\" }, finalKeyframe, speed = 1) {\n const resolvedKeyframes = keyframes.filter(isNotNull);\n const useFirstKeyframe = speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1);\n const index = useFirstKeyframe ? 0 : resolvedKeyframes.length - 1;\n return !index || finalKeyframe === undefined\n ? resolvedKeyframes[index]\n : finalKeyframe;\n}\n\nexport { getFinalKeyframe };\n//# sourceMappingURL=get-final.mjs.map\n","class WithPromise {\n constructor() {\n this.updateFinished();\n }\n get finished() {\n return this._finished;\n }\n updateFinished() {\n this._finished = new Promise((resolve) => {\n this.resolve = resolve;\n });\n }\n notifyFinished() {\n this.resolve();\n }\n /**\n * Allows the animation to be awaited.\n *\n * @deprecated Use `finished` instead.\n */\n then(onResolve, onReject) {\n return this.finished.then(onResolve, onReject);\n }\n}\n\nexport { WithPromise };\n//# sourceMappingURL=WithPromise.mjs.map\n","function fillWildcards(keyframes) {\n for (let i = 1; i < keyframes.length; i++) {\n keyframes[i] ?? (keyframes[i] = keyframes[i - 1]);\n }\n}\n\nexport { fillWildcards };\n//# sourceMappingURL=fill-wildcards.mjs.map\n","const isCSSVar = (name) => name.startsWith(\"--\");\n\nexport { isCSSVar };\n//# sourceMappingURL=is-css-var.mjs.map\n","/**\n * Add the ability for test suites to manually set support flags\n * to better test more environments.\n */\nconst supportsFlags = {};\n\nexport { supportsFlags };\n//# sourceMappingURL=flags.mjs.map\n","import { memo } from 'motion-utils';\nimport { supportsFlags } from './flags.mjs';\n\nfunction memoSupports(callback, supportsFlag) {\n const memoized = memo(callback);\n return () => supportsFlags[supportsFlag] ?? memoized();\n}\n\nexport { memoSupports };\n//# sourceMappingURL=memo.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nfunction memo(callback) {\n let result;\n return () => {\n if (result === undefined)\n result = callback();\n return result;\n };\n}\n\nexport { memo };\n//# sourceMappingURL=memo.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== undefined, \"scrollTimeline\");\nconst supportsViewTimeline = /* @__PURE__ */ memoSupports(() => window.ViewTimeline !== undefined, \"viewTimeline\");\n\nexport { supportsScrollTimeline, supportsViewTimeline };\n//# sourceMappingURL=scroll-timeline.mjs.map\n","import { memoSupports } from './memo.mjs';\n\nconst supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {\n try {\n document\n .createElement(\"div\")\n .animate({ opacity: 0 }, { easing: \"linear(0, 1)\" });\n }\n catch (e) {\n return false;\n }\n return true;\n}, \"linearEasing\");\n\nexport { supportsLinearEasing };\n//# sourceMappingURL=linear-easing.mjs.map\n","const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;\n\nexport { cubicBezierAsString };\n//# sourceMappingURL=cubic-bezier.mjs.map\n","import { cubicBezierAsString } from './cubic-bezier.mjs';\n\nconst supportedWaapiEasing = {\n linear: \"linear\",\n ease: \"ease\",\n easeIn: \"ease-in\",\n easeOut: \"ease-out\",\n easeInOut: \"ease-in-out\",\n circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),\n circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),\n backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),\n backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),\n};\n\nexport { supportedWaapiEasing };\n//# sourceMappingURL=supported.mjs.map\n","import { isBezierDefinition } from 'motion-utils';\nimport { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { generateLinearEasing } from '../utils/linear.mjs';\nimport { cubicBezierAsString } from './cubic-bezier.mjs';\nimport { supportedWaapiEasing } from './supported.mjs';\n\nfunction mapEasingToNativeEasing(easing, duration) {\n if (!easing) {\n return undefined;\n }\n else if (typeof easing === \"function\") {\n return supportsLinearEasing()\n ? generateLinearEasing(easing, duration)\n : \"ease-out\";\n }\n else if (isBezierDefinition(easing)) {\n return cubicBezierAsString(easing);\n }\n else if (Array.isArray(easing)) {\n return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||\n supportedWaapiEasing.easeOut);\n }\n else {\n return supportedWaapiEasing[easing];\n }\n}\n\nexport { mapEasingToNativeEasing };\n//# sourceMappingURL=map-easing.mjs.map\n","const generateLinearEasing = (easing, duration, // as milliseconds\nresolution = 10 // as milliseconds\n) => {\n let points = \"\";\n const numPoints = Math.max(Math.round(duration / resolution), 2);\n for (let i = 0; i < numPoints; i++) {\n points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + \", \";\n }\n return `linear(${points.substring(0, points.length - 2)})`;\n};\n\nexport { generateLinearEasing };\n//# sourceMappingURL=linear.mjs.map\n","/*#__NO_SIDE_EFFECTS__*/\nconst isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === \"number\";\n\nexport { isBezierDefinition };\n//# sourceMappingURL=is-bezier-definition.mjs.map\n","import { invariant, millisecondsToSeconds, secondsToMilliseconds, noop } from 'motion-utils';\nimport { setStyle } from '../render/dom/style-set.mjs';\nimport { supportsScrollTimeline } from '../utils/supports/scroll-timeline.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\nimport { startWaapiAnimation } from './waapi/start-waapi-animation.mjs';\nimport { applyGeneratorOptions } from './waapi/utils/apply-generator.mjs';\n\n/**\n * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.\n */\nclass NativeAnimation extends WithPromise {\n constructor(options) {\n super();\n this.finishedTime = null;\n this.isStopped = false;\n /**\n * Tracks a manually-set start time that takes precedence over WAAPI's\n * dynamic startTime. This is cleared when play() or time setter is called,\n * allowing WAAPI to take over timing.\n */\n this.manualStartTime = null;\n if (!options)\n return;\n const { element, name, keyframes, pseudoElement, allowFlatten = false, finalKeyframe, onComplete, } = options;\n this.isPseudoElement = Boolean(pseudoElement);\n this.allowFlatten = allowFlatten;\n this.options = options;\n invariant(typeof options.type !== \"string\", `Mini animate() doesn't support \"type\" as a string.`, \"mini-spring\");\n const transition = applyGeneratorOptions(options);\n this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement);\n if (transition.autoplay === false) {\n this.animation.pause();\n }\n this.animation.onfinish = () => {\n this.finishedTime = this.time;\n if (!pseudoElement) {\n const keyframe = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n if (this.updateMotionValue) {\n this.updateMotionValue(keyframe);\n }\n /**\n * If we can, we want to commit the final style as set by the user,\n * rather than the computed keyframe value supplied by the animation.\n * We always do this, even when a motion value is present, to prevent\n * a visual flash in Firefox where the WAAPI animation's fill is removed\n * during cancel() before the scheduled render can apply the correct value.\n */\n setStyle(element, name, keyframe);\n this.animation.cancel();\n }\n onComplete?.();\n this.notifyFinished();\n };\n }\n play() {\n if (this.isStopped)\n return;\n this.manualStartTime = null;\n this.animation.play();\n if (this.state === \"finished\") {\n this.updateFinished();\n }\n }\n pause() {\n this.animation.pause();\n }\n complete() {\n this.animation.finish?.();\n }\n cancel() {\n try {\n this.animation.cancel();\n }\n catch (e) { }\n }\n stop() {\n if (this.isStopped)\n return;\n this.isStopped = true;\n const { state } = this;\n if (state === \"idle\" || state === \"finished\") {\n return;\n }\n if (this.updateMotionValue) {\n this.updateMotionValue();\n }\n else {\n this.commitStyles();\n }\n if (!this.isPseudoElement)\n this.cancel();\n }\n /**\n * WAAPI doesn't natively have any interruption capabilities.\n *\n * In this method, we commit styles back to the DOM before cancelling\n * the animation.\n *\n * This is designed to be overridden by NativeAnimationExtended, which\n * will create a renderless JS animation and sample it twice to calculate\n * its current value, \"previous\" value, and therefore allow\n * Motion to also correctly calculate velocity for any subsequent animation\n * while deferring the commit until the next animation frame.\n */\n commitStyles() {\n const element = this.options?.element;\n if (!this.isPseudoElement && element?.isConnected) {\n this.animation.commitStyles?.();\n }\n }\n get duration() {\n const duration = this.animation.effect?.getComputedTiming?.().duration || 0;\n return millisecondsToSeconds(Number(duration));\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(Number(this.animation.currentTime) || 0);\n }\n set time(newTime) {\n const wasFinished = this.finishedTime !== null;\n this.manualStartTime = null;\n this.finishedTime = null;\n this.animation.currentTime = secondsToMilliseconds(newTime);\n if (wasFinished) {\n this.animation.pause();\n }\n }\n /**\n * The playback speed of the animation.\n * 1 = normal speed, 2 = double speed, 0.5 = half speed.\n */\n get speed() {\n return this.animation.playbackRate;\n }\n set speed(newSpeed) {\n // Allow backwards playback after finishing\n if (newSpeed < 0)\n this.finishedTime = null;\n this.animation.playbackRate = newSpeed;\n }\n get state() {\n return this.finishedTime !== null\n ? \"finished\"\n : this.animation.playState;\n }\n get startTime() {\n return this.manualStartTime ?? Number(this.animation.startTime);\n }\n set startTime(newStartTime) {\n this.manualStartTime = this.animation.startTime = newStartTime;\n }\n /**\n * Attaches a timeline to the animation, for instance the `ScrollTimeline`.\n */\n attachTimeline({ timeline, rangeStart, rangeEnd, observe, }) {\n if (this.allowFlatten) {\n this.animation.effect?.updateTiming({ easing: \"linear\" });\n }\n this.animation.onfinish = null;\n if (timeline && supportsScrollTimeline()) {\n this.animation.timeline = timeline;\n if (rangeStart)\n this.animation.rangeStart = rangeStart;\n if (rangeEnd)\n this.animation.rangeEnd = rangeEnd;\n return noop;\n }\n else {\n return observe(this);\n }\n }\n}\n\nexport { NativeAnimation };\n//# sourceMappingURL=NativeAnimation.mjs.map\n","import { supportsLinearEasing } from '../../../utils/supports/linear-easing.mjs';\nimport { isGenerator } from '../../generators/utils/is-generator.mjs';\n\nfunction applyGeneratorOptions({ type, ...options }) {\n if (isGenerator(type) && supportsLinearEasing()) {\n return type.applyToOptions(options);\n }\n else {\n options.duration ?? (options.duration = 300);\n options.ease ?? (options.ease = \"easeOut\");\n }\n return options;\n}\n\nexport { applyGeneratorOptions };\n//# sourceMappingURL=apply-generator.mjs.map\n","function isGenerator(type) {\n return typeof type === \"function\" && \"applyToOptions\" in type;\n}\n\nexport { isGenerator };\n//# sourceMappingURL=is-generator.mjs.map\n","import { activeAnimations } from '../../stats/animation-count.mjs';\nimport { statsBuffer } from '../../stats/buffer.mjs';\nimport { mapEasingToNativeEasing } from './easing/map-easing.mjs';\n\nfunction startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = \"loop\", ease = \"easeOut\", times, } = {}, pseudoElement = undefined) {\n const keyframeOptions = {\n [valueName]: keyframes,\n };\n if (times)\n keyframeOptions.offset = times;\n const easing = mapEasingToNativeEasing(ease, duration);\n /**\n * If this is an easing array, apply to keyframes, not animation as a whole\n */\n if (Array.isArray(easing))\n keyframeOptions.easing = easing;\n if (statsBuffer.value) {\n activeAnimations.waapi++;\n }\n const options = {\n delay,\n duration,\n easing: !Array.isArray(easing) ? easing : \"linear\",\n fill: \"both\",\n iterations: repeat + 1,\n direction: repeatType === \"reverse\" ? \"alternate\" : \"normal\",\n };\n if (pseudoElement)\n options.pseudoElement = pseudoElement;\n const animation = element.animate(keyframeOptions, options);\n if (statsBuffer.value) {\n animation.finished.finally(() => {\n activeAnimations.waapi--;\n });\n }\n return animation;\n}\n\nexport { startWaapiAnimation };\n//# sourceMappingURL=start-waapi-animation.mjs.map\n","import { isCSSVar } from './is-css-var.mjs';\n\nfunction setStyle(element, name, value) {\n isCSSVar(name)\n ? element.style.setProperty(name, value)\n : (element.style[name] = value);\n}\n\nexport { setStyle };\n//# sourceMappingURL=style-set.mjs.map\n","class GroupAnimation {\n constructor(animations) {\n // Bound to accomadate common `return animation.stop` pattern\n this.stop = () => this.runAll(\"stop\");\n this.animations = animations.filter(Boolean);\n }\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n /**\n * TODO: Filter out cancelled or stopped animations before returning\n */\n getAll(propName) {\n return this.animations[0][propName];\n }\n setAll(propName, newValue) {\n for (let i = 0; i < this.animations.length; i++) {\n this.animations[i][propName] = newValue;\n }\n }\n attachTimeline(timeline) {\n const subscriptions = this.animations.map((animation) => animation.attachTimeline(timeline));\n return () => {\n subscriptions.forEach((cancel, i) => {\n cancel && cancel();\n this.animations[i].stop();\n });\n };\n }\n get time() {\n return this.getAll(\"time\");\n }\n set time(time) {\n this.setAll(\"time\", time);\n }\n get speed() {\n return this.getAll(\"speed\");\n }\n set speed(speed) {\n this.setAll(\"speed\", speed);\n }\n get state() {\n return this.getAll(\"state\");\n }\n get startTime() {\n return this.getAll(\"startTime\");\n }\n get duration() {\n return getMax(this.animations, \"duration\");\n }\n get iterationDuration() {\n return getMax(this.animations, \"iterationDuration\");\n }\n runAll(methodName) {\n this.animations.forEach((controls) => controls[methodName]());\n }\n play() {\n this.runAll(\"play\");\n }\n pause() {\n this.runAll(\"pause\");\n }\n cancel() {\n this.runAll(\"cancel\");\n }\n complete() {\n this.runAll(\"complete\");\n }\n}\nfunction getMax(animations, propName) {\n let max = 0;\n for (let i = 0; i < animations.length; i++) {\n const value = animations[i][propName];\n if (value !== null && value > max) {\n max = value;\n }\n }\n return max;\n}\n\nexport { GroupAnimation };\n//# sourceMappingURL=GroupAnimation.mjs.map\n","import { GroupAnimation } from './GroupAnimation.mjs';\n\nclass GroupAnimationWithThen extends GroupAnimation {\n then(onResolve, _onReject) {\n return this.finished.finally(onResolve).then(() => { });\n }\n}\n\nexport { GroupAnimationWithThen };\n//# sourceMappingURL=GroupAnimationWithThen.mjs.map\n","const animationMaps = new WeakMap();\nconst animationMapKey = (name, pseudoElement = \"\") => `${name}:${pseudoElement}`;\nfunction getAnimationMap(element) {\n let map = animationMaps.get(element);\n if (!map) {\n map = new Map();\n animationMaps.set(element, map);\n }\n return map;\n}\n\nexport { animationMapKey, getAnimationMap };\n//# sourceMappingURL=active-animations.mjs.map\n","import { resolveTransition } from './resolve-transition.mjs';\n\nfunction getValueTransition(transition, key) {\n const valueTransition = transition?.[key] ??\n transition?.[\"default\"] ??\n transition;\n if (valueTransition !== transition) {\n return resolveTransition(valueTransition, transition);\n }\n return valueTransition;\n}\n\nexport { getValueTransition };\n//# sourceMappingURL=get-value-transition.mjs.map\n","/**\n * If `transition` has `inherit: true`, shallow-merge it with\n * `parentTransition` (child keys win) and strip the `inherit` key.\n * Otherwise return `transition` unchanged.\n */\nfunction resolveTransition(transition, parentTransition) {\n if (transition?.inherit && parentTransition) {\n const { inherit: _, ...rest } = transition;\n return { ...parentTransition, ...rest };\n }\n return transition;\n}\n\nexport { resolveTransition };\n//# sourceMappingURL=resolve-transition.mjs.map\n","const pxValues = new Set([\n // Border props\n \"borderWidth\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomLeftRadius\",\n // Positioning props\n \"width\",\n \"maxWidth\",\n \"height\",\n \"maxHeight\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"inset\",\n \"insetBlock\",\n \"insetBlockStart\",\n \"insetBlockEnd\",\n \"insetInline\",\n \"insetInlineStart\",\n \"insetInlineEnd\",\n // Spacing props\n \"padding\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"paddingBlock\",\n \"paddingBlockStart\",\n \"paddingBlockEnd\",\n \"paddingInline\",\n \"paddingInlineStart\",\n \"paddingInlineEnd\",\n \"margin\",\n \"marginTop\",\n \"marginRight\",\n \"marginBottom\",\n \"marginLeft\",\n \"marginBlock\",\n \"marginBlockStart\",\n \"marginBlockEnd\",\n \"marginInline\",\n \"marginInlineStart\",\n \"marginInlineEnd\",\n // Typography\n \"fontSize\",\n // Misc\n \"backgroundPositionX\",\n \"backgroundPositionY\",\n]);\n\nexport { pxValues };\n//# sourceMappingURL=px-values.mjs.map\n","import { pxValues } from '../../waapi/utils/px-values.mjs';\n\nfunction applyPxDefaults(keyframes, name) {\n for (let i = 0; i < keyframes.length; i++) {\n if (typeof keyframes[i] === \"number\" && pxValues.has(name)) {\n keyframes[i] = keyframes[i] + \"px\";\n }\n }\n}\n\nexport { applyPxDefaults };\n//# sourceMappingURL=apply-px-defaults.mjs.map\n","import { isCSSVar } from './is-css-var.mjs';\n\nfunction getComputedStyle(element, name) {\n const computedStyle = window.getComputedStyle(element);\n return isCSSVar(name)\n ? computedStyle.getPropertyValue(name)\n : computedStyle[name];\n}\n\nexport { getComputedStyle };\n//# sourceMappingURL=style-computed.mjs.map\n","import { animationMapKey, applyPxDefaults, fillWildcards, getAnimationMap, getComputedStyle, getValueTransition, NativeAnimation, resolveElements, } from \"motion-dom\";\nimport { invariant, secondsToMilliseconds } from \"motion-utils\";\nexport function animateElements(elementOrSelector, keyframes, options, scope) {\n // Gracefully handle null/undefined elements (e.g., from querySelector returning null)\n if (elementOrSelector == null) {\n return [];\n }\n const elements = resolveElements(elementOrSelector, scope);\n const numElements = elements.length;\n invariant(Boolean(numElements), \"No valid elements provided.\", \"no-valid-elements\");\n /**\n * WAAPI doesn't support interrupting animations.\n *\n * Therefore, starting animations requires a three-step process:\n * 1. Stop existing animations (write styles to DOM)\n * 2. Resolve keyframes (read styles from DOM)\n * 3. Create new animations (write styles to DOM)\n *\n * The hybrid `animate()` function uses AsyncAnimation to resolve\n * keyframes before creating new animations, which removes style\n * thrashing. Here, we have much stricter filesize constraints.\n * Therefore we do this in a synchronous way that ensures that\n * at least within `animate()` calls there is no style thrashing.\n *\n * In the motion-native-animate-mini-interrupt benchmark this\n * was 80% faster than a single loop.\n */\n const animationDefinitions = [];\n /**\n * Step 1: Build options and stop existing animations (write)\n */\n for (let i = 0; i < numElements; i++) {\n const element = elements[i];\n const elementTransition = { ...options };\n /**\n * Resolve stagger function if provided.\n */\n if (typeof elementTransition.delay === \"function\") {\n elementTransition.delay = elementTransition.delay(i, numElements);\n }\n for (const valueName in keyframes) {\n let valueKeyframes = keyframes[valueName];\n if (!Array.isArray(valueKeyframes)) {\n valueKeyframes = [valueKeyframes];\n }\n const valueOptions = {\n ...getValueTransition(elementTransition, valueName),\n };\n valueOptions.duration && (valueOptions.duration = secondsToMilliseconds(valueOptions.duration));\n valueOptions.delay && (valueOptions.delay = secondsToMilliseconds(valueOptions.delay));\n /**\n * If there's an existing animation playing on this element then stop it\n * before creating a new one.\n */\n const map = getAnimationMap(element);\n const key = animationMapKey(valueName, valueOptions.pseudoElement || \"\");\n const currentAnimation = map.get(key);\n currentAnimation && currentAnimation.stop();\n animationDefinitions.push({\n map,\n key,\n unresolvedKeyframes: valueKeyframes,\n options: {\n ...valueOptions,\n element,\n name: valueName,\n allowFlatten: !elementTransition.type && !elementTransition.ease,\n },\n });\n }\n }\n /**\n * Step 2: Resolve keyframes (read)\n */\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { unresolvedKeyframes, options: animationOptions } = animationDefinitions[i];\n const { element, name, pseudoElement } = animationOptions;\n if (!pseudoElement && unresolvedKeyframes[0] === null) {\n unresolvedKeyframes[0] = getComputedStyle(element, name);\n }\n fillWildcards(unresolvedKeyframes);\n applyPxDefaults(unresolvedKeyframes, name);\n /**\n * If we only have one keyframe, explicitly read the initial keyframe\n * from the computed style. This is to ensure consistency with WAAPI behaviour\n * for restarting animations, for instance .play() after finish, when it\n * has one vs two keyframes.\n */\n if (!pseudoElement && unresolvedKeyframes.length < 2) {\n unresolvedKeyframes.unshift(getComputedStyle(element, name));\n }\n animationOptions.keyframes = unresolvedKeyframes;\n }\n /**\n * Step 3: Create new animations (write)\n */\n const animations = [];\n for (let i = 0; i < animationDefinitions.length; i++) {\n const { map, key, options: animationOptions } = animationDefinitions[i];\n const animation = new NativeAnimation(animationOptions);\n map.set(key, animation);\n animation.finished.finally(() => map.delete(key));\n animations.push(animation);\n }\n return animations;\n}\n//# sourceMappingURL=animate-elements.js.map","function resolveElements(elementOrSelector, scope, selectorCache) {\n if (elementOrSelector == null) {\n return [];\n }\n if (elementOrSelector instanceof EventTarget) {\n return [elementOrSelector];\n }\n else if (typeof elementOrSelector === \"string\") {\n let root = document;\n if (scope) {\n root = scope.current;\n }\n const elements = selectorCache?.[elementOrSelector] ??\n root.querySelectorAll(elementOrSelector);\n return elements ? Array.from(elements) : [];\n }\n return Array.from(elementOrSelector).filter((element) => element != null);\n}\n\nexport { resolveElements };\n//# sourceMappingURL=resolve-elements.mjs.map\n","import { GroupAnimationWithThen, } from \"motion-dom\";\nimport { animateElements } from \"./animate-elements\";\nexport const createScopedWaapiAnimate = (scope) => {\n function scopedAnimate(elementOrSelector, keyframes, options) {\n return new GroupAnimationWithThen(animateElements(elementOrSelector, keyframes, options, scope));\n }\n return scopedAnimate;\n};\nexport const animateMini = /*@__PURE__*/ createScopedWaapiAnimate();\n//# sourceMappingURL=animate-style.js.map"],"names":["invariant","process","env","NODE_ENV","check","message","errorCode","Error","formatErrorMessage","noop","any","secondsToMilliseconds","seconds","millisecondsToSeconds","milliseconds","isNotNull","value","WithPromise","constructor","this","updateFinished","finished","_finished","Promise","resolve","notifyFinished","then","onResolve","onReject","fillWildcards","keyframes","i","length","isCSSVar","name","startsWith","supportsFlags","memoSupports","callback","supportsFlag","memoized","result","undefined","memo","supportsScrollTimeline","window","ScrollTimeline","supportsLinearEasing","document","createElement","animate","opacity","easing","e","cubicBezierAsString","a","b","c","d","supportedWaapiEasing","linear","ease","easeIn","easeOut","easeInOut","circIn","circOut","backIn","backOut","mapEasingToNativeEasing","duration","resolution","points","numPoints","Math","max","round","substring","generateLinearEasing","Array","isArray","isBezierDefinition","map","segmentEasing","NativeAnimation","options","super","finishedTime","isStopped","manualStartTime","element","pseudoElement","allowFlatten","finalKeyframe","onComplete","isPseudoElement","Boolean","type","transition","isGenerator","applyToOptions","applyGeneratorOptions","animation","valueName","delay","repeat","repeatType","times","keyframeOptions","offset","fill","iterations","direction","startWaapiAnimation","autoplay","pause","onfinish","time","keyframe","speed","resolvedKeyframes","filter","index","getFinalKeyframe","updateMotionValue","style","setProperty","setStyle","cancel","play","state","complete","finish","stop","commitStyles","isConnected","effect","getComputedTiming","Number","iterationDuration","currentTime","newTime","wasFinished","playbackRate","newSpeed","playState","startTime","newStartTime","attachTimeline","timeline","rangeStart","rangeEnd","observe","updateTiming","GroupAnimation","animations","runAll","all","getAll","propName","setAll","newValue","subscriptions","forEach","getMax","methodName","controls","GroupAnimationWithThen","_onReject","finally","animationMaps","WeakMap","animationMapKey","getAnimationMap","get","Map","set","getValueTransition","key","valueTransition","parentTransition","inherit","_","rest","resolveTransition","pxValues","Set","applyPxDefaults","has","getComputedStyle","computedStyle","getPropertyValue","animateElements","elementOrSelector","scope","elements","EventTarget","root","current","querySelectorAll","from","resolveElements","numElements","animationDefinitions","elementTransition","valueKeyframes","valueOptions","currentAnimation","push","unresolvedKeyframes","animationOptions","unshift","delete","createScopedWaapiAnimate","animateMini"],"mappings":"AAGA,IAAIA,EAAY,OACO,oBAAZC,SACmB,eAA1BA,QAAQC,KAAKC,WA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KAAK,CACtB9H,MACAgG,MACA+B,oBAAqBJ,EACrBxH,QAAS,IACFyH,EACHpH,UACAxD,KAAMqE,EACNX,cAAegH,EAAkB3G,OAAS2G,EAAkB/I,OAGxE,CACJ,CAIA,IAAK,IAAI9B,EAAI,EAAGA,EAAI4K,EAAqB3K,OAAQD,IAAK,CAClD,MAAMkL,oBAAEA,EAAqB5H,QAAS6H,GAAqBP,EAAqB5K,IAC1E2D,QAAEA,EAAOxD,KAAEA,EAAIyD,cAAEA,GAAkBuH,EACpCvH,GAA4C,OAA3BsH,EAAoB,KACtCA,EAAoB,GAAKpB,EAAiBnG,EAASxD,IAEvDL,EAAcoL,GACdtB,EAAgBsB,EAAqB/K,IAOhCyD,GAAiBsH,EAAoBjL,OAAS,GAC/CiL,EAAoBE,QAAQtB,EAAiBnG,EAASxD,IAE1DgL,EAAiBpL,UAAYmL,CACjC,CAIA,MAAMtD,EAAa,GACnB,IAAK,IAAI5H,EAAI,EAAGA,EAAI4K,EAAqB3K,OAAQD,IAAK,CAClD,MAAMmD,IAAEA,EAAGgG,IAAEA,EAAK7F,QAAS6H,GAAqBP,EAAqB5K,GAC/DuE,EAAY,IAAIlB,EAAgB8H,GACtChI,EAAI8F,IAAIE,EAAK5E,GACbA,EAAUjF,SAASoJ,QAAQ,IAAMvF,EAAIkI,OAAOlC,IAC5CvB,EAAWqD,KAAK1G,EACpB,CACA,OAAOqD,CACX,CEvGY,MAAC0D,EAA4BnB,GACrC,SAAuBD,EAAmBnK,EAAWuD,GACjD,OAAO,IAAIkF,EAAuByB,EAAgBC,EAAmBnK,EAAWuD,EAAS6G,GAC7F,EAGSoB,EAA4BD"} |
+7
-7
| { | ||
| "name": "framer-motion", | ||
| "version": "12.38.0", | ||
| "version": "12.39.0", | ||
| "description": "A simple and powerful JavaScript animation library", | ||
@@ -9,3 +9,3 @@ "main": "dist/cjs/index.js", | ||
| ".": { | ||
| "types": "./dist/types/index.d.ts", | ||
| "types": "./dist/index.d.ts", | ||
| "require": "./dist/cjs/index.js", | ||
@@ -34,3 +34,3 @@ "import": "./dist/es/index.mjs", | ||
| "./client": { | ||
| "types": "./dist/types/client.d.ts", | ||
| "types": "./dist/client.d.ts", | ||
| "require": "./dist/cjs/client.js", | ||
@@ -59,3 +59,3 @@ "import": "./dist/es/client.mjs", | ||
| }, | ||
| "types": "dist/types/index.d.ts", | ||
| "types": "dist/index.d.ts", | ||
| "author": "Matt Perry", | ||
@@ -94,4 +94,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "motion-dom": "^12.38.0", | ||
| "motion-utils": "^12.36.0", | ||
| "motion-dom": "^12.39.0", | ||
| "motion-utils": "^12.39.0", | ||
| "tslib": "^2.4.0" | ||
@@ -151,3 +151,3 @@ }, | ||
| ], | ||
| "gitHead": "0bfc9fe015f7170c538ca70ba4677ec59d83ee76" | ||
| "gitHead": "e1cad4e8c401b3bbfb3f5378a150f1270b86ea11" | ||
| } |
+0
-2
@@ -128,4 +128,2 @@ <h1 align="center"> <img width="35" height="35" alt="Motion logo" src="https://github.com/user-attachments/assets/00d6d1c3-72c4-4c2f-a664-69da13182ffc" /><br />Motion for React</h1> | ||
| <a href="https://mintlify.com"><img alt="Mintlify" src="https://github.com/user-attachments/assets/2740db2f-1877-49ae-ae80-ba5d19ef1587" width="200px" height="120px"></a> | ||
| ### Silver | ||
@@ -132,0 +130,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { CSSProperties, PropsWithoutRef, RefAttributes, JSX, SVGAttributes } from 'react'; | ||
| import { MotionNodeOptions, MotionValue, TransformProperties, SVGPathProperties } from 'motion-dom'; | ||
| /** | ||
| * Either a string, or array of strings, that reference variants defined via the `variants` prop. | ||
| * @public | ||
| */ | ||
| type VariantLabels = string | string[]; | ||
| type MotionValueString = MotionValue<string>; | ||
| type MotionValueNumber = MotionValue<number>; | ||
| type MotionValueAny = MotionValue<any>; | ||
| type AnyMotionValue = MotionValueNumber | MotionValueString | MotionValueAny; | ||
| type MotionValueHelper<T> = T | AnyMotionValue; | ||
| type MakeMotionHelper<T> = { | ||
| [K in keyof T]: MotionValueHelper<T[K]>; | ||
| }; | ||
| type MakeCustomValueTypeHelper<T> = MakeMotionHelper<T>; | ||
| type MakeMotion<T> = MakeCustomValueTypeHelper<T>; | ||
| type MotionCSS = MakeMotion<Omit<CSSProperties, "rotate" | "scale" | "perspective" | "x" | "y" | "z">>; | ||
| /** | ||
| * @public | ||
| */ | ||
| type MotionTransform = MakeMotion<TransformProperties>; | ||
| type MotionSVGProps = MakeMotion<SVGPathProperties>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface MotionStyle extends MotionCSS, MotionTransform, MotionSVGProps { | ||
| } | ||
| /** | ||
| * Props for `motion` components. | ||
| * | ||
| * @public | ||
| */ | ||
| interface MotionProps extends MotionNodeOptions { | ||
| /** | ||
| * | ||
| * The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(0) | ||
| * | ||
| * return <motion.div style={{ x, opacity: 1, scale: 0.5 }} /> | ||
| * } | ||
| * ``` | ||
| */ | ||
| style?: MotionStyle; | ||
| children?: React.ReactNode | MotionValueNumber | MotionValueString; | ||
| } | ||
| interface HTMLElements { | ||
| a: HTMLAnchorElement; | ||
| abbr: HTMLElement; | ||
| address: HTMLElement; | ||
| area: HTMLAreaElement; | ||
| article: HTMLElement; | ||
| aside: HTMLElement; | ||
| audio: HTMLAudioElement; | ||
| b: HTMLElement; | ||
| base: HTMLBaseElement; | ||
| bdi: HTMLElement; | ||
| bdo: HTMLElement; | ||
| big: HTMLElement; | ||
| blockquote: HTMLQuoteElement; | ||
| body: HTMLBodyElement; | ||
| br: HTMLBRElement; | ||
| button: HTMLButtonElement; | ||
| canvas: HTMLCanvasElement; | ||
| caption: HTMLElement; | ||
| center: HTMLElement; | ||
| cite: HTMLElement; | ||
| code: HTMLElement; | ||
| col: HTMLTableColElement; | ||
| colgroup: HTMLTableColElement; | ||
| data: HTMLDataElement; | ||
| datalist: HTMLDataListElement; | ||
| dd: HTMLElement; | ||
| del: HTMLModElement; | ||
| details: HTMLDetailsElement; | ||
| dfn: HTMLElement; | ||
| dialog: HTMLDialogElement; | ||
| div: HTMLDivElement; | ||
| dl: HTMLDListElement; | ||
| dt: HTMLElement; | ||
| em: HTMLElement; | ||
| embed: HTMLEmbedElement; | ||
| fieldset: HTMLFieldSetElement; | ||
| figcaption: HTMLElement; | ||
| figure: HTMLElement; | ||
| footer: HTMLElement; | ||
| form: HTMLFormElement; | ||
| h1: HTMLHeadingElement; | ||
| h2: HTMLHeadingElement; | ||
| h3: HTMLHeadingElement; | ||
| h4: HTMLHeadingElement; | ||
| h5: HTMLHeadingElement; | ||
| h6: HTMLHeadingElement; | ||
| head: HTMLHeadElement; | ||
| header: HTMLElement; | ||
| hgroup: HTMLElement; | ||
| hr: HTMLHRElement; | ||
| html: HTMLHtmlElement; | ||
| i: HTMLElement; | ||
| iframe: HTMLIFrameElement; | ||
| img: HTMLImageElement; | ||
| input: HTMLInputElement; | ||
| ins: HTMLModElement; | ||
| kbd: HTMLElement; | ||
| keygen: HTMLElement; | ||
| label: HTMLLabelElement; | ||
| legend: HTMLLegendElement; | ||
| li: HTMLLIElement; | ||
| link: HTMLLinkElement; | ||
| main: HTMLElement; | ||
| map: HTMLMapElement; | ||
| mark: HTMLElement; | ||
| menu: HTMLElement; | ||
| menuitem: HTMLElement; | ||
| meta: HTMLMetaElement; | ||
| meter: HTMLMeterElement; | ||
| nav: HTMLElement; | ||
| noindex: HTMLElement; | ||
| noscript: HTMLElement; | ||
| object: HTMLObjectElement; | ||
| ol: HTMLOListElement; | ||
| optgroup: HTMLOptGroupElement; | ||
| option: HTMLOptionElement; | ||
| output: HTMLOutputElement; | ||
| p: HTMLParagraphElement; | ||
| param: HTMLParamElement; | ||
| picture: HTMLElement; | ||
| pre: HTMLPreElement; | ||
| progress: HTMLProgressElement; | ||
| q: HTMLQuoteElement; | ||
| rp: HTMLElement; | ||
| rt: HTMLElement; | ||
| ruby: HTMLElement; | ||
| s: HTMLElement; | ||
| samp: HTMLElement; | ||
| search: HTMLElement; | ||
| slot: HTMLSlotElement; | ||
| script: HTMLScriptElement; | ||
| section: HTMLElement; | ||
| select: HTMLSelectElement; | ||
| small: HTMLElement; | ||
| source: HTMLSourceElement; | ||
| span: HTMLSpanElement; | ||
| strong: HTMLElement; | ||
| style: HTMLStyleElement; | ||
| sub: HTMLElement; | ||
| summary: HTMLElement; | ||
| sup: HTMLElement; | ||
| table: HTMLTableElement; | ||
| template: HTMLTemplateElement; | ||
| tbody: HTMLTableSectionElement; | ||
| td: HTMLTableDataCellElement; | ||
| textarea: HTMLTextAreaElement; | ||
| tfoot: HTMLTableSectionElement; | ||
| th: HTMLTableHeaderCellElement; | ||
| thead: HTMLTableSectionElement; | ||
| time: HTMLTimeElement; | ||
| title: HTMLTitleElement; | ||
| tr: HTMLTableRowElement; | ||
| track: HTMLTrackElement; | ||
| u: HTMLElement; | ||
| ul: HTMLUListElement; | ||
| var: HTMLElement; | ||
| video: HTMLVideoElement; | ||
| wbr: HTMLElement; | ||
| webview: HTMLWebViewElement; | ||
| } | ||
| /** | ||
| * @public | ||
| */ | ||
| type ForwardRefComponent<T, P> = { | ||
| readonly $$typeof: symbol; | ||
| } & ((props: PropsWithoutRef<P> & RefAttributes<T>) => JSX.Element); | ||
| type AttributesWithoutMotionProps<Attributes> = { | ||
| [K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K]; | ||
| }; | ||
| /** | ||
| * @public | ||
| */ | ||
| type HTMLMotionProps<Tag extends keyof HTMLElements> = AttributesWithoutMotionProps<JSX.IntrinsicElements[Tag]> & MotionProps; | ||
| /** | ||
| * Motion-optimised versions of React's HTML components. | ||
| * | ||
| * @public | ||
| */ | ||
| type HTMLMotionComponents = { | ||
| [K in keyof HTMLElements]: ForwardRefComponent<HTMLElements[K], HTMLMotionProps<K>>; | ||
| }; | ||
| type UnionStringArray<T extends Readonly<string[]>> = T[number]; | ||
| declare const svgElements: readonly ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "linearGradient", "radialGradient", "textPath"]; | ||
| type SVGElements = UnionStringArray<typeof svgElements>; | ||
| interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> { | ||
| } | ||
| /** | ||
| * Blanket-accept any SVG attribute as a `MotionValue` | ||
| * @public | ||
| */ | ||
| type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>; | ||
| type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps { | ||
| } | ||
| /** | ||
| * Motion-optimised versions of React's SVG components. | ||
| * | ||
| * @public | ||
| */ | ||
| type SVGMotionComponents = { | ||
| [K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>; | ||
| }; | ||
| export type { ForwardRefComponent as F, HTMLMotionComponents as H, MotionProps as M, SVGMotionComponents as S, VariantLabels as V, HTMLElements as a, HTMLMotionProps as b, MotionStyle as c, MotionTransform as d, SVGAttributesAsMotionValues as e, SVGMotionProps as f }; |
| import { F as ForwardRefComponent, b as HTMLMotionProps, f as SVGMotionProps } from '../types.d-DOCC-kZB.js'; | ||
| import 'react'; | ||
| import 'motion-dom'; | ||
| /** | ||
| * HTML components | ||
| */ | ||
| declare const MotionA: ForwardRefComponent<HTMLAnchorElement, HTMLMotionProps<"a">>; | ||
| declare const MotionAbbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"abbr">>; | ||
| declare const MotionAddress: ForwardRefComponent<HTMLElement, HTMLMotionProps<"address">>; | ||
| declare const MotionArea: ForwardRefComponent<HTMLAreaElement, HTMLMotionProps<"area">>; | ||
| declare const MotionArticle: ForwardRefComponent<HTMLElement, HTMLMotionProps<"article">>; | ||
| declare const MotionAside: ForwardRefComponent<HTMLElement, HTMLMotionProps<"aside">>; | ||
| declare const MotionAudio: ForwardRefComponent<HTMLAudioElement, HTMLMotionProps<"audio">>; | ||
| declare const MotionB: ForwardRefComponent<HTMLElement, HTMLMotionProps<"b">>; | ||
| declare const MotionBase: ForwardRefComponent<HTMLBaseElement, HTMLMotionProps<"base">>; | ||
| declare const MotionBdi: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdi">>; | ||
| declare const MotionBdo: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdo">>; | ||
| declare const MotionBig: ForwardRefComponent<HTMLElement, HTMLMotionProps<"big">>; | ||
| declare const MotionBlockquote: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"blockquote">>; | ||
| declare const MotionBody: ForwardRefComponent<HTMLBodyElement, HTMLMotionProps<"body">>; | ||
| declare const MotionButton: ForwardRefComponent<HTMLButtonElement, HTMLMotionProps<"button">>; | ||
| declare const MotionCanvas: ForwardRefComponent<HTMLCanvasElement, HTMLMotionProps<"canvas">>; | ||
| declare const MotionCaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"caption">>; | ||
| declare const MotionCite: ForwardRefComponent<HTMLElement, HTMLMotionProps<"cite">>; | ||
| declare const MotionCode: ForwardRefComponent<HTMLElement, HTMLMotionProps<"code">>; | ||
| declare const MotionCol: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"col">>; | ||
| declare const MotionColgroup: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"colgroup">>; | ||
| declare const MotionData: ForwardRefComponent<HTMLDataElement, HTMLMotionProps<"data">>; | ||
| declare const MotionDatalist: ForwardRefComponent<HTMLDataListElement, HTMLMotionProps<"datalist">>; | ||
| declare const MotionDd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dd">>; | ||
| declare const MotionDel: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"del">>; | ||
| declare const MotionDetails: ForwardRefComponent<HTMLDetailsElement, HTMLMotionProps<"details">>; | ||
| declare const MotionDfn: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dfn">>; | ||
| declare const MotionDialog: ForwardRefComponent<HTMLDialogElement, HTMLMotionProps<"dialog">>; | ||
| declare const MotionDiv: ForwardRefComponent<HTMLDivElement, HTMLMotionProps<"div">>; | ||
| declare const MotionDl: ForwardRefComponent<HTMLDListElement, HTMLMotionProps<"dl">>; | ||
| declare const MotionDt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dt">>; | ||
| declare const MotionEm: ForwardRefComponent<HTMLElement, HTMLMotionProps<"em">>; | ||
| declare const MotionEmbed: ForwardRefComponent<HTMLEmbedElement, HTMLMotionProps<"embed">>; | ||
| declare const MotionFieldset: ForwardRefComponent<HTMLFieldSetElement, HTMLMotionProps<"fieldset">>; | ||
| declare const MotionFigcaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figcaption">>; | ||
| declare const MotionFigure: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figure">>; | ||
| declare const MotionFooter: ForwardRefComponent<HTMLElement, HTMLMotionProps<"footer">>; | ||
| declare const MotionForm: ForwardRefComponent<HTMLFormElement, HTMLMotionProps<"form">>; | ||
| declare const MotionH1: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h1">>; | ||
| declare const MotionH2: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h2">>; | ||
| declare const MotionH3: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h3">>; | ||
| declare const MotionH4: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h4">>; | ||
| declare const MotionH5: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h5">>; | ||
| declare const MotionH6: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h6">>; | ||
| declare const MotionHead: ForwardRefComponent<HTMLHeadElement, HTMLMotionProps<"head">>; | ||
| declare const MotionHeader: ForwardRefComponent<HTMLElement, HTMLMotionProps<"header">>; | ||
| declare const MotionHgroup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"hgroup">>; | ||
| declare const MotionHr: ForwardRefComponent<HTMLHRElement, HTMLMotionProps<"hr">>; | ||
| declare const MotionHtml: ForwardRefComponent<HTMLHtmlElement, HTMLMotionProps<"html">>; | ||
| declare const MotionI: ForwardRefComponent<HTMLElement, HTMLMotionProps<"i">>; | ||
| declare const MotionIframe: ForwardRefComponent<HTMLIFrameElement, HTMLMotionProps<"iframe">>; | ||
| declare const MotionImg: ForwardRefComponent<HTMLImageElement, HTMLMotionProps<"img">>; | ||
| declare const MotionInput: ForwardRefComponent<HTMLInputElement, HTMLMotionProps<"input">>; | ||
| declare const MotionIns: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"ins">>; | ||
| declare const MotionKbd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"kbd">>; | ||
| declare const MotionKeygen: ForwardRefComponent<HTMLElement, HTMLMotionProps<"keygen">>; | ||
| declare const MotionLabel: ForwardRefComponent<HTMLLabelElement, HTMLMotionProps<"label">>; | ||
| declare const MotionLegend: ForwardRefComponent<HTMLLegendElement, HTMLMotionProps<"legend">>; | ||
| declare const MotionLi: ForwardRefComponent<HTMLLIElement, HTMLMotionProps<"li">>; | ||
| declare const MotionLink: ForwardRefComponent<HTMLLinkElement, HTMLMotionProps<"link">>; | ||
| declare const MotionMain: ForwardRefComponent<HTMLElement, HTMLMotionProps<"main">>; | ||
| declare const MotionMap: ForwardRefComponent<HTMLMapElement, HTMLMotionProps<"map">>; | ||
| declare const MotionMark: ForwardRefComponent<HTMLElement, HTMLMotionProps<"mark">>; | ||
| declare const MotionMenu: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menu">>; | ||
| declare const MotionMenuitem: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menuitem">>; | ||
| declare const MotionMeter: ForwardRefComponent<HTMLMeterElement, HTMLMotionProps<"meter">>; | ||
| declare const MotionNav: ForwardRefComponent<HTMLElement, HTMLMotionProps<"nav">>; | ||
| declare const MotionObject: ForwardRefComponent<HTMLObjectElement, HTMLMotionProps<"object">>; | ||
| declare const MotionOl: ForwardRefComponent<HTMLOListElement, HTMLMotionProps<"ol">>; | ||
| declare const MotionOptgroup: ForwardRefComponent<HTMLOptGroupElement, HTMLMotionProps<"optgroup">>; | ||
| declare const MotionOption: ForwardRefComponent<HTMLOptionElement, HTMLMotionProps<"option">>; | ||
| declare const MotionOutput: ForwardRefComponent<HTMLOutputElement, HTMLMotionProps<"output">>; | ||
| declare const MotionP: ForwardRefComponent<HTMLParagraphElement, HTMLMotionProps<"p">>; | ||
| declare const MotionParam: ForwardRefComponent<HTMLParamElement, HTMLMotionProps<"param">>; | ||
| declare const MotionPicture: ForwardRefComponent<HTMLElement, HTMLMotionProps<"picture">>; | ||
| declare const MotionPre: ForwardRefComponent<HTMLPreElement, HTMLMotionProps<"pre">>; | ||
| declare const MotionProgress: ForwardRefComponent<HTMLProgressElement, HTMLMotionProps<"progress">>; | ||
| declare const MotionQ: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"q">>; | ||
| declare const MotionRp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rp">>; | ||
| declare const MotionRt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rt">>; | ||
| declare const MotionRuby: ForwardRefComponent<HTMLElement, HTMLMotionProps<"ruby">>; | ||
| declare const MotionS: ForwardRefComponent<HTMLElement, HTMLMotionProps<"s">>; | ||
| declare const MotionSamp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"samp">>; | ||
| declare const MotionScript: ForwardRefComponent<HTMLScriptElement, HTMLMotionProps<"script">>; | ||
| declare const MotionSection: ForwardRefComponent<HTMLElement, HTMLMotionProps<"section">>; | ||
| declare const MotionSelect: ForwardRefComponent<HTMLSelectElement, HTMLMotionProps<"select">>; | ||
| declare const MotionSmall: ForwardRefComponent<HTMLElement, HTMLMotionProps<"small">>; | ||
| declare const MotionSource: ForwardRefComponent<HTMLSourceElement, HTMLMotionProps<"source">>; | ||
| declare const MotionSpan: ForwardRefComponent<HTMLSpanElement, HTMLMotionProps<"span">>; | ||
| declare const MotionStrong: ForwardRefComponent<HTMLElement, HTMLMotionProps<"strong">>; | ||
| declare const MotionStyle: ForwardRefComponent<HTMLStyleElement, HTMLMotionProps<"style">>; | ||
| declare const MotionSub: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sub">>; | ||
| declare const MotionSummary: ForwardRefComponent<HTMLElement, HTMLMotionProps<"summary">>; | ||
| declare const MotionSup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sup">>; | ||
| declare const MotionTable: ForwardRefComponent<HTMLTableElement, HTMLMotionProps<"table">>; | ||
| declare const MotionTbody: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tbody">>; | ||
| declare const MotionTd: ForwardRefComponent<HTMLTableDataCellElement, HTMLMotionProps<"td">>; | ||
| declare const MotionTextarea: ForwardRefComponent<HTMLTextAreaElement, HTMLMotionProps<"textarea">>; | ||
| declare const MotionTfoot: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tfoot">>; | ||
| declare const MotionTh: ForwardRefComponent<HTMLTableHeaderCellElement, HTMLMotionProps<"th">>; | ||
| declare const MotionThead: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"thead">>; | ||
| declare const MotionTime: ForwardRefComponent<HTMLTimeElement, HTMLMotionProps<"time">>; | ||
| declare const MotionTitle: ForwardRefComponent<HTMLTitleElement, HTMLMotionProps<"title">>; | ||
| declare const MotionTr: ForwardRefComponent<HTMLTableRowElement, HTMLMotionProps<"tr">>; | ||
| declare const MotionTrack: ForwardRefComponent<HTMLTrackElement, HTMLMotionProps<"track">>; | ||
| declare const MotionU: ForwardRefComponent<HTMLElement, HTMLMotionProps<"u">>; | ||
| declare const MotionUl: ForwardRefComponent<HTMLUListElement, HTMLMotionProps<"ul">>; | ||
| declare const MotionVideo: ForwardRefComponent<HTMLVideoElement, HTMLMotionProps<"video">>; | ||
| declare const MotionWbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"wbr">>; | ||
| declare const MotionWebview: ForwardRefComponent<HTMLWebViewElement, HTMLMotionProps<"webview">>; | ||
| /** | ||
| * SVG components | ||
| */ | ||
| declare const MotionAnimate: ForwardRefComponent<SVGElement, SVGMotionProps<SVGElement>>; | ||
| declare const MotionCircle: ForwardRefComponent<SVGCircleElement, SVGMotionProps<SVGCircleElement>>; | ||
| declare const MotionDefs: ForwardRefComponent<SVGDefsElement, SVGMotionProps<SVGDefsElement>>; | ||
| declare const MotionDesc: ForwardRefComponent<SVGDescElement, SVGMotionProps<SVGDescElement>>; | ||
| declare const MotionEllipse: ForwardRefComponent<SVGEllipseElement, SVGMotionProps<SVGEllipseElement>>; | ||
| declare const MotionG: ForwardRefComponent<SVGGElement, SVGMotionProps<SVGGElement>>; | ||
| declare const MotionImage: ForwardRefComponent<SVGImageElement, SVGMotionProps<SVGImageElement>>; | ||
| declare const MotionLine: ForwardRefComponent<SVGLineElement, SVGMotionProps<SVGLineElement>>; | ||
| declare const MotionFilter: ForwardRefComponent<SVGFilterElement, SVGMotionProps<SVGFilterElement>>; | ||
| declare const MotionMarker: ForwardRefComponent<SVGMarkerElement, SVGMotionProps<SVGMarkerElement>>; | ||
| declare const MotionMask: ForwardRefComponent<SVGMaskElement, SVGMotionProps<SVGMaskElement>>; | ||
| declare const MotionMetadata: ForwardRefComponent<SVGMetadataElement, SVGMotionProps<SVGMetadataElement>>; | ||
| declare const MotionPath: ForwardRefComponent<SVGPathElement, SVGMotionProps<SVGPathElement>>; | ||
| declare const MotionPattern: ForwardRefComponent<SVGPatternElement, SVGMotionProps<SVGPatternElement>>; | ||
| declare const MotionPolygon: ForwardRefComponent<SVGPolygonElement, SVGMotionProps<SVGPolygonElement>>; | ||
| declare const MotionPolyline: ForwardRefComponent<SVGPolylineElement, SVGMotionProps<SVGPolylineElement>>; | ||
| declare const MotionRect: ForwardRefComponent<SVGRectElement, SVGMotionProps<SVGRectElement>>; | ||
| declare const MotionStop: ForwardRefComponent<SVGStopElement, SVGMotionProps<SVGStopElement>>; | ||
| declare const MotionSvg: ForwardRefComponent<SVGSVGElement, SVGMotionProps<SVGSVGElement>>; | ||
| declare const MotionSymbol: ForwardRefComponent<SVGSymbolElement, SVGMotionProps<SVGSymbolElement>>; | ||
| declare const MotionText: ForwardRefComponent<SVGTextElement, SVGMotionProps<SVGTextElement>>; | ||
| declare const MotionTspan: ForwardRefComponent<SVGTSpanElement, SVGMotionProps<SVGTSpanElement>>; | ||
| declare const MotionUse: ForwardRefComponent<SVGUseElement, SVGMotionProps<SVGUseElement>>; | ||
| declare const MotionView: ForwardRefComponent<SVGViewElement, SVGMotionProps<SVGViewElement>>; | ||
| declare const MotionClipPath: ForwardRefComponent<SVGClipPathElement, SVGMotionProps<SVGClipPathElement>>; | ||
| declare const MotionFeBlend: ForwardRefComponent<SVGFEBlendElement, SVGMotionProps<SVGFEBlendElement>>; | ||
| declare const MotionFeColorMatrix: ForwardRefComponent<SVGFEColorMatrixElement, SVGMotionProps<SVGFEColorMatrixElement>>; | ||
| declare const MotionFeComponentTransfer: ForwardRefComponent<SVGFEComponentTransferElement, SVGMotionProps<SVGFEComponentTransferElement>>; | ||
| declare const MotionFeComposite: ForwardRefComponent<SVGFECompositeElement, SVGMotionProps<SVGFECompositeElement>>; | ||
| declare const MotionFeConvolveMatrix: ForwardRefComponent<SVGFEConvolveMatrixElement, SVGMotionProps<SVGFEConvolveMatrixElement>>; | ||
| declare const MotionFeDiffuseLighting: ForwardRefComponent<SVGFEDiffuseLightingElement, SVGMotionProps<SVGFEDiffuseLightingElement>>; | ||
| declare const MotionFeDisplacementMap: ForwardRefComponent<SVGFEDisplacementMapElement, SVGMotionProps<SVGFEDisplacementMapElement>>; | ||
| declare const MotionFeDistantLight: ForwardRefComponent<SVGFEDistantLightElement, SVGMotionProps<SVGFEDistantLightElement>>; | ||
| declare const MotionFeDropShadow: ForwardRefComponent<SVGFEDropShadowElement, SVGMotionProps<SVGFEDropShadowElement>>; | ||
| declare const MotionFeFlood: ForwardRefComponent<SVGFEFloodElement, SVGMotionProps<SVGFEFloodElement>>; | ||
| declare const MotionFeFuncA: ForwardRefComponent<SVGFEFuncAElement, SVGMotionProps<SVGFEFuncAElement>>; | ||
| declare const MotionFeFuncB: ForwardRefComponent<SVGFEFuncBElement, SVGMotionProps<SVGFEFuncBElement>>; | ||
| declare const MotionFeFuncG: ForwardRefComponent<SVGFEFuncGElement, SVGMotionProps<SVGFEFuncGElement>>; | ||
| declare const MotionFeFuncR: ForwardRefComponent<SVGFEFuncRElement, SVGMotionProps<SVGFEFuncRElement>>; | ||
| declare const MotionFeGaussianBlur: ForwardRefComponent<SVGFEGaussianBlurElement, SVGMotionProps<SVGFEGaussianBlurElement>>; | ||
| declare const MotionFeImage: ForwardRefComponent<SVGFEImageElement, SVGMotionProps<SVGFEImageElement>>; | ||
| declare const MotionFeMerge: ForwardRefComponent<SVGFEMergeElement, SVGMotionProps<SVGFEMergeElement>>; | ||
| declare const MotionFeMergeNode: ForwardRefComponent<SVGFEMergeNodeElement, SVGMotionProps<SVGFEMergeNodeElement>>; | ||
| declare const MotionFeMorphology: ForwardRefComponent<SVGFEMorphologyElement, SVGMotionProps<SVGFEMorphologyElement>>; | ||
| declare const MotionFeOffset: ForwardRefComponent<SVGFEOffsetElement, SVGMotionProps<SVGFEOffsetElement>>; | ||
| declare const MotionFePointLight: ForwardRefComponent<SVGFEPointLightElement, SVGMotionProps<SVGFEPointLightElement>>; | ||
| declare const MotionFeSpecularLighting: ForwardRefComponent<SVGFESpecularLightingElement, SVGMotionProps<SVGFESpecularLightingElement>>; | ||
| declare const MotionFeSpotLight: ForwardRefComponent<SVGFESpotLightElement, SVGMotionProps<SVGFESpotLightElement>>; | ||
| declare const MotionFeTile: ForwardRefComponent<SVGFETileElement, SVGMotionProps<SVGFETileElement>>; | ||
| declare const MotionFeTurbulence: ForwardRefComponent<SVGFETurbulenceElement, SVGMotionProps<SVGFETurbulenceElement>>; | ||
| declare const MotionForeignObject: ForwardRefComponent<SVGForeignObjectElement, SVGMotionProps<SVGForeignObjectElement>>; | ||
| declare const MotionLinearGradient: ForwardRefComponent<SVGLinearGradientElement, SVGMotionProps<SVGLinearGradientElement>>; | ||
| declare const MotionRadialGradient: ForwardRefComponent<SVGRadialGradientElement, SVGMotionProps<SVGRadialGradientElement>>; | ||
| declare const MotionTextPath: ForwardRefComponent<SVGTextPathElement, SVGMotionProps<SVGTextPathElement>>; | ||
| export { MotionA as a, MotionAbbr as abbr, MotionAddress as address, MotionAnimate as animate, MotionArea as area, MotionArticle as article, MotionAside as aside, MotionAudio as audio, MotionB as b, MotionBase as base, MotionBdi as bdi, MotionBdo as bdo, MotionBig as big, MotionBlockquote as blockquote, MotionBody as body, MotionButton as button, MotionCanvas as canvas, MotionCaption as caption, MotionCircle as circle, MotionCite as cite, MotionClipPath as clipPath, MotionCode as code, MotionCol as col, MotionColgroup as colgroup, MotionData as data, MotionDatalist as datalist, MotionDd as dd, MotionDefs as defs, MotionDel as del, MotionDesc as desc, MotionDetails as details, MotionDfn as dfn, MotionDialog as dialog, MotionDiv as div, MotionDl as dl, MotionDt as dt, MotionEllipse as ellipse, MotionEm as em, MotionEmbed as embed, MotionFeBlend as feBlend, MotionFeColorMatrix as feColorMatrix, MotionFeComponentTransfer as feComponentTransfer, MotionFeComposite as feComposite, MotionFeConvolveMatrix as feConvolveMatrix, MotionFeDiffuseLighting as feDiffuseLighting, MotionFeDisplacementMap as feDisplacementMap, MotionFeDistantLight as feDistantLight, MotionFeDropShadow as feDropShadow, MotionFeFlood as feFlood, MotionFeFuncA as feFuncA, MotionFeFuncB as feFuncB, MotionFeFuncG as feFuncG, MotionFeFuncR as feFuncR, MotionFeGaussianBlur as feGaussianBlur, MotionFeImage as feImage, MotionFeMerge as feMerge, MotionFeMergeNode as feMergeNode, MotionFeMorphology as feMorphology, MotionFeOffset as feOffset, MotionFePointLight as fePointLight, MotionFeSpecularLighting as feSpecularLighting, MotionFeSpotLight as feSpotLight, MotionFeTile as feTile, MotionFeTurbulence as feTurbulence, MotionFieldset as fieldset, MotionFigcaption as figcaption, MotionFigure as figure, MotionFilter as filter, MotionFooter as footer, MotionForeignObject as foreignObject, MotionForm as form, MotionG as g, MotionH1 as h1, MotionH2 as h2, MotionH3 as h3, MotionH4 as h4, MotionH5 as h5, MotionH6 as h6, MotionHead as head, MotionHeader as header, MotionHgroup as hgroup, MotionHr as hr, MotionHtml as html, MotionI as i, MotionIframe as iframe, MotionImage as image, MotionImg as img, MotionInput as input, MotionIns as ins, MotionKbd as kbd, MotionKeygen as keygen, MotionLabel as label, MotionLegend as legend, MotionLi as li, MotionLine as line, MotionLinearGradient as linearGradient, MotionLink as link, MotionMain as main, MotionMap as map, MotionMark as mark, MotionMarker as marker, MotionMask as mask, MotionMenu as menu, MotionMenuitem as menuitem, MotionMetadata as metadata, MotionMeter as meter, MotionNav as nav, MotionObject as object, MotionOl as ol, MotionOptgroup as optgroup, MotionOption as option, MotionOutput as output, MotionP as p, MotionParam as param, MotionPath as path, MotionPattern as pattern, MotionPicture as picture, MotionPolygon as polygon, MotionPolyline as polyline, MotionPre as pre, MotionProgress as progress, MotionQ as q, MotionRadialGradient as radialGradient, MotionRect as rect, MotionRp as rp, MotionRt as rt, MotionRuby as ruby, MotionS as s, MotionSamp as samp, MotionScript as script, MotionSection as section, MotionSelect as select, MotionSmall as small, MotionSource as source, MotionSpan as span, MotionStop as stop, MotionStrong as strong, MotionStyle as style, MotionSub as sub, MotionSummary as summary, MotionSup as sup, MotionSvg as svg, MotionSymbol as symbol, MotionTable as table, MotionTbody as tbody, MotionTd as td, MotionText as text, MotionTextPath as textPath, MotionTextarea as textarea, MotionTfoot as tfoot, MotionTh as th, MotionThead as thead, MotionTime as time, MotionTitle as title, MotionTr as tr, MotionTrack as track, MotionTspan as tspan, MotionU as u, MotionUl as ul, MotionUse as use, MotionVideo as video, MotionView as view, MotionWbr as wbr, MotionWebview as webview }; |
| /// <reference types="react" /> | ||
| import * as motion_dom from 'motion-dom'; | ||
| import { AnyResolvedKeyframe, OnKeyframesResolved, KeyframeResolver, Transition, PresenceContextProps, ResolvedValues, VisualElement, MotionValue, Feature, UnresolvedValueKeyframe, AnimationOptions, ElementOrSelector, DOMKeyframesDefinition, AnimationPlaybackOptions, AnimationPlaybackControlsWithThen, ValueAnimationTransition, AnimationScope, AnimationPlaybackControls, EventInfo, MotionValueEventCallbacks, FollowValueOptions, SpringOptions, TransformOptions, WillChange, LegacyAnimationControls, NodeGroup, IProjectionNode } from 'motion-dom'; | ||
| export * from 'motion-dom'; | ||
| export { DelayedFunction, FlatTree, FollowValueOptions, IProjectionNode, ResolvedValues, VisualElement, addScaleCorrector, animateVisualElement, buildTransform, calcLength, createBox, delay, optimizedAppearDataAttribute, resolveMotionValue, visualElementStore } from 'motion-dom'; | ||
| import * as react_jsx_runtime from 'react/jsx-runtime'; | ||
| import * as React$1 from 'react'; | ||
| import { JSX, useEffect, RefObject } from 'react'; | ||
| import { V as VariantLabels, M as MotionProps, H as HTMLMotionComponents, S as SVGMotionComponents, a as HTMLElements, b as HTMLMotionProps } from '../types.d-DOCC-kZB.js'; | ||
| export { F as ForwardRefComponent, c as MotionStyle, d as MotionTransform, e as SVGAttributesAsMotionValues, f as SVGMotionProps } from '../types.d-DOCC-kZB.js'; | ||
| import { TransformPoint, Easing, EasingFunction, Point } from 'motion-utils'; | ||
| export * from 'motion-utils'; | ||
| export { MotionGlobalConfig } from 'motion-utils'; | ||
| type ResolveKeyframes<V extends AnyResolvedKeyframe> = (keyframes: V[], onComplete: OnKeyframesResolved<V>, name?: string, motionValue?: any) => KeyframeResolver<V>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface AnimatePresenceProps { | ||
| /** | ||
| * By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children | ||
| * that are present when the component is first rendered. | ||
| * | ||
| * ```jsx | ||
| * <AnimatePresence initial={false}> | ||
| * {isVisible && ( | ||
| * <motion.div | ||
| * key="modal" | ||
| * initial={{ opacity: 0 }} | ||
| * animate={{ opacity: 1 }} | ||
| * exit={{ opacity: 0 }} | ||
| * /> | ||
| * )} | ||
| * </AnimatePresence> | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| initial?: boolean; | ||
| /** | ||
| * When a component is removed, there's no longer a chance to update its props. So if a component's `exit` | ||
| * prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`. | ||
| * This will ensure all leaving components animate using the latest data. | ||
| * | ||
| * @public | ||
| */ | ||
| custom?: any; | ||
| /** | ||
| * Fires when all exiting nodes have completed animating out. | ||
| * | ||
| * @public | ||
| */ | ||
| onExitComplete?: () => void; | ||
| /** | ||
| * Determines how to handle entering and exiting elements. | ||
| * | ||
| * - `"sync"`: Default. Elements animate in and out as soon as they're added/removed. | ||
| * - `"popLayout"`: Exiting elements are "popped" from the page layout, allowing sibling | ||
| * elements to immediately occupy their new layouts. | ||
| * - `"wait"`: Only renders one component at a time. Wait for the exiting component to animate out | ||
| * before animating the next component in. | ||
| * | ||
| * @public | ||
| */ | ||
| mode?: "sync" | "popLayout" | "wait"; | ||
| /** | ||
| * Root element to use when injecting styles, used when mode === `"popLayout"`. | ||
| * This defaults to document.head but can be overridden e.g. for use in shadow DOM. | ||
| */ | ||
| root?: HTMLElement | ShadowRoot; | ||
| /** | ||
| * Internal. Used in Framer to flag that sibling children *shouldn't* re-render as a result of a | ||
| * child being removed. | ||
| */ | ||
| presenceAffectsLayout?: boolean; | ||
| /** | ||
| * If true, the `AnimatePresence` component will propagate parent exit animations | ||
| * to its children. | ||
| */ | ||
| propagate?: boolean; | ||
| /** | ||
| * Internal. Set whether to anchor the x position of the exiting element to the left or right | ||
| * when using `mode="popLayout"`. | ||
| */ | ||
| anchorX?: "left" | "right"; | ||
| /** | ||
| * Internal. Set whether to anchor the y position of the exiting element to the top or bottom | ||
| * when using `mode="popLayout"`. Use `"bottom"` for elements originally positioned with | ||
| * `bottom: 0` to prevent them from shifting during exit animations. | ||
| */ | ||
| anchorY?: "top" | "bottom"; | ||
| } | ||
| /** | ||
| * `AnimatePresence` enables the animation of components that have been removed from the tree. | ||
| * | ||
| * When adding/removing more than a single child, every child **must** be given a unique `key` prop. | ||
| * | ||
| * Any `motion` components that have an `exit` property defined will animate out when removed from | ||
| * the tree. | ||
| * | ||
| * ```jsx | ||
| * import { motion, AnimatePresence } from 'framer-motion' | ||
| * | ||
| * export const Items = ({ items }) => ( | ||
| * <AnimatePresence> | ||
| * {items.map(item => ( | ||
| * <motion.div | ||
| * key={item.id} | ||
| * initial={{ opacity: 0 }} | ||
| * animate={{ opacity: 1 }} | ||
| * exit={{ opacity: 0 }} | ||
| * /> | ||
| * ))} | ||
| * </AnimatePresence> | ||
| * ) | ||
| * ``` | ||
| * | ||
| * You can sequence exit animations throughout a tree using variants. | ||
| * | ||
| * If a child contains multiple `motion` components with `exit` props, it will only unmount the child | ||
| * once all `motion` components have finished animating out. Likewise, any components using | ||
| * `usePresence` all need to call `safeToRemove`. | ||
| * | ||
| * @public | ||
| */ | ||
| declare const AnimatePresence: ({ children, custom, initial, onExitComplete, presenceAffectsLayout, mode, propagate, anchorX, anchorY, root }: React$1.PropsWithChildren<AnimatePresenceProps>) => react_jsx_runtime.JSX.Element | null; | ||
| interface Props$3 { | ||
| children: React$1.ReactElement; | ||
| isPresent: boolean; | ||
| anchorX?: "left" | "right"; | ||
| anchorY?: "top" | "bottom"; | ||
| root?: HTMLElement | ShadowRoot; | ||
| pop?: boolean; | ||
| } | ||
| declare function PopChild({ children, isPresent, anchorX, anchorY, root, pop }: Props$3): react_jsx_runtime.JSX.Element; | ||
| interface PresenceChildProps { | ||
| children: React$1.ReactElement; | ||
| isPresent: boolean; | ||
| onExitComplete?: () => void; | ||
| initial?: false | VariantLabels; | ||
| custom?: any; | ||
| presenceAffectsLayout: boolean; | ||
| mode: "sync" | "popLayout" | "wait"; | ||
| anchorX?: "left" | "right"; | ||
| anchorY?: "top" | "bottom"; | ||
| root?: HTMLElement | ShadowRoot; | ||
| } | ||
| declare const PresenceChild: ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }: PresenceChildProps) => react_jsx_runtime.JSX.Element; | ||
| type InheritOption = boolean | "id"; | ||
| interface Props$2 { | ||
| id?: string; | ||
| inherit?: InheritOption; | ||
| } | ||
| declare const LayoutGroup: React$1.FunctionComponent<React$1.PropsWithChildren<Props$2>>; | ||
| type ReducedMotionConfig = "always" | "never" | "user"; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface MotionConfigContext { | ||
| /** | ||
| * Internal, exported only for usage in Framer | ||
| */ | ||
| transformPagePoint: TransformPoint; | ||
| /** | ||
| * Internal. Determines whether this is a static context ie the Framer canvas. If so, | ||
| * it'll disable all dynamic functionality. | ||
| */ | ||
| isStatic: boolean; | ||
| /** | ||
| * Defines a new default transition for the entire tree. | ||
| * | ||
| * @public | ||
| */ | ||
| transition?: Transition; | ||
| /** | ||
| * If true, will respect the device prefersReducedMotion setting by switching | ||
| * transform animations off. | ||
| * | ||
| * @public | ||
| */ | ||
| reducedMotion?: ReducedMotionConfig; | ||
| /** | ||
| * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP). | ||
| * For more details see: | ||
| * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles | ||
| * | ||
| * @public | ||
| */ | ||
| nonce?: string; | ||
| /** | ||
| * If true, all animations will be skipped and values will be set instantly. | ||
| * Useful for E2E tests and visual regression testing. | ||
| * | ||
| * @public | ||
| */ | ||
| skipAnimations?: boolean; | ||
| } | ||
| /** | ||
| * @public | ||
| */ | ||
| declare const MotionConfigContext: React$1.Context<MotionConfigContext>; | ||
| /** | ||
| * @public | ||
| */ | ||
| declare const PresenceContext: React$1.Context<PresenceContextProps | null>; | ||
| interface VisualState<Instance, RenderState> { | ||
| renderState: RenderState; | ||
| latestValues: ResolvedValues; | ||
| onMount?: (instance: Instance) => void; | ||
| } | ||
| type UseVisualState<Instance, RenderState> = (props: MotionProps, isStatic: boolean) => VisualState<Instance, RenderState>; | ||
| interface UseVisualStateConfig<RenderState> { | ||
| scrapeMotionValuesFromProps: ScrapeMotionValuesFromProps; | ||
| createRenderState: () => RenderState; | ||
| } | ||
| declare const makeUseVisualState: <I, RS>(config: UseVisualStateConfig<RS>) => UseVisualState<I, RS>; | ||
| type DOMMotionComponents = HTMLMotionComponents & SVGMotionComponents; | ||
| type ScrapeMotionValuesFromProps = (props: MotionProps, prevProps: MotionProps, visualElement?: VisualElement) => { | ||
| [key: string]: MotionValue | AnyResolvedKeyframe; | ||
| }; | ||
| interface VisualElementOptions<Instance, RenderState = any> { | ||
| visualState: VisualState<Instance, RenderState>; | ||
| parent?: VisualElement<unknown>; | ||
| variantParent?: VisualElement<unknown>; | ||
| presenceContext: PresenceContextProps | null; | ||
| props: MotionProps; | ||
| blockInitialAnimation?: boolean; | ||
| reducedMotionConfig?: ReducedMotionConfig; | ||
| /** | ||
| * If true, all animations will be skipped and values will be set instantly. | ||
| * Useful for E2E tests and visual regression testing. | ||
| */ | ||
| skipAnimations?: boolean; | ||
| /** | ||
| * Explicit override for SVG detection. When true, uses SVG rendering; | ||
| * when false, uses HTML rendering. If undefined, auto-detects. | ||
| */ | ||
| isSVG?: boolean; | ||
| } | ||
| type CreateVisualElement<Props = {}, TagName extends keyof DOMMotionComponents | string = "div"> = (Component: TagName | string | React.ComponentType<Props>, options: VisualElementOptions<HTMLElement | SVGElement>) => VisualElement<HTMLElement | SVGElement>; | ||
| declare function MeasureLayout(props: MotionProps & { | ||
| visualElement: VisualElement; | ||
| }): react_jsx_runtime.JSX.Element; | ||
| interface FeatureClass<Props = unknown> { | ||
| new (props: Props): Feature<Props>; | ||
| } | ||
| interface HydratedFeatureDefinition { | ||
| isEnabled: (props: MotionProps) => boolean; | ||
| Feature: FeatureClass<unknown>; | ||
| ProjectionNode?: any; | ||
| MeasureLayout?: typeof MeasureLayout; | ||
| } | ||
| interface HydratedFeatureDefinitions { | ||
| animation?: HydratedFeatureDefinition; | ||
| exit?: HydratedFeatureDefinition; | ||
| drag?: HydratedFeatureDefinition; | ||
| tap?: HydratedFeatureDefinition; | ||
| focus?: HydratedFeatureDefinition; | ||
| hover?: HydratedFeatureDefinition; | ||
| pan?: HydratedFeatureDefinition; | ||
| inView?: HydratedFeatureDefinition; | ||
| layout?: HydratedFeatureDefinition; | ||
| } | ||
| interface FeatureDefinition { | ||
| isEnabled: HydratedFeatureDefinition["isEnabled"]; | ||
| Feature?: HydratedFeatureDefinition["Feature"]; | ||
| ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"]; | ||
| MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"]; | ||
| } | ||
| type FeatureDefinitions = { | ||
| [K in keyof HydratedFeatureDefinitions]: FeatureDefinition; | ||
| }; | ||
| interface FeaturePackage { | ||
| Feature?: HydratedFeatureDefinition["Feature"]; | ||
| ProjectionNode?: HydratedFeatureDefinition["ProjectionNode"]; | ||
| MeasureLayout?: HydratedFeatureDefinition["MeasureLayout"]; | ||
| } | ||
| type FeaturePackages = { | ||
| [K in keyof HydratedFeatureDefinitions]: FeaturePackage; | ||
| }; | ||
| interface FeatureBundle extends FeaturePackages { | ||
| renderer: CreateVisualElement; | ||
| } | ||
| type LazyFeatureBundle$1 = () => Promise<FeatureBundle>; | ||
| type LazyFeatureBundle = () => Promise<FeatureBundle>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface LazyProps { | ||
| children?: React.ReactNode; | ||
| /** | ||
| * Can be used to provide a feature bundle synchronously or asynchronously. | ||
| * | ||
| * ```jsx | ||
| * // features.js | ||
| * import { domAnimation } from "framer-motion" | ||
| * export default domAnimation | ||
| * | ||
| * // index.js | ||
| * import { LazyMotion, m } from "framer-motion" | ||
| * | ||
| * const loadFeatures = () =>import("./features.js") | ||
| * .then(res => res.default) | ||
| * | ||
| * function Component() { | ||
| * return ( | ||
| * <LazyMotion features={loadFeatures}> | ||
| * <m.div animate={{ scale: 1.5 }} /> | ||
| * </LazyMotion> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| features: FeatureBundle | LazyFeatureBundle; | ||
| /** | ||
| * If `true`, will throw an error if a `motion` component renders within | ||
| * a `LazyMotion` component. | ||
| * | ||
| * ```jsx | ||
| * // This component will throw an error that explains using a motion component | ||
| * // instead of the m component will break the benefits of code-splitting. | ||
| * function Component() { | ||
| * return ( | ||
| * <LazyMotion features={domAnimation} strict> | ||
| * <motion.div /> | ||
| * </LazyMotion> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| strict?: boolean; | ||
| } | ||
| /** | ||
| * Used in conjunction with the `m` component to reduce bundle size. | ||
| * | ||
| * `m` is a version of the `motion` component that only loads functionality | ||
| * critical for the initial render. | ||
| * | ||
| * `LazyMotion` can then be used to either synchronously or asynchronously | ||
| * load animation and gesture support. | ||
| * | ||
| * ```jsx | ||
| * // Synchronous loading | ||
| * import { LazyMotion, m, domAnimation } from "framer-motion" | ||
| * | ||
| * function App() { | ||
| * return ( | ||
| * <LazyMotion features={domAnimation}> | ||
| * <m.div animate={{ scale: 2 }} /> | ||
| * </LazyMotion> | ||
| * ) | ||
| * } | ||
| * | ||
| * // Asynchronous loading | ||
| * import { LazyMotion, m } from "framer-motion" | ||
| * | ||
| * function App() { | ||
| * return ( | ||
| * <LazyMotion features={() => import('./path/to/domAnimation')}> | ||
| * <m.div animate={{ scale: 2 }} /> | ||
| * </LazyMotion> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function LazyMotion({ children, features, strict }: LazyProps): react_jsx_runtime.JSX.Element; | ||
| type IsValidProp = (key: string) => boolean; | ||
| declare function filterProps(props: MotionProps, isDom: boolean, forwardMotionProps: boolean): MotionProps; | ||
| interface MotionConfigProps extends Partial<MotionConfigContext> { | ||
| children?: React$1.ReactNode; | ||
| isValidProp?: IsValidProp; | ||
| } | ||
| /** | ||
| * `MotionConfig` is used to set configuration options for all children `motion` components. | ||
| * | ||
| * ```jsx | ||
| * import { motion, MotionConfig } from "framer-motion" | ||
| * | ||
| * export function App() { | ||
| * return ( | ||
| * <MotionConfig transition={{ type: "spring" }}> | ||
| * <motion.div animate={{ x: 100 }} /> | ||
| * </MotionConfig> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function MotionConfig({ children, isValidProp, ...config }: MotionConfigProps): react_jsx_runtime.JSX.Element; | ||
| /** | ||
| * Lifecycle callbacks are not supported on individual sequence segments | ||
| * because segments are consolidated into a single animation per subject. | ||
| * Use sequence-level options (e.g. SequenceOptions.onComplete) instead. | ||
| */ | ||
| type LifecycleCallbacks = "onUpdate" | "onPlay" | "onComplete" | "onRepeat" | "onStop"; | ||
| /** | ||
| * Distributive Omit preserves union branches (unlike plain Omit). | ||
| */ | ||
| type DistributiveOmit<T, K extends string> = T extends any ? Omit<T, K> : never; | ||
| type SegmentTransitionOptions = DistributiveOmit<AnimationOptions, LifecycleCallbacks> & At; | ||
| type SegmentValueTransitionOptions = DistributiveOmit<Transition, LifecycleCallbacks> & At; | ||
| type ObjectTarget<O> = { | ||
| [K in keyof O]?: O[K] | UnresolvedValueKeyframe[]; | ||
| }; | ||
| type SequenceTime = number | "<" | `+${number}` | `-${number}` | `${string}`; | ||
| type SequenceLabel = string; | ||
| interface SequenceLabelWithTime { | ||
| name: SequenceLabel; | ||
| at: SequenceTime; | ||
| } | ||
| interface At { | ||
| at?: SequenceTime; | ||
| } | ||
| type MotionValueSegment = [ | ||
| MotionValue, | ||
| UnresolvedValueKeyframe | UnresolvedValueKeyframe[] | ||
| ]; | ||
| type MotionValueSegmentWithTransition = [ | ||
| MotionValue, | ||
| UnresolvedValueKeyframe | UnresolvedValueKeyframe[], | ||
| SegmentValueTransitionOptions | ||
| ]; | ||
| type DOMSegment = [ElementOrSelector, DOMKeyframesDefinition]; | ||
| type DOMSegmentWithTransition = [ | ||
| ElementOrSelector, | ||
| DOMKeyframesDefinition, | ||
| SegmentTransitionOptions | ||
| ]; | ||
| type ObjectSegment<O extends {} = {}> = [O, ObjectTarget<O>]; | ||
| type ObjectSegmentWithTransition<O extends {} = {}> = [ | ||
| O, | ||
| ObjectTarget<O>, | ||
| SegmentTransitionOptions | ||
| ]; | ||
| type SequenceProgressCallback = (value: any) => void; | ||
| type FunctionSegment = [SequenceProgressCallback] | [SequenceProgressCallback, SegmentTransitionOptions] | [ | ||
| SequenceProgressCallback, | ||
| UnresolvedValueKeyframe | UnresolvedValueKeyframe[], | ||
| SegmentTransitionOptions | ||
| ]; | ||
| type Segment = ObjectSegment | ObjectSegmentWithTransition | SequenceLabel | SequenceLabelWithTime | MotionValueSegment | MotionValueSegmentWithTransition | DOMSegment | DOMSegmentWithTransition | FunctionSegment; | ||
| type AnimationSequence = Segment[]; | ||
| interface SequenceOptions extends AnimationPlaybackOptions { | ||
| delay?: number; | ||
| duration?: number; | ||
| defaultTransition?: Transition; | ||
| reduceMotion?: boolean; | ||
| onComplete?: () => void; | ||
| } | ||
| interface AbsoluteKeyframe { | ||
| value: AnyResolvedKeyframe | null; | ||
| at: number; | ||
| easing?: Easing; | ||
| } | ||
| type ValueSequence = AbsoluteKeyframe[]; | ||
| interface SequenceMap { | ||
| [key: string]: ValueSequence; | ||
| } | ||
| type ResolvedAnimationDefinition = { | ||
| keyframes: { | ||
| [key: string]: UnresolvedValueKeyframe[]; | ||
| }; | ||
| transition: { | ||
| [key: string]: Transition; | ||
| }; | ||
| }; | ||
| type ResolvedAnimationDefinitions = Map<Element | MotionValue, ResolvedAnimationDefinition>; | ||
| interface ScopedAnimateOptions { | ||
| scope?: AnimationScope; | ||
| reduceMotion?: boolean; | ||
| } | ||
| /** | ||
| * Creates an animation function that is optionally scoped | ||
| * to a specific element. | ||
| */ | ||
| declare function createScopedAnimate(options?: ScopedAnimateOptions): { | ||
| (sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControlsWithThen; | ||
| (value: string | MotionValue<string>, keyframes: string | UnresolvedValueKeyframe<string>[], options?: ValueAnimationTransition<string>): AnimationPlaybackControlsWithThen; | ||
| (value: number | MotionValue<number>, keyframes: number | UnresolvedValueKeyframe<number>[], options?: ValueAnimationTransition<number>): AnimationPlaybackControlsWithThen; | ||
| <V extends string | number>(value: V | MotionValue<V>, keyframes: V | UnresolvedValueKeyframe<V>[], options?: ValueAnimationTransition<V>): AnimationPlaybackControlsWithThen; | ||
| (element: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; | ||
| <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: AnimationOptions): AnimationPlaybackControlsWithThen; | ||
| }; | ||
| declare const animate: { | ||
| (sequence: AnimationSequence, options?: SequenceOptions): AnimationPlaybackControlsWithThen; | ||
| (value: string | MotionValue<string>, keyframes: string | UnresolvedValueKeyframe<string>[], options?: ValueAnimationTransition<string>): AnimationPlaybackControlsWithThen; | ||
| (value: number | MotionValue<number>, keyframes: number | UnresolvedValueKeyframe<number>[], options?: ValueAnimationTransition<number>): AnimationPlaybackControlsWithThen; | ||
| <V extends string | number>(value: V | MotionValue<V>, keyframes: V | UnresolvedValueKeyframe<V>[], options?: ValueAnimationTransition<V>): AnimationPlaybackControlsWithThen; | ||
| (element: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: AnimationOptions): AnimationPlaybackControlsWithThen; | ||
| <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: AnimationOptions): AnimationPlaybackControlsWithThen; | ||
| }; | ||
| declare const animateMini: (elementOrSelector: ElementOrSelector, keyframes: DOMKeyframesDefinition, options?: AnimationOptions) => AnimationPlaybackControlsWithThen; | ||
| interface ScrollOptions { | ||
| source?: HTMLElement; | ||
| container?: Element; | ||
| target?: Element; | ||
| axis?: "x" | "y"; | ||
| offset?: ScrollOffset; | ||
| } | ||
| type OnScrollProgress = (progress: number) => void; | ||
| type OnScrollWithInfo = (progress: number, info: ScrollInfo) => void; | ||
| type OnScroll = OnScrollProgress | OnScrollWithInfo; | ||
| interface AxisScrollInfo { | ||
| current: number; | ||
| offset: number[]; | ||
| progress: number; | ||
| scrollLength: number; | ||
| velocity: number; | ||
| targetOffset: number; | ||
| targetLength: number; | ||
| containerLength: number; | ||
| interpolatorOffsets?: number[]; | ||
| interpolate?: EasingFunction; | ||
| } | ||
| interface ScrollInfo { | ||
| time: number; | ||
| x: AxisScrollInfo; | ||
| y: AxisScrollInfo; | ||
| } | ||
| type OnScrollInfo = (info: ScrollInfo) => void; | ||
| type SupportedEdgeUnit = "px" | "vw" | "vh" | "%"; | ||
| type EdgeUnit = `${number}${SupportedEdgeUnit}`; | ||
| type NamedEdges = "start" | "end" | "center"; | ||
| type EdgeString = NamedEdges | EdgeUnit | `${number}`; | ||
| type Edge = EdgeString | number; | ||
| type ProgressIntersection = [number, number]; | ||
| type Intersection = `${Edge} ${Edge}`; | ||
| type ScrollOffset = Array<Edge | Intersection | ProgressIntersection>; | ||
| interface ScrollInfoOptions { | ||
| container?: Element; | ||
| target?: Element; | ||
| axis?: "x" | "y"; | ||
| offset?: ScrollOffset; | ||
| /** | ||
| * When true, enables per-frame checking of scrollWidth/scrollHeight | ||
| * to detect content size changes and recalculate scroll progress. | ||
| * | ||
| * @default false | ||
| */ | ||
| trackContentSize?: boolean; | ||
| } | ||
| declare function scroll(onScroll: OnScroll | AnimationPlaybackControls, { axis, container, ...options }?: ScrollOptions): VoidFunction; | ||
| declare function scrollInfo(onScroll: OnScrollInfo, { container, trackContentSize, ...options }?: ScrollInfoOptions): VoidFunction; | ||
| type ViewChangeHandler = (entry: IntersectionObserverEntry) => void; | ||
| type MarginValue = `${number}${"px" | "%"}`; | ||
| type MarginType = MarginValue | `${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}`; | ||
| interface InViewOptions { | ||
| root?: Element | Document; | ||
| margin?: MarginType; | ||
| amount?: "some" | "all" | number; | ||
| } | ||
| declare function inView(elementOrSelector: ElementOrSelector, onStart: (element: Element, entry: IntersectionObserverEntry) => void | ViewChangeHandler, { root, margin: rootMargin, amount }?: InViewOptions): VoidFunction; | ||
| declare const distance: (a: number, b: number) => number; | ||
| declare function distance2D(a: Point, b: Point): number; | ||
| type ReorderElementTag = keyof HTMLElements; | ||
| type DefaultGroupElement = "ul"; | ||
| type DefaultItemElement = "li"; | ||
| interface Props$1<V, TagName extends ReorderElementTag = DefaultGroupElement> { | ||
| /** | ||
| * A HTML element to render this component as. Defaults to `"ul"`. | ||
| * | ||
| * @public | ||
| */ | ||
| as?: TagName; | ||
| /** | ||
| * The axis to reorder along. By default, items will be draggable on this axis. | ||
| * To make draggable on both axes, set `<Reorder.Item drag />` | ||
| * | ||
| * @public | ||
| */ | ||
| axis?: "x" | "y"; | ||
| /** | ||
| * A callback to fire with the new value order. For instance, if the values | ||
| * are provided as a state from `useState`, this could be the set state function. | ||
| * | ||
| * @public | ||
| */ | ||
| onReorder: (newOrder: V[]) => void; | ||
| /** | ||
| * The latest values state. | ||
| * | ||
| * ```jsx | ||
| * function Component() { | ||
| * const [items, setItems] = useState([0, 1, 2]) | ||
| * | ||
| * return ( | ||
| * <Reorder.Group values={items} onReorder={setItems}> | ||
| * {items.map((item) => <Reorder.Item key={item} value={item} />)} | ||
| * </Reorder.Group> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| values: V[]; | ||
| } | ||
| type ReorderGroupProps<V, TagName extends ReorderElementTag = DefaultGroupElement> = Props$1<V, TagName> & Omit<HTMLMotionProps<TagName>, "values"> & React$1.PropsWithChildren<{}>; | ||
| declare function ReorderGroupComponent<V, TagName extends ReorderElementTag = DefaultGroupElement>({ children, as, axis, onReorder, values, ...props }: ReorderGroupProps<V, TagName>, externalRef?: React$1.ForwardedRef<any>): JSX.Element; | ||
| declare const ReorderGroup: <V, TagName extends keyof HTMLElements = "ul">(props: ReorderGroupProps<V, TagName> & { | ||
| ref?: React$1.ForwardedRef<any>; | ||
| }) => ReturnType<typeof ReorderGroupComponent>; | ||
| interface Props<V, TagName extends ReorderElementTag = DefaultItemElement> { | ||
| /** | ||
| * A HTML element to render this component as. Defaults to `"li"`. | ||
| * | ||
| * @public | ||
| */ | ||
| as?: TagName; | ||
| /** | ||
| * The value in the list that this component represents. | ||
| * | ||
| * @public | ||
| */ | ||
| value: V; | ||
| /** | ||
| * A subset of layout options primarily used to disable layout="size" | ||
| * | ||
| * @public | ||
| * @default true | ||
| */ | ||
| layout?: true | "position"; | ||
| } | ||
| type ReorderItemProps<V, TagName extends ReorderElementTag = DefaultItemElement> = Props<V, TagName> & Omit<HTMLMotionProps<TagName>, "value" | "layout"> & React$1.PropsWithChildren<{}>; | ||
| declare function ReorderItemComponent<V, TagName extends ReorderElementTag = DefaultItemElement>({ children, style, value, as, onDrag, onDragEnd, layout, ...props }: ReorderItemProps<V, TagName>, externalRef?: React$1.ForwardedRef<any>): React$1.JSX.Element; | ||
| declare const ReorderItem: <V, TagName extends keyof HTMLElements = "li">(props: ReorderItemProps<V, TagName> & { | ||
| ref?: React$1.ForwardedRef<any>; | ||
| }) => ReturnType<typeof ReorderItemComponent>; | ||
| declare namespace namespace_d { | ||
| export { ReorderGroup as Group, ReorderItem as Item }; | ||
| } | ||
| type MotionComponentProps<Props> = { | ||
| [K in Exclude<keyof Props, keyof MotionProps>]?: Props[K]; | ||
| } & MotionProps; | ||
| type MotionComponent<T, P> = T extends keyof DOMMotionComponents ? DOMMotionComponents[T] : React$1.ComponentType<Omit<MotionComponentProps<P>, "children"> & { | ||
| children?: "children" extends keyof P ? P["children"] | MotionComponentProps<P>["children"] : MotionComponentProps<P>["children"]; | ||
| }>; | ||
| interface MotionComponentOptions { | ||
| forwardMotionProps?: boolean; | ||
| /** | ||
| * Specify whether the component renders an HTML or SVG element. | ||
| * This is useful when wrapping custom SVG components that need | ||
| * SVG-specific attribute handling (like viewBox animation). | ||
| * By default, Motion auto-detects based on the component name, | ||
| * but custom React components are always treated as HTML. | ||
| */ | ||
| type?: "html" | "svg"; | ||
| } | ||
| /** | ||
| * Create a `motion` component. | ||
| * | ||
| * This function accepts a Component argument, which can be either a string (ie "div" | ||
| * for `motion.div`), or an actual React component. | ||
| * | ||
| * Alongside this is a config option which provides a way of rendering the provided | ||
| * component "offline", or outside the React render cycle. | ||
| */ | ||
| declare function createMotionComponent<Props, TagName extends keyof DOMMotionComponents | string = "div">(Component: TagName | string | React$1.ComponentType<Props>, { forwardMotionProps, type }?: MotionComponentOptions, preloadedFeatures?: FeaturePackages, createVisualElement?: CreateVisualElement<Props, TagName>): MotionComponent<TagName, Props>; | ||
| declare const m: typeof createMotionComponent & HTMLMotionComponents & SVGMotionComponents & { | ||
| create: typeof createMotionComponent; | ||
| }; | ||
| declare const motion: typeof createMotionComponent & HTMLMotionComponents & SVGMotionComponents & { | ||
| create: typeof createMotionComponent; | ||
| }; | ||
| type EventListenerWithPointInfo = (e: PointerEvent, info: EventInfo) => void; | ||
| declare const addPointerInfo: (handler: EventListenerWithPointInfo) => EventListener; | ||
| declare function addPointerEvent(target: EventTarget, eventName: string, handler: EventListenerWithPointInfo, options?: AddEventListenerOptions): () => void; | ||
| declare const animations: FeaturePackages; | ||
| type AnimationType = "animate" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "exit"; | ||
| declare const isBrowser: boolean; | ||
| /** | ||
| * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx | ||
| */ | ||
| type PossibleRef<T> = React$1.Ref<T> | undefined; | ||
| /** | ||
| * A custom hook that composes multiple refs | ||
| * Accepts callback refs and RefObject(s) | ||
| */ | ||
| declare function useComposedRefs<T>(...refs: PossibleRef<T>[]): React$1.RefCallback<T>; | ||
| declare function useForceUpdate(): [VoidFunction, number]; | ||
| declare const useIsomorphicLayoutEffect: typeof useEffect; | ||
| declare function useUnmountEffect(callback: () => void): void; | ||
| /** | ||
| * @public | ||
| */ | ||
| declare const domAnimation: FeatureBundle; | ||
| /** | ||
| * @public | ||
| */ | ||
| declare const domMax: FeatureBundle; | ||
| /** | ||
| * @public | ||
| */ | ||
| declare const domMin: FeatureBundle; | ||
| declare function useMotionValueEvent<V, EventName extends keyof MotionValueEventCallbacks<V>>(value: MotionValue<V>, event: EventName, callback: MotionValueEventCallbacks<V>[EventName]): void; | ||
| /** | ||
| * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref }) | ||
| */ | ||
| declare function useElementScroll(ref: RefObject<HTMLElement | null>): { | ||
| scrollX: motion_dom.MotionValue<number>; | ||
| scrollY: motion_dom.MotionValue<number>; | ||
| scrollXProgress: motion_dom.MotionValue<number>; | ||
| scrollYProgress: motion_dom.MotionValue<number>; | ||
| }; | ||
| /** | ||
| * @deprecated useViewportScroll is deprecated. Convert to useScroll() | ||
| */ | ||
| declare function useViewportScroll(): { | ||
| scrollX: motion_dom.MotionValue<number>; | ||
| scrollY: motion_dom.MotionValue<number>; | ||
| scrollXProgress: motion_dom.MotionValue<number>; | ||
| scrollYProgress: motion_dom.MotionValue<number>; | ||
| }; | ||
| /** | ||
| * Combine multiple motion values into a new one using a string template literal. | ||
| * | ||
| * ```jsx | ||
| * import { | ||
| * motion, | ||
| * useSpring, | ||
| * useMotionValue, | ||
| * useMotionTemplate | ||
| * } from "framer-motion" | ||
| * | ||
| * function Component() { | ||
| * const shadowX = useSpring(0) | ||
| * const shadowY = useMotionValue(0) | ||
| * const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))` | ||
| * | ||
| * return <motion.div style={{ filter: shadow }} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useMotionTemplate(fragments: TemplateStringsArray, ...values: Array<MotionValue | number | string>): MotionValue<string>; | ||
| /** | ||
| * Creates a `MotionValue` to track the state and velocity of a value. | ||
| * | ||
| * Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const scale = useMotionValue(1) | ||
| * | ||
| * return <motion.div style={{ scale }} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param initial - The initial state. | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useMotionValue<T>(initial: T): MotionValue<T>; | ||
| interface UseScrollOptions extends Omit<ScrollInfoOptions, "container" | "target"> { | ||
| container?: RefObject<HTMLElement | null>; | ||
| target?: RefObject<HTMLElement | null>; | ||
| } | ||
| declare function useScroll({ container, target, ...options }?: UseScrollOptions): { | ||
| scrollX: motion_dom.MotionValue<number>; | ||
| scrollY: motion_dom.MotionValue<number>; | ||
| scrollXProgress: motion_dom.MotionValue<number>; | ||
| scrollYProgress: motion_dom.MotionValue<number>; | ||
| }; | ||
| /** | ||
| * Creates a `MotionValue` that, when `set`, will use the specified animation transition to animate to its new state. | ||
| * | ||
| * Unlike `useSpring` which is limited to spring animations, `useFollowValue` accepts any motion transition | ||
| * including spring, tween, inertia, and keyframes. | ||
| * | ||
| * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber | ||
| * to another `MotionValue`. | ||
| * | ||
| * @remarks | ||
| * | ||
| * ```jsx | ||
| * // Spring animation (default) | ||
| * const x = useFollowValue(0, { stiffness: 300 }) | ||
| * | ||
| * // Tween animation | ||
| * const y = useFollowValue(0, { type: "tween", duration: 0.5, ease: "easeOut" }) | ||
| * | ||
| * // Track another MotionValue with spring | ||
| * const source = useMotionValue(0) | ||
| * const z = useFollowValue(source, { type: "spring", damping: 10 }) | ||
| * | ||
| * // Inertia animation | ||
| * const w = useFollowValue(0, { type: "inertia", velocity: 100 }) | ||
| * ``` | ||
| * | ||
| * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will animate towards that value using the specified transition. | ||
| * @param options - Animation transition options. Supports all transition types: spring, tween, inertia, keyframes. | ||
| * @returns `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useFollowValue(source: MotionValue<string>, options?: FollowValueOptions): MotionValue<string>; | ||
| declare function useFollowValue(source: string, options?: FollowValueOptions): MotionValue<string>; | ||
| declare function useFollowValue(source: MotionValue<number>, options?: FollowValueOptions): MotionValue<number>; | ||
| declare function useFollowValue(source: number, options?: FollowValueOptions): MotionValue<number>; | ||
| type UseSpringOptions = SpringOptions & Pick<FollowValueOptions, "skipInitialAnimation">; | ||
| /** | ||
| * Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state. | ||
| * | ||
| * It can either work as a stand-alone `MotionValue` by initialising it with a value, or as a subscriber | ||
| * to another `MotionValue`. | ||
| * | ||
| * @remarks | ||
| * | ||
| * ```jsx | ||
| * const x = useSpring(0, { stiffness: 300 }) | ||
| * const y = useSpring(x, { damping: 10 }) | ||
| * ``` | ||
| * | ||
| * @param inputValue - `MotionValue` or number. If provided a `MotionValue`, when the input `MotionValue` changes, the created `MotionValue` will spring towards that value. | ||
| * @param springConfig - Configuration options for the spring. | ||
| * @returns `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useSpring(source: MotionValue<string>, options?: UseSpringOptions): MotionValue<string>; | ||
| declare function useSpring(source: string, options?: UseSpringOptions): MotionValue<string>; | ||
| declare function useSpring(source: MotionValue<number>, options?: UseSpringOptions): MotionValue<number>; | ||
| declare function useSpring(source: number, options?: UseSpringOptions): MotionValue<number>; | ||
| declare function useTime(): motion_dom.MotionValue<number>; | ||
| type InputRange = number[]; | ||
| type SingleTransformer<I, O> = (input: I) => O; | ||
| type MultiTransformer<I, O> = (input: I[]) => O; | ||
| /** | ||
| * Create multiple `MotionValue`s that transform the output of another `MotionValue` by mapping it from one range of values into multiple output ranges. | ||
| * | ||
| * @remarks | ||
| * | ||
| * This is useful when you want to derive multiple values from a single input value. | ||
| * The keys of the output map must remain constant across renders. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(0) | ||
| * const { opacity, scale } = useTransform(x, [0, 100], { | ||
| * opacity: [0, 1], | ||
| * scale: [0.5, 1] | ||
| * }) | ||
| * | ||
| * return ( | ||
| * <motion.div style={{ opacity, scale, x }} /> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param inputValue - `MotionValue` | ||
| * @param inputRange - A linear series of numbers (either all increasing or decreasing) | ||
| * @param outputMap - An object where keys map to output ranges. Each output range must be the same length as `inputRange`. | ||
| * @param options - Transform options applied to all outputs | ||
| * | ||
| * @returns An object with the same keys as `outputMap`, where each value is a `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useTransform<T extends Record<string, any[]>>(inputValue: MotionValue<number>, inputRange: InputRange, outputMap: T, options?: TransformOptions<T[keyof T][number]>): { | ||
| [K in keyof T]: MotionValue<T[K][number]>; | ||
| }; | ||
| /** | ||
| * Create a `MotionValue` that transforms the output of another `MotionValue` by mapping it from one range of values into another. | ||
| * | ||
| * @remarks | ||
| * | ||
| * Given an input range of `[-200, -100, 100, 200]` and an output range of | ||
| * `[0, 1, 1, 0]`, the returned `MotionValue` will: | ||
| * | ||
| * - When provided a value between `-200` and `-100`, will return a value between `0` and `1`. | ||
| * - When provided a value between `-100` and `100`, will return `1`. | ||
| * - When provided a value between `100` and `200`, will return a value between `1` and `0` | ||
| * | ||
| * | ||
| * The input range must be a linear series of numbers. The output range | ||
| * can be any value type supported by Motion: numbers, colors, shadows, etc. | ||
| * | ||
| * Every value in the output range must be of the same type and in the same format. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(0) | ||
| * const xRange = [-200, -100, 100, 200] | ||
| * const opacityRange = [0, 1, 1, 0] | ||
| * const opacity = useTransform(x, xRange, opacityRange) | ||
| * | ||
| * return ( | ||
| * <motion.div | ||
| * animate={{ x: 200 }} | ||
| * style={{ opacity, x }} | ||
| * /> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param inputValue - `MotionValue` | ||
| * @param inputRange - A linear series of numbers (either all increasing or decreasing) | ||
| * @param outputRange - A series of numbers, colors or strings. Must be the same length as `inputRange`. | ||
| * @param options - | ||
| * | ||
| * - clamp: boolean. Clamp values to within the given range. Defaults to `true` | ||
| * - ease: EasingFunction[]. Easing functions to use on the interpolations between each value in the input and output ranges. If provided as an array, the array must be one item shorter than the input and output ranges, as the easings apply to the transition between each. | ||
| * | ||
| * @returns `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useTransform<I, O>(value: MotionValue<number>, inputRange: InputRange, outputRange: O[], options?: TransformOptions<O>): MotionValue<O>; | ||
| /** | ||
| * Create a `MotionValue` that transforms the output of another `MotionValue` through a function. | ||
| * In this example, `y` will always be double `x`. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(10) | ||
| * const y = useTransform(x, value => value * 2) | ||
| * | ||
| * return <motion.div style={{ x, y }} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param input - A `MotionValue` that will pass its latest value through `transform` to update the returned `MotionValue`. | ||
| * @param transform - A function that accepts the latest value from `input` and returns a new value. | ||
| * @returns `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useTransform<I, O>(input: MotionValue<I>, transformer: SingleTransformer<I, O>): MotionValue<O>; | ||
| /** | ||
| * Pass an array of `MotionValue`s and a function to combine them. In this example, `z` will be the `x` multiplied by `y`. | ||
| * | ||
| * ```jsx | ||
| * export const MyComponent = () => { | ||
| * const x = useMotionValue(0) | ||
| * const y = useMotionValue(0) | ||
| * const z = useTransform([x, y], ([latestX, latestY]) => latestX * latestY) | ||
| * | ||
| * return <motion.div style={{ x, y, z }} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param input - An array of `MotionValue`s that will pass their latest values through `transform` to update the returned `MotionValue`. | ||
| * @param transform - A function that accepts the latest values from `input` and returns a new value. | ||
| * @returns `MotionValue` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useTransform<I, O>(input: MotionValue<string>[] | MotionValue<number>[] | MotionValue<AnyResolvedKeyframe>[], transformer: MultiTransformer<I, O>): MotionValue<O>; | ||
| declare function useTransform<I, O>(transformer: () => O): MotionValue<O>; | ||
| /** | ||
| * Creates a `MotionValue` that updates when the velocity of the provided `MotionValue` changes. | ||
| * | ||
| * ```javascript | ||
| * const x = useMotionValue(0) | ||
| * const xVelocity = useVelocity(x) | ||
| * const xAcceleration = useVelocity(xVelocity) | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useVelocity(value: MotionValue<number>): MotionValue<number>; | ||
| declare function useWillChange(): WillChange; | ||
| declare class WillChangeMotionValue extends MotionValue<string> implements WillChange { | ||
| private isEnabled; | ||
| add(name: string): void; | ||
| private update; | ||
| } | ||
| /** | ||
| * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting. | ||
| * | ||
| * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing | ||
| * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion. | ||
| * | ||
| * It will actively respond to changes and re-render your components with the latest setting. | ||
| * | ||
| * ```jsx | ||
| * export function Sidebar({ isOpen }) { | ||
| * const shouldReduceMotion = useReducedMotion() | ||
| * const closedX = shouldReduceMotion ? 0 : "-100%" | ||
| * | ||
| * return ( | ||
| * <motion.div animate={{ | ||
| * opacity: isOpen ? 1 : 0, | ||
| * x: isOpen ? 0 : closedX | ||
| * }} /> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @return boolean | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useReducedMotion(): boolean | null; | ||
| declare function useReducedMotionConfig(): boolean | null; | ||
| /** | ||
| * @public | ||
| */ | ||
| declare function animationControls(): LegacyAnimationControls; | ||
| declare function useAnimate<T extends Element = any>(): [AnimationScope<T>, { | ||
| (sequence: AnimationSequence, options?: SequenceOptions | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| (value: string | motion_dom.MotionValue<string>, keyframes: string | motion_dom.UnresolvedValueKeyframe<string>[], options?: motion_dom.ValueAnimationTransition<string> | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| (value: number | motion_dom.MotionValue<number>, keyframes: number | motion_dom.UnresolvedValueKeyframe<number>[], options?: motion_dom.ValueAnimationTransition<number> | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| <V extends string | number>(value: V | motion_dom.MotionValue<V>, keyframes: V | motion_dom.UnresolvedValueKeyframe<V>[], options?: motion_dom.ValueAnimationTransition<V> | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| (element: motion_dom.ElementOrSelector, keyframes: motion_dom.DOMKeyframesDefinition, options?: motion_dom.AnimationOptions | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| <O extends {}>(object: O | O[], keyframes: ObjectTarget<O>, options?: motion_dom.AnimationOptions | undefined): motion_dom.AnimationPlaybackControlsWithThen; | ||
| }]; | ||
| declare function useAnimateMini<T extends Element = any>(): [AnimationScope<T>, (elementOrSelector: motion_dom.ElementOrSelector, keyframes: motion_dom.DOMKeyframesDefinition, options?: motion_dom.AnimationOptions | undefined) => motion_dom.AnimationPlaybackControlsWithThen]; | ||
| /** | ||
| * Creates `LegacyAnimationControls`, which can be used to manually start, stop | ||
| * and sequence animations on one or more components. | ||
| * | ||
| * The returned `LegacyAnimationControls` should be passed to the `animate` property | ||
| * of the components you want to animate. | ||
| * | ||
| * These components can then be animated with the `start` method. | ||
| * | ||
| * ```jsx | ||
| * import * as React from 'react' | ||
| * import { motion, useAnimation } from 'framer-motion' | ||
| * | ||
| * export function MyComponent(props) { | ||
| * const controls = useAnimation() | ||
| * | ||
| * controls.start({ | ||
| * x: 100, | ||
| * transition: { duration: 0.5 }, | ||
| * }) | ||
| * | ||
| * return <motion.div animate={controls} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @returns Animation controller with `start` and `stop` methods | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useAnimationControls(): LegacyAnimationControls; | ||
| declare const useAnimation: typeof useAnimationControls; | ||
| type SafeToRemove = () => void; | ||
| type AlwaysPresent = [true, null]; | ||
| type Present = [true]; | ||
| type NotPresent = [false, SafeToRemove]; | ||
| /** | ||
| * When a component is the child of `AnimatePresence`, it can use `usePresence` | ||
| * to access information about whether it's still present in the React tree. | ||
| * | ||
| * ```jsx | ||
| * import { usePresence } from "framer-motion" | ||
| * | ||
| * export const Component = () => { | ||
| * const [isPresent, safeToRemove] = usePresence() | ||
| * | ||
| * useEffect(() => { | ||
| * !isPresent && setTimeout(safeToRemove, 1000) | ||
| * }, [isPresent]) | ||
| * | ||
| * return <div /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * If `isPresent` is `false`, it means that a component has been removed from the tree, | ||
| * but `AnimatePresence` won't really remove it until `safeToRemove` has been called. | ||
| * | ||
| * @public | ||
| */ | ||
| declare function usePresence(subscribe?: boolean): AlwaysPresent | Present | NotPresent; | ||
| /** | ||
| * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present. | ||
| * There is no `safeToRemove` function. | ||
| * | ||
| * ```jsx | ||
| * import { useIsPresent } from "framer-motion" | ||
| * | ||
| * export const Component = () => { | ||
| * const isPresent = useIsPresent() | ||
| * | ||
| * useEffect(() => { | ||
| * !isPresent && console.log("I've been removed!") | ||
| * }, [isPresent]) | ||
| * | ||
| * return <div /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useIsPresent(): boolean; | ||
| declare function usePresenceData(): any; | ||
| /** | ||
| * Attaches an event listener directly to the provided DOM element. | ||
| * | ||
| * Bypassing React's event system can be desirable, for instance when attaching non-passive | ||
| * event handlers. | ||
| * | ||
| * ```jsx | ||
| * const ref = useRef(null) | ||
| * | ||
| * useDomEvent(ref, 'wheel', onWheel, { passive: false }) | ||
| * | ||
| * return <div ref={ref} /> | ||
| * ``` | ||
| * | ||
| * @param ref - React.RefObject that's been provided to the element you want to bind the listener to. | ||
| * @param eventName - Name of the event you want listen for. | ||
| * @param handler - Function to fire when receiving the event. | ||
| * @param options - Options to pass to `Event.addEventListener`. | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useDomEvent(ref: RefObject<EventTarget | null>, eventName: string, handler?: EventListener | undefined, options?: AddEventListenerOptions): void; | ||
| interface DragControlOptions { | ||
| /** | ||
| * This distance after which dragging starts and a direction is locked in. | ||
| * | ||
| * @public | ||
| */ | ||
| distanceThreshold?: number; | ||
| /** | ||
| * Whether to immediately snap to the cursor when dragging starts. | ||
| * | ||
| * @public | ||
| */ | ||
| snapToCursor?: boolean; | ||
| } | ||
| /** | ||
| * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components. | ||
| * | ||
| * ```jsx | ||
| * const dragControls = useDragControls() | ||
| * | ||
| * function startDrag(event) { | ||
| * dragControls.start(event, { snapToCursor: true }) | ||
| * } | ||
| * | ||
| * return ( | ||
| * <> | ||
| * <div onPointerDown={startDrag} /> | ||
| * <motion.div drag="x" dragControls={dragControls} /> | ||
| * </> | ||
| * ) | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare class DragControls { | ||
| private componentControls; | ||
| /** | ||
| * Start a drag gesture on every `motion` component that has this set of drag controls | ||
| * passed into it via the `dragControls` prop. | ||
| * | ||
| * ```jsx | ||
| * dragControls.start(e, { | ||
| * snapToCursor: true | ||
| * }) | ||
| * ``` | ||
| * | ||
| * @param event - PointerEvent | ||
| * @param options - Options | ||
| * | ||
| * @public | ||
| */ | ||
| start(event: React$1.PointerEvent | PointerEvent, options?: DragControlOptions): void; | ||
| /** | ||
| * Cancels a drag gesture. | ||
| * | ||
| * ```jsx | ||
| * dragControls.cancel() | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| cancel(): void; | ||
| /** | ||
| * Stops a drag gesture. | ||
| * | ||
| * ```jsx | ||
| * dragControls.stop() | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| stop(): void; | ||
| } | ||
| /** | ||
| * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop | ||
| * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we | ||
| * might want to initiate that dragging from a different component than the draggable one. | ||
| * | ||
| * By creating a `dragControls` using the `useDragControls` hook, we can pass this into | ||
| * the draggable component's `dragControls` prop. It exposes a `start` method | ||
| * that can start dragging from pointer events on other components. | ||
| * | ||
| * ```jsx | ||
| * const dragControls = useDragControls() | ||
| * | ||
| * function startDrag(event) { | ||
| * dragControls.start(event, { snapToCursor: true }) | ||
| * } | ||
| * | ||
| * return ( | ||
| * <> | ||
| * <div onPointerDown={startDrag} /> | ||
| * <motion.div drag="x" dragControls={dragControls} /> | ||
| * </> | ||
| * ) | ||
| * ``` | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useDragControls(): DragControls; | ||
| /** | ||
| * Checks if a component is a `motion` component. | ||
| */ | ||
| declare function isMotionComponent(component: React.ComponentType | string): boolean; | ||
| /** | ||
| * Unwraps a `motion` component and returns either a string for `motion.div` or | ||
| * the React component for `motion(Component)`. | ||
| * | ||
| * If the component is not a `motion` component it returns undefined. | ||
| */ | ||
| declare function unwrapMotionComponent(component: React.ComponentType | string): React.ComponentType | string | undefined; | ||
| /** | ||
| * Check whether a prop name is a valid `MotionProp` key. | ||
| * | ||
| * @param key - Name of the property to check | ||
| * @returns `true` is key is a valid `MotionProp`. | ||
| * | ||
| * @public | ||
| */ | ||
| declare function isValidMotionProp(key: string): boolean; | ||
| declare function useInstantLayoutTransition(): (cb?: (() => void) | undefined) => void; | ||
| declare function useResetProjection(): () => void; | ||
| type FrameCallback = (timestamp: number, delta: number) => void; | ||
| declare function useAnimationFrame(callback: FrameCallback): void; | ||
| type Cycle = (i?: number) => void; | ||
| type CycleState<T> = [T, Cycle]; | ||
| /** | ||
| * Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments. | ||
| * | ||
| * An index value can be passed to the returned `cycle` function to cycle to a specific index. | ||
| * | ||
| * ```jsx | ||
| * import * as React from "react" | ||
| * import { motion, useCycle } from "framer-motion" | ||
| * | ||
| * export const MyComponent = () => { | ||
| * const [x, cycleX] = useCycle(0, 50, 100) | ||
| * | ||
| * return ( | ||
| * <motion.div | ||
| * animate={{ x: x }} | ||
| * onTap={() => cycleX()} | ||
| * /> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param items - items to cycle through | ||
| * @returns [currentState, cycleState] | ||
| * | ||
| * @public | ||
| */ | ||
| declare function useCycle<T>(...items: T[]): CycleState<T>; | ||
| interface UseInViewOptions extends Omit<InViewOptions, "root" | "amount"> { | ||
| root?: RefObject<Element | null>; | ||
| once?: boolean; | ||
| amount?: "some" | "all" | number; | ||
| initial?: boolean; | ||
| } | ||
| declare function useInView(ref: RefObject<Element | null>, { root, margin, amount, once, initial, }?: UseInViewOptions): boolean; | ||
| declare function useInstantTransition(): (callback: () => void) => void; | ||
| declare function disableInstantTransitions(): void; | ||
| declare function usePageInView(): boolean; | ||
| /** | ||
| * Creates a `transformPagePoint` function that accounts for SVG viewBox scaling. | ||
| * | ||
| * When dragging SVG elements inside an SVG with a viewBox that differs from | ||
| * the rendered dimensions (e.g., `viewBox="0 0 100 100"` but rendered at 500x500 pixels), | ||
| * pointer coordinates need to be transformed to match the SVG's coordinate system. | ||
| * | ||
| * @example | ||
| * ```jsx | ||
| * function App() { | ||
| * const svgRef = useRef<SVGSVGElement>(null) | ||
| * | ||
| * return ( | ||
| * <MotionConfig transformPagePoint={transformViewBoxPoint(svgRef)}> | ||
| * <svg ref={svgRef} viewBox="0 0 100 100" width={500} height={500}> | ||
| * <motion.rect drag width={10} height={10} /> | ||
| * </svg> | ||
| * </MotionConfig> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param svgRef - A React ref to the SVG element | ||
| * @returns A transformPagePoint function for use with MotionConfig | ||
| * | ||
| * @public | ||
| */ | ||
| declare function transformViewBoxPoint(svgRef: RefObject<SVGSVGElement | null>): TransformPoint; | ||
| /** | ||
| * Creates a `transformPagePoint` function that corrects pointer coordinates | ||
| * for a parent container with CSS transforms (rotation, scale, skew). | ||
| * | ||
| * When dragging elements inside a transformed parent, pointer coordinates | ||
| * need to be transformed through the inverse of the parent's transform | ||
| * so the drag offset is in local space. | ||
| * | ||
| * Works with both static and continuously animating transforms. | ||
| * | ||
| * @example | ||
| * ```jsx | ||
| * function App() { | ||
| * const ref = useRef(null) | ||
| * | ||
| * return ( | ||
| * <motion.div ref={ref} style={{ rotate: 90 }}> | ||
| * <MotionConfig transformPagePoint={correctParentTransform(ref)}> | ||
| * <motion.div drag /> | ||
| * </MotionConfig> | ||
| * </motion.div> | ||
| * ) | ||
| * } | ||
| * ``` | ||
| * | ||
| * @param parentRef - A React ref to the transformed parent element | ||
| * @returns A transformPagePoint function for use with MotionConfig | ||
| * | ||
| * @public | ||
| */ | ||
| declare function correctParentTransform(parentRef: RefObject<HTMLElement | null>): TransformPoint; | ||
| declare function startOptimizedAppearAnimation(element: HTMLElement, name: string, keyframes: string[] | number[], options: ValueAnimationTransition<number | string>, onReady?: (animation: Animation) => void): void; | ||
| interface LayoutGroupContextProps { | ||
| id?: string; | ||
| group?: NodeGroup; | ||
| forceRender?: VoidFunction; | ||
| } | ||
| declare const LayoutGroupContext: React$1.Context<LayoutGroupContextProps>; | ||
| interface MotionContextProps<Instance = unknown> { | ||
| visualElement?: VisualElement<Instance>; | ||
| initial?: false | string | string[]; | ||
| animate?: string | string[]; | ||
| } | ||
| declare const MotionContext: React$1.Context<MotionContextProps<unknown>>; | ||
| interface SwitchLayoutGroup { | ||
| register?: (member: IProjectionNode) => void; | ||
| deregister?: (member: IProjectionNode) => void; | ||
| } | ||
| type InitialPromotionConfig = { | ||
| /** | ||
| * The initial transition to use when the elements in this group mount (and automatically promoted). | ||
| * Subsequent updates should provide a transition in the promote method. | ||
| */ | ||
| transition?: Transition; | ||
| /** | ||
| * If the follow tree should preserve its opacity when the lead is promoted on mount | ||
| */ | ||
| shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean; | ||
| }; | ||
| type SwitchLayoutGroupContext = SwitchLayoutGroup & InitialPromotionConfig; | ||
| /** | ||
| * Internal, exported only for usage in Framer | ||
| */ | ||
| declare const SwitchLayoutGroupContext: React$1.Context<SwitchLayoutGroupContext>; | ||
| /** | ||
| * @public | ||
| */ | ||
| interface ScrollMotionValues { | ||
| scrollX: MotionValue<number>; | ||
| scrollY: MotionValue<number>; | ||
| scrollXProgress: MotionValue<number>; | ||
| scrollYProgress: MotionValue<number>; | ||
| } | ||
| /** | ||
| * This is not an officially supported API and may be removed | ||
| * on any version. | ||
| */ | ||
| declare function useAnimatedState(initialState: any): any[]; | ||
| declare const AnimateSharedLayout: React$1.FunctionComponent<React$1.PropsWithChildren<unknown>>; | ||
| /** | ||
| * Note: Still used by components generated by old versions of Framer | ||
| * | ||
| * @deprecated | ||
| */ | ||
| declare const DeprecatedLayoutGroupContext: React$1.Context<string | null>; | ||
| interface ScaleMotionValues { | ||
| scaleX: MotionValue<number>; | ||
| scaleY: MotionValue<number>; | ||
| } | ||
| /** | ||
| * Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse | ||
| * of their respective parent scales. | ||
| * | ||
| * This is useful for undoing the distortion of content when scaling a parent component. | ||
| * | ||
| * By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent. | ||
| * By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output | ||
| * of those instead. | ||
| * | ||
| * ```jsx | ||
| * const MyComponent = () => { | ||
| * const { scaleX, scaleY } = useInvertedScale() | ||
| * return <motion.div style={{ scaleX, scaleY }} /> | ||
| * } | ||
| * ``` | ||
| * | ||
| * @deprecated | ||
| */ | ||
| declare function useInvertedScale(scale?: Partial<ScaleMotionValues>): ScaleMotionValues; | ||
| export { type AbsoluteKeyframe, AnimatePresence, type AnimatePresenceProps, AnimateSharedLayout, type AnimationSequence, type AnimationType, type At, type CreateVisualElement, type Cycle, type CycleState, type DOMMotionComponents, type DOMSegment, type DOMSegmentWithTransition, DeprecatedLayoutGroupContext, DragControls, type FeatureBundle, type FeatureDefinition, type FeatureDefinitions, type FeaturePackage, type FeaturePackages, type FunctionSegment, HTMLElements, HTMLMotionProps, type HydratedFeatureDefinition, type HydratedFeatureDefinitions, LayoutGroup, LayoutGroupContext, type LazyFeatureBundle$1 as LazyFeatureBundle, LazyMotion, type LazyProps, MotionConfig, MotionConfigContext, type MotionConfigProps, MotionContext, MotionProps, type MotionValueSegment, type MotionValueSegmentWithTransition, type ObjectSegment, type ObjectSegmentWithTransition, type ObjectTarget, PopChild, PresenceChild, PresenceContext, namespace_d as Reorder, type ResolveKeyframes, type ResolvedAnimationDefinition, type ResolvedAnimationDefinitions, type ScrapeMotionValuesFromProps, type ScrollMotionValues, type Segment, type SegmentTransitionOptions, type SegmentValueTransitionOptions, type SequenceLabel, type SequenceLabelWithTime, type SequenceMap, type SequenceOptions, type SequenceProgressCallback, type SequenceTime, SwitchLayoutGroupContext, type UseInViewOptions, type UseScrollOptions, type ValueSequence, VariantLabels, type VisualState, WillChangeMotionValue, addPointerEvent, addPointerInfo, animate, animateMini, animationControls, animations, correctParentTransform, createScopedAnimate, disableInstantTransitions, distance, distance2D, domAnimation, domMax, domMin, filterProps, inView, isBrowser, isMotionComponent, isValidMotionProp, m, makeUseVisualState, motion, scroll, scrollInfo, startOptimizedAppearAnimation, transformViewBoxPoint, unwrapMotionComponent, useAnimate, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useComposedRefs, useCycle, useAnimatedState as useDeprecatedAnimatedState, useInvertedScale as useDeprecatedInvertedScale, useDomEvent, useDragControls, useElementScroll, useFollowValue, useForceUpdate, useInView, useInstantLayoutTransition, useInstantTransition, useIsPresent, useIsomorphicLayoutEffect, useMotionTemplate, useMotionValue, useMotionValueEvent, usePageInView, usePresence, usePresenceData, useReducedMotion, useReducedMotionConfig, useResetProjection, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVelocity, useViewportScroll, useWillChange }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
382
0.79%31
-6.06%4706392
-0.52%37625
-0.11%137
-1.44%Updated
Updated