{"ast":null,"code":"import { flushLayout } from '../../render/dom/utils/batch-layout.js';\nimport { useConstant } from '../../utils/use-constant.js';\n\n/**\n * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nvar DragControls = /** @class */function () {\n  function DragControls() {\n    this.componentControls = new Set();\n  }\n  /**\n   * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.\n   *\n   * @internal\n   */\n  DragControls.prototype.subscribe = function (controls) {\n    var _this = this;\n    this.componentControls.add(controls);\n    return function () {\n      return _this.componentControls[\"delete\"](controls);\n    };\n  };\n  /**\n   * Start a drag gesture on every `motion` component that has this set of drag controls\n   * passed into it via the `dragControls` prop.\n   *\n   * ```jsx\n   * dragControls.start(e, {\n   *   snapToCursor: true\n   * })\n   * ```\n   *\n   * @param event - PointerEvent\n   * @param options - Options\n   *\n   * @public\n   */\n  DragControls.prototype.start = function (event, options) {\n    this.componentControls.forEach(function (controls) {\n      controls.start(event.nativeEvent || event, options);\n    });\n  };\n  DragControls.prototype.updateConstraints = function (flush) {\n    if (flush === void 0) {\n      flush = true;\n    }\n    this.componentControls.forEach(function (controls) {\n      controls.updateConstraints();\n    });\n    flush && flushLayout();\n  };\n  return DragControls;\n}();\nvar createDragControls = function createDragControls() {\n  return new DragControls();\n};\n/**\n * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop\n * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we\n * might want to initiate that dragging from a different component than the draggable one.\n *\n * By creating a `dragControls` using the `useDragControls` hook, we can pass this into\n * the draggable component's `dragControls` prop. It exposes a `start` method\n * that can start dragging from pointer events on other components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nfunction useDragControls() {\n  return useConstant(createDragControls);\n}\nexport { DragControls, useDragControls };","map":{"version":3,"names":["flushLayout","useConstant","DragControls","componentControls","Set","prototype","subscribe","controls","_this","add","start","event","options","forEach","nativeEvent","updateConstraints","flush","createDragControls","useDragControls"],"sources":["D:/DSP_Management/node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js"],"sourcesContent":["import { flushLayout } from '../../render/dom/utils/batch-layout.js';\nimport { useConstant } from '../../utils/use-constant.js';\n\n/**\n * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nvar DragControls = /** @class */ (function () {\n    function DragControls() {\n        this.componentControls = new Set();\n    }\n    /**\n     * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.\n     *\n     * @internal\n     */\n    DragControls.prototype.subscribe = function (controls) {\n        var _this = this;\n        this.componentControls.add(controls);\n        return function () { return _this.componentControls.delete(controls); };\n    };\n    /**\n     * Start a drag gesture on every `motion` component that has this set of drag controls\n     * passed into it via the `dragControls` prop.\n     *\n     * ```jsx\n     * dragControls.start(e, {\n     *   snapToCursor: true\n     * })\n     * ```\n     *\n     * @param event - PointerEvent\n     * @param options - Options\n     *\n     * @public\n     */\n    DragControls.prototype.start = function (event, options) {\n        this.componentControls.forEach(function (controls) {\n            controls.start(event.nativeEvent || event, options);\n        });\n    };\n    DragControls.prototype.updateConstraints = function (flush) {\n        if (flush === void 0) { flush = true; }\n        this.componentControls.forEach(function (controls) {\n            controls.updateConstraints();\n        });\n        flush && flushLayout();\n    };\n    return DragControls;\n}());\nvar createDragControls = function () { return new DragControls(); };\n/**\n * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop\n * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we\n * might want to initiate that dragging from a different component than the draggable one.\n *\n * By creating a `dragControls` using the `useDragControls` hook, we can pass this into\n * the draggable component's `dragControls` prop. It exposes a `start` method\n * that can start dragging from pointer events on other components.\n *\n * @library\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <Frame onTapStart={startDrag} />\n *     <Frame drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @motion\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n *   dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n *   <>\n *     <div onPointerDown={startDrag} />\n *     <motion.div drag=\"x\" dragControls={dragControls} />\n *   </>\n * )\n * ```\n *\n * @public\n */\nfunction useDragControls() {\n    return useConstant(createDragControls);\n}\n\nexport { DragControls, useDragControls };\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,wCAAwC;AACpE,SAASC,WAAW,QAAQ,6BAA6B;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,YAAY,GAAG,aAAe,YAAY;EAC1C,SAASA,YAAYA,CAAA,EAAG;IACpB,IAAI,CAACC,iBAAiB,GAAG,IAAIC,GAAG,CAAC,CAAC;EACtC;EACA;AACJ;AACA;AACA;AACA;EACIF,YAAY,CAACG,SAAS,CAACC,SAAS,GAAG,UAAUC,QAAQ,EAAE;IACnD,IAAIC,KAAK,GAAG,IAAI;IAChB,IAAI,CAACL,iBAAiB,CAACM,GAAG,CAACF,QAAQ,CAAC;IACpC,OAAO,YAAY;MAAE,OAAOC,KAAK,CAACL,iBAAiB,UAAO,CAACI,QAAQ,CAAC;IAAE,CAAC;EAC3E,CAAC;EACD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIL,YAAY,CAACG,SAAS,CAACK,KAAK,GAAG,UAAUC,KAAK,EAAEC,OAAO,EAAE;IACrD,IAAI,CAACT,iBAAiB,CAACU,OAAO,CAAC,UAAUN,QAAQ,EAAE;MAC/CA,QAAQ,CAACG,KAAK,CAACC,KAAK,CAACG,WAAW,IAAIH,KAAK,EAAEC,OAAO,CAAC;IACvD,CAAC,CAAC;EACN,CAAC;EACDV,YAAY,CAACG,SAAS,CAACU,iBAAiB,GAAG,UAAUC,KAAK,EAAE;IACxD,IAAIA,KAAK,KAAK,KAAK,CAAC,EAAE;MAAEA,KAAK,GAAG,IAAI;IAAE;IACtC,IAAI,CAACb,iBAAiB,CAACU,OAAO,CAAC,UAAUN,QAAQ,EAAE;MAC/CA,QAAQ,CAACQ,iBAAiB,CAAC,CAAC;IAChC,CAAC,CAAC;IACFC,KAAK,IAAIhB,WAAW,CAAC,CAAC;EAC1B,CAAC;EACD,OAAOE,YAAY;AACvB,CAAC,CAAC,CAAE;AACJ,IAAIe,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAA,EAAe;EAAE,OAAO,IAAIf,YAAY,CAAC,CAAC;AAAE,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASgB,eAAeA,CAAA,EAAG;EACvB,OAAOjB,WAAW,CAACgB,kBAAkB,CAAC;AAC1C;AAEA,SAASf,YAAY,EAAEgB,eAAe","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}