import { createLogger } from "../lib/logger/index.js";
const logger = createLogger("shared").child({ component: "analytics-registry" });
let _analyticsModuleConfigs = null;
function registerAnalyticsModuleConfigs(configs) {
  if (_analyticsModuleConfigs !== null && process.env.NODE_ENV === "development") {
    logger.debug("Analytics module configs re-registered (this may occur during HMR)");
  }
  _analyticsModuleConfigs = configs;
}
function getAnalyticsModuleConfigs() {
  return _analyticsModuleConfigs ?? [];
}
function getAllAnalyticsEntityConfigs() {
  const configs = getAnalyticsModuleConfigs();
  return configs.flatMap((moduleConfig) => moduleConfig.entities);
}
function getAnalyticsEntityConfig(entityId) {
  const entities = getAllAnalyticsEntityConfigs();
  return entities.find((e) => e.entityId === entityId) ?? null;
}
export {
  getAllAnalyticsEntityConfigs,
  getAnalyticsEntityConfig,
  getAnalyticsModuleConfigs,
  registerAnalyticsModuleConfigs
};
//# sourceMappingURL=analytics.js.map
