{"ast":null,"code":"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';\nvar visualElement = function visualElement(_a) {\n  var _b = _a.treeType,\n    treeType = _b === void 0 ? \"\" : _b,\n    build = _a.build,\n    _getBaseTarget = _a.getBaseTarget,\n    _makeTargetAnimatable = _a.makeTargetAnimatable,\n    _measureViewportBox = _a.measureViewportBox,\n    renderInstance = _a.render,\n    readValueFromInstance = _a.readValueFromInstance,\n    _resetTransform = _a.resetTransform,\n    _restoreTransform = _a.restoreTransform,\n    removeValueFromRenderState = _a.removeValueFromRenderState,\n    _sortNodePosition = _a.sortNodePosition,\n    scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps;\n  return function (_a, options) {\n    var parent = _a.parent,\n      props = _a.props,\n      presenceId = _a.presenceId,\n      blockInitialAnimation = _a.blockInitialAnimation,\n      visualState = _a.visualState;\n    if (options === void 0) {\n      options = {};\n    }\n    var latestValues = visualState.latestValues,\n      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) 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) 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()) return;\n      var delta = layoutState.delta,\n        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 && 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 || 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({\n      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,\n      parent: parent,\n      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]) : [],\n      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 isMounted() {\n        return Boolean(instance);\n      },\n      mount: function mount(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 unmount() {\n        cancelSync.update(update);\n        cancelSync.render(render);\n        cancelSync.preRender(element.updateLayoutProjection);\n        valueSubscriptions.forEach(function (remove) {\n          return remove();\n        });\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 addVariantChild(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 () {\n            return closestVariantNode.variantChildren[\"delete\"](child);\n          };\n        }\n      },\n      sortNodePosition: function sortNodePosition(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) 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 getClosestVariantNode() {\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 ? parent.scheduleUpdateLayoutProjection : function () {\n        return sync.preRender(element.updateTreeLayoutProjection, false, true);\n      },\n      /**\n       * Expose the latest layoutId prop.\n       */\n      getLayoutId: function getLayoutId() {\n        return props.layoutId;\n      },\n      /**\n       * Returns the current instance.\n       */\n      getInstance: function getInstance() {\n        return instance;\n      },\n      /**\n       * Get/set the latest static values.\n       */\n      getStaticValue: function getStaticValue(key) {\n        return latestValues[key];\n      },\n      setStaticValue: function setStaticValue(key, value) {\n        return latestValues[key] = value;\n      },\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 getLatestValues() {\n        return latestValues;\n      },\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 setVisibility(visibility) {\n        if (element.isVisible === visibility) 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 makeTargetAnimatable(target, canMutate) {\n        if (canMutate === void 0) {\n          canMutate = true;\n        }\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 addValue(key, value) {\n        // Remove existing value if it exists\n        if (element.hasValue(key)) 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 removeValue(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 hasValue(key) {\n        return values.has(key);\n      },\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 getValue(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 forEachValue(callback) {\n        return values.forEach(callback);\n      },\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 readValue(key) {\n        var _a;\n        return (_a = latestValues[key]) !== null && _a !== void 0 ? _a : readValueFromInstance(instance, key, options);\n      },\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 setBaseTarget(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 getBaseTarget(key) {\n        if (_getBaseTarget) {\n          var target = _getBaseTarget(props, key);\n          if (target !== undefined && !isMotionValue(target)) return target;\n        }\n        return baseTarget[key];\n      }\n    }, lifecycles), {\n      /**\n       * Build the renderer state based on the latest visual state.\n       */\n      build: function build() {\n        triggerBuild();\n        return renderState;\n      },\n      /**\n       * Schedule a render on the next animation frame.\n       */\n      scheduleRender: function scheduleRender() {\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 setProps(newProps) {\n        props = newProps;\n        lifecycles.updatePropListeners(newProps);\n        prevMotionValues = updateMotionValuesFromProps(element, scrapeMotionValuesFromProps(props), prevMotionValues);\n      },\n      getProps: function getProps() {\n        return props;\n      },\n      // Variants ==============================\n      /**\n       * Returns the variant definition with a given name.\n       */\n      getVariant: function getVariant(name) {\n        var _a;\n        return (_a = props.variants) === null || _a === void 0 ? void 0 : _a[name];\n      },\n      /**\n       * Returns the defined default transition on this component.\n       */\n      getDefaultTransition: function getDefaultTransition() {\n        return props.transition;\n      },\n      /**\n       * Used by child variant nodes to get the closest ancestor variant props.\n       */\n      getVariantContext: function getVariantContext(startAtParent) {\n        if (startAtParent === void 0) {\n          startAtParent = false;\n        }\n        if (startAtParent) 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 enableLayoutProjection() {\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 lockProjectionTarget() {\n        projection.isTargetLocked = true;\n      },\n      unlockProjectionTarget: function unlockProjectionTarget() {\n        element.stopLayoutAnimation();\n        projection.isTargetLocked = false;\n      },\n      getLayoutState: function getLayoutState() {\n        return layoutState;\n      },\n      setCrossfader: function setCrossfader(newCrossfader) {\n        crossfader = newCrossfader;\n      },\n      isProjectionReady: function isProjectionReady() {\n        return projection.isEnabled && projection.isHydrated && layoutState.isHydrated;\n      },\n      /**\n       * Start a layout animation on a given axis.\n       */\n      startLayoutAnimation: function startLayoutAnimation(axis, transition, isRelative) {\n        if (isRelative === void 0) {\n          isRelative = false;\n        }\n        var progress = element.getProjectionAnimationProgress()[axis];\n        var _a = isRelative ? projection.relativeTarget[axis] : projection.target[axis],\n          min = _a.min,\n          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 stopLayoutAnimation() {\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 measureViewportBox(withTransform) {\n        if (withTransform === void 0) {\n          withTransform = true;\n        }\n        var viewportBox = _measureViewportBox(instance, options);\n        if (!withTransform) 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 getProjectionAnimationProgress() {\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 setProjectionTargetAxis(axis, min, max, isRelative) {\n        if (isRelative === void 0) {\n          isRelative = false;\n        }\n        var target;\n        if (isRelative) {\n          if (!projection.relativeTarget) {\n            projection.relativeTarget = axisBox();\n          }\n          target = projection.relativeTarget[axis];\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 rebaseProjectionTarget(force, box) {\n        if (box === void 0) {\n          box = layoutState.layout;\n        }\n        var _a = element.getProjectionAnimationProgress(),\n          x = _a.x,\n          y = _a.y;\n        var shouldRebase = !projection.relativeTarget && !projection.isTargetLocked && !x.isAnimating() && !y.isAnimating();\n        if (force || shouldRebase) {\n          eachAxis(function (axis) {\n            var _a = box[axis],\n              min = _a.min,\n              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 notifyLayoutReady(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 resetTransform() {\n        return _resetTransform(element, instance, props);\n      },\n      restoreTransform: function restoreTransform() {\n        return _restoreTransform(instance, renderState);\n      },\n      updateLayoutProjection: updateLayoutProjection,\n      updateTreeLayoutProjection: function updateTreeLayoutProjection() {\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 getProjectionParent() {\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 resolveRelativeTargetBox() {\n        var relativeParent = element.getProjectionParent();\n        if (!projection.relativeTarget || !relativeParent) 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 shouldResetTransform() {\n        return Boolean(props._layoutResetTransform);\n      },\n      /**\n       *\n       */\n      pointTo: function pointTo(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          } 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,\n      presence: Presence.Entering\n    });\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;\nexport { visualElement };","map":{"version":3,"names":["__assign","__spreadArray","__read","sync","cancelSync","pipe","Presence","eachAxis","axisBox","removeBoxTransforms","applyBoxTransforms","calcRelativeBox","updateBoxDelta","motionValue","isMotionValue","buildLayoutProjectionTransform","variantPriorityOrder","createLifecycles","updateMotionValuesFromProps","updateLayoutDeltas","createLayoutState","createProjectionState","FlatTree","checkIfControllingVariants","checkIfVariantNode","isVariantLabel","setCurrentViewportBox","isDraggable","visualElement","_a","_b","treeType","build","getBaseTarget","makeTargetAnimatable","measureViewportBox","renderInstance","render","readValueFromInstance","resetTransform","restoreTransform","removeValueFromRenderState","sortNodePosition","scrapeMotionValuesFromProps","options","parent","props","presenceId","blockInitialAnimation","visualState","latestValues","renderState","instance","lifecycles","projection","projectionParent","leadProjection","leadLatestValues","unsubscribeFromLeadVisualElement","layoutState","crossfader","hasViewportBoxUpdated","values","Map","valueSubscriptions","prevMotionValues","projectionTargetProgress","baseTarget","removeFromVariantTree","element","isProjectionReady","targetFinal","target","deltaFinal","layoutCorrected","triggerBuild","valuesToRender","isActive","crossfadedValues","getCrossfadeState","update","notifyUpdate","updateLayoutProjection","delta","treeScale","prevTreeScaleX","x","prevTreeScaleY","y","prevDeltaTransform","deltaTransform","path","notifyViewportBoxUpdate","scheduleRender","updateTreeLayoutProjection","layoutTree","forEach","fireUpdateLayoutProjection","bindToMotionValue","key","value","removeOnChange","onChange","latestValue","onUpdate","removeOnRenderRequest","onRenderRequest","set","initialMotionValues","undefined","isControllingVariants","isVariantNode","current","depth","children","Set","variantChildren","isVisible","manuallyAnimateOnMount","Boolean","isMounted","mount","newInstance","pointTo","addVariantChild","add","unmount","preRender","remove","stopLayoutAnimation","clearAllListeners","child","closestVariantNode","getClosestVariantNode","other","getInstance","scheduleUpdateLayoutProjection","getLayoutId","layoutId","getStaticValue","setStaticValue","getLatestValues","setVisibility","visibility","canMutate","addValue","hasValue","removeValue","get","has","getValue","defaultValue","forEachValue","callback","readValue","setBaseTarget","syncRender","setProps","newProps","updatePropListeners","getProps","getVariant","name","variants","getDefaultTransition","transition","getVariantContext","startAtParent","context_1","initial","context","i","numVariantProps","name_1","variantProps","prop","enableLayoutProjection","isEnabled","lockProjectionTarget","isTargetLocked","unlockProjectionTarget","getLayoutState","setCrossfader","newCrossfader","isHydrated","startLayoutAnimation","axis","isRelative","progress","getProjectionAnimationProgress","relativeTarget","min","max","length","clearListeners","v","setProjectionTargetAxis","animateMotionValue","stop","withTransform","viewportBox","notifySetAxisTarget","rebaseProjectionTarget","force","box","layout","shouldRebase","isAnimating","notifyLayoutReady","config","notifyLayoutUpdate","prevViewportBox","fireResolveRelativeTargetBox","getProjectionParent","foundParent","ancestor","resolveRelativeTargetBox","relativeParent","shouldResetTransform","_layoutResetTransform","newLead","onSetAxisTarget","onLayoutAnimationComplete","isPresent","presence","Present","layoutSafeToRemove","call","Entering"],"sources":["C:/ldt/LDT/Safemate_Management/node_modules/framer-motion/dist/es/render/index.js"],"sourcesContent":["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"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,EAAEC,MAAM,QAAQ,OAAO;AACvD,OAAOC,IAAI,IAAIC,UAAU,QAAQ,WAAW;AAC5C,SAASC,IAAI,QAAQ,WAAW;AAChC,SAASC,QAAQ,QAAQ,4CAA4C;AACrE,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,OAAO,QAAQ,4BAA4B;AACpD,SAASC,mBAAmB,EAAEC,kBAAkB,QAAQ,kCAAkC;AAC1F,SAASC,eAAe,EAAEC,cAAc,QAAQ,iCAAiC;AACjF,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,mCAAmC;AACjE,SAASC,8BAA8B,QAAQ,4CAA4C;AAC3F,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,2BAA2B,QAAQ,0BAA0B;AACtE,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,kBAAkB;AAC3E,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,0BAA0B,EAAEC,kBAAkB,EAAEC,cAAc,QAAQ,qBAAqB;AACpG,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,WAAW,QAAQ,yBAAyB;AAErD,IAAIC,aAAa,G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