import {
  setBootstrapper
} from "./chunk-3VM3WAOV.mjs";
import {
  __name
} from "./chunk-PAWJFY3S.mjs";

// src/client/config.ts
var _clientConfig = null;
function configureJsonApi(config) {
  _clientConfig = config;
  if (config.bootstrapper) {
    setBootstrapper(config.bootstrapper);
    config.bootstrapper();
  }
}
__name(configureJsonApi, "configureJsonApi");
function configureClientConfig(config) {
  _clientConfig = config;
}
__name(configureClientConfig, "configureClientConfig");
function getApiUrl() {
  if (_clientConfig?.apiUrl) {
    return _clientConfig.apiUrl;
  }
  if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_URL) {
    return process.env.NEXT_PUBLIC_API_URL;
  }
  return "";
}
__name(getApiUrl, "getApiUrl");
function getAppUrl() {
  if (_clientConfig?.appUrl) {
    return _clientConfig.appUrl;
  }
  if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_APP_URL) {
    return process.env.NEXT_PUBLIC_APP_URL;
  }
  if (typeof window !== "undefined") {
    return window.location.origin;
  }
  return "";
}
__name(getAppUrl, "getAppUrl");
function getTrackablePages() {
  return _clientConfig?.trackablePages ?? [];
}
__name(getTrackablePages, "getTrackablePages");
function getStripePublishableKey() {
  return _clientConfig?.stripePublishableKey;
}
__name(getStripePublishableKey, "getStripePublishableKey");

// src/i18n/config.ts
var _config = null;
function configureI18n(config) {
  _config = config;
}
__name(configureI18n, "configureI18n");
function useI18nRouter() {
  if (!_config?.useRouter) {
    throw new Error("i18n not configured. Call configureI18n() at app startup.");
  }
  return _config.useRouter();
}
__name(useI18nRouter, "useI18nRouter");
function useI18nTranslations(namespace) {
  if (!_config?.useTranslations) {
    return (key) => key;
  }
  return _config.useTranslations(namespace);
}
__name(useI18nTranslations, "useI18nTranslations");
function getI18nLink() {
  if (!_config?.Link) {
    throw new Error("i18n not configured. Call configureI18n() at app startup.");
  }
  return _config.Link;
}
__name(getI18nLink, "getI18nLink");
function useI18nLocale() {
  if (_config?.useLocale) {
    return _config.useLocale();
  }
  return "en";
}
__name(useI18nLocale, "useI18nLocale");
function useI18nDateFnsLocale() {
  if (_config?.useDateFnsLocale) {
    return _config.useDateFnsLocale();
  }
  return void 0;
}
__name(useI18nDateFnsLocale, "useI18nDateFnsLocale");

// src/login/config.ts
var _useDiscordAuth = false;
var _useInternalAuth = true;
var _allowRegistration = true;
function configureLogin(params) {
  _useDiscordAuth = params.useDiscordAuth;
  _useInternalAuth = params.useInternalAuth;
  _allowRegistration = params.allowRegistration ?? true;
}
__name(configureLogin, "configureLogin");
function isDiscordAuthEnabled() {
  return _useDiscordAuth;
}
__name(isDiscordAuthEnabled, "isDiscordAuthEnabled");
function isInternalAuthEnabled() {
  return _useInternalAuth;
}
__name(isInternalAuthEnabled, "isInternalAuthEnabled");
function isRegistrationAllowed() {
  return _allowRegistration;
}
__name(isRegistrationAllowed, "isRegistrationAllowed");

// src/roles/config.ts
var _roleId = null;
function configureRoles(roleId) {
  _roleId = roleId;
}
__name(configureRoles, "configureRoles");
function getRoleId() {
  if (!_roleId) {
    throw new Error("Roles not configured. Call configureRoles() at app startup.");
  }
  return _roleId;
}
__name(getRoleId, "getRoleId");
function isRolesConfigured() {
  return _roleId !== null;
}
__name(isRolesConfigured, "isRolesConfigured");

export {
  configureJsonApi,
  configureClientConfig,
  getApiUrl,
  getAppUrl,
  getTrackablePages,
  getStripePublishableKey,
  configureI18n,
  useI18nRouter,
  useI18nTranslations,
  getI18nLink,
  useI18nLocale,
  useI18nDateFnsLocale,
  configureLogin,
  isDiscordAuthEnabled,
  isInternalAuthEnabled,
  isRegistrationAllowed,
  configureRoles,
  getRoleId,
  isRolesConfigured
};
//# sourceMappingURL=chunk-KX7YG6LY.mjs.map