function isRegistrationOpen(mode) {
  return mode === "open" || mode === "domain-open";
}
function isDomainAllowed(email, allowedDomains) {
  var _a;
  if (!allowedDomains.length) return false;
  const domain = (_a = email.split("@")[1]) == null ? void 0 : _a.toLowerCase();
  if (!domain) return false;
  return allowedDomains.some(
    (allowed) => domain === allowed.toLowerCase()
  );
}
function isGoogleAuthEnabled(authConfig) {
  var _a, _b;
  return ((_b = (_a = authConfig.providers) == null ? void 0 : _a.google) == null ? void 0 : _b.enabled) !== false;
}
function isSignupPageVisible(mode) {
  return mode === "open" || mode === "domain-open";
}
function isEmailSignupEnabled(mode) {
  return mode === "open" || mode === "domain-open";
}
function shouldBlockSignup(mode, isOAuth) {
  if (mode === "domain-restricted" && !isOAuth) return true;
  return false;
}
function isEmailLoginVisible(mode) {
  return mode !== "domain-restricted";
}
function getPublicAuthConfig(authConfig) {
  return {
    registration: {
      mode: authConfig.registration.mode
    },
    providers: {
      google: {
        enabled: isGoogleAuthEnabled(authConfig)
      }
    }
  };
}
export {
  getPublicAuthConfig,
  isDomainAllowed,
  isEmailLoginVisible,
  isEmailSignupEnabled,
  isGoogleAuthEnabled,
  isRegistrationOpen,
  isSignupPageVisible,
  shouldBlockSignup
};
