1(function() { 2 try { 3 var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}; 4 e.SENTRY_RELEASE = { id: "b96dc26" }; 5 var n = new e.Error().stack; 6 n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "ecfd61b1-ef84-4835-b8ae-0eafa2810a1e", e._sentryDebugIdIdentifier = "sentry-dbid-ecfd61b1-ef84-4835-b8ae-0eafa2810a1e"); 7 } catch (e) {} 8})(); 9import { a as __toESM, n as __esmMin } from "./rolldown-runtime-sLwMD6dS.js"; 10import { t as require_jsx_runtime } from "./jsx-runtime-CHSMGLHp.js"; 11import { t as require_react } from "./react-CrLPhuc5.js"; 12import { $ as NativeAnimation, $t as circOut, A as init_is_svg_element, B as init_keys_position, Bt as init_sync_time, C as init_build_attrs, Cn as invariant, D as resolveElements, Dn as addUniqueItem, En as init_clamp, F as init_DOMKeyframesResolver, Ft as init_units, G as init_get_value_transition, Gt as frameSteps, H as animateMotionValue, Ht as cancelFrame, I as camelToDash, It as percent, Jt as init_batcher, Kt as init_frame, Lt as px, M as init_is_html_element, Mt as mixNumber, N as isHTMLElement, Nt as complex, P as DOMKeyframesResolver, Pt as init_complex, Q as init_accelerated_values, R as init_is_motion_value, Rt as init_is_css_variable, S as cssStyleProperties, Sn as init_errors, St as notifyLayoutAnimationStart, T as init_build_styles, Tn as clamp, U as init_motion_value, Ut as frame, V as positionalKeys, Vt as time, W as getValueTransition, Wt as frameData, X as motionValue, Y as init_value, Z as acceleratedValues, a as init_measure, an as secondsToMilliseconds, at as KeyframeResolver, bn as MotionGlobalConfig, c as applyBoxDelta, cn as init_progress, ct as transformPropOrder, d as scalePoint, dn as pipe, dt as init_parse_transform, en as init_circ, et as init_NativeAnimation, f as transformBox, fn as init_noop, ft as readTransformValue, g as hasTransform, gt as init_defaults, h as hasScale, hn as isZeroValueString, ht as getDefaultValueType, i as visualElementStore, in as millisecondsToSeconds, j as isSVGElement, jt as init_number, kn as removeItem, l as applyTreeDeltas, ln as progress, lt as transformProps, m as has2DTranslate, mn as init_is_zero_value_string, mt as init_animatable_none, n as init_single_value, o as measurePageBox, on as SubscriptionManager, ot as init_KeyframesResolver, p as translateAxis, pn as noop, pt as getAnimatableNone, q as resolveTransition, qt as createRenderBatcher, r as init_store, rn as init_time_conversion, s as measureViewportBox, sn as init_subscription_manager, st as init_keys_transform, t as animateSingleValue, u as init_delta_apply, un as init_pipe, ut as defaultTransformValue, v as convertBoundingBoxToBox, vn as init_is_numerical_string, w as buildHTMLStyles, x as buildSVGAttrs, xn as init_global_config, xt as init_notify_inspector, y as convertBoxToBoundingBox, yn as isNumericalString, z as isMotionValue, zt as isCSSVariableName } from "./single-value-zOKmmSUX.js"; 13import { r as init_MotionConfig } from "./Index-DO6EqESk.js"; 14//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/utils/calc-child-stagger.mjs 15function calcChildStagger(children, child, delayChildren, staggerChildren = 0, staggerDirection = 1) { 16 const index = Array.from(children).sort((a, b) => a.sortNodePosition(b)).indexOf(child); 17 const numChildren = children.size; 18 const maxStaggerDuration = (numChildren - 1) * staggerChildren; 19 return typeof delayChildren === "function" ? delayChildren(index, numChildren) : staggerDirection === 1 ? index * staggerChildren : maxStaggerDuration - index * staggerChildren; 20} 21//#endregion 22//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/resolve-variants.mjs 23function getValueState(visualElement) { 24 const state = [{}, {}]; 25 visualElement?.values.forEach((value, key) => { 26 state[0][key] = value.get(); 27 state[1][key] = value.getVelocity(); 28 }); 29 return state; 30} 31function resolveVariantFromProps(props, definition, custom, visualElement) { 32 /** 33 * If the variant definition is a function, resolve. 34 */ 35 if (typeof definition === "function") { 36 const [current, velocity] = getValueState(visualElement); 37 definition = definition(custom !== void 0 ? custom : props.custom, current, velocity); 38 } 39 /** 40 * If the variant definition is a variant label, or 41 * the function returned a variant label, resolve. 42 */ 43 if (typeof definition === "string") definition = props.variants && props.variants[definition]; 44 /** 45 * At this point we've resolved both functions and variant labels, 46 * but the resolved variant label might itself have been a function. 47 * If so, resolve. This can only have returned a valid target object. 48 */ 49 if (typeof definition === "function") { 50 const [current, velocity] = getValueState(visualElement); 51 definition = definition(custom !== void 0 ? custom : props.custom, current, velocity); 52 } 53 return definition; 54} 55//#endregion 56//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/resolve-dynamic-variants.mjs 57function resolveVariant(visualElement, definition, custom) { 58 const props = visualElement.getProps(); 59 return resolveVariantFromProps(props, definition, custom !== void 0 ? custom : props.custom, visualElement); 60} 61function init_resolve_dynamic_variants() { 62 return (init_resolve_dynamic_variants = __esmMin((() => {})))(); 63} 64//#endregion 65//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/is-keyframes-target.mjs 66var isKeyframesTarget; 67function init_is_keyframes_target() { 68 return (init_is_keyframes_target = __esmMin((() => { 69 isKeyframesTarget = (v) => { 70 return Array.isArray(v); 71 }; 72 })))(); 73} 74//#endregion 75//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/setters.mjs 76/** 77* Set VisualElement's MotionValue, creating a new MotionValue for it if 78* it doesn't exist. 79*/ 80function setMotionValue(visualElement, key, value) { 81 if (visualElement.hasValue(key)) visualElement.getValue(key).set(value); 82 else visualElement.addValue(key, motionValue(value)); 83} 84function resolveFinalValueInKeyframes(v) { 85 return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v; 86} 87function setTarget(visualElement, definition) { 88 let { transitionEnd = {}, transition = {}, ...target } = resolveVariant(visualElement, definition) || {}; 89 target = { 90 ...target, 91 ...transitionEnd 92 }; 93 for (const key in target) setMotionValue(visualElement, key, resolveFinalValueInKeyframes(target[key])); 94} 95function init_setters() { 96 return (init_setters = __esmMin((() => {
97 init_value(); 98 init_resolve_dynamic_variants(); 99 init_is_keyframes_target(); 100 })))(); 101} 102//#endregion 103//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/value/will-change/is.mjs 104function isWillChangeMotionValue(value) { 105 return Boolean(isMotionValue(value) && value.add); 106} 107function init_is() { 108 return (init_is = __esmMin((() => { 109 init_is_motion_value(); 110 })))(); 111} 112//#endregion 113//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/value/will-change/add-will-change.mjs 114function addValueToWillChange(visualElement, key) { 115 const willChange = visualElement.getValue("willChange"); 116 /** 117 * It could be that a user has set willChange to a regular MotionValue, 118 * in which case we can't add the value to it. 119 */ 120 if (isWillChangeMotionValue(willChange)) return willChange.add(key); 121 else if (!willChange && MotionGlobalConfig.WillChange) { 122 const newWillChange = new MotionGlobalConfig.WillChange("auto"); 123 visualElement.addValue("willChange", newWillChange); 124 newWillChange.add(key); 125 } 126} 127function init_add_will_change() { 128 return (init_add_will_change = __esmMin((() => { 129 init_global_config(); 130 init_is(); 131 })))(); 132} 133//#endregion 134//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id.mjs 135var optimizedAppearDataId, optimizedAppearDataAttribute; 136function init_data_id() { 137 return (init_data_id = __esmMin((() => { 138 optimizedAppearDataId = "framerAppearId"; 139 optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId); 140 })))(); 141} 142//#endregion 143//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/optimized-appear/get-appear-id.mjs 144function getOptimisedAppearId(visualElement) { 145 return visualElement.props[optimizedAppearDataAttribute]; 146} 147function init_get_appear_id() { 148 return (init_get_appear_id = __esmMin((() => { 149 init_data_id(); 150 })))(); 151} 152//#endregion 153//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.mjs 154/** 155* Decide whether we should block this animation. Previously, we achieved this 156* just by checking whether the key was listed in protectedKeys, but this 157* posed problems if an animation was triggered by afterChildren and protectedKeys 158* had been set to true in the meantime. 159*/ 160function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) { 161 const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true; 162 needsAnimating[key] = false; 163 return shouldBlock; 164} 165function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) { 166 let { transition, transitionEnd, ...target } = targetAndTransition; 167 const defaultTransition = visualElement.getDefaultTransition(); 168 transition = transition ? resolveTransition(transition, defaultTransition) : defaultTransition; 169 const reduceMotion = transition?.reduceMotion; 170 const skipAnimations = transition?.skipAnimations; 171 if (transitionOverride) transition = transitionOverride; 172 const animations = []; 173 const animationTypeState = type && visualElement.animationState && visualElement.animationState.getState()[type]; 174 const path = transition?.path; 175 if (path) path.animateVisualElement(visualElement, target, transition, delay, animations); 176 for (const key in target) { 177 const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null); 178 const valueTarget = target[key]; 179 if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) continue; 180 const valueTransition = { 181 delay, 182 ...getValueTransition(transition || {}, key) 183 }; 184 if (skipAnimations) valueTransition.skipAnimations = true; 185 /** 186 * If the value is already at the defined target, skip the animation. 187 * We still re-assert the value via frame.update to take precedence 188 * over any stale transitionEnd callbacks from previous animations. 189 */ 190 const currentValue = value.get(); 191 if (currentValue !== void 0 && !value.isAnimating() && !Array.isArray(valueTarget) && valueTarget === currentValue && !valueTransition.velocity) { 192 frame.update(() => value.set(valueTarget)); 193 continue; 194 } 195 /** 196 * If this is the first time a value is being animated, check 197 * to see if we're handling off from an existing animation. 198 */ 199 let isHandoff = false;
200 if (isBrowser$2 && window.MotionHandoffAnimation) { 201 const appearId = getOptimisedAppearId(visualElement); 202 if (appearId) { 203 const startTime = window.MotionHandoffAnimation(appearId, key, frame); 204 if (startTime !== null) { 205 valueTransition.startTime = startTime; 206 isHandoff = true; 207 } 208 } 209 } 210 addValueToWillChange(visualElement, key); 211 const shouldReduceMotion = reduceMotion ?? visualElement.shouldReduceMotion; 212 value.start(animateMotionValue(key, value, valueTarget, shouldReduceMotion && positionalKeys.has(key) ? { type: false } : valueTransition, visualElement, isHandoff)); 213 const animation = value.animation; 214 if (animation) animations.push(animation); 215 } 216 if (transitionEnd) { 217 const applyTransitionEnd = () => frame.update(() => { 218 transitionEnd && setTarget(visualElement, transitionEnd); 219 }); 220 if (animations.length) Promise.all(animations).then(applyTransitionEnd); 221 else applyTransitionEnd(); 222 } 223 return animations; 224} 225var isBrowser$2; 226function init_visual_element_target() { 227 return (init_visual_element_target = __esmMin((() => { 228 init_get_value_transition(); 229 init_keys_position(); 230 init_setters(); 231 init_add_will_change(); 232 init_get_appear_id(); 233 init_motion_value(); 234 init_frame(); 235 isBrowser$2 = typeof window !== "undefined"; 236 })))(); 237} 238//#endregion 239//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-variant.mjs 240function animateVariant(visualElement, variant, options = {}) { 241 const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? visualElement.presenceContext?.custom : void 0); 242 let { transition = visualElement.getDefaultTransition() || {} } = resolved || {}; 243 if (options.transitionOverride) transition = options.transitionOverride; 244 /** 245 * If we have a variant, create a callback that runs it as an animation. 246 * Otherwise, we resolve a Promise immediately for a composable no-op. 247 */ 248 const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve(); 249 /** 250 * If we have children, create a callback that runs all their animations. 251 * Otherwise, we resolve a Promise immediately for a composable no-op. 252 */ 253 const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => { 254 const { delayChildren = 0, staggerChildren, staggerDirection } = transition; 255 return animateChildren(visualElement, variant, forwardDelay, delayChildren, staggerChildren, staggerDirection, options); 256 } : () => Promise.resolve(); 257 /** 258 * If the transition explicitly defines a "when" option, we need to resolve either 259 * this animation or all children animations before playing the other. 260 */ 261 const { when } = transition; 262 if (when) { 263 const [first, last] = when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation]; 264 return first().then(() => last()); 265 } else return Promise.all([getAnimation(), getChildAnimations(options.delay)]); 266} 267function animateChildren(visualElement, variant, delay = 0, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) { 268 const animations = []; 269 for (const child of visualElement.variantChildren) { 270 child.notify("AnimationStart", variant); 271 animations.push(animateVariant(child, variant, { 272 ...options, 273 delay: delay + (typeof delayChildren === "function" ? 0 : delayChildren) + calcChildStagger(visualElement.variantChildren, child, delayChildren, staggerChildren, staggerDirection) 274 }).then(() => child.notify("AnimationComplete", variant))); 275 } 276 return Promise.all(animations); 277} 278function init_visual_element_variant() { 279 return (init_visual_element_variant = __esmMin((() => { 280 init_resolve_dynamic_variants(); 281 init_visual_element_target(); 282 })))(); 283} 284//#endregion 285//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/animation/interfaces/visual-element.mjs 286function animateVisualElement(visualElement, definition, options = {}) { 287 visualElement.notify("AnimationStart", definition); 288 let animation; 289 if (Array.isArray(definition)) { 290 const animations = definition.map((variant) => animateVariant(visualElement, variant, options)); 291 animation = Promise.all(animations); 292 } else if (typeof definition === "string") animation = animateVariant(visualElement, definition, options); 293 else { 294 const resolvedDefinition = typeof definition === "function" ? resolveVariant(visualElement, definition, options.custom) : definition; 295 animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options)); 296 } 297 return animation.then(() => { 298 visualElement.notify("AnimationComplete", definition); 299 }); 300}
301function init_visual_element() { 302 return (init_visual_element = __esmMin((() => { 303 init_resolve_dynamic_variants(); 304 init_visual_element_target(); 305 init_visual_element_variant(); 306 })))(); 307} 308//#endregion 309//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/utils/border-radius.mjs 310var cornerRadiusProps; 311function init_border_radius() { 312 return (init_border_radius = __esmMin((() => { 313 cornerRadiusProps = [ 314 "borderTopLeftRadius", 315 "borderTopRightRadius", 316 "borderBottomRightRadius", 317 "borderBottomLeftRadius" 318 ]; 319 })))(); 320} 321//#endregion 322//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/frameloop/microtask.mjs 323var microtask, cancelMicrotask; 324function init_microtask() { 325 return (init_microtask = __esmMin((() => { 326 init_batcher(); 327 ({schedule: microtask, cancel: cancelMicrotask} = /* @__PURE__ */ createRenderBatcher(queueMicrotask, false)); 328 })))(); 329} 330//#endregion 331//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/drag/state/is-active.mjs 332function isDragActive() { 333 return isDragging.x || isDragging.y; 334} 335var isDragging; 336function init_is_active() { 337 return (init_is_active = __esmMin((() => { 338 isDragging = { 339 x: false, 340 y: false 341 }; 342 })))(); 343} 344//#endregion 345//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/drag/state/set-active.mjs 346function setDragLock(axis) { 347 if (axis === "x" || axis === "y") { 348 if (isDragging[axis]) return null; 349 else { 350 isDragging[axis] = true; 351 return () => { 352 isDragging[axis] = false; 353 }; 354 } 355 } else if (isDragging.x || isDragging.y) return null; 356 else { 357 isDragging.x = isDragging.y = true; 358 return () => { 359 isDragging.x = isDragging.y = false; 360 }; 361 } 362} 363function init_set_active() { 364 return (init_set_active = __esmMin((() => { 365 init_is_active(); 366 })))(); 367} 368//#endregion 369//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/utils/setup.mjs 370function setupGesture(elementOrSelector, options) { 371 const elements = resolveElements(elementOrSelector); 372 const gestureAbortController = new AbortController(); 373 const eventOptions = { 374 passive: true, 375 ...options, 376 signal: gestureAbortController.signal 377 }; 378 const cancel = () => gestureAbortController.abort(); 379 return [ 380 elements, 381 eventOptions, 382 cancel 383 ]; 384} 385function init_setup() { 386 return (init_setup = __esmMin((() => {})))(); 387} 388//#endregion 389//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/hover.mjs 390function isValidHover(event) { 391 return !(event.pointerType === "touch" || isDragActive()); 392} 393/** 394* Create a hover gesture. hover() is different to .addEventListener("pointerenter") 395* in that it has an easier syntax, filters out polyfilled touch events, interoperates 396* with drag gestures, and automatically removes the "pointerennd" event listener when the hover ends. 397* 398* @public 399*/ 400function hover(elementOrSelector, onHoverStart, options = {}) { 401 const [elements, eventOptions, cancel] = setupGesture(elementOrSelector, options); 402 elements.forEach((element) => { 403 let isPressed = false; 404 let deferredHoverEnd = false; 405 let hoverEndCallback; 406 const removePointerLeave = () => { 407 element.removeEventListener("pointerleave", onPointerLeave); 408 }; 409 const endHover = (event) => { 410 if (hoverEndCallback) { 411 hoverEndCallback(event); 412 hoverEndCallback = void 0; 413 } 414 removePointerLeave(); 415 }; 416 const onPointerUp = (event) => { 417 isPressed = false; 418 window.removeEventListener("pointerup", onPointerUp); 419 window.removeEventListener("pointercancel", onPointerUp); 420 if (deferredHoverEnd) { 421 deferredHoverEnd = false; 422 endHover(event); 423 } 424 }; 425 const onPointerDown = () => { 426 isPressed = true; 427 window.addEventListener("pointerup", onPointerUp, eventOptions); 428 window.addEventListener("pointercancel", onPointerUp, eventOptions); 429 }; 430 const onPointerLeave = (leaveEvent) => { 431 if (leaveEvent.pointerType === "touch") return; 432 if (isPressed) { 433 deferredHoverEnd = true; 434 return; 435 } 436 endHover(leaveEvent); 437 }; 438 const onPointerEnter = (enterEvent) => { 439 if (!isValidHover(enterEvent)) return; 440 deferredHoverEnd = false;
441 const onHoverEnd = onHoverStart(element, enterEvent); 442 if (typeof onHoverEnd !== "function") return; 443 hoverEndCallback = onHoverEnd; 444 element.addEventListener("pointerleave", onPointerLeave, eventOptions); 445 }; 446 element.addEventListener("pointerenter", onPointerEnter, eventOptions); 447 element.addEventListener("pointerdown", onPointerDown, eventOptions); 448 }); 449 return cancel; 450} 451function init_hover() { 452 return (init_hover = __esmMin((() => { 453 init_is_active(); 454 init_setup(); 455 })))(); 456} 457//#endregion 458//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs 459var isNodeOrChild; 460function init_is_node_or_child() { 461 return (init_is_node_or_child = __esmMin((() => { 462 isNodeOrChild = (parent, child) => { 463 if (!child) return false; 464 else if (parent === child) return true; 465 else return isNodeOrChild(parent, child.parentElement); 466 }; 467 })))(); 468} 469//#endregion 470//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs 471var isPrimaryPointer; 472function init_is_primary_pointer() { 473 return (init_is_primary_pointer = __esmMin((() => { 474 isPrimaryPointer = (event) => { 475 if (event.pointerType === "mouse") return typeof event.button !== "number" || event.button <= 0; 476 else 477 /** 478 * isPrimary is true for all mice buttons, whereas every touch point 479 * is regarded as its own input. So subsequent concurrent touch points 480 * will be false. 481 * 482 * Specifically match against false here as incomplete versions of 483 * PointerEvents in very old browser might have it set as undefined. 484 */ 485 return event.isPrimary !== false; 486 }; 487 })))(); 488} 489//#endregion 490//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs 491/** 492* Checks if an element is natively keyboard accessible (focusable). 493* Used by the press gesture to determine if we need to add tabIndex. 494*/ 495function isElementKeyboardAccessible(element) { 496 return keyboardAccessibleElements.has(element.tagName) || element.isContentEditable === true; 497} 498/** 499* Checks if an element has text selection or direct interaction behavior 500* that should block drag gestures from starting. 501* 502* This specifically targets form controls where the user might want to select 503* text or interact with the control (e.g., sliders, dropdowns). 504* 505* Buttons and links are NOT included because they don't have click-and-move 506* actions of their own - they only respond to click events, so dragging 507* should still work when initiated from these elements. 508*/ 509function isElementTextInput(element) { 510 return textInputElements.has(element.tagName) || element.isContentEditable === true; 511} 512var keyboardAccessibleElements, textInputElements; 513function init_is_keyboard_accessible() { 514 return (init_is_keyboard_accessible = __esmMin((() => { 515 keyboardAccessibleElements = /* @__PURE__ */ new Set([ 516 "BUTTON", 517 "INPUT", 518 "SELECT", 519 "TEXTAREA", 520 "A" 521 ]); 522 textInputElements = /* @__PURE__ */ new Set([ 523 "INPUT", 524 "SELECT", 525 "TEXTAREA" 526 ]); 527 })))(); 528} 529//#endregion 530//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/press/utils/state.mjs 531var isPressing; 532function init_state() { 533 return (init_state = __esmMin((() => { 534 isPressing = /* @__PURE__ */ new WeakSet(); 535 })))(); 536} 537//#endregion 538//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.mjs 539/** 540* Filter out events that are not "Enter" keys. 541*/ 542function filterEvents(callback) { 543 return (event) => { 544 if (event.key !== "Enter") return; 545 callback(event); 546 }; 547} 548function firePointerEvent(target, type) { 549 target.dispatchEvent(new PointerEvent("pointer" + type, { 550 isPrimary: true, 551 bubbles: true 552 })); 553} 554var enableKeyboardPress; 555function init_keyboard() { 556 return (init_keyboard = __esmMin((() => { 557 init_state(); 558 enableKeyboardPress = (focusEvent, eventOptions) => { 559 const element = focusEvent.currentTarget; 560 if (!element) return; 561 const handleKeydown = filterEvents(() => { 562 if (isPressing.has(element)) return; 563 firePointerEvent(element, "down"); 564 const handleKeyup = filterEvents(() => { 565 firePointerEvent(element, "up"); 566 }); 567 const handleBlur = () => firePointerEvent(element, "cancel"); 568 element.addEventListener("keyup", handleKeyup, eventOptions); 569 element.addEventListener("blur", handleBlur, eventOptions); 570 }); 571 element.addEventListener("keydown", handleKeydown, eventOptions); 572 /** 573 * Add an event listener that fires on blur to remove the keydown events. 574 */ 575 element.addEventListener("blur", () => element.removeEventListener("keydown", handleKeydown), eventOptions); 576 }; 577 })))(); 578} 579//#endregion 580//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/gestures/press/index.mjs 581/** 582* Filter out events that are not primary pointer events, or are triggering 583* while a Motion gesture is active. 584*/ 585function isValidPressEvent(event) { 586 return isPrimaryPointer(event) && !isDragActive(); 587} 588/** 589* Create a press gesture. 590* 591* Press is different to `"pointerdown"`, `"pointerup"` in that it 592* automatically filters out secondary pointer events like right 593* click and multitouch. 594* 595* It also adds accessibility support for keyboards, where 596* an element with a press gesture will receive focus and 597* trigger on Enter `"keydown"` and `"keyup"` events. 598* 599* This is different to a browser's `"click"` event, which does 600* respond to keyboards but only for the `"click"` itself, rather 601* than the press start and end/cancel. The element also needs 602* to be focusable for this to work, whereas a press gesture will 603* make an element focusable by default. 604* 605* @public 606*/ 607function press(targetOrSelector, onPressStart, options = {}) { 608 const [targets, eventOptions, cancelEvents] = setupGesture(targetOrSelector, options); 609 const startPress = (startEvent) => { 610 const target = startEvent.currentTarget; 611 if (!isValidPressEvent(startEvent)) return; 612 if (claimedPointerDownEvents.has(startEvent)) return; 613 isPressing.add(target); 614 if (options.stopPropagation) claimedPointerDownEvents.add(startEvent); 615 const onPressEnd = onPressStart(target, startEvent); 616 /**
617 * End listeners run in the capture phase so a descendant calling 618 * stopPropagation() in its own pointerup handler can't prevent the 619 * press gesture from ending. This also keeps the gesture-end 620 * ordering consistent with the drag gesture. See #2794. 621 */ 622 const endEventOptions = { 623 ...eventOptions, 624 capture: true 625 }; 626 const onPointerEnd = (endEvent, success) => { 627 window.removeEventListener("pointerup", onPointerUp, endEventOptions); 628 window.removeEventListener("pointercancel", onPointerCancel, endEventOptions); 629 if (isPressing.has(target)) isPressing.delete(target); 630 if (!isValidPressEvent(endEvent)) return; 631 if (typeof onPressEnd === "function") onPressEnd(endEvent, { success }); 632 }; 633 const onPointerUp = (upEvent) => { 634 onPointerEnd(upEvent, target === window || target === document || options.useGlobalTarget || isNodeOrChild(target, upEvent.target)); 635 }; 636 const onPointerCancel = (cancelEvent) => { 637 onPointerEnd(cancelEvent, false); 638 }; 639 window.addEventListener("pointerup", onPointerUp, endEventOptions); 640 window.addEventListener("pointercancel", onPointerCancel, endEventOptions); 641 }; 642 targets.forEach((target) => { 643 (options.useGlobalTarget ? window : target).addEventListener("pointerdown", startPress, eventOptions); 644 if (isHTMLElement(target)) { 645 target.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions)); 646 if (!isElementKeyboardAccessible(target) && !target.hasAttribute("tabindex")) target.tabIndex = 0; 647 } 648 }); 649 return cancelEvents; 650} 651var claimedPointerDownEvents; 652function init_press() { 653 return (init_press = __esmMin((() => { 654 init_is_html_element(); 655 init_is_active(); 656 init_is_node_or_child(); 657 init_is_primary_pointer(); 658 init_setup(); 659 init_is_keyboard_accessible(); 660 init_keyboard(); 661 init_state(); 662 claimedPointerDownEvents = /* @__PURE__ */ new WeakSet(); 663 })))(); 664} 665//#endregion 666//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/resize/handle-element.mjs 667function notifyTarget({ target, borderBoxSize }) { 668 resizeHandlers.get(target)?.forEach((handler) => { 669 handler(target, { 670 get width() { 671 return getWidth(target, borderBoxSize); 672 }, 673 get height() { 674 return getHeight(target, borderBoxSize); 675 } 676 }); 677 }); 678} 679function notifyAll(entries) { 680 entries.forEach(notifyTarget); 681} 682function createResizeObserver() { 683 if (typeof ResizeObserver === "undefined") return; 684 observer = new ResizeObserver(notifyAll); 685} 686function resizeElement(target, handler) { 687 if (!observer) createResizeObserver(); 688 const elements = resolveElements(target); 689 elements.forEach((element) => { 690 let elementHandlers = resizeHandlers.get(element); 691 if (!elementHandlers) { 692 elementHandlers = /* @__PURE__ */ new Set(); 693 resizeHandlers.set(element, elementHandlers); 694 } 695 elementHandlers.add(handler); 696 observer?.observe(element); 697 }); 698 return () => { 699 elements.forEach((element) => { 700 const elementHandlers = resizeHandlers.get(element); 701 elementHandlers?.delete(handler); 702 if (!elementHandlers?.size) observer?.unobserve(element); 703 }); 704 }; 705} 706var resizeHandlers, observer, getSize, getWidth, getHeight; 707function init_handle_element() { 708 return (init_handle_element = __esmMin((() => { 709 init_is_svg_element(); 710 resizeHandlers = /* @__PURE__ */ new WeakMap(); 711 getSize = (borderBoxAxis, svgAxis, htmlAxis) => (target, borderBoxSize) => { 712 if (borderBoxSize && borderBoxSize[0]) return borderBoxSize[0][borderBoxAxis + "Size"]; 713 else if (isSVGElement(target) && "getBBox" in target) return target.getBBox()[svgAxis]; 714 else return target[htmlAxis]; 715 }; 716 getWidth = /*@__PURE__*/ getSize("inline", "width", "offsetWidth"); 717 getHeight = /*@__PURE__*/ getSize("block", "height", "offsetHeight"); 718 })))(); 719} 720//#endregion 721//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/resize/handle-window.mjs 722function createWindowResizeHandler() { 723 windowResizeHandler = () => { 724 const info = { 725 get width() { 726 return window.innerWidth; 727 }, 728 get height() { 729 return window.innerHeight; 730 } 731 }; 732 windowCallbacks.forEach((callback) => callback(info)); 733 }; 734 window.addEventListener("resize", windowResizeHandler); 735} 736function resizeWindow(callback) { 737 windowCallbacks.add(callback); 738 if (!windowResizeHandler) createWindowResizeHandler(); 739 return () => { 740 windowCallbacks.delete(callback); 741 if (!windowCallbacks.size && typeof windowResizeHandler === "function") { 742 window.removeEventListener("resize", windowResizeHandler); 743 windowResizeHandler = void 0; 744 } 745 }; 746} 747var windowCallbacks, windowResizeHandler; 748function init_handle_window() { 749 return (init_handle_window = __esmMin((() => { 750 windowCallbacks = /* @__PURE__ */ new Set(); 751 })))(); 752} 753//#endregion 754//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/resize/index.mjs 755function resize(a, b) { 756 return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b); 757} 758function init_resize() { 759 return (init_resize = __esmMin((() => {
760 init_handle_element(); 761 init_handle_window(); 762 })))(); 763} 764//#endregion 765//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/stats/buffer.mjs 766var statsBuffer; 767function init_buffer() { 768 return (init_buffer = __esmMin((() => { 769 statsBuffer = { 770 value: null, 771 addProjectionMetrics: null 772 }; 773 })))(); 774} 775//#endregion 776//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/utils/is-svg-svg-element.mjs 777/** 778* Checks if an element is specifically an SVGSVGElement (the root SVG element) 779* in a way that works across iframes 780*/ 781function isSVGSVGElement(element) { 782 return isSVGElement(element) && element.tagName === "svg"; 783} 784function init_is_svg_svg_element() { 785 return (init_is_svg_svg_element = __esmMin((() => { 786 init_is_svg_element(); 787 })))(); 788} 789//#endregion 790//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/geometry/models.mjs 791var createAxisDelta, createDelta, createAxis, createBox; 792function init_models() { 793 return (init_models = __esmMin((() => { 794 createAxisDelta = () => ({ 795 translate: 0, 796 scale: 1, 797 origin: 0, 798 originPoint: 0 799 }); 800 createDelta = () => ({ 801 x: createAxisDelta(), 802 y: createAxisDelta() 803 }); 804 createAxis = () => ({ 805 min: 0, 806 max: 0 807 }); 808 createBox = () => ({ 809 x: createAxis(), 810 y: createAxis() 811 }); 812 })))(); 813} 814//#endregion 815//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/is-animation-controls.mjs 816function isAnimationControls(v) { 817 return v !== null && typeof v === "object" && typeof v.start === "function"; 818} 819//#endregion 820//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/is-variant-label.mjs 821/** 822* Decides if the supplied variable is variant label 823*/ 824function isVariantLabel(v) { 825 return typeof v === "string" || Array.isArray(v); 826} 827//#endregion 828//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/variant-props.mjs 829var variantPriorityOrder, variantProps; 830function init_variant_props() { 831 return (init_variant_props = __esmMin((() => { 832 variantPriorityOrder = [ 833 "animate", 834 "whileInView", 835 "whileFocus", 836 "whileHover", 837 "whileTap", 838 "whileDrag", 839 "exit" 840 ]; 841 variantProps = ["initial", ...variantPriorityOrder]; 842 })))(); 843} 844//#endregion 845//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/is-controlling-variants.mjs 846function isControllingVariants(props) { 847 if (isAnimationControls(props.animate)) return true; 848 for (let i = 0; i < variantProps.length; i++) if (isVariantLabel(props[variantProps[i]])) return true; 849 return false; 850} 851function isVariantNode(props) { 852 return Boolean(isControllingVariants(props) || props.variants); 853} 854function init_is_controlling_variants() { 855 return (init_is_controlling_variants = __esmMin((() => { 856 init_variant_props(); 857 })))(); 858} 859//#endregion 860//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/motion-values.mjs 861/** 862* Updates motion values from props changes. 863* Uses `any` type for element to avoid circular dependencies with VisualElement. 864*/ 865function updateMotionValuesFromProps(element, next, prev) { 866 for (const key in next) { 867 const nextValue = next[key]; 868 const prevValue = prev[key]; 869 if (isMotionValue(nextValue)) 870 /** 871 * If this is a motion value found in props or style, we want to add it 872 * to our visual element's motion value map. 873 */ 874 element.addValue(key, nextValue); 875 else if (isMotionValue(prevValue)) 876 /** 877 * If we're swapping from a motion value to a static value, 878 * create a new motion value from that 879 */ 880 element.addValue(key, motionValue(nextValue, { owner: element })); 881 else if (prevValue !== nextValue) { 882 /** 883 * If this is a flat value that has changed, update the motion value 884 * or create one if it doesn't exist. We only want to do this if we're 885 * not handling the value with our animation state. 886 */ 887 if (element.hasValue(key)) { 888 const existingValue = element.getValue(key); 889 if (existingValue.liveStyle === true) existingValue.jump(nextValue);
890 else if (!existingValue.hasAnimated) existingValue.set(nextValue); 891 } else { 892 const latestValue = element.getStaticValue(key); 893 element.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element })); 894 } 895 } 896 } 897 for (const key in prev) if (next[key] === void 0) element.removeValue(key); 898 return next; 899} 900function init_motion_values() { 901 return (init_motion_values = __esmMin((() => { 902 init_value(); 903 init_is_motion_value(); 904 })))(); 905} 906//#endregion 907//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.mjs 908var prefersReducedMotion, hasReducedMotionListener; 909function init_state$1() { 910 return (init_state$1 = __esmMin((() => { 911 prefersReducedMotion = { current: null }; 912 hasReducedMotionListener = { current: false }; 913 })))(); 914} 915//#endregion 916//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.mjs 917function initPrefersReducedMotion() { 918 hasReducedMotionListener.current = true; 919 if (!isBrowser$1) return; 920 if (window.matchMedia) { 921 const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)"); 922 const setReducedMotionPreferences = () => prefersReducedMotion.current = motionMediaQuery.matches; 923 motionMediaQuery.addEventListener("change", setReducedMotionPreferences); 924 setReducedMotionPreferences(); 925 } else prefersReducedMotion.current = false; 926} 927var isBrowser$1; 928function init_reduced_motion() { 929 return (init_reduced_motion = __esmMin((() => { 930 init_state$1(); 931 isBrowser$1 = typeof window !== "undefined"; 932 })))(); 933} 934//#endregion 935//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/VisualElement.mjs 936/** 937* Set feature definitions for all VisualElements. 938* This should be called by the framework layer (e.g., framer-motion) during initialization. 939*/ 940function setFeatureDefinitions(definitions) { 941 featureDefinitions = definitions; 942} 943/** 944* Get the current feature definitions 945*/ 946function getFeatureDefinitions() { 947 return featureDefinitions; 948} 949var propEventHandlers, featureDefinitions, VisualElement; 950function init_VisualElement() { 951 return (init_VisualElement = __esmMin((() => { 952 init_time_conversion(), init_is_numerical_string(), init_is_zero_value_string(), init_subscription_manager(); 953 init_KeyframesResolver(); 954 init_NativeAnimation(); 955 init_accelerated_values(); 956 init_microtask(); 957 init_sync_time(); 958 init_models(); 959 init_value(); 960 init_complex(); 961 init_animatable_none(); 962 init_is_motion_value(); 963 init_store(); 964 init_is_controlling_variants(); 965 init_keys_transform(); 966 init_motion_values(); 967 init_reduced_motion(); 968 init_state$1(); 969 init_frame(); 970 propEventHandlers = [ 971 "AnimationStart", 972 "AnimationComplete", 973 "Update", 974 "BeforeLayoutMeasure", 975 "LayoutMeasure", 976 "LayoutAnimationStart", 977 "LayoutAnimationComplete" 978 ]; 979 featureDefinitions = {}; 980 VisualElement = class { 981 /** 982 * This method takes React props and returns found MotionValues. For example, HTML 983 * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays. 984 * 985 * This isn't an abstract method as it needs calling in the constructor, but it is 986 * intended to be one. 987 */ 988 scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) { 989 return {}; 990 } 991 constructor({ parent, props, presenceContext, reducedMotionConfig, skipAnimations, blockInitialAnimation, visualState }, options = {}) { 992 /** 993 * A reference to the current underlying Instance, e.g. a HTMLElement 994 * or Three.Mesh etc. 995 */ 996 this.current = null; 997 /** 998 * A set containing references to this VisualElement's children. 999 */ 1000 this.children = /* @__PURE__ */ new Set(); 1001 /** 1002 * Determine what role this visual element should take in the variant tree. 1003 */ 1004 this.isVariantNode = false; 1005 this.isControllingVariants = false; 1006 /** 1007 * Decides whether this VisualElement should animate in reduced motion 1008 * mode. 1009 * 1010 * TODO: This is currently set on every individual VisualElement but feels 1011 * like it could be set globally. 1012 */ 1013 this.shouldReduceMotion = null; 1014 /** 1015 * Decides whether animations should be skipped for this VisualElement. 1016 * Useful for E2E tests and visual regression testing. 1017 */ 1018 this.shouldSkipAnimations = false;
1019 /** 1020 * A map of all motion values attached to this visual element. Motion 1021 * values are source of truth for any given animated value. A motion 1022 * value might be provided externally by the component via props. 1023 */ 1024 this.values = /* @__PURE__ */ new Map(); 1025 this.KeyframeResolver = KeyframeResolver; 1026 /** 1027 * Cleanup functions for active features (hover/tap/exit etc) 1028 */ 1029 this.features = {}; 1030 /** 1031 * A map of every subscription that binds the provided or generated 1032 * motion values onChange listeners to this visual element. 1033 */ 1034 this.valueSubscriptions = /* @__PURE__ */ new Map(); 1035 /** 1036 * A reference to the previously-provided motion values as returned 1037 * from scrapeMotionValuesFromProps. We use the keys in here to determine 1038 * if any motion values need to be removed after props are updated. 1039 */ 1040 this.prevMotionValues = {}; 1041 /** 1042 * Track whether this element has been mounted before, to detect 1043 * remounts after Suspense unmount/remount cycles. 1044 */ 1045 this.hasBeenMounted = false; 1046 /** 1047 * An object containing a SubscriptionManager for each active event. 1048 */ 1049 this.events = {}; 1050 /** 1051 * An object containing an unsubscribe function for each prop event subscription. 1052 * For example, every "Update" event can have multiple subscribers via 1053 * VisualElement.on(), but only one of those can be defined via the onUpdate prop. 1054 */ 1055 this.propEventSubscriptions = {}; 1056 this.notifyUpdate = () => this.notify("Update", this.latestValues); 1057 this.render = () => { 1058 if (!this.current) return; 1059 this.triggerBuild(); 1060 this.renderInstance(this.current, this.renderState, this.props.style, this.projection); 1061 }; 1062 this.renderScheduledAt = 0; 1063 this.scheduleRender = () => { 1064 const now = time.now(); 1065 if (this.renderScheduledAt < now) { 1066 this.renderScheduledAt = now; 1067 frame.render(this.render, false, true); 1068 } 1069 }; 1070 const { latestValues, renderState } = visualState; 1071 this.latestValues = latestValues; 1072 this.baseTarget = { ...latestValues }; 1073 this.initialValues = props.initial ? { ...latestValues } : {}; 1074 this.renderState = renderState; 1075 this.parent = parent; 1076 this.props = props; 1077 this.presenceContext = presenceContext; 1078 this.depth = parent ? parent.depth + 1 : 0; 1079 this.reducedMotionConfig = reducedMotionConfig; 1080 this.skipAnimationsConfig = skipAnimations; 1081 this.options = options; 1082 this.blockInitialAnimation = Boolean(blockInitialAnimation); 1083 this.isControllingVariants = isControllingVariants(props); 1084 this.isVariantNode = isVariantNode(props); 1085 if (this.isVariantNode) this.variantChildren = /* @__PURE__ */ new Set(); 1086 this.manuallyAnimateOnMount = Boolean(parent && parent.current); 1087 /** 1088 * Any motion values that are provided to the element when created 1089 * aren't yet bound to the element, as this would technically be impure. 1090 * However, we iterate through the motion values and set them to the 1091 * initial values for this component. 1092 * 1093 * TODO: This is impure and we should look at changing this to run on mount. 1094 * Doing so will break some tests but this isn't necessarily a breaking change, 1095 * more a reflection of the test. 1096 */ 1097 const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this); 1098 for (const key in initialMotionValues) { 1099 const value = initialMotionValues[key]; 1100 if (latestValues[key] !== void 0 && isMotionValue(value)) value.set(latestValues[key]); 1101 } 1102 } 1103 mount(instance) { 1104 /** 1105 * If this element has been mounted before (e.g. after a Suspense 1106 * unmount/remount), reset motion values to their initial state 1107 * so animations replay correctly from initial → animate. 1108 */ 1109 if (this.hasBeenMounted) for (const key in this.initialValues) { 1110 this.values.get(key)?.jump(this.initialValues[key]); 1111 this.latestValues[key] = this.initialValues[key]; 1112 } 1113 this.current = instance; 1114 visualElementStore.set(instance, this); 1115 if (this.projection && !this.projection.instance) this.projection.mount(instance); 1116 if (this.parent && this.isVariantNode && !this.isControllingVariants) this.removeFromVariantTree = this.parent.addVariantChild(this);
1117 this.values.forEach((value, key) => this.bindToMotionValue(key, value)); 1118 /** 1119 * Determine reduced motion preference. Only initialize the matchMedia 1120 * listener if we actually need the dynamic value (i.e., when config 1121 * is neither "never" nor "always"). 1122 */ 1123 if (this.reducedMotionConfig === "never") this.shouldReduceMotion = false; 1124 else if (this.reducedMotionConfig === "always") this.shouldReduceMotion = true; 1125 else { 1126 if (!hasReducedMotionListener.current) initPrefersReducedMotion(); 1127 this.shouldReduceMotion = prefersReducedMotion.current; 1128 } 1129 /** 1130 * Set whether animations should be skipped based on the config. 1131 */ 1132 this.shouldSkipAnimations = this.skipAnimationsConfig ?? false; 1133 this.parent?.addChild(this); 1134 this.update(this.props, this.presenceContext); 1135 this.hasBeenMounted = true; 1136 } 1137 unmount() { 1138 this.projection && this.projection.unmount(); 1139 cancelFrame(this.notifyUpdate); 1140 cancelFrame(this.render); 1141 this.valueSubscriptions.forEach((remove) => remove()); 1142 this.valueSubscriptions.clear(); 1143 this.removeFromVariantTree && this.removeFromVariantTree(); 1144 this.parent?.removeChild(this); 1145 for (const key in this.events) this.events[key].clear(); 1146 for (const key in this.features) { 1147 const feature = this.features[key]; 1148 if (feature) { 1149 feature.unmount(); 1150 feature.isMounted = false; 1151 } 1152 } 1153 this.current = null; 1154 } 1155 addChild(child) { 1156 this.children.add(child); 1157 this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()); 1158 this.enteringChildren.add(child); 1159 } 1160 removeChild(child) { 1161 this.children.delete(child); 1162 this.enteringChildren && this.enteringChildren.delete(child); 1163 } 1164 bindToMotionValue(key, value) { 1165 if (this.valueSubscriptions.has(key)) this.valueSubscriptions.get(key)(); 1166 if (value.accelerate && acceleratedValues.has(key) && this.current instanceof HTMLElement) { 1167 const { factory, keyframes, times, ease, duration } = value.accelerate; 1168 const animation = new NativeAnimation({ 1169 element: this.current, 1170 name: key, 1171 keyframes, 1172 times, 1173 ease, 1174 duration: secondsToMilliseconds(duration) 1175 }); 1176 const cleanup = factory(animation); 1177 this.valueSubscriptions.set(key, () => { 1178 cleanup(); 1179 animation.cancel(); 1180 }); 1181 return; 1182 } 1183 const valueIsTransform = transformProps.has(key); 1184 if (valueIsTransform && this.onBindTransform) this.onBindTransform(); 1185 const removeOnChange = value.on("change", (latestValue) => { 1186 this.latestValues[key] = latestValue; 1187 this.props.onUpdate && frame.preRender(this.notifyUpdate); 1188 if (valueIsTransform && this.projection) this.projection.isTransformDirty = true; 1189 this.scheduleRender(); 1190 }); 1191 let removeSyncCheck; 1192 if (typeof window !== "undefined" && window.MotionCheckAppearSync) removeSyncCheck = window.MotionCheckAppearSync(this, key, value); 1193 this.valueSubscriptions.set(key, () => { 1194 removeOnChange(); 1195 if (removeSyncCheck) removeSyncCheck(); 1196 }); 1197 } 1198 sortNodePosition(other) { 1199 /** 1200 * If these nodes aren't even of the same type we can't compare their depth. 1201 */ 1202 if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) return 0; 1203 return this.sortInstanceNodePosition(this.current, other.current); 1204 } 1205 updateFeatures() { 1206 let key = "animation"; 1207 for (key in featureDefinitions) { 1208 const featureDefinition = featureDefinitions[key]; 1209 if (!featureDefinition) continue; 1210 const { isEnabled, Feature: FeatureConstructor } = featureDefinition; 1211 /** 1212 * If this feature is enabled but not active, make a new instance. 1213 */ 1214 if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) this.features[key] = new FeatureConstructor(this); 1215 /** 1216 * If we have a feature, mount or update it. 1217 */ 1218 if (this.features[key]) { 1219 const feature = this.features[key]; 1220 if (feature.isMounted) feature.update(); 1221 else { 1222 feature.mount(); 1223 feature.isMounted = true; 1224 } 1225 } 1226 } 1227 } 1228 triggerBuild() { 1229 this.build(this.renderState, this.latestValues, this.props); 1230 } 1231 /** 1232 * Measure the current viewport box with or without transforms. 1233 * Only measures axis-aligned boxes, rotate and skew must be manually 1234 * removed with a re-render to work. 1235 */ 1236 measureViewportBox() { 1237 return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox(); 1238 } 1239 getStaticValue(key) { 1240 return this.latestValues[key]; 1241 } 1242 setStaticValue(key, value) { 1243 this.latestValues[key] = value; 1244 } 1245 /** 1246 * Update the provided props. Ensure any newly-added motion values are 1247 * added to our map, old ones removed, and listeners updated. 1248 */ 1249 update(props, presenceContext) { 1250 if (props.transformTemplate || this.props.transformTemplate) this.scheduleRender(); 1251 this.prevProps = this.props; 1252 this.props = props; 1253 this.prevPresenceContext = this.presenceContext; 1254 this.presenceContext = presenceContext; 1255 /** 1256 * Update prop event handlers ie onAnimationStart, onAnimationComplete 1257 */ 1258 for (let i = 0; i < propEventHandlers.length; i++) {
1259 const key = propEventHandlers[i]; 1260 if (this.propEventSubscriptions[key]) { 1261 this.propEventSubscriptions[key](); 1262 delete this.propEventSubscriptions[key]; 1263 } 1264 const listener = props["on" + key]; 1265 if (listener) this.propEventSubscriptions[key] = this.on(key, listener); 1266 } 1267 this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps || {}, this), this.prevMotionValues); 1268 if (this.handleChildMotionValue) this.handleChildMotionValue(); 1269 } 1270 getProps() { 1271 return this.props; 1272 } 1273 /** 1274 * Returns the variant definition with a given name. 1275 */ 1276 getVariant(name) { 1277 return this.props.variants ? this.props.variants[name] : void 0; 1278 } 1279 /** 1280 * Returns the defined default transition on this component. 1281 */ 1282 getDefaultTransition() { 1283 return this.props.transition; 1284 } 1285 getTransformPagePoint() { 1286 return this.props.transformPagePoint; 1287 } 1288 getClosestVariantNode() { 1289 return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0; 1290 } 1291 /** 1292 * Add a child visual element to our set of children. 1293 */ 1294 addVariantChild(child) { 1295 const closestVariantNode = this.getClosestVariantNode(); 1296 if (closestVariantNode) { 1297 closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child); 1298 return () => closestVariantNode.variantChildren.delete(child); 1299 } 1300 } 1301 /** 1302 * Add a motion value and bind it to this visual element. 1303 */ 1304 addValue(key, value) { 1305 const existingValue = this.values.get(key); 1306 if (value !== existingValue) { 1307 if (existingValue) this.removeValue(key); 1308 this.bindToMotionValue(key, value); 1309 this.values.set(key, value); 1310 this.latestValues[key] = value.get(); 1311 } 1312 } 1313 /** 1314 * Remove a motion value and unbind any active subscriptions. 1315 */ 1316 removeValue(key) { 1317 this.values.delete(key); 1318 const unsubscribe = this.valueSubscriptions.get(key); 1319 if (unsubscribe) { 1320 unsubscribe(); 1321 this.valueSubscriptions.delete(key); 1322 } 1323 delete this.latestValues[key]; 1324 this.removeValueFromRenderState(key, this.renderState); 1325 } 1326 /** 1327 * Check whether we have a motion value for this key 1328 */ 1329 hasValue(key) { 1330 return this.values.has(key); 1331 } 1332 getValue(key, defaultValue) { 1333 if (this.props.values && this.props.values[key]) return this.props.values[key]; 1334 let value = this.values.get(key); 1335 if (value === void 0 && defaultValue !== void 0) { 1336 value = motionValue(defaultValue === null ? void 0 : defaultValue, { owner: this }); 1337 this.addValue(key, value); 1338 } 1339 return value; 1340 } 1341 /** 1342 * If we're trying to animate to a previously unencountered value, 1343 * we need to check for it in our state and as a last resort read it 1344 * directly from the instance (which might have performance implications). 1345 */ 1346 readValue(key, target) { 1347 let value = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : this.getBaseTargetFromProps(this.props, key) ?? this.readValueFromInstance(this.current, key, this.options); 1348 if (value !== void 0 && value !== null) { 1349 if (typeof value === "string" && (isNumericalString(value) || isZeroValueString(value))) value = parseFloat(value); 1350 else if (typeof value !== "number" && !complex.test(value) && complex.test(target)) value = getAnimatableNone(key, target); 1351 this.setBaseTarget(key, isMotionValue(value) ? value.get() : value); 1352 } 1353 return isMotionValue(value) ? value.get() : value; 1354 } 1355 /** 1356 * Set the base target to later animate back to. This is currently 1357 * only hydrated on creation and when we first read a value. 1358 */ 1359 setBaseTarget(key, value) { 1360 this.baseTarget[key] = value; 1361 } 1362 /** 1363 * Find the base target for a value thats been removed from all animation 1364 * props. 1365 */ 1366 getBaseTarget(key) { 1367 const { initial } = this.props; 1368 let valueFromInitial; 1369 if (typeof initial === "string" || typeof initial === "object") { 1370 const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom); 1371 if (variant) valueFromInitial = variant[key]; 1372 } 1373 /** 1374 * If this value still exists in the current initial variant, read that. 1375 */ 1376 if (initial && valueFromInitial !== void 0) return valueFromInitial; 1377 /** 1378 * Alternatively, if this VisualElement config has defined a getBaseTarget 1379 * so we can read the value from an alternative source, try that. 1380 */ 1381 const target = this.getBaseTargetFromProps(this.props, key); 1382 if (target !== void 0 && !isMotionValue(target)) return target; 1383 /** 1384 * If the value was initially defined on initial, but it doesn't any more, 1385 * return undefined. Otherwise return the value as initially read from the DOM. 1386 */ 1387 return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key]; 1388 } 1389 on(eventName, callback) { 1390 if (!this.events[eventName]) this.events[eventName] = new SubscriptionManager(); 1391 return this.events[eventName].add(callback); 1392 } 1393 notify(eventName, ...args) { 1394 if (this.events[eventName]) this.events[eventName].notify(...args); 1395 } 1396 scheduleRenderMicrotask() { 1397 microtask.render(this.render); 1398 } 1399 }; 1400 })))(); 1401} 1402//#endregion 1403//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/dom/DOMVisualElement.mjs 1404var DOMVisualElement; 1405function init_DOMVisualElement() { 1406 return (init_DOMVisualElement = __esmMin((() => { 1407 init_is_motion_value(); 1408 init_DOMKeyframesResolver(); 1409 init_VisualElement(); 1410 DOMVisualElement = class extends VisualElement { 1411 constructor() { 1412 super(...arguments); 1413 this.KeyframeResolver = DOMKeyframesResolver; 1414 } 1415 sortInstanceNodePosition(a, b) { 1416 /** 1417 * compareDocumentPosition returns a bitmask, by using the bitwise & 1418 * we're returning true if 2 in that bitmask is set to true. 2 is set 1419 * to true if b preceeds a. 1420 */ 1421 return a.compareDocumentPosition(b) & 2 ? 1 : -1; 1422 } 1423 getBaseTargetFromProps(props, key) { 1424 const style = props.style; 1425 return style ? style[key] : void 0; 1426 } 1427 removeValueFromRenderState(key, { vars, style }) { 1428 delete vars[key]; 1429 delete style[key]; 1430 } 1431 handleChildMotionValue() { 1432 if (this.childSubscription) { 1433 this.childSubscription(); 1434 delete this.childSubscription; 1435 } 1436 const { children } = this.props; 1437 if (isMotionValue(children)) this.childSubscription = children.on("change", (latest) => { 1438 if (this.current) this.current.textContent = `${latest}`; 1439 }); 1440 } 1441 }; 1442 })))(); 1443} 1444//#endregion 1445//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/Feature.mjs 1446var Feature;
1447function init_Feature() { 1448 return (init_Feature = __esmMin((() => { 1449 Feature = class { 1450 constructor(node) { 1451 this.isMounted = false; 1452 this.node = node; 1453 } 1454 update() {} 1455 }; 1456 })))(); 1457} 1458//#endregion 1459//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/html/utils/render.mjs 1460function renderHTML(element, { style, vars }, styleProp, projection) { 1461 const elementStyle = element.style; 1462 let key; 1463 for (key in style) elementStyle[key] = style[key]; 1464 projection?.applyProjectionStyles(elementStyle, styleProp); 1465 for (key in vars) elementStyle.setProperty(key, vars[key]); 1466} 1467//#endregion 1468//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/styles/scale-border-radius.mjs 1469function pixelsToPercent(pixels, axis) { 1470 if (axis.max === axis.min) return 0; 1471 return pixels / (axis.max - axis.min) * 100; 1472} 1473var correctBorderRadius; 1474function init_scale_border_radius() { 1475 return (init_scale_border_radius = __esmMin((() => { 1476 init_units(); 1477 correctBorderRadius = { correct: (latest, node) => { 1478 if (!node.target) return latest; 1479 /** 1480 * If latest is a string, if it's a percentage we can return immediately as it's 1481 * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number. 1482 */ 1483 if (typeof latest === "string") { 1484 if (px.test(latest)) latest = parseFloat(latest); 1485 else return latest; 1486 } 1487 return `${pixelsToPercent(latest, node.target.x)}% ${pixelsToPercent(latest, node.target.y)}%`; 1488 } }; 1489 })))(); 1490} 1491//#endregion 1492//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/styles/scale-box-shadow.mjs 1493var correctBoxShadow; 1494function init_scale_box_shadow() { 1495 return (init_scale_box_shadow = __esmMin((() => { 1496 init_complex(); 1497 init_number(); 1498 correctBoxShadow = { correct: (latest, { treeScale, projectionDelta }) => { 1499 const original = latest; 1500 const shadow = complex.parse(latest); 1501 if (shadow.length > 5) return original; 1502 const template = complex.createTransformer(latest); 1503 const offset = typeof shadow[0] !== "number" ? 1 : 0; 1504 const xScale = projectionDelta.x.scale * treeScale.x; 1505 const yScale = projectionDelta.y.scale * treeScale.y; 1506 shadow[0 + offset] /= xScale; 1507 shadow[1 + offset] /= yScale; 1508 /** 1509 * Ideally we'd correct x and y scales individually, but because blur and 1510 * spread apply to both we have to take a scale average and apply that instead. 1511 * We could potentially improve the outcome of this by incorporating the ratio between 1512 * the two scales. 1513 */ 1514 const averageScale = mixNumber(xScale, yScale, .5); 1515 if (typeof shadow[2 + offset] === "number") shadow[2 + offset] /= averageScale; 1516 if (typeof shadow[3 + offset] === "number") shadow[3 + offset] /= averageScale; 1517 return template(shadow); 1518 } }; 1519 })))(); 1520} 1521//#endregion 1522//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/styles/scale-correction.mjs 1523var scaleCorrectors; 1524function init_scale_correction() { 1525 return (init_scale_correction = __esmMin((() => { 1526 init_border_radius(); 1527 init_scale_border_radius(); 1528 init_scale_box_shadow(); 1529 scaleCorrectors = { 1530 borderRadius: { 1531 ...correctBorderRadius, 1532 applyTo: [...cornerRadiusProps] 1533 }, 1534 borderTopLeftRadius: correctBorderRadius, 1535 borderTopRightRadius: correctBorderRadius, 1536 borderBottomLeftRadius: correctBorderRadius, 1537 borderBottomRightRadius: correctBorderRadius, 1538 boxShadow: correctBoxShadow 1539 }; 1540 })))(); 1541} 1542//#endregion 1543//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.mjs 1544function isForcedMotionValue(key, { layout, layoutId }) { 1545 return transformProps.has(key) || key.startsWith("origin") || (layout || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity"); 1546} 1547function init_is_forced_motion_value() { 1548 return (init_is_forced_motion_value = __esmMin((() => { 1549 init_keys_transform(); 1550 init_scale_correction(); 1551 })))(); 1552} 1553//#endregion 1554//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.mjs 1555function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) { 1556 const style = props.style; 1557 const prevStyle = prevProps?.style; 1558 const newValues = {}; 1559 if (!style) return newValues; 1560 for (const key in style) if (isMotionValue(style[key]) || prevStyle && isMotionValue(prevStyle[key]) || isForcedMotionValue(key, props) || visualElement?.getValue(key)?.liveStyle !== void 0) newValues[key] = style[key]; 1561 return newValues; 1562} 1563function init_scrape_motion_values() { 1564 return (init_scrape_motion_values = __esmMin((() => { 1565 init_is_motion_value(); 1566 init_is_forced_motion_value(); 1567 })))(); 1568} 1569//#endregion 1570//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.mjs 1571function getComputedStyle$1(element) { 1572 return window.getComputedStyle(element); 1573} 1574var HTMLVisualElement; 1575function init_HTMLVisualElement() { 1576 return (init_HTMLVisualElement = __esmMin((() => { 1577 init_errors(); 1578 init_is_css_variable(); 1579 init_keys_transform(); 1580 init_parse_transform(); 1581 init_measure(); 1582 init_DOMVisualElement(); 1583 init_build_styles(); 1584 init_scrape_motion_values(); 1585 HTMLVisualElement = class extends DOMVisualElement { 1586 constructor() { 1587 super(...arguments); 1588 this.type = "html"; 1589 this.renderInstance = renderHTML; 1590 } 1591 mount(instance) { 1592 /** 1593 * If a custom component forwards its ref to something other than a 1594 * HTML/SVG element (a class instance, an imperative handle) there's 1595 * nothing for Motion to style, measure or attach gestures to. #2777 1596 */ 1597 invariant(Boolean(instance.style), "motion.create() components must forward their ref to a HTML or SVG element", "custom-component-ref"); 1598 super.mount(instance); 1599 } 1600 readValueFromInstance(instance, key) { 1601 if (transformProps.has(key)) return this.projection?.isProjecting ? defaultTransformValue(key) : readTransformValue(instance, key); 1602 else { 1603 const computedStyle = getComputedStyle$1(instance); 1604 const value = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0; 1605 return typeof value === "string" ? value.trim() : value; 1606 } 1607 } 1608 measureInstanceViewportBox(instance, { transformPagePoint }) { 1609 return measureViewportBox(instance, transformPagePoint); 1610 } 1611 build(renderState, latestValues, props) { 1612 buildHTMLStyles(renderState, latestValues, props.transformTemplate); 1613 } 1614 scrapeMotionValuesFromProps(props, prevProps, visualElement) { 1615 return scrapeMotionValuesFromProps$1(props, prevProps, visualElement); 1616 } 1617 }; 1618 })))(); 1619} 1620//#endregion 1621//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/svg/utils/camel-case-attrs.mjs
1622var camelCaseAttributes; 1623function init_camel_case_attrs() { 1624 return (init_camel_case_attrs = __esmMin((() => { 1625 camelCaseAttributes = /* @__PURE__ */ new Set([ 1626 "baseFrequency", 1627 "diffuseConstant", 1628 "kernelMatrix", 1629 "kernelUnitLength", 1630 "keySplines", 1631 "keyTimes", 1632 "limitingConeAngle", 1633 "markerHeight", 1634 "markerWidth", 1635 "numOctaves", 1636 "targetX", 1637 "targetY", 1638 "surfaceScale", 1639 "specularConstant", 1640 "specularExponent", 1641 "stdDeviation", 1642 "tableValues", 1643 "viewBox", 1644 "gradientTransform", 1645 "pathLength", 1646 "startOffset", 1647 "textLength", 1648 "lengthAdjust" 1649 ]); 1650 })))(); 1651} 1652//#endregion 1653//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/svg/utils/is-svg-tag.mjs 1654var isSVGTag; 1655function init_is_svg_tag() { 1656 return (init_is_svg_tag = __esmMin((() => { 1657 isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg"; 1658 })))(); 1659} 1660//#endregion 1661//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/svg/utils/render.mjs
1662function renderSVG(element, renderState, _styleProp, projection) { 1663 renderHTML(element, renderState, void 0, projection); 1664 for (const key in renderState.attrs) element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]); 1665} 1666function init_render$1() { 1667 return (init_render$1 = __esmMin((() => { 1668 init_camel_case_attrs(); 1669 })))(); 1670} 1671//#endregion 1672//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.mjs 1673function scrapeMotionValuesFromProps(props, prevProps, visualElement) { 1674 const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement); 1675 for (const key in props) if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) { 1676 const targetKey = transformPropOrder.indexOf(key) !== -1 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) : key; 1677 newValues[targetKey] = props[key]; 1678 } 1679 return newValues; 1680} 1681function init_scrape_motion_values$1() { 1682 return (init_scrape_motion_values$1 = __esmMin((() => { 1683 init_is_motion_value(); 1684 init_keys_transform(); 1685 init_scrape_motion_values(); 1686 })))(); 1687} 1688//#endregion 1689//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.mjs 1690var SVGVisualElement; 1691function init_SVGVisualElement() { 1692 return (init_SVGVisualElement = __esmMin((() => { 1693 init_keys_transform(); 1694 init_defaults(); 1695 init_models(); 1696 init_DOMVisualElement(); 1697 init_build_attrs(); 1698 init_camel_case_attrs(); 1699 init_is_svg_tag(); 1700 init_render$1(); 1701 init_scrape_motion_values$1(); 1702 SVGVisualElement = class extends DOMVisualElement { 1703 constructor() { 1704 super(...arguments); 1705 this.type = "svg"; 1706 this.isSVGTag = false; 1707 this.measureInstanceViewportBox = createBox; 1708 } 1709 getBaseTargetFromProps(props, key) { 1710 return props[key]; 1711 } 1712 readValueFromInstance(instance, key) { 1713 if (transformProps.has(key)) { 1714 const defaultType = getDefaultValueType(key); 1715 return defaultType ? defaultType.default || 0 : 0; 1716 } 1717 if (cssStyleProperties.includes(key)) { 1718 const value = getComputedStyle(instance)[key]; 1719 if (typeof value === "string" && value) return value.trim(); 1720 } 1721 key = !camelCaseAttributes.has(key) ? camelToDash(key) : key; 1722 return instance.getAttribute(key); 1723 } 1724 scrapeMotionValuesFromProps(props, prevProps, visualElement) { 1725 return scrapeMotionValuesFromProps(props, prevProps, visualElement); 1726 } 1727 build(renderState, latestValues, props) { 1728 buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate, props.style); 1729 } 1730 renderInstance(instance, renderState, styleProp, projection) { 1731 renderSVG(instance, renderState, styleProp, projection); 1732 } 1733 mount(instance) { 1734 this.isSVGTag = isSVGTag(instance.tagName); 1735 super.mount(instance); 1736 } 1737 }; 1738 })))(); 1739} 1740//#endregion 1741//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/get-variant-context.mjs 1742/** 1743* Get variant context from a visual element's parent chain. 1744* Uses `any` type for visualElement to avoid circular dependencies. 1745*/ 1746function getVariantContext(visualElement) { 1747 if (!visualElement) return void 0; 1748 if (!visualElement.isControllingVariants) { 1749 const context = visualElement.parent ? getVariantContext(visualElement.parent) || {} : {}; 1750 if (visualElement.props.initial !== void 0) context.initial = visualElement.props.initial; 1751 return context; 1752 } 1753 const context = {}; 1754 for (let i = 0; i < numVariantProps; i++) { 1755 const name = variantProps[i]; 1756 const prop = visualElement.props[name]; 1757 if (isVariantLabel(prop) || prop === false) context[name] = prop; 1758 } 1759 return context; 1760} 1761var numVariantProps; 1762function init_get_variant_context() { 1763 return (init_get_variant_context = __esmMin((() => { 1764 init_variant_props(); 1765 numVariantProps = variantProps.length; 1766 })))(); 1767} 1768//#endregion 1769//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/shallow-compare.mjs 1770function shallowCompare(next, prev) { 1771 if (!Array.isArray(prev)) return false; 1772 const prevLength = prev.length; 1773 if (prevLength !== next.length) return false;
vendor: 4,436 bytes, lines 1774-1877
1774 for (let i = 0; i < prevLength; i++) if (prev[i] !== next[i]) return false; 1775 return true; 1776} 1777//#endregion 1778//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/render/utils/animation-state.mjs 1779function createAnimateFunction(visualElement) { 1780 return (animations) => { 1781 return Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options))); 1782 }; 1783} 1784function createAnimationState(visualElement) { 1785 let animate = createAnimateFunction(visualElement); 1786 let state = createState(); 1787 let isInitialRender = true; 1788 /** 1789 * Track whether the animation state has been reset (e.g. via StrictMode 1790 * double-invocation or Suspense unmount/remount). On the first 1791 * animateChanges() call after a reset we need to behave like the initial 1792 * render for variant-inheritance checks, even though isInitialRender is 1793 * already false. 1794 */ 1795 let wasReset = false; 1796 /** 1797 * This function will be used to reduce the animation definitions for 1798 * each active animation type into an object of resolved values for it. 1799 */ 1800 const buildResolvedTypeValues = (type) => (acc, definition) => { 1801 const resolved = resolveVariant(visualElement, definition, type === "exit" ? visualElement.presenceContext?.custom : void 0); 1802 if (resolved) { 1803 const { transition, transitionEnd, ...target } = resolved; 1804 acc = { 1805 ...acc, 1806 ...target, 1807 ...transitionEnd 1808 }; 1809 } 1810 return acc; 1811 }; 1812 /** 1813 * This just allows us to inject mocked animation functions 1814 * @internal 1815 */ 1816 function setAnimateFunction(makeAnimator) { 1817 animate = makeAnimator(visualElement); 1818 } 1819 /** 1820 * When we receive new props, we need to: 1821 * 1. Create a list of protected keys for each type. This is a directory of 1822 * value keys that are currently being "handled" by types of a higher priority 1823 * so that whenever an animation is played of a given type, these values are 1824 * protected from being animated. 1825 * 2. Determine if an animation type needs animating. 1826 * 3. Determine if any values have been removed from a type and figure out 1827 * what to animate those to. 1828 */ 1829 function animateChanges(changedActiveType) { 1830 const { props } = visualElement; 1831 const context = getVariantContext(visualElement.parent) || {}; 1832 /** 1833 * A list of animations that we'll build into as we iterate through the animation 1834 * types. This will get executed at the end of the function. 1835 */ 1836 const animations = []; 1837 /** 1838 * Keep track of which values have been removed. Then, as we hit lower priority 1839 * animation types, we can check if they contain removed values and animate to that. 1840 */ 1841 const removedKeys = /* @__PURE__ */ new Set(); 1842 /** 1843 * A dictionary of all encountered keys. This is an object to let us build into and 1844 * copy it without iteration. Each time we hit an animation type we set its protected 1845 * keys - the keys its not allowed to animate - to the latest version of this object. 1846 */ 1847 let encounteredKeys = {}; 1848 /** 1849 * If a variant has been removed at a given index, and this component is controlling 1850 * variant animations, we want to ensure lower-priority variants are forced to animate. 1851 */ 1852 let removedVariantIndex = Infinity; 1853 /** 1854 * Iterate through all animation types in reverse priority order. For each, we want to 1855 * detect which values it's handling and whether or not they've changed (and therefore 1856 * need to be animated). If any values have been removed, we want to detect those in 1857 * lower priority props and flag for animation. 1858 */ 1859 for (let i = 0; i < numAnimationTypes; i++) { 1860 const type = reversePriorityOrder[i]; 1861 const typeState = state[type]; 1862 const prop = props[type] !== void 0 ? props[type] : context[type]; 1863 const propIsVariant = isVariantLabel(prop); 1864 /** 1865 * If this type has *just* changed isActive status, set activeDelta 1866 * to that status. Otherwise set to null. 1867 */ 1868 const activeDelta = type === changedActiveType ? typeState.isActive : null; 1869 if (activeDelta === false) removedVariantIndex = i; 1870 /** 1871 * If this prop is an inherited variant, rather than been set directly on the 1872 * component itself, we want to make sure we allow the parent to trigger animations. 1873 * 1874 * TODO: Can probably change this to a !isControllingVariants check 1875 */ 1876 let isInherited = prop === context[type] && prop !== props[type] && propIsVariant; 1877 if (isInherited && (isInitialRender || wasReset) && visualElement.manuallyAnimateOnMount) isInherited = false;
1878 /** 1879 * Set all encountered keys so far as the protected keys for this type. This will 1880 * be any key that has been animated or otherwise handled by active, higher-priortiy types. 1881 */ 1882 typeState.protectedKeys = { ...encounteredKeys }; 1883 if (!typeState.isActive && activeDelta === null || !prop && !typeState.prevProp || isAnimationControls(prop) || typeof prop === "boolean") continue; 1884 /** 1885 * If exit is already active and wasn't just activated, skip 1886 * re-processing to prevent interrupting running exit animations. 1887 * Re-resolving exit with a changed custom value can start new 1888 * value animations that stop the originals, leaving the exit 1889 * animation promise unresolved and the component stuck in the DOM. 1890 */ 1891 if (type === "exit" && typeState.isActive && activeDelta !== true) { 1892 if (typeState.prevResolvedValues) encounteredKeys = { 1893 ...encounteredKeys, 1894 ...typeState.prevResolvedValues 1895 }; 1896 continue; 1897 } 1898 /** 1899 * As we go look through the values defined on this type, if we detect 1900 * a changed value or a value that was removed in a higher priority, we set 1901 * this to true and add this prop to the animation list. 1902 */ 1903 const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop); 1904 let shouldAnimateType = variantDidChange || type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || i > removedVariantIndex && propIsVariant; 1905 let handledRemovedValues = false; 1906 /** 1907 * As animations can be set as variant lists, variants or target objects, we 1908 * coerce everything to an array if it isn't one already 1909 */ 1910 const definitionList = Array.isArray(prop) ? prop : [prop]; 1911 /** 1912 * Build an object of all the resolved values. We'll use this in the subsequent 1913 * animateChanges calls to determine whether a value has changed. 1914 */ 1915 let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {}); 1916 if (activeDelta === false) resolvedValues = {}; 1917 /** 1918 * Now we need to loop through all the keys in the prev prop and this prop, 1919 * and decide: 1920 * 1. If the value has changed, and needs animating 1921 * 2. If it has been removed, and needs adding to the removedKeys set 1922 * 3. If it has been removed in a higher priority type and needs animating 1923 * 4. If it hasn't been removed in a higher priority but hasn't changed, and 1924 * needs adding to the type's protectedKeys list. 1925 */ 1926 const { prevResolvedValues = {} } = typeState; 1927 const allKeys = { 1928 ...prevResolvedValues, 1929 ...resolvedValues 1930 }; 1931 const markToAnimate = (key) => { 1932 shouldAnimateType = true; 1933 if (removedKeys.has(key)) { 1934 handledRemovedValues = true; 1935 removedKeys.delete(key); 1936 } 1937 typeState.needsAnimating[key] = true; 1938 const motionValue = visualElement.getValue(key); 1939 if (motionValue) motionValue.liveStyle = false; 1940 }; 1941 for (const key in allKeys) { 1942 const next = resolvedValues[key]; 1943 const prev = prevResolvedValues[key]; 1944 if (encounteredKeys.hasOwnProperty(key)) continue; 1945 /** 1946 * If the value has changed, we probably want to animate it. 1947 */ 1948 let valueHasChanged = false; 1949 if (isKeyframesTarget(next) && isKeyframesTarget(prev)) valueHasChanged = !shallowCompare(next, prev) || variantDidChange; 1950 else valueHasChanged = next !== prev; 1951 if (valueHasChanged) { 1952 if (next !== void 0 && next !== null) markToAnimate(key); 1953 else removedKeys.add(key); 1954 } else if (next !== void 0 && removedKeys.has(key)) 1955 /** 1956 * If next hasn't changed and it isn't undefined, we want to check if it's 1957 * been removed by a higher priority 1958 */ 1959 markToAnimate(key); 1960 else 1961 /** 1962 * If it hasn't changed, we add it to the list of protected values 1963 * to ensure it doesn't get animated. 1964 */ 1965 typeState.protectedKeys[key] = true; 1966 } 1967 /** 1968 * Update the typeState so next time animateChanges is called we can compare the 1969 * latest prop and resolvedValues to these. 1970 */ 1971 typeState.prevProp = prop; 1972 typeState.prevResolvedValues = resolvedValues; 1973 if (typeState.isActive) encounteredKeys = { 1974 ...encounteredKeys, 1975 ...resolvedValues 1976 }; 1977 if ((isInitialRender || wasReset) && visualElement.blockInitialAnimation) shouldAnimateType = false;
1978 /** 1979 * If this is an inherited prop we want to skip this animation 1980 * unless the inherited variants haven't changed on this render. 1981 */ 1982 const willAnimateViaParent = isInherited && variantDidChange; 1983 if (shouldAnimateType && (!willAnimateViaParent || handledRemovedValues)) animations.push(...definitionList.map((animation) => { 1984 const options = { type }; 1985 /** 1986 * If we're performing the initial animation, but we're not 1987 * rendering at the same time as the variant-controlling parent, 1988 * we want to use the parent's transition to calculate the stagger. 1989 */ 1990 if (typeof animation === "string" && (isInitialRender || wasReset) && !willAnimateViaParent && visualElement.manuallyAnimateOnMount && visualElement.parent) { 1991 const { parent } = visualElement; 1992 const parentVariant = resolveVariant(parent, animation); 1993 if (parent.enteringChildren && parentVariant) { 1994 const { delayChildren } = parentVariant.transition || {}; 1995 options.delay = calcChildStagger(parent.enteringChildren, visualElement, delayChildren); 1996 } 1997 } 1998 return { 1999 animation, 2000 options 2001 }; 2002 })); 2003 } 2004 /** 2005 * If there are some removed value that haven't been dealt with, 2006 * we need to create a new animation that falls back either to the value 2007 * defined in the style prop, or the last read value. 2008 */ 2009 if (removedKeys.size) { 2010 const fallbackAnimation = {}; 2011 /** 2012 * If the initial prop contains a transition we can use that, otherwise 2013 * allow the animation function to use the visual element's default. 2014 */ 2015 if (typeof props.initial !== "boolean") { 2016 const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial) ? props.initial[0] : props.initial); 2017 if (initialTransition && initialTransition.transition) fallbackAnimation.transition = initialTransition.transition; 2018 } 2019 removedKeys.forEach((key) => { 2020 const fallbackTarget = visualElement.getBaseTarget(key); 2021 const motionValue = visualElement.getValue(key); 2022 if (motionValue) motionValue.liveStyle = true; 2023 fallbackAnimation[key] = fallbackTarget ?? null; 2024 }); 2025 animations.push({ animation: fallbackAnimation }); 2026 } 2027 let shouldAnimate = Boolean(animations.length); 2028 if (isInitialRender && (props.initial === false || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount) shouldAnimate = false; 2029 isInitialRender = false;
2030 wasReset = false; 2031 return shouldAnimate ? animate(animations) : Promise.resolve(); 2032 } 2033 /** 2034 * Change whether a certain animation type is active. 2035 */ 2036 function setActive(type, isActive) { 2037 if (state[type].isActive === isActive) return Promise.resolve(); 2038 visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive)); 2039 state[type].isActive = isActive; 2040 const animations = animateChanges(type); 2041 for (const key in state) state[key].protectedKeys = {}; 2042 return animations; 2043 } 2044 return { 2045 animateChanges, 2046 setActive, 2047 setAnimateFunction, 2048 getState: () => state, 2049 reset: () => { 2050 state = createState(); 2051 wasReset = true; 2052 } 2053 }; 2054} 2055function checkVariantsDidChange(prev, next) { 2056 if (typeof next === "string") return next !== prev; 2057 else if (Array.isArray(next)) return !shallowCompare(next, prev); 2058 return false; 2059} 2060function createTypeState(isActive = false) { 2061 return { 2062 isActive, 2063 protectedKeys: {}, 2064 needsAnimating: {}, 2065 prevResolvedValues: {} 2066 }; 2067} 2068function createState() { 2069 return { 2070 animate: createTypeState(true), 2071 whileInView: createTypeState(), 2072 whileHover: createTypeState(), 2073 whileTap: createTypeState(), 2074 whileDrag: createTypeState(), 2075 whileFocus: createTypeState(), 2076 exit: createTypeState() 2077 }; 2078} 2079var reversePriorityOrder, numAnimationTypes; 2080function init_animation_state() { 2081 return (init_animation_state = __esmMin((() => { 2082 init_visual_element(); 2083 init_get_variant_context(); 2084 init_is_keyframes_target(); 2085 init_resolve_dynamic_variants(); 2086 init_variant_props(); 2087 reversePriorityOrder = [...variantPriorityOrder].reverse(); 2088 numAnimationTypes = variantPriorityOrder.length; 2089 })))(); 2090} 2091//#endregion 2092//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/geometry/copy.mjs 2093/** 2094* Reset an axis to the provided origin box. 2095* 2096* This is a mutative operation. 2097*/ 2098function copyAxisInto(axis, originAxis) { 2099 axis.min = originAxis.min; 2100 axis.max = originAxis.max; 2101} 2102/** 2103* Reset a box to the provided origin box. 2104* 2105* This is a mutative operation. 2106*/ 2107function copyBoxInto(box, originBox) { 2108 copyAxisInto(box.x, originBox.x); 2109 copyAxisInto(box.y, originBox.y); 2110} 2111/** 2112* Reset a delta to the provided origin box. 2113* 2114* This is a mutative operation. 2115*/ 2116function copyAxisDeltaInto(delta, originDelta) { 2117 delta.translate = originDelta.translate; 2118 delta.scale = originDelta.scale; 2119 delta.originPoint = originDelta.originPoint; 2120 delta.origin = originDelta.origin; 2121} 2122//#endregion 2123//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.mjs 2124function calcLength(axis) { 2125 return axis.max - axis.min; 2126} 2127function isNear(value, target, maxDistance) { 2128 return Math.abs(value - target) <= maxDistance; 2129} 2130function calcAxisDelta(delta, source, target, origin = .5) { 2131 delta.origin = origin; 2132 delta.originPoint = mixNumber(source.min, source.max, delta.origin); 2133 delta.scale = calcLength(target) / calcLength(source); 2134 delta.translate = mixNumber(target.min, target.max, delta.origin) - delta.originPoint; 2135 if (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX || isNaN(delta.scale)) delta.scale = 1; 2136 if (delta.translate >= TRANSLATE_MIN && delta.translate <= TRANSLATE_MAX || isNaN(delta.translate)) delta.translate = 0; 2137} 2138function calcBoxDelta(delta, source, target, origin) { 2139 calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : void 0); 2140 calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : void 0); 2141} 2142function calcRelativeAxis(target, relative, parent, anchor = 0) { 2143 target.min = (anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min) + relative.min; 2144 target.max = target.min + calcLength(relative); 2145} 2146function calcRelativeBox(target, relative, parent, anchor) { 2147 calcRelativeAxis(target.x, relative.x, parent.x, anchor?.x); 2148 calcRelativeAxis(target.y, relative.y, parent.y, anchor?.y); 2149} 2150function calcRelativeAxisPosition(target, layout, parent, anchor = 0) { 2151 const anchorPoint = anchor ? mixNumber(parent.min, parent.max, anchor) : parent.min; 2152 target.min = layout.min - anchorPoint; 2153 target.max = target.min + calcLength(layout); 2154}
2155function calcRelativePosition(target, layout, parent, anchor) { 2156 calcRelativeAxisPosition(target.x, layout.x, parent.x, anchor?.x); 2157 calcRelativeAxisPosition(target.y, layout.y, parent.y, anchor?.y); 2158} 2159var SCALE_MIN, SCALE_MAX, TRANSLATE_MIN, TRANSLATE_MAX; 2160function init_delta_calc() { 2161 return (init_delta_calc = __esmMin((() => { 2162 init_number(); 2163 SCALE_MIN = .9999; 2164 SCALE_MAX = 1.0001; 2165 TRANSLATE_MIN = -.01; 2166 TRANSLATE_MAX = .01; 2167 })))(); 2168} 2169//#endregion 2170//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.mjs 2171/** 2172* Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse 2173*/ 2174function removePointDelta(point, translate, scale, originPoint, boxScale) { 2175 point -= translate; 2176 point = scalePoint(point, 1 / scale, originPoint); 2177 if (boxScale !== void 0) point = scalePoint(point, 1 / boxScale, originPoint); 2178 return point; 2179} 2180/** 2181* Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse 2182*/ 2183function removeAxisDelta(axis, translate = 0, scale = 1, origin = .5, boxScale, originAxis = axis, sourceAxis = axis) { 2184 if (percent.test(translate)) { 2185 translate = parseFloat(translate); 2186 translate = mixNumber(sourceAxis.min, sourceAxis.max, translate / 100) - sourceAxis.min; 2187 } 2188 if (typeof translate !== "number") return; 2189 let originPoint = mixNumber(originAxis.min, originAxis.max, origin); 2190 if (axis === originAxis) originPoint -= translate; 2191 axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale); 2192 axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale); 2193} 2194/** 2195* Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse 2196* and acts as a bridge between motion values and removeAxisDelta 2197*/ 2198function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) { 2199 removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis); 2200} 2201/** 2202* Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse 2203* and acts as a bridge between motion values and removeAxisDelta 2204*/ 2205function removeBoxTransforms(box, transforms, originBox, sourceBox) { 2206 removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : void 0, sourceBox ? sourceBox.x : void 0); 2207 removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : void 0, sourceBox ? sourceBox.y : void 0); 2208} 2209var xKeys, yKeys; 2210function init_delta_remove() { 2211 return (init_delta_remove = __esmMin((() => { 2212 init_number(); 2213 init_units(); 2214 init_delta_apply(); 2215 xKeys = [ 2216 "x", 2217 "scaleX", 2218 "originX" 2219 ]; 2220 yKeys = [ 2221 "y", 2222 "scaleY", 2223 "originY" 2224 ]; 2225 })))(); 2226} 2227//#endregion 2228//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/geometry/utils.mjs 2229function isAxisDeltaZero(delta) { 2230 return delta.translate === 0 && delta.scale === 1; 2231} 2232function isDeltaZero(delta) { 2233 return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y); 2234} 2235function axisEquals(a, b) { 2236 return a.min === b.min && a.max === b.max; 2237} 2238function boxEquals(a, b) { 2239 return axisEquals(a.x, b.x) && axisEquals(a.y, b.y); 2240} 2241function axisEqualsRounded(a, b) { 2242 return Math.round(a.min) === Math.round(b.min) && Math.round(a.max) === Math.round(b.max); 2243} 2244function boxEqualsRounded(a, b) { 2245 return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y); 2246} 2247function aspectRatio(box) { 2248 return calcLength(box.x) / calcLength(box.y); 2249} 2250function axisDeltaEquals(a, b) { 2251 return a.translate === b.translate && a.scale === b.scale && a.originPoint === b.originPoint; 2252} 2253function init_utils() { 2254 return (init_utils = __esmMin((() => { 2255 init_delta_calc(); 2256 })))(); 2257} 2258//#endregion 2259//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/utils/each-axis.mjs 2260function eachAxis(callback) { 2261 return [callback("x"), callback("y")]; 2262} 2263//#endregion 2264//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/styles/transform.mjs 2265function buildProjectionTransform(delta, treeScale, latestTransform) { 2266 let transform = ""; 2267 /** 2268 * The translations we use to calculate are always relative to the viewport coordinate space. 2269 * But when we apply scales, we also scale the coordinate space of an element and its children. 2270 * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need 2271 * to move an element 100 pixels, we actually need to move it 200 in within that scaled space. 2272 */ 2273 const xTranslate = delta.x.translate / treeScale.x; 2274 const yTranslate = delta.y.translate / treeScale.y; 2275 const zTranslate = latestTransform?.z || 0; 2276 if (xTranslate || yTranslate || zTranslate) transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `; 2277 /** 2278 * Apply scale correction for the tree transform. 2279 * This will apply scale to the screen-orientated axes. 2280 */ 2281 if (treeScale.x !== 1 || treeScale.y !== 1) transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `; 2282 if (latestTransform) { 2283 const { transformPerspective, rotate, pathRotation, rotateX, rotateY, skewX, skewY } = latestTransform; 2284 if (transformPerspective) transform = `perspective(${transformPerspective}px) ${transform}`; 2285 if (rotate) transform += `rotate(${rotate}deg) `; 2286 if (pathRotation) transform += `rotate(${pathRotation}deg) `; 2287 if (rotateX) transform += `rotateX(${rotateX}deg) `; 2288 if (rotateY) transform += `rotateY(${rotateY}deg) `;
2289 if (skewX) transform += `skewX(${skewX}deg) `; 2290 if (skewY) transform += `skewY(${skewY}deg) `; 2291 } 2292 /** 2293 * Apply scale to match the size of the element to the size we want it. 2294 * This will apply scale to the element-orientated axes. 2295 */ 2296 const elementScaleX = delta.x.scale * treeScale.x; 2297 const elementScaleY = delta.y.scale * treeScale.y; 2298 if (elementScaleX !== 1 || elementScaleY !== 1) transform += `scale(${elementScaleX}, ${elementScaleY})`; 2299 return transform || "none"; 2300} 2301//#endregion 2302//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/animation/mix-values.mjs 2303function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) { 2304 if (shouldCrossfadeOpacity) { 2305 target.opacity = mixNumber(0, lead.opacity ?? 1, easeCrossfadeIn(progress)); 2306 target.opacityExit = mixNumber(follow.opacity ?? 1, 0, easeCrossfadeOut(progress)); 2307 } else if (isOnlyMember) target.opacity = mixNumber(follow.opacity ?? 1, lead.opacity ?? 1, progress); 2308 /** 2309 * Mix border radius 2310 */ 2311 for (let i = 0; i < numBorders; i++) { 2312 const borderLabel = cornerRadiusProps[i]; 2313 let followRadius = getRadius(follow, borderLabel); 2314 let leadRadius = getRadius(lead, borderLabel); 2315 if (followRadius === void 0 && leadRadius === void 0) continue; 2316 followRadius || (followRadius = 0); 2317 leadRadius || (leadRadius = 0); 2318 if (followRadius === 0 || leadRadius === 0 || isPx(followRadius) === isPx(leadRadius)) { 2319 target[borderLabel] = Math.max(mixNumber(asNumber(followRadius), asNumber(leadRadius), progress), 0); 2320 if (percent.test(leadRadius) || percent.test(followRadius)) target[borderLabel] += "%"; 2321 } else target[borderLabel] = leadRadius; 2322 } 2323 /** 2324 * Mix rotation 2325 */ 2326 if (follow.rotate || lead.rotate) target.rotate = mixNumber(follow.rotate || 0, lead.rotate || 0, progress); 2327} 2328function getRadius(values, radiusName) { 2329 return values[radiusName] !== void 0 ? values[radiusName] : values.borderRadius; 2330} 2331function compress(min, max, easing) { 2332 return (p) => { 2333 if (p < min) return 0; 2334 if (p > max) return 1; 2335 return easing(progress(min, max, p)); 2336 }; 2337} 2338var numBorders, asNumber, isPx, easeCrossfadeIn, easeCrossfadeOut; 2339function init_mix_values() { 2340 return (init_mix_values = __esmMin((() => { 2341 init_number(); 2342 init_units(); 2343 init_progress(), init_circ(), init_noop(); 2344 init_border_radius(); 2345 numBorders = cornerRadiusProps.length; 2346 asNumber = (value) => typeof value === "string" ? parseFloat(value) : value; 2347 isPx = (value) => typeof value === "number" || px.test(value); 2348 easeCrossfadeIn = /*@__PURE__*/ compress(0, .5, circOut); 2349 easeCrossfadeOut = /*@__PURE__*/ compress(.5, .95, noop); 2350 })))(); 2351} 2352//#endregion 2353//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/events/add-dom-event.mjs 2354function addDomEvent(target, eventName, handler, options = { passive: true }) { 2355 target.addEventListener(eventName, handler, options); 2356 return () => target.removeEventListener(eventName, handler, options); 2357} 2358//#endregion 2359//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/utils/compare-by-depth.mjs 2360var compareByDepth; 2361function init_compare_by_depth() { 2362 return (init_compare_by_depth = __esmMin((() => { 2363 compareByDepth = (a, b) => a.depth - b.depth; 2364 })))(); 2365} 2366//#endregion 2367//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/utils/flat-tree.mjs 2368var FlatTree; 2369function init_flat_tree() { 2370 return (init_flat_tree = __esmMin((() => { 2371 init_compare_by_depth(); 2372 FlatTree = class { 2373 constructor() { 2374 this.children = []; 2375 this.isDirty = false; 2376 } 2377 add(child) { 2378 addUniqueItem(this.children, child); 2379 this.isDirty = true; 2380 } 2381 remove(child) { 2382 removeItem(this.children, child); 2383 this.isDirty = true; 2384 } 2385 forEach(callback) { 2386 this.isDirty && this.children.sort(compareByDepth); 2387 this.isDirty = false; 2388 this.children.forEach(callback); 2389 } 2390 }; 2391 })))(); 2392} 2393//#endregion 2394//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/utils/delay.mjs 2395/** 2396* Timeout defined in ms 2397*/ 2398function delay(callback, timeout) { 2399 const start = time.now(); 2400 const checkElapsed = ({ timestamp }) => {
2401 const elapsed = timestamp - start; 2402 if (elapsed >= timeout) { 2403 cancelFrame(checkElapsed); 2404 callback(elapsed - timeout); 2405 } 2406 }; 2407 frame.setup(checkElapsed, true); 2408 return () => cancelFrame(checkElapsed); 2409} 2410function init_delay() { 2411 return (init_delay = __esmMin((() => { 2412 init_sync_time(); 2413 init_frame(); 2414 })))(); 2415} 2416//#endregion 2417//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.mjs 2418/** 2419* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself 2420*/ 2421function resolveMotionValue(value) { 2422 return isMotionValue(value) ? value.get() : value; 2423} 2424function init_resolve_motion_value() { 2425 return (init_resolve_motion_value = __esmMin((() => { 2426 init_is_motion_value(); 2427 })))(); 2428} 2429//#endregion 2430//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/shared/stack.mjs 2431var NodeStack; 2432function init_stack() { 2433 return (init_stack = __esmMin((() => { 2434 NodeStack = class { 2435 constructor() { 2436 this.members = []; 2437 } 2438 add(node) { 2439 addUniqueItem(this.members, node); 2440 for (let i = this.members.length - 1; i >= 0; i--) { 2441 const member = this.members[i]; 2442 if (member === node || member === this.lead || member === this.prevLead) continue; 2443 const inst = member.instance; 2444 if ((!inst || inst.isConnected === false) && !member.snapshot) { 2445 removeItem(this.members, member); 2446 member.unmount(); 2447 } 2448 } 2449 node.scheduleRender(); 2450 } 2451 remove(node) { 2452 removeItem(this.members, node); 2453 if (node === this.prevLead) this.prevLead = void 0; 2454 if (node === this.lead) { 2455 const prevLead = this.members[this.members.length - 1]; 2456 if (prevLead) this.promote(prevLead); 2457 } 2458 } 2459 relegate(node) { 2460 for (let i = this.members.indexOf(node) - 1; i >= 0; i--) { 2461 const member = this.members[i]; 2462 if (member.isPresent !== false && member.instance?.isConnected !== false) { 2463 this.promote(member); 2464 return true; 2465 } 2466 } 2467 return false; 2468 } 2469 promote(node, preserveFollowOpacity) { 2470 const prevLead = this.lead; 2471 if (node === prevLead) return; 2472 this.prevLead = prevLead; 2473 this.lead = node; 2474 node.show(); 2475 if (prevLead) { 2476 prevLead.updateSnapshot(); 2477 node.scheduleRender(); 2478 const { layoutDependency: prevDep } = prevLead.options; 2479 const { layoutDependency: nextDep } = node.options; 2480 if (prevDep === void 0 || prevDep !== nextDep) { 2481 node.resumeFrom = prevLead; 2482 if (preserveFollowOpacity) prevLead.preserveOpacity = true; 2483 if (prevLead.snapshot) { 2484 node.snapshot = prevLead.snapshot; 2485 node.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues; 2486 } 2487 if (node.root?.isUpdating) node.isLayoutDirty = true; 2488 } 2489 if (node.options.crossfade === false) prevLead.hide(); 2490 } 2491 } 2492 exitAnimationComplete() { 2493 this.members.forEach((member) => { 2494 member.options.onExitComplete?.(); 2495 member.resumingFrom?.options.onExitComplete?.(); 2496 }); 2497 } 2498 scheduleRender() { 2499 this.members.forEach((member) => member.instance && member.scheduleRender(false)); 2500 } 2501 removeLeadSnapshot() { 2502 if (this.lead?.snapshot) this.lead.snapshot = void 0; 2503 } 2504 }; 2505 })))(); 2506} 2507//#endregion 2508//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/node/state.mjs 2509var globalProjectionState; 2510function init_state$2() { 2511 return (init_state$2 = __esmMin((() => { 2512 globalProjectionState = { 2513 /** 2514 * Global flag as to whether the tree has animated since the last time 2515 * we resized the window 2516 */ 2517 hasAnimatedSinceResize: true, 2518 /** 2519 * We set this to true once, on the first update. Any nodes added to the tree beyond that 2520 * update will be given a `data-projection-id` attribute. 2521 */ 2522 hasEverUpdated: false 2523 }; 2524 })))(); 2525} 2526//#endregion 2527//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/node/create-projection-node.mjs 2528function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) { 2529 const { latestValues } = visualElement; 2530 if (latestValues[key]) { 2531 values[key] = latestValues[key]; 2532 visualElement.setStaticValue(key, 0); 2533 if (sharedAnimationValues) sharedAnimationValues[key] = 0; 2534 } 2535} 2536function cancelTreeOptimisedTransformAnimations(projectionNode) { 2537 projectionNode.hasCheckedOptimisedAppear = true; 2538 if (projectionNode.root === projectionNode) return; 2539 const { visualElement } = projectionNode.options; 2540 if (!visualElement) return; 2541 const appearId = getOptimisedAppearId(visualElement); 2542 if (window.MotionHasOptimisedAnimation(appearId, "transform")) { 2543 const { layout, layoutId } = projectionNode.options; 2544 window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId)); 2545 } 2546 const { parent } = projectionNode; 2547 if (parent && !parent.hasCheckedOptimisedAppear) cancelTreeOptimisedTransformAnimations(parent); 2548} 2549function createProjectionNode$1({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) { 2550 return class ProjectionNode { 2551 constructor(latestValues = {}, parent = defaultParent?.()) { 2552 /** 2553 * A unique ID generated for every projection node. 2554 */ 2555 this.id = id$1++; 2556 /** 2557 * An id that represents a unique session instigated by startUpd
vendor: 4,078 bytes, lines 2557-2670
2557ate. 2558 */ 2559 this.animationId = 0; 2560 this.animationCommitId = 0; 2561 /** 2562 * A Set containing all this component's children. This is used to iterate 2563 * through the children. 2564 * 2565 * TODO: This could be faster to iterate as a flat array stored on the root node. 2566 */ 2567 this.children = /* @__PURE__ */ new Set(); 2568 /** 2569 * Options for the node. We use this to configure what kind of layout animations 2570 * we should perform (if any). 2571 */ 2572 this.options = {}; 2573 /** 2574 * We use this to detect when its safe to shut down part of a projection tree. 2575 * We have to keep projecting children for scale correction and relative projection 2576 * until all their parents stop performing layout animations. 2577 */ 2578 this.isTreeAnimating = false; 2579 this.isAnimationBlocked = false; 2580 /** 2581 * Flag to true if we think this layout has been changed. We can't always know this, 2582 * currently we set it to true every time a component renders, or if it has a layoutDependency 2583 * if that has changed between renders. Additionally, components can be grouped by LayoutGroup 2584 * and if one node is dirtied, they all are. 2585 */ 2586 this.isLayoutDirty = false; 2587 /** 2588 * Flag to true if we think the projection calculations for this node needs 2589 * recalculating as a result of an updated transform or layout animation. 2590 */ 2591 this.isProjectionDirty = false; 2592 /** 2593 * Flag to true if the layout *or* transform has changed. This then gets propagated 2594 * throughout the projection tree, forcing any element below to recalculate on the next frame. 2595 */ 2596 this.isSharedProjectionDirty = false; 2597 /** 2598 * Flag transform dirty. This gets propagated throughout the whole tree but is only 2599 * respected by shared nodes. 2600 */ 2601 this.isTransformDirty = false; 2602 /** 2603 * Block layout updates for instant layout transitions throughout the tree. 2604 */ 2605 this.updateManuallyBlocked = false; 2606 this.updateBlockedByResize = false; 2607 /** 2608 * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate` 2609 * call. 2610 */ 2611 this.isUpdating = false; 2612 /** 2613 * If this is an SVG element we currently disable projection transforms 2614 */ 2615 this.isSVG = false; 2616 /** 2617 * Flag to true (during promotion) if a node doing an instant layout transition needs to reset 2618 * its projection styles. 2619 */ 2620 this.needsReset = false; 2621 /** 2622 * Flags whether this node should have its transform reset prior to measuring. 2623 */ 2624 this.shouldResetTransform = false; 2625 /** 2626 * Store whether this node has been checked for optimised appear animations. As 2627 * effects fire bottom-up, and we want to look up the tree for appear animations, 2628 * this makes sure we only check each path once, stopping at nodes that 2629 * have already been checked. 2630 */ 2631 this.hasCheckedOptimisedAppear = false; 2632 /** 2633 * An object representing the calculated contextual/accumulated/tree scale. 2634 * This will be used to scale calculcated projection transforms, as these are 2635 * calculated in screen-space but need to be scaled for elements to layoutly 2636 * make it to their calculated destinations. 2637 * 2638 * TODO: Lazy-init 2639 */ 2640 this.treeScale = { 2641 x: 1, 2642 y: 1 2643 }; 2644 /** 2645 * 2646 */ 2647 this.eventHandlers = /* @__PURE__ */ new Map(); 2648 this.hasTreeAnimated = false; 2649 this.layoutVersion = 0; 2650 this.updateScheduled = false; 2651 this.scheduleUpdate = () => this.update(); 2652 this.projectionUpdateScheduled = false; 2653 this.checkUpdateFailed = () => { 2654 if (this.isUpdating) { 2655 this.isUpdating = false; 2656 this.clearAllSnapshots(); 2657 } 2658 }; 2659 /** 2660 * This is a multi-step process as shared nodes might be of different depths. Nodes 2661 * are sorted by depth order, so we need to resolve the entire tree before moving to 2662 * the next step. 2663 */ 2664 this.updateProjection = () => { 2665 this.projectionUpdateScheduled = false; 2666 /** 2667 * Reset debug counts. Manually resetting rather than creating a new 2668 * object each frame. 2669 */ 2670 if (statsBuffer.value) metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0;
2671 this.nodes.forEach(propagateDirtyNodes); 2672 this.nodes.forEach(resolveTargetDelta); 2673 this.nodes.forEach(calcProjection); 2674 this.nodes.forEach(cleanDirtyNodes); 2675 if (statsBuffer.addProjectionMetrics) statsBuffer.addProjectionMetrics(metrics); 2676 }; 2677 /** 2678 * Frame calculations 2679 */ 2680 this.resolvedRelativeTargetAt = 0; 2681 this.linkedParentVersion = 0; 2682 this.hasProjected = false; 2683 this.isVisible = true; 2684 this.animationProgress = 0; 2685 /** 2686 * Shared layout 2687 */ 2688 this.sharedNodes = /* @__PURE__ */ new Map(); 2689 this.latestValues = latestValues; 2690 this.root = parent ? parent.root || parent : this; 2691 this.path = parent ? [...parent.path, parent] : []; 2692 this.parent = parent; 2693 this.depth = parent ? parent.depth + 1 : 0; 2694 for (let i = 0; i < this.path.length; i++) this.path[i].shouldResetTransform = true; 2695 if (this.root === this) this.nodes = new FlatTree(); 2696 } 2697 addEventListener(name, handler) { 2698 if (!this.eventHandlers.has(name)) this.eventHandlers.set(name, new SubscriptionManager()); 2699 return this.eventHandlers.get(name).add(handler); 2700 } 2701 notifyListeners(name, ...args) { 2702 const subscriptionManager = this.eventHandlers.get(name); 2703 subscriptionManager && subscriptionManager.notify(...args); 2704 } 2705 hasListeners(name) { 2706 return this.eventHandlers.has(name); 2707 } 2708 /** 2709 * Lifecycles 2710 */ 2711 mount(instance) { 2712 if (this.instance) return; 2713 this.isSVG = isSVGElement(instance) && !isSVGSVGElement(instance); 2714 this.instance = instance; 2715 const { layoutId, layout, visualElement } = this.options; 2716 if (visualElement && !visualElement.current) visualElement.mount(instance); 2717 this.root.nodes.add(this); 2718 this.parent && this.parent.children.add(this); 2719 if (this.root.hasTreeAnimated && (layout || layoutId)) this.isLayoutDirty = true; 2720 if (attachResizeListener) { 2721 let cancelDelay; 2722 let innerWidth = 0; 2723 const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false; 2724 frame.read(() => { 2725 innerWidth = window.innerWidth; 2726 }); 2727 attachResizeListener(instance, () => { 2728 const newInnerWidth = window.innerWidth; 2729 if (newInnerWidth === innerWidth) return; 2730 innerWidth = newInnerWidth; 2731 this.root.updateBlockedByResize = true; 2732 cancelDelay && cancelDelay(); 2733 cancelDelay = delay(resizeUnblockUpdate, 250); 2734 if (globalProjectionState.hasAnimatedSinceResize) { 2735 globalProjectionState.hasAnimatedSinceResize = false; 2736 this.nodes.forEach(finishAnimation); 2737 } 2738 }); 2739 } 2740 if (layoutId) this.root.registerSharedNode(layoutId, this); 2741 if (this.options.animate !== false && visualElement && (layoutId || layout)) this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeLayoutChanged, layout: newLayout }) => { 2742 if (this.isTreeAnimationBlocked()) { 2743 this.target = void 0; 2744 this.relativeTarget = void 0; 2745 return; 2746 } 2747 const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition; 2748 const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps(); 2749 /** 2750 * The target layout of the element might stay the same, 2751 * but its position relative to its parent has changed. 2752 */ 2753 const hasTargetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout); 2754 /** 2755 * If the layout hasn't seemed to have changed, it might be that the 2756 * element is visually in the same place in the document but its position 2757 * relative to its parent has indeed changed. So here we check for that. 2758 */ 2759 const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeLayoutChanged; 2760 if (this.options.layoutRoot || this.resumeFrom || hasOnlyRelativeTargetChanged || hasLayoutChanged && (hasTargetChanged || !this.currentAnimation)) { 2761 if (this.resumeFrom) { 2762 this.resumingFrom = this.resumeFrom; 2763 this.resumingFrom.resumingFrom = void 0; 2764 } 2765 const animationOptions = { 2766 ...getValueTransition(layoutTransition, "layout"), 2767 onPlay: onLayoutAnimationStart, 2768 onComplete: onLayoutAnimationComplete 2769 }; 2770 if (visualElement.shouldReduceMotion || this.options.layoutRoot) { 2771 animationOptions.delay = 0; 2772 animationOptions.type = false;
2773 } 2774 this.startAnimation(animationOptions); 2775 /** 2776 * Set animation origin after starting animation to avoid layout jump 2777 * caused by stopping previous layout animation 2778 */ 2779 this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged, animationOptions.path); 2780 } else { 2781 /** 2782 * If the layout hasn't changed and we have an animation that hasn't started yet, 2783 * finish it immediately. Otherwise it will be animating from a location 2784 * that was probably never committed to screen and look like a jumpy box. 2785 */ 2786 if (!hasLayoutChanged) finishAnimation(this); 2787 if (this.isLead() && this.options.onExitComplete) this.options.onExitComplete(); 2788 } 2789 this.targetLayout = newLayout; 2790 }); 2791 } 2792 unmount() { 2793 this.options.layoutId && this.willUpdate(); 2794 this.root.nodes.remove(this); 2795 const stack = this.getStack(); 2796 stack && stack.remove(this); 2797 this.parent && this.parent.children.delete(this); 2798 this.instance = void 0; 2799 this.eventHandlers.clear(); 2800 cancelFrame(this.updateProjection); 2801 } 2802 blockUpdate() { 2803 this.updateManuallyBlocked = true; 2804 } 2805 unblockUpdate() { 2806 this.updateManuallyBlocked = false; 2807 } 2808 isUpdateBlocked() { 2809 return this.updateManuallyBlocked || this.updateBlockedByResize; 2810 } 2811 isTreeAnimationBlocked() { 2812 return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false; 2813 } 2814 startUpdate() { 2815 if (this.isUpdateBlocked()) return; 2816 this.isUpdating = true; 2817 this.nodes && this.nodes.forEach(resetSkewAndRotation); 2818 this.animationId++; 2819 } 2820 getTransformTemplate() { 2821 const { visualElement } = this.options; 2822 return visualElement && visualElement.getProps().transformTemplate; 2823 } 2824 willUpdate(shouldNotifyListeners = true) { 2825 this.root.hasTreeAnimated = true; 2826 if (this.root.isUpdateBlocked()) { 2827 this.options.onExitComplete && this.options.onExitComplete(); 2828 return; 2829 } 2830 /** 2831 * If we're running optimised appear animations then these must be 2832 * cancelled before measuring the DOM. This is so we can measure 2833 * the true layout of the element rather than the WAAPI animation 2834 * which will be unaffected by the resetSkewAndRotate step. 2835 * 2836 * Note: This is a DOM write. Worst case scenario is this is sandwiched 2837 * between other snapshot reads which will cause unnecessary style recalculations. 2838 * This has to happen here though, as we don't yet know which nodes will need 2839 * snapshots in startUpdate(), but we only want to cancel optimised animations 2840 * if a layout animation measurement is actually going to be affected by them. 2841 */ 2842 if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) cancelTreeOptimisedTransformAnimations(this); 2843 !this.root.isUpdating && this.root.startUpdate(); 2844 if (this.isLayoutDirty) return; 2845 this.isLayoutDirty = true; 2846 for (let i = 0; i < this.path.length; i++) { 2847 const node = this.path[i]; 2848 node.shouldResetTransform = true; 2849 /** 2850 * Percentage translates resolve against layoutBox dimensions, 2851 * so ancestors with them must be re-measured after transform reset. 2852 */ 2853 if (typeof node.latestValues.x === "string" || typeof node.latestValues.y === "string") node.isLayoutDirty = true; 2854 node.updateScroll("snapshot"); 2855 if (node.options.layoutRoot) node.willUpdate(false); 2856 } 2857 const { layoutId, layout } = this.options; 2858 if (layoutId === void 0 && !layout) return; 2859 const transformTemplate = this.getTransformTemplate(); 2860 this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0; 2861 this.updateSnapshot(); 2862 shouldNotifyListeners && this.notifyListeners("willUpdate"); 2863 } 2864 update() { 2865 this.updateScheduled = false; 2866 if (this.isUpdateBlocked()) { 2867 const wasBlockedByResize = this.updateBlockedByResize; 2868 this.unblockUpdate(); 2869 this.updateBlockedByResize = false; 2870 this.clearAllSnapshots(); 2871 /** 2872 * When blocked by resize, still measure layouts so 2873 * callbacks like onLayoutMeasure fire (e.g. Reorder). 2874 * Skip notifyLayoutUpdate to prevent animations. 2875 */
2876 if (wasBlockedByResize) this.nodes.forEach(forceLayoutMeasure); 2877 this.nodes.forEach(clearMeasurements); 2878 return; 2879 } 2880 /** 2881 * If this is a repeat of didUpdate then ignore the animation. 2882 */ 2883 if (this.animationId <= this.animationCommitId) { 2884 this.nodes.forEach(clearIsLayoutDirty); 2885 return; 2886 } 2887 this.animationCommitId = this.animationId; 2888 if (!this.isUpdating) this.nodes.forEach(clearIsLayoutDirty); 2889 else { 2890 this.isUpdating = false; 2891 /** 2892 * Ensure animation-blocked nodes (e.g. during drag) 2893 * get measured even when memoized (willUpdate skipped). 2894 */ 2895 this.nodes.forEach(ensureDraggedNodesSnapshotted); 2896 /** 2897 * Write 2898 */ 2899 this.nodes.forEach(resetTransformStyle); 2900 /** 2901 * Read ================== 2902 */ 2903 this.nodes.forEach(updateLayout); 2904 /** 2905 * Write 2906 */ 2907 this.nodes.forEach(notifyLayoutUpdate); 2908 } 2909 this.clearAllSnapshots(); 2910 /** 2911 * Manually flush any pending updates. Ideally 2912 * we could leave this to the following requestAnimationFrame but this seems 2913 * to leave a flash of incorrectly styled content. 2914 */ 2915 const now = time.now(); 2916 frameData.delta = clamp(0, 1e3 / 60, now - frameData.timestamp); 2917 frameData.timestamp = now; 2918 frameData.isProcessing = true; 2919 frameSteps.update.process(frameData); 2920 frameSteps.preRender.process(frameData); 2921 frameSteps.render.process(frameData); 2922 frameData.isProcessing = false; 2923 } 2924 didUpdate() { 2925 if (!this.updateScheduled) { 2926 this.updateScheduled = true; 2927 microtask.read(this.scheduleUpdate); 2928 } 2929 } 2930 clearAllSnapshots() { 2931 this.nodes.forEach(clearSnapshot); 2932 this.sharedNodes.forEach(removeLeadSnapshots); 2933 } 2934 scheduleUpdateProjection() { 2935 if (!this.projectionUpdateScheduled) { 2936 this.projectionUpdateScheduled = true; 2937 frame.preRender(this.updateProjection, false, true); 2938 } 2939 } 2940 scheduleCheckAfterUnmount() { 2941 /** 2942 * If the unmounting node is in a layoutGroup and did trigger a willUpdate, 2943 * we manually call didUpdate to give a chance to the siblings to animate. 2944 * Otherwise, cleanup all snapshots to prevents future nodes from reusing them. 2945 */ 2946 frame.postRender(() => { 2947 if (this.isLayoutDirty) this.root.didUpdate(); 2948 else this.root.checkUpdateFailed(); 2949 }); 2950 } 2951 /** 2952 * Update measurements 2953 */ 2954 updateSnapshot() { 2955 if (this.snapshot || !this.instance) return; 2956 this.snapshot = this.measure(); 2957 if (this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y)) this.snapshot = void 0; 2958 } 2959 updateLayout() { 2960 if (!this.instance) return; 2961 this.updateScroll(); 2962 if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) return; 2963 /** 2964 * When a node is mounted, it simply resumes from the prevLead's 2965 * snapshot instead of taking a new one, but the ancestors scroll 2966 * might have updated while the prevLead is unmounted. We need to 2967 * update the scroll again to make sure the layout we measure is 2968 * up to date. 2969 */ 2970 if (this.resumeFrom && !this.resumeFrom.instance) for (let i = 0; i < this.path.length; i++) this.path[i].updateScroll(); 2971 const prevLayout = this.layout; 2972 this.layout = this.measure(false); 2973 this.layoutVersion++; 2974 if (!this.layoutCorrected) this.layoutCorrected = createBox(); 2975 this.isLayoutDirty = false; 2976 this.projectionDelta = void 0; 2977 this.notifyListeners("measure", this.layout.layoutBox); 2978 const { visualElement } = this.options; 2979 visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0); 2980 } 2981 updateScroll(phase = "measure") { 2982 let needsMeasurement = Boolean(this.options.layoutScroll && this.instance); 2983 if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) needsMeasurement = false; 2984 if (needsMeasurement && this.instance) { 2985 const isRoot = checkIsScrollRoot(this.instance); 2986 this.scroll = { 2987 animationId: this.root.animationId, 2988 phase, 2989 isRoot, 2990 offset: measureScroll(this.instance), 2991 wasRoot: this.scroll ? this.scroll.isRoot : isRoot 2992 }; 2993 } 2994 } 2995 resetTransform() { 2996 if (!resetTransform) return; 2997 const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
2998 const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta); 2999 const transformTemplate = this.getTransformTemplate(); 3000 const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0; 3001 const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue; 3002 if (isResetRequested && this.instance && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) { 3003 resetTransform(this.instance, transformTemplateValue); 3004 this.shouldResetTransform = false; 3005 this.scheduleRender(); 3006 } 3007 } 3008 measure(removeTransform = true) { 3009 const pageBox = this.measurePageBox(); 3010 let layoutBox = this.removeElementScroll(pageBox); 3011 /** 3012 * Measurements taken during the pre-render stage 3013 * still have transforms applied so we remove them 3014 * via calculation. 3015 */ 3016 if (removeTransform) layoutBox = this.removeTransform(layoutBox); 3017 roundBox(layoutBox); 3018 return { 3019 animationId: this.root.animationId, 3020 measuredBox: pageBox, 3021 layoutBox, 3022 latestValues: {}, 3023 source: this.id 3024 }; 3025 } 3026 measurePageBox() { 3027 const { visualElement } = this.options; 3028 if (!visualElement) return createBox(); 3029 const box = visualElement.measureViewportBox(); 3030 if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) { 3031 const { scroll } = this.root; 3032 if (scroll) { 3033 translateAxis(box.x, scroll.offset.x); 3034 translateAxis(box.y, scroll.offset.y); 3035 } 3036 } 3037 return box; 3038 } 3039 removeElementScroll(box) { 3040 const boxWithoutScroll = createBox(); 3041 copyBoxInto(boxWithoutScroll, box); 3042 if (this.scroll?.wasRoot) return boxWithoutScroll; 3043 /** 3044 * Performance TODO: Keep a cumulative scroll offset down the tree 3045 * rather than loop back up the path. 3046 */ 3047 for (let i = 0; i < this.path.length; i++) { 3048 const node = this.path[i]; 3049 const { scroll, options } = node; 3050 if (node !== this.root && scroll && options.layoutScroll) { 3051 /** 3052 * If this is a new scroll root, we want to remove all previous scrolls 3053 * from the viewport box. 3054 */ 3055 if (scroll.wasRoot) copyBoxInto(boxWithoutScroll, box); 3056 translateAxis(boxWithoutScroll.x, scroll.offset.x); 3057 translateAxis(boxWithoutScroll.y, scroll.offset.y); 3058 } 3059 } 3060 return boxWithoutScroll; 3061 } 3062 applyTransform(box, transformOnly = false, output) { 3063 const withTransforms = output || createBox(); 3064 copyBoxInto(withTransforms, box); 3065 for (let i = 0; i < this.path.length; i++) { 3066 const node = this.path[i]; 3067 if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) { 3068 translateAxis(withTransforms.x, -node.scroll.offset.x); 3069 translateAxis(withTransforms.y, -node.scroll.offset.y); 3070 } 3071 if (!hasTransform(node.latestValues)) continue; 3072 transformBox(withTransforms, node.latestValues, node.layout?.layoutBox); 3073 } 3074 if (hasTransform(this.latestValues)) transformBox(withTransforms, this.latestValues, this.layout?.layoutBox); 3075 return withTransforms; 3076 } 3077 removeTransform(box) { 3078 const boxWithoutTransform = createBox(); 3079 copyBoxInto(boxWithoutTransform, box); 3080 for (let i = 0; i < this.path.length; i++) { 3081 const node = this.path[i]; 3082 if (!hasTransform(node.latestValues)) continue; 3083 let sourceBox; 3084 if (node.instance) { 3085 hasScale(node.latestValues) && node.updateSnapshot(); 3086 sourceBox = createBox(); 3087 copyBoxInto(sourceBox, node.measurePageBox()); 3088 } 3089 removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot?.layoutBox, sourceBox); 3090 } 3091 if (hasTransform(this.latestValues)) removeBoxTransforms(boxWithoutTransform, this.latestValues); 3092 return boxWithoutTransform; 3093 } 3094 setTargetDelta(delta) { 3095 this.targetDelta = delta; 3096 this.root.scheduleUpdateProjection(); 3097 this.isProjectionDirty = true; 3098 } 3099 setOptions(options) { 3100 this.options = { 3101 ...this.options, 3102 ...options, 3103 crossfade: options.crossfade !== void 0 ? options.crossfade : true 3104 }; 3105 } 3106 clearMeasurements() { 3107 this.scroll = void 0; 3108 this.layout = void 0; 3109 this.snapshot = void 0; 3110 this.prevTransformTemplateValue = void 0; 3111 this.targetDelta = void 0; 3112 this.target = void 0; 3113 this.isLayoutDirty = false;
3114 } 3115 forceRelativeParentToResolveTarget() { 3116 if (!this.relativeParent) return; 3117 /** 3118 * If the parent target isn't up-to-date, force it to update. 3119 * This is an unfortunate de-optimisation as it means any updating relative 3120 * projection will cause all the relative parents to recalculate back 3121 * up the tree. 3122 */ 3123 if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) this.relativeParent.resolveTargetDelta(true); 3124 } 3125 resolveTargetDelta(forceRecalculation = false) { 3126 /** 3127 * Once the dirty status of nodes has been spread through the tree, we also 3128 * need to check if we have a shared node of a different depth that has itself 3129 * been dirtied. 3130 */ 3131 const lead = this.getLead(); 3132 this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty); 3133 this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty); 3134 this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty); 3135 const isShared = Boolean(this.resumingFrom) || this !== lead; 3136 if (!(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return; 3137 const { layout, layoutId } = this.options; 3138 /** 3139 * If we have no layout, we can't perform projection, so early return 3140 */ 3141 if (!this.layout || !(layout || layoutId)) return; 3142 this.resolvedRelativeTargetAt = frameData.timestamp; 3143 const relativeParent = this.getClosestProjectingParent(); 3144 if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) this.removeRelativeTarget(); 3145 /** 3146 * If we don't have a targetDelta but do have a layout, we can attempt to resolve 3147 * a relativeParent. This will allow a component to perform scale correction 3148 * even if no animation has started. 3149 */ 3150 if (!this.targetDelta && !this.relativeTarget) { 3151 if (this.options.layoutAnchor !== false && relativeParent && relativeParent.layout) this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox); 3152 else this.removeRelativeTarget(); 3153 } 3154 /** 3155 * If we have no relative target or no target delta our target isn't valid 3156 * for this frame. 3157 */ 3158 if (!this.relativeTarget && !this.targetDelta) return; 3159 /** 3160 * Lazy-init target data structure 3161 */ 3162 if (!this.target) { 3163 this.target = createBox(); 3164 this.targetWithTransforms = createBox(); 3165 } 3166 /** 3167 * If we've got a relative box for this component, resolve it into a target relative to the parent. 3168 */ 3169 if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) { 3170 this.forceRelativeParentToResolveTarget(); 3171 calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0); 3172 } else if (this.targetDelta) { 3173 if (Boolean(this.resumingFrom)) this.applyTransform(this.layout.layoutBox, false, this.target); 3174 else copyBoxInto(this.target, this.layout.layoutBox); 3175 applyBoxDelta(this.target, this.targetDelta); 3176 } else 3177 /** 3178 * If no target, use own layout as target 3179 */ 3180 copyBoxInto(this.target, this.layout.layoutBox); 3181 /** 3182 * If we've been told to attempt to resolve a relative target, do so. 3183 */ 3184 if (this.attemptToResolveRelativeTarget) { 3185 this.attemptToResolveRelativeTarget = false;
3186 if (this.options.layoutAnchor !== false && relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) this.createRelativeTarget(relativeParent, this.target, relativeParent.target); 3187 else this.relativeParent = this.relativeTarget = void 0; 3188 } 3189 /** 3190 * Increase debug counter for resolved target deltas 3191 */ 3192 if (statsBuffer.value) metrics.calculatedTargetDeltas++; 3193 } 3194 getClosestProjectingParent() { 3195 if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) return; 3196 if (this.parent.isProjecting()) return this.parent; 3197 else return this.parent.getClosestProjectingParent(); 3198 } 3199 isProjecting() { 3200 return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout); 3201 } 3202 createRelativeTarget(relativeParent, layout, parentLayout) { 3203 this.relativeParent = relativeParent; 3204 this.linkedParentVersion = relativeParent.layoutVersion; 3205 this.forceRelativeParentToResolveTarget(); 3206 this.relativeTarget = createBox(); 3207 this.relativeTargetOrigin = createBox(); 3208 calcRelativePosition(this.relativeTargetOrigin, layout, parentLayout, this.options.layoutAnchor || void 0); 3209 copyBoxInto(this.relativeTarget, this.relativeTargetOrigin); 3210 } 3211 removeRelativeTarget() { 3212 this.relativeParent = this.relativeTarget = void 0; 3213 } 3214 calcProjection() { 3215 const lead = this.getLead(); 3216 const isShared = Boolean(this.resumingFrom) || this !== lead; 3217 let canSkip = true; 3218 /** 3219 * If this is a normal layout animation and neither this node nor its nearest projecting 3220 * is dirty then we can't skip. 3221 */ 3222 if (this.isProjectionDirty || this.parent?.isProjectionDirty) canSkip = false; 3223 /** 3224 * If this is a shared layout animation and this node's shared projection is dirty then 3225 * we can't skip. 3226 */ 3227 if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) canSkip = false; 3228 /** 3229 * If we have resolved the target this frame we must recalculate the 3230 * projection to ensure it visually represents the internal calculations. 3231 */ 3232 if (this.resolvedRelativeTargetAt === frameData.timestamp) canSkip = false; 3233 if (canSkip) return; 3234 const { layout, layoutId } = this.options; 3235 /** 3236 * If this section of the tree isn't animating we can 3237 * delete our target sources for the following frame. 3238 */ 3239 this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation); 3240 if (!this.isTreeAnimating) this.targetDelta = this.relativeTarget = void 0; 3241 if (!this.layout || !(layout || layoutId)) return; 3242 /** 3243 * Reset the corrected box with the latest values from box, as we're then going 3244 * to perform mutative operations on it. 3245 */ 3246 copyBoxInto(this.layoutCorrected, this.layout.layoutBox); 3247 /** 3248 * Record previous tree scales before updating. 3249 */ 3250 const prevTreeScaleX = this.treeScale.x; 3251 const prevTreeScaleY = this.treeScale.y; 3252 /** 3253 * Apply all the parent deltas to this box to produce the corrected box. This 3254 * is the layout box, as it will appear on screen as a result of the transforms of its parents. 3255 */ 3256 applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared); 3257 /** 3258 * If this layer needs to perform scale correction but doesn't have a target, 3259 * use the layout as the target. 3260 */ 3261 if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) { 3262 lead.target = lead.layout.layoutBox; 3263 lead.targetWithTransforms = createBox(); 3264 } 3265 const { target } = lead; 3266 if (!target) { 3267 /** 3268 * If we don't have a target to project into, but we were previously 3269 * projecting, we want to remove the stored transform and schedule 3270 * a render to ensure the elements reflect the removed transform. 3271 */ 3272 if (this.prevProjectionDelta) { 3273 this.createProjectionDeltas(); 3274 this.scheduleRender(); 3275 } 3276 return; 3277 } 3278 if (!this.projectionDelta || !this.prevProjectionDelta) this.createProjectionDeltas(); 3279 else { 3280 copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x); 3281 copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y); 3282 } 3283 /** 3284 * Update the delta between the corrected box and the target box before user-set transforms were applied. 3285 * This will allow us to calculate the corrected borderRadius and boxShadow to compensate 3286 * for our layout reprojection, but still allow them to be scaled correctly by the user. 3287 * It might be that to simplify this we may want to accept that user-set scale is also corrected 3288 * and we wouldn't have to keep and calc both deltas, OR we could support a user setting 3289 * to allow people to choose whether these styles are corrected based on just the 3290 * layout reprojection or the final bounding box. 3291 */ 3292 calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues); 3293 if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) { 3294 this.hasProjected = true; 3295 this.scheduleRender(); 3296 this.notifyListeners("projectionUpdate", target); 3297 } 3298 /** 3299 * Increase debug counter for recalculated projections 3300 */ 3301 if (statsBuffer.value) metrics.calculatedProjections++; 3302 } 3303 hide() { 3304 this.isVisible = false;
3305 } 3306 show() { 3307 this.isVisible = true; 3308 } 3309 scheduleRender(notifyAll = true) { 3310 this.options.visualElement?.scheduleRender(); 3311 if (notifyAll) { 3312 const stack = this.getStack(); 3313 stack && stack.scheduleRender(); 3314 } 3315 if (this.resumingFrom && !this.resumingFrom.instance) this.resumingFrom = void 0; 3316 } 3317 createProjectionDeltas() { 3318 this.prevProjectionDelta = createDelta(); 3319 this.projectionDelta = createDelta(); 3320 this.projectionDeltaWithTransform = createDelta(); 3321 } 3322 setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false, pathFn) { 3323 const snapshot = this.snapshot; 3324 const snapshotLatestValues = snapshot ? snapshot.latestValues : {}; 3325 const mixedValues = { ...this.latestValues }; 3326 const targetDelta = createDelta(); 3327 if (!this.relativeParent || !this.relativeParent.options.layoutRoot) this.relativeTarget = this.relativeTargetOrigin = void 0; 3328 this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged; 3329 const relativeLayout = createBox(); 3330 const isSharedLayoutAnimation = (snapshot ? snapshot.source : void 0) !== (this.layout ? this.layout.source : void 0); 3331 const stack = this.getStack(); 3332 const isOnlyMember = !stack || stack.members.length <= 1; 3333 const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade)); 3334 this.animationProgress = 0; 3335 let prevRelativeTarget; 3336 const interpolate = pathFn?.interpolateProjection(delta); 3337 this.mixTargetDelta = (latest) => { 3338 const progress = latest / 1e3; 3339 const point = interpolate?.(progress); 3340 if (point) { 3341 targetDelta.x.translate = point.x; 3342 targetDelta.x.scale = mixNumber(delta.x.scale, 1, progress); 3343 targetDelta.x.origin = delta.x.origin; 3344 targetDelta.x.originPoint = delta.x.originPoint; 3345 targetDelta.y.translate = point.y; 3346 targetDelta.y.scale = mixNumber(delta.y.scale, 1, progress); 3347 targetDelta.y.origin = delta.y.origin; 3348 targetDelta.y.originPoint = delta.y.originPoint; 3349 } else { 3350 mixAxisDeltaLinear(targetDelta.x, delta.x, progress); 3351 mixAxisDeltaLinear(targetDelta.y, delta.y, progress); 3352 } 3353 this.setTargetDelta(targetDelta); 3354 if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) { 3355 calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0); 3356 mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress); 3357 /** 3358 * If this is an unchanged relative target we can consider the 3359 * projection not dirty. 3360 */ 3361 if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) this.isProjectionDirty = false; 3362 if (!prevRelativeTarget) prevRelativeTarget = createBox(); 3363 copyBoxInto(prevRelativeTarget, this.relativeTarget); 3364 } 3365 if (isSharedLayoutAnimation) { 3366 this.animationValues = mixedValues; 3367 mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember); 3368 } 3369 if (point && point.rotate !== void 0) { 3370 if (!this.animationValues) this.animationValues = mixedValues; 3371 this.animationValues.pathRotation = point.rotate; 3372 } 3373 this.root.scheduleUpdateProjection(); 3374 this.scheduleRender(); 3375 this.animationProgress = progress; 3376 }; 3377 this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0); 3378 } 3379 startAnimation(options) { 3380 this.notifyListeners("animationStart"); 3381 this.currentAnimation?.stop(); 3382 this.resumingFrom?.currentAnimation?.stop(); 3383 if (this.pendingAnimation) { 3384 cancelFrame(this.pendingAnimation); 3385 this.pendingAnimation = void 0; 3386 } 3387 /** 3388 * Start the animation in the next frame to have a frame with progress 0, 3389 * where the target is the same as when the animation started, so we can 3390 * calculate the relative positions correctly for instant transitions. 3391 */ 3392 this.pendingAnimation = frame.update(() => { 3393 globalProjectionState.hasAnimatedSinceResize = true; 3394 this.motionValue || (this.motionValue = motionValue(0)); 3395 this.motionValue.jump(0, false); 3396 this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], { 3397 ...options, 3398 velocity: 0, 3399 isSync: true, 3400 onUpdate: (latest) => { 3401 this.mixTargetDelta(latest); 3402 options.onUpdate && options.onUpdate(latest); 3403 }, 3404 onComplete: () => { 3405 options.onComplete && options.onComplete(); 3406 this.completeAnimation(); 3407 } 3408 }); 3409 notifyLayoutAnimationStart(this.currentAnimation, this); 3410 if (this.resumingFrom) this.resumingFrom.currentAnimation = this.currentAnimation; 3411 this.pendingAnimation = void 0; 3412 }); 3413 } 3414 completeAnimation() { 3415 if (this.resumingFrom) { 3416 this.resumingFrom.currentAnimation = void 0; 3417 this.resumingFrom.preserveOpacity = void 0; 3418 }
3419 const stack = this.getStack(); 3420 stack && stack.exitAnimationComplete(); 3421 this.resumingFrom = this.currentAnimation = this.animationValues = void 0; 3422 this.notifyListeners("animationComplete"); 3423 } 3424 finishAnimation() { 3425 if (this.currentAnimation) { 3426 this.mixTargetDelta && this.mixTargetDelta(animationTarget); 3427 this.currentAnimation.stop(); 3428 } 3429 this.completeAnimation(); 3430 } 3431 applyTransformsToTarget() { 3432 const lead = this.getLead(); 3433 const { targetWithTransforms, layout, latestValues } = lead; 3434 let { target } = lead; 3435 if (!targetWithTransforms || !target || !layout) return; 3436 /** 3437 * If we're only animating position, and this element isn't the lead element, 3438 * then instead of projecting into the lead box we instead want to calculate 3439 * a new target that aligns the two boxes but maintains the layout shape. 3440 */ 3441 if (this !== lead && this.layout && layout && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) { 3442 target = this.target || createBox(); 3443 const xLength = calcLength(this.layout.layoutBox.x); 3444 target.x.min = lead.target.x.min; 3445 target.x.max = target.x.min + xLength; 3446 const yLength = calcLength(this.layout.layoutBox.y); 3447 target.y.min = lead.target.y.min; 3448 target.y.max = target.y.min + yLength; 3449 } 3450 copyBoxInto(targetWithTransforms, target); 3451 /** 3452 * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal. 3453 * This is the final box that we will then project into by calculating a transform delta and 3454 * applying it to the corrected box. 3455 */ 3456 transformBox(targetWithTransforms, latestValues); 3457 /** 3458 * Update the delta between the corrected box and the final target box, after 3459 * user-set transforms are applied to it. This will be used by the renderer to 3460 * create a transform style that will reproject the element from its layout layout 3461 * into the desired bounding box. 3462 */ 3463 calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues); 3464 } 3465 registerSharedNode(layoutId, node) { 3466 if (!this.sharedNodes.has(layoutId)) this.sharedNodes.set(layoutId, new NodeStack()); 3467 this.sharedNodes.get(layoutId).add(node); 3468 const config = node.options.initialPromotionConfig; 3469 node.promote({ 3470 transition: config ? config.transition : void 0, 3471 preserveFollowOpacity: config && config.shouldPreserveFollowOpacity ? config.shouldPreserveFollowOpacity(node) : void 0 3472 }); 3473 } 3474 isLead() { 3475 const stack = this.getStack(); 3476 return stack ? stack.lead === this : true; 3477 } 3478 getLead() { 3479 const { layoutId } = this.options; 3480 return layoutId ? this.getStack()?.lead || this : this; 3481 } 3482 getPrevLead() { 3483 const { layoutId } = this.options; 3484 return layoutId ? this.getStack()?.prevLead : void 0; 3485 } 3486 getStack() { 3487 const { layoutId } = this.options; 3488 if (layoutId) return this.root.sharedNodes.get(layoutId); 3489 } 3490 promote({ needsReset, transition, preserveFollowOpacity } = {}) { 3491 const stack = this.getStack(); 3492 if (stack) stack.promote(this, preserveFollowOpacity); 3493 if (needsReset) { 3494 this.projectionDelta = void 0; 3495 this.needsReset = true; 3496 } 3497 if (transition) this.setOptions({ transition }); 3498 } 3499 relegate() { 3500 const stack = this.getStack(); 3501 if (stack) return stack.relegate(this); 3502 else return false; 3503 } 3504 resetSkewAndRotation() { 3505 const { visualElement } = this.options; 3506 if (!visualElement) return; 3507 let hasDistortingTransform = false; 3508 /** 3509 * An unrolled check for rotation values. Most elements don't have any rotation and 3510 * skipping the nested loop and new object creation is 50% faster. 3511 */ 3512 const { latestValues } = visualElement; 3513 if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) hasDistortingTransform = true; 3514 if (!hasDistortingTransform) return; 3515 const resetValues = {}; 3516 if (latestValues.z) resetDistortingTransform("z", visualElement, resetValues, this.animationValues); 3517 for (let i = 0; i < transformAxes.length; i++) { 3518 resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues); 3519 resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues); 3520 } 3521 visualElement.render(); 3522 for (const key in resetValues) { 3523 visualElement.setStaticValue(key, resetValues[key]); 3524 if (this.animationValues) this.animationValues[key] = resetValues[key]; 3525 } 3526 visualElement.scheduleRender(); 3527 } 3528 applyProjectionStyles(targetStyle, styleProp) { 3529 if (!this.instance || this.isSVG) return; 3530 if (!this.isVisible) { 3531 targetStyle.visibility = "hidden"; 3532 return; 3533 } 3534 const transformTemplate = this.getTransformTemplate(); 3535 if (this.needsReset) { 3536 this.needsReset = false;
3537 targetStyle.visibility = ""; 3538 targetStyle.opacity = ""; 3539 targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || ""; 3540 targetStyle.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none"; 3541 return; 3542 } 3543 const lead = this.getLead(); 3544 if (!this.projectionDelta || !this.layout || !lead.target) { 3545 if (this.options.layoutId) { 3546 targetStyle.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1; 3547 targetStyle.pointerEvents = resolveMotionValue(styleProp?.pointerEvents) || ""; 3548 } 3549 if (this.hasProjected && !hasTransform(this.latestValues)) { 3550 targetStyle.transform = transformTemplate ? transformTemplate({}, "") : "none"; 3551 this.hasProjected = false; 3552 } 3553 return; 3554 } 3555 targetStyle.visibility = ""; 3556 const valuesToRender = lead.animationValues || lead.latestValues; 3557 this.applyTransformsToTarget(); 3558 let transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender); 3559 if (transformTemplate) transform = transformTemplate(valuesToRender, transform); 3560 targetStyle.transform = transform; 3561 const { x, y } = this.projectionDelta; 3562 targetStyle.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`; 3563 if (lead.animationValues) 3564 /** 3565 * If the lead component is animating, assign this either the entering/leaving 3566 * opacity 3567 */ 3568 targetStyle.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit; 3569 else 3570 /** 3571 * Or we're not animating at all, set the lead component to its layout 3572 * opacity and other components to hidden. 3573 */ 3574 targetStyle.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0; 3575 /** 3576 * Apply scale correction 3577 */ 3578 for (const key in scaleCorrectors) { 3579 if (valuesToRender[key] === void 0) continue; 3580 const { correct, applyTo, isCSSVariable } = scaleCorrectors[key]; 3581 /** 3582 * Only apply scale correction to the value if we have an 3583 * active projection transform. Otherwise these values become 3584 * vulnerable to distortion if the element changes size without 3585 * a corresponding layout animation. 3586 */ 3587 const corrected = transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead); 3588 if (applyTo) { 3589 const num = applyTo.length; 3590 for (let i = 0; i < num; i++) targetStyle[applyTo[i]] = corrected; 3591 } else if (isCSSVariable) this.options.visualElement.renderState.vars[key] = corrected; 3592 else targetStyle[key] = corrected; 3593 } 3594 /** 3595 * Disable pointer events on follow components. This is to ensure 3596 * that if a follow component covers a lead component it doesn't block 3597 * pointer events on the lead. 3598 */ 3599 if (this.options.layoutId) targetStyle.pointerEvents = lead === this ? resolveMotionValue(styleProp?.pointerEvents) || "" : "none"; 3600 } 3601 clearSnapshot() { 3602 this.resumeFrom = this.snapshot = void 0; 3603 } 3604 resetTree() { 3605 this.root.nodes.forEach((node) => node.currentAnimation?.stop()); 3606 this.root.nodes.forEach(clearMeasurements); 3607 this.root.sharedNodes.clear(); 3608 } 3609 }; 3610} 3611function updateLayout(node) { 3612 node.updateLayout(); 3613} 3614function notifyLayoutUpdate(node) { 3615 const snapshot = node.resumeFrom?.snapshot || node.snapshot; 3616 if (node.isLead() && node.layout && snapshot && node.hasListeners("didUpdate")) { 3617 const { layoutBox: layout, measuredBox: measuredLayout } = node.layout; 3618 const { animationType } = node.options; 3619 const isShared = snapshot.source !== node.layout.source; 3620 if (animationType === "size") eachAxis((axis) => { 3621 const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis]; 3622 const length = calcLength(axisSnapshot); 3623 axisSnapshot.min = layout[axis].min; 3624 axisSnapshot.max = axisSnapshot.min + length; 3625 }); 3626 else if (animationType === "x" || animationType === "y") { 3627 const snapAxis = animationType === "x" ? "y" : "x"; 3628 copyAxisInto(isShared ? snapshot.measuredBox[snapAxis] : snapshot.layoutBox[snapAxis], layout[snapAxis]); 3629 } else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) eachAxis((axis) => { 3630 const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis]; 3631 const length = calcLength(layout[axis]); 3632 axisSnapshot.max = axisSnapshot.min + length; 3633 /** 3634 * Ensure relative target gets resized and rerendererd 3635 */ 3636 if (node.relativeTarget && !node.currentAnimation) { 3637 node.isProjectionDirty = true;
3638 node.relativeTarget[axis].max = node.relativeTarget[axis].min + length; 3639 } 3640 }); 3641 const layoutDelta = createDelta(); 3642 calcBoxDelta(layoutDelta, layout, snapshot.layoutBox); 3643 const visualDelta = createDelta(); 3644 if (isShared) calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox); 3645 else calcBoxDelta(visualDelta, layout, snapshot.layoutBox); 3646 const hasLayoutChanged = !isDeltaZero(layoutDelta); 3647 let hasRelativeLayoutChanged = false; 3648 if (!node.resumeFrom) { 3649 const relativeParent = node.getClosestProjectingParent(); 3650 /** 3651 * If the relativeParent is itself resuming from a different element then 3652 * the relative snapshot is not relavent 3653 */ 3654 if (relativeParent && !relativeParent.resumeFrom) { 3655 const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent; 3656 if (parentSnapshot && parentLayout) { 3657 const anchor = node.options.layoutAnchor || void 0; 3658 const relativeSnapshot = createBox(); 3659 calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox, anchor); 3660 const relativeLayout = createBox(); 3661 calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox, anchor); 3662 if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) hasRelativeLayoutChanged = true; 3663 if (relativeParent.options.layoutRoot) { 3664 node.relativeTarget = relativeLayout; 3665 node.relativeTargetOrigin = relativeSnapshot; 3666 node.relativeParent = relativeParent; 3667 } 3668 } 3669 } 3670 } 3671 node.notifyListeners("didUpdate", { 3672 layout, 3673 snapshot, 3674 delta: visualDelta, 3675 layoutDelta, 3676 hasLayoutChanged, 3677 hasRelativeLayoutChanged 3678 }); 3679 } else if (node.isLead()) { 3680 const { onExitComplete } = node.options; 3681 onExitComplete && onExitComplete(); 3682 } 3683 /** 3684 * Clearing transition 3685 * TODO: Investigate why this transition is being passed in as {type: false } from Framer 3686 * and why we need it at all 3687 */ 3688 node.options.transition = void 0; 3689} 3690function propagateDirtyNodes(node) { 3691 /** 3692 * Increase debug counter for nodes encountered this frame 3693 */ 3694 if (statsBuffer.value) metrics.nodes++; 3695 if (!node.parent) return; 3696 /** 3697 * If this node isn't projecting, propagate isProjectionDirty. It will have 3698 * no performance impact but it will allow the next child that *is* projecting 3699 * but *isn't* dirty to just check its parent to see if *any* ancestor needs 3700 * correcting. 3701 */ 3702 if (!node.isProjecting()) node.isProjectionDirty = node.parent.isProjectionDirty; 3703 /** 3704 * Propagate isSharedProjectionDirty and isTransformDirty 3705 * throughout the whole tree. A future revision can take another look at 3706 * this but for safety we still recalcualte shared nodes. 3707 */ 3708 node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty || node.parent.isProjectionDirty || node.parent.isSharedProjectionDirty)); 3709 node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty); 3710} 3711function cleanDirtyNodes(node) { 3712 node.isProjectionDirty = node.isSharedProjectionDirty = node.isTransformDirty = false; 3713} 3714function clearSnapshot(node) { 3715 node.clearSnapshot(); 3716} 3717function clearMeasurements(node) { 3718 node.clearMeasurements(); 3719} 3720function forceLayoutMeasure(node) { 3721 node.isLayoutDirty = true; 3722 node.updateLayout(); 3723} 3724function clearIsLayoutDirty(node) { 3725 node.isLayoutDirty = false; 3726} 3727/** 3728* When a node is animation-blocked (e.g. during drag) and its component 3729* didn't re-render (memoized), willUpdate() is never called so there's 3730* no snapshot. Use the previous layout as a snapshot and mark dirty so 3731* resetTransform/updateLayout/notifyLayoutUpdate process it normally. 3732*/ 3733function ensureDraggedNodesSnapshotted(node) { 3734 if (node.isAnimationBlocked && node.layout && !node.isLayoutDirty) { 3735 node.snapshot = node.layout; 3736 node.isLayoutDirty = true; 3737 } 3738} 3739function resetTransformStyle(node) { 3740 const { visualElement } = node.options; 3741 if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) visualElement.notify("BeforeLayoutMeasure"); 3742 node.resetTransform(); 3743} 3744function finishAnimation(node) { 3745 node.finishAnimation(); 3746 node.targetDelta = node.relativeTarget = node.target = void 0; 3747 node.isProjectionDirty = true; 3748} 3749function resolveTargetDelta(node) { 3750 node.resolveTargetDelta(); 3751} 3752function calcProjection(node) { 3753 node.calcProjection(); 3754}
3755function resetSkewAndRotation(node) { 3756 node.resetSkewAndRotation(); 3757} 3758function removeLeadSnapshots(stack) { 3759 stack.removeLeadSnapshot(); 3760} 3761function mixAxisDeltaLinear(output, delta, p) { 3762 output.translate = mixNumber(delta.translate, 0, p); 3763 output.scale = mixNumber(delta.scale, 1, p); 3764 output.origin = delta.origin; 3765 output.originPoint = delta.originPoint; 3766} 3767function mixAxis(output, from, to, p) { 3768 output.min = mixNumber(from.min, to.min, p); 3769 output.max = mixNumber(from.max, to.max, p); 3770} 3771function mixBox(output, from, to, p) { 3772 mixAxis(output.x, from.x, to.x, p); 3773 mixAxis(output.y, from.y, to.y, p); 3774} 3775function hasOpacityCrossfade(node) { 3776 return node.animationValues && node.animationValues.opacityExit !== void 0; 3777} 3778function roundAxis(axis) { 3779 axis.min = roundPoint(axis.min); 3780 axis.max = roundPoint(axis.max); 3781} 3782function roundBox(box) { 3783 roundAxis(box.x); 3784 roundAxis(box.y); 3785} 3786function shouldAnimatePositionOnly(animationType, snapshot, layout) { 3787 return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout), .2); 3788} 3789function checkNodeWasScrollRoot(node) { 3790 return node !== node.root && node.scroll?.wasRoot; 3791} 3792var metrics, transformAxes, animationTarget, id$1, defaultLayoutTransition, userAgentContains, roundPoint; 3793function init_create_projection_node() { 3794 return (init_create_projection_node = __esmMin((() => { 3795 init_subscription_manager(), init_clamp(), init_noop(); 3796 init_single_value(); 3797 init_notify_inspector(); 3798 init_get_appear_id(); 3799 init_get_value_transition(); 3800 init_microtask(); 3801 init_sync_time(); 3802 init_scale_correction(); 3803 init_buffer(); 3804 init_delay(); 3805 init_is_svg_element(); 3806 init_is_svg_svg_element(); 3807 init_number(); 3808 init_value(); 3809 init_resolve_motion_value(); 3810 init_mix_values(); 3811 init_delta_apply(); 3812 init_delta_calc(); 3813 init_delta_remove(); 3814 init_models(); 3815 init_utils(); 3816 init_stack(); 3817 init_flat_tree(); 3818 init_state$2(); 3819 init_frame(); 3820 metrics = { 3821 nodes: 0, 3822 calculatedTargetDeltas: 0, 3823 calculatedProjections: 0 3824 }; 3825 transformAxes = [ 3826 "", 3827 "X", 3828 "Y", 3829 "Z" 3830 ]; 3831 animationTarget = 1e3; 3832 id$1 = 0; 3833 defaultLayoutTransition = { 3834 duration: .45, 3835 ease: [ 3836 .4, 3837 0, 3838 .1, 3839 1 3840 ] 3841 }; 3842 userAgentContains = (string) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string); 3843 roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop; 3844 })))(); 3845} 3846//#endregion 3847//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.mjs 3848var DocumentProjectionNode; 3849function init_DocumentProjectionNode() { 3850 return (init_DocumentProjectionNode = __esmMin((() => { 3851 init_create_projection_node(); 3852 DocumentProjectionNode = createProjectionNode$1({ 3853 attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify), 3854 measureScroll: () => ({ 3855 x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0, 3856 y: document.documentElement.scrollTop || document.body?.scrollTop || 0 3857 }), 3858 checkIsScrollRoot: () => true 3859 }); 3860 })))(); 3861} 3862//#endregion 3863//#region node_modules/.pnpm/[email protected]/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.mjs 3864var rootProjectionNode, HTMLProjectionNode; 3865function init_HTMLProjectionNode() { 3866 return (init_HTMLProjectionNode = __esmMin((() => { 3867 init_create_projection_node(); 3868 init_DocumentProjectionNode(); 3869 rootProjectionNode = { current: void 0 }; 3870 HTMLProjectionNode = createProjectionNode$1({ 3871 measureScroll: (instance) => ({ 3872 x: instance.scrollLeft, 3873 y: instance.scrollTop 3874 }), 3875 defaultParent: () => { 3876 if (!rootProjectionNode.current) { 3877 const documentNode = new DocumentProjectionNode({}); 3878 documentNode.mount(window); 3879 documentNode.setOptions({ layoutScroll: true }); 3880 rootProjectionNode.current = documentNode; 3881 } 3882 return rootProjectionNode.current; 3883 }, 3884 resetTransform: (instance, value) => { 3885 instance.style.transform = value !== void 0 ? value : "none"; 3886 }, 3887 checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed") 3888 }); 3889 })))(); 3890} 3891//#endregion 3892//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/distance.mjs 3893function distance2D(a, b) { 3894 const xDelta = distance(a.x, b.x); 3895 const yDelta = distance(a.y, b.y); 3896 return Math.sqrt(xDelta ** 2 + yDelta ** 2); 3897} 3898var distance; 3899function init_distance() { 3900 return (init_distance = __esmMin((() => { 3901 distance = (a, b) => Math.abs(a - b); 3902 })))(); 3903} 3904//#endregion 3905//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs 3906var import_react$25, LayoutGroupContext; 3907function init_LayoutGroupContext() { 3908 return (init_LayoutGroupContext = __esmMin((() => { 3909 import_react$25 = require_react(); 3910 LayoutGroupContext = (0, import_react$25.createContext)({}); 3911 })))(); 3912} 3913//#endregion 3914//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/use-constant.mjs 3915/** 3916* Creates a constant value over the lifecycle of a component. 3917* 3918* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer 3919* a guarantee that it won't re-run for performance reasons later on. By using `useConstant` 3920* you can ensure that initialisers don't execute twice or more. 3921*/ 3922function useConstant(init) { 3923 const ref = (0, import_react$24.useRef)(null); 3924 if (ref.current === null) ref.current = init(); 3925 return ref.current; 3926} 3927var import_react$24; 3928function init_use_constant() { 3929 return (init_use_constant = __esmMin((() => { 3930 import_react$24 = require_react(); 3931 })))(); 3932} 3933//#endregion 3934//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/is-browser.mjs 3935var isBrowser; 3936function init_is_browser() { 3937 return (init_is_browser = __esmMin((() => { 3938 isBrowser = typeof window !== "undefined"; 3939 })))(); 3940} 3941//#endregion 3942//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs 3943var import_react$23, useIsomorphicLayoutEffect; 3944function init_use_isomorphic_effect() { 3945 return (init_use_isomorphic_effect = __esmMin((() => { 3946 import_react$23 = require_react(); 3947 init_is_browser(); 3948 useIsomorphicLayoutEffect = isBrowser ? import_react$23.useLayoutEffect : import_react$23.useEffect; 3949 })))(); 3950} 3951//#endregion 3952//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/PresenceContext.mjs 3953var import_react$22, PresenceContext; 3954function init_PresenceContext() { 3955 return (init_PresenceContext = __esmMin((() => { 3956 import_react$22 = require_react(); 3957 PresenceContext = /* @__PURE__ */ (0, import_react$22.createContext)(null); 3958 })))(); 3959} 3960//#endregion 3961//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs 3962var import_react$21, MotionConfigContext; 3963function init_MotionConfigContext() { 3964 return (init_MotionConfigContext = __esmMin((() => { 3965 import_react$21 = require_react(); 3966 MotionConfigContext = (0, import_react$21.createContext)({ 3967 transformPagePoint: (p) => p, 3968 isStatic: false,
3969 reducedMotion: "never" 3970 }); 3971 })))(); 3972} 3973//#endregion 3974//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs 3975/** 3976* Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx 3977*/ 3978/** 3979* Set a given ref to a given value 3980* This utility takes care of different types of refs: callback refs and RefObject(s) 3981*/ 3982function setRef(ref, value) { 3983 if (typeof ref === "function") return ref(value); 3984 else if (ref !== null && ref !== void 0) ref.current = value; 3985} 3986/** 3987* A utility to compose multiple refs together 3988* Accepts callback refs and RefObject(s) 3989*/ 3990function composeRefs(...refs) { 3991 return (node) => { 3992 let hasCleanup = false; 3993 const cleanups = refs.map((ref) => { 3994 const cleanup = setRef(ref, node); 3995 if (!hasCleanup && typeof cleanup === "function") hasCleanup = true; 3996 return cleanup; 3997 }); 3998 if (hasCleanup) return () => { 3999 for (let i = 0; i < cleanups.length; i++) { 4000 const cleanup = cleanups[i]; 4001 if (typeof cleanup === "function") cleanup(); 4002 else setRef(refs[i], null); 4003 } 4004 }; 4005 }; 4006} 4007/** 4008* A custom hook that composes multiple refs 4009* Accepts callback refs and RefObject(s) 4010*/ 4011function useComposedRefs(...refs) { 4012 return import_react$20.useCallback(composeRefs(...refs), refs); 4013} 4014var import_react$20; 4015function init_use_composed_ref() { 4016 return (init_use_composed_ref = __esmMin((() => { 4017 import_react$20 = /* @__PURE__ */ __toESM(require_react(), 1); 4018 })))(); 4019} 4020//#endregion 4021//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs 4022function PopChild({ children, isPresent, anchorX, anchorY, root, pop }) { 4023 const id = (0, import_react$19.useId)(); 4024 const ref = (0, import_react$19.useRef)(null); 4025 const size = (0, import_react$19.useRef)({ 4026 width: 0, 4027 height: 0, 4028 top: 0, 4029 left: 0, 4030 right: 0, 4031 bottom: 0, 4032 direction: "ltr" 4033 }); 4034 const { nonce } = (0, import_react$19.useContext)(MotionConfigContext); 4035 const composedRef = useComposedRefs(ref, pop !== false ? children.props?.ref ?? children?.ref : void 0); 4036 /** 4037 * We create and inject a style block so we can apply this explicit 4038 * sizing in a non-destructive manner by just deleting the style block. 4039 * 4040 * We can't apply size via render as the measurement happens 4041 * in getSnapshotBeforeUpdate (post-render), likewise if we apply the 4042 * styles directly on the DOM node, we might be overwriting 4043 * styles set via the style prop. 4044 */ 4045 (0, import_react$19.useInsertionEffect)(() => { 4046 const { width, height, top, left, right, bottom, direction } = size.current; 4047 if (isPresent || pop === false || !ref.current || !width || !height) return; 4048 const isRTL = direction === "rtl"; 4049 const x = anchorX === "left" ? isRTL ? `right: ${right}` : `left: ${left}` : isRTL ? `left: ${left}` : `right: ${right}`; 4050 const y = anchorY === "bottom" ? `bottom: ${bottom}` : `top: ${top}`; 4051 ref.current.dataset.motionPopId = id; 4052 const style = document.createElement("style"); 4053 if (nonce) style.nonce = nonce; 4054 const parent = root ?? document.head; 4055 parent.appendChild(style); 4056 if (style.sheet) style.sheet.insertRule(` 4057 [data-motion-pop-id="${id}"] { 4058 position: absolute !important; 4059 width: ${width}px !important; 4060 height: ${height}px !important; 4061 ${x}px !important; 4062 ${y}px !important; 4063 } 4064 `); 4065 return () => { 4066 ref.current?.removeAttribute("data-motion-pop-id"); 4067 if (parent.contains(style)) parent.removeChild(style); 4068 }; 4069 }, [isPresent]); 4070 return (0, import_jsx_runtime$4.jsx)(PopChildMeasure, { 4071 isPresent, 4072 childRef: ref, 4073 sizeRef: size, 4074 pop, 4075 children: pop === false ? children : import_react$18.cloneElement(children, { ref: composedRef }) 4076 }); 4077} 4078var import_jsx_runtime$4, import_react$18, import_react$19, PopChildMeasure; 4079function init_PopChild() { 4080 return (init_PopChild = __esmMin((() => { 4081 import_jsx_runtime$4 = require_jsx_runtime();
4082 init_is_html_element(); 4083 import_react$18 = /* @__PURE__ */ __toESM(require_react(), 1); 4084 import_react$19 = require_react(); 4085 init_MotionConfigContext(); 4086 init_use_composed_ref(); 4087 PopChildMeasure = class extends import_react$18.Component { 4088 getSnapshotBeforeUpdate(prevProps) { 4089 const element = this.props.childRef.current; 4090 if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) { 4091 const parent = element.offsetParent; 4092 const parentWidth = isHTMLElement(parent) ? parent.offsetWidth || 0 : 0; 4093 const parentHeight = isHTMLElement(parent) ? parent.offsetHeight || 0 : 0; 4094 const computedStyle = getComputedStyle(element); 4095 const size = this.props.sizeRef.current; 4096 size.height = parseFloat(computedStyle.height); 4097 size.width = parseFloat(computedStyle.width); 4098 size.top = element.offsetTop; 4099 size.left = element.offsetLeft; 4100 size.right = parentWidth - size.width - size.left; 4101 size.bottom = parentHeight - size.height - size.top; 4102 size.direction = computedStyle.direction; 4103 } 4104 return null; 4105 } 4106 /** 4107 * Required with getSnapshotBeforeUpdate to stop React complaining. 4108 */ 4109 componentDidUpdate() {} 4110 render() { 4111 return this.props.children; 4112 } 4113 }; 4114 })))(); 4115} 4116//#endregion 4117//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs 4118function newChildrenMap() { 4119 return /* @__PURE__ */ new Map(); 4120} 4121var import_jsx_runtime$3, import_react$16, import_react$17, PresenceChild; 4122function init_PresenceChild() { 4123 return (init_PresenceChild = __esmMin((() => { 4124 import_jsx_runtime$3 = require_jsx_runtime(); 4125 import_react$16 = /* @__PURE__ */ __toESM(require_react(), 1); 4126 import_react$17 = require_react(); 4127 init_PresenceContext(); 4128 init_use_constant(); 4129 init_use_isomorphic_effect(); 4130 init_PopChild(); 4131 PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => { 4132 const presenceChildren = useConstant(newChildrenMap); 4133 const id = (0, import_react$17.useId)(); 4134 const isPresentRef = (0, import_react$17.useRef)(isPresent); 4135 const onExitCompleteRef = (0, import_react$17.useRef)(onExitComplete); 4136 useIsomorphicLayoutEffect(() => { 4137 isPresentRef.current = isPresent; 4138 onExitCompleteRef.current = onExitComplete; 4139 }); 4140 let isReusedContext = true; 4141 let context = (0, import_react$17.useMemo)(() => { 4142 isReusedContext = false; 4143 return { 4144 id, 4145 initial, 4146 isPresent, 4147 custom, 4148 onExitComplete: (childId) => { 4149 presenceChildren.set(childId, true); 4150 for (const isComplete of presenceChildren.values()) if (!isComplete) return; 4151 onExitComplete && onExitComplete(); 4152 }, 4153 register: (childId) => { 4154 presenceChildren.set(childId, false); 4155 return () => { 4156 presenceChildren.delete(childId); 4157 !isPresentRef.current && !presenceChildren.size && onExitCompleteRef.current?.(); 4158 }; 4159 } 4160 }; 4161 }, [ 4162 isPresent, 4163 presenceChildren, 4164 onExitComplete 4165 ]); 4166 /** 4167 * If the presence of a child affects the layout of the components around it, 4168 * we want to make a new context value to ensure they get re-rendered 4169 * so they can detect that layout change. 4170 */ 4171 if (presenceAffectsLayout && isReusedContext) context = { ...context }; 4172 (0, import_react$17.useMemo)(() => { 4173 presenceChildren.forEach((_, key) => presenceChildren.set(key, false)); 4174 }, [isPresent]); 4175 /** 4176 * If there's no `motion` components to fire exit animations, we want to remove this 4177 * component immediately. 4178 */ 4179 import_react$16.useEffect(() => { 4180 !isPresent && !presenceChildren.size && onExitComplete && onExitComplete(); 4181 }, [isPresent]); 4182 children = (0, import_jsx_runtime$3.jsx)(PopChild, { 4183 pop: mode === "popLayout", 4184 isPresent, 4185 anchorX, 4186 anchorY, 4187 root, 4188 children 4189 }); 4190 return (0, import_jsx_runtime$3.jsx)(PresenceContext.Provider, { 4191 value: context, 4192 children 4193 }); 4194 }; 4195 })))(); 4196} 4197//#endregion 4198//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs 4199/** 4200* When a component is the child of `AnimatePresence`, it can use `usePresence` 4201* to access information about whether it's still present in the React tree. 4202* 4203* ```jsx 4204* import { usePresence } from "framer-motion" 4205* 4206* export const Component = () => { 4207* const [isPresent, safeToRemove] = usePresence() 4208* 4209* useEffect(() => { 4210* !isPresent && setTimeout(safeToRemove, 1000) 4211* }, [isPresent]) 4212* 4213* return <div /> 4214* } 4215* ``` 4216* 4217* If `isPresent` is `false`, it means that a component has been removed from the tree, 4218* but `AnimatePresence` won't really remove it until `safeToRemove` has been called. 4219* 4220* @public 4221*/ 4222function usePresence(subscribe = true) { 4223 const context = (0, import_react$15.useContext)(PresenceContext); 4224 if (context === null) return [true, null]; 4225 const { isPresent, onExitComplete, register } = context; 4226 const id = (0, import_react$15.useId)(); 4227 (0, import_react$15.useEffect)(() => { 4228 if (subscribe) return register(id); 4229 }, [subscribe]); 4230 const safeToRemove = (0, import_react$15.useCallback)(() => subscribe && onExitComplete && onExitComplete(id), [ 4231 id, 4232 onExitComplete, 4233 subscribe 4234 ]); 4235 return !isPresent && onExitComplete ? [false, safeToRemove] : [true]; 4236} 4237var import_react$15; 4238function init_use_presence() { 4239 return (init_use_presence = __esmMin((() => { 4240 import_react$15 = require_react(); 4241 init_PresenceContext(); 4242 })))(); 4243} 4244//#endregion 4245//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs 4246function onlyElements(children) { 4247 const filtered = [];
4248 import_react$14.Children.forEach(children, (child) => { 4249 if ((0, import_react$14.isValidElement)(child)) filtered.push(child); 4250 }); 4251 return filtered; 4252} 4253var import_react$14, getChildKey; 4254function init_utils$1() { 4255 return (init_utils$1 = __esmMin((() => { 4256 import_react$14 = require_react(); 4257 getChildKey = (child) => child.key || ""; 4258 })))(); 4259} 4260//#endregion 4261//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs 4262var import_jsx_runtime$2, import_react$13, AnimatePresence; 4263function init_AnimatePresence() { 4264 return (init_AnimatePresence = __esmMin((() => { 4265 import_jsx_runtime$2 = require_jsx_runtime(); 4266 import_react$13 = require_react(); 4267 init_LayoutGroupContext(); 4268 init_use_constant(); 4269 init_use_isomorphic_effect(); 4270 init_PresenceChild(); 4271 init_use_presence(); 4272 init_utils$1(); 4273 AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", anchorY = "top", root }) => { 4274 const [isParentPresent, safeToRemove] = usePresence(propagate); 4275 /** 4276 * Filter any children that aren't ReactElements. We can only track components 4277 * between renders with a props.key. 4278 */ 4279 const presentChildren = (0, import_react$13.useMemo)(() => onlyElements(children), [children]); 4280 /** 4281 * Track the keys of the currently rendered children. This is used to 4282 * determine which children are exiting. 4283 */ 4284 const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey); 4285 /** 4286 * If `initial={false}` we only want to pass this to components in the first render. 4287 */ 4288 const isInitialRender = (0, import_react$13.useRef)(true); 4289 /** 4290 * A ref containing the currently present children. When all exit animations 4291 * are complete, we use this to re-render the component with the latest children 4292 * *committed* rather than the latest children *rendered*. 4293 */ 4294 const pendingPresentChildren = (0, import_react$13.useRef)(presentChildren); 4295 /** 4296 * Track which exiting children have finished animating out. 4297 */ 4298 const exitComplete = useConstant(() => /* @__PURE__ */ new Map()); 4299 /** 4300 * Track which components are currently processing exit to prevent duplicate processing. 4301 */ 4302 const exitingComponents = (0, import_react$13.useRef)(/* @__PURE__ */ new Set()); 4303 /** 4304 * Save children to render as React state. To ensure this component is concurrent-safe, 4305 * we check for exiting children via an effect. 4306 */ 4307 const [diffedChildren, setDiffedChildren] = (0, import_react$13.useState)(presentChildren); 4308 const [renderedChildren, setRenderedChildren] = (0, import_react$13.useState)(presentChildren); 4309 useIsomorphicLayoutEffect(() => { 4310 if (propagate && !isParentPresent && !renderedChildren.length) safeToRemove?.(); 4311 }, [ 4312 isParentPresent, 4313 propagate, 4314 renderedChildren.length, 4315 safeToRemove 4316 ]); 4317 useIsomorphicLayoutEffect(() => { 4318 isInitialRender.current = false; 4319 pendingPresentChildren.current = presentChildren; 4320 /** 4321 * Update complete status of exiting children. 4322 */ 4323 for (let i = 0; i < renderedChildren.length; i++) { 4324 const key = getChildKey(renderedChildren[i]); 4325 if (!presentKeys.includes(key)) { 4326 if (exitComplete.get(key) !== true) exitComplete.set(key, false); 4327 } else { 4328 exitComplete.delete(key); 4329 exitingComponents.current.delete(key); 4330 } 4331 } 4332 }, [ 4333 renderedChildren, 4334 presentKeys.length, 4335 presentKeys.join("-") 4336 ]); 4337 const exitingChildren = []; 4338 if (presentChildren !== diffedChildren) { 4339 let nextChildren = [...presentChildren]; 4340 /** 4341 * Loop through all the currently rendered components and decide which 4342 * are exiting. 4343 * 4344 * Exiting children are reinserted directly after the child they 4345 * previously followed. Splicing at their index within the previously 4346 * rendered children, as we used to, indexes into the wrong list: it 4347 * can interleave them with entering children and push present children 4348 * to new positions, remounting them (#3746). 4349 */ 4350 let insertionIndex = 0; 4351 for (const child of renderedChildren) { 4352 const presentIndex = presentKeys.indexOf(getChildKey(child)); 4353 if (presentIndex === -1) { 4354 nextChildren.splice(insertionIndex++, 0, child); 4355 exitingChildren.push(child); 4356 } else insertionIndex = presentIndex + exitingChildren.length + 1; 4357 } 4358 /** 4359 * If we're in "wait" mode, and we have exiting children, we want to 4360 * only render these until they've all exited. 4361 */ 4362 if (mode === "wait" && exitingChildren.length) nextChildren = exitingChildren; 4363 setRenderedChildren(onlyElements(nextChildren)); 4364 setDiffedChildren(presentChildren); 4365 /** 4366 * Early return to ensure once we've set state with the latest diffed 4367 * children, we can immediately re-render. 4368 */ 4369 return null; 4370 } 4371 /** 4372 * If we've been provided a forceRender function by the LayoutGroupContext, 4373 * we can use it to force a re-render amongst all surrounding components once 4374 * all components have finished animating out. 4375 */ 4376 const { forceRender } = (0, import_react$13.useContext)(LayoutGroupContext); 4377 return (0, import_jsx_runtime$2.jsx)(import_jsx_runtime$2.Fragment, { children: renderedChildren.map((child) => {
4378 const key = getChildKey(child); 4379 const isPresent = propagate && !isParentPresent ? false : presentChildren === renderedChildren || presentKeys.includes(key); 4380 const onExit = () => { 4381 if (exitingComponents.current.has(key)) return; 4382 if (exitComplete.has(key)) { 4383 exitingComponents.current.add(key); 4384 exitComplete.set(key, true); 4385 } else return; 4386 let isEveryExitComplete = true; 4387 exitComplete.forEach((isExitComplete) => { 4388 if (!isExitComplete) isEveryExitComplete = false; 4389 }); 4390 if (isEveryExitComplete) { 4391 forceRender?.(); 4392 setRenderedChildren(pendingPresentChildren.current); 4393 propagate && safeToRemove?.(); 4394 onExitComplete && onExitComplete(); 4395 } 4396 }; 4397 return (0, import_jsx_runtime$2.jsx)(PresenceChild, { 4398 isPresent, 4399 initial: !isInitialRender.current || initial ? void 0 : false, 4400 custom, 4401 presenceAffectsLayout, 4402 mode, 4403 root, 4404 onExitComplete: isPresent ? void 0 : onExit, 4405 anchorX, 4406 anchorY, 4407 children: child 4408 }, key); 4409 }) }); 4410 }; 4411 })))(); 4412} 4413//#endregion 4414//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/LazyContext.mjs 4415var import_react$12, LazyContext; 4416function init_LazyContext() { 4417 return (init_LazyContext = __esmMin((() => { 4418 import_react$12 = require_react(); 4419 LazyContext = (0, import_react$12.createContext)({ strict: false }); 4420 })))(); 4421} 4422//#endregion 4423//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/definitions.mjs 4424/** 4425* Initialize feature definitions with isEnabled checks. 4426* This must be called before any motion components are rendered. 4427*/ 4428function initFeatureDefinitions() { 4429 if (isInitialized) return; 4430 const initialFeatureDefinitions = {}; 4431 for (const key in featureProps) initialFeatureDefinitions[key] = { isEnabled: (props) => featureProps[key].some((name) => !!props[name]) }; 4432 setFeatureDefinitions(initialFeatureDefinitions); 4433 isInitialized = true; 4434} 4435/** 4436* Get the current feature definitions, initializing if needed. 4437*/ 4438function getInitializedFeatureDefinitions() { 4439 initFeatureDefinitions(); 4440 return getFeatureDefinitions(); 4441} 4442var featureProps, isInitialized; 4443function init_definitions() { 4444 return (init_definitions = __esmMin((() => { 4445 init_VisualElement(); 4446 featureProps = { 4447 animation: [ 4448 "animate", 4449 "variants", 4450 "whileHover", 4451 "whileTap", 4452 "exit", 4453 "whileInView", 4454 "whileFocus", 4455 "whileDrag" 4456 ], 4457 exit: ["exit"], 4458 drag: ["drag", "dragControls"], 4459 focus: ["whileFocus"], 4460 hover: [ 4461 "whileHover", 4462 "onHoverStart", 4463 "onHoverEnd" 4464 ], 4465 tap: [ 4466 "whileTap", 4467 "onTap", 4468 "onTapStart", 4469 "onTapCancel" 4470 ], 4471 pan: [ 4472 "onPan", 4473 "onPanStart", 4474 "onPanSessionStart", 4475 "onPanEnd" 4476 ], 4477 inView: [ 4478 "whileInView", 4479 "onViewportEnter", 4480 "onViewportLeave" 4481 ], 4482 layout: ["layout", "layoutId"] 4483 }; 4484 isInitialized = false; 4485 })))(); 4486} 4487//#endregion 4488//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/load-features.mjs 4489function loadFeatures(features) { 4490 const featureDefinitions = getInitializedFeatureDefinitions(); 4491 for (const key in features) featureDefinitions[key] = { 4492 ...featureDefinitions[key], 4493 ...features[key] 4494 }; 4495 setFeatureDefinitions(featureDefinitions); 4496} 4497function init_load_features() { 4498 return (init_load_features = __esmMin((() => { 4499 init_VisualElement(); 4500 init_definitions(); 4501 })))(); 4502} 4503//#endregion 4504//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/MotionContext/index.mjs 4505var import_react$11, MotionContext; 4506function init_MotionContext() { 4507 return (init_MotionContext = __esmMin((() => { 4508 import_react$11 = require_react(); 4509 MotionContext = /* @__PURE__ */ (0, import_react$11.createContext)({}); 4510 })))(); 4511} 4512//#endregion 4513//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs 4514function getCurrentTreeVariants(props, context) { 4515 if (isControllingVariants(props)) { 4516 const { initial, animate } = props; 4517 return { 4518 initial: initial === false || isVariantLabel(initial) ? initial : void 0, 4519 animate: isVariantLabel(animate) ? animate : void 0 4520 }; 4521 } 4522 return props.inherit !== false ? context : {}; 4523} 4524function init_utils$2() { 4525 return (init_utils$2 = __esmMin((() => { 4526 init_is_controlling_variants(); 4527 })))(); 4528} 4529//#endregion 4530//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/MotionContext/create.mjs 4531function useCreateMotionContext(props) { 4532 const { initial, animate } = getCurrentTreeVariants(props, (0, import_react$10.useContext)(MotionContext)); 4533 return (0, import_react$10.useMemo)(() => ({ 4534 initial, 4535 animate 4536 }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]); 4537} 4538function variantLabelsAsDependency(prop) { 4539 return Array.isArray(prop) ? prop.join(" ") : prop; 4540} 4541var import_react$10; 4542function init_create() { 4543 return (init_create = __esmMin((() => { 4544 import_react$10 = require_react(); 4545 init_MotionContext(); 4546 init_utils$2(); 4547 })))(); 4548} 4549//#endregion 4550//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs 4551var createHtmlRenderState; 4552function init_create_render_state() { 4553 return (init_create_render_state = __esmMin((() => { 4554 createHtmlRenderState = () => ({ 4555 style: {}, 4556 transform: {}, 4557 transformOrigin: {}, 4558 vars: {} 4559 }); 4560 })))(); 4561} 4562//#endregion 4563//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/html/use-props.mjs 4564function copyRawValuesOnly(target, source, props) { 4565 for (const key in source) if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) target[key] = source[key]; 4566} 4567function useInitialMotionValues({ transformTemplate }, visualState) { 4568 return (0, import_react$9.useMemo)(() => { 4569 const state = createHtmlRenderState(); 4570 buildHTMLStyles(state, visualState, transformTemplate); 4571 return Object.assign({}, state.vars, state.style); 4572 }, [visualState]); 4573} 4574function useStyle(props, visualState) { 4575 const styleProp = props.style || {}; 4576 const style = {}; 4577 /** 4578 * Copy non-Motion Values straight into style 4579 */ 4580 copyRawValuesOnly(style, styleProp, props); 4581 Object.assign(style, useInitialMotionValues(props, visualState)); 4582 return style; 4583} 4584function useHTMLProps(props, visualState) { 4585 const htmlProps = {}; 4586 const style = useStyle(props, visualState); 4587 if (props.drag && props.dragListener !== false) { 4588 htmlProps.draggable = false;
4589 style.userSelect = style.WebkitUserSelect = style.WebkitTouchCallout = "none"; 4590 style.touchAction = props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`; 4591 } 4592 if (props.tabIndex === void 0 && (props.onTap || props.onTapStart || props.whileTap)) htmlProps.tabIndex = 0; 4593 htmlProps.style = style; 4594 return htmlProps; 4595} 4596var import_react$9; 4597function init_use_props() { 4598 return (init_use_props = __esmMin((() => { 4599 init_is_motion_value(), init_is_forced_motion_value(), init_build_styles(); 4600 import_react$9 = require_react(); 4601 init_create_render_state(); 4602 })))(); 4603} 4604//#endregion 4605//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs 4606var createSvgRenderState; 4607function init_create_render_state$1() { 4608 return (init_create_render_state$1 = __esmMin((() => { 4609 init_create_render_state(); 4610 createSvgRenderState = () => ({ 4611 ...createHtmlRenderState(), 4612 attrs: {} 4613 }); 4614 })))(); 4615} 4616//#endregion 4617//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/svg/use-props.mjs 4618function useSVGProps(props, visualState, _isStatic, Component) { 4619 const visualProps = (0, import_react$8.useMemo)(() => { 4620 const state = createSvgRenderState(); 4621 buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate, props.style); 4622 return { 4623 ...state.attrs, 4624 style: { ...state.style } 4625 }; 4626 }, [visualState]); 4627 if (props.style) { 4628 const rawStyles = {}; 4629 copyRawValuesOnly(rawStyles, props.style, props); 4630 visualProps.style = { 4631 ...rawStyles, 4632 ...visualProps.style 4633 }; 4634 } 4635 return visualProps; 4636} 4637var import_react$8; 4638function init_use_props$1() { 4639 return (init_use_props$1 = __esmMin((() => { 4640 init_build_attrs(), init_is_svg_tag(); 4641 import_react$8 = require_react(); 4642 init_use_props(); 4643 init_create_render_state$1(); 4644 })))(); 4645} 4646//#endregion 4647//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs 4648/** 4649* Check whether a prop name is a valid `MotionProp` key. 4650* 4651* @param key - Name of the property to check 4652* @returns `true` is key is a valid `MotionProp`. 4653* 4654* @public 4655*/ 4656function isValidMotionProp(key) { 4657 return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key); 4658} 4659var validMotionProps; 4660function init_valid_prop() { 4661 return (init_valid_prop = __esmMin((() => { 4662 validMotionProps = /* @__PURE__ */ new Set([ 4663 "animate", 4664 "exit", 4665 "variants", 4666 "initial", 4667 "style", 4668 "values", 4669 "variants", 4670 "transition", 4671 "transformTemplate", 4672 "custom", 4673 "inherit", 4674 "onBeforeLayoutMeasure", 4675 "onAnimationStart", 4676 "onAnimationComplete", 4677 "onUpdate", 4678 "onDragStart", 4679 "onDrag", 4680 "onDragEnd", 4681 "onMeasureDragConstraints", 4682 "onDirectionLock", 4683 "onDragTransitionEnd", 4684 "_dragX", 4685 "_dragY", 4686 "onHoverStart", 4687 "onHoverEnd", 4688 "onViewportEnter", 4689 "onViewportLeave", 4690 "globalTapTarget", 4691 "propagate", 4692 "ignoreStrict", 4693 "viewport" 4694 ]); 4695 })))(); 4696} 4697//#endregion 4698//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs 4699function shouldForward(key, isValidProp) { 4700 return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp?.(key) ?? !isValidMotionProp(key); 4701} 4702function filterProps(props, isDom, forwardMotionProps, isValidProp) { 4703 const filteredProps = {}; 4704 for (const key in props) { 4705 /** 4706 * values is considered a valid prop by Emotion, so if it's present 4707 * this will be rendered out to the DOM unless explicitly filtered. 4708 * 4709 * We check the type as it could be used with the `feColorMatrix` 4710 * element, which we support. 4711 */ 4712 if (key === "values" && typeof props.values === "object") continue; 4713 if (isMotionValue(props[key])) continue; 4714 if (shouldForward(key, isValidProp) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || props["draggable"] && key.startsWith("onDrag")) filteredProps[key] = props[key]; 4715 } 4716 return filteredProps; 4717} 4718function init_filter_props() { 4719 return (init_filter_props = __esmMin((() => { 4720 init_is_motion_value(); 4721 init_valid_prop(); 4722 })))(); 4723} 4724//#endregion 4725//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs 4726var lowercaseSVGElements; 4727function init_lowercase_elements() { 4728 return (init_lowercase_elements = __esmMin((() => { 4729 lowercaseSVGElements = [ 4730 "animate", 4731 "circle", 4732 "defs", 4733 "desc", 4734 "ellipse", 4735 "g", 4736 "image", 4737 "line", 4738 "filter", 4739 "marker", 4740 "mask", 4741 "metadata", 4742 "path", 4743 "pattern", 4744 "polygon", 4745 "polyline", 4746 "rect", 4747 "stop", 4748 "switch", 4749 "symbol", 4750 "svg", 4751 "text", 4752 "tspan", 4753 "use", 4754 "view" 4755 ]; 4756 })))(); 4757} 4758//#endregion 4759//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/dom/ut
4759ils/is-svg-component.mjs 4760function isSVGComponent(Component) { 4761 if (typeof Component !== "string" || Component.includes("-")) return false; 4762 else if (lowercaseSVGElements.indexOf(Component) > -1 || /[A-Z]/u.test(Component)) return true; 4763 return false; 4764} 4765function init_is_svg_component() { 4766 return (init_is_svg_component = __esmMin((() => { 4767 init_lowercase_elements(); 4768 })))(); 4769} 4770//#endregion 4771//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/dom/use-render.mjs 4772function useRender(Component, props, ref, { latestValues }, isStatic, forwardMotionProps = false, isSVG, isValidProp) { 4773 const visualProps = (isSVG ?? isSVGComponent(Component) ? useSVGProps : useHTMLProps)(props, latestValues, isStatic, Component); 4774 const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps, isValidProp); 4775 const elementProps = Component !== import_react$7.Fragment ? { 4776 ...filteredProps, 4777 ...visualProps, 4778 ref 4779 } : {}; 4780 /** 4781 * If component has been handed a motion value as its child, 4782 * memoise its initial value and render that. Subsequent updates 4783 * will be handled by the onChange handler 4784 */ 4785 const { children } = props; 4786 const renderedChildren = (0, import_react$7.useMemo)(() => isMotionValue(children) ? children.get() : children, [children]); 4787 return (0, import_react$7.createElement)(Component, { 4788 ...elementProps, 4789 children: renderedChildren 4790 }); 4791} 4792var import_react$7; 4793function init_use_render() { 4794 return (init_use_render = __esmMin((() => { 4795 init_is_motion_value(); 4796 import_react$7 = require_react(); 4797 init_use_props(); 4798 init_use_props$1(); 4799 init_filter_props(); 4800 init_is_svg_component(); 4801 })))(); 4802} 4803//#endregion 4804//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs 4805function makeState({ scrapeMotionValuesFromProps, createRenderState }, props, context, presenceContext) { 4806 return { 4807 latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps), 4808 renderState: createRenderState() 4809 }; 4810} 4811function makeLatestValues(props, context, presenceContext, scrapeMotionValues) { 4812 const values = {}; 4813 const motionValues = scrapeMotionValues(props, {}); 4814 for (const key in motionValues) values[key] = resolveMotionValue(motionValues[key]); 4815 let { initial, animate } = props; 4816 const isControllingVariants$1 = isControllingVariants(props); 4817 const isVariantNode$1 = isVariantNode(props); 4818 if (context && isVariantNode$1 && !isControllingVariants$1 && props.inherit !== false) { 4819 if (initial === void 0) initial = context.initial; 4820 if (animate === void 0) animate = context.animate; 4821 } 4822 let isInitialAnimationBlocked = presenceContext ? presenceContext.initial === false : false; 4823 isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false; 4824 const variantToSet = isInitialAnimationBlocked ? animate : initial; 4825 if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) { 4826 const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet]; 4827 for (let i = 0; i < list.length; i++) { 4828 const resolved = resolveVariantFromProps(props, list[i]); 4829 if (resolved) { 4830 const { transitionEnd, transition, ...target } = resolved; 4831 for (const key in target) { 4832 let valueTarget = target[key]; 4833 if (Array.isArray(valueTarget)) { 4834 /** 4835 * Take final keyframe if the initial animation is blocked because 4836 * we want to initialise at the end of that blocked animation. 4837 */ 4838 const index = isInitialAnimationBlocked ? valueTarget.length - 1 : 0; 4839 valueTarget = valueTarget[index]; 4840 } 4841 if (valueTarget !== null) values[key] = valueTarget; 4842 } 4843 for (const key in transitionEnd) values[key] = transitionEnd[key]; 4844 } 4845 } 4846 } 4847 return values; 4848} 4849var import_react$6, makeUseVisualState; 4850function init_use_visual_state() { 4851 return (init_use_visual_state = __esmMin((() => { 4852 init_resolve_motion_value(), init_is_controlling_variants(); 4853 import_react$6 = require_react(); 4854 init_MotionContext(); 4855 init_PresenceContext(); 4856 init_use_constant(); 4857 makeUseVisualState = (config) => (props, isStatic) => { 4858 const context = (0, import_react$6.useContext)(MotionContext); 4859 const presenceContext = (0, import_react$6.useContext)(PresenceContext); 4860 const make = () => makeState(config, props, context, presenceContext); 4861 return isStatic ? make() : useConstant(make); 4862 }; 4863 })))(); 4864} 4865//#endregion 4866//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.mjs 4867var useHTMLVisualState; 4868function init_use_html_visual_state() { 4869 return (init_use_html_visual_state = __esmMin((() => { 4870 init_scrape_motion_values(); 4871 init_use_visual_state(); 4872 init_create_render_state(); 4873 useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({ 4874 scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1, 4875 createRenderState: createHtmlRenderState 4876 }); 4877 })))(); 4878} 4879//#endregion 4880//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.mjs
4881var useSVGVisualState; 4882function init_use_svg_visual_state() { 4883 return (init_use_svg_visual_state = __esmMin((() => { 4884 init_scrape_motion_values$1(); 4885 init_use_visual_state(); 4886 init_create_render_state$1(); 4887 useSVGVisualState = /*@__PURE__*/ makeUseVisualState({ 4888 scrapeMotionValuesFromProps, 4889 createRenderState: createSvgRenderState 4890 }); 4891 })))(); 4892} 4893//#endregion 4894//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/utils/symbol.mjs 4895var motionComponentSymbol; 4896function init_symbol() { 4897 return (init_symbol = __esmMin((() => { 4898 motionComponentSymbol = Symbol.for("motionComponentSymbol"); 4899 })))(); 4900} 4901//#endregion 4902//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs 4903/** 4904* Creates a ref function that, when called, hydrates the provided 4905* external ref and VisualElement. 4906*/ 4907function useMotionRef(visualState, visualElement, externalRef) { 4908 /** 4909 * Store externalRef in a ref to avoid including it in the useCallback 4910 * dependency array. Including externalRef in dependencies causes issues 4911 * with libraries like Radix UI that create new callback refs on each render 4912 * when using asChild - this would cause the callback to be recreated,
4913 * triggering element remounts and breaking AnimatePresence exit animations. 4914 */ 4915 const externalRefContainer = (0, import_react$5.useRef)(externalRef); 4916 (0, import_react$5.useInsertionEffect)(() => { 4917 externalRefContainer.current = externalRef; 4918 }); 4919 const refCleanup = (0, import_react$5.useRef)(null); 4920 return (0, import_react$5.useCallback)((instance) => { 4921 if (instance) visualState.onMount?.(instance); 4922 if (visualElement) instance ? visualElement.mount(instance) : visualElement.unmount(); 4923 const ref = externalRefContainer.current; 4924 if (typeof ref === "function") { 4925 if (instance) { 4926 const cleanup = ref(instance); 4927 if (typeof cleanup === "function") refCleanup.current = cleanup; 4928 } else if (refCleanup.current) { 4929 refCleanup.current(); 4930 refCleanup.current = null; 4931 } else ref(instance); 4932 } else if (ref) ref.current = instance; 4933 }, [visualElement]); 4934} 4935var import_react$5; 4936function init_use_motion_ref() { 4937 return (init_use_motion_ref = __esmMin((() => { 4938 import_react$5 = require_react(); 4939 })))(); 4940} 4941//#endregion 4942//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs 4943var import_react$4, SwitchLayoutGroupContext; 4944function init_SwitchLayoutGroupContext() { 4945 return (init_SwitchLayoutGroupContext = __esmMin((() => { 4946 import_react$4 = require_react(); 4947 SwitchLayoutGroupContext = (0, import_react$4.createContext)({}); 4948 })))(); 4949} 4950//#endregion 4951//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/is-ref-object.mjs 4952function isRefObject(ref) { 4953 return ref && typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current"); 4954} 4955//#endregion 4956//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs 4957function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor, isSVG) { 4958 const { visualElement: parent } = (0, import_react$3.useContext)(MotionContext); 4959 const lazyContext = (0, import_react$3.useContext)(LazyContext); 4960 const presenceContext = (0, import_react$3.useContext)(PresenceContext); 4961 const motionConfig = (0, import_react$3.useContext)(MotionConfigContext); 4962 const reducedMotionConfig = motionConfig.reducedMotion; 4963 const skipAnimations = motionConfig.skipAnimations; 4964 const visualElementRef = (0, import_react$3.useRef)(null); 4965 /** 4966 * Track whether the component has been through React's commit phase.
4967 * Used to detect when LazyMotion features load after the component has mounted. 4968 */ 4969 const hasMountedOnce = (0, import_react$3.useRef)(false); 4970 /** 4971 * If we haven't preloaded a renderer, check to see if we have one lazy-loaded 4972 */ 4973 createVisualElement = createVisualElement || lazyContext.renderer; 4974 if (!visualElementRef.current && createVisualElement) { 4975 visualElementRef.current = createVisualElement(Component, { 4976 visualState, 4977 parent, 4978 props, 4979 presenceContext, 4980 blockInitialAnimation: presenceContext ? presenceContext.initial === false : false, 4981 reducedMotionConfig, 4982 skipAnimations, 4983 isSVG 4984 }); 4985 /** 4986 * If the component has already mounted before features loaded (e.g. via 4987 * LazyMotion with async feature loading), we need to force the initial 4988 * animation to run. Otherwise state changes that occurred before features 4989 * loaded will be lost and the element will snap to its final state. 4990 */ 4991 if (hasMountedOnce.current && visualElementRef.current) visualElementRef.current.manuallyAnimateOnMount = true; 4992 } 4993 const visualElement = visualElementRef.current; 4994 /** 4995 * Load Motion gesture and animation features. These are rendered as renderless 4996 * components so each feature can optionally make use of React lifecycle methods. 4997 */ 4998 const initialLayoutGroupConfig = (0, import_react$3.useContext)(SwitchLayoutGroupContext); 4999 if (visualElement && !visualElement.projection && ProjectionNodeConstructor && (visualElement.type === "html" || visualElement.type === "svg")) createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig); 5000 const isMounted = (0, import_react$3.useRef)(false); 5001 (0, import_react$3.useInsertionEffect)(() => { 5002 /** 5003 * Check the component has already mounted before calling 5004 * `update` unnecessarily. This ensures we skip the initial update. 5005 */ 5006 if (visualElement && isMounted.current) visualElement.update(props, presenceContext); 5007 }); 5008 /** 5009 * Cache this value as we want to know whether HandoffAppearAnimations 5010 * was present on initial render - it will be deleted after this. 5011 */ 5012 const optimisedAppearId = props[optimizedAppearDataAttribute]; 5013 const wantsHandoff = (0, import_react$3.useRef)(Boolean(optimisedAppearId) && typeof window !== "undefined" && !window.MotionHandoffIsComplete?.(optimisedAppearId) && window.MotionHasOptimisedAnimation?.(optimisedAppearId)); 5014 useIsomorphicLayoutEffect(() => { 5015 /** 5016 * Track that this component has mounted. This is used to detect when 5017 * LazyMotion features load after the component has already committed. 5018 */ 5019 hasMountedOnce.current = true; 5020 if (!visualElement) return; 5021 isMounted.current = true; 5022 window.MotionIsMounted = true; 5023 visualElement.updateFeatures(); 5024 visualElement.scheduleRenderMicrotask(); 5025 /** 5026 * Ideally this function would always run in a useEffect. 5027 * 5028 * However, if we have optimised appear animations to handoff from, 5029 * it needs to happen synchronously to ensure there's no flash of 5030 * incorrect styles in the event of a hydration error. 5031 * 5032 * So if we detect a situtation where optimised appear animations 5033 * are running, we use useLayoutEffect to trigger animations. 5034 */ 5035 if (wantsHandoff.current && visualElement.animationState) visualElement.animationState.animateChanges(); 5036 }); 5037 (0, import_react$3.useEffect)(() => { 5038 if (!visualElement) return; 5039 if (!wantsHandoff.current && visualElement.animationState) visualElement.animationState.animateChanges(); 5040 if (wantsHandoff.current) { 5041 queueMicrotask(() => { 5042 window.MotionHandoffMarkAsComplete?.(optimisedAppearId); 5043 }); 5044 wantsHandoff.current = false; 5045 } 5046 /** 5047 * Now we've finished triggering animations for this element we 5048 * can wipe the enteringChildren set for the next render. 5049 */ 5050 visualElement.enteringChildren = void 0; 5051 }); 5052 return visualElement; 5053} 5054function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) { 5055 const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, layoutAnchor, layoutCrossfade } = props; 5056 visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent)); 5057 visualElement.projection.setOptions({ 5058 layoutId, 5059 layout, 5060 alwaysMeasureLayout: Boolean(drag) || dragConstraints && isRefObject(dragConstraints), 5061 visualElement, 5062 /** 5063 * TODO: Update options in an effect. This could be tricky as it'll be too late 5064 * to update by the time layout animations run.
5065 * We also need to fix this safeToRemove by linking it up to the one returned by usePresence, 5066 * ensuring it gets called if there's no potential layout animations. 5067 * 5068 */ 5069 animationType: typeof layout === "string" ? layout : "both", 5070 initialPromotionConfig, 5071 crossfade: layoutCrossfade, 5072 layoutScroll, 5073 layoutRoot, 5074 layoutAnchor 5075 }); 5076} 5077function getClosestProjectingNode(visualElement) { 5078 if (!visualElement) return void 0; 5079 return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent); 5080} 5081var import_react$3; 5082function init_use_visual_element() { 5083 return (init_use_visual_element = __esmMin((() => { 5084 init_data_id(); 5085 import_react$3 = require_react(); 5086 init_LazyContext(); 5087 init_MotionConfigContext(); 5088 init_MotionContext(); 5089 init_PresenceContext(); 5090 init_SwitchLayoutGroupContext(); 5091 init_use_isomorphic_effect(); 5092 })))(); 5093} 5094//#endregion 5095//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/index.mjs 5096/** 5097* Create a `motion` component. 5098* 5099* This function accepts a Component argument, which can be either a string (ie "div" 5100* for `motion.div`), or an actual React component. 5101* 5102* Alongside this is a config option which provides a way of rendering the provided 5103* component "offline", or outside the React render cycle. 5104*/ 5105function createMotionComponent(Component, { forwardMotionProps = false, type } = {}, preloadedFeatures, createVisualElement) { 5106 preloadedFeatures && loadFeatures(preloadedFeatures); 5107 /** 5108 * Determine whether to use SVG or HTML rendering based on: 5109 * 1. Explicit `type` option (highest priority) 5110 * 2. Auto-detection via `isSVGComponent` 5111 */ 5112 const isSVG = type ? type === "svg" : isSVGComponent(Component); 5113 const useVisualState = isSVG ? useSVGVisualState : useHTMLVisualState; 5114 function MotionDOMComponent(props, externalRef) { 5115 /** 5116 * If we need to measure the element we load this functionality in a 5117 * separate class component in order to gain access to getSnapshotBeforeUpdate. 5118 */ 5119 let MeasureLayout; 5120 const configAndProps = { 5121 ...(0, import_react$2.useContext)(MotionConfigContext), 5122 ...props, 5123 layoutId: useLayoutId(props) 5124 }; 5125 const { isStatic, isValidProp } = configAndProps; 5126 const context = useCreateMotionContext(props); 5127 const visualState = useVisualState(props, isStatic); 5128 if (!isStatic && typeof window !== "undefined") { 5129 useStrictMode(configAndProps, preloadedFeatures); 5130 const layoutProjection = getProjectionFunctionality(configAndProps); 5131 MeasureLayout = layoutProjection.MeasureLayout; 5132 /** 5133 * Create a VisualElement for this component. A VisualElement provides a common 5134 * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as 5135 * providing a way of rendering to these APIs outside of the React render loop 5136 * for more performant animations and interactions 5137 */ 5138 context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode, isSVG); 5139 } 5140 /** 5141 * The mount order and hierarchy is specific to ensure our element ref 5142 * is hydrated by the time features fire their effects. 5143 */ 5144 return (0, import_jsx_runtime$1.jsxs)(MotionContext.Provider, { 5145 value: context, 5146 children: [MeasureLayout && context.visualElement ? (0, import_jsx_runtime$1.jsx)(MeasureLayout, { 5147 visualElement: context.visualElement, 5148 ...configAndProps 5149 }) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, forwardMotionProps, isSVG, isValidProp)] 5150 }); 5151 } 5152 MotionDOMComponent.displayName = `motion.${typeof Component === "string" ? Component : `create(${Component.displayName ?? Component.name ?? ""})`}`; 5153 const ForwardRefMotionComponent = (0, import_react$2.forwardRef)(MotionDOMComponent); 5154 ForwardRefMotionComponent[motionComponentSymbol] = Component; 5155 return ForwardRefMotionComponent; 5156} 5157function useLayoutId({ layoutId }) { 5158 const layoutGroupId = (0, import_react$2.useContext)(LayoutGroupContext).id; 5159 return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId; 5160} 5161function useStrictMode(configAndProps, preloadedFeatures) { 5162 (0, import_react$2.useContext)(LazyContext).strict; 5163} 5164function getProjectionFunctionality(props) { 5165 const { drag, layout } = getInitializedFeatureDefinitions(); 5166 if (!drag && !layout) return {}; 5167 const combined = { 5168 ...drag, 5169 ...layout 5170 }; 5171 return {
5172 MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props) ? combined.MeasureLayout : void 0, 5173 ProjectionNode: combined.ProjectionNode 5174 }; 5175} 5176var import_jsx_runtime$1, import_react$2; 5177function init_motion() { 5178 return (init_motion = __esmMin((() => { 5179 import_jsx_runtime$1 = require_jsx_runtime(); 5180 import_react$2 = require_react(); 5181 init_LayoutGroupContext(); 5182 init_LazyContext(); 5183 init_MotionConfigContext(); 5184 init_MotionContext(); 5185 init_create(); 5186 init_use_render(); 5187 init_is_svg_component(); 5188 init_use_html_visual_state(); 5189 init_use_svg_visual_state(); 5190 init_definitions(); 5191 init_load_features(); 5192 init_symbol(); 5193 init_use_motion_ref(); 5194 init_use_visual_element(); 5195 })))(); 5196} 5197//#endregion 5198//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/components/create-proxy.mjs 5199function createMotionProxy(preloadedFeatures, createVisualElement) { 5200 if (typeof Proxy === "undefined") return createMotionComponent; 5201 /** 5202 * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc. 5203 * Rather than generating them anew every render. 5204 */ 5205 const componentCache = /* @__PURE__ */ new Map(); 5206 const factory = (Component, options) => { 5207 return createMotionComponent(Component, options, preloadedFeatures, createVisualElement); 5208 }; 5209 /** 5210 * Support for deprecated`motion(Component)` pattern 5211 */ 5212 const deprecatedFactoryFunction = (Component, options) => { 5213 return factory(Component, options); 5214 }; 5215 return new Proxy(deprecatedFactoryFunction, { 5216 /** 5217 * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc. 5218 * The prop name is passed through as `key` and we can use that to generate a `motion` 5219 * DOM component with that name. 5220 */ 5221get: (_target, key) => { 5222 if (key === "create") return factory; 5223 /** 5224 * If this element doesn't exist in the component cache, create it and cache. 5225 */ 5226 if (!componentCache.has(key)) componentCache.set(key, createMotionComponent(key, void 0, preloadedFeatures, createVisualElement)); 5227 return componentCache.get(key); 5228 } }); 5229} 5230function init_create_proxy() { 5231 return (init_create_proxy = __esmMin((() => { 5232 init_motion(); 5233 })))(); 5234} 5235//#endregion 5236//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs 5237var import_react$1, createDomVisualElement; 5238function init_create_visual_element() { 5239 return (init_create_visual_element = __esmMin((() => { 5240 init_SVGVisualElement(), init_HTMLVisualElement(); 5241 import_react$1 = require_react(); 5242 init_is_svg_component(); 5243 createDomVisualElement = (Component, options) => { 5244 return options.isSVG ?? isSVGComponent(Component) ? new SVGVisualElement(options) : new HTMLVisualElement(options, { allowProjection: Component !== import_react$1.Fragment }); 5245 }; 5246 })))(); 5247} 5248//#endregion 5249//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/animation/index.mjs 5250var AnimationFeature; 5251function init_animation() { 5252 return (init_animation = __esmMin((() => { 5253 init_Feature(), init_animation_state(); 5254 AnimationFeature = class extends Feature { 5255 /** 5256 * We dynamically generate the AnimationState manager as it contains a reference 5257 * to the underlying animation library. We only want to load that if we load this, 5258 * so people can optionally code split it out using the `m` component. 5259 */ 5260 constructor(node) { 5261 super(node); 5262 node.animationState || (node.animationState = createAnimationState(node)); 5263 } 5264 updateAnimationControlsSubscription() { 5265 const { animate } = this.node.getProps(); 5266 if (isAnimationControls(animate)) this.unmountControls = animate.subscribe(this.node); 5267 } 5268 /** 5269 * Subscribe any provided AnimationControls to the component's VisualElement 5270 */ 5271 mount() { 5272 this.updateAnimationControlsSubscription(); 5273 } 5274 update() { 5275 const { animate } = this.node.getProps(); 5276 const { animate: prevAnimate } = this.node.prevProps || {}; 5277 if (animate !== prevAnimate) this.updateAnimationControlsSubscription(); 5278 } 5279 unmount() { 5280 this.node.animationState.reset(); 5281 this.unmountControls?.(); 5282 } 5283 }; 5284 })))(); 5285} 5286//#endregion 5287//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs 5288var id, ExitAnimationFeature;
5289function init_exit() { 5290 return (init_exit = __esmMin((() => { 5291 init_Feature(), init_resolve_dynamic_variants(); 5292 id = 0; 5293 ExitAnimationFeature = class extends Feature { 5294 constructor() { 5295 super(...arguments); 5296 this.id = id++; 5297 this.isExitComplete = false; 5298 } 5299 update() { 5300 if (!this.node.presenceContext) return; 5301 const { isPresent, onExitComplete } = this.node.presenceContext; 5302 const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}; 5303 if (!this.node.animationState || isPresent === prevIsPresent) return; 5304 if (isPresent && prevIsPresent === false) { 5305 /** 5306 * When re-entering, if the exit animation already completed 5307 * (element is at rest), reset to initial values so the enter 5308 * animation replays from the correct position. 5309 */ 5310 if (this.isExitComplete) { 5311 const { initial, custom } = this.node.getProps(); 5312 if (typeof initial === "string" || typeof initial === "object" && initial !== null && !Array.isArray(initial)) { 5313 const resolved = resolveVariant(this.node, initial, custom); 5314 if (resolved) { 5315 const { transition, transitionEnd, ...target } = resolved; 5316 for (const key in target) this.node.getValue(key)?.jump(target[key]); 5317 } 5318 } 5319 this.node.animationState.reset(); 5320 this.node.animationState.animateChanges(); 5321 } else this.node.animationState.setActive("exit", false); 5322 this.isExitComplete = false; 5323 return; 5324 } 5325 const exitAnimation = this.node.animationState.setActive("exit", !isPresent); 5326 if (onExitComplete && !isPresent) exitAnimation.then(() => { 5327 this.isExitComplete = true; 5328 onExitComplete(this.id); 5329 }); 5330 } 5331 mount() { 5332 const { register, onExitComplete } = this.node.presenceContext || {}; 5333 if (onExitComplete) onExitComplete(this.id); 5334 if (register) this.unmount = register(this.id); 5335 } 5336 unmount() {} 5337 }; 5338 })))(); 5339} 5340//#endregion 5341//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/animations.mjs 5342var animations; 5343function init_animations() { 5344 return (init_animations = __esmMin((() => { 5345 init_animation(); 5346 init_exit(); 5347 animations = { 5348 animation: { Feature: AnimationFeature }, 5349 exit: { Feature: ExitAnimationFeature } 5350 }; 5351 })))(); 5352} 5353//#endregion 5354//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/events/event-info.mjs 5355function extractEventInfo(event) { 5356 return { point: { 5357 x: event.pageX, 5358 y: event.pageY 5359 } }; 5360} 5361var addPointerInfo; 5362function init_event_info() { 5363 return (init_event_info = __esmMin((() => { 5364 init_is_primary_pointer(); 5365 addPointerInfo = (handler) => (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event)); 5366 })))(); 5367} 5368//#endregion 5369//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/events/add-pointer-event.mjs 5370function addPointerEvent(target, eventName, handler, options) { 5371 return addDomEvent(target, eventName, addPointerInfo(handler), options); 5372} 5373function init_add_pointer_event() { 5374 return (init_add_pointer_event = __esmMin((() => { 5375 init_event_info(); 5376 })))(); 5377} 5378//#endregion 5379//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/utils/get-context-window.mjs 5380var getContextWindow; 5381function init_get_context_window() { 5382 return (init_get_context_window = __esmMin((() => { 5383 getContextWindow = ({ current }) => { 5384 return current ? current.ownerDocument.defaultView : null; 5385 }; 5386 })))(); 5387} 5388//#endregion 5389//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs 5390function transformPoint(info, transformPagePoint) { 5391 return transformPagePoint ? { point: transformPagePoint(info.point) } : info; 5392} 5393function subtractPoint(a, b) { 5394 return { 5395 x: a.x - b.x, 5396 y: a.y - b.y 5397 }; 5398} 5399function getPanInfo({ point }, history) { 5400 return { 5401 point,
5402 delta: subtractPoint(point, lastDevicePoint(history)), 5403 offset: subtractPoint(point, startDevicePoint(history)), 5404 velocity: getVelocity(history, .1) 5405 }; 5406} 5407function startDevicePoint(history) { 5408 return history[0]; 5409} 5410function lastDevicePoint(history) { 5411 return history[history.length - 1]; 5412} 5413function getVelocity(history, timeDelta) { 5414 if (history.length < 2) return { 5415 x: 0, 5416 y: 0 5417 }; 5418 let i = history.length - 1; 5419 let timestampedPoint = null; 5420 const lastPoint = lastDevicePoint(history); 5421 while (i >= 0) { 5422 timestampedPoint = history[i]; 5423 if (lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta)) break; 5424 i--; 5425 } 5426 if (!timestampedPoint) return { 5427 x: 0, 5428 y: 0 5429 }; 5430 /** 5431 * If the selected point is the pointer-down origin (history[0]), 5432 * there are better movement points available, and the time gap 5433 * is suspiciously large (>2x timeDelta), use the next point instead. 5434 * This prevents stale pointer-down points from diluting velocity 5435 * in hold-then-flick gestures. 5436 */ 5437 if (timestampedPoint === history[0] && history.length > 2 && lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta) * 2) timestampedPoint = history[1]; 5438 const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp); 5439 if (time === 0) return { 5440 x: 0, 5441 y: 0 5442 }; 5443 const currentVelocity = { 5444 x: (lastPoint.x - timestampedPoint.x) / time, 5445 y: (lastPoint.y - timestampedPoint.y) / time 5446 }; 5447 if (currentVelocity.x === Infinity) currentVelocity.x = 0; 5448 if (currentVelocity.y === Infinity) currentVelocity.y = 0; 5449 return currentVelocity; 5450} 5451var overflowStyles, PanSession; 5452function init_PanSession() { 5453 return (init_PanSession = __esmMin((() => { 5454 init_frame(), init_is_primary_pointer(); 5455 init_pipe(), init_time_conversion(); 5456 init_add_pointer_event(); 5457 init_event_info(); 5458 init_distance(); 5459 overflowStyles = /*#__PURE__*/ new Set(["auto", "scroll"]); 5460 PanSession = class { 5461 constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element } = {}) { 5462 /** 5463 * @internal 5464 */ 5465 this.startEvent = null; 5466 /** 5467 * @internal 5468 */ 5469 this.lastMoveEvent = null; 5470 /** 5471 * @internal 5472 */ 5473 this.lastMoveEventInfo = null; 5474 /** 5475 * Raw (untransformed) event info, re-transformed each frame 5476 * so transformPagePoint sees the current parent matrix. 5477 * @internal 5478 */ 5479 this.lastRawMoveEventInfo = null; 5480 /** 5481 * @internal 5482 */ 5483 this.handlers = {}; 5484 /** 5485 * @internal 5486 */ 5487 this.contextWindow = window; 5488 /** 5489 * Scroll positions of scrollable ancestors and window. 5490 * @internal 5491 */ 5492 this.scrollPositions = /* @__PURE__ */ new Map(); 5493 /** 5494 * Cleanup function for scroll listeners. 5495 * @internal 5496 */ 5497 this.removeScrollListeners = null; 5498 this.onElementScroll = (event) => { 5499 this.handleScroll(event.target); 5500 }; 5501 this.onWindowScroll = () => { 5502 this.handleScroll(window); 5503 }; 5504 this.updatePoint = () => { 5505 if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; 5506 if (this.lastRawMoveEventInfo) this.lastMoveEventInfo = transformPoint(this.lastRawMoveEventInfo, this.transformPagePoint); 5507 const info = getPanInfo(this.lastMoveEventInfo, this.history); 5508 const isPanStarted = this.startEvent !== null; 5509 const isDistancePastThreshold = distance2D(info.offset, { 5510 x: 0, 5511 y: 0 5512 }) >= this.distanceThreshold; 5513 if (!isPanStarted && !isDistancePastThreshold) return; 5514 const { point } = info; 5515 const { timestamp } = frameData; 5516 this.history.push({ 5517 ...point, 5518 timestamp 5519 }); 5520 const { onStart, onMove } = this.handlers; 5521 if (!isPanStarted) { 5522 onStart && onStart(this.lastMoveEvent, info); 5523 this.startEvent = this.lastMoveEvent; 5524 } 5525 onMove && onMove(this.lastMoveEvent, info); 5526 }; 5527 this.handlePointerMove = (event, info) => { 5528 this.lastMoveEvent = event; 5529 this.lastRawMoveEventInfo = info; 5530 this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint); 5531 frame.update(this.updatePoint, true); 5532 }; 5533 this.handlePointerUp = (event, info) => { 5534 this.end(); 5535 const { onEnd, onSessionEnd, resumeAnimation } = this.handlers; 5536 if (this.dragSnapToOrigin || !this.startEvent) resumeAnimation && resumeAnimation(); 5537 if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return; 5538 const panInfo = getPanInfo(event.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(info, this.transformPagePoint), this.history); 5539 if (this.startEvent && onEnd) onEnd(event, panInfo); 5540 onSessionEnd && onSessionEnd(event, panInfo); 5541 }; 5542 if (!isPrimaryPointer(event)) return; 5543 this.dragSnapToOrigin = dragSnapToOrigin; 5544 this.handlers = handlers; 5545 this.transformPagePoint = transformPagePoint; 5546 this.distanceThreshold = distanceThreshold; 5547 this.contextWindow = contextWindow || window; 5548 const initialInfo = transformPoint(extractEventInfo(event), this.transformPagePoint); 5549 const { point } = initialInfo; 5550 const { timestamp } = frameData; 5551 this.history = [{ 5552 ...point, 5553 timestamp 5554 }
5554]; 5555 const { onSessionStart } = handlers; 5556 onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history)); 5557 const eventOptions = { 5558 passive: true, 5559 capture: true 5560 }; 5561 this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove, eventOptions), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp, eventOptions), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp, eventOptions)); 5562 if (element) this.startScrollTracking(element); 5563 } 5564 /** 5565 * Start tracking scroll on ancestors and window. 5566 */ 5567 startScrollTracking(element) { 5568 let current = element.parentElement; 5569 while (current) { 5570 const style = getComputedStyle(current); 5571 if (overflowStyles.has(style.overflowX) || overflowStyles.has(style.overflowY)) this.scrollPositions.set(current, { 5572 x: current.scrollLeft, 5573 y: current.scrollTop 5574 }); 5575 current = current.parentElement; 5576 } 5577 this.scrollPositions.set(window, { 5578 x: window.scrollX, 5579 y: window.scrollY 5580 }); 5581 window.addEventListener("scroll", this.onElementScroll, { capture: true }); 5582 window.addEventListener("scroll", this.onWindowScroll); 5583 this.removeScrollListeners = () => { 5584 window.removeEventListener("scroll", this.onElementScroll, { capture: true }); 5585 window.removeEventListener("scroll", this.onWindowScroll); 5586 }; 5587 } 5588 /** 5589 * Handle scroll compensation during drag. 5590 * 5591 * For element scroll: adjusts history origin since pageX/pageY doesn't change. 5592 * For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change. 5593 */ 5594 handleScroll(target) { 5595 const initial = this.scrollPositions.get(target); 5596 if (!initial) return; 5597 const isWindow = target === window; 5598 const current = isWindow ? { 5599 x: window.scrollX, 5600 y: window.scrollY 5601 } : { 5602 x: target.scrollLeft, 5603 y: target.scrollTop 5604 }; 5605 const delta = { 5606 x: current.x - initial.x, 5607 y: current.y - initial.y 5608 }; 5609 if (delta.x === 0 && delta.y === 0) return; 5610 if (isWindow) { 5611 if (this.lastMoveEventInfo) { 5612 this.lastMoveEventInfo.point.x += delta.x; 5613 this.lastMoveEventInfo.point.y += delta.y; 5614 } 5615 } else if (this.history.length > 0) { 5616 this.history[0].x -= delta.x; 5617 this.history[0].y -= delta.y; 5618 } 5619 this.scrollPositions.set(target, current); 5620 frame.update(this.updatePoint, true); 5621 } 5622 updateHandlers(handlers) { 5623 this.handlers = handlers; 5624 } 5625 end() { 5626 this.removeListeners && this.removeListeners(); 5627 this.removeScrollListeners && this.removeScrollListeners(); 5628 this.scrollPositions.clear(); 5629 cancelFrame(this.updatePoint); 5630 } 5631 }; 5632 })))(); 5633} 5634//#endregion 5635//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs 5636/** 5637* Apply constraints to a point. These constraints are both physical along an 5638* axis, and an elastic factor that determines how much to constrain the point 5639* by if it does lie outside the defined parameters. 5640*/ 5641function applyConstraints(point, { min, max }, elastic) { 5642 if (min !== void 0 && point < min) point = elastic ? mixNumber(min, point, elastic.min) : Math.max(point, min); 5643 else if (max !== void 0 && point > max) point = elastic ? mixNumber(max, point, elastic.max) : Math.min(point, max); 5644 return point; 5645} 5646/** 5647* Calculate constraints in terms of the viewport when defined relatively to the 5648* measured axis. This is measured from the nearest edge, so a max constraint of 200 5649* on an axis with a max value of 300 would return a constraint of 500 - axis length 5650*/ 5651function calcRelativeAxisConstraints(axis, min, max) { 5652 return { 5653 min: min !== void 0 ? axis.min + min : void 0, 5654 max: max !== void 0 ? axis.max + max - (axis.max - axis.min) : void 0 5655 }; 5656} 5657/** 5658* Calculate constraints in terms of the viewport when 5659* defined relatively to the measured bounding box. 5660*/ 5661function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) { 5662 return { 5663 x: calcRelativeAxisConstraints(layoutBox.x, left, right), 5664 y: calcRelativeAxisConstraints(layoutBox.y, top, bottom) 5665 }; 5666} 5667/** 5668* Calculate viewport constraints when defined as another viewport-relative axis 5669*/ 5670function calcViewportAxisConstraints(layoutAxis, constraintsAxis) { 5671 let min = constraintsAxis.min - layoutAxis.min; 5672 let max = constraintsAxis.max - layoutAxis.max; 5673 if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) [min, max] = [max, min]; 5674 return { 5675 min, 5676 max 5677 }; 5678} 5679/** 5680* Calculate viewport constraints when defined as another viewport-relative box 5681*/ 5682function calcViewportConstraints(layoutBox, constraintsBox) { 5683 return { 5684 x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x), 5685 y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y) 5686 }; 5687} 5688/** 5689* Calculate a transform origin relative to the source axis, between 0-1, that results 5690* in an asthetically pleasing scale/transform needed to project from source to target.
5691*/ 5692function calcOrigin(source, target) { 5693 let origin = .5; 5694 const sourceLength = calcLength(source); 5695 const targetLength = calcLength(target); 5696 if (targetLength > sourceLength) origin = progress(target.min, target.max - sourceLength, source.min); 5697 else if (sourceLength > targetLength) origin = progress(source.min, source.max - targetLength, target.min); 5698 return clamp(0, 1, origin); 5699} 5700/** 5701* Rebase the calculated viewport constraints relative to the layout.min point. 5702*/ 5703function rebaseAxisConstraints(layout, constraints) { 5704 const relativeConstraints = {}; 5705 if (constraints.min !== void 0) relativeConstraints.min = constraints.min - layout.min; 5706 if (constraints.max !== void 0) relativeConstraints.max = constraints.max - layout.min; 5707 return relativeConstraints; 5708} 5709/** 5710* Accepts a dragElastic prop and returns resolved elastic values for each axis. 5711*/ 5712function resolveDragElastic(dragElastic = defaultElastic) { 5713 if (dragElastic === false) dragElastic = 0; 5714 else if (dragElastic === true) dragElastic = defaultElastic; 5715 return { 5716 x: resolveAxisElastic(dragElastic, "left", "right"), 5717 y: resolveAxisElastic(dragElastic, "top", "bottom") 5718 }; 5719} 5720function resolveAxisElastic(dragElastic, minLabel, maxLabel) { 5721 return { 5722 min: resolvePointElastic(dragElastic, minLabel), 5723 max: resolvePointElastic(dragElastic, maxLabel) 5724 }; 5725} 5726function resolvePointElastic(dragElastic, label) { 5727 return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0; 5728} 5729var defaultElastic; 5730function init_constraints() { 5731 return (init_constraints = __esmMin((() => { 5732 init_number(), init_delta_calc(); 5733 init_progress(), init_clamp(); 5734 defaultElastic = .35; 5735 })))(); 5736} 5737//#endregion 5738//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs 5739function skipFirstCall(callback) { 5740 let isFirst = true; 5741 return () => { 5742 if (isFirst) { 5743 isFirst = false; 5744 return; 5745 } 5746 callback(); 5747 }; 5748} 5749function startResizeObservers(element, constraintsElement, onResize) { 5750 const stopElement = resize(element, skipFirstCall(onResize)); 5751 const stopContainer = resize(constraintsElement, skipFirstCall(onResize)); 5752 return () => { 5753 stopElement(); 5754 stopContainer(); 5755 }; 5756} 5757function shouldDrag(direction, drag, currentDirection) { 5758 return (drag === true || drag === direction) && (currentDirection === null || currentDirection === direction); 5759} 5760/** 5761* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower 5762* than the provided threshold, return `null`. 5763* 5764* @param offset - The x/y offset from origin. 5765* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction. 5766*/ 5767function getCurrentDirection(offset, lockThreshold = 10) { 5768 let direction = null; 5769 if (Math.abs(offset.y) > lockThreshold) direction = "y"; 5770 else if (Math.abs(offset.x) > lockThreshold) direction = "x"; 5771 return direction; 5772} 5773var elementDragControls, VisualElementDragControls; 5774function init_VisualElementDragControls() { 5775 return (init_VisualElementDragControls = __esmMin((() => { 5776 init_models(), init_frame(), init_measure(), init_add_will_change(), init_motion_value(), init_number(), init_set_active(), init_units(), init_delta_calc(), init_resize(), init_is_keyboard_accessible(); 5777 init_errors(); 5778 init_add_pointer_event(); 5779 init_event_info(); 5780 init_get_context_window(); 5781 init_PanSession(); 5782 init_constraints(); 5783 elementDragControls = /* @__PURE__ */ new WeakMap(); 5784 VisualElementDragControls = class { 5785 constructor(visualElement) { 5786 this.openDragLock = null; 5787 this.isDragging = false; 5788 this.currentDirection = null; 5789 this.originPoint = { 5790 x: 0, 5791 y: 0 5792 }; 5793 /** 5794 * The permitted boundaries of travel, in pixels. 5795 */ 5796 this.constraints = false; 5797 this.hasMutatedConstraints = false; 5798 /** 5799 * The per-axis resolved elastic values. 5800 */ 5801 this.elastic = createBox(); 5802 /** 5803 * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments. 5804 */ 5805 this.latestPointerEvent = null; 5806 /** 5807 * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments. 5808 */ 5809 this.latestPanInfo = null; 5810 this.visualElement = visualElement; 5811 } 5812 start(originEvent, { snapToCursor = false, distanceThreshold } = {}) { 5813 /** 5814 * Don't start dragging if this component is exiting 5815 */ 5816 const { presenceContext } = this.visualElement;
5817 if (presenceContext && presenceContext.isPresent === false) return; 5818 const onSessionStart = (event) => { 5819 if (snapToCursor) this.snapToCursor(extractEventInfo(event).point); 5820 this.stopAnimation(); 5821 }; 5822 const onStart = (event, info) => { 5823 const { drag, dragPropagation, onDragStart } = this.getProps(); 5824 if (drag && !dragPropagation) { 5825 if (this.openDragLock) this.openDragLock(); 5826 this.openDragLock = setDragLock(drag); 5827 if (!this.openDragLock) return; 5828 } 5829 this.latestPointerEvent = event; 5830 this.latestPanInfo = info; 5831 this.isDragging = true; 5832 this.currentDirection = null; 5833 this.resolveConstraints(); 5834 if (this.visualElement.projection) { 5835 this.visualElement.projection.isAnimationBlocked = true; 5836 this.visualElement.projection.target = void 0; 5837 } 5838 /** 5839 * Record gesture origin and pointer offset 5840 */ 5841 eachAxis((axis) => { 5842 let current = this.getAxisMotionValue(axis).get() || 0; 5843 /** 5844 * If the MotionValue is a percentage value convert to px 5845 */ 5846 if (percent.test(current)) { 5847 const { projection } = this.visualElement; 5848 if (projection && projection.layout) { 5849 const measuredAxis = projection.layout.layoutBox[axis]; 5850 if (measuredAxis) current = calcLength(measuredAxis) * (parseFloat(current) / 100); 5851 } 5852 } 5853 this.originPoint[axis] = current; 5854 }); 5855 if (onDragStart) frame.update(() => onDragStart(event, info), false, true); 5856 addValueToWillChange(this.visualElement, "transform"); 5857 const { animationState } = this.visualElement; 5858 animationState && animationState.setActive("whileDrag", true); 5859 }; 5860 const onMove = (event, info) => { 5861 this.latestPointerEvent = event; 5862 this.latestPanInfo = info; 5863 const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag } = this.getProps(); 5864 if (!dragPropagation && !this.openDragLock) return; 5865 const { offset } = info; 5866 if (dragDirectionLock && this.currentDirection === null) { 5867 this.currentDirection = getCurrentDirection(offset); 5868 if (this.currentDirection !== null) onDirectionLock && onDirectionLock(this.currentDirection); 5869 return; 5870 } 5871 this.updateAxis("x", info.point, offset); 5872 this.updateAxis("y", info.point, offset); 5873 /** 5874 * Ideally we would leave the renderer to fire naturally at the end of 5875 * this frame but if the element is about to change layout as the result 5876 * of a re-render we want to ensure the browser can read the latest 5877 * bounding box to ensure the pointer and element don't fall out of sync. 5878 */ 5879 this.visualElement.render(); 5880 /** 5881 * This must fire after the render call as it might trigger a state 5882 * change which itself might trigger a layout update. 5883 */ 5884 if (onDrag) frame.update(() => onDrag(event, info), false, true); 5885 }; 5886 const onSessionEnd = (event, info) => { 5887 this.latestPointerEvent = event; 5888 this.latestPanInfo = info; 5889 this.stop(event, info); 5890 this.latestPointerEvent = null; 5891 this.latestPanInfo = null; 5892 }; 5893 const resumeAnimation = () => { 5894 const { dragSnapToOrigin: snap } = this.getProps(); 5895 if (snap || this.constraints) this.startAnimation({ 5896 x: 0, 5897 y: 0 5898 }); 5899 }; 5900 const { dragSnapToOrigin } = this.getProps(); 5901 this.panSession = new PanSession(originEvent, { 5902 onSessionStart, 5903 onStart, 5904 onMove, 5905 onSessionEnd, 5906 resumeAnimation 5907 }, { 5908 transformPagePoint: this.visualElement.getTransformPagePoint(), 5909 dragSnapToOrigin, 5910 distanceThreshold, 5911 contextWindow: getContextWindow(this.visualElement), 5912 element: this.visualElement.current 5913 }); 5914 } 5915 /** 5916 * @internal 5917 */ 5918 stop(event, panInfo) { 5919 const finalEvent = event || this.latestPointerEvent; 5920 const finalPanInfo = panInfo || this.latestPanInfo; 5921 const isDragging = this.isDragging; 5922 this.cancel(); 5923 if (!isDragging || !finalPanInfo || !finalEvent) return; 5924 const { velocity } = finalPanInfo; 5925 this.startAnimation(velocity); 5926 const { onDragEnd } = this.getProps(); 5927 if (onDragEnd) frame.postRender(() => onDragEnd(finalEvent, finalPanInfo)); 5928 } 5929 /** 5930 * @internal 5931 */ 5932 cancel() { 5933 this.isDragging = false;
5934 const { projection, animationState } = this.visualElement; 5935 if (projection) projection.isAnimationBlocked = false; 5936 this.endPanSession(); 5937 const { dragPropagation } = this.getProps(); 5938 if (!dragPropagation && this.openDragLock) { 5939 this.openDragLock(); 5940 this.openDragLock = null; 5941 } 5942 animationState && animationState.setActive("whileDrag", false); 5943 } 5944 /** 5945 * Clean up the pan session without modifying other drag state. 5946 * This is used during unmount to ensure event listeners are removed 5947 * without affecting projection animations or drag locks. 5948 * @internal 5949 */ 5950 endPanSession() { 5951 this.panSession && this.panSession.end(); 5952 this.panSession = void 0; 5953 } 5954 updateAxis(axis, _point, offset) { 5955 const { drag } = this.getProps(); 5956 if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return; 5957 const axisValue = this.getAxisMotionValue(axis); 5958 let next = this.originPoint[axis] + offset[axis]; 5959 if (this.constraints && this.constraints[axis]) next = applyConstraints(next, this.constraints[axis], this.elastic[axis]); 5960 axisValue.set(next); 5961 } 5962 resolveConstraints() { 5963 const { dragConstraints, dragElastic } = this.getProps(); 5964 const layout = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : this.visualElement.projection?.layout; 5965 const prevConstraints = this.constraints; 5966 if (dragConstraints && isRefObject(dragConstraints)) { 5967 if (!this.constraints) this.constraints = this.resolveRefConstraints(); 5968 } else if (dragConstraints && layout) this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints); 5969 else this.constraints = false; 5970 this.elastic = resolveDragElastic(dragElastic); 5971 /** 5972 * If we're outputting to external MotionValues, we want to rebase the measured constraints 5973 * from viewport-relative to component-relative. This only applies to relative (non-ref) 5974 * constraints, as ref-based constraints from calcViewportConstraints are already in the 5975 * correct coordinate space for the motion value transform offset. 5976 */ 5977 if (prevConstraints !== this.constraints && !isRefObject(dragConstraints) && layout && this.constraints && !this.hasMutatedConstraints) eachAxis((axis) => { 5978 if (this.constraints !== false && this.getAxisMotionValue(axis)) this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]); 5979 }); 5980 } 5981 resolveRefConstraints() { 5982 const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps(); 5983 if (!constraints || !isRefObject(constraints)) return false; 5984 const constraintsElement = constraints.current; 5985 invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref"); 5986 const { projection } = this.visualElement; 5987 if (!projection || !projection.layout) return false; 5988 /** 5989 * Refresh the root scroll offset so the constraint's viewport box 5990 * translates to correct page coordinates. The scroll captured at 5991 * drag mount can be stale if the document was scrolled afterwards — 5992 * e.g. via the browser restoring scroll on refresh, or an ancestor 5993 * layout effect running after this element's mount (#2829). 5994 * 5995 * Clear the cached scroll first so `updateScroll` bypasses its 5996 * per-animationId cache and re-reads the live value. 5997 */ 5998 if (projection.root) { 5999 projection.root.scroll = void 0; 6000 projection.root.updateScroll(); 6001 } 6002 const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint()); 6003 let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox); 6004 /** 6005 * If there's an onMeasureDragConstraints listener we call it and 6006 * if different constraints are returned, set constraints to that 6007 */ 6008 if (onMeasureDragConstraints) { 6009 const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints)); 6010 this.hasMutatedConstraints = !!userConstraints; 6011 if (userConstraints) measuredConstraints = convertBoundingBoxToBox(userConstraints); 6012 } 6013 return measuredConstraints; 6014 } 6015 startAnimation(velocity) { 6016 const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd } = this.getProps(); 6017 const constraints = this.constraints || {}; 6018 const momentumAnimations = eachAxis((axis) => { 6019 if (!shouldDrag(axis, drag, this.currentDirection)) return; 6020 let transition = constraints && constraints[axis] || {}; 6021 if (dragSnapToOrigin === true || dragSnapToOrigin === axis) transition = { 6022 min: 0, 6023 max: 0 6024 }; 6025 /** 6026 * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame 6027 * of spring animations so we should look into adding a disable spring option to `inertia`. 6028 * We could do something here where we affect the `bounceStiffness` and `bounceDamping` 6029 * using the value of `dragElastic`. 6030 */ 6031 const bounceStiffness = dragElastic ? 200 : 1e6; 6032 const bounceDamping = dragElastic ? 40 : 1e7; 6033 const inertia = { 6034 type: "inertia", 6035 velocity: dragMomentum ? velocity[axis] : 0, 6036 bounceStiffness, 6037 bounceDamping, 6038 timeConstant: 750, 6039 restDelta: 1, 6040 restSpeed: 10, 6041 ...dragTransition, 6042 ...transition 6043 }; 6044 return this.startAxisValueAnimation(axis, inertia); 6045 }); 6046 return Promise.all(momentumAnimations).then(onDragTransitionEnd); 6047 } 6048 startAxisValueAnimation(axis, transition) { 6049 const axisValue = this.getAxisMotionValue(axis); 6050 addValueToWillChange(this.visualElement, axis); 6051 return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false)); 6052 } 6053 stopAnimation() { 6054 eachAxis((axis) => this.getAxisMotionValue(axis).stop()); 6055 } 6056 /** 6057 * Drag works differently depending on which props are provided. 6058 * 6059 * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values. 6060 * - Otherwise, we apply the delta to the x/y motion values. 6061 */ 6062 getAxisMotionValue(axis) { 6063 const dragKey = `_drag${axis.toUpperCase()}`; 6064 const externalMotionValue = this.visualElement.getProps()[dragKey]; 6065 return externalMotionValue ? externalMotionValue : this.visualElement.getValue(axis, this.visualElement.latestValues[axis] ?? 0); 6066 } 6067 snapToCursor(point) { 6068 eachAxis((axis) => { 6069 const { drag } = this.getProps(); 6070 if (!shouldDrag(axis, drag, this.currentDirection)) return; 6071 const { projection } = this.visualElement; 6072 const axisValue = this.getAxisMotionValue(axis); 6073 if (projection && projection.layout) { 6074 const { min, max } = projection.layout.layoutBox[axis]; 6075 /** 6076 * The layout measurement includes the current transform value, 6077 * so we need to add it back to get the correct snap position. 6078 * This fixes an issue where elements with initial coordinates 6079 * would snap to the wrong position on the first drag. 6080 */ 6081 const current = axisValue.get() || 0; 6082 axisValue.set(point[axis] - mixNumber(min, max, .5) + current); 6083 } 6084 }); 6085 } 6086 /** 6087 * When the viewport resizes we want to check if the measured constraints 6088 * have changed and, if so, reposition the element within those new constraints 6089 * relative to where it was before the resize. 6090 */ 6091 scalePositionWithinConstraints() { 6092 if (!this.visualElement.current) return; 6093 const { drag, dragConstraints } = this.getProps(); 6094 const { projection } = this.visualElement; 6095 if (!isRefObject(dragConstraints) || !projection || !this.constraints) return; 6096 /** 6097 * Stop current animations as there can be visual glitching if we try to do 6098 * this mid-animation 6099 */ 6100 this.stopAnimation(); 6101 /** 6102 * Record the relative position of the dragged element relative to the 6103 * constraints box and save as a progress value. 6104 */ 6105 const boxProgress = { 6106 x: 0, 6107 y: 0 6108 }; 6109 eachAxis((axis) => { 6110 const axisValue = this.getAxisMotionValue(axis); 6111 if (axisValue && this.constraints !== false) { 6112 const latest = axisValue.get(); 6113 boxProgress[axis] = calcOrigin({ 6114 min: latest, 6115 max: latest 6116 }, this.constraints[axis]); 6117 } 6118 }); 6119 /** 6120 * Update the layout of this element and resolve the latest drag constraints 6121 */ 6122 const { transformTemplate } = this.visualElement.getProps(); 6123 this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none"; 6124 projection.root && projection.root.updateScroll(); 6125 projection.updateLayout(); 6126 /**
vendor: 4,617 bytes, lines 6127-6242
6127 * Reset constraints so resolveConstraints() will recalculate them 6128 * with the freshly measured layout rather than returning the cached value. 6129 */ 6130 this.constraints = false; 6131 this.resolveConstraints(); 6132 /** 6133 * For each axis, calculate the current progress of the layout axis 6134 * within the new constraints. 6135 */ 6136 eachAxis((axis) => { 6137 if (!shouldDrag(axis, drag, null)) return; 6138 /** 6139 * Calculate a new transform based on the previous box progress 6140 */ 6141 const axisValue = this.getAxisMotionValue(axis); 6142 const { min, max } = this.constraints[axis]; 6143 axisValue.set(mixNumber(min, max, boxProgress[axis])); 6144 }); 6145 /** 6146 * Flush the updated transform to the DOM synchronously to prevent 6147 * a visual flash at the element's CSS layout position (0,0) when 6148 * the transform was stripped for measurement. 6149 */ 6150 this.visualElement.render(); 6151 } 6152 addListeners() { 6153 if (!this.visualElement.current) return; 6154 elementDragControls.set(this.visualElement, this); 6155 const element = this.visualElement.current; 6156 /** 6157 * Attach a pointerdown event listener on this DOM element to initiate drag tracking. 6158 */ 6159 const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => { 6160 const { drag, dragListener = true } = this.getProps(); 6161 const target = event.target; 6162 /** 6163 * Only block drag if clicking on a text input child element 6164 * (input, textarea, select, contenteditable) where users might 6165 * want to select text or interact with the control. 6166 * 6167 * Buttons and links don't block drag since they don't have 6168 * click-and-move actions of their own. 6169 */ 6170 const isClickingTextInputChild = target !== element && isElementTextInput(target); 6171 if (drag && dragListener && !isClickingTextInputChild) this.start(event); 6172 }); 6173 /** 6174 * If using ref-based constraints, observe both the draggable element 6175 * and the constraint container for size changes via ResizeObserver. 6176 * Setup is deferred because dragConstraints.current is null when 6177 * addListeners first runs (React hasn't committed the ref yet). 6178 */ 6179 let stopResizeObservers; 6180 const measureDragConstraints = () => { 6181 const { dragConstraints } = this.getProps(); 6182 if (isRefObject(dragConstraints) && dragConstraints.current) { 6183 this.constraints = this.resolveRefConstraints(); 6184 if (!stopResizeObservers) stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints()); 6185 } 6186 }; 6187 const { projection } = this.visualElement; 6188 const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints); 6189 if (projection && !projection.layout) { 6190 projection.root && projection.root.updateScroll(); 6191 projection.updateLayout(); 6192 } 6193 frame.read(measureDragConstraints); 6194 /** 6195 * Attach a window resize listener to scale the draggable target within its defined 6196 * constraints as the window resizes. 6197 */ 6198 const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints()); 6199 /** 6200 * If the element's layout changes, calculate the delta and apply that to 6201 * the drag gesture's origin point. 6202 */ 6203 const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => { 6204 if (this.isDragging && hasLayoutChanged) { 6205 eachAxis((axis) => { 6206 const motionValue = this.getAxisMotionValue(axis); 6207 if (!motionValue) return; 6208 this.originPoint[axis] += delta[axis].translate; 6209 motionValue.set(motionValue.get() + delta[axis].translate); 6210 }); 6211 this.visualElement.render(); 6212 } 6213 })); 6214 return () => { 6215 stopResizeListener(); 6216 stopPointerListener(); 6217 stopMeasureLayoutListener(); 6218 stopLayoutUpdateListener && stopLayoutUpdateListener(); 6219 stopResizeObservers && stopResizeObservers(); 6220 }; 6221 } 6222 getProps() { 6223 const props = this.visualElement.getProps(); 6224 const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true } = props; 6225 return { 6226 ...props, 6227 drag, 6228 dragDirectionLock, 6229 dragPropagation, 6230 dragConstraints, 6231 dragElastic, 6232 dragMomentum 6233 }; 6234 } 6235 }; 6236 })))(); 6237} 6238//#endregion 6239//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/drag/index.mjs 6240var DragGesture; 6241function init_drag() { 6242 return (init_drag = __esmMin((() => {
6243 init_Feature(); 6244 init_noop(); 6245 init_VisualElementDragControls(); 6246 DragGesture = class extends Feature { 6247 constructor(node) { 6248 super(node); 6249 this.removeGroupControls = noop; 6250 this.removeListeners = noop; 6251 this.controls = new VisualElementDragControls(node); 6252 } 6253 mount() { 6254 const { dragControls } = this.node.getProps(); 6255 if (dragControls) this.removeGroupControls = dragControls.subscribe(this.controls); 6256 this.removeListeners = this.controls.addListeners() || noop; 6257 } 6258 update() { 6259 const { dragControls } = this.node.getProps(); 6260 const { dragControls: prevDragControls } = this.node.prevProps || {}; 6261 if (dragControls !== prevDragControls) { 6262 this.removeGroupControls(); 6263 if (dragControls) this.removeGroupControls = dragControls.subscribe(this.controls); 6264 } 6265 } 6266 unmount() { 6267 this.removeGroupControls(); 6268 this.removeListeners(); 6269 /** 6270 * In React 19, during list reorder reconciliation, components may 6271 * briefly unmount and remount while the drag is still active. If we're 6272 * actively dragging, we should NOT end the pan session - it will 6273 * continue tracking pointer events via its window-level listeners. 6274 * 6275 * The pan session will be properly cleaned up when: 6276 * 1. The drag ends naturally (pointerup/pointercancel) 6277 * 2. The component is truly removed from the DOM 6278 */ 6279 if (!this.controls.isDragging) this.controls.endPanSession(); 6280 } 6281 }; 6282 })))(); 6283} 6284//#endregion 6285//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/pan/index.mjs 6286var asyncHandler, PanGesture; 6287function init_pan() { 6288 return (init_pan = __esmMin((() => { 6289 init_Feature(), init_frame(); 6290 init_noop(); 6291 init_add_pointer_event(); 6292 init_get_context_window(); 6293 init_PanSession(); 6294 asyncHandler = (handler) => (event, info) => { 6295 if (handler) frame.update(() => handler(event, info), false, true); 6296 }; 6297 PanGesture = class extends Feature { 6298 constructor() { 6299 super(...arguments); 6300 this.removePointerDownListener = noop; 6301 } 6302 onPointerDown(pointerDownEvent) { 6303 this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), { 6304 transformPagePoint: this.node.getTransformPagePoint(), 6305 contextWindow: getContextWindow(this.node) 6306 }); 6307 } 6308 createPanHandlers() { 6309 const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps(); 6310 return { 6311 onSessionStart: asyncHandler(onPanSessionStart), 6312 onStart: asyncHandler(onPanStart), 6313 onMove: asyncHandler(onPan), 6314 onEnd: (event, info) => { 6315 delete this.session; 6316 if (onPanEnd) frame.postRender(() => onPanEnd(event, info)); 6317 } 6318 }; 6319 } 6320 mount() { 6321 this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event)); 6322 } 6323 update() { 6324 this.session && this.session.updateHandlers(this.createPanHandlers()); 6325 } 6326 unmount() { 6327 this.removePointerDownListener(); 6328 this.session && this.session.end(); 6329 } 6330 }; 6331 })))(); 6332} 6333//#endregion 6334//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs 6335function MeasureLayout(props) { 6336 const [isPresent, safeToRemove] = usePresence(); 6337 const layoutGroup = (0, import_react.useContext)(LayoutGroupContext); 6338 return (0, import_jsx_runtime.jsx)(MeasureLayoutWithContext, { 6339 ...props, 6340 layoutGroup, 6341 switchLayoutGroup: (0, import_react.useContext)(SwitchLayoutGroupContext), 6342 isPresent, 6343 safeToRemove 6344 }); 6345} 6346var import_jsx_runtime, import_react, hasTakenAnySnapshot, MeasureLayoutWithContext; 6347function init_MeasureLayout() { 6348 return (init_MeasureLayout = __esmMin((() => { 6349 import_jsx_runtime = require_jsx_runtime(); 6350 init_state$2(), init_frame(), init_microtask(); 6351 import_react = require_react(); 6352 init_use_presence(); 6353 init_LayoutGroupContext(); 6354 init_SwitchLayoutGroupContext(); 6355 hasTakenAnySnapshot = false; 6356 MeasureLayoutWithContext = class extends import_react.Component { 6357 /** 6358 * This only mounts projection nodes for components that
6359 * need measuring, we might want to do it for all components 6360 * in order to incorporate transforms 6361 */ 6362 componentDidMount() { 6363 const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props; 6364 const { projection } = visualElement; 6365 if (projection) { 6366 if (layoutGroup.group) layoutGroup.group.add(projection); 6367 if (switchLayoutGroup && switchLayoutGroup.register && layoutId) switchLayoutGroup.register(projection); 6368 if (hasTakenAnySnapshot) projection.root.didUpdate(); 6369 projection.addEventListener("animationComplete", () => { 6370 this.safeToRemove(); 6371 }); 6372 projection.setOptions({ 6373 ...projection.options, 6374 layoutDependency: this.props.layoutDependency, 6375 onExitComplete: () => this.safeToRemove() 6376 }); 6377 } 6378 globalProjectionState.hasEverUpdated = true; 6379 } 6380 getSnapshotBeforeUpdate(prevProps) { 6381 const { layoutDependency, visualElement, drag, isPresent } = this.props; 6382 const { projection } = visualElement; 6383 if (!projection) return null; 6384 /** 6385 * TODO: We use this data in relegate to determine whether to 6386 * promote a previous element. There's no guarantee its presence data 6387 * will have updated by this point - if a bug like this arises it will 6388 * have to be that we markForRelegation and then find a new lead some other way, 6389 * perhaps in didUpdate 6390 */ 6391 projection.isPresent = isPresent; 6392 if (prevProps.layoutDependency !== layoutDependency) projection.setOptions({ 6393 ...projection.options, 6394 layoutDependency 6395 }); 6396 hasTakenAnySnapshot = true; 6397 if (drag || prevProps.layoutDependency !== layoutDependency || layoutDependency === void 0 || prevProps.isPresent !== isPresent) projection.willUpdate(); 6398 else this.safeToRemove(); 6399 if (prevProps.isPresent !== isPresent) { 6400 if (isPresent) projection.promote(); 6401 else if (!projection.relegate()) 6402 /** 6403 * If there's another stack member taking over from this one, 6404 * it's in charge of the exit animation and therefore should 6405 * be in charge of the safe to remove. Otherwise we call it here. 6406 */ 6407 frame.postRender(() => { 6408 const stack = projection.getStack(); 6409 if (!stack || !stack.members.length) this.safeToRemove(); 6410 }); 6411 } 6412 return null; 6413 } 6414 componentDidUpdate() { 6415 const { visualElement, layoutAnchor } = this.props; 6416 const { projection } = visualElement; 6417 if (projection) { 6418 projection.options.layoutAnchor = layoutAnchor; 6419 projection.root.didUpdate(); 6420 microtask.postRender(() => { 6421 if (!projection.currentAnimation && projection.isLead()) this.safeToRemove(); 6422 }); 6423 } 6424 } 6425 componentWillUnmount() { 6426 const { visualElement, layoutGroup, switchLayoutGroup: promoteContext } = this.props; 6427 const { projection } = visualElement; 6428 hasTakenAnySnapshot = true; 6429 if (projection) { 6430 projection.scheduleCheckAfterUnmount(); 6431 if (layoutGroup && layoutGroup.group) layoutGroup.group.remove(projection); 6432 if (promoteContext && promoteContext.deregister) promoteContext.deregister(projection); 6433 } 6434 } 6435 safeToRemove() { 6436 const { safeToRemove } = this.props; 6437 safeToRemove && safeToRemove(); 6438 } 6439 render() { 6440 return null; 6441 } 6442 }; 6443 })))(); 6444} 6445//#endregion 6446//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/drag.mjs 6447var drag; 6448function init_drag$1() { 6449 return (init_drag$1 = __esmMin((() => { 6450 init_drag(); 6451 init_pan(); 6452 init_MeasureLayout(); 6453 init_HTMLProjectionNode(); 6454 drag = { 6455 pan: { Feature: PanGesture }, 6456 drag: { 6457 Feature: DragGesture, 6458 ProjectionNode: HTMLProjectionNode, 6459 MeasureLayout 6460 } 6461 }; 6462 })))(); 6463} 6464//#endregion 6465//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/hover.mjs 6466function handleHoverEvent(node, event, lifecycle) { 6467 const { props } = node; 6468 if (node.animationState && props.whileHover) node.animationState.setActive("whileHover", lifecycle === "Start"); 6469 const callback = props["onHover" + lifecycle]; 6470 if (callback) frame.postRender(() => callback(event, extractEventInfo(event))); 6471} 6472var HoverGesture; 6473function init_hover$1() { 6474 return (init_hover$1 = __esmMin((() => {
6475 init_Feature(), init_hover(), init_frame(); 6476 init_event_info(); 6477 HoverGesture = class extends Feature { 6478 mount() { 6479 const { current } = this.node; 6480 if (!current) return; 6481 this.unmount = hover(current, (_element, startEvent) => { 6482 handleHoverEvent(this.node, startEvent, "Start"); 6483 return (endEvent) => handleHoverEvent(this.node, endEvent, "End"); 6484 }); 6485 } 6486 unmount() {} 6487 }; 6488 })))(); 6489} 6490//#endregion 6491//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/focus.mjs 6492var FocusGesture; 6493function init_focus() { 6494 return (init_focus = __esmMin((() => { 6495 init_Feature(); 6496 init_pipe(); 6497 FocusGesture = class extends Feature { 6498 constructor() { 6499 super(...arguments); 6500 this.isActive = false; 6501 } 6502 onFocus() { 6503 let isFocusVisible = false; 6504 /** 6505 * If this element doesn't match focus-visible then don't 6506 * apply whileHover. But, if matches throws that focus-visible 6507 * is not a valid selector then in that browser outline styles will be applied 6508 * to the element by default and we want to match that behaviour with whileFocus. 6509 */ 6510 try { 6511 isFocusVisible = this.node.current.matches(":focus-visible"); 6512 } catch (e) { 6513 isFocusVisible = true; 6514 } 6515 if (!isFocusVisible || !this.node.animationState) return; 6516 this.node.animationState.setActive("whileFocus", true); 6517 this.isActive = true; 6518 } 6519 onBlur() { 6520 if (!this.isActive || !this.node.animationState) return; 6521 this.node.animationState.setActive("whileFocus", false); 6522 this.isActive = false; 6523 } 6524 mount() { 6525 this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur())); 6526 } 6527 unmount() {} 6528 }; 6529 })))(); 6530} 6531//#endregion 6532//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/gestures/press.mjs 6533function handlePressEvent(node, event, lifecycle) { 6534 const { props } = node; 6535 if (node.current instanceof HTMLButtonElement && node.current.disabled) return; 6536 if (node.animationState && props.whileTap) node.animationState.setActive("whileTap", lifecycle === "Start"); 6537 const callback = props["onTap" + (lifecycle === "End" ? "" : lifecycle)]; 6538 if (callback) frame.postRender(() => callback(event, extractEventInfo(event))); 6539} 6540var PressGesture; 6541function init_press$1() { 6542 return (init_press$1 = __esmMin((() => { 6543 init_Feature(), init_press(), init_frame(); 6544 init_event_info(); 6545 PressGesture = class extends Feature { 6546 mount() { 6547 const { current } = this.node; 6548 if (!current) return; 6549 const { globalTapTarget, propagate } = this.node.props; 6550 this.unmount = press(current, (_element, startEvent) => { 6551 handlePressEvent(this.node, startEvent, "Start"); 6552 return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel"); 6553 }, { 6554 useGlobalTarget: globalTapTarget, 6555 stopPropagation: propagate?.tap === false 6556 }); 6557 } 6558 unmount() {} 6559 }; 6560 })))(); 6561} 6562//#endregion 6563//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs 6564function initIntersectionObserver({ root, ...options }) { 6565 const lookupRoot = root || document; 6566 /** 6567 * If we don't have an observer lookup map for this root, create one. 6568 */ 6569 if (!observers.has(lookupRoot)) observers.set(lookupRoot, {}); 6570 const rootObservers = observers.get(lookupRoot); 6571 const key = JSON.stringify(options); 6572 /** 6573 * If we don't have an observer for this combination of root and settings, 6574 * create one. 6575 */ 6576 if (!rootObservers[key]) rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { 6577 root, 6578 ...options 6579 }); 6580 return rootObservers[key]; 6581} 6582function observeIntersection(element, options, callback) { 6583 const rootInteresectionObserver = initIntersectionObserver(options); 6584 observerCallbacks.set(element, callback); 6585 rootInteresectionObserver.observe(element); 6586 return () => { 6587 observerCallbacks.delete(element); 6588 rootInteresectionObserver.unobserve(element); 6589 }; 6590} 6591var observerCallbacks, observers, fireObserverCallback, fireAllObserverCallbacks; 6592function init_observers() { 6593 return (init_observers = __esmMin((() => { 6594 observerCallbacks = /* @__PURE__ */ new WeakMap(); 6595 observers = /* @__PURE__ */ new WeakMap(); 6596 fireObserverCallback = (entry) => { 6597 const callback = observerCallbacks.get(entry.target); 6598 callback && callback(entry); 6599 }; 6600 fireAllObserverCallbacks = (entries) => {
6601 entries.forEach(fireObserverCallback); 6602 }; 6603 })))(); 6604} 6605//#endregion 6606//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs 6607function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) { 6608 return (name) => viewport[name] !== prevViewport[name]; 6609} 6610var thresholdNames, InViewFeature; 6611function init_viewport() { 6612 return (init_viewport = __esmMin((() => { 6613 init_Feature(); 6614 init_observers(); 6615 thresholdNames = { 6616 some: 0, 6617 all: 1 6618 }; 6619 InViewFeature = class extends Feature { 6620 constructor() { 6621 super(...arguments); 6622 this.hasEnteredView = false; 6623 this.isInView = false; 6624 } 6625 startObserver() { 6626 this.stopObserver?.(); 6627 const { viewport = {} } = this.node.getProps(); 6628 const { root, margin: rootMargin, amount = "some", once } = viewport; 6629 const options = { 6630 root: root ? root.current : void 0, 6631 rootMargin, 6632 threshold: typeof amount === "number" ? amount : thresholdNames[amount] 6633 }; 6634 const onIntersectionUpdate = (entry) => { 6635 const { isIntersecting } = entry; 6636 /** 6637 * If there's been no change in the viewport state, early return. 6638 */ 6639 if (this.isInView === isIntersecting) return; 6640 this.isInView = isIntersecting; 6641 /** 6642 * Handle hasEnteredView. If this is only meant to run once, and 6643 * element isn't visible, early return. Otherwise set hasEnteredView to true. 6644 */ 6645 if (once && !isIntersecting && this.hasEnteredView) return; 6646 else if (isIntersecting) this.hasEnteredView = true; 6647 if (this.node.animationState) this.node.animationState.setActive("whileInView", isIntersecting); 6648 /** 6649 * Use the latest committed props rather than the ones in scope 6650 * when this observer is created 6651 */ 6652 const { onViewportEnter, onViewportLeave } = this.node.getProps(); 6653 const callback = isIntersecting ? onViewportEnter : onViewportLeave; 6654 callback && callback(entry); 6655 }; 6656 this.stopObserver = observeIntersection(this.node.current, options, onIntersectionUpdate); 6657 } 6658 mount() { 6659 this.startObserver(); 6660 } 6661 update() { 6662 if (typeof IntersectionObserver === "undefined") return; 6663 const { props, prevProps } = this.node; 6664 if ([ 6665 "amount", 6666 "margin", 6667 "root" 6668 ].some(hasViewportOptionChanged(props, prevProps))) this.startObserver(); 6669 } 6670 unmount() { 6671 this.stopObserver?.(); 6672 this.hasEnteredView = false; 6673 this.isInView = false; 6674 } 6675 }; 6676 })))(); 6677} 6678//#endregion 6679//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/gestures.mjs 6680var gestureAnimations; 6681function init_gestures() { 6682 return (init_gestures = __esmMin((() => { 6683 init_hover$1(); 6684 init_focus(); 6685 init_press$1(); 6686 init_viewport(); 6687 gestureAnimations = { 6688 inView: { Feature: InViewFeature }, 6689 tap: { Feature: PressGesture }, 6690 focus: { Feature: FocusGesture }, 6691 hover: { Feature: HoverGesture } 6692 }; 6693 })))(); 6694} 6695//#endregion 6696//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/motion/features/layout.mjs 6697var layout; 6698function init_layout() { 6699 return (init_layout = __esmMin((() => { 6700 init_HTMLProjectionNode(); 6701 init_MeasureLayout(); 6702 layout = { layout: { 6703 ProjectionNode: HTMLProjectionNode, 6704 MeasureLayout 6705 } }; 6706 })))(); 6707} 6708//#endregion 6709//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.mjs 6710var featureBundle; 6711function init_feature_bundle() { 6712 return (init_feature_bundle = __esmMin((() => { 6713 init_animations(); 6714 init_drag$1(); 6715 init_gestures(); 6716 init_layout(); 6717 featureBundle = { 6718 ...animations, 6719 ...gestureAnimations, 6720 ...drag, 6721 ...layout 6722 }; 6723 })))(); 6724} 6725//#endregion 6726//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs 6727var motion$1; 6728function init_proxy() { 6729 return (init_proxy = __esmMin((() => {
6730 init_create_visual_element(); 6731 init_create_proxy(); 6732 init_feature_bundle(); 6733 motion$1 = /*@__PURE__*/ createMotionProxy(featureBundle, createDomVisualElement); 6734 })))(); 6735} 6736//#endregion 6737//#region node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/motion/dist/es/react.mjs 6738var motion; 6739function init_react() { 6740 return (init_react = __esmMin((() => { 6741 init_proxy(); 6742 init_AnimatePresence(); 6743 init_MotionConfig(); 6744 motion = motion$1; 6745 })))(); 6746} 6747//#endregion 6748export { MotionConfigContext as a, useConstant as c, init_AnimatePresence as i, motion as n, init_MotionConfigContext as o, AnimatePresence as r, init_use_constant as s, init_react as t };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.