import { c as Yt, b as qt, S as Wt, D as Xt, R as Zt, v as z, f as xt, K as dt, r as tt, Z as gt, F as et, e as P, J as $t, s as D, a4 as ht, a1 as At, g as _, k as te, a as ee, M as ne, h as re, a2 as Tt, V as oe, W as ie, X as se, n as ae } from "./PlayerAccountControllerNd-NUeaPDxp.js";
function It(e, t) {
  Yt(e, t);
}
function le(e) {
  qt.set(e);
}
const Nt = {
  en: {
    titleQRSessionGenerator: "Scan the QR Code to access your account on retail devices.",
    generateQRButton: "Generate QR",
    unauthorized: "Authentication failed.",
    failedToFetch: "Cannot generate QR, Please try again.",
    unexpectedError: "Unexpected error occurred. Please try again later.",
    second: "s"
  },
  fr: {
    titleQRSessionGenerator: "Scannez le code QR pour accéder à votre compte sur les appareils en magasin.",
    generateQRButton: "Générer des QR",
    unauthorized: "L'authentification a échoué.",
    failedToFetch: "Impossible de générer le code QR, veuillez réessayer.",
    unexpectedError: "Une erreur inattendue s'est produite. Veuillez réessayer plus tard.",
    second: "s"
  }
};
var j = {}, ue = function() {
  return typeof Promise == "function" && Promise.prototype && Promise.prototype.then;
}, _t = {}, I = {};
let pt;
const ce = [
  0,
  // Not used
  26,
  44,
  70,
  100,
  134,
  172,
  196,
  242,
  292,
  346,
  404,
  466,
  532,
  581,
  655,
  733,
  815,
  901,
  991,
  1085,
  1156,
  1258,
  1364,
  1474,
  1588,
  1706,
  1828,
  1921,
  2051,
  2185,
  2323,
  2465,
  2611,
  2761,
  2876,
  3034,
  3196,
  3362,
  3532,
  3706
];
I.getSymbolSize = function(t) {
  if (!t)
    throw new Error('"version" cannot be null or undefined');
  if (t < 1 || t > 40)
    throw new Error('"version" should be in range from 1 to 40');
  return t * 4 + 17;
};
I.getSymbolTotalCodewords = function(t) {
  return ce[t];
};
I.getBCHDigit = function(e) {
  let t = 0;
  for (; e !== 0; )
    t++, e >>>= 1;
  return t;
};
I.setToSJISFunction = function(t) {
  if (typeof t != "function")
    throw new Error('"toSJISFunc" is not a valid function.');
  pt = t;
};
I.isKanjiModeEnabled = function() {
  return typeof pt < "u";
};
I.toSJIS = function(t) {
  return pt(t);
};
var nt = {};
(function(e) {
  e.L = { bit: 1 }, e.M = { bit: 0 }, e.Q = { bit: 3 }, e.H = { bit: 2 };
  function t(n) {
    if (typeof n != "string")
      throw new Error("Param is not a string");
    switch (n.toLowerCase()) {
      case "l":
      case "low":
        return e.L;
      case "m":
      case "medium":
        return e.M;
      case "q":
      case "quartile":
        return e.Q;
      case "h":
      case "high":
        return e.H;
      default:
        throw new Error("Unknown EC Level: " + n);
    }
  }
  e.isValid = function(o) {
    return o && typeof o.bit < "u" && o.bit >= 0 && o.bit < 4;
  }, e.from = function(o, r) {
    if (e.isValid(o))
      return o;
    try {
      return t(o);
    } catch {
      return r;
    }
  };
})(nt);
function Lt() {
  this.buffer = [], this.length = 0;
}
Lt.prototype = {
  get: function(e) {
    const t = Math.floor(e / 8);
    return (this.buffer[t] >>> 7 - e % 8 & 1) === 1;
  },
  put: function(e, t) {
    for (let n = 0; n < t; n++)
      this.putBit((e >>> t - n - 1 & 1) === 1);
  },
  getLengthInBits: function() {
    return this.length;
  },
  putBit: function(e) {
    const t = Math.floor(this.length / 8);
    this.buffer.length <= t && this.buffer.push(0), e && (this.buffer[t] |= 128 >>> this.length % 8), this.length++;
  }
};
var fe = Lt;
function Y(e) {
  if (!e || e < 1)
    throw new Error("BitMatrix size must be defined and greater than 0");
  this.size = e, this.data = new Uint8Array(e * e), this.reservedBit = new Uint8Array(e * e);
}
Y.prototype.set = function(e, t, n, o) {
  const r = e * this.size + t;
  this.data[r] = n, o && (this.reservedBit[r] = !0);
};
Y.prototype.get = function(e, t) {
  return this.data[e * this.size + t];
};
Y.prototype.xor = function(e, t, n) {
  this.data[e * this.size + t] ^= n;
};
Y.prototype.isReserved = function(e, t) {
  return this.reservedBit[e * this.size + t];
};
var de = Y, Ut = {};
(function(e) {
  const t = I.getSymbolSize;
  e.getRowColCoords = function(o) {
    if (o === 1)
      return [];
    const r = Math.floor(o / 7) + 2, i = t(o), s = i === 145 ? 26 : Math.ceil((i - 13) / (2 * r - 2)) * 2, a = [i - 7];
    for (let l = 1; l < r - 1; l++)
      a[l] = a[l - 1] - s;
    return a.push(6), a.reverse();
  }, e.getPositions = function(o) {
    const r = [], i = e.getRowColCoords(o), s = i.length;
    for (let a = 0; a < s; a++)
      for (let l = 0; l < s; l++)
        a === 0 && l === 0 || // top-left
        a === 0 && l === s - 1 || // bottom-left
        a === s - 1 && l === 0 || r.push([i[a], i[l]]);
    return r;
  };
})(Ut);
var Dt = {};
const ge = I.getSymbolSize, Rt = 7;
Dt.getPositions = function(t) {
  const n = ge(t);
  return [
    // top-left
    [0, 0],
    // top-right
    [n - Rt, 0],
    // bottom-left
    [0, n - Rt]
  ];
};
var kt = {};
(function(e) {
  e.Patterns = {
    PATTERN000: 0,
    PATTERN001: 1,
    PATTERN010: 2,
    PATTERN011: 3,
    PATTERN100: 4,
    PATTERN101: 5,
    PATTERN110: 6,
    PATTERN111: 7
  };
  const t = {
    N1: 3,
    N2: 3,
    N3: 40,
    N4: 10
  };
  e.isValid = function(r) {
    return r != null && r !== "" && !isNaN(r) && r >= 0 && r <= 7;
  }, e.from = function(r) {
    return e.isValid(r) ? parseInt(r, 10) : void 0;
  }, e.getPenaltyN1 = function(r) {
    const i = r.size;
    let s = 0, a = 0, l = 0, f = null, c = null;
    for (let b = 0; b < i; b++) {
      a = l = 0, f = c = null;
      for (let d = 0; d < i; d++) {
        let g = r.get(b, d);
        g === f ? a++ : (a >= 5 && (s += t.N1 + (a - 5)), f = g, a = 1), g = r.get(d, b), g === c ? l++ : (l >= 5 && (s += t.N1 + (l - 5)), c = g, l = 1);
      }
      a >= 5 && (s += t.N1 + (a - 5)), l >= 5 && (s += t.N1 + (l - 5));
    }
    return s;
  }, e.getPenaltyN2 = function(r) {
    const i = r.size;
    let s = 0;
    for (let a = 0; a < i - 1; a++)
      for (let l = 0; l < i - 1; l++) {
        const f = r.get(a, l) + r.get(a, l + 1) + r.get(a + 1, l) + r.get(a + 1, l + 1);
        (f === 4 || f === 0) && s++;
      }
    return s * t.N2;
  }, e.getPenaltyN3 = function(r) {
    const i = r.size;
    let s = 0, a = 0, l = 0;
    for (let f = 0; f < i; f++) {
      a = l = 0;
      for (let c = 0; c < i; c++)
        a = a << 1 & 2047 | r.get(f, c), c >= 10 && (a === 1488 || a === 93) && s++, l = l << 1 & 2047 | r.get(c, f), c >= 10 && (l === 1488 || l === 93) && s++;
    }
    return s * t.N3;
  }, e.getPenaltyN4 = function(r) {
    let i = 0;
    const s = r.data.length;
    for (let l = 0; l < s; l++)
      i += r.data[l];
    return Math.abs(Math.ceil(i * 100 / s / 5) - 10) * t.N4;
  };
  function n(o, r, i) {
    switch (o) {
      case e.Patterns.PATTERN000:
        return (r + i) % 2 === 0;
      case e.Patterns.PATTERN001:
        return r % 2 === 0;
      case e.Patterns.PATTERN010:
        return i % 3 === 0;
      case e.Patterns.PATTERN011:
        return (r + i) % 3 === 0;
      case e.Patterns.PATTERN100:
        return (Math.floor(r / 2) + Math.floor(i / 3)) % 2 === 0;
      case e.Patterns.PATTERN101:
        return r * i % 2 + r * i % 3 === 0;
      case e.Patterns.PATTERN110:
        return (r * i % 2 + r * i % 3) % 2 === 0;
      case e.Patterns.PATTERN111:
        return (r * i % 3 + (r + i) % 2) % 2 === 0;
      default:
        throw new Error("bad maskPattern:" + o);
    }
  }
  e.applyMask = function(r, i) {
    const s = i.size;
    for (let a = 0; a < s; a++)
      for (let l = 0; l < s; l++)
        i.isReserved(l, a) || i.xor(l, a, n(r, l, a));
  }, e.getBestMask = function(r, i) {
    const s = Object.keys(e.Patterns).length;
    let a = 0, l = 1 / 0;
    for (let f = 0; f < s; f++) {
      i(f), e.applyMask(f, r);
      const c = e.getPenaltyN1(r) + e.getPenaltyN2(r) + e.getPenaltyN3(r) + e.getPenaltyN4(r);
      e.applyMask(f, r), c < l && (l = c, a = f);
    }
    return a;
  };
})(kt);
var rt = {};
const k = nt, W = [
  // L  M  Q  H
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  4,
  1,
  2,
  4,
  4,
  2,
  4,
  4,
  4,
  2,
  4,
  6,
  5,
  2,
  4,
  6,
  6,
  2,
  5,
  8,
  8,
  4,
  5,
  8,
  8,
  4,
  5,
  8,
  11,
  4,
  8,
  10,
  11,
  4,
  9,
  12,
  16,
  4,
  9,
  16,
  16,
  6,
  10,
  12,
  18,
  6,
  10,
  17,
  16,
  6,
  11,
  16,
  19,
  6,
  13,
  18,
  21,
  7,
  14,
  21,
  25,
  8,
  16,
  20,
  25,
  8,
  17,
  23,
  25,
  9,
  17,
  23,
  34,
  9,
  18,
  25,
  30,
  10,
  20,
  27,
  32,
  12,
  21,
  29,
  35,
  12,
  23,
  34,
  37,
  12,
  25,
  34,
  40,
  13,
  26,
  35,
  42,
  14,
  28,
  38,
  45,
  15,
  29,
  40,
  48,
  16,
  31,
  43,
  51,
  17,
  33,
  45,
  54,
  18,
  35,
  48,
  57,
  19,
  37,
  51,
  60,
  19,
  38,
  53,
  63,
  20,
  40,
  56,
  66,
  21,
  43,
  59,
  70,
  22,
  45,
  62,
  74,
  24,
  47,
  65,
  77,
  25,
  49,
  68,
  81
], X = [
  // L  M  Q  H
  7,
  10,
  13,
  17,
  10,
  16,
  22,
  28,
  15,
  26,
  36,
  44,
  20,
  36,
  52,
  64,
  26,
  48,
  72,
  88,
  36,
  64,
  96,
  112,
  40,
  72,
  108,
  130,
  48,
  88,
  132,
  156,
  60,
  110,
  160,
  192,
  72,
  130,
  192,
  224,
  80,
  150,
  224,
  264,
  96,
  176,
  260,
  308,
  104,
  198,
  288,
  352,
  120,
  216,
  320,
  384,
  132,
  240,
  360,
  432,
  144,
  280,
  408,
  480,
  168,
  308,
  448,
  532,
  180,
  338,
  504,
  588,
  196,
  364,
  546,
  650,
  224,
  416,
  600,
  700,
  224,
  442,
  644,
  750,
  252,
  476,
  690,
  816,
  270,
  504,
  750,
  900,
  300,
  560,
  810,
  960,
  312,
  588,
  870,
  1050,
  336,
  644,
  952,
  1110,
  360,
  700,
  1020,
  1200,
  390,
  728,
  1050,
  1260,
  420,
  784,
  1140,
  1350,
  450,
  812,
  1200,
  1440,
  480,
  868,
  1290,
  1530,
  510,
  924,
  1350,
  1620,
  540,
  980,
  1440,
  1710,
  570,
  1036,
  1530,
  1800,
  570,
  1064,
  1590,
  1890,
  600,
  1120,
  1680,
  1980,
  630,
  1204,
  1770,
  2100,
  660,
  1260,
  1860,
  2220,
  720,
  1316,
  1950,
  2310,
  750,
  1372,
  2040,
  2430
];
rt.getBlocksCount = function(t, n) {
  switch (n) {
    case k.L:
      return W[(t - 1) * 4 + 0];
    case k.M:
      return W[(t - 1) * 4 + 1];
    case k.Q:
      return W[(t - 1) * 4 + 2];
    case k.H:
      return W[(t - 1) * 4 + 3];
    default:
      return;
  }
};
rt.getTotalCodewordsCount = function(t, n) {
  switch (n) {
    case k.L:
      return X[(t - 1) * 4 + 0];
    case k.M:
      return X[(t - 1) * 4 + 1];
    case k.Q:
      return X[(t - 1) * 4 + 2];
    case k.H:
      return X[(t - 1) * 4 + 3];
    default:
      return;
  }
};
var Ft = {}, ot = {};
const J = new Uint8Array(512), x = new Uint8Array(256);
(function() {
  let t = 1;
  for (let n = 0; n < 255; n++)
    J[n] = t, x[t] = n, t <<= 1, t & 256 && (t ^= 285);
  for (let n = 255; n < 512; n++)
    J[n] = J[n - 255];
})();
ot.log = function(t) {
  if (t < 1)
    throw new Error("log(" + t + ")");
  return x[t];
};
ot.exp = function(t) {
  return J[t];
};
ot.mul = function(t, n) {
  return t === 0 || n === 0 ? 0 : J[x[t] + x[n]];
};
(function(e) {
  const t = ot;
  e.mul = function(o, r) {
    const i = new Uint8Array(o.length + r.length - 1);
    for (let s = 0; s < o.length; s++)
      for (let a = 0; a < r.length; a++)
        i[s + a] ^= t.mul(o[s], r[a]);
    return i;
  }, e.mod = function(o, r) {
    let i = new Uint8Array(o);
    for (; i.length - r.length >= 0; ) {
      const s = i[0];
      for (let l = 0; l < r.length; l++)
        i[l] ^= t.mul(r[l], s);
      let a = 0;
      for (; a < i.length && i[a] === 0; )
        a++;
      i = i.slice(a);
    }
    return i;
  }, e.generateECPolynomial = function(o) {
    let r = new Uint8Array([1]);
    for (let i = 0; i < o; i++)
      r = e.mul(r, new Uint8Array([1, t.exp(i)]));
    return r;
  };
})(Ft);
const zt = Ft;
function Ct(e) {
  this.genPoly = void 0, this.degree = e, this.degree && this.initialize(this.degree);
}
Ct.prototype.initialize = function(t) {
  this.degree = t, this.genPoly = zt.generateECPolynomial(this.degree);
};
Ct.prototype.encode = function(t) {
  if (!this.genPoly)
    throw new Error("Encoder not initialized");
  const n = new Uint8Array(t.length + this.degree);
  n.set(t);
  const o = zt.mod(n, this.genPoly), r = this.degree - o.length;
  if (r > 0) {
    const i = new Uint8Array(this.degree);
    return i.set(o, r), i;
  }
  return o;
};
var he = Ct, vt = {}, F = {}, bt = {};
bt.isValid = function(t) {
  return !isNaN(t) && t >= 1 && t <= 40;
};
var M = {};
const Vt = "[0-9]+", me = "[A-Z $%*+\\-./:]+";
let G = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";
G = G.replace(/u/g, "\\u");
const we = "(?:(?![A-Z0-9 $%*+\\-./:]|" + G + `)(?:.|[\r
]))+`;
M.KANJI = new RegExp(G, "g");
M.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\-./:]+", "g");
M.BYTE = new RegExp(we, "g");
M.NUMERIC = new RegExp(Vt, "g");
M.ALPHANUMERIC = new RegExp(me, "g");
const ye = new RegExp("^" + G + "$"), Ee = new RegExp("^" + Vt + "$"), pe = new RegExp("^[A-Z0-9 $%*+\\-./:]+$");
M.testKanji = function(t) {
  return ye.test(t);
};
M.testNumeric = function(t) {
  return Ee.test(t);
};
M.testAlphanumeric = function(t) {
  return pe.test(t);
};
(function(e) {
  const t = bt, n = M;
  e.NUMERIC = {
    id: "Numeric",
    bit: 1,
    ccBits: [10, 12, 14]
  }, e.ALPHANUMERIC = {
    id: "Alphanumeric",
    bit: 2,
    ccBits: [9, 11, 13]
  }, e.BYTE = {
    id: "Byte",
    bit: 4,
    ccBits: [8, 16, 16]
  }, e.KANJI = {
    id: "Kanji",
    bit: 8,
    ccBits: [8, 10, 12]
  }, e.MIXED = {
    bit: -1
  }, e.getCharCountIndicator = function(i, s) {
    if (!i.ccBits)
      throw new Error("Invalid mode: " + i);
    if (!t.isValid(s))
      throw new Error("Invalid version: " + s);
    return s >= 1 && s < 10 ? i.ccBits[0] : s < 27 ? i.ccBits[1] : i.ccBits[2];
  }, e.getBestModeForData = function(i) {
    return n.testNumeric(i) ? e.NUMERIC : n.testAlphanumeric(i) ? e.ALPHANUMERIC : n.testKanji(i) ? e.KANJI : e.BYTE;
  }, e.toString = function(i) {
    if (i && i.id)
      return i.id;
    throw new Error("Invalid mode");
  }, e.isValid = function(i) {
    return i && i.bit && i.ccBits;
  };
  function o(r) {
    if (typeof r != "string")
      throw new Error("Param is not a string");
    switch (r.toLowerCase()) {
      case "numeric":
        return e.NUMERIC;
      case "alphanumeric":
        return e.ALPHANUMERIC;
      case "kanji":
        return e.KANJI;
      case "byte":
        return e.BYTE;
      default:
        throw new Error("Unknown mode: " + r);
    }
  }
  e.from = function(i, s) {
    if (e.isValid(i))
      return i;
    try {
      return o(i);
    } catch {
      return s;
    }
  };
})(F);
(function(e) {
  const t = I, n = rt, o = nt, r = F, i = bt, s = 7973, a = t.getBCHDigit(s);
  function l(d, g, h) {
    for (let m = 1; m <= 40; m++)
      if (g <= e.getCapacity(m, h, d))
        return m;
  }
  function f(d, g) {
    return r.getCharCountIndicator(d, g) + 4;
  }
  function c(d, g) {
    let h = 0;
    return d.forEach(function(m) {
      const C = f(m.mode, g);
      h += C + m.getBitsLength();
    }), h;
  }
  function b(d, g) {
    for (let h = 1; h <= 40; h++)
      if (c(d, h) <= e.getCapacity(h, g, r.MIXED))
        return h;
  }
  e.from = function(g, h) {
    return i.isValid(g) ? parseInt(g, 10) : h;
  }, e.getCapacity = function(g, h, m) {
    if (!i.isValid(g))
      throw new Error("Invalid QR Code version");
    typeof m > "u" && (m = r.BYTE);
    const C = t.getSymbolTotalCodewords(g), u = n.getTotalCodewordsCount(g, h), w = (C - u) * 8;
    if (m === r.MIXED)
      return w;
    const E = w - f(m, g);
    switch (m) {
      case r.NUMERIC:
        return Math.floor(E / 10 * 3);
      case r.ALPHANUMERIC:
        return Math.floor(E / 11 * 2);
      case r.KANJI:
        return Math.floor(E / 13);
      case r.BYTE:
      default:
        return Math.floor(E / 8);
    }
  }, e.getBestVersionForData = function(g, h) {
    let m;
    const C = o.from(h, o.M);
    if (Array.isArray(g)) {
      if (g.length > 1)
        return b(g, C);
      if (g.length === 0)
        return 1;
      m = g[0];
    } else
      m = g;
    return l(m.mode, m.getLength(), C);
  }, e.getEncodedBits = function(g) {
    if (!i.isValid(g) || g < 7)
      throw new Error("Invalid QR Code version");
    let h = g << 12;
    for (; t.getBCHDigit(h) - a >= 0; )
      h ^= s << t.getBCHDigit(h) - a;
    return g << 12 | h;
  };
})(vt);
var Ht = {};
const mt = I, Ot = 1335, Ce = 21522, Mt = mt.getBCHDigit(Ot);
Ht.getEncodedBits = function(t, n) {
  const o = t.bit << 3 | n;
  let r = o << 10;
  for (; mt.getBCHDigit(r) - Mt >= 0; )
    r ^= Ot << mt.getBCHDigit(r) - Mt;
  return (o << 10 | r) ^ Ce;
};
var Kt = {};
const be = F;
function v(e) {
  this.mode = be.NUMERIC, this.data = e.toString();
}
v.getBitsLength = function(t) {
  return 10 * Math.floor(t / 3) + (t % 3 ? t % 3 * 3 + 1 : 0);
};
v.prototype.getLength = function() {
  return this.data.length;
};
v.prototype.getBitsLength = function() {
  return v.getBitsLength(this.data.length);
};
v.prototype.write = function(t) {
  let n, o, r;
  for (n = 0; n + 3 <= this.data.length; n += 3)
    o = this.data.substr(n, 3), r = parseInt(o, 10), t.put(r, 10);
  const i = this.data.length - n;
  i > 0 && (o = this.data.substr(n), r = parseInt(o, 10), t.put(r, i * 3 + 1));
};
var Be = v;
const Se = F, at = [
  "0",
  "1",
  "2",
  "3",
  "4",
  "5",
  "6",
  "7",
  "8",
  "9",
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G",
  "H",
  "I",
  "J",
  "K",
  "L",
  "M",
  "N",
  "O",
  "P",
  "Q",
  "R",
  "S",
  "T",
  "U",
  "V",
  "W",
  "X",
  "Y",
  "Z",
  " ",
  "$",
  "%",
  "*",
  "+",
  "-",
  ".",
  "/",
  ":"
];
function V(e) {
  this.mode = Se.ALPHANUMERIC, this.data = e;
}
V.getBitsLength = function(t) {
  return 11 * Math.floor(t / 2) + 6 * (t % 2);
};
V.prototype.getLength = function() {
  return this.data.length;
};
V.prototype.getBitsLength = function() {
  return V.getBitsLength(this.data.length);
};
V.prototype.write = function(t) {
  let n;
  for (n = 0; n + 2 <= this.data.length; n += 2) {
    let o = at.indexOf(this.data[n]) * 45;
    o += at.indexOf(this.data[n + 1]), t.put(o, 11);
  }
  this.data.length % 2 && t.put(at.indexOf(this.data[n]), 6);
};
var Ae = V;
const Te = F;
function H(e) {
  this.mode = Te.BYTE, typeof e == "string" ? this.data = new TextEncoder().encode(e) : this.data = new Uint8Array(e);
}
H.getBitsLength = function(t) {
  return t * 8;
};
H.prototype.getLength = function() {
  return this.data.length;
};
H.prototype.getBitsLength = function() {
  return H.getBitsLength(this.data.length);
};
H.prototype.write = function(e) {
  for (let t = 0, n = this.data.length; t < n; t++)
    e.put(this.data[t], 8);
};
var Ie = H;
const Ne = F, Re = I;
function O(e) {
  this.mode = Ne.KANJI, this.data = e;
}
O.getBitsLength = function(t) {
  return t * 13;
};
O.prototype.getLength = function() {
  return this.data.length;
};
O.prototype.getBitsLength = function() {
  return O.getBitsLength(this.data.length);
};
O.prototype.write = function(e) {
  let t;
  for (t = 0; t < this.data.length; t++) {
    let n = Re.toSJIS(this.data[t]);
    if (n >= 33088 && n <= 40956)
      n -= 33088;
    else if (n >= 57408 && n <= 60351)
      n -= 49472;
    else
      throw new Error(
        "Invalid SJIS character: " + this.data[t] + `
Make sure your charset is UTF-8`
      );
    n = (n >>> 8 & 255) * 192 + (n & 255), e.put(n, 13);
  }
};
var Me = O, Qt = { exports: {} };
(function(e) {
  var t = {
    single_source_shortest_paths: function(n, o, r) {
      var i = {}, s = {};
      s[o] = 0;
      var a = t.PriorityQueue.make();
      a.push(o, 0);
      for (var l, f, c, b, d, g, h, m, C; !a.empty(); ) {
        l = a.pop(), f = l.value, b = l.cost, d = n[f] || {};
        for (c in d)
          d.hasOwnProperty(c) && (g = d[c], h = b + g, m = s[c], C = typeof s[c] > "u", (C || m > h) && (s[c] = h, a.push(c, h), i[c] = f));
      }
      if (typeof r < "u" && typeof s[r] > "u") {
        var u = ["Could not find a path from ", o, " to ", r, "."].join("");
        throw new Error(u);
      }
      return i;
    },
    extract_shortest_path_from_predecessor_list: function(n, o) {
      for (var r = [], i = o; i; )
        r.push(i), n[i], i = n[i];
      return r.reverse(), r;
    },
    find_path: function(n, o, r) {
      var i = t.single_source_shortest_paths(n, o, r);
      return t.extract_shortest_path_from_predecessor_list(
        i,
        r
      );
    },
    /**
     * A very naive priority queue implementation.
     */
    PriorityQueue: {
      make: function(n) {
        var o = t.PriorityQueue, r = {}, i;
        n = n || {};
        for (i in o)
          o.hasOwnProperty(i) && (r[i] = o[i]);
        return r.queue = [], r.sorter = n.sorter || o.default_sorter, r;
      },
      default_sorter: function(n, o) {
        return n.cost - o.cost;
      },
      /**
       * Add a new item to the queue and ensure the highest priority element
       * is at the front of the queue.
       */
      push: function(n, o) {
        var r = { value: n, cost: o };
        this.queue.push(r), this.queue.sort(this.sorter);
      },
      /**
       * Return the highest priority element in the queue.
       */
      pop: function() {
        return this.queue.shift();
      },
      empty: function() {
        return this.queue.length === 0;
      }
    }
  };
  e.exports = t;
})(Qt);
var Pe = Qt.exports;
(function(e) {
  const t = F, n = Be, o = Ae, r = Ie, i = Me, s = M, a = I, l = Pe;
  function f(u) {
    return unescape(encodeURIComponent(u)).length;
  }
  function c(u, w, E) {
    const y = [];
    let B;
    for (; (B = u.exec(E)) !== null; )
      y.push({
        data: B[0],
        index: B.index,
        mode: w,
        length: B[0].length
      });
    return y;
  }
  function b(u) {
    const w = c(s.NUMERIC, t.NUMERIC, u), E = c(s.ALPHANUMERIC, t.ALPHANUMERIC, u);
    let y, B;
    return a.isKanjiModeEnabled() ? (y = c(s.BYTE, t.BYTE, u), B = c(s.KANJI, t.KANJI, u)) : (y = c(s.BYTE_KANJI, t.BYTE, u), B = []), w.concat(E, y, B).sort(function(A, T) {
      return A.index - T.index;
    }).map(function(A) {
      return {
        data: A.data,
        mode: A.mode,
        length: A.length
      };
    });
  }
  function d(u, w) {
    switch (w) {
      case t.NUMERIC:
        return n.getBitsLength(u);
      case t.ALPHANUMERIC:
        return o.getBitsLength(u);
      case t.KANJI:
        return i.getBitsLength(u);
      case t.BYTE:
        return r.getBitsLength(u);
    }
  }
  function g(u) {
    return u.reduce(function(w, E) {
      const y = w.length - 1 >= 0 ? w[w.length - 1] : null;
      return y && y.mode === E.mode ? (w[w.length - 1].data += E.data, w) : (w.push(E), w);
    }, []);
  }
  function h(u) {
    const w = [];
    for (let E = 0; E < u.length; E++) {
      const y = u[E];
      switch (y.mode) {
        case t.NUMERIC:
          w.push([
            y,
            { data: y.data, mode: t.ALPHANUMERIC, length: y.length },
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.ALPHANUMERIC:
          w.push([
            y,
            { data: y.data, mode: t.BYTE, length: y.length }
          ]);
          break;
        case t.KANJI:
          w.push([
            y,
            { data: y.data, mode: t.BYTE, length: f(y.data) }
          ]);
          break;
        case t.BYTE:
          w.push([
            { data: y.data, mode: t.BYTE, length: f(y.data) }
          ]);
      }
    }
    return w;
  }
  function m(u, w) {
    const E = {}, y = { start: {} };
    let B = ["start"];
    for (let S = 0; S < u.length; S++) {
      const A = u[S], T = [];
      for (let N = 0; N < A.length; N++) {
        const R = A[N], L = "" + S + N;
        T.push(L), E[L] = { node: R, lastCount: 0 }, y[L] = {};
        for (let K = 0; K < B.length; K++) {
          const p = B[K];
          E[p] && E[p].node.mode === R.mode ? (y[p][L] = d(E[p].lastCount + R.length, R.mode) - d(E[p].lastCount, R.mode), E[p].lastCount += R.length) : (E[p] && (E[p].lastCount = R.length), y[p][L] = d(R.length, R.mode) + 4 + t.getCharCountIndicator(R.mode, w));
        }
      }
      B = T;
    }
    for (let S = 0; S < B.length; S++)
      y[B[S]].end = 0;
    return { map: y, table: E };
  }
  function C(u, w) {
    let E;
    const y = t.getBestModeForData(u);
    if (E = t.from(w, y), E !== t.BYTE && E.bit < y.bit)
      throw new Error('"' + u + '" cannot be encoded with mode ' + t.toString(E) + `.
 Suggested mode is: ` + t.toString(y));
    switch (E === t.KANJI && !a.isKanjiModeEnabled() && (E = t.BYTE), E) {
      case t.NUMERIC:
        return new n(u);
      case t.ALPHANUMERIC:
        return new o(u);
      case t.KANJI:
        return new i(u);
      case t.BYTE:
        return new r(u);
    }
  }
  e.fromArray = function(w) {
    return w.reduce(function(E, y) {
      return typeof y == "string" ? E.push(C(y, null)) : y.data && E.push(C(y.data, y.mode)), E;
    }, []);
  }, e.fromString = function(w, E) {
    const y = b(w, a.isKanjiModeEnabled()), B = h(y), S = m(B, E), A = l.find_path(S.map, "start", "end"), T = [];
    for (let N = 1; N < A.length - 1; N++)
      T.push(S.table[A[N]].node);
    return e.fromArray(g(T));
  }, e.rawSplit = function(w) {
    return e.fromArray(
      b(w, a.isKanjiModeEnabled())
    );
  };
})(Kt);
const it = I, lt = nt, _e = fe, Le = de, Ue = Ut, De = Dt, wt = kt, yt = rt, ke = he, $ = vt, Fe = Ht, ze = F, ut = Kt;
function ve(e, t) {
  const n = e.size, o = De.getPositions(t);
  for (let r = 0; r < o.length; r++) {
    const i = o[r][0], s = o[r][1];
    for (let a = -1; a <= 7; a++)
      if (!(i + a <= -1 || n <= i + a))
        for (let l = -1; l <= 7; l++)
          s + l <= -1 || n <= s + l || (a >= 0 && a <= 6 && (l === 0 || l === 6) || l >= 0 && l <= 6 && (a === 0 || a === 6) || a >= 2 && a <= 4 && l >= 2 && l <= 4 ? e.set(i + a, s + l, !0, !0) : e.set(i + a, s + l, !1, !0));
  }
}
function Ve(e) {
  const t = e.size;
  for (let n = 8; n < t - 8; n++) {
    const o = n % 2 === 0;
    e.set(n, 6, o, !0), e.set(6, n, o, !0);
  }
}
function He(e, t) {
  const n = Ue.getPositions(t);
  for (let o = 0; o < n.length; o++) {
    const r = n[o][0], i = n[o][1];
    for (let s = -2; s <= 2; s++)
      for (let a = -2; a <= 2; a++)
        s === -2 || s === 2 || a === -2 || a === 2 || s === 0 && a === 0 ? e.set(r + s, i + a, !0, !0) : e.set(r + s, i + a, !1, !0);
  }
}
function Oe(e, t) {
  const n = e.size, o = $.getEncodedBits(t);
  let r, i, s;
  for (let a = 0; a < 18; a++)
    r = Math.floor(a / 3), i = a % 3 + n - 8 - 3, s = (o >> a & 1) === 1, e.set(r, i, s, !0), e.set(i, r, s, !0);
}
function ct(e, t, n) {
  const o = e.size, r = Fe.getEncodedBits(t, n);
  let i, s;
  for (i = 0; i < 15; i++)
    s = (r >> i & 1) === 1, i < 6 ? e.set(i, 8, s, !0) : i < 8 ? e.set(i + 1, 8, s, !0) : e.set(o - 15 + i, 8, s, !0), i < 8 ? e.set(8, o - i - 1, s, !0) : i < 9 ? e.set(8, 15 - i - 1 + 1, s, !0) : e.set(8, 15 - i - 1, s, !0);
  e.set(o - 8, 8, 1, !0);
}
function Ke(e, t) {
  const n = e.size;
  let o = -1, r = n - 1, i = 7, s = 0;
  for (let a = n - 1; a > 0; a -= 2)
    for (a === 6 && a--; ; ) {
      for (let l = 0; l < 2; l++)
        if (!e.isReserved(r, a - l)) {
          let f = !1;
          s < t.length && (f = (t[s] >>> i & 1) === 1), e.set(r, a - l, f), i--, i === -1 && (s++, i = 7);
        }
      if (r += o, r < 0 || n <= r) {
        r -= o, o = -o;
        break;
      }
    }
}
function Qe(e, t, n) {
  const o = new _e();
  n.forEach(function(l) {
    o.put(l.mode.bit, 4), o.put(l.getLength(), ze.getCharCountIndicator(l.mode, e)), l.write(o);
  });
  const r = it.getSymbolTotalCodewords(e), i = yt.getTotalCodewordsCount(e, t), s = (r - i) * 8;
  for (o.getLengthInBits() + 4 <= s && o.put(0, 4); o.getLengthInBits() % 8 !== 0; )
    o.putBit(0);
  const a = (s - o.getLengthInBits()) / 8;
  for (let l = 0; l < a; l++)
    o.put(l % 2 ? 17 : 236, 8);
  return Je(o, e, t);
}
function Je(e, t, n) {
  const o = it.getSymbolTotalCodewords(t), r = yt.getTotalCodewordsCount(t, n), i = o - r, s = yt.getBlocksCount(t, n), a = o % s, l = s - a, f = Math.floor(o / s), c = Math.floor(i / s), b = c + 1, d = f - c, g = new ke(d);
  let h = 0;
  const m = new Array(s), C = new Array(s);
  let u = 0;
  const w = new Uint8Array(e.buffer);
  for (let A = 0; A < s; A++) {
    const T = A < l ? c : b;
    m[A] = w.slice(h, h + T), C[A] = g.encode(m[A]), h += T, u = Math.max(u, T);
  }
  const E = new Uint8Array(o);
  let y = 0, B, S;
  for (B = 0; B < u; B++)
    for (S = 0; S < s; S++)
      B < m[S].length && (E[y++] = m[S][B]);
  for (B = 0; B < d; B++)
    for (S = 0; S < s; S++)
      E[y++] = C[S][B];
  return E;
}
function Ge(e, t, n, o) {
  let r;
  if (Array.isArray(e))
    r = ut.fromArray(e);
  else if (typeof e == "string") {
    let f = t;
    if (!f) {
      const c = ut.rawSplit(e);
      f = $.getBestVersionForData(c, n);
    }
    r = ut.fromString(e, f || 40);
  } else
    throw new Error("Invalid data");
  const i = $.getBestVersionForData(r, n);
  if (!i)
    throw new Error("The amount of data is too big to be stored in a QR Code");
  if (!t)
    t = i;
  else if (t < i)
    throw new Error(
      `
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: ` + i + `.
`
    );
  const s = Qe(t, n, r), a = it.getSymbolSize(t), l = new Le(a);
  return ve(l, t), Ve(l), He(l, t), ct(l, n, 0), t >= 7 && Oe(l, t), Ke(l, s), isNaN(o) && (o = wt.getBestMask(
    l,
    ct.bind(null, l, n)
  )), wt.applyMask(o, l), ct(l, n, o), {
    modules: l,
    version: t,
    errorCorrectionLevel: n,
    maskPattern: o,
    segments: r
  };
}
_t.create = function(t, n) {
  if (typeof t > "u" || t === "")
    throw new Error("No input text");
  let o = lt.M, r, i;
  return typeof n < "u" && (o = lt.from(n.errorCorrectionLevel, lt.M), r = $.from(n.version), i = wt.from(n.maskPattern), n.toSJISFunc && it.setToSJISFunction(n.toSJISFunc)), Ge(t, r, o, i);
};
var Jt = {}, Bt = {};
(function(e) {
  function t(n) {
    if (typeof n == "number" && (n = n.toString()), typeof n != "string")
      throw new Error("Color should be defined as hex string");
    let o = n.slice().replace("#", "").split("");
    if (o.length < 3 || o.length === 5 || o.length > 8)
      throw new Error("Invalid hex color: " + n);
    (o.length === 3 || o.length === 4) && (o = Array.prototype.concat.apply([], o.map(function(i) {
      return [i, i];
    }))), o.length === 6 && o.push("F", "F");
    const r = parseInt(o.join(""), 16);
    return {
      r: r >> 24 & 255,
      g: r >> 16 & 255,
      b: r >> 8 & 255,
      a: r & 255,
      hex: "#" + o.slice(0, 6).join("")
    };
  }
  e.getOptions = function(o) {
    o || (o = {}), o.color || (o.color = {});
    const r = typeof o.margin > "u" || o.margin === null || o.margin < 0 ? 4 : o.margin, i = o.width && o.width >= 21 ? o.width : void 0, s = o.scale || 4;
    return {
      width: i,
      scale: i ? 4 : s,
      margin: r,
      color: {
        dark: t(o.color.dark || "#000000ff"),
        light: t(o.color.light || "#ffffffff")
      },
      type: o.type,
      rendererOpts: o.rendererOpts || {}
    };
  }, e.getScale = function(o, r) {
    return r.width && r.width >= o + r.margin * 2 ? r.width / (o + r.margin * 2) : r.scale;
  }, e.getImageWidth = function(o, r) {
    const i = e.getScale(o, r);
    return Math.floor((o + r.margin * 2) * i);
  }, e.qrToImageData = function(o, r, i) {
    const s = r.modules.size, a = r.modules.data, l = e.getScale(s, i), f = Math.floor((s + i.margin * 2) * l), c = i.margin * l, b = [i.color.light, i.color.dark];
    for (let d = 0; d < f; d++)
      for (let g = 0; g < f; g++) {
        let h = (d * f + g) * 4, m = i.color.light;
        if (d >= c && g >= c && d < f - c && g < f - c) {
          const C = Math.floor((d - c) / l), u = Math.floor((g - c) / l);
          m = b[a[C * s + u] ? 1 : 0];
        }
        o[h++] = m.r, o[h++] = m.g, o[h++] = m.b, o[h] = m.a;
      }
  };
})(Bt);
(function(e) {
  const t = Bt;
  function n(r, i, s) {
    r.clearRect(0, 0, i.width, i.height), i.style || (i.style = {}), i.height = s, i.width = s, i.style.height = s + "px", i.style.width = s + "px";
  }
  function o() {
    try {
      return document.createElement("canvas");
    } catch {
      throw new Error("You need to specify a canvas element");
    }
  }
  e.render = function(i, s, a) {
    let l = a, f = s;
    typeof l > "u" && (!s || !s.getContext) && (l = s, s = void 0), s || (f = o()), l = t.getOptions(l);
    const c = t.getImageWidth(i.modules.size, l), b = f.getContext("2d"), d = b.createImageData(c, c);
    return t.qrToImageData(d.data, i, l), n(b, f, c), b.putImageData(d, 0, 0), f;
  }, e.renderToDataURL = function(i, s, a) {
    let l = a;
    typeof l > "u" && (!s || !s.getContext) && (l = s, s = void 0), l || (l = {});
    const f = e.render(i, s, l), c = l.type || "image/png", b = l.rendererOpts || {};
    return f.toDataURL(c, b.quality);
  };
})(Jt);
var Gt = {};
const je = Bt;
function Pt(e, t) {
  const n = e.a / 255, o = t + '="' + e.hex + '"';
  return n < 1 ? o + " " + t + '-opacity="' + n.toFixed(2).slice(1) + '"' : o;
}
function ft(e, t, n) {
  let o = e + t;
  return typeof n < "u" && (o += " " + n), o;
}
function Ye(e, t, n) {
  let o = "", r = 0, i = !1, s = 0;
  for (let a = 0; a < e.length; a++) {
    const l = Math.floor(a % t), f = Math.floor(a / t);
    !l && !i && (i = !0), e[a] ? (s++, a > 0 && l > 0 && e[a - 1] || (o += i ? ft("M", l + n, 0.5 + f + n) : ft("m", r, 0), r = 0, i = !1), l + 1 < t && e[a + 1] || (o += ft("h", s), s = 0)) : r++;
  }
  return o;
}
Gt.render = function(t, n, o) {
  const r = je.getOptions(n), i = t.modules.size, s = t.modules.data, a = i + r.margin * 2, l = r.color.light.a ? "<path " + Pt(r.color.light, "fill") + ' d="M0 0h' + a + "v" + a + 'H0z"/>' : "", f = "<path " + Pt(r.color.dark, "stroke") + ' d="' + Ye(s, i, r.margin) + '"/>', c = 'viewBox="0 0 ' + a + " " + a + '"', d = '<svg xmlns="http://www.w3.org/2000/svg" ' + (r.width ? 'width="' + r.width + '" height="' + r.width + '" ' : "") + c + ' shape-rendering="crispEdges">' + l + f + `</svg>
`;
  return typeof o == "function" && o(null, d), d;
};
const qe = ue, Et = _t, jt = Jt, We = Gt;
function St(e, t, n, o, r) {
  const i = [].slice.call(arguments, 1), s = i.length, a = typeof i[s - 1] == "function";
  if (!a && !qe())
    throw new Error("Callback required as last argument");
  if (a) {
    if (s < 2)
      throw new Error("Too few arguments provided");
    s === 2 ? (r = n, n = t, t = o = void 0) : s === 3 && (t.getContext && typeof r > "u" ? (r = o, o = void 0) : (r = o, o = n, n = t, t = void 0));
  } else {
    if (s < 1)
      throw new Error("Too few arguments provided");
    return s === 1 ? (n = t, t = o = void 0) : s === 2 && !t.getContext && (o = n, n = t, t = void 0), new Promise(function(l, f) {
      try {
        const c = Et.create(n, o);
        l(e(c, t, o));
      } catch (c) {
        f(c);
      }
    });
  }
  try {
    const l = Et.create(n, o);
    r(null, e(l, t, o));
  } catch (l) {
    r(l);
  }
}
j.create = Et.create;
j.toCanvas = St.bind(null, jt.render);
j.toDataURL = St.bind(null, jt.renderToDataURL);
j.toString = St.bind(null, function(e, t, n) {
  return We.render(e, n);
});
var Z = /* @__PURE__ */ ((e) => (e.unauthorizedError = "unauthorized", e.unexpectedError = "unexpectedError", e.failedToFetch = "failedToFetch", e))(Z || {});
function Xe(e) {
  xt(e, "svelte-ty0b2n", '*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box;font-family:inherit}.LoadingSpinner{display:block;width:80px;height:80px;margin:0 auto 0 0}.LoadingSpinner:after{content:" ";display:block;width:64px;height:64px;margin:8px;border-radius:50%;border:6px solid var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e));border-color:var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e)) transparent var(--emw--casino-color-primary, var(--emw--color-primary, #22b04e)) transparent;animation:LoadingSpinner 1.2s linear infinite}@keyframes LoadingSpinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}');
}
function Ze(e) {
  let t, n, o;
  return {
    c() {
      t = D("div"), n = D("img"), _(n, "class", "qr-image"), Tt(n.src, o = /*qrImageUrl*/
      e[3]) || _(n, "src", o), _(n, "alt", "qr-session-login"), _(t, "class", "qr-section");
    },
    m(r, i) {
      et(r, t, i), P(t, n);
    },
    p(r, i) {
      i & /*qrImageUrl*/
      8 && !Tt(n.src, o = /*qrImageUrl*/
      r[3]) && _(n, "src", o);
    },
    d(r) {
      r && tt(t);
    }
  };
}
function xe(e) {
  let t;
  return {
    c() {
      t = D("div"), _(t, "class", "LoadingSpinner");
    },
    m(n, o) {
      et(n, t, o);
    },
    p: dt,
    d(n) {
      n && tt(t);
    }
  };
}
function $e(e) {
  let t, n = (
    /*$_*/
    e[5](
      /*errorCode*/
      e[4]
    ) + ""
  ), o;
  return {
    c() {
      t = D("p"), o = ht(n), _(t, "class", "generate-qr-error-message");
    },
    m(r, i) {
      et(r, t, i), P(t, o);
    },
    p(r, i) {
      i & /*$_, errorCode*/
      48 && n !== (n = /*$_*/
      r[5](
        /*errorCode*/
        r[4]
      ) + "") && gt(o, n);
    },
    d(r) {
      r && tt(t);
    }
  };
}
function tn(e) {
  let t, n, o, r = (
    /*$_*/
    e[5]("titleQRSessionGenerator") + ""
  ), i, s, a, l = (
    /*remaining*/
    (e[1] > 0 ? `${/*remaining*/
    e[1]}${/*$_*/
    e[5]("second")}` : (
      /*$_*/
      e[5]("generateQRButton")
    )) + ""
  ), f, c, b, d, g;
  function h(u, w) {
    if (
      /*errorCode*/
      u[4]
    )
      return $e;
    if (
      /*isGenerating*/
      u[2]
    )
      return xe;
    if (
      /*qrImageUrl*/
      u[3]
    )
      return Ze;
  }
  let m = h(e), C = m && m(e);
  return {
    c() {
      t = D("div"), n = D("div"), o = D("p"), i = ht(r), s = At(), a = D("button"), f = ht(l), b = At(), C && C.c(), _(a, "class", "generate-qr-btn"), a.disabled = c = /*isGenerating*/
      e[2] || /*remaining*/
      e[1] > 0, _(n, "class", "qr-session-generator");
    },
    m(u, w) {
      et(u, t, w), P(t, n), P(n, o), P(o, i), P(n, s), P(n, a), P(a, f), P(n, b), C && C.m(n, null), e[14](t), d || (g = $t(
        a,
        "click",
        /*onGenerateQRClick*/
        e[6]
      ), d = !0);
    },
    p(u, [w]) {
      w & /*$_*/
      32 && r !== (r = /*$_*/
      u[5]("titleQRSessionGenerator") + "") && gt(i, r), w & /*remaining, $_*/
      34 && l !== (l = /*remaining*/
      (u[1] > 0 ? `${/*remaining*/
      u[1]}${/*$_*/
      u[5]("second")}` : (
        /*$_*/
        u[5]("generateQRButton")
      )) + "") && gt(f, l), w & /*isGenerating, remaining*/
      6 && c !== (c = /*isGenerating*/
      u[2] || /*remaining*/
      u[1] > 0) && (a.disabled = c), m === (m = h(u)) && C ? C.p(u, w) : (C && C.d(1), C = m && m(u), C && (C.c(), C.m(n, null)));
    },
    i: dt,
    o: dt,
    d(u) {
      u && tt(t), C && C.d(), e[14](null), d = !1, g();
    }
  };
}
const en = 60, nn = 1e3;
function rn(e, t, n) {
  let o;
  te(e, ee, (p) => n(5, o = p));
  let { clientstyling: r = "" } = t, { clientstylingurl: i = "" } = t, { mbsource: s } = t, { lang: a = "en" } = t, { endpoint: l = "" } = t, { sessionid: f } = t, { translationurl: c } = t;
  const b = {
    "gm.norway.unauthorized": Z.unauthorizedError
  };
  let d, g, h = 0, m = !1, C = null, u = null, w = null;
  const E = async () => {
    const p = c;
    try {
      const q = await (await fetch(p)).json();
      Object.keys(q).forEach((U) => {
        It(U, q[U]);
      });
    } catch (Q) {
      console.error(Q);
    }
  };
  Object.keys(Nt).forEach((p) => {
    It(p, Nt[p]);
  });
  const y = () => {
    le(a);
  }, B = async (p) => {
    n(3, u = await j.toDataURL(p));
  }, S = (p) => {
    n(4, w = p), L();
  }, A = async () => {
    const p = new URL(`${l}/api/pam/v1/qr/authenticate`), Q = new Headers();
    Q.append("X-SessionID", f);
    const q = { method: "POST", headers: Q };
    try {
      const U = await fetch(p.href, q);
      if (U.ok) {
        const st = await U.json();
        await B(JSON.stringify(st));
      } else {
        const st = await U.json();
        S(b[st.Code] ?? Z.unexpectedError);
      }
    } catch (U) {
      console.error(U), S(Z.failedToFetch);
    } finally {
      n(2, m = !1);
    }
  }, T = async () => {
    m || h > 0 || (n(2, m = !0), n(4, w = null), n(3, u = null), n(1, h = en), R(), await A());
  };
  function N() {
    C !== null && clearInterval(C);
  }
  function R() {
    N(), C = setInterval(
      () => {
        h > 1 ? n(1, h -= 1) : (n(1, h = 0), n(2, m = !1), n(3, u = null), L());
      },
      nn
    );
  }
  function L() {
    N(), C = null, n(1, h = 0);
  }
  ne(() => {
    N();
  });
  function K(p) {
    re[p ? "unshift" : "push"](() => {
      d = p, n(0, d);
    });
  }
  return e.$$set = (p) => {
    "clientstyling" in p && n(7, r = p.clientstyling), "clientstylingurl" in p && n(8, i = p.clientstylingurl), "mbsource" in p && n(9, s = p.mbsource), "lang" in p && n(10, a = p.lang), "endpoint" in p && n(11, l = p.endpoint), "sessionid" in p && n(12, f = p.sessionid), "translationurl" in p && n(13, c = p.translationurl);
  }, e.$$.update = () => {
    e.$$.dirty & /*clientstyling, customStylingContainer*/
    129 && r && d && oe(d, r), e.$$.dirty & /*clientstylingurl, customStylingContainer*/
    257 && i && d && ie(d, i), e.$$.dirty & /*mbsource, customStylingContainer*/
    513 && s && d && se(d, `${s}.Style`, g), e.$$.dirty & /*lang*/
    1024 && a && y(), e.$$.dirty & /*translationurl*/
    8192 && c && E();
  }, [
    d,
    h,
    m,
    u,
    w,
    o,
    T,
    r,
    i,
    s,
    a,
    l,
    f,
    c,
    K
  ];
}
class on extends Wt {
  constructor(t) {
    super(), Xt(
      this,
      t,
      rn,
      tn,
      Zt,
      {
        clientstyling: 7,
        clientstylingurl: 8,
        mbsource: 9,
        lang: 10,
        endpoint: 11,
        sessionid: 12,
        translationurl: 13
      },
      Xe
    );
  }
  get clientstyling() {
    return this.$$.ctx[7];
  }
  set clientstyling(t) {
    this.$$set({ clientstyling: t }), z();
  }
  get clientstylingurl() {
    return this.$$.ctx[8];
  }
  set clientstylingurl(t) {
    this.$$set({ clientstylingurl: t }), z();
  }
  get mbsource() {
    return this.$$.ctx[9];
  }
  set mbsource(t) {
    this.$$set({ mbsource: t }), z();
  }
  get lang() {
    return this.$$.ctx[10];
  }
  set lang(t) {
    this.$$set({ lang: t }), z();
  }
  get endpoint() {
    return this.$$.ctx[11];
  }
  set endpoint(t) {
    this.$$set({ endpoint: t }), z();
  }
  get sessionid() {
    return this.$$.ctx[12];
  }
  set sessionid(t) {
    this.$$set({ sessionid: t }), z();
  }
  get translationurl() {
    return this.$$.ctx[13];
  }
  set translationurl(t) {
    this.$$set({ translationurl: t }), z();
  }
}
ae(on, { clientstyling: {}, clientstylingurl: {}, mbsource: {}, lang: {}, endpoint: {}, sessionid: {}, translationurl: {} }, [], [], !0);
export {
  on as default
};
