'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

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

exports.deckgo_ic_signin = IcSignin;
