{"ast":null,"code":"import { __spreadArray, __read } from 'tslib';\nimport { invariant } from 'hey-listen';\nimport { stopAnimation, animateVisualElement } from '../render/utils/animation.js';\nimport { setValues } from '../render/utils/setters.js';\n\n/**\n * @public\n */\nfunction animationControls() {\n  /**\n   * Track whether the host component has mounted.\n   */\n  var hasMounted = false;\n  /**\n   * Pending animations that are started before a component is mounted.\n   * TODO: Remove this as animations should only run in effects\n   */\n  var pendingAnimations = [];\n  /**\n   * A collection of linked component animation controls.\n   */\n  var subscribers = new Set();\n  var controls = {\n    subscribe: function subscribe(visualElement) {\n      subscribers.add(visualElement);\n      return function () {\n        return void subscribers[\"delete\"](visualElement);\n      };\n    },\n    start: function start(definition, transitionOverride) {\n      /**\n       * TODO: We only perform this hasMounted check because in Framer we used to\n       * encourage the ability to start an animation within the render phase. This\n       * isn't behaviour concurrent-safe so when we make Framer concurrent-safe\n       * we can ditch this.\n       */\n      if (hasMounted) {\n        var animations_1 = [];\n        subscribers.forEach(function (visualElement) {\n          animations_1.push(animateVisualElement(visualElement, definition, {\n            transitionOverride: transitionOverride\n          }));\n        });\n        return Promise.all(animations_1);\n      } else {\n        return new Promise(function (resolve) {\n          pendingAnimations.push({\n            animation: [definition, transitionOverride],\n            resolve: resolve\n          });\n        });\n      }\n    },\n    set: function set(definition) {\n      invariant(hasMounted, \"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook.\");\n      return subscribers.forEach(function (visualElement) {\n        setValues(visualElement, definition);\n      });\n    },\n    stop: function stop() {\n      subscribers.forEach(function (visualElement) {\n        stopAnimation(visualElement);\n      });\n    },\n    mount: function mount() {\n      hasMounted = true;\n      pendingAnimations.forEach(function (_a) {\n        var animation = _a.animation,\n          resolve = _a.resolve;\n        controls.start.apply(controls, __spreadArray([], __read(animation))).then(resolve);\n      });\n      return function () {\n        hasMounted = false;\n        controls.stop();\n      };\n    }\n  };\n  return controls;\n}\nexport { animationControls };","map":{"version":3,"names":["__spreadArray","__read","invariant","stopAnimation","animateVisualElement","setValues","animationControls","hasMounted","pendingAnimations","subscribers","Set","controls","subscribe","visualElement","add","start","definition","transitionOverride","animations_1","forEach","push","Promise","all","resolve","animation","set","stop","mount","_a","apply","then"],"sources":["C:/ldt/LDT/management/node_modules/framer-motion/dist/es/animation/animation-controls.js"],"sourcesContent":["import { __spreadArray, __read } from 'tslib';\nimport { invariant } from 'hey-listen';\nimport { stopAnimation, animateVisualElement } from '../render/utils/animation.js';\nimport { setValues } from '../render/utils/setters.js';\n\n/**\n * @public\n */\nfunction animationControls() {\n    /**\n     * Track whether the host component has mounted.\n     */\n    var hasMounted = false;\n    /**\n     * Pending animations that are started before a component is mounted.\n     * TODO: Remove this as animations should only run in effects\n     */\n    var pendingAnimations = [];\n    /**\n     * A collection of linked component animation controls.\n     */\n    var subscribers = new Set();\n    var controls = {\n        subscribe: function (visualElement) {\n            subscribers.add(visualElement);\n            return function () { return void subscribers.delete(visualElement); };\n        },\n        start: function (definition, transitionOverride) {\n            /**\n             * TODO: We only perform this hasMounted check because in Framer we used to\n             * encourage the ability to start an animation within the render phase. This\n             * isn't behaviour concurrent-safe so when we make Framer concurrent-safe\n             * we can ditch this.\n             */\n            if (hasMounted) {\n                var animations_1 = [];\n                subscribers.forEach(function (visualElement) {\n                    animations_1.push(animateVisualElement(visualElement, definition, {\n                        transitionOverride: transitionOverride,\n                    }));\n                });\n                return Promise.all(animations_1);\n            }\n            else {\n                return new Promise(function (resolve) {\n                    pendingAnimations.push({\n                        animation: [definition, transitionOverride],\n                        resolve: resolve,\n                    });\n                });\n            }\n        },\n        set: function (definition) {\n            invariant(hasMounted, \"controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook.\");\n            return subscribers.forEach(function (visualElement) {\n                setValues(visualElement, definition);\n            });\n        },\n        stop: function () {\n            subscribers.forEach(function (visualElement) {\n                stopAnimation(visualElement);\n            });\n        },\n        mount: function () {\n            hasMounted = true;\n            pendingAnimations.forEach(function (_a) {\n                var animation = _a.animation, resolve = _a.resolve;\n                controls.start.apply(controls, __spreadArray([], __read(animation))).then(resolve);\n            });\n            return function () {\n                hasMounted = false;\n                controls.stop();\n            };\n        },\n    };\n    return controls;\n}\n\nexport { animationControls };\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,MAAM,QAAQ,OAAO;AAC7C,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,aAAa,EAAEC,oBAAoB,QAAQ,8BAA8B;AAClF,SAASC,SAAS,QAAQ,4BAA4B;;AAEtD;AACA;AACA;AACA,SAASC,iBAAiBA,CAAA,EAAG;EACzB;AACJ;AACA;EACI,IAAIC,UAAU,GAAG,KAAK;EACtB;AACJ;AACA;AACA;EACI,IAAIC,iBAAiB,GAAG,EAAE;EAC1B;AACJ;AACA;EACI,IAAIC,WAAW,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC3B,IAAIC,QAAQ,GAAG;IACXC,SAAS,EAAE,SAAXA,SAASA,CAAYC,aAAa,EAAE;MAChCJ,WAAW,CAACK,GAAG,CAACD,aAAa,CAAC;MAC9B,OAAO,YAAY;QAAE,OAAO,KAAKJ,WAAW,UAAO,CAACI,aAAa,CAAC;MAAE,CAAC;IACzE,CAAC;IACDE,KAAK,EAAE,SAAPA,KAAKA,CAAYC,UAAU,EAAEC,kBAAkB,EAAE;MAC7C;AACZ;AACA;AACA;AACA;AACA;MACY,IAAIV,UAAU,EAAE;QACZ,IAAIW,YAAY,GAAG,EAAE;QACrBT,WAAW,CAACU,OAAO,CAAC,UAAUN,aAAa,EAAE;UACzCK,YAAY,CAACE,IAAI,CAAChB,oBAAoB,CAACS,aAAa,EAAEG,UAAU,EAAE;YAC9DC,kBAAkB,EAAEA;UACxB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,OAAOI,OAAO,CAACC,GAAG,CAACJ,YAAY,CAAC;MACpC,CAAC,MACI;QACD,OAAO,IAAIG,OAAO,CAAC,UAAUE,OAAO,EAAE;UAClCf,iBAAiB,CAACY,IAAI,CAAC;YACnBI,SAAS,EAAE,CA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