import { o as p } from "./rolldown-runtime.js";
import { i as l, n as u } from "./vendor/react.js";
import { i as d } from "./LoginPage.js";
var o = /* @__PURE__ */ p(l(), 1), h = u();
function b(t) {
  return {
    onSignUpClick: (e) => {
      t.dispatchEvent(new CustomEvent("sign-up-click", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onLogInClick: (e) => {
      t.dispatchEvent(new CustomEvent("log-in-click", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onEmailSubmit: (e) => {
      t.dispatchEvent(new CustomEvent("email-submit", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onForgotPasswordClick: (e) => {
      t.dispatchEvent(new CustomEvent("forgot-password-click", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onSignUpLinkClick: (e) => {
      t.dispatchEvent(new CustomEvent("sign-up-link-click", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onGoogleSignIn: (e) => {
      t.dispatchEvent(new CustomEvent("google-sign-in", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onFacebookSignIn: (e) => {
      t.dispatchEvent(new CustomEvent("facebook-sign-in", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onAppleSignIn: (e) => {
      t.dispatchEvent(new CustomEvent("apple-sign-in", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    },
    onSAMLSignIn: (e) => {
      t.dispatchEvent(new CustomEvent("saml-sign-in", {
        detail: e,
        bubbles: !0,
        composed: !0
      }));
    }
  };
}
function g(t) {
  const { _hostElement: e, ...r } = t, i = o.useMemo(() => e ? b(e) : {}, [e]);
  return o.createElement(d, {
    ...r,
    ...i
  });
}
var n = {
  variant: "string",
  size: "string",
  className: "string",
  logo: "json",
  showTabs: "boolean",
  title: "string",
  subtitle: "string",
  submitLabel: "string",
  footerText: "string",
  footerLinkText: "string",
  loading: "boolean",
  error: "string"
};
function s(t, e) {
  if (t !== null)
    switch (e) {
      case "number":
        return Number(t);
      case "boolean":
        return t !== "false" && t !== "0";
      case "json":
        try {
          return JSON.parse(t);
        } catch {
          return t;
        }
      default:
        return t;
    }
}
var a = class extends HTMLElement {
  _root = null;
  _childrenContainer = null;
  _props = {};
  _initialized = !1;
  connectedCallback() {
    setTimeout(() => this._initialize(), 0);
  }
  _initialize() {
    if (this._initialized) return;
    this._initialized = !0;
    const t = [];
    for (const r of Array.from(this.childNodes))
      r.nodeType === Node.TEXT_NODE && !r.textContent?.trim() || t.push(r);
    const e = document.createElement("div");
    for (e.style.display = "contents", this._childrenContainer = document.createElement("div"), this._childrenContainer.style.display = "contents", t.forEach((r) => this._childrenContainer.appendChild(r)); this.firstChild; ) this.removeChild(this.firstChild);
    this.appendChild(e), this._root = (0, h.createRoot)(e), this._render();
  }
  disconnectedCallback() {
    this._root?.unmount(), this._root = null;
  }
  attributeChangedCallback(t, e, r) {
    this._render();
  }
  static get observedAttributes() {
    return Object.keys(n).map((t) => t.replace(/([A-Z])/g, "-$1").toLowerCase());
  }
  _setProp(t, e) {
    const r = n[t] || "string";
    this._props[t] = this._parseValue(e, r), this._render();
  }
  _parseValue(t, e) {
    if (e === "boolean" && typeof t == "boolean" || e === "number" && typeof t == "number" || e === "string" && typeof t == "string") return t;
    if (typeof t == "string") switch (e) {
      case "boolean":
        return t !== "false" && t !== "0" && t !== "";
      case "number":
        return Number(t);
      case "json":
        try {
          return JSON.parse(t);
        } catch {
          return t;
        }
      default:
        return t;
    }
    return t;
  }
  _getProp(t) {
    if (t in this._props) return this._props[t];
    const e = t.replace(/([A-Z])/g, "-$1").toLowerCase(), r = n[t] || "string";
    return s(this.getAttribute(e), r);
  }
  _render() {
    if (!this._root) return;
    const t = {};
    for (const [r, i] of Object.entries(n)) if (r in this._props) t[r] = this._props[r];
    else {
      const c = r.replace(/([A-Z])/g, "-$1").toLowerCase();
      t[r] = s(this.getAttribute(c), i);
    }
    const e = o.createElement(g, {
      ...t,
      _hostElement: this
    });
    this._root.render(e);
  }
};
for (const t of Object.keys(n)) Object.defineProperty(a.prototype, t, {
  get() {
    return this._getProp(t);
  },
  set(e) {
    this._setProp(t, e);
  },
  enumerable: !0,
  configurable: !0
});
typeof customElements < "u" && !customElements.get("hf-login-page") && customElements.define("hf-login-page", a);
export {
  a as LoginPageWC,
  a as default
};

//# sourceMappingURL=hf-login-page.js.map