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

'use strict';

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

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var iconsVue = require('@ldesign/icons-vue');
var utils_clipboard = require('../utils/clipboard.js');
var message_plugin = require('../message/plugin.js');
var popup_index = require('../popup/index.js');
var utils_mixins = require('../utils/mixins.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var anchor_anchorTargetProps = require('./anchor-target-props.js');
require('clipboard');
require('@babel/runtime/helpers/typeof');
require('vue');
require('../utils/dom.js');
require('raf');
require('lodash/isString');
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('lodash/capitalize');
require('../loading/directive.js');
require('lodash/isObject');
require('lodash/mapKeys');
require('lodash/isEqual');
require('../loading/plugin.js');
require('../config.js');
require('../loading/loading.js');
require('../utils/render-tnode.js');
require('@vue/composition-api');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/transfer-dom.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('@babel/runtime/helpers/slicedToArray');
require('lodash/isNull');
require('lodash/isUndefined');
require('lodash/isNumber');
require('lodash/isArray');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('../_chunks/dep-7c884501.js');
require('dayjs');
require('../message/animation.js');
require('../message/props.js');
require('../utils/map-props.js');
require('../popup/popup.js');
require('@popperjs/core');
require('../utils/helper.js');
require('../utils/event.js');
require('../popup/props.js');
require('../popup/container.js');
require('lodash/isFunction');
require('../popup/utils.js');
require('../popup/trigger.js');
require('../popup/plugin.js');

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

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _AnchorTarget = utils_mixins["default"](configProvider_configReceiver["default"]("anchor"), configProvider_configReceiver.getGlobalIconMixins()).extend({
  name: "TAnchorTarget",
  props: _objectSpread({}, anchor_anchorTargetProps["default"]),
  methods: {
    copyText: function copyText() {
      var a = document.createElement("a");
      a.href = "#".concat(this.id);
      utils_clipboard["default"](a.href);
      message_plugin.MessagePlugin.success(this.global.copySuccessText, 1e3);
    }
  },
  render: function render() {
    var h = arguments[0];
    var Tag = this.tag,
      children = this.$scopedSlots["default"],
      id = this.id;
    var _this$useGlobalIcon = this.useGlobalIcon({
        FileCopyIcon: iconsVue.FileCopyIcon
      }),
      FileCopyIcon = _this$useGlobalIcon.FileCopyIcon;
    var className = ["".concat(this.componentName, "__target")];
    var iconClassName = "".concat(this.componentName, "__copy");
    return h(Tag, {
      "attrs": {
        "id": id
      },
      "class": className
    }, [children && children(null), h(popup_index.Popup, {
      "attrs": {
        "content": this.global.copyText,
        "placement": "top",
        "showArrow": true
      },
      "class": iconClassName
    }, [h(FileCopyIcon, {
      "nativeOn": {
        "click": this.copyText
      }
    })])]);
  }
});

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