import { createLogger } from "../logger/index.js";
const logger = createLogger("shared").child({ component: "encryption" });
let _entityFieldsRegistry = null;
function registerEntityFields(registry) {
  if (_entityFieldsRegistry !== null && process.env.NODE_ENV === "development") {
    logger.debug("Entity fields re-registered (this may occur during HMR)");
  }
  _entityFieldsRegistry = registry;
}
function getEntityFieldsRegistry(throwIfNotRegistered = true) {
  if (!_entityFieldsRegistry) {
    if (throwIfNotRegistered) {
      throw new Error("[Bootstrap] Entity fields not registered. Call registerEntityFields() at bootstrap.");
    }
    return {};
  }
  return _entityFieldsRegistry;
}
function getEntityFields(slug) {
  const registry = getEntityFieldsRegistry(false);
  return registry[slug];
}
export {
  getEntityFields,
  getEntityFieldsRegistry,
  registerEntityFields
};
//# sourceMappingURL=entityFields.js.map
