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

import Vue from 'vue';
import { capitalize } from 'lodash';
import { PREFIX } from '../config.js';

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) => {
    const installConfig = {
      prefix: PREFIX,
      ...config
    };
    const defaultPrefix = capitalize(PREFIX);
    let componentName = name.replace(defaultPrefix, "").replace("-mapprops", "");
    componentName = capitalize(installConfig.prefix) + componentName;
    Vue2.component(componentName, comp);
  };
  if (dep && Vue && !(Vue._installedPlugins || []).includes(dep)) Vue.use(dep);
  return comp;
}

export { withInstall as default, withInstall };
//# sourceMappingURL=with-install.js.map
