/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var isFunction = require('lodash/isFunction');
var utils_dom = require('../utils/dom.js');
require('../_chunks/dep-f4db2590.js');
require('lodash/isString');
require('lodash/isArray');
require('../utils/easing.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var isFunction__default = /*#__PURE__*/_interopDefaultLegacy(isFunction);

var useTeleport = function useTeleport(attach, triggerNode) {
  var to = isFunction__default["default"](attach) ? vue.computed(attach) : vue.ref(attach);
  var innerTriggerNode = isFunction__default["default"](triggerNode) ? vue.computed(triggerNode) : vue.ref(triggerNode);
  var element = vue.ref();
  var getElement = function getElement() {
    element.value = utils_dom.getSSRAttach() || utils_dom.getAttach(to.value, innerTriggerNode.value);
  };
  vue.onMounted(function () {
    return getElement();
  });
  vue.watch([to, innerTriggerNode], function () {
    return getElement();
  });
  return element;
};

exports["default"] = useTeleport;
//# sourceMappingURL=useTeleport.js.map
