import { jsx as l, jsxs as v, Fragment as we } from "react/jsx-runtime";
import ue, { forwardRef as je, useRef as M, useState as $e, useEffect as x, useCallback as qe } from "react";
import { s as f, f as Q, j as Fe, i as Ge, e as be, u as We, c as Ke, d as Qe, h as Xe } from "./provider.js";
import { b as Ye, B as Ze } from "./index3.js";
import { A as Je, S as Ee, P as et } from "./useStreamLayerApp2.js";
var X = {}, Te = { exports: {} }, tt = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", rt = tt, nt = rt;
function Le() {
}
function Be() {
}
Be.resetWarningCache = Le;
var ot = function() {
  function e(r, o, s, a, i, u) {
    if (u !== nt) {
      var h = new Error(
        "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
      );
      throw h.name = "Invariant Violation", h;
    }
  }
  e.isRequired = e;
  function t() {
    return e;
  }
  var n = {
    array: e,
    bigint: e,
    bool: e,
    func: e,
    number: e,
    object: e,
    string: e,
    symbol: e,
    any: e,
    arrayOf: t,
    element: e,
    elementType: e,
    instanceOf: t,
    node: e,
    objectOf: t,
    oneOf: t,
    oneOfType: t,
    shape: t,
    exact: t,
    checkPropTypes: Be,
    resetWarningCache: Le
  };
  return n.PropTypes = n, n;
};
Te.exports = ot();
var Pe = Te.exports, Ie = {
  L: 1,
  M: 0,
  Q: 3,
  H: 2
}, ke = {
  MODE_NUMBER: 1,
  MODE_ALPHA_NUM: 2,
  MODE_8BIT_BYTE: 4,
  MODE_KANJI: 8
}, st = ke;
function De(e) {
  this.mode = st.MODE_8BIT_BYTE, this.data = e;
}
De.prototype = {
  getLength: function(e) {
    return this.data.length;
  },
  write: function(e) {
    for (var t = 0; t < this.data.length; t++)
      e.put(this.data.charCodeAt(t), 8);
  }
};
var it = De, G = Ie;
function I(e, t) {
  this.totalCount = e, this.dataCount = t;
}
I.RS_BLOCK_TABLE = [
  // L
  // M
  // Q
  // H
  // 1
  [1, 26, 19],
  [1, 26, 16],
  [1, 26, 13],
  [1, 26, 9],
  // 2
  [1, 44, 34],
  [1, 44, 28],
  [1, 44, 22],
  [1, 44, 16],
  // 3
  [1, 70, 55],
  [1, 70, 44],
  [2, 35, 17],
  [2, 35, 13],
  // 4		
  [1, 100, 80],
  [2, 50, 32],
  [2, 50, 24],
  [4, 25, 9],
  // 5
  [1, 134, 108],
  [2, 67, 43],
  [2, 33, 15, 2, 34, 16],
  [2, 33, 11, 2, 34, 12],
  // 6
  [2, 86, 68],
  [4, 43, 27],
  [4, 43, 19],
  [4, 43, 15],
  // 7		
  [2, 98, 78],
  [4, 49, 31],
  [2, 32, 14, 4, 33, 15],
  [4, 39, 13, 1, 40, 14],
  // 8
  [2, 121, 97],
  [2, 60, 38, 2, 61, 39],
  [4, 40, 18, 2, 41, 19],
  [4, 40, 14, 2, 41, 15],
  // 9
  [2, 146, 116],
  [3, 58, 36, 2, 59, 37],
  [4, 36, 16, 4, 37, 17],
  [4, 36, 12, 4, 37, 13],
  // 10		
  [2, 86, 68, 2, 87, 69],
  [4, 69, 43, 1, 70, 44],
  [6, 43, 19, 2, 44, 20],
  [6, 43, 15, 2, 44, 16],
  // 11
  [4, 101, 81],
  [1, 80, 50, 4, 81, 51],
  [4, 50, 22, 4, 51, 23],
  [3, 36, 12, 8, 37, 13],
  // 12
  [2, 116, 92, 2, 117, 93],
  [6, 58, 36, 2, 59, 37],
  [4, 46, 20, 6, 47, 21],
  [7, 42, 14, 4, 43, 15],
  // 13
  [4, 133, 107],
  [8, 59, 37, 1, 60, 38],
  [8, 44, 20, 4, 45, 21],
  [12, 33, 11, 4, 34, 12],
  // 14
  [3, 145, 115, 1, 146, 116],
  [4, 64, 40, 5, 65, 41],
  [11, 36, 16, 5, 37, 17],
  [11, 36, 12, 5, 37, 13],
  // 15
  [5, 109, 87, 1, 110, 88],
  [5, 65, 41, 5, 66, 42],
  [5, 54, 24, 7, 55, 25],
  [11, 36, 12],
  // 16
  [5, 122, 98, 1, 123, 99],
  [7, 73, 45, 3, 74, 46],
  [15, 43, 19, 2, 44, 20],
  [3, 45, 15, 13, 46, 16],
  // 17
  [1, 135, 107, 5, 136, 108],
  [10, 74, 46, 1, 75, 47],
  [1, 50, 22, 15, 51, 23],
  [2, 42, 14, 17, 43, 15],
  // 18
  [5, 150, 120, 1, 151, 121],
  [9, 69, 43, 4, 70, 44],
  [17, 50, 22, 1, 51, 23],
  [2, 42, 14, 19, 43, 15],
  // 19
  [3, 141, 113, 4, 142, 114],
  [3, 70, 44, 11, 71, 45],
  [17, 47, 21, 4, 48, 22],
  [9, 39, 13, 16, 40, 14],
  // 20
  [3, 135, 107, 5, 136, 108],
  [3, 67, 41, 13, 68, 42],
  [15, 54, 24, 5, 55, 25],
  [15, 43, 15, 10, 44, 16],
  // 21
  [4, 144, 116, 4, 145, 117],
  [17, 68, 42],
  [17, 50, 22, 6, 51, 23],
  [19, 46, 16, 6, 47, 17],
  // 22
  [2, 139, 111, 7, 140, 112],
  [17, 74, 46],
  [7, 54, 24, 16, 55, 25],
  [34, 37, 13],
  // 23
  [4, 151, 121, 5, 152, 122],
  [4, 75, 47, 14, 76, 48],
  [11, 54, 24, 14, 55, 25],
  [16, 45, 15, 14, 46, 16],
  // 24
  [6, 147, 117, 4, 148, 118],
  [6, 73, 45, 14, 74, 46],
  [11, 54, 24, 16, 55, 25],
  [30, 46, 16, 2, 47, 17],
  // 25
  [8, 132, 106, 4, 133, 107],
  [8, 75, 47, 13, 76, 48],
  [7, 54, 24, 22, 55, 25],
  [22, 45, 15, 13, 46, 16],
  // 26
  [10, 142, 114, 2, 143, 115],
  [19, 74, 46, 4, 75, 47],
  [28, 50, 22, 6, 51, 23],
  [33, 46, 16, 4, 47, 17],
  // 27
  [8, 152, 122, 4, 153, 123],
  [22, 73, 45, 3, 74, 46],
  [8, 53, 23, 26, 54, 24],
  [12, 45, 15, 28, 46, 16],
  // 28
  [3, 147, 117, 10, 148, 118],
  [3, 73, 45, 23, 74, 46],
  [4, 54, 24, 31, 55, 25],
  [11, 45, 15, 31, 46, 16],
  // 29
  [7, 146, 116, 7, 147, 117],
  [21, 73, 45, 7, 74, 46],
  [1, 53, 23, 37, 54, 24],
  [19, 45, 15, 26, 46, 16],
  // 30
  [5, 145, 115, 10, 146, 116],
  [19, 75, 47, 10, 76, 48],
  [15, 54, 24, 25, 55, 25],
  [23, 45, 15, 25, 46, 16],
  // 31
  [13, 145, 115, 3, 146, 116],
  [2, 74, 46, 29, 75, 47],
  [42, 54, 24, 1, 55, 25],
  [23, 45, 15, 28, 46, 16],
  // 32
  [17, 145, 115],
  [10, 74, 46, 23, 75, 47],
  [10, 54, 24, 35, 55, 25],
  [19, 45, 15, 35, 46, 16],
  // 33
  [17, 145, 115, 1, 146, 116],
  [14, 74, 46, 21, 75, 47],
  [29, 54, 24, 19, 55, 25],
  [11, 45, 15, 46, 46, 16],
  // 34
  [13, 145, 115, 6, 146, 116],
  [14, 74, 46, 23, 75, 47],
  [44, 54, 24, 7, 55, 25],
  [59, 46, 16, 1, 47, 17],
  // 35
  [12, 151, 121, 7, 152, 122],
  [12, 75, 47, 26, 76, 48],
  [39, 54, 24, 14, 55, 25],
  [22, 45, 15, 41, 46, 16],
  // 36
  [6, 151, 121, 14, 152, 122],
  [6, 75, 47, 34, 76, 48],
  [46, 54, 24, 10, 55, 25],
  [2, 45, 15, 64, 46, 16],
  // 37
  [17, 152, 122, 4, 153, 123],
  [29, 74, 46, 14, 75, 47],
  [49, 54, 24, 10, 55, 25],
  [24, 45, 15, 46, 46, 16],
  // 38
  [4, 152, 122, 18, 153, 123],
  [13, 74, 46, 32, 75, 47],
  [48, 54, 24, 14, 55, 25],
  [42, 45, 15, 32, 46, 16],
  // 39
  [20, 147, 117, 4, 148, 118],
  [40, 75, 47, 7, 76, 48],
  [43, 54, 24, 22, 55, 25],
  [10, 45, 15, 67, 46, 16],
  // 40
  [19, 148, 118, 6, 149, 119],
  [18, 75, 47, 31, 76, 48],
  [34, 54, 24, 34, 55, 25],
  [20, 45, 15, 61, 46, 16]
];
I.getRSBlocks = function(e, t) {
  var n = I.getRsBlockTable(e, t);
  if (n == null)
    throw new Error("bad rs block @ typeNumber:" + e + "/errorCorrectLevel:" + t);
  for (var r = n.length / 3, o = new Array(), s = 0; s < r; s++)
    for (var a = n[s * 3 + 0], i = n[s * 3 + 1], u = n[s * 3 + 2], h = 0; h < a; h++)
      o.push(new I(i, u));
  return o;
};
I.getRsBlockTable = function(e, t) {
  switch (t) {
    case G.L:
      return I.RS_BLOCK_TABLE[(e - 1) * 4 + 0];
    case G.M:
      return I.RS_BLOCK_TABLE[(e - 1) * 4 + 1];
    case G.Q:
      return I.RS_BLOCK_TABLE[(e - 1) * 4 + 2];
    case G.H:
      return I.RS_BLOCK_TABLE[(e - 1) * 4 + 3];
    default:
      return;
  }
};
var at = I;
function Re() {
  this.buffer = new Array(), this.length = 0;
}
Re.prototype = {
  get: function(e) {
    var t = Math.floor(e / 8);
    return (this.buffer[t] >>> 7 - e % 8 & 1) == 1;
  },
  put: function(e, t) {
    for (var n = 0; n < t; n++)
      this.putBit((e >>> t - n - 1 & 1) == 1);
  },
  getLengthInBits: function() {
    return this.length;
  },
  putBit: function(e) {
    var 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 lt = Re, P = {
  glog: function(e) {
    if (e < 1)
      throw new Error("glog(" + e + ")");
    return P.LOG_TABLE[e];
  },
  gexp: function(e) {
    for (; e < 0; )
      e += 255;
    for (; e >= 256; )
      e -= 255;
    return P.EXP_TABLE[e];
  },
  EXP_TABLE: new Array(256),
  LOG_TABLE: new Array(256)
};
for (var m = 0; m < 8; m++)
  P.EXP_TABLE[m] = 1 << m;
for (var m = 8; m < 256; m++)
  P.EXP_TABLE[m] = P.EXP_TABLE[m - 4] ^ P.EXP_TABLE[m - 5] ^ P.EXP_TABLE[m - 6] ^ P.EXP_TABLE[m - 8];
for (var m = 0; m < 255; m++)
  P.LOG_TABLE[P.EXP_TABLE[m]] = m;
var Oe = P, S = Oe;
function K(e, t) {
  if (e.length == null)
    throw new Error(e.length + "/" + t);
  for (var n = 0; n < e.length && e[n] == 0; )
    n++;
  this.num = new Array(e.length - n + t);
  for (var r = 0; r < e.length - n; r++)
    this.num[r] = e[r + n];
}
K.prototype = {
  get: function(e) {
    return this.num[e];
  },
  getLength: function() {
    return this.num.length;
  },
  multiply: function(e) {
    for (var t = new Array(this.getLength() + e.getLength() - 1), n = 0; n < this.getLength(); n++)
      for (var r = 0; r < e.getLength(); r++)
        t[n + r] ^= S.gexp(S.glog(this.get(n)) + S.glog(e.get(r)));
    return new K(t, 0);
  },
  mod: function(e) {
    if (this.getLength() - e.getLength() < 0)
      return this;
    for (var t = S.glog(this.get(0)) - S.glog(e.get(0)), n = new Array(this.getLength()), r = 0; r < this.getLength(); r++)
      n[r] = this.get(r);
    for (var r = 0; r < e.getLength(); r++)
      n[r] ^= S.gexp(S.glog(e.get(r)) + t);
    return new K(n, 0).mod(e);
  }
};
var Ne = K, T = ke, Ae = Ne, ut = Oe, N = {
  PATTERN000: 0,
  PATTERN001: 1,
  PATTERN010: 2,
  PATTERN011: 3,
  PATTERN100: 4,
  PATTERN101: 5,
  PATTERN110: 6,
  PATTERN111: 7
}, g = {
  PATTERN_POSITION_TABLE: [
    [],
    [6, 18],
    [6, 22],
    [6, 26],
    [6, 30],
    [6, 34],
    [6, 22, 38],
    [6, 24, 42],
    [6, 26, 46],
    [6, 28, 50],
    [6, 30, 54],
    [6, 32, 58],
    [6, 34, 62],
    [6, 26, 46, 66],
    [6, 26, 48, 70],
    [6, 26, 50, 74],
    [6, 30, 54, 78],
    [6, 30, 56, 82],
    [6, 30, 58, 86],
    [6, 34, 62, 90],
    [6, 28, 50, 72, 94],
    [6, 26, 50, 74, 98],
    [6, 30, 54, 78, 102],
    [6, 28, 54, 80, 106],
    [6, 32, 58, 84, 110],
    [6, 30, 58, 86, 114],
    [6, 34, 62, 90, 118],
    [6, 26, 50, 74, 98, 122],
    [6, 30, 54, 78, 102, 126],
    [6, 26, 52, 78, 104, 130],
    [6, 30, 56, 82, 108, 134],
    [6, 34, 60, 86, 112, 138],
    [6, 30, 58, 86, 114, 142],
    [6, 34, 62, 90, 118, 146],
    [6, 30, 54, 78, 102, 126, 150],
    [6, 24, 50, 76, 102, 128, 154],
    [6, 28, 54, 80, 106, 132, 158],
    [6, 32, 58, 84, 110, 136, 162],
    [6, 26, 54, 82, 110, 138, 166],
    [6, 30, 58, 86, 114, 142, 170]
  ],
  G15: 1335,
  G18: 7973,
  G15_MASK: 21522,
  getBCHTypeInfo: function(e) {
    for (var t = e << 10; g.getBCHDigit(t) - g.getBCHDigit(g.G15) >= 0; )
      t ^= g.G15 << g.getBCHDigit(t) - g.getBCHDigit(g.G15);
    return (e << 10 | t) ^ g.G15_MASK;
  },
  getBCHTypeNumber: function(e) {
    for (var t = e << 12; g.getBCHDigit(t) - g.getBCHDigit(g.G18) >= 0; )
      t ^= g.G18 << g.getBCHDigit(t) - g.getBCHDigit(g.G18);
    return e << 12 | t;
  },
  getBCHDigit: function(e) {
    for (var t = 0; e != 0; )
      t++, e >>>= 1;
    return t;
  },
  getPatternPosition: function(e) {
    return g.PATTERN_POSITION_TABLE[e - 1];
  },
  getMask: function(e, t, n) {
    switch (e) {
      case N.PATTERN000:
        return (t + n) % 2 == 0;
      case N.PATTERN001:
        return t % 2 == 0;
      case N.PATTERN010:
        return n % 3 == 0;
      case N.PATTERN011:
        return (t + n) % 3 == 0;
      case N.PATTERN100:
        return (Math.floor(t / 2) + Math.floor(n / 3)) % 2 == 0;
      case N.PATTERN101:
        return t * n % 2 + t * n % 3 == 0;
      case N.PATTERN110:
        return (t * n % 2 + t * n % 3) % 2 == 0;
      case N.PATTERN111:
        return (t * n % 3 + (t + n) % 2) % 2 == 0;
      default:
        throw new Error("bad maskPattern:" + e);
    }
  },
  getErrorCorrectPolynomial: function(e) {
    for (var t = new Ae([1], 0), n = 0; n < e; n++)
      t = t.multiply(new Ae([1, ut.gexp(n)], 0));
    return t;
  },
  getLengthInBits: function(e, t) {
    if (1 <= t && t < 10)
      switch (e) {
        case T.MODE_NUMBER:
          return 10;
        case T.MODE_ALPHA_NUM:
          return 9;
        case T.MODE_8BIT_BYTE:
          return 8;
        case T.MODE_KANJI:
          return 8;
        default:
          throw new Error("mode:" + e);
      }
    else if (t < 27)
      switch (e) {
        case T.MODE_NUMBER:
          return 12;
        case T.MODE_ALPHA_NUM:
          return 11;
        case T.MODE_8BIT_BYTE:
          return 16;
        case T.MODE_KANJI:
          return 10;
        default:
          throw new Error("mode:" + e);
      }
    else if (t < 41)
      switch (e) {
        case T.MODE_NUMBER:
          return 14;
        case T.MODE_ALPHA_NUM:
          return 13;
        case T.MODE_8BIT_BYTE:
          return 16;
        case T.MODE_KANJI:
          return 12;
        default:
          throw new Error("mode:" + e);
      }
    else
      throw new Error("type:" + t);
  },
  getLostPoint: function(e) {
    for (var t = e.getModuleCount(), n = 0, r = 0; r < t; r++)
      for (var o = 0; o < t; o++) {
        for (var s = 0, a = e.isDark(r, o), i = -1; i <= 1; i++)
          if (!(r + i < 0 || t <= r + i))
            for (var u = -1; u <= 1; u++)
              o + u < 0 || t <= o + u || i == 0 && u == 0 || a == e.isDark(r + i, o + u) && s++;
        s > 5 && (n += 3 + s - 5);
      }
    for (var r = 0; r < t - 1; r++)
      for (var o = 0; o < t - 1; o++) {
        var h = 0;
        e.isDark(r, o) && h++, e.isDark(r + 1, o) && h++, e.isDark(r, o + 1) && h++, e.isDark(r + 1, o + 1) && h++, (h == 0 || h == 4) && (n += 3);
      }
    for (var r = 0; r < t; r++)
      for (var o = 0; o < t - 6; o++)
        e.isDark(r, o) && !e.isDark(r, o + 1) && e.isDark(r, o + 2) && e.isDark(r, o + 3) && e.isDark(r, o + 4) && !e.isDark(r, o + 5) && e.isDark(r, o + 6) && (n += 40);
    for (var o = 0; o < t; o++)
      for (var r = 0; r < t - 6; r++)
        e.isDark(r, o) && !e.isDark(r + 1, o) && e.isDark(r + 2, o) && e.isDark(r + 3, o) && e.isDark(r + 4, o) && !e.isDark(r + 5, o) && e.isDark(r + 6, o) && (n += 40);
    for (var c = 0, o = 0; o < t; o++)
      for (var r = 0; r < t; r++)
        e.isDark(r, o) && c++;
    var p = Math.abs(100 * c / t / t - 50) / 5;
    return n += p * 10, n;
  }
}, dt = g, ct = it, Me = at, _e = lt, _ = dt, ht = Ne;
function k(e, t) {
  this.typeNumber = e, this.errorCorrectLevel = t, this.modules = null, this.moduleCount = 0, this.dataCache = null, this.dataList = [];
}
var w = k.prototype;
w.addData = function(e) {
  var t = new ct(e);
  this.dataList.push(t), this.dataCache = null;
};
w.isDark = function(e, t) {
  if (e < 0 || this.moduleCount <= e || t < 0 || this.moduleCount <= t)
    throw new Error(e + "," + t);
  return this.modules[e][t];
};
w.getModuleCount = function() {
  return this.moduleCount;
};
w.make = function() {
  if (this.typeNumber < 1) {
    var e = 1;
    for (e = 1; e < 40; e++) {
      for (var t = Me.getRSBlocks(e, this.errorCorrectLevel), n = new _e(), r = 0, o = 0; o < t.length; o++)
        r += t[o].dataCount;
      for (var o = 0; o < this.dataList.length; o++) {
        var s = this.dataList[o];
        n.put(s.mode, 4), n.put(s.getLength(), _.getLengthInBits(s.mode, e)), s.write(n);
      }
      if (n.getLengthInBits() <= r * 8)
        break;
    }
    this.typeNumber = e;
  }
  this.makeImpl(!1, this.getBestMaskPattern());
};
w.makeImpl = function(e, t) {
  this.moduleCount = this.typeNumber * 4 + 17, this.modules = new Array(this.moduleCount);
  for (var n = 0; n < this.moduleCount; n++) {
    this.modules[n] = new Array(this.moduleCount);
    for (var r = 0; r < this.moduleCount; r++)
      this.modules[n][r] = null;
  }
  this.setupPositionProbePattern(0, 0), this.setupPositionProbePattern(this.moduleCount - 7, 0), this.setupPositionProbePattern(0, this.moduleCount - 7), this.setupPositionAdjustPattern(), this.setupTimingPattern(), this.setupTypeInfo(e, t), this.typeNumber >= 7 && this.setupTypeNumber(e), this.dataCache == null && (this.dataCache = k.createData(this.typeNumber, this.errorCorrectLevel, this.dataList)), this.mapData(this.dataCache, t);
};
w.setupPositionProbePattern = function(e, t) {
  for (var n = -1; n <= 7; n++)
    if (!(e + n <= -1 || this.moduleCount <= e + n))
      for (var r = -1; r <= 7; r++)
        t + r <= -1 || this.moduleCount <= t + r || (0 <= n && n <= 6 && (r == 0 || r == 6) || 0 <= r && r <= 6 && (n == 0 || n == 6) || 2 <= n && n <= 4 && 2 <= r && r <= 4 ? this.modules[e + n][t + r] = !0 : this.modules[e + n][t + r] = !1);
};
w.getBestMaskPattern = function() {
  for (var e = 0, t = 0, n = 0; n < 8; n++) {
    this.makeImpl(!0, n);
    var r = _.getLostPoint(this);
    (n == 0 || e > r) && (e = r, t = n);
  }
  return t;
};
w.createMovieClip = function(e, t, n) {
  var r = e.createEmptyMovieClip(t, n), o = 1;
  this.make();
  for (var s = 0; s < this.modules.length; s++)
    for (var a = s * o, i = 0; i < this.modules[s].length; i++) {
      var u = i * o, h = this.modules[s][i];
      h && (r.beginFill(0, 100), r.moveTo(u, a), r.lineTo(u + o, a), r.lineTo(u + o, a + o), r.lineTo(u, a + o), r.endFill());
    }
  return r;
};
w.setupTimingPattern = function() {
  for (var e = 8; e < this.moduleCount - 8; e++)
    this.modules[e][6] == null && (this.modules[e][6] = e % 2 == 0);
  for (var t = 8; t < this.moduleCount - 8; t++)
    this.modules[6][t] == null && (this.modules[6][t] = t % 2 == 0);
};
w.setupPositionAdjustPattern = function() {
  for (var e = _.getPatternPosition(this.typeNumber), t = 0; t < e.length; t++)
    for (var n = 0; n < e.length; n++) {
      var r = e[t], o = e[n];
      if (this.modules[r][o] == null)
        for (var s = -2; s <= 2; s++)
          for (var a = -2; a <= 2; a++)
            s == -2 || s == 2 || a == -2 || a == 2 || s == 0 && a == 0 ? this.modules[r + s][o + a] = !0 : this.modules[r + s][o + a] = !1;
    }
};
w.setupTypeNumber = function(e) {
  for (var t = _.getBCHTypeNumber(this.typeNumber), n = 0; n < 18; n++) {
    var r = !e && (t >> n & 1) == 1;
    this.modules[Math.floor(n / 3)][n % 3 + this.moduleCount - 8 - 3] = r;
  }
  for (var n = 0; n < 18; n++) {
    var r = !e && (t >> n & 1) == 1;
    this.modules[n % 3 + this.moduleCount - 8 - 3][Math.floor(n / 3)] = r;
  }
};
w.setupTypeInfo = function(e, t) {
  for (var n = this.errorCorrectLevel << 3 | t, r = _.getBCHTypeInfo(n), o = 0; o < 15; o++) {
    var s = !e && (r >> o & 1) == 1;
    o < 6 ? this.modules[o][8] = s : o < 8 ? this.modules[o + 1][8] = s : this.modules[this.moduleCount - 15 + o][8] = s;
  }
  for (var o = 0; o < 15; o++) {
    var s = !e && (r >> o & 1) == 1;
    o < 8 ? this.modules[8][this.moduleCount - o - 1] = s : o < 9 ? this.modules[8][15 - o - 1 + 1] = s : this.modules[8][15 - o - 1] = s;
  }
  this.modules[this.moduleCount - 8][8] = !e;
};
w.mapData = function(e, t) {
  for (var n = -1, r = this.moduleCount - 1, o = 7, s = 0, a = this.moduleCount - 1; a > 0; a -= 2)
    for (a == 6 && a--; ; ) {
      for (var i = 0; i < 2; i++)
        if (this.modules[r][a - i] == null) {
          var u = !1;
          s < e.length && (u = (e[s] >>> o & 1) == 1);
          var h = _.getMask(t, r, a - i);
          h && (u = !u), this.modules[r][a - i] = u, o--, o == -1 && (s++, o = 7);
        }
      if (r += n, r < 0 || this.moduleCount <= r) {
        r -= n, n = -n;
        break;
      }
    }
};
k.PAD0 = 236;
k.PAD1 = 17;
k.createData = function(e, t, n) {
  for (var r = Me.getRSBlocks(e, t), o = new _e(), s = 0; s < n.length; s++) {
    var a = n[s];
    o.put(a.mode, 4), o.put(a.getLength(), _.getLengthInBits(a.mode, e)), a.write(o);
  }
  for (var i = 0, s = 0; s < r.length; s++)
    i += r[s].dataCount;
  if (o.getLengthInBits() > i * 8)
    throw new Error("code length overflow. (" + o.getLengthInBits() + ">" + i * 8 + ")");
  for (o.getLengthInBits() + 4 <= i * 8 && o.put(0, 4); o.getLengthInBits() % 8 != 0; )
    o.putBit(!1);
  for (; !(o.getLengthInBits() >= i * 8 || (o.put(k.PAD0, 8), o.getLengthInBits() >= i * 8)); )
    o.put(k.PAD1, 8);
  return k.createBytes(o, r);
};
k.createBytes = function(e, t) {
  for (var n = 0, r = 0, o = 0, s = new Array(t.length), a = new Array(t.length), i = 0; i < t.length; i++) {
    var u = t[i].dataCount, h = t[i].totalCount - u;
    r = Math.max(r, u), o = Math.max(o, h), s[i] = new Array(u);
    for (var c = 0; c < s[i].length; c++)
      s[i][c] = 255 & e.buffer[c + n];
    n += u;
    var p = _.getErrorCorrectPolynomial(h), b = new ht(s[i], p.getLength() - 1), d = b.mod(p);
    a[i] = new Array(p.getLength() - 1);
    for (var c = 0; c < a[i].length; c++) {
      var A = c + d.getLength() - a[i].length;
      a[i][c] = A >= 0 ? d.get(A) : 0;
    }
  }
  for (var y = 0, c = 0; c < t.length; c++)
    y += t[c].totalCount;
  for (var C = new Array(y), B = 0, c = 0; c < r; c++)
    for (var i = 0; i < t.length; i++)
      c < s[i].length && (C[B++] = s[i][c]);
  for (var c = 0; c < o; c++)
    for (var i = 0; i < t.length; i++)
      c < a[i].length && (C[B++] = a[i][c]);
  return C;
};
var ft = k, de = {};
Object.defineProperty(de, "__esModule", {
  value: !0
});
var pt = Object.assign || function(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t];
    for (var r in n)
      Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
  }
  return e;
}, gt = Pe, L = xe(gt), Se = ue, W = xe(Se);
function xe(e) {
  return e && e.__esModule ? e : { default: e };
}
function vt(e, t) {
  var n = {};
  for (var r in e)
    t.indexOf(r) >= 0 || Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]);
  return n;
}
var mt = {
  bgColor: L.default.oneOfType([L.default.object, L.default.string]).isRequired,
  bgD: L.default.string.isRequired,
  fgColor: L.default.oneOfType([L.default.object, L.default.string]).isRequired,
  fgD: L.default.string.isRequired,
  size: L.default.number.isRequired,
  title: L.default.string,
  viewBoxSize: L.default.number.isRequired,
  xmlns: L.default.string
}, ce = (0, Se.forwardRef)(function(e, t) {
  var n = e.bgColor, r = e.bgD, o = e.fgD, s = e.fgColor, a = e.size, i = e.title, u = e.viewBoxSize, h = e.xmlns, c = h === void 0 ? "http://www.w3.org/2000/svg" : h, p = vt(e, ["bgColor", "bgD", "fgD", "fgColor", "size", "title", "viewBoxSize", "xmlns"]);
  return W.default.createElement(
    "svg",
    pt({}, p, { height: a, ref: t, viewBox: "0 0 " + u + " " + u, width: a, xmlns: c }),
    i ? W.default.createElement(
      "title",
      null,
      i
    ) : null,
    W.default.createElement("path", { d: r, fill: n }),
    W.default.createElement("path", { d: o, fill: s })
  );
});
ce.displayName = "QRCodeSvg";
ce.propTypes = mt;
de.default = ce;
Object.defineProperty(X, "__esModule", {
  value: !0
});
X.QRCode = void 0;
var bt = Object.assign || function(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t];
    for (var r in n)
      Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
  }
  return e;
}, At = Pe, R = U(At), yt = Ie, Ct = U(yt), wt = ft, Et = U(wt), Ve = ue, Tt = U(Ve), Lt = de, Bt = U(Lt);
function U(e) {
  return e && e.__esModule ? e : { default: e };
}
function Pt(e, t) {
  var n = {};
  for (var r in e)
    t.indexOf(r) >= 0 || Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]);
  return n;
}
var It = {
  bgColor: R.default.oneOfType([R.default.object, R.default.string]),
  fgColor: R.default.oneOfType([R.default.object, R.default.string]),
  level: R.default.string,
  size: R.default.number,
  value: R.default.string.isRequired
}, Y = (0, Ve.forwardRef)(function(e, t) {
  var n = e.bgColor, r = n === void 0 ? "#FFFFFF" : n, o = e.fgColor, s = o === void 0 ? "#000000" : o, a = e.level, i = a === void 0 ? "L" : a, u = e.size, h = u === void 0 ? 256 : u, c = e.value, p = Pt(e, ["bgColor", "fgColor", "level", "size", "value"]), b = new Et.default(-1, Ct.default[i]);
  b.addData(c), b.make();
  var d = b.modules;
  return Tt.default.createElement(Bt.default, bt({}, p, {
    bgColor: r,
    bgD: d.map(function(A, y) {
      return A.map(function(C, B) {
        return C ? "" : "M " + B + " " + y + " l 1 0 0 1 -1 0 Z";
      }).join(" ");
    }).join(" "),
    fgColor: s,
    fgD: d.map(function(A, y) {
      return A.map(function(C, B) {
        return C ? "M " + B + " " + y + " l 1 0 0 1 -1 0 Z" : "";
      }).join(" ");
    }).join(" "),
    ref: t,
    size: h,
    viewBoxSize: d.length
  }));
});
X.QRCode = Y;
Y.displayName = "QRCode";
Y.propTypes = It;
var kt = X.default = Y;
const Dt = /* @__PURE__ */ f("div")({
  name: "Container",
  class: "c1xv4385",
  propsAsIs: !1
}), Rt = /* @__PURE__ */ f("div")({
  name: "Header",
  class: "h1hbtbp8",
  propsAsIs: !1
}), Ot = /* @__PURE__ */ f("div")({
  name: "BrandBlock",
  class: "b1c3dxvx",
  propsAsIs: !1
}), Nt = /* @__PURE__ */ f("img")({
  name: "LogoIcon",
  class: "lvk233f",
  propsAsIs: !1
}), Mt = /* @__PURE__ */ f("div")({
  name: "BrandText",
  class: "bniy1ul",
  propsAsIs: !1
}), _t = /* @__PURE__ */ f("div")({
  name: "BrandNameContainer",
  class: "blz2fxg",
  propsAsIs: !1
}), St = /* @__PURE__ */ f("span")({
  name: "BrandName",
  class: "byc93px",
  propsAsIs: !1
}), xt = /* @__PURE__ */ f("span")({
  name: "Sponsored",
  class: "shnfhl9",
  propsAsIs: !1
}), Vt = (e) => /* @__PURE__ */ l("svg", {
  viewBox: "0 0 24 24",
  fill: "white",
  xmlns: "http://www.w3.org/2000/svg",
  ...e,
  children: /* @__PURE__ */ l("path", {
    fillRule: "evenodd",
    clipRule: "evenodd",
    d: "M6.225 4.811a.75.75 0 0 1 1.06 0L12 9.525l4.715-4.714a.75.75 0 1 1 1.06 1.06L13.06 10.5l4.715 4.715a.75.75 0 0 1-1.06 1.06L12 11.56l-4.715 4.715a.75.75 0 0 1-1.06-1.06L10.94 10.5 6.225 5.785a.75.75 0 0 1 0-1.06z"
  })
}), Ht = /* @__PURE__ */ f("button")({
  name: "CloseButton",
  class: "cipq0ys",
  propsAsIs: !1
}), zt = /* @__PURE__ */ f("video")({
  name: "FocusableVideo",
  class: "f1aopm9q",
  propsAsIs: !1
}), Ut = /* @__PURE__ */ f("div")({
  name: "VideoWrapper",
  class: "vb02wvi",
  propsAsIs: !1
}), jt = /* @__PURE__ */ f("div")({
  name: "VideoBlock",
  class: "v9c5qs6",
  propsAsIs: !1
}), $t = () => ({
  focusColor: e
}) => e || "#0f6cd4", ne = /* @__PURE__ */ f("div")({
  name: "SendToUserButton",
  class: "szzabyz",
  propsAsIs: !1,
  vars: {
    "szzabyz-0": [$t()]
  }
}), ye = () => /* @__PURE__ */ l("svg", {
  fill: "white",
  style: {
    fill: "white",
    width: "30px",
    height: "30px",
    verticalAlign: "middle",
    marginRight: "8px"
  },
  viewBox: "0 0 40 28",
  xmlns: "http://www.w3.org/2000/svg",
  children: /* @__PURE__ */ l("path", {
    d: "M5.57502 27.5H34.9099C37.803 27.5 39.5 25.8713 39.5 22.645V5.355C39.5 2.12878 37.7869 0.5 34.4251 0.5H5.09014C2.19706 0.5 0.5 2.12878 0.5 5.355V22.645C0.5 25.8713 2.21323 27.5 5.57502 27.5ZM5.47805 25.1039C3.87796 25.1039 2.97286 24.2425 2.97286 22.6294V5.33933C2.97286 3.74189 3.87796 2.89618 5.47805 2.89618H34.5058C36.1059 2.89618 37.0272 3.74189 37.0272 5.355V22.645C37.0272 24.2425 36.1059 25.1039 34.5058 25.1039H5.47805ZM19.9919 18.1189C21.0263 18.1189 22.0285 17.7431 22.9496 16.9287L38.1586 3.66359L36.4776 2.01915L21.5435 15.0651C21.0425 15.5035 20.5253 15.7071 19.9919 15.7071C19.4586 15.7071 18.9414 15.5035 18.4403 15.0651L3.50622 2.01915L1.82532 3.66359L17.0342 16.9287C17.9554 17.7431 18.9575 18.1189 19.9919 18.1189ZM3.74866 25.4954L15.224 14.3602L13.5431 12.7315L2.06776 23.851L3.74866 25.4954ZM36.2676 25.5111L37.9484 23.8666L26.4569 12.7315L24.7598 14.3602L36.2676 25.5111Z",
    fill: "white"
  })
}), qt = /* @__PURE__ */ f("div")({
  name: "SendToUserText",
  class: "sk8z5rw",
  propsAsIs: !1
}), Ft = /* @__PURE__ */ f("div")({
  name: "Paused",
  class: "p8aznsd",
  propsAsIs: !1
}), Gt = /* @__PURE__ */ f("h2")({
  name: "Title",
  class: "tuyd7o9",
  propsAsIs: !1
}), Wt = /* @__PURE__ */ f("p")({
  name: "Description",
  class: "d5xp0vd",
  propsAsIs: !1
}), oe = /* @__PURE__ */ f("div")({
  name: "QRBlock",
  class: "qwsbbb1",
  propsAsIs: !1
}), se = /* @__PURE__ */ f("div")({
  name: "QRDescBlock",
  class: "q15u429c",
  propsAsIs: !1
}), ie = /* @__PURE__ */ f("div")({
  name: "LearnMore",
  class: "l17c8eb2",
  propsAsIs: !1
}), ae = /* @__PURE__ */ f("div")({
  name: "QRHint",
  class: "q1hnjpwv",
  propsAsIs: !1
}), Kt = /* @__PURE__ */ f("div")({
  name: "QRWrapper",
  class: "q1uhiux3",
  propsAsIs: !1
}), Qt = () => kt, Xt = /* @__PURE__ */ f(Qt())({
  name: "StyledQRCode",
  class: "sj0sb33",
  propsAsIs: !0
}), le = ue.forwardRef(({
  value: e,
  size: t = 200,
  fgColor: n = "#0f172a",
  bgColor: r = "#ffffff",
  level: o = "M"
}, s) => /* @__PURE__ */ l("a", {
  ref: s,
  href: e,
  target: "_blank",
  rel: "noopener noreferrer",
  style: {
    textDecoration: "none",
    borderRadius: 10
  },
  tabIndex: 0,
  children: /* @__PURE__ */ l(Kt, {
    children: /* @__PURE__ */ l(Xt, {
      value: e,
      size: t,
      fgColor: n,
      bgColor: r,
      level: o,
      viewBox: `0 0 ${t} ${t}`
    })
  })
})), Yt = je(({ promotion: e }, t) => {
  var n, r, o, s, a, i, u;
  const h = e.buttonType, c = e.coupon, p = (n = e.banner) == null ? void 0 : n.url, b = e.type;
  return h === 1 ? /* @__PURE__ */ v(oe, { children: [
    /* @__PURE__ */ l(le, { value: p, ref: t, tabIndex: 1 }),
    /* @__PURE__ */ v(se, { children: [
      /* @__PURE__ */ l(ie, { children: "LEARN MORE" }),
      /* @__PURE__ */ l(ae, { children: "SCAN QR CODE WITH YOUR PHONE CAMERA" })
    ] })
  ] }) : h === 3 ? /* @__PURE__ */ v(oe, { children: [
    /* @__PURE__ */ l(le, { value: c, ref: t }),
    /* @__PURE__ */ v(se, { children: [
      /* @__PURE__ */ l(ie, { style: { fontSize: 18, fontWeight: 400 }, children: "ADD TO APPLE WALLET" }),
      /* @__PURE__ */ l(ae, { style: { fontSize: 17 }, children: "SCAN QR CODE WITH YOUR PHONE CAMERA" })
    ] })
  ] }) : h === 6 && b !== 4 ? /* @__PURE__ */ v(we, { children: [
    /* @__PURE__ */ v(
      ne,
      {
        ref: t,
        tabIndex: 1,
        focusColor: (o = (r = e == null ? void 0 : e.banner) == null ? void 0 : r.ctaButton) == null ? void 0 : o.color,
        children: [
          /* @__PURE__ */ l(ye, {}),
          "SEND INFO TO ACCOUNT EMAIL"
        ]
      }
    ),
    /* @__PURE__ */ v(oe, { children: [
      /* @__PURE__ */ l(le, { value: p }),
      /* @__PURE__ */ v(se, { children: [
        /* @__PURE__ */ l(ie, { children: "LEARN MORE" }),
        /* @__PURE__ */ l(ae, { children: "SCAN QR CODE WITH YOUR PHONE CAMERA" })
      ] })
    ] })
  ] }) : h === 6 && b === 4 ? /* @__PURE__ */ v(
    ne,
    {
      ref: t,
      tabIndex: 1,
      focusColor: (a = (s = e == null ? void 0 : e.banner) == null ? void 0 : s.ctaButton) == null ? void 0 : a.color,
      children: [
        /* @__PURE__ */ l(ye, {}),
        /* @__PURE__ */ l(qt, { children: "SEND INFO TO ACCOUNT EMAIL" })
      ]
    }
  ) : h === 4 ? /* @__PURE__ */ l(
    ne,
    {
      ref: t,
      tabIndex: 1,
      focusColor: (u = (i = e == null ? void 0 : e.banner) == null ? void 0 : i.ctaButton) == null ? void 0 : u.color,
      children: "BACK TO VIDEO"
    }
  ) : null;
}), Zt = (e) => {
  var t, n, r, o, s, a, i, u, h, c, p, b;
  const { promotion: d, open: A, togglePause: y, controlVideo: C, promotionId: B, onClose: Z, markAsViewed: J } = e, V = M(null), ee = M(null), te = M(null), re = M(null), [he, He] = $e(0), D = M(0), ze = d.type === 4 ? he : he / 2, fe = !!((n = (t = d.banner) == null ? void 0 : t.video) != null && n.url), pe = d.autoPlayVideo === Je.ENABLED;
  let j = (r = d.banner) == null ? void 0 : r.url;
  return j && !j.startsWith("http") && (j = `https://${j}`), x(() => {
    if (!re.current) return;
    const H = new ResizeObserver(([$]) => {
      const O = $.contentRect.width;
      He(O);
    });
    return H.observe(re.current), () => {
      H.disconnect();
    };
  }, []), x(() => {
    var H;
    y == null || y(fe || pe), A == null || A();
    const $ = () => {
      const E = [];
      return te.current && E.push(te.current), d.type === 5 && V.current && E.push(V.current), ee.current && E.push(ee.current), E;
    };
    let O = $();
    D.current = 0, (H = O[D.current]) == null || H.focus();
    const ge = (E) => {
      var ve, me;
      O = $();
      const q = O.length;
      if (q !== 0) {
        if (["ArrowDown", "ArrowRight"].includes(E.key)) {
          D.current = (D.current + 1) % q, (ve = O[D.current]) == null || ve.focus(), E.preventDefault();
          return;
        }
        if (["ArrowUp", "ArrowLeft"].includes(E.key)) {
          D.current = (D.current - 1 + q) % q, (me = O[D.current]) == null || me.focus(), E.preventDefault();
          return;
        }
        if (E.key === "Enter" || E.key === " ") {
          const z = O[D.current];
          if (!z) return;
          switch (z.tagName) {
            case "A":
              z.click();
              break;
            case "BUTTON":
              z.click();
              break;
            case "VIDEO":
              setTimeout(() => {
                const F = z;
                F.paused || F.ended ? F.play().then(() => {
                }).catch((Ue) => console.warn("⛔ start failed:", Ue)) : F.pause();
              }, 0);
              break;
          }
          E.preventDefault();
        }
      }
    };
    return window.addEventListener("keydown", ge), () => window.removeEventListener("keydown", ge);
  }, [d.type, fe, pe, A, y]), x(() => {
    B && d.type && J && J();
  }, [B, d.type, J]), x(() => () => {
    C == null || C({ muted: !1 });
  }, [C]), x(() => {
    d.type === 5 && V.current && V.current.focus();
  }, [d.type]), /* @__PURE__ */ v(Dt, { ref: re, tabIndex: 0, children: [
    /* @__PURE__ */ v(Rt, { children: [
      d.logoMode === 1 && /* @__PURE__ */ v(Ot, { children: [
        /* @__PURE__ */ l(Nt, { src: (o = d.sponsor) == null ? void 0 : o.logo, alt: "Logo" }),
        /* @__PURE__ */ v(Mt, { children: [
          /* @__PURE__ */ l(_t, { children: /* @__PURE__ */ l(St, { children: (s = d.sponsor) == null ? void 0 : s.name }) }),
          /* @__PURE__ */ l(xt, { children: "SPONSORED" })
        ] })
      ] }),
      d.logoMode === 2 && d.type === 4 && /* @__PURE__ */ l("img", { src: (a = d.sponsor) == null ? void 0 : a.logo, alt: "Video paused preview", style: { height: "56px" } }),
      /* @__PURE__ */ l(Ht, { ref: ee, onClick: Z, children: /* @__PURE__ */ l(Vt, {}) })
    ] }),
    d.logoMode === 2 && d.type !== 4 && /* @__PURE__ */ l(
      "img",
      {
        src: (i = d.sponsor) == null ? void 0 : i.logo,
        alt: "Video paused preview",
        style: {
          display: "block",
          alignSelf: "center",
          maxHeight: "72px",
          width: "auto"
        }
      }
    ),
    ((u = d.banner) == null ? void 0 : u.imageUrl) && /* @__PURE__ */ l(jt, { style: { height: ze }, children: /* @__PURE__ */ l(
      "img",
      {
        src: (h = d.banner) == null ? void 0 : h.imageUrl,
        alt: "Video paused preview",
        style: { width: "100%", height: "100%", objectFit: "cover" }
      }
    ) }),
    ((c = d.banner) == null ? void 0 : c.video) && /* @__PURE__ */ l(Ut, { children: /* @__PURE__ */ l(zt, { ref: te, tabIndex: 0, muted: !1, autoPlay: !1, loop: !0, playsInline: !0, controls: !0, children: /* @__PURE__ */ l("source", { src: d.banner.video.url, type: "video/mp4" }) }) }),
    /* @__PURE__ */ l(Ft, { children: "PAUSED" }),
    d.type === 5 && /* @__PURE__ */ v(we, { children: [
      /* @__PURE__ */ l(Gt, { children: (p = d.banner) == null ? void 0 : p.title }),
      /* @__PURE__ */ l(Wt, { children: (b = d.banner) == null ? void 0 : b.body })
    ] }),
    /* @__PURE__ */ l(Yt, { promotion: d, ref: V })
  ] });
}, Jt = ({
  advertisement: e,
  close: t,
  skipAutoClose: n,
  sidebar: r,
  banner: o,
  markAsViewed: s,
  open: a,
  controlVideo: i,
  advertisementPaused: u,
  togglePause: h
}) => e.promotion ? r ? /* @__PURE__ */ l(Ye, { className: "PromoSidebarContainer", direction: r, hiding: !1, children: /* @__PURE__ */ l(
  Zt,
  {
    markAsViewed: s,
    promotionId: e.question.id,
    promotion: e.promotion,
    onClose: t,
    open: a,
    controlVideo: i,
    skipAutoClose: n,
    advertisementPaused: u,
    togglePause: h
  }
) }) : o ? /* @__PURE__ */ l(
  Ze,
  {
    promotionId: e.question.id,
    hiding: !1,
    promotion: e.promotion,
    direction: o
  }
) : null : null, er = /* @__PURE__ */ f("div")({
  name: "AdvertisementUIWrap",
  class: "a3844y1",
  propsAsIs: !1
}), tr = (e) => {
  const t = e.target;
  if (t instanceof HTMLAnchorElement && t.target === "_blank") {
    const n = t.getAttribute("data-promo-id") || "", r = t.getAttribute("data-promo-type") || et.UNSET;
    t.getAttribute("data-a") === "button" && be.emit("advertisement", {
      action: "buttonSelect",
      payload: {
        id: n,
        type: r
      }
    }), t.getAttribute("data-a") === "banner" && be.emit("advertisement", {
      action: "bannerSelect",
      payload: {
        id: n,
        type: r
      }
    });
  }
}, rr = ({
  gamification: e,
  skipAutoClose: t,
  sidebar: n,
  banner: r,
  persistent: o,
  controlVideo: s
}) => {
  const a = M(null), i = Q(e.advertisement.$store);
  Fe(a, {
    enabled: !!i.data,
    event: "click",
    listener: tr
  });
  const u = !r && !n;
  return i.data === void 0 || !o && i.isViewed ? null : /* @__PURE__ */ l(er, {
    ref: a,
    style: {
      height: u ? "auto" : "100%"
    },
    className: Ge("SL-AdvertisementUIWrap", "SL-AdvertisementUIWrap--lower-third"),
    children: /* @__PURE__ */ l(Jt, {
      sidebar: n,
      banner: r,
      advertisement: i.data,
      advertisementPaused: !!i.isPaused,
      togglePause: i.togglePause || (() => {
      }),
      close: i.close,
      markAsViewed: e.advertisement.markAsViewed,
      open: e.advertisement.open,
      skipAutoClose: t,
      controlVideo: s
    })
  });
}, Ce = ({
  sdk: e,
  sidebar: t,
  banner: n,
  skipAutoClose: r,
  persistent: o
}) => {
  if (!Q(e.featuresList.getStore()))
    return null;
  const s = e.getFeature(Ee.GAMES);
  return s ? /* @__PURE__ */ l(rr, {
    gamification: s,
    sidebar: t,
    banner: n,
    persistent: o,
    skipAutoClose: r,
    controlVideo: e.controlVideoPlayer
  }) : null;
}, nr = /* @__PURE__ */ f("div")({
  name: "Container",
  class: "cheo2r6",
  propsAsIs: !1
}), or = /* @__PURE__ */ f("div")({
  name: "ContentContainer",
  class: "c1pvfh8e",
  propsAsIs: !1
}), sr = /* @__PURE__ */ f("div")({
  name: "Sidebar",
  class: "s1ew4id0",
  propsAsIs: !1
}), ir = /* @__PURE__ */ f("div")({
  name: "Banner",
  class: "bci5mwc",
  propsAsIs: !1
}), ar = /* @__PURE__ */ f("div")({
  name: "VideoContainer",
  class: "v1y91bzn",
  propsAsIs: !1
}), lr = /* @__PURE__ */ f("div")({
  name: "VideoBox",
  class: "vqmlsjk",
  propsAsIs: !1
}), ur = /* @__PURE__ */ f("div")({
  name: "VideoPlayer",
  class: "vyn4uy0",
  propsAsIs: !1
}), dr = /* @__PURE__ */ f("div")({
  name: "AdContainer",
  class: "a9sufrb",
  propsAsIs: !1
}), cr = /* @__PURE__ */ f("span")({
  name: "AdLabel",
  class: "acv3bdg",
  propsAsIs: !1
}), hr = ({ gamification: e, sidebar: t, banner: n, video: r, uiState: o }) => {
  var s, a;
  const i = Q(e.advertisement.$store), u = M(null), h = M(null), c = qe(() => {
    const d = h.current, A = u.current;
    if (!d || !A)
      return;
    const { width: y, height: C } = d.getBoundingClientRect(), { width: B, height: Z } = A.getBoundingClientRect();
    (y > B || C > Z) && (d.style.width === "100%" ? (d.style.height = "100%", d.style.width = "auto") : (d.style.width = "100%", d.style.height = "auto"));
  }, []);
  x(() => {
    if (u.current) {
      const d = new ResizeObserver((A) => {
        for (const y of A)
          y.contentBoxSize && c();
      });
      return d.observe(u.current), () => {
        d.disconnect();
      };
    }
    return () => {
    };
  }, [c]), x(c);
  const p = o.promotionSidebar, b = o.promotionBanner;
  return /* @__PURE__ */ v(
    nr,
    {
      style: { backgroundImage: `url(${(a = (s = i == null ? void 0 : i.data) == null ? void 0 : s.promotion) == null ? void 0 : a.backgroundImageLandscapeUrl})` },
      className: "Container",
      children: [
        /* @__PURE__ */ v(
          or,
          {
            className: "ContentContainer",
            style: {
              width: p ? "calc(100% - var(--sidebar-width))" : "100%"
            },
            children: [
              /* @__PURE__ */ v(
                ar,
                {
                  className: "VideoContainer",
                  ref: u,
                  style: {
                    height: b ? "calc(100% - var(--banner-height))" : "100%"
                  },
                  children: [
                    /* @__PURE__ */ l(dr, { children: /* @__PURE__ */ l(cr, { children: "Ad" }) }),
                    /* @__PURE__ */ l(lr, { ref: h, className: "VideoBox", children: /* @__PURE__ */ l(ur, { className: "VideoPlayer", children: r }) })
                  ]
                }
              ),
              /* @__PURE__ */ l(
                ir,
                {
                  className: "Banner",
                  style: {
                    height: b ? "var(--banner-height)" : "0px"
                  },
                  children: b && n
                }
              )
            ]
          }
        ),
        /* @__PURE__ */ l(sr, { style: { width: p ? "var(--sidebar-width)" : "0px" }, className: "Sidebar", children: p && t })
      ]
    }
  );
}, fr = ({ persistent: e, children: t, sdk: n, uiState: r }) => {
  if (!Q(n.featuresList.getStore()))
    return null;
  const o = n.getFeature(Ee.GAMES);
  return o ? /* @__PURE__ */ l(
    hr,
    {
      gamification: o,
      sidebar: /* @__PURE__ */ l(Ce, { sdk: n, persistent: e, sidebar: "right" }),
      banner: /* @__PURE__ */ l(Ce, { sdk: n, persistent: e, banner: "bottom" }),
      video: t,
      uiState: r
    }
  ) : null;
}, Ar = ({ persistent: e, children: t }) => {
  const n = We(), r = Ke(), o = Qe();
  return n ? /* @__PURE__ */ l("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ l(Xe, { customTheme: o.theme, themeMode: o.themeMode, children: /* @__PURE__ */ l(fr, { sdk: n, persistent: e, uiState: r, children: t }) }) }) : null;
};
export {
  Ar as StreamLayerSDKTv
};
