/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

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

var iconsVue = require('@ldesign/icons-vue');
var utils_clipboard = require('../../utils/clipboard.js');
var components_message_plugin = require('../message/plugin.js');
var components_popup_index = require('../popup/index.js');
var utils_mixins = require('../../utils/mixins.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var components_anchor_props = require('./props.js');
require('clipboard');
require('vue');
require('../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../chunks/log.js');
require('../../chunks/_commonjsHelpers-2e6815bd.js');
require('../../utils/easing.js');
require('../message/list.js');
require('../message/const.js');
require('../message/message.js');
require('../loading/index.js');
require('../../utils/with-install.js');
require('lodash');
require('../../config.js');
require('../loading/loading.js');
require('../../utils/render-node.js');
require('../../utils/transfer-dom.js');
require('../loading/props.js');
require('../loading/icon/gradient.js');
require('../../chunks/defineProperty-838e4192.js');
require('../../chunks/set-style.js');
require('../../chunks/helper2.js');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');
require('../loading/plugin.js');
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('lodash/camelCase');
require('../popup/props.js');
require('../popup/container.js');

var _AnchorTarget = utils_mixins["default"](components_configProvider_configReceiver["default"]("anchor"), components_configProvider_configReceiver.getGlobalIconMixins()).extend({
  name: "LAnchorTarget",
  props: {
    ...components_anchor_props.AnchorTargetProps
  },
  components: {
    LPopup: components_popup_index.Popup
  },
  methods: {
    copyText() {
      const a = document.createElement("a");
      a.href = `#${this.id}`;
      utils_clipboard["default"](a.href);
      components_message_plugin.MessagePlugin.success(this.global.copySuccessText, 1e3);
    }
  },
  render() {
    const h = arguments[0];
    const {
      tag: Tag,
      $scopedSlots: {
        default: children
      },
      id
    } = this;
    const {
      FileCopyIcon
    } = this.useGlobalIcon({
      FileCopyIcon: iconsVue.FileCopyIcon
    });
    const className = [`${this.componentName}__target`];
    const iconClassName = `${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, {
      "nativeOn": {
        "click": this.copyText
      }
    })])]);
  }
});

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