@nethesis/phone-island 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/components/CallView/index.js +1 -1
  2. package/dist/components/CallView/index.js.map +1 -1
  3. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js +1 -1
  4. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs.js.map +1 -1
  5. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js +1 -1
  6. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs.js.map +1 -1
  7. package/dist/node_modules/js-base64/base64.mjs.js +1 -1
  8. package/dist/node_modules/js-base64/base64.mjs.js.map +1 -1
  9. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.mjs.js.map +1 -1
  10. package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs.js.map +1 -1
  11. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js +1 -1
  12. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.mjs.js.map +1 -1
  13. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js +1 -1
  14. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.mjs.js.map +1 -1
  15. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js +1 -1
  16. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.mjs.js.map +1 -1
  17. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js +1 -1
  18. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.mjs.js.map +1 -1
  19. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js +1 -1
  20. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs.js.map +1 -1
  21. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js +1 -1
  22. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs.js.map +1 -1
  23. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js +1 -1
  24. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs.js.map +1 -1
  25. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js +2 -0
  26. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.mjs.js.map +1 -0
  27. package/dist/node_modules/react-redux/node_modules/react-is/index.js +1 -1
  28. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -1
  29. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +1 -1
  30. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  31. package/dist/package.json.js +1 -1
  32. package/package.json +1 -1
  33. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js +0 -2
  34. package/dist/node_modules/motion-dom/dist/es/stats/buffer.mjs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"JSAnimation.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/animation/JSAnimation.mjs"],"sourcesContent":["import { invariant, pipe, clamp, millisecondsToSeconds, secondsToMilliseconds } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { activeAnimations } from '../stats/animation-count.mjs';\nimport { mix } from '../utils/mix/index.mjs';\nimport { frameloopDriver } from './drivers/frame.mjs';\nimport { inertia } from './generators/inertia.mjs';\nimport { keyframes } from './generators/keyframes.mjs';\nimport { calcGeneratorDuration } from './generators/utils/calc-duration.mjs';\nimport { getGeneratorVelocity } from './generators/utils/velocity.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { replaceTransitionType } from './utils/replace-transition-type.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\n\nconst percentToProgress = (percent) => percent / 100;\nclass JSAnimation extends WithPromise {\n constructor(options) {\n super();\n this.state = \"idle\";\n this.startTime = null;\n this.isStopped = false;\n /**\n * The current time of the animation.\n */\n this.currentTime = 0;\n /**\n * The time at which the animation was paused.\n */\n this.holdTime = null;\n /**\n * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.\n */\n this.playbackSpeed = 1;\n /**\n * Reusable state object for the delay phase to avoid\n * allocating a new object every frame.\n */\n this.delayState = {\n done: false,\n value: undefined,\n };\n /**\n * This method is bound to the instance to fix a pattern where\n * animation.stop is returned as a reference from a useEffect.\n */\n this.stop = () => {\n const { motionValue } = this.options;\n if (motionValue && motionValue.updatedAt !== time.now()) {\n this.tick(time.now());\n }\n this.isStopped = true;\n if (this.state === \"idle\")\n return;\n this.teardown();\n this.options.onStop?.();\n };\n activeAnimations.mainThread++;\n this.options = options;\n this.initAnimation();\n this.play();\n if (options.autoplay === false)\n this.pause();\n }\n initAnimation() {\n const { options } = this;\n replaceTransitionType(options);\n const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = options;\n let { keyframes: keyframes$1 } = options;\n const generatorFactory = type || keyframes;\n if (process.env.NODE_ENV !== \"production\" &&\n generatorFactory !== keyframes) {\n invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, \"spring-two-frames\");\n }\n if (generatorFactory !== keyframes &&\n typeof keyframes$1[0] !== \"number\") {\n this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));\n keyframes$1 = [0, 100];\n }\n const generator = generatorFactory({ ...options, keyframes: keyframes$1 });\n /**\n * If we have a mirror repeat type we need to create a second generator that outputs the\n * mirrored (not reversed) animation and later ping pong between the two generators.\n */\n if (repeatType === \"mirror\") {\n this.mirroredGenerator = generatorFactory({\n ...options,\n keyframes: [...keyframes$1].reverse(),\n velocity: -velocity,\n });\n }\n /**\n * If duration is undefined and we have repeat options,\n * we need to calculate a duration from the generator.\n *\n * We set it to the generator itself to cache the duration.\n * Any timeline resolver will need to have already precalculated\n * the duration by this step.\n */\n if (generator.calculatedDuration === null) {\n generator.calculatedDuration = calcGeneratorDuration(generator);\n }\n const { calculatedDuration } = generator;\n this.calculatedDuration = calculatedDuration;\n this.resolvedDuration = calculatedDuration + repeatDelay;\n this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay;\n this.generator = generator;\n }\n updateTime(timestamp) {\n const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed;\n // Update currentTime\n if (this.holdTime !== null) {\n this.currentTime = this.holdTime;\n }\n else {\n // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =\n // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for\n // example.\n this.currentTime = animationTime;\n }\n }\n tick(timestamp, sample = false) {\n const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration, } = this;\n if (this.startTime === null)\n return generator.next(0);\n const { delay = 0, keyframes, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe, } = this.options;\n /**\n * requestAnimationFrame timestamps can come through as lower than\n * the startTime as set by performance.now(). Here we prevent this,\n * though in the future it could be possible to make setting startTime\n * a pending operation that gets resolved here.\n */\n if (this.speed > 0) {\n this.startTime = Math.min(this.startTime, timestamp);\n }\n else if (this.speed < 0) {\n this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);\n }\n if (sample) {\n this.currentTime = timestamp;\n }\n else {\n this.updateTime(timestamp);\n }\n // Rebase on delay\n const timeWithoutDelay = this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1);\n const isInDelayPhase = this.playbackSpeed >= 0\n ? timeWithoutDelay < 0\n : timeWithoutDelay > totalDuration;\n this.currentTime = Math.max(timeWithoutDelay, 0);\n // If this animation has finished, set the current time to the total duration.\n if (this.state === \"finished\" && this.holdTime === null) {\n this.currentTime = totalDuration;\n }\n let elapsed = this.currentTime;\n let frameGenerator = generator;\n if (repeat) {\n /**\n * Get the current progress (0-1) of the animation. If t is >\n * than duration we'll get values like 2.5 (midway through the\n * third iteration)\n */\n const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;\n /**\n * Get the current iteration (0 indexed). For instance the floor of\n * 2.5 is 2.\n */\n let currentIteration = Math.floor(progress);\n /**\n * Get the current progress of the iteration by taking the remainder\n * so 2.5 is 0.5 through iteration 2\n */\n let iterationProgress = progress % 1.0;\n /**\n * If iteration progress is 1 we count that as the end\n * of the previous iteration.\n */\n if (!iterationProgress && progress >= 1) {\n iterationProgress = 1;\n }\n iterationProgress === 1 && currentIteration--;\n currentIteration = Math.min(currentIteration, repeat + 1);\n /**\n * Reverse progress if we're not running in \"normal\" direction\n */\n const isOddIteration = Boolean(currentIteration % 2);\n if (isOddIteration) {\n if (repeatType === \"reverse\") {\n iterationProgress = 1 - iterationProgress;\n if (repeatDelay) {\n iterationProgress -= repeatDelay / resolvedDuration;\n }\n }\n else if (repeatType === \"mirror\") {\n frameGenerator = mirroredGenerator;\n }\n }\n elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;\n }\n /**\n * If we're in negative time, set state as the initial keyframe.\n * This prevents delay: x, duration: 0 animations from finishing\n * instantly.\n */\n let state;\n if (isInDelayPhase) {\n this.delayState.value = keyframes[0];\n state = this.delayState;\n }\n else {\n state = frameGenerator.next(elapsed);\n }\n if (mixKeyframes && !isInDelayPhase) {\n state.value = mixKeyframes(state.value);\n }\n let { done } = state;\n if (!isInDelayPhase && calculatedDuration !== null) {\n done =\n this.playbackSpeed >= 0\n ? this.currentTime >= totalDuration\n : this.currentTime <= 0;\n }\n const isAnimationFinished = this.holdTime === null &&\n (this.state === \"finished\" || (this.state === \"running\" && done));\n // TODO: The exception for inertia could be cleaner here\n if (isAnimationFinished && type !== inertia) {\n state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n }\n if (onUpdate) {\n onUpdate(state.value);\n }\n if (isAnimationFinished) {\n this.finish();\n }\n return state;\n }\n /**\n * Allows the returned animation to be awaited or promise-chained. Currently\n * resolves when the animation finishes at all but in a future update could/should\n * reject if its cancels.\n */\n then(resolve, reject) {\n return this.finished.then(resolve, reject);\n }\n get duration() {\n return millisecondsToSeconds(this.calculatedDuration);\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(this.currentTime);\n }\n set time(newTime) {\n newTime = secondsToMilliseconds(newTime);\n this.currentTime = newTime;\n if (this.startTime === null ||\n this.holdTime !== null ||\n this.playbackSpeed === 0) {\n this.holdTime = newTime;\n }\n else if (this.driver) {\n this.startTime = this.driver.now() - newTime / this.playbackSpeed;\n }\n if (this.driver) {\n this.driver.start(false);\n }\n else {\n this.startTime = 0;\n this.state = \"paused\";\n this.holdTime = newTime;\n this.tick(newTime);\n }\n }\n /**\n * Returns the generator's velocity at the current time in units/second.\n * Uses the analytical derivative when available (springs), avoiding\n * the MotionValue's frame-dependent velocity estimation.\n */\n getGeneratorVelocity() {\n const t = this.currentTime;\n if (t <= 0)\n return this.options.velocity || 0;\n if (this.generator.velocity) {\n return this.generator.velocity(t);\n }\n // Fallback: finite difference\n const current = this.generator.next(t).value;\n return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);\n }\n get speed() {\n return this.playbackSpeed;\n }\n set speed(newSpeed) {\n const hasChanged = this.playbackSpeed !== newSpeed;\n if (hasChanged && this.driver) {\n this.updateTime(time.now());\n }\n this.playbackSpeed = newSpeed;\n if (hasChanged && this.driver) {\n this.time = millisecondsToSeconds(this.currentTime);\n }\n }\n play() {\n if (this.isStopped)\n return;\n const { driver = frameloopDriver, startTime } = this.options;\n if (!this.driver) {\n this.driver = driver((timestamp) => this.tick(timestamp));\n }\n this.options.onPlay?.();\n const now = this.driver.now();\n if (this.state === \"finished\") {\n this.updateFinished();\n this.startTime = now;\n }\n else if (this.holdTime !== null) {\n this.startTime = now - this.holdTime;\n }\n else if (!this.startTime) {\n this.startTime = startTime ?? now;\n }\n if (this.state === \"finished\" && this.speed < 0) {\n this.startTime += this.calculatedDuration;\n }\n this.holdTime = null;\n /**\n * Set playState to running only after we've used it in\n * the previous logic.\n */\n this.state = \"running\";\n this.driver.start();\n }\n pause() {\n this.state = \"paused\";\n this.updateTime(time.now());\n this.holdTime = this.currentTime;\n }\n complete() {\n if (this.state !== \"running\") {\n this.play();\n }\n this.state = \"finished\";\n this.holdTime = null;\n }\n finish() {\n this.notifyFinished();\n this.teardown();\n this.state = \"finished\";\n this.options.onComplete?.();\n }\n cancel() {\n this.holdTime = null;\n this.startTime = 0;\n this.tick(0);\n this.teardown();\n this.options.onCancel?.();\n }\n teardown() {\n this.state = \"idle\";\n this.stopDriver();\n this.startTime = this.holdTime = null;\n activeAnimations.mainThread--;\n }\n stopDriver() {\n if (!this.driver)\n return;\n this.driver.stop();\n this.driver = undefined;\n }\n sample(sampleTime) {\n this.startTime = 0;\n return this.tick(sampleTime, true);\n }\n attachTimeline(timeline) {\n if (this.options.allowFlatten) {\n this.options.type = \"keyframes\";\n this.options.ease = \"linear\";\n this.initAnimation();\n }\n this.driver?.stop();\n return timeline.observe(this);\n }\n}\n// Legacy function support\nfunction animateValue(options) {\n return new JSAnimation(options);\n}\n\nexport { JSAnimation, animateValue };\n//# sourceMappingURL=JSAnimation.mjs.map\n"],"names":["percentToProgress","percent","JSAnimation","WithPromise","constructor","options","super","this","state","startTime","isStopped","currentTime","holdTime","playbackSpeed","delayState","done","value","undefined","stop","motionValue","updatedAt","time","now","tick","teardown","onStop","initAnimation","play","autoplay","pause","replaceTransitionType","type","keyframes","repeat","repeatDelay","repeatType","velocity","keyframes$1","generatorFactory","process","env","NODE_ENV","keyframesGenerator","invariant","length","mixKeyframes","pipe","mix","generator","mirroredGenerator","reverse","calculatedDuration","calcGeneratorDuration","resolvedDuration","totalDuration","updateTime","timestamp","animationTime","Math","round","sample","arguments","next","delay","onUpdate","finalKeyframe","speed","min","timeWithoutDelay","isInDelayPhase","max","elapsed","frameGenerator","progress","currentIteration","floor","iterationProgress","Boolean","clamp","isAnimationFinished","inertia","getFinalKeyframe","finish","then","resolve","reject","finished","duration","millisecondsToSeconds","iterationDuration","newTime","secondsToMilliseconds","driver","start","getGeneratorVelocity","t","current","s","newSpeed","hasChanged","frameloopDriver","onPlay","updateFinished","complete","notifyFinished","onComplete","cancel","onCancel","stopDriver","sampleTime","attachTimeline","timeline","allowFlatten","ease","observe"],"mappings":"mvBA6BA,MAAMA,EAAqBC,GAAoBA,EAAU,IAEnD,MAAOC,UACDC,EAAAA,YA2DRC,WAAAA,CAAYC,GACRC,QAzDJC,KAAAC,MAA4B,OAE5BD,KAAAE,UAA2B,KAQnBF,KAAAG,WAAY,EAeZH,KAAAI,YAAsB,EAKtBJ,KAAAK,SAA0B,KAK1BL,KAAAM,cAAgB,EAgBhBN,KAAAO,WAAgC,CACpCC,MAAM,EACNC,WAAOC,GA+YXV,KAAAW,KAAO,KACH,MAAMC,YAAEA,GAAgBZ,KAAKF,QACzBc,GAAeA,EAAYC,YAAcC,EAAIA,KAACC,OAC9Cf,KAAKgB,KAAKF,OAAKC,OAGnBf,KAAKG,WAAY,EACE,SAAfH,KAAKC,QACTD,KAAKiB,WACLjB,KAAKF,QAAQoB,WAAU,EAjZvBlB,KAAKF,QAAUA,EACfE,KAAKmB,gBACLnB,KAAKoB,QAEoB,IAArBtB,EAAQuB,UAAoBrB,KAAKsB,OACzC,CAEAH,aAAAA,GACI,MAAMrB,QAAEA,GAAYE,KAEpBuB,EAAqBA,sBAACzB,GAEtB,MAAM0B,KACFA,EAAOC,EAAkBA,UAAAC,OACzBA,EAAS,EAACC,YACVA,EAAc,EAACC,WACfA,EAAUC,SACVA,EAAW,GACX/B,EACJ,IAAI2B,UAAEK,GAAchC,EAEpB,MAAMiC,EACDP,GAA6BC,YAGL,eAAzBO,QAAQC,IAAIC,UACZH,IAAqBI,EAAAA,WAErBC,YACIN,EAAUO,QAAU,EACpB,gGAAgGP,IAChG,qBAKJC,IAAqBI,EAAAA,WACG,iBAAjBV,EAAU,KAEjBzB,KAAKsC,aAAeC,OAChB9C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F,KAAKqF,OAAO1E,OACZX,KAAKqF,YAAS3E,EAClB,CAEA2C,MAAAA,CAAOiD,GAEH,OADAtG,KAAKE,UAAY,EACVF,KAAKgB,KAAKsF,GAAY,EACjC,CAEAC,cAAAA,CAAeC,GAQX,OAPIxG,KAAKF,QAAQ2G,eACbzG,KAAKF,QAAQ0B,KAAO,YACpBxB,KAAKF,QAAQ4G,KAAO,SACpB1G,KAAKmB,iBAGTnB,KAAKqF,QAAQ1E,OACN6F,EAASG,QAAQ3G,KAC5B"}
1
+ {"version":3,"file":"JSAnimation.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/animation/JSAnimation.mjs"],"sourcesContent":["import { invariant, pipe, clamp, millisecondsToSeconds, secondsToMilliseconds } from 'motion-utils';\nimport { time } from '../frameloop/sync-time.mjs';\nimport { mix } from '../utils/mix/index.mjs';\nimport { frameloopDriver } from './drivers/frame.mjs';\nimport { inertia } from './generators/inertia.mjs';\nimport { keyframes } from './generators/keyframes.mjs';\nimport { calcGeneratorDuration } from './generators/utils/calc-duration.mjs';\nimport { getGeneratorVelocity } from './generators/utils/velocity.mjs';\nimport { getFinalKeyframe } from './keyframes/get-final.mjs';\nimport { replaceTransitionType } from './utils/replace-transition-type.mjs';\nimport { WithPromise } from './utils/WithPromise.mjs';\n\nconst percentToProgress = (percent) => percent / 100;\nclass JSAnimation extends WithPromise {\n constructor(options) {\n super();\n this.state = \"idle\";\n this.startTime = null;\n this.isStopped = false;\n /**\n * The current time of the animation.\n */\n this.currentTime = 0;\n /**\n * The time at which the animation was paused.\n */\n this.holdTime = null;\n /**\n * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.\n */\n this.playbackSpeed = 1;\n /**\n * Reusable state object for the delay phase to avoid\n * allocating a new object every frame.\n */\n this.delayState = {\n done: false,\n value: undefined,\n };\n /**\n * This method is bound to the instance to fix a pattern where\n * animation.stop is returned as a reference from a useEffect.\n */\n this.stop = () => {\n const { motionValue } = this.options;\n if (motionValue && motionValue.updatedAt !== time.now()) {\n this.tick(time.now());\n }\n this.isStopped = true;\n if (this.state === \"idle\")\n return;\n this.teardown();\n this.options.onStop?.();\n };\n this.options = options;\n this.initAnimation();\n this.play();\n if (options.autoplay === false)\n this.pause();\n }\n initAnimation() {\n const { options } = this;\n replaceTransitionType(options);\n const { type = keyframes, repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = options;\n let { keyframes: keyframes$1 } = options;\n const generatorFactory = type || keyframes;\n if (process.env.NODE_ENV !== \"production\" &&\n generatorFactory !== keyframes) {\n invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, \"spring-two-frames\");\n }\n if (generatorFactory !== keyframes &&\n typeof keyframes$1[0] !== \"number\") {\n this.mixKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));\n keyframes$1 = [0, 100];\n }\n const generator = generatorFactory({ ...options, keyframes: keyframes$1 });\n /**\n * If we have a mirror repeat type we need to create a second generator that outputs the\n * mirrored (not reversed) animation and later ping pong between the two generators.\n */\n if (repeatType === \"mirror\") {\n this.mirroredGenerator = generatorFactory({\n ...options,\n keyframes: [...keyframes$1].reverse(),\n velocity: -velocity,\n });\n }\n /**\n * If duration is undefined and we have repeat options,\n * we need to calculate a duration from the generator.\n *\n * We set it to the generator itself to cache the duration.\n * Any timeline resolver will need to have already precalculated\n * the duration by this step.\n */\n if (generator.calculatedDuration === null) {\n generator.calculatedDuration = calcGeneratorDuration(generator);\n }\n const { calculatedDuration } = generator;\n this.calculatedDuration = calculatedDuration;\n this.resolvedDuration = calculatedDuration + repeatDelay;\n this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay;\n this.generator = generator;\n }\n updateTime(timestamp) {\n const animationTime = Math.round(timestamp - this.startTime) * this.playbackSpeed;\n // Update currentTime\n if (this.holdTime !== null) {\n this.currentTime = this.holdTime;\n }\n else {\n // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =\n // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for\n // example.\n this.currentTime = animationTime;\n }\n }\n tick(timestamp, sample = false) {\n const { generator, totalDuration, mixKeyframes, mirroredGenerator, resolvedDuration, calculatedDuration, } = this;\n if (this.startTime === null)\n return generator.next(0);\n const { delay = 0, keyframes, repeat, repeatType, repeatDelay, type, onUpdate, finalKeyframe, } = this.options;\n /**\n * requestAnimationFrame timestamps can come through as lower than\n * the startTime as set by performance.now(). Here we prevent this,\n * though in the future it could be possible to make setting startTime\n * a pending operation that gets resolved here.\n */\n if (this.speed > 0) {\n this.startTime = Math.min(this.startTime, timestamp);\n }\n else if (this.speed < 0) {\n this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);\n }\n if (sample) {\n this.currentTime = timestamp;\n }\n else {\n this.updateTime(timestamp);\n }\n // Rebase on delay\n const timeWithoutDelay = this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1);\n const isInDelayPhase = this.playbackSpeed >= 0\n ? timeWithoutDelay < 0\n : timeWithoutDelay > totalDuration;\n this.currentTime = Math.max(timeWithoutDelay, 0);\n // If this animation has finished, set the current time to the total duration.\n if (this.state === \"finished\" && this.holdTime === null) {\n this.currentTime = totalDuration;\n }\n let elapsed = this.currentTime;\n let frameGenerator = generator;\n if (repeat) {\n /**\n * Get the current progress (0-1) of the animation. If t is >\n * than duration we'll get values like 2.5 (midway through the\n * third iteration)\n */\n const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;\n /**\n * Get the current iteration (0 indexed). For instance the floor of\n * 2.5 is 2.\n */\n let currentIteration = Math.floor(progress);\n /**\n * Get the current progress of the iteration by taking the remainder\n * so 2.5 is 0.5 through iteration 2\n */\n let iterationProgress = progress % 1.0;\n /**\n * If iteration progress is 1 we count that as the end\n * of the previous iteration.\n */\n if (!iterationProgress && progress >= 1) {\n iterationProgress = 1;\n }\n iterationProgress === 1 && currentIteration--;\n currentIteration = Math.min(currentIteration, repeat + 1);\n /**\n * Reverse progress if we're not running in \"normal\" direction\n */\n const isOddIteration = Boolean(currentIteration % 2);\n if (isOddIteration) {\n if (repeatType === \"reverse\") {\n iterationProgress = 1 - iterationProgress;\n if (repeatDelay) {\n iterationProgress -= repeatDelay / resolvedDuration;\n }\n }\n else if (repeatType === \"mirror\") {\n frameGenerator = mirroredGenerator;\n }\n }\n elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;\n }\n /**\n * If we're in negative time, set state as the initial keyframe.\n * This prevents delay: x, duration: 0 animations from finishing\n * instantly.\n */\n let state;\n if (isInDelayPhase) {\n this.delayState.value = keyframes[0];\n state = this.delayState;\n }\n else {\n state = frameGenerator.next(elapsed);\n }\n if (mixKeyframes && !isInDelayPhase) {\n state.value = mixKeyframes(state.value);\n }\n let { done } = state;\n if (!isInDelayPhase && calculatedDuration !== null) {\n done =\n this.playbackSpeed >= 0\n ? this.currentTime >= totalDuration\n : this.currentTime <= 0;\n }\n const isAnimationFinished = this.holdTime === null &&\n (this.state === \"finished\" || (this.state === \"running\" && done));\n // TODO: The exception for inertia could be cleaner here\n if (isAnimationFinished && type !== inertia) {\n state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe, this.speed);\n }\n if (onUpdate) {\n onUpdate(state.value);\n }\n if (isAnimationFinished) {\n this.finish();\n }\n return state;\n }\n /**\n * Allows the returned animation to be awaited or promise-chained. Currently\n * resolves when the animation finishes at all but in a future update could/should\n * reject if its cancels.\n */\n then(resolve, reject) {\n return this.finished.then(resolve, reject);\n }\n get duration() {\n return millisecondsToSeconds(this.calculatedDuration);\n }\n get iterationDuration() {\n const { delay = 0 } = this.options || {};\n return this.duration + millisecondsToSeconds(delay);\n }\n get time() {\n return millisecondsToSeconds(this.currentTime);\n }\n set time(newTime) {\n newTime = secondsToMilliseconds(newTime);\n this.currentTime = newTime;\n if (this.startTime === null ||\n this.holdTime !== null ||\n this.playbackSpeed === 0) {\n this.holdTime = newTime;\n }\n else if (this.driver) {\n this.startTime = this.driver.now() - newTime / this.playbackSpeed;\n }\n if (this.driver) {\n this.driver.start(false);\n }\n else {\n this.startTime = 0;\n this.state = \"paused\";\n this.holdTime = newTime;\n this.tick(newTime);\n }\n }\n /**\n * Returns the generator's velocity at the current time in units/second.\n * Uses the analytical derivative when available (springs), avoiding\n * the MotionValue's frame-dependent velocity estimation.\n */\n getGeneratorVelocity() {\n const t = this.currentTime;\n if (t <= 0)\n return this.options.velocity || 0;\n if (this.generator.velocity) {\n return this.generator.velocity(t);\n }\n // Fallback: finite difference\n const current = this.generator.next(t).value;\n return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);\n }\n get speed() {\n return this.playbackSpeed;\n }\n set speed(newSpeed) {\n const hasChanged = this.playbackSpeed !== newSpeed;\n if (hasChanged && this.driver) {\n this.updateTime(time.now());\n }\n this.playbackSpeed = newSpeed;\n if (hasChanged && this.driver) {\n this.time = millisecondsToSeconds(this.currentTime);\n }\n }\n play() {\n if (this.isStopped)\n return;\n const { driver = frameloopDriver, startTime } = this.options;\n if (!this.driver) {\n this.driver = driver((timestamp) => this.tick(timestamp));\n }\n this.options.onPlay?.();\n const now = this.driver.now();\n if (this.state === \"finished\") {\n this.updateFinished();\n this.startTime = now;\n }\n else if (this.holdTime !== null) {\n this.startTime = now - this.holdTime;\n }\n else if (!this.startTime) {\n this.startTime = startTime ?? now;\n }\n if (this.state === \"finished\" && this.speed < 0) {\n this.startTime += this.calculatedDuration;\n }\n this.holdTime = null;\n /**\n * Set playState to running only after we've used it in\n * the previous logic.\n */\n this.state = \"running\";\n this.driver.start();\n }\n pause() {\n this.state = \"paused\";\n this.updateTime(time.now());\n this.holdTime = this.currentTime;\n }\n complete() {\n if (this.state !== \"running\") {\n this.play();\n }\n this.state = \"finished\";\n this.holdTime = null;\n }\n finish() {\n this.notifyFinished();\n this.teardown();\n this.state = \"finished\";\n this.options.onComplete?.();\n }\n cancel() {\n this.holdTime = null;\n this.startTime = 0;\n this.tick(0);\n this.teardown();\n this.options.onCancel?.();\n }\n teardown() {\n this.state = \"idle\";\n this.stopDriver();\n this.startTime = this.holdTime = null;\n }\n stopDriver() {\n if (!this.driver)\n return;\n this.driver.stop();\n this.driver = undefined;\n }\n sample(sampleTime) {\n this.startTime = 0;\n return this.tick(sampleTime, true);\n }\n attachTimeline(timeline) {\n if (this.options.allowFlatten) {\n this.options.type = \"keyframes\";\n this.options.ease = \"linear\";\n this.initAnimation();\n }\n this.driver?.stop();\n return timeline.observe(this);\n }\n}\n// Legacy function support\nfunction animateValue(options) {\n return new JSAnimation(options);\n}\n\nexport { JSAnimation, animateValue };\n//# sourceMappingURL=JSAnimation.mjs.map\n"],"names":["percentToProgress","percent","JSAnimation","WithPromise","constructor","options","super","this","state","startTime","isStopped","currentTime","holdTime","playbackSpeed","delayState","done","value","undefined","stop","motionValue","updatedAt","time","now","tick","teardown","onStop","initAnimation","play","autoplay","pause","replaceTransitionType","type","keyframes","repeat","repeatDelay","repeatType","velocity","keyframes$1","generatorFactory","process","env","NODE_ENV","keyframesGenerator","invariant","length","mixKeyframes","pipe","mix","generator","mirroredGenerator","reverse","calculatedDuration","calcGeneratorDuration","resolvedDuration","totalDuration","updateTime","timestamp","animationTime","Math","round","sample","arguments","next","delay","onUpdate","finalKeyframe","speed","min","timeWithoutDelay","isInDelayPhase","max","elapsed","frameGenerator","progress","currentIteration","floor","iterationProgress","Boolean","clamp","isAnimationFinished","inertia","getFinalKeyframe","finish","then","resolve","reject","finished","duration","millisecondsToSeconds","iterationDuration","newTime","secondsToMilliseconds","driver","start","getGeneratorVelocity","t","current","s","newSpeed","hasChanged","frameloopDriver","onPlay","updateFinished","complete","notifyFinished","onComplete","cancel","onCancel","stopDriver","sampleTime","attachTimeline","timeline","allowFlatten","ease","observe"],"mappings":"mvBA4BA,MAAMA,EAAqBC,GAAoBA,EAAU,IAEnD,MAAOC,UACDC,EAAAA,YA2DRC,WAAAA,CAAYC,GACRC,QAzDJC,KAAAC,MAA4B,OAE5BD,KAAAE,UAA2B,KAQnBF,KAAAG,WAAY,EAeZH,KAA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../node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs"],"sourcesContent":["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"],"names":["element","valueName","keyframes","delay","duration","repeat","repeatType","ease","times","arguments","length","undefined","pseudoElement","keyframeOptions","offset","easing","mapEasingToNativeEasing","Array","isArray","options","fill","iterations","direction","animate"],"mappings":"4IAKM,SACFA,EACAC,EACAC,GAS6C,IAR7CC,MACIA,EAAQ,EAACC,SACTA,EAAW,IAAGC,OACdA,EAAS,EAACC,WACVA,EAAa,OAAMC,KACnBA,EAAO,UAASC,MAChBA,GAAKC,UAAAC,OAAAD,QAAAE,IAAAF,aAAAA,UAAA,GACY,GACrBG,EAAAH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,QAAoCE,EAEpC,MAAME,EAA4C,CAC9CZ,CAACA,GAAYC,GAEbM,IAAOK,EAAgBC,OAASN,GAEpC,MAAMO,EAASC,EAAAA,wBAAwBT,EAAMH,GAKzCa,MAAMC,QAAQH,KAASF,EAAgBE,OAASA,GAMpD,MAAMI,EAAoC,CACtChB,QACAC,WACAW,OAASE,MAAMC,QAAQH,GAAmB,SAATA,EACjCK,KAAM,OACNC,WAAYhB,EAAS,EACrBiB,UAA0B,YAAfhB,EAA2B,YAAc,UAaxD,OAVIM,IAAeO,EAAQP,cAAgBA,GAEzBZ,EAAQuB,QAAQV,EAAiBM,EASvD"}
1
+ {"version":3,"file":"start-waapi-animation.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs"],"sourcesContent":["import { 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 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 return element.animate(keyframeOptions, options);\n}\n\nexport { startWaapiAnimation };\n//# sourceMappingURL=start-waapi-animation.mjs.map\n"],"names":["element","valueName","keyframes","delay","duration","repeat","repeatType","ease","times","arguments","length","undefined","pseudoElement","keyframeOptions","offset","easing","mapEasingToNativeEasing","Array","isArray","options","fill","iterations","direction","animate"],"mappings":"4IAGM,SACFA,EACAC,EACAC,GAS6C,IAR7CC,MACIA,EAAQ,EAACC,SACTA,EAAW,IAAGC,OACdA,EAAS,EAACC,WACVA,EAAa,OAAMC,KACnBA,EAAO,UAASC,MAChBA,GAAKC,UAAAC,OAAAD,QAAAE,IAAAF,aAAAA,UAAA,GACY,GACrBG,EAAAH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,QAAoCE,EAEpC,MAAME,EAA4C,CAC9CZ,CAACA,GAAYC,GAEbM,IAAOK,EAAgBC,OAASN,GAEpC,MAAMO,EAASC,EAAAA,wBAAwBT,EAAMH,GAKzCa,MAAMC,QAAQH,KAASF,EAAgBE,OAASA,GAEpD,MAAMI,EAAoC,CACtChB,QACAC,WACAW,OAASE,MAAMC,QAAQH,GAAmB,SAATA,EACjCK,KAAM,OACNC,WAAYhB,EAAS,EACrBiB,UAA0B,YAAfhB,EAA2B,YAAc,UAKxD,OAFIM,IAAeO,EAAQP,cAAgBA,GAEpCZ,EAAQuB,QAAQV,EAAiBM,EAC5C"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addDomEvent=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{passive:!0};return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addDomEvent=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{passive:!0};return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)};
2
2
  //# sourceMappingURL=add-dom-event.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-dom-event.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/events/add-dom-event.mjs"],"sourcesContent":["function addDomEvent(target, eventName, handler, options = { passive: true }) {\n target.addEventListener(eventName, handler, options);\n return () => target.removeEventListener(eventName, handler);\n}\n\nexport { addDomEvent };\n//# sourceMappingURL=add-dom-event.mjs.map\n"],"names":["target","eventName","handler","options","arguments","length","undefined","passive","addEventListener","removeEventListener"],"mappings":"wFAAM,SACFA,EACAC,EACAC,GACoD,IAApDC,EAAAC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAmC,GAAA,CAAEG,SAAS,GAI9C,OAFAP,EAAOQ,iBAAiBP,EAAWC,EAASC,GAErC,IAAMH,EAAOS,oBAAoBR,EAAWC,EACvD"}
1
+ {"version":3,"file":"add-dom-event.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/events/add-dom-event.mjs"],"sourcesContent":["function addDomEvent(target, eventName, handler, options = { passive: true }) {\n target.addEventListener(eventName, handler, options);\n return () => target.removeEventListener(eventName, handler, options);\n}\n\nexport { addDomEvent };\n//# sourceMappingURL=add-dom-event.mjs.map\n"],"names":["target","eventName","handler","options","arguments","length","undefined","passive","addEventListener","removeEventListener"],"mappings":"wFAAM,SACFA,EACAC,EACAC,GACoD,IAApDC,EAAAC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAmC,GAAA,CAAEG,SAAS,GAI9C,OAFAP,EAAOQ,iBAAiBP,EAAWC,EAASC,GAErC,IAAMH,EAAOS,oBAAoBR,EAAWC,EAASC,EAChE"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./order.mjs.js"),s=require("./render-step.mjs.js"),r=require("../../../../motion-utils/dist/es/global-config.mjs.js");exports.createRenderBatcher=function(t,o){let n=!1,c=!0;const i={delta:0,timestamp:0,isProcessing:!1},p=()=>n=!0,a=e.stepsOrder.reduce(((e,r)=>(e[r]=s.createRenderStep(p,o?r:void 0),e)),{}),{setup:d,read:l,resolveKeyframes:u,preUpdate:m,update:g,preRender:f,render:h,postRender:j}=a,v=()=>{const e=r.MotionGlobalConfig.useManualTiming,s=e?i.timestamp:performance.now();n=!1,e||(i.delta=c?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,d.process(i),l.process(i),u.process(i),m.process(i),g.process(i),f.process(i),h.process(i),j.process(i),i.isProcessing=!1,n&&o&&(c=!1,t(v))};return{schedule:e.stepsOrder.reduce(((e,s)=>{const r=a[s];return e[s]=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n||(n=!0,c=!0,i.isProcessing||t(v)),r.schedule(e,s,o)},e}),{}),cancel:s=>{for(let r=0;r<e.stepsOrder.length;r++)a[e.stepsOrder[r]].cancel(s)},state:i,steps:a}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./order.mjs.js"),s=require("./render-step.mjs.js"),r=require("../../../../motion-utils/dist/es/global-config.mjs.js");exports.createRenderBatcher=function(t,o){let n=!1,c=!0;const i={delta:0,timestamp:0,isProcessing:!1},p=()=>n=!0,a=e.stepsOrder.reduce(((e,r)=>(e[r]=s.createRenderStep(p),e)),{}),{setup:d,read:l,resolveKeyframes:u,preUpdate:m,update:g,preRender:f,render:h,postRender:j}=a,v=()=>{const e=r.MotionGlobalConfig.useManualTiming,s=e?i.timestamp:performance.now();n=!1,e||(i.delta=c?1e3/60:Math.max(Math.min(s-i.timestamp,40),1)),i.timestamp=s,i.isProcessing=!0,d.process(i),l.process(i),u.process(i),m.process(i),g.process(i),f.process(i),h.process(i),j.process(i),i.isProcessing=!1,n&&o&&(c=!1,t(v))};return{schedule:e.stepsOrder.reduce(((e,s)=>{const r=a[s];return e[s]=function(e){let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n||(n=!0,c=!0,i.isProcessing||t(v)),r.schedule(e,s,o)},e}),{}),cancel:s=>{for(let r=0;r<e.stepsOrder.length;r++)a[e.stepsOrder[r]].cancel(s)},state:i,steps:a}};
2
2
  //# sourceMappingURL=batcher.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"batcher.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/frameloop/batcher.mjs"],"sourcesContent":["import { MotionGlobalConfig } from 'motion-utils';\nimport { stepsOrder } from './order.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);\n return acc;\n }, {});\n const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;\n const processBatch = () => {\n const useManualTiming = MotionGlobalConfig.useManualTiming;\n const timestamp = useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n if (!useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n }\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n setup.process(state);\n read.process(state);\n resolveKeyframes.process(state);\n preUpdate.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher };\n//# sourceMappingURL=batcher.mjs.map\n"],"names":["scheduleNextBatch","allowKeepAlive","runNextFrame","useDefaultElapsed","state","delta","timestamp","isProcessing","flagRunNextFrame","steps","stepsOrder","reduce","acc","key","createRenderStep","undefined","setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender","processBatch","useManualTiming","MotionGlobalConfig","performance","now","Math","max","min","process","schedule","step","keepAlive","arguments","length","immediate","cancel","i"],"mappings":"qOAOM,SACFA,EACAC,GAEA,IAAIC,GAAe,EACfC,GAAoB,EAExB,MAAMC,EAAmB,CACrBC,MAAO,EACPC,UAAW,EACXC,cAAc,GAGZC,EAAmBA,IAAON,GAAe,EAEzCO,EAAQC,EAAUA,WAACC,QAAO,CAACC,EAAKC,KAClCD,EAAIC,GAAOC,EAAgBA,iBACvBN,EACAP,EAAiBY,OAAME,GAEpBH,IACR,CAAW,IAERI,MACFA,EAAKC,KACLA,EAAIC,iBACJA,EAAgBC,UAChBA,EAASC,OACTA,EAAMC,UACNA,EAASC,OACTA,EAAMC,WACNA,GACAd,EAEEe,EAAeA,KACjB,MAAMC,EAAkBC,EAAkBA,mBAACD,gBACrCnB,EAAYmB,EACZrB,EAAME,UACNqB,YAAYC,MAClB1B,GAAe,EAEVuB,IACDrB,EAAMC,MAAQF,EACR,IAAO,GACP0B,KAAKC,IAAID,KAAKE,IAAIzB,EAAYF,EAAME,UA9CnC,IA8C2D,IAGtEF,EAAME,UAAYA,EAClBF,EAAMG,cAAe,EAGrBS,EAAMgB,QAAQ5B,GACda,EAAKe,QAAQ5B,GACbc,EAAiBc,QAAQ5B,GACzBe,EAAUa,QAAQ5B,GAClBgB,EAAOY,QAAQ5B,GACfiB,EAAUW,QAAQ5B,GAClBkB,EAAOU,QAAQ5B,GACfmB,EAAWS,QAAQ5B,GAEnBA,EAAMG,cAAe,EAEjBL,GAAgBD,IAChBE,GAAoB,EACpBH,EAAkBwB,GACtB,EA4BJ,MAAO,CAAES,SAhBQvB,EAAUA,WAACC,QAAO,CAACC,EAAKC,KACrC,MAAMqB,EAAOzB,EAAMI,GAMnB,OALAD,EAAIC,GAAO,SAACmB,GAA0D,IAAxCG,EAASC,UAAAC,OAAA,QAAAtB,IAAAqB,UAAA,IAAAA,UAAA,GAAUE,EAASF,UAAAC,OAAA,QAAAtB,IAAAqB,UAAA,IAAAA,UAAA,GAGtD,OAFKlC,IAXTA,GAAe,EACfC,GAAoB,EAEfC,EAAMG,cACPP,EAAkBwB,IASXU,EAAKD,SAASD,EAASG,EAAWG,IAEtC1B,CAAG,GACX,CAAa,GAQG2B,OANHP,IACZ,IAAK,IAAIQ,EAAI,EAAGA,EAAI9B,EAAAA,WAAW2B,OAAQG,IACnC/B,EAAMC,EAAUA,WAAC8B,IAAID,OAAOP,EAChC,EAGuB5B,QAAOK,QACtC"}
1
+ {"version":3,"file":"batcher.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/frameloop/batcher.mjs"],"sourcesContent":["import { MotionGlobalConfig } from 'motion-utils';\nimport { stepsOrder } from './order.mjs';\nimport { createRenderStep } from './render-step.mjs';\n\nconst maxElapsed = 40;\nfunction createRenderBatcher(scheduleNextBatch, allowKeepAlive) {\n let runNextFrame = false;\n let useDefaultElapsed = true;\n const state = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n const flagRunNextFrame = () => (runNextFrame = true);\n const steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(flagRunNextFrame);\n return acc;\n }, {});\n const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender, } = steps;\n const processBatch = () => {\n const useManualTiming = MotionGlobalConfig.useManualTiming;\n const timestamp = useManualTiming\n ? state.timestamp\n : performance.now();\n runNextFrame = false;\n if (!useManualTiming) {\n state.delta = useDefaultElapsed\n ? 1000 / 60\n : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);\n }\n state.timestamp = timestamp;\n state.isProcessing = true;\n // Unrolled render loop for better per-frame performance\n setup.process(state);\n read.process(state);\n resolveKeyframes.process(state);\n preUpdate.process(state);\n update.process(state);\n preRender.process(state);\n render.process(state);\n postRender.process(state);\n state.isProcessing = false;\n if (runNextFrame && allowKeepAlive) {\n useDefaultElapsed = false;\n scheduleNextBatch(processBatch);\n }\n };\n const wake = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!state.isProcessing) {\n scheduleNextBatch(processBatch);\n }\n };\n const schedule = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n wake();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n }, {});\n const cancel = (process) => {\n for (let i = 0; i < stepsOrder.length; i++) {\n steps[stepsOrder[i]].cancel(process);\n }\n };\n return { schedule, cancel, state, steps };\n}\n\nexport { createRenderBatcher };\n//# sourceMappingURL=batcher.mjs.map\n"],"names":["scheduleNextBatch","allowKeepAlive","runNextFrame","useDefaultElapsed","state","delta","timestamp","isProcessing","flagRunNextFrame","steps","stepsOrder","reduce","acc","key","createRenderStep","setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender","processBatch","useManualTiming","MotionGlobalConfig","performance","now","Math","max","min","process","schedule","step","keepAlive","arguments","length","undefined","immediate","cancel","i"],"mappings":"qOAOM,SACFA,EACAC,GAEA,IAAIC,GAAe,EACfC,GAAoB,EAExB,MAAMC,EAAmB,CACrBC,MAAO,EACPC,UAAW,EACXC,cAAc,GAGZC,EAAmBA,IAAON,GAAe,EAEzCO,EAAQC,EAAUA,WAACC,QAAO,CAACC,EAAKC,KAClCD,EAAIC,GAAOC,EAAgBA,iBAACN,GACrBI,IACR,CAAW,IAERG,MACFA,EAAKC,KACLA,EAAIC,iBACJA,EAAgBC,UAChBA,EAASC,OACTA,EAAMC,UACNA,EAASC,OACTA,EAAMC,WACNA,GACAb,EAEEc,EAAeA,KACjB,MAAMC,EAAkBC,EAAkBA,mBAACD,gBACrClB,EAAYkB,EACZpB,EAAME,UACNoB,YAAYC,MAClBzB,GAAe,EAEVsB,IACDpB,EAAMC,MAAQF,EACR,IAAO,GACPyB,KAAKC,IAAID,KAAKE,IAAIxB,EAAYF,EAAME,UA3CnC,IA2C2D,IAGtEF,EAAME,UAAYA,EAClBF,EAAMG,cAAe,EAGrBQ,EAAMgB,QAAQ3B,GACdY,EAAKe,QAAQ3B,GACba,EAAiBc,QAAQ3B,GACzBc,EAAUa,QAAQ3B,GAClBe,EAAOY,QAAQ3B,GACfgB,EAAUW,QAAQ3B,GAClBiB,EAAOU,QAAQ3B,GACfkB,EAAWS,QAAQ3B,GAEnBA,EAAMG,cAAe,EAEjBL,GAAgBD,IAChBE,GAAoB,EACpBH,EAAkBuB,GACtB,EA4BJ,MAAO,CAAES,SAhBQtB,EAAUA,WAACC,QAAO,CAACC,EAAKC,KACrC,MAAMoB,EAAOxB,EAAMI,GAMnB,OALAD,EAAIC,GAAO,SAACkB,GAA0D,IAAxCG,EAASC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAAUG,EAASH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAGtD,OAFKjC,IAXTA,GAAe,EACfC,GAAoB,EAEfC,EAAMG,cACPP,EAAkBuB,IASXU,EAAKD,SAASD,EAASG,EAAWI,IAEtC1B,CAAG,GACX,CAAa,GAQG2B,OANHR,IACZ,IAAK,IAAIS,EAAI,EAAGA,EAAI9B,EAAAA,WAAW0B,OAAQI,IACnC/B,EAAMC,EAAUA,WAAC8B,IAAID,OAAOR,EAChC,EAGuB3B,QAAOK,QACtC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../stats/buffer.mjs.js");exports.createRenderStep=function(t,s){let r=new Set,n=new Set,o=!1,c=!1;const a=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1},l=0;function d(e){a.has(e)&&(f.schedule(e),t()),l++,e(u)}const f={schedule:function(e){const t=arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&o?r:n;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&a.add(e),t.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:t=>{if(u=t,o)return void(c=!0);o=!0;const a=r;r=n,n=a,r.forEach(d),s&&e.statsBuffer.value&&e.statsBuffer.value.frameloop[s].push(l),l=0,r.clear(),o=!1,c&&(c=!1,f.process(t))}};return f};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createRenderStep=function(e){let t=new Set,n=new Set,s=!1,c=!1;const o=new WeakSet;let r={delta:0,timestamp:0,isProcessing:!1};function d(t){o.has(t)&&(l.schedule(t),e()),t(r)}const l={schedule:function(e){const c=arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&s?t:n;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&o.add(e),c.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(r=e,s)return void(c=!0);s=!0;const o=t;t=n,n=o,t.forEach(d),t.clear(),s=!1,c&&(c=!1,l.process(e))}};return l};
2
2
  //# sourceMappingURL=render-step.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-step.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/frameloop/render-step.mjs"],"sourcesContent":["import { statsBuffer } from '../stats/buffer.mjs';\n\nfunction createRenderStep(runNextFrame, stepName) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n let numCalls = 0;\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n numCalls++;\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n // Swap this frame and the next to avoid GC\n const prevFrame = thisFrame;\n thisFrame = nextFrame;\n nextFrame = prevFrame;\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n /**\n * If we're recording stats then\n */\n if (stepName && statsBuffer.value) {\n statsBuffer.value.frameloop[stepName].push(numCalls);\n }\n numCalls = 0;\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n//# sourceMappingURL=render-step.mjs.map\n"],"names":["runNextFrame","stepName","thisFrame","Set","nextFrame","isProcessing","flushNextFrame","toKeepAlive","WeakSet","latestFrameData","delta","timestamp","numCalls","triggerCallback","callback","has","step","schedule","queue","arguments","length","undefined","add","cancel","delete","process","frameData","prevFrame","forEach","statsBuffer","value","frameloop","push","clear"],"mappings":"qIAIM,SACFA,EACAC,GAMA,IAAIC,EAAY,IAAIC,IAChBC,EAAY,IAAID,IAMhBE,GAAe,EAEfC,GAAiB,EAKrB,MAAMC,EAAc,IAAIC,QAExB,IAAIC,EAA6B,CAC7BC,MAAO,EACPC,UAAW,EACXN,cAAc,GAGdO,EAAW,EAEf,SAASC,EAAgBC,GACjBP,EAAYQ,IAAID,KAChBE,EAAKC,SAASH,GACdd,KAGJY,IACAE,EAASL,EACb,CAEA,MAAMO,EAAa,CAIfC,SAAU,SAACH,GACP,MACMI,EAFuCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,IACNd,EACLH,EAAYE,EAM9C,OAR0Be,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,IAIXZ,EAAYe,IAAIR,GAE/BI,EAAMI,IAAIR,GAEHA,CACV,EAKDS,OAAST,IACLV,EAAUoB,OAAOV,GACjBP,EAAYiB,OAAOV,EAAS,EAMhCW,QAAUC,IAQN,GAPAjB,EAAkBiB,EAOdrB,EAEA,YADAC,GAAiB,GAIrBD,GAAe,EAGf,MAAMsB,EAAYzB,EAClBA,EAAYE,EACZA,EAAYuB,EAGZzB,EAAU0B,QAAQf,GAKdZ,GAAY4B,EAAWA,YAACC,OACxBD,EAAWA,YAACC,MAAMC,UAAU9B,GAAU+B,KAAKpB,GAE/CA,EAAW,EAIXV,EAAU+B,QAEV5B,GAAe,EAEXC,IACAA,GAAiB,EACjBU,EAAKS,QAAQC,GACjB,GAIR,OAAOV,CACX"}
1
+ {"version":3,"file":"render-step.mjs.js","sources":["../../../../../../node_modules/motion-dom/dist/es/frameloop/render-step.mjs"],"sourcesContent":["function createRenderStep(runNextFrame) {\n /**\n * We create and reuse two queues, one to queue jobs for the current frame\n * and one for the next. We reuse to avoid triggering GC after x frames.\n */\n let thisFrame = new Set();\n let nextFrame = new Set();\n /**\n * Track whether we're currently processing jobs in this step. This way\n * we can decide whether to schedule new jobs for this frame or next.\n */\n let isProcessing = false;\n let flushNextFrame = false;\n /**\n * A set of processes which were marked keepAlive when scheduled.\n */\n const toKeepAlive = new WeakSet();\n let latestFrameData = {\n delta: 0.0,\n timestamp: 0.0,\n isProcessing: false,\n };\n function triggerCallback(callback) {\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n callback(latestFrameData);\n }\n const step = {\n /**\n * Schedule a process to run on the next frame.\n */\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const queue = addToCurrentFrame ? thisFrame : nextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n queue.add(callback);\n return callback;\n },\n /**\n * Cancel the provided callback from running on the next frame.\n */\n cancel: (callback) => {\n nextFrame.delete(callback);\n toKeepAlive.delete(callback);\n },\n /**\n * Execute all schedule callbacks.\n */\n process: (frameData) => {\n latestFrameData = frameData;\n /**\n * If we're already processing we've probably been triggered by a flushSync\n * inside an existing process. Instead of executing, mark flushNextFrame\n * as true and ensure we flush the following frame at the end of this one.\n */\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n // Swap this frame and the next to avoid GC\n const prevFrame = thisFrame;\n thisFrame = nextFrame;\n nextFrame = prevFrame;\n // Execute this frame\n thisFrame.forEach(triggerCallback);\n // Clear the frame so no callbacks remain. This is to avoid\n // memory leaks should this render step not run for a while.\n thisFrame.clear();\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n//# sourceMappingURL=render-step.mjs.map\n"],"names":["runNextFrame","thisFrame","Set","nextFrame","isProcessing","flushNextFrame","toKeepAlive","WeakSet","latestFrameData","delta","timestamp","triggerCallback","callback","has","step","schedule","queue","arguments","length","undefined","add","cancel","delete","process","frameData","prevFrame","forEach","clear"],"mappings":"6FAEM,SAA2BA,GAK7B,IAAIC,EAAY,IAAIC,IAChBC,EAAY,IAAID,IAMhBE,GAAe,EAEfC,GAAiB,EAKrB,MAAMC,EAAc,IAAIC,QAExB,IAAIC,EAA6B,CAC7BC,MAAO,EACPC,UAAW,EACXN,cAAc,GAGlB,SAASO,EAAgBC,GACjBN,EAAYO,IAAID,KAChBE,EAAKC,SAASH,GACdZ,KAGJY,EAASJ,EACb,CAEA,MAAMM,EAAa,CAIfC,SAAU,SAACH,GACP,MACMI,EAFuCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,IACNb,EACLH,EAAYE,EAM9C,OAR0Bc,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,IAIXX,EAAYc,IAAIR,GAE/BI,EAAMI,IAAIR,GAEHA,CACV,EAKDS,OAAST,IACLT,EAAUmB,OAAOV,GACjBN,EAAYgB,OAAOV,EAAS,EAMhCW,QAAUC,IAQN,GAPAhB,EAAkBgB,EAOdpB,EAEA,YADAC,GAAiB,GAIrBD,GAAe,EAGf,MAAMqB,EAAYxB,EAClBA,EAAYE,EACZA,EAAYsB,EAGZxB,EAAUyB,QAAQf,GAIlBV,EAAU0B,QAEVvB,GAAe,EAEXC,IACAA,GAAiB,EACjBS,EAAKS,QAAQC,GACjB,GAIR,OAAOV,CACX"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/is-html-element.mjs.js"),s=require("../drag/state/is-active.mjs.js"),t=require("../utils/is-node-or-child.mjs.js"),r=require("../utils/is-primary-pointer.mjs.js"),i=require("../utils/setup.mjs.js"),n=require("./utils/is-keyboard-accessible.mjs.js"),o=require("./utils/keyboard.mjs.js"),a=require("./utils/state.mjs.js");function u(e){return r.isPrimaryPointer(e)&&!s.isDragActive()}const d=new WeakSet;exports.press=function(s,r){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const[c,p,j]=i.setupGesture(s,l),m=e=>{const s=e.currentTarget;if(!u(e))return;if(d.has(e))return;a.isPressing.add(s),l.stopPropagation&&d.add(e);const i=r(s,e),n=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",c),a.isPressing.has(s)&&a.isPressing.delete(s),u(e)&&"function"==typeof i&&i(e,{success:t})},o=e=>{n(e,s===window||s===document||l.useGlobalTarget||t.isNodeOrChild(s,e.target))},c=e=>{n(e,!1)};window.addEventListener("pointerup",o,p),window.addEventListener("pointercancel",c,p)};return c.forEach((s=>{(l.useGlobalTarget?window:s).addEventListener("pointerdown",m,p),e.isHTMLElement(s)&&(s.addEventListener("focus",(e=>o.enableKeyboardPress(e,p))),n.isElementKeyboardAccessible(s)||s.hasAttribute("tabindex")||(s.tabIndex=0))})),j};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/is-html-element.mjs.js"),s=require("../drag/state/is-active.mjs.js"),t=require("../utils/is-node-or-child.mjs.js"),r=require("../utils/is-primary-pointer.mjs.js"),i=require("../utils/setup.mjs.js"),n=require("./utils/is-keyboard-accessible.mjs.js"),o=require("./utils/keyboard.mjs.js"),a=require("./utils/state.mjs.js");function u(e){return r.isPrimaryPointer(e)&&!s.isDragActive()}const d=new WeakSet;exports.press=function(s,r){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const[l,p,j]=i.setupGesture(s,c),m=e=>{const s=e.currentTarget;if(!u(e))return;if(d.has(e))return;a.isPressing.add(s),c.stopPropagation&&d.add(e);const i=r(s,e),n={...p,capture:!0},o=(e,t)=>{window.removeEventListener("pointerup",l,n),window.removeEventListener("pointercancel",j,n),a.isPressing.has(s)&&a.isPressing.delete(s),u(e)&&"function"==typeof i&&i(e,{success:t})},l=e=>{o(e,s===window||s===document||c.useGlobalTarget||t.isNodeOrChild(s,e.target))},j=e=>{o(e,!1)};window.addEventListener("pointerup",l,n),window.addEventListener("pointercancel",j,n)};return l.forEach((s=>{(c.useGlobalTarget?window:s).addEventListener("pointerdown",m,p),e.isHTMLElement(s)&&(s.addEventListener("focus",(e=>o.enableKeyboardPress(e,p))),n.isElementKeyboardAccessible(s)||s.hasAttribute("tabindex")||(s.tabIndex=0))})),j};
2
2
  //# sourceMappingURL=index.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/press/index.mjs"],"sourcesContent":["import { isHTMLElement } from '../../utils/is-html-element.mjs';\nimport { isDragActive } from '../drag/state/is-active.mjs';\nimport { isNodeOrChild } from '../utils/is-node-or-child.mjs';\nimport { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';\nimport { setupGesture } from '../utils/setup.mjs';\nimport { isElementKeyboardAccessible } from './utils/is-keyboard-accessible.mjs';\nimport { enableKeyboardPress } from './utils/keyboard.mjs';\nimport { isPressing } from './utils/state.mjs';\n\n/**\n * Filter out events that are not primary pointer events, or are triggering\n * while a Motion gesture is active.\n */\nfunction isValidPressEvent(event) {\n return isPrimaryPointer(event) && !isDragActive();\n}\nconst claimedPointerDownEvents = new WeakSet();\n/**\n * Create a press gesture.\n *\n * Press is different to `\"pointerdown\"`, `\"pointerup\"` in that it\n * automatically filters out secondary pointer events like right\n * click and multitouch.\n *\n * It also adds accessibility support for keyboards, where\n * an element with a press gesture will receive focus and\n * trigger on Enter `\"keydown\"` and `\"keyup\"` events.\n *\n * This is different to a browser's `\"click\"` event, which does\n * respond to keyboards but only for the `\"click\"` itself, rather\n * than the press start and end/cancel. The element also needs\n * to be focusable for this to work, whereas a press gesture will\n * make an element focusable by default.\n *\n * @public\n */\nfunction press(targetOrSelector, onPressStart, options = {}) {\n const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);\n const startPress = (startEvent) => {\n const target = startEvent.currentTarget;\n if (!isValidPressEvent(startEvent))\n return;\n if (claimedPointerDownEvents.has(startEvent))\n return;\n isPressing.add(target);\n if (options.stopPropagation) {\n claimedPointerDownEvents.add(startEvent);\n }\n const onPressEnd = onPressStart(target, startEvent);\n const onPointerEnd = (endEvent, success) => {\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onPointerCancel);\n if (isPressing.has(target)) {\n isPressing.delete(target);\n }\n if (!isValidPressEvent(endEvent)) {\n return;\n }\n if (typeof onPressEnd === \"function\") {\n onPressEnd(endEvent, { success });\n }\n };\n const onPointerUp = (upEvent) => {\n onPointerEnd(upEvent, target === window ||\n target === document ||\n options.useGlobalTarget ||\n isNodeOrChild(target, upEvent.target));\n };\n const onPointerCancel = (cancelEvent) => {\n onPointerEnd(cancelEvent, false);\n };\n window.addEventListener(\"pointerup\", onPointerUp, eventOptions);\n window.addEventListener(\"pointercancel\", onPointerCancel, eventOptions);\n };\n targets.forEach((target) => {\n const pointerDownTarget = options.useGlobalTarget ? window : target;\n pointerDownTarget.addEventListener(\"pointerdown\", startPress, eventOptions);\n if (isHTMLElement(target)) {\n target.addEventListener(\"focus\", (event) => enableKeyboardPress(event, eventOptions));\n if (!isElementKeyboardAccessible(target) &&\n !target.hasAttribute(\"tabindex\")) {\n target.tabIndex = 0;\n }\n }\n });\n return cancelEvents;\n}\n\nexport { press };\n//# sourceMappingURL=index.mjs.map\n"],"names":["isValidPressEvent","event","isPrimaryPointer","isDragActive","claimedPointerDownEvents","WeakSet","targetOrSelector","onPressStart","options","arguments","length","undefined","targets","eventOptions","cancelEvents","setupGesture","startPress","startEvent","target","currentTarget","has","isPressing","add","stopPropagation","onPressEnd","onPointerEnd","endEvent","success","window","removeEventListener","onPointerUp","onPointerCancel","delete","upEvent","document","useGlobalTarget","isNodeOrChild","cancelEvent","addEventListener","forEach","isHTMLElement","enableKeyboardPress","isElementKeyboardAccessible","hasAttribute","tabIndex"],"mappings":"+ZAgBA,SAASA,EAAkBC,GACvB,OAAOC,mBAAiBD,KAAWE,EAAYA,cACnD,CAEA,MAAMC,EAA2B,IAAIC,sBA0B/B,SACFC,EACAC,GACiC,IAAjCC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAA+B,CAAA,EAE/B,MAAOG,EAASC,EAAcC,GAAgBC,eAC1CT,EACAE,GAGEQ,EAAcC,IAChB,MAAMC,EAASD,EAAWE,cAE1B,IAAKnB,EAAkBiB,GAAa,OACpC,GAAIb,EAAyBgB,IAAIH,GAAa,OAE9CI,aAAWC,IAAIJ,GAEXV,EAAQe,iBACRnB,EAAyBkB,IAAIL,GAGjC,MAAMO,EAAajB,EAAaW,EAAQD,GAElCQ,EAAeA,CAACC,EAAwBC,KAC1CC,OAAOC,oBAAoB,YAAaC,GACxCF,OAAOC,oBAAoB,gBAAiBE,GAExCV,EAAUA,WAACD,IAAIF,IACfG,aAAWW,OAAOd,GAGjBlB,EAAkB0B,IAIG,mBAAfF,GACPA,EAAWE,EAAU,CAAEC,WAC3B,EAGEG,EAAeG,IACjBR,EACIQ,EACCf,IAAmBU,QACfV,IAAmBgB,UACpB1B,EAAQ2B,iBACRC,EAAAA,cAAclB,EAAQe,EAAQf,QACrC,EAGCa,EAAmBM,IACrBZ,EAAaY,GAAa,EAAM,EAGpCT,OAAOU,iBAAiB,YAAaR,EAAajB,GAClDe,OAAOU,iBAAiB,gBAAiBP,EAAiBlB,EAAa,EAyB3E,OAtBAD,EAAQ2B,SAASrB,KACaV,EAAQ2B,gBAAkBP,OAASV,GAC3CoB,iBACd,cACAtB,EACAH,GAGA2B,EAAAA,cAActB,KACdA,EAAOoB,iBAAiB,SAAUrC,GAC9BwC,EAAAA,oBAAoBxC,EAAqBY,KAIxC6B,EAA2BA,4BAACxB,IAC5BA,EAAOyB,aAAa,cAErBzB,EAAO0B,SAAW,GAE1B,IAGG9B,CACX"}
1
+ {"version":3,"file":"index.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/gestures/press/index.mjs"],"sourcesContent":["import { isHTMLElement } from '../../utils/is-html-element.mjs';\nimport { isDragActive } from '../drag/state/is-active.mjs';\nimport { isNodeOrChild } from '../utils/is-node-or-child.mjs';\nimport { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';\nimport { setupGesture } from '../utils/setup.mjs';\nimport { isElementKeyboardAccessible } from './utils/is-keyboard-accessible.mjs';\nimport { enableKeyboardPress } from './utils/keyboard.mjs';\nimport { isPressing } from './utils/state.mjs';\n\n/**\n * Filter out events that are not primary pointer events, or are triggering\n * while a Motion gesture is active.\n */\nfunction isValidPressEvent(event) {\n return isPrimaryPointer(event) && !isDragActive();\n}\nconst claimedPointerDownEvents = new WeakSet();\n/**\n * Create a press gesture.\n *\n * Press is different to `\"pointerdown\"`, `\"pointerup\"` in that it\n * automatically filters out secondary pointer events like right\n * click and multitouch.\n *\n * It also adds accessibility support for keyboards, where\n * an element with a press gesture will receive focus and\n * trigger on Enter `\"keydown\"` and `\"keyup\"` events.\n *\n * This is different to a browser's `\"click\"` event, which does\n * respond to keyboards but only for the `\"click\"` itself, rather\n * than the press start and end/cancel. The element also needs\n * to be focusable for this to work, whereas a press gesture will\n * make an element focusable by default.\n *\n * @public\n */\nfunction press(targetOrSelector, onPressStart, options = {}) {\n const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);\n const startPress = (startEvent) => {\n const target = startEvent.currentTarget;\n if (!isValidPressEvent(startEvent))\n return;\n if (claimedPointerDownEvents.has(startEvent))\n return;\n isPressing.add(target);\n if (options.stopPropagation) {\n claimedPointerDownEvents.add(startEvent);\n }\n const onPressEnd = onPressStart(target, startEvent);\n /**\n * End listeners run in the capture phase so a descendant calling\n * stopPropagation() in its own pointerup handler can't prevent the\n * press gesture from ending. This also keeps the gesture-end\n * ordering consistent with the drag gesture. See #2794.\n */\n const endEventOptions = { ...eventOptions, capture: true };\n const onPointerEnd = (endEvent, success) => {\n window.removeEventListener(\"pointerup\", onPointerUp, endEventOptions);\n window.removeEventListener(\"pointercancel\", onPointerCancel, endEventOptions);\n if (isPressing.has(target)) {\n isPressing.delete(target);\n }\n if (!isValidPressEvent(endEvent)) {\n return;\n }\n if (typeof onPressEnd === \"function\") {\n onPressEnd(endEvent, { success });\n }\n };\n const onPointerUp = (upEvent) => {\n onPointerEnd(upEvent, target === window ||\n target === document ||\n options.useGlobalTarget ||\n isNodeOrChild(target, upEvent.target));\n };\n const onPointerCancel = (cancelEvent) => {\n onPointerEnd(cancelEvent, false);\n };\n window.addEventListener(\"pointerup\", onPointerUp, endEventOptions);\n window.addEventListener(\"pointercancel\", onPointerCancel, endEventOptions);\n };\n targets.forEach((target) => {\n const pointerDownTarget = options.useGlobalTarget ? window : target;\n pointerDownTarget.addEventListener(\"pointerdown\", startPress, eventOptions);\n if (isHTMLElement(target)) {\n target.addEventListener(\"focus\", (event) => enableKeyboardPress(event, eventOptions));\n if (!isElementKeyboardAccessible(target) &&\n !target.hasAttribute(\"tabindex\")) {\n target.tabIndex = 0;\n }\n }\n });\n return cancelEvents;\n}\n\nexport { press };\n//# sourceMappingURL=index.mjs.map\n"],"names":["isValidPressEvent","event","isPrimaryPointer","isDragActive","claimedPointerDownEvents","WeakSet","targetOrSelector","onPressStart","options","arguments","length","undefined","targets","eventOptions","cancelEvents","setupGesture","startPress","startEvent","target","currentTarget","has","isPressing","add","stopPropagation","onPressEnd","endEventOptions","capture","onPointerEnd","endEvent","success","window","removeEventListener","onPointerUp","onPointerCancel","delete","upEvent","document","useGlobalTarget","isNodeOrChild","cancelEvent","addEventListener","forEach","isHTMLElement","enableKeyboardPress","isElementKeyboardAccessible","hasAttribute","tabIndex"],"mappings":"+ZAgBA,SAASA,EAAkBC,GACvB,OAAOC,mBAAiBD,KAAWE,EAAYA,cACnD,CAEA,MAAMC,EAA2B,IAAIC,sBA0B/B,SACFC,EACAC,GACiC,IAAjCC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAA+B,CAAA,EAE/B,MAAOG,EAASC,EAAcC,GAAgBC,eAC1CT,EACAE,GAGEQ,EAAcC,IAChB,MAAMC,EAASD,EAAWE,cAE1B,IAAKnB,EAAkBiB,GAAa,OACpC,GAAIb,EAAyBgB,IAAIH,GAAa,OAE9CI,aAAWC,IAAIJ,GAEXV,EAAQe,iBACRnB,EAAyBkB,IAAIL,GAGjC,MAAMO,EAAajB,EAAaW,EAAQD,GAQlCQ,EAAkB,IAAKZ,EAAca,SAAS,GAE9CC,EAAeA,CAACC,EAAwBC,KAC1CC,OAAOC,oBACH,YACAC,EACAP,GAEJK,OAAOC,oBACH,gBACAE,EACAR,GAGAJ,EAAUA,WAACD,IAAIF,IACfG,aAAWa,OAAOhB,GAGjBlB,EAAkB4B,IAIG,mBAAfJ,GACPA,EAAWI,EAAU,CAAEC,WAC3B,EAGEG,EAAeG,IACjBR,EACIQ,EACCjB,IAAmBY,QACfZ,IAAmBkB,UACpB5B,EAAQ6B,iBACRC,EAAAA,cAAcpB,EAAQiB,EAAQjB,QACrC,EAGCe,EAAmBM,IACrBZ,EAAaY,GAAa,EAAM,EAGpCT,OAAOU,iBAAiB,YAAaR,EAAaP,GAClDK,OAAOU,iBACH,gBACAP,EACAR,EACH,EAyBL,OAtBAb,EAAQ6B,SAASvB,KACaV,EAAQ6B,gBAAkBP,OAASZ,GAC3CsB,iBACd,cACAxB,EACAH,GAGA6B,EAAAA,cAAcxB,KACdA,EAAOsB,iBAAiB,SAAUvC,GAC9B0C,EAAAA,oBAAoB1C,EAAqBY,KAIxC+B,EAA2BA,4BAAC1B,IAC5BA,EAAO2B,aAAa,cAErB3B,EAAO4B,SAAW,GAE1B,IAGGhC,CACX"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../utils/mix/number.mjs.js"),e=require("../../value/types/numbers/units.mjs.js"),r=require("../../../../../motion-utils/dist/es/easing/circ.mjs.js"),o=require("../../../../../motion-utils/dist/es/progress.mjs.js"),i=require("../../../../../motion-utils/dist/es/noop.mjs.js");const s=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],u=s.length,n=t=>"string"==typeof t?parseFloat(t):t,a=t=>"number"==typeof t||e.px.test(t);function m(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const p=d(0,.5,r.circOut),c=d(.5,.95,i.noop);function d(t,e,r){return i=>i<t?0:i>e?1:r(o.progress(t,e,i))}exports.mixValues=function(r,o,i,d,b,l){b?(r.opacity=t.mixNumber(0,i.opacity??1,p(d)),r.opacityExit=t.mixNumber(o.opacity??1,0,c(d))):l&&(r.opacity=t.mixNumber(o.opacity??1,i.opacity??1,d));for(let p=0;p<u;p++){const u=s[p];let c=m(o,u),b=m(i,u);if(void 0===c&&void 0===b)continue;c||(c=0),b||(b=0);0===c||0===b||a(c)===a(b)?(r[u]=Math.max(t.mixNumber(n(c),n(b),d),0),(e.percent.test(b)||e.percent.test(c))&&(r[u]+="%")):r[u]=b}(o.rotate||i.rotate)&&(r.rotate=t.mixNumber(o.rotate||0,i.rotate||0,d))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/mix/number.mjs.js"),t=require("../../value/types/numbers/units.mjs.js"),r=require("../../utils/border-radius.mjs.js"),i=require("../../../../../motion-utils/dist/es/easing/circ.mjs.js"),s=require("../../../../../motion-utils/dist/es/progress.mjs.js"),o=require("../../../../../motion-utils/dist/es/noop.mjs.js");const u=r.cornerRadiusProps.length,n=e=>"string"==typeof e?parseFloat(e):e,a=e=>"number"==typeof e||t.px.test(e);function m(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const c=d(0,.5,i.circOut),p=d(.5,.95,o.noop);function d(e,t,r){return i=>i<e?0:i>t?1:r(s.progress(e,t,i))}exports.mixValues=function(i,s,o,d,j,l){j?(i.opacity=e.mixNumber(0,o.opacity??1,c(d)),i.opacityExit=e.mixNumber(s.opacity??1,0,p(d))):l&&(i.opacity=e.mixNumber(s.opacity??1,o.opacity??1,d));for(let c=0;c<u;c++){const u=r.cornerRadiusProps[c];let p=m(s,u),j=m(o,u);if(void 0===p&&void 0===j)continue;p||(p=0),j||(j=0);0===p||0===j||a(p)===a(j)?(i[u]=Math.max(e.mixNumber(n(p),n(j),d),0),(t.percent.test(j)||t.percent.test(p))&&(i[u]+="%")):i[u]=j}(s.rotate||o.rotate)&&(i.rotate=e.mixNumber(s.rotate||0,o.rotate||0,d))};
2
2
  //# sourceMappingURL=mix-values.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mix-values.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs"],"sourcesContent":["import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent, px } from '../../value/types/numbers/units.mjs';\nimport { progress, circOut, noop } from 'motion-utils';\n\nconst borderLabels = [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n];\nconst numBorders = borderLabels.length;\nconst asNumber = (value) => typeof value === \"string\" ? parseFloat(value) : value;\nconst isPx = (value) => typeof value === \"number\" || px.test(value);\nfunction mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress));\n target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress));\n }\n else if (isOnlyMember) {\n target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress);\n }\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = borderLabels[i];\n let followRadius = getRadius(follow, borderLabel);\n let leadRadius = getRadius(lead, borderLabel);\n if (followRadius === undefined && leadRadius === undefined)\n continue;\n followRadius || (followRadius = 0);\n leadRadius || (leadRadius = 0);\n const canMix = followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius);\n if (canMix) {\n target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0);\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\";\n }\n }\n else {\n target[borderLabel] = leadRadius;\n }\n }\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress);\n }\n}\nfunction getRadius(values, radiusName) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius;\n}\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut);\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop);\nfunction compress(min, max, easing) {\n return (p) => {\n // Could replace ifs with clamp\n if (p < min)\n return 0;\n if (p > max)\n return 1;\n return easing(progress(min, max, p));\n };\n}\n\nexport { mixValues };\n//# sourceMappingURL=mix-values.mjs.map\n"],"names":["borderLabels","numBorders","length","asNumber","value","parseFloat","isPx","px","test","getRadius","values","radiusName","undefined","borderRadius","easeCrossfadeIn","compress","circOut","easeCrossfadeOut","noop","min","max","easing","p","calcProgress","target","follow","lead","progress","shouldCrossfadeOpacity","isOnlyMember","opacity","mixNumber","opacityExit","i","borderLabel","followRadius","leadRadius","Math","percent","rotate"],"mappings":"yWAWA,MAAMA,EAAe,CACjB,sBACA,uBACA,yBACA,2BAEEC,EAAaD,EAAaE,OAE1BC,EAAYC,GACG,iBAAVA,EAAqBC,WAAWD,GAASA,EAE9CE,EAAQF,GACO,iBAAVA,GAAsBG,KAAGC,KAAKJ,GA6EzC,SAASK,EAAUC,EAAwBC,GACvC,YAA8BC,IAAvBF,EAAOC,GACRD,EAAOC,GACPD,EAAOG,YACjB,CAEA,MAAMC,EAAgCC,EAAS,EAAG,GAAKC,EAAOA,SACxDC,EAAiCF,EAAS,GAAK,IAAMG,EAAIA,MAE/D,SAASH,EACLI,EACAC,EACAC,GAEA,OAAQC,GAEAA,EAAIH,EAAY,EAChBG,EAAIF,EAAY,EACbC,EAAOE,EAAAA,SAAaJ,EAAKC,EAAKE,GAE7C,mBA/FM,SACFE,EACAC,EACAC,EACAC,EACAC,EACAC,GAEID,GACAJ,EAAOM,QAAUC,EAASA,UACtB,EACCL,EAAKI,SAAsB,EAC5BhB,EAAgBa,IAEpBH,EAAOQ,YAAcD,EAASA,UACzBN,EAAOK,SAAsB,EAC9B,EACAb,EAAiBU,KAEdE,IACPL,EAAOM,QAAUC,YACZN,EAAOK,SAAsB,EAC7BJ,EAAKI,SAAsB,EAC5BH,IAOR,IAAK,IAAIM,EAAI,EAAGA,EAAIhC,EAAYgC,IAAK,CACjC,MAAMC,EAAclC,EAAaiC,GACjC,IAAIE,EAAe1B,EAAUgB,EAAQS,GACjCE,EAAa3B,EAAUiB,EAAMQ,GAEjC,QAAqBtB,IAAjBuB,QAA6CvB,IAAfwB,EAA0B,SAE5DD,IAAAA,EAAiB,GACjBC,IAAAA,EAAe,GAGM,IAAjBD,GACe,IAAfC,GACA9B,EAAK6B,KAAkB7B,EAAK8B,IAG5BZ,EAAOU,GAAeG,KAAKjB,IACvBW,EAASA,UACL5B,EAASgC,GACThC,EAASiC,GACTT,GAEJ,IAGAW,EAAAA,QAAQ9B,KAAK4B,IAAeE,EAAAA,QAAQ9B,KAAK2B,MACzCX,EAAOU,IAAgB,MAG3BV,EAAOU,GAAeE,CAE9B,EAKIX,EAAOc,QAAUb,EAAKa,UACtBf,EAAOe,OAASR,YACXN,EAAOc,QAAqB,EAC5Bb,EAAKa,QAAqB,EAC3BZ,GAGZ"}
1
+ {"version":3,"file":"mix-values.mjs.js","sources":["../../../../../../../node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs"],"sourcesContent":["import { mixNumber } from '../../utils/mix/number.mjs';\nimport { percent, px } from '../../value/types/numbers/units.mjs';\nimport { progress, circOut, noop } from 'motion-utils';\nimport { cornerRadiusProps } from '../../utils/border-radius.mjs';\n\nconst numBorders = cornerRadiusProps.length;\nconst asNumber = (value) => typeof value === \"string\" ? parseFloat(value) : value;\nconst isPx = (value) => typeof value === \"number\" || px.test(value);\nfunction mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {\n if (shouldCrossfadeOpacity) {\n target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress));\n target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress));\n }\n else if (isOnlyMember) {\n target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress);\n }\n /**\n * Mix border radius\n */\n for (let i = 0; i < numBorders; i++) {\n const borderLabel = cornerRadiusProps[i];\n let followRadius = getRadius(follow, borderLabel);\n let leadRadius = getRadius(lead, borderLabel);\n if (followRadius === undefined && leadRadius === undefined)\n continue;\n followRadius || (followRadius = 0);\n leadRadius || (leadRadius = 0);\n const canMix = followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius);\n if (canMix) {\n target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0);\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\";\n }\n }\n else {\n target[borderLabel] = leadRadius;\n }\n }\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress);\n }\n}\nfunction getRadius(values, radiusName) {\n return values[radiusName] !== undefined\n ? values[radiusName]\n : values.borderRadius;\n}\nconst easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut);\nconst easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop);\nfunction compress(min, max, easing) {\n return (p) => {\n // Could replace ifs with clamp\n if (p < min)\n return 0;\n if (p > max)\n return 1;\n return easing(progress(min, max, p));\n };\n}\n\nexport { mixValues };\n//# sourceMappingURL=mix-values.mjs.map\n"],"names":["numBorders","cornerRadiusProps","length","asNumber","value","parseFloat","isPx","px","test","getRadius","values","radiusName","undefined","borderRadius","easeCrossfadeIn","compress","circOut","easeCrossfadeOut","noop","min","max","easing","p","calcProgress","target","follow","lead","progress","shouldCrossfadeOpacity","isOnlyMember","opacity","mixNumber","opacityExit","i","borderLabel","followRadius","leadRadius","Math","percent","rotate"],"mappings":"uZAYA,MAAMA,EAAaC,EAAiBA,kBAACC,OAE/BC,EAAYC,GACG,iBAAVA,EAAqBC,WAAWD,GAASA,EAE9CE,EAAQF,GACO,iBAAVA,GAAsBG,KAAGC,KAAKJ,GA6EzC,SAASK,EAAUC,EAAwBC,GACvC,YAA8BC,IAAvBF,EAAOC,GACRD,EAAOC,GACPD,EAAOG,YACjB,CAEA,MAAMC,EAAgCC,EAAS,EAAG,GAAKC,EAAOA,SACxDC,EAAiCF,EAAS,GAAK,IAAMG,EAAIA,MAE/D,SAASH,EACLI,EACAC,EACAC,GAEA,OAAQC,GAEAA,EAAIH,EAAY,EAChBG,EAAIF,EAAY,EACbC,EAAOE,EAAAA,SAAaJ,EAAKC,EAAKE,GAE7C,mBA/FM,SACFE,EACAC,EACAC,EACAC,EACAC,EACAC,GAEID,GACAJ,EAAOM,QAAUC,EAASA,UACtB,EACCL,EAAKI,SAAsB,EAC5BhB,EAAgBa,IAEpBH,EAAOQ,YAAcD,EAASA,UACzBN,EAAOK,SAAsB,EAC9B,EACAb,EAAiBU,KAEdE,IACPL,EAAOM,QAAUC,YACZN,EAAOK,SAAsB,EAC7BJ,EAAKI,SAAsB,EAC5BH,IAOR,IAAK,IAAIM,EAAI,EAAGA,EAAIjC,EAAYiC,IAAK,CACjC,MAAMC,EAAcjC,oBAAkBgC,GACtC,IAAIE,EAAe1B,EAAUgB,EAAQS,GACjCE,EAAa3B,EAAUiB,EAAMQ,GAEjC,QAAqBtB,IAAjBuB,QAA6CvB,IAAfwB,EAA0B,SAE5DD,IAAAA,EAAiB,GACjBC,IAAAA,EAAe,GAGM,IAAjBD,GACe,IAAfC,GACA9B,EAAK6B,KAAkB7B,EAAK8B,IAG5BZ,EAAOU,GAAeG,KAAKjB,IACvBW,EAASA,UACL5B,EAASgC,GACThC,EAASiC,GACTT,GAEJ,IAGAW,EAAAA,QAAQ9B,KAAK4B,IAAeE,EAAAA,QAAQ9B,KAAK2B,MACzCX,EAAOU,IAAgB,MAG3BV,EAAOU,GAAeE,CAE9B,EAKIX,EAAOc,QAAUb,EAAKa,UACtBf,EAAOe,OAASR,YACXN,EAAOc,QAAqB,EAC5Bb,EAAKa,QAAqB,EAC3BZ,GAGZ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../animation/animate/single-value.mjs.js"),e=require("../../animation/optimized-appear/get-appear-id.mjs.js"),i=require("../../animation/utils/get-value-transition.mjs.js"),s=require("../../frameloop/microtask.mjs.js"),o=require("../../frameloop/sync-time.mjs.js"),a=require("../styles/scale-correction.mjs.js"),r=require("../../utils/delay.mjs.js"),n=require("../../utils/is-svg-element.mjs.js"),l=require("../../utils/is-svg-svg-element.mjs.js"),h=require("../../utils/mix/number.mjs.js"),c=require("../../value/index.mjs.js"),u=require("../../value/utils/resolve-motion-value.mjs.js"),d=require("../animation/mix-values.mjs.js"),m=require("../geometry/copy.mjs.js"),p=require("../geometry/delta-apply.mjs.js"),y=require("../geometry/delta-calc.mjs.js"),g=require("../geometry/delta-remove.mjs.js"),v=require("../geometry/models.mjs.js"),f=require("../geometry/utils.mjs.js"),x=require("../shared/stack.mjs.js"),j=require("../styles/transform.mjs.js"),T=require("../utils/each-axis.mjs.js"),D=require("../utils/flat-tree.mjs.js"),B=require("../utils/has-transform.mjs.js"),P=require("./state.mjs.js"),S=require("../../frameloop/frame.mjs.js"),A=require("../../../../../motion-utils/dist/es/noop.mjs.js"),R=require("../../../../../motion-utils/dist/es/subscription-manager.mjs.js"),V=require("../../../../../motion-utils/dist/es/clamp.mjs.js");const L=["","X","Y","Z"];let k=0;function E(t,e,i,s){const{latestValues:o}=e;o[t]&&(i[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function w(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:i}=t.options;if(!i)return;const s=e.getOptimisedAppearId(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(s,"transform",S.frame,!(e||i))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&w(o)}function C(t){t.updateLayout()}function U(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:s}=t.layout,{animationType:o}=t.options,a=e.source!==t.layout.source;if("size"===o)T.eachAxis((t=>{const s=a?e.measuredBox[t]:e.layoutBox[t],o=y.calcLength(s);s.min=i[t].min,s.max=s.min+o}));else if("x"===o||"y"===o){const t="x"===o?"y":"x";m.copyAxisInto(a?e.measuredBox[t]:e.layoutBox[t],i[t])}else it(o,e.layoutBox,i)&&T.eachAxis((s=>{const o=a?e.measuredBox[s]:e.layoutBox[s],r=y.calcLength(i[s]);o.max=o.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)}));const r=v.createDelta();y.calcBoxDelta(r,i,e.layoutBox);const n=v.createDelta();a?y.calcBoxDelta(n,t.applyTransform(s,!0),e.measuredBox):y.calcBoxDelta(n,i,e.layoutBox);const l=!f.isDeltaZero(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:o,layout:a}=s;if(o&&a){const r=t.options.layoutAnchor||void 0,n=v.createBox();y.calcRelativePosition(n,e.layoutBox,o.layoutBox,r);const l=v.createBox();y.calcRelativePosition(l,i,a.layoutBox,r),f.boxEqualsRounded(n,l)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=l,t.relativeTargetOrigin=n,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:n,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function I(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function F(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q(t){t.clearSnapshot()}function b(t){t.clearMeasurements()}function O(t){t.isLayoutDirty=!0,t.updateLayout()}function M(t){t.isLayoutDirty=!1}function N(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function z(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function H(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W(t){t.resolveTargetDelta()}function G(t){t.calcProjection()}function Z(t){t.resetSkewAndRotation()}function $(t){t.removeLeadSnapshot()}function X(t,e,i){t.translate=h.mixNumber(e.translate,0,i),t.scale=h.mixNumber(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Y(t,e,i,s){t.min=h.mixNumber(e.min,i.min,s),t.max=h.mixNumber(e.max,i.max,s)}function _(t,e,i,s){Y(t.x,e.x,i.x,s),Y(t.y,e.y,i.y,s)}function J(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const K={duration:.45,ease:[.4,0,.1,1]},Q=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),tt=Q("applewebkit/")&&!Q("chrome/")?Math.round:A.noop;function et(t){t.min=tt(t.min),t.max=tt(t.max)}function it(t,e,i){return"position"===t||"preserve-aspect"===t&&!y.isNear(f.aspectRatio(e),f.aspectRatio(i),.2)}function st(t){return t!==t.root&&t.scroll?.wasRoot}exports.cleanDirtyNodes=F,exports.createProjectionNode=function(e){let{attachResizeListener:T,defaultParent:A,measureScroll:Y,checkIsScrollRoot:Q,resetTransform:tt}=e;return class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A?.();this.id=k++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(I),this.nodes.forEach(W),this.nodes.forEach(G),this.nodes.forEach(F)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=e?e.root||e:this,this.path=e?[...e.path,e]:[],this.parent=e,this.depth=e?e.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new D.FlatTree)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new R.SubscriptionManager),this.eventHandlers.get(t).add(e)}notifyListeners(t){const e=this.eventHandlers.get(t);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];e&&e.notify(...s)}hasListeners(t){return this.eventHandlers.has(t)}mount(t){if(this.instance)return;this.isSVG=n.isSVGElement(t)&&!l.isSVGSVGElement(t),this.instance=t;const{layoutId:e,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||e)&&(this.isLayoutDirty=!0),T){let e,i=0;const s=()=>this.root.updateBlockedByResize=!1;S.frame.read((()=>{i=window.innerWidth})),T(t,(()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,e&&e(),e=r.delay(s,250),P.globalProjectionState.hasAnimatedSinceResize&&(P.globalProjectionState.hasAnimatedSinceResize=!1,this.nodes.forEach(H)))}))}e&&this.root.registerSharedNode(e,this),!1!==this.options.animate&&o&&(e||s)&&this.addEventListener("didUpdate",(t=>{let{delta:e,hasLayoutChanged:s,hasRelativeLayoutChanged:a,layout:r}=t;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||o.getDefaultTransition()||K,{onLayoutAnimationStart:l,onLayoutAnimationComplete:h}=o.getProps(),c=!this.targetLayout||!f.boxEqualsRounded(this.targetLayout,r),u=!s&&a;if(this.options.layoutRoot||this.resumeFrom||u||s&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...i.getValueTransition(n,"layout"),onPlay:l,onComplete:h};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,u,t.path)}else s||H(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),S.cancelFrame(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Z),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&w(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(O),void this.nodes.forEach(b)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(M);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(N),this.nodes.forEach(z),this.nodes.forEach(C),this.nodes.forEach(U)):this.nodes.forEach(M),this.clearAllSnapshots();const t=o.time.now();S.frameData.delta=V.clamp(0,1e3/60,t-S.frameData.timestamp),S.frameData.timestamp=t,S.frameData.isProcessing=!0,S.frameSteps.update.process(S.frameData),S.frameSteps.preRender.process(S.frameData),S.frameSteps.render.process(S.frameData),S.frameData.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,s.microtask.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q),this.sharedNodes.forEach($)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,S.frame.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){S.frame.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||y.calcLength(this.snapshot.measuredBox.x)||y.calcLength(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=v.createBox()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"measure",e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=Q(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:Y(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!tt)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!f.isDeltaZero(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&this.instance&&(e||B.hasTransform(this.latestValues)||o)&&(tt(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),et((s=i).x),et(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return v.createBox();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(st))){const{scroll:t}=this.root;t&&(p.translateAxis(e.x,t.offset.x),p.translateAxis(e.y,t.offset.y))}return e}removeElementScroll(t){const e=v.createBox();if(m.copyBoxInto(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const s=this.path[i],{scroll:o,options:a}=s;s!==this.root&&o&&a.layoutScroll&&(o.wasRoot&&m.copyBoxInto(e,t),p.translateAxis(e.x,o.offset.x),p.translateAxis(e.y,o.offset.y))}return e}applyTransform(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=(arguments.length>2?arguments[2]:void 0)||v.createBox();m.copyBoxInto(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(p.translateAxis(i.x,-s.scroll.offset.x),p.translateAxis(i.y,-s.scroll.offset.y)),B.hasTransform(s.latestValues)&&p.transformBox(i,s.latestValues,s.layout?.layoutBox)}return B.hasTransform(this.latestValues)&&p.transformBox(i,this.latestValues,this.layout?.layoutBox),i}removeTransform(t){const e=v.createBox();m.copyBoxInto(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!B.hasTransform(i.latestValues))continue;let s;i.instance&&(B.hasScale(i.latestValues)&&i.updateSnapshot(),s=v.createBox(),m.copyBoxInto(s,i.measurePageBox())),g.removeBoxTransforms(e,i.latestValues,i.snapshot?.layoutBox,s)}return B.hasTransform(this.latestValues)&&g.removeBoxTransforms(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==S.frameData.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:o}=this.options;if(!this.layout||!s&&!o)return;this.resolvedRelativeTargetAt=S.frameData.timestamp;const a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target=v.createBox(),this.targetWithTransforms=v.createBox()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),y.calcRelativeBox(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target):m.copyBoxInto(this.target,this.layout.layoutBox),p.applyBoxDelta(this.target,this.targetDelta)):m.copyBoxInto(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&a&&Boolean(a.resumingFrom)===Boolean(this.resumingFrom)&&!a.options.layoutScroll&&a.target&&1!==this.animationProgress?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!B.hasScale(this.parent.latestValues)&&!B.has2DTranslate(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=v.createBox(),this.relativeTargetOrigin=v.createBox(),y.calcRelativePosition(this.relativeTargetOrigin,e,i,this.options.layoutAnchor||void 0),m.copyBoxInto(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===S.frameData.timestamp&&(i=!1),i)return;const{layout:s,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!o)return;m.copyBoxInto(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,r=this.treeScale.y;p.applyTreeDeltas(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=v.createBox());const{target:n}=t;n?(this.projectionDelta&&this.prevProjectionDelta?(m.copyAxisDeltaInto(this.prevProjectionDelta.x,this.projectionDelta.x),m.copyAxisDeltaInto(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),y.calcBoxDelta(this.projectionDelta,this.layoutCorrected,n,this.latestValues),this.treeScale.x===a&&this.treeScale.y===r&&f.axisDeltaEquals(this.projectionDelta.x,this.prevProjectionDelta.x)&&f.axisDeltaEquals(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",n))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=v.createDelta(),this.projectionDelta=v.createDelta(),this.projectionDeltaWithTransform=v.createDelta()}setAnimationOrigin(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=this.snapshot,o=s?s.latestValues:{},a={...this.latestValues},r=v.createDelta();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const n=v.createBox(),l=(s?s.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,p=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(J));let g;this.animationProgress=0;const x=i?.interpolateProjection(t);this.mixTargetDelta=e=>{const i=e/1e3,s=x?.(i);s?(r.x.translate=s.x,r.x.scale=h.mixNumber(t.x.scale,1,i),r.x.origin=t.x.origin,r.x.originPoint=t.x.originPoint,r.y.translate=s.y,r.y.scale=h.mixNumber(t.y.scale,1,i),r.y.origin=t.y.origin,r.y.originPoint=t.y.originPoint):(X(r.x,t.x,i),X(r.y,t.y,i)),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(y.calcRelativePosition(n,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),_(this.relativeTarget,this.relativeTargetOrigin,n,i),g&&f.boxEquals(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=v.createBox()),m.copyBoxInto(g,this.relativeTarget)),l&&(this.animationValues=a,d.mixValues(a,o,this.latestValues,i,p,u)),s&&void 0!==s.rotate&&(this.animationValues||(this.animationValues=a),this.animationValues.pathRotation=s.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(S.cancelFrame(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=S.frame.update((()=>{P.globalProjectionState.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=c.motionValue(0)),this.motionValue.jump(0,!1),this.currentAnimation=t.animateSingleValue(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:o}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&it(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||v.createBox();const e=y.calcLength(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=y.calcLength(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}m.copyBoxInto(e,i),p.transformBox(e,o),y.calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,e,o)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new x.NodeStack);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote(){let{needsReset:t,transition:e,preserveFollowOpacity:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&E("z",t,s,this.animationValues);for(let e=0;e<L.length;e++)E(`rotate${L[e]}`,t,s,this.animationValues),E(`skew${L[e]}`,t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=u.resolveMotionValue(e?.pointerEvents)||""),void(this.hasProjected&&!B.hasTransform(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const o=s.animationValues||s.latestValues;this.applyTransformsToTarget();let r=j.buildProjectionTransform(this.projectionDeltaWithTransform,this.treeScale,o);i&&(r=i(o,r)),t.transform=r;const{x:n,y:l}=this.projectionDelta;t.transformOrigin=`${100*n.origin}% ${100*l.origin}% 0`,s.animationValues?t.opacity=s===this?o.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:t.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in a.scaleCorrectors){if(void 0===o[e])continue;const{correct:i,applyTo:n,isCSSVariable:l}=a.scaleCorrectors[e],h="none"===r?o[e]:i(o[e],s);if(n){const e=n.length;for(let i=0;i<e;i++)t[n[i]]=h}else l?this.options.visualElement.renderState.vars[e]=h:t[e]=h}this.options.layoutId&&(t.pointerEvents=s===this?u.resolveMotionValue(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((t=>t.currentAnimation?.stop())),this.root.nodes.forEach(b),this.root.sharedNodes.clear()}}},exports.mixAxis=Y,exports.mixBox=_,exports.propagateDirtyNodes=I;
2
2
  //# sourceMappingURL=create-projection-node.mjs.js.map