/* wp:polyfill */
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = makeFamiliesFromFaces;
var _components = require("@wordpress/components");
var _lockUnlock = require("../../../../lock-unlock");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const {
  kebabCase
} = (0, _lockUnlock.unlock)(_components.privateApis);
function makeFamiliesFromFaces(fontFaces) {
  const fontFamiliesObject = fontFaces.reduce((acc, item) => {
    if (!acc[item.fontFamily]) {
      acc[item.fontFamily] = {
        name: item.fontFamily,
        fontFamily: item.fontFamily,
        slug: kebabCase(item.fontFamily.toLowerCase()),
        fontFace: []
      };
    }
    acc[item.fontFamily].fontFace.push(item);
    return acc;
  }, {});
  return Object.values(fontFamiliesObject);
}
//# sourceMappingURL=make-families-from-faces.js.map