import { a as U, $ as q, S as V, i as Z, s as Q, f as p, b as X, n as L, d as v, c as B, e as w, g as Y, h as J, o as K, j as W, m as f, w as E, x, u as F, p as $, r as b, E as tt, t as I, z as k, A as et, B as nt, C as ot, D as st } from "./PlayerAccountController-yJR1r7p7.js";
const it = (e, t = {}) => {
  const o = new CustomEvent("track-custom-event", {
    detail: {
      type: e,
      data: t
    },
    bubbles: !0,
    composed: !0
  });
  document.dispatchEvent(o);
};
function P(e, t) {
  U(e, t);
}
function lt(e) {
  q.set(e);
}
const S = {
  en: {
    logoutButton: "Logout"
  },
  "zh-hk": {
    logoutButton: "登出"
  },
  fr: {
    logoutButton: "Déconnexion"
  },
  tr: {
    logoutButton: "Çıkış Yap"
  },
  ro: {
    logoutButton: "Iesire"
  },
  es: {
    logoutButton: "Cerrar sesión"
  },
  pt: {
    logoutButton: "Sair"
  },
  hr: {
    logoutButton: "Odjava"
  },
  "pt-br": {
    logoutButton: "Fechar Sessão"
  },
  "es-mx": {
    logoutButton: "Cerrar sesión"
  },
  "en-us": {
    logoutButton: "Logout"
  }
};
function at(e) {
  X(e, "svelte-xtnqa3", "*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.PlayerAccountMenuItemBox{padding:20px;font-size:16px;display:inline-flex;width:100%;box-sizing:border-box;align-items:center;cursor:pointer}.PlayerAccountMenuItemBox .PlayerLogoutText{margin-left:20px}.PlayerAccountMenuItemBox svg{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox{height:auto;justify-content:center;position:relative;display:flex;width:unset;padding:0}.PlayerAccountMenuItemBoxMobile.PlayerAccountMenuItemBox svg{fill:var(--emw--pam-typography-color-nav-bg, var(--emw--color-white, #FFFFFF))}");
}
function rt(e) {
  let t, o, l, n = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), i, a, c;
  return {
    c() {
      t = w("div"), o = w("button"), l = w("span"), i = F(n), b(t, "class", "GeneralLogout");
    },
    m(r, d) {
      B(r, t, d), f(t, o), f(o, l), f(l, i), a || (c = E(
        o,
        "click",
        /*click_handler_1*/
        e[14]
      ), a = !0);
    },
    p(r, d) {
      d & /*$_*/
      4 && n !== (n = /*$_*/
      r[2]("logoutButton") + "") && I(i, n);
    },
    d(r) {
      r && v(t), a = !1, c();
    }
  };
}
function ut(e) {
  let t, o, l, n, i, a, c, r, d, m, _, g = !/*isMobile*/
  e[3] && ct(e);
  return {
    c() {
      t = w("p"), o = w("span"), l = x("svg"), n = x("defs"), i = x("style"), a = F(".a88316b4-2478-4a69-b2eb-d32a5fb419dd{fill:var(--emw--color-white, #FFFFFF);}"), c = x("path"), r = x("path"), d = $(), g && g.c(), b(c, "class", "a88316b4-2478-4a69-b2eb-d32a5fb419dd"), b(c, "d", "M147.16,67.69,115.42,36a9.6,9.6,0,1,0-13.58,13.58l15.32,15.31H49.58a9.63,9.63,0,1,0,0,19.26h67.58L101.84,99.42a9.64,9.64,0,0,0,6.79,16.43,9.41,9.41,0,0,0,6.79-2.85l31.74-31.73a9.53,9.53,0,0,0,0-13.58Z"), b(r, "class", "a88316b4-2478-4a69-b2eb-d32a5fb419dd"), b(r, "d", "M45.16,122.16H19.26V26.79H45.32a9.63,9.63,0,1,0,0-19.26H9.63A9.56,9.56,0,0,0,0,17.16V131.63a9.57,9.57,0,0,0,9.63,9.64H45.32A9.57,9.57,0,0,0,55,131.63a9.78,9.78,0,0,0-9.79-9.47Z"), b(l, "id", "bbfaf345-72af-4296-bf4b-2fd41fc03d5d"), b(l, "data-name", "Layer 1"), b(l, "xmlns", "http://www.w3.org/2000/svg"), b(l, "viewBox", "0 0 150 150"), tt(o, "width", /*isMobile*/
      e[3] ? (
        /*mediaQuery*/
        e[4].matches ? "20px" : "24px"
      ) : "20px"), b(t, "class", "PlayerAccountMenuItemBox " + /*isMobile*/
      (e[3] ? "PlayerAccountMenuItemBoxMobile" : "") + " " + /*mediaQuery*/
      (e[4].matches && /*isMobile*/
      e[3] ? "PlayerAccountMenuItemBoxTablet" : ""));
    },
    m(h, u) {
      B(h, t, u), f(t, o), f(o, l), f(l, n), f(n, i), f(i, a), f(l, c), f(l, r), f(t, d), g && g.m(t, null), m || (_ = E(
        t,
        "click",
        /*click_handler*/
        e[13]
      ), m = !0);
    },
    p(h, u) {
      /*isMobile*/
      h[3] || g.p(h, u);
    },
    d(h) {
      h && v(t), g && g.d(), m = !1, _();
    }
  };
}
function ct(e) {
  let t, o = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), l;
  return {
    c() {
      t = w("span"), l = F(o), b(t, "class", "PlayerLogoutText");
    },
    m(n, i) {
      B(n, t, i), f(t, l);
    },
    p(n, i) {
      i & /*$_*/
      4 && o !== (o = /*$_*/
      n[2]("logoutButton") + "") && I(l, o);
    },
    d(n) {
      n && v(t);
    }
  };
}
function dt(e) {
  let t;
  function o(i, a) {
    return (
      /*buttonlocation*/
      i[0] === "PlayerAccountMenu" ? ut : rt
    );
  }
  let l = o(e), n = l(e);
  return {
    c() {
      t = w("div"), n.c();
    },
    m(i, a) {
      B(i, t, a), n.m(t, null), e[15](t);
    },
    p(i, [a]) {
      l === (l = o(i)) && n ? n.p(i, a) : (n.d(1), n = l(i), n && (n.c(), n.m(t, null)));
    },
    i: L,
    o: L,
    d(i) {
      i && v(t), n.d(), e[15](null);
    }
  };
}
function gt(e, t, o) {
  let l;
  Y(e, st, (s) => o(2, l = s));
  let { endpoint: n = "" } = t, { session: i = "" } = t, { buttonlocation: a = "" } = t, { lang: c = "" } = t, { mbsource: r } = t, { clientstyling: d = "" } = t, { clientstylingurl: m = "" } = t, { translationurl: _ = "" } = t, g = "", h = !1, u, C, T = window.navigator.userAgent, O = J(T) !== "PC";
  const j = window.matchMedia("(min-width: 768px)"), H = () => {
    fetch(_).then((y) => y.json()).then((y) => {
      Object.keys(y).forEach((A) => {
        P(A, y[A]);
      });
    }).catch((y) => {
      console.log(y);
    });
  };
  Object.keys(S).forEach((s) => {
    P(s, S[s]);
  });
  const M = () => {
    let s = new Headers();
    s.append("Content-type", "application/json"), s.append("X-SessionID", i);
    let y = { method: "DELETE", headers: s };
    fetch(`${n}/v1/player/session/player`, y).then((A) => {
      window.postMessage({ type: "LogoutSuccessfull" }, window.location.href), it("logged_out", {});
    });
  }, G = () => (n || (g = "GENERAL-LOGOUT - Endpoint is missing! Please provide a valid endpointURL.", h = !0, console.error(g)), i || (g = "GENERAL-LOGOUT - Session is missing! Please provide a valid session.", h = !0, console.error(g)), h), z = () => {
    lt(c);
  };
  K(() => () => {
  });
  const D = () => M(), N = () => M();
  function R(s) {
    W[s ? "unshift" : "push"](() => {
      u = s, o(1, u);
    });
  }
  return e.$$set = (s) => {
    "endpoint" in s && o(6, n = s.endpoint), "session" in s && o(7, i = s.session), "buttonlocation" in s && o(0, a = s.buttonlocation), "lang" in s && o(8, c = s.lang), "mbsource" in s && o(9, r = s.mbsource), "clientstyling" in s && o(10, d = s.clientstyling), "clientstylingurl" in s && o(11, m = s.clientstylingurl), "translationurl" in s && o(12, _ = s.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*endpoint, session, buttonlocation*/
    193 && n && i && a && G(), e.$$.dirty & /*lang*/
    256 && c && z(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && k(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && k(u, d), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2050 && m && u && et(u, m), e.$$.dirty & /*mbsource, customStylingContainer*/
    514 && r && u && nt(u, `${r}.Style`, C), e.$$.dirty & /*translationurl*/
    4096 && _ && H();
  }, [
    a,
    u,
    l,
    O,
    j,
    M,
    n,
    i,
    c,
    r,
    d,
    m,
    _,
    D,
    N,
    R
  ];
}
class ft extends V {
  constructor(t) {
    super(), Z(
      this,
      t,
      gt,
      dt,
      Q,
      {
        endpoint: 6,
        session: 7,
        buttonlocation: 0,
        lang: 8,
        mbsource: 9,
        clientstyling: 10,
        clientstylingurl: 11,
        translationurl: 12
      },
      at
    );
  }
  get endpoint() {
    return this.$$.ctx[6];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), p();
  }
  get session() {
    return this.$$.ctx[7];
  }
  set session(t) {
    this.$$set({ session: t }), p();
  }
  get buttonlocation() {
    return this.$$.ctx[0];
  }
  set buttonlocation(t) {
    this.$$set({ buttonlocation: t }), p();
  }
  get lang() {
    return this.$$.ctx[8];
  }
  set lang(t) {
    this.$$set({ lang: t }), p();
  }
  get mbsource() {
    return this.$$.ctx[9];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), p();
  }
  get clientstyling() {
    return this.$$.ctx[10];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), p();
  }
  get clientstylingurl() {
    return this.$$.ctx[11];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), p();
  }
  get translationurl() {
    return this.$$.ctx[12];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), p();
  }
}
ot(ft, { endpoint: {}, session: {}, buttonlocation: {}, lang: {}, mbsource: {}, clientstyling: {}, clientstylingurl: {}, translationurl: {} }, [], [], !0);
export {
  ft as default
};
