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,MAAM3f,EAAKC,IAC/B,CACA,SAAS4Z,GAASvJ,GACdoP,GAAUpP,EAAInU,GACdujB,GAAUpP,EAAIjU,EAClB,CCjrCA,IAAIujB,GAAyB1L,GAAqB,CAC9CC,qBAAsB,SAAU0L,EAAKtJ,GAAU,OAAO,OAAYsJ,EAAK,SAAUtJ,EAAS,EAC1FlC,cAAe,WAAc,MAAO,CAChClY,EAAGqjB,SAASM,gBAAgBC,YAAcP,SAASQ,KAAKD,WACxD1jB,EAAGmjB,SAASM,gBAAgBG,WAAaT,SAASQ,KAAKC,UACvD,EACJ3L,kBAAmB,WAAc,OAAO,CAAM,ICN9C4L,GAAqB,CACrBlc,aAASxC,GAET2e,GAAqBjM,GAAqB,CAC1CG,cAAe,SAAUpC,GAAY,MAAO,CACxC9V,EAAG8V,EAAS8N,WACZ1jB,EAAG4V,EAASgO,UACZ,EACJ7L,cAAe,WACX,IAAK8L,GAAmBlc,QAAS,CAC7B,IAAIoc,EAAe,IAAIR,GAAuB,EAAG,CAAC,GAClDQ,EAAa3J,MAAM1X,QACnBqhB,EAAa/S,WAAW,CAAE6M,cAAc,IACxCgG,GAAmBlc,QAAUoc,CACjC,CACA,OAAOF,GAAmBlc,OAC9B,EACAuQ,eAAgB,SAAUtC,EAAU5W,GAChC4W,EAASrJ,MAAMC,UAAYxN,QAAqCA,EAAQ,MAC5E,EACAiZ,kBAAmB,SAAUrC,GACzB,OAAOsJ,QAAuD,UAA/Cxc,OAAOshB,iBAAiBpO,GAAUqO,SACrD,IChBAC,IAAS,SAAS,SAAS,SAAS,QAAS,CAAC,EAAG,MAAe7c,IAAOwL,IAAiB,CAAEsR,0BAA2BL,I","sources":["webpack://eploy/./node_modules/framer-motion/dist/es/animation/animate.mjs","webpack://eploy/./node_modules/popmotion/dist/es/utils/is-point.mjs","webpack://eploy/./node_modules/popmotion/dist/es/utils/is-point-3d.mjs","webpack://eploy/./node_modules/popmotion/dist/es/utils/distance.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/gestures/PanSession.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/geometry/models.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/motion/features/drag.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/gestures/use-pan-gesture.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/gestures/drag/use-drag.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/motion/features/layout/index.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/geometry/copy.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/geometry/utils.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/shared/stack.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/styles/transform.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs","webpack://eploy/./node_modules/framer-motion/dist/es/render/dom/features-max.mjs"],"sourcesContent":["import { motionValue } from '../value/index.mjs';\nimport { isMotionValue } from '../value/utils/is-motion-value.mjs';\nimport { startAnimation } from './utils/transitions.mjs';\n\n/**\n * Animate a single value or a `MotionValue`.\n *\n * The first argument is either a `MotionValue` to animate, or an initial animation value.\n *\n * The second is either a value to animate to, or an array of keyframes to animate through.\n *\n * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.\n *\n * Returns `AnimationPlaybackControls`, currently just a `stop` method.\n *\n * ```javascript\n * const x = useMotionValue(0)\n *\n * useEffect(() => {\n * const controls = animate(x, 100, {\n * type: \"spring\",\n * stiffness: 2000,\n * onComplete: v => {}\n * })\n *\n * return controls.stop\n * })\n * ```\n *\n * @public\n */\nfunction animate(from, to, transition) {\n if (transition === void 0) { transition = {}; }\n var value = isMotionValue(from) ? from : motionValue(from);\n startAnimation(\"\", value, to, transition);\n return {\n stop: function () { return value.stop(); },\n isAnimating: function () { return value.isAnimating(); },\n };\n}\n\nexport { animate };\n","const isPoint = (point) => point.hasOwnProperty('x') && point.hasOwnProperty('y');\n\nexport { isPoint };\n","import { isPoint } from './is-point.mjs';\n\nconst isPoint3D = (point) => isPoint(point) && point.hasOwnProperty('z');\n\nexport { isPoint3D };\n","import { isPoint } from './is-point.mjs';\nimport { isPoint3D } from './is-point-3d.mjs';\nimport { isNum } from './inc.mjs';\n\nconst distance1D = (a, b) => 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 const xDelta = distance1D(a.x, b.x);\n const yDelta = distance1D(a.y, b.y);\n const 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","import { __assign } from 'tslib';\nimport { isMouseEvent, isTouchEvent } from './utils/event-type.mjs';\nimport { extractEventInfo } from '../events/event-info.mjs';\nimport sync, { getFrameData, cancelSync } from 'framesync';\nimport { secondsToMilliseconds } from '../utils/time-conversion.mjs';\nimport { addPointerEvent } from '../events/use-pointer-event.mjs';\nimport { distance, pipe } from 'popmotion';\n\n/**\n * @internal\n */\nvar PanSession = /** @class */ (function () {\n function PanSession(event, handlers, _a) {\n var _this = this;\n var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;\n /**\n * @internal\n */\n this.startEvent = null;\n /**\n * @internal\n */\n this.lastMoveEvent = null;\n /**\n * @internal\n */\n this.lastMoveEventInfo = null;\n /**\n * @internal\n */\n this.handlers = {};\n this.updatePoint = function () {\n if (!(_this.lastMoveEvent && _this.lastMoveEventInfo))\n return;\n var info = getPanInfo(_this.lastMoveEventInfo, _this.history);\n var isPanStarted = _this.startEvent !== null;\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursoe.\n var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3;\n if (!isPanStarted && !isDistancePastThreshold)\n return;\n var point = info.point;\n var timestamp = getFrameData().timestamp;\n _this.history.push(__assign(__assign({}, point), { timestamp: timestamp }));\n var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove;\n if (!isPanStarted) {\n onStart && onStart(_this.lastMoveEvent, info);\n _this.startEvent = _this.lastMoveEvent;\n }\n onMove && onMove(_this.lastMoveEvent, info);\n };\n this.handlePointerMove = function (event, info) {\n _this.lastMoveEvent = event;\n _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint);\n // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n if (isMouseEvent(event) && event.buttons === 0) {\n _this.handlePointerUp(event, info);\n return;\n }\n // Throttle mouse move event to once per frame\n sync.update(_this.updatePoint, true);\n };\n this.handlePointerUp = function (event, info) {\n _this.end();\n var _a = _this.handlers, onEnd = _a.onEnd, onSessionEnd = _a.onSessionEnd;\n var panInfo = getPanInfo(transformPoint(info, _this.transformPagePoint), _this.history);\n if (_this.startEvent && onEnd) {\n onEnd(event, panInfo);\n }\n onSessionEnd && onSessionEnd(event, panInfo);\n };\n // If we have more than one touch, don't start detecting this gesture\n if (isTouchEvent(event) && event.touches.length > 1)\n return;\n this.handlers = handlers;\n this.transformPagePoint = transformPagePoint;\n var info = extractEventInfo(event);\n var initialInfo = transformPoint(info, this.transformPagePoint);\n var point = initialInfo.point;\n var timestamp = getFrameData().timestamp;\n this.history = [__assign(__assign({}, point), { timestamp: timestamp })];\n var onSessionStart = handlers.onSessionStart;\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history));\n this.removeListeners = pipe(addPointerEvent(window, \"pointermove\", this.handlePointerMove), addPointerEvent(window, \"pointerup\", this.handlePointerUp), addPointerEvent(window, \"pointercancel\", this.handlePointerUp));\n }\n PanSession.prototype.updateHandlers = function (handlers) {\n this.handlers = handlers;\n };\n PanSession.prototype.end = function () {\n this.removeListeners && this.removeListeners();\n cancelSync.update(this.updatePoint);\n };\n return PanSession;\n}());\nfunction transformPoint(info, transformPagePoint) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info;\n}\nfunction subtractPoint(a, b) {\n return { x: a.x - b.x, y: a.y - b.y };\n}\nfunction getPanInfo(_a, history) {\n var point = _a.point;\n return {\n point: point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n };\n}\nfunction startDevicePoint(history) {\n return history[0];\n}\nfunction lastDevicePoint(history) {\n return history[history.length - 1];\n}\nfunction getVelocity(history, timeDelta) {\n if (history.length < 2) {\n return { x: 0, y: 0 };\n }\n var i = history.length - 1;\n var timestampedPoint = null;\n var lastPoint = lastDevicePoint(history);\n while (i >= 0) {\n timestampedPoint = history[i];\n if (lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)) {\n break;\n }\n i--;\n }\n if (!timestampedPoint) {\n return { x: 0, y: 0 };\n }\n var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;\n if (time === 0) {\n return { x: 0, y: 0 };\n }\n var currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n };\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0;\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0;\n }\n return currentVelocity;\n}\n\nexport { PanSession };\n","import { mix, distance } from 'popmotion';\n\nfunction calcLength(axis) {\n return axis.max - axis.min;\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 calcAxisDelta(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) || isNaN(delta.scale))\n delta.scale = 1;\n delta.translate =\n mix(target.min, target.max, delta.origin) - delta.originPoint;\n if (isNear(delta.translate) || isNaN(delta.translate))\n delta.translate = 0;\n}\nfunction calcBoxDelta(delta, source, target, origin) {\n calcAxisDelta(delta.x, source.x, target.x, origin === null || origin === void 0 ? void 0 : origin.originX);\n calcAxisDelta(delta.y, source.y, target.y, origin === null || origin === void 0 ? void 0 : origin.originY);\n}\nfunction calcRelativeAxis(target, relative, parent) {\n target.min = parent.min + relative.min;\n target.max = target.min + calcLength(relative);\n}\nfunction calcRelativeBox(target, relative, parent) {\n calcRelativeAxis(target.x, relative.x, parent.x);\n calcRelativeAxis(target.y, relative.y, parent.y);\n}\nfunction calcRelativeAxisPosition(target, layout, parent) {\n target.min = layout.min - parent.min;\n target.max = target.min + calcLength(layout);\n}\nfunction calcRelativePosition(target, layout, parent) {\n calcRelativeAxisPosition(target.x, layout.x, parent.x);\n calcRelativeAxisPosition(target.y, layout.y, parent.y);\n}\n\nexport { calcAxisDelta, calcBoxDelta, calcLength, calcRelativeAxis, calcRelativeAxisPosition, calcRelativeBox, calcRelativePosition, isNear };\n","import { __read } from 'tslib';\nimport { clamp, mix, progress } from 'popmotion';\nimport { calcLength } from '../../../projection/geometry/delta-calc.mjs';\n\n/**\n * Apply constraints to a point. These constraints are both physical along an\n * axis, and an elastic factor that determines how much to constrain the point\n * by if it does lie outside the defined parameters.\n */\nfunction applyConstraints(point, _a, elastic) {\n var min = _a.min, max = _a.max;\n if (min !== undefined && point < min) {\n // If we have a min point defined, and this is outside of that, constrain\n point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);\n }\n else if (max !== undefined && point > max) {\n // If we have a max point defined, and this is outside of that, constrain\n point = elastic ? mix(max, point, elastic.max) : Math.min(point, max);\n }\n return point;\n}\n/**\n * Calculate constraints in terms of the viewport when defined relatively to the\n * measured axis. This is measured from the nearest edge, so a max constraint of 200\n * on an axis with a max value of 300 would return a constraint of 500 - axis length\n */\nfunction calcRelativeAxisConstraints(axis, min, max) {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max: max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n };\n}\n/**\n * Calculate constraints in terms of the viewport when\n * defined relatively to the measured bounding box.\n */\nfunction calcRelativeConstraints(layoutBox, _a) {\n var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;\n return {\n x: calcRelativeAxisConstraints(layoutBox.x, left, right),\n y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),\n };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative axis\n */\nfunction calcViewportAxisConstraints(layoutAxis, constraintsAxis) {\n var _a;\n var min = constraintsAxis.min - layoutAxis.min;\n var max = constraintsAxis.max - layoutAxis.max;\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min) {\n _a = __read([max, min], 2), min = _a[0], max = _a[1];\n }\n return { min: min, max: max };\n}\n/**\n * Calculate viewport constraints when defined as another viewport-relative box\n */\nfunction calcViewportConstraints(layoutBox, constraintsBox) {\n return {\n x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),\n y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),\n };\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 clamp(0, 1, origin);\n}\n/**\n * Rebase the calculated viewport constraints relative to the layout.min point.\n */\nfunction rebaseAxisConstraints(layout, constraints) {\n var relativeConstraints = {};\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min;\n }\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min;\n }\n return relativeConstraints;\n}\nvar defaultElastic = 0.35;\n/**\n * Accepts a dragElastic prop and returns resolved elastic values for each axis.\n */\nfunction resolveDragElastic(dragElastic) {\n if (dragElastic === void 0) { dragElastic = defaultElastic; }\n if (dragElastic === false) {\n dragElastic = 0;\n }\n else if (dragElastic === true) {\n dragElastic = defaultElastic;\n }\n return {\n x: resolveAxisElastic(dragElastic, \"left\", \"right\"),\n y: resolveAxisElastic(dragElastic, \"top\", \"bottom\"),\n };\n}\nfunction resolveAxisElastic(dragElastic, minLabel, maxLabel) {\n return {\n min: resolvePointElastic(dragElastic, minLabel),\n max: resolvePointElastic(dragElastic, maxLabel),\n };\n}\nfunction resolvePointElastic(dragElastic, label) {\n var _a;\n return typeof dragElastic === \"number\"\n ? dragElastic\n : (_a = dragElastic[label]) !== null && _a !== void 0 ? _a : 0;\n}\n\nexport { applyConstraints, calcOrigin, calcRelativeAxisConstraints, calcRelativeConstraints, calcViewportAxisConstraints, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, resolveAxisElastic, resolveDragElastic, resolvePointElastic };\n","var createAxisDelta = function () { return ({\n translate: 0,\n scale: 1,\n origin: 0,\n originPoint: 0,\n}); };\nvar createDelta = function () { return ({\n x: createAxisDelta(),\n y: createAxisDelta(),\n}); };\nvar createAxis = function () { return ({ min: 0, max: 0 }); };\nvar createBox = function () { return ({\n x: createAxis(),\n y: createAxis(),\n}); };\n\nexport { createAxis, createAxisDelta, createBox, createDelta };\n","function eachAxis(callback) {\n return [callback(\"x\"), callback(\"y\")];\n}\n\nexport { eachAxis };\n","import { __assign } from 'tslib';\nimport { invariant } from 'hey-listen';\nimport { PanSession } from '../PanSession.mjs';\nimport { getGlobalLock } from './utils/lock.mjs';\nimport { isRefObject } from '../../utils/is-ref-object.mjs';\nimport { addPointerEvent } from '../../events/use-pointer-event.mjs';\nimport { applyConstraints, calcRelativeConstraints, resolveDragElastic, rebaseAxisConstraints, calcViewportConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';\nimport { AnimationType } from '../../render/utils/types.mjs';\nimport { createBox } from '../../projection/geometry/models.mjs';\nimport { eachAxis } from '../../projection/utils/each-axis.mjs';\nimport { measurePageBox } from '../../projection/utils/measure.mjs';\nimport { extractEventInfo } from '../../events/event-info.mjs';\nimport { startAnimation } from '../../animation/utils/transitions.mjs';\nimport { convertBoxToBoundingBox, convertBoundingBoxToBox } from '../../projection/geometry/conversion.mjs';\nimport { addDomEvent } from '../../events/use-dom-event.mjs';\nimport { mix } from 'popmotion';\nimport { percent } from 'style-value-types';\nimport { calcLength } from '../../projection/geometry/delta-calc.mjs';\n\nvar elementDragControls = new WeakMap();\n/**\n *\n */\n// let latestPointerEvent: AnyPointerEvent\nvar VisualElementDragControls = /** @class */ (function () {\n function VisualElementDragControls(visualElement) {\n // This is a reference to the global drag gesture lock, ensuring only one component\n // can \"capture\" the drag of one or both axes.\n // TODO: Look into moving this into pansession?\n this.openGlobalLock = null;\n this.isDragging = false;\n this.currentDirection = null;\n this.originPoint = { x: 0, y: 0 };\n /**\n * The permitted boundaries of travel, in pixels.\n */\n this.constraints = false;\n this.hasMutatedConstraints = false;\n /**\n * The per-axis resolved elastic values.\n */\n this.elastic = createBox();\n this.visualElement = visualElement;\n }\n VisualElementDragControls.prototype.start = function (originEvent, _a) {\n var _this = this;\n var _b = _a === void 0 ? {} : _a, _c = _b.snapToCursor, snapToCursor = _c === void 0 ? false : _c;\n /**\n * Don't start dragging if this component is exiting\n */\n if (this.visualElement.isPresent === false)\n return;\n var onSessionStart = function (event) {\n // Stop any animations on both axis values immediately. This allows the user to throw and catch\n // the component.\n _this.stopAnimation();\n if (snapToCursor) {\n _this.snapToCursor(extractEventInfo(event, \"page\").point);\n }\n };\n var onStart = function (event, info) {\n var _a;\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n var _b = _this.getProps(), drag = _b.drag, dragPropagation = _b.dragPropagation, onDragStart = _b.onDragStart;\n if (drag && !dragPropagation) {\n if (_this.openGlobalLock)\n _this.openGlobalLock();\n _this.openGlobalLock = getGlobalLock(drag);\n // If we don 't have the lock, don't start dragging\n if (!_this.openGlobalLock)\n return;\n }\n _this.isDragging = true;\n _this.currentDirection = null;\n _this.resolveConstraints();\n if (_this.visualElement.projection) {\n _this.visualElement.projection.isAnimationBlocked = true;\n _this.visualElement.projection.target = undefined;\n }\n /**\n * Record gesture origin\n */\n eachAxis(function (axis) {\n var _a, _b;\n var current = _this.getAxisMotionValue(axis).get() || 0;\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];\n if (measuredAxis) {\n var length_1 = calcLength(measuredAxis);\n current = length_1 * (parseFloat(current) / 100);\n }\n }\n _this.originPoint[axis] = current;\n });\n // Fire onDragStart event\n onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, info);\n (_a = _this.visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Drag, true);\n };\n var onMove = function (event, info) {\n // latestPointerEvent = event\n var _a = _this.getProps(), dragPropagation = _a.dragPropagation, dragDirectionLock = _a.dragDirectionLock, onDirectionLock = _a.onDirectionLock, onDrag = _a.onDrag;\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !_this.openGlobalLock)\n return;\n var offset = info.offset;\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && _this.currentDirection === null) {\n _this.currentDirection = getCurrentDirection(offset);\n // If we've successfully set a direction, notify listener\n if (_this.currentDirection !== null) {\n onDirectionLock === null || onDirectionLock === void 0 ? void 0 : onDirectionLock(_this.currentDirection);\n }\n return;\n }\n // Update each point with the latest position\n _this.updateAxis(\"x\", info.point, offset);\n _this.updateAxis(\"y\", info.point, offset);\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n _this.visualElement.syncRender();\n /**\n * This must fire after the syncRender call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, info);\n };\n var onSessionEnd = function (event, info) {\n return _this.stop(event, info);\n };\n this.panSession = new PanSession(originEvent, {\n onSessionStart: onSessionStart,\n onStart: onStart,\n onMove: onMove,\n onSessionEnd: onSessionEnd,\n }, { transformPagePoint: this.visualElement.getTransformPagePoint() });\n };\n VisualElementDragControls.prototype.stop = function (event, info) {\n var isDragging = this.isDragging;\n this.cancel();\n if (!isDragging)\n return;\n var velocity = info.velocity;\n this.startAnimation(velocity);\n var onDragEnd = this.getProps().onDragEnd;\n onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(event, info);\n };\n VisualElementDragControls.prototype.cancel = function () {\n var _a, _b;\n this.isDragging = false;\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = false;\n }\n (_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();\n this.panSession = undefined;\n var dragPropagation = this.getProps().dragPropagation;\n if (!dragPropagation && this.openGlobalLock) {\n this.openGlobalLock();\n this.openGlobalLock = null;\n }\n (_b = this.visualElement.animationState) === null || _b === void 0 ? void 0 : _b.setActive(AnimationType.Drag, false);\n };\n VisualElementDragControls.prototype.updateAxis = function (axis, _point, offset) {\n var drag = this.getProps().drag;\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection))\n return;\n var axisValue = this.getAxisMotionValue(axis);\n var next = this.originPoint[axis] + offset[axis];\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);\n }\n axisValue.set(next);\n };\n VisualElementDragControls.prototype.resolveConstraints = function () {\n var _this = this;\n var _a = this.getProps(), dragConstraints = _a.dragConstraints, dragElastic = _a.dragElastic;\n var layout = (this.visualElement.projection || {}).layout;\n var prevConstraints = this.constraints;\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints();\n }\n }\n else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(layout.actual, dragConstraints);\n }\n else {\n this.constraints = false;\n }\n }\n this.elastic = resolveDragElastic(dragElastic);\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative.\n */\n if (prevConstraints !== this.constraints &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints) {\n eachAxis(function (axis) {\n if (_this.getAxisMotionValue(axis)) {\n _this.constraints[axis] = rebaseAxisConstraints(layout.actual[axis], _this.constraints[axis]);\n }\n });\n }\n };\n VisualElementDragControls.prototype.resolveRefConstraints = function () {\n var _a = this.getProps(), constraints = _a.dragConstraints, onMeasureDragConstraints = _a.onMeasureDragConstraints;\n if (!constraints || !isRefObject(constraints))\n return false;\n var constraintsElement = constraints.current;\n invariant(constraintsElement !== null, \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\");\n var projection = this.visualElement.projection;\n // TODO\n if (!projection || !projection.layout)\n return false;\n var constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());\n var measuredConstraints = calcViewportConstraints(projection.layout.actual, constraintsBox);\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n var userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));\n this.hasMutatedConstraints = !!userConstraints;\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints);\n }\n }\n return measuredConstraints;\n };\n VisualElementDragControls.prototype.startAnimation = function (velocity) {\n var _this = this;\n var _a = this.getProps(), drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition, dragSnapToOrigin = _a.dragSnapToOrigin, onDragTransitionEnd = _a.onDragTransitionEnd;\n var constraints = this.constraints || {};\n var momentumAnimations = eachAxis(function (axis) {\n var _a;\n if (!shouldDrag(axis, drag, _this.currentDirection)) {\n return;\n }\n var transition = (_a = constraints === null || constraints === void 0 ? void 0 : constraints[axis]) !== null && _a !== void 0 ? _a : {};\n if (dragSnapToOrigin)\n transition = { min: 0, max: 0 };\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n var bounceStiffness = dragElastic ? 200 : 1000000;\n var bounceDamping = dragElastic ? 40 : 10000000;\n var inertia = __assign(__assign({ type: \"inertia\", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness, bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return _this.startAxisValueAnimation(axis, inertia);\n });\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd);\n };\n VisualElementDragControls.prototype.startAxisValueAnimation = function (axis, transition) {\n var axisValue = this.getAxisMotionValue(axis);\n return startAnimation(axis, axisValue, 0, transition);\n };\n VisualElementDragControls.prototype.stopAnimation = function () {\n var _this = this;\n eachAxis(function (axis) { return _this.getAxisMotionValue(axis).stop(); });\n };\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n VisualElementDragControls.prototype.getAxisMotionValue = function (axis) {\n var _a, _b;\n var dragKey = \"_drag\" + axis.toUpperCase();\n var externalMotionValue = this.visualElement.getProps()[dragKey];\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(axis, (_b = (_a = this.visualElement.getProps().initial) === null || _a === void 0 ? void 0 : _a[axis]) !== null && _b !== void 0 ? _b : 0);\n };\n VisualElementDragControls.prototype.snapToCursor = function (point) {\n var _this = this;\n eachAxis(function (axis) {\n var drag = _this.getProps().drag;\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, _this.currentDirection))\n return;\n var projection = _this.visualElement.projection;\n var axisValue = _this.getAxisMotionValue(axis);\n if (projection && projection.layout) {\n var _a = projection.layout.actual[axis], min = _a.min, max = _a.max;\n axisValue.set(point[axis] - mix(min, max, 0.5));\n }\n });\n };\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n VisualElementDragControls.prototype.scalePositionWithinConstraints = function () {\n var _this = this;\n var _a;\n var _b = this.getProps(), drag = _b.drag, dragConstraints = _b.dragConstraints;\n var projection = this.visualElement.projection;\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return;\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation();\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n var boxProgress = { x: 0, y: 0 };\n eachAxis(function (axis) {\n var axisValue = _this.getAxisMotionValue(axis);\n if (axisValue) {\n var latest = axisValue.get();\n boxProgress[axis] = calcOrigin({ min: latest, max: latest }, _this.constraints[axis]);\n }\n });\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n var transformTemplate = this.visualElement.getProps().transformTemplate;\n this.visualElement.getInstance().style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();\n projection.updateLayout();\n this.resolveConstraints();\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis(function (axis) {\n if (!shouldDrag(axis, drag, null))\n return;\n /**\n * Calculate a new transform based on the previous box progress\n */\n var axisValue = _this.getAxisMotionValue(axis);\n var _a = _this.constraints[axis], min = _a.min, max = _a.max;\n axisValue.set(mix(min, max, boxProgress[axis]));\n });\n };\n VisualElementDragControls.prototype.addListeners = function () {\n var _this = this;\n var _a;\n elementDragControls.set(this.visualElement, this);\n var element = this.visualElement.getInstance();\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n var stopPointerListener = addPointerEvent(element, \"pointerdown\", function (event) {\n var _a = _this.getProps(), drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;\n drag && dragListener && _this.start(event);\n });\n var measureDragConstraints = function () {\n var dragConstraints = _this.getProps().dragConstraints;\n if (isRefObject(dragConstraints)) {\n _this.constraints = _this.resolveRefConstraints();\n }\n };\n var projection = this.visualElement.projection;\n var stopMeasureLayoutListener = projection.addEventListener(\"measure\", measureDragConstraints);\n if (projection && !projection.layout) {\n (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();\n projection.updateLayout();\n }\n measureDragConstraints();\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n var stopResizeListener = addDomEvent(window, \"resize\", function () {\n return _this.scalePositionWithinConstraints();\n });\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n projection.addEventListener(\"didUpdate\", (function (_a) {\n var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged;\n if (_this.isDragging && hasLayoutChanged) {\n eachAxis(function (axis) {\n var motionValue = _this.getAxisMotionValue(axis);\n if (!motionValue)\n return;\n _this.originPoint[axis] += delta[axis].translate;\n motionValue.set(motionValue.get() + delta[axis].translate);\n });\n _this.visualElement.syncRender();\n }\n }));\n return function () {\n stopResizeListener();\n stopPointerListener();\n stopMeasureLayoutListener();\n };\n };\n VisualElementDragControls.prototype.getProps = function () {\n var props = this.visualElement.getProps();\n var _a = props.drag, drag = _a === void 0 ? false : _a, _b = props.dragDirectionLock, dragDirectionLock = _b === void 0 ? false : _b, _c = props.dragPropagation, dragPropagation = _c === void 0 ? false : _c, _d = props.dragConstraints, dragConstraints = _d === void 0 ? false : _d, _e = props.dragElastic, dragElastic = _e === void 0 ? defaultElastic : _e, _f = props.dragMomentum, dragMomentum = _f === void 0 ? true : _f;\n return __assign(__assign({}, props), { drag: drag, dragDirectionLock: dragDirectionLock, dragPropagation: dragPropagation, dragConstraints: dragConstraints, dragElastic: dragElastic, dragMomentum: dragMomentum });\n };\n return VisualElementDragControls;\n}());\nfunction shouldDrag(direction, drag, currentDirection) {\n return ((drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction));\n}\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(offset, lockThreshold) {\n if (lockThreshold === void 0) { lockThreshold = 10; }\n var direction = null;\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\";\n }\n else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\";\n }\n return direction;\n}\n\nexport { VisualElementDragControls, elementDragControls };\n","import { useDrag } from '../../gestures/drag/use-drag.mjs';\nimport { usePanGesture } from '../../gestures/use-pan-gesture.mjs';\nimport { makeRenderlessComponent } from '../utils/make-renderless-component.mjs';\n\nvar drag = {\n pan: makeRenderlessComponent(usePanGesture),\n drag: makeRenderlessComponent(useDrag),\n};\n\nexport { drag };\n","import { useRef, useContext, useEffect } from 'react';\nimport { MotionConfigContext } from '../context/MotionConfigContext.mjs';\nimport { useUnmountEffect } from '../utils/use-unmount-effect.mjs';\nimport { usePointerEvent } from '../events/use-pointer-event.mjs';\nimport { PanSession } from './PanSession.mjs';\n\n/**\n *\n * @param handlers -\n * @param ref -\n *\n * @privateRemarks\n * Currently this sets new pan gesture functions every render. The memo route has been explored\n * in the past but ultimately we're still creating new functions every render. An optimisation\n * to explore is creating the pan gestures and loading them into a `ref`.\n *\n * @internal\n */\nfunction usePanGesture(_a) {\n var onPan = _a.onPan, onPanStart = _a.onPanStart, onPanEnd = _a.onPanEnd, onPanSessionStart = _a.onPanSessionStart, visualElement = _a.visualElement;\n var hasPanEvents = onPan || onPanStart || onPanEnd || onPanSessionStart;\n var panSession = useRef(null);\n var transformPagePoint = useContext(MotionConfigContext).transformPagePoint;\n var handlers = {\n onSessionStart: onPanSessionStart,\n onStart: onPanStart,\n onMove: onPan,\n onEnd: function (event, info) {\n panSession.current = null;\n onPanEnd && onPanEnd(event, info);\n },\n };\n useEffect(function () {\n if (panSession.current !== null) {\n panSession.current.updateHandlers(handlers);\n }\n });\n function onPointerDown(event) {\n panSession.current = new PanSession(event, handlers, {\n transformPagePoint: transformPagePoint,\n });\n }\n usePointerEvent(visualElement, \"pointerdown\", hasPanEvents && onPointerDown);\n useUnmountEffect(function () { return panSession.current && panSession.current.end(); });\n}\n\nexport { usePanGesture };\n","import { useEffect } from 'react';\nimport { VisualElementDragControls } from './VisualElementDragControls.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\n\n/**\n * A hook that allows an element to be dragged.\n *\n * @internal\n */\nfunction useDrag(props) {\n var groupDragControls = props.dragControls, visualElement = props.visualElement;\n var dragControls = useConstant(function () { return new VisualElementDragControls(visualElement); });\n // If we've been provided a DragControls for manual control over the drag gesture,\n // subscribe this component to it on mount.\n useEffect(function () { return groupDragControls && groupDragControls.subscribe(dragControls); }, [dragControls, groupDragControls]);\n // Apply the event listeners to the element\n useEffect(function () { return dragControls.addListeners(); }, [dragControls]);\n}\n\nexport { useDrag };\n","import { px } from 'style-value-types';\n\nfunction pixelsToPercent(pixels, axis) {\n if (axis.max === axis.min)\n return 0;\n return (pixels / (axis.max - axis.min)) * 100;\n}\n/**\n * We always correct borderRadius as a percentage rather than pixels to reduce paints.\n * For example, if you are projecting a box that is 100px wide with a 10px borderRadius\n * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%\n * borderRadius in both states. If we animate between the two in pixels that will trigger\n * a paint each time. If we animate between the two in percentage we'll avoid a paint.\n */\nvar correctBorderRadius = {\n correct: function (latest, node) {\n if (!node.target)\n return latest;\n /**\n * If latest is a string, if it's a percentage we can return immediately as it's\n * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.\n */\n if (typeof latest === \"string\") {\n if (px.test(latest)) {\n latest = parseFloat(latest);\n }\n else {\n return latest;\n }\n }\n /**\n * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that\n * pixel value as a percentage of each axis\n */\n var x = pixelsToPercent(latest, node.target.x);\n var y = pixelsToPercent(latest, node.target.y);\n return \"\".concat(x, \"% \").concat(y, \"%\");\n },\n};\n\nexport { correctBorderRadius, pixelsToPercent };\n","import { mix } from 'popmotion';\nimport { complex } from 'style-value-types';\nimport { cssVariableRegex } from '../../render/dom/utils/css-variables-conversion.mjs';\n\nvar varToken = \"_$css\";\nvar correctBoxShadow = {\n correct: function (latest, _a) {\n var treeScale = _a.treeScale, projectionDelta = _a.projectionDelta;\n var original = latest;\n /**\n * We need to first strip and store CSS variables from the string.\n */\n var containsCSSVariables = latest.includes(\"var(\");\n var cssVariables = [];\n if (containsCSSVariables) {\n latest = latest.replace(cssVariableRegex, function (match) {\n cssVariables.push(match);\n return varToken;\n });\n }\n var shadow = complex.parse(latest);\n // TODO: Doesn't support multiple shadows\n if (shadow.length > 5)\n return original;\n var template = complex.createTransformer(latest);\n var offset = typeof shadow[0] !== \"number\" ? 1 : 0;\n // Calculate the overall context scale\n var xScale = projectionDelta.x.scale * treeScale.x;\n var yScale = projectionDelta.y.scale * treeScale.y;\n shadow[0 + offset] /= xScale;\n shadow[1 + offset] /= yScale;\n /**\n * Ideally we'd correct x and y scales individually, but because blur and\n * spread apply to both we have to take a scale average and apply that instead.\n * We could potentially improve the outcome of this by incorporating the ratio between\n * the two scales.\n */\n var averageScale = mix(xScale, yScale, 0.5);\n // Blur\n if (typeof shadow[2 + offset] === \"number\")\n shadow[2 + offset] /= averageScale;\n // Spread\n if (typeof shadow[3 + offset] === \"number\")\n shadow[3 + offset] /= averageScale;\n var output = template(shadow);\n if (containsCSSVariables) {\n var i_1 = 0;\n output = output.replace(varToken, function () {\n var cssVariable = cssVariables[i_1];\n i_1++;\n return cssVariable;\n });\n }\n return output;\n },\n};\n\nexport { correctBoxShadow };\n","import { __extends, __assign, __read } from 'tslib';\nimport sync from 'framesync';\nimport React__default, { useContext } from 'react';\nimport { usePresence } from '../../../components/AnimatePresence/use-presence.mjs';\nimport { LayoutGroupContext } from '../../../context/LayoutGroupContext.mjs';\nimport { SwitchLayoutGroupContext } from '../../../context/SwitchLayoutGroupContext.mjs';\nimport { globalProjectionState } from '../../../projection/node/state.mjs';\nimport { correctBorderRadius } from '../../../projection/styles/scale-border-radius.mjs';\nimport { correctBoxShadow } from '../../../projection/styles/scale-box-shadow.mjs';\nimport { addScaleCorrector } from '../../../projection/styles/scale-correction.mjs';\n\nvar MeasureLayoutWithContext = /** @class */ (function (_super) {\n __extends(MeasureLayoutWithContext, _super);\n function MeasureLayoutWithContext() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * This only mounts projection nodes for components that\n * need measuring, we might want to do it for all components\n * in order to incorporate transforms\n */\n MeasureLayoutWithContext.prototype.componentDidMount = function () {\n var _this = this;\n var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, switchLayoutGroup = _a.switchLayoutGroup, layoutId = _a.layoutId;\n var projection = visualElement.projection;\n addScaleCorrector(defaultScaleCorrectors);\n if (projection) {\n if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)\n layoutGroup.group.add(projection);\n if ((switchLayoutGroup === null || switchLayoutGroup === void 0 ? void 0 : switchLayoutGroup.register) && layoutId) {\n switchLayoutGroup.register(projection);\n }\n projection.root.didUpdate();\n projection.addEventListener(\"animationComplete\", function () {\n _this.safeToRemove();\n });\n projection.setOptions(__assign(__assign({}, projection.options), { onExitComplete: function () { return _this.safeToRemove(); } }));\n }\n globalProjectionState.hasEverUpdated = true;\n };\n MeasureLayoutWithContext.prototype.getSnapshotBeforeUpdate = function (prevProps) {\n var _this = this;\n var _a = this.props, layoutDependency = _a.layoutDependency, visualElement = _a.visualElement, drag = _a.drag, isPresent = _a.isPresent;\n var projection = visualElement.projection;\n if (!projection)\n return null;\n /**\n * TODO: We use this data in relegate to determine whether to\n * promote a previous element. There's no guarantee its presence data\n * will have updated by this point - if a bug like this arises it will\n * have to be that we markForRelegation and then find a new lead some other way,\n * perhaps in didUpdate\n */\n projection.isPresent = isPresent;\n if (drag ||\n prevProps.layoutDependency !== layoutDependency ||\n layoutDependency === undefined) {\n projection.willUpdate();\n }\n else {\n this.safeToRemove();\n }\n if (prevProps.isPresent !== isPresent) {\n if (isPresent) {\n projection.promote();\n }\n else if (!projection.relegate()) {\n /**\n * If there's another stack member taking over from this one,\n * it's in charge of the exit animation and therefore should\n * be in charge of the safe to remove. Otherwise we call it here.\n */\n sync.postRender(function () {\n var _a;\n if (!((_a = projection.getStack()) === null || _a === void 0 ? void 0 : _a.members.length)) {\n _this.safeToRemove();\n }\n });\n }\n }\n return null;\n };\n MeasureLayoutWithContext.prototype.componentDidUpdate = function () {\n var projection = this.props.visualElement.projection;\n if (projection) {\n projection.root.didUpdate();\n if (!projection.currentAnimation && projection.isLead()) {\n this.safeToRemove();\n }\n }\n };\n MeasureLayoutWithContext.prototype.componentWillUnmount = function () {\n var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, promoteContext = _a.switchLayoutGroup;\n var projection = visualElement.projection;\n if (projection) {\n projection.scheduleCheckAfterUnmount();\n if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)\n layoutGroup.group.remove(projection);\n if (promoteContext === null || promoteContext === void 0 ? void 0 : promoteContext.deregister)\n promoteContext.deregister(projection);\n }\n };\n MeasureLayoutWithContext.prototype.safeToRemove = function () {\n var safeToRemove = this.props.safeToRemove;\n safeToRemove === null || safeToRemove === void 0 ? void 0 : safeToRemove();\n };\n MeasureLayoutWithContext.prototype.render = function () {\n return null;\n };\n return MeasureLayoutWithContext;\n}(React__default.Component));\nfunction MeasureLayout(props) {\n var _a = __read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];\n var layoutGroup = useContext(LayoutGroupContext);\n return (React__default.createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));\n}\nvar defaultScaleCorrectors = {\n borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n ] }),\n borderTopLeftRadius: correctBorderRadius,\n borderTopRightRadius: correctBorderRadius,\n borderBottomLeftRadius: correctBorderRadius,\n borderBottomRightRadius: correctBorderRadius,\n boxShadow: correctBoxShadow,\n};\n\nexport { MeasureLayout };\n","import { MeasureLayout } from './MeasureLayout.mjs';\n\nvar layoutFeatures = {\n measureLayout: MeasureLayout,\n};\n\nexport { layoutFeatures };\n","import { mix, progress, linear, circOut } from 'popmotion';\nimport { px, percent } from 'style-value-types';\n\nvar borders = [\"TopLeft\", \"TopRight\", \"BottomLeft\", \"BottomRight\"];\nvar numBorders = borders.length;\nvar asNumber = function (value) {\n return typeof value === \"string\" ? parseFloat(value) : value;\n};\nvar isPx = function (value) {\n return typeof value === \"number\" || px.test(value);\n};\nfunction mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {\n var _a, _b, _c, _d;\n if (shouldCrossfadeOpacity) {\n target.opacity = mix(0, \n // (follow?.opacity as number) ?? 0,\n // TODO Reinstate this if only child\n (_a = lead.opacity) !== null && _a !== void 0 ? _a : 1, easeCrossfadeIn(progress));\n target.opacityExit = mix((_b = follow.opacity) !== null && _b !== void 0 ? _b : 1, 0, easeCrossfadeOut(progress));\n }\n else if (isOnlyMember) {\n target.opacity = mix((_c = follow.opacity) !== null && _c !== void 0 ? _c : 1, (_d = lead.opacity) !== null && _d !== void 0 ? _d : 1, progress);\n }\n /**\n * Mix border radius\n */\n for (var i = 0; i < numBorders; i++) {\n var borderLabel = \"border\".concat(borders[i], \"Radius\");\n var followRadius = getRadius(follow, borderLabel);\n var leadRadius = getRadius(lead, borderLabel);\n if (followRadius === undefined && leadRadius === undefined)\n continue;\n followRadius || (followRadius = 0);\n leadRadius || (leadRadius = 0);\n var canMix = followRadius === 0 ||\n leadRadius === 0 ||\n isPx(followRadius) === isPx(leadRadius);\n if (canMix) {\n target[borderLabel] = Math.max(mix(asNumber(followRadius), asNumber(leadRadius), progress), 0);\n if (percent.test(leadRadius) || percent.test(followRadius)) {\n target[borderLabel] += \"%\";\n }\n }\n else {\n target[borderLabel] = leadRadius;\n }\n }\n /**\n * Mix rotation\n */\n if (follow.rotate || lead.rotate) {\n target.rotate = mix(follow.rotate || 0, lead.rotate || 0, progress);\n }\n}\nfunction getRadius(values, radiusName) {\n var _a;\n return (_a = values[radiusName]) !== null && _a !== void 0 ? _a : values.borderRadius;\n}\n// /**\n// * We only want to mix the background color if there's a follow element\n// * that we're not crossfading opacity between. For instance with switch\n// * AnimateSharedLayout animations, this helps the illusion of a continuous\n// * element being animated but also cuts down on the number of paints triggered\n// * for elements where opacity is doing that work for us.\n// */\n// if (\n// !hasFollowElement &&\n// latestLeadValues.backgroundColor &&\n// latestFollowValues.backgroundColor\n// ) {\n// /**\n// * This isn't ideal performance-wise as mixColor is creating a new function every frame.\n// * We could probably create a mixer that runs at the start of the animation but\n// * the idea behind the crossfader is that it runs dynamically between two potentially\n// * changing targets (ie opacity or borderRadius may be animating independently via variants)\n// */\n// leadState.backgroundColor = followState.backgroundColor = mixColor(\n// latestFollowValues.backgroundColor as string,\n// latestLeadValues.backgroundColor as string\n// )(p)\n// }\nvar easeCrossfadeIn = compress(0, 0.5, circOut);\nvar easeCrossfadeOut = compress(0.5, 0.95, linear);\nfunction compress(min, max, easing) {\n return function (p) {\n // Could replace ifs with clamp\n if (p < min)\n return 0;\n if (p > max)\n return 1;\n return easing(progress(min, max, p));\n };\n}\n\nexport { mixValues };\n","/**\n * Reset an axis to the provided origin box.\n *\n * This is a mutative operation.\n */\nfunction copyAxisInto(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 copyBoxInto(box, originBox) {\n copyAxisInto(box.x, originBox.x);\n copyAxisInto(box.y, originBox.y);\n}\n\nexport { copyAxisInto, copyBoxInto };\n","import { __read } from 'tslib';\nimport { mix } from 'popmotion';\nimport { percent } from 'style-value-types';\nimport { scalePoint } from './delta-apply.mjs';\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, originAxis, sourceAxis) {\n if (translate === void 0) { translate = 0; }\n if (scale === void 0) { scale = 1; }\n if (origin === void 0) { origin = 0.5; }\n if (originAxis === void 0) { originAxis = axis; }\n if (sourceAxis === void 0) { sourceAxis = axis; }\n if (percent.test(translate)) {\n translate = parseFloat(translate);\n var relativeProgress = mix(sourceAxis.min, sourceAxis.max, translate / 100);\n translate = relativeProgress - sourceAxis.min;\n }\n if (typeof translate !== \"number\")\n return;\n var originPoint = mix(originAxis.min, originAxis.max, origin);\n if (axis === originAxis)\n originPoint -= 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, origin, sourceAxis) {\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, origin, sourceAxis);\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 * 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, originBox, sourceBox) {\n removeAxisTransforms(box.x, transforms, xKeys, originBox === null || originBox === void 0 ? void 0 : originBox.x, sourceBox === null || sourceBox === void 0 ? void 0 : sourceBox.x);\n removeAxisTransforms(box.y, transforms, yKeys, originBox === null || originBox === void 0 ? void 0 : originBox.y, sourceBox === null || sourceBox === void 0 ? void 0 : sourceBox.y);\n}\n\nexport { removeAxisDelta, removeAxisTransforms, removeBoxTransforms, removePointDelta };\n","function isAxisDeltaZero(delta) {\n return delta.translate === 0 && delta.scale === 1;\n}\nfunction isDeltaZero(delta) {\n return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);\n}\nfunction boxEquals(a, b) {\n return (a.x.min === b.x.min &&\n a.x.max === b.x.max &&\n a.y.min === b.y.min &&\n a.y.max === b.y.max);\n}\n\nexport { boxEquals, isDeltaZero };\n","import { addUniqueItem, removeItem } from '../../utils/array.mjs';\n\nvar NodeStack = /** @class */ (function () {\n function NodeStack() {\n this.members = [];\n }\n NodeStack.prototype.add = function (node) {\n addUniqueItem(this.members, node);\n node.scheduleRender();\n };\n NodeStack.prototype.remove = function (node) {\n removeItem(this.members, node);\n if (node === this.prevLead) {\n this.prevLead = undefined;\n }\n if (node === this.lead) {\n var prevLead = this.members[this.members.length - 1];\n if (prevLead) {\n this.promote(prevLead);\n }\n }\n };\n NodeStack.prototype.relegate = function (node) {\n var indexOfNode = this.members.findIndex(function (member) { return node === member; });\n if (indexOfNode === 0)\n return false;\n /**\n * Find the next projection node that is present\n */\n var prevLead;\n for (var i = indexOfNode; i >= 0; i--) {\n var member = this.members[i];\n if (member.isPresent !== false) {\n prevLead = member;\n break;\n }\n }\n if (prevLead) {\n this.promote(prevLead);\n return true;\n }\n else {\n return false;\n }\n };\n NodeStack.prototype.promote = function (node, preserveFollowOpacity) {\n var _a;\n var prevLead = this.lead;\n if (node === prevLead)\n return;\n this.prevLead = prevLead;\n this.lead = node;\n node.show();\n if (prevLead) {\n prevLead.instance && prevLead.scheduleRender();\n node.scheduleRender();\n node.resumeFrom = prevLead;\n if (preserveFollowOpacity) {\n node.resumeFrom.preserveOpacity = true;\n }\n if (prevLead.snapshot) {\n node.snapshot = prevLead.snapshot;\n node.snapshot.latestValues =\n prevLead.animationValues || prevLead.latestValues;\n node.snapshot.isShared = true;\n }\n if ((_a = node.root) === null || _a === void 0 ? void 0 : _a.isUpdating) {\n node.isLayoutDirty = true;\n }\n var crossfade = node.options.crossfade;\n if (crossfade === false) {\n prevLead.hide();\n }\n /**\n * TODO:\n * - Test border radius when previous node was deleted\n * - boxShadow mixing\n * - Shared between element A in scrolled container and element B (scroll stays the same or changes)\n * - Shared between element A in transformed container and element B (transform stays the same or changes)\n * - Shared between element A in scrolled page and element B (scroll stays the same or changes)\n * ---\n * - Crossfade opacity of root nodes\n * - layoutId changes after animation\n * - layoutId changes mid animation\n */\n }\n };\n NodeStack.prototype.exitAnimationComplete = function () {\n this.members.forEach(function (node) {\n var _a, _b, _c, _d, _e;\n (_b = (_a = node.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_e = (_c = node.resumingFrom) === null || _c === void 0 ? void 0 : (_d = _c.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d);\n });\n };\n NodeStack.prototype.scheduleRender = function () {\n this.members.forEach(function (node) {\n node.instance && node.scheduleRender(false);\n });\n };\n /**\n * Clear any leads that have been removed this render to prevent them from being\n * used in future animations and to prevent memory leaks\n */\n NodeStack.prototype.removeLeadSnapshot = function () {\n if (this.lead && this.lead.snapshot) {\n this.lead.snapshot = undefined;\n }\n };\n return NodeStack;\n}());\n\nexport { NodeStack };\n","var identityProjection = \"translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)\";\nfunction buildProjectionTransform(delta, treeScale, latestTransform) {\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 = delta.x.translate / treeScale.x;\n var yTranslate = delta.y.translate / treeScale.y;\n var transform = \"translate3d(\".concat(xTranslate, \"px, \").concat(yTranslate, \"px, 0) \");\n /**\n * Apply scale correction for the tree transform.\n * This will apply scale to the screen-orientated axes.\n */\n transform += \"scale(\".concat(1 / treeScale.x, \", \").concat(1 / treeScale.y, \") \");\n if (latestTransform) {\n var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;\n if (rotate)\n transform += \"rotate(\".concat(rotate, \"deg) \");\n if (rotateX)\n transform += \"rotateX(\".concat(rotateX, \"deg) \");\n if (rotateY)\n transform += \"rotateY(\".concat(rotateY, \"deg) \");\n }\n /**\n * Apply scale to match the size of the element to the size we want it.\n * This will apply scale to the element-orientated axes.\n */\n var elementScaleX = delta.x.scale * treeScale.x;\n var elementScaleY = delta.y.scale * treeScale.y;\n transform += \"scale(\".concat(elementScaleX, \", \").concat(elementScaleY, \")\");\n return transform === identityProjection ? \"none\" : transform;\n}\n\nexport { buildProjectionTransform, identityProjection };\n","var compareByDepth = function (a, b) {\n return a.depth - b.depth;\n};\n\nexport { compareByDepth };\n","import { addUniqueItem, removeItem } from '../../utils/array.mjs';\nimport { compareByDepth } from './compare-by-depth.mjs';\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 { __spreadArray, __read, __assign } from 'tslib';\nimport sync, { cancelSync, flushSync } from 'framesync';\nimport { mix } from 'popmotion';\nimport { animate } from '../../animation/animate.mjs';\nimport { SubscriptionManager } from '../../utils/subscription-manager.mjs';\nimport { mixValues } from '../animation/mix-values.mjs';\nimport { copyBoxInto } from '../geometry/copy.mjs';\nimport { translateAxis, transformBox, applyBoxDelta, applyTreeDeltas } from '../geometry/delta-apply.mjs';\nimport { calcRelativePosition, calcRelativeBox, calcBoxDelta, calcLength } from '../geometry/delta-calc.mjs';\nimport { removeBoxTransforms } from '../geometry/delta-remove.mjs';\nimport { createBox, createDelta } from '../geometry/models.mjs';\nimport { getValueTransition } from '../../animation/utils/transitions.mjs';\nimport { boxEquals, isDeltaZero } from '../geometry/utils.mjs';\nimport { NodeStack } from '../shared/stack.mjs';\nimport { scaleCorrectors } from '../styles/scale-correction.mjs';\nimport { buildProjectionTransform } from '../styles/transform.mjs';\nimport { eachAxis } from '../utils/each-axis.mjs';\nimport { hasTransform, hasScale } from '../utils/has-transform.mjs';\nimport { transformAxes } from '../../render/html/utils/transform.mjs';\nimport { FlatTree } from '../../render/utils/flat-tree.mjs';\nimport { resolveMotionValue } from '../../value/utils/resolve-motion-value.mjs';\nimport { globalProjectionState } from './state.mjs';\n\n/**\n * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1\n * which has a noticeable difference in spring animations\n */\nvar animationTarget = 1000;\nfunction createProjectionNode(_a) {\n var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, checkIsScrollRoot = _a.checkIsScrollRoot, resetTransform = _a.resetTransform;\n return /** @class */ (function () {\n function ProjectionNode(id, latestValues, parent) {\n var _this = this;\n if (latestValues === void 0) { latestValues = {}; }\n if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }\n /**\n * A Set containing all this component's children. This is used to iterate\n * through the children.\n *\n * TODO: This could be faster to iterate as a flat array stored on the root node.\n */\n this.children = new Set();\n /**\n * Options for the node. We use this to configure what kind of layout animations\n * we should perform (if any).\n */\n this.options = {};\n /**\n * We use this to detect when its safe to shut down part of a projection tree.\n * We have to keep projecting children for scale correction and relative projection\n * until all their parents stop performing layout animations.\n */\n this.isTreeAnimating = false;\n this.isAnimationBlocked = false;\n /**\n * Flag to true if we think this layout has been changed. We can't always know this,\n * currently we set it to true every time a component renders, or if it has a layoutDependency\n * if that has changed between renders. Additionally, components can be grouped by LayoutGroup\n * and if one node is dirtied, they all are.\n */\n this.isLayoutDirty = false;\n /**\n * Block layout updates for instant layout transitions throughout the tree.\n */\n this.updateManuallyBlocked = false;\n this.updateBlockedByResize = false;\n /**\n * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`\n * call.\n */\n this.isUpdating = false;\n /**\n * If this is an SVG element we currently disable projection transforms\n */\n this.isSVG = false;\n /**\n * Flag to true (during promotion) if a node doing an instant layout transition needs to reset\n * its projection styles.\n */\n this.needsReset = false;\n /**\n * Flags whether this node should have its transform reset prior to measuring.\n */\n this.shouldResetTransform = false;\n /**\n * An object representing the calculated contextual/accumulated/tree scale.\n * This will be used to scale calculcated projection transforms, as these are\n * calculated in screen-space but need to be scaled for elements to actually\n * make it to their calculated destinations.\n *\n * TODO: Lazy-init\n */\n this.treeScale = { x: 1, y: 1 };\n /**\n *\n */\n this.eventHandlers = new Map();\n // Note: Currently only running on root node\n this.potentialNodes = new Map();\n this.checkUpdateFailed = function () {\n if (_this.isUpdating) {\n _this.isUpdating = false;\n _this.clearAllSnapshots();\n }\n };\n this.updateProjection = function () {\n _this.nodes.forEach(resolveTargetDelta);\n _this.nodes.forEach(calcProjection);\n };\n this.hasProjected = false;\n this.isVisible = true;\n this.animationProgress = 0;\n /**\n * Shared layout\n */\n // TODO Only running on root node\n this.sharedNodes = new Map();\n this.id = id;\n this.latestValues = latestValues;\n this.root = parent ? parent.root || parent : this;\n this.path = parent ? __spreadArray(__spreadArray([], __read(parent.path), false), [parent], false) : [];\n this.parent = parent;\n this.depth = parent ? parent.depth + 1 : 0;\n id && this.root.registerPotentialNode(id, this);\n for (var i = 0; i < this.path.length; i++) {\n this.path[i].shouldResetTransform = true;\n }\n if (this.root === this)\n this.nodes = new FlatTree();\n }\n ProjectionNode.prototype.addEventListener = function (name, handler) {\n if (!this.eventHandlers.has(name)) {\n this.eventHandlers.set(name, new SubscriptionManager());\n }\n return this.eventHandlers.get(name).add(handler);\n };\n ProjectionNode.prototype.notifyListeners = function (name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var subscriptionManager = this.eventHandlers.get(name);\n subscriptionManager === null || subscriptionManager === void 0 ? void 0 : subscriptionManager.notify.apply(subscriptionManager, __spreadArray([], __read(args), false));\n };\n ProjectionNode.prototype.hasListeners = function (name) {\n return this.eventHandlers.has(name);\n };\n ProjectionNode.prototype.registerPotentialNode = function (id, node) {\n this.potentialNodes.set(id, node);\n };\n /**\n * Lifecycles\n */\n ProjectionNode.prototype.mount = function (instance, isLayoutDirty) {\n var _this = this;\n var _a;\n if (isLayoutDirty === void 0) { isLayoutDirty = false; }\n if (this.instance)\n return;\n this.isSVG =\n instance instanceof SVGElement && instance.tagName !== \"svg\";\n this.instance = instance;\n var _b = this.options, layoutId = _b.layoutId, layout = _b.layout, visualElement = _b.visualElement;\n if (visualElement && !visualElement.getInstance()) {\n visualElement.mount(instance);\n }\n this.root.nodes.add(this);\n (_a = this.parent) === null || _a === void 0 ? void 0 : _a.children.add(this);\n this.id && this.root.potentialNodes.delete(this.id);\n if (isLayoutDirty && (layout || layoutId)) {\n this.isLayoutDirty = true;\n }\n if (attachResizeListener) {\n var unblockTimeout_1;\n var resizeUnblockUpdate_1 = function () {\n return (_this.root.updateBlockedByResize = false);\n };\n attachResizeListener(instance, function () {\n _this.root.updateBlockedByResize = true;\n clearTimeout(unblockTimeout_1);\n unblockTimeout_1 = window.setTimeout(resizeUnblockUpdate_1, 250);\n if (globalProjectionState.hasAnimatedSinceResize) {\n globalProjectionState.hasAnimatedSinceResize = false;\n _this.nodes.forEach(finishAnimation);\n }\n });\n }\n if (layoutId) {\n this.root.registerSharedNode(layoutId, this);\n }\n // Only register the handler if it requires layout animation\n if (this.options.animate !== false &&\n visualElement &&\n (layoutId || layout)) {\n this.addEventListener(\"didUpdate\", function (_a) {\n var _b, _c, _d, _e, _f;\n var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged, hasRelativeTargetChanged = _a.hasRelativeTargetChanged, newLayout = _a.layout;\n if (_this.isTreeAnimationBlocked()) {\n _this.target = undefined;\n _this.relativeTarget = undefined;\n return;\n }\n // TODO: Check here if an animation exists\n var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;\n var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;\n /**\n * The target layout of the element might stay the same,\n * but its position relative to its parent has changed.\n */\n var targetChanged = !_this.targetLayout ||\n !boxEquals(_this.targetLayout, newLayout) ||\n hasRelativeTargetChanged;\n /**\n * If the layout hasn't seemed to have changed, it might be that the\n * element is visually in the same place in the document but its position\n * relative to its parent has indeed changed. So here we check for that.\n */\n var hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;\n if (((_d = _this.resumeFrom) === null || _d === void 0 ? void 0 : _d.instance) ||\n hasOnlyRelativeTargetChanged ||\n (hasLayoutChanged &&\n (targetChanged || !_this.currentAnimation))) {\n if (_this.resumeFrom) {\n _this.resumingFrom = _this.resumeFrom;\n _this.resumingFrom.resumingFrom = undefined;\n }\n _this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);\n var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, \"layout\")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });\n if (visualElement.shouldReduceMotion) {\n animationOptions.delay = 0;\n animationOptions.type = false;\n }\n _this.startAnimation(animationOptions);\n }\n else {\n /**\n * If the layout hasn't changed and we have an animation that hasn't started yet,\n * finish it immediately. Otherwise it will be animating from a location\n * that was probably never commited to screen and look like a jumpy box.\n */\n if (!hasLayoutChanged &&\n _this.animationProgress === 0) {\n _this.finishAnimation();\n }\n _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));\n }\n _this.targetLayout = newLayout;\n });\n }\n };\n ProjectionNode.prototype.unmount = function () {\n var _a, _b;\n this.options.layoutId && this.willUpdate();\n this.root.nodes.remove(this);\n (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.remove(this);\n (_b = this.parent) === null || _b === void 0 ? void 0 : _b.children.delete(this);\n this.instance = undefined;\n cancelSync.preRender(this.updateProjection);\n };\n // only on the root\n ProjectionNode.prototype.blockUpdate = function () {\n this.updateManuallyBlocked = true;\n };\n ProjectionNode.prototype.unblockUpdate = function () {\n this.updateManuallyBlocked = false;\n };\n ProjectionNode.prototype.isUpdateBlocked = function () {\n return this.updateManuallyBlocked || this.updateBlockedByResize;\n };\n ProjectionNode.prototype.isTreeAnimationBlocked = function () {\n var _a;\n return (this.isAnimationBlocked ||\n ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimationBlocked()) ||\n false);\n };\n // Note: currently only running on root node\n ProjectionNode.prototype.startUpdate = function () {\n var _a;\n if (this.isUpdateBlocked())\n return;\n this.isUpdating = true;\n (_a = this.nodes) === null || _a === void 0 ? void 0 : _a.forEach(resetRotation);\n };\n ProjectionNode.prototype.willUpdate = function (shouldNotifyListeners) {\n var _a, _b, _c;\n if (shouldNotifyListeners === void 0) { shouldNotifyListeners = true; }\n if (this.root.isUpdateBlocked()) {\n (_b = (_a = this.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);\n return;\n }\n !this.root.isUpdating && this.root.startUpdate();\n if (this.isLayoutDirty)\n return;\n this.isLayoutDirty = true;\n for (var i = 0; i < this.path.length; i++) {\n var node = this.path[i];\n node.shouldResetTransform = true;\n /**\n * TODO: Check we haven't updated the scroll\n * since the last didUpdate\n */\n node.updateScroll();\n }\n var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;\n if (layoutId === undefined && !layout)\n return;\n var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;\n this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, \"\");\n this.updateSnapshot();\n shouldNotifyListeners && this.notifyListeners(\"willUpdate\");\n };\n // Note: Currently only running on root node\n ProjectionNode.prototype.didUpdate = function () {\n var updateWasBlocked = this.isUpdateBlocked();\n // When doing an instant transition, we skip the layout update,\n // but should still clean up the measurements so that the next\n // snapshot could be taken correctly.\n if (updateWasBlocked) {\n this.unblockUpdate();\n this.clearAllSnapshots();\n this.nodes.forEach(clearMeasurements);\n return;\n }\n if (!this.isUpdating)\n return;\n this.isUpdating = false;\n /**\n * Search for and mount newly-added projection elements.\n *\n * TODO: Every time a new component is rendered we could search up the tree for\n * the closest mounted node and query from there rather than document.\n */\n if (this.potentialNodes.size) {\n this.potentialNodes.forEach(mountNodeEarly);\n this.potentialNodes.clear();\n }\n /**\n * Write\n */\n this.nodes.forEach(resetTransformStyle);\n /**\n * Read ==================\n */\n // Update layout measurements of updated children\n this.nodes.forEach(updateLayout);\n /**\n * Write\n */\n // Notify listeners that the layout is updated\n this.nodes.forEach(notifyLayoutUpdate);\n this.clearAllSnapshots();\n // Flush any scheduled updates\n flushSync.update();\n flushSync.preRender();\n flushSync.render();\n };\n ProjectionNode.prototype.clearAllSnapshots = function () {\n this.nodes.forEach(clearSnapshot);\n this.sharedNodes.forEach(removeLeadSnapshots);\n };\n ProjectionNode.prototype.scheduleUpdateProjection = function () {\n sync.preRender(this.updateProjection, false, true);\n };\n ProjectionNode.prototype.scheduleCheckAfterUnmount = function () {\n var _this = this;\n /**\n * If the unmounting node is in a layoutGroup and did trigger a willUpdate,\n * we manually call didUpdate to give a chance to the siblings to animate.\n * Otherwise, cleanup all snapshots to prevents future nodes from reusing them.\n */\n sync.postRender(function () {\n if (_this.isLayoutDirty) {\n _this.root.didUpdate();\n }\n else {\n _this.root.checkUpdateFailed();\n }\n });\n };\n /**\n * Update measurements\n */\n ProjectionNode.prototype.updateSnapshot = function () {\n if (this.snapshot || !this.instance)\n return;\n var measured = this.measure();\n var layout = this.removeTransform(this.removeElementScroll(measured));\n roundBox(layout);\n this.snapshot = {\n measured: measured,\n layout: layout,\n latestValues: {},\n };\n };\n ProjectionNode.prototype.updateLayout = function () {\n var _a;\n if (!this.instance)\n return;\n // TODO: Incorporate into a forwarded scroll offset\n this.updateScroll();\n if (!(this.options.alwaysMeasureLayout && this.isLead()) &&\n !this.isLayoutDirty) {\n return;\n }\n /**\n * When a node is mounted, it simply resumes from the prevLead's\n * snapshot instead of taking a new one, but the ancestors scroll\n * might have updated while the prevLead is unmounted. We need to\n * update the scroll again to make sure the layout we measure is\n * up to date.\n */\n if (this.resumeFrom && !this.resumeFrom.instance) {\n for (var i = 0; i < this.path.length; i++) {\n var node = this.path[i];\n node.updateScroll();\n }\n }\n var measured = this.measure();\n roundBox(measured);\n var prevLayout = this.layout;\n this.layout = {\n measured: measured,\n actual: this.removeElementScroll(measured),\n };\n this.layoutCorrected = createBox();\n this.isLayoutDirty = false;\n this.projectionDelta = undefined;\n this.notifyListeners(\"measure\", this.layout.actual);\n (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.notifyLayoutMeasure(this.layout.actual, prevLayout === null || prevLayout === void 0 ? void 0 : prevLayout.actual);\n };\n ProjectionNode.prototype.updateScroll = function () {\n if (this.options.layoutScroll && this.instance) {\n this.isScrollRoot = checkIsScrollRoot(this.instance);\n this.scroll = measureScroll(this.instance);\n }\n };\n ProjectionNode.prototype.resetTransform = function () {\n var _a;\n if (!resetTransform)\n return;\n var isResetRequested = this.isLayoutDirty || this.shouldResetTransform;\n var hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);\n var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;\n var transformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, \"\");\n var transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;\n if (isResetRequested &&\n (hasProjection ||\n hasTransform(this.latestValues) ||\n transformTemplateHasChanged)) {\n resetTransform(this.instance, transformTemplateValue);\n this.shouldResetTransform = false;\n this.scheduleRender();\n }\n };\n ProjectionNode.prototype.measure = function () {\n var visualElement = this.options.visualElement;\n if (!visualElement)\n return createBox();\n var box = visualElement.measureViewportBox();\n // Remove viewport scroll to give page-relative coordinates\n var scroll = this.root.scroll;\n if (scroll) {\n translateAxis(box.x, scroll.x);\n translateAxis(box.y, scroll.y);\n }\n return box;\n };\n ProjectionNode.prototype.removeElementScroll = function (box) {\n var boxWithoutScroll = createBox();\n copyBoxInto(boxWithoutScroll, box);\n /**\n * Performance TODO: Keep a cumulative scroll offset down the tree\n * rather than loop back up the path.\n */\n for (var i = 0; i < this.path.length; i++) {\n var node = this.path[i];\n var scroll_1 = node.scroll, options = node.options, isScrollRoot = node.isScrollRoot;\n if (node !== this.root && scroll_1 && options.layoutScroll) {\n /**\n * If this is a new scroll root, we want to remove all previous scrolls\n * from the viewport box.\n */\n if (isScrollRoot) {\n copyBoxInto(boxWithoutScroll, box);\n var rootScroll = this.root.scroll;\n /**\n * Undo the application of page scroll that was originally added\n * to the measured bounding box.\n */\n if (rootScroll) {\n translateAxis(boxWithoutScroll.x, -rootScroll.x);\n translateAxis(boxWithoutScroll.y, -rootScroll.y);\n }\n }\n translateAxis(boxWithoutScroll.x, scroll_1.x);\n translateAxis(boxWithoutScroll.y, scroll_1.y);\n }\n }\n return boxWithoutScroll;\n };\n ProjectionNode.prototype.applyTransform = function (box, transformOnly) {\n if (transformOnly === void 0) { transformOnly = false; }\n var withTransforms = createBox();\n copyBoxInto(withTransforms, box);\n for (var i = 0; i < this.path.length; i++) {\n var node = this.path[i];\n if (!transformOnly &&\n node.options.layoutScroll &&\n node.scroll &&\n node !== node.root) {\n transformBox(withTransforms, {\n x: -node.scroll.x,\n y: -node.scroll.y,\n });\n }\n if (!hasTransform(node.latestValues))\n continue;\n transformBox(withTransforms, node.latestValues);\n }\n if (hasTransform(this.latestValues)) {\n transformBox(withTransforms, this.latestValues);\n }\n return withTransforms;\n };\n ProjectionNode.prototype.removeTransform = function (box) {\n var _a;\n var boxWithoutTransform = createBox();\n copyBoxInto(boxWithoutTransform, box);\n for (var i = 0; i < this.path.length; i++) {\n var node = this.path[i];\n if (!node.instance)\n continue;\n if (!hasTransform(node.latestValues))\n continue;\n hasScale(node.latestValues) && node.updateSnapshot();\n var sourceBox = createBox();\n var nodeBox = node.measure();\n copyBoxInto(sourceBox, nodeBox);\n removeBoxTransforms(boxWithoutTransform, node.latestValues, (_a = node.snapshot) === null || _a === void 0 ? void 0 : _a.layout, sourceBox);\n }\n if (hasTransform(this.latestValues)) {\n removeBoxTransforms(boxWithoutTransform, this.latestValues);\n }\n return boxWithoutTransform;\n };\n /**\n *\n */\n ProjectionNode.prototype.setTargetDelta = function (delta) {\n this.targetDelta = delta;\n this.root.scheduleUpdateProjection();\n };\n ProjectionNode.prototype.setOptions = function (options) {\n var _a;\n this.options = __assign(__assign(__assign({}, this.options), options), { crossfade: (_a = options.crossfade) !== null && _a !== void 0 ? _a : true });\n };\n ProjectionNode.prototype.clearMeasurements = function () {\n this.scroll = undefined;\n this.layout = undefined;\n this.snapshot = undefined;\n this.prevTransformTemplateValue = undefined;\n this.targetDelta = undefined;\n this.target = undefined;\n this.isLayoutDirty = false;\n };\n /**\n * Frame calculations\n */\n ProjectionNode.prototype.resolveTargetDelta = function () {\n var _a;\n var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;\n /**\n * If we have no layout, we can't perform projection, so early return\n */\n if (!this.layout || !(layout || layoutId))\n return;\n /**\n * If we don't have a targetDelta but do have a layout, we can attempt to resolve\n * a relativeParent. This will allow a component to perform scale correction\n * even if no animation has started.\n */\n // TODO If this is unsuccessful this currently happens every frame\n if (!this.targetDelta && !this.relativeTarget) {\n // TODO: This is a semi-repetition of further down this function, make DRY\n this.relativeParent = this.getClosestProjectingParent();\n if (this.relativeParent && this.relativeParent.layout) {\n this.relativeTarget = createBox();\n this.relativeTargetOrigin = createBox();\n calcRelativePosition(this.relativeTargetOrigin, this.layout.actual, this.relativeParent.layout.actual);\n copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);\n }\n }\n /**\n * If we have no relative target or no target delta our target isn't valid\n * for this frame.\n */\n if (!this.relativeTarget && !this.targetDelta)\n return;\n /**\n * Lazy-init target data structure\n */\n if (!this.target) {\n this.target = createBox();\n this.targetWithTransforms = createBox();\n }\n /**\n * If we've got a relative box for this component, resolve it into a target relative to the parent.\n */\n if (this.relativeTarget &&\n this.relativeTargetOrigin &&\n ((_a = this.relativeParent) === null || _a === void 0 ? void 0 : _a.target)) {\n calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);\n /**\n * If we've only got a targetDelta, resolve it into a target\n */\n }\n else if (this.targetDelta) {\n if (Boolean(this.resumingFrom)) {\n // TODO: This is creating a new object every frame\n this.target = this.applyTransform(this.layout.actual);\n }\n else {\n copyBoxInto(this.target, this.layout.actual);\n }\n applyBoxDelta(this.target, this.targetDelta);\n }\n else {\n /**\n * If no target, use own layout as target\n */\n copyBoxInto(this.target, this.layout.actual);\n }\n /**\n * If we've been told to attempt to resolve a relative target, do so.\n */\n if (this.attemptToResolveRelativeTarget) {\n this.attemptToResolveRelativeTarget = false;\n this.relativeParent = this.getClosestProjectingParent();\n if (this.relativeParent &&\n Boolean(this.relativeParent.resumingFrom) ===\n Boolean(this.resumingFrom) &&\n !this.relativeParent.options.layoutScroll &&\n this.relativeParent.target) {\n this.relativeTarget = createBox();\n this.relativeTargetOrigin = createBox();\n calcRelativePosition(this.relativeTargetOrigin, this.target, this.relativeParent.target);\n copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);\n }\n }\n };\n ProjectionNode.prototype.getClosestProjectingParent = function () {\n if (!this.parent || hasTransform(this.parent.latestValues))\n return undefined;\n if ((this.parent.relativeTarget || this.parent.targetDelta) &&\n this.parent.layout) {\n return this.parent;\n }\n else {\n return this.parent.getClosestProjectingParent();\n }\n };\n ProjectionNode.prototype.calcProjection = function () {\n var _a;\n var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;\n /**\n * If this section of the tree isn't animating we can\n * delete our target sources for the following frame.\n */\n this.isTreeAnimating = Boolean(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimating) ||\n this.currentAnimation ||\n this.pendingAnimation);\n if (!this.isTreeAnimating) {\n this.targetDelta = this.relativeTarget = undefined;\n }\n if (!this.layout || !(layout || layoutId))\n return;\n var lead = this.getLead();\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 copyBoxInto(this.layoutCorrected, this.layout.actual);\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(this.layoutCorrected, this.treeScale, this.path, Boolean(this.resumingFrom) || this !== lead);\n var target = lead.target;\n if (!target)\n return;\n if (!this.projectionDelta) {\n this.projectionDelta = createDelta();\n this.projectionDeltaWithTransform = createDelta();\n }\n var prevTreeScaleX = this.treeScale.x;\n var prevTreeScaleY = this.treeScale.y;\n var prevProjectionTransform = this.projectionTransform;\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 calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);\n this.projectionTransform = buildProjectionTransform(this.projectionDelta, this.treeScale);\n if (this.projectionTransform !== prevProjectionTransform ||\n this.treeScale.x !== prevTreeScaleX ||\n this.treeScale.y !== prevTreeScaleY) {\n this.hasProjected = true;\n this.scheduleRender();\n this.notifyListeners(\"projectionUpdate\", target);\n }\n };\n ProjectionNode.prototype.hide = function () {\n this.isVisible = false;\n // TODO: Schedule render\n };\n ProjectionNode.prototype.show = function () {\n this.isVisible = true;\n // TODO: Schedule render\n };\n ProjectionNode.prototype.scheduleRender = function (notifyAll) {\n var _a, _b, _c;\n if (notifyAll === void 0) { notifyAll = true; }\n (_b = (_a = this.options).scheduleRender) === null || _b === void 0 ? void 0 : _b.call(_a);\n notifyAll && ((_c = this.getStack()) === null || _c === void 0 ? void 0 : _c.scheduleRender());\n if (this.resumingFrom && !this.resumingFrom.instance) {\n this.resumingFrom = undefined;\n }\n };\n ProjectionNode.prototype.setAnimationOrigin = function (delta, hasOnlyRelativeTargetChanged) {\n var _this = this;\n var _a;\n if (hasOnlyRelativeTargetChanged === void 0) { hasOnlyRelativeTargetChanged = false; }\n var snapshot = this.snapshot;\n var snapshotLatestValues = (snapshot === null || snapshot === void 0 ? void 0 : snapshot.latestValues) || {};\n var mixedValues = __assign({}, this.latestValues);\n var targetDelta = createDelta();\n this.relativeTarget = this.relativeTargetOrigin = undefined;\n this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;\n var relativeLayout = createBox();\n var isSharedLayoutAnimation = snapshot === null || snapshot === void 0 ? void 0 : snapshot.isShared;\n var isOnlyMember = (((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.members.length) || 0) <= 1;\n var shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&\n !isOnlyMember &&\n this.options.crossfade === true &&\n !this.path.some(hasOpacityCrossfade));\n this.animationProgress = 0;\n this.mixTargetDelta = function (latest) {\n var _a;\n var progress = latest / 1000;\n mixAxisDelta(targetDelta.x, delta.x, progress);\n mixAxisDelta(targetDelta.y, delta.y, progress);\n _this.setTargetDelta(targetDelta);\n if (_this.relativeTarget &&\n _this.relativeTargetOrigin &&\n _this.layout &&\n ((_a = _this.relativeParent) === null || _a === void 0 ? void 0 : _a.layout)) {\n calcRelativePosition(relativeLayout, _this.layout.actual, _this.relativeParent.layout.actual);\n mixBox(_this.relativeTarget, _this.relativeTargetOrigin, relativeLayout, progress);\n }\n if (isSharedLayoutAnimation) {\n _this.animationValues = mixedValues;\n mixValues(mixedValues, snapshotLatestValues, _this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);\n }\n _this.root.scheduleUpdateProjection();\n _this.scheduleRender();\n _this.animationProgress = progress;\n };\n this.mixTargetDelta(0);\n };\n ProjectionNode.prototype.startAnimation = function (options) {\n var _this = this;\n var _a, _b;\n this.notifyListeners(\"animationStart\");\n (_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();\n if (this.resumingFrom) {\n (_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();\n }\n if (this.pendingAnimation) {\n cancelSync.update(this.pendingAnimation);\n this.pendingAnimation = undefined;\n }\n /**\n * Start the animation in the next frame to have a frame with progress 0,\n * where the target is the same as when the animation started, so we can\n * calculate the relative positions correctly for instant transitions.\n */\n this.pendingAnimation = sync.update(function () {\n globalProjectionState.hasAnimatedSinceResize = true;\n _this.currentAnimation = animate(0, animationTarget, __assign(__assign({}, options), { onUpdate: function (latest) {\n var _a;\n _this.mixTargetDelta(latest);\n (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, latest);\n }, onComplete: function () {\n var _a;\n (_a = options.onComplete) === null || _a === void 0 ? void 0 : _a.call(options);\n _this.completeAnimation();\n } }));\n if (_this.resumingFrom) {\n _this.resumingFrom.currentAnimation = _this.currentAnimation;\n }\n _this.pendingAnimation = undefined;\n });\n };\n ProjectionNode.prototype.completeAnimation = function () {\n var _a;\n if (this.resumingFrom) {\n this.resumingFrom.currentAnimation = undefined;\n this.resumingFrom.preserveOpacity = undefined;\n }\n (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.exitAnimationComplete();\n this.resumingFrom =\n this.currentAnimation =\n this.animationValues =\n undefined;\n this.notifyListeners(\"animationComplete\");\n };\n ProjectionNode.prototype.finishAnimation = function () {\n var _a;\n if (this.currentAnimation) {\n (_a = this.mixTargetDelta) === null || _a === void 0 ? void 0 : _a.call(this, animationTarget);\n this.currentAnimation.stop();\n }\n this.completeAnimation();\n };\n ProjectionNode.prototype.applyTransformsToTarget = function () {\n var _a = this.getLead(), targetWithTransforms = _a.targetWithTransforms, target = _a.target, layout = _a.layout, latestValues = _a.latestValues;\n if (!targetWithTransforms || !target || !layout)\n return;\n copyBoxInto(targetWithTransforms, target);\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 transformBox(targetWithTransforms, latestValues);\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 calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);\n };\n ProjectionNode.prototype.registerSharedNode = function (layoutId, node) {\n var _a, _b, _c;\n if (!this.sharedNodes.has(layoutId)) {\n this.sharedNodes.set(layoutId, new NodeStack());\n }\n var stack = this.sharedNodes.get(layoutId);\n stack.add(node);\n node.promote({\n transition: (_a = node.options.initialPromotionConfig) === null || _a === void 0 ? void 0 : _a.transition,\n preserveFollowOpacity: (_c = (_b = node.options.initialPromotionConfig) === null || _b === void 0 ? void 0 : _b.shouldPreserveFollowOpacity) === null || _c === void 0 ? void 0 : _c.call(_b, node),\n });\n };\n ProjectionNode.prototype.isLead = function () {\n var stack = this.getStack();\n return stack ? stack.lead === this : true;\n };\n ProjectionNode.prototype.getLead = function () {\n var _a;\n var layoutId = this.options.layoutId;\n return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;\n };\n ProjectionNode.prototype.getPrevLead = function () {\n var _a;\n var layoutId = this.options.layoutId;\n return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;\n };\n ProjectionNode.prototype.getStack = function () {\n var layoutId = this.options.layoutId;\n if (layoutId)\n return this.root.sharedNodes.get(layoutId);\n };\n ProjectionNode.prototype.promote = function (_a) {\n var _b = _a === void 0 ? {} : _a, needsReset = _b.needsReset, transition = _b.transition, preserveFollowOpacity = _b.preserveFollowOpacity;\n var stack = this.getStack();\n if (stack)\n stack.promote(this, preserveFollowOpacity);\n if (needsReset) {\n this.projectionDelta = undefined;\n this.needsReset = true;\n }\n if (transition)\n this.setOptions({ transition: transition });\n };\n ProjectionNode.prototype.relegate = function () {\n var stack = this.getStack();\n if (stack) {\n return stack.relegate(this);\n }\n else {\n return false;\n }\n };\n ProjectionNode.prototype.resetRotation = function () {\n var visualElement = this.options.visualElement;\n if (!visualElement)\n return;\n // If there's no detected rotation values, we can early return without a forced render.\n var hasRotate = false;\n // Keep a record of all the values we've reset\n var resetValues = {};\n // Check the rotate value of all axes and reset to 0\n for (var i = 0; i < transformAxes.length; i++) {\n var axis = transformAxes[i];\n var key = \"rotate\" + axis;\n // If this rotation doesn't exist as a motion value, then we don't\n // need to reset it\n if (!visualElement.getStaticValue(key)) {\n continue;\n }\n hasRotate = true;\n // Record the rotation and then temporarily set it to 0\n resetValues[key] = visualElement.getStaticValue(key);\n visualElement.setStaticValue(key, 0);\n }\n // If there's no rotation values, we don't need to do any more.\n if (!hasRotate)\n return;\n // Force a render of this element to apply the transform with all rotations\n // set to 0.\n visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();\n // Put back all the values we reset\n for (var key in resetValues) {\n visualElement.setStaticValue(key, resetValues[key]);\n }\n // Schedule a render for the next frame. This ensures we won't visually\n // see the element with the reset rotate value applied.\n visualElement.scheduleRender();\n };\n ProjectionNode.prototype.getProjectionStyles = function (styleProp) {\n var _a, _b, _c, _d, _e, _f;\n if (styleProp === void 0) { styleProp = {}; }\n // TODO: Return lifecycle-persistent object\n var styles = {};\n if (!this.instance || this.isSVG)\n return styles;\n if (!this.isVisible) {\n return { visibility: \"hidden\" };\n }\n else {\n styles.visibility = \"\";\n }\n var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;\n if (this.needsReset) {\n this.needsReset = false;\n styles.opacity = \"\";\n styles.pointerEvents =\n resolveMotionValue(styleProp.pointerEvents) || \"\";\n styles.transform = transformTemplate\n ? transformTemplate(this.latestValues, \"\")\n : \"none\";\n return styles;\n }\n var lead = this.getLead();\n if (!this.projectionDelta || !this.layout || !lead.target) {\n var emptyStyles = {};\n if (this.options.layoutId) {\n emptyStyles.opacity = (_b = this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1;\n emptyStyles.pointerEvents =\n resolveMotionValue(styleProp.pointerEvents) || \"\";\n }\n if (this.hasProjected && !hasTransform(this.latestValues)) {\n emptyStyles.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\";\n this.hasProjected = false;\n }\n return emptyStyles;\n }\n var valuesToRender = lead.animationValues || lead.latestValues;\n this.applyTransformsToTarget();\n styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);\n if (transformTemplate) {\n styles.transform = transformTemplate(valuesToRender, styles.transform);\n }\n var _g = this.projectionDelta, x = _g.x, y = _g.y;\n styles.transformOrigin = \"\".concat(x.origin * 100, \"% \").concat(y.origin * 100, \"% 0\");\n if (lead.animationValues) {\n /**\n * If the lead component is animating, assign this either the entering/leaving\n * opacity\n */\n styles.opacity =\n lead === this\n ? (_d = (_c = valuesToRender.opacity) !== null && _c !== void 0 ? _c : this.latestValues.opacity) !== null && _d !== void 0 ? _d : 1\n : this.preserveOpacity\n ? this.latestValues.opacity\n : valuesToRender.opacityExit;\n }\n else {\n /**\n * Or we're not animating at all, set the lead component to its actual\n * opacity and other components to hidden.\n */\n styles.opacity =\n lead === this\n ? (_e = valuesToRender.opacity) !== null && _e !== void 0 ? _e : \"\"\n : (_f = valuesToRender.opacityExit) !== null && _f !== void 0 ? _f : 0;\n }\n /**\n * Apply scale correction\n */\n for (var key in scaleCorrectors) {\n if (valuesToRender[key] === undefined)\n continue;\n var _h = scaleCorrectors[key], correct = _h.correct, applyTo = _h.applyTo;\n var corrected = correct(valuesToRender[key], lead);\n if (applyTo) {\n var num = applyTo.length;\n for (var i = 0; i < num; i++) {\n styles[applyTo[i]] = corrected;\n }\n }\n else {\n styles[key] = corrected;\n }\n }\n /**\n * Disable pointer events on follow components. This is to ensure\n * that if a follow component covers a lead component it doesn't block\n * pointer events on the lead.\n */\n if (this.options.layoutId) {\n styles.pointerEvents =\n lead === this\n ? resolveMotionValue(styleProp.pointerEvents) || \"\"\n : \"none\";\n }\n return styles;\n };\n ProjectionNode.prototype.clearSnapshot = function () {\n this.resumeFrom = this.snapshot = undefined;\n };\n // Only run on root\n ProjectionNode.prototype.resetTree = function () {\n this.root.nodes.forEach(function (node) { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });\n this.root.nodes.forEach(clearMeasurements);\n this.root.sharedNodes.clear();\n };\n return ProjectionNode;\n }());\n}\nfunction updateLayout(node) {\n node.updateLayout();\n}\nfunction notifyLayoutUpdate(node) {\n var _a, _b, _c, _d;\n var snapshot = (_b = (_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) !== null && _b !== void 0 ? _b : node.snapshot;\n if (node.isLead() &&\n node.layout &&\n snapshot &&\n node.hasListeners(\"didUpdate\")) {\n var _e = node.layout, layout_1 = _e.actual, measuredLayout = _e.measured;\n // TODO Maybe we want to also resize the layout snapshot so we don't trigger\n // animations for instance if layout=\"size\" and an element has only changed position\n if (node.options.animationType === \"size\") {\n eachAxis(function (axis) {\n var axisSnapshot = snapshot.isShared\n ? snapshot.measured[axis]\n : snapshot.layout[axis];\n var length = calcLength(axisSnapshot);\n axisSnapshot.min = layout_1[axis].min;\n axisSnapshot.max = axisSnapshot.min + length;\n });\n }\n else if (node.options.animationType === \"position\") {\n eachAxis(function (axis) {\n var axisSnapshot = snapshot.isShared\n ? snapshot.measured[axis]\n : snapshot.layout[axis];\n var length = calcLength(layout_1[axis]);\n axisSnapshot.max = axisSnapshot.min + length;\n });\n }\n var layoutDelta = createDelta();\n calcBoxDelta(layoutDelta, layout_1, snapshot.layout);\n var visualDelta = createDelta();\n if (snapshot.isShared) {\n calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measured);\n }\n else {\n calcBoxDelta(visualDelta, layout_1, snapshot.layout);\n }\n var hasLayoutChanged = !isDeltaZero(layoutDelta);\n var hasRelativeTargetChanged = false;\n if (!node.resumeFrom) {\n node.relativeParent = node.getClosestProjectingParent();\n /**\n * If the relativeParent is itself resuming from a different element then\n * the relative snapshot is not relavent\n */\n if (node.relativeParent && !node.relativeParent.resumeFrom) {\n var _f = node.relativeParent, parentSnapshot = _f.snapshot, parentLayout = _f.layout;\n if (parentSnapshot && parentLayout) {\n var relativeSnapshot = createBox();\n calcRelativePosition(relativeSnapshot, snapshot.layout, parentSnapshot.layout);\n var relativeLayout = createBox();\n calcRelativePosition(relativeLayout, layout_1, parentLayout.actual);\n if (!boxEquals(relativeSnapshot, relativeLayout)) {\n hasRelativeTargetChanged = true;\n }\n }\n }\n }\n node.notifyListeners(\"didUpdate\", {\n layout: layout_1,\n snapshot: snapshot,\n delta: visualDelta,\n layoutDelta: layoutDelta,\n hasLayoutChanged: hasLayoutChanged,\n hasRelativeTargetChanged: hasRelativeTargetChanged,\n });\n }\n else if (node.isLead()) {\n (_d = (_c = node.options).onExitComplete) === null || _d === void 0 ? void 0 : _d.call(_c);\n }\n /**\n * Clearing transition\n * TODO: Investigate why this transition is being passed in as {type: false } from Framer\n * and why we need it at all\n */\n node.options.transition = undefined;\n}\nfunction clearSnapshot(node) {\n node.clearSnapshot();\n}\nfunction clearMeasurements(node) {\n node.clearMeasurements();\n}\nfunction resetTransformStyle(node) {\n var visualElement = node.options.visualElement;\n if (visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onBeforeLayoutMeasure) {\n visualElement.notifyBeforeLayoutMeasure();\n }\n node.resetTransform();\n}\nfunction finishAnimation(node) {\n node.finishAnimation();\n node.targetDelta = node.relativeTarget = node.target = undefined;\n}\nfunction resolveTargetDelta(node) {\n node.resolveTargetDelta();\n}\nfunction calcProjection(node) {\n node.calcProjection();\n}\nfunction resetRotation(node) {\n node.resetRotation();\n}\nfunction removeLeadSnapshots(stack) {\n stack.removeLeadSnapshot();\n}\nfunction mixAxisDelta(output, delta, p) {\n output.translate = mix(delta.translate, 0, p);\n output.scale = mix(delta.scale, 1, p);\n output.origin = delta.origin;\n output.originPoint = delta.originPoint;\n}\nfunction mixAxis(output, from, to, p) {\n output.min = mix(from.min, to.min, p);\n output.max = mix(from.max, to.max, p);\n}\nfunction mixBox(output, from, to, p) {\n mixAxis(output.x, from.x, to.x, p);\n mixAxis(output.y, from.y, to.y, p);\n}\nfunction hasOpacityCrossfade(node) {\n return (node.animationValues && node.animationValues.opacityExit !== undefined);\n}\nvar defaultLayoutTransition = {\n duration: 0.45,\n ease: [0.4, 0, 0.1, 1],\n};\nfunction mountNodeEarly(node, id) {\n /**\n * Rather than searching the DOM from document we can search the\n * path for the deepest mounted ancestor and search from there\n */\n var searchNode = node.root;\n for (var i = node.path.length - 1; i >= 0; i--) {\n if (Boolean(node.path[i].instance)) {\n searchNode = node.path[i];\n break;\n }\n }\n var searchElement = searchNode && searchNode !== node.root ? searchNode.instance : document;\n var element = searchElement.querySelector(\"[data-projection-id=\\\"\".concat(id, \"\\\"]\"));\n if (element)\n node.mount(element, true);\n}\nfunction roundAxis(axis) {\n axis.min = Math.round(axis.min);\n axis.max = Math.round(axis.max);\n}\nfunction roundBox(box) {\n roundAxis(box.x);\n roundAxis(box.y);\n}\n\nexport { createProjectionNode, mixAxis, mixAxisDelta, mixBox };\n","import { createProjectionNode } from './create-projection-node.mjs';\nimport { addDomEvent } from '../../events/use-dom-event.mjs';\n\nvar DocumentProjectionNode = createProjectionNode({\n attachResizeListener: function (ref, notify) { return addDomEvent(ref, \"resize\", notify); },\n measureScroll: function () { return ({\n x: document.documentElement.scrollLeft || document.body.scrollLeft,\n y: document.documentElement.scrollTop || document.body.scrollTop,\n }); },\n checkIsScrollRoot: function () { return true; },\n});\n\nexport { DocumentProjectionNode };\n","import { createProjectionNode } from './create-projection-node.mjs';\nimport { DocumentProjectionNode } from './DocumentProjectionNode.mjs';\n\nvar rootProjectionNode = {\n current: undefined,\n};\nvar HTMLProjectionNode = createProjectionNode({\n measureScroll: function (instance) { return ({\n x: instance.scrollLeft,\n y: instance.scrollTop,\n }); },\n defaultParent: function () {\n if (!rootProjectionNode.current) {\n var documentNode = new DocumentProjectionNode(0, {});\n documentNode.mount(window);\n documentNode.setOptions({ layoutScroll: true });\n rootProjectionNode.current = documentNode;\n }\n return rootProjectionNode.current;\n },\n resetTransform: function (instance, value) {\n instance.style.transform = value !== null && value !== void 0 ? value : \"none\";\n },\n checkIsScrollRoot: function (instance) {\n return Boolean(window.getComputedStyle(instance).position === \"fixed\");\n },\n});\n\nexport { HTMLProjectionNode, rootProjectionNode };\n","import { __assign } from 'tslib';\nimport { drag } from '../../motion/features/drag.mjs';\nimport { layoutFeatures } from '../../motion/features/layout/index.mjs';\nimport { domAnimation } from './features-animation.mjs';\nimport { HTMLProjectionNode } from '../../projection/node/HTMLProjectionNode.mjs';\n\n/**\n * @public\n */\nvar domMax = __assign(__assign(__assign(__assign({}, domAnimation), drag), layoutFeatures), { projectionNodeConstructor: HTMLProjectionNode });\n\nexport { domMax };\n"],"names":["animate","from","to","transition","value","stop","isAnimating","isPoint","point","hasOwnProperty","isPoint3D","distance1D","a","b","Math","abs","distance","xDelta","x","yDelta","y","zDelta","z","sqrt","pow","PanSession","event","handlers","_a","_this","this","transformPagePoint","startEvent","lastMoveEvent","lastMoveEventInfo","updatePoint","info","getPanInfo","history","isPanStarted","isDistancePastThreshold","offset","timestamp","push","onStart","onMove","handlePointerMove","transformPoint","buttons","handlePointerUp","update","end","onEnd","onSessionEnd","panInfo","touches","length","initialInfo","e","onSessionStart","removeListeners","pipe","window","prototype","updateHandlers","subtractPoint","delta","lastDevicePoint","startDevicePoint","velocity","getVelocity","timeDelta","i","timestampedPoint","lastPoint","time","currentVelocity","Infinity","calcLength","axis","max","min","isNear","target","maxDistance","calcAxisDelta","source","origin","originPoint","mix","scale","isNaN","translate","calcBoxDelta","originX","originY","calcRelativeAxis","relative","parent","calcRelativeAxisPosition","layout","calcRelativePosition","calcRelativeAxisConstraints","undefined","calcViewportAxisConstraints","layoutAxis","constraintsAxis","defaultElastic","resolveAxisElastic","dragElastic","minLabel","maxLabel","resolvePointElastic","label","createDelta","createBox","eachAxis","callback","elementDragControls","WeakMap","VisualElementDragControls","visualElement","openGlobalLock","isDragging","currentDirection","constraints","hasMutatedConstraints","elastic","start","originEvent","_c","snapToCursor","isPresent","panSession","stopAnimation","_b","getProps","drag","dragPropagation","onDragStart","resolveConstraints","projection","isAnimationBlocked","current","getAxisMotionValue","get","test","measuredAxis","actual","parseFloat","animationState","setActive","Drag","dragDirectionLock","onDirectionLock","onDrag","lockThreshold","direction","getCurrentDirection","updateAxis","syncRender","getTransformPagePoint","cancel","startAnimation","onDragEnd","_point","shouldDrag","axisValue","next","set","dragConstraints","prevConstraints","resolveRefConstraints","layoutBox","top","left","bottom","right","calcRelativeConstraints","resolveDragElastic","relativeConstraints","rebaseAxisConstraints","onMeasureDragConstraints","constraintsElement","constraintsBox","measure","root","measuredConstraints","calcViewportConstraints","userConstraints","dragMomentum","dragTransition","dragSnapToOrigin","onDragTransitionEnd","momentumAnimations","bounceStiffness","bounceDamping","inertia","type","timeConstant","restDelta","restSpeed","startAxisValueAnimation","Promise","all","then","dragKey","toUpperCase","getValue","initial","scalePositionWithinConstraints","boxProgress","sourceLength","targetLength","latest","progress","clamp","transformTemplate","getInstance","style","transform","updateScroll","updateLayout","addListeners","element","stopPointerListener","dragListener","measureDragConstraints","stopMeasureLayoutListener","addEventListener","stopResizeListener","hasLayoutChanged","motionValue","props","_d","_e","_f","pan","onPan","onPanStart","onPanEnd","onPanSessionStart","hasPanEvents","useRef","useContext","MotionConfigContext","useEffect","groupDragControls","dragControls","subscribe","pixelsToPercent","pixels","correctBorderRadius","correct","node","px","concat","varToken","correctBoxShadow","treeScale","projectionDelta","original","containsCSSVariables","includes","cssVariables","replace","match","shadow","complex","parse","template","createTransformer","xScale","yScale","averageScale","output","i_1","cssVariable","MeasureLayoutWithContext","_super","apply","arguments","componentDidMount","layoutGroup","switchLayoutGroup","layoutId","defaultScaleCorrectors","group","add","register","didUpdate","safeToRemove","setOptions","options","onExitComplete","hasEverUpdated","getSnapshotBeforeUpdate","prevProps","layoutDependency","willUpdate","promote","relegate","postRender","getStack","members","componentDidUpdate","currentAnimation","isLead","componentWillUnmount","promoteContext","scheduleCheckAfterUnmount","remove","deregister","render","borderRadius","applyTo","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","boxShadow","layoutFeatures","measureLayout","LayoutGroupContext","L","SwitchLayoutGroupContext","borders","numBorders","asNumber","isPx","getRadius","values","radiusName","easeCrossfadeIn","compress","easeCrossfadeOut","easing","p","copyAxisInto","originAxis","copyBoxInto","box","originBox","removePointDelta","boxScale","removeAxisTransforms","transforms","sourceAxis","key","scaleKey","originKey","removeAxisDelta","xKeys","yKeys","removeBoxTransforms","sourceBox","isAxisDeltaZero","isDeltaZero","boxEquals","NodeStack","scheduleRender","prevLead","lead","indexOfNode","findIndex","member","preserveFollowOpacity","show","instance","resumeFrom","preserveOpacity","snapshot","latestValues","animationValues","isShared","isUpdating","isLayoutDirty","crossfade","hide","exitAnimationComplete","forEach","call","resumingFrom","removeLeadSnapshot","identityProjection","buildProjectionTransform","latestTransform","xTranslate","yTranslate","rotate","rotateX","rotateY","elementScaleX","elementScaleY","compareByDepth","depth","FlatTree","children","isDirty","child","sort","createProjectionNode","attachResizeListener","defaultParent","measureScroll","checkIsScrollRoot","resetTransform","ProjectionNode","id","Set","isTreeAnimating","updateManuallyBlocked","updateBlockedByResize","isSVG","needsReset","shouldResetTransform","eventHandlers","Map","potentialNodes","checkUpdateFailed","clearAllSnapshots","updateProjection","nodes","resolveTargetDelta","calcProjection","hasProjected","isVisible","animationProgress","sharedNodes","path","registerPotentialNode","name","handler","has","notifyListeners","args","_i","subscriptionManager","notify","hasListeners","mount","SVGElement","tagName","delete","unblockTimeout_1","resizeUnblockUpdate_1","clearTimeout","setTimeout","hasAnimatedSinceResize","finishAnimation","registerSharedNode","hasRelativeTargetChanged","newLayout","isTreeAnimationBlocked","relativeTarget","layoutTransition","getDefaultTransition","defaultLayoutTransition","_g","onLayoutAnimationStart","onLayoutAnimationComplete","targetChanged","targetLayout","hasOnlyRelativeTargetChanged","setAnimationOrigin","animationOptions","onPlay","onComplete","shouldReduceMotion","delay","unmount","preRender","blockUpdate","unblockUpdate","isUpdateBlocked","startUpdate","resetRotation","shouldNotifyListeners","prevTransformTemplateValue","updateSnapshot","clearMeasurements","size","mountNodeEarly","clear","resetTransformStyle","notifyLayoutUpdate","clearSnapshot","removeLeadSnapshots","scheduleUpdateProjection","measured","removeTransform","removeElementScroll","roundBox","alwaysMeasureLayout","prevLayout","layoutCorrected","notifyLayoutMeasure","layoutScroll","isScrollRoot","scroll","isResetRequested","hasProjection","transformTemplateValue","transformTemplateHasChanged","measureViewportBox","boxWithoutScroll","scroll_1","rootScroll","applyTransform","transformOnly","withTransforms","boxWithoutTransform","setTargetDelta","targetDelta","relativeParent","getClosestProjectingParent","relativeTargetOrigin","targetWithTransforms","Boolean","attemptToResolveRelativeTarget","pendingAnimation","getLead","projectionDeltaWithTransform","prevTreeScaleX","prevTreeScaleY","prevProjectionTransform","projectionTransform","notifyAll","snapshotLatestValues","mixedValues","relativeLayout","isSharedLayoutAnimation","isOnlyMember","shouldCrossfadeOpacity","some","hasOpacityCrossfade","mixTargetDelta","mixAxisDelta","mixAxis","follow","opacity","opacityExit","borderLabel","followRadius","leadRadius","mixValues","onUpdate","completeAnimation","applyTransformsToTarget","initialPromotionConfig","shouldPreserveFollowOpacity","stack","getPrevLead","hasRotate","resetValues","getStaticValue","setStaticValue","getProjectionStyles","styleProp","styles","visibility","pointerEvents","emptyStyles","valuesToRender","transformOrigin","_h","corrected","num","resetTree","layout_1","measuredLayout","animationType","axisSnapshot","layoutDelta","visualDelta","parentSnapshot","parentLayout","relativeSnapshot","onBeforeLayoutMeasure","notifyBeforeLayoutMeasure","duration","ease","searchNode","document","querySelector","roundAxis","round","DocumentProjectionNode","ref","documentElement","scrollLeft","body","scrollTop","rootProjectionNode","HTMLProjectionNode","documentNode","getComputedStyle","position","domMax","projectionNodeConstructor"],"sourceRoot":""}