{"ast":null,"code":"import _assertThisInitialized from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js\";\nimport _toConsumableArray from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _objectWithoutProperties from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js\";\nimport _slicedToArray from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _objectDestructuringEmpty from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js\";\nimport _get from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/get.js\";\nimport _getPrototypeOf from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js\";\nimport _inherits from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/inherits.js\";\nimport _createSuper from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/createSuper.js\";\nimport _wrapNativeSuper from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js\";\nimport _regeneratorRuntime from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";\nimport _asyncToGenerator from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport _createClass from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/createClass.js\";\nimport _classCallCheck from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/classCallCheck.js\";\nimport _objectSpread from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";\nimport _createForOfIteratorHelper from \"C:/Users/user/Desktop/portreact/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js\";\nvar _excluded = [\"children\"],\n  _excluded2 = [\"container\"],\n  _excluded3 = [\"container\"],\n  _excluded4 = [\"to\", \"from\"],\n  _excluded5 = [\"root\", \"once\", \"amount\"],\n  _excluded6 = [\"children\"],\n  _excluded7 = [\"items\", \"children\"],\n  _excluded8 = [\"items\", \"children\"];\n// src/hooks/useChain.ts\nimport { each, useIsomorphicLayoutEffect } from \"@react-spring/shared\";\n\n// src/helpers.ts\nimport { is, toArray, eachProp, getFluidValue, isAnimatedString, Globals as G } from \"@react-spring/shared\";\nfunction callProp(value) {\n  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n    args[_key - 1] = arguments[_key];\n  }\n  return is.fun(value) ? value.apply(void 0, args) : value;\n}\nvar matchProp = function matchProp(value, key) {\n  return value === true || !!(key && value && (is.fun(value) ? value(key) : toArray(value).includes(key)));\n};\nvar resolveProp = function resolveProp(prop, key) {\n  return is.obj(prop) ? key && prop[key] : prop;\n};\nvar getDefaultProp = function getDefaultProp(props, key) {\n  return props.default === true ? props[key] : props.default ? props.default[key] : void 0;\n};\nvar noopTransform = function noopTransform(value) {\n  return value;\n};\nvar getDefaultProps = function getDefaultProps(props) {\n  var transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noopTransform;\n  var keys = DEFAULT_PROPS;\n  if (props.default && props.default !== true) {\n    props = props.default;\n    keys = Object.keys(props);\n  }\n  var defaults2 = {};\n  var _iterator = _createForOfIteratorHelper(keys),\n    _step;\n  try {\n    for (_iterator.s(); !(_step = _iterator.n()).done;) {\n      var key = _step.value;\n      var value = transform(props[key], key);\n      if (!is.und(value)) {\n        defaults2[key] = value;\n      }\n    }\n  } catch (err) {\n    _iterator.e(err);\n  } finally {\n    _iterator.f();\n  }\n  return defaults2;\n};\nvar DEFAULT_PROPS = [\"config\", \"onProps\", \"onStart\", \"onChange\", \"onPause\", \"onResume\", \"onRest\"];\nvar RESERVED_PROPS = {\n  config: 1,\n  from: 1,\n  to: 1,\n  ref: 1,\n  loop: 1,\n  reset: 1,\n  pause: 1,\n  cancel: 1,\n  reverse: 1,\n  immediate: 1,\n  default: 1,\n  delay: 1,\n  onProps: 1,\n  onStart: 1,\n  onChange: 1,\n  onPause: 1,\n  onResume: 1,\n  onRest: 1,\n  onResolve: 1,\n  // Transition props\n  items: 1,\n  trail: 1,\n  sort: 1,\n  expires: 1,\n  initial: 1,\n  enter: 1,\n  update: 1,\n  leave: 1,\n  children: 1,\n  onDestroyed: 1,\n  // Internal props\n  keys: 1,\n  callId: 1,\n  parentId: 1\n};\nfunction getForwardProps(props) {\n  var forward = {};\n  var count = 0;\n  eachProp(props, function (value, prop) {\n    if (!RESERVED_PROPS[prop]) {\n      forward[prop] = value;\n      count++;\n    }\n  });\n  if (count) {\n    return forward;\n  }\n}\nfunction inferTo(props) {\n  var to2 = getForwardProps(props);\n  if (to2) {\n    var out = {\n      to: to2\n    };\n    eachProp(props, function (val, key) {\n      return key in to2 || (out[key] = val);\n    });\n    return out;\n  }\n  return _objectSpread({}, props);\n}\nfunction computeGoal(value) {\n  value = getFluidValue(value);\n  return is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? G.createStringInterpolator({\n    range: [0, 1],\n    output: [value, value]\n  })(1) : value;\n}\nfunction hasProps(props) {\n  for (var _ in props) return true;\n  return false;\n}\nfunction isAsyncTo(to2) {\n  return is.fun(to2) || is.arr(to2) && is.obj(to2[0]);\n}\nfunction detachRefs(ctrl, ref) {\n  var _ctrl$ref;\n  (_ctrl$ref = ctrl.ref) === null || _ctrl$ref === void 0 ? void 0 : _ctrl$ref.delete(ctrl);\n  ref === null || ref === void 0 ? void 0 : ref.delete(ctrl);\n}\nfunction replaceRef(ctrl, ref) {\n  if (ref && ctrl.ref !== ref) {\n    var _ctrl$ref2;\n    (_ctrl$ref2 = ctrl.ref) === null || _ctrl$ref2 === void 0 ? void 0 : _ctrl$ref2.delete(ctrl);\n    ref.add(ctrl);\n    ctrl.ref = ref;\n  }\n}\n\n// src/hooks/useChain.ts\nfunction useChain(refs, timeSteps) {\n  var timeFrame = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1e3;\n  useIsomorphicLayoutEffect(function () {\n    if (timeSteps) {\n      var prevDelay = 0;\n      each(refs, function (ref, i) {\n        var controllers = ref.current;\n        if (controllers.length) {\n          var delay = timeFrame * timeSteps[i];\n          if (isNaN(delay)) delay = prevDelay;else prevDelay = delay;\n          each(controllers, function (ctrl) {\n            each(ctrl.queue, function (props) {\n              var memoizedDelayProp = props.delay;\n              props.delay = function (key) {\n                return delay + callProp(memoizedDelayProp || 0, key);\n              };\n            });\n          });\n          ref.start();\n        }\n      });\n    } else {\n      var p = Promise.resolve();\n      each(refs, function (ref) {\n        var controllers = ref.current;\n        if (controllers.length) {\n          var queues = controllers.map(function (ctrl) {\n            var q = ctrl.queue;\n            ctrl.queue = [];\n            return q;\n          });\n          p = p.then(function () {\n            each(controllers, function (ctrl, i) {\n              return each(queues[i] || [], function (update2) {\n                return ctrl.queue.push(update2);\n              });\n            });\n            return Promise.all(ref.start());\n          });\n        }\n      });\n    }\n  });\n}\n\n// src/hooks/useSpring.ts\nimport { is as is9 } from \"@react-spring/shared\";\n\n// src/hooks/useSprings.ts\nimport { useContext as useContext2, useMemo, useRef } from \"react\";\nimport { is as is8, each as each5, usePrev, useOnce, useForceUpdate, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect2 } from \"@react-spring/shared\";\n\n// src/SpringValue.ts\nimport { is as is5, raf as raf3, each as each2, isEqual, toArray as toArray2, eachProp as eachProp3, frameLoop as frameLoop2, flushCalls, getFluidValue as getFluidValue2, isAnimatedString as isAnimatedString2, Globals as G5, callFluidObservers as callFluidObservers2, hasFluidValue, addFluidObserver, removeFluidObserver, getFluidObservers } from \"@react-spring/shared\";\nimport { AnimatedValue, AnimatedString, getPayload, getAnimated as getAnimated2, setAnimated, getAnimatedType } from \"@react-spring/animated\";\n\n// src/AnimationConfig.ts\nimport { is as is2, easings } from \"@react-spring/shared\";\n\n// src/constants.ts\nvar config = {\n  default: {\n    tension: 170,\n    friction: 26\n  },\n  gentle: {\n    tension: 120,\n    friction: 14\n  },\n  wobbly: {\n    tension: 180,\n    friction: 12\n  },\n  stiff: {\n    tension: 210,\n    friction: 20\n  },\n  slow: {\n    tension: 280,\n    friction: 60\n  },\n  molasses: {\n    tension: 280,\n    friction: 120\n  }\n};\n\n// src/AnimationConfig.ts\nvar defaults = _objectSpread(_objectSpread({}, config.default), {}, {\n  mass: 1,\n  damping: 1,\n  easing: easings.linear,\n  clamp: false\n});\nvar AnimationConfig = /*#__PURE__*/_createClass(function AnimationConfig() {\n  _classCallCheck(this, AnimationConfig);\n  /**\n   * The initial velocity of one or more values.\n   *\n   * @default 0\n   */\n  this.velocity = 0;\n  Object.assign(this, defaults);\n});\nfunction mergeConfig(config2, newConfig, defaultConfig) {\n  if (defaultConfig) {\n    defaultConfig = _objectSpread({}, defaultConfig);\n    sanitizeConfig(defaultConfig, newConfig);\n    newConfig = _objectSpread(_objectSpread({}, defaultConfig), newConfig);\n  }\n  sanitizeConfig(config2, newConfig);\n  Object.assign(config2, newConfig);\n  for (var key in defaults) {\n    if (config2[key] == null) {\n      config2[key] = defaults[key];\n    }\n  }\n  var frequency = config2.frequency,\n    damping = config2.damping;\n  var mass = config2.mass;\n  if (!is2.und(frequency)) {\n    if (frequency < 0.01) frequency = 0.01;\n    if (damping < 0) damping = 0;\n    config2.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;\n    config2.friction = 4 * Math.PI * damping * mass / frequency;\n  }\n  return config2;\n}\nfunction sanitizeConfig(config2, props) {\n  if (!is2.und(props.decay)) {\n    config2.duration = void 0;\n  } else {\n    var isTensionConfig = !is2.und(props.tension) || !is2.und(props.friction);\n    if (isTensionConfig || !is2.und(props.frequency) || !is2.und(props.damping) || !is2.und(props.mass)) {\n      config2.duration = void 0;\n      config2.decay = void 0;\n    }\n    if (isTensionConfig) {\n      config2.frequency = void 0;\n    }\n  }\n}\n\n// src/Animation.ts\nvar emptyArray = [];\nvar Animation = /*#__PURE__*/_createClass(function Animation() {\n  _classCallCheck(this, Animation);\n  this.changed = false;\n  this.values = emptyArray;\n  this.toValues = null;\n  this.fromValues = emptyArray;\n  this.config = new AnimationConfig();\n  this.immediate = false;\n});\n\n// src/scheduleProps.ts\nimport { is as is3, raf, Globals as G2 } from \"@react-spring/shared\";\nfunction scheduleProps(callId, _ref) {\n  var key = _ref.key,\n    props = _ref.props,\n    defaultProps = _ref.defaultProps,\n    state = _ref.state,\n    actions = _ref.actions;\n  return new Promise(function (resolve, reject) {\n    var _props$cancel;\n    var delay;\n    var timeout;\n    var cancel = matchProp((_props$cancel = props.cancel) !== null && _props$cancel !== void 0 ? _props$cancel : defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.cancel, key);\n    if (cancel) {\n      onStart();\n    } else {\n      if (!is3.und(props.pause)) {\n        state.paused = matchProp(props.pause, key);\n      }\n      var pause = defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.pause;\n      if (pause !== true) {\n        pause = state.paused || matchProp(pause, key);\n      }\n      delay = callProp(props.delay || 0, key);\n      if (pause) {\n        state.resumeQueue.add(onResume);\n        actions.pause();\n      } else {\n        actions.resume();\n        onResume();\n      }\n    }\n    function onPause() {\n      state.resumeQueue.add(onResume);\n      state.timeouts.delete(timeout);\n      timeout.cancel();\n      delay = timeout.time - raf.now();\n    }\n    function onResume() {\n      if (delay > 0 && !G2.skipAnimation) {\n        state.delayed = true;\n        timeout = raf.setTimeout(onStart, delay);\n        state.pauseQueue.add(onPause);\n        state.timeouts.add(timeout);\n      } else {\n        onStart();\n      }\n    }\n    function onStart() {\n      if (state.delayed) {\n        state.delayed = false;\n      }\n      state.pauseQueue.delete(onPause);\n      state.timeouts.delete(timeout);\n      if (callId <= (state.cancelId || 0)) {\n        cancel = true;\n      }\n      try {\n        actions.start(_objectSpread(_objectSpread({}, props), {}, {\n          callId: callId,\n          cancel: cancel\n        }), resolve);\n      } catch (err) {\n        reject(err);\n      }\n    }\n  });\n}\n\n// src/runAsync.ts\nimport { is as is4, raf as raf2, flush, eachProp as eachProp2, Globals as G3 } from \"@react-spring/shared\";\n\n// src/AnimationResult.ts\nvar getCombinedResult = function getCombinedResult(target, results) {\n  return results.length == 1 ? results[0] : results.some(function (result) {\n    return result.cancelled;\n  }) ? getCancelledResult(target.get()) : results.every(function (result) {\n    return result.noop;\n  }) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every(function (result) {\n    return result.finished;\n  }));\n};\nvar getNoopResult = function getNoopResult(value) {\n  return {\n    value: value,\n    noop: true,\n    finished: true,\n    cancelled: false\n  };\n};\nvar getFinishedResult = function getFinishedResult(value, finished) {\n  var cancelled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n  return {\n    value: value,\n    finished: finished,\n    cancelled: cancelled\n  };\n};\nvar getCancelledResult = function getCancelledResult(value) {\n  return {\n    value: value,\n    cancelled: true,\n    finished: false\n  };\n};\n\n// src/runAsync.ts\nfunction runAsync(to2, props, state, target) {\n  var callId = props.callId,\n    parentId = props.parentId,\n    onRest = props.onRest;\n  var prevTo = state.asyncTo,\n    prevPromise = state.promise;\n  if (!parentId && to2 === prevTo && !props.reset) {\n    return prevPromise;\n  }\n  return state.promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n    var defaultProps, preventBail, bail, bailPromise, bailIfEnded, animate, result, animating;\n    return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n      while (1) switch (_context3.prev = _context3.next) {\n        case 0:\n          state.asyncId = callId;\n          state.asyncTo = to2;\n          defaultProps = getDefaultProps(props, function (value, key) {\n            return (\n              // The `onRest` prop is only called when the `runAsync` promise is resolved.\n              key === \"onRest\" ? void 0 : value\n            );\n          });\n          bailPromise = new Promise(function (resolve, reject) {\n            return preventBail = resolve, bail = reject;\n          });\n          bailIfEnded = function bailIfEnded(bailSignal) {\n            var bailResult =\n            // The `cancel` prop or `stop` method was used.\n            callId <= (state.cancelId || 0) && getCancelledResult(target) ||\n            // The async `to` prop was replaced.\n            callId !== state.asyncId && getFinishedResult(target, false);\n            if (bailResult) {\n              bailSignal.result = bailResult;\n              bail(bailSignal);\n              throw bailSignal;\n            }\n          };\n          animate = function animate(arg1, arg2) {\n            var bailSignal = new BailSignal();\n            var skipAnimationSignal = new SkipAnimationSignal();\n            return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n              var props2, result2;\n              return _regeneratorRuntime().wrap(function _callee$(_context) {\n                while (1) switch (_context.prev = _context.next) {\n                  case 0:\n                    if (!G3.skipAnimation) {\n                      _context.next = 5;\n                      break;\n                    }\n                    stopAsync(state);\n                    skipAnimationSignal.result = getFinishedResult(target, false);\n                    bail(skipAnimationSignal);\n                    throw skipAnimationSignal;\n                  case 5:\n                    bailIfEnded(bailSignal);\n                    props2 = is4.obj(arg1) ? _objectSpread({}, arg1) : _objectSpread(_objectSpread({}, arg2), {}, {\n                      to: arg1\n                    });\n                    props2.parentId = callId;\n                    eachProp2(defaultProps, function (value, key) {\n                      if (is4.und(props2[key])) {\n                        props2[key] = value;\n                      }\n                    });\n                    _context.next = 11;\n                    return target.start(props2);\n                  case 11:\n                    result2 = _context.sent;\n                    bailIfEnded(bailSignal);\n                    if (!state.paused) {\n                      _context.next = 16;\n                      break;\n                    }\n                    _context.next = 16;\n                    return new Promise(function (resume) {\n                      state.resumeQueue.add(resume);\n                    });\n                  case 16:\n                    return _context.abrupt(\"return\", result2);\n                  case 17:\n                  case \"end\":\n                    return _context.stop();\n                }\n              }, _callee);\n            }))();\n          };\n          if (!G3.skipAnimation) {\n            _context3.next = 9;\n            break;\n          }\n          stopAsync(state);\n          return _context3.abrupt(\"return\", getFinishedResult(target, false));\n        case 9:\n          _context3.prev = 9;\n          if (is4.arr(to2)) {\n            animating = function () {\n              var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(queue) {\n                var _iterator2, _step2, props2;\n                return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n                  while (1) switch (_context2.prev = _context2.next) {\n                    case 0:\n                      _iterator2 = _createForOfIteratorHelper(queue);\n                      _context2.prev = 1;\n                      _iterator2.s();\n                    case 3:\n                      if ((_step2 = _iterator2.n()).done) {\n                        _context2.next = 9;\n                        break;\n                      }\n                      props2 = _step2.value;\n                      _context2.next = 7;\n                      return animate(props2);\n                    case 7:\n                      _context2.next = 3;\n                      break;\n                    case 9:\n                      _context2.next = 14;\n                      break;\n                    case 11:\n                      _context2.prev = 11;\n                      _context2.t0 = _context2[\"catch\"](1);\n                      _iterator2.e(_context2.t0);\n                    case 14:\n                      _context2.prev = 14;\n                      _iterator2.f();\n                      return _context2.finish(14);\n                    case 17:\n                    case \"end\":\n                      return _context2.stop();\n                  }\n                }, _callee2, null, [[1, 11, 14, 17]]);\n              }));\n              return function (_x) {\n                return _ref4.apply(this, arguments);\n              };\n            }()(to2);\n          } else {\n            animating = Promise.resolve(to2(animate, target.stop.bind(target)));\n          }\n          _context3.next = 13;\n          return Promise.all([animating.then(preventBail), bailPromise]);\n        case 13:\n          result = getFinishedResult(target.get(), true, false);\n          _context3.next = 27;\n          break;\n        case 16:\n          _context3.prev = 16;\n          _context3.t0 = _context3[\"catch\"](9);\n          if (!(_context3.t0 instanceof BailSignal)) {\n            _context3.next = 22;\n            break;\n          }\n          result = _context3.t0.result;\n          _context3.next = 27;\n          break;\n        case 22:\n          if (!(_context3.t0 instanceof SkipAnimationSignal)) {\n            _context3.next = 26;\n            break;\n          }\n          result = _context3.t0.result;\n          _context3.next = 27;\n          break;\n        case 26:\n          throw _context3.t0;\n        case 27:\n          _context3.prev = 27;\n          if (callId == state.asyncId) {\n            state.asyncId = parentId;\n            state.asyncTo = parentId ? prevTo : void 0;\n            state.promise = parentId ? prevPromise : void 0;\n          }\n          return _context3.finish(27);\n        case 30:\n          if (is4.fun(onRest)) {\n            raf2.batchedUpdates(function () {\n              onRest(result, target, target.item);\n            });\n          }\n          return _context3.abrupt(\"return\", result);\n        case 32:\n        case \"end\":\n          return _context3.stop();\n      }\n    }, _callee3, null, [[9, 16, 27, 30]]);\n  }))();\n}\nfunction stopAsync(state, cancelId) {\n  flush(state.timeouts, function (t) {\n    return t.cancel();\n  });\n  state.pauseQueue.clear();\n  state.resumeQueue.clear();\n  state.asyncId = state.asyncTo = state.promise = void 0;\n  if (cancelId) state.cancelId = cancelId;\n}\nvar BailSignal = /*#__PURE__*/function (_Error) {\n  _inherits(BailSignal, _Error);\n  var _super = _createSuper(BailSignal);\n  function BailSignal() {\n    _classCallCheck(this, BailSignal);\n    return _super.call(this, \"An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.\");\n  }\n  return _createClass(BailSignal);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nvar SkipAnimationSignal = /*#__PURE__*/function (_Error2) {\n  _inherits(SkipAnimationSignal, _Error2);\n  var _super2 = _createSuper(SkipAnimationSignal);\n  function SkipAnimationSignal() {\n    _classCallCheck(this, SkipAnimationSignal);\n    return _super2.call(this, \"SkipAnimationSignal\");\n  }\n  return _createClass(SkipAnimationSignal);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\n// src/FrameValue.ts\nimport { deprecateInterpolate, frameLoop, FluidValue as FluidValue2, Globals as G4, callFluidObservers } from \"@react-spring/shared\";\nimport { getAnimated } from \"@react-spring/animated\";\nvar isFrameValue = function isFrameValue(value) {\n  return value instanceof FrameValue;\n};\nvar nextId = 1;\nvar FrameValue = /*#__PURE__*/function (_FluidValue) {\n  _inherits(FrameValue, _FluidValue);\n  var _super3 = _createSuper(FrameValue);\n  function FrameValue() {\n    var _this;\n    _classCallCheck(this, FrameValue);\n    _this = _super3.apply(this, arguments);\n    _this.id = nextId++;\n    _this._priority = 0;\n    return _this;\n  }\n  _createClass(FrameValue, [{\n    key: \"priority\",\n    get: function get() {\n      return this._priority;\n    },\n    set: function set(priority) {\n      if (this._priority != priority) {\n        this._priority = priority;\n        this._onPriorityChange(priority);\n      }\n    }\n    /** Get the current value */\n  }, {\n    key: \"get\",\n    value: function get() {\n      var node = getAnimated(this);\n      return node && node.getValue();\n    }\n    /** Create a spring that maps our value to another value */\n  }, {\n    key: \"to\",\n    value: function to() {\n      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n        args[_key2] = arguments[_key2];\n      }\n      return G4.to(this, args);\n    }\n    /** @deprecated Use the `to` method instead. */\n  }, {\n    key: \"interpolate\",\n    value: function interpolate() {\n      deprecateInterpolate();\n      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n        args[_key3] = arguments[_key3];\n      }\n      return G4.to(this, args);\n    }\n  }, {\n    key: \"toJSON\",\n    value: function toJSON() {\n      return this.get();\n    }\n  }, {\n    key: \"observerAdded\",\n    value: function observerAdded(count) {\n      if (count == 1) this._attach();\n    }\n  }, {\n    key: \"observerRemoved\",\n    value: function observerRemoved(count) {\n      if (count == 0) this._detach();\n    }\n    /** Called when the first child is added. */\n  }, {\n    key: \"_attach\",\n    value: function _attach() {}\n    /** Called when the last child is removed. */\n  }, {\n    key: \"_detach\",\n    value: function _detach() {}\n    /** Tell our children about our new value */\n  }, {\n    key: \"_onChange\",\n    value: function _onChange(value) {\n      var idle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n      callFluidObservers(this, {\n        type: \"change\",\n        parent: this,\n        value: value,\n        idle: idle\n      });\n    }\n    /** Tell our children about our new priority */\n  }, {\n    key: \"_onPriorityChange\",\n    value: function _onPriorityChange(priority) {\n      if (!this.idle) {\n        frameLoop.sort(this);\n      }\n      callFluidObservers(this, {\n        type: \"priority\",\n        parent: this,\n        priority: priority\n      });\n    }\n  }]);\n  return FrameValue;\n}(FluidValue2);\n\n// src/SpringPhase.ts\nvar $P = Symbol.for(\"SpringPhase\");\nvar HAS_ANIMATED = 1;\nvar IS_ANIMATING = 2;\nvar IS_PAUSED = 4;\nvar hasAnimated = function hasAnimated(target) {\n  return (target[$P] & HAS_ANIMATED) > 0;\n};\nvar isAnimating = function isAnimating(target) {\n  return (target[$P] & IS_ANIMATING) > 0;\n};\nvar isPaused = function isPaused(target) {\n  return (target[$P] & IS_PAUSED) > 0;\n};\nvar setActiveBit = function setActiveBit(target, active) {\n  return active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;\n};\nvar setPausedBit = function setPausedBit(target, paused) {\n  return paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;\n};\n\n// src/SpringValue.ts\nvar SpringValue = /*#__PURE__*/function (_FrameValue) {\n  _inherits(SpringValue, _FrameValue);\n  var _super4 = _createSuper(SpringValue);\n  function SpringValue(arg1, arg2) {\n    var _this2;\n    _classCallCheck(this, SpringValue);\n    _this2 = _super4.call(this);\n    /** The animation state */\n    _this2.animation = new Animation();\n    /** Some props have customizable default values */\n    _this2.defaultProps = {};\n    /** The state for `runAsync` calls */\n    _this2._state = {\n      paused: false,\n      delayed: false,\n      pauseQueue: /* @__PURE__ */new Set(),\n      resumeQueue: /* @__PURE__ */new Set(),\n      timeouts: /* @__PURE__ */new Set()\n    };\n    /** The promise resolvers of pending `start` calls */\n    _this2._pendingCalls = /* @__PURE__ */new Set();\n    /** The counter for tracking `scheduleProps` calls */\n    _this2._lastCallId = 0;\n    /** The last `scheduleProps` call that changed the `to` prop */\n    _this2._lastToId = 0;\n    _this2._memoizedDuration = 0;\n    if (!is5.und(arg1) || !is5.und(arg2)) {\n      var props = is5.obj(arg1) ? _objectSpread({}, arg1) : _objectSpread(_objectSpread({}, arg2), {}, {\n        from: arg1\n      });\n      if (is5.und(props.default)) {\n        props.default = true;\n      }\n      _this2.start(props);\n    }\n    return _this2;\n  }\n  /** Equals true when not advancing on each frame. */\n  _createClass(SpringValue, [{\n    key: \"idle\",\n    get: function get() {\n      return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);\n    }\n  }, {\n    key: \"goal\",\n    get: function get() {\n      return getFluidValue2(this.animation.to);\n    }\n  }, {\n    key: \"velocity\",\n    get: function get() {\n      var node = getAnimated2(this);\n      return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map(function (node2) {\n        return node2.lastVelocity || 0;\n      });\n    }\n    /**\n     * When true, this value has been animated at least once.\n     */\n  }, {\n    key: \"hasAnimated\",\n    get: function get() {\n      return hasAnimated(this);\n    }\n    /**\n     * When true, this value has an unfinished animation,\n     * which is either active or paused.\n     */\n  }, {\n    key: \"isAnimating\",\n    get: function get() {\n      return isAnimating(this);\n    }\n    /**\n     * When true, all current and future animations are paused.\n     */\n  }, {\n    key: \"isPaused\",\n    get: function get() {\n      return isPaused(this);\n    }\n    /**\n     *\n     *\n     */\n  }, {\n    key: \"isDelayed\",\n    get: function get() {\n      return this._state.delayed;\n    }\n    /** Advance the current animation by a number of milliseconds */\n  }, {\n    key: \"advance\",\n    value: function advance(dt) {\n      var _this3 = this;\n      var idle = true;\n      var changed = false;\n      var anim = this.animation;\n      var toValues = anim.toValues;\n      var config2 = anim.config;\n      var payload = getPayload(anim.to);\n      if (!payload && hasFluidValue(anim.to)) {\n        toValues = toArray2(getFluidValue2(anim.to));\n      }\n      anim.values.forEach(function (node2, i) {\n        if (node2.done) return;\n        var to2 =\n        // Animated strings always go from 0 to 1.\n        node2.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i];\n        var finished = anim.immediate;\n        var position = to2;\n        if (!finished) {\n          position = node2.lastPosition;\n          if (config2.tension <= 0) {\n            node2.done = true;\n            return;\n          }\n          var elapsed = node2.elapsedTime += dt;\n          var from = anim.fromValues[i];\n          var v0 = node2.v0 != null ? node2.v0 : node2.v0 = is5.arr(config2.velocity) ? config2.velocity[i] : config2.velocity;\n          var velocity;\n          var precision = config2.precision || (from == to2 ? 5e-3 : Math.min(1, Math.abs(to2 - from) * 1e-3));\n          if (!is5.und(config2.duration)) {\n            var p = 1;\n            if (config2.duration > 0) {\n              if (_this3._memoizedDuration !== config2.duration) {\n                _this3._memoizedDuration = config2.duration;\n                if (node2.durationProgress > 0) {\n                  node2.elapsedTime = config2.duration * node2.durationProgress;\n                  elapsed = node2.elapsedTime += dt;\n                }\n              }\n              p = (config2.progress || 0) + elapsed / _this3._memoizedDuration;\n              p = p > 1 ? 1 : p < 0 ? 0 : p;\n              node2.durationProgress = p;\n            }\n            position = from + config2.easing(p) * (to2 - from);\n            velocity = (position - node2.lastPosition) / dt;\n            finished = p == 1;\n          } else if (config2.decay) {\n            var decay = config2.decay === true ? 0.998 : config2.decay;\n            var e = Math.exp(-(1 - decay) * elapsed);\n            position = from + v0 / (1 - decay) * (1 - e);\n            finished = Math.abs(node2.lastPosition - position) <= precision;\n            velocity = v0 * e;\n          } else {\n            velocity = node2.lastVelocity == null ? v0 : node2.lastVelocity;\n            var restVelocity = config2.restVelocity || precision / 10;\n            var bounceFactor = config2.clamp ? 0 : config2.bounce;\n            var canBounce = !is5.und(bounceFactor);\n            var isGrowing = from == to2 ? node2.v0 > 0 : from < to2;\n            var isMoving;\n            var isBouncing = false;\n            var step = 1;\n            var numSteps = Math.ceil(dt / step);\n            for (var n = 0; n < numSteps; ++n) {\n              isMoving = Math.abs(velocity) > restVelocity;\n              if (!isMoving) {\n                finished = Math.abs(to2 - position) <= precision;\n                if (finished) {\n                  break;\n                }\n              }\n              if (canBounce) {\n                isBouncing = position == to2 || position > to2 == isGrowing;\n                if (isBouncing) {\n                  velocity = -velocity * bounceFactor;\n                  position = to2;\n                }\n              }\n              var springForce = -config2.tension * 1e-6 * (position - to2);\n              var dampingForce = -config2.friction * 1e-3 * velocity;\n              var acceleration = (springForce + dampingForce) / config2.mass;\n              velocity = velocity + acceleration * step;\n              position = position + velocity * step;\n            }\n          }\n          node2.lastVelocity = velocity;\n          if (Number.isNaN(position)) {\n            console.warn(\"Got NaN while animating:\", _this3);\n            finished = true;\n          }\n        }\n        if (payload && !payload[i].done) {\n          finished = false;\n        }\n        if (finished) {\n          node2.done = true;\n        } else {\n          idle = false;\n        }\n        if (node2.setValue(position, config2.round)) {\n          changed = true;\n        }\n      });\n      var node = getAnimated2(this);\n      var currVal = node.getValue();\n      if (idle) {\n        var finalVal = getFluidValue2(anim.to);\n        if ((currVal !== finalVal || changed) && !config2.decay) {\n          node.setValue(finalVal);\n          this._onChange(finalVal);\n        } else if (changed && config2.decay) {\n          this._onChange(currVal);\n        }\n        this._stop();\n      } else if (changed) {\n        this._onChange(currVal);\n      }\n    }\n    /** Set the current value, while stopping the current animation */\n  }, {\n    key: \"set\",\n    value: function set(value) {\n      var _this4 = this;\n      raf3.batchedUpdates(function () {\n        _this4._stop();\n        _this4._focus(value);\n        _this4._set(value);\n      });\n      return this;\n    }\n    /**\n     * Freeze the active animation in time, as well as any updates merged\n     * before `resume` is called.\n     */\n  }, {\n    key: \"pause\",\n    value: function pause() {\n      this._update({\n        pause: true\n      });\n    }\n    /** Resume the animation if paused. */\n  }, {\n    key: \"resume\",\n    value: function resume() {\n      this._update({\n        pause: false\n      });\n    }\n    /** Skip to the end of the current animation. */\n  }, {\n    key: \"finish\",\n    value: function finish() {\n      var _this5 = this;\n      if (isAnimating(this)) {\n        var _this$animation = this.animation,\n          to2 = _this$animation.to,\n          config2 = _this$animation.config;\n        raf3.batchedUpdates(function () {\n          _this5._onStart();\n          if (!config2.decay) {\n            _this5._set(to2, false);\n          }\n          _this5._stop();\n        });\n      }\n      return this;\n    }\n    /** Push props into the pending queue. */\n  }, {\n    key: \"update\",\n    value: function update(props) {\n      var queue = this.queue || (this.queue = []);\n      queue.push(props);\n      return this;\n    }\n  }, {\n    key: \"start\",\n    value: function start(to2, arg2) {\n      var _this6 = this;\n      var queue;\n      if (!is5.und(to2)) {\n        queue = [is5.obj(to2) ? to2 : _objectSpread(_objectSpread({}, arg2), {}, {\n          to: to2\n        })];\n      } else {\n        queue = this.queue || [];\n        this.queue = [];\n      }\n      return Promise.all(queue.map(function (props) {\n        var up = _this6._update(props);\n        return up;\n      })).then(function (results) {\n        return getCombinedResult(_this6, results);\n      });\n    }\n    /**\n     * Stop the current animation, and cancel any delayed updates.\n     *\n     * Pass `true` to call `onRest` with `cancelled: true`.\n     */\n  }, {\n    key: \"stop\",\n    value: function stop(cancel) {\n      var _this7 = this;\n      var to2 = this.animation.to;\n      this._focus(this.get());\n      stopAsync(this._state, cancel && this._lastCallId);\n      raf3.batchedUpdates(function () {\n        return _this7._stop(to2, cancel);\n      });\n      return this;\n    }\n    /** Restart the animation. */\n  }, {\n    key: \"reset\",\n    value: function reset() {\n      this._update({\n        reset: true\n      });\n    }\n    /** @internal */\n  }, {\n    key: \"eventObserved\",\n    value: function eventObserved(event) {\n      if (event.type == \"change\") {\n        this._start();\n      } else if (event.type == \"priority\") {\n        this.priority = event.priority + 1;\n      }\n    }\n    /**\n     * Parse the `to` and `from` range from the given `props` object.\n     *\n     * This also ensures the initial value is available to animated components\n     * during the render phase.\n     */\n  }, {\n    key: \"_prepareNode\",\n    value: function _prepareNode(props) {\n      var key = this.key || \"\";\n      var to2 = props.to,\n        from = props.from;\n      to2 = is5.obj(to2) ? to2[key] : to2;\n      if (to2 == null || isAsyncTo(to2)) {\n        to2 = void 0;\n      }\n      from = is5.obj(from) ? from[key] : from;\n      if (from == null) {\n        from = void 0;\n      }\n      var range = {\n        to: to2,\n        from: from\n      };\n      if (!hasAnimated(this)) {\n        if (props.reverse) {\n          var _ref5 = [from, to2];\n          to2 = _ref5[0];\n          from = _ref5[1];\n        }\n        from = getFluidValue2(from);\n        if (!is5.und(from)) {\n          this._set(from);\n        } else if (!getAnimated2(this)) {\n          this._set(to2);\n        }\n      }\n      return range;\n    }\n    /** Every update is processed by this method before merging. */\n  }, {\n    key: \"_update\",\n    value: function _update(_ref6, isLoop) {\n      var _this8 = this;\n      var props = Object.assign({}, (_objectDestructuringEmpty(_ref6), _ref6));\n      var key = this.key,\n        defaultProps = this.defaultProps;\n      if (props.default) Object.assign(defaultProps, getDefaultProps(props, function (value, prop) {\n        return /^on/.test(prop) ? resolveProp(value, key) : value;\n      }));\n      mergeActiveFn(this, props, \"onProps\");\n      sendEvent(this, \"onProps\", props, this);\n      var range = this._prepareNode(props);\n      if (Object.isFrozen(this)) {\n        throw Error(\"Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?\");\n      }\n      var state = this._state;\n      return scheduleProps(++this._lastCallId, {\n        key: key,\n        props: props,\n        defaultProps: defaultProps,\n        state: state,\n        actions: {\n          pause: function pause() {\n            if (!isPaused(_this8)) {\n              setPausedBit(_this8, true);\n              flushCalls(state.pauseQueue);\n              sendEvent(_this8, \"onPause\", getFinishedResult(_this8, checkFinished(_this8, _this8.animation.to)), _this8);\n            }\n          },\n          resume: function resume() {\n            if (isPaused(_this8)) {\n              setPausedBit(_this8, false);\n              if (isAnimating(_this8)) {\n                _this8._resume();\n              }\n              flushCalls(state.resumeQueue);\n              sendEvent(_this8, \"onResume\", getFinishedResult(_this8, checkFinished(_this8, _this8.animation.to)), _this8);\n            }\n          },\n          start: this._merge.bind(this, range)\n        }\n      }).then(function (result) {\n        if (props.loop && result.finished && !(isLoop && result.noop)) {\n          var nextProps = createLoopUpdate(props);\n          if (nextProps) {\n            return _this8._update(nextProps, true);\n          }\n        }\n        return result;\n      });\n    }\n    /** Merge props into the current animation */\n  }, {\n    key: \"_merge\",\n    value: function _merge(range, props, resolve) {\n      var _this9 = this;\n      if (props.cancel) {\n        this.stop(true);\n        return resolve(getCancelledResult(this));\n      }\n      var hasToProp = !is5.und(range.to);\n      var hasFromProp = !is5.und(range.from);\n      if (hasToProp || hasFromProp) {\n        if (props.callId > this._lastToId) {\n          this._lastToId = props.callId;\n        } else {\n          return resolve(getCancelledResult(this));\n        }\n      }\n      var key = this.key,\n        defaultProps = this.defaultProps,\n        anim = this.animation;\n      var prevTo = anim.to,\n        prevFrom = anim.from;\n      var _range$to = range.to,\n        to2 = _range$to === void 0 ? prevTo : _range$to,\n        _range$from = range.from,\n        from = _range$from === void 0 ? prevFrom : _range$from;\n      if (hasFromProp && !hasToProp && (!props.default || is5.und(to2))) {\n        to2 = from;\n      }\n      if (props.reverse) {\n        var _ref7 = [from, to2];\n        to2 = _ref7[0];\n        from = _ref7[1];\n      }\n      var hasFromChanged = !isEqual(from, prevFrom);\n      if (hasFromChanged) {\n        anim.from = from;\n      }\n      from = getFluidValue2(from);\n      var hasToChanged = !isEqual(to2, prevTo);\n      if (hasToChanged) {\n        this._focus(to2);\n      }\n      var hasAsyncTo = isAsyncTo(props.to);\n      var config2 = anim.config;\n      var decay = config2.decay,\n        velocity = config2.velocity;\n      if (hasToProp || hasFromProp) {\n        config2.velocity = 0;\n      }\n      if (props.config && !hasAsyncTo) {\n        mergeConfig(config2, callProp(props.config, key),\n        // Avoid calling the same \"config\" prop twice.\n        props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);\n      }\n      var node = getAnimated2(this);\n      if (!node || is5.und(to2)) {\n        return resolve(getFinishedResult(this, true));\n      }\n      var reset =\n      // When `reset` is undefined, the `from` prop implies `reset: true`,\n      // except for declarative updates. When `reset` is defined, there\n      // must exist a value to animate from.\n      is5.und(props.reset) ? hasFromProp && !props.default : !is5.und(from) && matchProp(props.reset, key);\n      var value = reset ? from : this.get();\n      var goal = computeGoal(to2);\n      var isAnimatable = is5.num(goal) || is5.arr(goal) || isAnimatedString2(goal);\n      var immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));\n      if (hasToChanged) {\n        var nodeType = getAnimatedType(to2);\n        if (nodeType !== node.constructor) {\n          if (immediate) {\n            node = this._set(goal);\n          } else throw Error(\"Cannot animate between \".concat(node.constructor.name, \" and \").concat(nodeType.name, \", as the \\\"to\\\" prop suggests\"));\n        }\n      }\n      var goalType = node.constructor;\n      var started = hasFluidValue(to2);\n      var finished = false;\n      if (!started) {\n        var hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;\n        if (hasToChanged || hasValueChanged) {\n          finished = isEqual(computeGoal(value), goal);\n          started = !finished;\n        }\n        if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config2.decay, decay) || !isEqual(config2.velocity, velocity)) {\n          started = true;\n        }\n      }\n      if (finished && isAnimating(this)) {\n        if (anim.changed && !reset) {\n          started = true;\n        } else if (!started) {\n          this._stop(prevTo);\n        }\n      }\n      if (!hasAsyncTo) {\n        if (started || hasFluidValue(prevTo)) {\n          anim.values = node.getPayload();\n          anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray2(goal);\n        }\n        if (anim.immediate != immediate) {\n          anim.immediate = immediate;\n          if (!immediate && !reset) {\n            this._set(prevTo);\n          }\n        }\n        if (started) {\n          var onRest = anim.onRest;\n          each2(ACTIVE_EVENTS, function (type) {\n            return mergeActiveFn(_this9, props, type);\n          });\n          var result = getFinishedResult(this, checkFinished(this, prevTo));\n          flushCalls(this._pendingCalls, result);\n          this._pendingCalls.add(resolve);\n          if (anim.changed) raf3.batchedUpdates(function () {\n            anim.changed = !reset;\n            onRest === null || onRest === void 0 ? void 0 : onRest(result, _this9);\n            if (reset) {\n              callProp(defaultProps.onRest, result);\n            } else {\n              var _anim$onStart;\n              (_anim$onStart = anim.onStart) === null || _anim$onStart === void 0 ? void 0 : _anim$onStart.call(anim, result, _this9);\n            }\n          });\n        }\n      }\n      if (reset) {\n        this._set(value);\n      }\n      if (hasAsyncTo) {\n        resolve(runAsync(props.to, props, this._state, this));\n      } else if (started) {\n        this._start();\n      } else if (isAnimating(this) && !hasToChanged) {\n        this._pendingCalls.add(resolve);\n      } else {\n        resolve(getNoopResult(value));\n      }\n    }\n    /** Update the `animation.to` value, which might be a `FluidValue` */\n  }, {\n    key: \"_focus\",\n    value: function _focus(value) {\n      var anim = this.animation;\n      if (value !== anim.to) {\n        if (getFluidObservers(this)) {\n          this._detach();\n        }\n        anim.to = value;\n        if (getFluidObservers(this)) {\n          this._attach();\n        }\n      }\n    }\n  }, {\n    key: \"_attach\",\n    value: function _attach() {\n      var priority = 0;\n      var to2 = this.animation.to;\n      if (hasFluidValue(to2)) {\n        addFluidObserver(to2, this);\n        if (isFrameValue(to2)) {\n          priority = to2.priority + 1;\n        }\n      }\n      this.priority = priority;\n    }\n  }, {\n    key: \"_detach\",\n    value: function _detach() {\n      var to2 = this.animation.to;\n      if (hasFluidValue(to2)) {\n        removeFluidObserver(to2, this);\n      }\n    }\n    /**\n     * Update the current value from outside the frameloop,\n     * and return the `Animated` node.\n     */\n  }, {\n    key: \"_set\",\n    value: function _set(arg) {\n      var _this10 = this;\n      var idle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n      var value = getFluidValue2(arg);\n      if (!is5.und(value)) {\n        var oldNode = getAnimated2(this);\n        if (!oldNode || !isEqual(value, oldNode.getValue())) {\n          var nodeType = getAnimatedType(value);\n          if (!oldNode || oldNode.constructor != nodeType) {\n            setAnimated(this, nodeType.create(value));\n          } else {\n            oldNode.setValue(value);\n          }\n          if (oldNode) {\n            raf3.batchedUpdates(function () {\n              _this10._onChange(value, idle);\n            });\n          }\n        }\n      }\n      return getAnimated2(this);\n    }\n  }, {\n    key: \"_onStart\",\n    value: function _onStart() {\n      var anim = this.animation;\n      if (!anim.changed) {\n        anim.changed = true;\n        sendEvent(this, \"onStart\", getFinishedResult(this, checkFinished(this, anim.to)), this);\n      }\n    }\n  }, {\n    key: \"_onChange\",\n    value: function _onChange(value, idle) {\n      if (!idle) {\n        this._onStart();\n        callProp(this.animation.onChange, value, this);\n      }\n      callProp(this.defaultProps.onChange, value, this);\n      _get(_getPrototypeOf(SpringValue.prototype), \"_onChange\", this).call(this, value, idle);\n    }\n    // This method resets the animation state (even if already animating) to\n    // ensure the latest from/to range is used, and it also ensures this spring\n    // is added to the frameloop.\n  }, {\n    key: \"_start\",\n    value: function _start() {\n      var anim = this.animation;\n      getAnimated2(this).reset(getFluidValue2(anim.to));\n      if (!anim.immediate) {\n        anim.fromValues = anim.values.map(function (node) {\n          return node.lastPosition;\n        });\n      }\n      if (!isAnimating(this)) {\n        setActiveBit(this, true);\n        if (!isPaused(this)) {\n          this._resume();\n        }\n      }\n    }\n  }, {\n    key: \"_resume\",\n    value: function _resume() {\n      if (G5.skipAnimation) {\n        this.finish();\n      } else {\n        frameLoop2.start(this);\n      }\n    }\n    /**\n     * Exit the frameloop and notify `onRest` listeners.\n     *\n     * Always wrap `_stop` calls with `batchedUpdates`.\n     */\n  }, {\n    key: \"_stop\",\n    value: function _stop(goal, cancel) {\n      if (isAnimating(this)) {\n        setActiveBit(this, false);\n        var anim = this.animation;\n        each2(anim.values, function (node) {\n          node.done = true;\n        });\n        if (anim.toValues) {\n          anim.onChange = anim.onPause = anim.onResume = void 0;\n        }\n        callFluidObservers2(this, {\n          type: \"idle\",\n          parent: this\n        });\n        var result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal !== null && goal !== void 0 ? goal : anim.to));\n        flushCalls(this._pendingCalls, result);\n        if (anim.changed) {\n          anim.changed = false;\n          sendEvent(this, \"onRest\", result, this);\n        }\n      }\n    }\n  }]);\n  return SpringValue;\n}(FrameValue);\nfunction checkFinished(target, to2) {\n  var goal = computeGoal(to2);\n  var value = computeGoal(target.get());\n  return isEqual(value, goal);\n}\nfunction createLoopUpdate(props) {\n  var loop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : props.loop;\n  var to2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : props.to;\n  var loopRet = callProp(loop);\n  if (loopRet) {\n    var overrides = loopRet !== true && inferTo(loopRet);\n    var reverse = (overrides || props).reverse;\n    var reset = !overrides || overrides.reset;\n    return createUpdate(_objectSpread(_objectSpread({}, props), {}, {\n      loop: loop,\n      // Avoid updating default props when looping.\n      default: false,\n      // Never loop the `pause` prop.\n      pause: void 0,\n      // For the \"reverse\" prop to loop as expected, the \"to\" prop\n      // must be undefined. The \"reverse\" prop is ignored when the\n      // \"to\" prop is an array or function.\n      to: !reverse || isAsyncTo(to2) ? to2 : void 0,\n      // Ignore the \"from\" prop except on reset.\n      from: reset ? props.from : void 0,\n      reset: reset\n    }, overrides));\n  }\n}\nfunction createUpdate(props) {\n  var _props = props = inferTo(props),\n    to2 = _props.to,\n    from = _props.from;\n  var keys = /* @__PURE__ */new Set();\n  if (is5.obj(to2)) findDefined(to2, keys);\n  if (is5.obj(from)) findDefined(from, keys);\n  props.keys = keys.size ? Array.from(keys) : null;\n  return props;\n}\nfunction declareUpdate(props) {\n  var update2 = createUpdate(props);\n  if (is5.und(update2.default)) {\n    update2.default = getDefaultProps(update2);\n  }\n  return update2;\n}\nfunction findDefined(values, keys) {\n  eachProp3(values, function (value, key) {\n    return value != null && keys.add(key);\n  });\n}\nvar ACTIVE_EVENTS = [\"onStart\", \"onRest\", \"onChange\", \"onPause\", \"onResume\"];\nfunction mergeActiveFn(target, props, type) {\n  target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : void 0;\n}\nfunction sendEvent(target, type) {\n  var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;\n  for (var _len4 = arguments.length, args = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {\n    args[_key4 - 2] = arguments[_key4];\n  }\n  (_target$animation$typ = (_target$animation = target.animation)[type]) === null || _target$animation$typ === void 0 ? void 0 : _target$animation$typ.call.apply(_target$animation$typ, [_target$animation].concat(args));\n  (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) === null || _target$defaultProps$ === void 0 ? void 0 : _target$defaultProps$.call.apply(_target$defaultProps$, [_target$defaultProps].concat(args));\n}\n\n// src/Controller.ts\nimport { is as is6, raf as raf4, each as each3, noop, flush as flush2, toArray as toArray3, eachProp as eachProp4, flushCalls as flushCalls2, addFluidObserver as addFluidObserver2 } from \"@react-spring/shared\";\nvar BATCHED_EVENTS = [\"onStart\", \"onChange\", \"onRest\"];\nvar nextId2 = 1;\nvar Controller = /*#__PURE__*/function () {\n  function Controller(props, flush3) {\n    _classCallCheck(this, Controller);\n    this.id = nextId2++;\n    /** The animated values */\n    this.springs = {};\n    /** The queue of props passed to the `update` method. */\n    this.queue = [];\n    /** The counter for tracking `scheduleProps` calls */\n    this._lastAsyncId = 0;\n    /** The values currently being animated */\n    this._active = /* @__PURE__ */new Set();\n    /** The values that changed recently */\n    this._changed = /* @__PURE__ */new Set();\n    /** Equals false when `onStart` listeners can be called */\n    this._started = false;\n    /** State used by the `runAsync` function */\n    this._state = {\n      paused: false,\n      pauseQueue: /* @__PURE__ */new Set(),\n      resumeQueue: /* @__PURE__ */new Set(),\n      timeouts: /* @__PURE__ */new Set()\n    };\n    /** The event queues that are flushed once per frame maximum */\n    this._events = {\n      onStart: /* @__PURE__ */new Map(),\n      onChange: /* @__PURE__ */new Map(),\n      onRest: /* @__PURE__ */new Map()\n    };\n    this._onFrame = this._onFrame.bind(this);\n    if (flush3) {\n      this._flush = flush3;\n    }\n    if (props) {\n      this.start(_objectSpread({\n        default: true\n      }, props));\n    }\n  }\n  /**\n   * Equals `true` when no spring values are in the frameloop, and\n   * no async animation is currently active.\n   */\n  _createClass(Controller, [{\n    key: \"idle\",\n    get: function get() {\n      return !this._state.asyncTo && Object.values(this.springs).every(function (spring) {\n        return spring.idle && !spring.isDelayed && !spring.isPaused;\n      });\n    }\n  }, {\n    key: \"item\",\n    get: function get() {\n      return this._item;\n    },\n    set: function set(item) {\n      this._item = item;\n    }\n    /** Get the current values of our springs */\n  }, {\n    key: \"get\",\n    value: function get() {\n      var values = {};\n      this.each(function (spring, key) {\n        return values[key] = spring.get();\n      });\n      return values;\n    }\n    /** Set the current values without animating. */\n  }, {\n    key: \"set\",\n    value: function set(values) {\n      for (var key in values) {\n        var value = values[key];\n        if (!is6.und(value)) {\n          this.springs[key].set(value);\n        }\n      }\n    }\n    /** Push an update onto the queue of each value. */\n  }, {\n    key: \"update\",\n    value: function update(props) {\n      if (props) {\n        this.queue.push(createUpdate(props));\n      }\n      return this;\n    }\n    /**\n     * Start the queued animations for every spring, and resolve the returned\n     * promise once all queued animations have finished or been cancelled.\n     *\n     * When you pass a queue (instead of nothing), that queue is used instead of\n     * the queued animations added with the `update` method, which are left alone.\n     */\n  }, {\n    key: \"start\",\n    value: function start(props) {\n      var queue = this.queue;\n      if (props) {\n        queue = toArray3(props).map(createUpdate);\n      } else {\n        this.queue = [];\n      }\n      if (this._flush) {\n        return this._flush(this, queue);\n      }\n      prepareKeys(this, queue);\n      return flushUpdateQueue(this, queue);\n    }\n    /** @internal */\n  }, {\n    key: \"stop\",\n    value: function stop(arg, keys) {\n      if (arg !== !!arg) {\n        keys = arg;\n      }\n      if (keys) {\n        var springs = this.springs;\n        each3(toArray3(keys), function (key) {\n          return springs[key].stop(!!arg);\n        });\n      } else {\n        stopAsync(this._state, this._lastAsyncId);\n        this.each(function (spring) {\n          return spring.stop(!!arg);\n        });\n      }\n      return this;\n    }\n    /** Freeze the active animation in time */\n  }, {\n    key: \"pause\",\n    value: function pause(keys) {\n      if (is6.und(keys)) {\n        this.start({\n          pause: true\n        });\n      } else {\n        var springs = this.springs;\n        each3(toArray3(keys), function (key) {\n          return springs[key].pause();\n        });\n      }\n      return this;\n    }\n    /** Resume the animation if paused. */\n  }, {\n    key: \"resume\",\n    value: function resume(keys) {\n      if (is6.und(keys)) {\n        this.start({\n          pause: false\n        });\n      } else {\n        var springs = this.springs;\n        each3(toArray3(keys), function (key) {\n          return springs[key].resume();\n        });\n      }\n      return this;\n    }\n    /** Call a function once per spring value */\n  }, {\n    key: \"each\",\n    value: function each(iterator) {\n      eachProp4(this.springs, iterator);\n    }\n    /** @internal Called at the end of every animation frame */\n  }, {\n    key: \"_onFrame\",\n    value: function _onFrame() {\n      var _this11 = this;\n      var _this$_events = this._events,\n        onStart = _this$_events.onStart,\n        onChange = _this$_events.onChange,\n        onRest = _this$_events.onRest;\n      var active = this._active.size > 0;\n      var changed = this._changed.size > 0;\n      if (active && !this._started || changed && !this._started) {\n        this._started = true;\n        flush2(onStart, function (_ref8) {\n          var _ref9 = _slicedToArray(_ref8, 2),\n            onStart2 = _ref9[0],\n            result = _ref9[1];\n          result.value = _this11.get();\n          onStart2(result, _this11, _this11._item);\n        });\n      }\n      var idle = !active && this._started;\n      var values = changed || idle && onRest.size ? this.get() : null;\n      if (changed && onChange.size) {\n        flush2(onChange, function (_ref10) {\n          var _ref11 = _slicedToArray(_ref10, 2),\n            onChange2 = _ref11[0],\n            result = _ref11[1];\n          result.value = values;\n          onChange2(result, _this11, _this11._item);\n        });\n      }\n      if (idle) {\n        this._started = false;\n        flush2(onRest, function (_ref12) {\n          var _ref13 = _slicedToArray(_ref12, 2),\n            onRest2 = _ref13[0],\n            result = _ref13[1];\n          result.value = values;\n          onRest2(result, _this11, _this11._item);\n        });\n      }\n    }\n    /** @internal */\n  }, {\n    key: \"eventObserved\",\n    value: function eventObserved(event) {\n      if (event.type == \"change\") {\n        this._changed.add(event.parent);\n        if (!event.idle) {\n          this._active.add(event.parent);\n        }\n      } else if (event.type == \"idle\") {\n        this._active.delete(event.parent);\n      } else return;\n      raf4.onFrame(this._onFrame);\n    }\n  }]);\n  return Controller;\n}();\nfunction flushUpdateQueue(ctrl, queue) {\n  return Promise.all(queue.map(function (props) {\n    return flushUpdate(ctrl, props);\n  })).then(function (results) {\n    return getCombinedResult(ctrl, results);\n  });\n}\nfunction flushUpdate(_x2, _x3, _x4) {\n  return _flushUpdate.apply(this, arguments);\n}\nfunction _flushUpdate() {\n  _flushUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(ctrl, props, isLoop) {\n    var keys, to2, from, loop, onRest, onResolve, defaults2, asyncTo, state, promises, cancel, result, nextProps;\n    return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n      while (1) switch (_context4.prev = _context4.next) {\n        case 0:\n          keys = props.keys, to2 = props.to, from = props.from, loop = props.loop, onRest = props.onRest, onResolve = props.onResolve;\n          defaults2 = is6.obj(props.default) && props.default;\n          if (loop) {\n            props.loop = false;\n          }\n          if (to2 === false) props.to = null;\n          if (from === false) props.from = null;\n          asyncTo = is6.arr(to2) || is6.fun(to2) ? to2 : void 0;\n          if (asyncTo) {\n            props.to = void 0;\n            props.onRest = void 0;\n            if (defaults2) {\n              defaults2.onRest = void 0;\n            }\n          } else {\n            each3(BATCHED_EVENTS, function (key) {\n              var handler = props[key];\n              if (is6.fun(handler)) {\n                var queue = ctrl[\"_events\"][key];\n                props[key] = function (_ref29) {\n                  var finished = _ref29.finished,\n                    cancelled = _ref29.cancelled;\n                  var result2 = queue.get(handler);\n                  if (result2) {\n                    if (!finished) result2.finished = false;\n                    if (cancelled) result2.cancelled = true;\n                  } else {\n                    queue.set(handler, {\n                      value: null,\n                      finished: finished || false,\n                      cancelled: cancelled || false\n                    });\n                  }\n                };\n                if (defaults2) {\n                  defaults2[key] = props[key];\n                }\n              }\n            });\n          }\n          state = ctrl[\"_state\"];\n          if (props.pause === !state.paused) {\n            state.paused = props.pause;\n            flushCalls2(props.pause ? state.pauseQueue : state.resumeQueue);\n          } else if (state.paused) {\n            props.pause = true;\n          }\n          promises = (keys || Object.keys(ctrl.springs)).map(function (key) {\n            return ctrl.springs[key].start(props);\n          });\n          cancel = props.cancel === true || getDefaultProp(props, \"cancel\") === true;\n          if (asyncTo || cancel && state.asyncId) {\n            promises.push(scheduleProps(++ctrl[\"_lastAsyncId\"], {\n              props: props,\n              state: state,\n              actions: {\n                pause: noop,\n                resume: noop,\n                start: function start(props2, resolve) {\n                  if (cancel) {\n                    stopAsync(state, ctrl[\"_lastAsyncId\"]);\n                    resolve(getCancelledResult(ctrl));\n                  } else {\n                    props2.onRest = onRest;\n                    resolve(runAsync(asyncTo, props2, state, ctrl));\n                  }\n                }\n              }\n            }));\n          }\n          if (!state.paused) {\n            _context4.next = 15;\n            break;\n          }\n          _context4.next = 15;\n          return new Promise(function (resume) {\n            state.resumeQueue.add(resume);\n          });\n        case 15:\n          _context4.t0 = getCombinedResult;\n          _context4.t1 = ctrl;\n          _context4.next = 19;\n          return Promise.all(promises);\n        case 19:\n          _context4.t2 = _context4.sent;\n          result = (0, _context4.t0)(_context4.t1, _context4.t2);\n          if (!(loop && result.finished && !(isLoop && result.noop))) {\n            _context4.next = 26;\n            break;\n          }\n          nextProps = createLoopUpdate(props, loop, to2);\n          if (!nextProps) {\n            _context4.next = 26;\n            break;\n          }\n          prepareKeys(ctrl, [nextProps]);\n          return _context4.abrupt(\"return\", flushUpdate(ctrl, nextProps, true));\n        case 26:\n          if (onResolve) {\n            raf4.batchedUpdates(function () {\n              return onResolve(result, ctrl, ctrl.item);\n            });\n          }\n          return _context4.abrupt(\"return\", result);\n        case 28:\n        case \"end\":\n          return _context4.stop();\n      }\n    }, _callee4);\n  }));\n  return _flushUpdate.apply(this, arguments);\n}\nfunction getSprings(ctrl, props) {\n  var springs = _objectSpread({}, ctrl.springs);\n  if (props) {\n    each3(toArray3(props), function (props2) {\n      if (is6.und(props2.keys)) {\n        props2 = createUpdate(props2);\n      }\n      if (!is6.obj(props2.to)) {\n        props2 = _objectSpread(_objectSpread({}, props2), {}, {\n          to: void 0\n        });\n      }\n      prepareSprings(springs, props2, function (key) {\n        return createSpring(key);\n      });\n    });\n  }\n  setSprings(ctrl, springs);\n  return springs;\n}\nfunction setSprings(ctrl, springs) {\n  eachProp4(springs, function (spring, key) {\n    if (!ctrl.springs[key]) {\n      ctrl.springs[key] = spring;\n      addFluidObserver2(spring, ctrl);\n    }\n  });\n}\nfunction createSpring(key, observer) {\n  var spring = new SpringValue();\n  spring.key = key;\n  if (observer) {\n    addFluidObserver2(spring, observer);\n  }\n  return spring;\n}\nfunction prepareSprings(springs, props, create) {\n  if (props.keys) {\n    each3(props.keys, function (key) {\n      var spring = springs[key] || (springs[key] = create(key));\n      spring[\"_prepareNode\"](props);\n    });\n  }\n}\nfunction prepareKeys(ctrl, queue) {\n  each3(queue, function (props) {\n    prepareSprings(ctrl.springs, props, function (key) {\n      return createSpring(key, ctrl);\n    });\n  });\n}\n\n// src/SpringContext.tsx\nimport * as React from \"react\";\nimport { useContext } from \"react\";\nimport { useMemoOne } from \"@react-spring/shared\";\nvar SpringContext = function SpringContext(_ref14) {\n  var children = _ref14.children,\n    props = _objectWithoutProperties(_ref14, _excluded);\n  var inherited = useContext(ctx);\n  var pause = props.pause || !!inherited.pause,\n    immediate = props.immediate || !!inherited.immediate;\n  props = useMemoOne(function () {\n    return {\n      pause: pause,\n      immediate: immediate\n    };\n  }, [pause, immediate]);\n  var Provider = ctx.Provider;\n  return /* @__PURE__ */React.createElement(Provider, {\n    value: props\n  }, children);\n};\nvar ctx = makeContext(SpringContext, {});\nSpringContext.Provider = ctx.Provider;\nSpringContext.Consumer = ctx.Consumer;\nfunction makeContext(target, init) {\n  Object.assign(target, React.createContext(init));\n  target.Provider._context = target;\n  target.Consumer._context = target;\n  return target;\n}\n\n// src/SpringRef.ts\nimport { each as each4, is as is7, deprecateDirectCall } from \"@react-spring/shared\";\nvar SpringRef = function SpringRef() {\n  var current = [];\n  var SpringRef2 = function SpringRef2(props) {\n    deprecateDirectCall();\n    var results = [];\n    each4(current, function (ctrl, i) {\n      if (is7.und(props)) {\n        results.push(ctrl.start());\n      } else {\n        var update2 = _getProps(props, ctrl, i);\n        if (update2) {\n          results.push(ctrl.start(update2));\n        }\n      }\n    });\n    return results;\n  };\n  SpringRef2.current = current;\n  SpringRef2.add = function (ctrl) {\n    if (!current.includes(ctrl)) {\n      current.push(ctrl);\n    }\n  };\n  SpringRef2.delete = function (ctrl) {\n    var i = current.indexOf(ctrl);\n    if (~i) current.splice(i, 1);\n  };\n  SpringRef2.pause = function () {\n    var _arguments = arguments;\n    each4(current, function (ctrl) {\n      return ctrl.pause.apply(ctrl, _toConsumableArray(_arguments));\n    });\n    return this;\n  };\n  SpringRef2.resume = function () {\n    var _arguments2 = arguments;\n    each4(current, function (ctrl) {\n      return ctrl.resume.apply(ctrl, _toConsumableArray(_arguments2));\n    });\n    return this;\n  };\n  SpringRef2.set = function (values) {\n    each4(current, function (ctrl, i) {\n      var update2 = is7.fun(values) ? values(i, ctrl) : values;\n      if (update2) {\n        ctrl.set(update2);\n      }\n    });\n  };\n  SpringRef2.start = function (props) {\n    var _this12 = this;\n    var results = [];\n    each4(current, function (ctrl, i) {\n      if (is7.und(props)) {\n        results.push(ctrl.start());\n      } else {\n        var update2 = _this12._getProps(props, ctrl, i);\n        if (update2) {\n          results.push(ctrl.start(update2));\n        }\n      }\n    });\n    return results;\n  };\n  SpringRef2.stop = function () {\n    var _arguments3 = arguments;\n    each4(current, function (ctrl) {\n      return ctrl.stop.apply(ctrl, _toConsumableArray(_arguments3));\n    });\n    return this;\n  };\n  SpringRef2.update = function (props) {\n    var _this13 = this;\n    each4(current, function (ctrl, i) {\n      return ctrl.update(_this13._getProps(props, ctrl, i));\n    });\n    return this;\n  };\n  var _getProps = function _getProps(arg, ctrl, index) {\n    return is7.fun(arg) ? arg(index, ctrl) : arg;\n  };\n  SpringRef2._getProps = _getProps;\n  return SpringRef2;\n};\n\n// src/hooks/useSprings.ts\nfunction useSprings(length, props, deps) {\n  var _arguments4 = arguments;\n  var propsFn = is8.fun(props) && props;\n  if (propsFn && !deps) deps = [];\n  var ref = useMemo(function () {\n    return propsFn || _arguments4.length == 3 ? SpringRef() : void 0;\n  }, []);\n  var layoutId = useRef(0);\n  var forceUpdate = useForceUpdate();\n  var state = useMemo(function () {\n    return {\n      ctrls: [],\n      queue: [],\n      flush: function flush(ctrl, updates2) {\n        var springs2 = getSprings(ctrl, updates2);\n        var canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs2).some(function (key) {\n          return !ctrl.springs[key];\n        });\n        return canFlushSync ? flushUpdateQueue(ctrl, updates2) : new Promise(function (resolve) {\n          setSprings(ctrl, springs2);\n          state.queue.push(function () {\n            resolve(flushUpdateQueue(ctrl, updates2));\n          });\n          forceUpdate();\n        });\n      }\n    };\n  }, []);\n  var ctrls = useRef(_toConsumableArray(state.ctrls));\n  var updates = [];\n  var prevLength = usePrev(length) || 0;\n  useMemo(function () {\n    each5(ctrls.current.slice(length, prevLength), function (ctrl) {\n      detachRefs(ctrl, ref);\n      ctrl.stop(true);\n    });\n    ctrls.current.length = length;\n    declareUpdates(prevLength, length);\n  }, [length]);\n  useMemo(function () {\n    declareUpdates(0, Math.min(prevLength, length));\n  }, deps);\n  function declareUpdates(startIndex, endIndex) {\n    for (var i = startIndex; i < endIndex; i++) {\n      var ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush));\n      var update2 = propsFn ? propsFn(i, ctrl) : props[i];\n      if (update2) {\n        updates[i] = declareUpdate(update2);\n      }\n    }\n  }\n  var springs = ctrls.current.map(function (ctrl, i) {\n    return getSprings(ctrl, updates[i]);\n  });\n  var context = useContext2(SpringContext);\n  var prevContext = usePrev(context);\n  var hasContext = context !== prevContext && hasProps(context);\n  useIsomorphicLayoutEffect2(function () {\n    layoutId.current++;\n    state.ctrls = ctrls.current;\n    var queue = state.queue;\n    if (queue.length) {\n      state.queue = [];\n      each5(queue, function (cb) {\n        return cb();\n      });\n    }\n    each5(ctrls.current, function (ctrl, i) {\n      ref === null || ref === void 0 ? void 0 : ref.add(ctrl);\n      if (hasContext) {\n        ctrl.start({\n          default: context\n        });\n      }\n      var update2 = updates[i];\n      if (update2) {\n        replaceRef(ctrl, update2.ref);\n        if (ctrl.ref) {\n          ctrl.queue.push(update2);\n        } else {\n          ctrl.start(update2);\n        }\n      }\n    });\n  });\n  useOnce(function () {\n    return function () {\n      each5(state.ctrls, function (ctrl) {\n        return ctrl.stop(true);\n      });\n    };\n  });\n  var values = springs.map(function (x) {\n    return _objectSpread({}, x);\n  });\n  return ref ? [values, ref] : values;\n}\n\n// src/hooks/useSpring.ts\nfunction useSpring(props, deps) {\n  var isFn = is9.fun(props);\n  var _useSprings = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps),\n    _useSprings2 = _slicedToArray(_useSprings, 2),\n    _useSprings2$ = _slicedToArray(_useSprings2[0], 1),\n    values = _useSprings2$[0],\n    ref = _useSprings2[1];\n  return isFn || arguments.length == 2 ? [values, ref] : values;\n}\n\n// src/hooks/useSpringRef.ts\nimport { useState } from \"react\";\nvar initSpringRef = function initSpringRef() {\n  return SpringRef();\n};\nvar useSpringRef = function useSpringRef() {\n  return useState(initSpringRef)[0];\n};\n\n// src/hooks/useSpringValue.ts\nimport { useConstant, useOnce as useOnce2 } from \"@react-spring/shared\";\nvar useSpringValue = function useSpringValue(initial, props) {\n  var springValue = useConstant(function () {\n    return new SpringValue(initial, props);\n  });\n  useOnce2(function () {\n    return function () {\n      springValue.stop();\n    };\n  });\n  return springValue;\n};\n\n// src/hooks/useTrail.ts\nimport { each as each6, is as is10, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect3 } from \"@react-spring/shared\";\nfunction useTrail(length, propsArg, deps) {\n  var propsFn = is10.fun(propsArg) && propsArg;\n  if (propsFn && !deps) deps = [];\n  var reverse = true;\n  var passedRef = void 0;\n  var result = useSprings(length, function (i, ctrl) {\n    var props = propsFn ? propsFn(i, ctrl) : propsArg;\n    passedRef = props.ref;\n    reverse = reverse && props.reverse;\n    return props;\n  },\n  // Ensure the props function is called when no deps exist.\n  // This works around the 3 argument rule.\n  deps || [{}]);\n  useIsomorphicLayoutEffect3(function () {\n    each6(result[1].current, function (ctrl, i) {\n      var parent = result[1].current[i + (reverse ? 1 : -1)];\n      replaceRef(ctrl, passedRef);\n      if (ctrl.ref) {\n        if (parent) {\n          ctrl.update({\n            to: parent.springs\n          });\n        }\n        return;\n      }\n      if (parent) {\n        ctrl.start({\n          to: parent.springs\n        });\n      } else {\n        ctrl.start();\n      }\n    });\n  }, deps);\n  if (propsFn || arguments.length == 3) {\n    var _passedRef;\n    var ref = (_passedRef = passedRef) !== null && _passedRef !== void 0 ? _passedRef : result[1];\n    ref[\"_getProps\"] = function (propsArg2, ctrl, i) {\n      var props = is10.fun(propsArg2) ? propsArg2(i, ctrl) : propsArg2;\n      if (props) {\n        var parent = ref.current[i + (props.reverse ? 1 : -1)];\n        if (parent) props.to = parent.springs;\n        return props;\n      }\n    };\n    return result;\n  }\n  return result[0];\n}\n\n// src/hooks/useTransition.tsx\nimport * as React2 from \"react\";\nimport { useContext as useContext3, useRef as useRef2, useMemo as useMemo2 } from \"react\";\nimport { is as is11, toArray as toArray4, useForceUpdate as useForceUpdate2, useOnce as useOnce3, usePrev as usePrev2, each as each7, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect4 } from \"@react-spring/shared\";\nfunction useTransition(data, props, deps) {\n  var _arguments5 = arguments;\n  var propsFn = is11.fun(props) && props;\n  var _ref15 = propsFn ? propsFn() : props,\n    reset = _ref15.reset,\n    sort = _ref15.sort,\n    _ref15$trail = _ref15.trail,\n    trail = _ref15$trail === void 0 ? 0 : _ref15$trail,\n    _ref15$expires = _ref15.expires,\n    expires = _ref15$expires === void 0 ? true : _ref15$expires,\n    _ref15$exitBeforeEnte = _ref15.exitBeforeEnter,\n    exitBeforeEnter = _ref15$exitBeforeEnte === void 0 ? false : _ref15$exitBeforeEnte,\n    onDestroyed = _ref15.onDestroyed,\n    propsRef = _ref15.ref,\n    propsConfig = _ref15.config;\n  var ref = useMemo2(function () {\n    return propsFn || _arguments5.length == 3 ? SpringRef() : void 0;\n  }, []);\n  var items = toArray4(data);\n  var transitions = [];\n  var usedTransitions = useRef2(null);\n  var prevTransitions = reset ? null : usedTransitions.current;\n  useIsomorphicLayoutEffect4(function () {\n    usedTransitions.current = transitions;\n  });\n  useOnce3(function () {\n    each7(transitions, function (t) {\n      ref === null || ref === void 0 ? void 0 : ref.add(t.ctrl);\n      t.ctrl.ref = ref;\n    });\n    return function () {\n      each7(usedTransitions.current, function (t) {\n        if (t.expired) {\n          clearTimeout(t.expirationId);\n        }\n        detachRefs(t.ctrl, ref);\n        t.ctrl.stop(true);\n      });\n    };\n  });\n  var keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions);\n  var expired = reset && usedTransitions.current || [];\n  useIsomorphicLayoutEffect4(function () {\n    return each7(expired, function (_ref16) {\n      var ctrl = _ref16.ctrl,\n        item = _ref16.item,\n        key = _ref16.key;\n      detachRefs(ctrl, ref);\n      callProp(onDestroyed, item, key);\n    });\n  });\n  var reused = [];\n  if (prevTransitions) each7(prevTransitions, function (t, i) {\n    if (t.expired) {\n      clearTimeout(t.expirationId);\n      expired.push(t);\n    } else {\n      i = reused[i] = keys.indexOf(t.key);\n      if (~i) transitions[i] = t;\n    }\n  });\n  each7(items, function (item, i) {\n    if (!transitions[i]) {\n      transitions[i] = {\n        key: keys[i],\n        item: item,\n        phase: \"mount\" /* MOUNT */,\n        ctrl: new Controller()\n      };\n      transitions[i].ctrl.item = item;\n    }\n  });\n  if (reused.length) {\n    var i = -1;\n    var _ref17 = propsFn ? propsFn() : props,\n      leave = _ref17.leave;\n    each7(reused, function (keyIndex, prevIndex) {\n      var t = prevTransitions[prevIndex];\n      if (~keyIndex) {\n        i = transitions.indexOf(t);\n        transitions[i] = _objectSpread(_objectSpread({}, t), {}, {\n          item: items[keyIndex]\n        });\n      } else if (leave) {\n        transitions.splice(++i, 0, t);\n      }\n    });\n  }\n  if (is11.fun(sort)) {\n    transitions.sort(function (a, b) {\n      return sort(a.item, b.item);\n    });\n  }\n  var delay = -trail;\n  var forceUpdate = useForceUpdate2();\n  var defaultProps = getDefaultProps(props);\n  var changes = /* @__PURE__ */new Map();\n  var exitingTransitions = useRef2( /* @__PURE__ */new Map());\n  var forceChange = useRef2(false);\n  each7(transitions, function (t, i) {\n    var key = t.key;\n    var prevPhase = t.phase;\n    var p = propsFn ? propsFn() : props;\n    var to2;\n    var phase;\n    var propsDelay = callProp(p.delay || 0, key);\n    if (prevPhase == \"mount\" /* MOUNT */) {\n      to2 = p.enter;\n      phase = \"enter\" /* ENTER */;\n    } else {\n      var isLeave = keys.indexOf(key) < 0;\n      if (prevPhase != \"leave\" /* LEAVE */) {\n        if (isLeave) {\n          to2 = p.leave;\n          phase = \"leave\" /* LEAVE */;\n        } else if (to2 = p.update) {\n          phase = \"update\" /* UPDATE */;\n        } else return;\n      } else if (!isLeave) {\n        to2 = p.enter;\n        phase = \"enter\" /* ENTER */;\n      } else return;\n    }\n    to2 = callProp(to2, t.item, i);\n    to2 = is11.obj(to2) ? inferTo(to2) : {\n      to: to2\n    };\n    if (!to2.config) {\n      var config2 = propsConfig || defaultProps.config;\n      to2.config = callProp(config2, t.item, i, phase);\n    }\n    delay += trail;\n    var payload = _objectSpread(_objectSpread({}, defaultProps), {}, {\n      // we need to add our props.delay value you here.\n      delay: propsDelay + delay,\n      ref: propsRef,\n      immediate: p.immediate,\n      // This prevents implied resets.\n      reset: false\n    }, to2);\n    if (phase == \"enter\" /* ENTER */ && is11.und(payload.from)) {\n      var p2 = propsFn ? propsFn() : props;\n      var from = is11.und(p2.initial) || prevTransitions ? p2.from : p2.initial;\n      payload.from = callProp(from, t.item, i);\n    }\n    var onResolve = payload.onResolve;\n    payload.onResolve = function (result) {\n      callProp(onResolve, result);\n      var transitions2 = usedTransitions.current;\n      var t2 = transitions2.find(function (t3) {\n        return t3.key === key;\n      });\n      if (!t2) return;\n      if (result.cancelled && t2.phase != \"update\" /* UPDATE */) {\n        return;\n      }\n      if (t2.ctrl.idle) {\n        var idle = transitions2.every(function (t3) {\n          return t3.ctrl.idle;\n        });\n        if (t2.phase == \"leave\" /* LEAVE */) {\n          var expiry = callProp(expires, t2.item);\n          if (expiry !== false) {\n            var expiryMs = expiry === true ? 0 : expiry;\n            t2.expired = true;\n            if (!idle && expiryMs > 0) {\n              if (expiryMs <= 2147483647) t2.expirationId = setTimeout(forceUpdate, expiryMs);\n              return;\n            }\n          }\n        }\n        if (idle && transitions2.some(function (t3) {\n          return t3.expired;\n        })) {\n          exitingTransitions.current.delete(t2);\n          if (exitBeforeEnter) {\n            forceChange.current = true;\n          }\n          forceUpdate();\n        }\n      }\n    };\n    var springs = getSprings(t.ctrl, payload);\n    if (phase === \"leave\" /* LEAVE */ && exitBeforeEnter) {\n      exitingTransitions.current.set(t, {\n        phase: phase,\n        springs: springs,\n        payload: payload\n      });\n    } else {\n      changes.set(t, {\n        phase: phase,\n        springs: springs,\n        payload: payload\n      });\n    }\n  });\n  var context = useContext3(SpringContext);\n  var prevContext = usePrev2(context);\n  var hasContext = context !== prevContext && hasProps(context);\n  useIsomorphicLayoutEffect4(function () {\n    if (hasContext) {\n      each7(transitions, function (t) {\n        t.ctrl.start({\n          default: context\n        });\n      });\n    }\n  }, [context]);\n  each7(changes, function (_, t) {\n    if (exitingTransitions.current.size) {\n      var ind = transitions.findIndex(function (state) {\n        return state.key === t.key;\n      });\n      transitions.splice(ind, 1);\n    }\n  });\n  useIsomorphicLayoutEffect4(function () {\n    each7(exitingTransitions.current.size ? exitingTransitions.current : changes, function (_ref18, t) {\n      var phase = _ref18.phase,\n        payload = _ref18.payload;\n      var ctrl = t.ctrl;\n      t.phase = phase;\n      ref === null || ref === void 0 ? void 0 : ref.add(ctrl);\n      if (hasContext && phase == \"enter\" /* ENTER */) {\n        ctrl.start({\n          default: context\n        });\n      }\n      if (payload) {\n        replaceRef(ctrl, payload.ref);\n        if ((ctrl.ref || ref) && !forceChange.current) {\n          ctrl.update(payload);\n        } else {\n          ctrl.start(payload);\n          if (forceChange.current) {\n            forceChange.current = false;\n          }\n        }\n      }\n    });\n  }, reset ? void 0 : deps);\n  var renderTransitions = function renderTransitions(render) {\n    return /* @__PURE__ */React2.createElement(React2.Fragment, null, transitions.map(function (t, i) {\n      var _ref19 = changes.get(t) || t.ctrl,\n        springs = _ref19.springs;\n      var elem = render(_objectSpread({}, springs), t.item, t, i);\n      return elem && elem.type ? /* @__PURE__ */React2.createElement(elem.type, _objectSpread(_objectSpread({}, elem.props), {}, {\n        key: is11.str(t.key) || is11.num(t.key) ? t.key : t.ctrl.id,\n        ref: elem.ref\n      })) : elem;\n    }));\n  };\n  return ref ? [renderTransitions, ref] : renderTransitions;\n}\nvar nextKey = 1;\nfunction getKeys(items, _ref20, prevTransitions) {\n  var key = _ref20.key,\n    _ref20$keys = _ref20.keys,\n    keys = _ref20$keys === void 0 ? key : _ref20$keys;\n  if (keys === null) {\n    var reused = /* @__PURE__ */new Set();\n    return items.map(function (item) {\n      var t = prevTransitions && prevTransitions.find(function (t2) {\n        return t2.item === item && t2.phase !== \"leave\" /* LEAVE */ && !reused.has(t2);\n      });\n      if (t) {\n        reused.add(t);\n        return t.key;\n      }\n      return nextKey++;\n    });\n  }\n  return is11.und(keys) ? items : is11.fun(keys) ? items.map(keys) : toArray4(keys);\n}\n\n// src/hooks/useScroll.ts\nimport { each as each8, onScroll, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect5 } from \"@react-spring/shared\";\nvar useScroll = function useScroll() {\n  var _ref21 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n    container = _ref21.container,\n    springOptions = _objectWithoutProperties(_ref21, _excluded2);\n  var _useSpring = useSpring(function () {\n      return _objectSpread({\n        scrollX: 0,\n        scrollY: 0,\n        scrollXProgress: 0,\n        scrollYProgress: 0\n      }, springOptions);\n    }, []),\n    _useSpring2 = _slicedToArray(_useSpring, 2),\n    scrollValues = _useSpring2[0],\n    api = _useSpring2[1];\n  useIsomorphicLayoutEffect5(function () {\n    var cleanupScroll = onScroll(function (_ref22) {\n      var x = _ref22.x,\n        y = _ref22.y;\n      api.start({\n        scrollX: x.current,\n        scrollXProgress: x.progress,\n        scrollY: y.current,\n        scrollYProgress: y.progress\n      });\n    }, {\n      container: (container === null || container === void 0 ? void 0 : container.current) || void 0\n    });\n    return function () {\n      each8(Object.values(scrollValues), function (value) {\n        return value.stop();\n      });\n      cleanupScroll();\n    };\n  }, []);\n  return scrollValues;\n};\n\n// src/hooks/useResize.ts\nimport { onResize, each as each9, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect6 } from \"@react-spring/shared\";\nvar useResize = function useResize(_ref23) {\n  var container = _ref23.container,\n    springOptions = _objectWithoutProperties(_ref23, _excluded3);\n  var _useSpring3 = useSpring(function () {\n      return _objectSpread({\n        width: 0,\n        height: 0\n      }, springOptions);\n    }, []),\n    _useSpring4 = _slicedToArray(_useSpring3, 2),\n    sizeValues = _useSpring4[0],\n    api = _useSpring4[1];\n  useIsomorphicLayoutEffect6(function () {\n    var cleanupScroll = onResize(function (_ref24) {\n      var width = _ref24.width,\n        height = _ref24.height;\n      api.start({\n        width: width,\n        height: height,\n        immediate: sizeValues.width.get() === 0 || sizeValues.height.get() === 0\n      });\n    }, {\n      container: (container === null || container === void 0 ? void 0 : container.current) || void 0\n    });\n    return function () {\n      each9(Object.values(sizeValues), function (value) {\n        return value.stop();\n      });\n      cleanupScroll();\n    };\n  }, []);\n  return sizeValues;\n};\n\n// src/hooks/useInView.ts\nimport { useRef as useRef3, useState as useState2 } from \"react\";\nimport { is as is12, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect7 } from \"@react-spring/shared\";\nvar defaultThresholdOptions = {\n  any: 0,\n  all: 1\n};\nfunction useInView(props, args) {\n  var _useState = useState2(false),\n    _useState2 = _slicedToArray(_useState, 2),\n    isInView = _useState2[0],\n    setIsInView = _useState2[1];\n  var ref = useRef3();\n  var propsFn = is12.fun(props) && props;\n  var springsProps = propsFn ? propsFn() : {};\n  var _springsProps$to = springsProps.to,\n    to2 = _springsProps$to === void 0 ? {} : _springsProps$to,\n    _springsProps$from = springsProps.from,\n    from = _springsProps$from === void 0 ? {} : _springsProps$from,\n    restSpringProps = _objectWithoutProperties(springsProps, _excluded4);\n  var intersectionArguments = propsFn ? args : props;\n  var _useSpring5 = useSpring(function () {\n      return _objectSpread({\n        from: from\n      }, restSpringProps);\n    }, []),\n    _useSpring6 = _slicedToArray(_useSpring5, 2),\n    springs = _useSpring6[0],\n    api = _useSpring6[1];\n  useIsomorphicLayoutEffect7(function () {\n    var element = ref.current;\n    var _ref25 = intersectionArguments !== null && intersectionArguments !== void 0 ? intersectionArguments : {},\n      root = _ref25.root,\n      once = _ref25.once,\n      _ref25$amount = _ref25.amount,\n      amount = _ref25$amount === void 0 ? \"any\" : _ref25$amount,\n      restArgs = _objectWithoutProperties(_ref25, _excluded5);\n    if (!element || once && isInView || typeof IntersectionObserver === \"undefined\") return;\n    var activeIntersections = /* @__PURE__ */new WeakMap();\n    var onEnter = function onEnter() {\n      if (to2) {\n        api.start(to2);\n      }\n      setIsInView(true);\n      var cleanup = function cleanup() {\n        if (from) {\n          api.start(from);\n        }\n        setIsInView(false);\n      };\n      return once ? void 0 : cleanup;\n    };\n    var handleIntersection = function handleIntersection(entries) {\n      entries.forEach(function (entry) {\n        var onLeave = activeIntersections.get(entry.target);\n        if (entry.isIntersecting === Boolean(onLeave)) {\n          return;\n        }\n        if (entry.isIntersecting) {\n          var newOnLeave = onEnter();\n          if (is12.fun(newOnLeave)) {\n            activeIntersections.set(entry.target, newOnLeave);\n          } else {\n            observer.unobserve(entry.target);\n          }\n        } else if (onLeave) {\n          onLeave();\n          activeIntersections.delete(entry.target);\n        }\n      });\n    };\n    var observer = new IntersectionObserver(handleIntersection, _objectSpread({\n      root: root && root.current || void 0,\n      threshold: typeof amount === \"number\" || Array.isArray(amount) ? amount : defaultThresholdOptions[amount]\n    }, restArgs));\n    observer.observe(element);\n    return function () {\n      return observer.unobserve(element);\n    };\n  }, [intersectionArguments]);\n  if (propsFn) {\n    return [ref, springs];\n  }\n  return [ref, isInView];\n}\n\n// src/components/Spring.tsx\nfunction Spring(_ref26) {\n  var children = _ref26.children,\n    props = _objectWithoutProperties(_ref26, _excluded6);\n  return children(useSpring(props));\n}\n\n// src/components/Trail.tsx\nimport { is as is13 } from \"@react-spring/shared\";\nfunction Trail(_ref27) {\n  var items = _ref27.items,\n    children = _ref27.children,\n    props = _objectWithoutProperties(_ref27, _excluded7);\n  var trails = useTrail(items.length, props);\n  return items.map(function (item, index) {\n    var result = children(item, index);\n    return is13.fun(result) ? result(trails[index]) : result;\n  });\n}\n\n// src/components/Transition.tsx\nfunction Transition(_ref28) {\n  var items = _ref28.items,\n    children = _ref28.children,\n    props = _objectWithoutProperties(_ref28, _excluded8);\n  return useTransition(items, props)(children);\n}\n\n// src/interpolate.ts\nimport { deprecateInterpolate as deprecateInterpolate2 } from \"@react-spring/shared\";\n\n// src/Interpolation.ts\nimport { is as is14, raf as raf5, each as each10, isEqual as isEqual2, toArray as toArray5, frameLoop as frameLoop3, getFluidValue as getFluidValue3, createInterpolator, Globals as G6, callFluidObservers as callFluidObservers3, addFluidObserver as addFluidObserver3, removeFluidObserver as removeFluidObserver2, hasFluidValue as hasFluidValue2 } from \"@react-spring/shared\";\nimport { getAnimated as getAnimated3, setAnimated as setAnimated2, getAnimatedType as getAnimatedType2, getPayload as getPayload2 } from \"@react-spring/animated\";\nvar Interpolation = /*#__PURE__*/function (_FrameValue2) {\n  _inherits(Interpolation, _FrameValue2);\n  var _super5 = _createSuper(Interpolation);\n  function Interpolation(source, args) {\n    var _this14;\n    _classCallCheck(this, Interpolation);\n    _this14 = _super5.call(this);\n    _this14.source = source;\n    /** Equals false when in the frameloop */\n    _this14.idle = true;\n    /** The inputs which are currently animating */\n    _this14._active = /* @__PURE__ */new Set();\n    _this14.calc = createInterpolator.apply(void 0, _toConsumableArray(args));\n    var value = _this14._get();\n    var nodeType = getAnimatedType2(value);\n    setAnimated2(_assertThisInitialized(_this14), nodeType.create(value));\n    return _this14;\n  }\n  _createClass(Interpolation, [{\n    key: \"advance\",\n    value: function advance(_dt) {\n      var value = this._get();\n      var oldValue = this.get();\n      if (!isEqual2(value, oldValue)) {\n        getAnimated3(this).setValue(value);\n        this._onChange(value, this.idle);\n      }\n      if (!this.idle && checkIdle(this._active)) {\n        becomeIdle(this);\n      }\n    }\n  }, {\n    key: \"_get\",\n    value: function _get() {\n      var inputs = is14.arr(this.source) ? this.source.map(getFluidValue3) : toArray5(getFluidValue3(this.source));\n      return this.calc.apply(this, _toConsumableArray(inputs));\n    }\n  }, {\n    key: \"_start\",\n    value: function _start() {\n      var _this15 = this;\n      if (this.idle && !checkIdle(this._active)) {\n        this.idle = false;\n        each10(getPayload2(this), function (node) {\n          node.done = false;\n        });\n        if (G6.skipAnimation) {\n          raf5.batchedUpdates(function () {\n            return _this15.advance();\n          });\n          becomeIdle(this);\n        } else {\n          frameLoop3.start(this);\n        }\n      }\n    }\n    // Observe our sources only when we're observed.\n  }, {\n    key: \"_attach\",\n    value: function _attach() {\n      var _this16 = this;\n      var priority = 1;\n      each10(toArray5(this.source), function (source) {\n        if (hasFluidValue2(source)) {\n          addFluidObserver3(source, _this16);\n        }\n        if (isFrameValue(source)) {\n          if (!source.idle) {\n            _this16._active.add(source);\n          }\n          priority = Math.max(priority, source.priority + 1);\n        }\n      });\n      this.priority = priority;\n      this._start();\n    }\n    // Stop observing our sources once we have no observers.\n  }, {\n    key: \"_detach\",\n    value: function _detach() {\n      var _this17 = this;\n      each10(toArray5(this.source), function (source) {\n        if (hasFluidValue2(source)) {\n          removeFluidObserver2(source, _this17);\n        }\n      });\n      this._active.clear();\n      becomeIdle(this);\n    }\n    /** @internal */\n  }, {\n    key: \"eventObserved\",\n    value: function eventObserved(event) {\n      if (event.type == \"change\") {\n        if (event.idle) {\n          this.advance();\n        } else {\n          this._active.add(event.parent);\n          this._start();\n        }\n      } else if (event.type == \"idle\") {\n        this._active.delete(event.parent);\n      } else if (event.type == \"priority\") {\n        this.priority = toArray5(this.source).reduce(function (highest, parent) {\n          return Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1);\n        }, 0);\n      }\n    }\n  }]);\n  return Interpolation;\n}(FrameValue);\nfunction isIdle(source) {\n  return source.idle !== false;\n}\nfunction checkIdle(active) {\n  return !active.size || Array.from(active).every(isIdle);\n}\nfunction becomeIdle(self) {\n  if (!self.idle) {\n    self.idle = true;\n    each10(getPayload2(self), function (node) {\n      node.done = true;\n    });\n    callFluidObservers3(self, {\n      type: \"idle\",\n      parent: self\n    });\n  }\n}\n\n// src/interpolate.ts\nvar to = function to(source) {\n  for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n    args[_key5 - 1] = arguments[_key5];\n  }\n  return new Interpolation(source, args);\n};\nvar interpolate = function interpolate(source) {\n  for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {\n    args[_key6 - 1] = arguments[_key6];\n  }\n  return deprecateInterpolate2(), new Interpolation(source, args);\n};\n\n// src/globals.ts\nimport { Globals, frameLoop as frameLoop4, createStringInterpolator } from \"@react-spring/shared\";\nGlobals.assign({\n  createStringInterpolator: createStringInterpolator,\n  to: function to(source, args) {\n    return new Interpolation(source, args);\n  }\n});\nvar update = frameLoop4.advance;\n\n// src/index.ts\nimport { createInterpolator as createInterpolator2, useIsomorphicLayoutEffect as useIsomorphicLayoutEffect8, useReducedMotion, easings as easings2 } from \"@react-spring/shared\";\nexport * from \"@react-spring/types\";\nexport { BailSignal, Controller, FrameValue, Globals, Interpolation, Spring, SpringContext, SpringRef, SpringValue, Trail, Transition, config, createInterpolator2 as createInterpolator, easings2 as easings, inferTo, interpolate, to, update, useChain, useInView, useIsomorphicLayoutEffect8 as useIsomorphicLayoutEffect, useReducedMotion, useResize, useScroll, useSpring, useSpringRef, useSpringValue, useSprings, useTrail, useTransition };","map":{"version":3,"names":["each","useIsomorphicLayoutEffect","is","toArray","eachProp","getFluidValue","isAnimatedString","Globals","G","callProp","value","_len","arguments","length","args","Array","_key","fun","apply","matchProp","key","includes","resolveProp","prop","obj","getDefaultProp","props","default","noopTransform","getDefaultProps","transform","undefined","keys","DEFAULT_PROPS","Object","defaults2","_iterator","_createForOfIteratorHelper","_step","s","n","done","und","err","e","f","RESERVED_PROPS","config","from","to","ref","loop","reset","pause","cancel","reverse","immediate","delay","onProps","onStart","onChange","onPause","onResume","onRest","onResolve","items","trail","sort","expires","initial","enter","update","leave","children","onDestroyed","callId","parentId","getForwardProps","forward","count","inferTo","to2","out","val","_objectSpread","computeGoal","arr","map","createStringInterpolator","range","output","hasProps","_","isAsyncTo","detachRefs","ctrl","_ctrl$ref","delete","replaceRef","_ctrl$ref2","add","useChain","refs","timeSteps","timeFrame","prevDelay","i","controllers","current","isNaN","queue","memoizedDelayProp","start","p","Promise","resolve","queues","q","then","update2","push","all","is9","useContext","useContext2","useMemo","useRef","is8","each5","usePrev","useOnce","useForceUpdate","useIsomorphicLayoutEffect2","is5","raf","raf3","each2","isEqual","toArray2","eachProp3","frameLoop","frameLoop2","flushCalls","getFluidValue2","isAnimatedString2","G5","callFluidObservers","callFluidObservers2","hasFluidValue","addFluidObserver","removeFluidObserver","getFluidObservers","AnimatedValue","AnimatedString","getPayload","getAnimated","getAnimated2","setAnimated","getAnimatedType","is2","easings","tension","friction","gentle","wobbly","stiff","slow","molasses","defaults","mass","damping","easing","linear","clamp","AnimationConfig","_createClass","_classCallCheck","velocity","assign","mergeConfig","config2","newConfig","defaultConfig","sanitizeConfig","frequency","Math","pow","PI","decay","duration","isTensionConfig","emptyArray","Animation","changed","values","toValues","fromValues","is3","G2","scheduleProps","_ref","defaultProps","state","actions","reject","_props$cancel","timeout","paused","resumeQueue","resume","timeouts","time","now","skipAnimation","delayed","setTimeout","pauseQueue","cancelId","is4","raf2","flush","eachProp2","G3","getCombinedResult","target","results","some","result","cancelled","getCancelledResult","get","every","noop","getNoopResult","getFinishedResult","finished","runAsync","prevTo","asyncTo","prevPromise","promise","_asyncToGenerator","_regeneratorRuntime","mark","_callee3","preventBail","bail","bailPromise","bailIfEnded","animate","animating","wrap","_callee3$","_context3","prev","next","asyncId","bailSignal","bailResult","arg1","arg2","BailSignal","skipAnimationSignal","SkipAnimationSignal","_callee","props2","result2","_callee$","_context","stopAsync","sent","abrupt","stop","_ref4","_callee2","_iterator2","_step2","_callee2$","_context2","t0","finish","_x","bind","batchedUpdates","item","t","clear","_Error","_inherits","_super","_createSuper","call","_wrapNativeSuper","Error","_Error2","_super2","deprecateInterpolate","FluidValue","FluidValue2","G4","isFrameValue","FrameValue","nextId","_FluidValue","_super3","_this","id","_priority","set","priority","_onPriorityChange","node","getValue","_len2","_key2","interpolate","_len3","_key3","toJSON","observerAdded","_attach","observerRemoved","_detach","_onChange","idle","type","parent","$P","Symbol","for","HAS_ANIMATED","IS_ANIMATING","IS_PAUSED","hasAnimated","isAnimating","isPaused","setActiveBit","active","setPausedBit","SpringValue","_FrameValue","_super4","_this2","animation","_state","Set","_pendingCalls","_lastCallId","_lastToId","_memoizedDuration","lastVelocity","node2","advance","dt","_this3","anim","payload","forEach","constructor","lastPosition","position","elapsed","elapsedTime","v0","precision","min","abs","durationProgress","progress","exp","restVelocity","bounceFactor","bounce","canBounce","isGrowing","isMoving","isBouncing","step","numSteps","ceil","springForce","dampingForce","acceleration","Number","console","warn","setValue","round","currVal","finalVal","_stop","_this4","_focus","_set","_update","_this5","_this$animation","_onStart","_this6","up","_this7","eventObserved","event","_start","_prepareNode","_ref5","_ref6","isLoop","_this8","_objectDestructuringEmpty","test","mergeActiveFn","sendEvent","isFrozen","checkFinished","_resume","_merge","nextProps","createLoopUpdate","_this9","hasToProp","hasFromProp","prevFrom","_range$to","_range$from","_ref7","hasFromChanged","hasToChanged","hasAsyncTo","goal","isAnimatable","num","nodeType","concat","name","goalType","started","hasValueChanged","ACTIVE_EVENTS","_anim$onStart","arg","_this10","oldNode","create","_get","_getPrototypeOf","prototype","loopRet","overrides","createUpdate","_props","findDefined","size","declareUpdate","_target$animation$typ","_target$animation","_target$defaultProps$","_target$defaultProps","_len4","_key4","is6","raf4","each3","flush2","toArray3","eachProp4","flushCalls2","addFluidObserver2","BATCHED_EVENTS","nextId2","Controller","flush3","springs","_lastAsyncId","_active","_changed","_started","_events","Map","_onFrame","_flush","spring","isDelayed","_item","prepareKeys","flushUpdateQueue","iterator","_this11","_this$_events","_ref8","_ref9","_slicedToArray","onStart2","_ref10","_ref11","onChange2","_ref12","_ref13","onRest2","onFrame","flushUpdate","_x2","_x3","_x4","_flushUpdate","_callee4","promises","_callee4$","_context4","handler","_ref29","t1","t2","getSprings","prepareSprings","createSpring","setSprings","observer","React","useMemoOne","SpringContext","_ref14","_objectWithoutProperties","_excluded","inherited","ctx","Provider","createElement","makeContext","Consumer","init","createContext","each4","is7","deprecateDirectCall","SpringRef","SpringRef2","_getProps","indexOf","splice","_arguments","_toConsumableArray","_arguments2","_this12","_arguments3","_this13","index","useSprings","deps","_arguments4","propsFn","layoutId","forceUpdate","ctrls","updates2","springs2","canFlushSync","updates","prevLength","slice","declareUpdates","startIndex","endIndex","context","prevContext","hasContext","cb","x","useSpring","isFn","_useSprings","_useSprings2","_useSprings2$","useState","initSpringRef","useSpringRef","useConstant","useOnce2","useSpringValue","springValue","each6","is10","useIsomorphicLayoutEffect3","useTrail","propsArg","passedRef","_passedRef","propsArg2","React2","useContext3","useRef2","useMemo2","is11","toArray4","useForceUpdate2","useOnce3","usePrev2","each7","useIsomorphicLayoutEffect4","useTransition","data","_arguments5","_ref15","_ref15$trail","_ref15$expires","_ref15$exitBeforeEnte","exitBeforeEnter","propsRef","propsConfig","transitions","usedTransitions","prevTransitions","expired","clearTimeout","expirationId","getKeys","_ref16","reused","phase","_ref17","keyIndex","prevIndex","a","b","changes","exitingTransitions","forceChange","prevPhase","propsDelay","isLeave","p2","transitions2","find","t3","expiry","expiryMs","ind","findIndex","_ref18","renderTransitions","render","Fragment","_ref19","elem","str","nextKey","_ref20","_ref20$keys","has","each8","onScroll","useIsomorphicLayoutEffect5","useScroll","_ref21","container","springOptions","_excluded2","_useSpring","scrollX","scrollY","scrollXProgress","scrollYProgress","_useSpring2","scrollValues","api","cleanupScroll","_ref22","y","onResize","each9","useIsomorphicLayoutEffect6","useResize","_ref23","_excluded3","_useSpring3","width","height","_useSpring4","sizeValues","_ref24","useRef3","useState2","is12","useIsomorphicLayoutEffect7","defaultThresholdOptions","any","useInView","_useState","_useState2","isInView","setIsInView","springsProps","_springsProps$to","_springsProps$from","restSpringProps","_excluded4","intersectionArguments","_useSpring5","_useSpring6","element","_ref25","root","once","_ref25$amount","amount","restArgs","_excluded5","IntersectionObserver","activeIntersections","WeakMap","onEnter","cleanup","handleIntersection","entries","entry","onLeave","isIntersecting","Boolean","newOnLeave","unobserve","threshold","isArray","observe","Spring","_ref26","_excluded6","is13","Trail","_ref27","_excluded7","trails","Transition","_ref28","_excluded8","deprecateInterpolate2","is14","raf5","each10","isEqual2","toArray5","frameLoop3","getFluidValue3","createInterpolator","G6","callFluidObservers3","addFluidObserver3","removeFluidObserver2","hasFluidValue2","getAnimated3","setAnimated2","getAnimatedType2","getPayload2","Interpolation","_FrameValue2","_super5","source","_this14","calc","_assertThisInitialized","_dt","oldValue","checkIdle","becomeIdle","inputs","_this15","_this16","max","_this17","reduce","highest","isIdle","self","_len5","_key5","_len6","_key6","frameLoop4","createInterpolator2","useIsomorphicLayoutEffect8","useReducedMotion","easings2"],"sources":["C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useChain.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\helpers.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useSpring.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useSprings.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\SpringValue.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\AnimationConfig.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\constants.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\Animation.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\scheduleProps.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\runAsync.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\AnimationResult.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\FrameValue.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\SpringPhase.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\Controller.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\SpringContext.tsx","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\SpringRef.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useSpringRef.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useSpringValue.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useTrail.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useTransition.tsx","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useScroll.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useResize.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\hooks\\useInView.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\components\\Spring.tsx","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\components\\Trail.tsx","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\components\\Transition.tsx","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\interpolate.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\Interpolation.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\globals.ts","C:\\Users\\user\\Desktop\\portreact\\node_modules\\@react-spring\\core\\src\\index.ts"],"sourcesContent":["import { each, useIsomorphicLayoutEffect } from '@react-spring/shared'\nimport { SpringRef } from '../SpringRef'\nimport { callProp } from '../helpers'\n\n/**\n * Used to orchestrate animation hooks in sequence with one another.\n * This is best used when you specifically want to orchestrate different\n * types of animation hook e.g. `useSpring` & `useTransition` in\n * sequence as opposed to multiple `useSpring` hooks.\n *\n *\n * ```jsx\n * export const MyComponent = () => {\n *  //...\n *  useChain([springRef, transitionRef])\n *  //...\n * }\n * ```\n *\n * @param refs – An array of `SpringRef`s.\n * @param timeSteps – Optional array of numbers that define the\n * delay between each animation from 0-1. The length should correlate\n * to the length of `refs`.\n * @param timeFrame – Optional number that defines the total duration\n *\n * @public\n */\nexport function useChain(\n  refs: ReadonlyArray<SpringRef>,\n  timeSteps?: number[],\n  timeFrame = 1000\n) {\n  useIsomorphicLayoutEffect(() => {\n    if (timeSteps) {\n      let prevDelay = 0\n      each(refs, (ref, i) => {\n        const controllers = ref.current\n        if (controllers.length) {\n          let delay = timeFrame * timeSteps[i]\n\n          // Use the previous delay if none exists.\n          if (isNaN(delay)) delay = prevDelay\n          else prevDelay = delay\n\n          each(controllers, ctrl => {\n            each(ctrl.queue, props => {\n              // memoizing stops recursion https://github.com/pmndrs/react-spring/issues/1367\n              const memoizedDelayProp = props.delay\n              props.delay = key => delay + callProp(memoizedDelayProp || 0, key)\n            })\n          })\n\n          ref.start()\n        }\n      })\n    } else {\n      let p: Promise<any> = Promise.resolve()\n      each(refs, ref => {\n        const controllers = ref.current\n        if (controllers.length) {\n          // Take the queue of each controller\n          const queues = controllers.map(ctrl => {\n            const q = ctrl.queue\n            ctrl.queue = []\n            return q\n          })\n\n          // Apply the queue when the previous ref stops animating\n          p = p.then(() => {\n            each(controllers, (ctrl, i) =>\n              each(queues[i] || [], update => ctrl.queue.push(update))\n            )\n            return Promise.all(ref.start())\n          })\n        }\n      })\n    }\n  })\n}\n","import {\n  is,\n  toArray,\n  eachProp,\n  getFluidValue,\n  isAnimatedString,\n  FluidValue,\n  Globals as G,\n} from '@react-spring/shared'\nimport { AnyFn, OneOrMore, Lookup } from '@react-spring/types'\nimport { ReservedProps, ForwardProps, InferTo } from './types'\nimport type { Controller } from './Controller'\nimport type { SpringRef } from './SpringRef'\n\nexport function callProp<T>(\n  value: T,\n  ...args: T extends AnyFn ? Parameters<T> : unknown[]\n): T extends AnyFn<any, infer U> ? U : T {\n  return is.fun(value) ? value(...args) : value\n}\n\n/** Try to coerce the given value into a boolean using the given key */\nexport const matchProp = (\n  value: boolean | OneOrMore<string> | ((key: any) => boolean) | undefined,\n  key: string | undefined\n) =>\n  value === true ||\n  !!(\n    key &&\n    value &&\n    (is.fun(value) ? value(key) : toArray(value).includes(key))\n  )\n\nexport const resolveProp = <T>(\n  prop: T | Lookup<T> | undefined,\n  key: string | undefined\n) => (is.obj(prop) ? key && (prop as any)[key] : prop)\n\nexport const concatFn = <T extends AnyFn>(first: T | undefined, last: T) =>\n  first ? (...args: Parameters<T>) => (first(...args), last(...args)) : last\n\n/** Returns `true` if the given prop is having its default value set. */\nexport const hasDefaultProp = <T extends Lookup>(props: T, key: keyof T) =>\n  !is.und(getDefaultProp(props, key))\n\n/** Get the default value being set for the given `key` */\nexport const getDefaultProp = <T extends Lookup, P extends keyof T>(\n  props: T,\n  key: P\n): T[P] =>\n  props.default === true\n    ? props[key]\n    : props.default\n    ? props.default[key]\n    : undefined\n\nconst noopTransform = (value: any) => value\n\n/**\n * Extract the default props from an update.\n *\n * When the `default` prop is falsy, this function still behaves as if\n * `default: true` was used. The `default` prop is always respected when\n * truthy.\n */\nexport const getDefaultProps = <T extends Lookup>(\n  props: Lookup,\n  transform: (value: any, key: string) => any = noopTransform\n): T => {\n  let keys: readonly string[] = DEFAULT_PROPS\n  if (props.default && props.default !== true) {\n    props = props.default\n    keys = Object.keys(props)\n  }\n  const defaults: any = {}\n  for (const key of keys) {\n    const value = transform(props[key], key)\n    if (!is.und(value)) {\n      defaults[key] = value\n    }\n  }\n  return defaults\n}\n\n/**\n * These props are implicitly used as defaults when defined in a\n * declarative update (eg: render-based) or any update with `default: true`.\n *\n * Use `default: {}` or `default: false` to opt-out of these implicit defaults\n * for any given update.\n *\n * Note: These are not the only props with default values. For example, the\n * `pause`, `cancel`, and `immediate` props. But those must be updated with\n * the object syntax (eg: `default: { immediate: true }`).\n */\nexport const DEFAULT_PROPS = [\n  'config',\n  'onProps',\n  'onStart',\n  'onChange',\n  'onPause',\n  'onResume',\n  'onRest',\n] as const\n\nconst RESERVED_PROPS: {\n  [key: string]: 1 | undefined\n} = {\n  config: 1,\n  from: 1,\n  to: 1,\n  ref: 1,\n  loop: 1,\n  reset: 1,\n  pause: 1,\n  cancel: 1,\n  reverse: 1,\n  immediate: 1,\n  default: 1,\n  delay: 1,\n  onProps: 1,\n  onStart: 1,\n  onChange: 1,\n  onPause: 1,\n  onResume: 1,\n  onRest: 1,\n  onResolve: 1,\n\n  // Transition props\n  items: 1,\n  trail: 1,\n  sort: 1,\n  expires: 1,\n  initial: 1,\n  enter: 1,\n  update: 1,\n  leave: 1,\n  children: 1,\n  onDestroyed: 1,\n\n  // Internal props\n  keys: 1,\n  callId: 1,\n  parentId: 1,\n}\n\n/**\n * Extract any properties whose keys are *not* reserved for customizing your\n * animations. All hooks use this function, which means `useTransition` props\n * are reserved for `useSpring` calls, etc.\n */\nfunction getForwardProps<Props extends ReservedProps>(\n  props: Props\n): ForwardProps<Props> | undefined {\n  const forward: any = {}\n\n  let count = 0\n  eachProp(props, (value, prop) => {\n    if (!RESERVED_PROPS[prop]) {\n      forward[prop] = value\n      count++\n    }\n  })\n\n  if (count) {\n    return forward\n  }\n}\n\n/**\n * Clone the given `props` and move all non-reserved props\n * into the `to` prop.\n */\nexport function inferTo<T extends object>(props: T): InferTo<T> {\n  const to = getForwardProps(props)\n  if (to) {\n    const out: any = { to }\n    eachProp(props, (val, key) => key in to || (out[key] = val))\n    return out\n  }\n  return { ...props } as any\n}\n\n// Compute the goal value, converting \"red\" to \"rgba(255, 0, 0, 1)\" in the process\nexport function computeGoal<T>(value: T | FluidValue<T>): T {\n  value = getFluidValue(value)\n  return is.arr(value)\n    ? value.map(computeGoal)\n    : isAnimatedString(value)\n    ? (G.createStringInterpolator({\n        range: [0, 1],\n        output: [value, value] as any,\n      })(1) as any)\n    : value\n}\n\nexport function hasProps(props: object) {\n  for (const _ in props) return true\n  return false\n}\n\nexport function isAsyncTo(to: any) {\n  return is.fun(to) || (is.arr(to) && is.obj(to[0]))\n}\n\n/** Detach `ctrl` from `ctrl.ref` and (optionally) the given `ref` */\nexport function detachRefs(ctrl: Controller, ref?: SpringRef) {\n  ctrl.ref?.delete(ctrl)\n  ref?.delete(ctrl)\n}\n\n/** Replace `ctrl.ref` with the given `ref` (if defined) */\nexport function replaceRef(ctrl: Controller, ref?: SpringRef) {\n  if (ref && ctrl.ref !== ref) {\n    ctrl.ref?.delete(ctrl)\n    ref.add(ctrl)\n    ctrl.ref = ref\n  }\n}\n","import { Lookup, Remap } from '@react-spring/types'\nimport { is } from '@react-spring/shared'\n\nimport { ControllerUpdate, PickAnimated, SpringValues } from '../types'\nimport { Valid } from '../types/common'\nimport { SpringRef } from '../SpringRef'\nimport { useSprings } from './useSprings'\n\n/**\n * The props that `useSpring` recognizes.\n */\nexport type UseSpringProps<Props extends object = any> = unknown &\n  PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? Remap<\n        ControllerUpdate<State> & {\n          /**\n           * Used to access the imperative API.\n           *\n           * When defined, the render animation won't auto-start.\n           */\n          ref?: SpringRef<State>\n        }\n      >\n    : never\n  : never\n\n/**\n * The `props` function is only called on the first render, unless\n * `deps` change (when defined). State is inferred from forward props.\n */\nexport function useSpring<Props extends object>(\n  props:\n    | Function\n    | (() => (Props & Valid<Props, UseSpringProps<Props>>) | UseSpringProps),\n  deps?: readonly any[] | undefined\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? [SpringValues<State>, SpringRef<State>]\n    : never\n  : never\n\n/**\n * Updated on every render, with state inferred from forward props.\n */\nexport function useSpring<Props extends object>(\n  props: (Props & Valid<Props, UseSpringProps<Props>>) | UseSpringProps\n): SpringValues<PickAnimated<Props>>\n\n/**\n * Updated only when `deps` change, with state inferred from forward props.\n */\nexport function useSpring<Props extends object>(\n  props: (Props & Valid<Props, UseSpringProps<Props>>) | UseSpringProps,\n  deps: readonly any[] | undefined\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? [SpringValues<State>, SpringRef<State>]\n    : never\n  : never\n\n/** @internal */\nexport function useSpring(props: any, deps?: readonly any[]) {\n  const isFn = is.fun(props)\n  const [[values], ref] = useSprings(\n    1,\n    isFn ? props : [props],\n    isFn ? deps || [] : deps\n  )\n  return isFn || arguments.length == 2 ? [values, ref] : values\n}\n","import { useContext, useMemo, useRef } from 'react'\nimport { Lookup } from '@react-spring/types'\nimport {\n  is,\n  each,\n  usePrev,\n  useOnce,\n  useForceUpdate,\n  useIsomorphicLayoutEffect,\n} from '@react-spring/shared'\n\nimport {\n  ControllerFlushFn,\n  ControllerUpdate,\n  PickAnimated,\n  SpringValues,\n} from '../types'\nimport { UseSpringProps } from './useSpring'\nimport { declareUpdate } from '../SpringValue'\nimport {\n  Controller,\n  getSprings,\n  flushUpdateQueue,\n  setSprings,\n} from '../Controller'\nimport { hasProps, detachRefs, replaceRef } from '../helpers'\nimport { SpringContext } from '../SpringContext'\nimport { SpringRef } from '../SpringRef'\nimport type { SpringRef as SpringRefType } from '../SpringRef'\n\nexport type UseSpringsProps<State extends Lookup = Lookup> = unknown &\n  ControllerUpdate<State> & {\n    ref?: SpringRefType<State>\n  }\n\n/**\n * When the `deps` argument exists, the `props` function is called whenever\n * the `deps` change on re-render.\n *\n * Without the `deps` argument, the `props` function is only called once.\n */\nexport function useSprings<Props extends UseSpringProps>(\n  length: number,\n  props: (i: number, ctrl: Controller) => Props,\n  deps?: readonly any[]\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup<any>\n    ? [SpringValues<State>[], SpringRefType<State>]\n    : never\n  : never\n\n/**\n * Animations are updated on re-render.\n */\nexport function useSprings<Props extends UseSpringsProps>(\n  length: number,\n  props: Props[] & UseSpringsProps<PickAnimated<Props>>[]\n): SpringValues<PickAnimated<Props>>[]\n\n/**\n * When the `deps` argument exists, you get the `update` and `stop` function.\n */\nexport function useSprings<Props extends UseSpringsProps>(\n  length: number,\n  props: Props[] & UseSpringsProps<PickAnimated<Props>>[],\n  deps: readonly any[] | undefined\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup<any>\n    ? [SpringValues<State>[], SpringRefType<State>]\n    : never\n  : never\n\n/** @internal */\nexport function useSprings(\n  length: number,\n  props: any[] | ((i: number, ctrl: Controller) => any),\n  deps?: readonly any[]\n): any {\n  const propsFn = is.fun(props) && props\n  if (propsFn && !deps) deps = []\n\n  // Create a local ref if a props function or deps array is ever passed.\n  const ref = useMemo(\n    () => (propsFn || arguments.length == 3 ? SpringRef() : void 0),\n    []\n  )\n\n  interface State {\n    // The controllers used for applying updates.\n    ctrls: Controller[]\n    // The queue of changes to make on commit.\n    queue: Array<() => void>\n    // The flush function used by controllers.\n    flush: ControllerFlushFn\n  }\n\n  // Set to 0 to prevent sync flush.\n  const layoutId = useRef(0)\n  const forceUpdate = useForceUpdate()\n\n  // State is updated on commit.\n  const state = useMemo(\n    (): State => ({\n      ctrls: [],\n      queue: [],\n      flush(ctrl, updates) {\n        const springs = getSprings(ctrl, updates)\n\n        // Flushing is postponed until the component's commit phase\n        // if a spring was created since the last commit.\n        const canFlushSync =\n          layoutId.current > 0 &&\n          !state.queue.length &&\n          !Object.keys(springs).some(key => !ctrl.springs[key])\n\n        return canFlushSync\n          ? flushUpdateQueue(ctrl, updates)\n          : new Promise<any>(resolve => {\n              setSprings(ctrl, springs)\n              state.queue.push(() => {\n                resolve(flushUpdateQueue(ctrl, updates))\n              })\n              forceUpdate()\n            })\n      },\n    }),\n    []\n  )\n\n  const ctrls = useRef([...state.ctrls])\n  const updates: any[] = []\n\n  // Cache old controllers to dispose in the commit phase.\n  const prevLength = usePrev(length) || 0\n\n  // Create new controllers when \"length\" increases, and destroy\n  // the affected controllers when \"length\" decreases.\n  useMemo(() => {\n    // Clean up any unused controllers\n    each(ctrls.current.slice(length, prevLength), ctrl => {\n      detachRefs(ctrl, ref)\n      ctrl.stop(true)\n    })\n    ctrls.current.length = length\n\n    declareUpdates(prevLength, length)\n  }, [length])\n\n  // Update existing controllers when \"deps\" are changed.\n  useMemo(() => {\n    declareUpdates(0, Math.min(prevLength, length))\n  }, deps)\n\n  /** Fill the `updates` array with declarative updates for the given index range. */\n  function declareUpdates(startIndex: number, endIndex: number) {\n    for (let i = startIndex; i < endIndex; i++) {\n      const ctrl =\n        ctrls.current[i] ||\n        (ctrls.current[i] = new Controller(null, state.flush))\n\n      const update: UseSpringProps<any> = propsFn\n        ? propsFn(i, ctrl)\n        : (props as any)[i]\n\n      if (update) {\n        updates[i] = declareUpdate(update)\n      }\n    }\n  }\n\n  // New springs are created during render so users can pass them to\n  // their animated components, but new springs aren't cached until the\n  // commit phase (see the `useIsomorphicLayoutEffect` callback below).\n  const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i]))\n\n  const context = useContext(SpringContext)\n  const prevContext = usePrev(context)\n  const hasContext = context !== prevContext && hasProps(context)\n\n  useIsomorphicLayoutEffect(() => {\n    layoutId.current++\n\n    // Replace the cached controllers.\n    state.ctrls = ctrls.current\n\n    // Flush the commit queue.\n    const { queue } = state\n    if (queue.length) {\n      state.queue = []\n      each(queue, cb => cb())\n    }\n\n    // Update existing controllers.\n    each(ctrls.current, (ctrl, i) => {\n      // Attach the controller to the local ref.\n      ref?.add(ctrl)\n\n      // Update the default props.\n      if (hasContext) {\n        ctrl.start({ default: context })\n      }\n\n      // Apply updates created during render.\n      const update = updates[i]\n      if (update) {\n        // Update the injected ref if needed.\n        replaceRef(ctrl, update.ref)\n\n        // When an injected ref exists, the update is postponed\n        // until the ref has its `start` method called.\n        if (ctrl.ref) {\n          ctrl.queue.push(update)\n        } else {\n          ctrl.start(update)\n        }\n      }\n    })\n  })\n\n  // Cancel the animations of all controllers on unmount.\n  useOnce(() => () => {\n    each(state.ctrls, ctrl => ctrl.stop(true))\n  })\n\n  // Return a deep copy of the `springs` array so the caller can\n  // safely mutate it during render.\n  const values = springs.map(x => ({ ...x }))\n\n  return ref ? [values, ref] : values\n}\n","import {\n  is,\n  raf,\n  each,\n  isEqual,\n  toArray,\n  eachProp,\n  frameLoop,\n  flushCalls,\n  getFluidValue,\n  isAnimatedString,\n  FluidValue,\n  Globals as G,\n  callFluidObservers,\n  hasFluidValue,\n  addFluidObserver,\n  removeFluidObserver,\n  getFluidObservers,\n} from '@react-spring/shared'\nimport {\n  Animated,\n  AnimatedValue,\n  AnimatedString,\n  getPayload,\n  getAnimated,\n  setAnimated,\n  getAnimatedType,\n} from '@react-spring/animated'\nimport { Lookup } from '@react-spring/types'\n\nimport { Animation } from './Animation'\nimport { mergeConfig } from './AnimationConfig'\nimport { scheduleProps } from './scheduleProps'\nimport { runAsync, RunAsyncState, RunAsyncProps, stopAsync } from './runAsync'\nimport {\n  callProp,\n  computeGoal,\n  matchProp,\n  inferTo,\n  getDefaultProps,\n  getDefaultProp,\n  isAsyncTo,\n  resolveProp,\n} from './helpers'\nimport { FrameValue, isFrameValue } from './FrameValue'\nimport {\n  isAnimating,\n  isPaused,\n  setPausedBit,\n  hasAnimated,\n  setActiveBit,\n} from './SpringPhase'\nimport {\n  AnimationRange,\n  AnimationResolver,\n  EventKey,\n  PickEventFns,\n} from './types/internal'\nimport { AsyncResult, SpringUpdate, VelocityProp, SpringProps } from './types'\nimport {\n  getCombinedResult,\n  getCancelledResult,\n  getFinishedResult,\n  getNoopResult,\n} from './AnimationResult'\n\ndeclare const console: any\n\ninterface DefaultSpringProps<T>\n  extends Pick<SpringProps<T>, 'pause' | 'cancel' | 'immediate' | 'config'>,\n    PickEventFns<SpringProps<T>> {}\n\n/**\n * Only numbers, strings, and arrays of numbers/strings are supported.\n * Non-animatable strings are also supported.\n */\nexport class SpringValue<T = any> extends FrameValue<T> {\n  /** The property name used when `to` or `from` is an object. Useful when debugging too. */\n  key?: string\n\n  /** The animation state */\n  animation = new Animation<T>()\n\n  /** The queue of pending props */\n  queue?: SpringUpdate<T>[]\n\n  /** Some props have customizable default values */\n  defaultProps: DefaultSpringProps<T> = {}\n\n  /** The state for `runAsync` calls */\n  protected _state: RunAsyncState<SpringValue<T>> = {\n    paused: false,\n    delayed: false,\n    pauseQueue: new Set(),\n    resumeQueue: new Set(),\n    timeouts: new Set(),\n  }\n\n  /** The promise resolvers of pending `start` calls */\n  protected _pendingCalls = new Set<AnimationResolver<this>>()\n\n  /** The counter for tracking `scheduleProps` calls */\n  protected _lastCallId = 0\n\n  /** The last `scheduleProps` call that changed the `to` prop */\n  protected _lastToId = 0\n\n  protected _memoizedDuration = 0\n\n  constructor(from: Exclude<T, object>, props?: SpringUpdate<T>)\n  constructor(props?: SpringUpdate<T>)\n  constructor(arg1?: any, arg2?: any) {\n    super()\n    if (!is.und(arg1) || !is.und(arg2)) {\n      const props = is.obj(arg1) ? { ...arg1 } : { ...arg2, from: arg1 }\n      if (is.und(props.default)) {\n        props.default = true\n      }\n      this.start(props)\n    }\n  }\n\n  /** Equals true when not advancing on each frame. */\n  get idle() {\n    return !(isAnimating(this) || this._state.asyncTo) || isPaused(this)\n  }\n\n  get goal() {\n    return getFluidValue(this.animation.to) as T\n  }\n\n  get velocity(): VelocityProp<T> {\n    const node = getAnimated(this)!\n    return (\n      node instanceof AnimatedValue\n        ? node.lastVelocity || 0\n        : node.getPayload().map(node => node.lastVelocity || 0)\n    ) as any\n  }\n\n  /**\n   * When true, this value has been animated at least once.\n   */\n  get hasAnimated() {\n    return hasAnimated(this)\n  }\n\n  /**\n   * When true, this value has an unfinished animation,\n   * which is either active or paused.\n   */\n  get isAnimating() {\n    return isAnimating(this)\n  }\n\n  /**\n   * When true, all current and future animations are paused.\n   */\n  get isPaused() {\n    return isPaused(this)\n  }\n\n  /**\n   *\n   *\n   */\n  get isDelayed() {\n    return this._state.delayed\n  }\n\n  /** Advance the current animation by a number of milliseconds */\n  advance(dt: number) {\n    let idle = true\n    let changed = false\n\n    const anim = this.animation\n    let { toValues } = anim\n    const { config } = anim\n\n    const payload = getPayload(anim.to)\n    if (!payload && hasFluidValue(anim.to)) {\n      toValues = toArray(getFluidValue(anim.to)) as any\n    }\n\n    anim.values.forEach((node, i) => {\n      if (node.done) return\n\n      const to =\n        // Animated strings always go from 0 to 1.\n        node.constructor == AnimatedString\n          ? 1\n          : payload\n          ? payload[i].lastPosition\n          : toValues![i]\n\n      let finished = anim.immediate\n      let position = to\n\n      if (!finished) {\n        position = node.lastPosition\n\n        // Loose springs never move.\n        if (config.tension <= 0) {\n          node.done = true\n          return\n        }\n\n        let elapsed = (node.elapsedTime += dt)\n        const from = anim.fromValues[i]\n\n        const v0 =\n          node.v0 != null\n            ? node.v0\n            : (node.v0 = is.arr(config.velocity)\n                ? config.velocity[i]\n                : config.velocity)\n\n        let velocity: number\n\n        /** The smallest distance from a value before being treated like said value. */\n        /**\n         * TODO: make this value ~0.0001 by default in next breaking change\n         * for more info see – https://github.com/pmndrs/react-spring/issues/1389\n         */\n        const precision =\n          config.precision ||\n          (from == to ? 0.005 : Math.min(1, Math.abs(to - from) * 0.001))\n\n        // Duration easing\n        if (!is.und(config.duration)) {\n          let p = 1\n          if (config.duration > 0) {\n            /**\n             * Here we check if the duration has changed in the config\n             * and if so update the elapsed time to the percentage\n             * of completition so there is no jank in the animation\n             * https://github.com/pmndrs/react-spring/issues/1163\n             */\n            if (this._memoizedDuration !== config.duration) {\n              // update the memoized version to the new duration\n              this._memoizedDuration = config.duration\n\n              // if the value has started animating we need to update it\n              if (node.durationProgress > 0) {\n                // set elapsed time to be the same percentage of progress as the previous duration\n                node.elapsedTime = config.duration * node.durationProgress\n                // add the delta so the below updates work as expected\n                elapsed = node.elapsedTime += dt\n              }\n            }\n\n            // calculate the new progress\n            p = (config.progress || 0) + elapsed / this._memoizedDuration\n            // p is clamped between 0-1\n            p = p > 1 ? 1 : p < 0 ? 0 : p\n            // store our new progress\n            node.durationProgress = p\n          }\n\n          position = from + config.easing(p) * (to - from)\n          velocity = (position - node.lastPosition) / dt\n\n          finished = p == 1\n        }\n\n        // Decay easing\n        else if (config.decay) {\n          const decay = config.decay === true ? 0.998 : config.decay\n          const e = Math.exp(-(1 - decay) * elapsed)\n\n          position = from + (v0 / (1 - decay)) * (1 - e)\n          finished = Math.abs(node.lastPosition - position) <= precision\n\n          // derivative of position\n          velocity = v0 * e\n        }\n\n        // Spring easing\n        else {\n          velocity = node.lastVelocity == null ? v0 : node.lastVelocity\n\n          /** The velocity at which movement is essentially none */\n          const restVelocity = config.restVelocity || precision / 10\n\n          // Bouncing is opt-in (not to be confused with overshooting)\n          const bounceFactor = config.clamp ? 0 : config.bounce!\n          const canBounce = !is.und(bounceFactor)\n\n          /** When `true`, the value is increasing over time */\n          const isGrowing = from == to ? node.v0 > 0 : from < to\n\n          /** When `true`, the velocity is considered moving */\n          let isMoving!: boolean\n\n          /** When `true`, the velocity is being deflected or clamped */\n          let isBouncing = false\n\n          const step = 1 // 1ms\n          const numSteps = Math.ceil(dt / step)\n          for (let n = 0; n < numSteps; ++n) {\n            isMoving = Math.abs(velocity) > restVelocity\n\n            if (!isMoving) {\n              finished = Math.abs(to - position) <= precision\n              if (finished) {\n                break\n              }\n            }\n\n            if (canBounce) {\n              isBouncing = position == to || position > to == isGrowing\n\n              // Invert the velocity with a magnitude, or clamp it.\n              if (isBouncing) {\n                velocity = -velocity * bounceFactor\n                position = to\n              }\n            }\n\n            const springForce = -config.tension * 0.000001 * (position - to)\n            const dampingForce = -config.friction * 0.001 * velocity\n            const acceleration = (springForce + dampingForce) / config.mass // pt/ms^2\n\n            velocity = velocity + acceleration * step // pt/ms\n            position = position + velocity * step\n          }\n        }\n\n        node.lastVelocity = velocity\n\n        if (Number.isNaN(position)) {\n          console.warn(`Got NaN while animating:`, this)\n          finished = true\n        }\n      }\n\n      // Parent springs must finish before their children can.\n      if (payload && !payload[i].done) {\n        finished = false\n      }\n\n      if (finished) {\n        node.done = true\n      } else {\n        idle = false\n      }\n\n      if (node.setValue(position, config.round)) {\n        changed = true\n      }\n    })\n\n    const node = getAnimated(this)!\n    /**\n     * Get the node's current value, this will be different\n     * to anim.to when config.decay is true\n     */\n    const currVal = node.getValue()\n    if (idle) {\n      // get our final fluid val from the anim.to\n      const finalVal = getFluidValue(anim.to)\n      /**\n       * check if they're not equal, or if they're\n       * change and if there's no config.decay set\n       */\n      if ((currVal !== finalVal || changed) && !config.decay) {\n        // set the value to anim.to\n        node.setValue(finalVal)\n        this._onChange(finalVal)\n      } else if (changed && config.decay) {\n        /**\n         * if it's changed but there is a config.decay,\n         * just call _onChange with currrent value\n         */\n        this._onChange(currVal)\n      }\n      // call stop because the spring has stopped.\n      this._stop()\n    } else if (changed) {\n      /**\n       * if the spring has changed, but is not idle,\n       * just call the _onChange handler\n       */\n      this._onChange(currVal)\n    }\n  }\n\n  /** Set the current value, while stopping the current animation */\n  set(value: T | FluidValue<T>) {\n    raf.batchedUpdates(() => {\n      this._stop()\n\n      // These override the current value and goal value that may have\n      // been updated by `onRest` handlers in the `_stop` call above.\n      this._focus(value)\n      this._set(value)\n    })\n    return this\n  }\n\n  /**\n   * Freeze the active animation in time, as well as any updates merged\n   * before `resume` is called.\n   */\n  pause() {\n    this._update({ pause: true })\n  }\n\n  /** Resume the animation if paused. */\n  resume() {\n    this._update({ pause: false })\n  }\n\n  /** Skip to the end of the current animation. */\n  finish() {\n    if (isAnimating(this)) {\n      const { to, config } = this.animation\n      raf.batchedUpdates(() => {\n        // Ensure the \"onStart\" and \"onRest\" props are called.\n        this._onStart()\n\n        // Jump to the goal value, except for decay animations\n        // which have an undefined goal value.\n        if (!config.decay) {\n          this._set(to, false)\n        }\n\n        this._stop()\n      })\n    }\n    return this\n  }\n\n  /** Push props into the pending queue. */\n  update(props: SpringUpdate<T>) {\n    const queue = this.queue || (this.queue = [])\n    queue.push(props)\n    return this\n  }\n\n  /**\n   * Update this value's animation using the queue of pending props,\n   * and unpause the current animation (if one is frozen).\n   *\n   * When arguments are passed, a new animation is created, and the\n   * queued animations are left alone.\n   */\n  start(): AsyncResult<this>\n\n  start(props: SpringUpdate<T>): AsyncResult<this>\n\n  start(to: T, props?: SpringProps<T>): AsyncResult<this>\n\n  start(to?: any, arg2?: any) {\n    let queue: SpringUpdate<T>[]\n    if (!is.und(to)) {\n      queue = [is.obj(to) ? to : { ...arg2, to }]\n    } else {\n      queue = this.queue || []\n      this.queue = []\n    }\n\n    return Promise.all(\n      queue.map(props => {\n        const up = this._update(props)\n        return up\n      })\n    ).then(results => getCombinedResult(this, results))\n  }\n\n  /**\n   * Stop the current animation, and cancel any delayed updates.\n   *\n   * Pass `true` to call `onRest` with `cancelled: true`.\n   */\n  stop(cancel?: boolean) {\n    const { to } = this.animation\n\n    // The current value becomes the goal value.\n    this._focus(this.get())\n\n    stopAsync(this._state, cancel && this._lastCallId)\n    raf.batchedUpdates(() => this._stop(to, cancel))\n\n    return this\n  }\n\n  /** Restart the animation. */\n  reset() {\n    this._update({ reset: true })\n  }\n\n  /** @internal */\n  eventObserved(event: FrameValue.Event) {\n    if (event.type == 'change') {\n      this._start()\n    } else if (event.type == 'priority') {\n      this.priority = event.priority + 1\n    }\n  }\n\n  /**\n   * Parse the `to` and `from` range from the given `props` object.\n   *\n   * This also ensures the initial value is available to animated components\n   * during the render phase.\n   */\n  protected _prepareNode(props: {\n    to?: any\n    from?: any\n    reverse?: boolean\n    default?: any\n  }) {\n    const key = this.key || ''\n\n    let { to, from } = props\n\n    to = is.obj(to) ? to[key] : to\n    if (to == null || isAsyncTo(to)) {\n      to = undefined\n    }\n\n    from = is.obj(from) ? from[key] : from\n    if (from == null) {\n      from = undefined\n    }\n\n    // Create the range now to avoid \"reverse\" logic.\n    const range = { to, from }\n\n    // Before ever animating, this method ensures an `Animated` node\n    // exists and keeps its value in sync with the \"from\" prop.\n    if (!hasAnimated(this)) {\n      if (props.reverse) [to, from] = [from, to]\n\n      from = getFluidValue(from)\n      if (!is.und(from)) {\n        this._set(from)\n      }\n      // Use the \"to\" value if our node is undefined.\n      else if (!getAnimated(this)) {\n        this._set(to)\n      }\n    }\n\n    return range\n  }\n\n  /** Every update is processed by this method before merging. */\n  protected _update(\n    { ...props }: SpringProps<T>,\n    isLoop?: boolean\n  ): AsyncResult<SpringValue<T>> {\n    const { key, defaultProps } = this\n\n    // Update the default props immediately.\n    if (props.default)\n      Object.assign(\n        defaultProps,\n        getDefaultProps(props, (value, prop) =>\n          /^on/.test(prop) ? resolveProp(value, key) : value\n        )\n      )\n\n    mergeActiveFn(this, props, 'onProps')\n    sendEvent(this, 'onProps', props, this)\n\n    // Ensure the initial value can be accessed by animated components.\n    const range = this._prepareNode(props)\n\n    if (Object.isFrozen(this)) {\n      throw Error(\n        'Cannot animate a `SpringValue` object that is frozen. ' +\n          'Did you forget to pass your component to `animated(...)` before animating its props?'\n      )\n    }\n\n    const state = this._state\n\n    return scheduleProps(++this._lastCallId, {\n      key,\n      props,\n      defaultProps,\n      state,\n      actions: {\n        pause: () => {\n          if (!isPaused(this)) {\n            setPausedBit(this, true)\n            flushCalls(state.pauseQueue)\n            sendEvent(\n              this,\n              'onPause',\n              getFinishedResult(this, checkFinished(this, this.animation.to)),\n              this\n            )\n          }\n        },\n        resume: () => {\n          if (isPaused(this)) {\n            setPausedBit(this, false)\n            if (isAnimating(this)) {\n              this._resume()\n            }\n            flushCalls(state.resumeQueue)\n            sendEvent(\n              this,\n              'onResume',\n              getFinishedResult(this, checkFinished(this, this.animation.to)),\n              this\n            )\n          }\n        },\n        start: this._merge.bind(this, range),\n      },\n    }).then(result => {\n      if (props.loop && result.finished && !(isLoop && result.noop)) {\n        const nextProps = createLoopUpdate(props)\n        if (nextProps) {\n          return this._update(nextProps, true)\n        }\n      }\n      return result\n    })\n  }\n\n  /** Merge props into the current animation */\n  protected _merge(\n    range: AnimationRange<T>,\n    props: RunAsyncProps<SpringValue<T>>,\n    resolve: AnimationResolver<SpringValue<T>>\n  ): void {\n    // The \"cancel\" prop cancels all pending delays and it forces the\n    // active animation to stop where it is.\n    if (props.cancel) {\n      this.stop(true)\n      return resolve(getCancelledResult(this))\n    }\n\n    /** The \"to\" prop is defined. */\n    const hasToProp = !is.und(range.to)\n\n    /** The \"from\" prop is defined. */\n    const hasFromProp = !is.und(range.from)\n\n    // Avoid merging other props if implicitly prevented, except\n    // when both the \"to\" and \"from\" props are undefined.\n    if (hasToProp || hasFromProp) {\n      if (props.callId > this._lastToId) {\n        this._lastToId = props.callId\n      } else {\n        return resolve(getCancelledResult(this))\n      }\n    }\n\n    const { key, defaultProps, animation: anim } = this\n    const { to: prevTo, from: prevFrom } = anim\n    let { to = prevTo, from = prevFrom } = range\n\n    // Focus the \"from\" value if changing without a \"to\" value.\n    // For default updates, do this only if no \"to\" value exists.\n    if (hasFromProp && !hasToProp && (!props.default || is.und(to))) {\n      to = from\n    }\n\n    // Flip the current range if \"reverse\" is true.\n    if (props.reverse) [to, from] = [from, to]\n\n    /** The \"from\" value is changing. */\n    const hasFromChanged = !isEqual(from, prevFrom)\n\n    if (hasFromChanged) {\n      anim.from = from\n    }\n\n    // Coerce \"from\" into a static value.\n    from = getFluidValue(from)\n\n    /** The \"to\" value is changing. */\n    const hasToChanged = !isEqual(to, prevTo)\n\n    if (hasToChanged) {\n      this._focus(to)\n    }\n\n    /** The \"to\" prop is async. */\n    const hasAsyncTo = isAsyncTo(props.to)\n\n    const { config } = anim\n    const { decay, velocity } = config\n\n    // Reset to default velocity when goal values are defined.\n    if (hasToProp || hasFromProp) {\n      config.velocity = 0\n    }\n\n    // The \"runAsync\" function treats the \"config\" prop as a default,\n    // so we must avoid merging it when the \"to\" prop is async.\n    if (props.config && !hasAsyncTo) {\n      mergeConfig(\n        config,\n        callProp(props.config, key!),\n        // Avoid calling the same \"config\" prop twice.\n        props.config !== defaultProps.config\n          ? callProp(defaultProps.config, key!)\n          : void 0\n      )\n    }\n\n    // This instance might not have its Animated node yet. For example,\n    // the constructor can be given props without a \"to\" or \"from\" value.\n    let node = getAnimated(this)\n    if (!node || is.und(to)) {\n      return resolve(getFinishedResult(this, true))\n    }\n\n    /** When true, start at the \"from\" value. */\n    const reset =\n      // When `reset` is undefined, the `from` prop implies `reset: true`,\n      // except for declarative updates. When `reset` is defined, there\n      // must exist a value to animate from.\n      is.und(props.reset)\n        ? hasFromProp && !props.default\n        : !is.und(from) && matchProp(props.reset, key)\n\n    // The current value, where the animation starts from.\n    const value = reset ? (from as T) : this.get()\n\n    // The animation ends at this value, unless \"to\" is fluid.\n    const goal = computeGoal<any>(to)\n\n    // Only specific types can be animated to/from.\n    const isAnimatable = is.num(goal) || is.arr(goal) || isAnimatedString(goal)\n\n    // When true, the value changes instantly on the next frame.\n    const immediate =\n      !hasAsyncTo &&\n      (!isAnimatable ||\n        matchProp(defaultProps.immediate || props.immediate, key))\n\n    if (hasToChanged) {\n      const nodeType = getAnimatedType(to)\n      if (nodeType !== node.constructor) {\n        if (immediate) {\n          node = this._set(goal)!\n        } else\n          throw Error(\n            `Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the \"to\" prop suggests`\n          )\n      }\n    }\n\n    // The type of Animated node for the goal value.\n    const goalType = node.constructor\n\n    // When the goal value is fluid, we don't know if its value\n    // will change before the next animation frame, so it always\n    // starts the animation to be safe.\n    let started = hasFluidValue(to)\n    let finished = false\n\n    if (!started) {\n      // When true, the current value has probably changed.\n      const hasValueChanged = reset || (!hasAnimated(this) && hasFromChanged)\n\n      // When the \"to\" value or current value are changed,\n      // start animating if not already finished.\n      if (hasToChanged || hasValueChanged) {\n        finished = isEqual(computeGoal(value), goal)\n        started = !finished\n      }\n\n      // Changing \"decay\" or \"velocity\" starts the animation.\n      if (\n        (!isEqual(anim.immediate, immediate) && !immediate) ||\n        !isEqual(config.decay, decay) ||\n        !isEqual(config.velocity, velocity)\n      ) {\n        started = true\n      }\n    }\n\n    // Was the goal value set to the current value while animating?\n    if (finished && isAnimating(this)) {\n      // If the first frame has passed, allow the animation to\n      // overshoot instead of stopping abruptly.\n      if (anim.changed && !reset) {\n        started = true\n      }\n      // Stop the animation before its first frame.\n      else if (!started) {\n        this._stop(prevTo)\n      }\n    }\n\n    if (!hasAsyncTo) {\n      // Make sure our \"toValues\" are updated even if our previous\n      // \"to\" prop is a fluid value whose current value is also ours.\n      if (started || hasFluidValue(prevTo)) {\n        anim.values = node.getPayload()\n        anim.toValues = hasFluidValue(to)\n          ? null\n          : goalType == AnimatedString\n          ? [1]\n          : toArray(goal)\n      }\n\n      if (anim.immediate != immediate) {\n        anim.immediate = immediate\n\n        // Ensure the immediate goal is used as from value.\n        if (!immediate && !reset) {\n          this._set(prevTo)\n        }\n      }\n\n      if (started) {\n        const { onRest } = anim\n\n        // Set the active handlers when an animation starts.\n        each(ACTIVE_EVENTS, type => mergeActiveFn(this, props, type))\n\n        const result = getFinishedResult(this, checkFinished(this, prevTo))\n        flushCalls(this._pendingCalls, result)\n        this._pendingCalls.add(resolve)\n\n        if (anim.changed)\n          raf.batchedUpdates(() => {\n            // Ensure `onStart` can be called after a reset.\n            anim.changed = !reset\n\n            // Call the active `onRest` handler from the interrupted animation.\n            onRest?.(result, this)\n\n            // Notify the default `onRest` of the reset, but wait for the\n            // first frame to pass before sending an `onStart` event.\n            if (reset) {\n              callProp(defaultProps.onRest, result)\n            }\n            // Call the active `onStart` handler here since the first frame\n            // has already passed, which means this is a goal update and not\n            // an entirely new animation.\n            else {\n              anim.onStart?.(result, this)\n            }\n          })\n      }\n    }\n\n    if (reset) {\n      this._set(value)\n    }\n\n    if (hasAsyncTo) {\n      resolve(runAsync(props.to, props, this._state, this))\n    }\n\n    // Start an animation\n    else if (started) {\n      this._start()\n    }\n\n    // Postpone promise resolution until the animation is finished,\n    // so that no-op updates still resolve at the expected time.\n    else if (isAnimating(this) && !hasToChanged) {\n      this._pendingCalls.add(resolve)\n    }\n\n    // Resolve our promise immediately.\n    else {\n      resolve(getNoopResult(value))\n    }\n  }\n\n  /** Update the `animation.to` value, which might be a `FluidValue` */\n  protected _focus(value: T | FluidValue<T>) {\n    const anim = this.animation\n    if (value !== anim.to) {\n      if (getFluidObservers(this)) {\n        this._detach()\n      }\n      anim.to = value\n      if (getFluidObservers(this)) {\n        this._attach()\n      }\n    }\n  }\n\n  protected _attach() {\n    let priority = 0\n\n    const { to } = this.animation\n    if (hasFluidValue(to)) {\n      addFluidObserver(to, this)\n      if (isFrameValue(to)) {\n        priority = to.priority + 1\n      }\n    }\n\n    this.priority = priority\n  }\n\n  protected _detach() {\n    const { to } = this.animation\n    if (hasFluidValue(to)) {\n      removeFluidObserver(to, this)\n    }\n  }\n\n  /**\n   * Update the current value from outside the frameloop,\n   * and return the `Animated` node.\n   */\n  protected _set(arg: T | FluidValue<T>, idle = true): Animated | undefined {\n    const value = getFluidValue(arg)\n    if (!is.und(value)) {\n      const oldNode = getAnimated(this)\n      if (!oldNode || !isEqual(value, oldNode.getValue())) {\n        // Create a new node or update the existing node.\n        const nodeType = getAnimatedType(value)\n        if (!oldNode || oldNode.constructor != nodeType) {\n          setAnimated(this, nodeType.create(value))\n        } else {\n          oldNode.setValue(value)\n        }\n        // Never emit a \"change\" event for the initial value.\n        if (oldNode) {\n          raf.batchedUpdates(() => {\n            this._onChange(value, idle)\n          })\n        }\n      }\n    }\n    return getAnimated(this)\n  }\n\n  protected _onStart() {\n    const anim = this.animation\n    if (!anim.changed) {\n      anim.changed = true\n      sendEvent(\n        this,\n        'onStart',\n        getFinishedResult(this, checkFinished(this, anim.to)),\n        this\n      )\n    }\n  }\n\n  protected _onChange(value: T, idle?: boolean) {\n    if (!idle) {\n      this._onStart()\n      callProp(this.animation.onChange, value, this)\n    }\n    callProp(this.defaultProps.onChange, value, this)\n    super._onChange(value, idle)\n  }\n\n  // This method resets the animation state (even if already animating) to\n  // ensure the latest from/to range is used, and it also ensures this spring\n  // is added to the frameloop.\n  protected _start() {\n    const anim = this.animation\n\n    // Reset the state of each Animated node.\n    getAnimated(this)!.reset(getFluidValue(anim.to))\n\n    // Use the current values as the from values.\n    if (!anim.immediate) {\n      anim.fromValues = anim.values.map(node => node.lastPosition)\n    }\n\n    if (!isAnimating(this)) {\n      setActiveBit(this, true)\n      if (!isPaused(this)) {\n        this._resume()\n      }\n    }\n  }\n\n  protected _resume() {\n    // The \"skipAnimation\" global avoids the frameloop.\n    if (G.skipAnimation) {\n      this.finish()\n    } else {\n      frameLoop.start(this)\n    }\n  }\n\n  /**\n   * Exit the frameloop and notify `onRest` listeners.\n   *\n   * Always wrap `_stop` calls with `batchedUpdates`.\n   */\n  protected _stop(goal?: any, cancel?: boolean) {\n    if (isAnimating(this)) {\n      setActiveBit(this, false)\n\n      const anim = this.animation\n      each(anim.values, node => {\n        node.done = true\n      })\n\n      // These active handlers must be reset to undefined or else\n      // they could be called while idle. But keep them defined\n      // when the goal value is dynamic.\n      if (anim.toValues) {\n        anim.onChange = anim.onPause = anim.onResume = undefined\n      }\n\n      callFluidObservers(this, {\n        type: 'idle',\n        parent: this,\n      })\n\n      const result = cancel\n        ? getCancelledResult(this.get())\n        : getFinishedResult(this.get(), checkFinished(this, goal ?? anim.to))\n\n      flushCalls(this._pendingCalls, result)\n      if (anim.changed) {\n        anim.changed = false\n        sendEvent(this, 'onRest', result, this)\n      }\n    }\n  }\n}\n\n/** Returns true when the current value and goal value are equal. */\nfunction checkFinished<T>(target: SpringValue<T>, to: T | FluidValue<T>) {\n  const goal = computeGoal(to)\n  const value = computeGoal(target.get())\n  return isEqual(value, goal)\n}\n\nexport function createLoopUpdate<T>(\n  props: T & { loop?: any; to?: any; from?: any; reverse?: any },\n  loop = props.loop,\n  to = props.to\n): T | undefined {\n  const loopRet = callProp(loop)\n  if (loopRet) {\n    const overrides = loopRet !== true && inferTo(loopRet)\n    const reverse = (overrides || props).reverse\n    const reset = !overrides || overrides.reset\n    return createUpdate({\n      ...props,\n      loop,\n\n      // Avoid updating default props when looping.\n      default: false,\n\n      // Never loop the `pause` prop.\n      pause: undefined,\n\n      // For the \"reverse\" prop to loop as expected, the \"to\" prop\n      // must be undefined. The \"reverse\" prop is ignored when the\n      // \"to\" prop is an array or function.\n      to: !reverse || isAsyncTo(to) ? to : undefined,\n\n      // Ignore the \"from\" prop except on reset.\n      from: reset ? props.from : undefined,\n      reset,\n\n      // The \"loop\" prop can return a \"useSpring\" props object to\n      // override any of the original props.\n      ...overrides,\n    })\n  }\n}\n\n/**\n * Return a new object based on the given `props`.\n *\n * - All non-reserved props are moved into the `to` prop object.\n * - The `keys` prop is set to an array of affected keys,\n *   or `null` if all keys are affected.\n */\nexport function createUpdate(props: any) {\n  const { to, from } = (props = inferTo(props))\n\n  // Collect the keys affected by this update.\n  const keys = new Set<string>()\n\n  if (is.obj(to)) findDefined(to, keys)\n  if (is.obj(from)) findDefined(from, keys)\n\n  // The \"keys\" prop helps in applying updates to affected keys only.\n  props.keys = keys.size ? Array.from(keys) : null\n\n  return props\n}\n\n/**\n * A modified version of `createUpdate` meant for declarative APIs.\n */\nexport function declareUpdate(props: any) {\n  const update = createUpdate(props)\n  if (is.und(update.default)) {\n    update.default = getDefaultProps(update)\n  }\n  return update\n}\n\n/** Find keys with defined values */\nfunction findDefined(values: Lookup, keys: Set<string>) {\n  eachProp(values, (value, key) => value != null && keys.add(key as any))\n}\n\n/** Event props with \"active handler\" support */\nconst ACTIVE_EVENTS = [\n  'onStart',\n  'onRest',\n  'onChange',\n  'onPause',\n  'onResume',\n] as const\n\nfunction mergeActiveFn<T, P extends EventKey>(\n  target: SpringValue<T>,\n  props: SpringProps<T>,\n  type: P\n) {\n  target.animation[type] =\n    props[type] !== getDefaultProp(props, type)\n      ? resolveProp<any>(props[type], target.key)\n      : undefined\n}\n\ntype EventArgs<T, P extends EventKey> = Parameters<\n  Extract<SpringProps<T>[P], Function>\n>\n\n/** Call the active handler first, then the default handler. */\nfunction sendEvent<T, P extends EventKey>(\n  target: SpringValue<T>,\n  type: P,\n  ...args: EventArgs<T, P>\n) {\n  target.animation[type]?.(...(args as [any, any]))\n  target.defaultProps[type]?.(...(args as [any, any]))\n}\n","import { is, easings } from '@react-spring/shared'\nimport { EasingFunction } from '@react-spring/types'\nimport { config as configs } from './constants'\n\nconst defaults: any = {\n  ...configs.default,\n  mass: 1,\n  damping: 1,\n  easing: easings.linear,\n  clamp: false,\n}\n\nexport class AnimationConfig {\n  /**\n   * With higher tension, the spring will resist bouncing and try harder to stop at its end value.\n   *\n   * When tension is zero, no animation occurs.\n   *\n   * @default 170\n   */\n  tension!: number\n\n  /**\n   * The damping ratio coefficient, or just the damping ratio when `speed` is defined.\n   *\n   * When `speed` is defined, this value should be between 0 and 1.\n   *\n   * Higher friction means the spring will slow down faster.\n   *\n   * @default 26\n   */\n  friction!: number\n\n  /**\n   * The natural frequency (in seconds), which dictates the number of bounces\n   * per second when no damping exists.\n   *\n   * When defined, `tension` is derived from this, and `friction` is derived\n   * from `tension` and `damping`.\n   */\n  frequency?: number\n\n  /**\n   * The damping ratio, which dictates how the spring slows down.\n   *\n   * Set to `0` to never slow down. Set to `1` to slow down without bouncing.\n   * Between `0` and `1` is for you to explore.\n   *\n   * Only works when `frequency` is defined.\n   *\n   * @default 1\n   */\n  damping!: number\n\n  /**\n   * Higher mass means more friction is required to slow down.\n   *\n   * Defaults to 1, which works fine most of the time.\n   *\n   * @default 1\n   */\n  mass!: number\n\n  /**\n   * The initial velocity of one or more values.\n   *\n   * @default 0\n   */\n  velocity: number | number[] = 0\n\n  /**\n   * The smallest velocity before the animation is considered \"not moving\".\n   *\n   * When undefined, `precision` is used instead.\n   */\n  restVelocity?: number\n\n  /**\n   * The smallest distance from a value before that distance is essentially zero.\n   *\n   * This helps in deciding when a spring is \"at rest\". The spring must be within\n   * this distance from its final value, and its velocity must be lower than this\n   * value too (unless `restVelocity` is defined).\n   *\n   * @default 0.01\n   */\n  precision?: number\n\n  /**\n   * For `duration` animations only. Note: The `duration` is not affected\n   * by this property.\n   *\n   * Defaults to `0`, which means \"start from the beginning\".\n   *\n   * Setting to `1+` makes an immediate animation.\n   *\n   * Setting to `0.5` means \"start from the middle of the easing function\".\n   *\n   * Any number `>= 0` and `<= 1` makes sense here.\n   */\n  progress?: number\n\n  /**\n   * Animation length in number of milliseconds.\n   */\n  duration?: number\n\n  /**\n   * The animation curve. Only used when `duration` is defined.\n   *\n   * Defaults to quadratic ease-in-out.\n   */\n  easing!: EasingFunction\n\n  /**\n   * Avoid overshooting by ending abruptly at the goal value.\n   *\n   * @default false\n   */\n  clamp!: boolean\n\n  /**\n   * When above zero, the spring will bounce instead of overshooting when\n   * exceeding its goal value. Its velocity is multiplied by `-1 + bounce`\n   * whenever its current value equals or exceeds its goal. For example,\n   * setting `bounce` to `0.5` chops the velocity in half on each bounce,\n   * in addition to any friction.\n   */\n  bounce?: number\n\n  /**\n   * \"Decay animations\" decelerate without an explicit goal value.\n   * Useful for scrolling animations.\n   *\n   * Use `true` for the default exponential decay factor (`0.998`).\n   *\n   * When a `number` between `0` and `1` is given, a lower number makes the\n   * animation slow down faster. And setting to `1` would make an unending\n   * animation.\n   *\n   * @default false\n   */\n  decay?: boolean | number\n\n  /**\n   * While animating, round to the nearest multiple of this number.\n   * The `from` and `to` values are never rounded, as well as any value\n   * passed to the `set` method of an animated value.\n   */\n  round?: number\n\n  constructor() {\n    Object.assign(this, defaults)\n  }\n}\n\nexport function mergeConfig(\n  config: AnimationConfig,\n  newConfig: Partial<AnimationConfig>,\n  defaultConfig?: Partial<AnimationConfig>\n): typeof config\n\nexport function mergeConfig(\n  config: any,\n  newConfig: object,\n  defaultConfig?: object\n) {\n  if (defaultConfig) {\n    defaultConfig = { ...defaultConfig }\n    sanitizeConfig(defaultConfig, newConfig)\n    newConfig = { ...defaultConfig, ...newConfig }\n  }\n\n  sanitizeConfig(config, newConfig)\n  Object.assign(config, newConfig)\n\n  for (const key in defaults) {\n    if (config[key] == null) {\n      config[key] = defaults[key]\n    }\n  }\n\n  let { frequency, damping } = config\n  const { mass } = config\n  if (!is.und(frequency)) {\n    if (frequency < 0.01) frequency = 0.01\n    if (damping < 0) damping = 0\n    config.tension = Math.pow((2 * Math.PI) / frequency, 2) * mass\n    config.friction = (4 * Math.PI * damping * mass) / frequency\n  }\n\n  return config\n}\n\n// Prevent a config from accidentally overriding new props.\n// This depends on which \"config\" props take precedence when defined.\nfunction sanitizeConfig(\n  config: Partial<AnimationConfig>,\n  props: Partial<AnimationConfig>\n) {\n  if (!is.und(props.decay)) {\n    config.duration = undefined\n  } else {\n    const isTensionConfig = !is.und(props.tension) || !is.und(props.friction)\n    if (\n      isTensionConfig ||\n      !is.und(props.frequency) ||\n      !is.und(props.damping) ||\n      !is.und(props.mass)\n    ) {\n      config.duration = undefined\n      config.decay = undefined\n    }\n    if (isTensionConfig) {\n      config.frequency = undefined\n    }\n  }\n}\n","// The `mass` prop defaults to 1\nexport const config = {\n  default: { tension: 170, friction: 26 },\n  gentle: { tension: 120, friction: 14 },\n  wobbly: { tension: 180, friction: 12 },\n  stiff: { tension: 210, friction: 20 },\n  slow: { tension: 280, friction: 60 },\n  molasses: { tension: 280, friction: 120 },\n} as const\n","import { AnimatedValue } from '@react-spring/animated'\nimport { FluidValue } from '@react-spring/shared'\nimport { AnimationConfig } from './AnimationConfig'\nimport { PickEventFns } from './types/internal'\nimport { SpringProps } from './types'\n\nconst emptyArray: readonly any[] = []\n\n/** An animation being executed by the frameloop */\nexport class Animation<T = any> {\n  changed = false\n  values: readonly AnimatedValue[] = emptyArray\n  toValues: readonly number[] | null = null\n  fromValues: readonly number[] = emptyArray\n\n  to!: T | FluidValue<T>\n  from!: T | FluidValue<T>\n  config = new AnimationConfig()\n  immediate = false\n}\n\nexport interface Animation<T> extends PickEventFns<SpringProps<T>> {}\n","import { Timeout, is, raf, Globals as G } from '@react-spring/shared'\nimport { matchProp, callProp } from './helpers'\nimport { AsyncResult, MatchProp } from './types'\nimport { RunAsyncState, RunAsyncProps } from './runAsync'\nimport {\n  AnimationResolver,\n  AnimationTarget,\n  InferProps,\n  InferState,\n} from './types/internal'\n\n// The `scheduleProps` function only handles these defaults.\ntype DefaultProps<T> = { cancel?: MatchProp<T>; pause?: MatchProp<T> }\n\ninterface ScheduledProps<T extends AnimationTarget> {\n  key?: string\n  props: InferProps<T>\n  defaultProps?: DefaultProps<InferState<T>>\n  state: RunAsyncState<T>\n  actions: {\n    pause: () => void\n    resume: () => void\n    start: (props: RunAsyncProps<T>, resolve: AnimationResolver<T>) => void\n  }\n}\n\n/**\n * This function sets a timeout if both the `delay` prop exists and\n * the `cancel` prop is not `true`.\n *\n * The `actions.start` function must handle the `cancel` prop itself,\n * but the `pause` prop is taken care of.\n */\nexport function scheduleProps<T extends AnimationTarget>(\n  callId: number,\n  { key, props, defaultProps, state, actions }: ScheduledProps<T>\n): AsyncResult<T> {\n  return new Promise((resolve, reject) => {\n    let delay: number\n    let timeout: Timeout\n\n    let cancel = matchProp(props.cancel ?? defaultProps?.cancel, key)\n    if (cancel) {\n      onStart()\n    } else {\n      // The `pause` prop updates the paused flag.\n      if (!is.und(props.pause)) {\n        state.paused = matchProp(props.pause, key)\n      }\n      // The default `pause` takes precedence when true,\n      // which allows `SpringContext` to work as expected.\n      let pause = defaultProps?.pause\n      if (pause !== true) {\n        pause = state.paused || matchProp(pause, key)\n      }\n\n      delay = callProp(props.delay || 0, key)\n      if (pause) {\n        state.resumeQueue.add(onResume)\n        actions.pause()\n      } else {\n        actions.resume()\n        onResume()\n      }\n    }\n\n    function onPause() {\n      state.resumeQueue.add(onResume)\n      state.timeouts.delete(timeout)\n      timeout.cancel()\n      // Cache the remaining delay.\n      delay = timeout.time - raf.now()\n    }\n\n    function onResume() {\n      if (delay > 0 && !G.skipAnimation) {\n        state.delayed = true\n        timeout = raf.setTimeout(onStart, delay)\n        state.pauseQueue.add(onPause)\n        state.timeouts.add(timeout)\n      } else {\n        onStart()\n      }\n    }\n\n    function onStart() {\n      if (state.delayed) {\n        state.delayed = false\n      }\n\n      state.pauseQueue.delete(onPause)\n      state.timeouts.delete(timeout)\n\n      // Maybe cancelled during its delay.\n      if (callId <= (state.cancelId || 0)) {\n        cancel = true\n      }\n\n      try {\n        actions.start({ ...props, callId, cancel }, resolve)\n      } catch (err) {\n        reject(err)\n      }\n    }\n  })\n}\n","import {\n  is,\n  raf,\n  flush,\n  eachProp,\n  Timeout,\n  Globals as G,\n} from '@react-spring/shared'\nimport { Falsy } from '@react-spring/types'\n\nimport { getDefaultProps } from './helpers'\nimport { AnimationTarget, InferState, InferProps } from './types/internal'\nimport { AnimationResult, AsyncResult, SpringChain, SpringToFn } from './types'\nimport { getCancelledResult, getFinishedResult } from './AnimationResult'\n\ntype AsyncTo<T> = SpringChain<T> | SpringToFn<T>\n\n/** @internal */\nexport type RunAsyncProps<T extends AnimationTarget = any> = InferProps<T> & {\n  callId: number\n  parentId?: number\n  cancel: boolean\n  to?: any\n}\n\n/** @internal */\nexport interface RunAsyncState<T extends AnimationTarget = any> {\n  paused: boolean\n  pauseQueue: Set<() => void>\n  resumeQueue: Set<() => void>\n  timeouts: Set<Timeout>\n  delayed?: boolean\n  asyncId?: number\n  asyncTo?: AsyncTo<InferState<T>>\n  promise?: AsyncResult<T>\n  cancelId?: number\n}\n\n/**\n * Start an async chain or an async script.\n *\n * Always call `runAsync` in the action callback of a `scheduleProps` call.\n *\n * The `T` parameter can be a set of animated values (as an object type)\n * or a primitive type for a single animated value.\n */\nexport function runAsync<T extends AnimationTarget>(\n  to: AsyncTo<InferState<T>>,\n  props: RunAsyncProps<T>,\n  state: RunAsyncState<T>,\n  target: T\n): AsyncResult<T> {\n  const { callId, parentId, onRest } = props\n  const { asyncTo: prevTo, promise: prevPromise } = state\n\n  if (!parentId && to === prevTo && !props.reset) {\n    return prevPromise!\n  }\n\n  return (state.promise = (async () => {\n    state.asyncId = callId\n    state.asyncTo = to\n\n    // The default props of any `animate` calls.\n    const defaultProps = getDefaultProps<InferProps<T>>(props, (value, key) =>\n      // The `onRest` prop is only called when the `runAsync` promise is resolved.\n      key === 'onRest' ? undefined : value\n    )\n\n    let preventBail!: () => void\n    let bail: (error: any) => void\n\n    // This promise is rejected when the animation is interrupted.\n    const bailPromise = new Promise<void>(\n      (resolve, reject) => ((preventBail = resolve), (bail = reject))\n    )\n\n    const bailIfEnded = (bailSignal: BailSignal) => {\n      const bailResult =\n        // The `cancel` prop or `stop` method was used.\n        (callId <= (state.cancelId || 0) && getCancelledResult(target)) ||\n        // The async `to` prop was replaced.\n        (callId !== state.asyncId && getFinishedResult(target, false))\n\n      if (bailResult) {\n        bailSignal.result = bailResult\n\n        // Reject the `bailPromise` to ensure the `runAsync` promise\n        // is not relying on the caller to rethrow the error for us.\n        bail(bailSignal)\n        throw bailSignal\n      }\n    }\n\n    const animate: any = (arg1: any, arg2?: any) => {\n      // Create the bail signal outside the returned promise,\n      // so the generated stack trace is relevant.\n      const bailSignal = new BailSignal()\n      const skipAnimationSignal = new SkipAnimationSignal()\n\n      return (async () => {\n        if (G.skipAnimation) {\n          /**\n           * We need to stop animations if `skipAnimation`\n           * is set in the Globals\n           *\n           */\n          stopAsync(state)\n\n          // create the rejection error that's handled gracefully\n          skipAnimationSignal.result = getFinishedResult(target, false)\n          bail(skipAnimationSignal)\n          throw skipAnimationSignal\n        }\n\n        bailIfEnded(bailSignal)\n\n        const props: any = is.obj(arg1) ? { ...arg1 } : { ...arg2, to: arg1 }\n        props.parentId = callId\n\n        eachProp(defaultProps, (value, key) => {\n          if (is.und(props[key])) {\n            props[key] = value\n          }\n        })\n\n        const result = await target.start(props)\n        bailIfEnded(bailSignal)\n\n        if (state.paused) {\n          await new Promise<void>(resume => {\n            state.resumeQueue.add(resume)\n          })\n        }\n\n        return result\n      })()\n    }\n\n    let result!: AnimationResult<T>\n\n    if (G.skipAnimation) {\n      /**\n       * We need to stop animations if `skipAnimation`\n       * is set in the Globals\n       */\n      stopAsync(state)\n      return getFinishedResult(target, false)\n    }\n\n    try {\n      let animating!: Promise<void>\n\n      // Async sequence\n      if (is.arr(to)) {\n        animating = (async (queue: any[]) => {\n          for (const props of queue) {\n            await animate(props)\n          }\n        })(to)\n      }\n\n      // Async script\n      else {\n        animating = Promise.resolve(to(animate, target.stop.bind(target)))\n      }\n\n      await Promise.all([animating.then(preventBail), bailPromise])\n      result = getFinishedResult(target.get(), true, false)\n\n      // Bail handling\n    } catch (err) {\n      if (err instanceof BailSignal) {\n        result = err.result\n      } else if (err instanceof SkipAnimationSignal) {\n        result = err.result\n      } else {\n        throw err\n      }\n\n      // Reset the async state.\n    } finally {\n      if (callId == state.asyncId) {\n        state.asyncId = parentId\n        state.asyncTo = parentId ? prevTo : undefined\n        state.promise = parentId ? prevPromise : undefined\n      }\n    }\n\n    if (is.fun(onRest)) {\n      raf.batchedUpdates(() => {\n        onRest(result, target, target.item)\n      })\n    }\n\n    return result\n  })())\n}\n\n/** Stop the current `runAsync` call with `finished: false` (or with `cancelled: true` when `cancelId` is defined) */\nexport function stopAsync(state: RunAsyncState, cancelId?: number | Falsy) {\n  flush(state.timeouts, t => t.cancel())\n  state.pauseQueue.clear()\n  state.resumeQueue.clear()\n  state.asyncId = state.asyncTo = state.promise = undefined\n  if (cancelId) state.cancelId = cancelId\n}\n\n/** This error is thrown to signal an interrupted async animation. */\nexport class BailSignal extends Error {\n  result!: AnimationResult\n  constructor() {\n    super(\n      'An async animation has been interrupted. You see this error because you ' +\n        'forgot to use `await` or `.catch(...)` on its returned promise.'\n    )\n  }\n}\n\nexport class SkipAnimationSignal extends Error {\n  result!: AnimationResult\n\n  constructor() {\n    super('SkipAnimationSignal')\n  }\n}\n","import { AnimationResult } from './types'\nimport { Readable } from './types/internal'\n\n/** @internal */\nexport const getCombinedResult = <T extends Readable>(\n  target: T,\n  results: AnimationResult<T>[]\n): AnimationResult<T> =>\n  results.length == 1\n    ? results[0]\n    : results.some(result => result.cancelled)\n    ? getCancelledResult(target.get())\n    : results.every(result => result.noop)\n    ? getNoopResult(target.get())\n    : getFinishedResult(\n        target.get(),\n        results.every(result => result.finished)\n      )\n\n/** No-op results are for updates that never start an animation. */\nexport const getNoopResult = (value: any) => ({\n  value,\n  noop: true,\n  finished: true,\n  cancelled: false,\n})\n\nexport const getFinishedResult = (\n  value: any,\n  finished: boolean,\n  cancelled = false\n) => ({\n  value,\n  finished,\n  cancelled,\n})\n\nexport const getCancelledResult = (value: any) => ({\n  value,\n  cancelled: true,\n  finished: false,\n})\n","import {\n  deprecateInterpolate,\n  frameLoop,\n  FluidValue,\n  Globals as G,\n  callFluidObservers,\n} from '@react-spring/shared'\nimport { InterpolatorArgs } from '@react-spring/types'\nimport { getAnimated } from '@react-spring/animated'\n\nimport { Interpolation } from './Interpolation'\n\nexport const isFrameValue = (value: any): value is FrameValue =>\n  value instanceof FrameValue\n\nlet nextId = 1\n\n/**\n * A kind of `FluidValue` that manages an `AnimatedValue` node.\n *\n * Its underlying value can be accessed and even observed.\n */\nexport abstract class FrameValue<T = any> extends FluidValue<\n  T,\n  FrameValue.Event<T>\n> {\n  readonly id = nextId++\n\n  abstract key?: string\n  abstract get idle(): boolean\n\n  protected _priority = 0\n\n  get priority() {\n    return this._priority\n  }\n  set priority(priority: number) {\n    if (this._priority != priority) {\n      this._priority = priority\n      this._onPriorityChange(priority)\n    }\n  }\n\n  /** Get the current value */\n  get(): T {\n    const node = getAnimated(this)\n    return node && node.getValue()\n  }\n\n  /** Create a spring that maps our value to another value */\n  to<Out>(...args: InterpolatorArgs<T, Out>) {\n    return G.to(this, args) as Interpolation<T, Out>\n  }\n\n  /** @deprecated Use the `to` method instead. */\n  interpolate<Out>(...args: InterpolatorArgs<T, Out>) {\n    deprecateInterpolate()\n    return G.to(this, args) as Interpolation<T, Out>\n  }\n\n  toJSON() {\n    return this.get()\n  }\n\n  protected observerAdded(count: number) {\n    if (count == 1) this._attach()\n  }\n\n  protected observerRemoved(count: number) {\n    if (count == 0) this._detach()\n  }\n\n  /** @internal */\n  abstract advance(dt: number): void\n\n  /** @internal */\n  abstract eventObserved(_event: FrameValue.Event): void\n\n  /** Called when the first child is added. */\n  protected _attach() {}\n\n  /** Called when the last child is removed. */\n  protected _detach() {}\n\n  /** Tell our children about our new value */\n  protected _onChange(value: T, idle = false) {\n    callFluidObservers(this, {\n      type: 'change',\n      parent: this,\n      value,\n      idle,\n    })\n  }\n\n  /** Tell our children about our new priority */\n  protected _onPriorityChange(priority: number) {\n    if (!this.idle) {\n      frameLoop.sort(this)\n    }\n    callFluidObservers(this, {\n      type: 'priority',\n      parent: this,\n      priority,\n    })\n  }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace FrameValue {\n  /** A parent changed its value */\n  interface ChangeEvent<T = any> {\n    parent: FrameValue<T>\n    type: 'change'\n    value: T\n    idle: boolean\n  }\n\n  /** A parent changed its priority */\n  interface PriorityEvent<T = any> {\n    parent: FrameValue<T>\n    type: 'priority'\n    priority: number\n  }\n\n  /** A parent is done animating */\n  interface IdleEvent<T = any> {\n    parent: FrameValue<T>\n    type: 'idle'\n  }\n\n  /** Events sent to children of `FrameValue` objects */\n  export type Event<T = any> = ChangeEvent<T> | PriorityEvent<T> | IdleEvent<T>\n}\n","/** The property symbol of the current animation phase. */\nconst $P = Symbol.for('SpringPhase')\n\nconst HAS_ANIMATED = 1\nconst IS_ANIMATING = 2\nconst IS_PAUSED = 4\n\n/** Returns true if the `target` has ever animated. */\nexport const hasAnimated = (target: any) => (target[$P] & HAS_ANIMATED) > 0\n\n/** Returns true if the `target` is animating (even if paused). */\nexport const isAnimating = (target: any) => (target[$P] & IS_ANIMATING) > 0\n\n/** Returns true if the `target` is paused (even if idle). */\nexport const isPaused = (target: any) => (target[$P] & IS_PAUSED) > 0\n\n/** Set the active bit of the `target` phase. */\nexport const setActiveBit = (target: any, active: boolean) =>\n  active\n    ? (target[$P] |= IS_ANIMATING | HAS_ANIMATED)\n    : (target[$P] &= ~IS_ANIMATING)\n\nexport const setPausedBit = (target: any, paused: boolean) =>\n  paused ? (target[$P] |= IS_PAUSED) : (target[$P] &= ~IS_PAUSED)\n","import { OneOrMore, UnknownProps, Lookup, Falsy } from '@react-spring/types'\nimport {\n  is,\n  raf,\n  each,\n  noop,\n  flush,\n  toArray,\n  eachProp,\n  flushCalls,\n  addFluidObserver,\n  FluidObserver,\n} from '@react-spring/shared'\n\nimport { getDefaultProp } from './helpers'\nimport { FrameValue } from './FrameValue'\nimport type { SpringRef } from './SpringRef'\nimport { SpringValue, createLoopUpdate, createUpdate } from './SpringValue'\nimport { getCancelledResult, getCombinedResult } from './AnimationResult'\nimport { runAsync, RunAsyncState, stopAsync } from './runAsync'\nimport { scheduleProps } from './scheduleProps'\nimport {\n  AnimationResult,\n  AsyncResult,\n  ControllerFlushFn,\n  ControllerUpdate,\n  OnChange,\n  OnRest,\n  OnStart,\n  SpringChain,\n  SpringToFn,\n  SpringValues,\n} from './types'\n\n/** Events batched by the `Controller` class */\nconst BATCHED_EVENTS = ['onStart', 'onChange', 'onRest'] as const\n\nlet nextId = 1\n\n/** Queue of pending updates for a `Controller` instance. */\nexport interface ControllerQueue<State extends Lookup = Lookup>\n  extends Array<\n    ControllerUpdate<State, any> & {\n      /** The keys affected by this update. When null, all keys are affected. */\n      keys: string[] | null\n    }\n  > {}\n\nexport class Controller<State extends Lookup = Lookup> {\n  readonly id = nextId++\n\n  /** The animated values */\n  springs: SpringValues<State> = {} as any\n\n  /** The queue of props passed to the `update` method. */\n  queue: ControllerQueue<State> = []\n\n  /**\n   * The injected ref. When defined, render-based updates are pushed\n   * onto the `queue` instead of being auto-started.\n   */\n  ref?: SpringRef<State>\n\n  /** Custom handler for flushing update queues */\n  protected _flush?: ControllerFlushFn<this>\n\n  /** These props are used by all future spring values */\n  protected _initialProps?: Lookup\n\n  /** The counter for tracking `scheduleProps` calls */\n  protected _lastAsyncId = 0\n\n  /** The values currently being animated */\n  protected _active = new Set<FrameValue>()\n\n  /** The values that changed recently */\n  protected _changed = new Set<FrameValue>()\n\n  /** Equals false when `onStart` listeners can be called */\n  protected _started = false\n\n  private _item?: any\n\n  /** State used by the `runAsync` function */\n  protected _state: RunAsyncState<this> = {\n    paused: false,\n    pauseQueue: new Set(),\n    resumeQueue: new Set(),\n    timeouts: new Set(),\n  }\n\n  /** The event queues that are flushed once per frame maximum */\n  protected _events = {\n    onStart: new Map<\n      OnStart<SpringValue<State>, Controller<State>, any>,\n      AnimationResult\n    >(),\n    onChange: new Map<\n      OnChange<SpringValue<State>, Controller<State>, any>,\n      AnimationResult\n    >(),\n    onRest: new Map<\n      OnRest<SpringValue<State>, Controller<State>, any>,\n      AnimationResult\n    >(),\n  }\n\n  constructor(\n    props?: ControllerUpdate<State> | null,\n    flush?: ControllerFlushFn<any>\n  ) {\n    this._onFrame = this._onFrame.bind(this)\n    if (flush) {\n      this._flush = flush\n    }\n    if (props) {\n      this.start({ default: true, ...props })\n    }\n  }\n\n  /**\n   * Equals `true` when no spring values are in the frameloop, and\n   * no async animation is currently active.\n   */\n  get idle() {\n    return (\n      !this._state.asyncTo &&\n      Object.values(this.springs as Lookup<SpringValue>).every(spring => {\n        return spring.idle && !spring.isDelayed && !spring.isPaused\n      })\n    )\n  }\n\n  get item() {\n    return this._item\n  }\n\n  set item(item) {\n    this._item = item\n  }\n\n  /** Get the current values of our springs */\n  get(): State & UnknownProps {\n    const values: any = {}\n    this.each((spring, key) => (values[key] = spring.get()))\n    return values\n  }\n\n  /** Set the current values without animating. */\n  set(values: Partial<State>) {\n    for (const key in values) {\n      const value = values[key]\n      if (!is.und(value)) {\n        this.springs[key].set(value)\n      }\n    }\n  }\n\n  /** Push an update onto the queue of each value. */\n  update(props: ControllerUpdate<State> | Falsy) {\n    if (props) {\n      this.queue.push(createUpdate(props))\n    }\n    return this\n  }\n\n  /**\n   * Start the queued animations for every spring, and resolve the returned\n   * promise once all queued animations have finished or been cancelled.\n   *\n   * When you pass a queue (instead of nothing), that queue is used instead of\n   * the queued animations added with the `update` method, which are left alone.\n   */\n  start(props?: OneOrMore<ControllerUpdate<State>> | null): AsyncResult<this> {\n    let { queue } = this as any\n    if (props) {\n      queue = toArray<any>(props).map(createUpdate)\n    } else {\n      this.queue = []\n    }\n\n    if (this._flush) {\n      return this._flush(this, queue)\n    }\n\n    prepareKeys(this, queue)\n    return flushUpdateQueue(this, queue)\n  }\n\n  /** Stop all animations. */\n  stop(): this\n  /** Stop animations for the given keys. */\n  stop(keys: OneOrMore<string>): this\n  /** Cancel all animations. */\n  stop(cancel: boolean): this\n  /** Cancel animations for the given keys. */\n  stop(cancel: boolean, keys: OneOrMore<string>): this\n  /** Stop some or all animations. */\n  stop(keys?: OneOrMore<string>): this\n  /** Cancel some or all animations. */\n  stop(cancel: boolean, keys?: OneOrMore<string>): this\n  /** @internal */\n  stop(arg?: boolean | OneOrMore<string>, keys?: OneOrMore<string>) {\n    if (arg !== !!arg) {\n      keys = arg as OneOrMore<string>\n    }\n    if (keys) {\n      const springs = this.springs as Lookup<SpringValue>\n      each(toArray(keys) as string[], key => springs[key].stop(!!arg))\n    } else {\n      stopAsync(this._state, this._lastAsyncId)\n      this.each(spring => spring.stop(!!arg))\n    }\n    return this\n  }\n\n  /** Freeze the active animation in time */\n  pause(keys?: OneOrMore<string>) {\n    if (is.und(keys)) {\n      this.start({ pause: true })\n    } else {\n      const springs = this.springs as Lookup<SpringValue>\n      each(toArray(keys) as string[], key => springs[key].pause())\n    }\n    return this\n  }\n\n  /** Resume the animation if paused. */\n  resume(keys?: OneOrMore<string>) {\n    if (is.und(keys)) {\n      this.start({ pause: false })\n    } else {\n      const springs = this.springs as Lookup<SpringValue>\n      each(toArray(keys) as string[], key => springs[key].resume())\n    }\n    return this\n  }\n\n  /** Call a function once per spring value */\n  each(iterator: (spring: SpringValue, key: string) => void) {\n    eachProp(this.springs, iterator as any)\n  }\n\n  /** @internal Called at the end of every animation frame */\n  protected _onFrame() {\n    const { onStart, onChange, onRest } = this._events\n\n    const active = this._active.size > 0\n    const changed = this._changed.size > 0\n\n    if ((active && !this._started) || (changed && !this._started)) {\n      this._started = true\n      flush(onStart, ([onStart, result]) => {\n        result.value = this.get()\n        onStart(result, this, this._item)\n      })\n    }\n\n    const idle = !active && this._started\n    const values = changed || (idle && onRest.size) ? this.get() : null\n\n    if (changed && onChange.size) {\n      flush(onChange, ([onChange, result]) => {\n        result.value = values\n        onChange(result, this, this._item)\n      })\n    }\n\n    // The \"onRest\" queue is only flushed when all springs are idle.\n    if (idle) {\n      this._started = false\n      flush(onRest, ([onRest, result]) => {\n        result.value = values\n        onRest(result, this, this._item)\n      })\n    }\n  }\n\n  /** @internal */\n  eventObserved(event: FrameValue.Event) {\n    if (event.type == 'change') {\n      this._changed.add(event.parent)\n      if (!event.idle) {\n        this._active.add(event.parent)\n      }\n    } else if (event.type == 'idle') {\n      this._active.delete(event.parent)\n    }\n    // The `onFrame` handler runs when a parent is changed or idle.\n    else return\n    raf.onFrame(this._onFrame)\n  }\n}\n\n/**\n * Warning: Props might be mutated.\n */\nexport function flushUpdateQueue(\n  ctrl: Controller<any>,\n  queue: ControllerQueue\n) {\n  return Promise.all(queue.map(props => flushUpdate(ctrl, props))).then(\n    results => getCombinedResult(ctrl, results)\n  )\n}\n\n/**\n * Warning: Props might be mutated.\n *\n * Process a single set of props using the given controller.\n *\n * The returned promise resolves to `true` once the update is\n * applied and any animations it starts are finished without being\n * stopped or cancelled.\n */\nexport async function flushUpdate(\n  ctrl: Controller<any>,\n  props: ControllerQueue[number],\n  isLoop?: boolean\n): AsyncResult {\n  const { keys, to, from, loop, onRest, onResolve } = props\n  const defaults = is.obj(props.default) && props.default\n\n  // Looping must be handled in this function, or else the values\n  // would end up looping out-of-sync in many common cases.\n  if (loop) {\n    props.loop = false\n  }\n\n  // Treat false like null, which gets ignored.\n  if (to === false) props.to = null\n  if (from === false) props.from = null\n\n  const asyncTo = is.arr(to) || is.fun(to) ? to : undefined\n  if (asyncTo) {\n    props.to = undefined\n    props.onRest = undefined\n    if (defaults) {\n      defaults.onRest = undefined\n    }\n  }\n  // For certain events, use batching to prevent multiple calls per frame.\n  // However, batching is avoided when the `to` prop is async, because any\n  // event props are used as default props instead.\n  else {\n    each(BATCHED_EVENTS, key => {\n      const handler: any = props[key]\n      if (is.fun(handler)) {\n        const queue = ctrl['_events'][key]\n        props[key] = (({ finished, cancelled }: AnimationResult) => {\n          const result = queue.get(handler)\n          if (result) {\n            if (!finished) result.finished = false\n            if (cancelled) result.cancelled = true\n          } else {\n            // The \"value\" is set before the \"handler\" is called.\n            queue.set(handler, {\n              value: null,\n              finished: finished || false,\n              cancelled: cancelled || false,\n            })\n          }\n        }) as any\n\n        // Avoid using a batched `handler` as a default prop.\n        if (defaults) {\n          defaults[key] = props[key] as any\n        }\n      }\n    })\n  }\n\n  const state = ctrl['_state']\n\n  // Pause/resume the `asyncTo` when `props.pause` is true/false.\n  if (props.pause === !state.paused) {\n    state.paused = props.pause\n    flushCalls(props.pause ? state.pauseQueue : state.resumeQueue)\n  }\n  // When a controller is paused, its values are also paused.\n  else if (state.paused) {\n    props.pause = true\n  }\n\n  const promises: AsyncResult[] = (keys || Object.keys(ctrl.springs)).map(key =>\n    ctrl.springs[key]!.start(props as any)\n  )\n\n  const cancel =\n    props.cancel === true || getDefaultProp(props, 'cancel') === true\n\n  if (asyncTo || (cancel && state.asyncId)) {\n    promises.push(\n      scheduleProps(++ctrl['_lastAsyncId'], {\n        props,\n        state,\n        actions: {\n          pause: noop,\n          resume: noop,\n          start(props, resolve) {\n            if (cancel) {\n              stopAsync(state, ctrl['_lastAsyncId'])\n              resolve(getCancelledResult(ctrl))\n            } else {\n              props.onRest = onRest\n              resolve(\n                runAsync(\n                  asyncTo as SpringChain | SpringToFn,\n                  props,\n                  state,\n                  ctrl\n                )\n              )\n            }\n          },\n        },\n      })\n    )\n  }\n\n  // Pause after updating each spring, so they can be resumed separately\n  // and so their default `pause` and `cancel` props are updated.\n  if (state.paused) {\n    // Ensure `this` must be resumed before the returned promise\n    // is resolved and before starting the next `loop` repetition.\n    await new Promise<void>(resume => {\n      state.resumeQueue.add(resume)\n    })\n  }\n\n  const result = getCombinedResult<any>(ctrl, await Promise.all(promises))\n  if (loop && result.finished && !(isLoop && result.noop)) {\n    const nextProps = createLoopUpdate(props, loop, to)\n    if (nextProps) {\n      prepareKeys(ctrl, [nextProps])\n      return flushUpdate(ctrl, nextProps, true)\n    }\n  }\n  if (onResolve) {\n    raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item))\n  }\n  return result\n}\n\n/**\n * From an array of updates, get the map of `SpringValue` objects\n * by their keys. Springs are created when any update wants to\n * animate a new key.\n *\n * Springs created by `getSprings` are neither cached nor observed\n * until they're given to `setSprings`.\n */\nexport function getSprings<State extends Lookup>(\n  ctrl: Controller<Lookup<any>>,\n  props?: OneOrMore<ControllerUpdate<State>>\n) {\n  const springs = { ...ctrl.springs }\n  if (props) {\n    each(toArray(props), (props: any) => {\n      if (is.und(props.keys)) {\n        props = createUpdate(props)\n      }\n      if (!is.obj(props.to)) {\n        // Avoid passing array/function to each spring.\n        props = { ...props, to: undefined }\n      }\n      prepareSprings(springs as any, props, key => {\n        return createSpring(key)\n      })\n    })\n  }\n  setSprings(ctrl, springs)\n  return springs\n}\n\n/**\n * Tell a controller to manage the given `SpringValue` objects\n * whose key is not already in use.\n */\nexport function setSprings(\n  ctrl: Controller<Lookup<any>>,\n  springs: SpringValues<UnknownProps>\n) {\n  eachProp(springs, (spring, key) => {\n    if (!ctrl.springs[key]) {\n      ctrl.springs[key] = spring\n      addFluidObserver(spring, ctrl)\n    }\n  })\n}\n\nfunction createSpring(key: string, observer?: FluidObserver<FrameValue.Event>) {\n  const spring = new SpringValue()\n  spring.key = key\n  if (observer) {\n    addFluidObserver(spring, observer)\n  }\n  return spring\n}\n\n/**\n * Ensure spring objects exist for each defined key.\n *\n * Using the `props`, the `Animated` node of each `SpringValue` may\n * be created or updated.\n */\nfunction prepareSprings(\n  springs: SpringValues,\n  props: ControllerQueue[number],\n  create: (key: string) => SpringValue\n) {\n  if (props.keys) {\n    each(props.keys, key => {\n      const spring = springs[key] || (springs[key] = create(key))\n      spring['_prepareNode'](props)\n    })\n  }\n}\n\n/**\n * Ensure spring objects exist for each defined key, and attach the\n * `ctrl` to them for observation.\n *\n * The queue is expected to contain `createUpdate` results.\n */\nfunction prepareKeys(ctrl: Controller<any>, queue: ControllerQueue[number][]) {\n  each(queue, props => {\n    prepareSprings(ctrl.springs, props, key => {\n      return createSpring(key, ctrl)\n    })\n  })\n}\n","import * as React from 'react'\nimport { useContext, PropsWithChildren } from 'react'\nimport { useMemoOne } from '@react-spring/shared'\n\n/**\n * This context affects all new and existing `SpringValue` objects\n * created with the hook API or the renderprops API.\n */\nexport interface SpringContext {\n  /** Pause all new and existing animations. */\n  pause?: boolean\n  /** Force all new and existing animations to be immediate. */\n  immediate?: boolean\n}\n\nexport const SpringContext = ({\n  children,\n  ...props\n}: PropsWithChildren<SpringContext>) => {\n  const inherited = useContext(ctx)\n\n  // Inherited values are dominant when truthy.\n  const pause = props.pause || !!inherited.pause,\n    immediate = props.immediate || !!inherited.immediate\n\n  // Memoize the context to avoid unwanted renders.\n  props = useMemoOne(() => ({ pause, immediate }), [pause, immediate])\n\n  const { Provider } = ctx\n  return <Provider value={props}>{children}</Provider>\n}\n\nconst ctx = makeContext(SpringContext, {} as SpringContext)\n\n// Allow `useContext(SpringContext)` in TypeScript.\nSpringContext.Provider = ctx.Provider\nSpringContext.Consumer = ctx.Consumer\n\n/** Make the `target` compatible with `useContext` */\nfunction makeContext<T>(target: any, init: T): React.Context<T> {\n  Object.assign(target, React.createContext(init))\n  target.Provider._context = target\n  target.Consumer._context = target\n  return target\n}\n","import { each, is, deprecateDirectCall } from '@react-spring/shared'\nimport { Lookup, Falsy, OneOrMore } from '@react-spring/types'\nimport { AsyncResult, ControllerUpdate } from './types'\nimport { Controller } from './Controller'\n\nexport interface ControllerUpdateFn<State extends Lookup = Lookup> {\n  (i: number, ctrl: Controller<State>): ControllerUpdate<State> | Falsy\n}\n\nexport interface SpringRef<State extends Lookup = Lookup> {\n  (props?: ControllerUpdate<State> | ControllerUpdateFn<State>): AsyncResult<\n    Controller<State>\n  >[]\n  current: Controller<State>[]\n\n  /** Add a controller to this ref */\n  add(ctrl: Controller<State>): void\n\n  /** Remove a controller from this ref */\n  delete(ctrl: Controller<State>): void\n\n  /** Pause all animations. */\n  pause(): this\n  /** Pause animations for the given keys. */\n  pause(keys: OneOrMore<string>): this\n  /** Pause some or all animations. */\n  pause(keys?: OneOrMore<string>): this\n\n  /** Resume all animations. */\n  resume(): this\n  /** Resume animations for the given keys. */\n  resume(keys: OneOrMore<string>): this\n  /** Resume some or all animations. */\n  resume(keys?: OneOrMore<string>): this\n\n  /** Update the state of each controller without animating. */\n  set(values: Partial<State>): void\n  /** Update the state of each controller without animating based on their passed state. */\n  set(values: (index: number, ctrl: Controller<State>) => Partial<State>): void\n\n  /** Start the queued animations of each controller. */\n  start(): AsyncResult<Controller<State>>[]\n  /** Update every controller with the same props. */\n  start(props: ControllerUpdate<State>): AsyncResult<Controller<State>>[]\n  /** Update controllers based on their state. */\n  start(props: ControllerUpdateFn<State>): AsyncResult<Controller<State>>[]\n  /** Start animating each controller. */\n  start(\n    props?: ControllerUpdate<State> | ControllerUpdateFn<State>\n  ): AsyncResult<Controller<State>>[]\n\n  /** Stop all animations. */\n  stop(): this\n  /** Stop animations for the given keys. */\n  stop(keys: OneOrMore<string>): this\n  /** Cancel all animations. */\n  stop(cancel: boolean): this\n  /** Cancel animations for the given keys. */\n  stop(cancel: boolean, keys: OneOrMore<string>): this\n  /** Stop some or all animations. */\n  stop(keys?: OneOrMore<string>): this\n  /** Cancel some or all animations. */\n  stop(cancel: boolean, keys?: OneOrMore<string>): this\n\n  /** Add the same props to each controller's update queue. */\n  update(props: ControllerUpdate<State>): this\n  /** Generate separate props for each controller's update queue. */\n  update(props: ControllerUpdateFn<State>): this\n  /** Add props to each controller's update queue. */\n  update(props: ControllerUpdate<State> | ControllerUpdateFn<State>): this\n\n  _getProps(\n    arg: ControllerUpdate<State> | ControllerUpdateFn<State>,\n    ctrl: Controller<State>,\n    index: number\n  ): ControllerUpdate<State> | Falsy\n}\n\nexport const SpringRef = <\n  State extends Lookup = Lookup\n>(): SpringRef<State> => {\n  const current: Controller<State>[] = []\n\n  const SpringRef: SpringRef<State> = function (props) {\n    deprecateDirectCall()\n\n    const results: AsyncResult[] = []\n\n    each(current, (ctrl, i) => {\n      if (is.und(props)) {\n        results.push(ctrl.start())\n      } else {\n        const update = _getProps(props, ctrl, i)\n        if (update) {\n          results.push(ctrl.start(update))\n        }\n      }\n    })\n\n    return results\n  }\n\n  SpringRef.current = current\n\n  /** Add a controller to this ref */\n  SpringRef.add = function (ctrl: Controller<State>) {\n    if (!current.includes(ctrl)) {\n      current.push(ctrl)\n    }\n  }\n\n  /** Remove a controller from this ref */\n  SpringRef.delete = function (ctrl: Controller<State>) {\n    const i = current.indexOf(ctrl)\n    if (~i) current.splice(i, 1)\n  }\n\n  /** Pause all animations. */\n  SpringRef.pause = function () {\n    each(current, ctrl => ctrl.pause(...arguments))\n    return this\n  }\n\n  /** Resume all animations. */\n  SpringRef.resume = function () {\n    each(current, ctrl => ctrl.resume(...arguments))\n    return this\n  }\n\n  /** Update the state of each controller without animating. */\n  SpringRef.set = function (\n    values:\n      | Partial<State>\n      | ((i: number, ctrl: Controller<State>) => Partial<State>)\n  ) {\n    each(current, (ctrl, i) => {\n      const update = is.fun(values) ? values(i, ctrl) : values\n      if (update) {\n        ctrl.set(update)\n      }\n    })\n  }\n\n  SpringRef.start = function (props?: object | ControllerUpdateFn<State>) {\n    const results: AsyncResult[] = []\n\n    each(current, (ctrl, i) => {\n      if (is.und(props)) {\n        results.push(ctrl.start())\n      } else {\n        const update = this._getProps(props, ctrl, i)\n        if (update) {\n          results.push(ctrl.start(update))\n        }\n      }\n    })\n\n    return results\n  }\n\n  /** Stop all animations. */\n  SpringRef.stop = function () {\n    each(current, ctrl => ctrl.stop(...arguments))\n    return this\n  }\n\n  SpringRef.update = function (props: object | ControllerUpdateFn<State>) {\n    each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i)))\n    return this\n  }\n\n  /** Overridden by `useTrail` to manipulate props */\n  const _getProps = function (\n    arg: ControllerUpdate<State> | ControllerUpdateFn<State>,\n    ctrl: Controller<State>,\n    index: number\n  ) {\n    return is.fun(arg) ? arg(index, ctrl) : arg\n  }\n\n  SpringRef._getProps = _getProps\n\n  return SpringRef\n}\n","import { useState } from 'react'\nimport { Lookup } from '@react-spring/types'\nimport { SpringRef } from '../SpringRef'\nimport type { SpringRef as SpringRefType } from '../SpringRef'\n\nconst initSpringRef = () => SpringRef<any>()\n\nexport const useSpringRef = <State extends Lookup = Lookup>() =>\n  useState(initSpringRef)[0] as SpringRefType<State>\n","import { useConstant, useOnce } from '@react-spring/shared'\n\nimport { SpringValue } from '../SpringValue'\nimport { SpringUpdate } from '../types'\n\n/**\n * Creates a constant single `SpringValue` that can be interacted\n * with imperatively. This is an advanced API and does not react\n * to updates from the parent component e.g. passing a new initial value\n *\n *\n * ```jsx\n * export const MyComponent = () => {\n *   const opacity = useSpringValue(1)\n *\n *   return <animated.div style={{ opacity }} />\n * }\n * ```\n *\n * @param initial – The initial value of the `SpringValue`.\n * @param props – Typically the same props as `useSpring` e.g. `config`, `loop` etc.\n *\n * @public\n */\nexport const useSpringValue = <T>(\n  initial: Exclude<T, object>,\n  props?: SpringUpdate<T>\n) => {\n  const springValue = useConstant(() => new SpringValue(initial, props))\n\n  useOnce(() => () => {\n    springValue.stop()\n  })\n\n  return springValue\n}\n","import { each, is, useIsomorphicLayoutEffect } from '@react-spring/shared'\nimport { Lookup } from '@react-spring/types'\n\nimport { Valid } from '../types/common'\nimport { PickAnimated, SpringValues } from '../types'\n\nimport { SpringRef } from '../SpringRef'\nimport { Controller } from '../Controller'\n\nimport { UseSpringProps } from './useSpring'\nimport { useSprings } from './useSprings'\nimport { replaceRef } from '../helpers'\n\nexport type UseTrailProps<Props extends object = any> = UseSpringProps<Props>\n\nexport function useTrail<Props extends object>(\n  length: number,\n  props: (\n    i: number,\n    ctrl: Controller\n  ) => UseTrailProps | (Props & Valid<Props, UseTrailProps<Props>>),\n  deps?: readonly any[]\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup<any>\n    ? [SpringValues<State>[], SpringRef<State>]\n    : never\n  : never\n\n/**\n * This hook is an abstraction around `useSprings` and is designed to\n * automatically orchestrate the springs to stagger one after the other\n *\n * ```jsx\n * export const MyComponent = () => {\n *  const trails = useTrail(3, {opacity: 0})\n *\n *  return trails.map(styles => <animated.div style={styles} />)\n * }\n * ```\n *\n * @param length – The number of springs you want to create\n * @param propsArg – The props to pass to the internal `useSprings` hook,\n * therefore is the same as `useSprings`.\n *\n * @public\n */\nexport function useTrail<Props extends object>(\n  length: number,\n  props: UseTrailProps | (Props & Valid<Props, UseTrailProps<Props>>)\n): SpringValues<PickAnimated<Props>>[]\n\n/**\n * This hook is an abstraction around `useSprings` and is designed to\n * automatically orchestrate the springs to stagger one after the other\n *\n * ```jsx\n * export const MyComponent = () => {\n *  const trails = useTrail(3, {opacity: 0}, [])\n *\n *  return trails.map(styles => <animated.div style={styles} />)\n * }\n * ```\n *\n * @param length – The number of springs you want to create\n * @param propsArg – The props to pass to the internal `useSprings` hook,\n * therefore is the same as `useSprings`.\n * @param deps – The optional array of dependencies to pass to the internal\n * `useSprings` hook, therefore is the same as `useSprings`.\n *\n * @public\n */\nexport function useTrail<Props extends object>(\n  length: number,\n  props: UseTrailProps | (Props & Valid<Props, UseTrailProps<Props>>),\n  deps: readonly any[]\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup<any>\n    ? [SpringValues<State>[], SpringRef<State>]\n    : never\n  : never\n\nexport function useTrail(\n  length: number,\n  propsArg: unknown,\n  deps?: readonly any[]\n) {\n  const propsFn = is.fun(propsArg) && propsArg\n  if (propsFn && !deps) deps = []\n\n  // The trail is reversed when every render-based update is reversed.\n  let reverse = true\n  let passedRef: SpringRef | undefined = undefined\n\n  const result = useSprings(\n    length,\n    (i, ctrl) => {\n      const props = propsFn ? propsFn(i, ctrl) : propsArg\n      passedRef = props.ref\n      reverse = reverse && props.reverse\n\n      return props\n    },\n    // Ensure the props function is called when no deps exist.\n    // This works around the 3 argument rule.\n    deps || [{}]\n  )\n\n  useIsomorphicLayoutEffect(() => {\n    /**\n     * Run through the ref passed by the `useSprings` hook.\n     */\n    each(result[1].current, (ctrl, i) => {\n      const parent = result[1].current[i + (reverse ? 1 : -1)]\n\n      /**\n       * If there's a passed ref then we replace the ctrl ref with it\n       */\n      replaceRef(ctrl, passedRef)\n\n      /**\n       * And if there's a ctrl ref then we update instead of start\n       * which means nothing is fired until the start method\n       * of said passedRef is called.\n       */\n      if (ctrl.ref) {\n        if (parent) {\n          ctrl.update({ to: parent.springs })\n        }\n\n        return\n      }\n\n      if (parent) {\n        ctrl.start({ to: parent.springs })\n      } else {\n        ctrl.start()\n      }\n    })\n  }, deps)\n\n  if (propsFn || arguments.length == 3) {\n    const ref = passedRef ?? result[1]\n\n    ref['_getProps'] = (propsArg, ctrl, i) => {\n      const props = is.fun(propsArg) ? propsArg(i, ctrl) : propsArg\n      if (props) {\n        const parent = ref.current[i + (props.reverse ? 1 : -1)]\n        if (parent) props.to = parent.springs\n        return props\n      }\n    }\n    return result\n  }\n\n  return result[0]\n}\n","import * as React from 'react'\nimport { useContext, useRef, useMemo } from 'react'\nimport { Lookup, OneOrMore, UnknownProps } from '@react-spring/types'\nimport {\n  is,\n  toArray,\n  useForceUpdate,\n  useOnce,\n  usePrev,\n  each,\n  useIsomorphicLayoutEffect,\n} from '@react-spring/shared'\n\nimport {\n  Change,\n  ControllerUpdate,\n  ItemKeys,\n  PickAnimated,\n  TransitionFn,\n  TransitionState,\n  TransitionTo,\n  UseTransitionProps,\n} from '../types'\nimport { Valid } from '../types/common'\nimport {\n  callProp,\n  detachRefs,\n  getDefaultProps,\n  hasProps,\n  inferTo,\n  replaceRef,\n} from '../helpers'\nimport { Controller, getSprings } from '../Controller'\nimport { SpringContext } from '../SpringContext'\nimport { SpringRef } from '../SpringRef'\nimport type { SpringRef as SpringRefType } from '../SpringRef'\nimport { TransitionPhase } from '../TransitionPhase'\n\ndeclare function setTimeout(handler: Function, timeout?: number): number\ndeclare function clearTimeout(timeoutId: number): void\n\nexport function useTransition<Item, Props extends object>(\n  data: OneOrMore<Item>,\n  props: () =>\n    | UseTransitionProps<Item>\n    | (Props & Valid<Props, UseTransitionProps<Item>>),\n  deps?: any[]\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? [TransitionFn<Item, PickAnimated<Props>>, SpringRefType<State>]\n    : never\n  : never\n\nexport function useTransition<Item, Props extends object>(\n  data: OneOrMore<Item>,\n  props:\n    | UseTransitionProps<Item>\n    | (Props & Valid<Props, UseTransitionProps<Item>>)\n): TransitionFn<Item, PickAnimated<Props>>\n\nexport function useTransition<Item, Props extends object>(\n  data: OneOrMore<Item>,\n  props:\n    | UseTransitionProps<Item>\n    | (Props & Valid<Props, UseTransitionProps<Item>>),\n  deps: any[] | undefined\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? [TransitionFn<Item, State>, SpringRefType<State>]\n    : never\n  : never\n\nexport function useTransition(\n  data: unknown,\n  props: UseTransitionProps | (() => any),\n  deps?: any[]\n): any {\n  const propsFn = is.fun(props) && props\n\n  const {\n    reset,\n    sort,\n    trail = 0,\n    expires = true,\n    exitBeforeEnter = false,\n    onDestroyed,\n    ref: propsRef,\n    config: propsConfig,\n  }: UseTransitionProps<any> = propsFn ? propsFn() : props\n\n  // Return a `SpringRef` if a deps array was passed.\n  const ref = useMemo(\n    () => (propsFn || arguments.length == 3 ? SpringRef() : void 0),\n    []\n  )\n\n  // Every item has its own transition.\n  const items = toArray(data)\n  const transitions: TransitionState[] = []\n\n  // The \"onRest\" callbacks need a ref to the latest transitions.\n  const usedTransitions = useRef<TransitionState[] | null>(null)\n  const prevTransitions = reset ? null : usedTransitions.current\n\n  useIsomorphicLayoutEffect(() => {\n    usedTransitions.current = transitions\n  })\n\n  useOnce(() => {\n    /**\n     * If transitions exist on mount of the component\n     * then reattach their refs on-mount, this was required\n     * for react18 strict mode to work properly.\n     *\n     * See https://github.com/pmndrs/react-spring/issues/1890\n     */\n\n    each(transitions, t => {\n      ref?.add(t.ctrl)\n      t.ctrl.ref = ref\n    })\n\n    // Destroy all transitions on dismount.\n    return () => {\n      each(usedTransitions.current!, t => {\n        if (t.expired) {\n          clearTimeout(t.expirationId!)\n        }\n        detachRefs(t.ctrl, ref)\n        t.ctrl.stop(true)\n      })\n    }\n  })\n\n  // Keys help with reusing transitions between renders.\n  // The `key` prop can be undefined (which means the items themselves are used\n  // as keys), or a function (which maps each item to its key), or an array of\n  // keys (which are assigned to each item by index).\n  const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions)\n\n  // Expired transitions that need clean up.\n  const expired = (reset && usedTransitions.current) || []\n  useIsomorphicLayoutEffect(() =>\n    each(expired, ({ ctrl, item, key }) => {\n      detachRefs(ctrl, ref)\n      callProp(onDestroyed, item, key)\n    })\n  )\n\n  // Map old indices to new indices.\n  const reused: number[] = []\n  if (prevTransitions)\n    each(prevTransitions, (t, i) => {\n      // Expired transitions are not rendered.\n      if (t.expired) {\n        clearTimeout(t.expirationId!)\n        expired.push(t)\n      } else {\n        i = reused[i] = keys.indexOf(t.key)\n        if (~i) transitions[i] = t\n      }\n    })\n\n  // Mount new items with fresh transitions.\n  each(items, (item, i) => {\n    if (!transitions[i]) {\n      transitions[i] = {\n        key: keys[i],\n        item,\n        phase: TransitionPhase.MOUNT,\n        ctrl: new Controller(),\n      }\n\n      transitions[i].ctrl.item = item\n    }\n  })\n\n  // Update the item of any transition whose key still exists,\n  // and ensure leaving transitions are rendered until they finish.\n  if (reused.length) {\n    let i = -1\n    const { leave }: UseTransitionProps<any> = propsFn ? propsFn() : props\n    each(reused, (keyIndex, prevIndex) => {\n      const t = prevTransitions![prevIndex]\n      if (~keyIndex) {\n        i = transitions.indexOf(t)\n        transitions[i] = { ...t, item: items[keyIndex] }\n      } else if (leave) {\n        transitions.splice(++i, 0, t)\n      }\n    })\n  }\n\n  if (is.fun(sort)) {\n    transitions.sort((a, b) => sort(a.item, b.item))\n  }\n\n  // Track cumulative delay for the \"trail\" prop.\n  let delay = -trail\n\n  // Expired transitions use this to dismount.\n  const forceUpdate = useForceUpdate()\n\n  // These props are inherited by every phase change.\n  const defaultProps = getDefaultProps<UseTransitionProps>(props)\n  // Generate changes to apply in useEffect.\n  const changes = new Map<TransitionState, Change>()\n  const exitingTransitions = useRef(new Map<TransitionState, Change>())\n\n  const forceChange = useRef(false)\n  each(transitions, (t, i) => {\n    const key = t.key\n    const prevPhase = t.phase\n\n    const p: UseTransitionProps<any> = propsFn ? propsFn() : props\n\n    let to: TransitionTo<any>\n    let phase: TransitionPhase\n\n    const propsDelay = callProp(p.delay || 0, key)\n\n    if (prevPhase == TransitionPhase.MOUNT) {\n      to = p.enter\n      phase = TransitionPhase.ENTER\n    } else {\n      const isLeave = keys.indexOf(key) < 0\n      if (prevPhase != TransitionPhase.LEAVE) {\n        if (isLeave) {\n          to = p.leave\n          phase = TransitionPhase.LEAVE\n        } else if ((to = p.update)) {\n          phase = TransitionPhase.UPDATE\n        } else return\n      } else if (!isLeave) {\n        to = p.enter\n        phase = TransitionPhase.ENTER\n      } else return\n    }\n\n    // When \"to\" is a function, it can return (1) an array of \"useSpring\" props,\n    // (2) an async function, or (3) an object with any \"useSpring\" props.\n    to = callProp(to, t.item, i)\n    to = is.obj(to) ? inferTo(to) : { to }\n\n    /**\n     * This would allow us to give different delays for phases.\n     * If we were to do this, we'd have to suffle the prop\n     * spreading below to set delay last.\n     * But if we were going to do that, we should consider letting\n     * the prop trail also be part of a phase.\n     */\n    // if (to.delay) {\n    //   phaseDelay = callProp(to.delay, key)\n    // }\n\n    if (!to.config) {\n      const config = propsConfig || defaultProps.config\n      to.config = callProp(config, t.item, i, phase)\n    }\n\n    delay += trail\n\n    // The payload is used to update the spring props once the current render is committed.\n    const payload: ControllerUpdate<UnknownProps> = {\n      ...defaultProps,\n      // we need to add our props.delay value you here.\n      delay: propsDelay + delay,\n      ref: propsRef,\n      immediate: p.immediate,\n      // This prevents implied resets.\n      reset: false,\n      // Merge any phase-specific props.\n      ...(to as any),\n    }\n\n    if (phase == TransitionPhase.ENTER && is.und(payload.from)) {\n      const p = propsFn ? propsFn() : props\n      // The `initial` prop is used on the first render of our parent component,\n      // as well as when `reset: true` is passed. It overrides the `from` prop\n      // when defined, and it makes `enter` instant when null.\n      const from = is.und(p.initial) || prevTransitions ? p.from : p.initial\n\n      payload.from = callProp(from, t.item, i)\n    }\n\n    const { onResolve } = payload\n    payload.onResolve = result => {\n      callProp(onResolve, result)\n\n      const transitions = usedTransitions.current!\n      const t = transitions.find(t => t.key === key)\n      if (!t) return\n\n      // Reset the phase of a cancelled enter/leave transition, so it can\n      // retry the animation on the next render.\n      if (result.cancelled && t.phase != TransitionPhase.UPDATE) {\n        /**\n         * @legacy Reset the phase of a cancelled enter/leave transition, so it can\n         * retry the animation on the next render.\n         *\n         * Note: leaving this here made the transitioned item respawn.\n         */\n        // t.phase = prevPhase\n        return\n      }\n\n      if (t.ctrl.idle) {\n        const idle = transitions.every(t => t.ctrl.idle)\n        if (t.phase == TransitionPhase.LEAVE) {\n          const expiry = callProp(expires, t.item)\n          if (expiry !== false) {\n            const expiryMs = expiry === true ? 0 : expiry\n            t.expired = true\n\n            // Force update once the expiration delay ends.\n            if (!idle && expiryMs > 0) {\n              // The maximum timeout is 2^31-1\n              if (expiryMs <= 0x7fffffff)\n                t.expirationId = setTimeout(forceUpdate, expiryMs)\n              return\n            }\n          }\n        }\n        // Force update once idle and expired items exist.\n        if (idle && transitions.some(t => t.expired)) {\n          /**\n           * Remove the exited transition from the list\n           * this may not exist but we'll try anyway.\n           */\n          exitingTransitions.current.delete(t)\n\n          if (exitBeforeEnter) {\n            /**\n             * If we have exitBeforeEnter == true\n             * we need to force the animation to start\n             */\n            forceChange.current = true\n          }\n\n          forceUpdate()\n        }\n      }\n    }\n\n    const springs = getSprings(t.ctrl, payload)\n\n    /**\n     * Make a separate map for the exiting changes and \"regular\" changes\n     */\n    if (phase === TransitionPhase.LEAVE && exitBeforeEnter) {\n      exitingTransitions.current.set(t, { phase, springs, payload })\n    } else {\n      changes.set(t, { phase, springs, payload })\n    }\n  })\n\n  // The prop overrides from an ancestor.\n  const context = useContext(SpringContext)\n  const prevContext = usePrev(context)\n  const hasContext = context !== prevContext && hasProps(context)\n\n  // Merge the context into each transition.\n  useIsomorphicLayoutEffect(() => {\n    if (hasContext) {\n      each(transitions, t => {\n        t.ctrl.start({ default: context })\n      })\n    }\n  }, [context])\n\n  each(changes, (_, t) => {\n    /**\n     * If we have children to exit because exitBeforeEnter is\n     * set to true, we remove the transitions so they go to back\n     * to their initial state.\n     */\n    if (exitingTransitions.current.size) {\n      const ind = transitions.findIndex(state => state.key === t.key)\n      transitions.splice(ind, 1)\n    }\n  })\n\n  useIsomorphicLayoutEffect(\n    () => {\n      /*\n       * if exitingTransitions.current has a size it means we're exiting before enter\n       * so we want to map through those and fire those first.\n       */\n      each(\n        exitingTransitions.current.size ? exitingTransitions.current : changes,\n        ({ phase, payload }, t) => {\n          const { ctrl } = t\n\n          t.phase = phase\n\n          // Attach the controller to our local ref.\n          ref?.add(ctrl)\n\n          // Merge the context into new items.\n          if (hasContext && phase == TransitionPhase.ENTER) {\n            ctrl.start({ default: context })\n          }\n\n          if (payload) {\n            // Update the injected ref if needed.\n            replaceRef(ctrl, payload.ref)\n\n            /**\n             * When an injected ref exists, the update is postponed\n             * until the ref has its `start` method called.\n             * Unless we have exitBeforeEnter in which case will skip\n             * to enter the new animation straight away as if they \"overlapped\"\n             */\n            if ((ctrl.ref || ref) && !forceChange.current) {\n              ctrl.update(payload)\n            } else {\n              ctrl.start(payload)\n\n              if (forceChange.current) {\n                forceChange.current = false\n              }\n            }\n          }\n        }\n      )\n    },\n    reset ? void 0 : deps\n  )\n\n  const renderTransitions: TransitionFn = render => (\n    <>\n      {transitions.map((t, i) => {\n        const { springs } = changes.get(t) || t.ctrl\n        const elem: any = render({ ...springs }, t.item, t, i)\n        return elem && elem.type ? (\n          <elem.type\n            {...elem.props}\n            key={is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id}\n            ref={elem.ref}\n          />\n        ) : (\n          elem\n        )\n      })}\n    </>\n  )\n\n  return ref ? [renderTransitions, ref] : renderTransitions\n}\n\n/** Local state for auto-generated item keys */\nlet nextKey = 1\n\nfunction getKeys(\n  items: readonly any[],\n  { key, keys = key }: { key?: ItemKeys; keys?: ItemKeys },\n  prevTransitions: TransitionState[] | null\n): readonly any[] {\n  if (keys === null) {\n    const reused = new Set()\n    return items.map(item => {\n      const t =\n        prevTransitions &&\n        prevTransitions.find(\n          t =>\n            t.item === item &&\n            t.phase !== TransitionPhase.LEAVE &&\n            !reused.has(t)\n        )\n      if (t) {\n        reused.add(t)\n        return t.key\n      }\n      return nextKey++\n    })\n  }\n  return is.und(keys) ? items : is.fun(keys) ? items.map(keys) : toArray(keys)\n}\n","import { MutableRefObject } from 'react'\nimport { each, onScroll, useIsomorphicLayoutEffect } from '@react-spring/shared'\n\nimport { SpringProps, SpringValues } from '../types'\n\nimport { useSpring } from './useSpring'\n\nexport interface UseScrollOptions extends Omit<SpringProps, 'to' | 'from'> {\n  container?: MutableRefObject<HTMLElement>\n}\n\n/**\n * A small utility abstraction around our signature useSpring hook. It's a great way to create\n * a scroll-linked animation. With either the raw value of distance or a 0-1 progress value.\n * You can either use the scroll values of the whole document, or just a specific element.\n *\n * \n ```jsx\n    import { useScroll, animated } from '@react-spring/web'\n\n    function MyComponent() {\n      const { scrollYProgress } = useScroll()\n\n      return (\n        <animated.div style={{ opacity: scrollYProgress }}>\n          Hello World\n        </animated.div>\n      )\n    }\n  ```\n * \n * @param {UseScrollOptions} useScrollOptions options for the useScroll hook.\n * @param {MutableRefObject<HTMLElement>} useScrollOptions.container the container to listen to scroll events on, defaults to the window.\n *\n * @returns {SpringValues<{scrollX: number; scrollY: number; scrollXProgress: number; scrollYProgress: number}>} SpringValues the collection of values returned from the inner hook\n */\nexport const useScroll = ({\n  container,\n  ...springOptions\n}: UseScrollOptions = {}): SpringValues<{\n  scrollX: number\n  scrollY: number\n  scrollXProgress: number\n  scrollYProgress: number\n}> => {\n  const [scrollValues, api] = useSpring(\n    () => ({\n      scrollX: 0,\n      scrollY: 0,\n      scrollXProgress: 0,\n      scrollYProgress: 0,\n      ...springOptions,\n    }),\n    []\n  )\n\n  useIsomorphicLayoutEffect(() => {\n    const cleanupScroll = onScroll(\n      ({ x, y }) => {\n        api.start({\n          scrollX: x.current,\n          scrollXProgress: x.progress,\n          scrollY: y.current,\n          scrollYProgress: y.progress,\n        })\n      },\n      { container: container?.current || undefined }\n    )\n\n    return () => {\n      /**\n       * Stop the springs on unmount.\n       */\n      each(Object.values(scrollValues), value => value.stop())\n\n      cleanupScroll()\n    }\n  }, [])\n\n  return scrollValues\n}\n","import { MutableRefObject } from 'react'\nimport { onResize, each, useIsomorphicLayoutEffect } from '@react-spring/shared'\n\nimport { SpringProps, SpringValues } from '../types'\n\nimport { useSpring } from './useSpring'\n\nexport interface UseResizeOptions extends Omit<SpringProps, 'to' | 'from'> {\n  container?: MutableRefObject<HTMLElement | null | undefined>\n}\n\n/**\n * A small abstraction around the `useSpring` hook. It returns a `SpringValues` \n * object with the `width` and `height` of the element it's attached to & doesn't \n * necessarily have to be attached to the window, by passing a `container` you \n * can observe that element's size instead.\n * \n ```jsx\n    import { useResize, animated } from '@react-spring/web'\n\n    function MyComponent() {\n      const { width } = useResize()\n\n      return (\n        <animated.div style={{ width }}>\n          Hello World\n        </animated.div>\n      )\n    }\n  ```\n * \n * @param {UseResizeOptions} UseResizeOptions options for the useScroll hook.\n * @param {MutableRefObject<HTMLElement>} UseResizeOptions.container the container to listen to scroll events on, defaults to the window.\n *\n * @returns {SpringValues<{width: number; height: number;}>} SpringValues the collection of values returned from the inner hook\n */\nexport const useResize = ({\n  container,\n  ...springOptions\n}: UseResizeOptions): SpringValues<{\n  width: number\n  height: number\n}> => {\n  const [sizeValues, api] = useSpring(\n    () => ({\n      width: 0,\n      height: 0,\n      ...springOptions,\n    }),\n    []\n  )\n\n  useIsomorphicLayoutEffect(() => {\n    const cleanupScroll = onResize(\n      ({ width, height }) => {\n        api.start({\n          width,\n          height,\n          immediate:\n            sizeValues.width.get() === 0 || sizeValues.height.get() === 0,\n        })\n      },\n      { container: container?.current || undefined }\n    )\n\n    return () => {\n      /**\n       * Stop the springs on unmount.\n       */\n      each(Object.values(sizeValues), value => value.stop())\n\n      cleanupScroll()\n    }\n  }, [])\n\n  return sizeValues\n}\n","import { RefObject, useRef, useState } from 'react'\nimport { is, useIsomorphicLayoutEffect } from '@react-spring/shared'\nimport { Lookup } from '@react-spring/types'\n\nimport { PickAnimated, SpringValues } from '../types'\nimport { useSpring, UseSpringProps } from './useSpring'\nimport { Valid } from '../types/common'\n\nexport interface IntersectionArgs\n  extends Omit<IntersectionObserverInit, 'root' | 'threshold'> {\n  root?: React.MutableRefObject<HTMLElement>\n  once?: boolean\n  amount?: 'any' | 'all' | number | number[]\n}\n\nconst defaultThresholdOptions = {\n  any: 0,\n  all: 1,\n}\n\nexport function useInView(args?: IntersectionArgs): [RefObject<any>, boolean]\nexport function useInView<Props extends object>(\n  /**\n   * TODO: make this narrower to only accept reserved props.\n   */\n  props: () => Props & Valid<Props, UseSpringProps<Props>>,\n  args?: IntersectionArgs\n): PickAnimated<Props> extends infer State\n  ? State extends Lookup\n    ? [RefObject<any>, SpringValues<State>]\n    : never\n  : never\nexport function useInView<TElement extends HTMLElement>(\n  props?: (() => UseSpringProps<any>) | IntersectionArgs,\n  args?: IntersectionArgs\n) {\n  const [isInView, setIsInView] = useState(false)\n  const ref = useRef<TElement>()\n\n  const propsFn = is.fun(props) && props\n\n  const springsProps = propsFn ? propsFn() : {}\n  const { to = {}, from = {}, ...restSpringProps } = springsProps\n\n  const intersectionArguments = propsFn ? args : props\n\n  const [springs, api] = useSpring(() => ({ from, ...restSpringProps }), [])\n\n  useIsomorphicLayoutEffect(() => {\n    const element = ref.current\n    const {\n      root,\n      once,\n      amount = 'any',\n      ...restArgs\n    } = intersectionArguments ?? {}\n\n    if (\n      !element ||\n      (once && isInView) ||\n      typeof IntersectionObserver === 'undefined'\n    )\n      return\n\n    const activeIntersections = new WeakMap<Element, VoidFunction>()\n\n    const onEnter = () => {\n      if (to) {\n        api.start(to)\n      }\n\n      setIsInView(true)\n\n      const cleanup = () => {\n        if (from) {\n          api.start(from)\n        }\n        setIsInView(false)\n      }\n\n      return once ? undefined : cleanup\n    }\n\n    const handleIntersection: IntersectionObserverCallback = entries => {\n      entries.forEach(entry => {\n        const onLeave = activeIntersections.get(entry.target)\n\n        if (entry.isIntersecting === Boolean(onLeave)) {\n          return\n        }\n\n        if (entry.isIntersecting) {\n          const newOnLeave = onEnter()\n          if (is.fun(newOnLeave)) {\n            activeIntersections.set(entry.target, newOnLeave)\n          } else {\n            observer.unobserve(entry.target)\n          }\n        } else if (onLeave) {\n          onLeave()\n          activeIntersections.delete(entry.target)\n        }\n      })\n    }\n\n    const observer = new IntersectionObserver(handleIntersection, {\n      root: (root && root.current) || undefined,\n      threshold:\n        typeof amount === 'number' || Array.isArray(amount)\n          ? amount\n          : defaultThresholdOptions[amount],\n      ...restArgs,\n    })\n\n    observer.observe(element)\n\n    return () => observer.unobserve(element)\n  }, [intersectionArguments])\n\n  if (propsFn) {\n    return [ref, springs]\n  }\n\n  return [ref, isInView]\n}\n","import { NoInfer, UnknownProps } from '@react-spring/types'\nimport { useSpring, UseSpringProps } from '../hooks/useSpring'\nimport { SpringValues, SpringToFn, SpringChain } from '../types'\n\nexport type SpringComponentProps<State extends object = UnknownProps> =\n  unknown &\n    UseSpringProps<State> & {\n      children: (values: SpringValues<State>) => JSX.Element | null\n    }\n\n// Infer state from \"from\" object prop.\nexport function Spring<State extends object>(\n  props: {\n    from: State\n    to?: SpringChain<NoInfer<State>> | SpringToFn<NoInfer<State>>\n  } & Omit<SpringComponentProps<NoInfer<State>>, 'from' | 'to'>\n): JSX.Element | null\n\n// Infer state from \"to\" object prop.\nexport function Spring<State extends object>(\n  props: { to: State } & Omit<SpringComponentProps<NoInfer<State>>, 'to'>\n): JSX.Element | null\n\nexport function Spring({ children, ...props }: any) {\n  return children(useSpring(props))\n}\n","import { ReactNode } from 'react'\nimport { NoInfer, Falsy } from '@react-spring/types'\nimport { is } from '@react-spring/shared'\n\nimport { Valid } from '../types/common'\nimport { PickAnimated, SpringValues } from '../types'\nimport { UseSpringProps } from '../hooks/useSpring'\nimport { useTrail } from '../hooks/useTrail'\n\nexport type TrailComponentProps<Item, Props extends object = any> = unknown &\n  UseSpringProps<Props> & {\n    items: readonly Item[]\n    children: (\n      item: NoInfer<Item>,\n      index: number\n    ) => ((values: SpringValues<PickAnimated<Props>>) => ReactNode) | Falsy\n  }\n\nexport function Trail<Item, Props extends TrailComponentProps<Item>>({\n  items,\n  children,\n  ...props\n}: Props & Valid<Props, TrailComponentProps<Item, Props>>) {\n  const trails: any[] = useTrail(items.length, props)\n  return items.map((item, index) => {\n    const result = children(item, index)\n    return is.fun(result) ? result(trails[index]) : result\n  })\n}\n","import { Valid } from '../types/common'\nimport { TransitionComponentProps } from '../types'\nimport { useTransition } from '../hooks'\n\nexport function Transition<Item, Props extends TransitionComponentProps<Item>>(\n  props:\n    | TransitionComponentProps<Item>\n    | (Props & Valid<Props, TransitionComponentProps<Item, Props>>)\n): JSX.Element\n\nexport function Transition({\n  items,\n  children,\n  ...props\n}: TransitionComponentProps<any>) {\n  return useTransition(items, props)(children)\n}\n","import { FluidValue, deprecateInterpolate } from '@react-spring/shared'\nimport {\n  Constrain,\n  OneOrMore,\n  Animatable,\n  ExtrapolateType,\n  InterpolatorConfig,\n  InterpolatorFn,\n} from '@react-spring/types'\nimport { Interpolation } from './Interpolation'\n\n/** Map the value of one or more dependencies */\nexport const to: Interpolator = (source: any, ...args: [any]) =>\n  new Interpolation(source, args)\n\n/** @deprecated Use the `to` export instead */\nexport const interpolate: Interpolator = (source: any, ...args: [any]) => (\n  deprecateInterpolate(), new Interpolation(source, args)\n)\n\n/** Extract the raw value types that are being interpolated */\nexport type Interpolated<T extends ReadonlyArray<any>> = {\n  [P in keyof T]: T[P] extends infer Element\n    ? Element extends FluidValue<infer U>\n      ? U\n      : Element\n    : never\n}\n\n/**\n * This interpolates one or more `FluidValue` objects.\n * The exported `interpolate` function uses this type.\n */\nexport interface Interpolator {\n  // Tuple of parent values\n  <Input extends ReadonlyArray<any>, Output>(\n    parents: Input,\n    interpolator: (...args: Interpolated<Input>) => Output\n  ): Interpolation<Output>\n\n  // Single parent value\n  <Input, Output>(\n    parent: FluidValue<Input> | Input,\n    interpolator: InterpolatorFn<Input, Output>\n  ): Interpolation<Output>\n\n  // Interpolation config\n  <Out>(\n    parents: OneOrMore<FluidValue>,\n    config: InterpolatorConfig<Out>\n  ): Interpolation<Animatable<Out>>\n\n  // Range shortcuts\n  <Out>(\n    parents: OneOrMore<FluidValue<number>> | FluidValue<number[]>,\n    range: readonly number[],\n    output: readonly Constrain<Out, Animatable>[],\n    extrapolate?: ExtrapolateType\n  ): Interpolation<Animatable<Out>>\n}\n","import { Arrify, InterpolatorArgs, InterpolatorFn } from '@react-spring/types'\nimport {\n  is,\n  raf,\n  each,\n  isEqual,\n  toArray,\n  frameLoop,\n  FluidValue,\n  getFluidValue,\n  createInterpolator,\n  Globals as G,\n  callFluidObservers,\n  addFluidObserver,\n  removeFluidObserver,\n  hasFluidValue,\n} from '@react-spring/shared'\n\nimport { FrameValue, isFrameValue } from './FrameValue'\nimport {\n  getAnimated,\n  setAnimated,\n  getAnimatedType,\n  getPayload,\n} from '@react-spring/animated'\n\n/**\n * An `Interpolation` is a memoized value that's computed whenever one of its\n * `FluidValue` dependencies has its value changed.\n *\n * Other `FrameValue` objects can depend on this. For example, passing an\n * `Interpolation` as the `to` prop of a `useSpring` call will trigger an\n * animation toward the memoized value.\n */\nexport class Interpolation<\n  Input = any,\n  Output = any\n> extends FrameValue<Output> {\n  /** Useful for debugging. */\n  key?: string\n\n  /** Equals false when in the frameloop */\n  idle = true\n\n  /** The function that maps inputs values to output */\n  readonly calc: InterpolatorFn<Input, Output>\n\n  /** The inputs which are currently animating */\n  protected _active = new Set<FluidValue>()\n\n  constructor(\n    /** The source of input values */\n    readonly source: unknown,\n    args: InterpolatorArgs<Input, Output>\n  ) {\n    super()\n    this.calc = createInterpolator(...args)\n\n    const value = this._get()\n    const nodeType = getAnimatedType(value)\n\n    // Assume the computed value never changes type.\n    setAnimated(this, nodeType.create(value))\n  }\n\n  advance(_dt?: number) {\n    const value = this._get()\n    const oldValue = this.get()\n    if (!isEqual(value, oldValue)) {\n      getAnimated(this)!.setValue(value)\n      this._onChange(value, this.idle)\n    }\n    // Become idle when all parents are idle or paused.\n    if (!this.idle && checkIdle(this._active)) {\n      becomeIdle(this)\n    }\n  }\n\n  protected _get() {\n    const inputs: Arrify<Input> = is.arr(this.source)\n      ? this.source.map(getFluidValue)\n      : (toArray(getFluidValue(this.source)) as any)\n\n    return this.calc(...inputs)\n  }\n\n  protected _start() {\n    if (this.idle && !checkIdle(this._active)) {\n      this.idle = false\n\n      each(getPayload(this)!, node => {\n        node.done = false\n      })\n\n      if (G.skipAnimation) {\n        raf.batchedUpdates(() => this.advance())\n        becomeIdle(this)\n      } else {\n        frameLoop.start(this)\n      }\n    }\n  }\n\n  // Observe our sources only when we're observed.\n  protected _attach() {\n    let priority = 1\n    each(toArray(this.source), source => {\n      if (hasFluidValue(source)) {\n        addFluidObserver(source, this)\n      }\n      if (isFrameValue(source)) {\n        if (!source.idle) {\n          this._active.add(source)\n        }\n        priority = Math.max(priority, source.priority + 1)\n      }\n    })\n    this.priority = priority\n    this._start()\n  }\n\n  // Stop observing our sources once we have no observers.\n  protected _detach() {\n    each(toArray(this.source), source => {\n      if (hasFluidValue(source)) {\n        removeFluidObserver(source, this)\n      }\n    })\n    this._active.clear()\n    becomeIdle(this)\n  }\n\n  /** @internal */\n  eventObserved(event: FrameValue.Event) {\n    // Update our value when an idle parent is changed,\n    // and enter the frameloop when a parent is resumed.\n    if (event.type == 'change') {\n      if (event.idle) {\n        this.advance()\n      } else {\n        this._active.add(event.parent)\n        this._start()\n      }\n    }\n    // Once all parents are idle, the `advance` method runs one more time,\n    // so we should avoid updating the `idle` status here.\n    else if (event.type == 'idle') {\n      this._active.delete(event.parent)\n    }\n    // Ensure our priority is greater than all parents, which means\n    // our value won't be updated until our parents have updated.\n    else if (event.type == 'priority') {\n      this.priority = toArray(this.source).reduce(\n        (highest: number, parent) =>\n          Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1),\n        0\n      )\n    }\n  }\n}\n\n/** Returns true for an idle source. */\nfunction isIdle(source: any) {\n  return source.idle !== false\n}\n\n/** Return true if all values in the given set are idle or paused. */\nfunction checkIdle(active: Set<FluidValue>) {\n  // Parents can be active even when paused, so the `.every` check\n  // removes us from the frameloop if all active parents are paused.\n  return !active.size || Array.from(active).every(isIdle)\n}\n\n/** Become idle if not already idle. */\nfunction becomeIdle(self: Interpolation) {\n  if (!self.idle) {\n    self.idle = true\n\n    each(getPayload(self)!, node => {\n      node.done = true\n    })\n\n    callFluidObservers(self, {\n      type: 'idle',\n      parent: self,\n    })\n  }\n}\n","import {\n  Globals,\n  frameLoop,\n  createStringInterpolator,\n} from '@react-spring/shared'\nimport { Interpolation } from './Interpolation'\n\n// Sane defaults\nGlobals.assign({\n  createStringInterpolator,\n  to: (source, args) => new Interpolation(source, args),\n})\n\nexport { Globals }\n\n/** Advance all animations by the given time */\nexport const update = frameLoop.advance\n","export * from './hooks'\nexport * from './components'\nexport * from './interpolate'\nexport * from './constants'\nexport * from './globals'\n\nexport { Controller } from './Controller'\nexport { SpringValue } from './SpringValue'\nexport { SpringContext } from './SpringContext'\nexport { SpringRef } from './SpringRef'\n\nexport { FrameValue } from './FrameValue'\nexport { Interpolation } from './Interpolation'\nexport { BailSignal } from './runAsync'\nexport {\n  createInterpolator,\n  useIsomorphicLayoutEffect,\n  useReducedMotion,\n  easings,\n} from '@react-spring/shared'\nexport { inferTo } from './helpers'\n\nexport * from './types'\nexport * from '@react-spring/types'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,IAAA,EAAMC,yBAAA,QAAiC;;;ACAhD,SACEC,EAAA,EACAC,OAAA,EACAC,QAAA,EACAC,aAAA,EACAC,gBAAA,EAEAC,OAAA,IAAWC,CAAA,QACN;AAMA,SAASC,SACdC,KAAA,EAEuC;EAAA,SAAAC,IAAA,GAAAC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