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

'use strict';

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

var vue = require('vue');
var iconsVueNext = require('@ldesign/icons-vue-next');
var utils_clipboard = require('../utils/clipboard.js');
var message_plugin = require('../message/plugin.js');
var popup_index = require('../popup/index.js');
var hooks_useGlobalIcon = require('../hooks/useGlobalIcon.js');
var hooks_useConfig = require('../hooks/useConfig.js');
var anchor_anchorTargetProps = require('./anchor-target-props.js');
var configProvider_useConfig = require('../config-provider/useConfig.js');
require('../_chunks/dep-f4db2590.js');
require('@babel/runtime/helpers/defineProperty');
require('lodash/isObject');
require('lodash/isString');
require('../utils/dom.js');
require('lodash/isFunction');
require('lodash/isArray');
require('../utils/easing.js');
require('../message/messageList.js');
require('../message/const.js');
require('../message/message.js');
require('../loading/index.js');
require('../utils/withInstall.js');
require('../loading/directive.js');
require('../loading/plugin.js');
require('../loading/loading.js');
require('@babel/runtime/helpers/slicedToArray');
require('../utils/render-tnode.js');
require('lodash/isEmpty');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../hooks/useTeleport.js');
require('../loading/props.js');
require('../loading/icon/gradient.js');
require('../_common/js/loading/circle-adapter.js');
require('../_common/js/utils/set-style.js');
require('../_common/js/utils/helper.js');
require('@babel/runtime/helpers/toConsumableArray');
require('@babel/runtime/helpers/objectWithoutProperties');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('lodash/cloneDeep');
require('../config-provider/context.js');
require('lodash/mergeWith');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('@babel/runtime/helpers/typeof');
require('dayjs');
require('../hooks/tnode.js');
require('../message/props.js');
require('../message/animation.js');
require('../popup/popup.js');
require('@popperjs/core');
require('../hooks/useVModel.js');
require('../popup/props.js');
require('../popup/container.js');
require('../hooks/useResizeObserver.js');

var _AnchorTarget = vue.defineComponent({
  name: "TAnchorTarget",
  props: anchor_anchorTargetProps["default"],
  setup: function setup(props2, _ref) {
    var slots = _ref.slots;
    var _useConfig = configProvider_useConfig.useConfig("anchor"),
      globalConfig = _useConfig.globalConfig,
      classPrefix = _useConfig.classPrefix;
    var _useGlobalIcon = hooks_useGlobalIcon.useGlobalIcon({
        FileCopyIcon: iconsVueNext.FileCopyIcon
      }),
      FileCopyIcon = _useGlobalIcon.FileCopyIcon;
    var COMPONENT_NAME = hooks_useConfig.usePrefixClass("anchor");
    var toCopyText = function toCopyText() {
      var a = document.createElement("a");
      a.href = "#".concat(props2.id);
      utils_clipboard.copyText(a.href);
      message_plugin["default"].success(globalConfig.value.copySuccessText, 1e3);
    };
    return function () {
      var children = slots["default"];
      var TAG = props2.tag,
        id = props2.id;
      var className = ["".concat(COMPONENT_NAME.value, "__target")];
      var iconClassName = "".concat(classPrefix.value, "-copy");
      return vue.createVNode(TAG, {
        "id": id,
        "class": className
      }, {
        "default": function _default() {
          return [children && children(null), vue.createVNode(popup_index.Popup, {
            "content": globalConfig.value.copyText,
            "placement": "top",
            "showArrow": true,
            "class": iconClassName
          }, {
            "default": function _default() {
              return [vue.createVNode(FileCopyIcon, {
                "onClick": toCopyText
              }, null)];
            }
          })];
        }
      });
    };
  }
});

exports["default"] = _AnchorTarget;
//# sourceMappingURL=anchor-target.js.map
