'use strict';

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

var vue = require('vue');
var index$1 = require('../../icon/index.js');
require('../../../utils/index.js');
var iconsVue = require('@element-plus/icons-vue');
require('../../../hooks/index.js');
var backtop = require('./backtop.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var index = require('../../../hooks/use-namespace/index.js');
var error = require('../../../utils/error.js');

const __default__ = {
  name: "PsBacktop"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: backtop.backtopProps,
  setup(__props) {
    const props = __props;
    const COMPONENT_NAME = "PsBacktop";
    const ns = index.useNamespace("backtop");
    const el = vue.shallowRef();
    const container = vue.shallowRef();
    const visible = vue.ref(false);
    const backTopStyle = vue.computed(() => ({
      right: `${props.right}px`,
      bottom: `${props.bottom}px`
    }));
    vue.onMounted(() => {
      var _a;
      container.value = document;
      el.value = document.documentElement;
      if (props.target) {
        el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
        if (!el.value) {
          error.throwError(COMPONENT_NAME, `target is not existed: ${props.target}`);
        }
        container.value = el.value;
      }
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", {
        style: vue.normalizeStyle(vue.unref(backTopStyle)),
        class: vue.normalizeClass(vue.unref(ns).b())
      }, [
        vue.renderSlot(_ctx.$slots, "default", {}, () => [
          vue.createVNode(vue.unref(index$1.PsIcon), {
            class: vue.normalizeClass(vue.unref(ns).e("icon"))
          }, {
            default: vue.withCtx(() => [
              vue.createVNode(vue.unref(iconsVue.CaretTop))
            ]),
            _: 1
          }, 8, ["class"])
        ])
      ], 6);
    };
  }
});
var Backtop = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/backtop/src/backtop.vue"]]);

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