'use strict';

var vue = require('vue');
var serverRenderer = require('vue/server-renderer');
var index = require('../../../components/index.cjs');
require('../index.cjs');
var index$1 = require('../../../components/date-picker/index.cjs');
var StyleContext = require('../StyleContext.cjs');
var index$2 = require('../hooks/useStyleRegister/index.cjs');

const blackList = ["ConfigProvider", "Grid", "Tour", "SelectOptGroup", "SelectOption", "MentionsOption", "TreeNode", "TreeSelectNode", "LocaleProvider"];
const pickerMap = {
  MonthPicker: "month",
  WeekPicker: "week",
  QuarterPicker: "quarter"
};
const compChildNameMap = {
  MenuDivider: "Menu",
  MenuItem: "Menu",
  MenuItemGroup: "Menu",
  SubMenu: "Menu",
  TableColumn: "Table",
  TableColumnGroup: "Table",
  TableSummary: "Table",
  TableSummaryRow: "Table",
  TableSummaryCell: "Table",
  TabPane: "Tabs",
  TimelineItem: "Timeline"
};
function defaultNode() {
  return vue.createVNode(vue.Fragment, null, [Object.keys(index).filter((name) => !blackList.includes(name) && name[0] === name[0].toUpperCase()).map((compName) => {
    const Comp = index[compName];
    if (compName === "Dropdown") {
      return vue.createVNode(Comp, {
        "key": compName,
        "menu": {
          items: []
        }
      }, {
        default: () => [vue.createVNode("div", null, null)]
      });
    }
    if (compName === "Anchor")
      return vue.createVNode(Comp, {
        "key": compName,
        "items": []
      }, null);
    if (compName in pickerMap) {
      const Comp2 = index$1.DatePicker;
      const type = pickerMap[compName];
      return vue.createVNode(Comp2, {
        "key": compName,
        "picker": type
      }, null);
    }
    if (compName in compChildNameMap) {
      const ParentComp = index[compChildNameMap[compName]];
      return vue.createVNode(ParentComp, null, {
        default: () => [vue.createVNode(Comp, null, null)]
      });
    }
    if (compName === "QRCode" || compName === "Segmented") {
      return vue.createVNode(Comp, {
        "key": compName,
        "value": ""
      }, {
        default: () => [vue.createVNode("div", null, null)]
      });
    }
    return vue.createVNode(Comp, {
      "key": compName
    }, null);
  })]);
}
function extractStyle(customTheme) {
  const cache = StyleContext.createCache();
  serverRenderer.renderToString(vue.createVNode(StyleContext.StyleProvider, {
    "cache": cache
  }, {
    default: () => [customTheme ? customTheme(defaultNode()) : defaultNode()]
  }));
  const styleText = index$2.extractStyle(cache, true);
  return styleText;
}

exports.extractStyle = extractStyle;
//# sourceMappingURL=index.cjs.map
