/**
 * ldesign v0.2.2
 * (c) 2022年9月20日 swimly
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { FileCopyIcon } from '@ldesign/icons-vue';
import copyText from '../../utils/clipboard.js';
import { MessagePlugin } from '../message/plugin.js';
import { AnchorTargetProps } from './props.js';
import { Popup } from '../popup/index.js';
import mixins from '../../utils/mixins.js';
import getConfigReceiverMixins, { getGlobalIconMixins } from '../config-provider/config-receiver.js';
import 'clipboard';
import '@babel/runtime/helpers/typeof';
import 'vue';
import '../message/list.js';
import '../message/const.js';
import '../message/message.js';
import '../loading/index.js';
import '../loading/loading.js';
import '../loading/icon/gradient.js';
import '../../_chunks/dep-33b15d9d.js';
import '../../_chunks/dep-85e8b23b.js';
import '../../_chunks/dep-fc383775.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/slicedToArray';
import '../../config.js';
import '../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../utils/easing.js';
import '../../utils/render-node.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../utils/transfer-dom.js';
import '../loading/props.js';
import 'lodash/mergeWith';
import 'lodash';
import '../config-provider/context.js';
import '../../_chunks/dep-a0f2090c.js';
import '../../utils/with-install.js';
import '../loading/plugin.js';
import '../message/props.js';
import '../message/animation.js';
import '../popup/popup.js';
import '@popperjs/core';
import '../../utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../popup/props.js';
import '../popup/container.js';
import '../../utils/map-props.js';

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(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 = mixins(getConfigReceiverMixins("anchor"), getGlobalIconMixins()).extend({
  name: "LAnchorTarget",
  props: _objectSpread({}, AnchorTargetProps),
  components: {
    LPopup: Popup
  },
  methods: {
    copyText: function copyText$1() {
      var a = document.createElement("a");
      a.href = "#".concat(this.id);

      copyText(a.href);

      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: FileCopyIcon
    }),
        FileCopyIcon$1 = _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("l-popup", {
      "attrs": {
        "content": this.global.copyText,
        "placement": "top",
        "showArrow": true
      },
      "class": iconClassName
    }, [h(FileCopyIcon$1, {
      "nativeOn": {
        "click": this.copyText
      }
    })])]);
  }
});

export { _AnchorTarget as default };
//# sourceMappingURL=target.js.map
