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

'use strict';

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

var Vue = require('vue');
var lodash = require('lodash');
var config = require('../config.js');

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

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);

function withInstall(comp, dep) {
  var _c$options;
  const c = comp;
  const name = (c === null || c === void 0 ? void 0 : (_c$options = c.options) === null || _c$options === void 0 ? void 0 : _c$options.name) || c.name;
  c.install = (Vue2, config$1) => {
    const installConfig = {
      prefix: config.PREFIX,
      ...config$1
    };
    const defaultPrefix = lodash.capitalize(config.PREFIX);
    let componentName = name.replace(defaultPrefix, "").replace("-mapprops", "");
    componentName = lodash.capitalize(installConfig.prefix) + componentName;
    Vue2.component(componentName, comp);
  };
  if (dep && Vue__default["default"] && !(Vue__default["default"]._installedPlugins || []).includes(dep)) Vue__default["default"].use(dep);
  return comp;
}

exports["default"] = withInstall;
exports.withInstall = withInstall;
//# sourceMappingURL=with-install.js.map
