import { c as z, b as q, S as V, D as Z, R as X, v as p, f as J, K as k, r as x, F as B, s as v, k as K, a as Q, y as W, N as Y, h as $, e as f, J as E, a3 as w, a4 as F, a1 as tt, g as b, a0 as et, Z as I, V as L, W as nt, X as ot, n as st } from "./PlayerAccountControllerNd-NUeaPDxp.js";
const lt = (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) {
  z(e, t);
}
function it(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) {
  J(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, i, n = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), l, a, c;
  return {
    c() {
      t = v("div"), o = v("button"), i = v("span"), l = F(n), b(t, "class", "GeneralLogout");
    },
    m(r, d) {
      B(r, t, d), f(t, o), f(o, i), f(i, l), a || (c = E(
        o,
        "click",
        /*click_handler_1*/
        e[14]
      ), a = !0);
    },
    p(r, d) {
      d & /*$_*/
      4 && n !== (n = /*$_*/
      r[2]("logoutButton") + "") && I(l, n);
    },
    d(r) {
      r && x(t), a = !1, c();
    }
  };
}
function ut(e) {
  let t, o, i, n, l, a, c, r, d, h, _, g = !/*isMobile*/
  e[3] && ct(e);
  return {
    c() {
      t = v("p"), o = v("span"), i = w("svg"), n = w("defs"), l = w("style"), a = F(".a88316b4-2478-4a69-b2eb-d32a5fb419dd{fill:var(--emw--color-white, #FFFFFF);}"), c = w("path"), r = w("path"), d = tt(), 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(i, "id", "bbfaf345-72af-4296-bf4b-2fd41fc03d5d"), b(i, "data-name", "Layer 1"), b(i, "xmlns", "http://www.w3.org/2000/svg"), b(i, "viewBox", "0 0 150 150"), et(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(y, u) {
      B(y, t, u), f(t, o), f(o, i), f(i, n), f(n, l), f(l, a), f(i, c), f(i, r), f(t, d), g && g.m(t, null), h || (_ = E(
        t,
        "click",
        /*click_handler*/
        e[13]
      ), h = !0);
    },
    p(y, u) {
      /*isMobile*/
      y[3] || g.p(y, u);
    },
    d(y) {
      y && x(t), g && g.d(), h = !1, _();
    }
  };
}
function ct(e) {
  let t, o = (
    /*$_*/
    e[2]("logoutButton") + ""
  ), i;
  return {
    c() {
      t = v("span"), i = F(o), b(t, "class", "PlayerLogoutText");
    },
    m(n, l) {
      B(n, t, l), f(t, i);
    },
    p(n, l) {
      l & /*$_*/
      4 && o !== (o = /*$_*/
      n[2]("logoutButton") + "") && I(i, o);
    },
    d(n) {
      n && x(t);
    }
  };
}
function dt(e) {
  let t;
  function o(l, a) {
    return (
      /*buttonlocation*/
      l[0] === "PlayerAccountMenu" ? ut : rt
    );
  }
  let i = o(e), n = i(e);
  return {
    c() {
      t = v("div"), n.c();
    },
    m(l, a) {
      B(l, t, a), n.m(t, null), e[15](t);
    },
    p(l, [a]) {
      i === (i = o(l)) && n ? n.p(l, a) : (n.d(1), n = i(l), n && (n.c(), n.m(t, null)));
    },
    i: k,
    o: k,
    d(l) {
      l && x(t), n.d(), e[15](null);
    }
  };
}
function gt(e, t, o) {
  let i;
  K(e, Q, (s) => o(2, i = s));
  let { endpoint: n = "" } = t, { session: l = "" } = t, { buttonlocation: a = "" } = t, { lang: c = "" } = t, { mbsource: r } = t, { clientstyling: d = "" } = t, { clientstylingurl: h = "" } = t, { translationurl: _ = "" } = t, g = "", y = !1, u, C, T = window.navigator.userAgent, O = W(T) !== "PC";
  const H = window.matchMedia("(min-width: 768px)"), j = () => {
    fetch(_).then((m) => m.json()).then((m) => {
      Object.keys(m).forEach((A) => {
        P(A, m[A]);
      });
    }).catch((m) => {
      console.log(m);
    });
  };
  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", l);
    let m = { method: "DELETE", headers: s };
    fetch(`${n}/v1/player/session/player`, m).then((A) => {
      window.postMessage({ type: "LogoutSuccessfull" }, window.location.href), lt("logged_out", {});
    });
  }, G = () => (n || (g = "GENERAL-LOGOUT - Endpoint is missing! Please provide a valid endpointURL.", y = !0, console.error(g)), l || (g = "GENERAL-LOGOUT - Session is missing! Please provide a valid session.", y = !0, console.error(g)), y), N = () => {
    it(c);
  };
  Y(() => () => {
  });
  const R = () => M(), D = () => M();
  function U(s) {
    $[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, l = 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, h = s.clientstylingurl), "translationurl" in s && o(12, _ = s.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*endpoint, session, buttonlocation*/
    193 && n && l && a && G(), e.$$.dirty & /*lang*/
    256 && c && N(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && L(), e.$$.dirty & /*clientstyling, customStylingContainer*/
    1026 && d && u && L(u, d), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    2050 && h && u && nt(u, h), e.$$.dirty & /*mbsource, customStylingContainer*/
    514 && r && u && ot(u, `${r}.Style`, C), e.$$.dirty & /*translationurl*/
    4096 && _ && j();
  }, [
    a,
    u,
    i,
    O,
    H,
    M,
    n,
    l,
    c,
    r,
    d,
    h,
    _,
    R,
    D,
    U
  ];
}
class ft extends V {
  constructor(t) {
    super(), Z(
      this,
      t,
      gt,
      dt,
      X,
      {
        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();
  }
}
st(ft, { endpoint: {}, session: {}, buttonlocation: {}, lang: {}, mbsource: {}, clientstyling: {}, clientstylingurl: {}, translationurl: {} }, [], [], !0);
export {
  ft as default
};
