@nswds/app 1.113.0 → 1.114.0

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.
package/dist/index.js CHANGED
@@ -18781,7 +18781,7 @@ function FormatToggle({ format, setFormat }) {
18781
18781
 
18782
18782
  // package.json
18783
18783
  var package_default = {
18784
- version: "1.112.2"};
18784
+ version: "1.113.1"};
18785
18785
  var SluggerContext = React5__default.createContext(null);
18786
18786
  function flattenText(nodes) {
18787
18787
  if (nodes == null || typeof nodes === "boolean") return "";
@@ -21109,7 +21109,7 @@ var backIn = /* @__PURE__ */ reverseEasing(backOut);
21109
21109
  var backInOut = /* @__PURE__ */ mirrorEasing(backIn);
21110
21110
 
21111
21111
  // node_modules/motion-utils/dist/es/easing/anticipate.mjs
21112
- var anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
21112
+ var anticipate = (p) => p >= 1 ? 1 : (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
21113
21113
 
21114
21114
  // node_modules/motion-utils/dist/es/easing/circ.mjs
21115
21115
  var circIn = (p) => 1 - Math.sin(Math.acos(p));
@@ -21206,8 +21206,7 @@ function createRenderStep(runNextFrame, stepName) {
21206
21206
  const queue = addToCurrentFrame ? thisFrame : nextFrame;
21207
21207
  if (keepAlive)
21208
21208
  toKeepAlive.add(callback);
21209
- if (!queue.has(callback))
21210
- queue.add(callback);
21209
+ queue.add(callback);
21211
21210
  return callback;
21212
21211
  },
21213
21212
  /**
@@ -21227,7 +21226,9 @@ function createRenderStep(runNextFrame, stepName) {
21227
21226
  return;
21228
21227
  }
21229
21228
  isProcessing = true;
21230
- [thisFrame, nextFrame] = [nextFrame, thisFrame];
21229
+ const prevFrame = thisFrame;
21230
+ thisFrame = nextFrame;
21231
+ nextFrame = prevFrame;
21231
21232
  thisFrame.forEach(triggerCallback);
21232
21233
  thisFrame.clear();
21233
21234
  isProcessing = false;
@@ -21257,9 +21258,10 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
21257
21258
  }, {});
21258
21259
  const { setup, read, resolveKeyframes, preUpdate, update, preRender, render, postRender } = steps;
21259
21260
  const processBatch = () => {
21260
- const timestamp = MotionGlobalConfig.useManualTiming ? state.timestamp : performance.now();
21261
+ const useManualTiming = MotionGlobalConfig.useManualTiming;
21262
+ const timestamp = useManualTiming ? state.timestamp : performance.now();
21261
21263
  runNextFrame = false;
21262
- if (!MotionGlobalConfig.useManualTiming) {
21264
+ if (!useManualTiming) {
21263
21265
  state.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
21264
21266
  }
21265
21267
  state.timestamp = timestamp;
@@ -21525,8 +21527,7 @@ function analyseComplexValue(value) {
21525
21527
  function parseComplexValue(v) {
21526
21528
  return analyseComplexValue(v).values;
21527
21529
  }
21528
- function createTransformer(source) {
21529
- const { split, types } = analyseComplexValue(source);
21530
+ function buildTransformer({ split, types }) {
21530
21531
  const numSections = split.length;
21531
21532
  return (v) => {
21532
21533
  let output = "";
@@ -21546,11 +21547,20 @@ function createTransformer(source) {
21546
21547
  return output;
21547
21548
  };
21548
21549
  }
21550
+ function createTransformer(source) {
21551
+ return buildTransformer(analyseComplexValue(source));
21552
+ }
21549
21553
  var convertNumbersToZero = (v) => typeof v === "number" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v;
21554
+ var convertToZero = (value, splitBefore) => {
21555
+ if (typeof value === "number") {
21556
+ return splitBefore?.trim().endsWith("/") ? value : 0;
21557
+ }
21558
+ return convertNumbersToZero(value);
21559
+ };
21550
21560
  function getAnimatableNone(v) {
21551
- const parsed = parseComplexValue(v);
21552
- const transformer = createTransformer(v);
21553
- return transformer(parsed.map(convertNumbersToZero));
21561
+ const info = analyseComplexValue(v);
21562
+ const transformer = buildTransformer(info);
21563
+ return transformer(info.values.map((value, i) => convertToZero(value, info.split[i])));
21554
21564
  }
21555
21565
  var complex = {
21556
21566
  test,
@@ -21781,14 +21791,7 @@ function createGeneratorEasing(options, scale2 = 100, createGenerator) {
21781
21791
  };
21782
21792
  }
21783
21793
 
21784
- // node_modules/motion-dom/dist/es/animation/generators/utils/velocity.mjs
21785
- var velocitySampleDuration = 5;
21786
- function calcGeneratorVelocity(resolveValue, t, current) {
21787
- const prevT = Math.max(t - velocitySampleDuration, 0);
21788
- return velocityPerSecond(current - resolveValue(prevT), t - prevT);
21789
- }
21790
-
21791
- // node_modules/motion-dom/dist/es/animation/generators/spring/defaults.mjs
21794
+ // node_modules/motion-dom/dist/es/animation/generators/spring.mjs
21792
21795
  var springDefaults = {
21793
21796
  // Default spring physics
21794
21797
  stiffness: 100,
@@ -21818,8 +21821,17 @@ var springDefaults = {
21818
21821
  minDamping: 0.05,
21819
21822
  maxDamping: 1
21820
21823
  };
21821
-
21822
- // node_modules/motion-dom/dist/es/animation/generators/spring/find.mjs
21824
+ function calcAngularFreq(undampedFreq, dampingRatio) {
21825
+ return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
21826
+ }
21827
+ var rootIterations = 12;
21828
+ function approximateRoot(envelope, derivative, initialGuess) {
21829
+ let result = initialGuess;
21830
+ for (let i = 1; i < rootIterations; i++) {
21831
+ result = result - envelope(result) / derivative(result);
21832
+ }
21833
+ return result;
21834
+ }
21823
21835
  var safeMin = 1e-3;
21824
21836
  function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
21825
21837
  let envelope;
@@ -21877,19 +21889,6 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
21877
21889
  };
21878
21890
  }
21879
21891
  }
21880
- var rootIterations = 12;
21881
- function approximateRoot(envelope, derivative, initialGuess) {
21882
- let result = initialGuess;
21883
- for (let i = 1; i < rootIterations; i++) {
21884
- result = result - envelope(result) / derivative(result);
21885
- }
21886
- return result;
21887
- }
21888
- function calcAngularFreq(undampedFreq, dampingRatio) {
21889
- return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
21890
- }
21891
-
21892
- // node_modules/motion-dom/dist/es/animation/generators/spring/index.mjs
21893
21892
  var durationKeys = ["duration", "bounce"];
21894
21893
  var physicsKeys = ["stiffness", "damping", "mass"];
21895
21894
  function isSpringType(options, keys) {
@@ -21905,6 +21904,7 @@ function getSpringOptions(options) {
21905
21904
  ...options
21906
21905
  };
21907
21906
  if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
21907
+ springOptions.velocity = 0;
21908
21908
  if (options.visualDuration) {
21909
21909
  const visualDuration = options.visualDuration;
21910
21910
  const root = 2 * Math.PI / (visualDuration * 1.2);
@@ -21917,7 +21917,7 @@ function getSpringOptions(options) {
21917
21917
  damping
21918
21918
  };
21919
21919
  } else {
21920
- const derived = findSpring(options);
21920
+ const derived = findSpring({ ...options, velocity: 0 });
21921
21921
  springOptions = {
21922
21922
  ...springOptions,
21923
21923
  ...derived,
@@ -21950,14 +21950,28 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
21950
21950
  restSpeed || (restSpeed = isGranularScale ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default);
21951
21951
  restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
21952
21952
  let resolveSpring;
21953
+ let resolveVelocity;
21954
+ let angularFreq;
21955
+ let A;
21956
+ let sinCoeff;
21957
+ let cosCoeff;
21953
21958
  if (dampingRatio < 1) {
21954
- const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
21959
+ angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
21960
+ A = (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq;
21955
21961
  resolveSpring = (t) => {
21956
21962
  const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
21957
- return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
21963
+ return target - envelope * (A * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
21964
+ };
21965
+ sinCoeff = dampingRatio * undampedAngularFreq * A + initialDelta * angularFreq;
21966
+ cosCoeff = dampingRatio * undampedAngularFreq * initialDelta - A * angularFreq;
21967
+ resolveVelocity = (t) => {
21968
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
21969
+ return envelope * (sinCoeff * Math.sin(angularFreq * t) + cosCoeff * Math.cos(angularFreq * t));
21958
21970
  };
21959
21971
  } else if (dampingRatio === 1) {
21960
21972
  resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
21973
+ const C = initialVelocity + undampedAngularFreq * initialDelta;
21974
+ resolveVelocity = (t) => Math.exp(-undampedAngularFreq * t) * (undampedAngularFreq * C * t - initialVelocity);
21961
21975
  } else {
21962
21976
  const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
21963
21977
  resolveSpring = (t) => {
@@ -21965,19 +21979,33 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
21965
21979
  const freqForT = Math.min(dampedAngularFreq * t, 300);
21966
21980
  return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
21967
21981
  };
21982
+ const P = (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / dampedAngularFreq;
21983
+ const sinhCoeff = dampingRatio * undampedAngularFreq * P - initialDelta * dampedAngularFreq;
21984
+ const coshCoeff = dampingRatio * undampedAngularFreq * initialDelta - P * dampedAngularFreq;
21985
+ resolveVelocity = (t) => {
21986
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
21987
+ const freqForT = Math.min(dampedAngularFreq * t, 300);
21988
+ return envelope * (sinhCoeff * Math.sinh(freqForT) + coshCoeff * Math.cosh(freqForT));
21989
+ };
21968
21990
  }
21969
21991
  const generator = {
21970
21992
  calculatedDuration: isResolvedFromDuration ? duration || null : null,
21993
+ velocity: (t) => secondsToMilliseconds(resolveVelocity(t)),
21971
21994
  next: (t) => {
21995
+ if (!isResolvedFromDuration && dampingRatio < 1) {
21996
+ const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
21997
+ const sin = Math.sin(angularFreq * t);
21998
+ const cos = Math.cos(angularFreq * t);
21999
+ const current2 = target - envelope * (A * sin + initialDelta * cos);
22000
+ const currentVelocity = secondsToMilliseconds(envelope * (sinCoeff * sin + cosCoeff * cos));
22001
+ state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current2) <= restDelta;
22002
+ state.value = state.done ? target : current2;
22003
+ return state;
22004
+ }
21972
22005
  const current = resolveSpring(t);
21973
22006
  if (!isResolvedFromDuration) {
21974
- let currentVelocity = t === 0 ? initialVelocity : 0;
21975
- if (dampingRatio < 1) {
21976
- currentVelocity = t === 0 ? secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t, current);
21977
- }
21978
- const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
21979
- const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
21980
- state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
22007
+ const currentVelocity = secondsToMilliseconds(resolveVelocity(t));
22008
+ state.done = Math.abs(currentVelocity) <= restSpeed && Math.abs(target - current) <= restDelta;
21981
22009
  } else {
21982
22010
  state.done = t >= duration;
21983
22011
  }
@@ -22002,6 +22030,13 @@ spring.applyToOptions = (options) => {
22002
22030
  return options;
22003
22031
  };
22004
22032
 
22033
+ // node_modules/motion-dom/dist/es/animation/generators/utils/velocity.mjs
22034
+ var velocitySampleDuration = 5;
22035
+ function getGeneratorVelocity(resolveValue, t, current) {
22036
+ const prevT = Math.max(t - velocitySampleDuration, 0);
22037
+ return velocityPerSecond(current - resolveValue(prevT), t - prevT);
22038
+ }
22039
+
22005
22040
  // node_modules/motion-dom/dist/es/animation/generators/inertia.mjs
22006
22041
  function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed }) {
22007
22042
  const origin = keyframes2[0];
@@ -22038,7 +22073,7 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
22038
22073
  timeReachedBoundary = t;
22039
22074
  spring$1 = spring({
22040
22075
  keyframes: [state.value, nearestBoundary(state.value)],
22041
- velocity: calcGeneratorVelocity(calcLatest, t, state.value),
22076
+ velocity: getGeneratorVelocity(calcLatest, t, state.value),
22042
22077
  // TODO: This should be passing * 1000
22043
22078
  damping: bounceDamping,
22044
22079
  stiffness: bounceStiffness,
@@ -22221,6 +22256,10 @@ var JSAnimation = class extends WithPromise {
22221
22256
  this.currentTime = 0;
22222
22257
  this.holdTime = null;
22223
22258
  this.playbackSpeed = 1;
22259
+ this.delayState = {
22260
+ done: false,
22261
+ value: void 0
22262
+ };
22224
22263
  this.stop = () => {
22225
22264
  const { motionValue: motionValue2 } = this.options;
22226
22265
  if (motionValue2 && motionValue2.updatedAt !== time.now()) {
@@ -22321,8 +22360,14 @@ var JSAnimation = class extends WithPromise {
22321
22360
  }
22322
22361
  elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
22323
22362
  }
22324
- const state = isInDelayPhase ? { done: false, value: keyframes2[0] } : frameGenerator.next(elapsed);
22325
- if (mixKeyframes) {
22363
+ let state;
22364
+ if (isInDelayPhase) {
22365
+ this.delayState.value = keyframes2[0];
22366
+ state = this.delayState;
22367
+ } else {
22368
+ state = frameGenerator.next(elapsed);
22369
+ }
22370
+ if (mixKeyframes && !isInDelayPhase) {
22326
22371
  state.value = mixKeyframes(state.value);
22327
22372
  }
22328
22373
  let { done } = state;
@@ -22367,16 +22412,40 @@ var JSAnimation = class extends WithPromise {
22367
22412
  } else if (this.driver) {
22368
22413
  this.startTime = this.driver.now() - newTime / this.playbackSpeed;
22369
22414
  }
22370
- this.driver?.start(false);
22415
+ if (this.driver) {
22416
+ this.driver.start(false);
22417
+ } else {
22418
+ this.startTime = 0;
22419
+ this.state = "paused";
22420
+ this.holdTime = newTime;
22421
+ this.tick(newTime);
22422
+ }
22423
+ }
22424
+ /**
22425
+ * Returns the generator's velocity at the current time in units/second.
22426
+ * Uses the analytical derivative when available (springs), avoiding
22427
+ * the MotionValue's frame-dependent velocity estimation.
22428
+ */
22429
+ getGeneratorVelocity() {
22430
+ const t = this.currentTime;
22431
+ if (t <= 0)
22432
+ return this.options.velocity || 0;
22433
+ if (this.generator.velocity) {
22434
+ return this.generator.velocity(t);
22435
+ }
22436
+ const current = this.generator.next(t).value;
22437
+ return getGeneratorVelocity((s) => this.generator.next(s).value, t, current);
22371
22438
  }
22372
22439
  get speed() {
22373
22440
  return this.playbackSpeed;
22374
22441
  }
22375
22442
  set speed(newSpeed) {
22376
- this.updateTime(time.now());
22377
22443
  const hasChanged = this.playbackSpeed !== newSpeed;
22444
+ if (hasChanged && this.driver) {
22445
+ this.updateTime(time.now());
22446
+ }
22378
22447
  this.playbackSpeed = newSpeed;
22379
- if (hasChanged) {
22448
+ if (hasChanged && this.driver) {
22380
22449
  this.time = millisecondsToSeconds(this.currentTime);
22381
22450
  }
22382
22451
  }
@@ -22581,8 +22650,14 @@ function removeNonTranslationalTransform(visualElement) {
22581
22650
  }
22582
22651
  var positionalValues = {
22583
22652
  // Dimensions
22584
- width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
22585
- height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
22653
+ width: ({ x }, { paddingLeft = "0", paddingRight = "0", boxSizing }) => {
22654
+ const width = x.max - x.min;
22655
+ return boxSizing === "border-box" ? width : width - parseFloat(paddingLeft) - parseFloat(paddingRight);
22656
+ },
22657
+ height: ({ y }, { paddingTop = "0", paddingBottom = "0", boxSizing }) => {
22658
+ const height = y.max - y.min;
22659
+ return boxSizing === "border-box" ? height : height - parseFloat(paddingTop) - parseFloat(paddingBottom);
22660
+ },
22586
22661
  top: (_bbox, { top }) => parseFloat(top),
22587
22662
  left: (_bbox, { left }) => parseFloat(left),
22588
22663
  bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
@@ -22728,9 +22803,6 @@ function setStyle(element, name, value) {
22728
22803
  isCSSVar(name) ? element.style.setProperty(name, value) : element.style[name] = value;
22729
22804
  }
22730
22805
 
22731
- // node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.mjs
22732
- var supportsScrollTimeline = /* @__PURE__ */ memo(() => window.ScrollTimeline !== void 0);
22733
-
22734
22806
  // node_modules/motion-dom/dist/es/utils/supports/flags.mjs
22735
22807
  var supportsFlags = {};
22736
22808
 
@@ -22740,6 +22812,9 @@ function memoSupports(callback, supportsFlag) {
22740
22812
  return () => supportsFlags[supportsFlag] ?? memoized();
22741
22813
  }
22742
22814
 
22815
+ // node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.mjs
22816
+ var supportsScrollTimeline = /* @__PURE__ */ memoSupports(() => window.ScrollTimeline !== void 0, "scrollTimeline");
22817
+
22743
22818
  // node_modules/motion-dom/dist/es/utils/supports/linear-easing.mjs
22744
22819
  var supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
22745
22820
  try {
@@ -22846,9 +22921,8 @@ var NativeAnimation = class extends WithPromise {
22846
22921
  const keyframe = getFinalKeyframe(keyframes2, this.options, finalKeyframe, this.speed);
22847
22922
  if (this.updateMotionValue) {
22848
22923
  this.updateMotionValue(keyframe);
22849
- } else {
22850
- setStyle(element, name, keyframe);
22851
22924
  }
22925
+ setStyle(element, name, keyframe);
22852
22926
  this.animation.cancel();
22853
22927
  }
22854
22928
  onComplete?.();
@@ -22922,9 +22996,13 @@ var NativeAnimation = class extends WithPromise {
22922
22996
  return millisecondsToSeconds(Number(this.animation.currentTime) || 0);
22923
22997
  }
22924
22998
  set time(newTime) {
22999
+ const wasFinished = this.finishedTime !== null;
22925
23000
  this.manualStartTime = null;
22926
23001
  this.finishedTime = null;
22927
23002
  this.animation.currentTime = secondsToMilliseconds(newTime);
23003
+ if (wasFinished) {
23004
+ this.animation.pause();
23005
+ }
22928
23006
  }
22929
23007
  /**
22930
23008
  * The playback speed of the animation.
@@ -22950,13 +23028,17 @@ var NativeAnimation = class extends WithPromise {
22950
23028
  /**
22951
23029
  * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
22952
23030
  */
22953
- attachTimeline({ timeline, observe }) {
23031
+ attachTimeline({ timeline, rangeStart, rangeEnd, observe }) {
22954
23032
  if (this.allowFlatten) {
22955
23033
  this.animation.effect?.updateTiming({ easing: "linear" });
22956
23034
  }
22957
23035
  this.animation.onfinish = null;
22958
23036
  if (timeline && supportsScrollTimeline()) {
22959
23037
  this.animation.timeline = timeline;
23038
+ if (rangeStart)
23039
+ this.animation.rangeStart = rangeStart;
23040
+ if (rangeEnd)
23041
+ this.animation.rangeEnd = rangeEnd;
22960
23042
  return noop;
22961
23043
  } else {
22962
23044
  return observe(this);
@@ -22986,7 +23068,7 @@ var NativeAnimationExtended = class extends NativeAnimation {
22986
23068
  replaceStringEasing(options);
22987
23069
  replaceTransitionType(options);
22988
23070
  super(options);
22989
- if (options.startTime !== void 0) {
23071
+ if (options.startTime !== void 0 && options.autoplay !== false) {
22990
23072
  this.startTime = options.startTime;
22991
23073
  }
22992
23074
  this.options = options;
@@ -23013,7 +23095,11 @@ var NativeAnimationExtended = class extends NativeAnimation {
23013
23095
  });
23014
23096
  const sampleTime = Math.max(sampleDelta, time.now() - this.startTime);
23015
23097
  const delta = clamp(0, sampleDelta, sampleTime - sampleDelta);
23016
- motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, sampleAnimation.sample(sampleTime).value, delta);
23098
+ const current = sampleAnimation.sample(sampleTime).value;
23099
+ const { name } = this.options;
23100
+ if (element && name)
23101
+ setStyle(element, name, current);
23102
+ motionValue2.setWithVelocity(sampleAnimation.sample(Math.max(0, sampleTime - delta)).value, current, delta);
23017
23103
  sampleAnimation.stop();
23018
23104
  }
23019
23105
  };
@@ -23065,24 +23151,54 @@ function makeAnimationInstant(options) {
23065
23151
  options.type = "keyframes";
23066
23152
  }
23067
23153
 
23068
- // node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs
23154
+ // node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs
23069
23155
  var acceleratedValues = /* @__PURE__ */ new Set([
23070
23156
  "opacity",
23071
23157
  "clipPath",
23072
23158
  "filter",
23073
23159
  "transform"
23074
- // TODO: Could be re-enabled now we have support for linear() easing
23160
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
23161
+ // or until we implement support for linear() easing.
23075
23162
  // "background-color"
23076
23163
  ]);
23164
+
23165
+ // node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.mjs
23166
+ var browserColorFunctions = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
23167
+ function hasBrowserOnlyColors(keyframes2) {
23168
+ for (let i = 0; i < keyframes2.length; i++) {
23169
+ if (typeof keyframes2[i] === "string" && browserColorFunctions.test(keyframes2[i])) {
23170
+ return true;
23171
+ }
23172
+ }
23173
+ return false;
23174
+ }
23175
+
23176
+ // node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.mjs
23177
+ var colorProperties = /* @__PURE__ */ new Set([
23178
+ "color",
23179
+ "backgroundColor",
23180
+ "outlineColor",
23181
+ "fill",
23182
+ "stroke",
23183
+ "borderColor",
23184
+ "borderTopColor",
23185
+ "borderRightColor",
23186
+ "borderBottomColor",
23187
+ "borderLeftColor"
23188
+ ]);
23077
23189
  var supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
23078
23190
  function supportsBrowserAnimation(options) {
23079
- const { motionValue: motionValue2, name, repeatDelay, repeatType, damping, type } = options;
23191
+ const { motionValue: motionValue2, name, repeatDelay, repeatType, damping, type, keyframes: keyframes2 } = options;
23080
23192
  const subject = motionValue2?.owner?.current;
23081
23193
  if (!(subject instanceof HTMLElement)) {
23082
23194
  return false;
23083
23195
  }
23084
23196
  const { onUpdate, transformTemplate } = motionValue2.owner.getProps();
23085
- return supportsWaapi() && name && acceleratedValues.has(name) && (name !== "transform" || !transformTemplate) && /**
23197
+ return supportsWaapi() && name && /**
23198
+ * Force WAAPI for color properties with browser-only color formats
23199
+ * (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.
23200
+ */
23201
+ (acceleratedValues.has(name) || colorProperties.has(name) && hasBrowserOnlyColors(keyframes2)) && (name !== "transform" || !transformTemplate) && /**
23086
23202
  * If we're outputting values to onUpdate then we can't use WAAPI as there's
23087
23203
  * no way to read the value from WAAPI every frame.
23088
23204
  */
@@ -23122,7 +23238,9 @@ var AsyncMotionValueAnimation = class extends WithPromise {
23122
23238
  this.keyframeResolver = void 0;
23123
23239
  const { name, type, velocity, delay: delay2, isHandoff, onUpdate } = options;
23124
23240
  this.resolvedAt = time.now();
23241
+ let canAnimateValue = true;
23125
23242
  if (!canAnimate(keyframes2, name, type, velocity)) {
23243
+ canAnimateValue = false;
23126
23244
  if (MotionGlobalConfig.instantAnimations || !delay2) {
23127
23245
  onUpdate?.(getFinalKeyframe(keyframes2, options, finalKeyframe));
23128
23246
  }
@@ -23137,12 +23255,21 @@ var AsyncMotionValueAnimation = class extends WithPromise {
23137
23255
  ...options,
23138
23256
  keyframes: keyframes2
23139
23257
  };
23140
- const useWaapi = !isHandoff && supportsBrowserAnimation(resolvedOptions);
23258
+ const useWaapi = canAnimateValue && !isHandoff && supportsBrowserAnimation(resolvedOptions);
23141
23259
  const element = resolvedOptions.motionValue?.owner?.current;
23142
- const animation = useWaapi ? new NativeAnimationExtended({
23143
- ...resolvedOptions,
23144
- element
23145
- }) : new JSAnimation(resolvedOptions);
23260
+ let animation;
23261
+ if (useWaapi) {
23262
+ try {
23263
+ animation = new NativeAnimationExtended({
23264
+ ...resolvedOptions,
23265
+ element
23266
+ });
23267
+ } catch {
23268
+ animation = new JSAnimation(resolvedOptions);
23269
+ }
23270
+ } else {
23271
+ animation = new JSAnimation(resolvedOptions);
23272
+ }
23146
23273
  animation.finished.then(() => {
23147
23274
  this.notifyFinished();
23148
23275
  }).catch(noop);
@@ -23285,22 +23412,43 @@ var getDefaultTransition = (valueKey, { keyframes: keyframes2 }) => {
23285
23412
  return ease;
23286
23413
  };
23287
23414
 
23288
- // node_modules/motion-dom/dist/es/animation/utils/get-final-keyframe.mjs
23289
- var isNotNull2 = (value) => value !== null;
23290
- function getFinalKeyframe2(keyframes2, { repeat, repeatType = "loop" }, finalKeyframe) {
23291
- const resolvedKeyframes = keyframes2.filter(isNotNull2);
23292
- const index = repeat && repeatType !== "loop" && repeat % 2 === 1 ? 0 : resolvedKeyframes.length - 1;
23293
- return !index || finalKeyframe === void 0 ? resolvedKeyframes[index] : finalKeyframe;
23415
+ // node_modules/motion-dom/dist/es/animation/utils/resolve-transition.mjs
23416
+ function resolveTransition(transition, parentTransition) {
23417
+ if (transition?.inherit && parentTransition) {
23418
+ const { inherit: _, ...rest } = transition;
23419
+ return { ...parentTransition, ...rest };
23420
+ }
23421
+ return transition;
23294
23422
  }
23295
23423
 
23296
23424
  // node_modules/motion-dom/dist/es/animation/utils/get-value-transition.mjs
23297
23425
  function getValueTransition(transition, key) {
23298
- return transition?.[key] ?? transition?.["default"] ?? transition;
23426
+ const valueTransition = transition?.[key] ?? transition?.["default"] ?? transition;
23427
+ if (valueTransition !== transition) {
23428
+ return resolveTransition(valueTransition, transition);
23429
+ }
23430
+ return valueTransition;
23299
23431
  }
23300
23432
 
23301
23433
  // node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.mjs
23302
- function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
23303
- return !!Object.keys(transition).length;
23434
+ var orchestrationKeys = /* @__PURE__ */ new Set([
23435
+ "when",
23436
+ "delay",
23437
+ "delayChildren",
23438
+ "staggerChildren",
23439
+ "staggerDirection",
23440
+ "repeat",
23441
+ "repeatType",
23442
+ "repeatDelay",
23443
+ "from",
23444
+ "elapsed"
23445
+ ]);
23446
+ function isTransitionDefined(transition) {
23447
+ for (const key in transition) {
23448
+ if (!orchestrationKeys.has(key))
23449
+ return true;
23450
+ }
23451
+ return false;
23304
23452
  }
23305
23453
 
23306
23454
  // node_modules/motion-dom/dist/es/animation/interfaces/motion-value.mjs
@@ -23349,7 +23497,7 @@ var animateMotionValue = (name, value, target, transition = {}, element, isHando
23349
23497
  }
23350
23498
  options.allowFlatten = !valueTransition.type && !valueTransition.ease;
23351
23499
  if (shouldSkip && !isHandoff && value.get() !== void 0) {
23352
- const finalKeyframe = getFinalKeyframe2(options.keyframes, valueTransition);
23500
+ const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
23353
23501
  if (finalKeyframe !== void 0) {
23354
23502
  frame.update(() => {
23355
23503
  options.onUpdate(finalKeyframe);
@@ -23748,7 +23896,9 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
23748
23896
  return shouldBlock;
23749
23897
  }
23750
23898
  function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type } = {}) {
23751
- let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
23899
+ let { transition, transitionEnd, ...target } = targetAndTransition;
23900
+ const defaultTransition = visualElement.getDefaultTransition();
23901
+ transition = transition ? resolveTransition(transition, defaultTransition) : defaultTransition;
23752
23902
  const reduceMotion = transition?.reduceMotion;
23753
23903
  if (transitionOverride)
23754
23904
  transition = transitionOverride;
@@ -23765,7 +23915,8 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
23765
23915
  ...getValueTransition(transition || {}, key)
23766
23916
  };
23767
23917
  const currentValue = value.get();
23768
- if (currentValue !== void 0 && !value.isAnimating && !Array.isArray(valueTarget) && valueTarget === currentValue && !valueTransition.velocity) {
23918
+ if (currentValue !== void 0 && !value.isAnimating() && !Array.isArray(valueTarget) && valueTarget === currentValue && !valueTransition.velocity) {
23919
+ frame.update(() => value.set(valueTarget));
23769
23920
  continue;
23770
23921
  }
23771
23922
  let isHandoff = false;
@@ -23788,11 +23939,14 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
23788
23939
  }
23789
23940
  }
23790
23941
  if (transitionEnd) {
23791
- Promise.all(animations2).then(() => {
23792
- frame.update(() => {
23793
- transitionEnd && setTarget(visualElement, transitionEnd);
23794
- });
23942
+ const applyTransitionEnd = () => frame.update(() => {
23943
+ transitionEnd && setTarget(visualElement, transitionEnd);
23795
23944
  });
23945
+ if (animations2.length) {
23946
+ Promise.all(animations2).then(applyTransitionEnd);
23947
+ } else {
23948
+ applyTransitionEnd();
23949
+ }
23796
23950
  }
23797
23951
  return animations2;
23798
23952
  }
@@ -23895,6 +24049,16 @@ var filter = {
23895
24049
  }
23896
24050
  };
23897
24051
 
24052
+ // node_modules/motion-dom/dist/es/value/types/complex/mask.mjs
24053
+ var mask = {
24054
+ ...complex,
24055
+ getAnimatableNone: (v) => {
24056
+ const parsed = complex.parse(v);
24057
+ const transformer = complex.createTransformer(v);
24058
+ return transformer(parsed.map((v2) => typeof v2 === "number" ? 0 : typeof v2 === "object" ? { ...v2, alpha: 1 } : v2));
24059
+ }
24060
+ };
24061
+
23898
24062
  // node_modules/motion-dom/dist/es/value/types/int.mjs
23899
24063
  var int = {
23900
24064
  ...number,
@@ -24010,14 +24174,17 @@ var defaultValueTypes = {
24010
24174
  borderBottomColor: color,
24011
24175
  borderLeftColor: color,
24012
24176
  filter,
24013
- WebkitFilter: filter
24177
+ WebkitFilter: filter,
24178
+ mask,
24179
+ WebkitMask: mask
24014
24180
  };
24015
24181
  var getDefaultValueType = (key) => defaultValueTypes[key];
24016
24182
 
24017
24183
  // node_modules/motion-dom/dist/es/value/types/utils/animatable-none.mjs
24184
+ var customTypes = /* @__PURE__ */ new Set([filter, mask]);
24018
24185
  function getAnimatableNone2(key, value) {
24019
24186
  let defaultValueType = getDefaultValueType(key);
24020
- if (defaultValueType !== filter)
24187
+ if (!customTypes.has(defaultValueType))
24021
24188
  defaultValueType = complex;
24022
24189
  return defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value) : void 0;
24023
24190
  }
@@ -24161,7 +24328,7 @@ var getValueAsType = (value, type) => {
24161
24328
 
24162
24329
  // node_modules/motion-dom/dist/es/utils/is-html-element.mjs
24163
24330
  function isHTMLElement(element) {
24164
- return isObject(element) && "offsetHeight" in element;
24331
+ return isObject(element) && "offsetHeight" in element && !("ownerSVGElement" in element);
24165
24332
  }
24166
24333
 
24167
24334
  // node_modules/motion-dom/dist/es/frameloop/microtask.mjs
@@ -24218,23 +24385,55 @@ function isValidHover(event) {
24218
24385
  }
24219
24386
  function hover(elementOrSelector, onHoverStart, options = {}) {
24220
24387
  const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options);
24221
- const onPointerEnter = (enterEvent) => {
24222
- if (!isValidHover(enterEvent))
24223
- return;
24224
- const { target } = enterEvent;
24225
- const onHoverEnd = onHoverStart(target, enterEvent);
24226
- if (typeof onHoverEnd !== "function" || !target)
24227
- return;
24388
+ elements.forEach((element) => {
24389
+ let isPressed = false;
24390
+ let deferredHoverEnd = false;
24391
+ let hoverEndCallback;
24392
+ const removePointerLeave = () => {
24393
+ element.removeEventListener("pointerleave", onPointerLeave);
24394
+ };
24395
+ const endHover = (event) => {
24396
+ if (hoverEndCallback) {
24397
+ hoverEndCallback(event);
24398
+ hoverEndCallback = void 0;
24399
+ }
24400
+ removePointerLeave();
24401
+ };
24402
+ const onPointerUp = (event) => {
24403
+ isPressed = false;
24404
+ window.removeEventListener("pointerup", onPointerUp);
24405
+ window.removeEventListener("pointercancel", onPointerUp);
24406
+ if (deferredHoverEnd) {
24407
+ deferredHoverEnd = false;
24408
+ endHover(event);
24409
+ }
24410
+ };
24411
+ const onPointerDown = () => {
24412
+ isPressed = true;
24413
+ window.addEventListener("pointerup", onPointerUp, eventOptions);
24414
+ window.addEventListener("pointercancel", onPointerUp, eventOptions);
24415
+ };
24228
24416
  const onPointerLeave = (leaveEvent) => {
24229
- if (!isValidHover(leaveEvent))
24417
+ if (leaveEvent.pointerType === "touch")
24230
24418
  return;
24231
- onHoverEnd(leaveEvent);
24232
- target.removeEventListener("pointerleave", onPointerLeave);
24419
+ if (isPressed) {
24420
+ deferredHoverEnd = true;
24421
+ return;
24422
+ }
24423
+ endHover(leaveEvent);
24424
+ };
24425
+ const onPointerEnter = (enterEvent) => {
24426
+ if (!isValidHover(enterEvent))
24427
+ return;
24428
+ deferredHoverEnd = false;
24429
+ const onHoverEnd = onHoverStart(element, enterEvent);
24430
+ if (typeof onHoverEnd !== "function")
24431
+ return;
24432
+ hoverEndCallback = onHoverEnd;
24433
+ element.addEventListener("pointerleave", onPointerLeave, eventOptions);
24233
24434
  };
24234
- target.addEventListener("pointerleave", onPointerLeave, eventOptions);
24235
- };
24236
- elements.forEach((element) => {
24237
24435
  element.addEventListener("pointerenter", onPointerEnter, eventOptions);
24436
+ element.addEventListener("pointerdown", onPointerDown, eventOptions);
24238
24437
  });
24239
24438
  return cancel;
24240
24439
  }
@@ -24312,13 +24511,19 @@ var enableKeyboardPress = (focusEvent, eventOptions) => {
24312
24511
  function isValidPressEvent(event) {
24313
24512
  return isPrimaryPointer(event) && !isDragActive();
24314
24513
  }
24514
+ var claimedPointerDownEvents = /* @__PURE__ */ new WeakSet();
24315
24515
  function press(targetOrSelector, onPressStart, options = {}) {
24316
24516
  const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options);
24317
24517
  const startPress = (startEvent) => {
24318
24518
  const target = startEvent.currentTarget;
24319
24519
  if (!isValidPressEvent(startEvent))
24320
24520
  return;
24521
+ if (claimedPointerDownEvents.has(startEvent))
24522
+ return;
24321
24523
  isPressing.add(target);
24524
+ if (options.stopPropagation) {
24525
+ claimedPointerDownEvents.add(startEvent);
24526
+ }
24322
24527
  const onPressEnd = onPressStart(target, startEvent);
24323
24528
  const onPointerEnd = (endEvent, success) => {
24324
24529
  window.removeEventListener("pointerup", onPointerUp);
@@ -24360,6 +24565,99 @@ function isSVGElement(element) {
24360
24565
  return isObject(element) && "ownerSVGElement" in element;
24361
24566
  }
24362
24567
 
24568
+ // node_modules/motion-dom/dist/es/resize/handle-element.mjs
24569
+ var resizeHandlers = /* @__PURE__ */ new WeakMap();
24570
+ var observer;
24571
+ var getSize = (borderBoxAxis, svgAxis, htmlAxis) => (target, borderBoxSize) => {
24572
+ if (borderBoxSize && borderBoxSize[0]) {
24573
+ return borderBoxSize[0][borderBoxAxis + "Size"];
24574
+ } else if (isSVGElement(target) && "getBBox" in target) {
24575
+ return target.getBBox()[svgAxis];
24576
+ } else {
24577
+ return target[htmlAxis];
24578
+ }
24579
+ };
24580
+ var getWidth = /* @__PURE__ */ getSize("inline", "width", "offsetWidth");
24581
+ var getHeight = /* @__PURE__ */ getSize("block", "height", "offsetHeight");
24582
+ function notifyTarget({ target, borderBoxSize }) {
24583
+ resizeHandlers.get(target)?.forEach((handler) => {
24584
+ handler(target, {
24585
+ get width() {
24586
+ return getWidth(target, borderBoxSize);
24587
+ },
24588
+ get height() {
24589
+ return getHeight(target, borderBoxSize);
24590
+ }
24591
+ });
24592
+ });
24593
+ }
24594
+ function notifyAll(entries) {
24595
+ entries.forEach(notifyTarget);
24596
+ }
24597
+ function createResizeObserver() {
24598
+ if (typeof ResizeObserver === "undefined")
24599
+ return;
24600
+ observer = new ResizeObserver(notifyAll);
24601
+ }
24602
+ function resizeElement(target, handler) {
24603
+ if (!observer)
24604
+ createResizeObserver();
24605
+ const elements = resolveElements(target);
24606
+ elements.forEach((element) => {
24607
+ let elementHandlers = resizeHandlers.get(element);
24608
+ if (!elementHandlers) {
24609
+ elementHandlers = /* @__PURE__ */ new Set();
24610
+ resizeHandlers.set(element, elementHandlers);
24611
+ }
24612
+ elementHandlers.add(handler);
24613
+ observer?.observe(element);
24614
+ });
24615
+ return () => {
24616
+ elements.forEach((element) => {
24617
+ const elementHandlers = resizeHandlers.get(element);
24618
+ elementHandlers?.delete(handler);
24619
+ if (!elementHandlers?.size) {
24620
+ observer?.unobserve(element);
24621
+ }
24622
+ });
24623
+ };
24624
+ }
24625
+
24626
+ // node_modules/motion-dom/dist/es/resize/handle-window.mjs
24627
+ var windowCallbacks = /* @__PURE__ */ new Set();
24628
+ var windowResizeHandler;
24629
+ function createWindowResizeHandler() {
24630
+ windowResizeHandler = () => {
24631
+ const info = {
24632
+ get width() {
24633
+ return window.innerWidth;
24634
+ },
24635
+ get height() {
24636
+ return window.innerHeight;
24637
+ }
24638
+ };
24639
+ windowCallbacks.forEach((callback) => callback(info));
24640
+ };
24641
+ window.addEventListener("resize", windowResizeHandler);
24642
+ }
24643
+ function resizeWindow(callback) {
24644
+ windowCallbacks.add(callback);
24645
+ if (!windowResizeHandler)
24646
+ createWindowResizeHandler();
24647
+ return () => {
24648
+ windowCallbacks.delete(callback);
24649
+ if (!windowCallbacks.size && typeof windowResizeHandler === "function") {
24650
+ window.removeEventListener("resize", windowResizeHandler);
24651
+ windowResizeHandler = void 0;
24652
+ }
24653
+ };
24654
+ }
24655
+
24656
+ // node_modules/motion-dom/dist/es/resize/index.mjs
24657
+ function resize(a, b) {
24658
+ return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
24659
+ }
24660
+
24363
24661
  // node_modules/motion-dom/dist/es/utils/is-svg-svg-element.mjs
24364
24662
  function isSVGSVGElement(element) {
24365
24663
  return isSVGElement(element) && element.tagName === "svg";
@@ -24386,26 +24684,6 @@ var createBox = () => ({
24386
24684
  y: createAxis()
24387
24685
  });
24388
24686
 
24389
- // node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.mjs
24390
- var prefersReducedMotion = { current: null };
24391
- var hasReducedMotionListener = { current: false };
24392
-
24393
- // node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.mjs
24394
- var isBrowser2 = typeof window !== "undefined";
24395
- function initPrefersReducedMotion() {
24396
- hasReducedMotionListener.current = true;
24397
- if (!isBrowser2)
24398
- return;
24399
- if (window.matchMedia) {
24400
- const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
24401
- const setReducedMotionPreferences = () => prefersReducedMotion.current = motionMediaQuery.matches;
24402
- motionMediaQuery.addEventListener("change", setReducedMotionPreferences);
24403
- setReducedMotionPreferences();
24404
- } else {
24405
- prefersReducedMotion.current = false;
24406
- }
24407
- }
24408
-
24409
24687
  // node_modules/motion-dom/dist/es/render/store.mjs
24410
24688
  var visualElementStore = /* @__PURE__ */ new WeakMap();
24411
24689
 
@@ -24469,6 +24747,26 @@ function updateMotionValuesFromProps(element, next, prev) {
24469
24747
  return next;
24470
24748
  }
24471
24749
 
24750
+ // node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.mjs
24751
+ var prefersReducedMotion = { current: null };
24752
+ var hasReducedMotionListener = { current: false };
24753
+
24754
+ // node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.mjs
24755
+ var isBrowser2 = typeof window !== "undefined";
24756
+ function initPrefersReducedMotion() {
24757
+ hasReducedMotionListener.current = true;
24758
+ if (!isBrowser2)
24759
+ return;
24760
+ if (window.matchMedia) {
24761
+ const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
24762
+ const setReducedMotionPreferences = () => prefersReducedMotion.current = motionMediaQuery.matches;
24763
+ motionMediaQuery.addEventListener("change", setReducedMotionPreferences);
24764
+ setReducedMotionPreferences();
24765
+ } else {
24766
+ prefersReducedMotion.current = false;
24767
+ }
24768
+ }
24769
+
24472
24770
  // node_modules/motion-dom/dist/es/render/VisualElement.mjs
24473
24771
  var propEventHandlers = [
24474
24772
  "AnimationStart",
@@ -24509,6 +24807,7 @@ var VisualElement = class {
24509
24807
  this.features = {};
24510
24808
  this.valueSubscriptions = /* @__PURE__ */ new Map();
24511
24809
  this.prevMotionValues = {};
24810
+ this.hasBeenMounted = false;
24512
24811
  this.events = {};
24513
24812
  this.propEventSubscriptions = {};
24514
24813
  this.notifyUpdate = () => this.notify("Update", this.latestValues);
@@ -24554,6 +24853,12 @@ var VisualElement = class {
24554
24853
  }
24555
24854
  }
24556
24855
  mount(instance) {
24856
+ if (this.hasBeenMounted) {
24857
+ for (const key in this.initialValues) {
24858
+ this.values.get(key)?.jump(this.initialValues[key]);
24859
+ this.latestValues[key] = this.initialValues[key];
24860
+ }
24861
+ }
24557
24862
  this.current = instance;
24558
24863
  visualElementStore.set(instance, this);
24559
24864
  if (this.projection && !this.projection.instance) {
@@ -24579,6 +24884,7 @@ var VisualElement = class {
24579
24884
  this.shouldSkipAnimations = this.skipAnimationsConfig ?? false;
24580
24885
  this.parent?.addChild(this);
24581
24886
  this.update(this.props, this.presenceContext);
24887
+ this.hasBeenMounted = true;
24582
24888
  }
24583
24889
  unmount() {
24584
24890
  this.projection && this.projection.unmount();
@@ -24613,6 +24919,23 @@ var VisualElement = class {
24613
24919
  if (this.valueSubscriptions.has(key)) {
24614
24920
  this.valueSubscriptions.get(key)();
24615
24921
  }
24922
+ if (value.accelerate && acceleratedValues.has(key) && this.current instanceof HTMLElement) {
24923
+ const { factory, keyframes: keyframes2, times, ease: ease2, duration } = value.accelerate;
24924
+ const animation = new NativeAnimation({
24925
+ element: this.current,
24926
+ name: key,
24927
+ keyframes: keyframes2,
24928
+ times,
24929
+ ease: ease2,
24930
+ duration: secondsToMilliseconds(duration)
24931
+ });
24932
+ const cleanup = factory(animation);
24933
+ this.valueSubscriptions.set(key, () => {
24934
+ cleanup();
24935
+ animation.cancel();
24936
+ });
24937
+ return;
24938
+ }
24616
24939
  const valueIsTransform = transformProps.has(key);
24617
24940
  if (valueIsTransform && this.onBindTransform) {
24618
24941
  this.onBindTransform();
@@ -24965,10 +25288,8 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
24965
25288
  continue;
24966
25289
  }
24967
25290
  if (isSharedTransition && node.options.layoutScroll && node.scroll && node !== node.root) {
24968
- transformBox(box, {
24969
- x: -node.scroll.offset.x,
24970
- y: -node.scroll.offset.y
24971
- });
25291
+ translateAxis(box.x, -node.scroll.offset.x);
25292
+ translateAxis(box.y, -node.scroll.offset.y);
24972
25293
  }
24973
25294
  if (delta) {
24974
25295
  treeScale.x *= delta.x.scale;
@@ -24976,7 +25297,7 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
24976
25297
  applyBoxDelta(box, delta);
24977
25298
  }
24978
25299
  if (isSharedTransition && hasTransform(node.latestValues)) {
24979
- transformBox(box, node.latestValues);
25300
+ transformBox(box, node.latestValues, node.layout?.layoutBox);
24980
25301
  }
24981
25302
  }
24982
25303
  if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) {
@@ -24987,16 +25308,23 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
24987
25308
  }
24988
25309
  }
24989
25310
  function translateAxis(axis, distance2) {
24990
- axis.min = axis.min + distance2;
24991
- axis.max = axis.max + distance2;
25311
+ axis.min += distance2;
25312
+ axis.max += distance2;
24992
25313
  }
24993
25314
  function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
24994
25315
  const originPoint = mixNumber(axis.min, axis.max, axisOrigin);
24995
25316
  applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
24996
25317
  }
24997
- function transformBox(box, transform) {
24998
- transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX);
24999
- transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY);
25318
+ function resolveAxisTranslate(value, axis) {
25319
+ if (typeof value === "string") {
25320
+ return parseFloat(value) / 100 * (axis.max - axis.min);
25321
+ }
25322
+ return value;
25323
+ }
25324
+ function transformBox(box, transform, sourceBox) {
25325
+ const resolveBox = sourceBox ?? box;
25326
+ transformAxis(box.x, resolveAxisTranslate(transform.x, resolveBox.x), transform.scaleX, transform.scale, transform.originX);
25327
+ transformAxis(box.y, resolveAxisTranslate(transform.y, resolveBox.y), transform.scaleY, transform.scale, transform.originY);
25000
25328
  }
25001
25329
 
25002
25330
  // node_modules/motion-dom/dist/es/projection/utils/measure.mjs
@@ -25424,6 +25752,7 @@ function createAnimationState(visualElement) {
25424
25752
  let animate = createAnimateFunction(visualElement);
25425
25753
  let state = createState();
25426
25754
  let isInitialRender = true;
25755
+ let wasReset = false;
25427
25756
  const buildResolvedTypeValues = (type) => (acc, definition) => {
25428
25757
  const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0);
25429
25758
  if (resolved) {
@@ -25451,7 +25780,7 @@ function createAnimationState(visualElement) {
25451
25780
  if (activeDelta === false)
25452
25781
  removedVariantIndex = i;
25453
25782
  let isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
25454
- if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
25783
+ if (isInherited && (isInitialRender || wasReset) && visualElement.manuallyAnimateOnMount) {
25455
25784
  isInherited = false;
25456
25785
  }
25457
25786
  typeState.protectedKeys = { ...encounteredKeys };
@@ -25463,6 +25792,15 @@ function createAnimationState(visualElement) {
25463
25792
  ) {
25464
25793
  continue;
25465
25794
  }
25795
+ if (type === "exit" && typeState.isActive && activeDelta !== true) {
25796
+ if (typeState.prevResolvedValues) {
25797
+ encounteredKeys = {
25798
+ ...encounteredKeys,
25799
+ ...typeState.prevResolvedValues
25800
+ };
25801
+ }
25802
+ continue;
25803
+ }
25466
25804
  const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
25467
25805
  let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active
25468
25806
  type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order)
@@ -25516,7 +25854,7 @@ function createAnimationState(visualElement) {
25516
25854
  if (typeState.isActive) {
25517
25855
  encounteredKeys = { ...encounteredKeys, ...resolvedValues };
25518
25856
  }
25519
- if (isInitialRender && visualElement.blockInitialAnimation) {
25857
+ if ((isInitialRender || wasReset) && visualElement.blockInitialAnimation) {
25520
25858
  shouldAnimateType = false;
25521
25859
  }
25522
25860
  const willAnimateViaParent = isInherited && variantDidChange;
@@ -25524,7 +25862,7 @@ function createAnimationState(visualElement) {
25524
25862
  if (shouldAnimateType && needsAnimating) {
25525
25863
  animations2.push(...definitionList.map((animation) => {
25526
25864
  const options = { type };
25527
- if (typeof animation === "string" && isInitialRender && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
25865
+ if (typeof animation === "string" && (isInitialRender || wasReset) && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) {
25528
25866
  const { parent } = visualElement;
25529
25867
  const parentVariant = resolveVariant(parent, animation);
25530
25868
  if (parent.enteringChildren && parentVariant) {
@@ -25561,6 +25899,7 @@ function createAnimationState(visualElement) {
25561
25899
  shouldAnimate = false;
25562
25900
  }
25563
25901
  isInitialRender = false;
25902
+ wasReset = false;
25564
25903
  return shouldAnimate ? animate(animations2) : Promise.resolve();
25565
25904
  }
25566
25905
  function setActive(type, isActive) {
@@ -25581,6 +25920,7 @@ function createAnimationState(visualElement) {
25581
25920
  getState: () => state,
25582
25921
  reset: () => {
25583
25922
  state = createState();
25923
+ wasReset = true;
25584
25924
  }
25585
25925
  };
25586
25926
  }
@@ -25657,21 +25997,23 @@ function calcBoxDelta(delta, source, target, origin) {
25657
25997
  calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : void 0);
25658
25998
  calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : void 0);
25659
25999
  }
25660
- function calcRelativeAxis(target, relative, parent) {
25661
- target.min = parent.min + relative.min;
26000
+ function calcRelativeAxis(target, relative, parent, anchor = 0) {
26001
+ const anchorPoint = anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min;
26002
+ target.min = anchorPoint + relative.min;
25662
26003
  target.max = target.min + calcLength(relative);
25663
26004
  }
25664
- function calcRelativeBox(target, relative, parent) {
25665
- calcRelativeAxis(target.x, relative.x, parent.x);
25666
- calcRelativeAxis(target.y, relative.y, parent.y);
26005
+ function calcRelativeBox(target, relative, parent, anchor) {
26006
+ calcRelativeAxis(target.x, relative.x, parent.x, anchor?.x);
26007
+ calcRelativeAxis(target.y, relative.y, parent.y, anchor?.y);
25667
26008
  }
25668
- function calcRelativeAxisPosition(target, layout2, parent) {
25669
- target.min = layout2.min - parent.min;
26009
+ function calcRelativeAxisPosition(target, layout2, parent, anchor = 0) {
26010
+ const anchorPoint = anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min;
26011
+ target.min = layout2.min - anchorPoint;
25670
26012
  target.max = target.min + calcLength(layout2);
25671
26013
  }
25672
- function calcRelativePosition(target, layout2, parent) {
25673
- calcRelativeAxisPosition(target.x, layout2.x, parent.x);
25674
- calcRelativeAxisPosition(target.y, layout2.y, parent.y);
26014
+ function calcRelativePosition(target, layout2, parent, anchor) {
26015
+ calcRelativeAxisPosition(target.x, layout2.x, parent.x, anchor?.x);
26016
+ calcRelativeAxisPosition(target.y, layout2.y, parent.y, anchor?.y);
25675
26017
  }
25676
26018
 
25677
26019
  // node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs
@@ -25774,8 +26116,13 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
25774
26116
  }
25775
26117
 
25776
26118
  // node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs
25777
- var borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
25778
- var numBorders = borders.length;
26119
+ var borderLabels = [
26120
+ "borderTopLeftRadius",
26121
+ "borderTopRightRadius",
26122
+ "borderBottomLeftRadius",
26123
+ "borderBottomRightRadius"
26124
+ ];
26125
+ var numBorders = borderLabels.length;
25779
26126
  var asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
25780
26127
  var isPx = (value) => typeof value === "number" || px.test(value);
25781
26128
  function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOnlyMember) {
@@ -25786,7 +26133,7 @@ function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOn
25786
26133
  target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress2);
25787
26134
  }
25788
26135
  for (let i = 0; i < numBorders; i++) {
25789
- const borderLabel = `border${borders[i]}Radius`;
26136
+ const borderLabel = borderLabels[i];
25790
26137
  let followRadius = getRadius(follow, borderLabel);
25791
26138
  let leadRadius = getRadius(lead, borderLabel);
25792
26139
  if (followRadius === void 0 && leadRadius === void 0)
@@ -25885,38 +26232,37 @@ var NodeStack = class {
25885
26232
  }
25886
26233
  add(node) {
25887
26234
  addUniqueItem(this.members, node);
26235
+ for (let i = this.members.length - 1; i >= 0; i--) {
26236
+ const member = this.members[i];
26237
+ if (member === node || member === this.lead || member === this.prevLead)
26238
+ continue;
26239
+ const inst = member.instance;
26240
+ if ((!inst || inst.isConnected === false) && !member.snapshot) {
26241
+ removeItem(this.members, member);
26242
+ member.unmount();
26243
+ }
26244
+ }
25888
26245
  node.scheduleRender();
25889
26246
  }
25890
26247
  remove(node) {
25891
26248
  removeItem(this.members, node);
25892
- if (node === this.prevLead) {
26249
+ if (node === this.prevLead)
25893
26250
  this.prevLead = void 0;
25894
- }
25895
26251
  if (node === this.lead) {
25896
26252
  const prevLead = this.members[this.members.length - 1];
25897
- if (prevLead) {
26253
+ if (prevLead)
25898
26254
  this.promote(prevLead);
25899
- }
25900
26255
  }
25901
26256
  }
25902
26257
  relegate(node) {
25903
- const indexOfNode = this.members.findIndex((member) => node === member);
25904
- if (indexOfNode === 0)
25905
- return false;
25906
- let prevLead;
25907
- for (let i = indexOfNode; i >= 0; i--) {
26258
+ for (let i = this.members.indexOf(node) - 1; i >= 0; i--) {
25908
26259
  const member = this.members[i];
25909
- if (member.isPresent !== false) {
25910
- prevLead = member;
25911
- break;
26260
+ if (member.isPresent !== false && member.instance?.isConnected !== false) {
26261
+ this.promote(member);
26262
+ return true;
25912
26263
  }
25913
26264
  }
25914
- if (prevLead) {
25915
- this.promote(prevLead);
25916
- return true;
25917
- } else {
25918
- return false;
25919
- }
26265
+ return false;
25920
26266
  }
25921
26267
  promote(node, preserveFollowOpacity) {
25922
26268
  const prevLead = this.lead;
@@ -25926,52 +26272,37 @@ var NodeStack = class {
25926
26272
  this.lead = node;
25927
26273
  node.show();
25928
26274
  if (prevLead) {
25929
- prevLead.instance && prevLead.scheduleRender();
26275
+ prevLead.updateSnapshot();
25930
26276
  node.scheduleRender();
25931
- const prevDep = prevLead.options.layoutDependency;
25932
- const nextDep = node.options.layoutDependency;
25933
- const dependencyMatches = prevDep !== void 0 && nextDep !== void 0 && prevDep === nextDep;
25934
- if (!dependencyMatches) {
26277
+ const { layoutDependency: prevDep } = prevLead.options;
26278
+ const { layoutDependency: nextDep } = node.options;
26279
+ if (prevDep === void 0 || prevDep !== nextDep) {
25935
26280
  node.resumeFrom = prevLead;
25936
- if (preserveFollowOpacity) {
25937
- node.resumeFrom.preserveOpacity = true;
25938
- }
26281
+ if (preserveFollowOpacity)
26282
+ prevLead.preserveOpacity = true;
25939
26283
  if (prevLead.snapshot) {
25940
26284
  node.snapshot = prevLead.snapshot;
25941
26285
  node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
25942
26286
  }
25943
- if (node.root && node.root.isUpdating) {
26287
+ if (node.root?.isUpdating)
25944
26288
  node.isLayoutDirty = true;
25945
- }
25946
26289
  }
25947
- const { crossfade } = node.options;
25948
- if (crossfade === false) {
26290
+ if (node.options.crossfade === false)
25949
26291
  prevLead.hide();
25950
- }
25951
26292
  }
25952
26293
  }
25953
26294
  exitAnimationComplete() {
25954
- this.members.forEach((node) => {
25955
- const { options, resumingFrom } = node;
25956
- options.onExitComplete && options.onExitComplete();
25957
- if (resumingFrom) {
25958
- resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete();
25959
- }
26295
+ this.members.forEach((member) => {
26296
+ member.options.onExitComplete?.();
26297
+ member.resumingFrom?.options.onExitComplete?.();
25960
26298
  });
25961
26299
  }
25962
26300
  scheduleRender() {
25963
- this.members.forEach((node) => {
25964
- node.instance && node.scheduleRender(false);
25965
- });
26301
+ this.members.forEach((member) => member.instance && member.scheduleRender(false));
25966
26302
  }
25967
- /**
25968
- * Clear any leads that have been removed this render to prevent them from being
25969
- * used in future animations and to prevent memory leaks
25970
- */
25971
26303
  removeLeadSnapshot() {
25972
- if (this.lead && this.lead.snapshot) {
26304
+ if (this.lead?.snapshot)
25973
26305
  this.lead.snapshot = void 0;
25974
- }
25975
26306
  }
25976
26307
  };
25977
26308
 
@@ -26220,6 +26551,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26220
26551
  for (let i = 0; i < this.path.length; i++) {
26221
26552
  const node = this.path[i];
26222
26553
  node.shouldResetTransform = true;
26554
+ if (typeof node.latestValues.x === "string" || typeof node.latestValues.y === "string") {
26555
+ node.isLayoutDirty = true;
26556
+ }
26223
26557
  node.updateScroll("snapshot");
26224
26558
  if (node.options.layoutRoot) {
26225
26559
  node.willUpdate(false);
@@ -26237,8 +26571,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26237
26571
  this.updateScheduled = false;
26238
26572
  const updateWasBlocked = this.isUpdateBlocked();
26239
26573
  if (updateWasBlocked) {
26574
+ const wasBlockedByResize = this.updateBlockedByResize;
26240
26575
  this.unblockUpdate();
26576
+ this.updateBlockedByResize = false;
26241
26577
  this.clearAllSnapshots();
26578
+ if (wasBlockedByResize) {
26579
+ this.nodes.forEach(forceLayoutMeasure);
26580
+ }
26242
26581
  this.nodes.forEach(clearMeasurements);
26243
26582
  return;
26244
26583
  }
@@ -26251,6 +26590,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26251
26590
  this.nodes.forEach(clearIsLayoutDirty);
26252
26591
  } else {
26253
26592
  this.isUpdating = false;
26593
+ this.nodes.forEach(ensureDraggedNodesSnapshotted);
26254
26594
  this.nodes.forEach(resetTransformStyle);
26255
26595
  this.nodes.forEach(updateLayout);
26256
26596
  this.nodes.forEach(notifyLayoutUpdate);
@@ -26317,7 +26657,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26317
26657
  const prevLayout = this.layout;
26318
26658
  this.layout = this.measure(false);
26319
26659
  this.layoutVersion++;
26320
- this.layoutCorrected = createBox();
26660
+ if (!this.layoutCorrected)
26661
+ this.layoutCorrected = createBox();
26321
26662
  this.isLayoutDirty = false;
26322
26663
  this.projectionDelta = void 0;
26323
26664
  this.notifyListeners("measure", this.layout.layoutBox);
@@ -26403,23 +26744,21 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26403
26744
  }
26404
26745
  return boxWithoutScroll;
26405
26746
  }
26406
- applyTransform(box, transformOnly = false) {
26407
- const withTransforms = createBox();
26747
+ applyTransform(box, transformOnly = false, output) {
26748
+ const withTransforms = output || createBox();
26408
26749
  copyBoxInto(withTransforms, box);
26409
26750
  for (let i = 0; i < this.path.length; i++) {
26410
26751
  const node = this.path[i];
26411
26752
  if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
26412
- transformBox(withTransforms, {
26413
- x: -node.scroll.offset.x,
26414
- y: -node.scroll.offset.y
26415
- });
26753
+ translateAxis(withTransforms.x, -node.scroll.offset.x);
26754
+ translateAxis(withTransforms.y, -node.scroll.offset.y);
26416
26755
  }
26417
26756
  if (!hasTransform(node.latestValues))
26418
26757
  continue;
26419
- transformBox(withTransforms, node.latestValues);
26758
+ transformBox(withTransforms, node.latestValues, node.layout?.layoutBox);
26420
26759
  }
26421
26760
  if (hasTransform(this.latestValues)) {
26422
- transformBox(withTransforms, this.latestValues);
26761
+ transformBox(withTransforms, this.latestValues, this.layout?.layoutBox);
26423
26762
  }
26424
26763
  return withTransforms;
26425
26764
  }
@@ -26428,15 +26767,15 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26428
26767
  copyBoxInto(boxWithoutTransform, box);
26429
26768
  for (let i = 0; i < this.path.length; i++) {
26430
26769
  const node = this.path[i];
26431
- if (!node.instance)
26432
- continue;
26433
26770
  if (!hasTransform(node.latestValues))
26434
26771
  continue;
26435
- hasScale(node.latestValues) && node.updateSnapshot();
26436
- const sourceBox = createBox();
26437
- const nodeBox = node.measurePageBox();
26438
- copyBoxInto(sourceBox, nodeBox);
26439
- removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : void 0, sourceBox);
26772
+ let sourceBox;
26773
+ if (node.instance) {
26774
+ hasScale(node.latestValues) && node.updateSnapshot();
26775
+ sourceBox = createBox();
26776
+ copyBoxInto(sourceBox, node.measurePageBox());
26777
+ }
26778
+ removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox);
26440
26779
  }
26441
26780
  if (hasTransform(this.latestValues)) {
26442
26781
  removeBoxTransforms(boxWithoutTransform, this.latestValues);
@@ -26489,7 +26828,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26489
26828
  this.removeRelativeTarget();
26490
26829
  }
26491
26830
  if (!this.targetDelta && !this.relativeTarget) {
26492
- if (relativeParent && relativeParent.layout) {
26831
+ if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) {
26493
26832
  this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
26494
26833
  } else {
26495
26834
  this.removeRelativeTarget();
@@ -26503,10 +26842,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26503
26842
  }
26504
26843
  if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
26505
26844
  this.forceRelativeParentToResolveTarget();
26506
- calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
26845
+ calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0);
26507
26846
  } else if (this.targetDelta) {
26508
26847
  if (Boolean(this.resumingFrom)) {
26509
- this.target = this.applyTransform(this.layout.layoutBox);
26848
+ this.applyTransform(this.layout.layoutBox, false, this.target);
26510
26849
  } else {
26511
26850
  copyBoxInto(this.target, this.layout.layoutBox);
26512
26851
  }
@@ -26516,7 +26855,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26516
26855
  }
26517
26856
  if (this.attemptToResolveRelativeTarget) {
26518
26857
  this.attemptToResolveRelativeTarget = false;
26519
- if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
26858
+ if (this.options.layoutAnchor !== false && relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
26520
26859
  this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
26521
26860
  } else {
26522
26861
  this.relativeParent = this.relativeTarget = void 0;
@@ -26542,7 +26881,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26542
26881
  this.forceRelativeParentToResolveTarget();
26543
26882
  this.relativeTarget = createBox();
26544
26883
  this.relativeTargetOrigin = createBox();
26545
- calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout);
26884
+ calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout, this.options.layoutAnchor || void 0);
26546
26885
  copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
26547
26886
  }
26548
26887
  removeRelativeTarget() {
@@ -26605,9 +26944,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26605
26944
  show() {
26606
26945
  this.isVisible = true;
26607
26946
  }
26608
- scheduleRender(notifyAll = true) {
26947
+ scheduleRender(notifyAll2 = true) {
26609
26948
  this.options.visualElement?.scheduleRender();
26610
- if (notifyAll) {
26949
+ if (notifyAll2) {
26611
26950
  const stack = this.getStack();
26612
26951
  stack && stack.scheduleRender();
26613
26952
  }
@@ -26644,7 +26983,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26644
26983
  mixAxisDelta(targetDelta.y, delta.y, progress2);
26645
26984
  this.setTargetDelta(targetDelta);
26646
26985
  if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
26647
- calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
26986
+ calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0);
26648
26987
  mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress2);
26649
26988
  if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) {
26650
26989
  this.isProjectionDirty = false;
@@ -26674,6 +27013,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
26674
27013
  this.pendingAnimation = frame.update(() => {
26675
27014
  globalProjectionState.hasAnimatedSinceResize = true;
26676
27015
  this.motionValue || (this.motionValue = motionValue(0));
27016
+ this.motionValue.jump(0, false);
26677
27017
  this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
26678
27018
  ...options,
26679
27019
  velocity: 0,
@@ -26898,6 +27238,9 @@ function notifyLayoutUpdate(node) {
26898
27238
  axisSnapshot.min = layout2[axis].min;
26899
27239
  axisSnapshot.max = axisSnapshot.min + length;
26900
27240
  });
27241
+ } else if (animationType === "x" || animationType === "y") {
27242
+ const snapAxis = animationType === "x" ? "y" : "x";
27243
+ copyAxisInto(isShared ? snapshot.measuredBox[snapAxis] : snapshot.layoutBox[snapAxis], layout2[snapAxis]);
26901
27244
  } else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout2)) {
26902
27245
  eachAxis((axis) => {
26903
27246
  const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
@@ -26924,10 +27267,11 @@ function notifyLayoutUpdate(node) {
26924
27267
  if (relativeParent && !relativeParent.resumeFrom) {
26925
27268
  const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
26926
27269
  if (parentSnapshot && parentLayout) {
27270
+ const anchor = node.options.layoutAnchor || void 0;
26927
27271
  const relativeSnapshot = createBox();
26928
- calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
27272
+ calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox, anchor);
26929
27273
  const relativeLayout = createBox();
26930
- calcRelativePosition(relativeLayout, layout2, parentLayout.layoutBox);
27274
+ calcRelativePosition(relativeLayout, layout2, parentLayout.layoutBox, anchor);
26931
27275
  if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
26932
27276
  hasRelativeLayoutChanged = true;
26933
27277
  }
@@ -26971,9 +27315,19 @@ function clearSnapshot(node) {
26971
27315
  function clearMeasurements(node) {
26972
27316
  node.clearMeasurements();
26973
27317
  }
27318
+ function forceLayoutMeasure(node) {
27319
+ node.isLayoutDirty = true;
27320
+ node.updateLayout();
27321
+ }
26974
27322
  function clearIsLayoutDirty(node) {
26975
27323
  node.isLayoutDirty = false;
26976
27324
  }
27325
+ function ensureDraggedNodesSnapshotted(node) {
27326
+ if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) {
27327
+ node.snapshot = node.layout;
27328
+ node.isLayoutDirty = true;
27329
+ }
27330
+ }
26977
27331
  function resetTransformStyle(node) {
26978
27332
  const { visualElement } = node.options;
26979
27333
  if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
@@ -27239,6 +27593,7 @@ var validMotionProps = /* @__PURE__ */ new Set([
27239
27593
  "onViewportEnter",
27240
27594
  "onViewportLeave",
27241
27595
  "globalTapTarget",
27596
+ "propagate",
27242
27597
  "ignoreStrict",
27243
27598
  "viewport"
27244
27599
  ]);
@@ -27254,7 +27609,8 @@ function loadExternalIsValidProp(isValidProp) {
27254
27609
  shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
27255
27610
  }
27256
27611
  try {
27257
- loadExternalIsValidProp(__require("@emotion/is-prop-valid").default);
27612
+ const emotionPkg = "@emotion/is-prop-valid";
27613
+ loadExternalIsValidProp(__require(emotionPkg).default);
27258
27614
  } catch {
27259
27615
  }
27260
27616
  function filterProps(props, isDom, forwardMotionProps) {
@@ -27262,6 +27618,8 @@ function filterProps(props, isDom, forwardMotionProps) {
27262
27618
  for (const key in props) {
27263
27619
  if (key === "values" && typeof props.values === "object")
27264
27620
  continue;
27621
+ if (isMotionValue(props[key]))
27622
+ continue;
27265
27623
  if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || // If trying to use native HTML drag events, forward drag listeners
27266
27624
  props["draggable"] && key.startsWith("onDrag")) {
27267
27625
  filteredProps[key] = props[key];
@@ -27510,9 +27868,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
27510
27868
  if (instance) {
27511
27869
  visualState.onMount?.(instance);
27512
27870
  }
27513
- if (visualElement) {
27514
- instance ? visualElement.mount(instance) : visualElement.unmount();
27515
- }
27516
27871
  const ref = externalRefContainer.current;
27517
27872
  if (typeof ref === "function") {
27518
27873
  if (instance) {
@@ -27529,6 +27884,9 @@ function useMotionRef(visualState, visualElement, externalRef) {
27529
27884
  } else if (ref) {
27530
27885
  ref.current = instance;
27531
27886
  }
27887
+ if (visualElement) {
27888
+ instance ? visualElement.mount(instance) : visualElement.unmount();
27889
+ }
27532
27890
  }, [visualElement]);
27533
27891
  }
27534
27892
  var SwitchLayoutGroupContext = createContext({});
@@ -27576,7 +27934,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
27576
27934
  }
27577
27935
  });
27578
27936
  const optimisedAppearId = props[optimizedAppearDataAttribute];
27579
- const wantsHandoff = useRef(Boolean(optimisedAppearId) && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
27937
+ const wantsHandoff = useRef(Boolean(optimisedAppearId) && typeof window !== "undefined" && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId));
27580
27938
  useIsomorphicLayoutEffect(() => {
27581
27939
  hasMountedOnce.current = true;
27582
27940
  if (!visualElement)
@@ -27606,7 +27964,7 @@ function useVisualElement(Component2, visualState, props, createVisualElement, P
27606
27964
  return visualElement;
27607
27965
  }
27608
27966
  function createProjectionNode2(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
27609
- const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot, layoutCrossfade } = props;
27967
+ const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot, layoutAnchor, layoutCrossfade } = props;
27610
27968
  visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent));
27611
27969
  visualElement.projection.setOptions({
27612
27970
  layoutId,
@@ -27624,7 +27982,8 @@ function createProjectionNode2(visualElement, props, ProjectionNodeConstructor,
27624
27982
  initialPromotionConfig,
27625
27983
  crossfade: layoutCrossfade,
27626
27984
  layoutScroll,
27627
- layoutRoot
27985
+ layoutRoot,
27986
+ layoutAnchor
27628
27987
  });
27629
27988
  }
27630
27989
  function getClosestProjectingNode(visualElement) {
@@ -27648,7 +28007,7 @@ function createMotionComponent(Component2, { forwardMotionProps = false, type }
27648
28007
  const { isStatic } = configAndProps;
27649
28008
  const context = useCreateMotionContext(props);
27650
28009
  const visualState = useVisualState(props, isStatic);
27651
- if (!isStatic && isBrowser) {
28010
+ if (!isStatic && typeof window !== "undefined") {
27652
28011
  useStrictMode(configAndProps, preloadedFeatures);
27653
28012
  const layoutProjection = getProjectionFunctionality(configAndProps);
27654
28013
  MeasureLayout2 = layoutProjection.MeasureLayout;
@@ -27764,6 +28123,7 @@ var ExitAnimationFeature = class extends Feature {
27764
28123
  constructor() {
27765
28124
  super(...arguments);
27766
28125
  this.id = id2++;
28126
+ this.isExitComplete = false;
27767
28127
  }
27768
28128
  update() {
27769
28129
  if (!this.node.presenceContext)
@@ -27773,9 +28133,30 @@ var ExitAnimationFeature = class extends Feature {
27773
28133
  if (!this.node.animationState || isPresent === prevIsPresent) {
27774
28134
  return;
27775
28135
  }
28136
+ if (isPresent && prevIsPresent === false) {
28137
+ if (this.isExitComplete) {
28138
+ const { initial, custom } = this.node.getProps();
28139
+ if (typeof initial === "string") {
28140
+ const resolved = resolveVariant(this.node, initial, custom);
28141
+ if (resolved) {
28142
+ const { transition, transitionEnd, ...target } = resolved;
28143
+ for (const key in target) {
28144
+ this.node.getValue(key)?.jump(target[key]);
28145
+ }
28146
+ }
28147
+ }
28148
+ this.node.animationState.reset();
28149
+ this.node.animationState.animateChanges();
28150
+ } else {
28151
+ this.node.animationState.setActive("exit", false);
28152
+ }
28153
+ this.isExitComplete = false;
28154
+ return;
28155
+ }
27776
28156
  const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
27777
28157
  if (onExitComplete && !isPresent) {
27778
28158
  exitAnimation.then(() => {
28159
+ this.isExitComplete = true;
27779
28160
  onExitComplete(this.id);
27780
28161
  });
27781
28162
  }
@@ -27812,9 +28193,7 @@ function extractEventInfo(event) {
27812
28193
  }
27813
28194
  };
27814
28195
  }
27815
- var addPointerInfo = (handler) => {
27816
- return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
27817
- };
28196
+ var addPointerInfo = (handler) => (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
27818
28197
 
27819
28198
  // node_modules/framer-motion/dist/es/events/add-pointer-event.mjs
27820
28199
  function addPointerEvent(target, eventName, handler, options) {
@@ -27841,6 +28220,7 @@ var PanSession = class {
27841
28220
  this.startEvent = null;
27842
28221
  this.lastMoveEvent = null;
27843
28222
  this.lastMoveEventInfo = null;
28223
+ this.lastRawMoveEventInfo = null;
27844
28224
  this.handlers = {};
27845
28225
  this.contextWindow = window;
27846
28226
  this.scrollPositions = /* @__PURE__ */ new Map();
@@ -27854,6 +28234,9 @@ var PanSession = class {
27854
28234
  this.updatePoint = () => {
27855
28235
  if (!(this.lastMoveEvent && this.lastMoveEventInfo))
27856
28236
  return;
28237
+ if (this.lastRawMoveEventInfo) {
28238
+ this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint);
28239
+ }
27857
28240
  const info2 = getPanInfo(this.lastMoveEventInfo, this.history);
27858
28241
  const isPanStarted = this.startEvent !== null;
27859
28242
  const isDistancePastThreshold = distance2D(info2.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
@@ -27871,6 +28254,7 @@ var PanSession = class {
27871
28254
  };
27872
28255
  this.handlePointerMove = (event2, info2) => {
27873
28256
  this.lastMoveEvent = event2;
28257
+ this.lastRawMoveEventInfo = info2;
27874
28258
  this.lastMoveEventInfo = transformPoint(info2, this.transformPagePoint);
27875
28259
  frame.update(this.updatePoint, true);
27876
28260
  };
@@ -27927,12 +28311,9 @@ var PanSession = class {
27927
28311
  y: window.scrollY
27928
28312
  });
27929
28313
  window.addEventListener("scroll", this.onElementScroll, {
27930
- capture: true,
27931
- passive: true
27932
- });
27933
- window.addEventListener("scroll", this.onWindowScroll, {
27934
- passive: true
28314
+ capture: true
27935
28315
  });
28316
+ window.addEventListener("scroll", this.onWindowScroll);
27936
28317
  this.removeScrollListeners = () => {
27937
28318
  window.removeEventListener("scroll", this.onElementScroll, {
27938
28319
  capture: true
@@ -28019,6 +28400,9 @@ function getVelocity(history, timeDelta) {
28019
28400
  if (!timestampedPoint) {
28020
28401
  return { x: 0, y: 0 };
28021
28402
  }
28403
+ if (timestampedPoint === history[0] && history.length > 2 && lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta) * 2) {
28404
+ timestampedPoint = history[1];
28405
+ }
28022
28406
  const time2 = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
28023
28407
  if (time2 === 0) {
28024
28408
  return { x: 0, y: 0 };
@@ -28135,14 +28519,11 @@ var VisualElementDragControls = class {
28135
28519
  return;
28136
28520
  const onSessionStart = (event) => {
28137
28521
  if (snapToCursor) {
28138
- this.stopAnimation();
28139
28522
  this.snapToCursor(extractEventInfo(event).point);
28140
- } else {
28141
- this.pauseAnimation();
28142
28523
  }
28524
+ this.stopAnimation();
28143
28525
  };
28144
28526
  const onStart = (event, info) => {
28145
- this.stopAnimation();
28146
28527
  const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
28147
28528
  if (drag2 && !dragPropagation) {
28148
28529
  if (this.openDragLock)
@@ -28209,7 +28590,12 @@ var VisualElementDragControls = class {
28209
28590
  this.latestPointerEvent = null;
28210
28591
  this.latestPanInfo = null;
28211
28592
  };
28212
- const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" && this.getAxisMotionValue(axis).animation?.play());
28593
+ const resumeAnimation = () => {
28594
+ const { dragSnapToOrigin: snap } = this.getProps();
28595
+ if (snap || this.constraints) {
28596
+ this.startAnimation({ x: 0, y: 0 });
28597
+ }
28598
+ };
28213
28599
  const { dragSnapToOrigin } = this.getProps();
28214
28600
  this.panSession = new PanSession(originEvent, {
28215
28601
  onSessionStart,
@@ -28296,7 +28682,7 @@ var VisualElementDragControls = class {
28296
28682
  }
28297
28683
  }
28298
28684
  this.elastic = resolveDragElastic(dragElastic);
28299
- if (prevConstraints !== this.constraints && layout2 && this.constraints && !this.hasMutatedConstraints) {
28685
+ if (prevConstraints !== this.constraints && !isRefObject(dragConstraints) && layout2 && this.constraints && !this.hasMutatedConstraints) {
28300
28686
  eachAxis((axis) => {
28301
28687
  if (this.constraints !== false && this.getAxisMotionValue(axis)) {
28302
28688
  this.constraints[axis] = rebaseAxisConstraints(layout2.layoutBox[axis], this.constraints[axis]);
@@ -28332,7 +28718,7 @@ var VisualElementDragControls = class {
28332
28718
  return;
28333
28719
  }
28334
28720
  let transition = constraints && constraints[axis] || {};
28335
- if (dragSnapToOrigin)
28721
+ if (dragSnapToOrigin === true || dragSnapToOrigin === axis)
28336
28722
  transition = { min: 0, max: 0 };
28337
28723
  const bounceStiffness = dragElastic ? 200 : 1e6;
28338
28724
  const bounceDamping = dragElastic ? 40 : 1e7;
@@ -28359,12 +28745,6 @@ var VisualElementDragControls = class {
28359
28745
  stopAnimation() {
28360
28746
  eachAxis((axis) => this.getAxisMotionValue(axis).stop());
28361
28747
  }
28362
- pauseAnimation() {
28363
- eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause());
28364
- }
28365
- getAnimationState(axis) {
28366
- return this.getAxisMotionValue(axis).animation?.state;
28367
- }
28368
28748
  /**
28369
28749
  * Drag works differently depending on which props are provided.
28370
28750
  *
@@ -28416,6 +28796,7 @@ var VisualElementDragControls = class {
28416
28796
  this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none";
28417
28797
  projection.root && projection.root.updateScroll();
28418
28798
  projection.updateLayout();
28799
+ this.constraints = false;
28419
28800
  this.resolveConstraints();
28420
28801
  eachAxis((axis) => {
28421
28802
  if (!shouldDrag(axis, drag2, null))
@@ -28424,6 +28805,7 @@ var VisualElementDragControls = class {
28424
28805
  const { min, max } = this.constraints[axis];
28425
28806
  axisValue.set(mixNumber(min, max, boxProgress[axis]));
28426
28807
  });
28808
+ this.visualElement.render();
28427
28809
  }
28428
28810
  addListeners() {
28429
28811
  if (!this.visualElement.current)
@@ -28438,10 +28820,14 @@ var VisualElementDragControls = class {
28438
28820
  this.start(event);
28439
28821
  }
28440
28822
  });
28823
+ let stopResizeObservers;
28441
28824
  const measureDragConstraints = () => {
28442
28825
  const { dragConstraints } = this.getProps();
28443
28826
  if (isRefObject(dragConstraints) && dragConstraints.current) {
28444
28827
  this.constraints = this.resolveRefConstraints();
28828
+ if (!stopResizeObservers) {
28829
+ stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints());
28830
+ }
28445
28831
  }
28446
28832
  };
28447
28833
  const { projection } = this.visualElement;
@@ -28469,6 +28855,7 @@ var VisualElementDragControls = class {
28469
28855
  stopPointerListener();
28470
28856
  stopMeasureLayoutListener();
28471
28857
  stopLayoutUpdateListener && stopLayoutUpdateListener();
28858
+ stopResizeObservers && stopResizeObservers();
28472
28859
  };
28473
28860
  }
28474
28861
  getProps() {
@@ -28485,6 +28872,24 @@ var VisualElementDragControls = class {
28485
28872
  };
28486
28873
  }
28487
28874
  };
28875
+ function skipFirstCall(callback) {
28876
+ let isFirst = true;
28877
+ return () => {
28878
+ if (isFirst) {
28879
+ isFirst = false;
28880
+ return;
28881
+ }
28882
+ callback();
28883
+ };
28884
+ }
28885
+ function startResizeObservers(element, constraintsElement, onResize) {
28886
+ const stopElement = resize(element, skipFirstCall(onResize));
28887
+ const stopContainer = resize(constraintsElement, skipFirstCall(onResize));
28888
+ return () => {
28889
+ stopElement();
28890
+ stopContainer();
28891
+ };
28892
+ }
28488
28893
  function shouldDrag(direction, drag2, currentDirection) {
28489
28894
  return (drag2 === true || drag2 === direction) && (currentDirection === null || currentDirection === direction);
28490
28895
  }
@@ -28637,8 +29042,10 @@ var MeasureLayoutWithContext = class extends Component {
28637
29042
  return null;
28638
29043
  }
28639
29044
  componentDidUpdate() {
28640
- const { projection } = this.props.visualElement;
29045
+ const { visualElement, layoutAnchor } = this.props;
29046
+ const { projection } = visualElement;
28641
29047
  if (projection) {
29048
+ projection.options.layoutAnchor = layoutAnchor;
28642
29049
  projection.root.didUpdate();
28643
29050
  microtask.postRender(() => {
28644
29051
  if (!projection.currentAnimation && projection.isLead()) {
@@ -28762,10 +29169,14 @@ var PressGesture = class extends Feature {
28762
29169
  const { current } = this.node;
28763
29170
  if (!current)
28764
29171
  return;
29172
+ const { globalTapTarget, propagate } = this.node.props;
28765
29173
  this.unmount = press(current, (_element, startEvent) => {
28766
29174
  handlePressEvent(this.node, startEvent, "Start");
28767
29175
  return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
28768
- }, { useGlobalTarget: this.node.props.globalTapTarget });
29176
+ }, {
29177
+ useGlobalTarget: globalTapTarget,
29178
+ stopPropagation: propagate?.tap === false
29179
+ });
28769
29180
  }
28770
29181
  unmount() {
28771
29182
  }
@@ -28815,7 +29226,7 @@ var InViewFeature = class extends Feature {
28815
29226
  this.isInView = false;
28816
29227
  }
28817
29228
  startObserver() {
28818
- this.unmount();
29229
+ this.stopObserver?.();
28819
29230
  const { viewport = {} } = this.node.getProps();
28820
29231
  const { root, margin: rootMargin, amount = "some", once } = viewport;
28821
29232
  const options = {
@@ -28840,7 +29251,7 @@ var InViewFeature = class extends Feature {
28840
29251
  const callback = isIntersecting ? onViewportEnter : onViewportLeave;
28841
29252
  callback && callback(entry);
28842
29253
  };
28843
- return observeIntersection(this.node.current, options, onIntersectionUpdate);
29254
+ this.stopObserver = observeIntersection(this.node.current, options, onIntersectionUpdate);
28844
29255
  }
28845
29256
  mount() {
28846
29257
  this.startObserver();
@@ -28855,6 +29266,9 @@ var InViewFeature = class extends Feature {
28855
29266
  }
28856
29267
  }
28857
29268
  unmount() {
29269
+ this.stopObserver?.();
29270
+ this.hasEnteredView = false;
29271
+ this.isInView = false;
28858
29272
  }
28859
29273
  };
28860
29274
  function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
@@ -29162,13 +29576,148 @@ function NavigationMenuIndicator({
29162
29576
  }
29163
29577
  );
29164
29578
  }
29579
+ var navigationMenuMainNavigationSurfaceStyles = cva("", {
29580
+ variants: {
29581
+ variant: {
29582
+ primary: "bg-primary-800 dark:bg-primary-900",
29583
+ secondary: "bg-[#f5f2ff] dark:bg-[#261447]",
29584
+ tertiary: "bg-primary-600 dark:bg-primary-700",
29585
+ white: "bg-white dark:bg-grey-950",
29586
+ grey: "bg-grey-100 dark:bg-grey-900"
29587
+ }
29588
+ },
29589
+ defaultVariants: {
29590
+ variant: "grey"
29591
+ }
29592
+ });
29593
+ var navigationMenuMainNavigationBorderStyles = cva("", {
29594
+ variants: {
29595
+ variant: {
29596
+ primary: "border-primary-700 dark:border-primary-600",
29597
+ secondary: "border-[#d9ccff] dark:border-[#4e3a86]",
29598
+ tertiary: "border-primary-500 dark:border-primary-600",
29599
+ white: "border-grey-200 dark:border-grey-800",
29600
+ grey: "border-grey-200 dark:border-grey-800"
29601
+ }
29602
+ },
29603
+ defaultVariants: {
29604
+ variant: "grey"
29605
+ }
29606
+ });
29607
+ var navigationMenuMainNavigationTriggerToneStyles = cva("", {
29608
+ variants: {
29609
+ variant: {
29610
+ primary: "text-white dark:text-primary-50",
29611
+ secondary: "text-primary-800 dark:text-primary-100",
29612
+ tertiary: "text-white dark:text-primary-50",
29613
+ white: "text-grey-900 dark:text-white",
29614
+ grey: "text-grey-800 dark:text-grey-100"
29615
+ }
29616
+ },
29617
+ defaultVariants: {
29618
+ variant: "grey"
29619
+ }
29620
+ });
29621
+ var navigationMenuMainNavigationTriggerActiveStyles = cva("", {
29622
+ variants: {
29623
+ variant: {
29624
+ primary: "hover:bg-primary-700 hover:text-white focus:bg-primary-700 focus:text-white data-[state=open]:bg-primary-700 data-[state=open]:text-white dark:hover:bg-primary-800 dark:hover:text-white dark:focus:bg-primary-800 dark:focus:text-white dark:data-[state=open]:bg-primary-800 dark:data-[state=open]:text-white",
29625
+ secondary: "hover:bg-[#e8e2ff] hover:text-primary-800 focus:bg-[#e8e2ff] focus:text-primary-800 data-[state=open]:bg-[#e8e2ff] data-[state=open]:text-primary-800 dark:hover:bg-[#32205a] dark:hover:text-primary-200 dark:focus:bg-[#32205a] dark:focus:text-primary-200 dark:data-[state=open]:bg-[#32205a] dark:data-[state=open]:text-primary-200",
29626
+ tertiary: "hover:bg-primary-500 hover:text-white focus:bg-primary-500 focus:text-white data-[state=open]:bg-primary-500 data-[state=open]:text-white dark:hover:bg-primary-600 dark:hover:text-white dark:focus:bg-primary-600 dark:focus:text-white dark:data-[state=open]:bg-primary-600 dark:data-[state=open]:text-white",
29627
+ white: "hover:bg-grey-100 hover:text-primary-800 focus:bg-grey-100 focus:text-primary-800 data-[state=open]:bg-grey-100 data-[state=open]:text-primary-800 dark:hover:bg-grey-800 dark:hover:text-primary-200 dark:focus:bg-grey-800 dark:focus:text-primary-200 dark:data-[state=open]:bg-grey-800 dark:data-[state=open]:text-primary-200",
29628
+ grey: "hover:bg-grey-200 hover:text-primary-800 focus:bg-grey-200 focus:text-primary-800 data-[state=open]:bg-grey-200 data-[state=open]:text-primary-800 dark:hover:bg-grey-800 dark:hover:text-primary-200 dark:focus:bg-grey-800 dark:focus:text-primary-200 dark:data-[state=open]:bg-grey-800 dark:data-[state=open]:text-primary-200"
29629
+ }
29630
+ },
29631
+ defaultVariants: {
29632
+ variant: "grey"
29633
+ }
29634
+ });
29635
+ var navigationMenuMainNavigationTriggerEdgeStyles = cva("", {
29636
+ variants: {
29637
+ variant: {
29638
+ primary: "hover:before:bg-primary-700 hover:after:bg-primary-700 focus:before:bg-primary-700 focus:after:bg-primary-700 data-[state=open]:before:bg-primary-700 data-[state=open]:after:bg-primary-700 dark:hover:before:bg-primary-800 dark:hover:after:bg-primary-800 dark:focus:before:bg-primary-800 dark:focus:after:bg-primary-800 dark:data-[state=open]:before:bg-primary-800 dark:data-[state=open]:after:bg-primary-800",
29639
+ secondary: "hover:before:bg-[#e8e2ff] hover:after:bg-[#e8e2ff] focus:before:bg-[#e8e2ff] focus:after:bg-[#e8e2ff] data-[state=open]:before:bg-[#e8e2ff] data-[state=open]:after:bg-[#e8e2ff] dark:hover:before:bg-[#32205a] dark:hover:after:bg-[#32205a] dark:focus:before:bg-[#32205a] dark:focus:after:bg-[#32205a] dark:data-[state=open]:before:bg-[#32205a] dark:data-[state=open]:after:bg-[#32205a]",
29640
+ tertiary: "hover:before:bg-primary-500 hover:after:bg-primary-500 focus:before:bg-primary-500 focus:after:bg-primary-500 data-[state=open]:before:bg-primary-500 data-[state=open]:after:bg-primary-500 dark:hover:before:bg-primary-600 dark:hover:after:bg-primary-600 dark:focus:before:bg-primary-600 dark:focus:after:bg-primary-600 dark:data-[state=open]:before:bg-primary-600 dark:data-[state=open]:after:bg-primary-600",
29641
+ white: "hover:before:bg-grey-100 hover:after:bg-grey-100 focus:before:bg-grey-100 focus:after:bg-grey-100 data-[state=open]:before:bg-grey-100 data-[state=open]:after:bg-grey-100 dark:hover:before:bg-grey-800 dark:hover:after:bg-grey-800 dark:focus:before:bg-grey-800 dark:focus:after:bg-grey-800 dark:data-[state=open]:before:bg-grey-800 dark:data-[state=open]:after:bg-grey-800",
29642
+ grey: "hover:before:bg-grey-200 hover:after:bg-grey-200 focus:before:bg-grey-200 focus:after:bg-grey-200 data-[state=open]:before:bg-grey-200 data-[state=open]:after:bg-grey-200 dark:hover:before:bg-grey-800 dark:hover:after:bg-grey-800 dark:focus:before:bg-grey-800 dark:focus:after:bg-grey-800 dark:data-[state=open]:before:bg-grey-800 dark:data-[state=open]:after:bg-grey-800"
29643
+ }
29644
+ },
29645
+ defaultVariants: {
29646
+ variant: "grey"
29647
+ }
29648
+ });
29649
+ var navigationMenuMainNavigationDropdownSurfaceStyles = cva(
29650
+ "w-full shadow dark:shadow-black/40",
29651
+ {
29652
+ variants: {
29653
+ variant: {
29654
+ primary: "bg-white dark:bg-grey-950",
29655
+ secondary: "bg-white dark:bg-grey-900",
29656
+ tertiary: "bg-white dark:bg-grey-950",
29657
+ white: "bg-white dark:bg-grey-950",
29658
+ grey: "bg-white dark:bg-grey-950"
29659
+ }
29660
+ },
29661
+ defaultVariants: {
29662
+ variant: "grey"
29663
+ }
29664
+ }
29665
+ );
29666
+ var navigationMenuMainNavigationFeaturedLinkStyles = cva(
29667
+ "group relative flex items-center px-8 py-8 text-xl font-bold whitespace-normal",
29668
+ {
29669
+ variants: {
29670
+ variant: {
29671
+ primary: "text-primary-800 hover:bg-primary-800/8 dark:text-primary-200 dark:hover:bg-primary-900/80",
29672
+ secondary: "text-primary-800 hover:bg-[#f5f2ff] dark:text-primary-200 dark:hover:bg-[#32205a]/70",
29673
+ tertiary: "text-primary-700 hover:bg-primary-100 dark:text-primary-200 dark:hover:bg-primary-900/70",
29674
+ white: "text-primary-800 hover:bg-grey-100 dark:text-primary-200 dark:hover:bg-grey-800/80",
29675
+ grey: "text-primary-800 hover:bg-grey-100 dark:text-primary-200 dark:hover:bg-grey-800/80"
29676
+ }
29677
+ },
29678
+ defaultVariants: {
29679
+ variant: "grey"
29680
+ }
29681
+ }
29682
+ );
29683
+ var navigationMenuMainNavigationSectionLinkStyles = cva(
29684
+ "relative mx-2 rounded-none border-t p-4 whitespace-normal focus-within:rounded-sm focus-within:outline focus-within:outline-inherit [&:nth-last-child(-n+3)]:border-b",
29685
+ {
29686
+ variants: {
29687
+ variant: {
29688
+ primary: "border-primary-100 bg-white hover:bg-primary-50 hover:font-bold hover:text-primary-800 dark:border-primary-900 dark:bg-grey-950 dark:hover:bg-primary-900/60 dark:hover:text-primary-200",
29689
+ secondary: "border-[#ece3ff] bg-white hover:bg-[#f8f4ff] hover:font-bold hover:text-primary-800 dark:border-[#45356e] dark:bg-grey-900 dark:hover:bg-[#32205a]/60 dark:hover:text-primary-200",
29690
+ tertiary: "border-primary-100 bg-white hover:bg-primary-50 hover:font-bold hover:text-primary-700 dark:border-primary-900 dark:bg-grey-950 dark:hover:bg-primary-900/60 dark:hover:text-primary-200",
29691
+ white: "border-grey-200 bg-white hover:bg-grey-50 hover:font-bold hover:text-primary-800 dark:border-grey-800 dark:bg-grey-950 dark:hover:bg-grey-800/80 dark:hover:text-primary-200",
29692
+ grey: "border-grey-200 bg-white hover:bg-grey-50 hover:font-bold hover:text-primary-800 dark:border-grey-800 dark:bg-grey-950 dark:hover:bg-grey-800/80 dark:hover:text-primary-200"
29693
+ }
29694
+ },
29695
+ defaultVariants: {
29696
+ variant: "grey"
29697
+ }
29698
+ }
29699
+ );
29700
+ var navigationMenuMainNavigationSectionLinkTitleStyles = cva("text-base font-semibold", {
29701
+ variants: {
29702
+ variant: {
29703
+ primary: "text-grey-900 dark:text-primary-50",
29704
+ secondary: "text-grey-900 dark:text-grey-100",
29705
+ tertiary: "text-grey-900 dark:text-primary-50",
29706
+ white: "text-grey-900 dark:text-white",
29707
+ grey: "text-grey-900 dark:text-grey-100"
29708
+ }
29709
+ },
29710
+ defaultVariants: {
29711
+ variant: "grey"
29712
+ }
29713
+ });
29165
29714
  var PANEL_CLOSE_DELAY_MS = 220;
29166
- var DEFAULT_TRIGGER_ACTIVE_CLASS_NAME = "hover:bg-primary-800/10 hover:text-primary-800 focus:bg-primary-800/10 focus:text-primary-800 data-[state=open]:bg-primary-800/10 data-[state=open]:text-primary-800 dark:hover:bg-primary-200/10 dark:hover:text-primary-200 dark:focus:bg-primary-200/10 dark:focus:text-primary-200 dark:data-[state=open]:bg-primary-200/10 dark:data-[state=open]:text-primary-200";
29167
- var DEFAULT_TRIGGER_ACTIVE_BORDER_CLASS_NAME = "hover:before:bg-primary-800/10 hover:after:bg-primary-800/10 focus:before:bg-primary-800/10 focus:after:bg-primary-800/10 data-[state=open]:before:bg-primary-800/10 dark:hover:before:bg-primary-200/10 dark:hover:after:bg-primary-200/10 dark:focus:before:bg-primary-200/10 dark:focus:after:bg-primary-200/10 dark:data-[state=open]:before:bg-primary-200/10";
29168
29715
  function TopLevelItem({
29169
29716
  href = "#",
29170
29717
  title,
29718
+ variant,
29171
29719
  syncBorderToSurface,
29720
+ triggerClassName,
29172
29721
  triggerActiveClassName,
29173
29722
  triggerActiveBorderClassName
29174
29723
  }) {
@@ -29177,21 +29726,30 @@ function TopLevelItem({
29177
29726
  {
29178
29727
  asChild: true,
29179
29728
  className: cn(
29180
- "relative inline-flex min-h-14 h-auto w-auto flex-row items-center justify-start gap-x-1 rounded-none bg-transparent p-4 text-base leading-6 font-bold text-grey-800 transition dark:text-grey-100 lg:px-8",
29181
- triggerActiveClassName ?? DEFAULT_TRIGGER_ACTIVE_CLASS_NAME,
29729
+ "relative inline-flex h-auto min-h-14 w-auto flex-row items-center justify-start gap-x-1 rounded-none bg-transparent p-4 text-base leading-6 font-bold transition lg:px-8",
29730
+ navigationMenuMainNavigationTriggerToneStyles({ variant }),
29731
+ navigationMenuMainNavigationTriggerActiveStyles({ variant }),
29732
+ triggerClassName,
29733
+ triggerActiveClassName,
29182
29734
  syncBorderToSurface && "before:absolute before:inset-x-0 before:top-0 before:h-px before:bg-transparent after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-transparent",
29183
- syncBorderToSurface && (triggerActiveBorderClassName ?? DEFAULT_TRIGGER_ACTIVE_BORDER_CLASS_NAME)
29735
+ syncBorderToSurface && navigationMenuMainNavigationTriggerEdgeStyles({ variant }),
29736
+ syncBorderToSurface && triggerActiveBorderClassName
29184
29737
  ),
29185
29738
  children: /* @__PURE__ */ jsx(Link14, { href, children: title })
29186
29739
  }
29187
29740
  ) });
29188
29741
  }
29189
- function FeaturedSectionLink({ href = "#", title }) {
29742
+ function FeaturedSectionLink({
29743
+ href = "#",
29744
+ title,
29745
+ variant,
29746
+ className
29747
+ }) {
29190
29748
  return /* @__PURE__ */ jsxs(
29191
29749
  Link14,
29192
29750
  {
29193
29751
  href,
29194
- className: "group relative flex items-center px-8 py-8 text-xl font-bold whitespace-normal text-primary-800 hover:bg-primary-800/10 dark:text-primary-200 dark:hover:bg-primary-200/10",
29752
+ className: cn(navigationMenuMainNavigationFeaturedLinkStyles({ variant }), className),
29195
29753
  children: [
29196
29754
  /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "absolute inset-0" }),
29197
29755
  title,
@@ -29200,33 +29758,47 @@ function FeaturedSectionLink({ href = "#", title }) {
29200
29758
  }
29201
29759
  );
29202
29760
  }
29203
- function SectionLink({ link }) {
29761
+ function SectionLink({
29762
+ link,
29763
+ variant,
29764
+ className,
29765
+ titleClassName
29766
+ }) {
29204
29767
  return /* @__PURE__ */ jsx(
29205
29768
  NavigationMenuLink,
29206
29769
  {
29207
29770
  asChild: true,
29208
- className: cn(
29209
- "relative mx-2 rounded-none border-t border-grey-200 bg-white p-4 hover:bg-primary-800/10 hover:font-bold hover:text-primary-800 dark:border-grey-700 dark:bg-grey-900 dark:hover:bg-primary-200/10 dark:hover:text-primary-200",
29210
- "[&:nth-last-child(-n+3)]:border-b",
29211
- "whitespace-normal",
29212
- "focus-within:rounded-sm focus-within:outline focus-within:outline-inherit"
29213
- ),
29771
+ className: cn(navigationMenuMainNavigationSectionLinkStyles({ variant }), className),
29214
29772
  children: /* @__PURE__ */ jsxs(Link14, { href: link.href, className: "outline-none", children: [
29215
29773
  /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "absolute inset-0" }),
29216
- /* @__PURE__ */ jsx("span", { className: "text-base font-semibold text-grey-900 dark:text-grey-100", children: link.title })
29774
+ /* @__PURE__ */ jsx(
29775
+ "span",
29776
+ {
29777
+ className: cn(
29778
+ navigationMenuMainNavigationSectionLinkTitleStyles({ variant }),
29779
+ titleClassName
29780
+ ),
29781
+ children: link.title
29782
+ }
29783
+ )
29217
29784
  ] })
29218
29785
  }
29219
29786
  );
29220
29787
  }
29221
29788
  function MegaNavigationItem({
29222
29789
  section,
29790
+ variant,
29223
29791
  fullBleed,
29224
29792
  panelMetrics,
29225
29793
  onOpenIntent,
29226
29794
  dropdownBackgroundClassName,
29227
29795
  syncBorderToSurface,
29796
+ triggerClassName,
29228
29797
  triggerActiveClassName,
29229
- triggerActiveBorderClassName
29798
+ triggerActiveBorderClassName,
29799
+ featuredLinkClassName,
29800
+ sectionLinkClassName,
29801
+ sectionLinkTitleClassName
29230
29802
  }) {
29231
29803
  if (!section.links?.length) {
29232
29804
  return /* @__PURE__ */ jsx(
@@ -29234,7 +29806,9 @@ function MegaNavigationItem({
29234
29806
  {
29235
29807
  href: section.href,
29236
29808
  title: section.title,
29809
+ variant,
29237
29810
  syncBorderToSurface,
29811
+ triggerClassName,
29238
29812
  triggerActiveClassName,
29239
29813
  triggerActiveBorderClassName
29240
29814
  }
@@ -29245,11 +29819,15 @@ function MegaNavigationItem({
29245
29819
  NavigationMenuTrigger,
29246
29820
  {
29247
29821
  className: cn(
29248
- "relative mb-0 min-h-14 h-auto w-auto justify-start rounded-none bg-transparent p-4 text-base leading-6 font-bold text-grey-800 lg:px-8 dark:text-grey-100 [&_svg]:h-6 [&_svg]:w-6",
29249
- triggerActiveClassName ?? DEFAULT_TRIGGER_ACTIVE_CLASS_NAME,
29822
+ "relative mb-0 h-auto min-h-14 w-auto justify-start rounded-none bg-transparent p-4 text-base leading-6 font-bold lg:px-8 [&_svg]:h-6 [&_svg]:w-6",
29823
+ navigationMenuMainNavigationTriggerToneStyles({ variant }),
29824
+ navigationMenuMainNavigationTriggerActiveStyles({ variant }),
29825
+ triggerClassName,
29826
+ triggerActiveClassName,
29250
29827
  "data-[state=open]:shadow-[inset_0_-2px_0_0_currentColor]",
29251
29828
  syncBorderToSurface && "before:absolute before:inset-x-0 before:top-0 before:h-px before:bg-transparent after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-transparent",
29252
- syncBorderToSurface && (triggerActiveBorderClassName ?? DEFAULT_TRIGGER_ACTIVE_BORDER_CLASS_NAME)
29829
+ syncBorderToSurface && navigationMenuMainNavigationTriggerEdgeStyles({ variant }),
29830
+ syncBorderToSurface && triggerActiveBorderClassName
29253
29831
  ),
29254
29832
  onPointerEnter: onOpenIntent,
29255
29833
  children: section.title
@@ -29259,7 +29837,7 @@ function MegaNavigationItem({
29259
29837
  NavigationMenuContent,
29260
29838
  {
29261
29839
  className: cn(
29262
- "left-0 w-full p-0 pr-0 whitespace-normal md:w-full group-data-[viewport=false]/navigation-menu:mt-0 group-data-[viewport=false]/navigation-menu:rounded-none group-data-[viewport=false]/navigation-menu:border-0 group-data-[viewport=false]/navigation-menu:bg-transparent group-data-[viewport=false]/navigation-menu:shadow-none"
29840
+ "left-0 w-full p-0 pr-0 whitespace-normal group-data-[viewport=false]/navigation-menu:mt-0 group-data-[viewport=false]/navigation-menu:rounded-none group-data-[viewport=false]/navigation-menu:border-0 group-data-[viewport=false]/navigation-menu:bg-transparent group-data-[viewport=false]/navigation-menu:shadow-none md:w-full"
29263
29841
  ),
29264
29842
  style: fullBleed && panelMetrics ? {
29265
29843
  left: `${-panelMetrics.left}px`,
@@ -29270,8 +29848,8 @@ function MegaNavigationItem({
29270
29848
  "div",
29271
29849
  {
29272
29850
  className: cn(
29273
- "w-full shadow dark:shadow-black/40",
29274
- dropdownBackgroundClassName ?? "bg-white dark:bg-grey-900"
29851
+ navigationMenuMainNavigationDropdownSurfaceStyles({ variant }),
29852
+ dropdownBackgroundClassName
29275
29853
  ),
29276
29854
  children: /* @__PURE__ */ jsxs(
29277
29855
  "div",
@@ -29283,8 +29861,25 @@ function MegaNavigationItem({
29283
29861
  marginRight: "auto"
29284
29862
  } : void 0,
29285
29863
  children: [
29286
- /* @__PURE__ */ jsx(FeaturedSectionLink, { href: section.href, title: section.title }),
29287
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 overflow-hidden px-4 pb-12 sm:grid-cols-2 lg:grid-cols-3", children: section.links.map((link, index) => /* @__PURE__ */ jsx(SectionLink, { link }, `${link.title}-${link.href}-${index}`)) })
29864
+ /* @__PURE__ */ jsx(
29865
+ FeaturedSectionLink,
29866
+ {
29867
+ href: section.href,
29868
+ title: section.title,
29869
+ variant,
29870
+ className: featuredLinkClassName
29871
+ }
29872
+ ),
29873
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 overflow-hidden px-4 pb-12 sm:grid-cols-2 lg:grid-cols-3", children: section.links.map((link, index) => /* @__PURE__ */ jsx(
29874
+ SectionLink,
29875
+ {
29876
+ link,
29877
+ variant,
29878
+ className: sectionLinkClassName,
29879
+ titleClassName: sectionLinkTitleClassName
29880
+ },
29881
+ `${link.title}-${link.href}-${index}`
29882
+ )) })
29288
29883
  ]
29289
29884
  }
29290
29885
  )
@@ -29297,6 +29892,8 @@ function MegaNavigationItem({
29297
29892
  function NavigationMenuMainNavigation({
29298
29893
  navigation,
29299
29894
  id: id3 = "nsw-main-navigation",
29895
+ variant = "grey",
29896
+ borderPosition = "none",
29300
29897
  className,
29301
29898
  responsive = true,
29302
29899
  sticky = true,
@@ -29304,8 +29901,12 @@ function NavigationMenuMainNavigation({
29304
29901
  backgroundClassName,
29305
29902
  dropdownBackgroundClassName,
29306
29903
  borderClassName,
29904
+ triggerClassName,
29307
29905
  triggerActiveClassName,
29308
29906
  triggerActiveBorderClassName,
29907
+ featuredLinkClassName,
29908
+ sectionLinkClassName,
29909
+ sectionLinkTitleClassName,
29309
29910
  showTopBorder = false,
29310
29911
  showBottomBorder = false
29311
29912
  }) {
@@ -29313,14 +29914,19 @@ function NavigationMenuMainNavigation({
29313
29914
  const containerRef = React5.useRef(null);
29314
29915
  const closeTimerRef = React5.useRef(null);
29315
29916
  const [value, setValue] = React5.useState("");
29316
- const syncBorderToSurface = showTopBorder || showBottomBorder;
29917
+ const hasLegacyBorderProps = showTopBorder || showBottomBorder;
29918
+ const resolvedBorderPosition = borderPosition !== "none" ? borderPosition : showTopBorder && showBottomBorder ? "both" : showTopBorder ? "top" : showBottomBorder ? "bottom" : "none";
29919
+ const hasTopBorder = resolvedBorderPosition === "top" || resolvedBorderPosition === "both";
29920
+ const hasBottomBorder = resolvedBorderPosition === "bottom" || resolvedBorderPosition === "both";
29921
+ const hasBorder = hasTopBorder || hasBottomBorder;
29922
+ const syncBorderToSurface = hasBorder;
29317
29923
  const [panelMetrics, setPanelMetrics] = React5.useState({
29318
29924
  left: 0,
29319
29925
  width: 0,
29320
29926
  viewportWidth: 0
29321
29927
  });
29322
29928
  const cancelCloseTimer = React5.useCallback(() => {
29323
- if (closeTimerRef.current) {
29929
+ if (closeTimerRef.current !== null) {
29324
29930
  window.clearTimeout(closeTimerRef.current);
29325
29931
  closeTimerRef.current = null;
29326
29932
  }
@@ -29352,17 +29958,27 @@ function NavigationMenuMainNavigation({
29352
29958
  cancelCloseTimer();
29353
29959
  };
29354
29960
  }, [cancelCloseTimer]);
29355
- const handleValueChange = React5.useCallback((nextValue) => {
29356
- cancelCloseTimer();
29357
- if (nextValue) {
29358
- setValue(nextValue);
29359
- return;
29961
+ React5.useEffect(() => {
29962
+ if (process.env.NODE_ENV !== "production" && borderPosition !== "none" && hasLegacyBorderProps) {
29963
+ console.warn(
29964
+ "NavigationMenuMainNavigation: `borderPosition` overrides deprecated `showTopBorder` / `showBottomBorder` props."
29965
+ );
29360
29966
  }
29361
- closeTimerRef.current = window.setTimeout(() => {
29362
- setValue("");
29363
- closeTimerRef.current = null;
29364
- }, PANEL_CLOSE_DELAY_MS);
29365
- }, [cancelCloseTimer]);
29967
+ }, [borderPosition, hasLegacyBorderProps]);
29968
+ const handleValueChange = React5.useCallback(
29969
+ (nextValue) => {
29970
+ cancelCloseTimer();
29971
+ if (nextValue) {
29972
+ setValue(nextValue);
29973
+ return;
29974
+ }
29975
+ closeTimerRef.current = window.setTimeout(() => {
29976
+ setValue("");
29977
+ closeTimerRef.current = null;
29978
+ }, PANEL_CLOSE_DELAY_MS);
29979
+ },
29980
+ [cancelCloseTimer]
29981
+ );
29366
29982
  return /* @__PURE__ */ jsx(
29367
29983
  "nav",
29368
29984
  {
@@ -29371,10 +29987,12 @@ function NavigationMenuMainNavigation({
29371
29987
  id: id3,
29372
29988
  className: cn(
29373
29989
  "z-40 shadow-md shadow-grey-900/5 dark:shadow-none",
29374
- backgroundClassName ?? "bg-grey-100 dark:bg-grey-900",
29375
- (showTopBorder || showBottomBorder) && (borderClassName ?? "border-grey-200 dark:border-grey-800"),
29376
- showTopBorder && "border-t",
29377
- showBottomBorder && "border-b",
29990
+ navigationMenuMainNavigationSurfaceStyles({ variant }),
29991
+ backgroundClassName,
29992
+ hasBorder && navigationMenuMainNavigationBorderStyles({ variant }),
29993
+ hasBorder && borderClassName,
29994
+ hasTopBorder && "border-t",
29995
+ hasBottomBorder && "border-b",
29378
29996
  responsive ? "hidden sm:px-6 lg:block lg:px-4" : "block",
29379
29997
  sticky && "sticky",
29380
29998
  className
@@ -29397,13 +30015,18 @@ function NavigationMenuMainNavigation({
29397
30015
  MegaNavigationItem,
29398
30016
  {
29399
30017
  section,
30018
+ variant,
29400
30019
  fullBleed,
29401
30020
  panelMetrics,
29402
30021
  onOpenIntent: cancelCloseTimer,
29403
30022
  dropdownBackgroundClassName,
29404
30023
  syncBorderToSurface,
30024
+ triggerClassName,
29405
30025
  triggerActiveClassName,
29406
- triggerActiveBorderClassName
30026
+ triggerActiveBorderClassName,
30027
+ featuredLinkClassName,
30028
+ sectionLinkClassName,
30029
+ sectionLinkTitleClassName
29407
30030
  },
29408
30031
  `${section.title}-${section.href ?? "section"}`
29409
30032
  )) })
@@ -31794,7 +32417,7 @@ function useActiveSectionObserver(tableOfContents) {
31794
32417
  if (tableOfContents.length === 0) return;
31795
32418
  if (!headerHeight) return;
31796
32419
  const totalHeight = headerHeight + mastheadHeight + navigationHeight;
31797
- let observer = null;
32420
+ let observer2 = null;
31798
32421
  const initializeObserver = () => {
31799
32422
  const ids = tableOfContents.flatMap((node) => [
31800
32423
  node.id,
@@ -31806,7 +32429,7 @@ function useActiveSectionObserver(tableOfContents) {
31806
32429
  el.style.scrollMarginTop = `${totalHeight + 16}px`;
31807
32430
  }
31808
32431
  });
31809
- observer = new IntersectionObserver(
32432
+ observer2 = new IntersectionObserver(
31810
32433
  (entries) => {
31811
32434
  const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
31812
32435
  if (visible.length > 0) {
@@ -31820,14 +32443,14 @@ function useActiveSectionObserver(tableOfContents) {
31820
32443
  );
31821
32444
  ids.forEach((id3) => {
31822
32445
  const el = document.getElementById(id3);
31823
- if (el) observer.observe(el);
32446
+ if (el) observer2.observe(el);
31824
32447
  });
31825
32448
  };
31826
32449
  const raf = requestAnimationFrame(() => {
31827
32450
  initializeObserver();
31828
32451
  });
31829
32452
  return () => {
31830
- if (observer) observer.disconnect();
32453
+ if (observer2) observer2.disconnect();
31831
32454
  cancelAnimationFrame(raf);
31832
32455
  };
31833
32456
  }, [tableOfContents, headerHeight, mastheadHeight, navigationHeight]);