define(["core/pubsubhub"], function (_pubsubhub) {
  "use strict";

  function confFilter(key, val) {
    switch (key) {
      // DefinitionMap contains array of DOM elements that aren't serializable
      // we replace them by their id`
      case "definitionMap":
        return Object.keys(val).reduce(function (ret, k) {
          ret[k] = val[k].map(function (d) {
            return d[0].id;
          });
        }, {});
      default:
        return val;
    }
  } // Module core/include-config
  // Inject's the document's configuration into the head as JSON.


  (0, _pubsubhub.sub)("start-all", function (config) {
    var script = document.createElement("script");
    script.id = "initialUserConfig";
    script.innerHTML = JSON.stringify(config, confFilter, 2);
    script.type = "application/json";
    (0, _pubsubhub.sub)("end-all", function () {
      document.head.appendChild(script);
    }, { once: true });
  }, { once: true });
});
//# sourceMappingURL=include-config.js.map