{"version":3,"sources":["webpack:///./node_modules/framer-motion/dist/es/utils/each-axis.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.js","webpack:///./node_modules/framer-motion/dist/es/events/use-pointer-event.js","webpack:///./node_modules/framer-motion/dist/es/events/utils.js","webpack:///./node_modules/framer-motion/dist/es/components/AnimateSharedLayout/types.js","webpack:///./node_modules/popmotion/dist/es/utils/mix.js","webpack:///./node_modules/style-value-types/dist/es/color/index.js","webpack:///./node_modules/framer-motion/dist/es/motion/features/layout/utils.js","webpack:///./node_modules/framer-motion/dist/es/components/LazyMotion/index.js","webpack:///./node_modules/framer-motion/dist/es/utils/shallow-compare.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/test.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/find.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/setters.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/animation.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/animation-state.js","webpack:///./node_modules/framer-motion/dist/es/motion/features/animations.js","webpack:///./node_modules/framer-motion/dist/es/gestures/use-hover-gesture.js","webpack:///./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.js","webpack:///./node_modules/framer-motion/dist/es/motion/features/gestures.js","webpack:///./node_modules/framer-motion/dist/es/gestures/use-tap-gesture.js","webpack:///./node_modules/framer-motion/dist/es/gestures/use-focus-gesture.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/state.js","webpack:///./node_modules/framer-motion/dist/es/render/html/utils/build-projection-transform.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/lifecycles.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/flat-tree.js","webpack:///./node_modules/framer-motion/dist/es/render/index.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/motion-values.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/projection/relative-set.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/projection.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.js","webpack:///./node_modules/framer-motion/dist/es/render/html/visual-element.js","webpack:///./node_modules/framer-motion/dist/es/utils/is-numerical-string.js","webpack:///./node_modules/framer-motion/dist/es/render/svg/visual-element.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/features-animation.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/create-visual-element.js","webpack:///./node_modules/framer-motion/dist/es/utils/use-unmount-effect.js","webpack:///./node_modules/framer-motion/dist/es/value/index.js","webpack:///./node_modules/framer-motion/dist/es/motion/utils/make-renderless-component.js","webpack:///./node_modules/framer-motion/dist/es/utils/geometry/delta-apply.js","webpack:///./node_modules/popmotion/dist/es/animations/utils/find-spring.js","webpack:///./node_modules/popmotion/dist/es/animations/generators/spring.js","webpack:///./node_modules/popmotion/dist/es/utils/mix-complex.js","webpack:///./node_modules/popmotion/dist/es/utils/interpolate.js","webpack:///./node_modules/popmotion/dist/es/animations/generators/keyframes.js","webpack:///./node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js","webpack:///./node_modules/popmotion/dist/es/animations/generators/decay.js","webpack:///./node_modules/popmotion/dist/es/animations/utils/elapsed.js","webpack:///./node_modules/popmotion/dist/es/animations/index.js","webpack:///./node_modules/popmotion/dist/es/easing/cubic-bezier.js","webpack:///./node_modules/framer-motion/dist/es/animation/utils/easing.js","webpack:///./node_modules/framer-motion/dist/es/animation/utils/is-animatable.js","webpack:///./node_modules/framer-motion/dist/es/animation/utils/default-transitions.js","webpack:///./node_modules/framer-motion/dist/es/animation/utils/transitions.js","webpack:///./node_modules/popmotion/dist/es/animations/inertia.js","webpack:///./node_modules/style-value-types/dist/es/color/utils.js","webpack:///./node_modules/framer-motion/dist/es/events/use-dom-event.js","webpack:///./node_modules/style-value-types/dist/es/color/rgba.js","webpack:///./node_modules/framer-motion/dist/es/utils/geometry/delta-calc.js","webpack:///./node_modules/framer-motion/dist/es/events/event-info.js","webpack:///./node_modules/framer-motion/dist/es/gestures/utils/event-type.js","webpack:///./node_modules/style-value-types/dist/es/color/hsla.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.js","webpack:///./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.js","webpack:///./node_modules/framer-motion/dist/es/utils/subscription-manager.js","webpack:///./node_modules/framer-motion/dist/es/utils/array.js","webpack:///./node_modules/popmotion/dist/es/utils/clamp.js","webpack:///./node_modules/framer-motion/dist/es/utils/time-conversion.js","webpack:///./node_modules/popmotion/dist/es/utils/inc.js","webpack:///./node_modules/popmotion/dist/es/utils/pipe.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.js","webpack:///./node_modules/popmotion/dist/es/utils/progress.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/is-draggable.js","webpack:///./node_modules/popmotion/dist/es/utils/mix-color.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/projection/measure.js","webpack:///./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.js","webpack:///./node_modules/popmotion/dist/es/easing/utils.js","webpack:///./node_modules/popmotion/dist/es/easing/index.js","webpack:///./node_modules/style-value-types/dist/es/color/hex.js","webpack:///./node_modules/popmotion/dist/es/utils/velocity-per-second.js","webpack:///./node_modules/style-value-types/dist/es/complex/index.js","webpack:///./node_modules/style-value-types/dist/es/complex/filter.js","webpack:///./node_modules/framesync/dist/es/on-next-frame.js","webpack:///./node_modules/framesync/dist/es/index.js","webpack:///./node_modules/framesync/dist/es/create-render-step.js","webpack:///./node_modules/popmotion/dist/es/utils/is-point.js","webpack:///./node_modules/popmotion/dist/es/utils/is-point-3d.js","webpack:///./node_modules/popmotion/dist/es/utils/distance.js","webpack:///./node_modules/framer-motion/dist/es/utils/noop.js","webpack:///./node_modules/framer-motion/dist/es/utils/geometry/index.js","webpack:///./node_modules/framer-motion/dist/es/render/utils/types.js"],"names":["eachAxis","handler","compareByDepth","a","b","depth","mouseEventNames","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","touchEventNames","getPointerEventName","name","window","onpointerdown","ontouchstart","onmousedown","addPointerEvent","target","eventName","options","usePointerEvent","ref","Presence","VisibilityAction","mix","from","to","progress","color","test","v","parse","transform","hasOwnProperty","tweenAxis","prev","next","p","min","max","calcRelativeOffsetAxis","parent","child","calcRelativeOffset","x","y","checkIfParentHasChanged","prevId","getLayoutId","nextId","undefined","LazyMotion","_a","children","features","_b","strict","setIsLoaded","isLazyBundle","loadedRenderer","renderer","loadedFeatures","current","then","Provider","value","shallowCompare","Array","isArray","prevLength","length","i","testValueType","type","dimensionValueTypes","findDimensionValueType","find","valueTypes","complex","findValueType","setMotionValue","visualElement","key","hasValue","getValue","set","addValue","setTarget","definition","resolved","makeTargetAnimatable","transitionEnd","transition","getOriginFromTransition","animateVariant","variant","custom","getDefaultTransition","transitionOverride","getAnimation","animateTarget","Promise","resolve","getChildAnimations","variantChildren","size","forwardDelay","delayChildren","staggerChildren","staggerDirection","animations","maxStaggerDuration","generateStaggerDuration","sort","sortByTreeOrder","forEach","push","delay","notifyAnimationComplete","all","animateChildren","when","_c","first","last","_d","_e","_f","animationTypeState","animationState","getState","valueTarget","shouldBlockAnimation","animation","sortNodePosition","protectedKeys","needsAnimating","shouldBlock","variantPriorityOrder","Animate","Hover","Tap","Drag","Focus","Exit","reversePriorityOrder","reverse","numAnimationTypes","animateList","map","notifyAnimationStart","resolvedDefinition","animateVisualElement","createAnimationState","animate","state","createTypeState","allAnimatedKeys","isInitialRender","buildResolvedTypeValues","acc","animateChanges","changedActiveType","props","getProps","context","getVariantContext","removedKeys","Set","encounteredKeys","removedVariantIndex","Infinity","_loop_1","typeState","prop","propIsVariant","activeDelta","isActive","isInherited","manuallyAnimateOnMount","prevProp","shouldAnimateType","variantsHaveChanged","definitionList","resolvedValues","reduce","prevResolvedValues","allKeys","markToAnimate","delete","add","has","blockInitialAnimation","apply","fallbackAnimation_1","fallbackTarget","getBaseTarget","shouldAnimate","Boolean","initial","isAnimated","setActive","setAnimateFunction","makeAnimator","subscribe","exit","isPresent","onExitComplete","presenceContext","PresenceContext","createHoverEvent","callback","event","info","isNodeOrChild","parentElement","gestureAnimations","tap","onTap","onTapStart","onTapCancel","whileTap","hasPressListeners","isPressing","cancelPointerEndListeners","removePointerEndListener","call","checkPointerEnd","onPointerUp","getInstance","onPointerCancel","pipe","focus","whileFocus","hover","onHoverStart","onHoverEnd","whileHover","createLayoutState","isHydrated","layout","layoutCorrected","treeScale","delta","deltaFinal","deltaTransform","zeroLayout","buildLayoutProjectionTransform","latestTransform","translate","rotate","rotateX","rotateY","scale","identityProjection","buildLayoutProjectionTransformOrigin","origin","names","FlatTree","this","isDirty","prototype","remove","treeType","build","measureViewportBox","renderInstance","render","readValueFromInstance","resetTransform","restoreTransform","removeValueFromRenderState","scrapeMotionValuesFromProps","presenceId","visualState","instance","projectionParent","unsubscribeFromLeadVisualElement","crossfader","projectionTargetProgress","removeFromVariantTree","latestValues","renderState","lifecycles","managers","propSubscriptions","clearAllListeners","manager","clear","updatePropListeners","on","propListener","args","_i","arguments","notify","createLifecycles","projection","isEnabled","isTargetLocked","targetFinal","leadProjection","leadLatestValues","layoutState","hasViewportBoxUpdated","values","Map","valueSubscriptions","prevMotionValues","baseTarget","element","isProjectionReady","triggerBuild","valuesToRender","crossfadedValues","getCrossfadeState","update","notifyUpdate","updateTreeLayoutProjection","layoutTree","fireUpdateLayoutProjection","initialMotionValues","isControllingVariants","isVariantNode","path","isVisible","isMounted","mount","newInstance","pointTo","addVariantChild","unmount","preRender","updateLayoutProjection","stopLayoutAnimation","closestVariantNode","getClosestVariantNode","other","scheduleUpdateLayoutProjection","layoutId","getStaticValue","setStaticValue","getLatestValues","setVisibility","visibility","scheduleRender","canMutate","removeValue","get","removeOnChange","onChange","latestValue","onUpdate","removeOnRenderRequest","onRenderRequest","bindToMotionValue","defaultValue","forEachValue","readValue","setBaseTarget","syncRender","setProps","newProps","nextValue","prevValue","existingValue","hasAnimated","updateMotionValuesFromProps","getVariant","variants","startAtParent","context_1","numVariantProps","name_1","variantProps","enableLayoutProjection","lockProjectionTarget","unlockProjectionTarget","getLayoutState","setCrossfader","newCrossfader","startLayoutAnimation","axis","isRelative","getProjectionAnimationProgress","relativeTarget","clearListeners","setProjectionTargetAxis","animateMotionValue","stop","withTransform","viewportBox","notifySetAxisTarget","rebaseProjectionTarget","force","box","shouldRebase","isAnimating","notifyLayoutReady","config","getProjectionParent","relativeOffset","setCurrentViewportBox","notifyLayoutUpdate","prevViewportBox","prevTreeScaleX","prevTreeScaleY","prevDeltaTransform","treePath","transformOrigin","updateLayoutDeltas","notifyViewportBoxUpdate","fireResolveRelativeTargetBox","foundParent","ancestor","resolveRelativeTargetBox","relativeParent","shouldResetTransform","_layoutResetTransform","newLead","onSetAxisTarget","onLayoutAnimationComplete","presence","Present","layoutSafeToRemove","Entering","BoundingBoxDimension","positionalKeys","isPositionalKey","setAndResetVelocity","isNumOrPxType","getPosFromMatrix","matrix","pos","parseFloat","split","getTranslateFromMatrix","pos2","pos3","_bbox","matrix3d","match","transformKeys","nonTranslationalTransformKeys","filter","positionalValues","width","height","top","left","bottom","right","checkAndConvertChangedValueTypes","targetPositionalKeys","Object","keys","removedTransformValues","hasAttemptedToRemoveTransformValues","changedValueTypeKeys","toType","fromType","numKeyframes","removedTransforms","startsWith","removeNonTranslationalTransform","convertedTarget","changedKeys","originBbox","elementComputedStyle","getComputedStyle","display","originComputedStyle","targetBbox","convertChangedValueTypes","unitConversion","some","hasPositionalKey","htmlConfig","domElement","defaultType","default","computedStyle","getPropertyValue","compareDocumentPosition","style","transformPagePoint","transformTemplate","mutableState","vars","transformValues","getOrigin","newValueKeys","numNewValues","targetValue","checkTargetForNewValues","parsed","parseDomVariant","isProjectionTranform","htmlVisualElement","svgVisualElement","getAttribute","_element","domAnimation","Component","enableHardwareAcceleration","useUnmountEffect","MotionValue","init","_this","timeDelta","lastUpdated","updateSubscribers","velocityUpdateSubscribers","renderSubscribers","canTrackVelocity","updateAndNotify","timestamp","postRender","scheduleVelocityCheck","getSize","getVelocity","velocityCheck","isNaN","subscription","attach","passiveEffect","getPrevious","start","stopAnimation","clearAnimation","destroy","motionValue","makeRenderlessComponent","hook","resetAxis","originAxis","resetBox","originBox","scalePoint","point","originPoint","applyPointDelta","boxScale","applyAxisDelta","applyBoxDelta","applyAxisTransforms","final","transforms","scaleKey","originKey","axisOrigin","xKeys","yKeys","applyBoxTransforms","finalBox","removePointDelta","removeAxisTransforms","removeAxisDelta","removeBoxTransforms","applyTreeDeltas","treeLength","node","findSpring","envelope","derivative","duration","bounce","velocity","mass","maxDuration","dampingRatio","clamp","undampedFreq","exponentialDecay","calcAngularFreq","Math","exp","d","e","pow","f","g","initialGuess","result","approximateRoot","stiffness","damping","sqrt","durationKeys","physicsKeys","isSpringType","spring","restSpeed","restDelta","done","springOptions","isResolvedFromDuration","derived","getSpringOptions","resolveSpring","zero","resolveVelocity","createSpring","initialVelocity","initialDelta","undampedAngularFreq","abs","angularFreq_1","t","sin","cos","dampedAngularFreq_1","freqForT","sinh","cosh","currentVelocity","isBelowVelocityThreshold","isBelowDisplacementThreshold","flipTarget","needsInterpolation","_t","getMixer","mixComplex","mixArray","output","numValues","blendValue","fromThis","mixObject","analyse","numNumbers","numRGB","numHSL","hue","template","createTransformer","originStats","targetStats","mixNumber","createMixers","ease","customMixer","mixers","mixerFactory","numMixers","mixer","easingFunction","interpolate","input","isClamp","inputLength","concat","interpolator","fastInterpolate","lastInputIndex","mixerIndex","foundMixerIndex","progressInRange","slowInterpolate","defaultEasing","easing","splice","keyframes","offset","times","o","convertOffsetToTimes","_value","defaultOffset","createInterpolator","types","decay","power","timeConstant","modifyTarget","amplitude","ideal","loopElapsed","elapsed","framesync","passTimestamp","driverControls","latest","interpolateFromNumber","autoplay","driver","_g","repeat","repeatMax","_h","repeatType","_j","repeatDelay","onPlay","onStop","onComplete","onRepeat","repeatCount","computedDuration","isComplete","isForwardPlayback","animator","detectAnimationFromOptions","reverseElapsed","hasRepeatDelayElapsed","a1","a2","c","calcBezier","getSlope","cubicBezier","mX1","mY1","mX2","mY2","sampleValues","Float32Array","getTForX","aX","intervalStart","currentSample","kSplineTableSize","guessForT","initialSlope","aGuessT","currentSlope","newtonRaphsonIterate","aA","aB","currentX","currentT","binarySubdivide","easingLookup","linear","easeIn","easeInOut","easeOut","circIn","circInOut","circOut","backIn","backInOut","backOut","anticipate","bounceIn","bounceInOut","bounceOut","easingDefinitionToFunction","isAnimatable","underDampedSpring","criticallyDampedSpring","linearTween","defaultTransitions","z","rotateZ","scaleX","scaleY","opacity","backgroundColor","legacyRepeatWarning","convertTransitionToAnimationOptions","yoyo","flip","loop","isEasingArray","getPopmotionAnimationOptions","valueKey","transitionFactory","hydrateKeyframes","isTransitionDefined","valueTransition","getValueTransition","isTargetAnimatable","isZero","getZeroUnit","isOriginAnimatable","currentAnimation","bounceStiffness","bounceDamping","isOutOfBounds","boundaryNearest","startAnimation","startSpring","prev_1","current_1","boundary_1","heading_1","inertia","indexOf","potentialUnitType","delayTimer","controls","getDelayFromTransition","setTimeout","clearTimeout","isColorString","testProp","splitColor","aName","bName","cName","alpha","addDomEvent","addEventListener","removeEventListener","useDomEvent","clampRgbUnit","rgbUnit","round","rgba","red","green","blue","alpha$1","isNear","maxDistance","calcLength","calcOrigin","source","sourceLength","targetLength","updateAxisDelta","updateBoxDelta","defaultOrigin","originX","originY","calcRelativeAxis","relative","calcRelativeBox","parentProjection","defaultPagePoint","pageX","pageY","pointFromTouch","pointType","touches","changedTouches","pointFromMouse","extractEventInfo","getViewportPointFromEvent","wrapHandler","shouldFilterPrimaryPointer","eventHandler","listener","isMouseEvent","MouseEvent","button","PointerEvent","pointerType","isTouchEvent","hsla","saturation","lightness","defaultValueTypes","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","WebkitFilter","getDefaultValueType","createLock","lock","globalHorizontalLock","globalVerticalLock","getGlobalLock","drag","openHorizontal_1","openVertical_1","isDragActive","openGestureLock","SubscriptionManager","subscriptions","numSubscriptions","addUniqueItem","arr","item","removeItem","index","secondsToMilliseconds","seconds","isNum","combineFunctions","transformers","getAnimatableNone","defaultValueType","toFromDifference","isDraggable","_dragX","mixLinearColor","fromExpo","toExpo","colorTypes","getColorType","notAnimatable","mixColor","fromColorType","toColorType","fromColor","toColor","blended","mixFunc","getBoundingBox","getBoundingClientRect","isCSSVariable","cssVariableRegex","getVariableValue","exec","parseCSSVariable","token","fallback","trim","resolveCSSVariables","HTMLElement","reverseEasing","mirrorEasing","createBackIn","acos","backEasing","createAnticipate","p2","hex","r","substr","parseInt","velocityPerSecond","frameDuration","numColors","colors","replace","numbers","tokenised","convertNumbersToZero","transformer","maxDefaults","applyDefaultFilter","slice","number","unit","functionRegex","functions","join","getCurrentTime","performance","now","Date","onNextFrame","requestAnimationFrame","useDefaultElapsed","runNextFrame","isProcessing","stepsOrder","steps","toRun","toRunNextFrame","numToRun","toKeepAlive","WeakSet","step","schedule","keepAlive","immediate","addToCurrentFrame","buffer","cancel","process","frameData","createRenderStep","sync","startLoop","cancelSync","flushSync","processStep","stepId","processFrame","getFrameData","isPoint","isPoint3D","distance1D","distance","xDelta","yDelta","zDelta","noop","any","convertBoundingBoxToAxisBox","convertAxisBoxToBoundingBox","transformBoundingBox","transformPoint","topLeft","bottomRight","axisBox","copyAxisBox","zeroDelta","AnimationType"],"mappings":"sGACA,SAASA,EAASC,GACd,MAAO,CAACA,EAAQ,KAAMA,EAAQ,MAFlC,mC,iCCAA,sCAAIC,EAAiB,SAAUC,EAAGC,GAC9B,OAAOD,EAAEE,MAAQD,EAAEC,Q,oICGnBC,EAAkB,CAClBC,YAAa,YACbC,YAAa,YACbC,UAAW,UACXC,cAAe,cACfC,YAAa,YACbC,WAAY,WACZC,aAAc,aACdC,aAAc,cAEdC,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,EAAUD,EAAe,CAAEn7B,EAAGqZ,EAAMpZ,EAAGmZ,IACvCiiB,EAAcF,EAAe,CAAEn7B,EAAGuZ,EAAOtZ,EAAGqZ,IAChD,MAAO,CACHF,IAAKgiB,EAAQn7B,EACboZ,KAAM+hB,EAAQp7B,EACdsZ,OAAQ+hB,EAAYp7B,EACpBsZ,MAAO8hB,EAAYr7B,GAM3B,SAASs7B,IACL,MAAO,CAAEt7B,EAAG,CAAEN,IAAK,EAAGC,IAAK,GAAKM,EAAG,CAAEP,IAAK,EAAGC,IAAK,IAEtD,SAAS47B,EAAYxlB,GACjB,MAAO,CACH/V,EAAG,YAAS,GAAI+V,EAAI/V,GACpBC,EAAG,YAAS,GAAI8V,EAAI9V,IAM5B,IAAIu7B,EAAY,CACZ3uB,UAAW,EACXI,MAAO,EACPG,OAAQ,EACR4R,YAAa,GAEjB,SAASzS,IACL,MAAO,CACHvM,EAAG,YAAS,GAAIw7B,GAChBv7B,EAAG,YAAS,GAAIu7B,M,gCCjExB,IAAIC,EAAJ,kCACA,SAAWA,GACPA,EAAuB,QAAI,UAC3BA,EAAqB,MAAI,aACzBA,EAAmB,IAAI,WACvBA,EAAoB,KAAI,YACxBA,EAAqB,MAAI,aACzBA,EAAoB,KAAI,OAN5B,CAOGA,IAAkBA,EAAgB","file":"5-14efb0de581b0f379abc.js","sourcesContent":["// Call a handler once for each axis\nfunction eachAxis(handler) {\n return [handler(\"x\"), handler(\"y\")];\n}\n\nexport { eachAxis };\n","var compareByDepth = function (a, b) {\n return a.depth - b.depth;\n};\n\nexport { compareByDepth };\n","import { useDomEvent, addDomEvent } from './use-dom-event.js';\nimport { wrapHandler } from './event-info.js';\nimport { supportsPointerEvents, supportsTouchEvents, supportsMouseEvents } from './utils.js';\n\nvar mouseEventNames = {\n pointerdown: \"mousedown\",\n pointermove: \"mousemove\",\n pointerup: \"mouseup\",\n pointercancel: \"mousecancel\",\n pointerover: \"mouseover\",\n pointerout: \"mouseout\",\n pointerenter: \"mouseenter\",\n pointerleave: \"mouseleave\",\n};\nvar touchEventNames = {\n pointerdown: \"touchstart\",\n pointermove: \"touchmove\",\n pointerup: \"touchend\",\n pointercancel: \"touchcancel\",\n};\nfunction getPointerEventName(name) {\n if (supportsPointerEvents()) {\n return name;\n }\n else if (supportsTouchEvents()) {\n return touchEventNames[name];\n }\n else if (supportsMouseEvents()) {\n return mouseEventNames[name];\n }\n return name;\n}\nfunction addPointerEvent(target, eventName, handler, options) {\n return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === \"pointerdown\"), options);\n}\nfunction usePointerEvent(ref, eventName, handler, options) {\n return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === \"pointerdown\"), options);\n}\n\nexport { addPointerEvent, usePointerEvent };\n","import { isBrowser } from '../utils/is-browser.js';\n\n// We check for event support via functions in case they've been mocked by a testing suite.\nvar supportsPointerEvents = function () {\n return isBrowser && window.onpointerdown === null;\n};\nvar supportsTouchEvents = function () {\n return isBrowser && window.ontouchstart === null;\n};\nvar supportsMouseEvents = function () {\n return isBrowser && window.onmousedown === null;\n};\n\nexport { supportsMouseEvents, supportsPointerEvents, supportsTouchEvents };\n","/**\n * @public\n */\nvar Presence;\n(function (Presence) {\n Presence[Presence[\"Entering\"] = 0] = \"Entering\";\n Presence[Presence[\"Present\"] = 1] = \"Present\";\n Presence[Presence[\"Exiting\"] = 2] = \"Exiting\";\n})(Presence || (Presence = {}));\n/**\n * @public\n */\nvar VisibilityAction;\n(function (VisibilityAction) {\n VisibilityAction[VisibilityAction[\"Hide\"] = 0] = \"Hide\";\n VisibilityAction[VisibilityAction[\"Show\"] = 1] = \"Show\";\n})(VisibilityAction || (VisibilityAction = {}));\n\nexport { Presence, VisibilityAction };\n","var mix = function (from, to, progress) {\n return -progress * from + progress * to + from;\n};\n\nexport { mix };\n","import { isString } from '../utils.js';\nimport { hex } from './hex.js';\nimport { hsla } from './hsla.js';\nimport { rgba } from './rgba.js';\n\nvar color = {\n test: function (v) { return rgba.test(v) || hex.test(v) || hsla.test(v); },\n parse: function (v) {\n if (rgba.test(v)) {\n return rgba.parse(v);\n }\n else if (hsla.test(v)) {\n return hsla.parse(v);\n }\n else {\n return hex.parse(v);\n }\n },\n transform: function (v) {\n return isString(v)\n ? v\n : v.hasOwnProperty('red')\n ? rgba.transform(v)\n : hsla.transform(v);\n },\n};\n\nexport { color };\n","import { mix } from 'popmotion';\n\nfunction tweenAxis(target, prev, next, p) {\n target.min = mix(prev.min, next.min, p);\n target.max = mix(prev.max, next.max, p);\n}\nfunction calcRelativeOffsetAxis(parent, child) {\n return {\n min: child.min - parent.min,\n max: child.max - parent.min,\n };\n}\nfunction calcRelativeOffset(parent, child) {\n return {\n x: calcRelativeOffsetAxis(parent.x, child.x),\n y: calcRelativeOffsetAxis(parent.y, child.y),\n };\n}\nfunction checkIfParentHasChanged(prev, next) {\n var prevId = prev.getLayoutId();\n var nextId = next.getLayoutId();\n return prevId !== nextId || (nextId === undefined && prev !== next);\n}\n\nexport { calcRelativeOffset, calcRelativeOffsetAxis, checkIfParentHasChanged, tweenAxis };\n","import { __read, __rest } from 'tslib';\nimport * as React from 'react';\nimport { useState, useRef, useEffect } from 'react';\nimport { LazyContext } from '../../context/LazyContext.js';\nimport { loadFeatures } from '../../motion/features/definitions.js';\n\n/**\n * Used in conjunction with the `m` component to reduce bundle size.\n *\n * `m` is a version of the `motion` component that only loads functionality\n * critical for the initial render.\n *\n * `LazyMotion` can then be used to either synchronously or asynchronously\n * load animation and gesture support.\n *\n * ```jsx\n * // Synchronous loading\n * import { LazyMotion, m, domAnimations } from \"framer-motion\"\n *\n * function App() {\n * return (\n * \n * \n * \n * )\n * }\n *\n * // Asynchronous loading\n * import { LazyMotion, m } from \"framer-motion\"\n *\n * function App() {\n * return (\n * import('./path/to/domAnimations')}>\n * \n * \n * )\n * }\n * ```\n *\n * @public\n */\nfunction LazyMotion(_a) {\n var children = _a.children, features = _a.features, _b = _a.strict, strict = _b === void 0 ? false : _b;\n var _c = __read(useState(!isLazyBundle(features)), 2), setIsLoaded = _c[1];\n var loadedRenderer = useRef(undefined);\n /**\n * If this is a synchronous load, load features immediately\n */\n if (!isLazyBundle(features)) {\n var renderer = features.renderer, loadedFeatures = __rest(features, [\"renderer\"]);\n loadedRenderer.current = renderer;\n loadFeatures(loadedFeatures);\n }\n useEffect(function () {\n if (isLazyBundle(features)) {\n features().then(function (_a) {\n var renderer = _a.renderer, loadedFeatures = __rest(_a, [\"renderer\"]);\n loadFeatures(loadedFeatures);\n loadedRenderer.current = renderer;\n setIsLoaded(true);\n });\n }\n }, []);\n return (React.createElement(LazyContext.Provider, { value: { renderer: loadedRenderer.current, strict: strict } }, children));\n}\nfunction isLazyBundle(features) {\n return typeof features === \"function\";\n}\n\nexport { LazyMotion };\n","function shallowCompare(next, prev) {\n if (!Array.isArray(prev))\n return false;\n var prevLength = prev.length;\n if (prevLength !== next.length)\n return false;\n for (var i = 0; i < prevLength; i++) {\n if (prev[i] !== next[i])\n return false;\n }\n return true;\n}\n\nexport { shallowCompare };\n","/**\n * Tests a provided value against a ValueType\n */\nvar testValueType = function (v) { return function (type) { return type.test(v); }; };\n\nexport { testValueType };\n","import { number, px, percent, degrees, vw, vh } from 'style-value-types';\nimport { testValueType } from './test.js';\nimport { auto } from './type-auto.js';\n\n/**\n * A list of value types commonly used for dimensions\n */\nvar dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nvar findDimensionValueType = function (v) {\n return dimensionValueTypes.find(testValueType(v));\n};\n\nexport { dimensionValueTypes, findDimensionValueType };\n","/**\n * ValueType for \"auto\"\n */\nvar auto = {\n test: function (v) { return v === \"auto\"; },\n parse: function (v) { return v; },\n};\n\nexport { auto };\n","import { __spreadArray, __read } from 'tslib';\nimport { color, complex } from 'style-value-types';\nimport { dimensionValueTypes } from './dimensions.js';\nimport { testValueType } from './test.js';\n\n/**\n * A list of all ValueTypes\n */\nvar valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes)), [color, complex]);\n/**\n * Tests a value against the list of ValueTypes\n */\nvar findValueType = function (v) { return valueTypes.find(testValueType(v)); };\n\nexport { findValueType };\n","import { __rest, __assign, __spreadArray, __read } from 'tslib';\nimport { complex } from 'style-value-types';\nimport { isNumericalString } from '../../utils/is-numerical-string.js';\nimport { resolveFinalValueInKeyframes } from '../../utils/resolve-value.js';\nimport { motionValue } from '../../value/index.js';\nimport { getAnimatableNone } from '../dom/value-types/animatable-none.js';\nimport { findValueType } from '../dom/value-types/find.js';\nimport { resolveVariant } from './variants.js';\n\n/**\n * Set VisualElement's MotionValue, creating a new MotionValue for it if\n * it doesn't exist.\n */\nfunction setMotionValue(visualElement, key, value) {\n if (visualElement.hasValue(key)) {\n visualElement.getValue(key).set(value);\n }\n else {\n visualElement.addValue(key, motionValue(value));\n }\n}\nfunction setTarget(visualElement, definition) {\n var resolved = resolveVariant(visualElement, definition);\n var _a = resolved\n ? visualElement.makeTargetAnimatable(resolved, false)\n : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, [\"transitionEnd\", \"transition\"]);\n target = __assign(__assign({}, target), transitionEnd);\n for (var key in target) {\n var value = resolveFinalValueInKeyframes(target[key]);\n setMotionValue(visualElement, key, value);\n }\n}\nfunction setVariants(visualElement, variantLabels) {\n var reversedLabels = __spreadArray([], __read(variantLabels)).reverse();\n reversedLabels.forEach(function (key) {\n var _a;\n var variant = visualElement.getVariant(key);\n variant && setTarget(visualElement, variant);\n (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\n setVariants(child, variantLabels);\n });\n });\n}\nfunction setValues(visualElement, definition) {\n if (Array.isArray(definition)) {\n return setVariants(visualElement, definition);\n }\n else if (typeof definition === \"string\") {\n return setVariants(visualElement, [definition]);\n }\n else {\n setTarget(visualElement, definition);\n }\n}\nfunction checkTargetForNewValues(visualElement, target, origin) {\n var _a, _b, _c;\n var _d;\n var newValueKeys = Object.keys(target).filter(function (key) { return !visualElement.hasValue(key); });\n var numNewValues = newValueKeys.length;\n if (!numNewValues)\n return;\n for (var i = 0; i < numNewValues; i++) {\n var key = newValueKeys[i];\n var targetValue = target[key];\n var value = null;\n /**\n * If the target is a series of keyframes, we can use the first value\n * in the array. If this first value is null, we'll still need to read from the DOM.\n */\n if (Array.isArray(targetValue)) {\n value = targetValue[0];\n }\n /**\n * If the target isn't keyframes, or the first keyframe was null, we need to\n * first check if an origin value was explicitly defined in the transition as \"from\",\n * if not read the value from the DOM. As an absolute fallback, take the defined target value.\n */\n if (value === null) {\n value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];\n }\n /**\n * If value is still undefined or null, ignore it. Preferably this would throw,\n * but this was causing issues in Framer.\n */\n if (value === undefined || value === null)\n continue;\n if (typeof value === \"string\" && isNumericalString(value)) {\n // If this is a number read as a string, ie \"0\" or \"200\", convert it to a number\n value = parseFloat(value);\n }\n else if (!findValueType(value) && complex.test(targetValue)) {\n value = getAnimatableNone(key, targetValue);\n }\n visualElement.addValue(key, motionValue(value));\n (_c = (_d = origin)[key]) !== null && _c !== void 0 ? _c : (_d[key] = value);\n visualElement.setBaseTarget(key, value);\n }\n}\nfunction getOriginFromTransition(key, transition) {\n if (!transition)\n return;\n var valueTransition = transition[key] || transition[\"default\"] || transition;\n return valueTransition.from;\n}\nfunction getOrigin(target, transition, visualElement) {\n var _a, _b;\n var origin = {};\n for (var key in target) {\n origin[key] =\n (_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();\n }\n return origin;\n}\n\nexport { checkTargetForNewValues, getOrigin, getOriginFromTransition, setTarget, setValues };\n","import { __read, __rest, __assign } from 'tslib';\nimport { startAnimation } from '../../animation/utils/transitions.js';\nimport { setTarget } from './setters.js';\nimport { resolveVariant } from './variants.js';\n\n/**\n * @internal\n */\nfunction animateVisualElement(visualElement, definition, options) {\n if (options === void 0) { options = {}; }\n visualElement.notifyAnimationStart();\n var animation;\n if (Array.isArray(definition)) {\n var animations = definition.map(function (variant) {\n return animateVariant(visualElement, variant, options);\n });\n animation = Promise.all(animations);\n }\n else if (typeof definition === \"string\") {\n animation = animateVariant(visualElement, definition, options);\n }\n else {\n var resolvedDefinition = typeof definition === \"function\"\n ? resolveVariant(visualElement, definition, options.custom)\n : definition;\n animation = animateTarget(visualElement, resolvedDefinition, options);\n }\n return animation.then(function () {\n return visualElement.notifyAnimationComplete(definition);\n });\n}\nfunction animateVariant(visualElement, variant, options) {\n var _a;\n if (options === void 0) { options = {}; }\n var resolved = resolveVariant(visualElement, variant, options.custom);\n var _b = (resolved || {}).transition, transition = _b === void 0 ? visualElement.getDefaultTransition() || {} : _b;\n if (options.transitionOverride) {\n transition = options.transitionOverride;\n }\n /**\n * If we have a variant, create a callback that runs it as an animation.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n var getAnimation = resolved\n ? function () { return animateTarget(visualElement, resolved, options); }\n : function () { return Promise.resolve(); };\n /**\n * If we have children, create a callback that runs all their animations.\n * Otherwise, we resolve a Promise immediately for a composable no-op.\n */\n var getChildAnimations = ((_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.size)\n ? function (forwardDelay) {\n if (forwardDelay === void 0) { forwardDelay = 0; }\n var _a = transition.delayChildren, delayChildren = _a === void 0 ? 0 : _a, staggerChildren = transition.staggerChildren, staggerDirection = transition.staggerDirection;\n return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);\n }\n : function () { return Promise.resolve(); };\n /**\n * If the transition explicitly defines a \"when\" option, we need to resolve either\n * this animation or all children animations before playing the other.\n */\n var when = transition.when;\n if (when) {\n var _c = __read(when === \"beforeChildren\"\n ? [getAnimation, getChildAnimations]\n : [getChildAnimations, getAnimation], 2), first = _c[0], last = _c[1];\n return first().then(last);\n }\n else {\n return Promise.all([getAnimation(), getChildAnimations(options.delay)]);\n }\n}\n/**\n * @internal\n */\nfunction animateTarget(visualElement, definition, _a) {\n var _b;\n var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;\n var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, [\"transition\", \"transitionEnd\"]);\n if (transitionOverride)\n transition = transitionOverride;\n var animations = [];\n var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);\n for (var key in target) {\n var value = visualElement.getValue(key);\n var valueTarget = target[key];\n if (!value ||\n valueTarget === undefined ||\n (animationTypeState &&\n shouldBlockAnimation(animationTypeState, key))) {\n continue;\n }\n var animation = startAnimation(key, value, valueTarget, __assign({ delay: delay }, transition));\n animations.push(animation);\n }\n return Promise.all(animations).then(function () {\n transitionEnd && setTarget(visualElement, transitionEnd);\n });\n}\nfunction animateChildren(visualElement, variant, delayChildren, staggerChildren, staggerDirection, options) {\n if (delayChildren === void 0) { delayChildren = 0; }\n if (staggerChildren === void 0) { staggerChildren = 0; }\n if (staggerDirection === void 0) { staggerDirection = 1; }\n var animations = [];\n var maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;\n var generateStaggerDuration = staggerDirection === 1\n ? function (i) {\n if (i === void 0) { i = 0; }\n return i * staggerChildren;\n }\n : function (i) {\n if (i === void 0) { i = 0; }\n return maxStaggerDuration - i * staggerChildren;\n };\n Array.from(visualElement.variantChildren)\n .sort(sortByTreeOrder)\n .forEach(function (child, i) {\n animations.push(animateVariant(child, variant, __assign(__assign({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function () { return child.notifyAnimationComplete(variant); }));\n });\n return Promise.all(animations);\n}\nfunction stopAnimation(visualElement) {\n visualElement.forEachValue(function (value) { return value.stop(); });\n}\nfunction sortByTreeOrder(a, b) {\n return a.sortNodePosition(b);\n}\n/**\n * Decide whether we should block this animation. Previously, we achieved this\n * just by checking whether the key was listed in protectedKeys, but this\n * posed problems if an animation was triggered by afterChildren and protectedKeys\n * had been set to true in the meantime.\n */\nfunction shouldBlockAnimation(_a, key) {\n var protectedKeys = _a.protectedKeys, needsAnimating = _a.needsAnimating;\n var shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;\n needsAnimating[key] = false;\n return shouldBlock;\n}\n\nexport { animateVisualElement, sortByTreeOrder, stopAnimation };\n","import { __spreadArray, __read, __assign, __rest } from 'tslib';\nimport { isAnimationControls } from '../../animation/utils/is-animation-controls.js';\nimport { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.js';\nimport { shallowCompare } from '../../utils/shallow-compare.js';\nimport { animateVisualElement } from './animation.js';\nimport { AnimationType } from './types.js';\nimport { isVariantLabels, resolveVariant, isVariantLabel } from './variants.js';\n\nvar variantPriorityOrder = [\n AnimationType.Animate,\n AnimationType.Hover,\n AnimationType.Tap,\n AnimationType.Drag,\n AnimationType.Focus,\n AnimationType.Exit,\n];\nvar reversePriorityOrder = __spreadArray([], __read(variantPriorityOrder)).reverse();\nvar numAnimationTypes = variantPriorityOrder.length;\nfunction animateList(visualElement) {\n return function (animations) {\n return Promise.all(animations.map(function (_a) {\n var animation = _a.animation, options = _a.options;\n return animateVisualElement(visualElement, animation, options);\n }));\n };\n}\nfunction createAnimationState(visualElement) {\n var animate = animateList(visualElement);\n var state = createState();\n var allAnimatedKeys = {};\n var isInitialRender = true;\n /**\n * This function will be used to reduce the animation definitions for\n * each active animation type into an object of resolved values for it.\n */\n var buildResolvedTypeValues = function (acc, definition) {\n var resolved = resolveVariant(visualElement, definition);\n if (resolved) {\n resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, [\"transition\", \"transitionEnd\"]);\n acc = __assign(__assign(__assign({}, acc), target), transitionEnd);\n }\n return acc;\n };\n function isAnimated(key) {\n return allAnimatedKeys[key] !== undefined;\n }\n /**\n * This just allows us to inject mocked animation functions\n * @internal\n */\n function setAnimateFunction(makeAnimator) {\n animate = makeAnimator(visualElement);\n }\n /**\n * When we receive new props, we need to:\n * 1. Create a list of protected keys for each type. This is a directory of\n * value keys that are currently being \"handled\" by types of a higher priority\n * so that whenever an animation is played of a given type, these values are\n * protected from being animated.\n * 2. Determine if an animation type needs animating.\n * 3. Determine if any values have been removed from a type and figure out\n * what to animate those to.\n */\n function animateChanges(options, changedActiveType) {\n var _a;\n var props = visualElement.getProps();\n var context = visualElement.getVariantContext(true) || {};\n /**\n * A list of animations that we'll build into as we iterate through the animation\n * types. This will get executed at the end of the function.\n */\n var animations = [];\n /**\n * Keep track of which values have been removed. Then, as we hit lower priority\n * animation types, we can check if they contain removed values and animate to that.\n */\n var removedKeys = new Set();\n /**\n * A dictionary of all encountered keys. This is an object to let us build into and\n * copy it without iteration. Each time we hit an animation type we set its protected\n * keys - the keys its not allowed to animate - to the latest version of this object.\n */\n var encounteredKeys = {};\n /**\n * If a variant has been removed at a given index, and this component is controlling\n * variant animations, we want to ensure lower-priority variants are forced to animate.\n */\n var removedVariantIndex = Infinity;\n var _loop_1 = function (i) {\n var type = reversePriorityOrder[i];\n var typeState = state[type];\n var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];\n var propIsVariant = isVariantLabel(prop);\n /**\n * If this type has *just* changed isActive status, set activeDelta\n * to that status. Otherwise set to null.\n */\n var activeDelta = type === changedActiveType ? typeState.isActive : null;\n if (activeDelta === false)\n removedVariantIndex = i;\n /**\n * If this prop is an inherited variant, rather than been set directly on the\n * component itself, we want to make sure we allow the parent to trigger animations.\n *\n * TODO: Can probably change this to a !isControllingVariants check\n */\n var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;\n /**\n *\n */\n if (isInherited &&\n isInitialRender &&\n visualElement.manuallyAnimateOnMount) {\n isInherited = false;\n }\n /**\n * Set all encountered keys so far as the protected keys for this type. This will\n * be any key that has been animated or otherwise handled by active, higher-priortiy types.\n */\n typeState.protectedKeys = __assign({}, encounteredKeys);\n // Check if we can skip analysing this prop early\n if (\n // If it isn't active and hasn't *just* been set as inactive\n (!typeState.isActive && activeDelta === null) ||\n // If we didn't and don't have any defined prop for this animation type\n (!prop && !typeState.prevProp) ||\n // Or if the prop doesn't define an animation\n isAnimationControls(prop) ||\n typeof prop === \"boolean\") {\n return \"continue\";\n }\n /**\n * As we go look through the values defined on this type, if we detect\n * a changed value or a value that was removed in a higher priority, we set\n * this to true and add this prop to the animation list.\n */\n var shouldAnimateType = variantsHaveChanged(typeState.prevProp, prop) ||\n // If we're making this variant active, we want to always make it active\n (type === changedActiveType &&\n typeState.isActive &&\n !isInherited &&\n propIsVariant) ||\n // If we removed a higher-priority variant (i is in reverse order)\n (i > removedVariantIndex && propIsVariant);\n /**\n * As animations can be set as variant lists, variants or target objects, we\n * coerce everything to an array if it isn't one already\n */\n var definitionList = Array.isArray(prop) ? prop : [prop];\n /**\n * Build an object of all the resolved values. We'll use this in the subsequent\n * animateChanges calls to determine whether a value has changed.\n */\n var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});\n if (activeDelta === false)\n resolvedValues = {};\n /**\n * Now we need to loop through all the keys in the prev prop and this prop,\n * and decide:\n * 1. If the value has changed, and needs animating\n * 2. If it has been removed, and needs adding to the removedKeys set\n * 3. If it has been removed in a higher priority type and needs animating\n * 4. If it hasn't been removed in a higher priority but hasn't changed, and\n * needs adding to the type's protectedKeys list.\n */\n var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;\n var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);\n var markToAnimate = function (key) {\n shouldAnimateType = true;\n removedKeys.delete(key);\n typeState.needsAnimating[key] = true;\n };\n for (var key in allKeys) {\n var next = resolvedValues[key];\n var prev = prevResolvedValues[key];\n // If we've already handled this we can just skip ahead\n if (encounteredKeys.hasOwnProperty(key))\n continue;\n /**\n * If the value has changed, we probably want to animate it.\n */\n if (next !== prev) {\n /**\n * If both values are keyframes, we need to shallow compare them to\n * detect whether any value has changed. If it has, we animate it.\n */\n if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {\n if (!shallowCompare(next, prev)) {\n markToAnimate(key);\n }\n else {\n /**\n * If it hasn't changed, we want to ensure it doesn't animate by\n * adding it to the list of protected keys.\n */\n typeState.protectedKeys[key] = true;\n }\n }\n else if (next !== undefined) {\n // If next is defined and doesn't equal prev, it needs animating\n markToAnimate(key);\n }\n else {\n // If it's undefined, it's been removed.\n removedKeys.add(key);\n }\n }\n else if (next !== undefined && removedKeys.has(key)) {\n /**\n * If next hasn't changed and it isn't undefined, we want to check if it's\n * been removed by a higher priority\n */\n markToAnimate(key);\n }\n else {\n /**\n * If it hasn't changed, we add it to the list of protected values\n * to ensure it doesn't get animated.\n */\n typeState.protectedKeys[key] = true;\n }\n }\n /**\n * Update the typeState so next time animateChanges is called we can compare the\n * latest prop and resolvedValues to these.\n */\n typeState.prevProp = prop;\n typeState.prevResolvedValues = resolvedValues;\n /**\n *\n */\n if (typeState.isActive) {\n encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);\n }\n if (isInitialRender && visualElement.blockInitialAnimation) {\n shouldAnimateType = false;\n }\n /**\n * If this is an inherited prop we want to hard-block animations\n * TODO: Test as this should probably still handle animations triggered\n * by removed values?\n */\n if (shouldAnimateType && !isInherited) {\n animations.push.apply(animations, __spreadArray([], __read(definitionList.map(function (animation) { return ({\n animation: animation,\n options: __assign({ type: type }, options),\n }); }))));\n }\n };\n /**\n * Iterate through all animation types in reverse priority order. For each, we want to\n * detect which values it's handling and whether or not they've changed (and therefore\n * need to be animated). If any values have been removed, we want to detect those in\n * lower priority props and flag for animation.\n */\n for (var i = 0; i < numAnimationTypes; i++) {\n _loop_1(i);\n }\n allAnimatedKeys = __assign({}, encounteredKeys);\n /**\n * If there are some removed value that haven't been dealt with,\n * we need to create a new animation that falls back either to the value\n * defined in the style prop, or the last read value.\n */\n if (removedKeys.size) {\n var fallbackAnimation_1 = {};\n removedKeys.forEach(function (key) {\n var fallbackTarget = visualElement.getBaseTarget(key);\n if (fallbackTarget !== undefined) {\n fallbackAnimation_1[key] = fallbackTarget;\n }\n });\n animations.push({ animation: fallbackAnimation_1 });\n }\n var shouldAnimate = Boolean(animations.length);\n if (isInitialRender &&\n props.initial === false &&\n !visualElement.manuallyAnimateOnMount) {\n shouldAnimate = false;\n }\n isInitialRender = false;\n return shouldAnimate ? animate(animations) : Promise.resolve();\n }\n /**\n * Change whether a certain animation type is active.\n */\n function setActive(type, isActive, options) {\n var _a;\n // If the active state hasn't changed, we can safely do nothing here\n if (state[type].isActive === isActive)\n return Promise.resolve();\n // Propagate active change to children\n (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });\n state[type].isActive = isActive;\n return animateChanges(options, type);\n }\n return {\n isAnimated: isAnimated,\n animateChanges: animateChanges,\n setActive: setActive,\n setAnimateFunction: setAnimateFunction,\n getState: function () { return state; },\n };\n}\nfunction variantsHaveChanged(prev, next) {\n if (typeof next === \"string\") {\n return next !== prev;\n }\n else if (isVariantLabels(next)) {\n return !shallowCompare(next, prev);\n }\n return false;\n}\nfunction createTypeState(isActive) {\n if (isActive === void 0) { isActive = false; }\n return {\n isActive: isActive,\n protectedKeys: {},\n needsAnimating: {},\n prevResolvedValues: {},\n };\n}\nfunction createState() {\n var _a;\n return _a = {},\n _a[AnimationType.Animate] = createTypeState(true),\n _a[AnimationType.Hover] = createTypeState(),\n _a[AnimationType.Tap] = createTypeState(),\n _a[AnimationType.Drag] = createTypeState(),\n _a[AnimationType.Focus] = createTypeState(),\n _a[AnimationType.Exit] = createTypeState(),\n _a;\n}\n\nexport { createAnimationState, variantPriorityOrder, variantsHaveChanged };\n","import { __read } from 'tslib';\nimport { useEffect, useContext } from 'react';\nimport { isAnimationControls } from '../../animation/utils/is-animation-controls.js';\nimport { usePresence } from '../../components/AnimatePresence/use-presence.js';\nimport { PresenceContext } from '../../context/PresenceContext.js';\nimport { createAnimationState } from '../../render/utils/animation-state.js';\nimport { AnimationType } from '../../render/utils/types.js';\nimport { makeRenderlessComponent } from '../utils/make-renderless-component.js';\n\nvar animations = {\n animation: makeRenderlessComponent(function (_a) {\n var visualElement = _a.visualElement, animate = _a.animate;\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n visualElement.animationState || (visualElement.animationState = createAnimationState(visualElement));\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n if (isAnimationControls(animate)) {\n useEffect(function () { return animate.subscribe(visualElement); }, [animate]);\n }\n }),\n exit: makeRenderlessComponent(function (props) {\n var custom = props.custom, visualElement = props.visualElement;\n var _a = __read(usePresence(), 2), isPresent = _a[0], onExitComplete = _a[1];\n var presenceContext = useContext(PresenceContext);\n useEffect(function () {\n var _a, _b;\n var animation = (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Exit, !isPresent, { custom: (_b = presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.custom) !== null && _b !== void 0 ? _b : custom });\n !isPresent && (animation === null || animation === void 0 ? void 0 : animation.then(onExitComplete));\n }, [isPresent]);\n }),\n};\n\nexport { animations };\n","import { isMouseEvent } from './utils/event-type.js';\nimport { AnimationType } from '../render/utils/types.js';\nimport { usePointerEvent } from '../events/use-pointer-event.js';\nimport { isDragActive } from './drag/utils/lock.js';\n\nfunction createHoverEvent(visualElement, isActive, callback) {\n return function (event, info) {\n var _a;\n if (!isMouseEvent(event) || isDragActive())\n return;\n callback === null || callback === void 0 ? void 0 : callback(event, info);\n (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);\n };\n}\nfunction useHoverGesture(_a) {\n var onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd, whileHover = _a.whileHover, visualElement = _a.visualElement;\n usePointerEvent(visualElement, \"pointerenter\", onHoverStart || whileHover\n ? createHoverEvent(visualElement, true, onHoverStart)\n : undefined);\n usePointerEvent(visualElement, \"pointerleave\", onHoverEnd || whileHover\n ? createHoverEvent(visualElement, false, onHoverEnd)\n : undefined);\n}\n\nexport { useHoverGesture };\n","/**\n * Recursively traverse up the tree to check whether the provided child node\n * is the parent or a descendant of it.\n *\n * @param parent - Element to find\n * @param child - Element to test against parent\n */\nvar isNodeOrChild = function (parent, child) {\n if (!child) {\n return false;\n }\n else if (parent === child) {\n return true;\n }\n else {\n return isNodeOrChild(parent, child.parentElement);\n }\n};\n\nexport { isNodeOrChild };\n","import { useFocusGesture } from '../../gestures/use-focus-gesture.js';\nimport { useHoverGesture } from '../../gestures/use-hover-gesture.js';\nimport { useTapGesture } from '../../gestures/use-tap-gesture.js';\nimport { makeRenderlessComponent } from '../utils/make-renderless-component.js';\n\nvar gestureAnimations = {\n tap: makeRenderlessComponent(useTapGesture),\n focus: makeRenderlessComponent(useFocusGesture),\n hover: makeRenderlessComponent(useHoverGesture),\n};\n\nexport { gestureAnimations };\n","import { useRef } from 'react';\nimport { isNodeOrChild } from './utils/is-node-or-child.js';\nimport { usePointerEvent, addPointerEvent } from '../events/use-pointer-event.js';\nimport { useUnmountEffect } from '../utils/use-unmount-effect.js';\nimport { pipe } from 'popmotion';\nimport { AnimationType } from '../render/utils/types.js';\nimport { isDragActive } from './drag/utils/lock.js';\n\n/**\n * @param handlers -\n * @internal\n */\nfunction useTapGesture(_a) {\n var onTap = _a.onTap, onTapStart = _a.onTapStart, onTapCancel = _a.onTapCancel, whileTap = _a.whileTap, visualElement = _a.visualElement;\n var hasPressListeners = onTap || onTapStart || onTapCancel || whileTap;\n var isPressing = useRef(false);\n var cancelPointerEndListeners = useRef(null);\n function removePointerEndListener() {\n var _a;\n (_a = cancelPointerEndListeners.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEndListeners);\n cancelPointerEndListeners.current = null;\n }\n function checkPointerEnd() {\n var _a;\n removePointerEndListener();\n isPressing.current = false;\n (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, false);\n return !isDragActive();\n }\n function onPointerUp(event, info) {\n if (!checkPointerEnd())\n return;\n /**\n * We only count this as a tap gesture if the event.target is the same\n * as, or a child of, this component's element\n */\n !isNodeOrChild(visualElement.getInstance(), event.target)\n ? onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info)\n : onTap === null || onTap === void 0 ? void 0 : onTap(event, info);\n }\n function onPointerCancel(event, info) {\n if (!checkPointerEnd())\n return;\n onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);\n }\n function onPointerDown(event, info) {\n var _a;\n removePointerEndListener();\n if (isPressing.current)\n return;\n isPressing.current = true;\n cancelPointerEndListeners.current = pipe(addPointerEvent(window, \"pointerup\", onPointerUp), addPointerEvent(window, \"pointercancel\", onPointerCancel));\n onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);\n (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);\n }\n usePointerEvent(visualElement, \"pointerdown\", hasPressListeners ? onPointerDown : undefined);\n useUnmountEffect(removePointerEndListener);\n}\n\nexport { useTapGesture };\n","import { AnimationType } from '../render/utils/types.js';\nimport { useDomEvent } from '../events/use-dom-event.js';\n\n/**\n *\n * @param props\n * @param ref\n * @internal\n */\nfunction useFocusGesture(_a) {\n var whileFocus = _a.whileFocus, visualElement = _a.visualElement;\n var onFocus = function () {\n var _a;\n (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, true);\n };\n var onBlur = function () {\n var _a;\n (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, false);\n };\n useDomEvent(visualElement, \"focus\", whileFocus ? onFocus : undefined);\n useDomEvent(visualElement, \"blur\", whileFocus ? onBlur : undefined);\n}\n\nexport { useFocusGesture };\n","import { axisBox, delta } from '../../utils/geometry/index.js';\n\nvar createProjectionState = function () { return ({\n isEnabled: false,\n isHydrated: false,\n isTargetLocked: false,\n target: axisBox(),\n targetFinal: axisBox(),\n}); };\nfunction createLayoutState() {\n return {\n isHydrated: false,\n layout: axisBox(),\n layoutCorrected: axisBox(),\n treeScale: { x: 1, y: 1 },\n delta: delta(),\n deltaFinal: delta(),\n deltaTransform: \"\",\n };\n}\nvar zeroLayout = createLayoutState();\n\nexport { createLayoutState, createProjectionState, zeroLayout };\n","import { zeroLayout } from '../../utils/state.js';\n\n/**\n * Build a transform style that takes a calculated delta between the element's current\n * space on screen and projects it into the desired space.\n */\nfunction buildLayoutProjectionTransform(_a, treeScale, latestTransform) {\n var x = _a.x, y = _a.y;\n /**\n * The translations we use to calculate are always relative to the viewport coordinate space.\n * But when we apply scales, we also scale the coordinate space of an element and its children.\n * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need\n * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.\n */\n var xTranslate = x.translate / treeScale.x;\n var yTranslate = y.translate / treeScale.y;\n var transform = \"translate3d(\" + xTranslate + \"px, \" + yTranslate + \"px, 0) \";\n if (latestTransform) {\n var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;\n if (rotate)\n transform += \"rotate(\" + rotate + \") \";\n if (rotateX)\n transform += \"rotateX(\" + rotateX + \") \";\n if (rotateY)\n transform += \"rotateY(\" + rotateY + \") \";\n }\n transform += \"scale(\" + x.scale + \", \" + y.scale + \")\";\n return !latestTransform && transform === identityProjection ? \"\" : transform;\n}\n/**\n * Take the calculated delta origin and apply it as a transform string.\n */\nfunction buildLayoutProjectionTransformOrigin(_a) {\n var deltaFinal = _a.deltaFinal;\n return deltaFinal.x.origin * 100 + \"% \" + deltaFinal.y.origin * 100 + \"% 0\";\n}\nvar identityProjection = buildLayoutProjectionTransform(zeroLayout.delta, zeroLayout.treeScale, { x: 1, y: 1 });\n\nexport { buildLayoutProjectionTransform, buildLayoutProjectionTransformOrigin, identityProjection };\n","import { __spreadArray, __read } from 'tslib';\nimport { SubscriptionManager } from '../../utils/subscription-manager.js';\n\nvar names = [\n \"LayoutMeasure\",\n \"BeforeLayoutMeasure\",\n \"LayoutUpdate\",\n \"ViewportBoxUpdate\",\n \"Update\",\n \"Render\",\n \"AnimationComplete\",\n \"LayoutAnimationComplete\",\n \"AnimationStart\",\n \"SetAxisTarget\",\n \"Unmount\",\n];\nfunction createLifecycles() {\n var managers = names.map(function () { return new SubscriptionManager(); });\n var propSubscriptions = {};\n var lifecycles = {\n clearAllListeners: function () { return managers.forEach(function (manager) { return manager.clear(); }); },\n updatePropListeners: function (props) {\n return names.forEach(function (name) {\n var _a;\n (_a = propSubscriptions[name]) === null || _a === void 0 ? void 0 : _a.call(propSubscriptions);\n var on = \"on\" + name;\n var propListener = props[on];\n if (propListener) {\n propSubscriptions[name] = lifecycles[on](propListener);\n }\n });\n },\n };\n managers.forEach(function (manager, i) {\n lifecycles[\"on\" + names[i]] = function (handler) { return manager.add(handler); };\n lifecycles[\"notify\" + names[i]] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return manager.notify.apply(manager, __spreadArray([], __read(args)));\n };\n });\n return lifecycles;\n}\n\nexport { createLifecycles };\n","import { addUniqueItem, removeItem } from '../../utils/array.js';\nimport { compareByDepth } from './compare-by-depth.js';\n\nvar FlatTree = /** @class */ (function () {\n function FlatTree() {\n this.children = [];\n this.isDirty = false;\n }\n FlatTree.prototype.add = function (child) {\n addUniqueItem(this.children, child);\n this.isDirty = true;\n };\n FlatTree.prototype.remove = function (child) {\n removeItem(this.children, child);\n this.isDirty = true;\n };\n FlatTree.prototype.forEach = function (callback) {\n this.isDirty && this.children.sort(compareByDepth);\n this.isDirty = false;\n this.children.forEach(callback);\n };\n return FlatTree;\n}());\n\nexport { FlatTree };\n","import { __assign, __spreadArray, __read } from 'tslib';\nimport sync, { cancelSync } from 'framesync';\nimport { pipe } from 'popmotion';\nimport { Presence } from '../components/AnimateSharedLayout/types.js';\nimport { eachAxis } from '../utils/each-axis.js';\nimport { axisBox } from '../utils/geometry/index.js';\nimport { removeBoxTransforms, applyBoxTransforms } from '../utils/geometry/delta-apply.js';\nimport { calcRelativeBox, updateBoxDelta } from '../utils/geometry/delta-calc.js';\nimport { motionValue } from '../value/index.js';\nimport { isMotionValue } from '../value/utils/is-motion-value.js';\nimport { buildLayoutProjectionTransform } from './html/utils/build-projection-transform.js';\nimport { variantPriorityOrder } from './utils/animation-state.js';\nimport { createLifecycles } from './utils/lifecycles.js';\nimport { updateMotionValuesFromProps } from './utils/motion-values.js';\nimport { updateLayoutDeltas } from './utils/projection.js';\nimport { createLayoutState, createProjectionState } from './utils/state.js';\nimport { FlatTree } from './utils/flat-tree.js';\nimport { checkIfControllingVariants, checkIfVariantNode, isVariantLabel } from './utils/variants.js';\nimport { setCurrentViewportBox } from './dom/projection/relative-set.js';\nimport { isDraggable } from './utils/is-draggable.js';\n\nvar visualElement = function (_a) {\n var _b = _a.treeType, treeType = _b === void 0 ? \"\" : _b, build = _a.build, getBaseTarget = _a.getBaseTarget, makeTargetAnimatable = _a.makeTargetAnimatable, measureViewportBox = _a.measureViewportBox, renderInstance = _a.render, readValueFromInstance = _a.readValueFromInstance, resetTransform = _a.resetTransform, restoreTransform = _a.restoreTransform, removeValueFromRenderState = _a.removeValueFromRenderState, sortNodePosition = _a.sortNodePosition, scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps;\n return function (_a, options) {\n var parent = _a.parent, props = _a.props, presenceId = _a.presenceId, blockInitialAnimation = _a.blockInitialAnimation, visualState = _a.visualState;\n if (options === void 0) { options = {}; }\n var latestValues = visualState.latestValues, renderState = visualState.renderState;\n /**\n * The instance of the render-specific node that will be hydrated by the\n * exposed React ref. So for example, this visual element can host a\n * HTMLElement, plain object, or Three.js object. The functions provided\n * in VisualElementConfig allow us to interface with this instance.\n */\n var instance;\n /**\n * Manages the subscriptions for a visual element's lifecycle, for instance\n * onRender and onViewportBoxUpdate.\n */\n var lifecycles = createLifecycles();\n /**\n *\n */\n var projection = createProjectionState();\n /**\n * A reference to the nearest projecting parent. This is either\n * undefined if we haven't looked for the nearest projecting parent,\n * false if there is no parent performing layout projection, or a reference\n * to the projecting parent.\n */\n var projectionParent;\n /**\n * This is a reference to the visual state of the \"lead\" visual element.\n * Usually, this will be this visual element. But if it shares a layoutId\n * with other visual elements, only one of them will be designated lead by\n * AnimateSharedLayout. All the other visual elements will take on the visual\n * appearance of the lead while they crossfade to it.\n */\n var leadProjection = projection;\n var leadLatestValues = latestValues;\n var unsubscribeFromLeadVisualElement;\n /**\n * The latest layout measurements and calculated projections. This\n * is seperate from the target projection data in visualState as\n * many visual elements might point to the same piece of visualState as\n * a target, whereas they might each have different layouts and thus\n * projection calculations needed to project into the same viewport box.\n */\n var layoutState = createLayoutState();\n /**\n *\n */\n var crossfader;\n /**\n * Keep track of whether the viewport box has been updated since the\n * last time the layout projection was re-calculated.\n */\n var hasViewportBoxUpdated = false;\n /**\n * A map of all motion values attached to this visual element. Motion\n * values are source of truth for any given animated value. A motion\n * value might be provided externally by the component via props.\n */\n var values = new Map();\n /**\n * A map of every subscription that binds the provided or generated\n * motion values onChange listeners to this visual element.\n */\n var valueSubscriptions = new Map();\n /**\n * A reference to the previously-provided motion values as returned\n * from scrapeMotionValuesFromProps. We use the keys in here to determine\n * if any motion values need to be removed after props are updated.\n */\n var prevMotionValues = {};\n /**\n * x/y motion values that track the progress of initiated layout\n * animations.\n *\n * TODO: Target for removal\n */\n var projectionTargetProgress;\n /**\n * When values are removed from all animation props we need to search\n * for a fallback value to animate to. These values are tracked in baseTarget.\n */\n var baseTarget = __assign({}, latestValues);\n // Internal methods ========================\n /**\n * On mount, this will be hydrated with a callback to disconnect\n * this visual element from its parent on unmount.\n */\n var removeFromVariantTree;\n /**\n *\n */\n function render() {\n if (!instance)\n return;\n if (element.isProjectionReady()) {\n /**\n * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.\n * This is the final box that we will then project into by calculating a transform delta and\n * applying it to the corrected box.\n */\n applyBoxTransforms(leadProjection.targetFinal, leadProjection.target, leadLatestValues);\n /**\n * Update the delta between the corrected box and the final target box, after\n * user-set transforms are applied to it. This will be used by the renderer to\n * create a transform style that will reproject the element from its actual layout\n * into the desired bounding box.\n */\n updateBoxDelta(layoutState.deltaFinal, layoutState.layoutCorrected, leadProjection.targetFinal, latestValues);\n }\n triggerBuild();\n renderInstance(instance, renderState);\n }\n function triggerBuild() {\n var valuesToRender = latestValues;\n if (crossfader && crossfader.isActive()) {\n var crossfadedValues = crossfader.getCrossfadeState(element);\n if (crossfadedValues)\n valuesToRender = crossfadedValues;\n }\n build(element, renderState, valuesToRender, leadProjection, layoutState, options, props);\n }\n function update() {\n lifecycles.notifyUpdate(latestValues);\n }\n function updateLayoutProjection() {\n if (!element.isProjectionReady())\n return;\n var delta = layoutState.delta, treeScale = layoutState.treeScale;\n var prevTreeScaleX = treeScale.x;\n var prevTreeScaleY = treeScale.y;\n var prevDeltaTransform = layoutState.deltaTransform;\n updateLayoutDeltas(layoutState, leadProjection, element.path, latestValues);\n hasViewportBoxUpdated &&\n element.notifyViewportBoxUpdate(leadProjection.target, delta);\n hasViewportBoxUpdated = false;\n var deltaTransform = buildLayoutProjectionTransform(delta, treeScale);\n if (deltaTransform !== prevDeltaTransform ||\n // Also compare calculated treeScale, for values that rely on this only for scale correction\n prevTreeScaleX !== treeScale.x ||\n prevTreeScaleY !== treeScale.y) {\n element.scheduleRender();\n }\n layoutState.deltaTransform = deltaTransform;\n }\n function updateTreeLayoutProjection() {\n element.layoutTree.forEach(fireUpdateLayoutProjection);\n }\n /**\n *\n */\n function bindToMotionValue(key, value) {\n var removeOnChange = value.onChange(function (latestValue) {\n latestValues[key] = latestValue;\n props.onUpdate && sync.update(update, false, true);\n });\n var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);\n valueSubscriptions.set(key, function () {\n removeOnChange();\n removeOnRenderRequest();\n });\n }\n /**\n * Any motion values that are provided to the element when created\n * aren't yet bound to the element, as this would technically be impure.\n * However, we iterate through the motion values and set them to the\n * initial values for this component.\n *\n * TODO: This is impure and we should look at changing this to run on mount.\n * Doing so will break some tests but this isn't neccessarily a breaking change,\n * more a reflection of the test.\n */\n var initialMotionValues = scrapeMotionValuesFromProps(props);\n for (var key in initialMotionValues) {\n var value = initialMotionValues[key];\n if (latestValues[key] !== undefined && isMotionValue(value)) {\n value.set(latestValues[key], false);\n }\n }\n /**\n * Determine what role this visual element should take in the variant tree.\n */\n var isControllingVariants = checkIfControllingVariants(props);\n var isVariantNode = checkIfVariantNode(props);\n var element = __assign(__assign({ treeType: treeType, \n /**\n * This is a mirror of the internal instance prop, which keeps\n * VisualElement type-compatible with React's RefObject.\n */\n current: null, \n /**\n * The depth of this visual element within the visual element tree.\n */\n depth: parent ? parent.depth + 1 : 0, parent: parent, children: new Set(), \n /**\n * An ancestor path back to the root visual element. This is used\n * by layout projection to quickly recurse back up the tree.\n */\n path: parent ? __spreadArray(__spreadArray([], __read(parent.path)), [parent]) : [], layoutTree: parent ? parent.layoutTree : new FlatTree(), \n /**\n *\n */\n presenceId: presenceId,\n projection: projection, \n /**\n * If this component is part of the variant tree, it should track\n * any children that are also part of the tree. This is essentially\n * a shadow tree to simplify logic around how to stagger over children.\n */\n variantChildren: isVariantNode ? new Set() : undefined, \n /**\n * Whether this instance is visible. This can be changed imperatively\n * by AnimateSharedLayout, is analogous to CSS's visibility in that\n * hidden elements should take up layout, and needs enacting by the configured\n * render function.\n */\n isVisible: undefined, \n /**\n * Normally, if a component is controlled by a parent's variants, it can\n * rely on that ancestor to trigger animations further down the tree.\n * However, if a component is created after its parent is mounted, the parent\n * won't trigger that mount animation so the child needs to.\n *\n * TODO: This might be better replaced with a method isParentMounted\n */\n manuallyAnimateOnMount: Boolean(parent === null || parent === void 0 ? void 0 : parent.isMounted()), \n /**\n * This can be set by AnimatePresence to force components that mount\n * at the same time as it to mount as if they have initial={false} set.\n */\n blockInitialAnimation: blockInitialAnimation, \n /**\n * Determine whether this component has mounted yet. This is mostly used\n * by variant children to determine whether they need to trigger their\n * own animations on mount.\n */\n isMounted: function () { return Boolean(instance); }, mount: function (newInstance) {\n instance = element.current = newInstance;\n element.pointTo(element);\n if (isVariantNode && parent && !isControllingVariants) {\n removeFromVariantTree = parent === null || parent === void 0 ? void 0 : parent.addVariantChild(element);\n }\n parent === null || parent === void 0 ? void 0 : parent.children.add(element);\n },\n /**\n *\n */\n unmount: function () {\n cancelSync.update(update);\n cancelSync.render(render);\n cancelSync.preRender(element.updateLayoutProjection);\n valueSubscriptions.forEach(function (remove) { return remove(); });\n element.stopLayoutAnimation();\n element.layoutTree.remove(element);\n removeFromVariantTree === null || removeFromVariantTree === void 0 ? void 0 : removeFromVariantTree();\n parent === null || parent === void 0 ? void 0 : parent.children.delete(element);\n unsubscribeFromLeadVisualElement === null || unsubscribeFromLeadVisualElement === void 0 ? void 0 : unsubscribeFromLeadVisualElement();\n lifecycles.clearAllListeners();\n },\n /**\n * Add a child visual element to our set of children.\n */\n addVariantChild: function (child) {\n var _a;\n var closestVariantNode = element.getClosestVariantNode();\n if (closestVariantNode) {\n (_a = closestVariantNode.variantChildren) === null || _a === void 0 ? void 0 : _a.add(child);\n return function () { return closestVariantNode.variantChildren.delete(child); };\n }\n },\n sortNodePosition: function (other) {\n /**\n * If these nodes aren't even of the same type we can't compare their depth.\n */\n if (!sortNodePosition || treeType !== other.treeType)\n return 0;\n return sortNodePosition(element.getInstance(), other.getInstance());\n }, \n /**\n * Returns the closest variant node in the tree starting from\n * this visual element.\n */\n getClosestVariantNode: function () {\n return isVariantNode ? element : parent === null || parent === void 0 ? void 0 : parent.getClosestVariantNode();\n }, \n /**\n * A method that schedules an update to layout projections throughout\n * the tree. We inherit from the parent so there's only ever one\n * job scheduled on the next frame - that of the root visual element.\n */\n scheduleUpdateLayoutProjection: parent\n ? parent.scheduleUpdateLayoutProjection\n : function () {\n return sync.preRender(element.updateTreeLayoutProjection, false, true);\n }, \n /**\n * Expose the latest layoutId prop.\n */\n getLayoutId: function () { return props.layoutId; }, \n /**\n * Returns the current instance.\n */\n getInstance: function () { return instance; }, \n /**\n * Get/set the latest static values.\n */\n getStaticValue: function (key) { return latestValues[key]; }, setStaticValue: function (key, value) { return (latestValues[key] = value); }, \n /**\n * Returns the latest motion value state. Currently only used to take\n * a snapshot of the visual element - perhaps this can return the whole\n * visual state\n */\n getLatestValues: function () { return latestValues; }, \n /**\n * Set the visiblity of the visual element. If it's changed, schedule\n * a render to reflect these changes.\n */\n setVisibility: function (visibility) {\n if (element.isVisible === visibility)\n return;\n element.isVisible = visibility;\n element.scheduleRender();\n },\n /**\n * Make a target animatable by Popmotion. For instance, if we're\n * trying to animate width from 100px to 100vw we need to measure 100vw\n * in pixels to determine what we really need to animate to. This is also\n * pluggable to support Framer's custom value types like Color,\n * and CSS variables.\n */\n makeTargetAnimatable: function (target, canMutate) {\n if (canMutate === void 0) { canMutate = true; }\n return makeTargetAnimatable(element, target, props, canMutate);\n },\n // Motion values ========================\n /**\n * Add a motion value and bind it to this visual element.\n */\n addValue: function (key, value) {\n // Remove existing value if it exists\n if (element.hasValue(key))\n element.removeValue(key);\n values.set(key, value);\n latestValues[key] = value.get();\n bindToMotionValue(key, value);\n },\n /**\n * Remove a motion value and unbind any active subscriptions.\n */\n removeValue: function (key) {\n var _a;\n values.delete(key);\n (_a = valueSubscriptions.get(key)) === null || _a === void 0 ? void 0 : _a();\n valueSubscriptions.delete(key);\n delete latestValues[key];\n removeValueFromRenderState(key, renderState);\n }, \n /**\n * Check whether we have a motion value for this key\n */\n hasValue: function (key) { return values.has(key); }, \n /**\n * Get a motion value for this key. If called with a default\n * value, we'll create one if none exists.\n */\n getValue: function (key, defaultValue) {\n var value = values.get(key);\n if (value === undefined && defaultValue !== undefined) {\n value = motionValue(defaultValue);\n element.addValue(key, value);\n }\n return value;\n }, \n /**\n * Iterate over our motion values.\n */\n forEachValue: function (callback) { return values.forEach(callback); }, \n /**\n * If we're trying to animate to a previously unencountered value,\n * we need to check for it in our state and as a last resort read it\n * directly from the instance (which might have performance implications).\n */\n readValue: function (key) { var _a; return (_a = latestValues[key]) !== null && _a !== void 0 ? _a : readValueFromInstance(instance, key, options); }, \n /**\n * Set the base target to later animate back to. This is currently\n * only hydrated on creation and when we first read a value.\n */\n setBaseTarget: function (key, value) {\n baseTarget[key] = value;\n },\n /**\n * Find the base target for a value thats been removed from all animation\n * props.\n */\n getBaseTarget: function (key) {\n if (getBaseTarget) {\n var target = getBaseTarget(props, key);\n if (target !== undefined && !isMotionValue(target))\n return target;\n }\n return baseTarget[key];\n } }, lifecycles), { \n /**\n * Build the renderer state based on the latest visual state.\n */\n build: function () {\n triggerBuild();\n return renderState;\n },\n /**\n * Schedule a render on the next animation frame.\n */\n scheduleRender: function () {\n sync.render(render, false, true);\n }, \n /**\n * Synchronously fire render. It's prefered that we batch renders but\n * in many circumstances, like layout measurement, we need to run this\n * synchronously. However in those instances other measures should be taken\n * to batch reads/writes.\n */\n syncRender: render, \n /**\n * Update the provided props. Ensure any newly-added motion values are\n * added to our map, old ones removed, and listeners updated.\n */\n setProps: function (newProps) {\n props = newProps;\n lifecycles.updatePropListeners(newProps);\n prevMotionValues = updateMotionValuesFromProps(element, scrapeMotionValuesFromProps(props), prevMotionValues);\n }, getProps: function () { return props; }, \n // Variants ==============================\n /**\n * Returns the variant definition with a given name.\n */\n getVariant: function (name) { var _a; return (_a = props.variants) === null || _a === void 0 ? void 0 : _a[name]; }, \n /**\n * Returns the defined default transition on this component.\n */\n getDefaultTransition: function () { return props.transition; }, \n /**\n * Used by child variant nodes to get the closest ancestor variant props.\n */\n getVariantContext: function (startAtParent) {\n if (startAtParent === void 0) { startAtParent = false; }\n if (startAtParent)\n return parent === null || parent === void 0 ? void 0 : parent.getVariantContext();\n if (!isControllingVariants) {\n var context_1 = (parent === null || parent === void 0 ? void 0 : parent.getVariantContext()) || {};\n if (props.initial !== undefined) {\n context_1.initial = props.initial;\n }\n return context_1;\n }\n var context = {};\n for (var i = 0; i < numVariantProps; i++) {\n var name_1 = variantProps[i];\n var prop = props[name_1];\n if (isVariantLabel(prop) || prop === false) {\n context[name_1] = prop;\n }\n }\n return context;\n },\n // Layout projection ==============================\n /**\n * Enable layout projection for this visual element. Won't actually\n * occur until we also have hydrated layout measurements.\n */\n enableLayoutProjection: function () {\n projection.isEnabled = true;\n element.layoutTree.add(element);\n },\n /**\n * Lock the projection target, for instance when dragging, so\n * nothing else can try and animate it.\n */\n lockProjectionTarget: function () {\n projection.isTargetLocked = true;\n },\n unlockProjectionTarget: function () {\n element.stopLayoutAnimation();\n projection.isTargetLocked = false;\n }, getLayoutState: function () { return layoutState; }, setCrossfader: function (newCrossfader) {\n crossfader = newCrossfader;\n }, isProjectionReady: function () {\n return projection.isEnabled &&\n projection.isHydrated &&\n layoutState.isHydrated;\n }, \n /**\n * Start a layout animation on a given axis.\n */\n startLayoutAnimation: function (axis, transition, isRelative) {\n if (isRelative === void 0) { isRelative = false; }\n var progress = element.getProjectionAnimationProgress()[axis];\n var _a = isRelative\n ? projection.relativeTarget[axis]\n : projection.target[axis], min = _a.min, max = _a.max;\n var length = max - min;\n progress.clearListeners();\n progress.set(min);\n progress.set(min); // Set twice to hard-reset velocity\n progress.onChange(function (v) {\n element.setProjectionTargetAxis(axis, v, v + length, isRelative);\n });\n return element.animateMotionValue(axis, progress, 0, transition);\n },\n /**\n * Stop layout animations.\n */\n stopLayoutAnimation: function () {\n eachAxis(function (axis) {\n return element.getProjectionAnimationProgress()[axis].stop();\n });\n },\n /**\n * Measure the current viewport box with or without transforms.\n * Only measures axis-aligned boxes, rotate and skew must be manually\n * removed with a re-render to work.\n */\n measureViewportBox: function (withTransform) {\n if (withTransform === void 0) { withTransform = true; }\n var viewportBox = measureViewportBox(instance, options);\n if (!withTransform)\n removeBoxTransforms(viewportBox, latestValues);\n return viewportBox;\n },\n /**\n * Get the motion values tracking the layout animations on each\n * axis. Lazy init if not already created.\n */\n getProjectionAnimationProgress: function () {\n projectionTargetProgress || (projectionTargetProgress = {\n x: motionValue(0),\n y: motionValue(0),\n });\n return projectionTargetProgress;\n },\n /**\n * Update the projection of a single axis. Schedule an update to\n * the tree layout projection.\n */\n setProjectionTargetAxis: function (axis, min, max, isRelative) {\n if (isRelative === void 0) { isRelative = false; }\n var target;\n if (isRelative) {\n if (!projection.relativeTarget) {\n projection.relativeTarget = axisBox();\n }\n target = projection.relativeTarget[axis];\n }\n else {\n projection.relativeTarget = undefined;\n target = projection.target[axis];\n }\n projection.isHydrated = true;\n target.min = min;\n target.max = max;\n // Flag that we want to fire the onViewportBoxUpdate event handler\n hasViewportBoxUpdated = true;\n lifecycles.notifySetAxisTarget();\n },\n /**\n * Rebase the projection target on top of the provided viewport box\n * or the measured layout. This ensures that non-animating elements\n * don't fall out of sync differences in measurements vs projections\n * after a page scroll or other relayout.\n */\n rebaseProjectionTarget: function (force, box) {\n if (box === void 0) { box = layoutState.layout; }\n var _a = element.getProjectionAnimationProgress(), x = _a.x, y = _a.y;\n var shouldRebase = !projection.relativeTarget &&\n !projection.isTargetLocked &&\n !x.isAnimating() &&\n !y.isAnimating();\n if (force || shouldRebase) {\n eachAxis(function (axis) {\n var _a = box[axis], min = _a.min, max = _a.max;\n element.setProjectionTargetAxis(axis, min, max);\n });\n }\n },\n /**\n * Notify the visual element that its layout is up-to-date.\n * Currently Animate.tsx uses this to check whether a layout animation\n * needs to be performed.\n */\n notifyLayoutReady: function (config) {\n setCurrentViewportBox(element);\n element.notifyLayoutUpdate(layoutState.layout, element.prevViewportBox || layoutState.layout, config);\n }, \n /**\n * Temporarily reset the transform of the instance.\n */\n resetTransform: function () { return resetTransform(element, instance, props); }, restoreTransform: function () { return restoreTransform(instance, renderState); }, updateLayoutProjection: updateLayoutProjection,\n updateTreeLayoutProjection: function () {\n element.layoutTree.forEach(fireResolveRelativeTargetBox);\n /**\n * Schedule the projection updates at the end of the current preRender\n * step. This will ensure that all layout trees will first resolve\n * relative projection boxes into viewport boxes, and *then*\n * update projections.\n */\n sync.preRender(updateTreeLayoutProjection, false, true);\n // sync.postRender(() => element.scheduleUpdateLayoutProjection())\n },\n getProjectionParent: function () {\n if (projectionParent === undefined) {\n var foundParent = false;\n // Search backwards through the tree path\n for (var i = element.path.length - 1; i >= 0; i--) {\n var ancestor = element.path[i];\n if (ancestor.projection.isEnabled) {\n foundParent = ancestor;\n break;\n }\n }\n projectionParent = foundParent;\n }\n return projectionParent;\n },\n resolveRelativeTargetBox: function () {\n var relativeParent = element.getProjectionParent();\n if (!projection.relativeTarget || !relativeParent)\n return;\n calcRelativeBox(projection, relativeParent.projection);\n if (isDraggable(relativeParent)) {\n var target = projection.target;\n applyBoxTransforms(target, target, relativeParent.getLatestValues());\n }\n },\n shouldResetTransform: function () {\n return Boolean(props._layoutResetTransform);\n },\n /**\n *\n */\n pointTo: function (newLead) {\n leadProjection = newLead.projection;\n leadLatestValues = newLead.getLatestValues();\n /**\n * Subscribe to lead component's layout animations\n */\n unsubscribeFromLeadVisualElement === null || unsubscribeFromLeadVisualElement === void 0 ? void 0 : unsubscribeFromLeadVisualElement();\n unsubscribeFromLeadVisualElement = pipe(newLead.onSetAxisTarget(element.scheduleUpdateLayoutProjection), newLead.onLayoutAnimationComplete(function () {\n var _a;\n if (element.isPresent) {\n element.presence = Presence.Present;\n }\n else {\n (_a = element.layoutSafeToRemove) === null || _a === void 0 ? void 0 : _a.call(element);\n }\n }));\n }, \n // TODO: Clean this up\n isPresent: true, presence: Presence.Entering });\n return element;\n };\n};\nfunction fireResolveRelativeTargetBox(child) {\n child.resolveRelativeTargetBox();\n}\nfunction fireUpdateLayoutProjection(child) {\n child.updateLayoutProjection();\n}\nvar variantProps = __spreadArray([\"initial\"], __read(variantPriorityOrder));\nvar numVariantProps = variantProps.length;\n\nexport { visualElement };\n","import { motionValue } from '../../value/index.js';\nimport { isMotionValue } from '../../value/utils/is-motion-value.js';\n\nfunction updateMotionValuesFromProps(element, next, prev) {\n var _a;\n for (var key in next) {\n var nextValue = next[key];\n var prevValue = prev[key];\n if (isMotionValue(nextValue)) {\n /**\n * If this is a motion value found in props or style, we want to add it\n * to our visual element's motion value map.\n */\n element.addValue(key, nextValue);\n }\n else if (isMotionValue(prevValue)) {\n /**\n * If we're swapping to a new motion value, create a new motion value\n * from that\n */\n element.addValue(key, motionValue(nextValue));\n }\n else if (prevValue !== nextValue) {\n /**\n * If this is a flat value that has changed, update the motion value\n * or create one if it doesn't exist. We only want to do this if we're\n * not handling the value with our animation state.\n */\n if (element.hasValue(key)) {\n var existingValue = element.getValue(key);\n // TODO: Only update values that aren't being animated or even looked at\n !existingValue.hasAnimated && existingValue.set(nextValue);\n }\n else {\n element.addValue(key, motionValue((_a = element.getStaticValue(key)) !== null && _a !== void 0 ? _a : nextValue));\n }\n }\n }\n // Handle removed values\n for (var key in prev) {\n if (next[key] === undefined)\n element.removeValue(key);\n }\n return next;\n}\n\nexport { updateMotionValuesFromProps };\n","import { calcRelativeOffset } from '../../../motion/features/layout/utils.js';\nimport { eachAxis } from '../../../utils/each-axis.js';\n\nfunction setCurrentViewportBox(visualElement) {\n var projectionParent = visualElement.getProjectionParent();\n if (!projectionParent) {\n visualElement.rebaseProjectionTarget();\n return;\n }\n var relativeOffset = calcRelativeOffset(projectionParent.getLayoutState().layout, visualElement.getLayoutState().layout);\n eachAxis(function (axis) {\n visualElement.setProjectionTargetAxis(axis, relativeOffset[axis].min, relativeOffset[axis].max, true);\n });\n}\n\nexport { setCurrentViewportBox };\n","import { resetBox, applyTreeDeltas } from '../../utils/geometry/delta-apply.js';\nimport { updateBoxDelta } from '../../utils/geometry/delta-calc.js';\n\nfunction updateLayoutDeltas(_a, _b, treePath, transformOrigin) {\n var delta = _a.delta, layout = _a.layout, layoutCorrected = _a.layoutCorrected, treeScale = _a.treeScale;\n var target = _b.target;\n /**\n * Reset the corrected box with the latest values from box, as we're then going\n * to perform mutative operations on it.\n */\n resetBox(layoutCorrected, layout);\n /**\n * Apply all the parent deltas to this box to produce the corrected box. This\n * is the layout box, as it will appear on screen as a result of the transforms of its parents.\n */\n applyTreeDeltas(layoutCorrected, treeScale, treePath);\n /**\n * Update the delta between the corrected box and the target box before user-set transforms were applied.\n * This will allow us to calculate the corrected borderRadius and boxShadow to compensate\n * for our layout reprojection, but still allow them to be scaled correctly by the user.\n * It might be that to simplify this we may want to accept that user-set scale is also corrected\n * and we wouldn't have to keep and calc both deltas, OR we could support a user setting\n * to allow people to choose whether these styles are corrected based on just the\n * layout reprojection or the final bounding box.\n */\n updateBoxDelta(delta, layoutCorrected, target, transformOrigin);\n}\n\nexport { updateLayoutDeltas };\n","import { __assign, __read } from 'tslib';\nimport { number, px } from 'style-value-types';\nimport { isKeyframesTarget } from '../../../animation/utils/is-keyframes-target.js';\nimport { invariant } from 'hey-listen';\nimport { transformProps } from '../../html/utils/transform.js';\nimport { findDimensionValueType } from '../value-types/dimensions.js';\n\nvar positionalKeys = new Set([\n \"width\",\n \"height\",\n \"top\",\n \"left\",\n \"right\",\n \"bottom\",\n \"x\",\n \"y\",\n]);\nvar isPositionalKey = function (key) { return positionalKeys.has(key); };\nvar hasPositionalKey = function (target) {\n return Object.keys(target).some(isPositionalKey);\n};\nvar setAndResetVelocity = function (value, to) {\n // Looks odd but setting it twice doesn't render, it'll just\n // set both prev and current to the latest value\n value.set(to, false);\n value.set(to);\n};\nvar isNumOrPxType = function (v) {\n return v === number || v === px;\n};\nvar BoundingBoxDimension;\n(function (BoundingBoxDimension) {\n BoundingBoxDimension[\"width\"] = \"width\";\n BoundingBoxDimension[\"height\"] = \"height\";\n BoundingBoxDimension[\"left\"] = \"left\";\n BoundingBoxDimension[\"right\"] = \"right\";\n BoundingBoxDimension[\"top\"] = \"top\";\n BoundingBoxDimension[\"bottom\"] = \"bottom\";\n})(BoundingBoxDimension || (BoundingBoxDimension = {}));\nvar getPosFromMatrix = function (matrix, pos) {\n return parseFloat(matrix.split(\", \")[pos]);\n};\nvar getTranslateFromMatrix = function (pos2, pos3) { return function (_bbox, _a) {\n var transform = _a.transform;\n if (transform === \"none\" || !transform)\n return 0;\n var matrix3d = transform.match(/^matrix3d\\((.+)\\)$/);\n if (matrix3d) {\n return getPosFromMatrix(matrix3d[1], pos3);\n }\n else {\n var matrix = transform.match(/^matrix\\((.+)\\)$/);\n if (matrix) {\n return getPosFromMatrix(matrix[1], pos2);\n }\n else {\n return 0;\n }\n }\n}; };\nvar transformKeys = new Set([\"x\", \"y\", \"z\"]);\nvar nonTranslationalTransformKeys = transformProps.filter(function (key) { return !transformKeys.has(key); });\nfunction removeNonTranslationalTransform(visualElement) {\n var removedTransforms = [];\n nonTranslationalTransformKeys.forEach(function (key) {\n var value = visualElement.getValue(key);\n if (value !== undefined) {\n removedTransforms.push([key, value.get()]);\n value.set(key.startsWith(\"scale\") ? 1 : 0);\n }\n });\n // Apply changes to element before measurement\n if (removedTransforms.length)\n visualElement.syncRender();\n return removedTransforms;\n}\nvar positionalValues = {\n // Dimensions\n width: function (_a) {\n var x = _a.x;\n return x.max - x.min;\n },\n height: function (_a) {\n var y = _a.y;\n return y.max - y.min;\n },\n top: function (_bbox, _a) {\n var top = _a.top;\n return parseFloat(top);\n },\n left: function (_bbox, _a) {\n var left = _a.left;\n return parseFloat(left);\n },\n bottom: function (_a, _b) {\n var y = _a.y;\n var top = _b.top;\n return parseFloat(top) + (y.max - y.min);\n },\n right: function (_a, _b) {\n var x = _a.x;\n var left = _b.left;\n return parseFloat(left) + (x.max - x.min);\n },\n // Transform\n x: getTranslateFromMatrix(4, 13),\n y: getTranslateFromMatrix(5, 14),\n};\nvar convertChangedValueTypes = function (target, visualElement, changedKeys) {\n var originBbox = visualElement.measureViewportBox();\n var element = visualElement.getInstance();\n var elementComputedStyle = getComputedStyle(element);\n var display = elementComputedStyle.display, top = elementComputedStyle.top, left = elementComputedStyle.left, bottom = elementComputedStyle.bottom, right = elementComputedStyle.right, transform = elementComputedStyle.transform;\n var originComputedStyle = { top: top, left: left, bottom: bottom, right: right, transform: transform };\n // If the element is currently set to display: \"none\", make it visible before\n // measuring the target bounding box\n if (display === \"none\") {\n visualElement.setStaticValue(\"display\", target.display || \"block\");\n }\n // Apply the latest values (as set in checkAndConvertChangedValueTypes)\n visualElement.syncRender();\n var targetBbox = visualElement.measureViewportBox();\n changedKeys.forEach(function (key) {\n // Restore styles to their **calculated computed style**, not their actual\n // originally set style. This allows us to animate between equivalent pixel units.\n var value = visualElement.getValue(key);\n setAndResetVelocity(value, positionalValues[key](originBbox, originComputedStyle));\n target[key] = positionalValues[key](targetBbox, elementComputedStyle);\n });\n return target;\n};\nvar checkAndConvertChangedValueTypes = function (visualElement, target, origin, transitionEnd) {\n if (origin === void 0) { origin = {}; }\n if (transitionEnd === void 0) { transitionEnd = {}; }\n target = __assign({}, target);\n transitionEnd = __assign({}, transitionEnd);\n var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);\n // We want to remove any transform values that could affect the element's bounding box before\n // it's measured. We'll reapply these later.\n var removedTransformValues = [];\n var hasAttemptedToRemoveTransformValues = false;\n var changedValueTypeKeys = [];\n targetPositionalKeys.forEach(function (key) {\n var value = visualElement.getValue(key);\n if (!visualElement.hasValue(key))\n return;\n var from = origin[key];\n var to = target[key];\n var fromType = findDimensionValueType(from);\n var toType;\n // TODO: The current implementation of this basically throws an error\n // if you try and do value conversion via keyframes. There's probably\n // a way of doing this but the performance implications would need greater scrutiny,\n // as it'd be doing multiple resize-remeasure operations.\n if (isKeyframesTarget(to)) {\n var numKeyframes = to.length;\n for (var i = to[0] === null ? 1 : 0; i < numKeyframes; i++) {\n if (!toType) {\n toType = findDimensionValueType(to[i]);\n invariant(toType === fromType ||\n (isNumOrPxType(fromType) && isNumOrPxType(toType)), \"Keyframes must be of the same dimension as the current value\");\n }\n else {\n invariant(findDimensionValueType(to[i]) === toType, \"All keyframes must be of the same type\");\n }\n }\n }\n else {\n toType = findDimensionValueType(to);\n }\n if (fromType !== toType) {\n // If they're both just number or px, convert them both to numbers rather than\n // relying on resize/remeasure to convert (which is wasteful in this situation)\n if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {\n var current = value.get();\n if (typeof current === \"string\") {\n value.set(parseFloat(current));\n }\n if (typeof to === \"string\") {\n target[key] = parseFloat(to);\n }\n else if (Array.isArray(to) && toType === px) {\n target[key] = to.map(parseFloat);\n }\n }\n else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) &&\n (toType === null || toType === void 0 ? void 0 : toType.transform) &&\n (from === 0 || to === 0)) {\n // If one or the other value is 0, it's safe to coerce it to the\n // type of the other without measurement\n if (from === 0) {\n value.set(toType.transform(from));\n }\n else {\n target[key] = fromType.transform(to);\n }\n }\n else {\n // If we're going to do value conversion via DOM measurements, we first\n // need to remove non-positional transform values that could affect the bbox measurements.\n if (!hasAttemptedToRemoveTransformValues) {\n removedTransformValues = removeNonTranslationalTransform(visualElement);\n hasAttemptedToRemoveTransformValues = true;\n }\n changedValueTypeKeys.push(key);\n transitionEnd[key] =\n transitionEnd[key] !== undefined\n ? transitionEnd[key]\n : target[key];\n setAndResetVelocity(value, to);\n }\n }\n });\n if (changedValueTypeKeys.length) {\n var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);\n // If we removed transform values, reapply them before the next render\n if (removedTransformValues.length) {\n removedTransformValues.forEach(function (_a) {\n var _b = __read(_a, 2), key = _b[0], value = _b[1];\n visualElement.getValue(key).set(value);\n });\n }\n // Reapply original values\n visualElement.syncRender();\n return { target: convertedTarget, transitionEnd: transitionEnd };\n }\n else {\n return { target: target, transitionEnd: transitionEnd };\n }\n};\n/**\n * Convert value types for x/y/width/height/top/left/bottom/right\n *\n * Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`\n *\n * @internal\n */\nfunction unitConversion(visualElement, target, origin, transitionEnd) {\n return hasPositionalKey(target)\n ? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)\n : { target: target, transitionEnd: transitionEnd };\n}\n\nexport { BoundingBoxDimension, unitConversion };\n","import { resolveCSSVariables } from './css-variables-conversion.js';\nimport { unitConversion } from './unit-conversion.js';\n\n/**\n * Parse a DOM variant to make it animatable. This involves resolving CSS variables\n * and ensuring animations like \"20%\" => \"calc(50vw)\" are performed in pixels.\n */\nvar parseDomVariant = function (visualElement, target, origin, transitionEnd) {\n var resolved = resolveCSSVariables(visualElement, target, transitionEnd);\n target = resolved.target;\n transitionEnd = resolved.transitionEnd;\n return unitConversion(visualElement, target, origin, transitionEnd);\n};\n\nexport { parseDomVariant };\n","import { __rest, __assign } from 'tslib';\nimport { visualElement } from '../index.js';\nimport { getOrigin, checkTargetForNewValues } from '../utils/setters.js';\nimport { getBoundingBox } from '../dom/projection/measure.js';\nimport { buildHTMLStyles } from './utils/build-styles.js';\nimport { isCSSVariable } from '../dom/utils/is-css-variable.js';\nimport { parseDomVariant } from '../dom/utils/parse-dom-variant.js';\nimport { isTransformProp } from './utils/transform.js';\nimport { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.js';\nimport { renderHTML } from './utils/render.js';\nimport { getDefaultValueType } from '../dom/value-types/defaults.js';\nimport { buildLayoutProjectionTransformOrigin, buildLayoutProjectionTransform } from './utils/build-projection-transform.js';\n\nfunction getComputedStyle(element) {\n return window.getComputedStyle(element);\n}\nvar htmlConfig = {\n treeType: \"dom\",\n readValueFromInstance: function (domElement, key) {\n if (isTransformProp(key)) {\n var defaultType = getDefaultValueType(key);\n return defaultType ? defaultType.default || 0 : 0;\n }\n else {\n var computedStyle = getComputedStyle(domElement);\n return ((isCSSVariable(key)\n ? computedStyle.getPropertyValue(key)\n : computedStyle[key]) || 0);\n }\n },\n sortNodePosition: function (a, b) {\n /**\n * compareDocumentPosition returns a bitmask, by using the bitwise &\n * we're returning true if 2 in that bitmask is set to true. 2 is set\n * to true if b preceeds a.\n */\n return a.compareDocumentPosition(b) & 2 ? 1 : -1;\n },\n getBaseTarget: function (props, key) {\n var _a;\n return (_a = props.style) === null || _a === void 0 ? void 0 : _a[key];\n },\n measureViewportBox: function (element, _a) {\n var transformPagePoint = _a.transformPagePoint;\n return getBoundingBox(element, transformPagePoint);\n },\n /**\n * Reset the transform on the current Element. This is called as part\n * of a batched process across the entire layout tree. To remove this write\n * cycle it'd be interesting to see if it's possible to \"undo\" all the current\n * layout transforms up the tree in the same way this.getBoundingBoxWithoutTransforms\n * works\n */\n resetTransform: function (element, domElement, props) {\n var transformTemplate = props.transformTemplate;\n domElement.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n // Ensure that whatever happens next, we restore our transform on the next frame\n element.scheduleRender();\n },\n restoreTransform: function (instance, mutableState) {\n instance.style.transform = mutableState.style.transform;\n },\n removeValueFromRenderState: function (key, _a) {\n var vars = _a.vars, style = _a.style;\n delete vars[key];\n delete style[key];\n },\n /**\n * Ensure that HTML and Framer-specific value types like `px`->`%` and `Color`\n * can be animated by Motion.\n */\n makeTargetAnimatable: function (element, _a, _b, isMounted) {\n var transformValues = _b.transformValues;\n if (isMounted === void 0) { isMounted = true; }\n var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, [\"transition\", \"transitionEnd\"]);\n var origin = getOrigin(target, transition || {}, element);\n /**\n * If Framer has provided a function to convert `Color` etc value types, convert them\n */\n if (transformValues) {\n if (transitionEnd)\n transitionEnd = transformValues(transitionEnd);\n if (target)\n target = transformValues(target);\n if (origin)\n origin = transformValues(origin);\n }\n if (isMounted) {\n checkTargetForNewValues(element, target, origin);\n var parsed = parseDomVariant(element, target, origin, transitionEnd);\n transitionEnd = parsed.transitionEnd;\n target = parsed.target;\n }\n return __assign({ transition: transition,\n transitionEnd: transitionEnd }, target);\n },\n scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,\n build: function (element, renderState, latestValues, projection, layoutState, options, props) {\n if (element.isVisible !== undefined) {\n renderState.style.visibility = element.isVisible\n ? \"visible\"\n : \"hidden\";\n }\n var isProjectionTranform = projection.isEnabled && layoutState.isHydrated;\n buildHTMLStyles(renderState, latestValues, projection, layoutState, options, props.transformTemplate, isProjectionTranform ? buildLayoutProjectionTransform : undefined, isProjectionTranform\n ? buildLayoutProjectionTransformOrigin\n : undefined);\n },\n render: renderHTML,\n};\nvar htmlVisualElement = visualElement(htmlConfig);\n\nexport { getComputedStyle, htmlConfig, htmlVisualElement };\n","/**\n * Check if value is a numerical string, ie a string that is purely a number eg \"100\" or \"-100.1\"\n */\nvar isNumericalString = function (v) { return /^\\-?\\d*\\.?\\d+$/.test(v); };\n\nexport { isNumericalString };\n","import { __assign } from 'tslib';\nimport { visualElement } from '../index.js';\nimport { scrapeMotionValuesFromProps } from './utils/scrape-motion-values.js';\nimport { htmlConfig } from '../html/visual-element.js';\nimport { buildSVGAttrs } from './utils/build-attrs.js';\nimport { camelToDash } from '../dom/utils/camel-to-dash.js';\nimport { camelCaseAttributes } from './utils/camel-case-attrs.js';\nimport { isTransformProp } from '../html/utils/transform.js';\nimport { renderSVG } from './utils/render.js';\nimport { getDefaultValueType } from '../dom/value-types/defaults.js';\nimport { buildLayoutProjectionTransformOrigin, buildLayoutProjectionTransform } from '../html/utils/build-projection-transform.js';\n\nvar svgVisualElement = visualElement(__assign(__assign({}, htmlConfig), { getBaseTarget: function (props, key) {\n return props[key];\n },\n readValueFromInstance: function (domElement, key) {\n var _a;\n if (isTransformProp(key)) {\n return ((_a = getDefaultValueType(key)) === null || _a === void 0 ? void 0 : _a.default) || 0;\n }\n key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;\n return domElement.getAttribute(key);\n },\n scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,\n build: function (_element, renderState, latestValues, projection, layoutState, options, props) {\n var isProjectionTranform = projection.isEnabled && layoutState.isHydrated;\n buildSVGAttrs(renderState, latestValues, projection, layoutState, options, props.transformTemplate, isProjectionTranform ? buildLayoutProjectionTransform : undefined, isProjectionTranform\n ? buildLayoutProjectionTransformOrigin\n : undefined);\n }, render: renderSVG }));\n\nexport { svgVisualElement };\n","import { __assign } from 'tslib';\nimport { animations } from '../../motion/features/animations.js';\nimport { gestureAnimations } from '../../motion/features/gestures.js';\nimport { createDomVisualElement } from './create-visual-element.js';\n\n/**\n * @public\n */\nvar domAnimation = __assign(__assign({ renderer: createDomVisualElement }, animations), gestureAnimations);\n\nexport { domAnimation };\n","import { htmlVisualElement } from '../html/visual-element.js';\nimport { svgVisualElement } from '../svg/visual-element.js';\nimport { isSVGComponent } from './utils/is-svg-component.js';\n\nvar createDomVisualElement = function (Component, options) {\n return isSVGComponent(Component)\n ? svgVisualElement(options, { enableHardwareAcceleration: false })\n : htmlVisualElement(options, { enableHardwareAcceleration: true });\n};\n\nexport { createDomVisualElement };\n","import { useEffect } from 'react';\n\nfunction useUnmountEffect(callback) {\n return useEffect(function () { return function () { return callback(); }; }, []);\n}\n\nexport { useUnmountEffect };\n","import sync, { getFrameData } from 'framesync';\nimport { velocityPerSecond } from 'popmotion';\nimport { SubscriptionManager } from '../utils/subscription-manager.js';\n\nvar isFloat = function (value) {\n return !isNaN(parseFloat(value));\n};\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nvar MotionValue = /** @class */ (function () {\n /**\n * @param init - The initiating value\n * @param config - Optional configuration options\n *\n * - `transformer`: A function to transform incoming values with.\n *\n * @internal\n */\n function MotionValue(init) {\n var _this = this;\n /**\n * Duration, in milliseconds, since last updating frame.\n *\n * @internal\n */\n this.timeDelta = 0;\n /**\n * Timestamp of the last time this `MotionValue` was updated.\n *\n * @internal\n */\n this.lastUpdated = 0;\n /**\n * Functions to notify when the `MotionValue` updates.\n *\n * @internal\n */\n this.updateSubscribers = new SubscriptionManager();\n /**\n * Functions to notify when the velocity updates.\n *\n * @internal\n */\n this.velocityUpdateSubscribers = new SubscriptionManager();\n /**\n * Functions to notify when the `MotionValue` updates and `render` is set to `true`.\n *\n * @internal\n */\n this.renderSubscribers = new SubscriptionManager();\n /**\n * Tracks whether this value can output a velocity. Currently this is only true\n * if the value is numerical, but we might be able to widen the scope here and support\n * other value types.\n *\n * @internal\n */\n this.canTrackVelocity = false;\n this.updateAndNotify = function (v, render) {\n if (render === void 0) { render = true; }\n _this.prev = _this.current;\n _this.current = v;\n // Update timestamp\n var _a = getFrameData(), delta = _a.delta, timestamp = _a.timestamp;\n if (_this.lastUpdated !== timestamp) {\n _this.timeDelta = delta;\n _this.lastUpdated = timestamp;\n sync.postRender(_this.scheduleVelocityCheck);\n }\n // Update update subscribers\n if (_this.prev !== _this.current) {\n _this.updateSubscribers.notify(_this.current);\n }\n // Update velocity subscribers\n if (_this.velocityUpdateSubscribers.getSize()) {\n _this.velocityUpdateSubscribers.notify(_this.getVelocity());\n }\n // Update render subscribers\n if (render) {\n _this.renderSubscribers.notify(_this.current);\n }\n };\n /**\n * Schedule a velocity check for the next frame.\n *\n * This is an instanced and bound function to prevent generating a new\n * function once per frame.\n *\n * @internal\n */\n this.scheduleVelocityCheck = function () { return sync.postRender(_this.velocityCheck); };\n /**\n * Updates `prev` with `current` if the value hasn't been updated this frame.\n * This ensures velocity calculations return `0`.\n *\n * This is an instanced and bound function to prevent generating a new\n * function once per frame.\n *\n * @internal\n */\n this.velocityCheck = function (_a) {\n var timestamp = _a.timestamp;\n if (timestamp !== _this.lastUpdated) {\n _this.prev = _this.current;\n _this.velocityUpdateSubscribers.notify(_this.getVelocity());\n }\n };\n this.hasAnimated = false;\n this.prev = this.current = init;\n this.canTrackVelocity = isFloat(this.current);\n }\n /**\n * Adds a function that will be notified when the `MotionValue` is updated.\n *\n * It returns a function that, when called, will cancel the subscription.\n *\n * When calling `onChange` inside a React component, it should be wrapped with the\n * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n * from the `useEffect` function to ensure you don't add duplicate subscribers..\n *\n * @library\n *\n * ```jsx\n * function MyComponent() {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.onChange(updateOpacity)\n * const unsubscribeY = y.onChange(updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return \n * }\n * ```\n *\n * @motion\n *\n * ```jsx\n * export const MyComponent = () => {\n * const x = useMotionValue(0)\n * const y = useMotionValue(0)\n * const opacity = useMotionValue(1)\n *\n * useEffect(() => {\n * function updateOpacity() {\n * const maxXY = Math.max(x.get(), y.get())\n * const newOpacity = transform(maxXY, [0, 100], [1, 0])\n * opacity.set(newOpacity)\n * }\n *\n * const unsubscribeX = x.onChange(updateOpacity)\n * const unsubscribeY = y.onChange(updateOpacity)\n *\n * return () => {\n * unsubscribeX()\n * unsubscribeY()\n * }\n * }, [])\n *\n * return \n * }\n * ```\n *\n * @internalremarks\n *\n * We could look into a `useOnChange` hook if the above lifecycle management proves confusing.\n *\n * ```jsx\n * useOnChange(x, () => {})\n * ```\n *\n * @param subscriber - A function that receives the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @public\n */\n MotionValue.prototype.onChange = function (subscription) {\n return this.updateSubscribers.add(subscription);\n };\n MotionValue.prototype.clearListeners = function () {\n this.updateSubscribers.clear();\n };\n /**\n * Adds a function that will be notified when the `MotionValue` requests a render.\n *\n * @param subscriber - A function that's provided the latest value.\n * @returns A function that, when called, will cancel this subscription.\n *\n * @internal\n */\n MotionValue.prototype.onRenderRequest = function (subscription) {\n // Render immediately\n subscription(this.get());\n return this.renderSubscribers.add(subscription);\n };\n /**\n * Attaches a passive effect to the `MotionValue`.\n *\n * @internal\n */\n MotionValue.prototype.attach = function (passiveEffect) {\n this.passiveEffect = passiveEffect;\n };\n /**\n * Sets the state of the `MotionValue`.\n *\n * @remarks\n *\n * ```jsx\n * const x = useMotionValue(0)\n * x.set(10)\n * ```\n *\n * @param latest - Latest value to set.\n * @param render - Whether to notify render subscribers. Defaults to `true`\n *\n * @public\n */\n MotionValue.prototype.set = function (v, render) {\n if (render === void 0) { render = true; }\n if (!render || !this.passiveEffect) {\n this.updateAndNotify(v, render);\n }\n else {\n this.passiveEffect(v, this.updateAndNotify);\n }\n };\n /**\n * Returns the latest state of `MotionValue`\n *\n * @returns - The latest state of `MotionValue`\n *\n * @public\n */\n MotionValue.prototype.get = function () {\n return this.current;\n };\n /**\n * @public\n */\n MotionValue.prototype.getPrevious = function () {\n return this.prev;\n };\n /**\n * Returns the latest velocity of `MotionValue`\n *\n * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n *\n * @public\n */\n MotionValue.prototype.getVelocity = function () {\n // This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful\n return this.canTrackVelocity\n ? // These casts could be avoided if parseFloat would be typed better\n velocityPerSecond(parseFloat(this.current) -\n parseFloat(this.prev), this.timeDelta)\n : 0;\n };\n /**\n * Registers a new animation to control this `MotionValue`. Only one\n * animation can drive a `MotionValue` at one time.\n *\n * ```jsx\n * value.start()\n * ```\n *\n * @param animation - A function that starts the provided animation\n *\n * @internal\n */\n MotionValue.prototype.start = function (animation) {\n var _this = this;\n this.stop();\n return new Promise(function (resolve) {\n _this.hasAnimated = true;\n _this.stopAnimation = animation(resolve);\n }).then(function () { return _this.clearAnimation(); });\n };\n /**\n * Stop the currently active animation.\n *\n * @public\n */\n MotionValue.prototype.stop = function () {\n if (this.stopAnimation)\n this.stopAnimation();\n this.clearAnimation();\n };\n /**\n * Returns `true` if this value is currently animating.\n *\n * @public\n */\n MotionValue.prototype.isAnimating = function () {\n return !!this.stopAnimation;\n };\n MotionValue.prototype.clearAnimation = function () {\n this.stopAnimation = null;\n };\n /**\n * Destroy and clean up subscribers to this `MotionValue`.\n *\n * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n * created a `MotionValue` via the `motionValue` function.\n *\n * @public\n */\n MotionValue.prototype.destroy = function () {\n this.updateSubscribers.clear();\n this.renderSubscribers.clear();\n this.stop();\n };\n return MotionValue;\n}());\n/**\n * @internal\n */\nfunction motionValue(init) {\n return new MotionValue(init);\n}\n\nexport { MotionValue, motionValue };\n","var makeRenderlessComponent = function (hook) { return function (props) {\n hook(props);\n return null;\n}; };\n\nexport { makeRenderlessComponent };\n","import { __read } from 'tslib';\nimport { mix } from 'popmotion';\nimport { isDraggable } from '../../render/utils/is-draggable.js';\n\n/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction resetAxis(axis, originAxis) {\n axis.min = originAxis.min;\n axis.max = originAxis.max;\n}\n/**\n * Reset a box to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction resetBox(box, originBox) {\n resetAxis(box.x, originBox.x);\n resetAxis(box.y, originBox.y);\n}\n/**\n * Scales a point based on a factor and an originPoint\n */\nfunction scalePoint(point, scale, originPoint) {\n var distanceFromOrigin = point - originPoint;\n var scaled = scale * distanceFromOrigin;\n return originPoint + scaled;\n}\n/**\n * Applies a translate/scale delta to a point\n */\nfunction applyPointDelta(point, translate, scale, originPoint, boxScale) {\n if (boxScale !== undefined) {\n point = scalePoint(point, boxScale, originPoint);\n }\n return scalePoint(point, scale, originPoint) + translate;\n}\n/**\n * Applies a translate/scale delta to an axis\n */\nfunction applyAxisDelta(axis, translate, scale, originPoint, boxScale) {\n if (translate === void 0) { translate = 0; }\n if (scale === void 0) { scale = 1; }\n axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);\n axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Applies a translate/scale delta to a box\n */\nfunction applyBoxDelta(box, _a) {\n var x = _a.x, y = _a.y;\n applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);\n applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);\n}\n/**\n * Apply a transform to an axis from the latest resolved motion values.\n * This function basically acts as a bridge between a flat motion value map\n * and applyAxisDelta\n */\nfunction applyAxisTransforms(final, axis, transforms, _a) {\n var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];\n // Copy the current axis to the final axis before mutation\n final.min = axis.min;\n final.max = axis.max;\n var axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;\n var originPoint = mix(axis.min, axis.max, axisOrigin);\n // Apply the axis delta to the final axis\n applyAxisDelta(final, transforms[key], transforms[scaleKey], originPoint, transforms.scale);\n}\n/**\n * The names of the motion values we want to apply as translation, scale and origin.\n */\nvar xKeys = [\"x\", \"scaleX\", \"originX\"];\nvar yKeys = [\"y\", \"scaleY\", \"originY\"];\n/**\n * Apply a transform to a box from the latest resolved motion values.\n */\nfunction applyBoxTransforms(finalBox, box, transforms) {\n applyAxisTransforms(finalBox.x, box.x, transforms, xKeys);\n applyAxisTransforms(finalBox.y, box.y, transforms, yKeys);\n}\n/**\n * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse\n */\nfunction removePointDelta(point, translate, scale, originPoint, boxScale) {\n point -= translate;\n point = scalePoint(point, 1 / scale, originPoint);\n if (boxScale !== undefined) {\n point = scalePoint(point, 1 / boxScale, originPoint);\n }\n return point;\n}\n/**\n * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse\n */\nfunction removeAxisDelta(axis, translate, scale, origin, boxScale) {\n if (translate === void 0) { translate = 0; }\n if (scale === void 0) { scale = 1; }\n if (origin === void 0) { origin = 0.5; }\n var originPoint = mix(axis.min, axis.max, origin) - translate;\n axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);\n axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);\n}\n/**\n * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeAxisTransforms(axis, transforms, _a) {\n var _b = __read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];\n removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale);\n}\n/**\n * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse\n * and acts as a bridge between motion values and removeAxisDelta\n */\nfunction removeBoxTransforms(box, transforms) {\n removeAxisTransforms(box.x, transforms, xKeys);\n removeAxisTransforms(box.y, transforms, yKeys);\n}\n/**\n * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms\n * in a tree upon our box before then calculating how to project it into our desired viewport-relative box\n *\n * This is the final nested loop within updateLayoutDelta for future refactoring\n */\nfunction applyTreeDeltas(box, treeScale, treePath) {\n var treeLength = treePath.length;\n if (!treeLength)\n return;\n // Reset the treeScale\n treeScale.x = treeScale.y = 1;\n var node;\n var delta;\n for (var i = 0; i < treeLength; i++) {\n node = treePath[i];\n delta = node.getLayoutState().delta;\n // Incoporate each ancestor's scale into a culmulative treeScale for this component\n treeScale.x *= delta.x.scale;\n treeScale.y *= delta.y.scale;\n // Apply each ancestor's calculated delta into this component's recorded layout box\n applyBoxDelta(box, delta);\n // If this is a draggable ancestor, also incorporate the node's transform to the layout box\n if (isDraggable(node)) {\n applyBoxTransforms(box, box, node.getLatestValues());\n }\n }\n}\n\nexport { applyAxisDelta, applyAxisTransforms, applyBoxDelta, applyBoxTransforms, applyPointDelta, applyTreeDeltas, removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta, resetAxis, resetBox, scalePoint };\n","import { warning } from 'hey-listen';\nimport { clamp } from '../../utils/clamp.js';\n\nvar safeMin = 0.001;\nvar minDuration = 0.01;\nvar maxDuration = 10.0;\nvar minDamping = 0.05;\nvar maxDamping = 1;\nfunction findSpring(_a) {\n var _b = _a.duration, duration = _b === void 0 ? 800 : _b, _c = _a.bounce, bounce = _c === void 0 ? 0.25 : _c, _d = _a.velocity, velocity = _d === void 0 ? 0 : _d, _e = _a.mass, mass = _e === void 0 ? 1 : _e;\n var envelope;\n var derivative;\n warning(duration <= maxDuration * 1000, \"Spring duration must be 10 seconds or less\");\n var dampingRatio = 1 - bounce;\n dampingRatio = clamp(minDamping, maxDamping, dampingRatio);\n duration = clamp(minDuration, maxDuration, duration / 1000);\n if (dampingRatio < 1) {\n envelope = function (undampedFreq) {\n var exponentialDecay = undampedFreq * dampingRatio;\n var delta = exponentialDecay * duration;\n var a = exponentialDecay - velocity;\n var b = calcAngularFreq(undampedFreq, dampingRatio);\n var c = Math.exp(-delta);\n return safeMin - (a / b) * c;\n };\n derivative = function (undampedFreq) {\n var exponentialDecay = undampedFreq * dampingRatio;\n var delta = exponentialDecay * duration;\n var d = delta * velocity + velocity;\n var e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;\n var f = Math.exp(-delta);\n var g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);\n var factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;\n return (factor * ((d - e) * f)) / g;\n };\n }\n else {\n envelope = function (undampedFreq) {\n var a = Math.exp(-undampedFreq * duration);\n var b = (undampedFreq - velocity) * duration + 1;\n return -safeMin + a * b;\n };\n derivative = function (undampedFreq) {\n var a = Math.exp(-undampedFreq * duration);\n var b = (velocity - undampedFreq) * (duration * duration);\n return a * b;\n };\n }\n var initialGuess = 5 / duration;\n var undampedFreq = approximateRoot(envelope, derivative, initialGuess);\n duration = duration * 1000;\n if (isNaN(undampedFreq)) {\n return {\n stiffness: 100,\n damping: 10,\n duration: duration,\n };\n }\n else {\n var stiffness = Math.pow(undampedFreq, 2) * mass;\n return {\n stiffness: stiffness,\n damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),\n duration: duration,\n };\n }\n}\nvar rootIterations = 12;\nfunction approximateRoot(envelope, derivative, initialGuess) {\n var result = initialGuess;\n for (var i = 1; i < rootIterations; i++) {\n result = result - envelope(result) / derivative(result);\n }\n return result;\n}\nfunction calcAngularFreq(undampedFreq, dampingRatio) {\n return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);\n}\n\nexport { calcAngularFreq, findSpring, maxDamping, maxDuration, minDamping, minDuration };\n","import { __rest, __assign } from 'tslib';\nimport { findSpring, calcAngularFreq } from '../utils/find-spring.js';\n\nvar durationKeys = [\"duration\", \"bounce\"];\nvar physicsKeys = [\"stiffness\", \"damping\", \"mass\"];\nfunction isSpringType(options, keys) {\n return keys.some(function (key) { return options[key] !== undefined; });\n}\nfunction getSpringOptions(options) {\n var springOptions = __assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);\n if (!isSpringType(options, physicsKeys) &&\n isSpringType(options, durationKeys)) {\n var derived = findSpring(options);\n springOptions = __assign(__assign(__assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });\n springOptions.isResolvedFromDuration = true;\n }\n return springOptions;\n}\nfunction spring(_a) {\n var _b = _a.from, from = _b === void 0 ? 0.0 : _b, _c = _a.to, to = _c === void 0 ? 1.0 : _c, _d = _a.restSpeed, restSpeed = _d === void 0 ? 2 : _d, restDelta = _a.restDelta, options = __rest(_a, [\"from\", \"to\", \"restSpeed\", \"restDelta\"]);\n var state = { done: false, value: from };\n var _e = getSpringOptions(options), stiffness = _e.stiffness, damping = _e.damping, mass = _e.mass, velocity = _e.velocity, duration = _e.duration, isResolvedFromDuration = _e.isResolvedFromDuration;\n var resolveSpring = zero;\n var resolveVelocity = zero;\n function createSpring() {\n var initialVelocity = velocity ? -(velocity / 1000) : 0.0;\n var initialDelta = to - from;\n var dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n var undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;\n restDelta !== null && restDelta !== void 0 ? restDelta : (restDelta = Math.abs(to - from) <= 1 ? 0.01 : 0.4);\n if (dampingRatio < 1) {\n var angularFreq_1 = calcAngularFreq(undampedAngularFreq, dampingRatio);\n resolveSpring = function (t) {\n var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (to -\n envelope *\n (((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n angularFreq_1) *\n Math.sin(angularFreq_1 * t) +\n initialDelta * Math.cos(angularFreq_1 * t)));\n };\n resolveVelocity = function (t) {\n var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (dampingRatio *\n undampedAngularFreq *\n envelope *\n ((Math.sin(angularFreq_1 * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta)) /\n angularFreq_1 +\n initialDelta * Math.cos(angularFreq_1 * t)) -\n envelope *\n (Math.cos(angularFreq_1 * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta) -\n angularFreq_1 *\n initialDelta *\n Math.sin(angularFreq_1 * t)));\n };\n }\n else if (dampingRatio === 1) {\n resolveSpring = function (t) {\n return to -\n Math.exp(-undampedAngularFreq * t) *\n (initialDelta +\n (initialVelocity + undampedAngularFreq * initialDelta) *\n t);\n };\n }\n else {\n var dampedAngularFreq_1 = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n resolveSpring = function (t) {\n var envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n var freqForT = Math.min(dampedAngularFreq_1 * t, 300);\n return (to -\n (envelope *\n ((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) *\n Math.sinh(freqForT) +\n dampedAngularFreq_1 *\n initialDelta *\n Math.cosh(freqForT))) /\n dampedAngularFreq_1);\n };\n }\n }\n createSpring();\n return {\n next: function (t) {\n var current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n var currentVelocity = resolveVelocity(t) * 1000;\n var isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;\n var isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;\n state.done =\n isBelowVelocityThreshold && isBelowDisplacementThreshold;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? to : current;\n return state;\n },\n flipTarget: function () {\n var _a;\n velocity = -velocity;\n _a = [to, from], from = _a[0], to = _a[1];\n createSpring();\n },\n };\n}\nspring.needsInterpolation = function (a, b) {\n return typeof a === \"string\" || typeof b === \"string\";\n};\nvar zero = function (_t) { return 0; };\n\nexport { spring };\n","import { __spreadArray, __assign } from 'tslib';\nimport { complex, color } from 'style-value-types';\nimport { mix } from './mix.js';\nimport { mixColor } from './mix-color.js';\nimport { isNum } from './inc.js';\nimport { pipe } from './pipe.js';\nimport { invariant } from 'hey-listen';\n\nfunction getMixer(origin, target) {\n if (isNum(origin)) {\n return function (v) { return mix(origin, target, v); };\n }\n else if (color.test(origin)) {\n return mixColor(origin, target);\n }\n else {\n return mixComplex(origin, target);\n }\n}\nvar mixArray = function (from, to) {\n var output = __spreadArray([], from);\n var numValues = output.length;\n var blendValue = from.map(function (fromThis, i) { return getMixer(fromThis, to[i]); });\n return function (v) {\n for (var i = 0; i < numValues; i++) {\n output[i] = blendValue[i](v);\n }\n return output;\n };\n};\nvar mixObject = function (origin, target) {\n var output = __assign(__assign({}, origin), target);\n var blendValue = {};\n for (var key in output) {\n if (origin[key] !== undefined && target[key] !== undefined) {\n blendValue[key] = getMixer(origin[key], target[key]);\n }\n }\n return function (v) {\n for (var key in blendValue) {\n output[key] = blendValue[key](v);\n }\n return output;\n };\n};\nfunction analyse(value) {\n var parsed = complex.parse(value);\n var numValues = parsed.length;\n var numNumbers = 0;\n var numRGB = 0;\n var numHSL = 0;\n for (var i = 0; i < numValues; i++) {\n if (numNumbers || typeof parsed[i] === \"number\") {\n numNumbers++;\n }\n else {\n if (parsed[i].hue !== undefined) {\n numHSL++;\n }\n else {\n numRGB++;\n }\n }\n }\n return { parsed: parsed, numNumbers: numNumbers, numRGB: numRGB, numHSL: numHSL };\n}\nvar mixComplex = function (origin, target) {\n var template = complex.createTransformer(target);\n var originStats = analyse(origin);\n var targetStats = analyse(target);\n invariant(originStats.numHSL === targetStats.numHSL &&\n originStats.numRGB === targetStats.numRGB &&\n originStats.numNumbers >= targetStats.numNumbers, \"Complex values '\" + origin + \"' and '\" + target + \"' too different to mix. Ensure all colors are of the same type.\");\n return pipe(mixArray(originStats.parsed, targetStats.parsed), template);\n};\n\nexport { mixArray, mixComplex, mixObject };\n","import { progress } from './progress.js';\nimport { mix } from './mix.js';\nimport { mixColor } from './mix-color.js';\nimport { mixComplex, mixArray, mixObject } from './mix-complex.js';\nimport { color } from 'style-value-types';\nimport { clamp } from './clamp.js';\nimport { pipe } from './pipe.js';\nimport { invariant } from 'hey-listen';\n\nvar mixNumber = function (from, to) { return function (p) { return mix(from, to, p); }; };\nfunction detectMixerFactory(v) {\n if (typeof v === 'number') {\n return mixNumber;\n }\n else if (typeof v === 'string') {\n if (color.test(v)) {\n return mixColor;\n }\n else {\n return mixComplex;\n }\n }\n else if (Array.isArray(v)) {\n return mixArray;\n }\n else if (typeof v === 'object') {\n return mixObject;\n }\n}\nfunction createMixers(output, ease, customMixer) {\n var mixers = [];\n var mixerFactory = customMixer || detectMixerFactory(output[0]);\n var numMixers = output.length - 1;\n for (var i = 0; i < numMixers; i++) {\n var mixer = mixerFactory(output[i], output[i + 1]);\n if (ease) {\n var easingFunction = Array.isArray(ease) ? ease[i] : ease;\n mixer = pipe(easingFunction, mixer);\n }\n mixers.push(mixer);\n }\n return mixers;\n}\nfunction fastInterpolate(_a, _b) {\n var from = _a[0], to = _a[1];\n var mixer = _b[0];\n return function (v) { return mixer(progress(from, to, v)); };\n}\nfunction slowInterpolate(input, mixers) {\n var inputLength = input.length;\n var lastInputIndex = inputLength - 1;\n return function (v) {\n var mixerIndex = 0;\n var foundMixerIndex = false;\n if (v <= input[0]) {\n foundMixerIndex = true;\n }\n else if (v >= input[lastInputIndex]) {\n mixerIndex = lastInputIndex - 1;\n foundMixerIndex = true;\n }\n if (!foundMixerIndex) {\n var i = 1;\n for (; i < inputLength; i++) {\n if (input[i] > v || i === lastInputIndex) {\n break;\n }\n }\n mixerIndex = i - 1;\n }\n var progressInRange = progress(input[mixerIndex], input[mixerIndex + 1], v);\n return mixers[mixerIndex](progressInRange);\n };\n}\nfunction interpolate(input, output, _a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.clamp, isClamp = _c === void 0 ? true : _c, ease = _b.ease, mixer = _b.mixer;\n var inputLength = input.length;\n invariant(inputLength === output.length, 'Both input and output ranges must be the same length');\n invariant(!ease || !Array.isArray(ease) || ease.length === inputLength - 1, 'Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values.');\n if (input[0] > input[inputLength - 1]) {\n input = [].concat(input);\n output = [].concat(output);\n input.reverse();\n output.reverse();\n }\n var mixers = createMixers(output, ease, mixer);\n var interpolator = inputLength === 2\n ? fastInterpolate(input, mixers)\n : slowInterpolate(input, mixers);\n return isClamp\n ? function (v) { return interpolator(clamp(input[0], input[inputLength - 1], v)); }\n : interpolator;\n}\n\nexport { interpolate };\n","import { interpolate } from '../../utils/interpolate.js';\nimport { easeInOut } from '../../easing/index.js';\n\nfunction defaultEasing(values, easing) {\n return values.map(function () { return easing || easeInOut; }).splice(0, values.length - 1);\n}\nfunction defaultOffset(values) {\n var numValues = values.length;\n return values.map(function (_value, i) {\n return i !== 0 ? i / (numValues - 1) : 0;\n });\n}\nfunction convertOffsetToTimes(offset, duration) {\n return offset.map(function (o) { return o * duration; });\n}\nfunction keyframes(_a) {\n var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.to, to = _c === void 0 ? 1 : _c, ease = _a.ease, offset = _a.offset, _d = _a.duration, duration = _d === void 0 ? 300 : _d;\n var state = { done: false, value: from };\n var values = Array.isArray(to) ? to : [from, to];\n var times = convertOffsetToTimes(offset && offset.length === values.length\n ? offset\n : defaultOffset(values), duration);\n function createInterpolator() {\n return interpolate(times, values, {\n ease: Array.isArray(ease) ? ease : defaultEasing(values, ease),\n });\n }\n var interpolator = createInterpolator();\n return {\n next: function (t) {\n state.value = interpolator(t);\n state.done = t >= duration;\n return state;\n },\n flipTarget: function () {\n values.reverse();\n interpolator = createInterpolator();\n },\n };\n}\n\nexport { convertOffsetToTimes, defaultEasing, defaultOffset, keyframes };\n","import { spring } from '../generators/spring.js';\nimport { keyframes } from '../generators/keyframes.js';\nimport { decay } from '../generators/decay.js';\n\nvar types = { keyframes: keyframes, spring: spring, decay: decay };\nfunction detectAnimationFromOptions(config) {\n if (Array.isArray(config.to)) {\n return keyframes;\n }\n else if (types[config.type]) {\n return types[config.type];\n }\n var keys = new Set(Object.keys(config));\n if (keys.has(\"ease\") ||\n (keys.has(\"duration\") && !keys.has(\"dampingRatio\"))) {\n return keyframes;\n }\n else if (keys.has(\"dampingRatio\") ||\n keys.has(\"stiffness\") ||\n keys.has(\"mass\") ||\n keys.has(\"damping\") ||\n keys.has(\"restSpeed\") ||\n keys.has(\"restDelta\")) {\n return spring;\n }\n return keyframes;\n}\n\nexport { detectAnimationFromOptions };\n","function decay(_a) {\n var _b = _a.velocity, velocity = _b === void 0 ? 0 : _b, _c = _a.from, from = _c === void 0 ? 0 : _c, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 350 : _e, _f = _a.restDelta, restDelta = _f === void 0 ? 0.5 : _f, modifyTarget = _a.modifyTarget;\n var state = { done: false, value: from };\n var amplitude = power * velocity;\n var ideal = from + amplitude;\n var target = modifyTarget === undefined ? ideal : modifyTarget(ideal);\n if (target !== ideal)\n amplitude = target - from;\n return {\n next: function (t) {\n var delta = -amplitude * Math.exp(-t / timeConstant);\n state.done = !(delta > restDelta || delta < -restDelta);\n state.value = state.done ? target : target + delta;\n return state;\n },\n flipTarget: function () { },\n };\n}\n\nexport { decay };\n","function loopElapsed(elapsed, duration, delay) {\n if (delay === void 0) { delay = 0; }\n return elapsed - duration - delay;\n}\nfunction reverseElapsed(elapsed, duration, delay, isForwardPlayback) {\n if (delay === void 0) { delay = 0; }\n if (isForwardPlayback === void 0) { isForwardPlayback = true; }\n return isForwardPlayback\n ? loopElapsed(duration + -elapsed, duration, delay)\n : duration - (elapsed - duration) + delay;\n}\nfunction hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {\n return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;\n}\n\nexport { hasRepeatDelayElapsed, loopElapsed, reverseElapsed };\n","import { __rest, __assign } from 'tslib';\nimport { detectAnimationFromOptions } from './utils/detect-animation-from-options.js';\nimport sync, { cancelSync } from 'framesync';\nimport { interpolate } from '../utils/interpolate.js';\nimport { hasRepeatDelayElapsed, reverseElapsed, loopElapsed } from './utils/elapsed.js';\n\nvar framesync = function (update) {\n var passTimestamp = function (_a) {\n var delta = _a.delta;\n return update(delta);\n };\n return {\n start: function () { return sync.update(passTimestamp, true); },\n stop: function () { return cancelSync.update(passTimestamp); },\n };\n};\nfunction animate(_a) {\n var _b, _c;\n var from = _a.from, _d = _a.autoplay, autoplay = _d === void 0 ? true : _d, _e = _a.driver, driver = _e === void 0 ? framesync : _e, _f = _a.elapsed, elapsed = _f === void 0 ? 0 : _f, _g = _a.repeat, repeatMax = _g === void 0 ? 0 : _g, _h = _a.repeatType, repeatType = _h === void 0 ? \"loop\" : _h, _j = _a.repeatDelay, repeatDelay = _j === void 0 ? 0 : _j, onPlay = _a.onPlay, onStop = _a.onStop, onComplete = _a.onComplete, onRepeat = _a.onRepeat, onUpdate = _a.onUpdate, options = __rest(_a, [\"from\", \"autoplay\", \"driver\", \"elapsed\", \"repeat\", \"repeatType\", \"repeatDelay\", \"onPlay\", \"onStop\", \"onComplete\", \"onRepeat\", \"onUpdate\"]);\n var to = options.to;\n var driverControls;\n var repeatCount = 0;\n var computedDuration = options.duration;\n var latest;\n var isComplete = false;\n var isForwardPlayback = true;\n var interpolateFromNumber;\n var animator = detectAnimationFromOptions(options);\n if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {\n interpolateFromNumber = interpolate([0, 100], [from, to], {\n clamp: false,\n });\n from = 0;\n to = 100;\n }\n var animation = animator(__assign(__assign({}, options), { from: from, to: to }));\n function repeat() {\n repeatCount++;\n if (repeatType === \"reverse\") {\n isForwardPlayback = repeatCount % 2 === 0;\n elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);\n }\n else {\n elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);\n if (repeatType === \"mirror\")\n animation.flipTarget();\n }\n isComplete = false;\n onRepeat && onRepeat();\n }\n function complete() {\n driverControls.stop();\n onComplete && onComplete();\n }\n function update(delta) {\n if (!isForwardPlayback)\n delta = -delta;\n elapsed += delta;\n if (!isComplete) {\n var state = animation.next(Math.max(0, elapsed));\n latest = state.value;\n if (interpolateFromNumber)\n latest = interpolateFromNumber(latest);\n isComplete = isForwardPlayback ? state.done : elapsed <= 0;\n }\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);\n if (isComplete) {\n if (repeatCount === 0)\n computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);\n if (repeatCount < repeatMax) {\n hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();\n }\n else {\n complete();\n }\n }\n }\n function play() {\n onPlay === null || onPlay === void 0 ? void 0 : onPlay();\n driverControls = driver(update);\n driverControls.start();\n }\n autoplay && play();\n return {\n stop: function () {\n onStop === null || onStop === void 0 ? void 0 : onStop();\n driverControls.stop();\n },\n };\n}\n\nexport { animate };\n","import { linear } from './index.js';\n\nvar a = function (a1, a2) { return 1.0 - 3.0 * a2 + 3.0 * a1; };\nvar b = function (a1, a2) { return 3.0 * a2 - 6.0 * a1; };\nvar c = function (a1) { return 3.0 * a1; };\nvar calcBezier = function (t, a1, a2) {\n return ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;\n};\nvar getSlope = function (t, a1, a2) {\n return 3.0 * a(a1, a2) * t * t + 2.0 * b(a1, a2) * t + c(a1);\n};\nvar subdivisionPrecision = 0.0000001;\nvar subdivisionMaxIterations = 10;\nfunction binarySubdivide(aX, aA, aB, mX1, mX2) {\n var currentX;\n var currentT;\n var i = 0;\n do {\n currentT = aA + (aB - aA) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - aX;\n if (currentX > 0.0) {\n aB = currentT;\n }\n else {\n aA = currentT;\n }\n } while (Math.abs(currentX) > subdivisionPrecision &&\n ++i < subdivisionMaxIterations);\n return currentT;\n}\nvar newtonIterations = 8;\nvar newtonMinSlope = 0.001;\nfunction newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\n for (var i = 0; i < newtonIterations; ++i) {\n var currentSlope = getSlope(aGuessT, mX1, mX2);\n if (currentSlope === 0.0) {\n return aGuessT;\n }\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n aGuessT -= currentX / currentSlope;\n }\n return aGuessT;\n}\nvar kSplineTableSize = 11;\nvar kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\nfunction cubicBezier(mX1, mY1, mX2, mY2) {\n if (mX1 === mY1 && mX2 === mY2)\n return linear;\n var sampleValues = new Float32Array(kSplineTableSize);\n for (var i = 0; i < kSplineTableSize; ++i) {\n sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n }\n function getTForX(aX) {\n var intervalStart = 0.0;\n var currentSample = 1;\n var lastSample = kSplineTableSize - 1;\n for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {\n intervalStart += kSampleStepSize;\n }\n --currentSample;\n var dist = (aX - sampleValues[currentSample]) /\n (sampleValues[currentSample + 1] - sampleValues[currentSample]);\n var guessForT = intervalStart + dist * kSampleStepSize;\n var initialSlope = getSlope(guessForT, mX1, mX2);\n if (initialSlope >= newtonMinSlope) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\n }\n else if (initialSlope === 0.0) {\n return guessForT;\n }\n else {\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\n }\n }\n return function (t) {\n return t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);\n };\n}\n\nexport { cubicBezier };\n","import { __read } from 'tslib';\nimport { invariant } from 'hey-listen';\nimport { cubicBezier, linear, easeIn, easeInOut, easeOut, circIn, circInOut, circOut, backIn, backInOut, backOut, anticipate, bounceIn, bounceInOut, bounceOut } from 'popmotion';\n\nvar easingLookup = {\n linear: linear,\n easeIn: easeIn,\n easeInOut: easeInOut,\n easeOut: easeOut,\n circIn: circIn,\n circInOut: circInOut,\n circOut: circOut,\n backIn: backIn,\n backInOut: backInOut,\n backOut: backOut,\n anticipate: anticipate,\n bounceIn: bounceIn,\n bounceInOut: bounceInOut,\n bounceOut: bounceOut,\n};\nvar easingDefinitionToFunction = function (definition) {\n if (Array.isArray(definition)) {\n // If cubic bezier definition, create bezier curve\n invariant(definition.length === 4, \"Cubic bezier arrays must contain four numerical values.\");\n var _a = __read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];\n return cubicBezier(x1, y1, x2, y2);\n }\n else if (typeof definition === \"string\") {\n // Else lookup from table\n invariant(easingLookup[definition] !== undefined, \"Invalid easing type '\" + definition + \"'\");\n return easingLookup[definition];\n }\n return definition;\n};\nvar isEasingArray = function (ease) {\n return Array.isArray(ease) && typeof ease[0] !== \"number\";\n};\n\nexport { easingDefinitionToFunction, isEasingArray };\n","import { complex } from 'style-value-types';\n\n/**\n * Check if a value is animatable. Examples:\n *\n * ✅: 100, \"100px\", \"#fff\"\n * ❌: \"block\", \"url(2.jpg)\"\n * @param value\n *\n * @internal\n */\nvar isAnimatable = function (key, value) {\n // If the list of keys tat might be non-animatable grows, replace with Set\n if (key === \"zIndex\")\n return false;\n // If it's a number or a keyframes array, we can animate it. We might at some point\n // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,\n // but for now lets leave it like this for performance reasons\n if (typeof value === \"number\" || Array.isArray(value))\n return true;\n if (typeof value === \"string\" && // It's animatable if we have a string\n complex.test(value) && // And it contains numbers and/or colors\n !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n ) {\n return true;\n }\n return false;\n};\n\nexport { isAnimatable };\n","import { __assign } from 'tslib';\nimport { isKeyframesTarget } from './is-keyframes-target.js';\n\nvar underDampedSpring = function () { return ({\n type: \"spring\",\n stiffness: 500,\n damping: 25,\n restDelta: 0.5,\n restSpeed: 10,\n}); };\nvar criticallyDampedSpring = function (to) { return ({\n type: \"spring\",\n stiffness: 550,\n damping: to === 0 ? 2 * Math.sqrt(550) : 30,\n restDelta: 0.01,\n restSpeed: 10,\n}); };\nvar linearTween = function () { return ({\n type: \"keyframes\",\n ease: \"linear\",\n duration: 0.3,\n}); };\nvar keyframes = function (values) { return ({\n type: \"keyframes\",\n duration: 0.8,\n values: values,\n}); };\nvar defaultTransitions = {\n x: underDampedSpring,\n y: underDampedSpring,\n z: underDampedSpring,\n rotate: underDampedSpring,\n rotateX: underDampedSpring,\n rotateY: underDampedSpring,\n rotateZ: underDampedSpring,\n scaleX: criticallyDampedSpring,\n scaleY: criticallyDampedSpring,\n scale: criticallyDampedSpring,\n opacity: linearTween,\n backgroundColor: linearTween,\n color: linearTween,\n default: criticallyDampedSpring,\n};\nvar getDefaultTransition = function (valueKey, to) {\n var transitionFactory;\n if (isKeyframesTarget(to)) {\n transitionFactory = keyframes;\n }\n else {\n transitionFactory =\n defaultTransitions[valueKey] || defaultTransitions.default;\n }\n return __assign({ to: to }, transitionFactory(to));\n};\n\nexport { criticallyDampedSpring, getDefaultTransition, linearTween, underDampedSpring };\n","import { __assign, __rest, __spreadArray, __read } from 'tslib';\nimport { inertia, animate } from 'popmotion';\nimport { secondsToMilliseconds } from '../../utils/time-conversion.js';\nimport { isEasingArray, easingDefinitionToFunction } from './easing.js';\nimport { isAnimatable } from './is-animatable.js';\nimport { getDefaultTransition } from './default-transitions.js';\nimport { warning } from 'hey-listen';\nimport { getAnimatableNone } from '../../render/dom/value-types/animatable-none.js';\n\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nfunction isTransitionDefined(_a) {\n _a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest(_a, [\"when\", \"delay\", \"delayChildren\", \"staggerChildren\", \"staggerDirection\", \"repeat\", \"repeatType\", \"repeatDelay\", \"from\"]);\n return !!Object.keys(transition).length;\n}\nvar legacyRepeatWarning = false;\n/**\n * Convert Framer Motion's Transition type into Popmotion-compatible options.\n */\nfunction convertTransitionToAnimationOptions(_a) {\n var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, [\"ease\", \"times\", \"yoyo\", \"flip\", \"loop\"]);\n var options = __assign({}, transition);\n if (times)\n options[\"offset\"] = times;\n /**\n * Convert any existing durations from seconds to milliseconds\n */\n if (transition.duration)\n options[\"duration\"] = secondsToMilliseconds(transition.duration);\n if (transition.repeatDelay)\n options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);\n /**\n * Map easing names to Popmotion's easing functions\n */\n if (ease) {\n options[\"ease\"] = isEasingArray(ease)\n ? ease.map(easingDefinitionToFunction)\n : easingDefinitionToFunction(ease);\n }\n /**\n * Support legacy transition API\n */\n if (transition.type === \"tween\")\n options.type = \"keyframes\";\n /**\n * TODO: These options are officially removed from the API.\n */\n if (yoyo || loop || flip) {\n warning(!legacyRepeatWarning, \"yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.\");\n legacyRepeatWarning = true;\n if (yoyo) {\n options.repeatType = \"reverse\";\n }\n else if (loop) {\n options.repeatType = \"loop\";\n }\n else if (flip) {\n options.repeatType = \"mirror\";\n }\n options.repeat = loop || yoyo || flip || transition.repeat;\n }\n /**\n * TODO: Popmotion 9 has the ability to automatically detect whether to use\n * a keyframes or spring animation, but does so by detecting velocity and other spring options.\n * It'd be good to introduce a similar thing here.\n */\n if (transition.type !== \"spring\")\n options.type = \"keyframes\";\n return options;\n}\n/**\n * Get the delay for a value by checking Transition with decreasing specificity.\n */\nfunction getDelayFromTransition(transition, key) {\n var _a;\n var valueTransition = getValueTransition(transition, key) || {};\n return (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : 0;\n}\nfunction hydrateKeyframes(options) {\n if (Array.isArray(options.to) && options.to[0] === null) {\n options.to = __spreadArray([], __read(options.to));\n options.to[0] = options.from;\n }\n return options;\n}\nfunction getPopmotionAnimationOptions(transition, options, key) {\n var _a;\n if (Array.isArray(options.to)) {\n (_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8);\n }\n hydrateKeyframes(options);\n /**\n * Get a default transition if none is determined to be defined.\n */\n if (!isTransitionDefined(transition)) {\n transition = __assign(__assign({}, transition), getDefaultTransition(key, options.to));\n }\n return __assign(__assign({}, options), convertTransitionToAnimationOptions(transition));\n}\n/**\n *\n */\nfunction getAnimation(key, value, target, transition, onComplete) {\n var _a;\n var valueTransition = getValueTransition(transition, key);\n var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();\n var isTargetAnimatable = isAnimatable(key, target);\n if (origin === \"none\" && isTargetAnimatable && typeof target === \"string\") {\n /**\n * If we're trying to animate from \"none\", try and get an animatable version\n * of the target. This could be improved to work both ways.\n */\n origin = getAnimatableNone(key, target);\n }\n else if (isZero(origin) && typeof target === \"string\") {\n origin = getZeroUnit(target);\n }\n else if (!Array.isArray(target) &&\n isZero(target) &&\n typeof origin === \"string\") {\n target = getZeroUnit(origin);\n }\n var isOriginAnimatable = isAnimatable(key, origin);\n warning(isOriginAnimatable === isTargetAnimatable, \"You are trying to animate \" + key + \" from \\\"\" + origin + \"\\\" to \\\"\" + target + \"\\\". \" + origin + \" is not an animatable value - to enable this animation set \" + origin + \" to a value animatable to \" + target + \" via the `style` property.\");\n function start() {\n var options = {\n from: origin,\n to: target,\n velocity: value.getVelocity(),\n onComplete: onComplete,\n onUpdate: function (v) { return value.set(v); },\n };\n return valueTransition.type === \"inertia\" ||\n valueTransition.type === \"decay\"\n ? inertia(__assign(__assign({}, options), valueTransition))\n : animate(__assign(__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) {\n var _a;\n options.onUpdate(v);\n (_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);\n }, onComplete: function () {\n var _a;\n options.onComplete();\n (_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);\n } }));\n }\n function set() {\n var _a;\n value.set(target);\n onComplete();\n (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);\n return { stop: function () { } };\n }\n return !isOriginAnimatable ||\n !isTargetAnimatable ||\n valueTransition.type === false\n ? set\n : start;\n}\nfunction isZero(value) {\n return (value === 0 ||\n (typeof value === \"string\" &&\n parseFloat(value) === 0 &&\n value.indexOf(\" \") === -1));\n}\nfunction getZeroUnit(potentialUnitType) {\n return typeof potentialUnitType === \"number\"\n ? 0\n : getAnimatableNone(\"\", potentialUnitType);\n}\nfunction getValueTransition(transition, key) {\n return transition[key] || transition[\"default\"] || transition;\n}\n/**\n * Start animation on a MotionValue. This function is an interface between\n * Framer Motion and Popmotion\n *\n * @internal\n */\nfunction startAnimation(key, value, target, transition) {\n if (transition === void 0) { transition = {}; }\n return value.start(function (onComplete) {\n var delayTimer;\n var controls;\n var animation = getAnimation(key, value, target, transition, onComplete);\n var delay = getDelayFromTransition(transition, key);\n var start = function () { return (controls = animation()); };\n if (delay) {\n delayTimer = setTimeout(start, secondsToMilliseconds(delay));\n }\n else {\n start();\n }\n return function () {\n clearTimeout(delayTimer);\n controls === null || controls === void 0 ? void 0 : controls.stop();\n };\n });\n}\n\nexport { convertTransitionToAnimationOptions, getDelayFromTransition, getPopmotionAnimationOptions, getValueTransition, getZeroUnit, hydrateKeyframes, isTransitionDefined, isZero, startAnimation };\n","import { __assign } from 'tslib';\nimport { animate } from './index.js';\nimport { velocityPerSecond } from '../utils/velocity-per-second.js';\nimport { getFrameData } from 'framesync';\n\nfunction inertia(_a) {\n var _b = _a.from, from = _b === void 0 ? 0 : _b, _c = _a.velocity, velocity = _c === void 0 ? 0 : _c, min = _a.min, max = _a.max, _d = _a.power, power = _d === void 0 ? 0.8 : _d, _e = _a.timeConstant, timeConstant = _e === void 0 ? 750 : _e, _f = _a.bounceStiffness, bounceStiffness = _f === void 0 ? 500 : _f, _g = _a.bounceDamping, bounceDamping = _g === void 0 ? 10 : _g, _h = _a.restDelta, restDelta = _h === void 0 ? 1 : _h, modifyTarget = _a.modifyTarget, driver = _a.driver, onUpdate = _a.onUpdate, onComplete = _a.onComplete;\n var currentAnimation;\n function isOutOfBounds(v) {\n return (min !== undefined && v < min) || (max !== undefined && v > max);\n }\n function boundaryNearest(v) {\n if (min === undefined)\n return max;\n if (max === undefined)\n return min;\n return Math.abs(min - v) < Math.abs(max - v) ? min : max;\n }\n function startAnimation(options) {\n currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop();\n currentAnimation = animate(__assign(__assign({}, options), { driver: driver, onUpdate: function (v) {\n var _a;\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(v);\n (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, v);\n }, onComplete: onComplete }));\n }\n function startSpring(options) {\n startAnimation(__assign({ type: \"spring\", stiffness: bounceStiffness, damping: bounceDamping, restDelta: restDelta }, options));\n }\n if (isOutOfBounds(from)) {\n startSpring({ from: from, velocity: velocity, to: boundaryNearest(from) });\n }\n else {\n var target = power * velocity + from;\n if (typeof modifyTarget !== \"undefined\")\n target = modifyTarget(target);\n var boundary_1 = boundaryNearest(target);\n var heading_1 = boundary_1 === min ? -1 : 1;\n var prev_1;\n var current_1;\n var checkBoundary = function (v) {\n prev_1 = current_1;\n current_1 = v;\n velocity = velocityPerSecond(v - prev_1, getFrameData().delta);\n if ((heading_1 === 1 && v > boundary_1) ||\n (heading_1 === -1 && v < boundary_1)) {\n startSpring({ from: v, to: boundary_1, velocity: velocity });\n }\n };\n startAnimation({\n type: \"decay\",\n from: from,\n velocity: velocity,\n timeConstant: timeConstant,\n power: power,\n restDelta: restDelta,\n modifyTarget: modifyTarget,\n onUpdate: isOutOfBounds(target) ? checkBoundary : undefined,\n });\n }\n return {\n stop: function () { return currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop(); },\n };\n}\n\nexport { inertia };\n","import { isString, singleColorRegex, floatRegex } from '../utils.js';\n\nvar isColorString = function (type, testProp) { return function (v) {\n return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||\n (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));\n}; };\nvar splitColor = function (aName, bName, cName) { return function (v) {\n var _a;\n if (!isString(v))\n return v;\n var _b = v.match(floatRegex), a = _b[0], b = _b[1], c = _b[2], alpha = _b[3];\n return _a = {},\n _a[aName] = parseFloat(a),\n _a[bName] = parseFloat(b),\n _a[cName] = parseFloat(c),\n _a.alpha = alpha !== undefined ? parseFloat(alpha) : 1,\n _a;\n}; };\n\nexport { isColorString, splitColor };\n","import { useEffect } from 'react';\n\nfunction addDomEvent(target, eventName, handler, options) {\n target.addEventListener(eventName, handler, options);\n return function () { return target.removeEventListener(eventName, handler, options); };\n}\n/**\n * Attaches an event listener directly to the provided DOM element.\n *\n * Bypassing React's event system can be desirable, for instance when attaching non-passive\n * event handlers.\n *\n * ```jsx\n * const ref = useRef(null)\n *\n * useDomEvent(ref, 'wheel', onWheel, { passive: false })\n *\n * return
\n * ```\n *\n * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.\n * @param eventName - Name of the event you want listen for.\n * @param handler - Function to fire when receiving the event.\n * @param options - Options to pass to `Event.addEventListener`.\n *\n * @public\n */\nfunction useDomEvent(ref, eventName, handler, options) {\n useEffect(function () {\n var element = ref.current;\n if (handler && element) {\n return addDomEvent(element, eventName, handler, options);\n }\n }, [ref, eventName, handler, options]);\n}\n\nexport { addDomEvent, useDomEvent };\n","import { __assign } from 'tslib';\nimport { number, alpha } from '../numbers/index.js';\nimport { sanitize, clamp } from '../utils.js';\nimport { isColorString, splitColor } from './utils.js';\n\nvar clampRgbUnit = clamp(0, 255);\nvar rgbUnit = __assign(__assign({}, number), { transform: function (v) { return Math.round(clampRgbUnit(v)); } });\nvar rgba = {\n test: isColorString('rgb', 'red'),\n parse: splitColor('red', 'green', 'blue'),\n transform: function (_a) {\n var red = _a.red, green = _a.green, blue = _a.blue, _b = _a.alpha, alpha$1 = _b === void 0 ? 1 : _b;\n return 'rgba(' +\n rgbUnit.transform(red) +\n ', ' +\n rgbUnit.transform(green) +\n ', ' +\n rgbUnit.transform(blue) +\n ', ' +\n sanitize(alpha.transform(alpha$1)) +\n ')';\n },\n};\n\nexport { rgbUnit, rgba };\n","import { mix, distance, clamp, progress } from 'popmotion';\n\nvar clampProgress = function (v) { return clamp(0, 1, v); };\n/**\n * Returns true if the provided value is within maxDistance of the provided target\n */\nfunction isNear(value, target, maxDistance) {\n if (target === void 0) { target = 0; }\n if (maxDistance === void 0) { maxDistance = 0.01; }\n return distance(value, target) < maxDistance;\n}\nfunction calcLength(axis) {\n return axis.max - axis.min;\n}\n/**\n * Calculate a transform origin relative to the source axis, between 0-1, that results\n * in an asthetically pleasing scale/transform needed to project from source to target.\n */\nfunction calcOrigin(source, target) {\n var origin = 0.5;\n var sourceLength = calcLength(source);\n var targetLength = calcLength(target);\n if (targetLength > sourceLength) {\n origin = progress(target.min, target.max - sourceLength, source.min);\n }\n else if (sourceLength > targetLength) {\n origin = progress(source.min, source.max - targetLength, target.min);\n }\n return clampProgress(origin);\n}\n/**\n * Update the AxisDelta with a transform that projects source into target.\n *\n * The transform `origin` is optional. If not provided, it'll be automatically\n * calculated based on the relative positions of the two bounding boxes.\n */\nfunction updateAxisDelta(delta, source, target, origin) {\n if (origin === void 0) { origin = 0.5; }\n delta.origin = origin;\n delta.originPoint = mix(source.min, source.max, delta.origin);\n delta.scale = calcLength(target) / calcLength(source);\n if (isNear(delta.scale, 1, 0.0001))\n delta.scale = 1;\n delta.translate =\n mix(target.min, target.max, delta.origin) - delta.originPoint;\n if (isNear(delta.translate))\n delta.translate = 0;\n}\n/**\n * Update the BoxDelta with a transform that projects the source into the target.\n *\n * The transform `origin` is optional. If not provided, it'll be automatically\n * calculated based on the relative positions of the two bounding boxes.\n */\nfunction updateBoxDelta(delta, source, target, origin) {\n updateAxisDelta(delta.x, source.x, target.x, defaultOrigin(origin.originX));\n updateAxisDelta(delta.y, source.y, target.y, defaultOrigin(origin.originY));\n}\n/**\n * Currently this only accepts numerical origins, measured as 0-1, but could\n * accept pixel values by comparing to the target axis.\n */\nfunction defaultOrigin(origin) {\n return typeof origin === \"number\" ? origin : 0.5;\n}\nfunction calcRelativeAxis(target, relative, parent) {\n target.min = parent.min + relative.min;\n target.max = target.min + calcLength(relative);\n}\nfunction calcRelativeBox(projection, parentProjection) {\n calcRelativeAxis(projection.target.x, projection.relativeTarget.x, parentProjection.target.x);\n calcRelativeAxis(projection.target.y, projection.relativeTarget.y, parentProjection.target.y);\n}\n\nexport { calcOrigin, calcRelativeAxis, calcRelativeBox, isNear, updateAxisDelta, updateBoxDelta };\n","import { isTouchEvent } from '../gestures/utils/event-type.js';\n\n/**\n * Filters out events not attached to the primary pointer (currently left mouse button)\n * @param eventHandler\n */\nfunction filterPrimaryPointer(eventHandler) {\n return function (event) {\n var isMouseEvent = event instanceof MouseEvent;\n var isPrimaryPointer = !isMouseEvent ||\n (isMouseEvent && event.button === 0);\n if (isPrimaryPointer) {\n eventHandler(event);\n }\n };\n}\nvar defaultPagePoint = { pageX: 0, pageY: 0 };\nfunction pointFromTouch(e, pointType) {\n if (pointType === void 0) { pointType = \"page\"; }\n var primaryTouch = e.touches[0] || e.changedTouches[0];\n var point = primaryTouch || defaultPagePoint;\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"],\n };\n}\nfunction pointFromMouse(point, pointType) {\n if (pointType === void 0) { pointType = \"page\"; }\n return {\n x: point[pointType + \"X\"],\n y: point[pointType + \"Y\"],\n };\n}\nfunction extractEventInfo(event, pointType) {\n if (pointType === void 0) { pointType = \"page\"; }\n return {\n point: isTouchEvent(event)\n ? pointFromTouch(event, pointType)\n : pointFromMouse(event, pointType),\n };\n}\nfunction getViewportPointFromEvent(event) {\n return extractEventInfo(event, \"client\");\n}\nvar wrapHandler = function (handler, shouldFilterPrimaryPointer) {\n if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; }\n var listener = function (event) {\n return handler(event, extractEventInfo(event));\n };\n return shouldFilterPrimaryPointer\n ? filterPrimaryPointer(listener)\n : listener;\n};\n\nexport { extractEventInfo, getViewportPointFromEvent, wrapHandler };\n","function isMouseEvent(event) {\n // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.\n if (typeof PointerEvent !== \"undefined\" && event instanceof PointerEvent) {\n return !!(event.pointerType === \"mouse\");\n }\n return event instanceof MouseEvent;\n}\nfunction isTouchEvent(event) {\n var hasTouches = !!event.touches;\n return hasTouches;\n}\n\nexport { isMouseEvent, isTouchEvent };\n","import { alpha } from '../numbers/index.js';\nimport { percent } from '../numbers/units.js';\nimport { sanitize } from '../utils.js';\nimport { isColorString, splitColor } from './utils.js';\n\nvar hsla = {\n test: isColorString('hsl', 'hue'),\n parse: splitColor('hue', 'saturation', 'lightness'),\n transform: function (_a) {\n var hue = _a.hue, saturation = _a.saturation, lightness = _a.lightness, _b = _a.alpha, alpha$1 = _b === void 0 ? 1 : _b;\n return ('hsla(' +\n Math.round(hue) +\n ', ' +\n percent.transform(sanitize(saturation)) +\n ', ' +\n percent.transform(sanitize(lightness)) +\n ', ' +\n sanitize(alpha.transform(alpha$1)) +\n ')');\n },\n};\n\nexport { hsla };\n","import { __assign } from 'tslib';\nimport { color, filter } from 'style-value-types';\nimport { numberValueTypes } from './number.js';\n\n/**\n * A map of default value types for common values\n */\nvar defaultValueTypes = __assign(__assign({}, numberValueTypes), { \n // Color props\n color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color, \n // Border props\n borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });\n/**\n * Gets the default ValueType for the provided value key\n */\nvar getDefaultValueType = function (key) { return defaultValueTypes[key]; };\n\nexport { defaultValueTypes, getDefaultValueType };\n","function createLock(name) {\n var lock = null;\n return function () {\n var openLock = function () {\n lock = null;\n };\n if (lock === null) {\n lock = name;\n return openLock;\n }\n return false;\n };\n}\nvar globalHorizontalLock = createLock(\"dragHorizontal\");\nvar globalVerticalLock = createLock(\"dragVertical\");\nfunction getGlobalLock(drag) {\n var lock = false;\n if (drag === \"y\") {\n lock = globalVerticalLock();\n }\n else if (drag === \"x\") {\n lock = globalHorizontalLock();\n }\n else {\n var openHorizontal_1 = globalHorizontalLock();\n var openVertical_1 = globalVerticalLock();\n if (openHorizontal_1 && openVertical_1) {\n lock = function () {\n openHorizontal_1();\n openVertical_1();\n };\n }\n else {\n // Release the locks because we don't use them\n if (openHorizontal_1)\n openHorizontal_1();\n if (openVertical_1)\n openVertical_1();\n }\n }\n return lock;\n}\nfunction isDragActive() {\n // Check the gesture lock - if we get it, it means no drag gesture is active\n // and we can safely fire the tap gesture.\n var openGestureLock = getGlobalLock(true);\n if (!openGestureLock)\n return true;\n openGestureLock();\n return false;\n}\n\nexport { createLock, getGlobalLock, isDragActive };\n","import { addUniqueItem, removeItem } from './array.js';\n\nvar SubscriptionManager = /** @class */ (function () {\n function SubscriptionManager() {\n this.subscriptions = [];\n }\n SubscriptionManager.prototype.add = function (handler) {\n var _this = this;\n addUniqueItem(this.subscriptions, handler);\n return function () { return removeItem(_this.subscriptions, handler); };\n };\n SubscriptionManager.prototype.notify = function (a, b, c) {\n var numSubscriptions = this.subscriptions.length;\n if (!numSubscriptions)\n return;\n if (numSubscriptions === 1) {\n /**\n * If there's only a single handler we can just call it without invoking a loop.\n */\n this.subscriptions[0](a, b, c);\n }\n else {\n for (var i = 0; i < numSubscriptions; i++) {\n /**\n * Check whether the handler exists before firing as it's possible\n * the subscriptions were modified during this loop running.\n */\n var handler = this.subscriptions[i];\n handler && handler(a, b, c);\n }\n }\n };\n SubscriptionManager.prototype.getSize = function () {\n return this.subscriptions.length;\n };\n SubscriptionManager.prototype.clear = function () {\n this.subscriptions.length = 0;\n };\n return SubscriptionManager;\n}());\n\nexport { SubscriptionManager };\n","function addUniqueItem(arr, item) {\n arr.indexOf(item) === -1 && arr.push(item);\n}\nfunction removeItem(arr, item) {\n var index = arr.indexOf(item);\n index > -1 && arr.splice(index, 1);\n}\n\nexport { addUniqueItem, removeItem };\n","var clamp = function (min, max, v) {\n return Math.min(Math.max(v, min), max);\n};\n\nexport { clamp };\n","/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\nvar secondsToMilliseconds = function (seconds) { return seconds * 1000; };\n\nexport { secondsToMilliseconds };\n","var zeroPoint = {\n x: 0,\n y: 0,\n z: 0\n};\nvar isNum = function (v) { return typeof v === 'number'; };\n\nexport { isNum, zeroPoint };\n","var combineFunctions = function (a, b) { return function (v) { return b(a(v)); }; };\nvar pipe = function () {\n var transformers = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n transformers[_i] = arguments[_i];\n }\n return transformers.reduce(combineFunctions);\n};\n\nexport { pipe };\n","import { filter, complex } from 'style-value-types';\nimport { getDefaultValueType } from './defaults.js';\n\nfunction getAnimatableNone(key, value) {\n var _a;\n var defaultValueType = getDefaultValueType(key);\n if (defaultValueType !== filter)\n defaultValueType = complex;\n // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);\n}\n\nexport { getAnimatableNone };\n","var progress = function (from, to, value) {\n var toFromDifference = to - from;\n return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;\n};\n\nexport { progress };\n","function isDraggable(visualElement) {\n var _a = visualElement.getProps(), drag = _a.drag, _dragX = _a._dragX;\n return drag && !_dragX;\n}\n\nexport { isDraggable };\n","import { __assign } from 'tslib';\nimport { mix } from './mix.js';\nimport { hex, rgba, hsla } from 'style-value-types';\nimport { invariant } from 'hey-listen';\n\nvar mixLinearColor = function (from, to, v) {\n var fromExpo = from * from;\n var toExpo = to * to;\n return Math.sqrt(Math.max(0, v * (toExpo - fromExpo) + fromExpo));\n};\nvar colorTypes = [hex, rgba, hsla];\nvar getColorType = function (v) {\n return colorTypes.find(function (type) { return type.test(v); });\n};\nvar notAnimatable = function (color) {\n return \"'\" + color + \"' is not an animatable color. Use the equivalent color code instead.\";\n};\nvar mixColor = function (from, to) {\n var fromColorType = getColorType(from);\n var toColorType = getColorType(to);\n invariant(!!fromColorType, notAnimatable(from));\n invariant(!!toColorType, notAnimatable(to));\n invariant(fromColorType.transform === toColorType.transform, \"Both colors must be hex/RGBA, OR both must be HSLA.\");\n var fromColor = fromColorType.parse(from);\n var toColor = toColorType.parse(to);\n var blended = __assign({}, fromColor);\n var mixFunc = fromColorType === hsla ? mix : mixLinearColor;\n return function (v) {\n for (var key in blended) {\n if (key !== \"alpha\") {\n blended[key] = mixFunc(fromColor[key], toColor[key], v);\n }\n }\n blended.alpha = mix(fromColor.alpha, toColor.alpha, v);\n return fromColorType.transform(blended);\n };\n};\n\nexport { mixColor, mixLinearColor };\n","import { convertBoundingBoxToAxisBox, transformBoundingBox } from '../../../utils/geometry/index.js';\n\n/**\n * Measure and return the element bounding box.\n *\n * We convert the box into an AxisBox2D to make it easier to work with each axis\n * individually and programmatically.\n *\n * This function optionally accepts a transformPagePoint function which allows us to compensate\n * for, for instance, measuring the element within a scaled plane like a Framer devivce preview component.\n */\nfunction getBoundingBox(element, transformPagePoint) {\n var box = element.getBoundingClientRect();\n return convertBoundingBoxToAxisBox(transformBoundingBox(box, transformPagePoint));\n}\n\nexport { getBoundingBox };\n","import { __rest, __assign, __read } from 'tslib';\nimport { invariant } from 'hey-listen';\n\nfunction isCSSVariable(value) {\n return typeof value === \"string\" && value.startsWith(\"var(--\");\n}\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\nvar cssVariableRegex = /var\\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\\)/;\nfunction parseCSSVariable(current) {\n var match = cssVariableRegex.exec(current);\n if (!match)\n return [,];\n var _a = __read(match, 3), token = _a[1], fallback = _a[2];\n return [token, fallback];\n}\nvar maxDepth = 4;\nfunction getVariableValue(current, element, depth) {\n if (depth === void 0) { depth = 1; }\n invariant(depth <= maxDepth, \"Max CSS variable fallback depth detected in property \\\"\" + current + \"\\\". This may indicate a circular fallback dependency.\");\n var _a = __read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];\n // No CSS variable detected\n if (!token)\n return;\n // Attempt to read this CSS variable off the element\n var resolved = window.getComputedStyle(element).getPropertyValue(token);\n if (resolved) {\n return resolved.trim();\n }\n else if (isCSSVariable(fallback)) {\n // The fallback might itself be a CSS variable, in which case we attempt to resolve it too.\n return getVariableValue(fallback, element, depth + 1);\n }\n else {\n return fallback;\n }\n}\n/**\n * Resolve CSS variables from\n *\n * @internal\n */\nfunction resolveCSSVariables(visualElement, _a, transitionEnd) {\n var _b;\n var target = __rest(_a, []);\n var element = visualElement.getInstance();\n if (!(element instanceof HTMLElement))\n return { target: target, transitionEnd: transitionEnd };\n // If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`\n // only if they change but I think this reads clearer and this isn't a performance-critical path.\n if (transitionEnd) {\n transitionEnd = __assign({}, transitionEnd);\n }\n // Go through existing `MotionValue`s and ensure any existing CSS variables are resolved\n visualElement.forEachValue(function (value) {\n var current = value.get();\n if (!isCSSVariable(current))\n return;\n var resolved = getVariableValue(current, element);\n if (resolved)\n value.set(resolved);\n });\n // Cycle through every target property and resolve CSS variables. Currently\n // we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`\n for (var key in target) {\n var current = target[key];\n if (!isCSSVariable(current))\n continue;\n var resolved = getVariableValue(current, element);\n if (!resolved)\n continue;\n // Clone target if it hasn't already been\n target[key] = resolved;\n // If the user hasn't already set this key on `transitionEnd`, set it to the unresolved\n // CSS variable. This will ensure that after the animation the component will reflect\n // changes in the value of the CSS variable.\n if (transitionEnd)\n (_b = transitionEnd[key]) !== null && _b !== void 0 ? _b : (transitionEnd[key] = current);\n }\n return { target: target, transitionEnd: transitionEnd };\n}\n\nexport { cssVariableRegex, parseCSSVariable, resolveCSSVariables };\n","var reverseEasing = function (easing) { return function (p) { return 1 - easing(1 - p); }; };\nvar mirrorEasing = function (easing) { return function (p) {\n return p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;\n}; };\nvar createExpoIn = function (power) { return function (p) { return Math.pow(p, power); }; };\nvar createBackIn = function (power) { return function (p) {\n return p * p * ((power + 1) * p - power);\n}; };\nvar createAnticipate = function (power) {\n var backEasing = createBackIn(power);\n return function (p) {\n return (p *= 2) < 1\n ? 0.5 * backEasing(p)\n : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));\n };\n};\n\nexport { createAnticipate, createBackIn, createExpoIn, mirrorEasing, reverseEasing };\n","import { createExpoIn, reverseEasing, mirrorEasing, createBackIn, createAnticipate } from './utils.js';\n\nvar DEFAULT_OVERSHOOT_STRENGTH = 1.525;\nvar BOUNCE_FIRST_THRESHOLD = 4.0 / 11.0;\nvar BOUNCE_SECOND_THRESHOLD = 8.0 / 11.0;\nvar BOUNCE_THIRD_THRESHOLD = 9.0 / 10.0;\nvar linear = function (p) { return p; };\nvar easeIn = createExpoIn(2);\nvar easeOut = reverseEasing(easeIn);\nvar easeInOut = mirrorEasing(easeIn);\nvar circIn = function (p) { return 1 - Math.sin(Math.acos(p)); };\nvar circOut = reverseEasing(circIn);\nvar circInOut = mirrorEasing(circOut);\nvar backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);\nvar backOut = reverseEasing(backIn);\nvar backInOut = mirrorEasing(backIn);\nvar anticipate = createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);\nvar ca = 4356.0 / 361.0;\nvar cb = 35442.0 / 1805.0;\nvar cc = 16061.0 / 1805.0;\nvar bounceOut = function (p) {\n if (p === 1 || p === 0)\n return p;\n var p2 = p * p;\n return p < BOUNCE_FIRST_THRESHOLD\n ? 7.5625 * p2\n : p < BOUNCE_SECOND_THRESHOLD\n ? 9.075 * p2 - 9.9 * p + 3.4\n : p < BOUNCE_THIRD_THRESHOLD\n ? ca * p2 - cb * p + cc\n : 10.8 * p * p - 20.52 * p + 10.72;\n};\nvar bounceIn = reverseEasing(bounceOut);\nvar bounceInOut = function (p) {\n return p < 0.5\n ? 0.5 * (1.0 - bounceOut(1.0 - p * 2.0))\n : 0.5 * bounceOut(p * 2.0 - 1.0) + 0.5;\n};\n\nexport { anticipate, backIn, backInOut, backOut, bounceIn, bounceInOut, bounceOut, circIn, circInOut, circOut, easeIn, easeInOut, easeOut, linear };\n","import { rgba } from './rgba.js';\nimport { isColorString } from './utils.js';\n\nfunction parseHex(v) {\n var r = '';\n var g = '';\n var b = '';\n var a = '';\n if (v.length > 5) {\n r = v.substr(1, 2);\n g = v.substr(3, 2);\n b = v.substr(5, 2);\n a = v.substr(7, 2);\n }\n else {\n r = v.substr(1, 1);\n g = v.substr(2, 1);\n b = v.substr(3, 1);\n a = v.substr(4, 1);\n r += r;\n g += g;\n b += b;\n a += a;\n }\n return {\n red: parseInt(r, 16),\n green: parseInt(g, 16),\n blue: parseInt(b, 16),\n alpha: a ? parseInt(a, 16) / 255 : 1,\n };\n}\nvar hex = {\n test: isColorString('#'),\n parse: parseHex,\n transform: rgba.transform,\n};\n\nexport { hex };\n","function velocityPerSecond(velocity, frameDuration) {\n return frameDuration ? velocity * (1000 / frameDuration) : 0;\n}\n\nexport { velocityPerSecond };\n","import { color } from '../color/index.js';\nimport { number } from '../numbers/index.js';\nimport { isString, floatRegex, colorRegex, sanitize } from '../utils.js';\n\nvar colorToken = '${c}';\nvar numberToken = '${n}';\nfunction test(v) {\n var _a, _b, _c, _d;\n return (isNaN(v) &&\n isString(v) &&\n ((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);\n}\nfunction analyse(v) {\n var values = [];\n var numColors = 0;\n var colors = v.match(colorRegex);\n if (colors) {\n numColors = colors.length;\n v = v.replace(colorRegex, colorToken);\n values.push.apply(values, colors.map(color.parse));\n }\n var numbers = v.match(floatRegex);\n if (numbers) {\n v = v.replace(floatRegex, numberToken);\n values.push.apply(values, numbers.map(number.parse));\n }\n return { values: values, numColors: numColors, tokenised: v };\n}\nfunction parse(v) {\n return analyse(v).values;\n}\nfunction createTransformer(v) {\n var _a = analyse(v), values = _a.values, numColors = _a.numColors, tokenised = _a.tokenised;\n var numValues = values.length;\n return function (v) {\n var output = tokenised;\n for (var i = 0; i < numValues; i++) {\n output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));\n }\n return output;\n };\n}\nvar convertNumbersToZero = function (v) {\n return typeof v === 'number' ? 0 : v;\n};\nfunction getAnimatableNone(v) {\n var parsed = parse(v);\n var transformer = createTransformer(v);\n return transformer(parsed.map(convertNumbersToZero));\n}\nvar complex = { test: test, parse: parse, createTransformer: createTransformer, getAnimatableNone: getAnimatableNone };\n\nexport { complex };\n","import { __assign } from 'tslib';\nimport { complex } from './index.js';\nimport { floatRegex } from '../utils.js';\n\nvar maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);\nfunction applyDefaultFilter(v) {\n var _a = v.slice(0, -1).split('('), name = _a[0], value = _a[1];\n if (name === 'drop-shadow')\n return v;\n var number = (value.match(floatRegex) || [])[0];\n if (!number)\n return v;\n var unit = value.replace(number, '');\n var defaultValue = maxDefaults.has(name) ? 1 : 0;\n if (number !== value)\n defaultValue *= 100;\n return name + '(' + defaultValue + unit + ')';\n}\nvar functionRegex = /([a-z-]*)\\(.*?\\)/g;\nvar filter = __assign(__assign({}, complex), { getAnimatableNone: function (v) {\n var functions = v.match(functionRegex);\n return functions ? functions.map(applyDefaultFilter).join(' ') : v;\n } });\n\nexport { filter };\n","var defaultTimestep = (1 / 60) * 1000;\nvar getCurrentTime = typeof performance !== \"undefined\"\n ? function () { return performance.now(); }\n : function () { return Date.now(); };\nvar onNextFrame = typeof window !== \"undefined\"\n ? function (callback) {\n return window.requestAnimationFrame(callback);\n }\n : function (callback) {\n return setTimeout(function () { return callback(getCurrentTime()); }, defaultTimestep);\n };\n\nexport { defaultTimestep, onNextFrame };\n","import { onNextFrame, defaultTimestep } from './on-next-frame.js';\nimport { createRenderStep } from './create-render-step.js';\n\nvar maxElapsed = 40;\nvar useDefaultElapsed = true;\nvar runNextFrame = false;\nvar isProcessing = false;\nvar frame = {\n delta: 0,\n timestamp: 0\n};\nvar stepsOrder = [\"read\", \"update\", \"preRender\", \"render\", \"postRender\"];\nvar steps = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n acc[key] = createRenderStep(function () {\n return runNextFrame = true;\n });\n return acc;\n}, {});\nvar sync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n var step = steps[key];\n acc[key] = function (process, keepAlive, immediate) {\n if (keepAlive === void 0) {\n keepAlive = false;\n }\n if (immediate === void 0) {\n immediate = false;\n }\n if (!runNextFrame) startLoop();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n}, {});\nvar cancelSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n acc[key] = steps[key].cancel;\n return acc;\n}, {});\nvar flushSync = /*#__PURE__*/stepsOrder.reduce(function (acc, key) {\n acc[key] = function () {\n return steps[key].process(frame);\n };\n return acc;\n}, {});\nvar processStep = function (stepId) {\n return steps[stepId].process(frame);\n};\nvar processFrame = function (timestamp) {\n runNextFrame = false;\n frame.delta = useDefaultElapsed ? defaultTimestep : Math.max(Math.min(timestamp - frame.timestamp, maxElapsed), 1);\n frame.timestamp = timestamp;\n isProcessing = true;\n stepsOrder.forEach(processStep);\n isProcessing = false;\n if (runNextFrame) {\n useDefaultElapsed = false;\n onNextFrame(processFrame);\n }\n};\nvar startLoop = function () {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!isProcessing) onNextFrame(processFrame);\n};\nvar getFrameData = function () {\n return frame;\n};\n\nexport default sync;\nexport { cancelSync, flushSync, getFrameData };\n","function createRenderStep(runNextFrame) {\n var toRun = [];\n var toRunNextFrame = [];\n var numToRun = 0;\n var isProcessing = false;\n var toKeepAlive = new WeakSet();\n var step = {\n schedule: function (callback, keepAlive, immediate) {\n if (keepAlive === void 0) { keepAlive = false; }\n if (immediate === void 0) { immediate = false; }\n var addToCurrentFrame = immediate && isProcessing;\n var buffer = addToCurrentFrame ? toRun : toRunNextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n if (buffer.indexOf(callback) === -1) {\n buffer.push(callback);\n if (addToCurrentFrame && isProcessing)\n numToRun = toRun.length;\n }\n return callback;\n },\n cancel: function (callback) {\n var index = toRunNextFrame.indexOf(callback);\n if (index !== -1)\n toRunNextFrame.splice(index, 1);\n toKeepAlive.delete(callback);\n },\n process: function (frameData) {\n var _a;\n isProcessing = true;\n _a = [toRunNextFrame, toRun], toRun = _a[0], toRunNextFrame = _a[1];\n toRunNextFrame.length = 0;\n numToRun = toRun.length;\n if (numToRun) {\n for (var i = 0; i < numToRun; i++) {\n var callback = toRun[i];\n callback(frameData);\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n }\n }\n isProcessing = false;\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n","var isPoint = function (point) {\n return point.hasOwnProperty('x') && point.hasOwnProperty('y');\n};\n\nexport { isPoint };\n","import { isPoint } from './is-point.js';\n\nvar isPoint3D = function (point) {\n return isPoint(point) && point.hasOwnProperty('z');\n};\n\nexport { isPoint3D };\n","import { isPoint } from './is-point.js';\nimport { isPoint3D } from './is-point-3d.js';\nimport { isNum } from './inc.js';\n\nvar distance1D = function (a, b) { return Math.abs(a - b); };\nfunction distance(a, b) {\n if (isNum(a) && isNum(b)) {\n return distance1D(a, b);\n }\n else if (isPoint(a) && isPoint(b)) {\n var xDelta = distance1D(a.x, b.x);\n var yDelta = distance1D(a.y, b.y);\n var zDelta = isPoint3D(a) && isPoint3D(b) ? distance1D(a.z, b.z) : 0;\n return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2) + Math.pow(zDelta, 2));\n }\n}\n\nexport { distance };\n","function noop(any) {\n return any;\n}\n\nexport { noop };\n","import { __assign } from 'tslib';\nimport { noop } from '../noop.js';\n\n/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nfunction convertBoundingBoxToAxisBox(_a) {\n var top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom;\n return {\n x: { min: left, max: right },\n y: { min: top, max: bottom },\n };\n}\nfunction convertAxisBoxToBoundingBox(_a) {\n var x = _a.x, y = _a.y;\n return {\n top: y.min,\n bottom: y.max,\n left: x.min,\n right: x.max,\n };\n}\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nfunction transformBoundingBox(_a, transformPoint) {\n var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;\n if (transformPoint === void 0) { transformPoint = noop; }\n var topLeft = transformPoint({ x: left, y: top });\n var bottomRight = transformPoint({ x: right, y: bottom });\n return {\n top: topLeft.y,\n left: topLeft.x,\n bottom: bottomRight.y,\n right: bottomRight.x,\n };\n}\n/**\n * Create an empty axis box of zero size\n */\nfunction axisBox() {\n return { x: { min: 0, max: 1 }, y: { min: 0, max: 1 } };\n}\nfunction copyAxisBox(box) {\n return {\n x: __assign({}, box.x),\n y: __assign({}, box.y),\n };\n}\n/**\n * Create an empty box delta\n */\nvar zeroDelta = {\n translate: 0,\n scale: 1,\n origin: 0,\n originPoint: 0,\n};\nfunction delta() {\n return {\n x: __assign({}, zeroDelta),\n y: __assign({}, zeroDelta),\n };\n}\n\nexport { axisBox, convertAxisBoxToBoundingBox, convertBoundingBoxToAxisBox, copyAxisBox, delta, transformBoundingBox };\n","var AnimationType;\n(function (AnimationType) {\n AnimationType[\"Animate\"] = \"animate\";\n AnimationType[\"Hover\"] = \"whileHover\";\n AnimationType[\"Tap\"] = \"whileTap\";\n AnimationType[\"Drag\"] = \"whileDrag\";\n AnimationType[\"Focus\"] = \"whileFocus\";\n AnimationType[\"Exit\"] = \"exit\";\n})(AnimationType || (AnimationType = {}));\n\nexport { AnimationType };\n"],"sourceRoot":""}