/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

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

function withInstall(comp, dep) {
  const c = comp;
  const name = 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=withInstall.js.map
