motion 12.6.2 → 12.6.3

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 (72) hide show
  1. package/dist/cjs/debug.js +12 -12
  2. package/dist/cjs/index.js +402 -347
  3. package/dist/cjs/mini.js +339 -352
  4. package/dist/cjs/react-client.js +169 -176
  5. package/dist/cjs/react-m.js +18 -22
  6. package/dist/cjs/react-mini.js +275 -336
  7. package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -2
  8. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -4
  9. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -6
  10. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +10 -8
  11. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
  12. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
  13. package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +11 -1
  14. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -3
  15. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
  16. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
  17. package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +2 -4
  18. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +4 -6
  19. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
  20. package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
  21. package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +2 -2
  22. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
  23. package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +1 -2
  24. package/dist/es/framer-motion/dist/es/motion/index.mjs +2 -3
  25. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +3 -5
  26. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +19 -27
  27. package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +1 -1
  28. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +3 -4
  29. package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
  30. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +5 -6
  31. package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -2
  32. package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +1 -1
  34. package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
  35. package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -3
  36. package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +3 -5
  37. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  38. package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +1 -1
  39. package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -2
  40. package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +2 -3
  41. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +2 -2
  42. package/dist/es/motion-dom/dist/es/animation/{controls/BaseGroup.mjs → GroupAnimation.mjs} +4 -5
  43. package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +9 -0
  44. package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +161 -0
  45. package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +1 -1
  46. package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +12 -0
  47. package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +26 -0
  48. package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +3 -5
  49. package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +3 -0
  50. package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +14 -0
  51. package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +26 -0
  52. package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +15 -0
  53. package/dist/es/{framer-motion/dist/es/animation/animators/waapi/index.mjs → motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs} +8 -6
  54. package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs → motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs} +2 -2
  55. package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +14 -0
  56. package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +1 -4
  57. package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +39 -0
  58. package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +1 -1
  59. package/dist/es/motion-dom/dist/es/render/dom/style.mjs +15 -0
  60. package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +2 -7
  61. package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +1 -3
  62. package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +1 -1
  63. package/dist/es/motion-dom/dist/es/value/index.mjs +1 -1
  64. package/dist/es/motion-utils/dist/es/errors.mjs +2 -4
  65. package/dist/motion.dev.js +402 -347
  66. package/dist/motion.js +1 -1
  67. package/package.json +3 -3
  68. package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -116
  69. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
  70. package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +0 -13
  71. package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +0 -85
  72. package/dist/es/motion-dom/dist/es/animation/waapi/utils/easing.mjs +0 -44
@@ -13,7 +13,7 @@ function isAnimationControls(v) {
13
13
 
14
14
  function getValueState(visualElement) {
15
15
  const state = [{}, {}];
16
- visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
16
+ visualElement?.values.forEach((value, key) => {
17
17
  state[0][key] = value.get();
18
18
  state[1][key] = value.getVelocity();
19
19
  });
@@ -61,11 +61,8 @@ function removeItem(arr, item) {
61
61
  arr.splice(index, 1);
62
62
  }
63
63
 
64
- /*#__NO_SIDE_EFFECTS__*/
65
- const noop = (any) => any;
66
-
67
- let warning = noop;
68
- let invariant = noop;
64
+ let warning = () => { };
65
+ let invariant = () => { };
69
66
  if (process.env.NODE_ENV !== "production") {
70
67
  warning = (check, message) => {
71
68
  if (!check && typeof console !== "undefined") {
@@ -94,6 +91,9 @@ function memo(callback) {
94
91
  };
95
92
  }
96
93
 
94
+ /*#__NO_SIDE_EFFECTS__*/
95
+ const noop = (any) => any;
96
+
97
97
  /*
98
98
  Progress within given range
99
99
 
@@ -182,15 +182,14 @@ function warnOnce(condition, message, element) {
182
182
 
183
183
  const supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== undefined);
184
184
 
185
- class BaseGroupPlaybackControls {
185
+ class GroupAnimation {
186
186
  constructor(animations) {
187
187
  // Bound to accomodate common `return animation.stop` pattern
188
188
  this.stop = () => this.runAll("stop");
189
189
  this.animations = animations.filter(Boolean);
190
190
  }
191
191
  get finished() {
192
- // Support for new finished Promise and legacy thennable API
193
- return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
192
+ return Promise.all(this.animations.map((animation) => animation.finished));
194
193
  }
195
194
  /**
196
195
  * TODO: Filter out cancelled or stopped animations before returning
@@ -261,48 +260,16 @@ class BaseGroupPlaybackControls {
261
260
  }
262
261
  }
263
262
 
264
- /**
265
- * TODO: This is a temporary class to support the legacy
266
- * thennable API
267
- */
268
- class GroupPlaybackControls extends BaseGroupPlaybackControls {
269
- then(onResolve, onReject) {
270
- return Promise.all(this.animations).then(onResolve).catch(onReject);
271
- }
272
- }
273
-
274
- function getValueTransition(transition, key) {
275
- return transition
276
- ? transition[key] ||
277
- transition["default"] ||
278
- transition
279
- : undefined;
280
- }
281
-
282
- /**
283
- * Implement a practical max duration for keyframe generation
284
- * to prevent infinite loops
285
- */
286
- const maxGeneratorDuration = 20000;
287
- function calcGeneratorDuration(generator) {
288
- let duration = 0;
289
- const timeStep = 50;
290
- let state = generator.next(duration);
291
- while (!state.done && duration < maxGeneratorDuration) {
292
- duration += timeStep;
293
- state = generator.next(duration);
263
+ class GroupAnimationWithThen extends GroupAnimation {
264
+ then(onResolve, _onReject) {
265
+ return this.finished.finally(onResolve).then(() => { });
294
266
  }
295
- return duration >= maxGeneratorDuration ? Infinity : duration;
296
267
  }
297
268
 
298
- function isGenerator(type) {
299
- return typeof type === "function";
300
- }
301
-
302
- function attachTimeline(animation, timeline) {
303
- animation.timeline = timeline;
304
- animation.onfinish = null;
305
- }
269
+ const statsBuffer = {
270
+ value: null,
271
+ addProjectionMetrics: null,
272
+ };
306
273
 
307
274
  const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
308
275
 
@@ -310,13 +277,11 @@ const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0]
310
277
  * Add the ability for test suites to manually set support flags
311
278
  * to better test more environments.
312
279
  */
313
- const supportsFlags = {
314
- linearEasing: undefined,
315
- };
280
+ const supportsFlags = {};
316
281
 
317
282
  function memoSupports(callback, supportsFlag) {
318
283
  const memoized = memo(callback);
319
- return () => { var _a; return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized(); };
284
+ return () => supportsFlags[supportsFlag] ?? memoized();
320
285
  }
321
286
 
322
287
  const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {
@@ -337,20 +302,13 @@ resolution = 10 // as milliseconds
337
302
  let points = "";
338
303
  const numPoints = Math.max(Math.round(duration / resolution), 2);
339
304
  for (let i = 0; i < numPoints; i++) {
340
- points += easing(progress(0, numPoints - 1, i)) + ", ";
305
+ points += easing(i / (numPoints - 1)) + ", ";
341
306
  }
342
307
  return `linear(${points.substring(0, points.length - 2)})`;
343
308
  };
344
309
 
345
- function isWaapiSupportedEasing(easing) {
346
- return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
347
- !easing ||
348
- (typeof easing === "string" &&
349
- (easing in supportedWaapiEasing || supportsLinearEasing())) ||
350
- isBezierDefinition(easing) ||
351
- (Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
352
- }
353
310
  const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
311
+
354
312
  const supportedWaapiEasing = {
355
313
  linear: "linear",
356
314
  ease: "ease",
@@ -362,6 +320,7 @@ const supportedWaapiEasing = {
362
320
  backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
363
321
  backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
364
322
  };
323
+
365
324
  function mapEasingToNativeEasing(easing, duration) {
366
325
  if (!easing) {
367
326
  return undefined;
@@ -381,6 +340,85 @@ function mapEasingToNativeEasing(easing, duration) {
381
340
  }
382
341
  }
383
342
 
343
+ function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}, pseudoElement = undefined) {
344
+ const keyframeOptions = {
345
+ [valueName]: keyframes,
346
+ };
347
+ if (times)
348
+ keyframeOptions.offset = times;
349
+ const easing = mapEasingToNativeEasing(ease, duration);
350
+ /**
351
+ * If this is an easing array, apply to keyframes, not animation as a whole
352
+ */
353
+ if (Array.isArray(easing))
354
+ keyframeOptions.easing = easing;
355
+ const animation = element.animate(keyframeOptions, {
356
+ delay,
357
+ duration,
358
+ easing: !Array.isArray(easing) ? easing : "linear",
359
+ fill: "both",
360
+ iterations: repeat + 1,
361
+ direction: repeatType === "reverse" ? "alternate" : "normal",
362
+ pseudoElement,
363
+ });
364
+ return animation;
365
+ }
366
+
367
+ function isGenerator(type) {
368
+ return typeof type === "function" && "applyToOptions" in type;
369
+ }
370
+
371
+ function getValueTransition(transition, key) {
372
+ return (transition?.[key] ??
373
+ transition?.["default"] ??
374
+ transition);
375
+ }
376
+
377
+ /**
378
+ * Implement a practical max duration for keyframe generation
379
+ * to prevent infinite loops
380
+ */
381
+ const maxGeneratorDuration = 20000;
382
+ function calcGeneratorDuration(generator) {
383
+ let duration = 0;
384
+ const timeStep = 50;
385
+ let state = generator.next(duration);
386
+ while (!state.done && duration < maxGeneratorDuration) {
387
+ duration += timeStep;
388
+ state = generator.next(duration);
389
+ }
390
+ return duration >= maxGeneratorDuration ? Infinity : duration;
391
+ }
392
+
393
+ /**
394
+ * Create a progress => progress easing function from a generator.
395
+ */
396
+ function createGeneratorEasing(options, scale = 100, createGenerator) {
397
+ const generator = createGenerator({ ...options, keyframes: [0, scale] });
398
+ const duration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
399
+ return {
400
+ type: "keyframes",
401
+ ease: (progress) => {
402
+ return generator.next(duration * progress).value / scale;
403
+ },
404
+ duration: millisecondsToSeconds(duration),
405
+ };
406
+ }
407
+
408
+ function isWaapiSupportedEasing(easing) {
409
+ return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
410
+ !easing ||
411
+ (typeof easing === "string" &&
412
+ (easing in supportedWaapiEasing || supportsLinearEasing())) ||
413
+ isBezierDefinition(easing) ||
414
+ (Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
415
+ }
416
+
417
+ function attachTimeline(animation, timeline) {
418
+ animation.timeline = timeline;
419
+ animation.onfinish = null;
420
+ }
421
+
384
422
  const stepsOrder = [
385
423
  "read", // Read
386
424
  "resolveKeyframes", // Write/Read/Write/Read
@@ -390,11 +428,6 @@ const stepsOrder = [
390
428
  "postRender", // Compute
391
429
  ];
392
430
 
393
- const statsBuffer = {
394
- value: null,
395
- addProjectionMetrics: null,
396
- };
397
-
398
431
  function createRenderStep(runNextFrame, stepName) {
399
432
  /**
400
433
  * We create and reuse two queues, one to queue jobs for the current frame
@@ -612,21 +645,16 @@ function setDragLock(axis) {
612
645
  }
613
646
 
614
647
  function resolveElements(elementOrSelector, scope, selectorCache) {
615
- var _a;
616
648
  if (elementOrSelector instanceof EventTarget) {
617
649
  return [elementOrSelector];
618
650
  }
619
651
  else if (typeof elementOrSelector === "string") {
620
652
  let root = document;
621
653
  if (scope) {
622
- // TODO: Refactor to utils package
623
- // invariant(
624
- // Boolean(scope.current),
625
- // "Scope provided, but no element detected."
626
- // )
627
654
  root = scope.current;
628
655
  }
629
- const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
656
+ const elements = selectorCache?.[elementOrSelector] ??
657
+ root.querySelectorAll(elementOrSelector);
630
658
  return elements ? Array.from(elements) : [];
631
659
  }
632
660
  return Array.from(elementOrSelector);
@@ -825,7 +853,7 @@ function press(targetOrSelector, onPressStart, options = {}) {
825
853
  if (target instanceof HTMLElement) {
826
854
  target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions));
827
855
  if (!isElementKeyboardAccessible(target) &&
828
- target.tabIndex === null) {
856
+ !target.hasAttribute("tabindex")) {
829
857
  target.tabIndex = 0;
830
858
  }
831
859
  }
@@ -858,7 +886,7 @@ class MotionValue {
858
886
  * This will be replaced by the build step with the latest version number.
859
887
  * When MotionValues are provided to motion components, warn if versions are mixed.
860
888
  */
861
- this.version = "12.6.1";
889
+ this.version = "12.6.3";
862
890
  /**
863
891
  * Tracks whether this value can output a velocity. Currently this is only true
864
892
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -1486,11 +1514,10 @@ const color = {
1486
1514
  const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
1487
1515
 
1488
1516
  function test(v) {
1489
- var _a, _b;
1490
1517
  return (isNaN(v) &&
1491
1518
  typeof v === "string" &&
1492
- (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) +
1493
- (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
1519
+ (v.match(floatRegex)?.length || 0) +
1520
+ (v.match(colorRegex)?.length || 0) >
1494
1521
  0);
1495
1522
  }
1496
1523
  const NUMBER_TOKEN = "number";
@@ -1878,8 +1905,7 @@ function measureAllKeyframes() {
1878
1905
  const restore = transformsToRestore.get(element);
1879
1906
  if (restore) {
1880
1907
  restore.forEach(([key, value]) => {
1881
- var _a;
1882
- (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
1908
+ element.getValue(key)?.set(value);
1883
1909
  });
1884
1910
  }
1885
1911
  });
@@ -1966,7 +1992,7 @@ class KeyframeResolver {
1966
1992
  * If the first keyframe is null, we need to find its value by sampling the element
1967
1993
  */
1968
1994
  if (i === 0) {
1969
- const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
1995
+ const currentValue = motionValue?.get();
1970
1996
  const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
1971
1997
  if (currentValue !== undefined) {
1972
1998
  unresolvedKeyframes[0] = currentValue;
@@ -2047,7 +2073,7 @@ function parseCSSVariable(current) {
2047
2073
  if (!match)
2048
2074
  return [,];
2049
2075
  const [, token1, token2, fallback] = match;
2050
- return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback];
2076
+ return [`--${token1 ?? token2}`, fallback];
2051
2077
  }
2052
2078
  const maxDepth = 4;
2053
2079
  function getVariableValue(current, element, depth = 1) {
@@ -2186,7 +2212,6 @@ class DOMKeyframesResolver extends KeyframeResolver {
2186
2212
  }
2187
2213
  }
2188
2214
  measureEndState() {
2189
- var _a;
2190
2215
  const { element, name, unresolvedKeyframes } = this;
2191
2216
  if (!element || !element.current)
2192
2217
  return;
@@ -2199,7 +2224,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
2199
2224
  this.finalKeyframe = finalKeyframe;
2200
2225
  }
2201
2226
  // If we removed transform values, reapply them before the next render
2202
- if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
2227
+ if (this.removedTransforms?.length) {
2203
2228
  this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
2204
2229
  element
2205
2230
  .getValue(unsetTransformName)
@@ -2580,13 +2605,12 @@ function mixObject(a, b) {
2580
2605
  };
2581
2606
  }
2582
2607
  function matchOrder(origin, target) {
2583
- var _a;
2584
2608
  const orderedOrigin = [];
2585
2609
  const pointers = { color: 0, var: 0, number: 0 };
2586
2610
  for (let i = 0; i < target.values.length; i++) {
2587
2611
  const type = target.types[i];
2588
2612
  const originIndex = origin.indexes[type][pointers[type]];
2589
- const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
2613
+ const originValue = origin.values[originIndex] ?? 0;
2590
2614
  orderedOrigin[i] = originValue;
2591
2615
  pointers[type]++;
2592
2616
  }
@@ -2890,9 +2914,17 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
2890
2914
  const easing = generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);
2891
2915
  return calculatedDuration + "ms " + easing;
2892
2916
  },
2917
+ toTransition: () => { },
2893
2918
  };
2894
2919
  return generator;
2895
2920
  }
2921
+ spring.applyToOptions = (options) => {
2922
+ const generatorOptions = createGeneratorEasing(options, 100, spring);
2923
+ options.ease = supportsLinearEasing() ? generatorOptions.ease : "easeOut";
2924
+ options.duration = secondsToMilliseconds(generatorOptions.duration);
2925
+ options.type = "keyframes";
2926
+ return options;
2927
+ };
2896
2928
 
2897
2929
  function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
2898
2930
  const origin = keyframes[0];
@@ -3214,7 +3246,7 @@ class MainThreadAnimation extends BaseAnimation {
3214
3246
  onStop && onStop();
3215
3247
  };
3216
3248
  const { name, motionValue, element, keyframes } = this.options;
3217
- const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
3249
+ const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;
3218
3250
  const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
3219
3251
  this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
3220
3252
  this.resolver.scheduleResolve();
@@ -3463,7 +3495,7 @@ class MainThreadAnimation extends BaseAnimation {
3463
3495
  this.startTime = now - this.holdTime;
3464
3496
  }
3465
3497
  else if (!this.startTime) {
3466
- this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
3498
+ this.startTime = startTime ?? this.calcStartTime();
3467
3499
  }
3468
3500
  else if (this.state === "finished") {
3469
3501
  this.startTime = now;
@@ -3481,13 +3513,12 @@ class MainThreadAnimation extends BaseAnimation {
3481
3513
  this.driver.start();
3482
3514
  }
3483
3515
  pause() {
3484
- var _a;
3485
3516
  if (!this._resolved) {
3486
3517
  this.pendingPlayState = "paused";
3487
3518
  return;
3488
3519
  }
3489
3520
  this.state = "paused";
3490
- this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
3521
+ this.holdTime = this.currentTime ?? 0;
3491
3522
  }
3492
3523
  complete() {
3493
3524
  if (this.state !== "running") {
@@ -3527,6 +3558,9 @@ class MainThreadAnimation extends BaseAnimation {
3527
3558
  this.startTime = 0;
3528
3559
  return this.tick(time, true);
3529
3560
  }
3561
+ get finished() {
3562
+ return this.currentFinishedPromise;
3563
+ }
3530
3564
  }
3531
3565
 
3532
3566
  /**
@@ -3542,27 +3576,6 @@ const acceleratedValues = new Set([
3542
3576
  // "background-color"
3543
3577
  ]);
3544
3578
 
3545
- function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
3546
- const keyframeOptions = { [valueName]: keyframes };
3547
- if (times)
3548
- keyframeOptions.offset = times;
3549
- const easing = mapEasingToNativeEasing(ease, duration);
3550
- /**
3551
- * If this is an easing array, apply to keyframes, not animation as a whole
3552
- */
3553
- if (Array.isArray(easing))
3554
- keyframeOptions.easing = easing;
3555
- const animation = element.animate(keyframeOptions, {
3556
- delay,
3557
- duration,
3558
- easing: !Array.isArray(easing) ? easing : "linear",
3559
- fill: "both",
3560
- iterations: repeat + 1,
3561
- direction: repeatType === "reverse" ? "alternate" : "normal",
3562
- });
3563
- return animation;
3564
- }
3565
-
3566
3579
  const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
3567
3580
 
3568
3581
  /**
@@ -3673,7 +3686,7 @@ class AcceleratedAnimation extends BaseAnimation {
3673
3686
  const animation = startWaapiAnimation(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
3674
3687
  // Override the browser calculated startTime with one synchronised to other JS
3675
3688
  // and WAAPI animations starting this event loop.
3676
- animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
3689
+ animation.startTime = startTime ?? this.calcStartTime();
3677
3690
  if (this.pendingTimeline) {
3678
3691
  attachTimeline(animation, this.pendingTimeline);
3679
3692
  this.pendingTimeline = undefined;
@@ -3732,6 +3745,9 @@ class AcceleratedAnimation extends BaseAnimation {
3732
3745
  const { animation } = resolved;
3733
3746
  return animation.playbackRate;
3734
3747
  }
3748
+ get finished() {
3749
+ return this.resolved.animation.finished;
3750
+ }
3735
3751
  set speed(newSpeed) {
3736
3752
  const { resolved } = this;
3737
3753
  if (!resolved)
@@ -3997,7 +4013,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
3997
4013
  });
3998
4014
  // We still want to return some animation controls here rather
3999
4015
  // than returning undefined
4000
- return new GroupPlaybackControls([]);
4016
+ return new GroupAnimationWithThen([]);
4001
4017
  }
4002
4018
  }
4003
4019
  /**
@@ -4025,7 +4041,6 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
4025
4041
  return shouldBlock;
4026
4042
  }
4027
4043
  function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
4028
- var _a;
4029
4044
  let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
4030
4045
  if (transitionOverride)
4031
4046
  transition = transitionOverride;
@@ -4034,7 +4049,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
4034
4049
  visualElement.animationState &&
4035
4050
  visualElement.animationState.getState()[type];
4036
4051
  for (const key in target) {
4037
- const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
4052
+ const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
4038
4053
  const valueTarget = target[key];
4039
4054
  if (valueTarget === undefined ||
4040
4055
  (animationTypeState &&
@@ -4080,9 +4095,8 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
4080
4095
  }
4081
4096
 
4082
4097
  function animateVariant(visualElement, variant, options = {}) {
4083
- var _a;
4084
4098
  const resolved = resolveVariant(visualElement, variant, options.type === "exit"
4085
- ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
4099
+ ? visualElement.presenceContext?.custom
4086
4100
  : undefined);
4087
4101
  let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
4088
4102
  if (options.transitionOverride) {
@@ -4231,9 +4245,8 @@ function createAnimationState(visualElement) {
4231
4245
  * each active animation type into an object of resolved values for it.
4232
4246
  */
4233
4247
  const buildResolvedTypeValues = (type) => (acc, definition) => {
4234
- var _a;
4235
4248
  const resolved = resolveVariant(visualElement, definition, type === "exit"
4236
- ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
4249
+ ? visualElement.presenceContext?.custom
4237
4250
  : undefined);
4238
4251
  if (resolved) {
4239
4252
  const { transition, transitionEnd, ...target } = resolved;
@@ -4481,7 +4494,7 @@ function createAnimationState(visualElement) {
4481
4494
  if (motionValue)
4482
4495
  motionValue.liveStyle = true;
4483
4496
  // @ts-expect-error - @mattgperry to figure if we should do something here
4484
- fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
4497
+ fallbackAnimation[key] = fallbackTarget ?? null;
4485
4498
  });
4486
4499
  animations.push({ animation: fallbackAnimation });
4487
4500
  }
@@ -4498,12 +4511,11 @@ function createAnimationState(visualElement) {
4498
4511
  * Change whether a certain animation type is active.
4499
4512
  */
4500
4513
  function setActive(type, isActive) {
4501
- var _a;
4502
4514
  // If the active state hasn't changed, we can safely do nothing here
4503
4515
  if (state[type].isActive === isActive)
4504
4516
  return Promise.resolve();
4505
4517
  // Propagate active change to children
4506
- (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
4518
+ visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
4507
4519
  state[type].isActive = isActive;
4508
4520
  const animations = animateChanges(type);
4509
4521
  for (const key in state) {
@@ -4589,9 +4601,8 @@ class AnimationFeature extends Feature {
4589
4601
  }
4590
4602
  }
4591
4603
  unmount() {
4592
- var _a;
4593
4604
  this.node.animationState.reset();
4594
- (_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
4605
+ this.unmountControls?.();
4595
4606
  }
4596
4607
  }
4597
4608
 
@@ -5318,11 +5329,8 @@ class VisualElementDragControls {
5318
5329
  onDrag && onDrag(event, info);
5319
5330
  };
5320
5331
  const onSessionEnd = (event, info) => this.stop(event, info);
5321
- const resumeAnimation = () => eachAxis((axis) => {
5322
- var _a;
5323
- return this.getAnimationState(axis) === "paused" &&
5324
- ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
5325
- });
5332
+ const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" &&
5333
+ this.getAxisMotionValue(axis).animation?.play());
5326
5334
  const { dragSnapToOrigin } = this.getProps();
5327
5335
  this.panSession = new PanSession(originEvent, {
5328
5336
  onSessionStart,
@@ -5377,12 +5385,11 @@ class VisualElementDragControls {
5377
5385
  axisValue.set(next);
5378
5386
  }
5379
5387
  resolveConstraints() {
5380
- var _a;
5381
5388
  const { dragConstraints, dragElastic } = this.getProps();
5382
5389
  const layout = this.visualElement.projection &&
5383
5390
  !this.visualElement.projection.layout
5384
5391
  ? this.visualElement.projection.measure(false)
5385
- : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
5392
+ : this.visualElement.projection?.layout;
5386
5393
  const prevConstraints = this.constraints;
5387
5394
  if (dragConstraints && isRefObject(dragConstraints)) {
5388
5395
  if (!this.constraints) {
@@ -5485,11 +5492,10 @@ class VisualElementDragControls {
5485
5492
  eachAxis((axis) => this.getAxisMotionValue(axis).stop());
5486
5493
  }
5487
5494
  pauseAnimation() {
5488
- eachAxis((axis) => { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause(); });
5495
+ eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause());
5489
5496
  }
5490
5497
  getAnimationState(axis) {
5491
- var _a;
5492
- return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
5498
+ return this.getAxisMotionValue(axis).animation?.state;
5493
5499
  }
5494
5500
  /**
5495
5501
  * Drag works differently depending on which props are provided.
@@ -6371,7 +6377,7 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
6371
6377
  */
6372
6378
  const xTranslate = delta.x.translate / treeScale.x;
6373
6379
  const yTranslate = delta.y.translate / treeScale.y;
6374
- const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
6380
+ const zTranslate = latestTransform?.z || 0;
6375
6381
  if (xTranslate || yTranslate || zTranslate) {
6376
6382
  transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
6377
6383
  }
@@ -6447,7 +6453,7 @@ function cancelTreeOptimisedTransformAnimations(projectionNode) {
6447
6453
  }
6448
6454
  function createProjectionNode$1({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
6449
6455
  return class ProjectionNode {
6450
- constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
6456
+ constructor(latestValues = {}, parent = defaultParent?.()) {
6451
6457
  /**
6452
6458
  * A unique ID generated for every projection node.
6453
6459
  */
@@ -6965,12 +6971,11 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
6965
6971
  };
6966
6972
  }
6967
6973
  measurePageBox() {
6968
- var _a;
6969
6974
  const { visualElement } = this.options;
6970
6975
  if (!visualElement)
6971
6976
  return createBox();
6972
6977
  const box = visualElement.measureViewportBox();
6973
- const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
6978
+ const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot);
6974
6979
  if (!wasInScrollRoot) {
6975
6980
  // Remove viewport scroll to give page-relative coordinates
6976
6981
  const { scroll } = this.root;
@@ -6982,10 +6987,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
6982
6987
  return box;
6983
6988
  }
6984
6989
  removeElementScroll(box) {
6985
- var _a;
6986
6990
  const boxWithoutScroll = createBox();
6987
6991
  copyBoxInto(boxWithoutScroll, box);
6988
- if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
6992
+ if (this.scroll?.wasRoot) {
6989
6993
  return boxWithoutScroll;
6990
6994
  }
6991
6995
  /**
@@ -7088,7 +7092,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7088
7092
  }
7089
7093
  }
7090
7094
  resolveTargetDelta(forceRecalculation = false) {
7091
- var _a;
7092
7095
  /**
7093
7096
  * Once the dirty status of nodes has been spread through the tree, we also
7094
7097
  * need to check if we have a shared node of a different depth that has itself
@@ -7106,7 +7109,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7106
7109
  const canSkip = !(forceRecalculation ||
7107
7110
  (isShared && this.isSharedProjectionDirty) ||
7108
7111
  this.isProjectionDirty ||
7109
- ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
7112
+ this.parent?.isProjectionDirty ||
7110
7113
  this.attemptToResolveRelativeTarget ||
7111
7114
  this.root.updateBlockedByResize);
7112
7115
  if (canSkip)
@@ -7225,7 +7228,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7225
7228
  this.layout);
7226
7229
  }
7227
7230
  calcProjection() {
7228
- var _a;
7229
7231
  const lead = this.getLead();
7230
7232
  const isShared = Boolean(this.resumingFrom) || this !== lead;
7231
7233
  let canSkip = true;
@@ -7233,7 +7235,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7233
7235
  * If this is a normal layout animation and neither this node nor its nearest projecting
7234
7236
  * is dirty then we can't skip.
7235
7237
  */
7236
- if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
7238
+ if (this.isProjectionDirty || this.parent?.isProjectionDirty) {
7237
7239
  canSkip = false;
7238
7240
  }
7239
7241
  /**
@@ -7339,8 +7341,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7339
7341
  // TODO: Schedule render
7340
7342
  }
7341
7343
  scheduleRender(notifyAll = true) {
7342
- var _a;
7343
- (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
7344
+ this.options.visualElement?.scheduleRender();
7344
7345
  if (notifyAll) {
7345
7346
  const stack = this.getStack();
7346
7347
  stack && stack.scheduleRender();
@@ -7524,14 +7525,12 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7524
7525
  return stack ? stack.lead === this : true;
7525
7526
  }
7526
7527
  getLead() {
7527
- var _a;
7528
7528
  const { layoutId } = this.options;
7529
- return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
7529
+ return layoutId ? this.getStack()?.lead || this : this;
7530
7530
  }
7531
7531
  getPrevLead() {
7532
- var _a;
7533
7532
  const { layoutId } = this.options;
7534
- return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
7533
+ return layoutId ? this.getStack()?.prevLead : undefined;
7535
7534
  }
7536
7535
  getStack() {
7537
7536
  const { layoutId } = this.options;
@@ -7605,7 +7604,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7605
7604
  visualElement.scheduleRender();
7606
7605
  }
7607
7606
  getProjectionStyles(styleProp) {
7608
- var _a, _b;
7609
7607
  if (!this.instance || this.isSVG)
7610
7608
  return undefined;
7611
7609
  if (!this.isVisible) {
@@ -7619,7 +7617,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7619
7617
  this.needsReset = false;
7620
7618
  styles.opacity = "";
7621
7619
  styles.pointerEvents =
7622
- resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
7620
+ resolveMotionValue(styleProp?.pointerEvents) || "";
7623
7621
  styles.transform = transformTemplate
7624
7622
  ? transformTemplate(this.latestValues, "")
7625
7623
  : "none";
@@ -7634,7 +7632,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7634
7632
  ? this.latestValues.opacity
7635
7633
  : 1;
7636
7634
  emptyStyles.pointerEvents =
7637
- resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
7635
+ resolveMotionValue(styleProp?.pointerEvents) || "";
7638
7636
  }
7639
7637
  if (this.hasProjected && !hasTransform(this.latestValues)) {
7640
7638
  emptyStyles.transform = transformTemplate
@@ -7659,7 +7657,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7659
7657
  */
7660
7658
  styles.opacity =
7661
7659
  lead === this
7662
- ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1
7660
+ ? valuesToRender.opacity ??
7661
+ this.latestValues.opacity ??
7662
+ 1
7663
7663
  : this.preserveOpacity
7664
7664
  ? this.latestValues.opacity
7665
7665
  : valuesToRender.opacityExit;
@@ -7720,7 +7720,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7720
7720
  if (this.options.layoutId) {
7721
7721
  styles.pointerEvents =
7722
7722
  lead === this
7723
- ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""
7723
+ ? resolveMotionValue(styleProp?.pointerEvents) || ""
7724
7724
  : "none";
7725
7725
  }
7726
7726
  return styles;
@@ -7730,7 +7730,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
7730
7730
  }
7731
7731
  // Only run on root
7732
7732
  resetTree() {
7733
- this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
7733
+ this.root.nodes.forEach((node) => node.currentAnimation?.stop());
7734
7734
  this.root.nodes.forEach(clearMeasurements);
7735
7735
  this.root.sharedNodes.clear();
7736
7736
  }
@@ -7740,8 +7740,7 @@ function updateLayout(node) {
7740
7740
  node.updateLayout();
7741
7741
  }
7742
7742
  function notifyLayoutUpdate(node) {
7743
- var _a;
7744
- const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
7743
+ const snapshot = node.resumeFrom?.snapshot || node.snapshot;
7745
7744
  if (node.isLead() &&
7746
7745
  node.layout &&
7747
7746
  snapshot &&
@@ -7941,8 +7940,7 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout) {
7941
7940
  !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
7942
7941
  }
7943
7942
  function checkNodeWasScrollRoot(node) {
7944
- var _a;
7945
- return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
7943
+ return node !== node.root && node.scroll?.wasRoot;
7946
7944
  }
7947
7945
 
7948
7946
  const DocumentProjectionNode = createProjectionNode$1({
@@ -8332,7 +8330,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
8332
8330
  const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
8333
8331
 
8334
8332
  function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
8335
- var _a, _b;
8336
8333
  const { visualElement: parent } = react.useContext(MotionContext);
8337
8334
  const lazyContext = react.useContext(LazyContext);
8338
8335
  const presenceContext = react.useContext(PresenceContext);
@@ -8382,8 +8379,8 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
8382
8379
  */
8383
8380
  const optimisedAppearId = props[optimizedAppearDataAttribute];
8384
8381
  const wantsHandoff = react.useRef(Boolean(optimisedAppearId) &&
8385
- !((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) &&
8386
- ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
8382
+ !window.MotionHandoffIsComplete?.(optimisedAppearId) &&
8383
+ window.MotionHasOptimisedAnimation?.(optimisedAppearId));
8387
8384
  useIsomorphicLayoutEffect(() => {
8388
8385
  if (!visualElement)
8389
8386
  return;
@@ -8414,8 +8411,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
8414
8411
  if (wantsHandoff.current) {
8415
8412
  // This ensures all future calls to animateChanges() in this component will run in useEffect
8416
8413
  queueMicrotask(() => {
8417
- var _a;
8418
- (_a = window.MotionHandoffMarkAsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId);
8414
+ window.MotionHandoffMarkAsComplete?.(optimisedAppearId);
8419
8415
  });
8420
8416
  wantsHandoff.current = false;
8421
8417
  }
@@ -8463,7 +8459,6 @@ function getClosestProjectingNode(visualElement) {
8463
8459
  * component "offline", or outside the React render cycle.
8464
8460
  */
8465
8461
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
8466
- var _a, _b;
8467
8462
  preloadedFeatures && loadFeatures(preloadedFeatures);
8468
8463
  function MotionComponent(props, externalRef) {
8469
8464
  /**
@@ -8499,7 +8494,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
8499
8494
  }
8500
8495
  MotionComponent.displayName = `motion.${typeof Component === "string"
8501
8496
  ? Component
8502
- : `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
8497
+ : `create(${Component.displayName ?? Component.name ?? ""})`}`;
8503
8498
  const ForwardRefMotionComponent = react.forwardRef(MotionComponent);
8504
8499
  ForwardRefMotionComponent[motionComponentSymbol] = Component;
8505
8500
  return ForwardRefMotionComponent;
@@ -8531,7 +8526,7 @@ function getProjectionFunctionality(props) {
8531
8526
  return {};
8532
8527
  const combined = { ...drag, ...layout };
8533
8528
  return {
8534
- MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
8529
+ MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props)
8535
8530
  ? combined.MeasureLayout
8536
8531
  : undefined,
8537
8532
  ProjectionNode: combined.ProjectionNode,
@@ -8810,7 +8805,7 @@ try {
8810
8805
  */
8811
8806
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
8812
8807
  }
8813
- catch (_a) {
8808
+ catch {
8814
8809
  // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
8815
8810
  }
8816
8811
  function filterProps(props, isDom, forwardMotionProps) {
@@ -9131,7 +9126,6 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
9131
9126
  }
9132
9127
 
9133
9128
  function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
9134
- var _a;
9135
9129
  const { style } = props;
9136
9130
  const newValues = {};
9137
9131
  for (const key in style) {
@@ -9139,7 +9133,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
9139
9133
  (prevProps.style &&
9140
9134
  isMotionValue(prevProps.style[key])) ||
9141
9135
  isForcedMotionValue(key, props) ||
9142
- ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
9136
+ visualElement?.getValue(key)?.liveStyle !== undefined) {
9143
9137
  newValues[key] = style[key];
9144
9138
  }
9145
9139
  }
@@ -9336,7 +9330,7 @@ function updateMotionValuesFromProps(element, next, prev) {
9336
9330
  * and warn against mismatches.
9337
9331
  */
9338
9332
  if (process.env.NODE_ENV === "development") {
9339
- warnOnce(nextValue.version === "12.6.2", `Attempting to mix Motion versions ${nextValue.version} with 12.6.2 may not work as expected.`);
9333
+ warnOnce(nextValue.version === "12.6.3", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3 may not work as expected.`);
9340
9334
  }
9341
9335
  }
9342
9336
  else if (isMotionValue(prevValue)) {
@@ -9760,10 +9754,10 @@ class VisualElement {
9760
9754
  * directly from the instance (which might have performance implications).
9761
9755
  */
9762
9756
  readValue(key, target) {
9763
- var _a;
9764
9757
  let value = this.latestValues[key] !== undefined || !this.current
9765
9758
  ? this.latestValues[key]
9766
- : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
9759
+ : this.getBaseTargetFromProps(this.props, key) ??
9760
+ this.readValueFromInstance(this.current, key, this.options);
9767
9761
  if (value !== undefined && value !== null) {
9768
9762
  if (typeof value === "string" &&
9769
9763
  (isNumericalString(value) || isZeroValueString(value))) {
@@ -9789,11 +9783,10 @@ class VisualElement {
9789
9783
  * props.
9790
9784
  */
9791
9785
  getBaseTarget(key) {
9792
- var _a;
9793
9786
  const { initial } = this.props;
9794
9787
  let valueFromInitial;
9795
9788
  if (typeof initial === "string" || typeof initial === "object") {
9796
- const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
9789
+ const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
9797
9790
  if (variant) {
9798
9791
  valueFromInitial = variant[key];
9799
9792
  }