import { r as registerInstance, a as createEvent, h, F as Fragment } from './index-5b83ee50.js';
import { h as signIn } from './auth.ic-55cb31f4.js';

const icSigninCss = "deckgo-ic-signin div.actions{display:flex;justify-content:center;align-content:center;padding:8px 16px}deckgo-ic-signin p.terms{font-size:var(--font-size-very-small);max-width:220px;margin-left:auto;margin-right:auto}";

const IcSignin = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.inProgress = createEvent(this, "inProgress", 7);
    this.signInInProgress = false;
  }
  async signUserIn() {
    this.inProgress.emit(true);
    this.signInInProgress = true;
    await signIn({ onSuccess: this.signInSuccess, onError: this.signInError });
  }
  render() {
    if (this.signInInProgress) {
      return h("ion-spinner", { color: "medium" });
    }
    return (h(Fragment, null, h("div", { class: "actions" }, this.renderAction()), this.renderTerms()));
  }
  renderAction() {
    return (h("ion-button", { shape: "round", color: "dark", onClick: async () => await this.signUserIn() }, h("ion-icon", { src: `${this.config.globalAssetsUrl}/icons/dfinity.svg`, "aria-label": "", "aria-hidden": true, slot: "start", lazy: true }), h("ion-label", null, this.i18n.sign_in.internet_identity)));
  }
  renderTerms() {
    return (h("p", { class: "ion-text-center ion-margin terms" }, "By continuing, you are indicating that you accept our", ' ', h("a", { href: "https://deckdeckgo.com/terms", rel: "noopener norefferer", target: "_blank" }, h("ion-label", null, this.i18n.links.terms_of_use)), ' ', "and", ' ', h("a", { href: "https://deckdeckgo.com/privacy", rel: "noopener norefferer", target: "_blank" }, h("ion-label", null, this.i18n.links.privacy_policy)), "."));
  }
};
IcSignin.style = icSigninCss;

export { IcSignin as deckgo_ic_signin };
