import { __exports as dist } from "../../../_virtual/index13.js";
import require$$0 from "@babel/runtime/helpers/interopRequireDefault";
import { __require as requireArray_prototype_flat } from "../../array.prototype.flat/index.js";
import { __require as requireGlobalCache } from "../../global-cache/index.js";
import { __require as requireConstants } from "./utils/constants.js";
import { __require as requireGetClassName } from "./utils/getClassName.js";
import { __require as requireSeparateStyles } from "./utils/separateStyles.js";
var hasRequiredDist;
function requireDist() {
  if (hasRequiredDist) return dist;
  hasRequiredDist = 1;
  (function(exports$1) {
    var _interopRequireDefault = require$$0;
    Object.defineProperty(exports$1, "__esModule", {
      value: true
    });
    exports$1["default"] = void 0;
    var _arrayPrototype = _interopRequireDefault(requireArray_prototype_flat());
    var _globalCache = _interopRequireDefault(requireGlobalCache());
    var _constants = requireConstants();
    var _getClassName = _interopRequireDefault(requireGetClassName());
    var _separateStyles2 = _interopRequireDefault(requireSeparateStyles());
    function create(stylesObject) {
      var stylesToClasses = {};
      var styleNames = Object.keys(stylesObject);
      var sharedState = _globalCache["default"].get(_constants.GLOBAL_CACHE_KEY) || {};
      var _sharedState$namespac = sharedState.namespace, namespace = _sharedState$namespac === void 0 ? "" : _sharedState$namespac;
      styleNames.forEach(function(styleName) {
        var className = (0, _getClassName["default"])(namespace, styleName);
        stylesToClasses[styleName] = className;
      });
      return stylesToClasses;
    }
    function resolve(stylesArray) {
      var flattenedStyles = (0, _arrayPrototype["default"])(stylesArray, Infinity);
      var _separateStyles = (0, _separateStyles2["default"])(flattenedStyles), classNames = _separateStyles.classNames, hasInlineStyles = _separateStyles.hasInlineStyles, inlineStyles = _separateStyles.inlineStyles;
      var specificClassNames = classNames.map(function(name, index) {
        return "".concat(name, " ").concat(name, "_").concat(index + 1);
      });
      var className = specificClassNames.join(" ");
      var result = {
        className
      };
      if (hasInlineStyles) result.style = inlineStyles;
      return result;
    }
    var _default = {
      create,
      resolve
    };
    exports$1["default"] = _default;
  })(dist);
  return dist;
}
export {
  requireDist as __require
};
