import { a as W, $ as G, S as J, i as Q, s as V, f as u, b as Y, n as R, d as k, c as E, K as Z, g as $, h as ee, o as ie, e as w, k as te, u as se, p as C, x as X, v as ne, t as S, J as f, A as oe, B as ae, C as re, D as ce } from "./PlayerAccountControllerNd-DobNa2EP.js";
function le(t, e) {
  W(t, e);
}
function be(t) {
  G.set(t);
}
const me = {
  en: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "zh-hk": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  fr: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  tr: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  ro: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  es: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  pt: {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  hr: {
    btnEnableBiometrics: "Omogući biometriju",
    btnDisableBiometrics: "Onemogući biometriju",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "pt-br": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "es-mx": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  },
  "en-us": {
    btnEnableBiometrics: "Enable biometrics",
    btnDisableBiometrics: "Disable biometrics",
    successEnableBiometrics: "Biometric authentication enabled.",
    successDisableBiometrics: "Biometric authentication disabled.",
    errorMessage: "Biometrics update failed"
  }
};
function ue(t, e, i) {
  return window.emMessageBus && (e = window.emMessageBus.subscribe(t, i)), e;
}
function de(t) {
  Y(t, "svelte-4r3z7g", '*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit}.toggle-content{display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:transparent;border:none;border-radius:20px;cursor:pointer;gap:10px}.toggle-content:disabled{cursor:not-allowed}.toggle-content .skip-switch{display:inline-flex;align-items:center;position:relative;height:20px;vertical-align:middle;transition:opacity 0.2s}.toggle-content .skip-switch.disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.toggle-content .skip-switch.checked .skip-switch-core{border-color:var(--emw--color-primary, #22b04e);background:var(--emw--color-primary, #22b04e)}.toggle-content .skip-switch.checked .skip-switch-core::after{transform:translateX(14px)}.toggle-content .skip-switch .skip-switch-input{position:absolute;width:0;height:0;opacity:0;margin:0}.toggle-content .skip-switch .skip-switch-core{width:34px;height:20px;border-radius:20px;border:1px solid var(--emw--color-gray-300, #ababab);background:var(--emw--color-gray-300, #ababab);position:relative;cursor:pointer;transition:background-color 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.toggle-content .skip-switch .skip-switch-core::after{content:"";position:absolute;top:2px;left:2px;width:14px;height:14px;background:#fff;border-radius:50%;transform:translateX(0);transition:transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)}.skip-switch.shake{animation:shake 0.4s ease}@keyframes shake{0%{transform:translateX(0)}20%{transform:translateX(-3px)}40%{transform:translateX(3px)}60%{transform:translateX(-3px)}80%{transform:translateX(3px)}100%{transform:translateX(0)}}.BiometricsToggle{background:var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));border:1px solid var(--emw--pam-color-primary, var(--emw--color-primary, #22b04e));color:var(--emw--button-typography, var(--emw--color-white, #ffffff));cursor:pointer;border-radius:5px;width:100%;height:50px;display:flex;align-items:center;justify-content:center;font-size:16px;text-transform:uppercase;transition-duration:0.3s;box-sizing:border-box}.BiometricsToggle:disabled{opacity:0.6;cursor:not-allowed}');
}
function z(t) {
  let e;
  function i(c, a) {
    if (
      /*mode*/
      c[1] === "button"
    )
      return fe;
    if (
      /*mode*/
      c[1] === "switch"
    )
      return ge;
  }
  let o = i(t), s = o && o(t);
  return {
    c() {
      e = w("div"), s && s.c();
    },
    m(c, a) {
      E(c, e, a), s && s.m(e, null), t[17](e);
    },
    p(c, a) {
      o === (o = i(c)) && s ? s.p(c, a) : (s && s.d(1), s = o && o(c), s && (s.c(), s.m(e, null)));
    },
    d(c) {
      c && k(e), s && s.d(), t[17](null);
    }
  };
}
function ge(t) {
  let e, i, o, s, c;
  return {
    c() {
      e = w("button"), i = w("div"), i.innerHTML = '<input type="checkbox" class="skip-switch-input"/> <span class="skip-switch-core"></span>', S(i, "class", "skip-switch"), f(
        i,
        "checked",
        /*biometricsEnabled*/
        t[4]
      ), f(
        i,
        "disabled",
        /*isUpdatingBiometrics*/
        t[5] || /*isLoading*/
        t[2]
      ), f(
        i,
        "shake",
        /*shake*/
        t[6]
      ), S(e, "class", "toggle-content"), e.disabled = o = /*isUpdatingBiometrics*/
      t[5] || /*isLoading*/
      t[2];
    },
    m(a, r) {
      E(a, e, r), C(e, i), s || (c = X(
        e,
        "click",
        /*toggleBiometrics*/
        t[8]
      ), s = !0);
    },
    p(a, r) {
      r & /*biometricsEnabled*/
      16 && f(
        i,
        "checked",
        /*biometricsEnabled*/
        a[4]
      ), r & /*isUpdatingBiometrics, isLoading*/
      36 && f(
        i,
        "disabled",
        /*isUpdatingBiometrics*/
        a[5] || /*isLoading*/
        a[2]
      ), r & /*shake*/
      64 && f(
        i,
        "shake",
        /*shake*/
        a[6]
      ), r & /*isUpdatingBiometrics, isLoading*/
      36 && o !== (o = /*isUpdatingBiometrics*/
      a[5] || /*isLoading*/
      a[2]) && (e.disabled = o);
    },
    d(a) {
      a && k(e), s = !1, c();
    }
  };
}
function fe(t) {
  let e, i = (
    /*biometricsEnabled*/
    (t[4] ? (
      /*$_*/
      t[7]("btnDisableBiometrics")
    ) : (
      /*$_*/
      t[7]("btnEnableBiometrics")
    )) + ""
  ), o, s, c, a;
  return {
    c() {
      e = w("button"), o = ne(i), S(e, "class", "BiometricsToggle"), e.disabled = s = /*isUpdatingBiometrics*/
      t[5] || /*isLoading*/
      t[2];
    },
    m(r, l) {
      E(r, e, l), C(e, o), c || (a = X(
        e,
        "click",
        /*click_handler*/
        t[16]
      ), c = !0);
    },
    p(r, l) {
      l & /*biometricsEnabled, $_*/
      144 && i !== (i = /*biometricsEnabled*/
      (r[4] ? (
        /*$_*/
        r[7]("btnDisableBiometrics")
      ) : (
        /*$_*/
        r[7]("btnEnableBiometrics")
      )) + "") && se(o, i), l & /*isUpdatingBiometrics, isLoading*/
      36 && s !== (s = /*isUpdatingBiometrics*/
      r[5] || /*isLoading*/
      r[2]) && (e.disabled = s);
    },
    d(r) {
      r && k(e), c = !1, a();
    }
  };
}
function he(t) {
  let e, i = (
    /*isNativeApp*/
    t[0] && z(t)
  );
  return {
    c() {
      i && i.c(), e = Z();
    },
    m(o, s) {
      i && i.m(o, s), E(o, e, s);
    },
    p(o, [s]) {
      /*isNativeApp*/
      o[0] ? i ? i.p(o, s) : (i = z(o), i.c(), i.m(e.parentNode, e)) : i && (i.d(1), i = null);
    },
    i: R,
    o: R,
    d(o) {
      o && k(e), i && i.d(o);
    }
  };
}
function Be(t, e, i) {
  let o;
  $(t, ee, (n) => i(7, o = n));
  let { lang: s = "en" } = e, { clientstyling: c = "" } = e, { clientstylingurl: a = "" } = e, { mbsource: r } = e, { translationurl: l = "" } = e, { isNativeApp: B = !1 } = e, { mode: T = "button" } = e, { isFromLogin: p = !1 } = e, { isLoading: L = !1 } = e, m, F, h, d = null, y = !1, g = !1, _ = !1;
  const D = (n) => {
    Object.keys(n).forEach((b) => {
      le(b, n[b]);
    });
  }, j = () => {
    fetch(l).then((b) => b.json()).then((b) => {
      D(b);
    }).catch((b) => {
      console.log(b);
    });
  };
  D(me);
  const U = () => {
    be(s);
  }, A = {
    BIOMETRICS_RESPONSE: 3e3,
    SHAKE_DURATION: 500
  };
  let M = !1;
  const H = () => {
    i(6, M = !0), setTimeout(
      () => {
        i(6, M = !1);
      },
      A.SHAKE_DURATION
    );
  }, N = () => {
    d && clearTimeout(d), d = setTimeout(
      () => {
        i(5, g = !1), H(), I("error", o("errorMessage"));
      },
      A.BIOMETRICS_RESPONSE
    );
  }, v = async () => {
    g || (i(5, g = !0), _ = !0, window.postMessage({
      type: "ToggleBiometrics",
      data: `${!y}`,
      isFromLogin: p
    }), N());
  }, x = (n) => {
    n.data?.type === "NativeAppReady" && (i(0, B = !0), O()), n.data?.type === "BiometricsStatus" && (i(4, y = n.data.status || !1), i(5, g = !1), d && (clearTimeout(d), d = null), _ && (p || I("success", o(y ? "successEnableBiometrics" : "successDisableBiometrics"))), _ = !1);
  }, O = () => {
    i(5, g = !0), window.postMessage({ type: "GetBiometricsStatus" }), N();
  }, K = () => {
    window.postMessage({ type: "CheckNativeApp" });
  }, I = (n, b) => {
    window.postMessage(
      {
        type: "WidgetNotification",
        data: {
          type: n,
          message: b,
          config: { clearBefore: !0 }
        }
      },
      window.location.href
    );
  };
  ie(() => (window.addEventListener("message", x), B === !0 ? O() : K(), () => {
    window.removeEventListener("message", x), h && h.unsubscribe(), d && clearTimeout(d);
  }));
  const P = () => v();
  function q(n) {
    te[n ? "unshift" : "push"](() => {
      m = n, i(3, m);
    });
  }
  return t.$$set = (n) => {
    "lang" in n && i(9, s = n.lang), "clientstyling" in n && i(10, c = n.clientstyling), "clientstylingurl" in n && i(11, a = n.clientstylingurl), "mbsource" in n && i(12, r = n.mbsource), "translationurl" in n && i(13, l = n.translationurl), "isNativeApp" in n && i(0, B = n.isNativeApp), "mode" in n && i(1, T = n.mode), "isFromLogin" in n && i(14, p = n.isFromLogin), "isLoading" in n && i(2, L = n.isLoading);
  }, t.$$.update = () => {
    t.$$.dirty & /*lang*/
    512 && s && U(), t.$$.dirty & /*clientstyling, customStylingContainer*/
    1032 && c && m && oe(m, c), t.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2056 && a && m && ae(m, a), t.$$.dirty & /*mbsource, customStylingContainer*/
    4104 && r && m && re(m, `${r}.Style`, F), t.$$.dirty & /*translationurl*/
    8192 && l && j(), t.$$.dirty & /*mbsource, translationurl, translationSubscription*/
    45056 && r && !l && i(15, h = ue(`${r}.Translation`, h, D));
  }, [
    B,
    T,
    L,
    m,
    y,
    g,
    M,
    o,
    v,
    s,
    c,
    a,
    r,
    l,
    p,
    h,
    P,
    q
  ];
}
class pe extends J {
  constructor(e) {
    super(), Q(
      this,
      e,
      Be,
      he,
      V,
      {
        lang: 9,
        clientstyling: 10,
        clientstylingurl: 11,
        mbsource: 12,
        translationurl: 13,
        isNativeApp: 0,
        mode: 1,
        isFromLogin: 14,
        isLoading: 2
      },
      de
    );
  }
  get lang() {
    return this.$$.ctx[9];
  }
  set lang(e) {
    this.$$set({ lang: e }), u();
  }
  get clientstyling() {
    return this.$$.ctx[10];
  }
  set clientstyling(e) {
    this.$$set({ clientstyling: e }), u();
  }
  get clientstylingurl() {
    return this.$$.ctx[11];
  }
  set clientstylingurl(e) {
    this.$$set({ clientstylingurl: e }), u();
  }
  get mbsource() {
    return this.$$.ctx[12];
  }
  set mbsource(e) {
    this.$$set({ mbsource: e }), u();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(e) {
    this.$$set({ translationurl: e }), u();
  }
  get isNativeApp() {
    return this.$$.ctx[0];
  }
  set isNativeApp(e) {
    this.$$set({ isNativeApp: e }), u();
  }
  get mode() {
    return this.$$.ctx[1];
  }
  set mode(e) {
    this.$$set({ mode: e }), u();
  }
  get isFromLogin() {
    return this.$$.ctx[14];
  }
  set isFromLogin(e) {
    this.$$set({ isFromLogin: e }), u();
  }
  get isLoading() {
    return this.$$.ctx[2];
  }
  set isLoading(e) {
    this.$$set({ isLoading: e }), u();
  }
}
ce(pe, { lang: {}, clientstyling: {}, clientstylingurl: {}, mbsource: {}, translationurl: {}, isNativeApp: { type: "Boolean" }, mode: {}, isFromLogin: { type: "Boolean" }, isLoading: { type: "Boolean" } }, [], [], !0);
export {
  pe as default
};
