/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "e6ce");
/******/ })
/************************************************************************/
/******/ ({

/***/ "3c35":
/***/ (function(module, exports) {

/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */
module.exports = __webpack_amd_options__;

/* WEBPACK VAR INJECTION */}.call(this, {}))

/***/ }),

/***/ "7762":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global, process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return webmssdk; });
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

function webmssdk() {
  "use strict";

  function n(t) {
    return n = "function" == typeof Symbol && "symbol" == _typeof(Symbol.iterator) ? function (n) {
      return _typeof(n);
    } : function (n) {
      return n && "function" == typeof Symbol && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : _typeof(n);
    }, n(t);
  }

  var t, r, i, o, e, u, f, c, a, v, s, d, w, g, l, h, A;
  s = "2P%", d = 74, w = !0, g = 76, l = 9, h = "2d0", A = 86,  true && (a = (a = (a = "0aKf2oWGh%GE!N3KAUxIyYdBSAfBD0").slice(15) + a.slice(0, 15)).slice(0, a.length - 3), o = (o = (o = "d8$AdZFV%[Hd8LVHw=1").slice(14) + o.slice(0, 14)).slice(0, o.length - 3)), function () {
    var p, Q;
    A && (v = (v = (v = "SMTRYr4BMR8fBAgHFyo=cQO$0f").slice(13) + v.slice(0, 13)).slice(21) + v.slice(0, 21), c = (c = "PxccOqIJ2g5").slice(0, c.length - 2), f = (f = "KCgLPg==hRtXY(jxmE#9&SCi47BQcalG]").slice(0, f.length - 3), u = "wDOQ==clZUVW5seyIFuUIWALBQ", e = "U]%vjB90XGSJy4mBB8", e += "TJD1UOTAaDlI=", t = "8UdQv)lt4", t += "#i", A = 0), p = this, Q = function Q(n) {
      var t = Uint8Array,
          r = Uint16Array,
          i = Int32Array,
          o = new t([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]),
          e = new t([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]),
          u = new t([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]),
          f = function f(n, t) {
        for (var o = new r(31), e = 0; e < 31; ++e) {
          o[e] = t += 1 << n[e - 1];
        }

        var u = new i(o[30]);

        for (e = 1; e < 30; ++e) {
          for (var f = o[e]; f < o[e + 1]; ++f) {
            u[f] = f - o[e] << 5 | e;
          }
        }

        return {
          b: o,
          r: u
        };
      },
          c = f(o, 2),
          a = c.b,
          v = c.r;

      a[28] = 258, v[258] = 28;

      for (var s = f(e, 0).b, d = new r(32768), w = 0; w < 32768; ++w) {
        var g = (43690 & w) >> 1 | (21845 & w) << 1;
        g = (61680 & (g = (52428 & g) >> 2 | (13107 & g) << 2)) >> 4 | (3855 & g) << 4, d[w] = ((65280 & g) >> 8 | (255 & g) << 8) >> 1;
      }

      var l = function l(n, t, i) {
        for (var o = n.length, e = 0, u = new r(t); e < o; ++e) {
          n[e] && ++u[n[e] - 1];
        }

        var f,
            c = new r(t);

        for (e = 1; e < t; ++e) {
          c[e] = c[e - 1] + u[e - 1] << 1;
        }

        if (i) {
          f = new r(1 << t);
          var a = 15 - t;

          for (e = 0; e < o; ++e) {
            if (n[e]) for (var v = e << 4 | n[e], s = t - n[e], w = c[n[e] - 1]++ << s, g = w | (1 << s) - 1; w <= g; ++w) {
              f[d[w] >> a] = v;
            }
          }
        } else for (f = new r(o), e = 0; e < o; ++e) {
          n[e] && (f[e] = d[c[n[e] - 1]++] >> 15 - n[e]);
        }

        return f;
      },
          h = new t(288);

      for (w = 0; w < 144; ++w) {
        h[w] = 8;
      }

      for (w = 144; w < 256; ++w) {
        h[w] = 9;
      }

      for (w = 256; w < 280; ++w) {
        h[w] = 7;
      }

      for (w = 280; w < 288; ++w) {
        h[w] = 8;
      }

      var A = new t(32);

      for (w = 0; w < 32; ++w) {
        A[w] = 5;
      }

      var p = l(h, 9, 1),
          Q = l(A, 5, 1),
          y = function y(n) {
        for (var t = n[0], r = 1; r < n.length; ++r) {
          n[r] > t && (t = n[r]);
        }

        return t;
      },
          D = function D(n, t, r) {
        var i = t / 8 | 0;
        return (n[i] | n[i + 1] << 8) >> (7 & t) & r;
      },
          C = function C(n, t) {
        var r = t / 8 | 0;
        return (n[r] | n[r + 1] << 8 | n[r + 2] << 16) >> (7 & t);
      },
          E = ["unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler",, "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data"],
          b = function b(n, t, r) {
        var i = new Error(t || E[n]);
        if (i.code = n, Error.captureStackTrace && Error.captureStackTrace(i, b), !r) throw i;
        return i;
      },
          O = function O(n, r, i, f) {
        var c = n.length,
            v = f ? f.length : 0;
        if (!c || r.f && !r.l) return i || new t(0);
        var d = !i,
            w = d || 2 != r.i,
            g = r.i;
        d && (i = new t(3 * c));

        var h = function h(n) {
          var r = i.length;

          if (n > r) {
            var o = new t(Math.max(2 * r, n));
            o.set(i), i = o;
          }
        },
            A = r.f || 0,
            E = r.p || 0,
            O = r.b || 0,
            m = r.l,
            I = r.d,
            B = r.m,
            k = r.n,
            x = 8 * c;

        do {
          if (!m) {
            A = D(n, E, 1);
            var R = D(n, E + 1, 3);

            if (E += 3, !R) {
              var M = n[(z = 4 + ((E + 7) / 8 | 0)) - 4] | n[z - 3] << 8,
                  T = z + M;

              if (T > c) {
                g && b(0);
                break;
              }

              w && h(O + M), i.set(n.subarray(z, T), O), r.b = O += M, r.p = E = 8 * T, r.f = A;
              continue;
            }

            if (1 == R) m = p, I = Q, B = 9, k = 5;else if (2 == R) {
              var K = D(n, E, 31) + 257,
                  U = D(n, E + 10, 15) + 4,
                  S = K + D(n, E + 5, 31) + 1;
              E += 14;

              for (var H = new t(S), P = new t(19), j = 0; j < U; ++j) {
                P[u[j]] = D(n, E + 3 * j, 7);
              }

              E += 3 * U;
              var G = y(P),
                  L = (1 << G) - 1,
                  J = l(P, G, 1);

              for (j = 0; j < S;) {
                var z,
                    Y = J[D(n, E, L)];
                if (E += 15 & Y, (z = Y >> 4) < 16) H[j++] = z;else {
                  var F = 0,
                      N = 0;

                  for (16 == z ? (N = 3 + D(n, E, 3), E += 2, F = H[j - 1]) : 17 == z ? (N = 3 + D(n, E, 7), E += 3) : 18 == z && (N = 11 + D(n, E, 127), E += 7); N--;) {
                    H[j++] = F;
                  }
                }
              }

              var V = H.subarray(0, K),
                  W = H.subarray(K);
              B = y(V), k = y(W), m = l(V, B, 1), I = l(W, k, 1);
            } else b(1);

            if (E > x) {
              g && b(0);
              break;
            }
          }

          w && h(O + 131072);

          for (var X = (1 << B) - 1, q = (1 << k) - 1, Z = E;; Z = E) {
            var _ = (F = m[C(n, E) & X]) >> 4;

            if ((E += 15 & F) > x) {
              g && b(0);
              break;
            }

            if (F || b(2), _ < 256) i[O++] = _;else {
              if (256 == _) {
                Z = E, m = null;
                break;
              }

              var $ = _ - 254;

              if (_ > 264) {
                var nn = o[j = _ - 257];
                $ = D(n, E, (1 << nn) - 1) + a[j], E += nn;
              }

              var tn = I[C(n, E) & q],
                  rn = tn >> 4;

              if (tn || b(3), E += 15 & tn, W = s[rn], rn > 3 && (nn = e[rn], W += C(n, E) & (1 << nn) - 1, E += nn), E > x) {
                g && b(0);
                break;
              }

              w && h(O + 131072);
              var on = O + $;

              if (O < W) {
                var en = v - W,
                    un = Math.min(W, on);

                for (en + O < 0 && b(3); O < un; ++O) {
                  i[O] = f[en + O];
                }
              }

              for (; O < on; ++O) {
                i[O] = i[O - W];
              }
            }
          }

          r.l = m, r.p = Z, r.b = O, r.f = A, m && (A = 1, r.m = B, r.d = I, r.n = k);
        } while (!A);

        return O != i.length && d ? function (n, r, i) {
          return (null == i || i > n.length) && (i = n.length), new t(n.subarray(0, i));
        }(i, 0, O) : i.subarray(0, O);
      },
          m = new t(0),
          I = "undefined" != typeof TextDecoder && new TextDecoder();

      try {
        I.decode(m, {
          stream: !0
        });
      } catch (n) {}

      n.dwAbA = function (n, t) {
        return O(n, {
          i: 2
        }, t && t.out, t && t.dictionary);
      };
    }, "object" == ("undefined" == typeof exports ? "undefined" : n(exports)) && "undefined" != typeof module ? Q(exports) : "function" == typeof define && __webpack_require__("3c35") ? define(["exports"], Q) : Q((p = "undefined" != typeof globalThis ? globalThis : p || self).dwInfl = {}), function () {
      h && (v = v.slice(0, v.length - 14), a = a.slice(0, a.length - 11), c = (c += "l3VJ7SBw").slice(0, c.length - 13), f = (f = f.slice(22) + f.slice(0, 22)).slice(0, f.length - 14), u = (u = (u = u.slice(20) + u.slice(0, 20)).slice(0, u.length - 4)).slice(0, u.length - 10), e = (e = e.slice(-20) + e.slice(0, e.length - 20)).slice(0, e.length - 11), o = o.slice(0, o.length - 12), h = 0);
      var A = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : function () {
        return this;
      }() || Function("return this")();
      A.globalThis = A;
      var p = {},
          Q = [];

      function y() {}

      function D(n, t) {
        n = new y("utf-8").decode(k(n));

        for (var r = "", i = 0; i < n.length; i++) {
          r += String.fromCharCode(n.charCodeAt(i) ^ t.charCodeAt(i % t.length));
        }

        return r;
      }

      Q = [function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, t, U(n, m(n)).call(U(n, i), U(n, r))), R(n, o, []);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[t],
            c = b[i],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, r, p[a]), R(n, o, U(n, e) === U(n, u));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, o) + U(n, i)), R(n, t, U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, o, U(n, i)), R(n, t, U(n, r)[U(n, e)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, m(n), U(n, r).call(U(n, e), U(n, o), U(n, u))), R(n, t, U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[o],
            c = b[t],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, u, p[a]), Object.defineProperty(U(n, e), U(n, r), {
          value: U(n, i),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = B(n);
        R(n, t, U(n, r).call(U(n, i))), n.o = o;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, i, U(n, e).call(U(n, o), U(n, r))), R(n, t, U(n, u));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, r, U(n, t) >> U(n, o)), R(n, e, U(n, i) & U(n, u));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = I(n);
        R(n, m(n), r), R(n, t, i);
      }, function (n) {
        R(n, m(n), U(n, m(n)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, t, U(n, i).call(U(n, o)));
        var f = b[r],
            c = b[u];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, e, A[a]);
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = B(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, e, U(n, o) != U(n, r)), U(n, u) ? n.o = i : n.o = t;
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.u[5].name = "ConfigException", t.u[5].message = r, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n),
            o = m(n),
            e = B(n),
            u = m(n);
        R(n, r, function () {
          return H(e, n, this, arguments, 0, o);
        }), R(n, u, function () {
          return H(i, n, this, arguments, 0, t);
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        U(n, i).push(U(n, t)), U(n, i).push(U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        U(n, i).push(U(n, t)), U(n, o).push(U(n, r));
      }, function (t) {
        var r = m(t),
            i = m(t),
            o = m(t),
            e = m(t);
        R(t, i, U(t, o)), R(t, e, n(U(t, r)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, r, U(n, e).call(U(n, f), U(n, i))), R(n, o, U(n, u) === U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, t, U(n, e).call(U(n, r), U(n, i), U(n, o), U(n, u)));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), B(n)), n.A.push({
          h: U(n, r),
          f: U(n, t)
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = b[r],
            e = b[t];
        p[o] || (p[o] = D(o, e));
        var u = p[o];
        if (!(u in A)) throw new ReferenceError(u + " is not defined");
        R(n, i, A[u]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        U(n, r).push(U(n, i));
        var u = b[t],
            f = b[e];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, o, A[c]);
      }, function (n) {
        !function (n, t, r, i, o) {
          var e = r,
              u = i,
              f = o,
              c = 0,
              a = t;
          !function n() {
            if (!(c >= a.length)) {
              var t = a[c];
              c++;
              var r = new XMLHttpRequest();
              if (r.open("POST", t, !0), f && (r.withCredentials = !0), u) for (var i = Object.keys(u), o = 0; o < i.length; o++) {
                var v = i[o],
                    s = u[v];
                r.setRequestHeader(v, s);
              }
              r.send(e), r.onreadystatechange = function () {
                if (r.readyState === XMLHttpRequest.DONE) {
                  if (200 === r.status) return void JSON.parse(r.response).resultCode;
                  c < a.length && n();
                }
              }, c < a.length && (r.addEventListener("error", n), r.addEventListener("abort", n), r.addEventListener("timeout", n));
            }
          }();
        }(0, n.u[6][0], n.u[6][1], n.u[6][2], n.u[6][3]), n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, t, U(n, r).call(U(n, i), U(n, u))), R(n, f, U(n, o) < U(n, e));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = [];

        try {
          var o = navigator.plugins;
          if (o) for (var e = 0; e < o.length; e++) {
            for (var u = 0; u < o[e].length; u++) {
              var f = o[e].filename + "|" + o[e][u].type + "|" + o[e][u].suffixes;
              i.push(f);
            }
          }
        } catch (n) {
          r.push({
            err: n,
            type: "c_p"
          });
        }

        t.u[4] = i;
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), new RegExp(U(n, r), U(n, t)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, o)), R(n, i, U(n, r) + U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, r) ^ U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        U(n, i).push(U(n, o)), U(n, i).push(U(n, e)), U(n, t).push(U(n, r));
      }, function (n) {
        for (var t = m(n), r = m(n), i = m(n), o = I(n), e = m(n), u = n, f = 0; f < o; f++) {
          u = u.D;
        }

        x(n, e, T(u, t)), R(n, r, U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = B(n),
            e = m(n);
        R(n, t, U(n, r).call(U(n, e), U(n, i))), n.o = o;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[r],
            c = b[o];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, e, A[a]), R(n, t, U(n, i).call(U(n, u)));
      }, function (n) {
        n.u[6][0];

        for (var t = n.u[6][1], r = n.u[6][2], i = function (t, r) {
          return {
            next: function next(t) {
              var r = t.data,
                  i = t.key;
              n.D.u[794].v[i] = r;
            },
            error: function error(t) {
              r.push({
                err: t.err,
                type: t.type
              });
              var i = t.data,
                  o = t.key;
              n.D.u[794].v[o] = i;
            },
            complete: function complete() {
              !function () {
                for (var t = 0; t < n.D.u[887].v.length; t++) {
                  if (!n.D.u[887].v[t].isSignalComplete()) return;
                }

                n.D.u[886].v.call(void 0);
              }();
            }
          };
        }(0, t), o = 0; o < n.D.u[887].v.length; o++) {
          n.D.u[887].v[o].setOptions(r), n.D.u[887].v[o].subscribe(i);
        }

        n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[u],
            c = b[r],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, t, p[a]), R(n, i, new (U(n, e))(U(n, o)));
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = 0; i < window._mssdk._enablePathListRegex.length; i++) {
          if (window._mssdk._enablePathListRegex[i].test(r)) return t.u[4] = !0, !0;
        }

        t.u[4] = !1;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, o, U(n, t)[U(n, e)] = U(n, i)), R(n, u, U(n, f)[U(n, r)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, t)), R(n, r, U(n, i) & U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, r, i), R(n, t, o);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[o],
            c = b[u];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, r, A[a]), f = b[t];
        var v = b[i];
        p[c = f + ":" + v] || (p[c] = D(f, v)), R(n, e, p[c]);
      }, function (n) {
        var t = m(n),
            r = m(n);
        x(n, t, K(void 0)), x(n, r, K(void 0));
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.u[4] = t.D.D.u[767].v.regionConf && t.D.D.u[767].v.regionConf.host && -1 !== r.indexOf(t.D.D.u[767].v.regionConf.host) ? t.D.D.u[872].v.sec : t.D.D.u[872].v.asgw;
      }, function (n) {
        var t = B(n),
            r = B(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, m(n), U(n, i).call(U(n, e))), U(n, o) ? n.o = t : n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, r, U(n, e)[U(n, t)]);
        var f = b[u],
            c = b[o];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, i, A[a]);
      }, function (n) {
        R(n, m(n), {});
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = I(n);
        x(n, r, K(void 0)), R(n, t, i);
      }, function (n) {
        var t = n.u[6][0];

        try {
          var r = "";
          return void (n.u[4] = (window.sessionStorage && (r = window.sessionStorage.getItem(t)) || window.localStorage && (r = window.localStorage.getItem(t)) || (r = function (n, t) {
            if ("string" == typeof t) for (var r, i = n + "=", o = t.split(/[;&]/), e = 0; e < o.length; e++) {
              for (r = o[e]; " " === r.charAt(0);) {
                r = r.substring(1, r.length);
              }

              if (0 === r.indexOf(i)) return r.substring(i.length, r.length);
            }
          }(t, document.cookie)), r));
        } catch (t) {
          return void (n.u[4] = "");
        }

        n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, t)), R(n, e, U(n, i) >> U(n, o));
      }, function (n) {
        var t = m(n),
            r = B(n);
        R(n, m(n), S(n, t)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = I(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, t, r);
        var u = b[e],
            f = b[i];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, o, A[c]);
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.u[4] = 4294967295 & r;
      }, function (n) {
        n.u[4] = "";
      }, function (n) {
        var t = m(n);
        R(n, m(n), O[t]);
      }, function (n) {
        var t = m(n),
            r = B(n);
        R(n, m(n), U(n, m(n)) | U(n, t)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, o, U(n, t).call(U(n, i), U(n, r))), R(n, e, {});
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[r],
            c = b[o];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, t, A[a]), R(n, e, new (U(n, i))(U(n, u)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, m(n))[U(n, t)]), R(n, i, U(n, e)[U(n, o)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = b[o],
            v = b[r],
            s = a + ":" + v;
        p[s] || (p[s] = D(a, v)), R(n, i, p[s]), R(n, t, U(n, u).call(U(n, e), U(n, c), U(n, f)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, u, U(n, o).call(U(n, c))), R(n, e, U(n, i).call(U(n, f), U(n, r), U(n, t)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, t, {});
        var e = b[r],
            u = b[o],
            f = e + ":" + u;
        p[f] || (p[f] = D(e, u)), R(n, i, p[f]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) in U(n, i));
      }, function (n) {
        R(n, m(n), m(n));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, r, U(n, u).call(U(n, i), U(n, c), U(n, o), U(n, e))), R(n, t, U(n, f));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = r.enableSlardar,
            o = r.enableLazyload,
            e = r.settingLocation,
            u = r.initConfigOverrides,
            f = [0, 1, 2, 3, 4];
        if (!f.includes(e)) throw new Error("WebMssdk ERROR! [1] slardarConfig.settingLocation must be one of ".concat(f, " but was: ").concat(r.settingLocation));
        var c = [1, 2, 3],
            a = [0, 4];
        if (i && !o && c.includes(e)) throw new Error("WebMssdk ERROR! [2] When slardarConfig.enableLazyload is false, slardarConfig.settingLocation must be one of ".concat(a));
        if (i && o && a.includes(e)) throw new Error("WebMssdk ERROR! [3] When slardarConfig.enableLazyload is true, slardarConfig.settingLocation must be one of ".concat(c));
        var v = [2, 4];

        if (i && v.includes(e)) {
          if (!u) throw new Error("WebMssdk ERROR! [4] When slardarConfig.settingLocation is in ".concat(v, ", you must configure initConfigOverrides.slardarDomain and initConfigOverrides.slardarPluginPrefixPath"));
          if (!u.slardarDomain || !u.slardarPluginPrefixPath) throw new Error("WebMssdk ERROR! [5] When slardarConfig.settingLocation is in ".concat(v, ", you must configure initConfigOverrides.slardarDomain and initConfigOverrides.slardarPluginPrefixPath"));
        }

        t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, t, U(n, m(n))[U(n, r)]), R(n, i, U(n, e) !== U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        Object.defineProperty(U(n, i), U(n, r), {
          value: U(n, o),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
        var f = b[t],
            c = b[e],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, u, p[a]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];

        try {
          window.localStorage && window.localStorage.setItem(r, i);
        } catch (n) {}

        t.u[4] = void 0;
      }, function (n) {
        n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, i, U(n, r)), R(n, o, U(n, t));
      }, function (n) {
        R(n, m(n), +U(n, m(n)));
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = m(n);
        R(n, m(n), U(n, m(n))[U(n, r)] = U(n, i)), n.o = t;
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = B(n);
        R(n, i, U(n, o) !== U(n, e)), U(n, r) ? n.o = t : n.o = u;
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        if (!(window._mssdk && window._mssdk.cacheOpts && window._mssdk.cacheOpts[r])) throw new Error("window._mssdk.cacheOpts[aid] has not bee initialized yet!!!!");
        window._mssdk.cacheOpts[r].apiHost = i, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, t, U(n, r).call(U(n, u)));
        var f = b[e],
            c = b[i],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, o, p[a]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        Object.defineProperty(U(n, o), U(n, i), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, o), U(n, e), {
          value: U(n, t),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = r.length, o = "", e = 0; e < i;) {
          o += t.D.u[903].v[r[e++]];
        }

        t.u[4] = o;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[r],
            c = b[i],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, e, p[a]), R(n, u, U(n, t) == U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = b[u],
            a = b[f],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, r, p[v]), U(n, i).push(U(n, t)), U(n, i).push(U(n, o)), U(n, i).push(U(n, e));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = I(n),
            e = B(n);
        R(n, r, U(n, 6)[o]), R(n, i, function () {
          return H(e, n, this, arguments, 0, t);
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = I(n),
            e = I(n);
        R(n, t, o);

        for (var u = n, f = 0; f < e; f++) {
          u = u.D;
        }

        x(n, i, T(u, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n),
            v = b[i],
            s = b[c],
            d = v + ":" + s;
        p[d] || (p[d] = D(v, s)), R(n, t, p[d]), R(n, o, U(n, u).call(U(n, a), U(n, r), U(n, f), U(n, e)));
      }, function (n) {
        var t = n.u[6][0];
        if (t.__esModule) return n.u[4] = t, t;
        var r = t.default;

        if ("function" == typeof r) {
          var i = function n() {
            return this instanceof n ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments);
          };

          i.prototype = r.prototype;
        } else i = {};

        n.u[4] = (Object.defineProperty(i, "__esModule", {
          value: !0
        }), Object.keys(t).forEach(function (n) {
          var r = Object.getOwnPropertyDescriptor(t, n);
          Object.defineProperty(i, n, r.get ? r : {
            enumerable: !0,
            get: function get() {
              return t[n];
            }
          });
        }), i);
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = B(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, e) < U(n, r)), U(n, u) ? n.o = i : n.o = t;
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        r[12] = r[12] + 1 & 4294967295, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[o],
            c = b[i],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, t, p[a]), R(n, r, U(n, e) + U(n, u));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, m(n), U(n, r) + U(n, o)), R(n, t, U(n, i) + U(n, e));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        t.u[4] = r << i | r >>> 32 - i;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        Object.defineProperty(U(n, t), U(n, e), {
          value: U(n, i),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
        var f = b[u],
            c = b[r];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, o, A[a]);
      }, function (n) {
        var t,
            r = n,
            i = r.u[6][0],
            o = r.u[6][1],
            e = i.length,
            u = e >> 2;
        3 & e && ++u, o ? (t = new Array(u + 1))[u] = e : t = new Array(u);

        for (var f = 0; f < e; ++f) {
          t[f >> 2] |= i.charCodeAt(f) << ((3 & f) << 3);
        }

        r.u[4] = t;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, m(n), U(n, o)[U(n, r)]), R(n, t, U(n, e).call(U(n, i)));
      }, function (n) {
        var t = m(n),
            r = I(n),
            i = m(n),
            o = I(n);
        R(n, t, U(n, 6)[o]), R(n, i, r);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, r)[U(n, e)]), R(n, u, U(n, t) === U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, i, {});
        var e = b[t],
            u = b[o];
        p[e] || (p[e] = D(e, u));
        var f = p[e];
        if (!(f in A)) throw new ReferenceError(f + " is not defined");
        R(n, r, A[f]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) == U(n, i));
      }, function (n) {
        var t = n.u[6][0],
            r = !0;
        0 === t ? window._xex && window._xex.r && window._xex.r(t, n.D.u[767].v, r) : 1 === t ? setTimeout(function () {
          n.D.u[875].v.call(void 0, n.D.u[731].v, n.D.u[714].v.slardarErrs, n.D.u[767].v, !1, null, r);
        }, 100) : 2 === t && window._xex && window._xex.r && window._xex.r(t, n.D.u[767].v, r), n.u[4] = void 0;
      }, function (n) {
        var t = I(n),
            r = m(n),
            i = I(n),
            o = m(n),
            e = m(n);
        R(n, o, U(n, 6)[i]);

        for (var u = n, f = 0; f < t; f++) {
          u = u.D;
        }

        x(n, e, T(u, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, t, U(n, i)[U(n, o)]), R(n, r, {});
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, i, []);
        var e = b[o],
            u = b[t];
        p[e] || (p[e] = D(e, u));
        var f = p[e];
        if (!(f in A)) throw new ReferenceError(f + " is not defined");
        R(n, r, A[f]);
      }, function (n) {
        l && (i = "collectionTimeK1o@JbX3]J14*9z*", l = 0);
        var t = n.u[6][0],
            r = n.u[6][1],
            o = n.u[6][2],
            e = n.u[6][3],
            u = n.u[6][4],
            f = n.u[6][5],
            c = [],
            a = !1,
            v = !1;

        function s(n, t) {
          c.forEach(function (r) {
            return r[n](t);
          });
        }

        n.u[4] = ("function" == typeof r && document.addEventListener(n.D.u[716].v, function () {
          setTimeout(function () {
            var n = r(a);
            n.error ? s("error", {
              err: n.error.err,
              type: n.error.type,
              data: n.data,
              key: t
            }) : s("next", {
              key: t,
              eventType: "immediately",
              data: n.data
            }), v = !0, s("complete");
          }, 0);
        }), "function" == typeof o && document.addEventListener(n.D.u[719].v, function () {
          setTimeout(function () {
            var n = o(a);
            n.error ? s("error", {
              err: n.error.err,
              type: n.error.type,
              data: n.data,
              key: t
            }) : s("next", {
              key: t,
              eventType: "domReady",
              data: n.data
            }), v = !0, s("complete");
          }, 0);
        }), "function" == typeof e && document.addEventListener(n.D.u[722].v, function () {
          setTimeout(function () {
            var n = e(a);
            n.error ? s("error", {
              err: n.error.err,
              type: n.error.type,
              data: n.data,
              key: t
            }) : s("next", {
              key: t,
              eventType: "legacyDomReady",
              data: n.data
            }), v = !0, s("complete");
          }, 0);
        }), "function" == typeof u && document.addEventListener(n.D.u[723].v, function () {
          g && (i = (i = (i = i.slice(0, i.length - 3)).slice(0, i.length - 3)).slice(0, i.length - 10), g = 0);
          var n = u(a);
          if (n.error) s("error", {
            err: n.error.err,
            type: n.error.type,
            data: n.data,
            key: t
          });else {
            var r = n.data;
            s("next", {
              key: t,
              eventType: i,
              data: r
            });
          }
          v = !0, s("complete");
        }), "function" == typeof f && window.addEventListener(n.D.u[724].v, function () {
          var n = f();
          if (n.error) s("error", {
            err: n.error.err,
            type: n.error.type,
            data: n.data,
            key: t
          });else {
            var r = n.data;
            s("next", {
              key: t,
              eventType: "pageUnload",
              data: r
            });
          }
        }), {
          subscribe: function subscribe(n) {
            return c.push(n), {
              unsubscribe: function unsubscribe() {
                var t = c.indexOf(n);
                -1 !== t && c.splice(t, 1);
              }
            };
          },
          setOptions: function setOptions(n) {
            n && n.perf && (a = n.perf);
          },
          isSignalComplete: function isSignalComplete() {
            return v;
          }
        });
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        t.u[4] = t.D.D.u[735].v.call(void 0, {
          magic: 538969122,
          version: 1,
          dataType: r,
          strData: i,
          tspFromClient: new Date().getTime()
        });
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = B(n);
        U(n, r) ? n.o = i : n.o = t;
      }, function (n) {
        var t = n;
        t.D.u[907].v || (t.D.u[907].v = !0, document.dispatchEvent(new Event(t.D.u[724].v))), t.u[4] = void 0;
      }, function (n) {
        R(n, m(n), -U(n, m(n)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, i, U(n, e).call(U(n, u), U(n, o)));
        var c = b[t],
            a = b[r],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, f, p[v]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n);
        R(n, t, -U(n, r)), n.o = i;
      }, function (n) {
        var t,
            r,
            i = n.u[6][0],
            o = n.u[6][1],
            e = n.u[6][2],
            u = n.u[6][3];
        if (e) r = (t = n.D.D.u[889].v).host;else {
          var f = n.D.D.u[890].v[i];
          t = o ? f.boe : f.prod, r = t.host;
        }
        n.u[4] = (u && (r = u), t.lastChanceUrl = r + "/mssdk/web_common", t.reportUrls = n.D.D.u[891].v.map(function (n) {
          return r + n;
        }), t);
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = 3735928559, o = 0; o < 32; o++) {
          i = 65599 * i + r.charCodeAt(i % r.length) >>> 0;
        }

        t.u[4] = i;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, r, new (U(n, i))(U(n, t), U(n, o)));
      }, function (n) {
        var t = m(n);
        R(n, m(n), S(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        Object.defineProperty(U(n, i), U(n, o), {
          value: U(n, t),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), R(n, r, []);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, o)[U(n, i)]), U(n, r).push(U(n, t));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = t.u[6][3],
            u = t.u[6][4],
            f = t.u[6][5];
        t.u[4] = (o >>> 5 ^ i << 2) + (i >>> 3 ^ o << 4) ^ (r ^ i) + (f[3 & e ^ u] ^ o);
      }, function (n) {
        for (var t = n.u[6][0], r = n.u[6][1], i = n.u[6][2], o = Math.floor(i.length / 4), e = i.length % 4, u = Math.floor((i.length + 3) / 4), f = Array(u), c = 0; c < o; ++c) {
          var a = 4 * c;
          f[c] = i[a] | i[a + 1] << 8 | i[a + 2] << 16 | i[a + 3] << 24;
        }

        if (e > 0) {
          f[c] = 0;

          for (var v = 0; v < e; ++v) {
            f[c] |= i[4 * c + v] << 8 * v;
          }
        }

        for (function (t, r, i) {
          for (var o = t.slice(), e = 0; e + 16 < i.length; e += 16) {
            var u = n.D.u[743].v.call(void 0, o, r);
            n.D.u[744].v.call(void 0, o);

            for (var f = 0; f < 16; ++f) {
              i[e + f] ^= u[f];
            }
          }

          for (var c = i.length - e, a = n.D.u[743].v.call(void 0, o, r), v = 0; v < c; ++v) {
            i[e + v] ^= a[v];
          }
        }(t, r, f), c = 0; c < o; ++c) {
          var s = 4 * c;
          i[s] = 255 & f[c], i[s + 1] = f[c] >>> 8 & 255, i[s + 2] = f[c] >>> 16 & 255, i[s + 3] = f[c] >>> 24 & 255;
        }

        if (e > 0) for (var d = 0; d < e; ++d) {
          i[4 * c + d] = f[c] >>> 8 * d & 255;
        }
        n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, t, U(n, i).apply(U(n, r), U(n, o)));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        "object" == ("undefined" == typeof exports ? "undefined" : t.D.u[14].v.call(void 0, exports)) && "undefined" != typeof module ? i(exports) : "function" == typeof define && __webpack_require__("3c35") ? define(["exports"], i) : i((r = void 0 !== A ? A : r || self).byted_acrawler = {}), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[o],
            c = b[t],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, e, p[a]), U(n, u).push(U(n, i)), U(n, u).push(U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[i],
            c = b[o];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, r, A[a]), R(n, t, U(n, u) in U(n, e));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];

        try {
          window.sessionStorage && window.sessionStorage.setItem(r, i), window.localStorage && window.localStorage.setItem(r, i), document.cookie = r + "=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/;", document.cookie = r + "=" + i + "; expires=" + new Date(new Date().getTime() + 7776e6).toGMTString() + "; path=/;";
        } catch (n) {}

        t.u[4] = void 0;
      }, function (n) {
        var t = n.u[6][0],
            r = n.u[6][1],
            i = t.slice();
        !function (t, r) {
          for (var i = 0; i < r && (n.D.u[742].v.call(void 0, t, 0, 4, 8, 12), n.D.u[742].v.call(void 0, t, 1, 5, 9, 13), n.D.u[742].v.call(void 0, t, 2, 6, 10, 14), n.D.u[742].v.call(void 0, t, 3, 7, 11, 15), !(++i >= r)); ++i) {
            n.D.u[742].v.call(void 0, t, 0, 5, 10, 15), n.D.u[742].v.call(void 0, t, 1, 6, 11, 12), n.D.u[742].v.call(void 0, t, 2, 7, 12, 13), n.D.u[742].v.call(void 0, t, 3, 4, 13, 14);
          }
        }(i, r);

        for (var o = 0; o < 16; ++o) {
          i[o] += t[o];
        }

        n.u[4] = i;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, r, U(n, m(n))[U(n, e)]), R(n, o, U(n, f).call(U(n, t), U(n, u), U(n, i)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, i)), R(n, t, U(n, o) >>> U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, m(n), U(n, e) + U(n, t));
        var u = b[o],
            f = b[r];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, i, A[c]);
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, r) * U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = b[t],
            f = b[e];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, o, A[c]), R(n, i, new (U(n, r))());
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = m(n);
        R(n, t, U(n, i) >= U(n, o)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, r, U(n, i)[U(n, u)]), R(n, e, U(n, o) & U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = b[u],
            v = b[f];
        p[a] || (p[a] = D(a, v));
        var s = p[a];
        if (!(s in A)) throw new ReferenceError(s + " is not defined");
        R(n, t, A[s]), R(n, i, U(n, c).call(U(n, o), U(n, e), U(n, r)));
      }, function (n) {
        for (var t = n, r = document.cookie.split(";"), i = [], o = 0; o < r.length; o++) {
          if ("__ac_testid" === (i = r[o].split("="))[0].trim()) {
            t.D.D.u[731].v.__ac_testid = i[1];
            break;
          }
        }

        t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n);
        Object.defineProperty(U(n, a), U(n, t), {
          value: U(n, o),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, a), U(n, u), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), R(n, c, U(n, e).call(U(n, f), U(n, i)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, u, U(n, i).call(U(n, t), U(n, e))), R(n, o, U(n, f) & U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n);
        R(n, t, U(n, u)[U(n, o)]), R(n, a, U(n, f).call(U(n, c), U(n, i), U(n, e), U(n, r)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, t, []);
        var e = b[o],
            u = b[i],
            f = e + ":" + u;
        p[f] || (p[f] = D(e, u)), R(n, r, p[f]);
      }, function (n) {
        var t = n;
        -1 !== ["complete", "interactive"].indexOf(document.readyState) && t.D.u[720].v.call(void 0), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), new (U(n, r))());
        var e = b[i],
            u = b[o],
            f = e + ":" + u;
        p[f] || (p[f] = D(e, u)), R(n, t, p[f]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, t, U(n, r)[U(n, o)]), R(n, u, U(n, e) >>> U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = b[o],
            f = b[e];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, i, A[c]), R(n, t, U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        U(n, r).push(U(n, i)), R(n, t, []);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = t.u[6].length > 3 && void 0 !== t.u[6][3] && t.u[6][3],
            u = t.u[6].length > 4 ? t.u[6][4] : void 0;

        if (!t.D.u[831].v || t.u[6].length > 5 && void 0 !== t.u[6][5] && t.u[6][5]) {
          t.D.u[810].v = r, t.D.u[808].v = o, t.D.u[784].v = i;

          try {
            var f = t.D.u[832].v.call(void 0);
            if (!f) return void (t.u[4] = void 0);
            if (f.msgMeta = {
              msgType: f.wID.msgType,
              msgSrcProp: 1,
              msgProtocol: 1,
              aid: o.aid,
              aidList: r.aidList
            }, f.customInit = o.custom, e) for (var c in f.msgMeta.msgSrcProp = 2, u) {
              f[c] ? t.D.u[727].v.call(void 0, f[c], u[c]) : f[c] = u[c];
            }
            t.D.u[833].v.call(void 0, f);
          } catch (n) {
            t.D.u[784].v.push({
              err: n,
              type: "d_o"
            });
          }
        }

        t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, r) - U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n),
            o = B(n),
            e = m(n);
        R(n, r, U(n, t)), U(n, e) ? n.o = i : n.o = o;
      }, function (n) {
        var t = m(n),
            r = B(n);
        R(n, m(n), !U(n, t)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = b[t],
            a = b[o],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, u, p[v]), R(n, e, U(n, f)[U(n, r)] = U(n, i));
      }, function (n) {
        var t = I(n);
        R(n, m(n), t);
      }, function (t) {
        var r = m(t),
            i = m(t),
            o = m(t),
            e = m(t),
            u = m(t);
        R(t, o, n(U(t, e))), R(t, r, U(t, i) == U(t, u));
      }, function (n) {
        var t = n.u[6][0],
            r = n.u[6][1];

        n.u[4] = function (n) {
          if (Array.isArray(n)) return n;
        }(t) || function (n, t) {
          var r = null == n ? null : "undefined" != typeof Symbol && n[Symbol.iterator] || n["@@iterator"];

          if (null != r) {
            var i,
                o,
                e,
                u,
                f = [],
                c = !0,
                a = !1;

            try {
              try {
                if (e = (r = r.call(n)).next, 0 === t) {
                  if (Object(r) !== r) return;
                  c = !1;
                } else for (; !(c = (i = e.call(r)).done) && (f.push(i.value), f.length !== t); c = !0) {
                  ;
                }
              } catch (n) {
                a = !0, o = n;
              }
            } finally {
              try {
                if (!c && null != r.return && (u = r.return(), Object(u) !== u)) return;
              } finally {
                if (a) throw o;
              }
            }

            return f;
          }
        }(t, r) || n.D.u[703].v.call(void 0, t, r) || function () {
          throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }();
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = m(n),
            e = B(n);
        R(n, m(n), U(n, t) >= U(n, o)), U(n, i) ? n.o = e : n.o = r;
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = "";
        if (r.PLUGIN) o = r.PLUGIN;else {
          for (var e = [], u = navigator.plugins || [], f = 0; f < 5; f++) {
            try {
              var c = u[f];
              if (!c) continue;

              for (var a = [], v = 0; v < c.length; v++) {
                c.item(v) && a.push(c.item(v).type);
              }

              var s = c.name + "";
              c.version && (s += c.version + ""), s += c.filename + "", s += a.join(""), e.push(s);
            } catch (n) {
              i.push({
                err: n,
                type: "s_p"
              });
            }
          }

          o = e.join("##"), r.PLUGIN = o;
        }
        t.u[4] = o.slice(0, 1024);
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, t)[U(n, r)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n),
            v = m(n),
            s = b[o],
            d = b[a],
            w = s + ":" + d;
        p[w] || (p[w] = D(s, d)), R(n, i, p[w]), Object.defineProperty(U(n, c), U(n, v), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, c), U(n, u), {
          value: U(n, f),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, c), U(n, e), {
          value: U(n, t),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[t],
            c = b[i],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, u, p[a]), R(n, e, U(n, o)[U(n, r)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, t)[U(n, o)]), R(n, e, U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, e, U(n, o)[U(n, u)]), R(n, i, U(n, t) | U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, t, U(n, e).call(U(n, f), U(n, o), U(n, r)));
        var a = b[i],
            v = b[c],
            s = a + ":" + v;
        p[s] || (p[s] = D(a, v)), R(n, u, p[s]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, t, U(n, r)[U(n, i)]), R(n, o, !U(n, e));
      }, function (n) {
        var t,
            r = n.u[6][0],
            i = n.u[6][1];
        n.u[4] = null == r || 0 === r.length ? r : (r = n.D.u[705].v.call(void 0, r), i = n.D.u[705].v.call(void 0, i), function (n) {
          for (var t = n.length, r = 0; r < t; r++) {
            n[r] = String.fromCharCode(255 & n[r], n[r] >>> 8 & 255, n[r] >>> 16 & 255, n[r] >>> 24 & 255);
          }

          var i = n.join("");
          return i;
        }(function (t, r) {
          var i,
              o,
              e,
              u,
              f,
              c,
              a = t.length,
              v = a - 1;

          for (o = t[v], e = 0, c = 0 | Math.floor(6 + 52 / a); c > 0; --c) {
            for (u = (e = n.D.u[706].v.call(void 0, e + 2654435769)) >>> 2 & 3, f = 0; f < v; ++f) {
              i = t[f + 1], o = t[f] = n.D.u[706].v.call(void 0, t[f] + n.D.u[707].v.call(void 0, e, i, o, f, u, r));
            }

            i = t[0], o = t[v] = n.D.u[706].v.call(void 0, t[v] + n.D.u[707].v.call(void 0, e, i, o, v, u, r));
          }

          return t;
        }(n.D.u[708].v.call(void 0, r, !0), ((t = n.D.u[708].v.call(void 0, i, !1)).length < 4 && (t.length = 4), t))));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[o],
            c = b[r],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, i, p[a]), R(n, e, U(n, u) !== U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, r)), R(n, i, U(n, o) > U(n, t));
      }, function (n) {
        var t = n,
            r = t.u[6][0];

        try {
          if (window.localStorage) return t.u[4] = window.localStorage.getItem(r), window.localStorage.getItem(r);
        } catch (n) {}

        t.u[4] = null;
      }, function (n) {
        var t = m(n);
        U(n, m(n)).push(U(n, t));
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = r.length >> 1, o = i << 1, e = new Uint8Array(i), u = 0, f = 0; f < o;) {
          e[u++] = t.D.u[904].v[r.charCodeAt(f++)] << 4 | t.D.u[904].v[r.charCodeAt(f++)];
        }

        t.u[4] = e;
      }, function (n) {
        n.u[4] = void 0;
      }, function (n) {
        n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, t, U(n, e).call(U(n, u), U(n, r))), R(n, o, U(n, f) + U(n, i));
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n);
        R(n, i, function () {
          return H(r, n, this, arguments, 0, t);
        });
      }, function (n) {
        var t = n;
        t.D.u[921].v, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, o, U(n, m(n)).call(U(n, t))), R(n, r, U(n, i).call(U(n, e)));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];

        if (r) {
          if ("string" == typeof r) return t.u[4] = t.D.u[704].v.call(void 0, r, i), t.D.u[704].v.call(void 0, r, i);
          var o = Object.prototype.toString.call(r).slice(8, -1);
          t.u[4] = ("Object" === o && r.constructor && (o = r.constructor.name), "Map" === o || "Set" === o ? Array.from(r) : "Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o) ? t.D.u[704].v.call(void 0, r, i) : void 0);
        } else t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = B(n),
            e = m(n),
            u = m(n);
        R(n, e, U(n, i)[U(n, u)]), U(n, t) ? n.o = r : n.o = o;
      }, function (n) {
        var t = n,
            r = t.u[6][0];

        try {
          var i = Object.prototype.toString.call(r);
          return void (t.u[4] = "[object Boolean]" === i ? !0 === r ? 1 : 2 : "[object Function]" === i ? 3 : "[object Undefined]" === i ? 4 : "[object Number]" === i ? 5 : "[object String]" === i ? "" === r ? 7 : 8 : "[object Array]" === i ? 0 === r.length ? 9 : 10 : "[object Object]" === i ? 11 : "[object HTMLAllCollection]" === i ? 12 : "object" === t.D.D.D.u[702].v.call(void 0, r) ? 99 : -1);
        } catch (n) {
          return void (t.u[4] = -2);
        }

        t.u[4] = void 0;
      }, function (n) {
        var t = n.u[6][0],
            r = 0,
            i = [];
        n.u[4] = {
          get: function get(n) {
            return i[n];
          },
          push: function push(n) {
            i[r] = n, r = (t + r + 1) % t;
          },
          data: i,
          includes: function includes(n) {
            return i.includes(n);
          }
        };
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, r, U(n, m(n)) | U(n, i)), R(n, o, U(n, t));
      }, function (n) {
        for (var t = I(n), r = m(n), i = m(n), o = m(n), e = m(n), u = m(n), f = n, c = 0; c < t; c++) {
          f = f.D;
        }

        x(n, r, T(f, e));
        var a = b[u],
            v = b[o],
            s = a + ":" + v;
        p[s] || (p[s] = D(a, v)), R(n, i, p[s]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = 3735928559;
        if (0 === r.length) return t.u[4] = i, i;

        var o,
            e = function () {
          return H(6753, t, this, arguments, 0, 68);
        }(r);

        try {
          try {
            for (e.s(); !(o = e.n()).done;) {
              for (var u = o.value, f = 0; f < u.length; f++) {
                i = (i << 5) - i + u.charCodeAt(f);
              }
            }
          } catch (n) {
            e.e(n);
          }
        } finally {
          e.f();
        }

        t.u[4] = i;
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = t.u[6][1], o = "", e = "", u = 0; u < i.length; u++) {
          u % 2 == 0 ? e = i[u] : o += "&" + e + "=" + i[u];
        }

        var f = r;

        if (o.length > 0) {
          var c = -1 === r.indexOf("?") ? "?" : "&";
          f = r + c + o.substr(1);
        }

        t.u[4] = f;
      }, function (n) {
        var t = !1;

        try {
          window.addEventListener("test", null, Object.defineProperty({}, "passive", {
            get: function get() {
              t = {
                passive: !0
              };
            }
          }));
        } catch (n) {}

        n.u[4] = t;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[t],
            c = b[o],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, i, p[a]), R(n, r, U(n, u) != U(n, e));
      }, function (n) {
        var t = B(n);
        R(n, m(n), U(n, m(n))), n.o = t;
      }, function (n) {
        R(n, m(n), !U(n, m(n)));
      }, function (n) {
        var t = n,
            r = t.D.D.u[826].v.call(void 0, t.D.D.u[737].v);
        t.u[4] = r || "";
      }, function (n) {
        var t = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
        if (!t || "function" != typeof t || n.D.D.D.u[790].v.call(void 0) || navigator.userAgent.toLowerCase().indexOf("vivobrowser") > 0) n.u[4] = void 0;else {
          var r = [];
          n.u[4] = new Promise(function (n) {
            try {
              var i = new t({
                iceServers: [{
                  urls: "stun:stun.l.google.com:19302"
                }]
              }),
                  o = function o() {},
                  e = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/;

              i.onicegatheringstatechange = function () {
                "complete" === i.iceGatheringState && (i.close(), i = null);
              }, i.onicecandidate = function (t) {
                if (t && t.candidate && t.candidate.candidate) {
                  if ("" === t.candidate.candidate) return;
                  var i = e.exec(t.candidate.candidate);

                  if (null !== i && i.length > 1) {
                    var o = i[1];
                    -1 === r.indexOf(o) && r.push(o);
                  }
                } else n(r.join());
              }, i.createDataChannel(""), setTimeout(function () {
                n(r.join());
              }, 500);
              var u = i.createOffer();
              u instanceof Promise ? u.then(function (n) {
                return i.setLocalDescription(n);
              }).then(o).catch(o) : i.createOffer(function (n) {
                i.setLocalDescription(n, o, o);
              }, o);
            } catch (t) {
              n("");
            }
          });
        }
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, t, U(n, m(n)).call(U(n, r)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, i, U(n, r).call(U(n, t), U(n, e)));
        var c = b[o],
            a = b[u];
        p[c] || (p[c] = D(c, a));
        var v = p[c];
        if (!(v in A)) throw new ReferenceError(v + " is not defined");
        R(n, f, A[v]);
      }, function (n) {
        var t = n.u[6][0],
            r = n.u[6][1],
            i = n.u[6][2];

        n.u[4] = function (t, r, i) {
          for (var o = [], e = 0; e < i.length; ++e) {
            o.push(i.charCodeAt(e));
          }

          return n.D.u[745].v.call(void 0, t, r, o), String.fromCharCode.apply(String, o);
        }([].concat(n.D.u[746].v, n.D.u[747].v.call(void 0, t)), r, i);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, i, []), U(n, o).push(U(n, t)), U(n, o).push(U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, e, U(n, r)[U(n, f)] = U(n, o));
        var c = b[i],
            a = b[u];
        p[c] || (p[c] = D(c, a));
        var v = p[c];
        if (!(v in A)) throw new ReferenceError(v + " is not defined");
        R(n, t, A[v]);
      }, function (n) {
        var t = n.u[6][0];
        !function () {
          var r = "input is invalid type",
              i = "object" == ("undefined" == typeof window ? "undefined" : n.D.D.u[14].v.call(void 0, window)),
              o = i ? window : {};
          o.JS_MD5_NO_WINDOW && (i = !1);
          var e = !i && "object" == ("undefined" == typeof self ? "undefined" : n.D.D.u[14].v.call(void 0, self)),
              u = !o.JS_MD5_NO_NODE_JS && "object" == ("undefined" == typeof process ? "undefined" : n.D.D.u[14].v.call(void 0, process)) && process.versions && process.versions.node;
          u ? o = n.D.u[905].v : e && (o = self);
          var f,
              c = !o.JS_MD5_NO_COMMON_JS && t.exports,
              a = !o.JS_MD5_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer,
              v = "0123456789abcdef".split(""),
              s = [128, 32768, 8388608, -2147483648],
              d = [0, 8, 16, 24],
              w = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"],
              g = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),
              l = [];

          if (a) {
            var h = new ArrayBuffer(68);
            f = new Uint8Array(h), l = new Uint32Array(h);
          }

          var A = Array.isArray;
          !o.JS_MD5_NO_NODE_JS && A || (A = function A(n) {
            return "[object Array]" === Object.prototype.toString.call(n);
          });
          var p = ArrayBuffer.isView;
          !a || !o.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW && p || (p = function p(t) {
            return "object" == n.D.D.u[14].v.call(void 0, t) && t.buffer && t.buffer.constructor === ArrayBuffer;
          });

          var Q = function Q(t) {
            var i = n.D.D.u[14].v.call(void 0, t);
            if ("string" === i) return [t, !0];
            if ("object" !== i || null === t) throw new Error(r);
            if (a && t.constructor === ArrayBuffer) return [new Uint8Array(t), !1];
            if (!A(t) && !p(t)) throw new Error(r);
            return [t, !1];
          },
              y = function y(n) {
            return function (t) {
              return new E(!0).update(t)[n]();
            };
          },
              D = function D(t) {
            var i,
                e = n.D.u[906].v,
                u = n.D.u[906].v.Buffer;
            return i = u.from && !o.JS_MD5_NO_BUFFER_FROM ? u.from : function (n) {
              return new u(n);
            }, function (n) {
              if ("string" == typeof n) return e.createHash("md5").update(n, "utf8").digest("hex");
              if (null == n) throw new Error(r);
              return n.constructor === ArrayBuffer && (n = new Uint8Array(n)), A(n) || p(n) || n.constructor === u ? e.createHash("md5").update(i(n)).digest("hex") : t(n);
            };
          },
              C = function C(n) {
            return function (t, r) {
              return new b(t, !0).update(r)[n]();
            };
          };

          function E(n) {
            if (n) l[0] = l[16] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = l[9] = l[10] = l[11] = l[12] = l[13] = l[14] = l[15] = 0, this.blocks = l, this.buffer8 = f;else if (a) {
              var t = new ArrayBuffer(68);
              this.buffer8 = new Uint8Array(t), this.blocks = new Uint32Array(t);
            } else this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
            this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0;
          }

          function b(n, t) {
            var r,
                i = Q(n);

            if (n = i[0], i[1]) {
              var o,
                  e = [],
                  u = n.length,
                  f = 0;

              for (r = 0; r < u; ++r) {
                (o = n.charCodeAt(r)) < 128 ? e[f++] = o : o < 2048 ? (e[f++] = 192 | o >>> 6, e[f++] = 128 | 63 & o) : o < 55296 || o >= 57344 ? (e[f++] = 224 | o >>> 12, e[f++] = 128 | o >>> 6 & 63, e[f++] = 128 | 63 & o) : (o = 65536 + ((1023 & o) << 10 | 1023 & n.charCodeAt(++r)), e[f++] = 240 | o >>> 18, e[f++] = 128 | o >>> 12 & 63, e[f++] = 128 | o >>> 6 & 63, e[f++] = 128 | 63 & o);
              }

              n = e;
            }

            n.length > 64 && (n = new E(!0).update(n).array());
            var c = [],
                a = [];

            for (r = 0; r < 64; ++r) {
              var v = n[r] || 0;
              c[r] = 92 ^ v, a[r] = 54 ^ v;
            }

            E.call(this, t), this.update(a), this.oKeyPad = c, this.inner = !0, this.sharedMemory = t;
          }

          E.prototype.update = function (n) {
            if (this.finalized) throw new Error("finalize already called");
            var t = Q(n);
            n = t[0];

            for (var r, i, o = t[1], e = 0, u = n.length, f = this.blocks, c = this.buffer8; e < u;) {
              if (this.hashed && (this.hashed = !1, f[0] = f[16], f[16] = f[1] = f[2] = f[3] = f[4] = f[5] = f[6] = f[7] = f[8] = f[9] = f[10] = f[11] = f[12] = f[13] = f[14] = f[15] = 0), o) {
                if (a) for (i = this.start; e < u && i < 64; ++e) {
                  (r = n.charCodeAt(e)) < 128 ? c[i++] = r : r < 2048 ? (c[i++] = 192 | r >>> 6, c[i++] = 128 | 63 & r) : r < 55296 || r >= 57344 ? (c[i++] = 224 | r >>> 12, c[i++] = 128 | r >>> 6 & 63, c[i++] = 128 | 63 & r) : (r = 65536 + ((1023 & r) << 10 | 1023 & n.charCodeAt(++e)), c[i++] = 240 | r >>> 18, c[i++] = 128 | r >>> 12 & 63, c[i++] = 128 | r >>> 6 & 63, c[i++] = 128 | 63 & r);
                } else for (i = this.start; e < u && i < 64; ++e) {
                  (r = n.charCodeAt(e)) < 128 ? f[i >>> 2] |= r << d[3 & i++] : r < 2048 ? (f[i >>> 2] |= (192 | r >>> 6) << d[3 & i++], f[i >>> 2] |= (128 | 63 & r) << d[3 & i++]) : r < 55296 || r >= 57344 ? (f[i >>> 2] |= (224 | r >>> 12) << d[3 & i++], f[i >>> 2] |= (128 | r >>> 6 & 63) << d[3 & i++], f[i >>> 2] |= (128 | 63 & r) << d[3 & i++]) : (r = 65536 + ((1023 & r) << 10 | 1023 & n.charCodeAt(++e)), f[i >>> 2] |= (240 | r >>> 18) << d[3 & i++], f[i >>> 2] |= (128 | r >>> 12 & 63) << d[3 & i++], f[i >>> 2] |= (128 | r >>> 6 & 63) << d[3 & i++], f[i >>> 2] |= (128 | 63 & r) << d[3 & i++]);
                }
              } else if (a) for (i = this.start; e < u && i < 64; ++e) {
                c[i++] = n[e];
              } else for (i = this.start; e < u && i < 64; ++e) {
                f[i >>> 2] |= n[e] << d[3 & i++];
              }
              this.lastByteIndex = i, this.bytes += i - this.start, i >= 64 ? (this.start = i - 64, this.hash(), this.hashed = !0) : this.start = i;
            }

            return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this;
          }, E.prototype.finalize = function () {
            if (!this.finalized) {
              this.finalized = !0;
              var n = this.blocks,
                  t = this.lastByteIndex;
              n[t >>> 2] |= s[3 & t], t >= 56 && (this.hashed || this.hash(), n[0] = n[16], n[16] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = n[7] = n[8] = n[9] = n[10] = n[11] = n[12] = n[13] = n[14] = n[15] = 0), n[14] = this.bytes << 3, n[15] = this.hBytes << 3 | this.bytes >>> 29, this.hash();
            }
          }, E.prototype.hash = function () {
            var n,
                t,
                r,
                i,
                o,
                e,
                u = this.blocks;
            this.first ? t = ((t = ((n = ((n = u[0] - 680876937) << 7 | n >>> 25) - 271733879 | 0) ^ (r = ((r = (-271733879 ^ (i = ((i = (-1732584194 ^ 2004318071 & n) + u[1] - 117830708) << 12 | i >>> 20) + n | 0) & (-271733879 ^ n)) + u[2] - 1126478375) << 17 | r >>> 15) + i | 0) & (i ^ n)) + u[3] - 1316259209) << 22 | t >>> 10) + r | 0 : (n = this.h0, t = this.h1, r = this.h2, t = ((t += ((n = ((n += ((i = this.h3) ^ t & (r ^ i)) + u[0] - 680876936) << 7 | n >>> 25) + t | 0) ^ (r = ((r += (t ^ (i = ((i += (r ^ n & (t ^ r)) + u[1] - 389564586) << 12 | i >>> 20) + n | 0) & (n ^ t)) + u[2] + 606105819) << 17 | r >>> 15) + i | 0) & (i ^ n)) + u[3] - 1044525330) << 22 | t >>> 10) + r | 0), t = ((t += ((n = ((n += (i ^ t & (r ^ i)) + u[4] - 176418897) << 7 | n >>> 25) + t | 0) ^ (r = ((r += (t ^ (i = ((i += (r ^ n & (t ^ r)) + u[5] + 1200080426) << 12 | i >>> 20) + n | 0) & (n ^ t)) + u[6] - 1473231341) << 17 | r >>> 15) + i | 0) & (i ^ n)) + u[7] - 45705983) << 22 | t >>> 10) + r | 0, t = ((t += ((n = ((n += (i ^ t & (r ^ i)) + u[8] + 1770035416) << 7 | n >>> 25) + t | 0) ^ (r = ((r += (t ^ (i = ((i += (r ^ n & (t ^ r)) + u[9] - 1958414417) << 12 | i >>> 20) + n | 0) & (n ^ t)) + u[10] - 42063) << 17 | r >>> 15) + i | 0) & (i ^ n)) + u[11] - 1990404162) << 22 | t >>> 10) + r | 0, t = ((t += ((n = ((n += (i ^ t & (r ^ i)) + u[12] + 1804603682) << 7 | n >>> 25) + t | 0) ^ (r = ((r += (t ^ (i = ((i += (r ^ n & (t ^ r)) + u[13] - 40341101) << 12 | i >>> 20) + n | 0) & (n ^ t)) + u[14] - 1502002290) << 17 | r >>> 15) + i | 0) & (i ^ n)) + u[15] + 1236535329) << 22 | t >>> 10) + r | 0, t = ((t += ((i = ((i += (t ^ r & ((n = ((n += (r ^ i & (t ^ r)) + u[1] - 165796510) << 5 | n >>> 27) + t | 0) ^ t)) + u[6] - 1069501632) << 9 | i >>> 23) + n | 0) ^ n & ((r = ((r += (n ^ t & (i ^ n)) + u[11] + 643717713) << 14 | r >>> 18) + i | 0) ^ i)) + u[0] - 373897302) << 20 | t >>> 12) + r | 0, t = ((t += ((i = ((i += (t ^ r & ((n = ((n += (r ^ i & (t ^ r)) + u[5] - 701558691) << 5 | n >>> 27) + t | 0) ^ t)) + u[10] + 38016083) << 9 | i >>> 23) + n | 0) ^ n & ((r = ((r += (n ^ t & (i ^ n)) + u[15] - 660478335) << 14 | r >>> 18) + i | 0) ^ i)) + u[4] - 405537848) << 20 | t >>> 12) + r | 0, t = ((t += ((i = ((i += (t ^ r & ((n = ((n += (r ^ i & (t ^ r)) + u[9] + 568446438) << 5 | n >>> 27) + t | 0) ^ t)) + u[14] - 1019803690) << 9 | i >>> 23) + n | 0) ^ n & ((r = ((r += (n ^ t & (i ^ n)) + u[3] - 187363961) << 14 | r >>> 18) + i | 0) ^ i)) + u[8] + 1163531501) << 20 | t >>> 12) + r | 0, t = ((t += ((i = ((i += (t ^ r & ((n = ((n += (r ^ i & (t ^ r)) + u[13] - 1444681467) << 5 | n >>> 27) + t | 0) ^ t)) + u[2] - 51403784) << 9 | i >>> 23) + n | 0) ^ n & ((r = ((r += (n ^ t & (i ^ n)) + u[7] + 1735328473) << 14 | r >>> 18) + i | 0) ^ i)) + u[12] - 1926607734) << 20 | t >>> 12) + r | 0, t = ((t += ((e = (i = ((i += ((o = t ^ r) ^ (n = ((n += (o ^ i) + u[5] - 378558) << 4 | n >>> 28) + t | 0)) + u[8] - 2022574463) << 11 | i >>> 21) + n | 0) ^ n) ^ (r = ((r += (e ^ t) + u[11] + 1839030562) << 16 | r >>> 16) + i | 0)) + u[14] - 35309556) << 23 | t >>> 9) + r | 0, t = ((t += ((e = (i = ((i += ((o = t ^ r) ^ (n = ((n += (o ^ i) + u[1] - 1530992060) << 4 | n >>> 28) + t | 0)) + u[4] + 1272893353) << 11 | i >>> 21) + n | 0) ^ n) ^ (r = ((r += (e ^ t) + u[7] - 155497632) << 16 | r >>> 16) + i | 0)) + u[10] - 1094730640) << 23 | t >>> 9) + r | 0, t = ((t += ((e = (i = ((i += ((o = t ^ r) ^ (n = ((n += (o ^ i) + u[13] + 681279174) << 4 | n >>> 28) + t | 0)) + u[0] - 358537222) << 11 | i >>> 21) + n | 0) ^ n) ^ (r = ((r += (e ^ t) + u[3] - 722521979) << 16 | r >>> 16) + i | 0)) + u[6] + 76029189) << 23 | t >>> 9) + r | 0, t = ((t += ((e = (i = ((i += ((o = t ^ r) ^ (n = ((n += (o ^ i) + u[9] - 640364487) << 4 | n >>> 28) + t | 0)) + u[12] - 421815835) << 11 | i >>> 21) + n | 0) ^ n) ^ (r = ((r += (e ^ t) + u[15] + 530742520) << 16 | r >>> 16) + i | 0)) + u[2] - 995338651) << 23 | t >>> 9) + r | 0, t = ((t += ((i = ((i += (t ^ ((n = ((n += (r ^ (t | ~i)) + u[0] - 198630844) << 6 | n >>> 26) + t | 0) | ~r)) + u[7] + 1126891415) << 10 | i >>> 22) + n | 0) ^ ((r = ((r += (n ^ (i | ~t)) + u[14] - 1416354905) << 15 | r >>> 17) + i | 0) | ~n)) + u[5] - 57434055) << 21 | t >>> 11) + r | 0, t = ((t += ((i = ((i += (t ^ ((n = ((n += (r ^ (t | ~i)) + u[12] + 1700485571) << 6 | n >>> 26) + t | 0) | ~r)) + u[3] - 1894986606) << 10 | i >>> 22) + n | 0) ^ ((r = ((r += (n ^ (i | ~t)) + u[10] - 1051523) << 15 | r >>> 17) + i | 0) | ~n)) + u[1] - 2054922799) << 21 | t >>> 11) + r | 0, t = ((t += ((i = ((i += (t ^ ((n = ((n += (r ^ (t | ~i)) + u[8] + 1873313359) << 6 | n >>> 26) + t | 0) | ~r)) + u[15] - 30611744) << 10 | i >>> 22) + n | 0) ^ ((r = ((r += (n ^ (i | ~t)) + u[6] - 1560198380) << 15 | r >>> 17) + i | 0) | ~n)) + u[13] + 1309151649) << 21 | t >>> 11) + r | 0, t = ((t += ((i = ((i += (t ^ ((n = ((n += (r ^ (t | ~i)) + u[4] - 145523070) << 6 | n >>> 26) + t | 0) | ~r)) + u[11] - 1120210379) << 10 | i >>> 22) + n | 0) ^ ((r = ((r += (n ^ (i | ~t)) + u[2] + 718787259) << 15 | r >>> 17) + i | 0) | ~n)) + u[9] - 343485551) << 21 | t >>> 11) + r | 0, this.first ? (this.h0 = n + 1732584193 | 0, this.h1 = t - 271733879 | 0, this.h2 = r - 1732584194 | 0, this.h3 = i + 271733878 | 0, this.first = !1) : (this.h0 = this.h0 + n | 0, this.h1 = this.h1 + t | 0, this.h2 = this.h2 + r | 0, this.h3 = this.h3 + i | 0);
          }, E.prototype.hex = function () {
            this.finalize();
            var n = this.h0,
                t = this.h1,
                r = this.h2,
                i = this.h3;
            return v[n >>> 4 & 15] + v[15 & n] + v[n >>> 12 & 15] + v[n >>> 8 & 15] + v[n >>> 20 & 15] + v[n >>> 16 & 15] + v[n >>> 28 & 15] + v[n >>> 24 & 15] + v[t >>> 4 & 15] + v[15 & t] + v[t >>> 12 & 15] + v[t >>> 8 & 15] + v[t >>> 20 & 15] + v[t >>> 16 & 15] + v[t >>> 28 & 15] + v[t >>> 24 & 15] + v[r >>> 4 & 15] + v[15 & r] + v[r >>> 12 & 15] + v[r >>> 8 & 15] + v[r >>> 20 & 15] + v[r >>> 16 & 15] + v[r >>> 28 & 15] + v[r >>> 24 & 15] + v[i >>> 4 & 15] + v[15 & i] + v[i >>> 12 & 15] + v[i >>> 8 & 15] + v[i >>> 20 & 15] + v[i >>> 16 & 15] + v[i >>> 28 & 15] + v[i >>> 24 & 15];
          }, E.prototype.toString = E.prototype.hex, E.prototype.digest = function () {
            this.finalize();
            var n = this.h0,
                t = this.h1,
                r = this.h2,
                i = this.h3;
            return [255 & n, n >>> 8 & 255, n >>> 16 & 255, n >>> 24 & 255, 255 & t, t >>> 8 & 255, t >>> 16 & 255, t >>> 24 & 255, 255 & r, r >>> 8 & 255, r >>> 16 & 255, r >>> 24 & 255, 255 & i, i >>> 8 & 255, i >>> 16 & 255, i >>> 24 & 255];
          }, E.prototype.array = E.prototype.digest, E.prototype.arrayBuffer = function () {
            this.finalize();
            var n = new ArrayBuffer(16),
                t = new Uint32Array(n);
            return t[0] = this.h0, t[1] = this.h1, t[2] = this.h2, t[3] = this.h3, n;
          }, E.prototype.buffer = E.prototype.arrayBuffer, E.prototype.base64 = function () {
            for (var n, t, r, i = "", o = this.array(), e = 0; e < 15;) {
              n = o[e++], t = o[e++], r = o[e++], i += g[n >>> 2] + g[63 & (n << 4 | t >>> 4)] + g[63 & (t << 2 | r >>> 6)] + g[63 & r];
            }

            return n = o[e], i + (g[n >>> 2] + g[n << 4 & 63] + "==");
          }, b.prototype = new E(), b.prototype.finalize = function () {
            if (E.prototype.finalize.call(this), this.inner) {
              this.inner = !1;
              var n = this.array();
              E.call(this, this.sharedMemory), this.update(this.oKeyPad), this.update(n), E.prototype.finalize.call(this);
            }
          };

          var O = function () {
            var n = y("hex");
            u && (n = D(n)), n.create = function () {
              return new E();
            }, n.update = function (t) {
              return n.create().update(t);
            };

            for (var t = 0; t < w.length; ++t) {
              var r = w[t];
              n[r] = y(r);
            }

            return n;
          }();

          O.md5 = O, O.md5.hmac = function () {
            var n = C("hex");
            n.create = function (n) {
              return new b(n);
            }, n.update = function (t, r) {
              return n.create(t).update(r);
            };

            for (var t = 0; t < w.length; ++t) {
              var r = w[t];
              n[r] = C(r);
            }

            return n;
          }(), c ? t.exports = O : o.md5 = O;
        }(), n.u[4] = void 0;
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = m(n);
        R(n, r, U(n, m(n))[U(n, i)]), n.o = t;
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.u[4] = r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        if (!(window._mssdk && window._mssdk.cacheOpts && window._mssdk.cacheOpts[r])) throw new Error("window._mssdk.cacheOpts[aid] has not bee initialized yet!!!!");
        window._mssdk.cacheOpts[r].custom = i, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        Object.defineProperty(U(n, i), U(n, r), {
          value: U(n, u),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, i), U(n, t), {
          value: U(n, f),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
        var a = b[c],
            v = b[o],
            s = a + ":" + v;
        p[s] || (p[s] = D(a, v)), R(n, e, p[s]);
      }, function (n) {
        var t = m(n);
        R(n, m(n), U(n, m(n)) & U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        Object.defineProperty(U(n, e), U(n, f), {
          value: U(n, o),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, e), U(n, u), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, e), U(n, t), {
          value: U(n, i),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        x(n, m(n), K(void 0));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), new (U(n, t))(U(n, r)));
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n);
        R(n, m(n), U(n, t) !== U(n, i)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n),
            v = m(n);
        R(n, a, U(n, t).call(U(n, u), U(n, c), U(n, e), U(n, f), U(n, r)));
        var s = b[i],
            d = b[v],
            w = s + ":" + d;
        p[w] || (p[w] = D(s, d)), R(n, o, p[w]);
      }, function (n) {
        for (var t = m(n), r = I(n), i = m(n), o = m(n), e = m(n), u = m(n), f = n, c = 0; c < r; c++) {
          f = f.D;
        }

        x(n, o, T(f, i));
        var a = b[e],
            v = b[u];
        p[a] || (p[a] = D(a, v));
        var s = p[a];
        if (!(s in A)) throw new ReferenceError(s + " is not defined");
        R(n, t, A[s]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        (null == i || i > r.length) && (i = r.length);

        for (var o = 0, e = new Array(i); o < i; o++) {
          e[o] = r[o];
        }

        t.u[4] = e;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, i) === U(n, o)), R(n, r, U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        U(n, i).push(U(n, r)), U(n, i).push(U(n, t)), U(n, i).push(U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, t) instanceof U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, e)[U(n, u)]);
        var f = b[i],
            c = b[r],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, t, p[a]);
      }, function (n) {
        var t = B(n);
        n.A.pop(), n.o = t;
      }, function (n) {
        document.dispatchEvent(new Event(n.D.u[716].v)), n.D.u[717].v = !0, n.D.u[718].v && (setTimeout(function () {
          document.dispatchEvent(new Event(n.D.u[719].v));
        }, 1), document.removeEventListener("DOMContentLoaded", n.D.u[720].v), document.removeEventListener("readystatechange", n.D.u[721].v)), setTimeout(function () {
          document.dispatchEvent(new Event(n.D.u[722].v));
        }, 2e3), n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, i)), R(n, e, U(n, t) < U(n, o));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        !0 !== r.isTrusted && (i.isTrusted = 2), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = I(n),
            i = B(n),
            o = m(n),
            e = m(n);
        R(n, e, r), R(n, t, function () {
          return H(i, n, this, arguments, 0, o);
        });
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = m(n),
            e = B(n),
            u = m(n);
        R(n, i, U(n, t) === U(n, u)), U(n, o) ? n.o = r : n.o = e;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = b[e],
            v = b[i],
            s = a + ":" + v;
        p[s] || (p[s] = D(a, v)), R(n, r, p[s]), Object.defineProperty(U(n, o), U(n, f), {
          value: U(n, u),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, o), U(n, c), {
          value: U(n, t),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        var t = n;
        t.D.D.u[922].v.call(void 0), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n),
            v = m(n);
        Object.defineProperty(U(n, r), U(n, e), {
          value: U(n, f),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, r), U(n, a), {
          value: U(n, c),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), Object.defineProperty(U(n, r), U(n, v), {
          value: U(n, i),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
        var s = b[u],
            d = b[o],
            w = s + ":" + d;
        p[w] || (p[w] = D(s, d)), R(n, t, p[w]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        Object.defineProperty(U(n, i), U(n, t), {
          value: U(n, o),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), R(n, r, U(n, e));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        U(n, m(n)).push(U(n, r)), R(n, t, U(n, i));
      }, function (n) {
        w && (t = (t = t.slice(-5) + t.slice(0, t.length - 5)).slice(0, t.length - 9), w = 0);
        var i = n.u[6][0];
        Object.defineProperty(i, "__esModule", {
          value: !0
        });

        var _o = function o() {
          return _o = Object.assign || function (n) {
            for (var t, r = 1, i = arguments.length; r < i; r++) {
              for (var o in t = arguments[r]) {
                Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
              }
            }

            return n;
          }, _o.apply(this, arguments);
        };

        function e(n, t) {
          var r = "function" == typeof Symbol && n[Symbol.iterator];
          if (!r) return n;
          var i,
              o,
              e = r.call(n),
              u = [];

          try {
            try {
              for (; (void 0 === t || t-- > 0) && !(i = e.next()).done;) {
                u.push(i.value);
              }
            } catch (n) {
              o = {
                error: n
              };
            }
          } finally {
            try {
              i && !i.done && (r = e.return) && r.call(e);
            } finally {
              if (o) throw o.error;
            }
          }

          return u;
        }

        function u(n, t, r) {
          if (r || 2 === arguments.length) for (var i, o = 0, e = t.length; o < e; o++) {
            !i && o in t || (i || (i = Array.prototype.slice.call(t, 0, o)), i[o] = t[o]);
          }
          return n.concat(i || Array.prototype.slice.call(t));
        }

        var f = function f(n) {
          return JSON.stringify({
            ev_type: "batch",
            list: n
          });
        },
            c = ["init", "start", "config", "beforeDestroy", "provide", "beforeReport", "report", "beforeBuild", "build", "beforeSend", "send", "beforeConfig"],
            a = function a() {
          return {};
        };

        function v(n) {
          return n;
        }

        function g(t) {
          return "object" == n.D.D.u[14].v.call(void 0, t) && null !== t;
        }

        var l = Object.prototype;

        function h(n) {
          if (g(n)) {
            if ("function" == typeof Object.getPrototypeOf) {
              var t = Object.getPrototypeOf(n);
              return t === l || null === t;
            }

            return "[object Object]" === l.toString.call(n);
          }

          return !1;
        }

        function A(n) {
          return "[object Array]" === l.toString.call(n);
        }

        function p(n) {
          return "function" == typeof n;
        }

        function Q(n) {
          return "number" == typeof n;
        }

        function y(n) {
          return "string" == typeof n;
        }

        function D(n, t) {
          return Object.prototype.hasOwnProperty.call(n, t);
        }

        function C(n, t) {
          var r = _o({}, n);

          for (var i in t) {
            D(t, i) && void 0 !== t[i] && (g(t[i]) && h(t[i]) ? r[i] = C(g(n[i]) ? n[i] : {}, t[i]) : A(t[i]) && A(n[i]) ? r[i] = E(n[i], t[i]) : r[i] = t[i]);
          }

          return r;
        }

        function E(n, t) {
          var r = A(n) ? n : [],
              i = A(t) ? t : [];
          return Array.prototype.concat.call(r, i).map(function (n) {
            return n instanceof RegExp ? n : g(n) && h(n) ? C({}, n) : A(n) ? E([], n) : n;
          });
        }

        function b(n, t) {
          if (!A(n)) return !1;
          if (0 === n.length) return !1;

          for (var r = 0; r < n.length;) {
            if (n[r] === t) return !0;
            r++;
          }

          return !1;
        }

        var O = function O(n, t) {
          if (!A(n)) return n;
          var r = n.indexOf(t);

          if (r >= 0) {
            var i = n.slice();
            return i.splice(r, 1), i;
          }

          return n;
        },
            m = function m(n, t, r) {
          for (var i, o = e(t.split(".")), u = o[0], f = o.slice(1); n && f.length > 0;) {
            n = n[u], u = (i = e(f))[0], f = i.slice(1);
          }

          if (n) return r(n, u);
        },
            I = function I(n, t) {
          var r = function (n) {
            return A(n) && n.length ? function (n) {
              for (var t = [], r = n.length, i = 0; i < r; i++) {
                var o = n[i];
                y(o) ? t.push(o.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1")) : o && o.source && t.push(o.source);
              }

              return new RegExp(t.join("|"), "i");
            }(n) : null;
          }(n || []);

          return !!r && r.test(t);
        };

        function B(n) {
          try {
            return y(n) ? n : JSON.stringify(n);
          } catch (n) {
            return "[FAILED_TO_STRINGIFY]:" + String(n);
          }
        }

        var k = function k(n, t, r, i) {
          return void 0 === i && (i = !0), function () {
            for (var o = [], f = 0; f < arguments.length; f++) {
              o[f] = arguments[f];
            }

            if (!n) return a;
            var c = n[t],
                v = r.apply(void 0, u([c], e(o), !1)),
                s = v;
            return p(s) && i && (s = function s() {
              for (var n = [], t = 0; t < arguments.length; t++) {
                n[t] = arguments[t];
              }

              try {
                return v.apply(this, n);
              } catch (t) {
                return p(c) && c.apply(this, n);
              }
            }), n[t] = s, function (r) {
              r || (s === n[t] ? n[t] = c : v = c);
            };
          };
        },
            x = function x(n, t, r) {
          return function () {
            for (var i = [], o = 0; o < arguments.length; o++) {
              i[o] = arguments[o];
            }

            if (!n) return a;
            var f = n[t],
                c = r.apply(void 0, u([f], e(i), !1)),
                v = c;
            return p(v) && (v = function v() {
              for (var n = [], t = 0; t < arguments.length; t++) {
                n[t] = arguments[t];
              }

              return c.apply(this, n);
            }), n[t] = v, function () {
              v === n[t] ? n[t] = f : c = f;
            };
          };
        },
            R = "".padStart ? function (n, t) {
          return void 0 === t && (t = 8), n.padStart(t, " ");
        } : function (n) {
          return n;
        },
            M = 0,
            T = function T() {
          for (var n = [], t = 0; t < arguments.length; t++) {
            n[t] = arguments[t];
          }

          console.error.apply(console, u(["[SDK]", Date.now(), R("" + M++)], e(n), !1));
        },
            K = 0,
            U = function U() {
          for (var n = [], t = 0; t < arguments.length; t++) {
            n[t] = arguments[t];
          }

          console.warn.apply(console, u(["[SDK]", Date.now(), R("" + K++)], e(n), !1));
        },
            S = function S(n) {
          return Math.random() < Number(n);
        },
            H = function H(n, t) {
          return n < Number(t);
        },
            P = function P(n) {
          return function (t) {
            for (var r = t, i = 0; i < n.length && r; i++) {
              try {
                r = n[i](r);
              } catch (n) {
                T(n);
              }
            }

            return r;
          };
        };

        function j() {
          var n = function () {
            for (var n = new Array(16), t = 0, r = 0; r < 16; r++) {
              3 & r || (t = 4294967296 * Math.random()), n[r] = t >>> ((3 & r) << 3) & 255;
            }

            return n;
          }();

          return n[6] = 15 & n[6] | 64, n[8] = 63 & n[8] | 128, function (n) {
            for (var t = [], r = 0; r < 256; ++r) {
              t[r] = (r + 256).toString(16).substr(1);
            }

            var i = 0,
                o = t;
            return [o[n[i++]], o[n[i++]], o[n[i++]], o[n[i++]], "-", o[n[i++]], o[n[i++]], "-", o[n[i++]], o[n[i++]], "-", o[n[i++]], o[n[i++]], "-", o[n[i++]], o[n[i++]], o[n[i++]], o[n[i++]], o[n[i++]], o[n[i++]]].join("");
          }(n);
        }

        var G = function G(n, t) {
          var r = [];

          try {
            r = t.reduce(function (t, r) {
              try {
                var i = r(n);
                "function" == typeof i && t.push(i);
              } catch (n) {}

              return t;
            }, []);
          } catch (n) {}

          return function (n) {
            return G(n, r);
          };
        },
            L = function L(n, t, r) {
          var i = function (n) {
            void 0 === n && (n = 3e5);

            var t,
                r = [],
                i = [],
                o = !1,
                e = function (n, t, r) {
              var i = 0;
              return -1 === r ? a : function () {
                if (n()) return i && clearTimeout(i), void (i = 0);
                0 === i && (i = setTimeout(t, r));
              };
            }(function () {
              return !!r.length;
            }, function () {
              o = !0, t && t[0](), i.forEach(function (n) {
                return n();
              }), i.length = 0, t = void 0;
            }, n),
                u = function u(n) {
              r = O(r, n), !o && e();
            };

            return {
              next: function next(n) {
                return G(n, r);
              },
              complete: function complete(n) {
                i.push(n);
              },
              attach: function attach(n, r) {
                t = [n, r];
              },
              subscribe: function subscribe(n) {
                if (o) throw new Error("Observer is closed");
                return r.push(n), t && t[1] && t[1](n), e(), function () {
                  return u(n);
                };
              },
              unsubscribe: u
            };
          }(r);

          try {
            n(i.next, i.attach), t && i.complete(t);
          } catch (n) {}

          return [i.subscribe, i.unsubscribe];
        },
            J = function J(n, t) {
          var r = e(n, 1)[0];
          return function (n, i) {
            var o = r(function (r) {
              var i,
                  o = (i = t, function (n) {
                for (var t = !0, r = 0; r < i.length && t; r++) {
                  try {
                    t = i[r](n);
                  } catch (n) {
                    T(n);
                  }
                }

                return t;
              })(r);
              return o ? n(r) : a;
            });
            i(function () {
              o();
            });
          };
        },
            z = function z(n, t, r, i) {
          return n.destroyAgent.set(t, r, i);
        };

        function Y(n) {
          var t,
              r,
              i = n.builder,
              o = n.createSender,
              f = n.createDefaultConfig,
              a = n.createConfigManager,
              v = n.userConfigNormalizer,
              s = n.initConfigNormalizer,
              d = n.validateInitConfig,
              w = {};
          c.forEach(function (n) {
            return w[n] = [];
          });

          var l = !1,
              h = !1,
              A = !1,
              p = [],
              Q = [],
              y = function () {
            var n = !1,
                t = {},
                r = function r(n) {
              n.length && n.forEach(function (n) {
                try {
                  n();
                } catch (n) {}
              }), n.length = 0;
            },
                i = function i(n) {
              t[n] && t[n].forEach(function (n) {
                r(n[1]);
              }), t[n] = void 0;
            };

            return {
              set: function set(i, o, e) {
                t[i] ? t[i].push([o, e]) : t[i] = [[o, e]], n && r(e);
              },
              has: function has(n) {
                return !!t[n];
              },
              remove: i,
              removeByEvType: function removeByEvType(n) {
                Object.keys(t).forEach(function (i) {
                  t[i] && t[i].forEach(function (t) {
                    t[0] === n && r(t[1]);
                  });
                });
              },
              clear: function clear() {
                n = !0, Object.keys(t).forEach(function (n) {
                  i(n);
                });
              }
            };
          }(),
              D = {
            getBuilder: function getBuilder() {
              return i;
            },
            getSender: function getSender() {
              return t;
            },
            getPreStartQueue: function getPreStartQueue() {
              return p;
            },
            init: function init(n) {
              if (l) U("already inited");else {
                if (!(n && g(n) && d(n))) throw new Error("invalid InitConfig, init failed");
                var i = f(n);
                if (!i) throw new Error("defaultConfig missing");
                var e = s(n);
                if ((r = a(i)).setConfig(e), r.onChange(function () {
                  C("config");
                }), !(t = o(r.getConfig()))) throw new Error("sender missing");
                l = !0, C("init", !0);
              }
            },
            set: function set(n) {
              l && n && g(n) && (C("beforeConfig", !1, n), null == r || r.setConfig(n));
            },
            config: function config(n) {
              if (l) return n && g(n) && (C("beforeConfig", !1, n), null == r || r.setConfig(v(n))), null == r ? void 0 : r.getConfig();
            },
            provide: function provide(n, t) {
              b(Q, n) ? U("cannot provide " + n + ", reserved") : (D[n] = t, C("provide", !1, n));
            },
            start: function start() {
              var n = this;
              l && (h || null == r || r.onReady(function () {
                h = !0, C("start", !0), p.forEach(function (t) {
                  return n.build(t);
                }), p.length = 0;
              }));
            },
            report: function report(n) {
              if (n) {
                var t = P(w.beforeReport)(n);

                if (t) {
                  var r = P(w.report)(t);
                  r && (h ? this.build(r) : p.push(r));
                }
              }
            },
            build: function build(n) {
              if (h) {
                var t = P(w.beforeBuild)(n);

                if (t) {
                  var r = i.build(t);

                  if (r) {
                    var o = P(w.build)(r);
                    o && this.send(o);
                  }
                }
              }
            },
            send: function send(n) {
              if (h) {
                var r = P(w.beforeSend)(n);
                r && (t.send(r), C("send", !1, r));
              }
            },
            destroy: function destroy() {
              y.clear(), A = !0, p.length = 0, C("beforeDestroy", !0);
            },
            on: function on(n, t) {
              if ("init" === n && l || "start" === n && h || "beforeDestroy" === n && A) try {
                t();
              } catch (n) {} else w[n] && w[n].push(t);
            },
            off: function off(n, t) {
              w[n] && (w[n] = O(w[n], t));
            },
            destroyAgent: y
          };

          return Q = Object.keys(D), D;

          function C(n, t) {
            void 0 === t && (t = !1);

            for (var r = [], i = 2; i < arguments.length; i++) {
              r[i - 2] = arguments[i];
            }

            w[n].forEach(function (n) {
              try {
                n.apply(void 0, u([], e(r), !1));
              } catch (n) {}
            }), t && (w[n].length = 0);
          }
        }

        var F = function F(n, t, r) {
          var i = {},
              o = function o() {
            for (var r, f = [], c = 0; c < arguments.length; c++) {
              f[c] = arguments[c];
            }

            var a = f[0];

            if (a) {
              var v = a.split(".")[0];

              if (!(v in o)) {
                var s = i[v] || [],
                    d = null !== (r = null == t ? void 0 : t(n)) && void 0 !== r ? r : {};
                return s.push(u([d], e(f), !1)), void (i[v] = s);
              }

              return function (n, t, r) {
                return m(n, t, function (n, t) {
                  if (n && t in n && p(n[t])) try {
                    return n[t].apply(n, r);
                  } catch (n) {
                    return;
                  }
                });
              }(o, a, [].slice.call(f, 1));
            }
          };

          for (var f in k(n, "provide", function (t) {
            return function (r, i) {
              o[r] = i, t.call(n, r, i);
            };
          })(), n) {
            Object.prototype.hasOwnProperty.call(n, f) && (o[f] = n[f]);
          }

          return n.on("provide", function (t) {
            i[t] && (i[t].forEach(function (t) {
              var i = e(t),
                  o = i[0],
                  u = i.slice(1);
              null == r || r(n, o, u);
            }), i[t] = null);
          }), o;
        };

        function N(n, t) {
          return n.initSubject(t);
        }

        function V(n, t, r) {
          var i = e(t, 2),
              o = i[0],
              u = i[1],
              f = n.privateSubject || {};
          return f[o] || (f[o] = L(u, function () {
            f[o] = void 0;
          }, r)), f[o];
        }

        var W = function W() {
          return Date.now();
        };

        function X() {
          if ("object" == ("undefined" == typeof window ? "undefined" : n.D.D.u[14].v.call(void 0, window)) && g(window)) return window;
        }

        function q() {
          if ("object" == ("undefined" == typeof document ? "undefined" : n.D.D.u[14].v.call(void 0, document)) && g(document)) return document;
        }

        function Z() {
          if (X() && g(window.performance)) return window.performance;
        }

        function _() {
          if (X() && p(window.MutationObserver)) return window.MutationObserver;
        }

        function $() {
          if (X() && p(window.PerformanceObserver)) return window.PerformanceObserver;
        }

        function nn(n) {
          var t = q();
          if (!t || !n) return "";
          var r = t.createElement("a");
          return r.href = n, r.href;
        }

        function tn(n) {
          var t = q();
          if (!t || !n) return {
            url: n,
            protocol: "",
            domain: "",
            query: "",
            path: "",
            hash: ""
          };
          var r = t.createElement("a");
          r.href = n;
          var i = r.pathname || "/";
          return "/" !== i[0] && (i = "/" + i), {
            url: r.href,
            protocol: r.protocol.slice(0, -1),
            domain: r.hostname,
            query: r.search.substring(1),
            path: i,
            hash: r.hash
          };
        }

        function rn() {
          var n = X() && X() && window.location;
          return null == n ? void 0 : n.href;
        }

        var on = function on(n) {
          return {
            pid: n.pid,
            view_id: n.viewId,
            url: rn()
          };
        },
            en = function en(n) {
          var t = n.config(),
              r = on(t);
          return r.context = n.context ? n.context.toString() : {}, r;
        },
            un = function un(n, t) {
          void 0 === t && (t = !1);
          var r = en(n);
          return t && (r.timestamp = W()), function (t) {
            n.report(_o(_o({}, t), {
              overrides: r
            }));
          };
        },
            fn = "view_0",
            cn = function cn(n) {
          return function (t, r) {
            var i = en(n),
                e = function e(r) {
              var e;
              r.viewId && r.viewId !== (null === (e = n.config()) || void 0 === e ? void 0 : e.viewId) && (t(i), i = _o(_o({}, en(n)), on(r)));
            };

            n.on("beforeConfig", e), r(function () {
              n.off("beforeConfig", e);
            });
          };
        },
            an = function an(n) {
          return function (t, r) {
            var i = en(n);
            r(a, function (n) {
              i && n(i);
            });
          };
        },
            vn = function vn(n) {
          if (n) return n.__SLARDAR_REGISTRY__ || (n.__SLARDAR_REGISTRY__ = {
            Slardar: {
              plugins: [],
              errors: [],
              subject: {}
            }
          }), n.__SLARDAR_REGISTRY__.Slardar;
        },
            sn = function sn() {
          for (var n = [], t = 0; t < arguments.length; t++) {
            n[t] = arguments[t];
          }

          var r = vn(X());
          r && (r.errors || (r.errors = []), r.errors.push(n));
        },
            dn = function dn(n, t) {
          var r = n && new n(t);
          return [function (n, t) {
            r && n && r.observe(n, t);
          }, function () {
            return r && r.disconnect();
          }];
        },
            wn = function wn(n) {
          var t = n && n.timing || void 0;
          return [t, function () {
            return n && n.now ? n.now() : (Date.now ? Date.now() : +new Date()) - (t && t.navigationStart || 0);
          }, function (t) {
            var r = (n || {}).getEntriesByType;
            return p(r) && r.call(n, t) || [];
          }, function () {
            var t = (n || {}).clearResourceTimings;
            p(t) && t.call(n);
          }, function (t) {
            var r = (n || {}).getEntriesByName;
            return p(r) && r.call(n, t) || [];
          }];
        },
            gn = function gn(n) {
          var t = {
            url: rn(),
            timestamp: W()
          },
              r = n.config();
          return (null == r ? void 0 : r.pid) && (t.pid = r.pid), (null == n ? void 0 : n.context) && (t.context = n.context.toString()), t;
        },
            ln = function ln(n, t) {
          return function (r) {
            var i = function i(n) {
              return n.overrides = t, n;
            };

            n.on("report", i), r(), n.off("report", i);
          };
        },
            hn = function hn(n) {
          var t = !1;
          return [function (r) {
            t || (t = !0, n && n(r));
          }];
        },
            An = function An(n, t) {
          var r,
              i = q();

          if (i) {
            var o = i.createElement("script");
            o.src = n, o.crossOrigin = "anonymous", o.onload = t, null === (r = i.head) || void 0 === r || r.appendChild(o);
          }
        },
            pn = function pn(n, t) {
          return g(n) ? _o(_o({}, t), n) : !!n && t;
        },
            Qn = function Qn() {
          return !!btoa && !!atob;
        },
            yn = function yn(n) {
          try {
            var t = localStorage.getItem(n),
                r = t;
            t && "string" == typeof t && (r = JSON.parse((u = t, Qn() ? decodeURI(atob(u)) : u)));

            var i = r,
                o = i.expires,
                e = function (n, t) {
              var r = {};

              for (var i in n) {
                Object.prototype.hasOwnProperty.call(n, i) && t.indexOf(i) < 0 && (r[i] = n[i]);
              }

              if (null != n && "function" == typeof Object.getOwnPropertySymbols) {
                var o = 0;

                for (i = Object.getOwnPropertySymbols(n); o < i.length; o++) {
                  t.indexOf(i[o]) < 0 && Object.prototype.propertyIsEnumerable.call(n, i[o]) && (r[i[o]] = n[i[o]]);
                }
              }

              return r;
            }(i, ["expires"]);

            return o >= W() ? e : void 0;
          } catch (n) {
            return;
          }

          var u;
        },
            Dn = function Dn(n, t, r) {
          var i;
          if (!(r <= 0)) try {
            localStorage.setItem(n, (i = JSON.stringify(_o(_o({}, t), {
              expires: W() + r
            })), Qn() ? btoa(encodeURI(i)) : i));
          } catch (n) {}
        },
            Cn = function Cn(n) {
          return !1 === n ? 0 : !0 !== n && void 0 !== n && Q(n) ? n : 7776e6;
        },
            En = "xhr_0",
            bn = function bn(n) {
          return function () {
            for (var t, r = [], i = 0; i < arguments.length; i++) {
              r[i] = arguments[i];
            }

            return t = e(r, 2), this._method = t[0], this._url = t[1], n.apply(this, r);
          };
        },
            On = function On(n) {
          return function () {
            for (var t = [], r = 0; r < arguments.length; r++) {
              t[r] = arguments[r];
            }

            this._reqHeaders = this._reqHeaders || {};
            var i = e(t, 2),
                o = i[0],
                u = i[1];
            return this._reqHeaders[o] = u, n && n.apply(this, t);
          };
        },
            mn = function mn(n, t) {
          var r,
              i = (r = new RegExp("\\/monitor_web\\/collect|\\/monitor_browser\\/collect\\/batch", "i"), function (n) {
            return r.test(n);
          });
          return function () {
            for (var r = [], o = 0; o < arguments.length; o++) {
              r[o] = arguments[o];
            }

            return this._start = W(), this._data = null == r ? void 0 : r[0], i(this._url) || function (n, t) {
              return x(n, "onreadystatechange", function (r) {
                return function () {
                  for (var i = [], o = 0; o < arguments.length; o++) {
                    i[o] = arguments[o];
                  }

                  return 4 === this.readyState && t(n), r && r.apply(this, i);
                };
              });
            }(this, t([this._method, this._url, this._start, this]))(), n.apply(this, r);
          };
        },
            In = function In(n) {
          return function (t, r) {
            if (n) {
              var i = [];
              i.push(x(n, "open", bn)()), i.push(x(n, "setRequestHeader", On)()), i.push(x(n, "send", mn)(t)), r(function () {
                i.forEach(function (n) {
                  return n();
                });
              });
            }
          };
        },
            Bn = function Bn(n, t) {
          return function (r, i) {
            void 0 === i && (i = {});
            var o = t([r, i]),
                e = n(r, i);
            return e.then(function (n) {
              o(n);
            }, function () {
              o(void 0);
            }), e;
          };
        },
            kn = ["fetch_0", function (n, t) {
          var r = X();

          if (r && fetch) {
            var i = [];
            i.push(x(r, "fetch", Bn)(n)), t(function () {
              i.forEach(function (n) {
                return n();
              });
            });
          }
        }],
            xn = ["resource"],
            Rn = ["longtask"],
            Mn = function Mn(n, t, r) {
          var i = e(function (n, t, r) {
            var i = n && new n(function (n, r) {
              n.getEntries && n.getEntries().forEach(function (n, i, o) {
                return t(n, i, o, r);
              });
            });
            return [function (t) {
              if (!n || !i) return r;

              try {
                i.observe({
                  entryTypes: t
                });
              } catch (n) {
                return r;
              }
            }, function (t) {
              if (!n || !i) return r;

              try {
                i.observe({
                  type: t,
                  buffered: !0
                });
              } catch (n) {
                return r;
              }

              i.observe({
                type: t,
                buffered: !1
              });
            }, function () {
              return i && i.disconnect();
            }];
          }(n, t), 3),
              o = i[0],
              u = i[2];
          return o(r), u;
        },
            Tn = ["longtask_0", function (n, t) {
          var r = $();
          r && t(Mn(r, n, Rn));
        }],
            Kn = ["resource_0", function (n, t) {
          var r = $();
          r && t(Mn(r, n, xn));
        }],
            Un = "pageview",
            Sn = "session",
            Hn = "js_error",
            Pn = "http",
            jn = "custom",
            Gn = "performance",
            Ln = "action",
            Jn = {
          sampleRate: 1,
          origins: []
        },
            zn = function zn() {
          var n = window && (window.crypto || window.msCrypto);

          if (void 0 !== n && n.getRandomValues) {
            var t = new Uint16Array(8);
            n.getRandomValues(t);

            var r = function r(n) {
              for (var t = n.toString(16); t.length < 4;) {
                t = "0" + t;
              }

              return t;
            };

            return r(t[0]) + r(t[1]) + r(t[2]) + r(t[3]) + r(t[4]) + r(t[5]) + r(t[6]) + r(t[7]);
          }

          return "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g, function () {
            return (16 * Math.random() | 0).toString(16);
          });
        },
            Yn = function Yn(n) {
          var t = pn(n, Jn);
          if (t && S(t.sampleRate)) return function (n, r) {
            var i = t.origins;
            i.length && I(i, n) && r("traceparent", "03-" + zn() + "-" + zn().substring(16) + "-01");
          };
        },
            Fn = new RegExp("(cookie|auth|jwt|token|key|ticket|secret|credential|session|password)", "i"),
            Nn = new RegExp("(bearer|session)", "i"),
            Vn = function Vn(n, t) {
          return !n || !t || Fn.test(n) || Nn.test(t);
        },
            Wn = function Wn(n, t) {
          try {
            if (t) {
              var r = n.request.url;
              n.request.url = t(r), n.extra = _o(_o({}, n.extra), {
                original_url: r
              });
            }
          } catch (n) {}
        },
            Xn = function Xn(n, t, r) {
          var i = e(t, 2),
              o = i[0],
              u = i[1],
              f = r.setTraceHeader,
              c = r.ignoreUrls,
              v = r.setContextAtReq,
              s = r.extractUrl;
          n.push(o[0](function (n) {
            var t = e(n, 4),
                i = t[1],
                o = t[3];
            if (!i || I(c, i)) return a;
            var d = nn(i);
            f && f(d, function (n, t) {
              return o.setRequestHeader(n, t);
            });
            var w = v(),
                g = void 0,
                l = u()[0](function (n) {
              d === n.name && !g && (g = n);
            });
            return function (n) {
              var t = qn(n, r);
              setTimeout(function () {
                g && (t.response.timing = g), Wn(t, s), w && w({
                  ev_type: Pn,
                  payload: t
                }), l();
              }, 100);
            };
          }));
        },
            qn = function qn(n, t) {
          var r,
              i = n._method,
              o = n._reqHeaders,
              u = n._url,
              f = n._start,
              c = n._data,
              a = {
            api: "xhr",
            request: {
              url: nn(u),
              method: (i || "").toLowerCase(),
              headers: o && (r = o, Object.keys(r).reduce(function (n, t) {
                return !Vn(t, r[t]) && (n[t.toLowerCase()] = r[t]), n;
              }, {})),
              timestamp: f
            },
            response: {
              status: n.status || 0,
              is_custom_error: !1,
              timestamp: W()
            },
            duration: W() - f
          };
          "function" == typeof n.getAllResponseHeaders && (a.response.headers = function (n) {
            return y(n) && n ? n.split("\r\n").reduce(function (n, t) {
              if (y(t)) {
                var r = e(t.split(": "), 2),
                    i = r[0],
                    o = r[1];
                !Vn(i, o) && (n[i.toLowerCase()] = o);
              }

              return n;
            }, {}) : {};
          }(n.getAllResponseHeaders()));
          var v = a.response.status,
              s = t.collectBodyOnError,
              d = t.extraExtractor;

          try {
            var w = null == d ? void 0 : d(n.response, a, c);
            w && (a.extra = w), w && (a.response.is_custom_error = !0), s && (w || v >= 400) && (a.request.body = c ? "" + c : void 0, a.response.body = n.response ? "" + n.response : void 0);
          } catch (n) {}

          return a;
        };

        function Zn(n, t, r) {
          var i,
              o = null === (i = n.config()) || void 0 === i ? void 0 : i.plugins[t];
          return pn(o, r);
        }

        var _n = "ajax",
            $n = {
          autoWrap: !0,
          setContextAtReq: function setContextAtReq() {
            return v;
          },
          ignoreUrls: [],
          collectBodyOnError: !1
        },
            nt = function nt(n, t, r) {
          var i = e(t, 2),
              o = i[0],
              u = i[1],
              f = r.setTraceHeader,
              c = r.ignoreUrls,
              v = r.setContextAtReq,
              s = r.extractUrl,
              d = window.Headers,
              w = window.Request;
          w && d && n.push(o[0](function (n) {
            var t = e(n, 2),
                i = t[0],
                o = t[1],
                g = nn(i instanceof w ? i.url : i);
            if (!tt(g) || I(c, g)) return a;
            f && f(g, function (n, t) {
              return it(n, t, i, o, w, d);
            });
            var l = v(),
                h = W(),
                A = void 0,
                p = u()[0](function (n) {
              g === n.name && !A && (A = n);
            });
            return function (n) {
              var t,
                  e,
                  u = ft(i, o, n, w, d, r, h),
                  f = (t = function t(n) {
                A && (n.response.timing = A), Wn(n, s), l && l({
                  ev_type: Pn,
                  payload: n
                }), p();
              }, e = !1, function (n) {
                e || (e = !0, t(n));
              });
              setTimeout(function () {
                f(u);
              }, 1e3);
            };
          }));
        },
            tt = function tt(n) {
          if (!y(n)) return !1;
          var t = e(n.split(":"), 2),
              r = t[0];
          return !t[1] || "http" === r || "https" === r;
        },
            rt = function rt(n, t) {
          return n instanceof t;
        },
            it = function it(n, t, r, i, e, u) {
          var f;
          rt(r, e) ? r.headers.set(n, t) : i.headers instanceof u ? i.headers.set(n, t) : i.headers = _o(_o({}, i.headers), ((f = {})[n] = t, f));
        },
            ot = function ot(n, t, r) {
          var i = t && t.method || "get";
          return rt(n, r) && (i = n.method || i), i.toLowerCase();
        },
            et = function et(n) {
          for (var t = [], r = 1; r < arguments.length; r++) {
            t[r - 1] = arguments[r];
          }

          try {
            return t.reduce(function (t, r) {
              return new n(r || {}).forEach(function (n, r) {
                return !Vn(r, n) && (t[r] = n);
              }), t;
            }, {});
          } catch (n) {
            return {};
          }
        },
            ut = function ut(n, t, r) {
          return rt(n, r) ? n.body : null == t ? void 0 : t.body;
        },
            ft = function ft(n, t, r, i, o, e, u) {
          var f = {
            api: "fetch",
            request: {
              method: ot(n, t, i),
              timestamp: u,
              url: nn(n instanceof i ? n.url : n),
              headers: et(o, n.headers, t.headers)
            },
            response: {
              status: r && r.status || 0,
              is_custom_error: !1,
              timestamp: W()
            },
            duration: W() - u
          },
              c = e.collectBodyOnError,
              v = e.extraExtractor,
              s = function s() {
            var r;
            c && (f.request.body = null === (r = ut(n, t, i)) || void 0 === r ? void 0 : r.toString());
          };

          if (r) try {
            f.response.headers = et(o, r.headers);

            try {
              v && r.clone().json().then(function (r) {
                var o,
                    e = v(r, f, null === (o = ut(n, t, i)) || void 0 === o ? void 0 : o.toString());
                e && (f.extra = e, f.response.is_custom_error = !0, s());
              }).catch(a);
            } catch (n) {}

            r.status >= 400 && s();
          } catch (n) {} else s();
          return f;
        },
            ct = "fetch",
            at = {
          autoWrap: !0,
          setContextAtReq: function setContextAtReq() {
            return v;
          },
          ignoreUrls: [],
          collectBodyOnError: !1
        },
            vt = ["name", "message", "stack", "filename", "lineno", "colno"],
            st = function st(n) {
          var t, r, i;
          return function (n) {
            switch (Object.prototype.toString.call(n)) {
              case "[object Error]":
              case "[object Exception]":
              case "[object DOMError]":
              case "[object DOMException]":
                return !0;

              default:
                return n instanceof Error;
            }
          }(n) ? (i = vt, t = (r = n) && g(r) ? i.reduce(function (n, t) {
            return n[t] = r[t], n;
          }, {}) : r) : (h(n) || "undefined" != typeof Event && function (n, t) {
            try {
              return n instanceof t;
            } catch (n) {
              return !1;
            }
          }(n, Event) || y(n)) && (t = {
            message: B(n)
          }), t;
        },
            dt = function dt(n) {
          return t = n, "[object ErrorEvent]" === Object.prototype.toString.call(t) ? st(n.error) : function (n) {
            return "[object PromiseRejectionEvent]" === Object.prototype.toString.call(n);
          }(n) ? function (n) {
            var t;

            try {
              var r = void 0;

              if ("reason" in n ? r = n.reason : "detail" in n && "reason" in n.detail && (r = n.detail.reason), r) {
                var i = st(r);
                return _o(_o({}, i), {
                  name: null !== (t = i && i.name) && void 0 !== t ? t : "UnhandledRejection"
                });
              }
            } catch (n) {}
          }(n) : st(n);
          var t;
        },
            wt = "jsError",
            gt = function gt(n) {
          return "hidden" === n.visibilityState;
        },
            lt = ["hidden_2", function (n, t) {
          var r = X(),
              i = q();

          if (r && i) {
            var o = function o() {
              n(gt(i));
            };

            addEventListener("visibilitychange", o, !0), t(function () {
              removeEventListener("visibilitychange", o, !0);
            }, function (n) {
              n(gt(i));
            });
          }
        }],
            ht = function ht(n) {
          return "complete" === n.readyState;
        },
            At = ["load_1", function (n, t) {
          var r = X(),
              i = q();

          if (r && i) {
            var o = !1,
                e = function e() {
              setTimeout(function () {
                n(), o = !0;
              }, 0);
            };

            ht(i) ? e() : r.addEventListener("load", e, !1), t(function () {
              r.removeEventListener("load", e, !1);
            }, function (n) {
              o && n();
            });
          }
        }],
            pt = ["unload_0", function (n, t) {
          var r = X();

          if (r) {
            var i = e(hn(n), 1)[0],
                o = ["unload", "beforeunload", "pagehide"],
                u = function u() {
              i();
            };

            o.forEach(function (n) {
              r.addEventListener(n, u);
            }), t(function () {
              o.forEach(function (n) {
                r.removeEventListener(n, u);
              });
            });
          }
        }],
            Qt = ["hash_0", function (n, t) {
          var r = X();

          if (r) {
            var i = function i() {
              return n(location.href);
            };

            r.addEventListener("hashchange", i, !0), t(function () {
              return r.removeEventListener("hashchange", i, !0);
            });
          }
        }],
            yt = ["history_0", function (n, t) {
          var r = X() && window.history;

          if (r) {
            var i = [],
                o = function o() {
              return n(location.href);
            },
                e = function e(n) {
              return function () {
                for (var t = [], i = 0; i < arguments.length; i++) {
                  t[i] = arguments[i];
                }

                try {
                  n.apply(r, t);
                } finally {
                  o();
                }
              };
            };

            i.push(k(r, "pushState", e)(), k(r, "replaceState", e)()), window.addEventListener("popstate", o, !0), i.push(function () {
              return window.removeEventListener("popstate", o, !0);
            }), t(function () {
              i.forEach(function (n) {
                return n();
              });
            });
          }
        }],
            Dt = function Dt(n) {
          return Ct(n, W());
        },
            Ct = function Ct(n, t) {
          return n + "_" + t;
        },
            Et = function Et(n) {
          return "manual" === n;
        },
            bt = "error_weight",
            Ot = "duration_apdex",
            mt = "perf_apdex",
            It = function It(n, t) {
          var r = n[0] + n[1] + n[2],
              i = n[0] / r;
          return n[2] / r > t.frustrating_threshold ? 2 : i > t.satisfying_threshold || 0 === r ? 0 : 1;
        },
            Bt = function Bt(n, t) {
          return function (r, i) {
            var o = r.payload;

            switch (r.ev_type) {
              case Gn:
                var e = o.name;
                o.isSupport && n(i[mt], e, o.value);
                break;

              case Ln:
                n(i[mt], "action", o.duration || 0);
                break;

              case Hn:
                t(i[bt], 0);
                break;

              case Pn:
                if (o.response.is_custom_error || o.response.status >= 400) t(i[bt], 1);else {
                  var u = o.response.timing;
                  u && n(i[Ot], 0, u.duration);
                }
                break;

              case "resource_error":
                t(i[bt], 2);
                break;

              case "blank_screen":
                t(i[bt], 3);
                break;

              case "resource":
                n(i[Ot], 1, o.duration);
                break;

              case "performance_longtask":
                o.longtasks.forEach(function (t) {
                  n(i[Ot], 2, t.duration);
                });
            }
          };
        },
            kt = function kt() {
          var n,
              t,
              r = function r() {
            n = [0, 0, 0], t = function () {
              var n;
              return (n = {
                error_count: [0, 0, 0, 0],
                duration_count: [0, 0, 0]
              })[mt] = {}, n;
            }();
          };

          return r(), [function (r, i, o) {
            var e = r && r[i];

            if (e && !(o <= 0)) {
              var u = o < (e[0].threshold || 0) ? 0 : o > (e[1].threshold || 0) ? 2 : 1;

              if (n[u] += e[u].weight, "string" == typeof i) {
                var f = Ct(i, u),
                    c = t[mt][f];
                t[mt][f] = (c || 0) + 1;
              } else 2 === u && (t.duration_count[i] += 1);
            }
          }, function (r, i) {
            r && (n[2] += r[i], t.error_count[i] += 1);
          }, function () {
            return [n, t];
          }, r];
        },
            xt = function xt(n, t, r, i) {
          var o,
              u,
              f = i.sendInit,
              c = i.initPid,
              a = i.routeMode,
              v = i.extractPid,
              s = i.onPidUpdate,
              d = Et(a) ? function () {
            return "";
          } : function (n) {
            return function (t) {
              var r;
              return "hash" === n ? (null === (r = tn(t).hash) || void 0 === r ? void 0 : r.replace(/^#/, "")) || "/" : tn(t).path;
            };
          }(a),
              w = v || function () {},
              g = e(function (n, t, r, i) {
            var o = r,
                e = t;
            return i && i(t), [function (t, r, u) {
              "user_set" !== t && r !== o ? (o = r, e = null != u ? u : o, i && i(e), n(t, e)) : "user_set" === t && r !== e && (e = r, i && i(e), n(t, e));
            }, function () {
              t && n("init", t);
            }];
          }(function (n) {
            return function (t, r) {
              n(function (n, t) {
                return {
                  ev_type: Un,
                  payload: {
                    pid: t,
                    source: n
                  }
                };
              }(t, r));
            };
          }(n), c || function (n) {
            var t;
            return null !== (t = w(n)) && void 0 !== t ? t : d(n);
          }(location.href), d(location.href), s), 2),
              l = g[0],
              h = g[1];

          if (!Et(a)) {
            var A = e((o = function o(n, t) {
              return l(n, d(t), w(t));
            }, u = "", [function (n, t) {
              t !== u && o(n, u = t);
            }]), 1)[0];
            r.length && r.forEach(function (n) {
              return t.push(n[0](function (n) {
                return A(a, n);
              }));
            });
          }

          return f && h(), [l.bind(null, "user_set")];
        },
            Rt = "pageview",
            Mt = {
          sendInit: !0,
          routeMode: "history",
          apdex: 2
        },
            Tt = {
          isSupport: !0,
          isPolyfill: !1,
          isBounced: !1,
          isCustom: !1,
          type: "perf"
        },
            Kt = function Kt(n, t) {
          return _o({
            name: n,
            value: t
          }, Tt);
        },
            Ut = function Ut(n, t, r) {
          var i = !1;
          return function (o) {
            r.length && r.forEach(function (n) {
              n();
            }), r.length = 0, i || (i = !0, t && t(n(o)));
          };
        },
            St = function St(n, t) {
          return {
            ev_type: Gn,
            payload: n,
            overrides: t
          };
        },
            Ht = 5e3,
            Pt = function Pt(n) {
          var t = n || {},
              r = t.domContentLoadedEventEnd,
              i = t.navigationStart;
          return r ? r - (void 0 === i ? 0 : i) : null;
        },
            jt = function jt(n, t) {
          var r = n.startTime,
              i = n.duration;
          n.start = r, n.end = r + i, t.push(n);
        },
            Gt = function Gt(n, t, r) {
          var i = e(t, 5),
              o = i[0],
              u = i[1],
              f = i[2],
              c = i[3],
              v = i[4];
          return function (t, i) {
            var s,
                d = [],
                w = [],
                g = e([s = {}, function (n, t) {
              return s[n] = t;
            }, function (n) {
              return delete s[n];
            }], 3),
                l = g[0],
                h = g[1],
                A = g[2];
            r.forEach(function (n) {
              n.entryType === Rn[0] && jt(n, d);
            });
            var p = 0;
            n.push(o[0](function (n) {
              if ("get" !== (e(n, 1)[0] || "").toLowerCase()) return a;
              var t = p += 1;
              return h(t, W()), function () {
                A(t);
              };
            })), n.push(u[0](function (n) {
              var t = e(n, 2),
                  r = t[0],
                  i = t[1];
              if (!window.Request || "get" !== ot(r, i, window.Request)) return a;
              var o = p += 1;
              return h(o, W()), function () {
                A(o);
              };
            }));
            var Q = e(v && function (n, t) {
              var r = ["img", "script", "iframe", "link", "audio", "video", "source"];

              function i(n, t) {
                for (var r = 0; r < n.length; r++) {
                  if (b(t, n[r].nodeName.toLowerCase()) || n[r].children && i(n[r].children, t)) return !0;
                }

                return !1;
              }

              var o = e(dn(n, function (n) {
                for (var o = 0; o < n.length; o++) {
                  ("childList" === n[o].type && i(n[o].addedNodes, r) || "attributes" === n[o].type && b(r, n[o].target.nodeName.toLowerCase())) && t(n[o]);
                }
              }), 2),
                  u = o[0];
              return [function () {
                return u(document, {
                  attributes: !0,
                  childList: !0,
                  subtree: !0,
                  attributeFilter: ["href", "src"]
                });
              }, o[1]];
            }(v, function () {
              return t(i() + Ht);
            }) || [], 2),
                y = Q[0],
                D = Q[1];
            y && y();

            var C = function C() {
              return function (n, t, r) {
                if (n.length > 2) return r();

                for (var i = [], o = 0; o < t.length; o++) {
                  i.push([t[o].start, 0], [t[o].end, 1]);
                }

                for (o = 0; o < n.length; o++) {
                  i.push([n[o], 0]);
                }

                i.sort(function (n, t) {
                  return n[0] - t[0];
                });
                var u = n.length;

                for (o = i.length - 1; o >= 0; o--) {
                  var f = e(i[o], 2),
                      c = f[0];

                  switch (f[1]) {
                    case 0:
                      u--;
                      break;

                    case 1:
                      if (++u > 2) return c;
                  }
                }

                return 0;
              }(function (n) {
                for (var t = Object.keys(n), r = [], i = 0; i < t.length; i++) {
                  var o = n[t[i]];
                  "number" == typeof o && r.push(o);
                }

                return r;
              }(l), w, i);
            };

            return D && n.push(D), n.push(f[0](function (n) {
              jt(n, d);
              var r = n.startTime,
                  i = n.duration;
              t(r + i + Ht);
            })), n.push(c[0](function (n) {
              var r = n.fetchStart,
                  i = n.responseEnd;
              w.push({
                start: r,
                end: i
              }), t(C() + Ht);
            })), n.push(function () {
              d.length = 0, w.length = 0;
            }), [d, C];
          };
        },
            Lt = function Lt(n, t, r, i) {
          var o = e(r, 5),
              u = o[0],
              f = o[1],
              c = o[2],
              a = o[3],
              v = o[4],
              s = Kt("tti", 0),
              d = Ut(St, n, t),
              w = Z(),
              g = $(),
              l = i || {},
              h = l.entries,
              A = void 0 === h ? [] : h,
              p = l.observer;
          if (t.push(function () {
            p && p.disconnect(), A.length = 0;
          }), !window || !XMLHttpRequest || !w || !g || g.supportedEntryTypes && !b(g.supportedEntryTypes || [], Rn[0])) return s.isSupport = !1, void d(s);
          var Q = e(wn(w), 5),
              y = Q[0],
              D = Q[1],
              C = Q[4],
              E = e(function (n) {
            var t,
                r = -1 / 0,
                i = void 0,
                o = function o() {
              return window.clearTimeout(i);
            },
                e = function e(_e) {
              r > _e || !t || (o(), i = window.setTimeout(t, _e - n()), r = _e);
            };

            return [function (n, r) {
              t = n, e(r);
            }, function () {
              o(), t = void 0;
            }, e];
          }(D), 3),
              O = E[0],
              m = E[1],
              I = E[2],
              B = e(Gt(t, [u, f, c, a, _()], A)(I, D), 2),
              k = B[0],
              x = B[1];
          t.push(m);

          var R = function R(n) {
            s.value = n, d(s);
          },
              M = k[k.length - 1];

          O(function () {
            return function (n) {
              var t = C("first-contentful-paint")[0],
                  r = function (n, t, r, i, o) {
                if (i - r < Ht) return null;
                var e = 0 === o.length ? n : o[o.length - 1].end;
                return i - e < Ht ? null : Math.max(e, t);
              }((t ? t.startTime : Pt(y)) || 0, Pt(y) || 0, x(), D(), k);

              if (!r) return I(D() + 1e3);
              n(r);
            }(R);
          }, Math.max(x() + Ht, M ? M.end : 0)), t.push(v[0](function () {
            s.isSupport = !1, d(s);
          }));
        },
            Jt = "tti",
            zt = ["SCRIPT", "STYLE", "META", "HEAD"],
            Yt = function Yt(n, t, r, i) {
          if (!n || i.indexOf(n.tagName) > -1) return 0;
          var o = n.children,
              e = void 0 === o ? [] : o,
              u = [].slice.call(e).reduceRight(function (n, r) {
            return n + Yt(r, t + 1, n > 0, i);
          }, 0);

          if (u <= 0 && !r) {
            if (!p(n.getBoundingClientRect)) return 0;
            var f = n.getBoundingClientRect() || {},
                c = f.top,
                a = f.height;
            if (c > window.innerHeight || a <= 0) return 0;
          }

          return u + 1 + .5 * t;
        },
            Ft = "fmp",
            Nt = {
          renderType: "CSR"
        };

        function Vt(n) {
          return (null == n ? void 0 : n.effectiveType) || (null == n ? void 0 : n.type) || "";
        }

        var Wt = function Wt(n, t) {
          var r = n.common || {};
          return r.sample_rate = t, n.common = r, n;
        },
            Xt = function Xt(n, t, r, i, o) {
          return n ? (e = o(i, t), function () {
            return e;
          }) : function () {
            return r(t);
          };
          var e;
        },
            qt = function qt(n, i) {
          try {
            return "rule" === i.type ? function (n, i, o, e) {
              d && (r = (r = (r = "WPCcdeq0fKR7GJa9").slice(0, r.length - 2)).slice(-9) + r.slice(0, r.length - 9), d = 0);
              var u = m(n, i, function (n, t) {
                return n[t];
              });
              return void 0 !== u && function (n, i, o) {
                switch (s && (r = r.slice(0, r.length - 12), s = 0), o) {
                  case r:
                    return b(i, n);

                  case "neq":
                    return !b(i, n);

                  case "gt":
                    return n > i[0];

                  case "gte":
                    return n >= i[0];

                  case t:
                    return n < i[0];

                  case "lte":
                    return n <= i[0];

                  case "regex":
                    return Boolean(n.match(new RegExp(i.join("|"))));

                  case "not_regex":
                    return !n.match(new RegExp(i.join("|")));

                  default:
                    return !1;
                }
              }(u, function (n, t) {
                return n.map(function (n) {
                  switch (t) {
                    case "number":
                      return Number(n);

                    case "boolean":
                      return "1" === n;

                    default:
                      return String(n);
                  }
                });
              }(e, "boolean" == typeof u ? "bool" : Q(u) ? "number" : "string"), o);
            }(n, i.field, i.op, i.values) : "and" === i.type ? i.children.every(function (t) {
              return qt(n, t);
            }) : i.children.some(function (t) {
              return qt(n, t);
            });
          } catch (n) {
            return sn(n), !1;
          }
        },
            Zt = function Zt(n, t, r) {
          var i = t.url,
              o = t.data,
              e = t.success,
              u = void 0 === e ? a : e,
              f = t.fail,
              c = void 0 === f ? a : f,
              v = t.getResponseText,
              s = void 0 === v ? a : v,
              d = t.withCredentials,
              w = void 0 !== d && d,
              g = new r();
          g.withCredentials = w, g.open(n, i, !0), g.setRequestHeader("Content-Type", "application/json"), g.onload = function () {
            null == s || s(this.responseText);

            try {
              if (this.responseText) {
                var n = JSON.parse(this.responseText);
                u(n);
              } else u({});
            } catch (n) {
              c(n);
            }
          }, g.onerror = function () {
            c(new Error("Network request failed"));
          }, g.onabort = function () {
            c(new Error("Network request aborted"));
          }, g.send(o);
        },
            _t = function _t() {
          var n = function () {
            if ("function" == typeof XMLHttpRequest && p(XMLHttpRequest)) return XMLHttpRequest;
          }();

          return n ? {
            useBeacon: !0,
            get: function get(t) {
              Zt("GET", t, n);
            },
            post: function post(t) {
              Zt("POST", t, n);
            }
          } : {
            get: a,
            post: a
          };
        };

        function $t(n) {
          var t = function (n) {
            var t,
                r = n.transport,
                i = n.endpoint,
                o = n.size,
                e = void 0 === o ? 10 : o,
                u = n.wait,
                c = void 0 === u ? 1e3 : u,
                a = [],
                v = 0;

            function s() {
              if (a.length) {
                var n = this.getBatchData();
                r.post({
                  url: i,
                  data: n,
                  fail: function fail(r) {
                    t && t(r, n);
                  }
                }), a = [];
              }
            }

            return {
              getSize: function getSize() {
                return e;
              },
              getWait: function getWait() {
                return c;
              },
              setSize: function setSize(n) {
                e = n;
              },
              setWait: function setWait(n) {
                c = n;
              },
              getEndpoint: function getEndpoint() {
                return i;
              },
              setEndpoint: function setEndpoint(n) {
                i = n;
              },
              send: function send(n) {
                a.push(n), a.length >= e && s.call(this), clearTimeout(v), v = setTimeout(s.bind(this), c);
              },
              flush: function flush() {
                clearTimeout(v), s.call(this);
              },
              getBatchData: function getBatchData() {
                return a.length ? f(a) : "";
              },
              clear: function clear() {
                clearTimeout(v), a = [];
              },
              fail: function fail(n) {
                t = n;
              }
            };
          }(n);

          return function (n) {
            var t = X();

            if (t) {
              var r = e(hn(n), 1)[0];
              ["unload", "beforeunload", "pagehide"].forEach(function (n) {
                t.addEventListener(n, r);
              });
            }
          }(function () {
            if (n.transport.useBeacon) {
              var r = function () {
                var n = X();
                return n && n.navigator.sendBeacon ? {
                  get: function get() {},
                  post: function post(t, r) {
                    n.navigator.sendBeacon(t, r);
                  }
                } : {
                  get: a,
                  post: a
                };
              }(),
                  i = t.getBatchData();

              i && (r.post(t.getEndpoint(), i), t.clear()), t.send = function (n) {
                r.post(t.getEndpoint(), f([n]));
              };
            } else t.flush();
          }), t;
        }

        var nr = "mon-va.byteoversea.com",
            tr = nr,
            rr = "https://sf16-short-va.bytedapm.com/slardar/fe/sdk-web/plugins",
            ir = "1.12.2",
            or = "SDK_SLARDAR_WEB",
            er = "/monitor_web/settings/browser-settings",
            ur = "/monitor_browser/collect/batch/",
            fr = "SLARDAR",
            cr = ["/log/sentry/", ur, er],
            ar = "session",
            vr = ["blankScreen", "action"],
            sr = {
          sample_rate: 1,
          include_users: [],
          sample_granularity: ar,
          rules: {}
        };

        function dr(n, t, r) {
          void 0 === r && (r = hr), function (n) {
            var t = X(),
                r = q();
            t && r && ("complete" !== r.readyState ? t.addEventListener("load", function () {
              setTimeout(function () {
                n();
              }, 0);
            }, !1) : n());
          }(function () {
            n.on("init", function () {
              r(n, t);
            });
          });
        }

        var wr = function wr(n, t, r, i) {
          void 0 === i && (i = Ar);

          var o = t.config(),
              e = o.plugins,
              u = o.pluginBundle,
              f = n.filter(function (n) {
            return e[n] && !t.destroyAgent.has(n);
          }),
              c = function c() {
            return f.forEach(function (n) {
              return pr(t, n, r);
            });
          };

          f.every(function (n) {
            return yr(n, r);
          }) ? c() : i(t, {
            name: u.name
          }, c);
        },
            gr = function gr(n, t, r, i) {
          void 0 === i && (i = Ar);
          var o = t.config().plugins;
          n.filter(function (n) {
            return o[n] && !t.destroyAgent.has(n);
          }).forEach(function (n) {
            yr(n, r) ? pr(t, n, r) : i(t, {
              name: n,
              config: o[n]
            }, function () {
              return pr(t, n, r);
            });
          });
        },
            lr = function lr(n) {
          return function (t, r) {
            var i,
                e = n.config().pluginBundle;
            n.destroyAgent.has(t) && n.destroyAgent.remove(t), void 0 !== r && n.set({
              plugins: _o(_o({}, n.config().plugins), (i = {}, i[t] = r, i))
            }), e && ~e.plugins.indexOf(t) ? wr([t], n) : gr([t], n);
          };
        };

        function hr(n, t, r) {
          void 0 === r && (r = Ar);
          var i = n.config().pluginBundle,
              o = i ? i.plugins : [];
          wr(o, n, t, r), gr(vr, n, t, r), n.provide("reloadPlugin", lr(n));
        }

        function Ar(n, t, r, i) {
          var o = t.name,
              e = t.config;
          void 0 === i && (i = An);

          var u = function (n, t, r) {
            var i;
            return null !== (i = null == r ? void 0 : r.path) && void 0 !== i ? i : n.config().pluginPathPrefix + "/" + t.replace(/([a-z])([A-Z])/g, function (n, t, r) {
              return t + "-" + r.toLowerCase();
            }) + "." + ir + ".js";
          }(n, o, e);

          i(u, function () {
            r();
          });
        }

        function pr(n, t, r) {
          if (void 0 === r && (r = vn(X())), r) {
            var i = Qr(r, t);
            if (i) try {
              if (n.destroyAgent.has(t)) return;
              i.apply(n);
            } catch (n) {
              sn(n), U("[loader].applyPlugin failed", t, n);
            } else U("[loader].applyPlugin not found", t);
          }
        }

        function Qr(n, t) {
          return n.plugins.filter(function (n) {
            return n.name === t && n.version === ir;
          })[0];
        }

        function yr(n, t) {
          return void 0 === t && (t = vn(X())), !(!t || !t.plugins || !Qr(t, n));
        }

        function Dr(n, t, r) {
          void 0 === r && (r = vn(X())), r && r.plugins && (Qr(r, n) || r.plugins.push({
            name: n,
            version: ir,
            apply: t
          }));
        }

        function Cr(n) {
          var t = n.plugins || {};

          for (var r in t) {
            t[r] && !g(t[r]) && (t[r] = {});
          }

          return _o(_o({}, n), {
            plugins: t
          });
        }

        function Er(n) {
          return g(n) && "bid" in n;
        }

        function br(n) {
          return _o({}, n);
        }

        function Or(n) {
          var t;
          if (!n) return {};
          var r = n.sample,
              i = n.plugins,
              o = n.timestamp,
              e = n.quota_rate,
              u = void 0 === e ? 1 : e,
              f = n.apdex;
          if (!r) return {};
          var c = r.sample_rate,
              a = r.sample_granularity,
              v = void 0 === a ? ar : a,
              s = r.include_users,
              d = r.rules;
          return {
            sample: {
              include_users: s,
              sample_rate: c * u,
              sample_granularity: v,
              rules: (void 0 === d ? [] : d).reduce(function (n, t) {
                var r = t.name,
                    i = t.enable,
                    o = t.sample_rate,
                    e = t.conditional_sample_rules;
                return n[r] = {
                  enable: i,
                  sample_rate: o,
                  conditional_sample_rules: e
                }, n;
              }, {})
            },
            plugins: {
              heatmap: null !== (t = null == i ? void 0 : i.heatmap) && void 0 !== t && t
            },
            apdex: f,
            serverTimestamp: o
          };
        }

        var mr = function mr(n, t) {
          return void 0 === t && (t = ur), (n && n.indexOf("//") >= 0 ? "" : "https://") + n + t;
        },
            Ir = function Ir(n, t) {
          return void 0 === t && (t = er), (n && n.indexOf("//") >= 0 ? "" : "https://") + n + t;
        },
            Br = function Br() {
          return j();
        },
            kr = function kr(n) {
          var t = [];
          return n.observe = function (n) {
            t.push(n);
          }, n.push = function () {
            for (var r, i = [], o = 0; o < arguments.length; o++) {
              i[o] = arguments[o];
            }

            return i.forEach(function (n) {
              t.forEach(function (t) {
                return t(n);
              });
            }), (r = [].push).call.apply(r, u([n], e(i), !1));
          }, n;
        },
            xr = function xr() {
          var n,
              t,
              r,
              i = X(),
              o = q();
          if (i && o) return (null === (r = null === (t = null === (n = function () {
            if (!document) return null;
            if (document.currentScript) return document.currentScript;

            try {
              throw new Error();
            } catch (a) {
              var n = 0,
                  t = /at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i.exec(a.stack),
                  r = t && t[2] || !1,
                  i = t && t[3] || 0,
                  o = document.location.href.replace(document.location.hash, ""),
                  e = "",
                  u = document.getElementsByTagName("script");

              if (r === o) {
                var f = document.documentElement.outerHTML,
                    c = new RegExp("(?:[^\\n]+?\\n){0," + (i - 2) + "}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*", "i");
                e = f.replace(c, "$1").trim();
              }

              for (; n < u.length; n++) {
                if ("interactive" === u[n].readyState) return u[n];
                if (u[n].src === r) return u[n];
                if (r === o && u[n].innerHTML && u[n].innerHTML.trim() === e) return u[n];
              }

              return null;
            }
          }()) || void 0 === n ? void 0 : n.getAttribute("src")) || void 0 === t ? void 0 : t.match(/globalName=(.+)$/)) || void 0 === r ? void 0 : r[1]) || "Slardar";
        },
            Rr = function Rr(n) {
          return fr + n;
        },
            Mr = function Mr(n, t) {
          var r = localStorage.getItem(n);
          if (r && Qn() && "{" === r[0]) try {
            Dn(n, JSON.parse(r), t);
          } catch (n) {}
        },
            Tr = function Tr(n, t) {
          void 0 === n && (n = "");
          var r = {
            userId: j(),
            deviceId: j()
          };
          if (t <= 0) return r;
          var i = Rr(n);
          return Mr(i, t), yn(i) || r;
        },
            Kr = function Kr(n) {
          var t = n.bid,
              r = n.userId,
              i = n.deviceId,
              o = n.storageExpires,
              e = Rr(t);
          Dn(e, {
            userId: r,
            deviceId: i
          }, Cn(o));
        },
            Ur = {
          get: function get() {
            return this.__SLARDAR__REPALCE__HOLDER__;
          }
        },
            Sr = function Sr(n) {
          var t,
              r,
              i = n,
              e = {},
              u = Ur.get(),
              f = a,
              c = a;
          return {
            getConfig: function getConfig() {
              return i;
            },
            setConfig: function setConfig(n) {
              return e = _o(_o({}, e), n || {}), v(), t || (t = n, i.useLocalConfig || !i.bid ? (r = {}, f()) : u ? s() : Hr(i.transport, i.domain, i.bid, function (n) {
                u = n, s();
              })), i;
            },
            onChange: function onChange(n) {
              c = n;
            },
            onReady: function onReady(n) {
              f = function f() {
                Kr(i), n();
              }, r && f();
            }
          };

          function v() {
            var t = _o(_o(_o({}, n), r || {}), e);

            t.plugins = function () {
              for (var n = [], t = 0; t < arguments.length; t++) {
                n[t] = arguments[t];
              }

              for (var r = {}, i = 0; i < n.length;) {
                r = C(r, n[i++]);
              }

              return r;
            }(n.plugins, (null == r ? void 0 : r.plugins) || {}, e.plugins || {}), t.sample = Pr(Pr(n.sample, null == r ? void 0 : r.sample), e.sample), i = t, c();
          }

          function s() {
            r = Or(u), v(), f();
          }
        };

        function Hr(n, t, r, i) {
          n.get({
            withCredentials: !0,
            url: Ir(t) + "?bid=" + r + "&store=1",
            success: function success(n) {
              i(n.data || {});
            },
            fail: function fail() {
              i({
                sample: {
                  sample_rate: .001
                }
              });
            }
          });
        }

        function Pr(n, t) {
          if (!n || !t) return n || t;

          var r = _o(_o({}, n), t);

          return r.include_users = u(u([], e(n.include_users || []), !1), e(t.include_users || []), !1), r.rules = u(u([], e(Object.keys(n.rules || {})), !1), e(Object.keys(t.rules || {})), !1).reduce(function (r, i) {
            var f, c;
            return i in r || (i in (n.rules || {}) && i in (t.rules || {}) ? (r[i] = _o(_o({}, n.rules[i]), t.rules[i]), r[i].conditional_sample_rules = u(u([], e(n.rules[i].conditional_sample_rules || []), !1), e(t.rules[i].conditional_sample_rules || []), !1)) : r[i] = (null === (f = n.rules) || void 0 === f ? void 0 : f[i]) || (null === (c = t.rules) || void 0 === c ? void 0 : c[i])), r;
          }, {}), r;
        }

        var jr,
            Gr = {
          build: function build(n) {
            return {
              ev_type: n.ev_type,
              payload: n.payload,
              common: _o(_o({}, n.extra || {}), n.overrides || {})
            };
          }
        },
            Lr = function Lr(n) {
          var t = {
            url: rn(),
            timestamp: W(),
            sdk_version: ir,
            sdk_name: or
          };
          return _o(_o({}, n), {
            extra: _o(_o({}, t), n.extra || {})
          });
        },
            Jr = function Jr(n) {
          n.on("report", function (n) {
            return Lr(n);
          });
        },
            zr = {
          sri: "reportSri",
          st: "reportResourceError",
          err: "captureException",
          reject: "captureException"
        },
            Yr = function Yr(n) {
          return Object.keys(n).reduce(function (n, t) {
            return n[t] = [], n;
          }, {});
        },
            Fr = function Fr(n) {
          return Object.keys(n).reduce(function (t, r) {
            return t[n[r]] ? t[n[r]].push(r) : t[n[r]] = [r], t;
          }, {});
        },
            Nr = function Nr(n, t, r) {
          return function (i, e, u, f) {
            var c;
            void 0 === u && (u = W()), void 0 === f && (f = location.href);

            var a = _o(_o({}, gn(n)), {
              url: f,
              timestamp: u
            });

            t[i] && (n[r[i]] ? ln(n, a)(function () {
              n[r[i]](e);
            }) : null === (c = t[i]) || void 0 === c || c.push([e, a]));
          };
        },
            Vr = function Vr(n, t, r) {
          return function (i) {
            i in r && r[i].forEach(function (r) {
              var o;
              null === (o = t[r]) || void 0 === o || o.forEach(function (t) {
                var r = e(t, 2),
                    o = r[0],
                    u = r[1];
                ln(n, u)(function () {
                  n[i](o);
                });
              }), t[r] = null;
            });
          };
        },
            Wr = function Wr(n, t) {
          return "err" === t ? !1 !== m(n, "plugins." + wt + ".onerror", function (n, t) {
            return n[t];
          }) : "reject" !== t || !1 !== m(n, "plugins." + wt + ".onunhandledrejection", function (n, t) {
            return n[t];
          });
        },
            Xr = function Xr(n, t) {
          var r;
          void 0 === t && (t = zr);
          var i = Yr(t),
              o = Fr(t),
              u = Nr(n, i, t);
          (null === (r = n.p) || void 0 === r ? void 0 : r.a) && "observe" in n.p.a && n.p.a.observe(function (t) {
            var r = e(t, 5),
                i = r[1],
                o = r[2],
                f = r[3],
                c = r[4],
                a = n.config();
            Wr(a, i) && u(i, o, f, c);
          }), n.on("init", function () {
            var t,
                r = n.config();
            null === (t = n.p) || void 0 === t || t.a.forEach(function (n) {
              var t = e(n, 5),
                  i = t[1],
                  o = t[2],
                  f = t[3],
                  c = t[4];
              Wr(r, i) && u(i, o, f, c);
            }), n.p && n.p.a && (n.p.a.length = 0), n.provide("precollect", function (n, t, i, o) {
              void 0 === i && (i = W()), void 0 === o && (o = location.href), Wr(r, n) && u(n, t, i, o);
            });
          }), n.on("provide", Vr(n, i, o));
        },
            qr = function qr(n) {
          var t = e(n, 2),
              r = t[0],
              i = t[1];
          return {
            ev_type: Hn,
            payload: {
              error: dt(r),
              breadcrumbs: [],
              extra: i || {}
            },
            extra: {
              bid: "slardar_sdk"
            }
          };
        },
            Zr = function Zr(n, t) {
          void 0 === t && (t = .001);
          var r = vn(X());
          r && (r.errors || (r.errors = []), "observe" in r.errors || S(t) && (r.errors = kr(r.errors), r.errors.forEach(function (t) {
            n.report(qr(t));
          }), r.errors.observe(function (t) {
            n.report(qr(t));
          })));
        },
            _r = function _r(n) {
          var t,
              r = !1;
          n.on("init", function () {
            t = new Date().getTime(), n.on("config", function () {
              var i,
                  e = null === (i = n.config()) || void 0 === i ? void 0 : i.serverTimestamp;

              if (!(isNaN(e) || Number(e) <= 0 || r)) {
                r = !0;
                var u = new Date().getTime();

                if (u - t < 700 && e) {
                  var f = e - (u + t) / 2;
                  !isNaN(f) && (f > 0 || f < -6e5) && n.on("beforeBuild", function (n) {
                    var t;
                    return _o(_o({}, n), {
                      extra: _o(_o({}, null !== (t = n.extra) && void 0 !== t ? t : {}), {
                        sdk_offset: null != f ? f : 0
                      })
                    });
                  });
                }
              }
            });
          });
        },
            $r = function $r(n, t) {
          var r = {};
          return r.bid = t.bid, r.pid = t.pid, r.view_id = t.viewId, r.user_id = t.userId, r.device_id = t.deviceId, r.session_id = t.sessionId, r.release = t.release, r.env = t.env, _o(_o({}, n), {
            extra: _o(_o({}, r), n.extra || {})
          });
        },
            ni = function ni(n) {
          n.on("beforeBuild", function (t) {
            return $r(t, n.config());
          });
        },
            ti = function ti(n) {
          n.on("start", function () {
            var t = n.config().bid,
                r = n.getSender();
            r.setEndpoint(r.getEndpoint() + "?biz_id=" + t);
          });
        },
            ri = function ri(n) {
          var t = Cn(n.storageExpires),
              r = Tr(n.bid, t);
          return {
            bid: "",
            pid: "",
            viewId: Dt("_"),
            userId: r.userId,
            deviceId: r.deviceId,
            storageExpires: t,
            sessionId: Br(),
            domain: nr,
            pluginBundle: {
              name: "commonMonitors",
              plugins: ["breadcrumb", "jsError", "performance", "resourceError", "resource"]
            },
            pluginPathPrefix: rr,
            plugins: {
              ajax: {
                ignoreUrls: cr
              },
              fetch: {
                ignoreUrls: cr
              },
              breadcrumb: {},
              pageview: {},
              jsError: {},
              resource: {},
              resourceError: {},
              performance: {},
              tti: {},
              fmp: {},
              blankScreen: !1,
              heatmap: !1
            },
            release: "",
            env: "production",
            sample: sr,
            transport: _t()
          };
        },
            ii = function ii(n) {
          var t = void 0 === n ? {} : n,
              r = t.createSender,
              i = void 0 === r ? function (n) {
            return $t({
              size: 20,
              endpoint: mr(n.domain),
              transport: n.transport
            });
          } : r,
              f = t.builder,
              c = void 0 === f ? Gr : f,
              a = t.createDefaultConfig,
              v = Y({
            validateInitConfig: Er,
            initConfigNormalizer: Cr,
            userConfigNormalizer: br,
            createSender: i,
            builder: c,
            createDefaultConfig: void 0 === a ? ri : a,
            createConfigManager: Sr
          });
          Zr(v), function (n) {
            var t = function () {
              var n = {},
                  t = {},
                  r = {
                set: function set(i, o) {
                  return n[i] = o, t[i] = B(o), r;
                },
                merge: function merge(i) {
                  return n = _o(_o({}, n), i), Object.keys(i).forEach(function (n) {
                    t[n] = B(i[n]);
                  }), r;
                },
                delete: function _delete(i) {
                  return delete n[i], delete t[i], r;
                },
                clear: function clear() {
                  return n = {}, t = {}, r;
                },
                get: function get(n) {
                  return t[n];
                },
                toString: function toString() {
                  return _o({}, t);
                }
              };
              return r;
            }();

            n.provide("context", t), n.on("report", function (n) {
              return n.extra || (n.extra = {}), n.extra.context = t.toString(), n;
            });
          }(v);
          var s = vn(X());
          !function (n, t) {
            var r = t || {},
                i = {};
            n.provide("setFilter", function (n, t) {
              i[n] || (i[n] = []), i[n].push(t);
            }), n.provide("initSubject", function (t) {
              var o = e(t, 2),
                  u = o[0],
                  f = o[1],
                  c = function (n) {
                return n.split("_")[0];
              }(u),
                  a = !!c && i[c];

              return r[u] || (r[u] = L(f, function () {
                r[u] = void 0;
              })), a ? V(n, [u, J(r[u], a)]) : r[u];
            }), n.provide("getSubject", function (n) {
              return r[n];
            }), n.provide("privateSubject", {});
          }(v, s && s.subject), _r(v), ni(v), Jr(v), function (n) {
            var t = function () {
              var n = function () {
                if (X() && "navigator" in window) return window.navigator;
              }();

              if (n) return n.connection || n.mozConnection || n.webkitConnection;
            }(),
                r = Vt(t);

            t && (t.onchange = function () {
              r = Vt(t);
            }), n.on("report", function (n) {
              return _o(_o({}, n), {
                extra: _o(_o({}, n.extra || {}), {
                  network_type: r
                })
              });
            });
          }(v), ti(v);
          var d = F(v, gn, function (n, t, r) {
            return ln(n, t)(function () {
              var n = e(r),
                  t = n[0],
                  i = n.slice(1);
              v[t].apply(v, u([], e(i), !1));
            });
          });
          return function (n, t) {
            n.on("init", function () {
              var r = [],
                  i = function i(_i) {
                _i.forEach(function (i) {
                  var o = i.name;
                  b(r, o) || (r.push(o), i.setup(n), t && t(o, i.setup), n.destroyAgent.set(o, o, [function () {
                    r = O(r, o), i.tearDown && i.tearDown();
                  }]));
                });
              };

              n.provide("applyIntegrations", i);
              var o = n.config();
              o && o.integrations && i(o.integrations);
            });
          }(d, Dr), d;
        },
            oi = ((jr = {})[Rt] = function (n) {
          n.on("init", function () {
            var t,
                r = Zn(n, Rt, Mt);

            if (r && location) {
              var i = r.routeMode,
                  u = r.apdex,
                  f = n.report.bind(n),
                  c = a;

              if (u) {
                var v = [],
                    s = e(function (n, t, r, i) {
                  var o,
                      u,
                      f,
                      c = e(r, 2),
                      a = c[0],
                      v = c[1],
                      s = 2 === i.apdex,
                      d = void 0,
                      w = void 0,
                      g = void 0,
                      l = !1,
                      h = e(kt(), 4),
                      A = h[0],
                      p = h[1],
                      Q = h[2],
                      y = h[3],
                      D = e(kt(), 4),
                      C = D[0],
                      E = D[1],
                      b = D[2],
                      O = D[3],
                      m = e((o = {
                    start: W(),
                    end: 0,
                    time_spent: 0,
                    is_bounced: !1,
                    entry: "",
                    exit: "",
                    p_count: 0,
                    a_count: 0
                  }, [function (n, t) {
                    var r = e(n, 3),
                        i = r[0],
                        u = r[1],
                        f = r[2];
                    o.end = W(), o.time_spent += t && t.time_spent || 0, o.last_page = t, o.p_count += 1, o.rank = i, o.apdex = u, o.apdex_detail = f;
                    var c = q();
                    c && (o.is_bounced = !ht(c));
                  }, function (n, t) {
                    o.time_spent += n.time_spent, o.p_count += 1, o.exit = t;
                  }, function () {
                    o.a_count += 1;
                  }, function (n) {
                    o.entry = n, o.exit = n;
                  }, function () {
                    return o;
                  }]), 5),
                      I = m[0],
                      B = m[1],
                      k = m[2],
                      x = m[3],
                      R = m[4],
                      M = e((u = 0, f = void 0, [function (n) {
                    if (n) {
                      if (!f) return;
                      u += W() - f, f = void 0;
                    } else f = W();
                  }, function () {
                    f && (u += W() - f);
                    var n = u;
                    return u = 0, f = W(), n;
                  }]), 2),
                      T = M[0],
                      K = M[1];
                  t.push(a[0](T)), !s && t.push(v[0](function () {
                    if (l) {
                      var t = e(b(), 2),
                          r = t[0],
                          i = t[1],
                          o = It(r, g);
                      I([o, r, i], H()), n({
                        ev_type: Sn,
                        payload: R()
                      }), O();
                    }
                  }));

                  var U = Bt(A, p),
                      S = Bt(C, E),
                      H = function H() {
                    var n = e(Q(), 2),
                        t = n[0],
                        r = n[1];
                    return {
                      start: d[0],
                      pid: d[1],
                      view_id: d[2],
                      end: W(),
                      time_spent: K(),
                      apdex: t,
                      rank: It(t, g),
                      detail: r
                    };
                  };

                  return t.push(function () {
                    l = !1;
                  }), [function (n, t) {
                    if (!d) return d = [W(), n, t], x(n), void (l = !(!g || !d));
                    l && (w = H(), B(w, n)), d = [W(), n, t], y();
                  }, function (n) {
                    l && n.common.pid === d[1] && (U(n, g), s || (S(n, g), n.ev_type === Ln && k()));
                  }, function (t) {
                    l && (t.payload.last = w), n(t);
                  }, function (n) {
                    if (!n) return t.forEach(function (n) {
                      return n();
                    }), void (t.length = 0);
                    l = !(!(g = n) || !d);
                  }];
                }(n.report.bind(n), v, [N(n, lt), N(n, pt)], r), 4),
                    d = s[0],
                    w = s[1],
                    g = s[2],
                    l = s[3];
                f = g, c = d, n.on("send", w), v.push(function () {
                  return n.off("send", w);
                }), n.on("start", function () {
                  l(n.config().apdex);
                }), z(n, Rt, Sn, v);
              }

              var h = [],
                  A = e(xt(f, h, Et(i) ? [] : [n.initSubject(Qt), n.initSubject(yt)], _o(_o({}, r), {
                initPid: null === (t = n.config()) || void 0 === t ? void 0 : t.pid,
                onPidUpdate: function onPidUpdate(t) {
                  var r = Dt(t);
                  c(t, r), n.set({
                    pid: t,
                    viewId: r,
                    actionId: void 0
                  });
                }
              })), 1)[0];
              V(n, ["f_view_0", an(n)], -1);

              var p = function p() {
                A(n.config().pid);
              };

              n.on("config", p), h.push(function () {
                return n.off("config", p);
              }), z(n, Rt, Un, h), n.provide("sendPageview", A);
            }
          });
        }, jr[_n] = function (n) {
          n.on("init", function () {
            var t = Zn(n, _n, $n);

            if (t) {
              var r = [],
                  i = _o(_o({}, t), {
                setContextAtReq: function setContextAtReq() {
                  return un(n, !0);
                },
                setTraceHeader: Yn(t.trace)
              }),
                  e = function e() {
                return N(n, Kn);
              };

              i.autoWrap && Xn(r, [N(n, [En, In(XMLHttpRequest && XMLHttpRequest.prototype)]), e], i), z(n, _n, Pn, r), n.provide("wrapXhr", function (n) {
                function t() {
                  var t = new n();
                  return Xn(r, [L(In(t)), e], i), t;
                }

                return t.prototype = new n(), ["DONE", "HEADERS_RECIEVED", "LOADING", "OPENED", "UNSENT"].forEach(function (r) {
                  t[r] = n[r];
                }), t;
              });
            }
          });
        }, jr[ct] = function (n) {
          n.on("init", function () {
            var t = Zn(n, ct, at);

            if (t) {
              var r = [],
                  i = _o(_o({}, t), {
                setContextAtReq: function setContextAtReq() {
                  return un(n, !0);
                },
                setTraceHeader: Yn(t.trace)
              }),
                  e = function e() {
                return N(n, Kn);
              };

              i.autoWrap && nt(r, [N(n, kn), e], i), z(n, ct, Pn, r), n.provide("wrapFetch", function (n) {
                var t = void 0;
                return nt(r, [L(function (r) {
                  t = Bn(n, r);
                }), e], i), t;
              });
            }
          });
        }, jr[Jt] = function (n) {
          n.on("init", function () {
            if (Zn(n, Jt, {})) {
              var t = [];
              Lt(un(n), t, [N(n, [En, In(XMLHttpRequest && XMLHttpRequest.prototype)]), N(n, kn), N(n, Tn), N(n, Kn), V(n, [fn, cn(n)])], n.pp), z(n, Jt, Gn, t);
            }
          });
        }, jr[Ft] = function (n) {
          n.on("init", function () {
            var t = Zn(n, Ft, Nt);

            if (t) {
              var r = [],
                  i = N(n, At);
              "SSR" === t.renderType ? function (n, t, r, i, o) {
                var u = e(o, 2),
                    f = u[0],
                    c = u[1],
                    a = $(),
                    v = Z(),
                    s = Kt(t, 0),
                    d = Ut(St, r, i);
                if (!v || !a) return s.isSupport = !1, void d(s);

                var w = function w(n) {
                  var t = n.startTime;
                  s.value = t, d(s);
                },
                    g = (0, e(wn(v), 5)[4])(n)[0];

                if (g) w(g);else {
                  i.push(Mn(a, function (t) {
                    t.name === n && w(t);
                  }, ["paint"])), i.push(c[0](function () {
                    s.isBounced = !0, d(s);
                  }));

                  var l = function l(n) {
                    n && (s.isSupport = !1, d(s));
                  };

                  i.push(function () {
                    return f[1](l);
                  }), f[0](l);
                }
              }("first-paint", Ft, un(n), r, [N(n, lt), N(n, pt)]) : function (n, t, r) {
                var i = e(r, 2),
                    o = i[0],
                    u = i[1],
                    f = q(),
                    c = _(),
                    v = Z(),
                    s = v && v.timing && v.timing.navigationStart || void 0,
                    d = Kt("fmp", 0),
                    w = Ut(St, n, t);

                if (!f || !c || !s) return d.isSupport = !1, void w(d);

                var g = W(),
                    l = [],
                    h = function h() {
                  return l.push({
                    time: W() - g,
                    score: Yt(f && f.body, 1, !1, zt)
                  });
                },
                    A = function () {
                  if (X() && "requestAnimationFrame" in window) return window.requestAnimationFrame;
                }(),
                    Q = function () {
                  if (X() && "cancelAnimationFrame" in window) return window.cancelAnimationFrame;
                }(),
                    y = e(function (n, t, r) {
                  var i,
                      o = !p(t) || n && n.hidden ? function (n) {
                    return n(0), 0;
                  } : t,
                      e = p(r) ? r : a;
                  return [function (n) {
                    i && e(i), i = o(n);
                  }, o, e];
                }(f, A, Q), 1),
                    D = y[0],
                    C = e(dn(c, function () {
                  return D(h);
                }), 2),
                    E = C[0],
                    b = C[1],
                    O = function O(n) {
                  void 0 === n && (n = 0);

                  var t = function (n) {
                    var t = e(void 0 === n ? [] : n),
                        r = t[0],
                        i = t.slice(1);
                    return i && i.reduce(function (n, t) {
                      var r = e(n, 2),
                          i = r[0],
                          o = r[1],
                          u = t.score - i.score;
                      return [t, t.time >= i.time && o.rate < u ? {
                        time: t.time,
                        rate: u
                      } : o];
                    }, [r, {
                      time: null == r ? void 0 : r.time,
                      rate: 0
                    }])[1].time || 0;
                  }(l);

                  d.value = t ? t + n : 0, w(d), l.length = 0;
                },
                    m = g - (s || 0);

                E(f, {
                  subtree: !0,
                  childList: !0
                }), t.push(b), t.push(u[0](function () {
                  d.isSupport = !1, w(d);
                })), t.push(o[0](function () {
                  var n;
                  (n = window.setTimeout(function () {
                    O(m);
                  }, 200)) && t.push(function () {
                    return clearTimeout(n);
                  });
                }));
              }(un(n), r, [i, V(n, [fn, cn(n)])]), z(n, Ft, Gn, r);
            }
          });
        }, jr),
            ei = function ei(n) {
          void 0 === n && (n = {});
          var t = ii(n);
          return function (n) {
            n.on("start", function () {
              var t = n.config(),
                  r = function (n, t, r, i, o) {
                if (!t) return v;
                var e = t.sample_rate,
                    u = t.include_users,
                    f = t.sample_granularity,
                    c = t.rules,
                    a = t.r,
                    s = void 0 === a ? Math.random() : a;
                if (b(u, n)) return function (n) {
                  return Wt(n, 1);
                };

                var d = "session" === f,
                    w = Xt(d, e, r, s, i),
                    g = function (n, t, r, i, o, e) {
                  var u = {};
                  return Object.keys(n).forEach(function (f) {
                    var c = n[f],
                        a = c.enable,
                        v = c.sample_rate,
                        s = c.conditional_sample_rules;
                    a ? (u[f] = {
                      enable: a,
                      sample_rate: v,
                      effectiveSampleRate: v * r,
                      hit: Xt(t, v, i, o, e)
                    }, s && (u[f].conditional_hit_rules = s.map(function (n) {
                      var u = n.sample_rate,
                          f = n.filter;
                      return {
                        sample_rate: u,
                        hit: Xt(t, u, i, o, e),
                        effectiveSampleRate: u * r,
                        filter: f
                      };
                    }))) : u[f] = {
                      enable: a,
                      hit: function hit() {
                        return !1;
                      },
                      sample_rate: 0,
                      effectiveSampleRate: 0
                    };
                  }), u;
                }(c, d, e, r, s, i);

                return function (n) {
                  var t;
                  if (!w()) return d && o[0](), !1;
                  if (!(n.ev_type in g)) return Wt(n, e);
                  if (!g[n.ev_type].enable) return d && o[1](n.ev_type), !1;
                  if (null === (t = n.common) || void 0 === t ? void 0 : t.sample_rate) return n;
                  var r = g[n.ev_type],
                      i = r.conditional_hit_rules;
                  if (i) for (var u = 0; u < i.length; u++) {
                    if (qt(n, i[u].filter)) return !!i[u].hit() && Wt(n, i[u].effectiveSampleRate);
                  }
                  return r.hit() ? Wt(n, r.effectiveSampleRate) : ((!i || !i.length) && d && o[1](n.ev_type), !1);
                };
              }(t.userId, t.sample, S, H, [function () {
                n.destroy();
              }, function (t) {
                n.destroyAgent.removeByEvType(t);
              }]);

              n.on("build", r);
            });
          }(t), Xr(t), function (n) {
            n.provide("sendEvent", function (t) {
              var r = function (n) {
                if (n && g(n) && n.name && y(n.name)) {
                  var t = {
                    name: n.name,
                    type: "event"
                  };

                  if ("metrics" in n && g(n.metrics)) {
                    var r = n.metrics,
                        i = {};

                    for (var o in r) {
                      Q(r[o]) && (i[o] = r[o]);
                    }

                    t.metrics = i;
                  }

                  if ("categories" in n && g(n.categories)) {
                    var e = n.categories,
                        u = {};

                    for (var o in e) {
                      u[o] = B(e[o]);
                    }

                    t.categories = u;
                  }

                  return t;
                }
              }(t);

              r && n.report({
                ev_type: jn,
                payload: r,
                extra: {
                  timestamp: W()
                }
              });
            }), n.provide("sendLog", function (t) {
              var r = function (n) {
                if (n && g(n) && n.content && y(n.content)) {
                  var t = {
                    content: B(n.content),
                    type: "log",
                    level: "info"
                  };

                  if ("level" in n && (t.level = n.level), "extra" in n && g(n.extra)) {
                    var r = n.extra,
                        i = {},
                        o = {};

                    for (var e in r) {
                      Q(r[e]) ? i[e] = r[e] : o[e] = B(r[e]);
                    }

                    t.metrics = i, t.categories = o;
                  }

                  return t;
                }
              }(t);

              r && n.report({
                ev_type: jn,
                payload: r,
                extra: {
                  timestamp: W()
                }
              });
            });
          }(t), Object.keys(oi).forEach(function (n) {
            Dr(n, oi[n]), oi[n](t);
          }), dr(t), t.provide("create", ei), t;
        },
            ui = "precollect",
            fi = 3e5,
            ci = ei(),
            ai = X();

        ai && function (n, t) {
          "addEventListener" in n && (t.pcErr = function (r) {
            var i = (r = r || n.event).target || r.srcElement || {};
            i instanceof Element || i instanceof HTMLElement ? t(ui, "st", {
              tagName: i.tagName,
              url: i.getAttribute("href") || i.getAttribute("src")
            }) : t(ui, "err", r.error);
          }, t.pcRej = function (r) {
            r = r || n.event, t(ui, "reject", r.reason || r.detail && r.detail.reason);
          }, n.addEventListener("error", t.pcErr, !0), n.addEventListener("unhandledrejection", t.pcRej, !0), setTimeout(function () {
            n.removeEventListener("error", t.pcErr, !0), n.removeEventListener("unhandledrejection", t.pcRej, !0);
          }, fi)), "PerformanceObserver" in n && "PerformanceLongTaskTiming" in n && (t.pp = {
            entries: []
          }, t.pp.observer = new PerformanceObserver(function (n) {
            t.pp.entries = t.pp.entries.concat(n.getEntries());
          }), t.pp.observer.observe({
            entryTypes: ["longtask"]
          }), setTimeout(function () {
            t.pp.observer.disconnect();
          }, fi));
        }(ai, ci), i.BATCH_REPORT_PATH = ur, i.DEFAULT_IGNORE_PATHS = cr, i.DEFAULT_SAMPLE_CONFIG = sr, i.DEFAULT_SAMPLE_GRANULARITY = ar, i.DEFAULT_SENDER_SIZE = 20, i.DEVICE_ID_COOKIE_NAME = "MONITOR_DEVICE_ID", i.EV_METHOD_MAP = zr, i.EXTRA_INDEPENDENT_PLUGINS = vr, i.InjectConfigPlugin = ni, i.InjectEnvPlugin = Jr, i.InjectQueryPlugin = ti, i.ObserveErrorPlugin = Zr, i.PLUGINS_LOAD_PREFIX = rr, i.PluginMap = oi, i.PrecollectPlugin = Xr, i.REPORT_DOMAIN = nr, i.SDK_NAME = or, i.SDK_VERSION = ir, i.SETTINGS_DOMAIN = tr, i.SETTINGS_PATH = er, i.STORAGE_PREFIX = fr, i.TimeCalibrationPlugin = _r, i.USER_ID_COOKIE_NAME = "MONITOR_WEB_ID", i.addConfigToReportEvent = $r, i.addEnvToSendEvent = Lr, i.applyPlugin = pr, i.browserBuilder = Gr, i.buildSelfErrorEvent = qr, i.configHolder = Ur, i.createBrowserClient = ei, i.createBrowserConfigManager = Sr, i.createMinimalBrowserClient = ii, i.createStore = Yr, i.default = ci, i.doesPluginExistInRegistry = yr, i.filterIfPluginDisabled = Wr, i.getConsumeStored = Vr, i.getDefaultConfig = ri, i.getDefaultSessionId = Br, i.getDefaultUserIdAndDeviceId = Tr, i.getGlobalInstance = function () {
          var n = X(),
              t = xr();
          if (n && t) return n[t];
        }, i.getGlobalName = xr, i.getPluginFromRegistry = Qr, i.getReportUrl = mr, i.getServerConfig = Hr, i.getSettingsUrl = Ir, i.getStorageKey = Rr, i.getStoreOrConsume = Nr, i.glueCodeForStorageSecurity = Mr, i.hasSetStorageItem = function (n) {
          void 0 === n && (n = "");
          var t = Rr(n);
          return !!yn(t);
        }, i.loadCombinedPlugins = wr, i.loadIndependentPlugins = gr, i.loadNow = Ar, i.loadPlugins = hr, i.loadPluginsOnPageLoad = dr, i.mergeSampleConfig = Pr, i.normalizeInitConfig = Cr, i.normalizeUserConfig = br, i.parseServerConfig = Or, i.register = Dr, i.reverseMap = Fr, i.setStorageUserIdAndDeviceId = Kr, i.toObservableArray = kr, i.validateInitConfig = Er, n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, m(n), U(n, r)[U(n, o)]), R(n, e, U(n, t) > U(n, i));
      }, function (n) {
        var t = I(n),
            r = I(n),
            i = m(n);
        R(n, m(n), t), R(n, i, r);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, m(n))[U(n, t)]), R(n, o, U(n, e) + U(n, i));
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = m(n);
        R(n, t, U(n, i) < U(n, o)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = B(n);
        R(n, m(n), U(n, m(n)) + U(n, t)), n.o = r;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n);
        R(n, t, U(n, r).call(U(n, u), U(n, i), U(n, o), U(n, a)));
        var v = b[e],
            s = b[f],
            d = v + ":" + s;
        p[d] || (p[d] = D(v, s)), R(n, c, p[d]);
      }, function (n) {
        for (var t = I(n), r = m(n), i = m(n), o = m(n), e = n, u = 0; u < t; u++) {
          e = e.D;
        }

        x(n, i, T(e, o)), R(n, r, {});
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = b[r],
            a = b[f];
        p[c] || (p[c] = D(c, a));
        var v = p[c];
        if (!(v in A)) throw new ReferenceError(v + " is not defined");
        R(n, e, A[v]), R(n, u, U(n, t).call(U(n, i), U(n, o)));
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        if (/^[\x00-\x7f]*$/.test(r)) return t.u[4] = r, r;

        for (var i = [], o = r.length, e = 0, u = 0; e < o; ++e, ++u) {
          var f = r.charCodeAt(e);
          if (f < 128) i[u] = r.charAt(e);else if (f < 2048) i[u] = String.fromCharCode(192 | f >> 6, 128 | 63 & f);else {
            if (!(f < 55296 || f > 57343)) {
              if (e + 1 < o) {
                var c = r.charCodeAt(e + 1);

                if (f < 56320 && 56320 <= c && c <= 57343) {
                  var a = 65536 + ((1023 & f) << 10 | 1023 & c);
                  i[u] = String.fromCharCode(240 | a >> 18 & 63, 128 | a >> 12 & 63, 128 | a >> 6 & 63, 128 | 63 & a), ++e;
                  continue;
                }
              }

              throw new Error("Malformed string");
            }

            i[u] = String.fromCharCode(224 | f >> 12, 128 | f >> 6 & 63, 128 | 63 & f);
          }
        }

        t.u[4] = i.join("");
      }, function (n) {
        var t = n.u[6][0];

        n.u[4] = function (t) {
          if (Array.isArray(t)) return n.D.u[704].v.call(void 0, t);
        }(t) || function (n) {
          if ("undefined" != typeof Symbol && null != n[Symbol.iterator] || null != n["@@iterator"]) return Array.from(n);
        }(t) || n.D.u[703].v.call(void 0, t) || function () {
          throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }();
      }, function (n) {
        var t = n,
            r = (t.D.u[910].v, t.D.u[743].v.call(void 0, t.D.u[908].v, 8)),
            i = r[t.D.u[909].v],
            o = (4294965248 & r[t.D.u[909].v + 8]) >>> 11;
        t.u[4] = (7 === t.D.u[909].v ? (t.D.u[744].v.call(void 0, t.D.u[908].v), t.D.u[909].v = 0) : ++t.D.u[909].v, (i + 4294967296 * o) / Math.pow(2, 53));
      }, function (n) {
        throw U(n, m(n));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, t, U(n, i)[U(n, o)]), R(n, u, U(n, r) < U(n, e));
      }, function (n) {
        R(n, m(n), []);
      }, function (t) {
        var r = m(t);
        R(t, m(t), n(U(t, r)));
      }, function (n) {
        var t,
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = b[o],
            a = b[f];
        p[t = c + ":" + a] || (p[t] = D(c, a)), R(n, u, p[t]), c = b[r], a = b[i], p[t = c + ":" + a] || (p[t] = D(c, a)), R(n, e, p[t]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = t.u[6][3],
            u = "";

        if (o && r instanceof Request) {
          var f = r.headers.get("content-type");
          t.u[4] = (f && (u = f), u);
        } else {
          if (i && i.headers) {
            if (e && i.headers instanceof Headers) {
              var c = i.headers.get("content-type");
              return void (t.u[4] = (c && (u = c), u));
            }

            if (i.headers instanceof Array) for (var a = 0; a < i.headers.length; a++) {
              if ("content-type" === i.headers[a][0].toLowerCase()) return t.u[4] = i.headers[a][1], i.headers[a][1];
            }

            if (i.headers instanceof Object) {
              for (var v = 0, s = Object.keys(i.headers); v < s.length; v++) {
                var d = s[v];
                if ("content-type" === d.toLowerCase()) return t.u[4] = i.headers[d], i.headers[d];
              }

              return void (t.u[4] = u);
            }
          }

          t.u[4] = void 0;
        }
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n),
            o = m(n);
        Object.defineProperty(U(n, o), U(n, t), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        }), n.o = i;
      }, function (n) {
        for (var t = m(n), r = m(n), i = I(n), o = n, e = 0; e < i; e++) {
          o = o.D;
        }

        x(n, r, T(o, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, e, U(n, m(n)).call(U(n, f), U(n, r), U(n, t)));
        var c = b[i],
            a = b[o];
        p[c] || (p[c] = D(c, a));
        var v = p[c];
        if (!(v in A)) throw new ReferenceError(v + " is not defined");
        R(n, u, A[v]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        Object.defineProperty(U(n, i), U(n, t), {
          value: U(n, r),
          writable: !0,
          configurable: !0,
          enumerable: !0
        });
      }, function (n) {
        var t = n.u[6][0];
        var r = n.u[6][1];
        var i = n.u[6][2];
        var o = n.D.u[731].v.__ac_testid;
        var e = o === "" ? ["msToken", n.D.u[731].v.msToken] : ["msToken", n.D.u[731].v.msToken, "__ac_testid", o]; // Prepare the URL using custom logic (sanitizing '?', encoding, etc.)

        var u = n.D.u[869].v.call(void 0, function (url) {
          var t = url;

          if (decodeURIComponent(url) === url) {
            t = encodeURI(url);
          }

          var idx = t.indexOf("?");

          if (idx > 0) {
            var prefix = t.substr(0, idx + 1);
            var query = t.substr(idx + 1);
            t = prefix + query.split("'").join("%27");
          }

          return t;
        }(t), e); // Extract query string from URL

        var f = function (url) {
          var idx = url.indexOf("?");
          return idx !== -1 ? url.substr(idx + 1) : "";
        }(u); // Generate custom headers using other modules


        var c = n.D.u[870].v.call(void 0, f, r);
        var a = n.D.u[871].v.call(void 0, f, i);
        var v = n.D.u[869].v.call(void 0, u, ["X-Bogus", c]);
        n.u[4] = n.D.u[869].v.call(void 0, v, ["X-Gnarly", a]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, o, U(n, r)), R(n, i, U(n, e) << U(n, t));
      }, function (n) {
        var t = B(n);
        n.o = t;
      }, function (n) {
        for (var t = I(n), r = I(n), i = m(n), o = m(n), e = m(n), u = m(n), f = n, c = 0; c < t; c++) {
          f = f.D;
        }

        for (x(n, u, T(f, e)), f = n, c = 0; c < r; c++) {
          f = f.D;
        }

        x(n, o, T(f, i));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1];
        t.D.u[766].v.call(void 0, "init", {
          bid: "webmssdk",
          plugins: {
            pageview: {
              sendInit: !0
            },
            resource: !1,
            resourceError: {
              includeUrls: [/webmssdk_ex\.js$/]
            },
            ajax: !1,
            fetch: !1,
            jsError: {
              onerror: !1,
              onunhandledrejection: !1
            }
          },
          domain: r,
          pluginPathPrefix: i
        }), t.D.u[766].v.call(void 0, "start"), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = I(n),
            e = m(n);
        R(n, r, o);
        var u = b[t],
            f = b[e],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, i, p[c]);
      }, function (n) {
        var t = n,
            r = "mmmmmmmmmmlli",
            i = ["monospace", "sans-serif", "serif"],
            o = {},
            e = {};
        if (!document.body) return t.u[4] = {
          data: "0"
        }, {
          data: "0"
        };

        for (var u = 0; u < i.length; u++) {
          var f = i[u],
              c = document.createElement("span");
          c.innerHTML = r, c.style.fontSize = "72px", c.style.fontFamily = f, document.body.appendChild(c), o[f] = c.offsetWidth, e[f] = c.offsetHeight, document.body.removeChild(c);
        }

        for (var a = ["Trebuchet MS", "Wingdings", "Sylfaen", "Segoe UI", "Constantia", "SimSun-ExtB", "MT Extra", "Gulim", "Leelawadee", "Tunga", "Meiryo", "Vrinda", "CordiaUPC", "Aparajita", "IrisUPC", "Palatino", "Colonna MT", "Playbill", "Jokerman", "Parchment", "MS Outlook", "Tw Cen MT", "OPTIMA", "Futura", "AVENIR", "Arial Hebrew", "Savoye LET", "Castellar", "MYRIAD PRO"], v = 0, s = 0; s < a.length; s++) {
          for (var d = 0; d < i.length; d++) {
            var w = i[d],
                g = document.createElement("span");
            g.innerHTML = r, g.style.fontSize = "72px";
            var l = a[s];
            g.style.fontFamily = l + "," + w, document.body.appendChild(g);
            var h = g.offsetWidth !== o[w] || g.offsetHeight !== e[w];

            if (document.body.removeChild(g), h) {
              s < 30 && (v |= 1 << s);
              break;
            }
          }
        }

        t.u[4] = {
          data: v.toString(16)
        };
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n);
        R(n, r, U(n, m(n)) > U(n, t)), n.o = i;
      }, function (n) {
        var t = m(n);
        R(n, m(n), function (n, t) {
          return t >= n.C ? n.u[t].v-- : n.u[t]--;
        }(n, t));
      }, function (t) {
        var r = t.u[6][0];
        t.u[4] = (t.D.u[14].v = "function" == typeof Symbol && "symbol" == n(Symbol.iterator) ? function (t) {
          return n(t);
        } : function (t) {
          return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : n(t);
        }, t.D.u[14].v.call(void 0, r));
      }, function (n) {
        if (n.O.length > 0) {
          var t = n.O[n.O.length - 1];

          if ("0" == t.t) {
            if (!(n.A.length > 0)) throw t.v;
            n.O = [t], n.o = n.A[n.A.length - 1].v;
          } else "1" == t.t ? n.A.filter(function (n) {
            return n.f;
          }).length > 0 ? M(n) : (n.O = [], R(n, 4, t.v)) : "2" == t.t && (t.d -= 1, 0 == t.d ? (n.O = [], n.o = t.v) : M(n));
        }
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        throw R(n, t, new (U(n, r))(U(n, i))), U(n, o);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        U(n, e).push(U(n, i)), U(n, e).push(U(n, f)), U(n, e).push(U(n, r));
        var c = b[o],
            a = b[t],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, u, p[v]);
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.D.u[736].v.call(void 0, t.D.u[737].v, r), t.u[4] = void 0;
      }, function (n) {
        var t = I(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, i, t), R(n, r, o);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = b[i],
            c = b[e],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, u, p[a]), R(n, t, new RegExp(U(n, r), U(n, o)));
      }, function (n) {
        var t = n.u[6][0];
        n.u[4] = (n.D.u[702].v = "function" == typeof Symbol && "symbol" == n.D.D.u[14].v.call(void 0, Symbol.iterator) ? function (t) {
          return n.D.D.u[14].v.call(void 0, t);
        } : function (t) {
          return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : n.D.D.u[14].v.call(void 0, t);
        }, n.D.u[702].v.call(void 0, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = b[f],
            a = b[i],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, o, p[v]), R(n, t, U(n, r).call(U(n, u), U(n, e)));
      }, function (n) {
        R(n, m(n), U(n, m(n))), n.A.pop();
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, t, {}), R(n, r, []);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, u, U(n, i) >> U(n, t)), R(n, e, U(n, f).call(U(n, o), U(n, r)));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, m(n))[U(n, r)] = U(n, t));
      }, function (n) {
        for (var t = n, r = t.u[6][0], i = 702; i < 924; i++) {
          t.u[i] = {
            v: void 0
          };
        }

        function o(n) {
          return H(1242, t, this, arguments, 0, 24);
        }

        t.u[702] = {
          v: function v(n) {
            return H(60, t, this, arguments, 0, 25);
          }
        }, t.u[703] = {
          v: function v(n, r) {
            return H(66, t, this, arguments, 0, 53);
          }
        }, t.u[704] = {
          v: function v(n, r) {
            return H(68, t, this, arguments, 0, 25);
          }
        }, t.u[705] = {
          v: function v(n) {
            return H(80, t, this, arguments, 0, 71);
          }
        }, t.u[706] = {
          v: function v(n) {
            return H(76, t, this, arguments, 0, 11);
          }
        }, t.u[707] = {
          v: function v(n, r, i, o, e, u) {
            return H(78, t, this, arguments, 0, 21);
          }
        }, t.u[708] = {
          v: function v(n, r) {
            return H(74, t, this, arguments, 0, 34);
          }
        }, t.u[709] = {
          v: function v(n, r, i) {
            return H(84, t, this, arguments, 0, 54);
          }
        }, t.u[711] = {
          v: function v(n) {
            return H(1740, t, this, arguments, 0, 30);
          }
        }, t.u[712] = {
          v: function v(n) {
            return H(2048, t, this, arguments, 0, 51);
          }
        }, t.u[713] = {
          v: function v(n, r, i) {
            return H(2507, t, this, arguments, 0, 66);
          }
        }, t.u[715] = {
          v: function v(n, r) {
            return H(4344, t, this, arguments, 0, 39);
          }
        }, t.u[720] = {
          v: function v() {
            return H(4952, t, this, arguments, 0, 32);
          }
        }, t.u[721] = {
          v: function v() {
            return H(4950, t, this, arguments, 0, 22);
          }
        }, t.u[726] = {
          v: function v(n) {
            return H(5146, t, this, arguments, 0, 29);
          }
        }, t.u[727] = {
          v: function v(n, r) {
            return H(4450, t, this, arguments, 0, 34);
          }
        }, t.u[728] = {
          v: function v(n, r) {
            return H(5374, t, this, arguments, 0, 34);
          }
        }, t.u[729] = {
          v: function v() {
            return H(4956, t, this, arguments, 0, 102);
          }
        }, t.u[730] = {
          v: function v(n, r) {
            return H(70, t, this, arguments, 0, 59);
          }
        }, t.u[732] = {
          v: function v() {
            return H(5642, t, this, arguments, 0, 94);
          }
        }, t.u[733] = {
          v: function v(n) {
            return H(1518, t, this, arguments, 0, 28);
          }
        }, t.u[734] = {
          v: function v(n, r) {
            return H(82, t, this, arguments, 0, 28);
          }
        }, t.u[735] = {
          v: function v(n) {
            return H(4074, t, this, arguments, 0, 33);
          }
        }, t.u[736] = {
          v: function v(n, r) {
            return H(6739, t, this, arguments, 0, 21);
          }
        }, t.u[738] = {
          v: function v(n) {
            return H(6749, t, this, arguments, 0, 25);
          }
        }, t.u[740] = {
          v: function v() {
            return H(7935, t, this, arguments, 0, 37);
          }
        }, t.u[741] = {
          v: function v(n, r) {
            return H(8555, t, this, arguments, 0, 14);
          }
        }, t.u[742] = {
          v: function v(n, r, i, o, e) {
            return H(8557, t, this, arguments, 0, 20);
          }
        }, t.u[743] = {
          v: function v(n, r) {
            return H(8559, t, this, arguments, 0, 23);
          }
        }, t.u[744] = {
          v: function v(n) {
            return H(8561, t, this, arguments, 0, 13);
          }
        }, t.u[745] = {
          v: function v(n, r, i) {
            return H(8563, t, this, arguments, 0, 56);
          }
        }, t.u[747] = {
          v: function v(n) {
            return H(64, t, this, arguments, 0, 20);
          }
        }, t.u[749] = {
          v: function v(n, r, i) {
            return H(8565, t, this, arguments, 0, 18);
          }
        }, t.u[750] = {
          v: function v(n, r) {
            return H(1065, t, this, arguments, 0, 22);
          }
        }, t.u[752] = {
          v: function v(n) {
            return H(1195, t, this, arguments, 0, 12);
          }
        }, t.u[768] = {
          v: function v(n) {
            return H(9381, t, this, arguments, 0, 40);
          }
        }, t.u[769] = {
          v: function v(n, r, i) {
            return H(13942, t, this, arguments, 0, 29);
          }
        }, t.u[770] = {
          v: function v(n) {
            return H(13497, t, this, arguments, 0, 42);
          }
        }, t.u[771] = {
          v: function v(n) {
            return H(9738, t, this, arguments, 0, 18);
          }
        }, t.u[774] = {
          v: function v(n, r, i, o) {
            return H(14713, t, this, arguments, 0, 40);
          }
        }, t.u[775] = {
          v: function v(n, r, i) {
            return H(13495, t, this, arguments, 0, 36);
          }
        }, t.u[776] = {
          v: function v(n, r) {
            return H(13493, t, this, arguments, 0, 37);
          }
        }, t.u[777] = {
          v: function v(n) {
            return H(12217, t, this, arguments, 0, 30);
          }
        }, t.u[782] = {
          v: function v() {
            return H(19601, t, this, arguments, 0, 28);
          }
        }, t.u[790] = {
          v: function v() {
            return H(1326, t, this, arguments, 0, 20);
          }
        }, t.u[792] = {
          v: function v() {
            return H(4346, t, this, arguments, 0, 16);
          }
        }, t.u[793] = {
          v: function v(n, r, i) {
            return H(19991, t, this, arguments, 0, 20);
          }
        }, t.u[809] = {
          v: function v(n) {
            return H(6745, t, this, arguments, 0, 31);
          }
        }, t.u[821] = {
          v: function v(n) {
            return H(72, t, this, arguments, 0, 39);
          }
        }, t.u[822] = {
          v: function v() {
            return H(20451, t, this, arguments, 0, 41);
          }
        }, t.u[824] = {
          v: function v(n, r, i) {
            return H(12995, t, this, arguments, 0, 30);
          }
        }, t.u[825] = {
          v: function v(n, r, i, o) {
            return H(12456, t, this, arguments, 0, 39);
          }
        }, t.u[826] = {
          v: function v(n) {
            return H(6741, t, this, arguments, 0, 20);
          }
        }, t.u[827] = {
          v: function v(n, r, i) {
            return H(8567, t, this, arguments, 0, 48);
          }
        }, t.u[830] = {
          v: function v(n, r, i, o) {
            return H(8551, t, this, arguments, 0, 15);
          }
        }, t.u[832] = {
          v: function v() {
            return H(24476, t, this, arguments, 0, 113);
          }
        }, t.u[833] = {
          v: function v(n) {
            return H(32633, t, this, arguments, 0, 33);
          }
        }, t.u[836] = {
          v: function v(n) {
            return H(32929, t, this, arguments, 0, 14);
          }
        }, t.u[837] = {
          v: function v(n, r) {
            return H(32927, t, this, arguments, 0, 17);
          }
        }, t.u[838] = {
          v: function v(n, r) {
            return H(33767, t, this, arguments, 0, 27);
          }
        }, t.u[844] = {
          v: function v(n, r, i) {
            return H(32991, t, this, arguments, 0, 48);
          }
        }, t.u[850] = {
          v: function v() {
            return H(1460, t, this, arguments, 0, 12);
          }
        }, t.u[851] = {
          v: function v() {
            return H(37030, t, this, arguments, 0, 79);
          }
        }, t.u[852] = {
          v: function v() {
            return H(36064, t, this, arguments, 0, 54);
          }
        }, t.u[853] = {
          v: function v() {
            return H(38275, t, this, arguments, 0, 51);
          }
        }, t.u[855] = {
          v: function v() {
            return H(18898, t, this, arguments, 0, 50);
          }
        }, t.u[856] = {
          v: function v() {
            return H(39166, t, this, arguments, 0, 161);
          }
        }, t.u[857] = {
          v: function v() {
            return H(34803, t, this, arguments, 0, 75);
          }
        }, t.u[858] = {
          v: function v(n) {
            return H(1246, t, this, arguments, 0, 18);
          }
        }, t.u[860] = {
          v: function v(n, r) {
            return H(8553, t, this, arguments, 0, 45);
          }
        }, t.u[861] = {
          v: function v(n, r, i, o, e) {
            return H(46913, t, this, arguments, 0, 64);
          }
        }, t.u[863] = {
          v: function v(n) {
            return H(8275, t, this, arguments, 0, 28);
          }
        }, t.u[864] = {
          v: function v(n) {
            return H(48615, t, this, arguments, 0, 12);
          }
        }, t.u[866] = {
          v: function v(n, r) {
            return H(50289, t, this, arguments, 0, 39);
          }
        }, t.u[867] = {
          v: function v(n) {
            return H(10601, t, this, arguments, 0, 20);
          }
        }, t.u[868] = {
          v: function v(n) {
            return H(10509, t, this, arguments, 0, 20);
          }
        }, t.u[869] = {
          v: function v(n, r) {
            return H(52935, t, this, arguments, 0, 39);
          }
        }, t.u[870] = {
          v: function v(n, r) {
            return H(48662, t, this, arguments, 0, 96);
          }
        }, t.u[871] = {
          v: function v(n, r, i) {
            return H(50645, t, this, arguments, 0, 79);
          }
        }, t.u[873] = {
          v: function v(n, r) {
            return H(6747, t, this, arguments, 0, 35);
          }
        }, t.u[874] = {
          v: function v(n) {
            return H(6743, t, this, arguments, 0, 12);
          }
        }, t.u[875] = {
          v: function v(n, r, i) {
            return H(32925, t, this, arguments, 0, 74);
          }
        }, t.u[876] = {
          v: function v(n) {
            return H(52939, t, this, arguments, 0, 19);
          }
        }, t.u[877] = {
          v: function v(n, r, i) {
            return H(52941, t, this, arguments, 0, 48);
          }
        }, t.u[879] = {
          v: function v(n) {
            return H(52937, t, this, arguments, 0, 24);
          }
        }, t.u[881] = {
          v: function v() {
            return H(6522, t, this, arguments, 0, 27);
          }
        }, t.u[883] = {
          v: function v(n, r, i) {
            return H(52933, t, this, arguments, 0, 38);
          }
        }, t.u[885] = {
          v: function v() {
            return H(53595, t, this, arguments, 0, 24);
          }
        }, t.u[888] = {
          v: function v(n) {
            return H(59570, t, this, arguments, 0, 13);
          }
        }, t.u[892] = {
          v: function v(n) {
            return H(62451, t, this, arguments, 0, 46);
          }
        }, t.u[893] = {
          v: function v() {
            return H(15533, t, this, arguments, 0, 25);
          }
        }, t.u[894] = {
          v: function v() {
            return H(8511, t, this, arguments, 0, 13);
          }
        }, t.u[895] = {
          v: function v() {
            return H(56309, t, this, arguments, 0, 12);
          }
        }, t.u[896] = {
          v: function v(n) {
            return H(63071, t, this, arguments, 0, 37);
          }
        }, t.u[897] = {
          v: function v() {
            return H(19392, t, this, arguments, 0, 11);
          }
        }, t.u[898] = {
          v: function v() {
            return H(35639, t, this, arguments, 0, 42);
          }
        }, t.u[900] = {
          v: function v(n, r, i) {
            return H(59574, t, this, arguments, 0, 25);
          }
        }, t.u[901] = {
          v: function v() {
            return H(4948, t, this, arguments, 0, 29);
          }
        }, t.u[902] = {
          v: function v(n) {
            return H(59572, t, this, arguments, 0, 10);
          }
        }, t.u[910] = {
          v: V
        }, t.u[911] = {
          v: W
        }, t.u[912] = {
          v: function v(n, r) {
            return H(62, t, this, arguments, 0, 21);
          }
        }, t.u[913] = {
          v: function v() {
            return H(10693, t, this, arguments, 0, 81);
          }
        }, t.u[914] = {
          v: function v(n) {
            return H(11962, t, this, arguments, 0, 30);
          }
        }, t.u[915] = {
          v: function v(n, r) {
            return H(13251, t, this, arguments, 0, 32);
          }
        }, t.u[916] = {
          v: function v(n) {
            return H(19862, t, this, arguments, 0, 21);
          }
        }, t.u[917] = {
          v: function v(n, r, i) {
            return H(4710, t, this, arguments, 0, 31);
          }
        }, t.u[918] = {
          v: function v(n) {
            return H(6751, t, this, arguments, 0, 42);
          }
        }, t.u[919] = {
          v: X
        }, t.u[920] = {
          v: q
        }, t.u[921] = {
          v: Z
        }, t.u[922] = {
          v: function v() {
            return H(20866, t, this, arguments, 0, 25);
          }
        }, t.u[923] = {
          v: function v(n) {
            return H(59576, t, this, arguments, 0, 109);
          }
        }, t.u[767].v = {
          boe: !1,
          aid: 0,
          dfp: !1,
          sdi: !1,
          initialized: !1,
          triggerUnload: !1,
          region: "",
          regionConf: {
            lastChanceUrl: "",
            reportUrls: []
          },
          apiHost: "",
          umode: 0,
          v: !1,
          perf: !1,
          grecaptcha: {},
          slardarConfig: {
            enableSlardar: !0,
            enableLazyload: !1,
            settingLocation: 0,
            initConfigOverrides: {
              slardarDomain: "",
              slardarPluginPrefixPath: ""
            }
          },
          custom: {
            ttwid: ""
          }
        }, t.u[880].v = "X-Mssdk-Info", t.u[884].v = "X-Mssdk-RC", t.u[872].v = {
          sec: 9,
          asgw: 5,
          init: 0
        }, t.u[731].v = {
          aidList: [],
          bogusIndex: 0,
          msNewTokenList: [],
          isTrusted: 1,
          slardarErrs: [],
          WEBGL: {},
          envcode: 0,
          msToken: ""
        }, t.u[731].v.msStatus = t.u[872].v.init, t.u[731].v.__ac_testid = "", t.u[731].v.ttwid = "", t.u[731].v.tt_webid = "", t.u[731].v.tt_webid_v2 = "", t.u[714].v = {
          slardarErrs: [],
          ttwid: "",
          tt_webid: "",
          tt_webid_v2: "",
          msNewTokenList: []
        }, t.u[905].v = void 0 !== A ? A : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, t.u[859].v = {};

        for (var e = "0123456789abcdef".split(""), u = (t.u[903].v = [], t.u[904].v = [], 0); u < 256; u++) {
          t.u[903].v[u] = e[u >> 4 & 15] + e[15 & u], u < 16 && (u < 10 ? t.u[904].v[48 + u] = u : t.u[904].v[87 + u] = u);
        }

        t.u[859].v.encode = function () {
          return H(63662, t, this, arguments, 0, 21);
        }, t.u[859].v.decode = function () {
          return H(63664, t, this, arguments, 0, 27);
        };
        var f = {
          exports: {}
        };
        t.u[906].v = function (n) {
          return H(1244, t, this, arguments, 0, 32);
        }(Object.freeze({
          __proto__: null,
          default: {}
        })), function () {
          H(63666, t, this, arguments, 0, 11);
        }(f), t.u[710].v = o(f.exports), t.u[716].v = t.u[733].v.call(void 0, 10), t.u[719].v = t.u[733].v.call(void 0, 10), t.u[722].v = t.u[733].v.call(void 0, 10), t.u[724].v = t.u[733].v.call(void 0, 10), t.u[723].v = t.u[733].v.call(void 0, 10), t.u[718].v = !1;
        var c = !0;

        function a(n, r, i, o, e, u) {
          return H(4954, t, this, arguments, 0, 55);
        }

        "complete" === document.readyState || "interactive" === document.readyState ? t.u[718].v = !0 : "function" == typeof document.addEventListener && (c = !1, document.addEventListener("DOMContentLoaded", t.u[720].v), document.addEventListener("readystatechange", t.u[721].v)), c && (t.u[718].v = !0), t.u[717].v = !1, t.u[907].v = !1, window && window.addEventListener && window.addEventListener("beforeunload", function () {
          return H(63668, t, this, arguments, 0, 18);
        }), t.u[725].v = {}, t.u[795].v = t.u[733].v.call(void 0, 10);
        var v = a(t.u[795].v, void 0, void 0, function () {
          return H(63670, t, this, arguments, 0, 20);
        }, void 0);
        t.u[737].v = "xmst", t.u[799].v = t.u[733].v.call(void 0, 10);
        var s = a(t.u[799].v, function () {
          return H(63672, t, this, arguments, 0, 11);
        }, void 0, void 0, void 0),
            d = (t.u[798].v = t.u[733].v.call(void 0, 10), a(t.u[798].v, void 0, void 0, function () {
          return H(63702, t, this, arguments, 0, 124);
        }, void 0));
        t.u[801].v = t.u[733].v.call(void 0, 10), t.u[739].v = 0;
        var w = a(t.u[801].v, void 0, void 0, t.u[863].v, void 0, void 0);
        t.u[751].v = t.u[860].v, t.u[746].v = [1196819126, 600974999, 3863347763, 1451689750], t.u[908].v = [2517678443, 2718276124, 3212677781, 2633865432, 217618912, 2931180889, 1498001188, 2157053261, 211147047, 185100057, 2903579748, 3732962506, 4294967295 & Date.now(), Math.floor(4294967296 * Math.random()), Math.floor(4294967296 * Math.random()), Math.floor(4294967296 * Math.random())], t.u[909].v = 0, t.u[748].v = {
          rand: V,
          seed: W
        }, t.u[828].v = {
          pb: 2,
          json: 1
        }, t.u[829].v = 8, t.u[759].v = "🐼OynG@%tp$", t.u[758].v = "rgba(47, 211, 69, .99)", t.u[756].v = "*+(}#?🐼 🎅", t.u[755].v = "rgba(150, 32, 170, .97)", t.u[761].v = "rgba(255, 12, 220, 1)", t.u[753].v = 94, t.u[754].v = 31, t.u[760].v = 3, t.u[757].v = 18, t.u[823].v = t.u[733].v.call(void 0, 10);
        var g = a(t.u[823].v, void 0, void 0, function () {
          return H(63708, t, this, arguments, 0, 52);
        }, void 0);
        t.u[763].v = /\s*\(\)\s*{\s*\[\s*native\s+code\s*]\s*}\s*$/, t.u[762].v = Function.prototype.toString, t.u[812].v = t.u[733].v.call(void 0, 10);
        var l = a(t.u[812].v, void 0, function () {
          return H(64579, t, this, arguments, 0, 63);
        }, void 0, void 0);
        t.u[814].v = t.u[733].v.call(void 0, 10);
        var h = a(t.u[814].v, void 0, void 0, function () {
          return H(65827, t, this, arguments, 0, 59);
        }, void 0);
        t.u[765].v = /\s*\(\)\s*{\s*\[\s*native\s+code\s*]\s*}\s*$/, t.u[764].v = Function.prototype.toString, t.u[813].v = t.u[733].v.call(void 0, 10);
        var p = a(t.u[813].v, void 0, void 0, function () {
          return H(66596, t, this, arguments, 0, 38);
        }, void 0),
            Q = {};
        !function () {
          H(67204, t, this, arguments, 0, 739);
        }(Q), t.u[766].v = o(Q), t.u[773].v = 1, t.u[772].v = 0, t.u[779].v = !1, t.u[778].v = !1, t.u[815].v = t.u[733].v.call(void 0, 10);
        var y = a(t.u[815].v, void 0, t.u[855].v, void 0, void 0);
        t.u[780].v = new function () {
          return H(67206, t, this, arguments, 0, 23);
        }(100), t.u[781].v = 1, t.u[794].v = {}, t.u[796].v = t.u[733].v.call(void 0, 10);
        var D = a(t.u[796].v, function () {
          return H(67208, t, this, arguments, 0, 14);
        }, void 0, void 0, void 0, void 0),
            C = (t.u[797].v = t.u[733].v.call(void 0, 10), a(t.u[797].v, function () {
          return H(67280, t, this, arguments, 0, 29);
        }, void 0, void 0, void 0));
        t.u[800].v = t.u[733].v.call(void 0, 10);
        var E = a(t.u[800].v, void 0, function () {
          return H(67556, t, this, arguments, 0, 21);
        }),
            b = (t.u[802].v = t.u[733].v.call(void 0, 10), a(t.u[802].v, void 0, function () {
          return H(67674, t, this, arguments, 0, 57);
        }, void 0, void 0, void 0)),
            O = (t.u[803].v = t.u[733].v.call(void 0, 10), a(t.u[803].v, void 0, function () {
          return H(68057, t, this, arguments, 0, 17);
        }, void 0, void 0, void 0)),
            m = (t.u[804].v = t.u[733].v.call(void 0, 10), a(t.u[804].v, function () {
          return H(68139, t, this, arguments, 0, 116);
        }, void 0, void 0, void 0)),
            I = (t.u[805].v = t.u[733].v.call(void 0, 10), a(t.u[805].v, function () {
          return H(69419, t, this, arguments, 0, 58);
        }, void 0, void 0, void 0)),
            B = (t.u[806].v = t.u[733].v.call(void 0, 10), a(t.u[806].v, function () {
          return H(70116, t, this, arguments, 0, 29);
        }, void 0, void 0, void 0)),
            k = (t.u[807].v = t.u[733].v.call(void 0, 10), a(t.u[807].v, void 0, function () {
          return H(70405, t, this, arguments, 0, 21);
        }, void 0, void 0)),
            x = (t.u[811].v = t.u[733].v.call(void 0, 10), a(t.u[811].v, void 0, function () {
          return H(70573, t, this, arguments, 0, 31);
        }, void 0, void 0)),
            R = (t.u[816].v = t.u[733].v.call(void 0, 10), a(t.u[816].v, void 0, function () {
          return H(70863, t, this, arguments, 0, 69);
        }, void 0, void 0)),
            M = (t.u[817].v = t.u[733].v.call(void 0, 10), a(t.u[817].v, void 0, void 0, function () {
          return H(71437, t, this, arguments, 0, 54);
        }, void 0)),
            T = (t.u[818].v = t.u[733].v.call(void 0, 10), a(t.u[818].v, function () {
          return H(72526, t, this, arguments, 0, 36);
        }, void 0, void 0, void 0, void 0)),
            K = (t.u[820].v = t.u[733].v.call(void 0, 10), a(t.u[820].v, function () {
          return H(72929, t, this, arguments, 0, 14);
        }, void 0, void 0, void 0, void 0)),
            U = (t.u[819].v = t.u[733].v.call(void 0, 10), a(t.u[819].v, function () {
          return H(72980, t, this, arguments, 0, 79);
        }, void 0, void 0, void 0, void 0));

        function S(n) {
          return H(34034, t, this, arguments, 0, 18);
        }

        function P(n) {
          return H(34143, t, this, arguments, 0, 33);
        }

        function j(n) {
          return H(34473, t, this, arguments, 0, 33);
        }

        function G(n) {
          return H(48365, t, this, arguments, 0, 25);
        }

        t.u[783].v = {}, t.u[783].v.navigator = {}, t.u[783].v.wID = {}, t.u[783].v.window = {}, t.u[783].v.webgl = {}, t.u[783].v.document = {}, t.u[783].v.screen = {}, t.u[783].v.plugins = {}, t.u[783].v.custom = {}, t.u[783].v.canvasIntegrity = {}, t.u[783].v.mediaQuery = {}, t.u[791].v = null, t.u[788].v = null, t.u[789].v = null, t.u[787].v = !1, t.u[785].v = !1, t.u[786].v = 0, t.u[831].v = !1, t.u[862].v = {}, t.u[862].v.kHttp = 0, t.u[862].v.kWebsocket = 1, t.u[846].v = {
          kNoMove: 2,
          kNoClickTouch: 4,
          kNoKeyboardEvent: 8,
          kMoveFast: 16,
          kKeyboardFast: 32,
          kFakeOperations: 64,
          kUntrusted: 128
        }, t.u[840].v = !1, t.u[845].v = !1, t.u[842].v = [], t.u[841].v = [], t.u[839].v = [], t.u[847].v = {
          ubcode: 0
        }, t.u[834].v = X, t.u[835].v = q, t.u[848].v = {}, t.u[843].v = !1, t.u[848].v.keydown = S, t.u[848].v.keypress = S, t.u[848].v.click = P, t.u[848].v.dblclick = P, t.u[848].v.touchstart = P, t.u[848].v.touchmove = j, t.u[848].v.mousemove = j, t.u[849].v = 0, t.u[865].v = Math.floor(Math.abs(1e3 * (Date.now() + Math.random() + Math.random()) % 2147483648)), t.u[878].v = Request && Request instanceof Object, t.u[882].v = Headers && Headers instanceof Object, t.u[889].v = {
          host: "https://mssdk-boei18n.byteintl.net",
          slardarDomain: "mon.tiktokv.com",
          pluginPathPrefix: "https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/slardar/fe/sdk-web/plugins"
        };
        window.__tsign = t;
        var L = "https://lf16-cdn-tos.tiktokcdn-us.com/obj/static-tx/slardar/fe/sdk-web/plugins/",
            J = "mon16-normal-useast5.tiktokv.us",
            z = "https://sf16-website-login.neutral.ttwstatic.com/obj/tiktok_web_login_static/slardar/fe/sdk-web/plugins",
            Y = "mon.tiktokv.com",
            F = "mon-va.byteoversea.com",
            N = "mon-va.lemon8-app.com";

        function V() {
          return H(63704, t, this, arguments, 0, 33);
        }

        function W() {
          return H(63706, t, this, arguments, 0, 15);
        }

        function X() {
          return H(74529, t, this, arguments, 0, 13);
        }

        function q() {
          return H(74566, t, this, arguments, 0, 12);
        }

        function Z() {
          return H(74600, t, this, arguments, 0, 10);
        }

        t.u[890].v = {
          sg: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-sg.byteoversea.com",
              pluginPathPrefix: z,
              slardarDomain: F
            }
          },
          va: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-va.byteoversea.com",
              pluginPathPrefix: z,
              slardarDomain: F
            }
          },
          gcp: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-i18n.byteintlapi.com",
              pluginPathPrefix: z,
              slardarDomain: F
            }
          },
          "va-tiktok": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-va.tiktok.com",
              pluginPathPrefix: z,
              slardarDomain: Y
            }
          },
          "gcp-tiktok": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-i18n.tiktok.com",
              pluginPathPrefix: z,
              slardarDomain: Y
            }
          },
          "sg-tiktok": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-sg.tiktok.com",
              pluginPathPrefix: z,
              slardarDomain: Y
            }
          },
          ttp: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk.tiktokw.us",
              pluginPathPrefix: L,
              slardarDomain: J
            }
          },
          ttp2: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-ttp2.tiktokw.us",
              pluginPathPrefix: L,
              slardarDomain: J
            }
          },
          "eu-ttp": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk.tiktokw.eu",
              pluginPathPrefix: z,
              slardarDomain: Y
            }
          },
          "eu-ttp2": {
            boe: t.u[889].v,
            prod: {
              host: "https://webmssdk16-normal-no1a.tiktokw.eu",
              pluginPathPrefix: z,
              slardarDomain: Y
            }
          },
          mya: {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-mya.byteintlapi.com",
              pluginPathPrefix: z,
              slardarDomain: F
            }
          },
          "sg-capcut": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-sg.capcutapi.com",
              pluginPathPrefix: z,
              slardarDomain: "mon-sg.capcutapi.com"
            }
          },
          "va-capcut": {
            boe: t.u[889].v,
            prod: {
              host: "https://mssdk-va.capcutapi.com",
              pluginPathPrefix: z,
              slardarDomain: "mon-va.capcutapi.com"
            },
            "va-lemon8": {
              boe: t.u[889].v,
              prod: {
                host: "https://mssdk-va.lemon8-app.com",
                pluginPathPrefix: z,
                slardarDomain: N
              }
            },
            "sg-lemon8": {
              boe: t.u[889].v,
              prod: {
                host: "https://mssdk-sg.lemon8-app.com",
                pluginPathPrefix: z,
                slardarDomain: N
              }
            },
            "ttp-lemon8": {
              boe: t.u[889].v,
              prod: {
                host: "https://mssdk-ttp.lemon8-app.us",
                pluginPathPrefix: L,
                slardarDomain: "mon-ttp.lemon8-app.us"
              }
            }
          }
        }, t.u[891].v = ["/web/report", "/web/common"], t.u[887].v = [m, w, g, B, I, x, O, s, C, D, d, l, k, h, E, v, b, p, R, M, y, T, K, U], t.u[886].v = Z, t.u[899].v = !1, t.u[923].v.prototype.frontierSign = G, t.u[923].v.prototype.setUserMode = t.u[892].v, t.u[923].v.prototype.getReferer = function () {
          return H(74602, t, this, arguments, 0, 9);
        }, function () {
          H(74614, t, this, arguments, 0, 38);
        }(), console.info("."), r.frontierSign = G, r.getReferer = function () {
          return H(75336, t, this, arguments, 0, 9);
        }, r.init = function () {
          return H(75338, t, this, arguments, 0, 11);
        }, r.isWebmssdk = !0, r.report = function () {
          return H(75362, t, this, arguments, 0, 38);
        }, r.setTTWebid = function () {
          return H(75364, t, this, arguments, 0, 8);
        }, r.setTTWebidV2 = function () {
          return H(75366, t, this, arguments, 0, 8);
        }, r.setTTWid = function () {
          return H(75368, t, this, arguments, 0, 8);
        }, r.setUserMode = t.u[892].v, t.u[4] = void 0;
      }, function (n) {
        for (var t, r = n, i = r.u[6][0], o = r.u[6][1], e = [], u = 0, f = "", c = 0; c < 256; c++) {
          e[c] = c;
        }

        for (var a = 0; a < 256; a++) {
          u = (u + e[a] + i.charCodeAt(a % i.length)) % 256, t = e[a], e[a] = e[u], e[u] = t;
        }

        var v = 0;
        u = 0;

        for (var s = 0; s < o.length; s++) {
          u = (u + e[v = (v + 1) % 256]) % 256, t = e[v], e[v] = e[u], e[u] = t, f += String.fromCharCode(255 & (o.charCodeAt(s) ^ e[(e[v] + e[u]) % 256]));
        }

        r.u[4] = f;
      }, function (n) {
        var t = B(n),
            r = m(n);
        R(n, m(n), U(n, m(n)) === U(n, r)), n.o = t;
      }, function (n) {
        for (var t = I(n), r = m(n), i = B(n), o = m(n), e = n, u = 0; u < t; u++) {
          e = e.D;
        }

        x(n, r, T(e, o)), n.o = i;
      }, function (n) {
        var t = m(n);
        n.A.pop(), R(n, t, n.O.pop().v);
      }, function (n) {
        var t = n,
            r = t.u[6].length > 0 && void 0 !== t.u[6][0] && t.u[6][0],
            i = {},
            o = "";
        if (t.D.u[725].v && t.D.u[725].v.WEBGL && t.D.u[725].v.VENDOR && t.D.u[725].v.RENDERER) i = t.D.u[725].v.WEBGL, o = t.D.u[725].v.VENDOR + "/" + t.D.u[725].v.RENDERER;else {
          var e = function () {
            return H(4958, t, this, arguments, 0, 25);
          }();

          if (!e) return t.u[4] = {
            data: {
              webglData: {},
              gpu: ""
            }
          }, {
            data: {
              webglData: {},
              gpu: ""
            }
          };
          i = {
            supportedExtensions: e.getSupportedExtensions() || [],
            antialias: e.getContextAttributes().antialias ? 1 : 2,
            blueBits: e.getParameter(e.BLUE_BITS),
            depthBits: e.getParameter(e.DEPTH_BITS),
            greenBits: e.getParameter(e.GREEN_BITS),
            maxAnisotropy: t.D.u[726].v.call(void 0, e),
            maxCombinedTextureImageUnits: e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
            maxCubeMapTextureSize: e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),
            maxFragmentUniformVectors: e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),
            maxRenderbufferSize: e.getParameter(e.MAX_RENDERBUFFER_SIZE),
            maxTextureImageUnits: e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),
            maxTextureSize: e.getParameter(e.MAX_TEXTURE_SIZE),
            maxVaryingVectors: e.getParameter(e.MAX_VARYING_VECTORS),
            maxVertexAttribs: e.getParameter(e.MAX_VERTEX_ATTRIBS),
            maxVertexTextureImageUnits: e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
            maxVertexUniformVectors: e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),
            shadingLanguageVersion: e.getParameter(e.SHADING_LANGUAGE_VERSION),
            stencilBits: e.getParameter(e.STENCIL_BITS),
            version: e.getParameter(e.VERSION)
          };
          var u = e.getExtension("WEBGL_debug_renderer_info"),
              f = e.getParameter(u.UNMASKED_VENDOR_WEBGL),
              c = e.getParameter(u.UNMASKED_RENDERER_WEBGL);
          t.D.u[725].v.RENDERER = c, t.D.u[725].v.VENDOR = f, o = t.D.u[725].v.VENDOR + "/" + t.D.u[725].v.RENDERER, t.D.u[725].v.WEBGL = i;
        }

        if (r) {
          var a = {};
          t.u[4] = (t.D.u[727].v.call(void 0, a, i), a.antialias = 1 === i.antialias, {
            data: {
              webglData: a,
              gpu: o
            }
          });
        } else t.u[4] = (i.vendor = t.D.u[725].v.VENDOR, i.renderer = t.D.u[725].v.RENDERER, {
          data: {
            webglData: i,
            gpu: o
          }
        });
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        U(n, o).push(U(n, e)), U(n, o).push(U(n, t));
        var f = b[u],
            c = b[r],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, i, p[a]);
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = B(n);
        R(n, m(n), !U(n, m(n))), U(n, t) ? n.o = i : n.o = r;
      }, function (n) {
        var t = m(n),
            r = I(n),
            i = m(n),
            o = B(n),
            e = m(n),
            u = m(n);
        R(n, t, function () {
          return H(o, n, this, arguments, 0, e);
        });

        for (var f = n, c = 0; c < r; c++) {
          f = f.D;
        }

        x(n, i, T(f, u));
      }, function (n) {
        var t = m(n);
        R(n, m(n), new (U(n, t))());
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, i, U(n, u)[U(n, f)] = U(n, r));
        var c = b[e],
            a = b[t],
            v = c + ":" + a;
        p[v] || (p[v] = D(c, a)), R(n, o, p[v]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.D.u[767].v.regionConf.host;
        t.u[4] = !(!i || -1 === r.indexOf(i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, o, U(n, u)[U(n, e)]), R(n, r, U(n, f)[U(n, i)] = U(n, t));
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = m(n),
            o = B(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, u, U(n, e).call(U(n, r), U(n, i))), U(n, f) ? n.o = o : n.o = t;
      }, function (n) {
        for (var t = n.u[6][0], r = [], i = function (n) {
          var t = 0,
              r = 0;
          return {
            write: function write(i, o) {
              for (; o > 0; --o) {
                1 & i && (r |= 1 << t), i >>= 1, 8 == ++t && (n.push(r), t = 0, r = 0);
              }
            },
            finalize: function finalize() {
              t > 0 && n.push(r);
            }
          };
        }(r), o = Object.create(null), e = 0; e < 256; ++e) {
          o[String.fromCharCode(e)] = e;
        }

        for (var u = 8, f = 255, c = 0; c < t.length;) {
          for (var a = t[c]; c + 1 < t.length && o[a + t[c + 1]]; ++c) {
            a += t[c + 1];
          }

          if (i.write(o[a], u), c + 1 == t.length) break;
          ++f & f - 1 || ++u, o[a + t[c + 1]] = f, ++c;
        }

        n.u[4] = (i.finalize(), r);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, m(n), U(n, t).call(U(n, r), U(n, i))), n.A.pop();
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, e, U(n, r)[U(n, o)] = U(n, t)), R(n, i, U(n, u));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, r, {}), R(n, i, U(n, t));
      }, function (n) {
        var t = n;
        t.D.D.u[854].v = Object.getOwnPropertyNames(window).some(function () {
          return H(74986, t, this, arguments, 0, 36);
        }), t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, i).call(U(n, o), U(n, e), U(n, t)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, i, U(n, t).call(U(n, e), U(n, o))), R(n, u, U(n, f) !== U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, o, U(n, e).call(U(n, c), U(n, u), U(n, i), U(n, t), U(n, r), U(n, f)));
      }, function (n) {
        var t = n.u[6][0],
            r = n.u[6][1];

        if (t) {
          var i = t[r];

          if (i) {
            var o = n.D.u[702].v.call(void 0, i);
            return void (n.u[4] = "object" === o || "function" === o ? 1 : "string" === o ? o.length > 0 ? 1 : 2 : function (n) {
              return "[object Array]" === Object.prototype.toString.call(n);
            }(i) ? 1 : 2);
          }
        }

        n.u[4] = 2;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) === U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, m(n))[U(n, r)]), R(n, i, U(n, e).call(U(n, u), U(n, t)));
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = 3,
            u = r;
        (!(t.u[6].length > 3 && void 0 !== t.u[6][3]) || t.u[6][3]) && (u = String.fromCharCode.apply(null, function () {
          return H(8569, t, this, arguments, 0, 49);
        }(r)), u.length < r.length && (e = 4, r = u));

        var f = String.fromCharCode(255 & (i << 6 | 8 | e)),
            c = function () {
          return H(8571, t, this, arguments, 0, 42);
        }(),
            a = c.key,
            v = c.rounds,
            s = c.keyString,
            d = t.D.u[749].v.call(void 0, a, v, r);

        t.u[4] = (d = function () {
          return H(8978, t, this, arguments, 0, 34);
        }(d, s), t.D.u[750].v.call(void 0, f + d, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, r, U(n, t) % U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, e)), R(n, u, U(n, r).call(U(n, i), U(n, t)));
      }, function (n) {
        var t = m(n),
            r = I(n);
        R(n, t, U(n, 6)[r]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = [];

        for (var o in U(n, t)) {
          i.push(o);
        }

        R(n, r, i);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, r, U(n, t) + U(n, u));
        var f = b[e],
            c = b[o],
            a = f + ":" + c;
        p[a] || (p[a] = D(f, c)), R(n, i, p[a]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n);
        R(n, f, U(n, i).call(U(n, c), U(n, r))), R(n, o, U(n, a).call(U(n, u), U(n, t), U(n, e)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) >= U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, i, U(n, o));
        var u = b[e],
            f = b[t];
        p[u] || (p[u] = D(u, f));
        var c = p[u];
        if (!(c in A)) throw new ReferenceError(c + " is not defined");
        R(n, r, A[c]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, i, U(n, o));
        var u = b[t],
            f = b[r],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, e, p[c]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, t).call(U(n, i))), R(n, r, U(n, o));
      }, function (n) {
        var t = n;
        t.u[4] = {
          data: t.D.u[729].v.call(void 0, t.u[6].length > 0 && void 0 !== t.u[6][0] && t.u[6][0]).data.webglData
        };
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, o, U(n, e).call(U(n, f), U(n, u))), R(n, r, U(n, t) >= U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, r, U(n, m(n))), R(n, t, U(n, o) !== U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, m(n)) << U(n, o)), R(n, i, U(n, e) | U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, t) + U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, e, U(n, t) / U(n, u));
        var f = b[i],
            c = b[r];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, o, A[a]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        U(n, t).push(U(n, r));
        var u = b[o],
            f = b[e],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, i, p[c]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, r, U(n, m(n)).call(U(n, t), U(n, i)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, i, U(n, o)[U(n, e)]), R(n, u, U(n, t) - U(n, r));
      }, function (n) {
        n.D.u[718].v || !n.D.u[718].v && n.D.u[717].v ? (n.D.u[718].v = !0, setTimeout(function () {
          document.dispatchEvent(new Event(n.D.u[719].v));
        }, 1), document.removeEventListener("DOMContentLoaded", n.D.u[720].v), document.removeEventListener("readystatechange", n.D.u[721].v)) : n.D.u[718].v || n.D.u[717].v || (n.D.u[718].v = !0), n.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, e, U(n, i).call(U(n, r), U(n, o), U(n, f), U(n, t), U(n, u)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = b[e],
            f = b[r],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, i, p[c]), R(n, t, U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, i, -U(n, o));
        var u = b[e],
            f = b[r],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, t, p[c]);
      }, function (n) {
        var t = m(n);
        R(n, m(n), U(n, m(n)) / U(n, t));
      }, function (n) {
        var t = m(n),
            r = I(n),
            i = m(n);
        x(n, t, K(void 0)), R(n, i, U(n, 6)[r]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n);
        R(n, m(n), U(n, m(n)) ^ U(n, i)), R(n, o, U(n, r) ^ U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, t)), R(n, e, U(n, i) === U(n, o));
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.D.u[886].v = r, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = B(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, e).call(U(n, u), U(n, t), U(n, r))), n.o = i;
      }, function (n) {
        var t = m(n),
            r = B(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = B(n);
        R(n, i, U(n, o) > U(n, e)), U(n, t) ? n.o = r : n.o = u;
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, r) >>> U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = b[t],
            e = b[i],
            u = o + ":" + e;
        p[u] || (p[u] = D(o, e)), R(n, r, p[u]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, r, delete U(n, t)[U(n, i)]);
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, m(n), U(n, f).call(U(n, r), U(n, e), U(n, t), U(n, c), U(n, o), U(n, i), U(n, u)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = b[e],
            f = b[r],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(n, o, p[c]), U(n, i).push(U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, t, U(n, m(n))[U(n, r)]);
      }, function (t) {
        var r = m(t),
            i = m(t),
            o = m(t),
            e = m(t);
        R(t, o, n(U(t, m(t))));
        var u = b[i],
            f = b[r],
            c = u + ":" + f;
        p[c] || (p[c] = D(u, f)), R(t, e, p[c]);
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = t.u[6][3],
            u = t.u[6][4];
        r[i] += r[o], r[u] = t.D.u[741].v.call(void 0, r[u] ^ r[i], 16), r[e] += r[u], r[o] = t.D.u[741].v.call(void 0, r[o] ^ r[e], 12), r[i] += r[o], r[u] = t.D.u[741].v.call(void 0, r[u] ^ r[i], 8), r[e] += r[u], r[o] = t.D.u[741].v.call(void 0, r[o] ^ r[e], 7), t.u[4] = void 0;
      }, function (n) {
        var t = n,
            r = t.u[6][0];
        t.D.u[911].v, t.D.u[908].v = r, t.D.u[909].v = 0, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, r, U(n, t) << U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, m(n), U(n, t) | U(n, r));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, m(n), U(n, m(n)) & U(n, i)), R(n, t, U(n, r));
      }, function (n) {
        var t = I(n),
            r = I(n),
            i = m(n),
            o = m(n);
        R(n, i, U(n, 6)[t]), R(n, o, U(n, 6)[r]);
      }, function (n) {
        var t = m(n);
        R(n, m(n), U(n, m(n)).call(U(n, t))), n.A.pop();
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n);
        R(n, r, U(n, o) !== U(n, i)), R(n, e, U(n, t));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) <= U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n),
            a = m(n),
            v = m(n);
        R(n, e, U(n, o)[U(n, a)]), R(n, r, U(n, f).call(U(n, v), U(n, t), U(n, c), U(n, i), U(n, u)));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, o, U(n, t) * U(n, e));
        var f = b[i],
            c = b[u];
        p[f] || (p[f] = D(f, c));
        var a = p[f];
        if (!(a in A)) throw new ReferenceError(a + " is not defined");
        R(n, r, A[a]);
      }, function (n) {
        var t = B(n),
            r = m(n),
            i = B(n),
            o = m(n),
            e = m(n),
            u = m(n);
        R(n, r, U(n, o) == U(n, u)), U(n, e) ? n.o = i : n.o = t;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n),
            c = m(n);
        R(n, o, U(n, f).call(U(n, r), U(n, c))), R(n, e, U(n, t).call(U(n, i), U(n, u)));
      }, function (n) {
        n.A.pop();
      }, function (n) {
        var t = n,
            r = t.u[6][0],
            i = t.u[6][1],
            o = t.u[6][2],
            e = !(t.u[6].length > 3 && void 0 !== t.u[6][3]) || t.u[6][3];
        if (!(window._mssdk && window._mssdk.cacheOpts && window._mssdk.cacheOpts[r])) throw new Error("window._mssdk.cacheOpts[aid] has not bee initialized yet!!!!");
        window._mssdk.cacheOpts[r].slardarConfigFromCore = {
          slardarDomain: i,
          pluginPathPrefix: o,
          useFallback: e
        }, t.u[4] = void 0;
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n),
            o = m(n),
            e = m(n),
            u = m(n),
            f = m(n);
        R(n, m(n), U(n, i)[U(n, t)] = U(n, f)), R(n, e, U(n, r)[U(n, u)] = U(n, o));
      }, function (n) {
        var t = m(n),
            r = m(n),
            i = m(n);
        R(n, t, U(n, r) != U(n, i));
      }, function (n) {
        var t = m(n),
            r = m(n);
        R(n, t, U(n, m(n)) !== U(n, r));
      }, function (t) {
        var r = m(t),
            i = m(t),
            o = m(t),
            e = m(t),
            u = m(t);
        R(t, o, U(t, i)[U(t, e)]), R(t, r, n(U(t, u)));
      }, function (n) {
        var t = B(n);
        R(n, m(n), t);
      }], window.__Q = Q;

      y.prototype.decode = function (n) {
        for (var t = "", r = 0; r < n.length;) {
          var i = n[r],
              o = 0,
              e = 0;
          if (i <= 127 ? (o = 0, e = 255 & i) : i <= 223 ? (o = 1, e = 31 & i) : i <= 239 ? (o = 2, e = 15 & i) : i <= 244 && (o = 3, e = 7 & i), n.length - r - o > 0) for (var u = 0; u < o;) {
            e = e << 6 | 63 & (i = n[r + u + 1]), u += 1;
          } else e = 65533, o = n.length - r;
          t += String.fromCharCode(e), r += o + 1;
        }

        return t;
      };

      var C = {},
          E = dwInfl.dwAbA(k(" ")),
          b = ["HAAeBg4bTAITGCs0UUNXFT4dDUVfKzFpCllPXT4mOTQdAk04JREXKQE/NSYcCRUeMiEUBBALQRAOLBkXOgc7PQ==", "XkzvisxX", "RA==", "yMIjkvJI", "", "Jwg+NjUc", "KmPQAtkG", "OwMbBCocHD0ZHw==", "KAUxIwAA", "Cn0=", "Ci8TFQQyLA8CJxsdDDokFxo/AwUUIjwfEjcxMyIQDiEsBTk7KhgGKSQdISMyAB4xPBUpK3FFWXR/WGZmeU1AaHY=", "Cnw=", "DwY0ISYcXx0AHgETeURECi0bJ2J3LCJ2GV9lehYhKisOBGcfDRYENhI5HwE0DgYBISc+IzgMUg8dKjMwEgAoInY=", "OF8=", "HAAeBg4bTAITGCs0UUNXFT4dDUVfKzFpCllPWz4mOTQdAk04JREXKQE/NSYcCRUeMiEUBBALQRAOLBkXOgc7PWU=", "Cn4=", "Pl1pJSMnWBI9ChQUJEIZahE7HQk7OBs0CgI4BS9DBiMCIwE9FkBadQwcEjsnLQI+IFUaHhM3LXJkFRsZNhUIF3Y=", "Ci8TFQQyLA8CJxsdDDokFxo/AwUUIjwfEjcxMyIQDiEsBTk7KhgGKSQdISMyAB4xPBUpK3FFWXR/WGZmeU1AaA==", "ECMtDxM5LA==", "Pg0cEA8VHj4+DRwQDxUePj4NHBAPFR4+Pg0cEA8VHj4=", "Fyw/AwwXPiYL", "LRgfBCgUHTYs", "LAQ2GR4WChs5GB8=", "NB4ALw==", "PAQZAwQWFiw=", "HSIqHwYTJD00Ii0P", "DCMtDw0fJCwd", "PwcVFAgfLDAxGA==", "EQUJAggfFAwqAh0RDAE=", "GC8qDg4QLSEQJyIGBhglOQg/Oh4eAD0xADcIKCgyDw8+BQAgIDoHBzYdGDg4Ih8fLhUQMFtHeHpNeH9dU08=", "FQoOHg==", "KgoUEgYe", "DwwkNA==", "HyEmBRk=", "HRkIGRs=", "HgoTGgwXWCw3Sx8YChwcPXgIFRIMUwg3MQUO", "Kjk7AwUR", "PhkVGyobGSobBB4T", "Qw==", "UQ==", "QQ==", "VA==", "dA==", "F08=", "BDc=", "Ww==", "KAI0NBEbAik/LCQ=", "Mx4GJA==", "OBkiOC8TAiEy", "FzglBg==", "DT88Dw==", "HywlGQ4=", "Kx8IHwcU", "Nh4XFAwB", "Fh4XFAwB", "Ih4WOC8dHyI=", "OgIdHwcH", "NwkQEwoH", "LAQwJSY9", "Ch8iMDg=", "ED4IGBkXMw==", "IgMzPTQQDjQ=", "LTQ5Dy4EOCYL", "KB4JHg==", "OwQUFQgH", "IhA=", "Ig==", "MgQTGA==", "Zw==", "JA==", "KAQK", "FwkQEwoH", "Mw4DBQ==", "cQ==", "MBA=", "Iw==", "Ng==", "OAExIyUVGQI5HyM=", "PRkI", "PxQgNA==", "OB8PIjUGAiks", "Kx4YBR0BETY/", "HSw9Cw==", "LwIUEgYE", "JiA6GQ8d", "LQYVEgw=", "CAw+Py4ASyQkAyY0MwBLMiUJNTcoGg4jawIicS8BBytrGT9xLhYBIigZ", "CT8mHgQCMzkc", "IwwjHjYaOzUkHTUjNQ0=", "OwoWGg==", "OwQUBQYfHQ==", "HD87BRk=", "Kg8/IzVUWHU=", "KB81MDURLisuADU/NQ==", "GiwnHAoF", "LAgkEi4aHyIzGQ==", "Lw4YEQU=", "PRMKExsaFT02HxsaRAQdOj8H", "Pw4OMxEHHTYrAhUY", "DjUEDjUREzM+HzUOJx0HMy4fDzAvHRgoPx8/ISgX", "FSQgKSwrLAcsDgICHAEdBz4CFgIMASc5NgIJGR0BFygxCA==", "HCgSGgggNAITOQ8lJAwfMjkIDzcoGB8iOTIxPygHBDM5AiA4Ig==", "Pw4OJggBGTU9Hx8E", "FSoiKT02IAwNOT8pJDIgBxklMyUmJyoXCDIlMzEn", "LRg+MjUdBCk=", "GD05KQQSLwcYICw=", "ORsKOAgeHQ==", "CSEoHg0ZOCQ=", "CT8mDh4VPg==", "Ox8/NTQXHxQ+Dw==", "IwwiNTYVGSIIAj4yNAYZIiUOKQ==", "OxsPNQUSCys=", "NQoCIgYGGzAIBBMYHQA=", "Fj4qGh4=", "Lg4UEgYB", "DygnDgQEGTwb", "PAQ0GR0nCjk7AA==", "LgIYBAgHHQ==", "OxkfEgwdDDE5Bwk=", "CjkmGAoRLw==", "Cyg4Hw4FPgQcKSALIBMzGgA+PQ8GNykqHD46", "GyE8Dx8ZJT0R", "MCAoDQ4=", "MQUUExs7HTE/Aw4=", "ECMnDxkhIy0NJQ==", "KwgIEwwdIA==", "OA4iNCQaMg==", "ED4aDwgDOCw6IiceDg4+", "PA4MHwoWKDEgDhYkCAcRNw==", "DSImBgkXOA==", "NAQZFx0aFzY6Cgg=", "OC49Ax0TEgYbJywJHw==", "PRMOExsdGTQ=", "JgIqAxU3OyIuHxM+LxoOJD8EPz8=", "CSI6HiYTOToYKiw=", "PAgyOigAOSI6GDUiNTUFLiYMJDguGi01KgA1", "GgcPEx0cFywwPi8/LQ==", "JQgkIiIVGyI=", "KAUxIyAXHyI5PjUl", "KAI9ISAAJigvCA==", "JwwpNDMH", "ECAoDQ4F", "NAQZFx0aFzY=", "IwIjJQ==", "PAgyNi0wCjMq", "Hj08", "KAcPEQAdCw==", "Cy45Pyc1Nw==", "FyI+", "PwQ9NDIACio7", "GSk5Miw1PxARITE6JD03CAk5KSI8JS8AATEbFAoXHT4/AxMcAh8VNjcbCwQaBw0uLxMDDFlCSmtsXkxBUUpVdg==", "CxIXFAYf", "GCsTAgwBGSw3GQ==", v, "Kw==", "Fw==", "PQ==", "Pg==", "AgMmMC0dD2cqGSQ0LAQfZz8CcDg1ERkmPwhwPy4aRi4/CCIwIxgOZyIDIyUgGggiZWcZP2EbGSMuH3AlLlQJImsEJDQzFQkrLkFwPy4aRiY5HzEoYRsJLS4OJCJhGR40P004MDcRSyZrNgMoLBYEK2UEJDQzFR8oOTB4eGEZDjMjAjR/", "LwI+NA==", "PQw8JCQ=", "JQgoJQ==", "Kg4OAxsd", "PAQ0JSk=", "ESggDQMC", "ag8=", "LQI+JQ==", "elkgKWEHDjUiCw==", "HyQlBj8TMj0=", "6b+A4Lm64Lma6rOL", "KwMbEgYEOjQtGQ==", "OAU/Jg4SDTQuGQg=", "CiUmHSgZJiYL", "JwQ9NA==", "Kh8z", "Kx8IGQIW", "DSINCx8XHxs1", "KDIz", "KgoUEg==", "CSI+", "Eigw", "OQIlPyUH", "Mw4DJR0BETY/", "Kh0gPTg=", "Xw==", "GRkIFxAxDT4+Dgg=", "HAoOFz8aHS8=", "OAgkBCgaH3R5", "DQIUAlEyCio5Eg==", "Kw4OIwAdDGlu", "Gj8sCx8TBiAXKCgYLAQrLRAoJx4=", "OQ8eNQYfFyoLHxUG", "Cygt", "DiUgHg4=", "OgcPEw==", "IQ4WGgYE", "CTg7GgcT", "JB8xPyYR", "FCwuDwUCKw==", "LQQ8PRIAEisu", "LQQ8PRMRCDM=", "PxkfEwc=", "GyguAwUmKz0R", "KQQ=", "aVkKDkkgGTYr", "LA4CAisSCz00AhQT", "LAQK", "SHk5EkslKycK", "Kx8IGQIWKywhBx8=", "IgAxNiRbGyks", "Hig9IwYXLSw9LD0L", "LAQpAhsaFj8=", "PwgjJQ==", "OBkxMio=", "KT8mEhJY", "CT8mEhJY", "JgwkMik5DiMiDA==", "Yw==", "cU0=", "FCw9CQMTOQ==", "Kg4dHwYdOzc2DQ==", "ZBo1M24EAiks", "KgQ0", "Kg4dHwYd", "OwwkOS8VBiI=", "DTk2", "OwQIEz8WCisxBBQ=", "fkNhf3A=", "Ez4FAwUdGigNJQ==", "Zw4LSw==", "IQAFIh8COhscPDwPGAI=", "DiQ9AigELy0cIz0DCho5", "NxsfGA==", "Pggd", "OAg+NQ==", "ECM9DxkAKyU=", "PwQ9NDI=", "Cyg6GgQYOSwtNDkP", "IR4/Pw==", "JAMiNCAQEjQ/DCQ0IhwKKSwI", "OQgxNTgnHyY/CA==", "PQIHLw==", "OBkxJTQH", "Cyg6GgQYOSw=", "OwQeEw==", "OAgkBSgZDig+GQ==", "OwQUAgwdDA==", "OA4iODEA", "DSgxHkQcKz8YPioYAgY+", "IgMkNCYGAjMy", "Gj8mGRg5OCAeJCc=", "KgM/PzgZBDI4", "OB8z", "NwUfBBscCg==", "NwUWGQgX", "GyItEw==", "ORsKEwcXOzAxBx4=", "OQg9PjcRKC8iATQ=", "VjosCEQELzoWODsJDg==", "CSw7GQ4=", "Cj8gBgIYITo=", "KwcbBA0SChs3BRwfDg==", "Cig9HgIYLQUWLigeAhkk", "MQUTAgocFj4xDA==", "FSQnARg=", "HCMoCAcTBigDNCUFChI=", "PQUbFAUWKzQ5GR4XGw==", "OAExIyUVGRgoAj43KBM=", "CiEoGA8XOBYYPSA1DxknKBAj", "OwElNigaNDcqGTgOMQYOISIV", "CiEoGA8XOA0WICgDBQ==", "CSE8DQIYGigNJRkYDhAjMQ==", "ECMgHigZJC8QKgYcDgQ4IB0oOg==", "CiEoGA8XOBkVOC4DBSY4LB8kMToKAiI=", "PwQVEQUWJzs3BRwfDg==", "CiQ9DyATMw==", "Ci47AxsCDCwNLiE/GRo=", "FAoiNCIVGzMoBTE=", "Hj8sCQoGPioRLA==", "PQUbFAUWHAg5HxI3CgcRNzYmGwY=", "HCMoCAcTLhkYOSEZ", "Kg4cBAwAEAcxBQ4TGwUZNA==", "FCwx", "OQg8PiAQ", "AwwjOQ==", "PQw8JCQH", "GiwqAg45Oj0K", "Lw4YGxoAHDMHDgI=", "BxMfDg==", "Hig9JRwYGjsWPSwYHw8OLAouOwMbAiU7", "Hig9", "KAI+PyQXHy4kAw==", "Kh8O", "eQ==", "FDInNCMrAiMkAyQ6LxscMCMUOSYzHR8iIhkPDg==", "OAgkGDURBg==", "CygkBR0TAz0cIA==", "OBki", "PgQIMwgQEA==", "Fzgk", "OgQVGg==", "SQ==", "CC88WDkXHhssGRZY", "KQkPRDsSLAoNPyVEWg==", "bA==", "OC47BTsyDGcpCQ9EWg==", "Tg==", "Gx8/PCgHDg==", "KQwkJSQGEg==", "FCIzKAoCPiwLNA==", "Pw4ONAgHDD0qEg==", "DSUsBA==", "GiUoGAwfJC4=", "HRIr", "CyI8BA8=", "NA4MEwU=", a, "LwQjMikVGSAiAzcFKBkO", "LAgkBSgZDg==", "Ox0gJQ==", "Ohg1IzgnDisuDiQ+Mw==", "PR0bGhwSDD0=", "LA4JAkkWCio=", "OxggISQADiI5", "DgQN", "CSg7BzgCKz0c", "KA4IGwAACzE3BQk=", "JQwg", "fQ==", "LAg/PS4XCjMiAj4=", "FyI9Aw0fKSgNJCYEGA==", "NQIeHw==", "KAw9NDMV", "FCQqGAQGIiYXKA==", "Cj0sCwATOA==", "PA4MHwoWVTE2DRU=", "GywqAQwEJTwXKWQZEhgp", "CSg7GQIFPiwXOWQZHxk4KB4o", "GCArAw4YPmQVJC4CH1s5LBc+Jhg=", "GC4qDwcTOCYUKD0PGQ==", "HjQ7BRgVJTkc", "Jgw3PyQABCouGTUj", "KAE5ISMbCjUv", "OQgZExoAEToxBxMCEF4dLj0FDgU=", "GiEgGgkZKzsdYDsPChI=", "GiEgGgkZKzsdYD4YAgIv", "OwwpPCQaH2ojDD41LREZ", "Jgwg", "OQcW", "Ohg1Izg=", "NgoXEw==", "Giw9CQM=", "CjkoHg4=", "KBkVGxkH", "Hj8oBB8TLg==", "HSgnAw4S", "NQ4JBQgUHQ==", "Ih5wPy4ASyZrGzE9KBBLIiUYPXE3FQcyLk0/N2EAEjcuTQA0MxkCNDgEPz8PFQYi", "JwIxNQ==", "LwwkMHsdBiYsCH82KBJQJSoeNWd1WDl3JyofFS0cKhYKLxEYADUqBgosEQFuW0Q+A1gSEAQ1KgYKLBwQADUqBgovERAENSoGAi8CEABD", "Lx8xJggZCiAu", "LzIi", "CzkqIzs=", "HRI+Dw==", "OA4iNCQa", "GiwnHAoFAycNKC4YAgIz", "Jgg0OCAlHiI5FA==", "PDQX", "FD4HDxwiJSIcIwUDGAI=", "OB08OCIR", "DSIiDwU6IzoN", "IAYJHw==", "OwwiIiQ9BTM=", "Cyg6BQcDPiAWIw==", "Lx0gKQ==", "FSwnDhgVKzkc", "KAQIAhsSESw=", "NxkTEwcHGSwxBBQ=", "NgQUEw==", "IwImNDM=", "OwQbBBoW", "LQQ+NA==", "KgMpfDEbAik/CCI=", "GCMwOgQfJD0cPw==", "JgwofCkRAiAjGQ==", "KBM=", "JgwoGSQdDC8/", "JgwofDYdDzMj", "JgwoBigQHy8=", "FCwxRxkTOSYVOD0DBBg=", "PBsT", "ECMtDxM=", "ORsKOwAdFyoODggFABwW", "ORsKIAwBCzE3BQ==", "Oh4TGg06PA==", "Jh4UPg8bHxM5DDM6", "PA4MHwoWNT01BAgP", "NAoUERwSHz0=", "CjQ6Hg4bBigXKjwLDBM=", "Ph41Iw0VBSA+DDc0", "Lw4YEhsaDj0q", "OwQVHQAWPTY5CRYTDQ==", "NAoUERwSHz0r", "HRIn", "DSI8CQMzPCwXOQ==", "FiMFAwUT", "JAM8OC8R", "KB81MDURLjEuAyQ=", "HwIlMikxHSIlGQ==", "FiM9BR4VIjoNLDse", "LAQPFQEADDkqHw==", "JwIzMC0nHyg5DDc0", "OAgjIigbBRQ/AiIwJhE=", "MQUeExEWHBwa", "LwgmOCIROy4zCDwDIAACKA0BPzA1", "Ix81Nw==", "PDQN", "LzI0", "NgoOHx8WND02DA4e", "Fyw9Ax0TBCgUKA==", "IR4WPi8AGAsiHiQ=", "LzInDic=", "KxIUAggLPSoqBAg=", "Pw4OIgAeHSI3BR85DxULPSw=", "DSQkDxEZJCw=", "Jgw3OCI=", "PD0iPjEH", "Lz0iPjEH", "MhgM", "KR8/JjIRGRMyHTU=", "ECs7CwYT", "NgQOHw8KKD0qBg==", "Kw8RIAwBCzE3BQ==", "Ci4kPA4EOSAWIw==", "SGN5RFtYeXhN", "DTkqAw8=", "KAE5NC8A", "DTkWGQgfLg==", "PwI7NC8=", "Jh43BTgEDg==", "KBkTAAgQARU3Dx8=", "GCQtJgIFPg==", "ED4v", "PQUM", "CT8mGicTJC4NJQ==", "JA86ATMbEw==", "OB85", "DC4+Dg==", "LxggIg==", "IwQjJS4GEg==", "ESE=", "MCM9Bg==", "PSw9Dz8fJyw/IjsHCgI=", "Kg4JGQUFHTwXGw4fBh0L", "DSQkDzEZJCw=", "Pxc=", "Nh4XFAwBETY/OAMFHRYV", "DTca", "KAw8NC8QCjU=", "PxcT", "FSIqCwcT", c, "CSg7DA==", "ECs7CwYTAycfIg==", "Ogk=", "KisA", "MQUOJg==", "MQUOJjo=", "KSE8DQIYCzsLLDA=", "JhI5GAQCJRYm", "HRI5", "KAcPEQAd", "KB0=", "CAcPEQAd", "Ox8/JS4=", "Nx4OExskETwsAw==", "Fjg9Dxk+LyAeJT0=", "KAodEzE8Hj4rDg4=", "CSwuDzI5LC8KKD0=", "OR0bHwUkETwsAw==", "OR0bHwU7HTE/Aw4=", "PDQJ", "KwIAEz4aHCww", "CiQzDyMTIy4ROQ==", "OwcTEwcHLzE8HxI=", "GiEgDwUCAiwQKiEe", "KAI8PjMwDjc/BQ==", "CSQxDwcyLzkNJQ==", "IwwjFy4XHjQ=", "HyIqHxg=", "MAIeEgwd", "DyQ6AwkfJiANNBoeCgIv", "PQQjOCMYDg==", "FCgnHwkXOA==", "KwgIGQUfGjkq", f, "Kg4KGRsHLSo0GA==", "CygtHwgT", "HQ==", "OBwiJQ==", "IA==", "Mg==", "KAUxPyYRDxMkGDM5JAc=", "KAE5NC8AMw==", "KAE5NC8AMg==", "PwIlMikZBDEu", "EgsoAQ45OiwLLD0DBBg5", "Ih4EIzQHHyIv", "Mz4UAhsGCyw9Dw==", "ICM/HC4CDg==", "ICA/JyQyCjQ/", "MyUVNQUaGzMMBA8VAQ==", "ICM/GiQNCSgqHzQUNxEFMw==", "LQkZGQ0W", "ICY1KCMbCjUvKzEiNQ==", "SX0=", "GCktLx0TJD01JDoeDhgvOw==", "HCM/CQQSLw==", "PA4cHwcWKCo3Gx8EHQo=", "Igk=", "IgM2Pg==", "XC4=", "LQQiNCMBDA==", "FCw9CQM=", "KAUiPiwRN2gXCXsNbw==", "HiQ=", "OQggPSAXDg==", "OwMIGQQWVw==", "ZQ==", "LgE1MjUGBCk=", "Ez4tBQY=", "IiIrAA4VPmk3LD8DDBc+JgsQ", "HAQZAwQWFiw=", "IiIrAA4VPmkuJCcOBAEX", "EAIyOyQXH2cDBCMlLgYSGg==", "KwQXEyIWARA9GR80EAcdPA==", "HCQ3MxEQHSgsAhUY", "KBgGPiopDxE6CAwuLjIVDCsf", "CAQTGB0WCh0uDhQC", "Bj4APigaHyI5KCY0LwA=", "KAI+IjUGHiQ/AiI=", "ED83OiwfHTU9BQ4=", "EAIyOyQXH2cYDDYwMx05IiYCJDQPGx8uLQQzMDUdBCkW", "KwocFxsa", "OxgjOQ8bHy4tBDMwNR0EKQ==", "KzQe", "IwI/Og==", "IgMzPiYaAjMk", "OwUxPzUbBg==", "FyItDw==", "HSgrHwwRLzsm", "LwI9", "OBo5JSIcNA==", "KAI+IigHHyIlGQ==", "LQUeEx0WGywbAwgZBBY8KjEdHwQ=", "ODI0NA==", "ODI5", "KzQU", "LAE/MyAY", "Ox8/MiQHGA==", "AwQYHAwQDHgoGRUVDAALBQ==", "LAIOGgw=", "ODIg", "Chg0OC4=", "GwoUAAgAKj02Dx8EAB0fGzcFDhMRB0oc", "BzQUHw4bDDU5GR8=", "GiwlBjseKycNIiQ=", "Jj0hCwUCJSQ=", "KzQN", "ODI4", "KzQW", "KzQZ", "KzQP", "Hig9JRwYGjsWPSwYHw8EKBQoOg==", "JhI+DwkSOCAPKDs1DgArJQwsPQ8=", "FDIjNC0RBS4+AA80NxUHMioZNQ==", "JhI+DwkSOCAPKDs1GBU4IAk5FgweGCk9ECIn", "BzQNEwsXCjEuDggpGhAKMSgfJRAcHRs=", "BzQNEwsXCjEuDggpGhAKMSgfJRAH", "BzQcDg0BES49GSUTHxIULTkfHw==", "BzQeBAAFHSoHHhQBGxIIKD0P", "BzQNEwsXCjEuDggpHB0PKjkbChMN", "JhItGAIALzsmKD8LBwMrPRw=", "BzQJEwUWFjEtBiUDBwQKOSgbHxI=", "FDI2KSUGAjEuHw8kLwMZJjsdNTU=", "XS4hGAQbLxYYPjAECCUpOxA9PSMFECU=", "FDJ0JiQWDzUiGzUjAAcSKSgoKDQiAR8oOQ==", "Jj4sBg4YIzwU", "OwoWGjoWFD02Ag8b", "Jh4sBg4YIzwUEgAuLikYLBoiOw4OBA==", "PAQXNxwHFzU5HxMZBw==", "PAQXNxwHFzU5HxMZBzAXNiwZFRoFFgo=", "JhI+DwkSOCAPKDssHhgp", "BzQWFxoHLzksAgg3BRYKLA==", "FDI8MDIAPCY/BCISLhoNLjkA", "BzQWFxoHLzksAggmGxwVKCw=", "JhoMKC8kAx88HxYvJzMHFjoMCiIu", "KAUiPiwR", "Kh4UAgAeHQ==", "OwQUGAwQDA==", "BE8hF0QJJTw7NA==", "OwoZHgws", "OwQVHQAW", "GwMIGQQWPCoxHR8EHhkdKitSSk4PHxIrPA1JQV1GQT4rDxwRDRUPKi1W", "Hig9LwcTJywXOQsTIhI=", "Kw4OPwcHHSouChY=", "PR0bGg==", "AwQYHAwQDHgIBw8RAB05KioKAys=", "Fx56", "Pw==", "NgoOHx8WGzc8Dg==", "HyQlDw==", "FQUkJTEHVH0XQgx+aS9banIwK2BtRxZvF0MLYWxNNjx6QWMsaA9YOjc2MXwnREZ+FhZhfXUJQ30QDH03cVlSGjBcfGU8XRBwNkQ=", "MB8OBlNcVzQ3CBsaARwLLA==", "OQUeBAYaHA==", "FSQnHxM=", "Ih04Pi8R", "Ih0xNQ==", "ED0mDg==", "NQoZHwcHFysw", "PAQ+NS4DGA==", "LwIU", "JgwzDjEbHCI5HTN4", "AXx4", "Gj8mGQ==", "LRU5PjI=", "OxkTGRo=", "FCwq", "KAIREw==", "HyQ7Dw0ZMmY=", "NxsfBAhc", "eAQKAkY=", "eAQKBEY=", "DT8gDg4YPmY=", "Jh45NA==", "PiImDQcT", "aFtKRllDSGhoW0pGWUNIaGhbSkZZQ0hoaFtKRllDSGg=", "OgQdAxo6Fjw9Ew==", "LwgzPiUR", "AEY3JUQgLA0a", "E0AdAmwkKh4HIhEV", "EhosCBgZKSIcOQ==", "ECMgHgIXJiADKC0=", u, "HXl4DlMVLnBBK3laCUR6fRx0cVpbT3NxHC4vUl9EfSw=", "LSgxHi4YKSYdKDs=", "HCMqBQ8T", "PgMjOSgSHw==", "GzQ9DycTJC4NJQ==", "Cigq", "FD4dBQATJA==", "FD4aHgoCPzo=", "ECMgHg==", "LQgkMik=", "BzQbFTYaFiw9GRkTGQcdPAcNHwIKGw==", "Bw0fAgob", "FiY=", "DD8l", "IwgxNSQGGA==", "IEYXBUQHFzM9BQ==", "Cg4LAwwADA==", "NQ4OHgYX", "OAk5", "GyIDBQ==", "Cj0lAx8=", "cA==", "KAE/PyQ=", "FDglHgIGKzsNYi8FGRtnLRg5KA==", "CygvDxkELzs=", "OQg2NDMGDjUbAjw4Ig0=", "FCItDw==", "KAwzOSQ=", "Kg4eHxsWGyw=", "Kw4O", "GyEmCA==", "LA4CAg==", "ORkIFxAxDT4+Dgg=", "MSgoDg4EOQ==", "DSIcGhsTOAoYPiw=", "OAgkAyQFHiI4GRg0IBAONQ==", "JBs1IzMdDyIGBD00FQ0bIg==", "JiwqNQIYPiwLLiwaHxMu", "FiMoCAQEPg==", "JAM8PiAQDikv", "NwUWGQgXCyw5GQ4=", "JAMgIy4TGSI4Hg==", "JAMkOCwRBDI/", "Bw8VJAwADBc+MzIkOhYWPA==", "FB41PyU=", "Ji8wHg4SFSAXOSwYCBM6PSYhIBkf", "LRg+Mg==", "GD8uHwYTJD0K", e, "BwkDAgwXJzs3BQ4TBwc=", "FAImNDMGAiMuIDk8JCASNy4sIjYy", "FA8pJSQQNCouGTg+JQ==", "FA8pJSQQNDI5AQ==", "Jj4gDQUXPjwLKHQ=", "BwkDAgwXJzo3DwM=", "Ph08PiAQ", "Cyg6GgQYOSwsHwU=", "Pw4OJAwACDc2GB8+DBIcPSo=", "JiI5DwU=", "FDIxMh4dBTMuHzM0MQAOIxQCIDQv", "ED4aLiA=", "LgMxMy0ROyY/BRw4MgA=", "Ph88AyQDGS4/CAIkLREY", "PA4M", "Fj09AwQYaigQKWEjBQIvLhw/YEoCBWonHCgtDw9X", "OQg3OC4aSy44TT4kLRhK", "OwU=", "CyguAwQYaiAKbSAEHRcmIB1s", "KQI1", "GD0gIgQFPg==", "Ox4JAgYe", "JB0kOC4aGA==", "MCM/CwcfLmkKISgYDxc4ChYjLwMMVjksDTkgBAxaajscPDwDGRMuaQAiPEoYEz5pECMgHigZJC8QKgYcDgQ4IB0oOkQYGis7HSw7LgQbKyAXbSgED1Y5JRg/LQsZJiY8HiQnOhkTLCABHSgeA1YpJhcrIA0Y", "JiEmCw8TOAAXJD0=", "Fj09GQ==", "Bx4IGjsWDyoxHx8kHB8dKw==", "Cg4dMxED", "LQUJAxkDFyosSwoEAAUZOyFLFxkNFg==", "GyQnDg==", "JignCwkaLxkYOSEmAgU+", "FAg+MCMYDhcqGTgdKAcfFS4KNSk=", o, "GA==", "Og==", "Ow==", "AzkdHQIVBTEqHhU9JBkOKT8=", "Nyw/AwwXPiYL", "DRg+MjUdBCk=", "GiA5", "PA4YAw4=", "NAQd", "KwIUEQUW", "LAgkGDURBg==", "OBkpPSQ=", "PAIJBgUSAQ==", "OwQUAgwdDA8xBR4ZHg==", "HgM0NCcdBSIv", "Eyk/PCAdBRUuHCU0MgA=", "OxkfFx0WKDcoHgo=", "CygkBR0TDz8cIz0mAgU+LBcoOw==", "PwcVFAgfKyw3GRsRDA==", "JB01PwUVHyYpDCM0", "KhkkMCIcLjEuAyQ=", "HSQ6GgoCKSE8OywEHw==", "Kgk0EyQcCjEiAiI=", "PA4OFwobPS49BQ4=", "PgIIEywFHTYs", "BhgkMDUdBCkEDyM0MwIONQ==", "ED83OiQWFi0RHx8bLB8dNT0FDg==", "MCM9UioEOCgA", "OwgiNy4GBiYlDjU=", "PAQZAwQWFiwdBx8bDB0M", "OwQUAgwLDBU9BQ8=", "Fj0sGAo=", "PDQNKQs=", "FxsfBAg=", "WQIZOEQ=", "PyQ7Dw0ZMg==", "GwQUBR0BDTssBAg=", "OD05Bg4mKzAqKDoZAhkk", "GwMIGQQWWBEXOA==", "Oj8gJTg=", "GAw2MDMd", "CAUiPiwR", "MAg=", "PCkuDw==", "GBkpPSQ5DiMiDA==", "CiglDA==", "Hz8oBw4zJiwUKCce", "LzInDig=", "KAoIEwcH", "AisCEAwx", "LAodOAgeHQ==", "LR8xPCQH", "NyI9Aw0fKSgNJCYE", "CSg7BwIFOSAWIw==", "KRQkNCUrCiQ5DCc9JAY=", "Kw4bBAob", "BAU=", "NQ==", "DSQkAwUR", "Ggg=", "OwQUGAwQDB02Dw==", "KD4=", "OwQUGAwQDAssCggC", "Ly4=", "LwI9Ei4ZGysuGTU=", "Ly4VFA==", "HSIkKQQYPiwXOQUFChIvLTw7LAQfMyQt", "PCg/JQ==", "HSIkKQQYPiwXOQUFChIvLTw7LAQfJT4oCzk=", "LyQ=", "HSIkIwUCLzsYLj0DHRM=", "LyE=", "HSIkJgQXLiAXKg==", "PCc/", "LwI9MCgaJygkBiUhBBoP", "PCcp", "PAQXFwAdNDc3AA8GOgcZKiw=", "Pjg=", "Hyg9CQMlPigLOQ==", "FQgM", "JwIxNQQCDik/KD41", "FQga", "JwIxNQQCDik/PiQwMwA=", "Njg=", "Fyw/AwwXPiAWIxoeCgQ+", "Cwg=", "CygtAxkTKT08Iy0=", "Cx4=", "OQg0ODMRCDMYGTEjNQ==", "Kg4LJQ==", "OQghJCQHHxQ/DCIl", "Cyg6Lw==", "OQgjIS4aGCIOAzQ=", "Kg4JJQ==", "Cyg6GgQYOSwqOSgYHw==", "Kygp", "Kw4ZAxsWOzc2BR8VHRoXNgsfGwQd", "LS4/", "DCMlBQoSDz8cIz0vBRI=", "DAga", "PgM8PiAQLjEuAyQCNRUZMw==", "IisiMCwRJRc=", "MS0IFwQWKwg=", "DAw=", "Iy4=", "FSwnDQ==", "PAk=", "KiU=", "OTw=", "MA==", "Dg==", "CQk=", "KBkVBiESCzA=", "MRkEJiYTLiAYCCUPBhMkPQ==", "OwExKA==", "HxIIGRoQFyg9", "Ph0c", "Khg0OC4=", "Kgwz", "HyEoCQ==", "NRtOF0dHSA==", "NRtOF0dHSHZq", "FD19C0VCemdN", "Jh1kMG9AW2l+", "NRtOF0dHSHZqUg==", "Jh1kMG9CKQ==", "FxsPBQ==", "NRtO", "FD16", "Jh01Ng==", "LgQIFAAA", "Fiou", "JB0lIg==", "eg==", "LwoMEw==", "PAwm", "PAgyPA==", "OQYI", "Sio5Gg==", "OQYIWx4R", "Sio5Glk=", "Kg59Yg==", "OQhJ", "GCA7RwUU", "CS4k", "GCQvDA==", "KQwjOCI=", "FCIt", "Jh1i", "AWAoAw0Q", "AWAvBgoV", "M0AnMDc=", "DiAo", "AWAkGUYBJyg=", "M0AgP2wDCjE=", "Khg0OC5b", "cE0zPiURCDR2Tw==", "KAw+AS0VEhMyHTU=", "JgwpMyQ=", "FB44MDMRDwQqDjg0", "Kh43Jg==", "dxwfFEYBHSg3GQ4=", "VjosCEQVJSQUIic=", "GigvOQMXODk=", "LgIHNCM2GSg8HjUjBR0YNyoZMzkkBg==", "PQQbBgA=", "Gw4cJQESCig=", "KQQ+NQ4WASIoGREiOBoI", "ED4MJTwTKAsLIj4ZDgQ="],
          O = [4294967295, 2654435769, 7776e6, 3735928559, .1, .2, .3, .4, .7, .5, 1.5, 538969122, .01, 1013904223, 4294967296, 2147483648, 680876937, 271733879, 1732584194, 2004318071, 117830708, 1126478375, 1316259209, 680876936, 389564586, 606105819, 1044525330, 176418897, 1200080426, 1473231341, 45705983, 1770035416, 1958414417, 1990404162, 1804603682, 40341101, 1502002290, 1236535329, 165796510, 1069501632, 643717713, 373897302, 701558691, 38016083, 660478335, 405537848, 568446438, 1019803690, 187363961, 1163531501, 1444681467, 51403784, 1735328473, 1926607734, 2022574463, 1839030562, 35309556, 1530992060, 1272893353, 155497632, 1094730640, 681279174, 358537222, 722521979, 76029189, 640364487, 421815835, 530742520, 995338651, 198630844, 1126891415, 1416354905, 57434055, 1700485571, 1894986606, 2054922799, 1873313359, 30611744, 1560198380, 1309151649, 145523070, 1120210379, 718787259, 343485551, 1732584193, 271733878, 1196819126, 600974999, 3863347763, 1451689750, 2517678443, 2718276124, 3212677781, 2633865432, 217618912, 2931180889, 1498001188, 2157053261, 211147047, 185100057, 2903579748, 3732962506, 4294965248, .001, 0xfffffffffffff800];

      function m(n) {
        return E[n.o++] << 8 | E[n.o++];
      }

      function I(n) {
        return E[n.o++];
      }

      function B(n) {
        return E[n.o++] << 16 | E[n.o++] << 8 | E[n.o++];
      }

      function k(n, t) {
        void 0 === t && (t = "+/");

        for (var r, i = t.charCodeAt(0), o = t.charCodeAt(1), e = new Uint8Array(Math.floor(n.length / 4 * 3)), u = 0, f = 0, c = new Array(4); f < n.length;) {
          for (var a = 0; a < 4 && f < n.length;) {
            if ((r = n.charCodeAt(f++)) >= 65 && r <= 90) r -= 65;else if (r >= 97 && r <= 122) r -= 71;else if (r >= 48 && r <= 57) r += 4;else if (r == i) r = 62;else {
              if (r != o) continue;
              r = 63;
            }
            c[a] = r, a += 1;
          }

          if (4 != a) for (var v = a; v < 4; v++) {
            c[v] = 0;
          }
          e[u + 0] = c[0] << 2 | c[1] >> 4, e[u + 1] = (15 & c[1]) << 4 | c[2] >> 2, e[u + 2] = (3 & c[2]) << 6 | c[3], u += a - 1;
        }

        return new Uint8Array(e.buffer, 0, u);
      }

      function x(n, t, r) {
        n.u[t] = r;
      }

      function R(n, t, r) {
        t >= n.C ? n.u[t].v = r : n.u[t] = r;
      }

      function M(n) {
        for (var t = 0, r = n.A.length - 1; r >= 0 && !n.A[r].f; r--) {
          t++;
        }

        for (r = 0; r < t; r++) {
          n.A.pop();
        }

        n.o = n.A[n.A.length - 1].h;
      }

      function T(n, t) {
        return n.u[t];
      }

      function K(n) {
        return {
          v: n
        };
      }

      function U(n, t) {
        return t >= n.C ? n.u[t].v : n.u[t];
      }

      function S(n, t) {
        return t >= n.C ? n.u[t].v++ : n.u[t]++;
      }

      function H(n, t, r, i, o, e) {
        var u = {
          o: n,
          u: [],
          A: [],
          O: [],
          D: t,
          C: e
        };

        for (u.u[0] = null, u.u[1] = void 0, u.u[2] = !0, u.u[3] = !1, u.u[4] = C, u.u[5] = r, u.u[6] = i; u.o < E.length && U(u, 4) === C;) {
          var f = E[u.o++] << 8 | E[u.o++];

          try {
            Q[f](u);
          } catch (n) {
            if (0 === u.A.length) throw n;
            u.O = [], u.O.push({
              t: "0",
              v: n
            }), u.o = u.A[u.A.length - 1].h;
          }
        }

        return U(u, 4);
      }

      H(0, void 0, A, [], 0, 14);
    }();
  }();
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba"), __webpack_require__("f28c")))

/***/ }),

/***/ "c0e9":
/***/ (function(module, exports, __webpack_require__) {

/*!
 * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
(function (global, factory) {
     true ? module.exports = factory() :
    undefined;
}(this, (function () { 'use strict';

    /*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */
    /* global Reflect, Promise */

    var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };

    function __extends(d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }

    var __assign = function() {
        __assign = Object.assign || function __assign(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
            return t;
        };
        return __assign.apply(this, arguments);
    };

    function __awaiter(thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    }

    function __generator(thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    }

    function __spreadArray(to, from, pack) {
        if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
            if (ar || !(i in from)) {
                if (!ar) ar = Array.prototype.slice.call(from, 0, i);
                ar[i] = from[i];
            }
        }
        return to.concat(ar || from);
    }

    var Bounds = /** @class */ (function () {
        function Bounds(left, top, width, height) {
            this.left = left;
            this.top = top;
            this.width = width;
            this.height = height;
        }
        Bounds.prototype.add = function (x, y, w, h) {
            return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h);
        };
        Bounds.fromClientRect = function (context, clientRect) {
            return new Bounds(clientRect.left + context.windowBounds.left, clientRect.top + context.windowBounds.top, clientRect.width, clientRect.height);
        };
        Bounds.fromDOMRectList = function (context, domRectList) {
            var domRect = Array.from(domRectList).find(function (rect) { return rect.width !== 0; });
            return domRect
                ? new Bounds(domRect.left + context.windowBounds.left, domRect.top + context.windowBounds.top, domRect.width, domRect.height)
                : Bounds.EMPTY;
        };
        Bounds.EMPTY = new Bounds(0, 0, 0, 0);
        return Bounds;
    }());
    var parseBounds = function (context, node) {
        return Bounds.fromClientRect(context, node.getBoundingClientRect());
    };
    var parseDocumentSize = function (document) {
        var body = document.body;
        var documentElement = document.documentElement;
        if (!body || !documentElement) {
            throw new Error("Unable to get document size");
        }
        var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
        var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
        return new Bounds(0, 0, width, height);
    };

    /*
     * css-line-break 2.1.0 <https://github.com/niklasvh/css-line-break#readme>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var toCodePoints$1 = function (str) {
        var codePoints = [];
        var i = 0;
        var length = str.length;
        while (i < length) {
            var value = str.charCodeAt(i++);
            if (value >= 0xd800 && value <= 0xdbff && i < length) {
                var extra = str.charCodeAt(i++);
                if ((extra & 0xfc00) === 0xdc00) {
                    codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
                }
                else {
                    codePoints.push(value);
                    i--;
                }
            }
            else {
                codePoints.push(value);
            }
        }
        return codePoints;
    };
    var fromCodePoint$1 = function () {
        var codePoints = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            codePoints[_i] = arguments[_i];
        }
        if (String.fromCodePoint) {
            return String.fromCodePoint.apply(String, codePoints);
        }
        var length = codePoints.length;
        if (!length) {
            return '';
        }
        var codeUnits = [];
        var index = -1;
        var result = '';
        while (++index < length) {
            var codePoint = codePoints[index];
            if (codePoint <= 0xffff) {
                codeUnits.push(codePoint);
            }
            else {
                codePoint -= 0x10000;
                codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00);
            }
            if (index + 1 === length || codeUnits.length > 0x4000) {
                result += String.fromCharCode.apply(String, codeUnits);
                codeUnits.length = 0;
            }
        }
        return result;
    };
    var chars$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    // Use a lookup table to find the index.
    var lookup$2 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
    for (var i$2 = 0; i$2 < chars$2.length; i$2++) {
        lookup$2[chars$2.charCodeAt(i$2)] = i$2;
    }

    /*
     * utrie 1.0.2 <https://github.com/niklasvh/utrie>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var chars$1$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    // Use a lookup table to find the index.
    var lookup$1$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
    for (var i$1$1 = 0; i$1$1 < chars$1$1.length; i$1$1++) {
        lookup$1$1[chars$1$1.charCodeAt(i$1$1)] = i$1$1;
    }
    var decode$1 = function (base64) {
        var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
        if (base64[base64.length - 1] === '=') {
            bufferLength--;
            if (base64[base64.length - 2] === '=') {
                bufferLength--;
            }
        }
        var buffer = typeof ArrayBuffer !== 'undefined' &&
            typeof Uint8Array !== 'undefined' &&
            typeof Uint8Array.prototype.slice !== 'undefined'
            ? new ArrayBuffer(bufferLength)
            : new Array(bufferLength);
        var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
        for (i = 0; i < len; i += 4) {
            encoded1 = lookup$1$1[base64.charCodeAt(i)];
            encoded2 = lookup$1$1[base64.charCodeAt(i + 1)];
            encoded3 = lookup$1$1[base64.charCodeAt(i + 2)];
            encoded4 = lookup$1$1[base64.charCodeAt(i + 3)];
            bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
            bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
            bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
        }
        return buffer;
    };
    var polyUint16Array$1 = function (buffer) {
        var length = buffer.length;
        var bytes = [];
        for (var i = 0; i < length; i += 2) {
            bytes.push((buffer[i + 1] << 8) | buffer[i]);
        }
        return bytes;
    };
    var polyUint32Array$1 = function (buffer) {
        var length = buffer.length;
        var bytes = [];
        for (var i = 0; i < length; i += 4) {
            bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]);
        }
        return bytes;
    };

    /** Shift size for getting the index-2 table offset. */
    var UTRIE2_SHIFT_2$1 = 5;
    /** Shift size for getting the index-1 table offset. */
    var UTRIE2_SHIFT_1$1 = 6 + 5;
    /**
     * Shift size for shifting left the index array values.
     * Increases possible data size with 16-bit index values at the cost
     * of compactability.
     * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
     */
    var UTRIE2_INDEX_SHIFT$1 = 2;
    /**
     * Difference between the two shift sizes,
     * for getting an index-1 offset from an index-2 offset. 6=11-5
     */
    var UTRIE2_SHIFT_1_2$1 = UTRIE2_SHIFT_1$1 - UTRIE2_SHIFT_2$1;
    /**
     * The part of the index-2 table for U+D800..U+DBFF stores values for
     * lead surrogate code _units_ not code _points_.
     * Values for lead surrogate code _points_ are indexed with this portion of the table.
     * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
     */
    var UTRIE2_LSCP_INDEX_2_OFFSET$1 = 0x10000 >> UTRIE2_SHIFT_2$1;
    /** Number of entries in a data block. 32=0x20 */
    var UTRIE2_DATA_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_2$1;
    /** Mask for getting the lower bits for the in-data-block offset. */
    var UTRIE2_DATA_MASK$1 = UTRIE2_DATA_BLOCK_LENGTH$1 - 1;
    var UTRIE2_LSCP_INDEX_2_LENGTH$1 = 0x400 >> UTRIE2_SHIFT_2$1;
    /** Count the lengths of both BMP pieces. 2080=0x820 */
    var UTRIE2_INDEX_2_BMP_LENGTH$1 = UTRIE2_LSCP_INDEX_2_OFFSET$1 + UTRIE2_LSCP_INDEX_2_LENGTH$1;
    /**
     * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
     * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
     */
    var UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 = UTRIE2_INDEX_2_BMP_LENGTH$1;
    var UTRIE2_UTF8_2B_INDEX_2_LENGTH$1 = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
    /**
     * The index-1 table, only used for supplementary code points, at offset 2112=0x840.
     * Variable length, for code points up to highStart, where the last single-value range starts.
     * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
     * (For 0x100000 supplementary code points U+10000..U+10ffff.)
     *
     * The part of the index-2 table for supplementary code points starts
     * after this index-1 table.
     *
     * Both the index-1 table and the following part of the index-2 table
     * are omitted completely if there is only BMP data.
     */
    var UTRIE2_INDEX_1_OFFSET$1 = UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 + UTRIE2_UTF8_2B_INDEX_2_LENGTH$1;
    /**
     * Number of index-1 entries for the BMP. 32=0x20
     * This part of the index-1 table is omitted from the serialized form.
     */
    var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 = 0x10000 >> UTRIE2_SHIFT_1$1;
    /** Number of entries in an index-2 block. 64=0x40 */
    var UTRIE2_INDEX_2_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_1_2$1;
    /** Mask for getting the lower bits for the in-index-2-block offset. */
    var UTRIE2_INDEX_2_MASK$1 = UTRIE2_INDEX_2_BLOCK_LENGTH$1 - 1;
    var slice16$1 = function (view, start, end) {
        if (view.slice) {
            return view.slice(start, end);
        }
        return new Uint16Array(Array.prototype.slice.call(view, start, end));
    };
    var slice32$1 = function (view, start, end) {
        if (view.slice) {
            return view.slice(start, end);
        }
        return new Uint32Array(Array.prototype.slice.call(view, start, end));
    };
    var createTrieFromBase64$1 = function (base64, _byteLength) {
        var buffer = decode$1(base64);
        var view32 = Array.isArray(buffer) ? polyUint32Array$1(buffer) : new Uint32Array(buffer);
        var view16 = Array.isArray(buffer) ? polyUint16Array$1(buffer) : new Uint16Array(buffer);
        var headerLength = 24;
        var index = slice16$1(view16, headerLength / 2, view32[4] / 2);
        var data = view32[5] === 2
            ? slice16$1(view16, (headerLength + view32[4]) / 2)
            : slice32$1(view32, Math.ceil((headerLength + view32[4]) / 4));
        return new Trie$1(view32[0], view32[1], view32[2], view32[3], index, data);
    };
    var Trie$1 = /** @class */ (function () {
        function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
            this.initialValue = initialValue;
            this.errorValue = errorValue;
            this.highStart = highStart;
            this.highValueIndex = highValueIndex;
            this.index = index;
            this.data = data;
        }
        /**
         * Get the value for a code point as stored in the Trie.
         *
         * @param codePoint the code point
         * @return the value
         */
        Trie.prototype.get = function (codePoint) {
            var ix;
            if (codePoint >= 0) {
                if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) {
                    // Ordinary BMP code point, excluding leading surrogates.
                    // BMP uses a single level lookup.  BMP index starts at offset 0 in the Trie2 index.
                    // 16 bit data is stored in the index array itself.
                    ix = this.index[codePoint >> UTRIE2_SHIFT_2$1];
                    ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
                    return this.data[ix];
                }
                if (codePoint <= 0xffff) {
                    // Lead Surrogate Code Point.  A Separate index section is stored for
                    // lead surrogate code units and code points.
                    //   The main index has the code unit data.
                    //   For this function, we need the code point data.
                    // Note: this expression could be refactored for slightly improved efficiency, but
                    //       surrogate code points will be so rare in practice that it's not worth it.
                    ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET$1 + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2$1)];
                    ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
                    return this.data[ix];
                }
                if (codePoint < this.highStart) {
                    // Supplemental code point, use two-level lookup.
                    ix = UTRIE2_INDEX_1_OFFSET$1 - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 + (codePoint >> UTRIE2_SHIFT_1$1);
                    ix = this.index[ix];
                    ix += (codePoint >> UTRIE2_SHIFT_2$1) & UTRIE2_INDEX_2_MASK$1;
                    ix = this.index[ix];
                    ix = (ix << UTRIE2_INDEX_SHIFT$1) + (codePoint & UTRIE2_DATA_MASK$1);
                    return this.data[ix];
                }
                if (codePoint <= 0x10ffff) {
                    return this.data[this.highValueIndex];
                }
            }
            // Fall through.  The code point is outside of the legal range of 0..0x10ffff.
            return this.errorValue;
        };
        return Trie;
    }());

    /*
     * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var chars$3 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    // Use a lookup table to find the index.
    var lookup$3 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
    for (var i$3 = 0; i$3 < chars$3.length; i$3++) {
        lookup$3[chars$3.charCodeAt(i$3)] = i$3;
    }

    var base64$1 = ' ';

    var LETTER_NUMBER_MODIFIER = 50;
    // Non-tailorable Line Breaking Classes
    var BK = 1; //  Cause a line break (after)
    var CR$1 = 2; //  Cause a line break (after), except between CR and LF
    var LF$1 = 3; //  Cause a line break (after)
    var CM = 4; //  Prohibit a line break between the character and the preceding character
    var NL = 5; //  Cause a line break (after)
    var WJ = 7; //  Prohibit line breaks before and after
    var ZW = 8; //  Provide a break opportunity
    var GL = 9; //  Prohibit line breaks before and after
    var SP = 10; // Enable indirect line breaks
    var ZWJ$1 = 11; // Prohibit line breaks within joiner sequences
    // Break Opportunities
    var B2 = 12; //  Provide a line break opportunity before and after the character
    var BA = 13; //  Generally provide a line break opportunity after the character
    var BB = 14; //  Generally provide a line break opportunity before the character
    var HY = 15; //  Provide a line break opportunity after the character, except in numeric context
    var CB = 16; //   Provide a line break opportunity contingent on additional information
    // Characters Prohibiting Certain Breaks
    var CL = 17; //  Prohibit line breaks before
    var CP = 18; //  Prohibit line breaks before
    var EX = 19; //  Prohibit line breaks before
    var IN = 20; //  Allow only indirect line breaks between pairs
    var NS = 21; //  Allow only indirect line breaks before
    var OP = 22; //  Prohibit line breaks after
    var QU = 23; //  Act like they are both opening and closing
    // Numeric Context
    var IS = 24; //  Prevent breaks after any and before numeric
    var NU = 25; //  Form numeric expressions for line breaking purposes
    var PO = 26; //  Do not break following a numeric expression
    var PR = 27; //  Do not break in front of a numeric expression
    var SY = 28; //  Prevent a break before; and allow a break after
    // Other Characters
    var AI = 29; //  Act like AL when the resolvedEAW is N; otherwise; act as ID
    var AL = 30; //  Are alphabetic characters or symbols that are used with alphabetic characters
    var CJ = 31; //  Treat as NS or ID for strict or normal breaking.
    var EB = 32; //  Do not break from following Emoji Modifier
    var EM = 33; //  Do not break from preceding Emoji Base
    var H2 = 34; //  Form Korean syllable blocks
    var H3 = 35; //  Form Korean syllable blocks
    var HL = 36; //  Do not break around a following hyphen; otherwise act as Alphabetic
    var ID = 37; //  Break before or after; except in some numeric context
    var JL = 38; //  Form Korean syllable blocks
    var JV = 39; //  Form Korean syllable blocks
    var JT = 40; //  Form Korean syllable blocks
    var RI$1 = 41; //  Keep pairs together. For pairs; break before and after other classes
    var SA = 42; //  Provide a line break opportunity contingent on additional, language-specific context analysis
    var XX = 43; //  Have as yet unknown line breaking behavior or unassigned code positions
    var ea_OP = [0x2329, 0xff08];
    var BREAK_MANDATORY = '!';
    var BREAK_NOT_ALLOWED$1 = '×';
    var BREAK_ALLOWED$1 = '÷';
    var UnicodeTrie$1 = createTrieFromBase64$1(base64$1);
    var ALPHABETICS = [AL, HL];
    var HARD_LINE_BREAKS = [BK, CR$1, LF$1, NL];
    var SPACE$1 = [SP, ZW];
    var PREFIX_POSTFIX = [PR, PO];
    var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE$1);
    var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
    var HYPHEN = [HY, BA];
    var codePointsToCharacterClasses = function (codePoints, lineBreak) {
        if (lineBreak === void 0) { lineBreak = 'strict'; }
        var types = [];
        var indices = [];
        var categories = [];
        codePoints.forEach(function (codePoint, index) {
            var classType = UnicodeTrie$1.get(codePoint);
            if (classType > LETTER_NUMBER_MODIFIER) {
                categories.push(true);
                classType -= LETTER_NUMBER_MODIFIER;
            }
            else {
                categories.push(false);
            }
            if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
                // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0
                if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
                    indices.push(index);
                    return types.push(CB);
                }
            }
            if (classType === CM || classType === ZWJ$1) {
                // LB10 Treat any remaining combining mark or ZWJ as AL.
                if (index === 0) {
                    indices.push(index);
                    return types.push(AL);
                }
                // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
                // the base character in all of the following rules. Treat ZWJ as if it were CM.
                var prev = types[index - 1];
                if (LINE_BREAKS.indexOf(prev) === -1) {
                    indices.push(indices[index - 1]);
                    return types.push(prev);
                }
                indices.push(index);
                return types.push(AL);
            }
            indices.push(index);
            if (classType === CJ) {
                return types.push(lineBreak === 'strict' ? NS : ID);
            }
            if (classType === SA) {
                return types.push(AL);
            }
            if (classType === AI) {
                return types.push(AL);
            }
            // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
            // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
            // to take into account the actual line breaking properties for these characters.
            if (classType === XX) {
                if ((codePoint >= 0x20000 && codePoint <= 0x2fffd) || (codePoint >= 0x30000 && codePoint <= 0x3fffd)) {
                    return types.push(ID);
                }
                else {
                    return types.push(AL);
                }
            }
            types.push(classType);
        });
        return [indices, types, categories];
    };
    var isAdjacentWithSpaceIgnored = function (a, b, currentIndex, classTypes) {
        var current = classTypes[currentIndex];
        if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
            var i = currentIndex;
            while (i <= classTypes.length) {
                i++;
                var next = classTypes[i];
                if (next === b) {
                    return true;
                }
                if (next !== SP) {
                    break;
                }
            }
        }
        if (current === SP) {
            var i = currentIndex;
            while (i > 0) {
                i--;
                var prev = classTypes[i];
                if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
                    var n = currentIndex;
                    while (n <= classTypes.length) {
                        n++;
                        var next = classTypes[n];
                        if (next === b) {
                            return true;
                        }
                        if (next !== SP) {
                            break;
                        }
                    }
                }
                if (prev !== SP) {
                    break;
                }
            }
        }
        return false;
    };
    var previousNonSpaceClassType = function (currentIndex, classTypes) {
        var i = currentIndex;
        while (i >= 0) {
            var type = classTypes[i];
            if (type === SP) {
                i--;
            }
            else {
                return type;
            }
        }
        return 0;
    };
    var _lineBreakAtIndex = function (codePoints, classTypes, indicies, index, forbiddenBreaks) {
        if (indicies[index] === 0) {
            return BREAK_NOT_ALLOWED$1;
        }
        var currentIndex = index - 1;
        if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
            return BREAK_NOT_ALLOWED$1;
        }
        var beforeIndex = currentIndex - 1;
        var afterIndex = currentIndex + 1;
        var current = classTypes[currentIndex];
        // LB4 Always break after hard line breaks.
        // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
        var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
        var next = classTypes[afterIndex];
        if (current === CR$1 && next === LF$1) {
            return BREAK_NOT_ALLOWED$1;
        }
        if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
            return BREAK_MANDATORY;
        }
        // LB6 Do not break before hard line breaks.
        if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB7 Do not break before spaces or zero width space.
        if (SPACE$1.indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
        if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
            return BREAK_ALLOWED$1;
        }
        // LB8a Do not break after a zero width joiner.
        if (UnicodeTrie$1.get(codePoints[currentIndex]) === ZWJ$1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // zwj emojis
        if ((current === EB || current === EM) && UnicodeTrie$1.get(codePoints[afterIndex]) === ZWJ$1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB11 Do not break before or after Word joiner and related characters.
        if (current === WJ || next === WJ) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB12 Do not break after NBSP and related characters.
        if (current === GL) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
        if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces.
        if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB14 Do not break after ‘[’, even after spaces.
        if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB15 Do not break within ‘”[’, even with intervening spaces.
        if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
        if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB17 Do not break within ‘——’, even with intervening spaces.
        if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB18 Break after spaces.
        if (current === SP) {
            return BREAK_ALLOWED$1;
        }
        // LB19 Do not break before or after quotation marks, such as ‘ ” ’.
        if (current === QU || next === QU) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB20 Break before and after unresolved CB.
        if (next === CB || current === CB) {
            return BREAK_ALLOWED$1;
        }
        // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
        if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB21a Don't break after Hebrew + Hyphen.
        if (before === HL && HYPHEN.indexOf(current) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB21b Don’t break between Solidus and Hebrew letters.
        if (current === SY && next === HL) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB22 Do not break before ellipsis.
        if (next === IN) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB23 Do not break between digits and letters.
        if ((ALPHABETICS.indexOf(next) !== -1 && current === NU) || (ALPHABETICS.indexOf(current) !== -1 && next === NU)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
        if ((current === PR && [ID, EB, EM].indexOf(next) !== -1) ||
            ([ID, EB, EM].indexOf(current) !== -1 && next === PO)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
        if ((ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1) ||
            (PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB25 Do not break between the following pairs of classes relevant to numbers:
        if (
        // (PR | PO) × ( OP | HY )? NU
        ([PR, PO].indexOf(current) !== -1 &&
            (next === NU || ([OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU))) ||
            // ( OP | HY ) × NU
            ([OP, HY].indexOf(current) !== -1 && next === NU) ||
            // NU ×	(NU | SY | IS)
            (current === NU && [NU, SY, IS].indexOf(next) !== -1)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
        if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
            var prevIndex = currentIndex;
            while (prevIndex >= 0) {
                var type = classTypes[prevIndex];
                if (type === NU) {
                    return BREAK_NOT_ALLOWED$1;
                }
                else if ([SY, IS].indexOf(type) !== -1) {
                    prevIndex--;
                }
                else {
                    break;
                }
            }
        }
        // NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
        if ([PR, PO].indexOf(next) !== -1) {
            var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
            while (prevIndex >= 0) {
                var type = classTypes[prevIndex];
                if (type === NU) {
                    return BREAK_NOT_ALLOWED$1;
                }
                else if ([SY, IS].indexOf(type) !== -1) {
                    prevIndex--;
                }
                else {
                    break;
                }
            }
        }
        // LB26 Do not break a Korean syllable.
        if ((JL === current && [JL, JV, H2, H3].indexOf(next) !== -1) ||
            ([JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1) ||
            ([JT, H3].indexOf(current) !== -1 && next === JT)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB27 Treat a Korean Syllable Block the same as ID.
        if ((KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1) ||
            (KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB28 Do not break between alphabetics (“at”).
        if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
        if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
        if ((ALPHABETICS.concat(NU).indexOf(current) !== -1 &&
            next === OP &&
            ea_OP.indexOf(codePoints[afterIndex]) === -1) ||
            (ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP)) {
            return BREAK_NOT_ALLOWED$1;
        }
        // LB30a Break between two regional indicator symbols if and only if there are an even number of regional
        // indicators preceding the position of the break.
        if (current === RI$1 && next === RI$1) {
            var i = indicies[currentIndex];
            var count = 1;
            while (i > 0) {
                i--;
                if (classTypes[i] === RI$1) {
                    count++;
                }
                else {
                    break;
                }
            }
            if (count % 2 !== 0) {
                return BREAK_NOT_ALLOWED$1;
            }
        }
        // LB30b Do not break between an emoji base and an emoji modifier.
        if (current === EB && next === EM) {
            return BREAK_NOT_ALLOWED$1;
        }
        return BREAK_ALLOWED$1;
    };
    var cssFormattedClasses = function (codePoints, options) {
        if (!options) {
            options = { lineBreak: 'normal', wordBreak: 'normal' };
        }
        var _a = codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2];
        if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
            classTypes = classTypes.map(function (type) { return ([NU, AL, SA].indexOf(type) !== -1 ? ID : type); });
        }
        var forbiddenBreakpoints = options.wordBreak === 'keep-all'
            ? isLetterNumber.map(function (letterNumber, i) {
                return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
            })
            : undefined;
        return [indicies, classTypes, forbiddenBreakpoints];
    };
    var Break = /** @class */ (function () {
        function Break(codePoints, lineBreak, start, end) {
            this.codePoints = codePoints;
            this.required = lineBreak === BREAK_MANDATORY;
            this.start = start;
            this.end = end;
        }
        Break.prototype.slice = function () {
            return fromCodePoint$1.apply(void 0, this.codePoints.slice(this.start, this.end));
        };
        return Break;
    }());
    var LineBreaker = function (str, options) {
        var codePoints = toCodePoints$1(str);
        var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
        var length = codePoints.length;
        var lastEnd = 0;
        var nextIndex = 0;
        return {
            next: function () {
                if (nextIndex >= length) {
                    return { done: true, value: null };
                }
                var lineBreak = BREAK_NOT_ALLOWED$1;
                while (nextIndex < length &&
                    (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) ===
                        BREAK_NOT_ALLOWED$1) { }
                if (lineBreak !== BREAK_NOT_ALLOWED$1 || nextIndex === length) {
                    var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
                    lastEnd = nextIndex;
                    return { value: value, done: false };
                }
                return { done: true, value: null };
            },
        };
    };

    // https://www.w3.org/TR/css-syntax-3
    var FLAG_UNRESTRICTED = 1 << 0;
    var FLAG_ID = 1 << 1;
    var FLAG_INTEGER = 1 << 2;
    var FLAG_NUMBER = 1 << 3;
    var LINE_FEED = 0x000a;
    var SOLIDUS = 0x002f;
    var REVERSE_SOLIDUS = 0x005c;
    var CHARACTER_TABULATION = 0x0009;
    var SPACE = 0x0020;
    var QUOTATION_MARK = 0x0022;
    var EQUALS_SIGN = 0x003d;
    var NUMBER_SIGN = 0x0023;
    var DOLLAR_SIGN = 0x0024;
    var PERCENTAGE_SIGN = 0x0025;
    var APOSTROPHE = 0x0027;
    var LEFT_PARENTHESIS = 0x0028;
    var RIGHT_PARENTHESIS = 0x0029;
    var LOW_LINE = 0x005f;
    var HYPHEN_MINUS = 0x002d;
    var EXCLAMATION_MARK = 0x0021;
    var LESS_THAN_SIGN = 0x003c;
    var GREATER_THAN_SIGN = 0x003e;
    var COMMERCIAL_AT = 0x0040;
    var LEFT_SQUARE_BRACKET = 0x005b;
    var RIGHT_SQUARE_BRACKET = 0x005d;
    var CIRCUMFLEX_ACCENT = 0x003d;
    var LEFT_CURLY_BRACKET = 0x007b;
    var QUESTION_MARK = 0x003f;
    var RIGHT_CURLY_BRACKET = 0x007d;
    var VERTICAL_LINE = 0x007c;
    var TILDE = 0x007e;
    var CONTROL = 0x0080;
    var REPLACEMENT_CHARACTER = 0xfffd;
    var ASTERISK = 0x002a;
    var PLUS_SIGN = 0x002b;
    var COMMA = 0x002c;
    var COLON = 0x003a;
    var SEMICOLON = 0x003b;
    var FULL_STOP = 0x002e;
    var NULL = 0x0000;
    var BACKSPACE = 0x0008;
    var LINE_TABULATION = 0x000b;
    var SHIFT_OUT = 0x000e;
    var INFORMATION_SEPARATOR_ONE = 0x001f;
    var DELETE = 0x007f;
    var EOF = -1;
    var ZERO = 0x0030;
    var a = 0x0061;
    var e = 0x0065;
    var f = 0x0066;
    var u = 0x0075;
    var z = 0x007a;
    var A = 0x0041;
    var E = 0x0045;
    var F = 0x0046;
    var U = 0x0055;
    var Z = 0x005a;
    var isDigit = function (codePoint) { return codePoint >= ZERO && codePoint <= 0x0039; };
    var isSurrogateCodePoint = function (codePoint) { return codePoint >= 0xd800 && codePoint <= 0xdfff; };
    var isHex = function (codePoint) {
        return isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f);
    };
    var isLowerCaseLetter = function (codePoint) { return codePoint >= a && codePoint <= z; };
    var isUpperCaseLetter = function (codePoint) { return codePoint >= A && codePoint <= Z; };
    var isLetter = function (codePoint) { return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint); };
    var isNonASCIICodePoint = function (codePoint) { return codePoint >= CONTROL; };
    var isWhiteSpace = function (codePoint) {
        return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE;
    };
    var isNameStartCodePoint = function (codePoint) {
        return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
    };
    var isNameCodePoint = function (codePoint) {
        return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
    };
    var isNonPrintableCodePoint = function (codePoint) {
        return ((codePoint >= NULL && codePoint <= BACKSPACE) ||
            codePoint === LINE_TABULATION ||
            (codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) ||
            codePoint === DELETE);
    };
    var isValidEscape = function (c1, c2) {
        if (c1 !== REVERSE_SOLIDUS) {
            return false;
        }
        return c2 !== LINE_FEED;
    };
    var isIdentifierStart = function (c1, c2, c3) {
        if (c1 === HYPHEN_MINUS) {
            return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
        }
        else if (isNameStartCodePoint(c1)) {
            return true;
        }
        else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
            return true;
        }
        return false;
    };
    var isNumberStart = function (c1, c2, c3) {
        if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
            if (isDigit(c2)) {
                return true;
            }
            return c2 === FULL_STOP && isDigit(c3);
        }
        if (c1 === FULL_STOP) {
            return isDigit(c2);
        }
        return isDigit(c1);
    };
    var stringToNumber = function (codePoints) {
        var c = 0;
        var sign = 1;
        if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
            if (codePoints[c] === HYPHEN_MINUS) {
                sign = -1;
            }
            c++;
        }
        var integers = [];
        while (isDigit(codePoints[c])) {
            integers.push(codePoints[c++]);
        }
        var int = integers.length ? parseInt(fromCodePoint$1.apply(void 0, integers), 10) : 0;
        if (codePoints[c] === FULL_STOP) {
            c++;
        }
        var fraction = [];
        while (isDigit(codePoints[c])) {
            fraction.push(codePoints[c++]);
        }
        var fracd = fraction.length;
        var frac = fracd ? parseInt(fromCodePoint$1.apply(void 0, fraction), 10) : 0;
        if (codePoints[c] === E || codePoints[c] === e) {
            c++;
        }
        var expsign = 1;
        if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
            if (codePoints[c] === HYPHEN_MINUS) {
                expsign = -1;
            }
            c++;
        }
        var exponent = [];
        while (isDigit(codePoints[c])) {
            exponent.push(codePoints[c++]);
        }
        var exp = exponent.length ? parseInt(fromCodePoint$1.apply(void 0, exponent), 10) : 0;
        return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
    };
    var LEFT_PARENTHESIS_TOKEN = {
        type: 2 /* LEFT_PARENTHESIS_TOKEN */
    };
    var RIGHT_PARENTHESIS_TOKEN = {
        type: 3 /* RIGHT_PARENTHESIS_TOKEN */
    };
    var COMMA_TOKEN = { type: 4 /* COMMA_TOKEN */ };
    var SUFFIX_MATCH_TOKEN = { type: 13 /* SUFFIX_MATCH_TOKEN */ };
    var PREFIX_MATCH_TOKEN = { type: 8 /* PREFIX_MATCH_TOKEN */ };
    var COLUMN_TOKEN = { type: 21 /* COLUMN_TOKEN */ };
    var DASH_MATCH_TOKEN = { type: 9 /* DASH_MATCH_TOKEN */ };
    var INCLUDE_MATCH_TOKEN = { type: 10 /* INCLUDE_MATCH_TOKEN */ };
    var LEFT_CURLY_BRACKET_TOKEN = {
        type: 11 /* LEFT_CURLY_BRACKET_TOKEN */
    };
    var RIGHT_CURLY_BRACKET_TOKEN = {
        type: 12 /* RIGHT_CURLY_BRACKET_TOKEN */
    };
    var SUBSTRING_MATCH_TOKEN = { type: 14 /* SUBSTRING_MATCH_TOKEN */ };
    var BAD_URL_TOKEN = { type: 23 /* BAD_URL_TOKEN */ };
    var BAD_STRING_TOKEN = { type: 1 /* BAD_STRING_TOKEN */ };
    var CDO_TOKEN = { type: 25 /* CDO_TOKEN */ };
    var CDC_TOKEN = { type: 24 /* CDC_TOKEN */ };
    var COLON_TOKEN = { type: 26 /* COLON_TOKEN */ };
    var SEMICOLON_TOKEN = { type: 27 /* SEMICOLON_TOKEN */ };
    var LEFT_SQUARE_BRACKET_TOKEN = {
        type: 28 /* LEFT_SQUARE_BRACKET_TOKEN */
    };
    var RIGHT_SQUARE_BRACKET_TOKEN = {
        type: 29 /* RIGHT_SQUARE_BRACKET_TOKEN */
    };
    var WHITESPACE_TOKEN = { type: 31 /* WHITESPACE_TOKEN */ };
    var EOF_TOKEN = { type: 32 /* EOF_TOKEN */ };
    var Tokenizer = /** @class */ (function () {
        function Tokenizer() {
            this._value = [];
        }
        Tokenizer.prototype.write = function (chunk) {
            this._value = this._value.concat(toCodePoints$1(chunk));
        };
        Tokenizer.prototype.read = function () {
            var tokens = [];
            var token = this.consumeToken();
            while (token !== EOF_TOKEN) {
                tokens.push(token);
                token = this.consumeToken();
            }
            return tokens;
        };
        Tokenizer.prototype.consumeToken = function () {
            var codePoint = this.consumeCodePoint();
            switch (codePoint) {
                case QUOTATION_MARK:
                    return this.consumeStringToken(QUOTATION_MARK);
                case NUMBER_SIGN:
                    var c1 = this.peekCodePoint(0);
                    var c2 = this.peekCodePoint(1);
                    var c3 = this.peekCodePoint(2);
                    if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
                        var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
                        var value = this.consumeName();
                        return { type: 5 /* HASH_TOKEN */, value: value, flags: flags };
                    }
                    break;
                case DOLLAR_SIGN:
                    if (this.peekCodePoint(0) === EQUALS_SIGN) {
                        this.consumeCodePoint();
                        return SUFFIX_MATCH_TOKEN;
                    }
                    break;
                case APOSTROPHE:
                    return this.consumeStringToken(APOSTROPHE);
                case LEFT_PARENTHESIS:
                    return LEFT_PARENTHESIS_TOKEN;
                case RIGHT_PARENTHESIS:
                    return RIGHT_PARENTHESIS_TOKEN;
                case ASTERISK:
                    if (this.peekCodePoint(0) === EQUALS_SIGN) {
                        this.consumeCodePoint();
                        return SUBSTRING_MATCH_TOKEN;
                    }
                    break;
                case PLUS_SIGN:
                    if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
                        this.reconsumeCodePoint(codePoint);
                        return this.consumeNumericToken();
                    }
                    break;
                case COMMA:
                    return COMMA_TOKEN;
                case HYPHEN_MINUS:
                    var e1 = codePoint;
                    var e2 = this.peekCodePoint(0);
                    var e3 = this.peekCodePoint(1);
                    if (isNumberStart(e1, e2, e3)) {
                        this.reconsumeCodePoint(codePoint);
                        return this.consumeNumericToken();
                    }
                    if (isIdentifierStart(e1, e2, e3)) {
                        this.reconsumeCodePoint(codePoint);
                        return this.consumeIdentLikeToken();
                    }
                    if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) {
                        this.consumeCodePoint();
                        this.consumeCodePoint();
                        return CDC_TOKEN;
                    }
                    break;
                case FULL_STOP:
                    if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
                        this.reconsumeCodePoint(codePoint);
                        return this.consumeNumericToken();
                    }
                    break;
                case SOLIDUS:
                    if (this.peekCodePoint(0) === ASTERISK) {
                        this.consumeCodePoint();
                        while (true) {
                            var c = this.consumeCodePoint();
                            if (c === ASTERISK) {
                                c = this.consumeCodePoint();
                                if (c === SOLIDUS) {
                                    return this.consumeToken();
                                }
                            }
                            if (c === EOF) {
                                return this.consumeToken();
                            }
                        }
                    }
                    break;
                case COLON:
                    return COLON_TOKEN;
                case SEMICOLON:
                    return SEMICOLON_TOKEN;
                case LESS_THAN_SIGN:
                    if (this.peekCodePoint(0) === EXCLAMATION_MARK &&
                        this.peekCodePoint(1) === HYPHEN_MINUS &&
                        this.peekCodePoint(2) === HYPHEN_MINUS) {
                        this.consumeCodePoint();
                        this.consumeCodePoint();
                        return CDO_TOKEN;
                    }
                    break;
                case COMMERCIAL_AT:
                    var a1 = this.peekCodePoint(0);
                    var a2 = this.peekCodePoint(1);
                    var a3 = this.peekCodePoint(2);
                    if (isIdentifierStart(a1, a2, a3)) {
                        var value = this.consumeName();
                        return { type: 7 /* AT_KEYWORD_TOKEN */, value: value };
                    }
                    break;
                case LEFT_SQUARE_BRACKET:
                    return LEFT_SQUARE_BRACKET_TOKEN;
                case REVERSE_SOLIDUS:
                    if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                        this.reconsumeCodePoint(codePoint);
                        return this.consumeIdentLikeToken();
                    }
                    break;
                case RIGHT_SQUARE_BRACKET:
                    return RIGHT_SQUARE_BRACKET_TOKEN;
                case CIRCUMFLEX_ACCENT:
                    if (this.peekCodePoint(0) === EQUALS_SIGN) {
                        this.consumeCodePoint();
                        return PREFIX_MATCH_TOKEN;
                    }
                    break;
                case LEFT_CURLY_BRACKET:
                    return LEFT_CURLY_BRACKET_TOKEN;
                case RIGHT_CURLY_BRACKET:
                    return RIGHT_CURLY_BRACKET_TOKEN;
                case u:
                case U:
                    var u1 = this.peekCodePoint(0);
                    var u2 = this.peekCodePoint(1);
                    if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) {
                        this.consumeCodePoint();
                        this.consumeUnicodeRangeToken();
                    }
                    this.reconsumeCodePoint(codePoint);
                    return this.consumeIdentLikeToken();
                case VERTICAL_LINE:
                    if (this.peekCodePoint(0) === EQUALS_SIGN) {
                        this.consumeCodePoint();
                        return DASH_MATCH_TOKEN;
                    }
                    if (this.peekCodePoint(0) === VERTICAL_LINE) {
                        this.consumeCodePoint();
                        return COLUMN_TOKEN;
                    }
                    break;
                case TILDE:
                    if (this.peekCodePoint(0) === EQUALS_SIGN) {
                        this.consumeCodePoint();
                        return INCLUDE_MATCH_TOKEN;
                    }
                    break;
                case EOF:
                    return EOF_TOKEN;
            }
            if (isWhiteSpace(codePoint)) {
                this.consumeWhiteSpace();
                return WHITESPACE_TOKEN;
            }
            if (isDigit(codePoint)) {
                this.reconsumeCodePoint(codePoint);
                return this.consumeNumericToken();
            }
            if (isNameStartCodePoint(codePoint)) {
                this.reconsumeCodePoint(codePoint);
                return this.consumeIdentLikeToken();
            }
            return { type: 6 /* DELIM_TOKEN */, value: fromCodePoint$1(codePoint) };
        };
        Tokenizer.prototype.consumeCodePoint = function () {
            var value = this._value.shift();
            return typeof value === 'undefined' ? -1 : value;
        };
        Tokenizer.prototype.reconsumeCodePoint = function (codePoint) {
            this._value.unshift(codePoint);
        };
        Tokenizer.prototype.peekCodePoint = function (delta) {
            if (delta >= this._value.length) {
                return -1;
            }
            return this._value[delta];
        };
        Tokenizer.prototype.consumeUnicodeRangeToken = function () {
            var digits = [];
            var codePoint = this.consumeCodePoint();
            while (isHex(codePoint) && digits.length < 6) {
                digits.push(codePoint);
                codePoint = this.consumeCodePoint();
            }
            var questionMarks = false;
            while (codePoint === QUESTION_MARK && digits.length < 6) {
                digits.push(codePoint);
                codePoint = this.consumeCodePoint();
                questionMarks = true;
            }
            if (questionMarks) {
                var start_1 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? ZERO : digit); })), 16);
                var end = parseInt(fromCodePoint$1.apply(void 0, digits.map(function (digit) { return (digit === QUESTION_MARK ? F : digit); })), 16);
                return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start_1, end: end };
            }
            var start = parseInt(fromCodePoint$1.apply(void 0, digits), 16);
            if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
                this.consumeCodePoint();
                codePoint = this.consumeCodePoint();
                var endDigits = [];
                while (isHex(codePoint) && endDigits.length < 6) {
                    endDigits.push(codePoint);
                    codePoint = this.consumeCodePoint();
                }
                var end = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16);
                return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: end };
            }
            else {
                return { type: 30 /* UNICODE_RANGE_TOKEN */, start: start, end: start };
            }
        };
        Tokenizer.prototype.consumeIdentLikeToken = function () {
            var value = this.consumeName();
            if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) {
                this.consumeCodePoint();
                return this.consumeUrlToken();
            }
            else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
                this.consumeCodePoint();
                return { type: 19 /* FUNCTION_TOKEN */, value: value };
            }
            return { type: 20 /* IDENT_TOKEN */, value: value };
        };
        Tokenizer.prototype.consumeUrlToken = function () {
            var value = [];
            this.consumeWhiteSpace();
            if (this.peekCodePoint(0) === EOF) {
                return { type: 22 /* URL_TOKEN */, value: '' };
            }
            var next = this.peekCodePoint(0);
            if (next === APOSTROPHE || next === QUOTATION_MARK) {
                var stringToken = this.consumeStringToken(this.consumeCodePoint());
                if (stringToken.type === 0 /* STRING_TOKEN */) {
                    this.consumeWhiteSpace();
                    if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
                        this.consumeCodePoint();
                        return { type: 22 /* URL_TOKEN */, value: stringToken.value };
                    }
                }
                this.consumeBadUrlRemnants();
                return BAD_URL_TOKEN;
            }
            while (true) {
                var codePoint = this.consumeCodePoint();
                if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
                    return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
                }
                else if (isWhiteSpace(codePoint)) {
                    this.consumeWhiteSpace();
                    if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
                        this.consumeCodePoint();
                        return { type: 22 /* URL_TOKEN */, value: fromCodePoint$1.apply(void 0, value) };
                    }
                    this.consumeBadUrlRemnants();
                    return BAD_URL_TOKEN;
                }
                else if (codePoint === QUOTATION_MARK ||
                    codePoint === APOSTROPHE ||
                    codePoint === LEFT_PARENTHESIS ||
                    isNonPrintableCodePoint(codePoint)) {
                    this.consumeBadUrlRemnants();
                    return BAD_URL_TOKEN;
                }
                else if (codePoint === REVERSE_SOLIDUS) {
                    if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                        value.push(this.consumeEscapedCodePoint());
                    }
                    else {
                        this.consumeBadUrlRemnants();
                        return BAD_URL_TOKEN;
                    }
                }
                else {
                    value.push(codePoint);
                }
            }
        };
        Tokenizer.prototype.consumeWhiteSpace = function () {
            while (isWhiteSpace(this.peekCodePoint(0))) {
                this.consumeCodePoint();
            }
        };
        Tokenizer.prototype.consumeBadUrlRemnants = function () {
            while (true) {
                var codePoint = this.consumeCodePoint();
                if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) {
                    return;
                }
                if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                    this.consumeEscapedCodePoint();
                }
            }
        };
        Tokenizer.prototype.consumeStringSlice = function (count) {
            var SLICE_STACK_SIZE = 50000;
            var value = '';
            while (count > 0) {
                var amount = Math.min(SLICE_STACK_SIZE, count);
                value += fromCodePoint$1.apply(void 0, this._value.splice(0, amount));
                count -= amount;
            }
            this._value.shift();
            return value;
        };
        Tokenizer.prototype.consumeStringToken = function (endingCodePoint) {
            var value = '';
            var i = 0;
            do {
                var codePoint = this._value[i];
                if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
                    value += this.consumeStringSlice(i);
                    return { type: 0 /* STRING_TOKEN */, value: value };
                }
                if (codePoint === LINE_FEED) {
                    this._value.splice(0, i);
                    return BAD_STRING_TOKEN;
                }
                if (codePoint === REVERSE_SOLIDUS) {
                    var next = this._value[i + 1];
                    if (next !== EOF && next !== undefined) {
                        if (next === LINE_FEED) {
                            value += this.consumeStringSlice(i);
                            i = -1;
                            this._value.shift();
                        }
                        else if (isValidEscape(codePoint, next)) {
                            value += this.consumeStringSlice(i);
                            value += fromCodePoint$1(this.consumeEscapedCodePoint());
                            i = -1;
                        }
                    }
                }
                i++;
            } while (true);
        };
        Tokenizer.prototype.consumeNumber = function () {
            var repr = [];
            var type = FLAG_INTEGER;
            var c1 = this.peekCodePoint(0);
            if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
                repr.push(this.consumeCodePoint());
            }
            while (isDigit(this.peekCodePoint(0))) {
                repr.push(this.consumeCodePoint());
            }
            c1 = this.peekCodePoint(0);
            var c2 = this.peekCodePoint(1);
            if (c1 === FULL_STOP && isDigit(c2)) {
                repr.push(this.consumeCodePoint(), this.consumeCodePoint());
                type = FLAG_NUMBER;
                while (isDigit(this.peekCodePoint(0))) {
                    repr.push(this.consumeCodePoint());
                }
            }
            c1 = this.peekCodePoint(0);
            c2 = this.peekCodePoint(1);
            var c3 = this.peekCodePoint(2);
            if ((c1 === E || c1 === e) && (((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3)) || isDigit(c2))) {
                repr.push(this.consumeCodePoint(), this.consumeCodePoint());
                type = FLAG_NUMBER;
                while (isDigit(this.peekCodePoint(0))) {
                    repr.push(this.consumeCodePoint());
                }
            }
            return [stringToNumber(repr), type];
        };
        Tokenizer.prototype.consumeNumericToken = function () {
            var _a = this.consumeNumber(), number = _a[0], flags = _a[1];
            var c1 = this.peekCodePoint(0);
            var c2 = this.peekCodePoint(1);
            var c3 = this.peekCodePoint(2);
            if (isIdentifierStart(c1, c2, c3)) {
                var unit = this.consumeName();
                return { type: 15 /* DIMENSION_TOKEN */, number: number, flags: flags, unit: unit };
            }
            if (c1 === PERCENTAGE_SIGN) {
                this.consumeCodePoint();
                return { type: 16 /* PERCENTAGE_TOKEN */, number: number, flags: flags };
            }
            return { type: 17 /* NUMBER_TOKEN */, number: number, flags: flags };
        };
        Tokenizer.prototype.consumeEscapedCodePoint = function () {
            var codePoint = this.consumeCodePoint();
            if (isHex(codePoint)) {
                var hex = fromCodePoint$1(codePoint);
                while (isHex(this.peekCodePoint(0)) && hex.length < 6) {
                    hex += fromCodePoint$1(this.consumeCodePoint());
                }
                if (isWhiteSpace(this.peekCodePoint(0))) {
                    this.consumeCodePoint();
                }
                var hexCodePoint = parseInt(hex, 16);
                if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) {
                    return REPLACEMENT_CHARACTER;
                }
                return hexCodePoint;
            }
            if (codePoint === EOF) {
                return REPLACEMENT_CHARACTER;
            }
            return codePoint;
        };
        Tokenizer.prototype.consumeName = function () {
            var result = '';
            while (true) {
                var codePoint = this.consumeCodePoint();
                if (isNameCodePoint(codePoint)) {
                    result += fromCodePoint$1(codePoint);
                }
                else if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                    result += fromCodePoint$1(this.consumeEscapedCodePoint());
                }
                else {
                    this.reconsumeCodePoint(codePoint);
                    return result;
                }
            }
        };
        return Tokenizer;
    }());

    var Parser = /** @class */ (function () {
        function Parser(tokens) {
            this._tokens = tokens;
        }
        Parser.create = function (value) {
            var tokenizer = new Tokenizer();
            tokenizer.write(value);
            return new Parser(tokenizer.read());
        };
        Parser.parseValue = function (value) {
            return Parser.create(value).parseComponentValue();
        };
        Parser.parseValues = function (value) {
            return Parser.create(value).parseComponentValues();
        };
        Parser.prototype.parseComponentValue = function () {
            var token = this.consumeToken();
            while (token.type === 31 /* WHITESPACE_TOKEN */) {
                token = this.consumeToken();
            }
            if (token.type === 32 /* EOF_TOKEN */) {
                throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
            }
            this.reconsumeToken(token);
            var value = this.consumeComponentValue();
            do {
                token = this.consumeToken();
            } while (token.type === 31 /* WHITESPACE_TOKEN */);
            if (token.type === 32 /* EOF_TOKEN */) {
                return value;
            }
            throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
        };
        Parser.prototype.parseComponentValues = function () {
            var values = [];
            while (true) {
                var value = this.consumeComponentValue();
                if (value.type === 32 /* EOF_TOKEN */) {
                    return values;
                }
                values.push(value);
                values.push();
            }
        };
        Parser.prototype.consumeComponentValue = function () {
            var token = this.consumeToken();
            switch (token.type) {
                case 11 /* LEFT_CURLY_BRACKET_TOKEN */:
                case 28 /* LEFT_SQUARE_BRACKET_TOKEN */:
                case 2 /* LEFT_PARENTHESIS_TOKEN */:
                    return this.consumeSimpleBlock(token.type);
                case 19 /* FUNCTION_TOKEN */:
                    return this.consumeFunction(token);
            }
            return token;
        };
        Parser.prototype.consumeSimpleBlock = function (type) {
            var block = { type: type, values: [] };
            var token = this.consumeToken();
            while (true) {
                if (token.type === 32 /* EOF_TOKEN */ || isEndingTokenFor(token, type)) {
                    return block;
                }
                this.reconsumeToken(token);
                block.values.push(this.consumeComponentValue());
                token = this.consumeToken();
            }
        };
        Parser.prototype.consumeFunction = function (functionToken) {
            var cssFunction = {
                name: functionToken.value,
                values: [],
                type: 18 /* FUNCTION */
            };
            while (true) {
                var token = this.consumeToken();
                if (token.type === 32 /* EOF_TOKEN */ || token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */) {
                    return cssFunction;
                }
                this.reconsumeToken(token);
                cssFunction.values.push(this.consumeComponentValue());
            }
        };
        Parser.prototype.consumeToken = function () {
            var token = this._tokens.shift();
            return typeof token === 'undefined' ? EOF_TOKEN : token;
        };
        Parser.prototype.reconsumeToken = function (token) {
            this._tokens.unshift(token);
        };
        return Parser;
    }());
    var isDimensionToken = function (token) { return token.type === 15 /* DIMENSION_TOKEN */; };
    var isNumberToken = function (token) { return token.type === 17 /* NUMBER_TOKEN */; };
    var isIdentToken = function (token) { return token.type === 20 /* IDENT_TOKEN */; };
    var isStringToken = function (token) { return token.type === 0 /* STRING_TOKEN */; };
    var isIdentWithValue = function (token, value) {
        return isIdentToken(token) && token.value === value;
    };
    var nonWhiteSpace = function (token) { return token.type !== 31 /* WHITESPACE_TOKEN */; };
    var nonFunctionArgSeparator = function (token) {
        return token.type !== 31 /* WHITESPACE_TOKEN */ && token.type !== 4 /* COMMA_TOKEN */;
    };
    var parseFunctionArgs = function (tokens) {
        var args = [];
        var arg = [];
        tokens.forEach(function (token) {
            if (token.type === 4 /* COMMA_TOKEN */) {
                if (arg.length === 0) {
                    throw new Error("Error parsing function args, zero tokens for arg");
                }
                args.push(arg);
                arg = [];
                return;
            }
            if (token.type !== 31 /* WHITESPACE_TOKEN */) {
                arg.push(token);
            }
        });
        if (arg.length) {
            args.push(arg);
        }
        return args;
    };
    var isEndingTokenFor = function (token, type) {
        if (type === 11 /* LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* RIGHT_CURLY_BRACKET_TOKEN */) {
            return true;
        }
        if (type === 28 /* LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* RIGHT_SQUARE_BRACKET_TOKEN */) {
            return true;
        }
        return type === 2 /* LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* RIGHT_PARENTHESIS_TOKEN */;
    };

    var isLength = function (token) {
        return token.type === 17 /* NUMBER_TOKEN */ || token.type === 15 /* DIMENSION_TOKEN */;
    };

    var isLengthPercentage = function (token) {
        return token.type === 16 /* PERCENTAGE_TOKEN */ || isLength(token);
    };
    var parseLengthPercentageTuple = function (tokens) {
        return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
    };
    var ZERO_LENGTH = {
        type: 17 /* NUMBER_TOKEN */,
        number: 0,
        flags: FLAG_INTEGER
    };
    var FIFTY_PERCENT = {
        type: 16 /* PERCENTAGE_TOKEN */,
        number: 50,
        flags: FLAG_INTEGER
    };
    var HUNDRED_PERCENT = {
        type: 16 /* PERCENTAGE_TOKEN */,
        number: 100,
        flags: FLAG_INTEGER
    };
    var getAbsoluteValueForTuple = function (tuple, width, height) {
        var x = tuple[0], y = tuple[1];
        return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
    };
    var getAbsoluteValue = function (token, parent) {
        if (token.type === 16 /* PERCENTAGE_TOKEN */) {
            return (token.number / 100) * parent;
        }
        if (isDimensionToken(token)) {
            switch (token.unit) {
                case 'rem':
                case 'em':
                    return 16 * token.number; // TODO use correct font-size
                case 'px':
                default:
                    return token.number;
            }
        }
        return token.number;
    };

    var DEG = 'deg';
    var GRAD = 'grad';
    var RAD = 'rad';
    var TURN = 'turn';
    var angle = {
        name: 'angle',
        parse: function (_context, value) {
            if (value.type === 15 /* DIMENSION_TOKEN */) {
                switch (value.unit) {
                    case DEG:
                        return (Math.PI * value.number) / 180;
                    case GRAD:
                        return (Math.PI / 200) * value.number;
                    case RAD:
                        return value.number;
                    case TURN:
                        return Math.PI * 2 * value.number;
                }
            }
            throw new Error("Unsupported angle type");
        }
    };
    var isAngle = function (value) {
        if (value.type === 15 /* DIMENSION_TOKEN */) {
            if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
                return true;
            }
        }
        return false;
    };
    var parseNamedSide = function (tokens) {
        var sideOrCorner = tokens
            .filter(isIdentToken)
            .map(function (ident) { return ident.value; })
            .join(' ');
        switch (sideOrCorner) {
            case 'to bottom right':
            case 'to right bottom':
            case 'left top':
            case 'top left':
                return [ZERO_LENGTH, ZERO_LENGTH];
            case 'to top':
            case 'bottom':
                return deg(0);
            case 'to bottom left':
            case 'to left bottom':
            case 'right top':
            case 'top right':
                return [ZERO_LENGTH, HUNDRED_PERCENT];
            case 'to right':
            case 'left':
                return deg(90);
            case 'to top left':
            case 'to left top':
            case 'right bottom':
            case 'bottom right':
                return [HUNDRED_PERCENT, HUNDRED_PERCENT];
            case 'to bottom':
            case 'top':
                return deg(180);
            case 'to top right':
            case 'to right top':
            case 'left bottom':
            case 'bottom left':
                return [HUNDRED_PERCENT, ZERO_LENGTH];
            case 'to left':
            case 'right':
                return deg(270);
        }
        return 0;
    };
    var deg = function (deg) { return (Math.PI * deg) / 180; };

    var color$1 = {
        name: 'color',
        parse: function (context, value) {
            if (value.type === 18 /* FUNCTION */) {
                var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
                if (typeof colorFunction === 'undefined') {
                    throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
                }
                return colorFunction(context, value.values);
            }
            if (value.type === 5 /* HASH_TOKEN */) {
                if (value.value.length === 3) {
                    var r = value.value.substring(0, 1);
                    var g = value.value.substring(1, 2);
                    var b = value.value.substring(2, 3);
                    return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
                }
                if (value.value.length === 4) {
                    var r = value.value.substring(0, 1);
                    var g = value.value.substring(1, 2);
                    var b = value.value.substring(2, 3);
                    var a = value.value.substring(3, 4);
                    return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
                }
                if (value.value.length === 6) {
                    var r = value.value.substring(0, 2);
                    var g = value.value.substring(2, 4);
                    var b = value.value.substring(4, 6);
                    return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
                }
                if (value.value.length === 8) {
                    var r = value.value.substring(0, 2);
                    var g = value.value.substring(2, 4);
                    var b = value.value.substring(4, 6);
                    var a = value.value.substring(6, 8);
                    return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
                }
            }
            if (value.type === 20 /* IDENT_TOKEN */) {
                var namedColor = COLORS[value.value.toUpperCase()];
                if (typeof namedColor !== 'undefined') {
                    return namedColor;
                }
            }
            return COLORS.TRANSPARENT;
        }
    };
    var isTransparent = function (color) { return (0xff & color) === 0; };
    var asString = function (color) {
        var alpha = 0xff & color;
        var blue = 0xff & (color >> 8);
        var green = 0xff & (color >> 16);
        var red = 0xff & (color >> 24);
        return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")";
    };
    var pack = function (r, g, b, a) {
        return ((r << 24) | (g << 16) | (b << 8) | (Math.round(a * 255) << 0)) >>> 0;
    };
    var getTokenColorValue = function (token, i) {
        if (token.type === 17 /* NUMBER_TOKEN */) {
            return token.number;
        }
        if (token.type === 16 /* PERCENTAGE_TOKEN */) {
            var max = i === 3 ? 1 : 255;
            return i === 3 ? (token.number / 100) * max : Math.round((token.number / 100) * max);
        }
        return 0;
    };
    var rgb = function (_context, args) {
        var tokens = args.filter(nonFunctionArgSeparator);
        if (tokens.length === 3) {
            var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
            return pack(r, g, b, 1);
        }
        if (tokens.length === 4) {
            var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a = _b[3];
            return pack(r, g, b, a);
        }
        return 0;
    };
    function hue2rgb(t1, t2, hue) {
        if (hue < 0) {
            hue += 1;
        }
        if (hue >= 1) {
            hue -= 1;
        }
        if (hue < 1 / 6) {
            return (t2 - t1) * hue * 6 + t1;
        }
        else if (hue < 1 / 2) {
            return t2;
        }
        else if (hue < 2 / 3) {
            return (t2 - t1) * 6 * (2 / 3 - hue) + t1;
        }
        else {
            return t1;
        }
    }
    var hsl = function (context, args) {
        var tokens = args.filter(nonFunctionArgSeparator);
        var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
        var h = (hue.type === 17 /* NUMBER_TOKEN */ ? deg(hue.number) : angle.parse(context, hue)) / (Math.PI * 2);
        var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
        var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
        var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
        if (s === 0) {
            return pack(l * 255, l * 255, l * 255, 1);
        }
        var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
        var t1 = l * 2 - t2;
        var r = hue2rgb(t1, t2, h + 1 / 3);
        var g = hue2rgb(t1, t2, h);
        var b = hue2rgb(t1, t2, h - 1 / 3);
        return pack(r * 255, g * 255, b * 255, a);
    };
    var SUPPORTED_COLOR_FUNCTIONS = {
        hsl: hsl,
        hsla: hsl,
        rgb: rgb,
        rgba: rgb
    };
    var parseColor = function (context, value) {
        return color$1.parse(context, Parser.create(value).parseComponentValue());
    };
    var COLORS = {
        ALICEBLUE: 0xf0f8ffff,
        ANTIQUEWHITE: 0xfaebd7ff,
        AQUA: 0x00ffffff,
        AQUAMARINE: 0x7fffd4ff,
        AZURE: 0xf0ffffff,
        BEIGE: 0xf5f5dcff,
        BISQUE: 0xffe4c4ff,
        BLACK: 0x000000ff,
        BLANCHEDALMOND: 0xffebcdff,
        BLUE: 0x0000ffff,
        BLUEVIOLET: 0x8a2be2ff,
        BROWN: 0xa52a2aff,
        BURLYWOOD: 0xdeb887ff,
        CADETBLUE: 0x5f9ea0ff,
        CHARTREUSE: 0x7fff00ff,
        CHOCOLATE: 0xd2691eff,
        CORAL: 0xff7f50ff,
        CORNFLOWERBLUE: 0x6495edff,
        CORNSILK: 0xfff8dcff,
        CRIMSON: 0xdc143cff,
        CYAN: 0x00ffffff,
        DARKBLUE: 0x00008bff,
        DARKCYAN: 0x008b8bff,
        DARKGOLDENROD: 0xb886bbff,
        DARKGRAY: 0xa9a9a9ff,
        DARKGREEN: 0x006400ff,
        DARKGREY: 0xa9a9a9ff,
        DARKKHAKI: 0xbdb76bff,
        DARKMAGENTA: 0x8b008bff,
        DARKOLIVEGREEN: 0x556b2fff,
        DARKORANGE: 0xff8c00ff,
        DARKORCHID: 0x9932ccff,
        DARKRED: 0x8b0000ff,
        DARKSALMON: 0xe9967aff,
        DARKSEAGREEN: 0x8fbc8fff,
        DARKSLATEBLUE: 0x483d8bff,
        DARKSLATEGRAY: 0x2f4f4fff,
        DARKSLATEGREY: 0x2f4f4fff,
        DARKTURQUOISE: 0x00ced1ff,
        DARKVIOLET: 0x9400d3ff,
        DEEPPINK: 0xff1493ff,
        DEEPSKYBLUE: 0x00bfffff,
        DIMGRAY: 0x696969ff,
        DIMGREY: 0x696969ff,
        DODGERBLUE: 0x1e90ffff,
        FIREBRICK: 0xb22222ff,
        FLORALWHITE: 0xfffaf0ff,
        FORESTGREEN: 0x228b22ff,
        FUCHSIA: 0xff00ffff,
        GAINSBORO: 0xdcdcdcff,
        GHOSTWHITE: 0xf8f8ffff,
        GOLD: 0xffd700ff,
        GOLDENROD: 0xdaa520ff,
        GRAY: 0x808080ff,
        GREEN: 0x008000ff,
        GREENYELLOW: 0xadff2fff,
        GREY: 0x808080ff,
        HONEYDEW: 0xf0fff0ff,
        HOTPINK: 0xff69b4ff,
        INDIANRED: 0xcd5c5cff,
        INDIGO: 0x4b0082ff,
        IVORY: 0xfffff0ff,
        KHAKI: 0xf0e68cff,
        LAVENDER: 0xe6e6faff,
        LAVENDERBLUSH: 0xfff0f5ff,
        LAWNGREEN: 0x7cfc00ff,
        LEMONCHIFFON: 0xfffacdff,
        LIGHTBLUE: 0xadd8e6ff,
        LIGHTCORAL: 0xf08080ff,
        LIGHTCYAN: 0xe0ffffff,
        LIGHTGOLDENRODYELLOW: 0xfafad2ff,
        LIGHTGRAY: 0xd3d3d3ff,
        LIGHTGREEN: 0x90ee90ff,
        LIGHTGREY: 0xd3d3d3ff,
        LIGHTPINK: 0xffb6c1ff,
        LIGHTSALMON: 0xffa07aff,
        LIGHTSEAGREEN: 0x20b2aaff,
        LIGHTSKYBLUE: 0x87cefaff,
        LIGHTSLATEGRAY: 0x778899ff,
        LIGHTSLATEGREY: 0x778899ff,
        LIGHTSTEELBLUE: 0xb0c4deff,
        LIGHTYELLOW: 0xffffe0ff,
        LIME: 0x00ff00ff,
        LIMEGREEN: 0x32cd32ff,
        LINEN: 0xfaf0e6ff,
        MAGENTA: 0xff00ffff,
        MAROON: 0x800000ff,
        MEDIUMAQUAMARINE: 0x66cdaaff,
        MEDIUMBLUE: 0x0000cdff,
        MEDIUMORCHID: 0xba55d3ff,
        MEDIUMPURPLE: 0x9370dbff,
        MEDIUMSEAGREEN: 0x3cb371ff,
        MEDIUMSLATEBLUE: 0x7b68eeff,
        MEDIUMSPRINGGREEN: 0x00fa9aff,
        MEDIUMTURQUOISE: 0x48d1ccff,
        MEDIUMVIOLETRED: 0xc71585ff,
        MIDNIGHTBLUE: 0x191970ff,
        MINTCREAM: 0xf5fffaff,
        MISTYROSE: 0xffe4e1ff,
        MOCCASIN: 0xffe4b5ff,
        NAVAJOWHITE: 0xffdeadff,
        NAVY: 0x000080ff,
        OLDLACE: 0xfdf5e6ff,
        OLIVE: 0x808000ff,
        OLIVEDRAB: 0x6b8e23ff,
        ORANGE: 0xffa500ff,
        ORANGERED: 0xff4500ff,
        ORCHID: 0xda70d6ff,
        PALEGOLDENROD: 0xeee8aaff,
        PALEGREEN: 0x98fb98ff,
        PALETURQUOISE: 0xafeeeeff,
        PALEVIOLETRED: 0xdb7093ff,
        PAPAYAWHIP: 0xffefd5ff,
        PEACHPUFF: 0xffdab9ff,
        PERU: 0xcd853fff,
        PINK: 0xffc0cbff,
        PLUM: 0xdda0ddff,
        POWDERBLUE: 0xb0e0e6ff,
        PURPLE: 0x800080ff,
        REBECCAPURPLE: 0x663399ff,
        RED: 0xff0000ff,
        ROSYBROWN: 0xbc8f8fff,
        ROYALBLUE: 0x4169e1ff,
        SADDLEBROWN: 0x8b4513ff,
        SALMON: 0xfa8072ff,
        SANDYBROWN: 0xf4a460ff,
        SEAGREEN: 0x2e8b57ff,
        SEASHELL: 0xfff5eeff,
        SIENNA: 0xa0522dff,
        SILVER: 0xc0c0c0ff,
        SKYBLUE: 0x87ceebff,
        SLATEBLUE: 0x6a5acdff,
        SLATEGRAY: 0x708090ff,
        SLATEGREY: 0x708090ff,
        SNOW: 0xfffafaff,
        SPRINGGREEN: 0x00ff7fff,
        STEELBLUE: 0x4682b4ff,
        TAN: 0xd2b48cff,
        TEAL: 0x008080ff,
        THISTLE: 0xd8bfd8ff,
        TOMATO: 0xff6347ff,
        TRANSPARENT: 0x00000000,
        TURQUOISE: 0x40e0d0ff,
        VIOLET: 0xee82eeff,
        WHEAT: 0xf5deb3ff,
        WHITE: 0xffffffff,
        WHITESMOKE: 0xf5f5f5ff,
        YELLOW: 0xffff00ff,
        YELLOWGREEN: 0x9acd32ff
    };

    var backgroundClip = {
        name: 'background-clip',
        initialValue: 'border-box',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return tokens.map(function (token) {
                if (isIdentToken(token)) {
                    switch (token.value) {
                        case 'padding-box':
                            return 1 /* PADDING_BOX */;
                        case 'content-box':
                            return 2 /* CONTENT_BOX */;
                    }
                }
                return 0 /* BORDER_BOX */;
            });
        }
    };

    var backgroundColor = {
        name: "background-color",
        initialValue: 'transparent',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'color'
    };

    var parseColorStop = function (context, args) {
        var color = color$1.parse(context, args[0]);
        var stop = args[1];
        return stop && isLengthPercentage(stop) ? { color: color, stop: stop } : { color: color, stop: null };
    };
    var processColorStops = function (stops, lineLength) {
        var first = stops[0];
        var last = stops[stops.length - 1];
        if (first.stop === null) {
            first.stop = ZERO_LENGTH;
        }
        if (last.stop === null) {
            last.stop = HUNDRED_PERCENT;
        }
        var processStops = [];
        var previous = 0;
        for (var i = 0; i < stops.length; i++) {
            var stop_1 = stops[i].stop;
            if (stop_1 !== null) {
                var absoluteValue = getAbsoluteValue(stop_1, lineLength);
                if (absoluteValue > previous) {
                    processStops.push(absoluteValue);
                }
                else {
                    processStops.push(previous);
                }
                previous = absoluteValue;
            }
            else {
                processStops.push(null);
            }
        }
        var gapBegin = null;
        for (var i = 0; i < processStops.length; i++) {
            var stop_2 = processStops[i];
            if (stop_2 === null) {
                if (gapBegin === null) {
                    gapBegin = i;
                }
            }
            else if (gapBegin !== null) {
                var gapLength = i - gapBegin;
                var beforeGap = processStops[gapBegin - 1];
                var gapValue = (stop_2 - beforeGap) / (gapLength + 1);
                for (var g = 1; g <= gapLength; g++) {
                    processStops[gapBegin + g - 1] = gapValue * g;
                }
                gapBegin = null;
            }
        }
        return stops.map(function (_a, i) {
            var color = _a.color;
            return { color: color, stop: Math.max(Math.min(1, processStops[i] / lineLength), 0) };
        });
    };
    var getAngleFromCorner = function (corner, width, height) {
        var centerX = width / 2;
        var centerY = height / 2;
        var x = getAbsoluteValue(corner[0], width) - centerX;
        var y = centerY - getAbsoluteValue(corner[1], height);
        return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2);
    };
    var calculateGradientDirection = function (angle, width, height) {
        var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height);
        var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
        var halfWidth = width / 2;
        var halfHeight = height / 2;
        var halfLineLength = lineLength / 2;
        var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength;
        var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength;
        return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff];
    };
    var distance = function (a, b) { return Math.sqrt(a * a + b * b); };
    var findCorner = function (width, height, x, y, closest) {
        var corners = [
            [0, 0],
            [0, height],
            [width, 0],
            [width, height]
        ];
        return corners.reduce(function (stat, corner) {
            var cx = corner[0], cy = corner[1];
            var d = distance(x - cx, y - cy);
            if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
                return {
                    optimumCorner: corner,
                    optimumDistance: d
                };
            }
            return stat;
        }, {
            optimumDistance: closest ? Infinity : -Infinity,
            optimumCorner: null
        }).optimumCorner;
    };
    var calculateRadius = function (gradient, x, y, width, height) {
        var rx = 0;
        var ry = 0;
        switch (gradient.size) {
            case 0 /* CLOSEST_SIDE */:
                // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
                // If the shape is an ellipse, it exactly meets the closest side in each dimension.
                if (gradient.shape === 0 /* CIRCLE */) {
                    rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
                }
                else if (gradient.shape === 1 /* ELLIPSE */) {
                    rx = Math.min(Math.abs(x), Math.abs(x - width));
                    ry = Math.min(Math.abs(y), Math.abs(y - height));
                }
                break;
            case 2 /* CLOSEST_CORNER */:
                // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
                // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
                if (gradient.shape === 0 /* CIRCLE */) {
                    rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
                }
                else if (gradient.shape === 1 /* ELLIPSE */) {
                    // Compute the ratio ry/rx (which is to be the same as for "closest-side")
                    var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
                    var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
                    rx = distance(cx - x, (cy - y) / c);
                    ry = c * rx;
                }
                break;
            case 1 /* FARTHEST_SIDE */:
                // Same as closest-side, except the ending shape is sized based on the farthest side(s)
                if (gradient.shape === 0 /* CIRCLE */) {
                    rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
                }
                else if (gradient.shape === 1 /* ELLIPSE */) {
                    rx = Math.max(Math.abs(x), Math.abs(x - width));
                    ry = Math.max(Math.abs(y), Math.abs(y - height));
                }
                break;
            case 3 /* FARTHEST_CORNER */:
                // Same as closest-corner, except the ending shape is sized based on the farthest corner.
                // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
                if (gradient.shape === 0 /* CIRCLE */) {
                    rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
                }
                else if (gradient.shape === 1 /* ELLIPSE */) {
                    // Compute the ratio ry/rx (which is to be the same as for "farthest-side")
                    var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
                    var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
                    rx = distance(cx - x, (cy - y) / c);
                    ry = c * rx;
                }
                break;
        }
        if (Array.isArray(gradient.size)) {
            rx = getAbsoluteValue(gradient.size[0], width);
            ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx;
        }
        return [rx, ry];
    };

    var linearGradient = function (context, tokens) {
        var angle$1 = deg(180);
        var stops = [];
        parseFunctionArgs(tokens).forEach(function (arg, i) {
            if (i === 0) {
                var firstToken = arg[0];
                if (firstToken.type === 20 /* IDENT_TOKEN */ && firstToken.value === 'to') {
                    angle$1 = parseNamedSide(arg);
                    return;
                }
                else if (isAngle(firstToken)) {
                    angle$1 = angle.parse(context, firstToken);
                    return;
                }
            }
            var colorStop = parseColorStop(context, arg);
            stops.push(colorStop);
        });
        return { angle: angle$1, stops: stops, type: 1 /* LINEAR_GRADIENT */ };
    };

    var prefixLinearGradient = function (context, tokens) {
        var angle$1 = deg(180);
        var stops = [];
        parseFunctionArgs(tokens).forEach(function (arg, i) {
            if (i === 0) {
                var firstToken = arg[0];
                if (firstToken.type === 20 /* IDENT_TOKEN */ &&
                    ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
                    angle$1 = parseNamedSide(arg);
                    return;
                }
                else if (isAngle(firstToken)) {
                    angle$1 = (angle.parse(context, firstToken) + deg(270)) % deg(360);
                    return;
                }
            }
            var colorStop = parseColorStop(context, arg);
            stops.push(colorStop);
        });
        return {
            angle: angle$1,
            stops: stops,
            type: 1 /* LINEAR_GRADIENT */
        };
    };

    var webkitGradient = function (context, tokens) {
        var angle = deg(180);
        var stops = [];
        var type = 1 /* LINEAR_GRADIENT */;
        var shape = 0 /* CIRCLE */;
        var size = 3 /* FARTHEST_CORNER */;
        var position = [];
        parseFunctionArgs(tokens).forEach(function (arg, i) {
            var firstToken = arg[0];
            if (i === 0) {
                if (isIdentToken(firstToken) && firstToken.value === 'linear') {
                    type = 1 /* LINEAR_GRADIENT */;
                    return;
                }
                else if (isIdentToken(firstToken) && firstToken.value === 'radial') {
                    type = 2 /* RADIAL_GRADIENT */;
                    return;
                }
            }
            if (firstToken.type === 18 /* FUNCTION */) {
                if (firstToken.name === 'from') {
                    var color = color$1.parse(context, firstToken.values[0]);
                    stops.push({ stop: ZERO_LENGTH, color: color });
                }
                else if (firstToken.name === 'to') {
                    var color = color$1.parse(context, firstToken.values[0]);
                    stops.push({ stop: HUNDRED_PERCENT, color: color });
                }
                else if (firstToken.name === 'color-stop') {
                    var values = firstToken.values.filter(nonFunctionArgSeparator);
                    if (values.length === 2) {
                        var color = color$1.parse(context, values[1]);
                        var stop_1 = values[0];
                        if (isNumberToken(stop_1)) {
                            stops.push({
                                stop: { type: 16 /* PERCENTAGE_TOKEN */, number: stop_1.number * 100, flags: stop_1.flags },
                                color: color
                            });
                        }
                    }
                }
            }
        });
        return type === 1 /* LINEAR_GRADIENT */
            ? {
                angle: (angle + deg(180)) % deg(360),
                stops: stops,
                type: type
            }
            : { size: size, shape: shape, stops: stops, position: position, type: type };
    };

    var CLOSEST_SIDE = 'closest-side';
    var FARTHEST_SIDE = 'farthest-side';
    var CLOSEST_CORNER = 'closest-corner';
    var FARTHEST_CORNER = 'farthest-corner';
    var CIRCLE = 'circle';
    var ELLIPSE = 'ellipse';
    var COVER = 'cover';
    var CONTAIN = 'contain';
    var radialGradient = function (context, tokens) {
        var shape = 0 /* CIRCLE */;
        var size = 3 /* FARTHEST_CORNER */;
        var stops = [];
        var position = [];
        parseFunctionArgs(tokens).forEach(function (arg, i) {
            var isColorStop = true;
            if (i === 0) {
                var isAtPosition_1 = false;
                isColorStop = arg.reduce(function (acc, token) {
                    if (isAtPosition_1) {
                        if (isIdentToken(token)) {
                            switch (token.value) {
                                case 'center':
                                    position.push(FIFTY_PERCENT);
                                    return acc;
                                case 'top':
                                case 'left':
                                    position.push(ZERO_LENGTH);
                                    return acc;
                                case 'right':
                                case 'bottom':
                                    position.push(HUNDRED_PERCENT);
                                    return acc;
                            }
                        }
                        else if (isLengthPercentage(token) || isLength(token)) {
                            position.push(token);
                        }
                    }
                    else if (isIdentToken(token)) {
                        switch (token.value) {
                            case CIRCLE:
                                shape = 0 /* CIRCLE */;
                                return false;
                            case ELLIPSE:
                                shape = 1 /* ELLIPSE */;
                                return false;
                            case 'at':
                                isAtPosition_1 = true;
                                return false;
                            case CLOSEST_SIDE:
                                size = 0 /* CLOSEST_SIDE */;
                                return false;
                            case COVER:
                            case FARTHEST_SIDE:
                                size = 1 /* FARTHEST_SIDE */;
                                return false;
                            case CONTAIN:
                            case CLOSEST_CORNER:
                                size = 2 /* CLOSEST_CORNER */;
                                return false;
                            case FARTHEST_CORNER:
                                size = 3 /* FARTHEST_CORNER */;
                                return false;
                        }
                    }
                    else if (isLength(token) || isLengthPercentage(token)) {
                        if (!Array.isArray(size)) {
                            size = [];
                        }
                        size.push(token);
                        return false;
                    }
                    return acc;
                }, isColorStop);
            }
            if (isColorStop) {
                var colorStop = parseColorStop(context, arg);
                stops.push(colorStop);
            }
        });
        return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
    };

    var prefixRadialGradient = function (context, tokens) {
        var shape = 0 /* CIRCLE */;
        var size = 3 /* FARTHEST_CORNER */;
        var stops = [];
        var position = [];
        parseFunctionArgs(tokens).forEach(function (arg, i) {
            var isColorStop = true;
            if (i === 0) {
                isColorStop = arg.reduce(function (acc, token) {
                    if (isIdentToken(token)) {
                        switch (token.value) {
                            case 'center':
                                position.push(FIFTY_PERCENT);
                                return false;
                            case 'top':
                            case 'left':
                                position.push(ZERO_LENGTH);
                                return false;
                            case 'right':
                            case 'bottom':
                                position.push(HUNDRED_PERCENT);
                                return false;
                        }
                    }
                    else if (isLengthPercentage(token) || isLength(token)) {
                        position.push(token);
                        return false;
                    }
                    return acc;
                }, isColorStop);
            }
            else if (i === 1) {
                isColorStop = arg.reduce(function (acc, token) {
                    if (isIdentToken(token)) {
                        switch (token.value) {
                            case CIRCLE:
                                shape = 0 /* CIRCLE */;
                                return false;
                            case ELLIPSE:
                                shape = 1 /* ELLIPSE */;
                                return false;
                            case CONTAIN:
                            case CLOSEST_SIDE:
                                size = 0 /* CLOSEST_SIDE */;
                                return false;
                            case FARTHEST_SIDE:
                                size = 1 /* FARTHEST_SIDE */;
                                return false;
                            case CLOSEST_CORNER:
                                size = 2 /* CLOSEST_CORNER */;
                                return false;
                            case COVER:
                            case FARTHEST_CORNER:
                                size = 3 /* FARTHEST_CORNER */;
                                return false;
                        }
                    }
                    else if (isLength(token) || isLengthPercentage(token)) {
                        if (!Array.isArray(size)) {
                            size = [];
                        }
                        size.push(token);
                        return false;
                    }
                    return acc;
                }, isColorStop);
            }
            if (isColorStop) {
                var colorStop = parseColorStop(context, arg);
                stops.push(colorStop);
            }
        });
        return { size: size, shape: shape, stops: stops, position: position, type: 2 /* RADIAL_GRADIENT */ };
    };

    var isLinearGradient = function (background) {
        return background.type === 1 /* LINEAR_GRADIENT */;
    };
    var isRadialGradient = function (background) {
        return background.type === 2 /* RADIAL_GRADIENT */;
    };
    var image = {
        name: 'image',
        parse: function (context, value) {
            if (value.type === 22 /* URL_TOKEN */) {
                var image_1 = { url: value.value, type: 0 /* URL */ };
                context.cache.addImage(value.value);
                return image_1;
            }
            if (value.type === 18 /* FUNCTION */) {
                var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
                if (typeof imageFunction === 'undefined') {
                    throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\"");
                }
                return imageFunction(context, value.values);
            }
            throw new Error("Unsupported image type " + value.type);
        }
    };
    function isSupportedImage(value) {
        return (!(value.type === 20 /* IDENT_TOKEN */ && value.value === 'none') &&
            (value.type !== 18 /* FUNCTION */ || !!SUPPORTED_IMAGE_FUNCTIONS[value.name]));
    }
    var SUPPORTED_IMAGE_FUNCTIONS = {
        'linear-gradient': linearGradient,
        '-moz-linear-gradient': prefixLinearGradient,
        '-ms-linear-gradient': prefixLinearGradient,
        '-o-linear-gradient': prefixLinearGradient,
        '-webkit-linear-gradient': prefixLinearGradient,
        'radial-gradient': radialGradient,
        '-moz-radial-gradient': prefixRadialGradient,
        '-ms-radial-gradient': prefixRadialGradient,
        '-o-radial-gradient': prefixRadialGradient,
        '-webkit-radial-gradient': prefixRadialGradient,
        '-webkit-gradient': webkitGradient
    };

    var backgroundImage = {
        name: 'background-image',
        initialValue: 'none',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (context, tokens) {
            if (tokens.length === 0) {
                return [];
            }
            var first = tokens[0];
            if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
                return [];
            }
            return tokens
                .filter(function (value) { return nonFunctionArgSeparator(value) && isSupportedImage(value); })
                .map(function (value) { return image.parse(context, value); });
        }
    };

    var backgroundOrigin = {
        name: 'background-origin',
        initialValue: 'border-box',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return tokens.map(function (token) {
                if (isIdentToken(token)) {
                    switch (token.value) {
                        case 'padding-box':
                            return 1 /* PADDING_BOX */;
                        case 'content-box':
                            return 2 /* CONTENT_BOX */;
                    }
                }
                return 0 /* BORDER_BOX */;
            });
        }
    };

    var backgroundPosition = {
        name: 'background-position',
        initialValue: '0% 0%',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (_context, tokens) {
            return parseFunctionArgs(tokens)
                .map(function (values) { return values.filter(isLengthPercentage); })
                .map(parseLengthPercentageTuple);
        }
    };

    var backgroundRepeat = {
        name: 'background-repeat',
        initialValue: 'repeat',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return parseFunctionArgs(tokens)
                .map(function (values) {
                return values
                    .filter(isIdentToken)
                    .map(function (token) { return token.value; })
                    .join(' ');
            })
                .map(parseBackgroundRepeat);
        }
    };
    var parseBackgroundRepeat = function (value) {
        switch (value) {
            case 'no-repeat':
                return 1 /* NO_REPEAT */;
            case 'repeat-x':
            case 'repeat no-repeat':
                return 2 /* REPEAT_X */;
            case 'repeat-y':
            case 'no-repeat repeat':
                return 3 /* REPEAT_Y */;
            case 'repeat':
            default:
                return 0 /* REPEAT */;
        }
    };

    var BACKGROUND_SIZE;
    (function (BACKGROUND_SIZE) {
        BACKGROUND_SIZE["AUTO"] = "auto";
        BACKGROUND_SIZE["CONTAIN"] = "contain";
        BACKGROUND_SIZE["COVER"] = "cover";
    })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {}));
    var backgroundSize = {
        name: 'background-size',
        initialValue: '0',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return parseFunctionArgs(tokens).map(function (values) { return values.filter(isBackgroundSizeInfoToken); });
        }
    };
    var isBackgroundSizeInfoToken = function (value) {
        return isIdentToken(value) || isLengthPercentage(value);
    };

    var borderColorForSide = function (side) { return ({
        name: "border-" + side + "-color",
        initialValue: 'transparent',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'color'
    }); };
    var borderTopColor = borderColorForSide('top');
    var borderRightColor = borderColorForSide('right');
    var borderBottomColor = borderColorForSide('bottom');
    var borderLeftColor = borderColorForSide('left');

    var borderRadiusForSide = function (side) { return ({
        name: "border-radius-" + side,
        initialValue: '0 0',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
        }
    }); };
    var borderTopLeftRadius = borderRadiusForSide('top-left');
    var borderTopRightRadius = borderRadiusForSide('top-right');
    var borderBottomRightRadius = borderRadiusForSide('bottom-right');
    var borderBottomLeftRadius = borderRadiusForSide('bottom-left');

    var borderStyleForSide = function (side) { return ({
        name: "border-" + side + "-style",
        initialValue: 'solid',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, style) {
            switch (style) {
                case 'none':
                    return 0 /* NONE */;
                case 'dashed':
                    return 2 /* DASHED */;
                case 'dotted':
                    return 3 /* DOTTED */;
                case 'double':
                    return 4 /* DOUBLE */;
            }
            return 1 /* SOLID */;
        }
    }); };
    var borderTopStyle = borderStyleForSide('top');
    var borderRightStyle = borderStyleForSide('right');
    var borderBottomStyle = borderStyleForSide('bottom');
    var borderLeftStyle = borderStyleForSide('left');

    var borderWidthForSide = function (side) { return ({
        name: "border-" + side + "-width",
        initialValue: '0',
        type: 0 /* VALUE */,
        prefix: false,
        parse: function (_context, token) {
            if (isDimensionToken(token)) {
                return token.number;
            }
            return 0;
        }
    }); };
    var borderTopWidth = borderWidthForSide('top');
    var borderRightWidth = borderWidthForSide('right');
    var borderBottomWidth = borderWidthForSide('bottom');
    var borderLeftWidth = borderWidthForSide('left');

    var color = {
        name: "color",
        initialValue: 'transparent',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'color'
    };

    var direction = {
        name: 'direction',
        initialValue: 'ltr',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, direction) {
            switch (direction) {
                case 'rtl':
                    return 1 /* RTL */;
                case 'ltr':
                default:
                    return 0 /* LTR */;
            }
        }
    };

    var display = {
        name: 'display',
        initialValue: 'inline-block',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return tokens.filter(isIdentToken).reduce(function (bit, token) {
                return bit | parseDisplayValue(token.value);
            }, 0 /* NONE */);
        }
    };
    var parseDisplayValue = function (display) {
        switch (display) {
            case 'block':
            case '-webkit-box':
                return 2 /* BLOCK */;
            case 'inline':
                return 4 /* INLINE */;
            case 'run-in':
                return 8 /* RUN_IN */;
            case 'flow':
                return 16 /* FLOW */;
            case 'flow-root':
                return 32 /* FLOW_ROOT */;
            case 'table':
                return 64 /* TABLE */;
            case 'flex':
            case '-webkit-flex':
                return 128 /* FLEX */;
            case 'grid':
            case '-ms-grid':
                return 256 /* GRID */;
            case 'ruby':
                return 512 /* RUBY */;
            case 'subgrid':
                return 1024 /* SUBGRID */;
            case 'list-item':
                return 2048 /* LIST_ITEM */;
            case 'table-row-group':
                return 4096 /* TABLE_ROW_GROUP */;
            case 'table-header-group':
                return 8192 /* TABLE_HEADER_GROUP */;
            case 'table-footer-group':
                return 16384 /* TABLE_FOOTER_GROUP */;
            case 'table-row':
                return 32768 /* TABLE_ROW */;
            case 'table-cell':
                return 65536 /* TABLE_CELL */;
            case 'table-column-group':
                return 131072 /* TABLE_COLUMN_GROUP */;
            case 'table-column':
                return 262144 /* TABLE_COLUMN */;
            case 'table-caption':
                return 524288 /* TABLE_CAPTION */;
            case 'ruby-base':
                return 1048576 /* RUBY_BASE */;
            case 'ruby-text':
                return 2097152 /* RUBY_TEXT */;
            case 'ruby-base-container':
                return 4194304 /* RUBY_BASE_CONTAINER */;
            case 'ruby-text-container':
                return 8388608 /* RUBY_TEXT_CONTAINER */;
            case 'contents':
                return 16777216 /* CONTENTS */;
            case 'inline-block':
                return 33554432 /* INLINE_BLOCK */;
            case 'inline-list-item':
                return 67108864 /* INLINE_LIST_ITEM */;
            case 'inline-table':
                return 134217728 /* INLINE_TABLE */;
            case 'inline-flex':
                return 268435456 /* INLINE_FLEX */;
            case 'inline-grid':
                return 536870912 /* INLINE_GRID */;
        }
        return 0 /* NONE */;
    };

    var float = {
        name: 'float',
        initialValue: 'none',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, float) {
            switch (float) {
                case 'left':
                    return 1 /* LEFT */;
                case 'right':
                    return 2 /* RIGHT */;
                case 'inline-start':
                    return 3 /* INLINE_START */;
                case 'inline-end':
                    return 4 /* INLINE_END */;
            }
            return 0 /* NONE */;
        }
    };

    var letterSpacing = {
        name: 'letter-spacing',
        initialValue: '0',
        prefix: false,
        type: 0 /* VALUE */,
        parse: function (_context, token) {
            if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'normal') {
                return 0;
            }
            if (token.type === 17 /* NUMBER_TOKEN */) {
                return token.number;
            }
            if (token.type === 15 /* DIMENSION_TOKEN */) {
                return token.number;
            }
            return 0;
        }
    };

    var LINE_BREAK;
    (function (LINE_BREAK) {
        LINE_BREAK["NORMAL"] = "normal";
        LINE_BREAK["STRICT"] = "strict";
    })(LINE_BREAK || (LINE_BREAK = {}));
    var lineBreak = {
        name: 'line-break',
        initialValue: 'normal',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, lineBreak) {
            switch (lineBreak) {
                case 'strict':
                    return LINE_BREAK.STRICT;
                case 'normal':
                default:
                    return LINE_BREAK.NORMAL;
            }
        }
    };

    var lineHeight = {
        name: 'line-height',
        initialValue: 'normal',
        prefix: false,
        type: 4 /* TOKEN_VALUE */
    };
    var computeLineHeight = function (token, fontSize) {
        if (isIdentToken(token) && token.value === 'normal') {
            return 1.2 * fontSize;
        }
        else if (token.type === 17 /* NUMBER_TOKEN */) {
            return fontSize * token.number;
        }
        else if (isLengthPercentage(token)) {
            return getAbsoluteValue(token, fontSize);
        }
        return fontSize;
    };

    var listStyleImage = {
        name: 'list-style-image',
        initialValue: 'none',
        type: 0 /* VALUE */,
        prefix: false,
        parse: function (context, token) {
            if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
                return null;
            }
            return image.parse(context, token);
        }
    };

    var listStylePosition = {
        name: 'list-style-position',
        initialValue: 'outside',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, position) {
            switch (position) {
                case 'inside':
                    return 0 /* INSIDE */;
                case 'outside':
                default:
                    return 1 /* OUTSIDE */;
            }
        }
    };

    var listStyleType = {
        name: 'list-style-type',
        initialValue: 'none',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, type) {
            switch (type) {
                case 'disc':
                    return 0 /* DISC */;
                case 'circle':
                    return 1 /* CIRCLE */;
                case 'square':
                    return 2 /* SQUARE */;
                case 'decimal':
                    return 3 /* DECIMAL */;
                case 'cjk-decimal':
                    return 4 /* CJK_DECIMAL */;
                case 'decimal-leading-zero':
                    return 5 /* DECIMAL_LEADING_ZERO */;
                case 'lower-roman':
                    return 6 /* LOWER_ROMAN */;
                case 'upper-roman':
                    return 7 /* UPPER_ROMAN */;
                case 'lower-greek':
                    return 8 /* LOWER_GREEK */;
                case 'lower-alpha':
                    return 9 /* LOWER_ALPHA */;
                case 'upper-alpha':
                    return 10 /* UPPER_ALPHA */;
                case 'arabic-indic':
                    return 11 /* ARABIC_INDIC */;
                case 'armenian':
                    return 12 /* ARMENIAN */;
                case 'bengali':
                    return 13 /* BENGALI */;
                case 'cambodian':
                    return 14 /* CAMBODIAN */;
                case 'cjk-earthly-branch':
                    return 15 /* CJK_EARTHLY_BRANCH */;
                case 'cjk-heavenly-stem':
                    return 16 /* CJK_HEAVENLY_STEM */;
                case 'cjk-ideographic':
                    return 17 /* CJK_IDEOGRAPHIC */;
                case 'devanagari':
                    return 18 /* DEVANAGARI */;
                case 'ethiopic-numeric':
                    return 19 /* ETHIOPIC_NUMERIC */;
                case 'georgian':
                    return 20 /* GEORGIAN */;
                case 'gujarati':
                    return 21 /* GUJARATI */;
                case 'gurmukhi':
                    return 22 /* GURMUKHI */;
                case 'hebrew':
                    return 22 /* HEBREW */;
                case 'hiragana':
                    return 23 /* HIRAGANA */;
                case 'hiragana-iroha':
                    return 24 /* HIRAGANA_IROHA */;
                case 'japanese-formal':
                    return 25 /* JAPANESE_FORMAL */;
                case 'japanese-informal':
                    return 26 /* JAPANESE_INFORMAL */;
                case 'kannada':
                    return 27 /* KANNADA */;
                case 'katakana':
                    return 28 /* KATAKANA */;
                case 'katakana-iroha':
                    return 29 /* KATAKANA_IROHA */;
                case 'khmer':
                    return 30 /* KHMER */;
                case 'korean-hangul-formal':
                    return 31 /* KOREAN_HANGUL_FORMAL */;
                case 'korean-hanja-formal':
                    return 32 /* KOREAN_HANJA_FORMAL */;
                case 'korean-hanja-informal':
                    return 33 /* KOREAN_HANJA_INFORMAL */;
                case 'lao':
                    return 34 /* LAO */;
                case 'lower-armenian':
                    return 35 /* LOWER_ARMENIAN */;
                case 'malayalam':
                    return 36 /* MALAYALAM */;
                case 'mongolian':
                    return 37 /* MONGOLIAN */;
                case 'myanmar':
                    return 38 /* MYANMAR */;
                case 'oriya':
                    return 39 /* ORIYA */;
                case 'persian':
                    return 40 /* PERSIAN */;
                case 'simp-chinese-formal':
                    return 41 /* SIMP_CHINESE_FORMAL */;
                case 'simp-chinese-informal':
                    return 42 /* SIMP_CHINESE_INFORMAL */;
                case 'tamil':
                    return 43 /* TAMIL */;
                case 'telugu':
                    return 44 /* TELUGU */;
                case 'thai':
                    return 45 /* THAI */;
                case 'tibetan':
                    return 46 /* TIBETAN */;
                case 'trad-chinese-formal':
                    return 47 /* TRAD_CHINESE_FORMAL */;
                case 'trad-chinese-informal':
                    return 48 /* TRAD_CHINESE_INFORMAL */;
                case 'upper-armenian':
                    return 49 /* UPPER_ARMENIAN */;
                case 'disclosure-open':
                    return 50 /* DISCLOSURE_OPEN */;
                case 'disclosure-closed':
                    return 51 /* DISCLOSURE_CLOSED */;
                case 'none':
                default:
                    return -1 /* NONE */;
            }
        }
    };

    var marginForSide = function (side) { return ({
        name: "margin-" + side,
        initialValue: '0',
        prefix: false,
        type: 4 /* TOKEN_VALUE */
    }); };
    var marginTop = marginForSide('top');
    var marginRight = marginForSide('right');
    var marginBottom = marginForSide('bottom');
    var marginLeft = marginForSide('left');

    var overflow = {
        name: 'overflow',
        initialValue: 'visible',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return tokens.filter(isIdentToken).map(function (overflow) {
                switch (overflow.value) {
                    case 'hidden':
                        return 1 /* HIDDEN */;
                    case 'scroll':
                        return 2 /* SCROLL */;
                    case 'clip':
                        return 3 /* CLIP */;
                    case 'auto':
                        return 4 /* AUTO */;
                    case 'visible':
                    default:
                        return 0 /* VISIBLE */;
                }
            });
        }
    };

    var overflowWrap = {
        name: 'overflow-wrap',
        initialValue: 'normal',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, overflow) {
            switch (overflow) {
                case 'break-word':
                    return "break-word" /* BREAK_WORD */;
                case 'normal':
                default:
                    return "normal" /* NORMAL */;
            }
        }
    };

    var paddingForSide = function (side) { return ({
        name: "padding-" + side,
        initialValue: '0',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'length-percentage'
    }); };
    var paddingTop = paddingForSide('top');
    var paddingRight = paddingForSide('right');
    var paddingBottom = paddingForSide('bottom');
    var paddingLeft = paddingForSide('left');

    var textAlign = {
        name: 'text-align',
        initialValue: 'left',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, textAlign) {
            switch (textAlign) {
                case 'right':
                    return 2 /* RIGHT */;
                case 'center':
                case 'justify':
                    return 1 /* CENTER */;
                case 'left':
                default:
                    return 0 /* LEFT */;
            }
        }
    };

    var position = {
        name: 'position',
        initialValue: 'static',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, position) {
            switch (position) {
                case 'relative':
                    return 1 /* RELATIVE */;
                case 'absolute':
                    return 2 /* ABSOLUTE */;
                case 'fixed':
                    return 3 /* FIXED */;
                case 'sticky':
                    return 4 /* STICKY */;
            }
            return 0 /* STATIC */;
        }
    };

    var textShadow = {
        name: 'text-shadow',
        initialValue: 'none',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (context, tokens) {
            if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
                return [];
            }
            return parseFunctionArgs(tokens).map(function (values) {
                var shadow = {
                    color: COLORS.TRANSPARENT,
                    offsetX: ZERO_LENGTH,
                    offsetY: ZERO_LENGTH,
                    blur: ZERO_LENGTH
                };
                var c = 0;
                for (var i = 0; i < values.length; i++) {
                    var token = values[i];
                    if (isLength(token)) {
                        if (c === 0) {
                            shadow.offsetX = token;
                        }
                        else if (c === 1) {
                            shadow.offsetY = token;
                        }
                        else {
                            shadow.blur = token;
                        }
                        c++;
                    }
                    else {
                        shadow.color = color$1.parse(context, token);
                    }
                }
                return shadow;
            });
        }
    };

    var textTransform = {
        name: 'text-transform',
        initialValue: 'none',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, textTransform) {
            switch (textTransform) {
                case 'uppercase':
                    return 2 /* UPPERCASE */;
                case 'lowercase':
                    return 1 /* LOWERCASE */;
                case 'capitalize':
                    return 3 /* CAPITALIZE */;
            }
            return 0 /* NONE */;
        }
    };

    var transform$1 = {
        name: 'transform',
        initialValue: 'none',
        prefix: true,
        type: 0 /* VALUE */,
        parse: function (_context, token) {
            if (token.type === 20 /* IDENT_TOKEN */ && token.value === 'none') {
                return null;
            }
            if (token.type === 18 /* FUNCTION */) {
                var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
                if (typeof transformFunction === 'undefined') {
                    throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\"");
                }
                return transformFunction(token.values);
            }
            return null;
        }
    };
    var matrix = function (args) {
        var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
        return values.length === 6 ? values : null;
    };
    // doesn't support 3D transforms at the moment
    var matrix3d = function (args) {
        var values = args.filter(function (arg) { return arg.type === 17 /* NUMBER_TOKEN */; }).map(function (arg) { return arg.number; });
        var a1 = values[0], b1 = values[1]; values[2]; values[3]; var a2 = values[4], b2 = values[5]; values[6]; values[7]; values[8]; values[9]; values[10]; values[11]; var a4 = values[12], b4 = values[13]; values[14]; values[15];
        return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
    };
    var SUPPORTED_TRANSFORM_FUNCTIONS = {
        matrix: matrix,
        matrix3d: matrix3d
    };

    var DEFAULT_VALUE = {
        type: 16 /* PERCENTAGE_TOKEN */,
        number: 50,
        flags: FLAG_INTEGER
    };
    var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
    var transformOrigin = {
        name: 'transform-origin',
        initialValue: '50% 50%',
        prefix: true,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            var origins = tokens.filter(isLengthPercentage);
            if (origins.length !== 2) {
                return DEFAULT;
            }
            return [origins[0], origins[1]];
        }
    };

    var visibility = {
        name: 'visible',
        initialValue: 'none',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, visibility) {
            switch (visibility) {
                case 'hidden':
                    return 1 /* HIDDEN */;
                case 'collapse':
                    return 2 /* COLLAPSE */;
                case 'visible':
                default:
                    return 0 /* VISIBLE */;
            }
        }
    };

    var WORD_BREAK;
    (function (WORD_BREAK) {
        WORD_BREAK["NORMAL"] = "normal";
        WORD_BREAK["BREAK_ALL"] = "break-all";
        WORD_BREAK["KEEP_ALL"] = "keep-all";
    })(WORD_BREAK || (WORD_BREAK = {}));
    var wordBreak = {
        name: 'word-break',
        initialValue: 'normal',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, wordBreak) {
            switch (wordBreak) {
                case 'break-all':
                    return WORD_BREAK.BREAK_ALL;
                case 'keep-all':
                    return WORD_BREAK.KEEP_ALL;
                case 'normal':
                default:
                    return WORD_BREAK.NORMAL;
            }
        }
    };

    var zIndex = {
        name: 'z-index',
        initialValue: 'auto',
        prefix: false,
        type: 0 /* VALUE */,
        parse: function (_context, token) {
            if (token.type === 20 /* IDENT_TOKEN */) {
                return { auto: true, order: 0 };
            }
            if (isNumberToken(token)) {
                return { auto: false, order: token.number };
            }
            throw new Error("Invalid z-index number parsed");
        }
    };

    var time = {
        name: 'time',
        parse: function (_context, value) {
            if (value.type === 15 /* DIMENSION_TOKEN */) {
                switch (value.unit.toLowerCase()) {
                    case 's':
                        return 1000 * value.number;
                    case 'ms':
                        return value.number;
                }
            }
            throw new Error("Unsupported time type");
        }
    };

    var opacity = {
        name: 'opacity',
        initialValue: '1',
        type: 0 /* VALUE */,
        prefix: false,
        parse: function (_context, token) {
            if (isNumberToken(token)) {
                return token.number;
            }
            return 1;
        }
    };

    var textDecorationColor = {
        name: "text-decoration-color",
        initialValue: 'transparent',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'color'
    };

    var textDecorationLine = {
        name: 'text-decoration-line',
        initialValue: 'none',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            return tokens
                .filter(isIdentToken)
                .map(function (token) {
                switch (token.value) {
                    case 'underline':
                        return 1 /* UNDERLINE */;
                    case 'overline':
                        return 2 /* OVERLINE */;
                    case 'line-through':
                        return 3 /* LINE_THROUGH */;
                    case 'none':
                        return 4 /* BLINK */;
                }
                return 0 /* NONE */;
            })
                .filter(function (line) { return line !== 0 /* NONE */; });
        }
    };

    var fontFamily = {
        name: "font-family",
        initialValue: '',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            var accumulator = [];
            var results = [];
            tokens.forEach(function (token) {
                switch (token.type) {
                    case 20 /* IDENT_TOKEN */:
                    case 0 /* STRING_TOKEN */:
                        accumulator.push(token.value);
                        break;
                    case 17 /* NUMBER_TOKEN */:
                        accumulator.push(token.number.toString());
                        break;
                    case 4 /* COMMA_TOKEN */:
                        results.push(accumulator.join(' '));
                        accumulator.length = 0;
                        break;
                }
            });
            if (accumulator.length) {
                results.push(accumulator.join(' '));
            }
            return results.map(function (result) { return (result.indexOf(' ') === -1 ? result : "'" + result + "'"); });
        }
    };

    var fontSize = {
        name: "font-size",
        initialValue: '0',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'length'
    };

    var fontWeight = {
        name: 'font-weight',
        initialValue: 'normal',
        type: 0 /* VALUE */,
        prefix: false,
        parse: function (_context, token) {
            if (isNumberToken(token)) {
                return token.number;
            }
            if (isIdentToken(token)) {
                switch (token.value) {
                    case 'bold':
                        return 700;
                    case 'normal':
                    default:
                        return 400;
                }
            }
            return 400;
        }
    };

    var fontVariant = {
        name: 'font-variant',
        initialValue: 'none',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (_context, tokens) {
            return tokens.filter(isIdentToken).map(function (token) { return token.value; });
        }
    };

    var fontStyle = {
        name: 'font-style',
        initialValue: 'normal',
        prefix: false,
        type: 2 /* IDENT_VALUE */,
        parse: function (_context, overflow) {
            switch (overflow) {
                case 'oblique':
                    return "oblique" /* OBLIQUE */;
                case 'italic':
                    return "italic" /* ITALIC */;
                case 'normal':
                default:
                    return "normal" /* NORMAL */;
            }
        }
    };

    var contains = function (bit, value) { return (bit & value) !== 0; };

    var content = {
        name: 'content',
        initialValue: 'none',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (_context, tokens) {
            if (tokens.length === 0) {
                return [];
            }
            var first = tokens[0];
            if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
                return [];
            }
            return tokens;
        }
    };

    var counterIncrement = {
        name: 'counter-increment',
        initialValue: 'none',
        prefix: true,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            if (tokens.length === 0) {
                return null;
            }
            var first = tokens[0];
            if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
                return null;
            }
            var increments = [];
            var filtered = tokens.filter(nonWhiteSpace);
            for (var i = 0; i < filtered.length; i++) {
                var counter = filtered[i];
                var next = filtered[i + 1];
                if (counter.type === 20 /* IDENT_TOKEN */) {
                    var increment = next && isNumberToken(next) ? next.number : 1;
                    increments.push({ counter: counter.value, increment: increment });
                }
            }
            return increments;
        }
    };

    var counterReset = {
        name: 'counter-reset',
        initialValue: 'none',
        prefix: true,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            if (tokens.length === 0) {
                return [];
            }
            var resets = [];
            var filtered = tokens.filter(nonWhiteSpace);
            for (var i = 0; i < filtered.length; i++) {
                var counter = filtered[i];
                var next = filtered[i + 1];
                if (isIdentToken(counter) && counter.value !== 'none') {
                    var reset = next && isNumberToken(next) ? next.number : 0;
                    resets.push({ counter: counter.value, reset: reset });
                }
            }
            return resets;
        }
    };

    var duration = {
        name: 'duration',
        initialValue: '0s',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (context, tokens) {
            return tokens.filter(isDimensionToken).map(function (token) { return time.parse(context, token); });
        }
    };

    var quotes = {
        name: 'quotes',
        initialValue: 'none',
        prefix: true,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            if (tokens.length === 0) {
                return null;
            }
            var first = tokens[0];
            if (first.type === 20 /* IDENT_TOKEN */ && first.value === 'none') {
                return null;
            }
            var quotes = [];
            var filtered = tokens.filter(isStringToken);
            if (filtered.length % 2 !== 0) {
                return null;
            }
            for (var i = 0; i < filtered.length; i += 2) {
                var open_1 = filtered[i].value;
                var close_1 = filtered[i + 1].value;
                quotes.push({ open: open_1, close: close_1 });
            }
            return quotes;
        }
    };
    var getQuote = function (quotes, depth, open) {
        if (!quotes) {
            return '';
        }
        var quote = quotes[Math.min(depth, quotes.length - 1)];
        if (!quote) {
            return '';
        }
        return open ? quote.open : quote.close;
    };

    var boxShadow = {
        name: 'box-shadow',
        initialValue: 'none',
        type: 1 /* LIST */,
        prefix: false,
        parse: function (context, tokens) {
            if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
                return [];
            }
            return parseFunctionArgs(tokens).map(function (values) {
                var shadow = {
                    color: 0x000000ff,
                    offsetX: ZERO_LENGTH,
                    offsetY: ZERO_LENGTH,
                    blur: ZERO_LENGTH,
                    spread: ZERO_LENGTH,
                    inset: false
                };
                var c = 0;
                for (var i = 0; i < values.length; i++) {
                    var token = values[i];
                    if (isIdentWithValue(token, 'inset')) {
                        shadow.inset = true;
                    }
                    else if (isLength(token)) {
                        if (c === 0) {
                            shadow.offsetX = token;
                        }
                        else if (c === 1) {
                            shadow.offsetY = token;
                        }
                        else if (c === 2) {
                            shadow.blur = token;
                        }
                        else {
                            shadow.spread = token;
                        }
                        c++;
                    }
                    else {
                        shadow.color = color$1.parse(context, token);
                    }
                }
                return shadow;
            });
        }
    };

    var paintOrder = {
        name: 'paint-order',
        initialValue: 'normal',
        prefix: false,
        type: 1 /* LIST */,
        parse: function (_context, tokens) {
            var DEFAULT_VALUE = [0 /* FILL */, 1 /* STROKE */, 2 /* MARKERS */];
            var layers = [];
            tokens.filter(isIdentToken).forEach(function (token) {
                switch (token.value) {
                    case 'stroke':
                        layers.push(1 /* STROKE */);
                        break;
                    case 'fill':
                        layers.push(0 /* FILL */);
                        break;
                    case 'markers':
                        layers.push(2 /* MARKERS */);
                        break;
                }
            });
            DEFAULT_VALUE.forEach(function (value) {
                if (layers.indexOf(value) === -1) {
                    layers.push(value);
                }
            });
            return layers;
        }
    };

    var webkitTextStrokeColor = {
        name: "-webkit-text-stroke-color",
        initialValue: 'currentcolor',
        prefix: false,
        type: 3 /* TYPE_VALUE */,
        format: 'color'
    };

    var webkitTextStrokeWidth = {
        name: "-webkit-text-stroke-width",
        initialValue: '0',
        type: 0 /* VALUE */,
        prefix: false,
        parse: function (_context, token) {
            if (isDimensionToken(token)) {
                return token.number;
            }
            return 0;
        }
    };

    var CSSParsedDeclaration = /** @class */ (function () {
        function CSSParsedDeclaration(context, declaration) {
            var _a, _b;
            this.animationDuration = parse(context, duration, declaration.animationDuration);
            this.backgroundClip = parse(context, backgroundClip, declaration.backgroundClip);
            this.backgroundColor = parse(context, backgroundColor, declaration.backgroundColor);
            this.backgroundImage = parse(context, backgroundImage, declaration.backgroundImage);
            this.backgroundOrigin = parse(context, backgroundOrigin, declaration.backgroundOrigin);
            this.backgroundPosition = parse(context, backgroundPosition, declaration.backgroundPosition);
            this.backgroundRepeat = parse(context, backgroundRepeat, declaration.backgroundRepeat);
            this.backgroundSize = parse(context, backgroundSize, declaration.backgroundSize);
            this.borderTopColor = parse(context, borderTopColor, declaration.borderTopColor);
            this.borderRightColor = parse(context, borderRightColor, declaration.borderRightColor);
            this.borderBottomColor = parse(context, borderBottomColor, declaration.borderBottomColor);
            this.borderLeftColor = parse(context, borderLeftColor, declaration.borderLeftColor);
            this.borderTopLeftRadius = parse(context, borderTopLeftRadius, declaration.borderTopLeftRadius);
            this.borderTopRightRadius = parse(context, borderTopRightRadius, declaration.borderTopRightRadius);
            this.borderBottomRightRadius = parse(context, borderBottomRightRadius, declaration.borderBottomRightRadius);
            this.borderBottomLeftRadius = parse(context, borderBottomLeftRadius, declaration.borderBottomLeftRadius);
            this.borderTopStyle = parse(context, borderTopStyle, declaration.borderTopStyle);
            this.borderRightStyle = parse(context, borderRightStyle, declaration.borderRightStyle);
            this.borderBottomStyle = parse(context, borderBottomStyle, declaration.borderBottomStyle);
            this.borderLeftStyle = parse(context, borderLeftStyle, declaration.borderLeftStyle);
            this.borderTopWidth = parse(context, borderTopWidth, declaration.borderTopWidth);
            this.borderRightWidth = parse(context, borderRightWidth, declaration.borderRightWidth);
            this.borderBottomWidth = parse(context, borderBottomWidth, declaration.borderBottomWidth);
            this.borderLeftWidth = parse(context, borderLeftWidth, declaration.borderLeftWidth);
            this.boxShadow = parse(context, boxShadow, declaration.boxShadow);
            this.color = parse(context, color, declaration.color);
            this.direction = parse(context, direction, declaration.direction);
            this.display = parse(context, display, declaration.display);
            this.float = parse(context, float, declaration.cssFloat);
            this.fontFamily = parse(context, fontFamily, declaration.fontFamily);
            this.fontSize = parse(context, fontSize, declaration.fontSize);
            this.fontStyle = parse(context, fontStyle, declaration.fontStyle);
            this.fontVariant = parse(context, fontVariant, declaration.fontVariant);
            this.fontWeight = parse(context, fontWeight, declaration.fontWeight);
            this.letterSpacing = parse(context, letterSpacing, declaration.letterSpacing);
            this.lineBreak = parse(context, lineBreak, declaration.lineBreak);
            this.lineHeight = parse(context, lineHeight, declaration.lineHeight);
            this.listStyleImage = parse(context, listStyleImage, declaration.listStyleImage);
            this.listStylePosition = parse(context, listStylePosition, declaration.listStylePosition);
            this.listStyleType = parse(context, listStyleType, declaration.listStyleType);
            this.marginTop = parse(context, marginTop, declaration.marginTop);
            this.marginRight = parse(context, marginRight, declaration.marginRight);
            this.marginBottom = parse(context, marginBottom, declaration.marginBottom);
            this.marginLeft = parse(context, marginLeft, declaration.marginLeft);
            this.opacity = parse(context, opacity, declaration.opacity);
            var overflowTuple = parse(context, overflow, declaration.overflow);
            this.overflowX = overflowTuple[0];
            this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0];
            this.overflowWrap = parse(context, overflowWrap, declaration.overflowWrap);
            this.paddingTop = parse(context, paddingTop, declaration.paddingTop);
            this.paddingRight = parse(context, paddingRight, declaration.paddingRight);
            this.paddingBottom = parse(context, paddingBottom, declaration.paddingBottom);
            this.paddingLeft = parse(context, paddingLeft, declaration.paddingLeft);
            this.paintOrder = parse(context, paintOrder, declaration.paintOrder);
            this.position = parse(context, position, declaration.position);
            this.textAlign = parse(context, textAlign, declaration.textAlign);
            this.textDecorationColor = parse(context, textDecorationColor, (_a = declaration.textDecorationColor) !== null && _a !== void 0 ? _a : declaration.color);
            this.textDecorationLine = parse(context, textDecorationLine, (_b = declaration.textDecorationLine) !== null && _b !== void 0 ? _b : declaration.textDecoration);
            this.textShadow = parse(context, textShadow, declaration.textShadow);
            this.textTransform = parse(context, textTransform, declaration.textTransform);
            this.transform = parse(context, transform$1, declaration.transform);
            this.transformOrigin = parse(context, transformOrigin, declaration.transformOrigin);
            this.visibility = parse(context, visibility, declaration.visibility);
            this.webkitTextStrokeColor = parse(context, webkitTextStrokeColor, declaration.webkitTextStrokeColor);
            this.webkitTextStrokeWidth = parse(context, webkitTextStrokeWidth, declaration.webkitTextStrokeWidth);
            this.wordBreak = parse(context, wordBreak, declaration.wordBreak);
            this.zIndex = parse(context, zIndex, declaration.zIndex);
        }
        CSSParsedDeclaration.prototype.isVisible = function () {
            return this.display > 0 && this.opacity > 0 && this.visibility === 0 /* VISIBLE */;
        };
        CSSParsedDeclaration.prototype.isTransparent = function () {
            return isTransparent(this.backgroundColor);
        };
        CSSParsedDeclaration.prototype.isTransformed = function () {
            return this.transform !== null;
        };
        CSSParsedDeclaration.prototype.isPositioned = function () {
            return this.position !== 0 /* STATIC */;
        };
        CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
            return this.isPositioned() && !this.zIndex.auto;
        };
        CSSParsedDeclaration.prototype.isFloating = function () {
            return this.float !== 0 /* NONE */;
        };
        CSSParsedDeclaration.prototype.isInlineLevel = function () {
            return (contains(this.display, 4 /* INLINE */) ||
                contains(this.display, 33554432 /* INLINE_BLOCK */) ||
                contains(this.display, 268435456 /* INLINE_FLEX */) ||
                contains(this.display, 536870912 /* INLINE_GRID */) ||
                contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
                contains(this.display, 134217728 /* INLINE_TABLE */));
        };
        return CSSParsedDeclaration;
    }());
    var CSSParsedPseudoDeclaration = /** @class */ (function () {
        function CSSParsedPseudoDeclaration(context, declaration) {
            this.content = parse(context, content, declaration.content);
            this.quotes = parse(context, quotes, declaration.quotes);
        }
        return CSSParsedPseudoDeclaration;
    }());
    var CSSParsedCounterDeclaration = /** @class */ (function () {
        function CSSParsedCounterDeclaration(context, declaration) {
            this.counterIncrement = parse(context, counterIncrement, declaration.counterIncrement);
            this.counterReset = parse(context, counterReset, declaration.counterReset);
        }
        return CSSParsedCounterDeclaration;
    }());
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    var parse = function (context, descriptor, style) {
        var tokenizer = new Tokenizer();
        var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue;
        tokenizer.write(value);
        var parser = new Parser(tokenizer.read());
        switch (descriptor.type) {
            case 2 /* IDENT_VALUE */:
                var token = parser.parseComponentValue();
                return descriptor.parse(context, isIdentToken(token) ? token.value : descriptor.initialValue);
            case 0 /* VALUE */:
                return descriptor.parse(context, parser.parseComponentValue());
            case 1 /* LIST */:
                return descriptor.parse(context, parser.parseComponentValues());
            case 4 /* TOKEN_VALUE */:
                return parser.parseComponentValue();
            case 3 /* TYPE_VALUE */:
                switch (descriptor.format) {
                    case 'angle':
                        return angle.parse(context, parser.parseComponentValue());
                    case 'color':
                        return color$1.parse(context, parser.parseComponentValue());
                    case 'image':
                        return image.parse(context, parser.parseComponentValue());
                    case 'length':
                        var length_1 = parser.parseComponentValue();
                        return isLength(length_1) ? length_1 : ZERO_LENGTH;
                    case 'length-percentage':
                        var value_1 = parser.parseComponentValue();
                        return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH;
                    case 'time':
                        return time.parse(context, parser.parseComponentValue());
                }
                break;
        }
    };

    var elementDebuggerAttribute = 'data-html2canvas-debug';
    var getElementDebugType = function (element) {
        var attribute = element.getAttribute(elementDebuggerAttribute);
        switch (attribute) {
            case 'all':
                return 1 /* ALL */;
            case 'clone':
                return 2 /* CLONE */;
            case 'parse':
                return 3 /* PARSE */;
            case 'render':
                return 4 /* RENDER */;
            default:
                return 0 /* NONE */;
        }
    };
    var isDebugging = function (element, type) {
        var elementType = getElementDebugType(element);
        return elementType === 1 /* ALL */ || type === elementType;
    };

    var ElementContainer = /** @class */ (function () {
        function ElementContainer(context, element) {
            this.context = context;
            this.textNodes = [];
            this.elements = [];
            this.flags = 0;
            if (isDebugging(element, 3 /* PARSE */)) {
                debugger;
            }
            this.styles = new CSSParsedDeclaration(context, window.getComputedStyle(element, null));
            if (isHTMLElementNode(element)) {
                if (this.styles.animationDuration.some(function (duration) { return duration > 0; })) {
                    element.style.animationDuration = '0s';
                }
                if (this.styles.transform !== null) {
                    // getBoundingClientRect takes transforms into account
                    element.style.transform = 'none';
                }
            }
            this.bounds = parseBounds(this.context, element);
            if (isDebugging(element, 4 /* RENDER */)) {
                this.flags |= 16 /* DEBUG_RENDER */;
            }
        }
        return ElementContainer;
    }());

    /*
     * text-segmentation 1.0.3 <https://github.com/niklasvh/text-segmentation>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var base64 = ' ';

    /*
     * utrie 1.0.2 <https://github.com/niklasvh/utrie>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    // Use a lookup table to find the index.
    var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
    for (var i$1 = 0; i$1 < chars$1.length; i$1++) {
        lookup$1[chars$1.charCodeAt(i$1)] = i$1;
    }
    var decode = function (base64) {
        var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
        if (base64[base64.length - 1] === '=') {
            bufferLength--;
            if (base64[base64.length - 2] === '=') {
                bufferLength--;
            }
        }
        var buffer = typeof ArrayBuffer !== 'undefined' &&
            typeof Uint8Array !== 'undefined' &&
            typeof Uint8Array.prototype.slice !== 'undefined'
            ? new ArrayBuffer(bufferLength)
            : new Array(bufferLength);
        var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
        for (i = 0; i < len; i += 4) {
            encoded1 = lookup$1[base64.charCodeAt(i)];
            encoded2 = lookup$1[base64.charCodeAt(i + 1)];
            encoded3 = lookup$1[base64.charCodeAt(i + 2)];
            encoded4 = lookup$1[base64.charCodeAt(i + 3)];
            bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
            bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
            bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
        }
        return buffer;
    };
    var polyUint16Array = function (buffer) {
        var length = buffer.length;
        var bytes = [];
        for (var i = 0; i < length; i += 2) {
            bytes.push((buffer[i + 1] << 8) | buffer[i]);
        }
        return bytes;
    };
    var polyUint32Array = function (buffer) {
        var length = buffer.length;
        var bytes = [];
        for (var i = 0; i < length; i += 4) {
            bytes.push((buffer[i + 3] << 24) | (buffer[i + 2] << 16) | (buffer[i + 1] << 8) | buffer[i]);
        }
        return bytes;
    };

    /** Shift size for getting the index-2 table offset. */
    var UTRIE2_SHIFT_2 = 5;
    /** Shift size for getting the index-1 table offset. */
    var UTRIE2_SHIFT_1 = 6 + 5;
    /**
     * Shift size for shifting left the index array values.
     * Increases possible data size with 16-bit index values at the cost
     * of compactability.
     * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
     */
    var UTRIE2_INDEX_SHIFT = 2;
    /**
     * Difference between the two shift sizes,
     * for getting an index-1 offset from an index-2 offset. 6=11-5
     */
    var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2;
    /**
     * The part of the index-2 table for U+D800..U+DBFF stores values for
     * lead surrogate code _units_ not code _points_.
     * Values for lead surrogate code _points_ are indexed with this portion of the table.
     * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
     */
    var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2;
    /** Number of entries in a data block. 32=0x20 */
    var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2;
    /** Mask for getting the lower bits for the in-data-block offset. */
    var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1;
    var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2;
    /** Count the lengths of both BMP pieces. 2080=0x820 */
    var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH;
    /**
     * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
     * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
     */
    var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH;
    var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
    /**
     * The index-1 table, only used for supplementary code points, at offset 2112=0x840.
     * Variable length, for code points up to highStart, where the last single-value range starts.
     * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
     * (For 0x100000 supplementary code points U+10000..U+10ffff.)
     *
     * The part of the index-2 table for supplementary code points starts
     * after this index-1 table.
     *
     * Both the index-1 table and the following part of the index-2 table
     * are omitted completely if there is only BMP data.
     */
    var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH;
    /**
     * Number of index-1 entries for the BMP. 32=0x20
     * This part of the index-1 table is omitted from the serialized form.
     */
    var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1;
    /** Number of entries in an index-2 block. 64=0x40 */
    var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2;
    /** Mask for getting the lower bits for the in-index-2-block offset. */
    var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1;
    var slice16 = function (view, start, end) {
        if (view.slice) {
            return view.slice(start, end);
        }
        return new Uint16Array(Array.prototype.slice.call(view, start, end));
    };
    var slice32 = function (view, start, end) {
        if (view.slice) {
            return view.slice(start, end);
        }
        return new Uint32Array(Array.prototype.slice.call(view, start, end));
    };
    var createTrieFromBase64 = function (base64, _byteLength) {
        var buffer = decode(base64);
        var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer);
        var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer);
        var headerLength = 24;
        var index = slice16(view16, headerLength / 2, view32[4] / 2);
        var data = view32[5] === 2
            ? slice16(view16, (headerLength + view32[4]) / 2)
            : slice32(view32, Math.ceil((headerLength + view32[4]) / 4));
        return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
    };
    var Trie = /** @class */ (function () {
        function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
            this.initialValue = initialValue;
            this.errorValue = errorValue;
            this.highStart = highStart;
            this.highValueIndex = highValueIndex;
            this.index = index;
            this.data = data;
        }
        /**
         * Get the value for a code point as stored in the Trie.
         *
         * @param codePoint the code point
         * @return the value
         */
        Trie.prototype.get = function (codePoint) {
            var ix;
            if (codePoint >= 0) {
                if (codePoint < 0x0d800 || (codePoint > 0x0dbff && codePoint <= 0x0ffff)) {
                    // Ordinary BMP code point, excluding leading surrogates.
                    // BMP uses a single level lookup.  BMP index starts at offset 0 in the Trie2 index.
                    // 16 bit data is stored in the index array itself.
                    ix = this.index[codePoint >> UTRIE2_SHIFT_2];
                    ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
                    return this.data[ix];
                }
                if (codePoint <= 0xffff) {
                    // Lead Surrogate Code Point.  A Separate index section is stored for
                    // lead surrogate code units and code points.
                    //   The main index has the code unit data.
                    //   For this function, we need the code point data.
                    // Note: this expression could be refactored for slightly improved efficiency, but
                    //       surrogate code points will be so rare in practice that it's not worth it.
                    ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + ((codePoint - 0xd800) >> UTRIE2_SHIFT_2)];
                    ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
                    return this.data[ix];
                }
                if (codePoint < this.highStart) {
                    // Supplemental code point, use two-level lookup.
                    ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1);
                    ix = this.index[ix];
                    ix += (codePoint >> UTRIE2_SHIFT_2) & UTRIE2_INDEX_2_MASK;
                    ix = this.index[ix];
                    ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
                    return this.data[ix];
                }
                if (codePoint <= 0x10ffff) {
                    return this.data[this.highValueIndex];
                }
            }
            // Fall through.  The code point is outside of the legal range of 0..0x10ffff.
            return this.errorValue;
        };
        return Trie;
    }());

    /*
     * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>
     * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
     * Released under MIT License
     */
    var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    // Use a lookup table to find the index.
    var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
    for (var i = 0; i < chars.length; i++) {
        lookup[chars.charCodeAt(i)] = i;
    }

    var Prepend = 1;
    var CR = 2;
    var LF = 3;
    var Control = 4;
    var Extend = 5;
    var SpacingMark = 7;
    var L = 8;
    var V = 9;
    var T = 10;
    var LV = 11;
    var LVT = 12;
    var ZWJ = 13;
    var Extended_Pictographic = 14;
    var RI = 15;
    var toCodePoints = function (str) {
        var codePoints = [];
        var i = 0;
        var length = str.length;
        while (i < length) {
            var value = str.charCodeAt(i++);
            if (value >= 0xd800 && value <= 0xdbff && i < length) {
                var extra = str.charCodeAt(i++);
                if ((extra & 0xfc00) === 0xdc00) {
                    codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
                }
                else {
                    codePoints.push(value);
                    i--;
                }
            }
            else {
                codePoints.push(value);
            }
        }
        return codePoints;
    };
    var fromCodePoint = function () {
        var codePoints = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            codePoints[_i] = arguments[_i];
        }
        if (String.fromCodePoint) {
            return String.fromCodePoint.apply(String, codePoints);
        }
        var length = codePoints.length;
        if (!length) {
            return '';
        }
        var codeUnits = [];
        var index = -1;
        var result = '';
        while (++index < length) {
            var codePoint = codePoints[index];
            if (codePoint <= 0xffff) {
                codeUnits.push(codePoint);
            }
            else {
                codePoint -= 0x10000;
                codeUnits.push((codePoint >> 10) + 0xd800, (codePoint % 0x400) + 0xdc00);
            }
            if (index + 1 === length || codeUnits.length > 0x4000) {
                result += String.fromCharCode.apply(String, codeUnits);
                codeUnits.length = 0;
            }
        }
        return result;
    };
    var UnicodeTrie = createTrieFromBase64(base64);
    var BREAK_NOT_ALLOWED = '×';
    var BREAK_ALLOWED = '÷';
    var codePointToClass = function (codePoint) { return UnicodeTrie.get(codePoint); };
    var _graphemeBreakAtIndex = function (_codePoints, classTypes, index) {
        var prevIndex = index - 2;
        var prev = classTypes[prevIndex];
        var current = classTypes[index - 1];
        var next = classTypes[index];
        // GB3 Do not break between a CR and LF
        if (current === CR && next === LF) {
            return BREAK_NOT_ALLOWED;
        }
        // GB4 Otherwise, break before and after controls.
        if (current === CR || current === LF || current === Control) {
            return BREAK_ALLOWED;
        }
        // GB5
        if (next === CR || next === LF || next === Control) {
            return BREAK_ALLOWED;
        }
        // Do not break Hangul syllable sequences.
        // GB6
        if (current === L && [L, V, LV, LVT].indexOf(next) !== -1) {
            return BREAK_NOT_ALLOWED;
        }
        // GB7
        if ((current === LV || current === V) && (next === V || next === T)) {
            return BREAK_NOT_ALLOWED;
        }
        // GB8
        if ((current === LVT || current === T) && next === T) {
            return BREAK_NOT_ALLOWED;
        }
        // GB9 Do not break before extending characters or ZWJ.
        if (next === ZWJ || next === Extend) {
            return BREAK_NOT_ALLOWED;
        }
        // Do not break before SpacingMarks, or after Prepend characters.
        // GB9a
        if (next === SpacingMark) {
            return BREAK_NOT_ALLOWED;
        }
        // GB9a
        if (current === Prepend) {
            return BREAK_NOT_ALLOWED;
        }
        // GB11 Do not break within emoji modifier sequences or emoji zwj sequences.
        if (current === ZWJ && next === Extended_Pictographic) {
            while (prev === Extend) {
                prev = classTypes[--prevIndex];
            }
            if (prev === Extended_Pictographic) {
                return BREAK_NOT_ALLOWED;
            }
        }
        // GB12 Do not break within emoji flag sequences.
        // That is, do not break between regional indicator (RI) symbols
        // if there is an odd number of RI characters before the break point.
        if (current === RI && next === RI) {
            var countRI = 0;
            while (prev === RI) {
                countRI++;
                prev = classTypes[--prevIndex];
            }
            if (countRI % 2 === 0) {
                return BREAK_NOT_ALLOWED;
            }
        }
        return BREAK_ALLOWED;
    };
    var GraphemeBreaker = function (str) {
        var codePoints = toCodePoints(str);
        var length = codePoints.length;
        var index = 0;
        var lastEnd = 0;
        var classTypes = codePoints.map(codePointToClass);
        return {
            next: function () {
                if (index >= length) {
                    return { done: true, value: null };
                }
                var graphemeBreak = BREAK_NOT_ALLOWED;
                while (index < length &&
                    (graphemeBreak = _graphemeBreakAtIndex(codePoints, classTypes, ++index)) === BREAK_NOT_ALLOWED) { }
                if (graphemeBreak !== BREAK_NOT_ALLOWED || index === length) {
                    var value = fromCodePoint.apply(null, codePoints.slice(lastEnd, index));
                    lastEnd = index;
                    return { value: value, done: false };
                }
                return { done: true, value: null };
            },
        };
    };
    var splitGraphemes = function (str) {
        var breaker = GraphemeBreaker(str);
        var graphemes = [];
        var bk;
        while (!(bk = breaker.next()).done) {
            if (bk.value) {
                graphemes.push(bk.value.slice());
            }
        }
        return graphemes;
    };

    var testRangeBounds = function (document) {
        var TEST_HEIGHT = 123;
        if (document.createRange) {
            var range = document.createRange();
            if (range.getBoundingClientRect) {
                var testElement = document.createElement('boundtest');
                testElement.style.height = TEST_HEIGHT + "px";
                testElement.style.display = 'block';
                document.body.appendChild(testElement);
                range.selectNode(testElement);
                var rangeBounds = range.getBoundingClientRect();
                var rangeHeight = Math.round(rangeBounds.height);
                document.body.removeChild(testElement);
                if (rangeHeight === TEST_HEIGHT) {
                    return true;
                }
            }
        }
        return false;
    };
    var testIOSLineBreak = function (document) {
        var testElement = document.createElement('boundtest');
        testElement.style.width = '50px';
        testElement.style.display = 'block';
        testElement.style.fontSize = '12px';
        testElement.style.letterSpacing = '0px';
        testElement.style.wordSpacing = '0px';
        document.body.appendChild(testElement);
        var range = document.createRange();
        testElement.innerHTML = typeof ''.repeat === 'function' ? '&#128104;'.repeat(10) : '';
        var node = testElement.firstChild;
        var textList = toCodePoints$1(node.data).map(function (i) { return fromCodePoint$1(i); });
        var offset = 0;
        var prev = {};
        // ios 13 does not handle range getBoundingClientRect line changes correctly #2177
        var supports = textList.every(function (text, i) {
            range.setStart(node, offset);
            range.setEnd(node, offset + text.length);
            var rect = range.getBoundingClientRect();
            offset += text.length;
            var boundAhead = rect.x > prev.x || rect.y > prev.y;
            prev = rect;
            if (i === 0) {
                return true;
            }
            return boundAhead;
        });
        document.body.removeChild(testElement);
        return supports;
    };
    var testCORS = function () { return typeof new Image().crossOrigin !== 'undefined'; };
    var testResponseType = function () { return typeof new XMLHttpRequest().responseType === 'string'; };
    var testSVG = function (document) {
        var img = new Image();
        var canvas = document.createElement('canvas');
        var ctx = canvas.getContext('2d');
        if (!ctx) {
            return false;
        }
        img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
        try {
            ctx.drawImage(img, 0, 0);
            canvas.toDataURL();
        }
        catch (e) {
            return false;
        }
        return true;
    };
    var isGreenPixel = function (data) {
        return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
    };
    var testForeignObject = function (document) {
        var canvas = document.createElement('canvas');
        var size = 100;
        canvas.width = size;
        canvas.height = size;
        var ctx = canvas.getContext('2d');
        if (!ctx) {
            return Promise.reject(false);
        }
        ctx.fillStyle = 'rgb(0, 255, 0)';
        ctx.fillRect(0, 0, size, size);
        var img = new Image();
        var greenImageSrc = canvas.toDataURL();
        img.src = greenImageSrc;
        var svg = createForeignObjectSVG(size, size, 0, 0, img);
        ctx.fillStyle = 'red';
        ctx.fillRect(0, 0, size, size);
        return loadSerializedSVG$1(svg)
            .then(function (img) {
            ctx.drawImage(img, 0, 0);
            var data = ctx.getImageData(0, 0, size, size).data;
            ctx.fillStyle = 'red';
            ctx.fillRect(0, 0, size, size);
            var node = document.createElement('div');
            node.style.backgroundImage = "url(" + greenImageSrc + ")";
            node.style.height = size + "px";
            // Firefox 55 does not render inline <img /> tags
            return isGreenPixel(data)
                ? loadSerializedSVG$1(createForeignObjectSVG(size, size, 0, 0, node))
                : Promise.reject(false);
        })
            .then(function (img) {
            ctx.drawImage(img, 0, 0);
            // Edge does not render background-images
            return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
        })
            .catch(function () { return false; });
    };
    var createForeignObjectSVG = function (width, height, x, y, node) {
        var xmlns = 'http://www.w3.org/2000/svg';
        var svg = document.createElementNS(xmlns, 'svg');
        var foreignObject = document.createElementNS(xmlns, 'foreignObject');
        svg.setAttributeNS(null, 'width', width.toString());
        svg.setAttributeNS(null, 'height', height.toString());
        foreignObject.setAttributeNS(null, 'width', '100%');
        foreignObject.setAttributeNS(null, 'height', '100%');
        foreignObject.setAttributeNS(null, 'x', x.toString());
        foreignObject.setAttributeNS(null, 'y', y.toString());
        foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
        svg.appendChild(foreignObject);
        foreignObject.appendChild(node);
        return svg;
    };
    var loadSerializedSVG$1 = function (svg) {
        return new Promise(function (resolve, reject) {
            var img = new Image();
            img.onload = function () { return resolve(img); };
            img.onerror = reject;
            img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
        });
    };
    var FEATURES = {
        get SUPPORT_RANGE_BOUNDS() {
            var value = testRangeBounds(document);
            Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });
            return value;
        },
        get SUPPORT_WORD_BREAKING() {
            var value = FEATURES.SUPPORT_RANGE_BOUNDS && testIOSLineBreak(document);
            Object.defineProperty(FEATURES, 'SUPPORT_WORD_BREAKING', { value: value });
            return value;
        },
        get SUPPORT_SVG_DRAWING() {
            var value = testSVG(document);
            Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });
            return value;
        },
        get SUPPORT_FOREIGNOBJECT_DRAWING() {
            var value = typeof Array.from === 'function' && typeof window.fetch === 'function'
                ? testForeignObject(document)
                : Promise.resolve(false);
            Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value });
            return value;
        },
        get SUPPORT_CORS_IMAGES() {
            var value = testCORS();
            Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value });
            return value;
        },
        get SUPPORT_RESPONSE_TYPE() {
            var value = testResponseType();
            Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });
            return value;
        },
        get SUPPORT_CORS_XHR() {
            var value = 'withCredentials' in new XMLHttpRequest();
            Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value });
            return value;
        },
        get SUPPORT_NATIVE_TEXT_SEGMENTATION() {
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            var value = !!(typeof Intl !== 'undefined' && Intl.Segmenter);
            Object.defineProperty(FEATURES, 'SUPPORT_NATIVE_TEXT_SEGMENTATION', { value: value });
            return value;
        }
    };

    var TextBounds = /** @class */ (function () {
        function TextBounds(text, bounds) {
            this.text = text;
            this.bounds = bounds;
        }
        return TextBounds;
    }());
    var parseTextBounds = function (context, value, styles, node) {
        var textList = breakText(value, styles);
        var textBounds = [];
        var offset = 0;
        textList.forEach(function (text) {
            if (styles.textDecorationLine.length || text.trim().length > 0) {
                if (FEATURES.SUPPORT_RANGE_BOUNDS) {
                    var clientRects = createRange(node, offset, text.length).getClientRects();
                    if (clientRects.length > 1) {
                        var subSegments = segmentGraphemes(text);
                        var subOffset_1 = 0;
                        subSegments.forEach(function (subSegment) {
                            textBounds.push(new TextBounds(subSegment, Bounds.fromDOMRectList(context, createRange(node, subOffset_1 + offset, subSegment.length).getClientRects())));
                            subOffset_1 += subSegment.length;
                        });
                    }
                    else {
                        textBounds.push(new TextBounds(text, Bounds.fromDOMRectList(context, clientRects)));
                    }
                }
                else {
                    var replacementNode = node.splitText(text.length);
                    textBounds.push(new TextBounds(text, getWrapperBounds(context, node)));
                    node = replacementNode;
                }
            }
            else if (!FEATURES.SUPPORT_RANGE_BOUNDS) {
                node = node.splitText(text.length);
            }
            offset += text.length;
        });
        return textBounds;
    };
    var getWrapperBounds = function (context, node) {
        var ownerDocument = node.ownerDocument;
        if (ownerDocument) {
            var wrapper = ownerDocument.createElement('html2canvaswrapper');
            wrapper.appendChild(node.cloneNode(true));
            var parentNode = node.parentNode;
            if (parentNode) {
                parentNode.replaceChild(wrapper, node);
                var bounds = parseBounds(context, wrapper);
                if (wrapper.firstChild) {
                    parentNode.replaceChild(wrapper.firstChild, wrapper);
                }
                return bounds;
            }
        }
        return Bounds.EMPTY;
    };
    var createRange = function (node, offset, length) {
        var ownerDocument = node.ownerDocument;
        if (!ownerDocument) {
            throw new Error('Node has no owner document');
        }
        var range = ownerDocument.createRange();
        range.setStart(node, offset);
        range.setEnd(node, offset + length);
        return range;
    };
    var segmentGraphemes = function (value) {
        if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            var segmenter = new Intl.Segmenter(void 0, { granularity: 'grapheme' });
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; });
        }
        return splitGraphemes(value);
    };
    var segmentWords = function (value, styles) {
        if (FEATURES.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            var segmenter = new Intl.Segmenter(void 0, {
                granularity: 'word'
            });
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            return Array.from(segmenter.segment(value)).map(function (segment) { return segment.segment; });
        }
        return breakWords(value, styles);
    };
    var breakText = function (value, styles) {
        return styles.letterSpacing !== 0 ? segmentGraphemes(value) : segmentWords(value, styles);
    };
    // https://drafts.csswg.org/css-text/#word-separator
    var wordSeparators = [0x0020, 0x00a0, 0x1361, 0x10100, 0x10101, 0x1039, 0x1091];
    var breakWords = function (str, styles) {
        var breaker = LineBreaker(str, {
            lineBreak: styles.lineBreak,
            wordBreak: styles.overflowWrap === "break-word" /* BREAK_WORD */ ? 'break-word' : styles.wordBreak
        });
        var words = [];
        var bk;
        var _loop_1 = function () {
            if (bk.value) {
                var value = bk.value.slice();
                var codePoints = toCodePoints$1(value);
                var word_1 = '';
                codePoints.forEach(function (codePoint) {
                    if (wordSeparators.indexOf(codePoint) === -1) {
                        word_1 += fromCodePoint$1(codePoint);
                    }
                    else {
                        if (word_1.length) {
                            words.push(word_1);
                        }
                        words.push(fromCodePoint$1(codePoint));
                        word_1 = '';
                    }
                });
                if (word_1.length) {
                    words.push(word_1);
                }
            }
        };
        while (!(bk = breaker.next()).done) {
            _loop_1();
        }
        return words;
    };

    var TextContainer = /** @class */ (function () {
        function TextContainer(context, node, styles) {
            this.text = transform(node.data, styles.textTransform);
            this.textBounds = parseTextBounds(context, this.text, styles, node);
        }
        return TextContainer;
    }());
    var transform = function (text, transform) {
        switch (transform) {
            case 1 /* LOWERCASE */:
                return text.toLowerCase();
            case 3 /* CAPITALIZE */:
                return text.replace(CAPITALIZE, capitalize);
            case 2 /* UPPERCASE */:
                return text.toUpperCase();
            default:
                return text;
        }
    };
    var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
    var capitalize = function (m, p1, p2) {
        if (m.length > 0) {
            return p1 + p2.toUpperCase();
        }
        return m;
    };

    var ImageElementContainer = /** @class */ (function (_super) {
        __extends(ImageElementContainer, _super);
        function ImageElementContainer(context, img) {
            var _this = _super.call(this, context, img) || this;
            _this.src = img.currentSrc || img.src;
            _this.intrinsicWidth = img.naturalWidth;
            _this.intrinsicHeight = img.naturalHeight;
            _this.context.cache.addImage(_this.src);
            return _this;
        }
        return ImageElementContainer;
    }(ElementContainer));

    var CanvasElementContainer = /** @class */ (function (_super) {
        __extends(CanvasElementContainer, _super);
        function CanvasElementContainer(context, canvas) {
            var _this = _super.call(this, context, canvas) || this;
            _this.canvas = canvas;
            _this.intrinsicWidth = canvas.width;
            _this.intrinsicHeight = canvas.height;
            return _this;
        }
        return CanvasElementContainer;
    }(ElementContainer));

    var SVGElementContainer = /** @class */ (function (_super) {
        __extends(SVGElementContainer, _super);
        function SVGElementContainer(context, img) {
            var _this = _super.call(this, context, img) || this;
            var s = new XMLSerializer();
            var bounds = parseBounds(context, img);
            img.setAttribute('width', bounds.width + "px");
            img.setAttribute('height', bounds.height + "px");
            _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img));
            _this.intrinsicWidth = img.width.baseVal.value;
            _this.intrinsicHeight = img.height.baseVal.value;
            _this.context.cache.addImage(_this.svg);
            return _this;
        }
        return SVGElementContainer;
    }(ElementContainer));

    var LIElementContainer = /** @class */ (function (_super) {
        __extends(LIElementContainer, _super);
        function LIElementContainer(context, element) {
            var _this = _super.call(this, context, element) || this;
            _this.value = element.value;
            return _this;
        }
        return LIElementContainer;
    }(ElementContainer));

    var OLElementContainer = /** @class */ (function (_super) {
        __extends(OLElementContainer, _super);
        function OLElementContainer(context, element) {
            var _this = _super.call(this, context, element) || this;
            _this.start = element.start;
            _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true;
            return _this;
        }
        return OLElementContainer;
    }(ElementContainer));

    var CHECKBOX_BORDER_RADIUS = [
        {
            type: 15 /* DIMENSION_TOKEN */,
            flags: 0,
            unit: 'px',
            number: 3
        }
    ];
    var RADIO_BORDER_RADIUS = [
        {
            type: 16 /* PERCENTAGE_TOKEN */,
            flags: 0,
            number: 50
        }
    ];
    var reformatInputBounds = function (bounds) {
        if (bounds.width > bounds.height) {
            return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height);
        }
        else if (bounds.width < bounds.height) {
            return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width);
        }
        return bounds;
    };
    var getInputValue = function (node) {
        var value = node.type === PASSWORD ? new Array(node.value.length + 1).join('\u2022') : node.value;
        return value.length === 0 ? node.placeholder || '' : value;
    };
    var CHECKBOX = 'checkbox';
    var RADIO = 'radio';
    var PASSWORD = 'password';
    var INPUT_COLOR = 0x2a2a2aff;
    var InputElementContainer = /** @class */ (function (_super) {
        __extends(InputElementContainer, _super);
        function InputElementContainer(context, input) {
            var _this = _super.call(this, context, input) || this;
            _this.type = input.type.toLowerCase();
            _this.checked = input.checked;
            _this.value = getInputValue(input);
            if (_this.type === CHECKBOX || _this.type === RADIO) {
                _this.styles.backgroundColor = 0xdededeff;
                _this.styles.borderTopColor =
                    _this.styles.borderRightColor =
                        _this.styles.borderBottomColor =
                            _this.styles.borderLeftColor =
                                0xa5a5a5ff;
                _this.styles.borderTopWidth =
                    _this.styles.borderRightWidth =
                        _this.styles.borderBottomWidth =
                            _this.styles.borderLeftWidth =
                                1;
                _this.styles.borderTopStyle =
                    _this.styles.borderRightStyle =
                        _this.styles.borderBottomStyle =
                            _this.styles.borderLeftStyle =
                                1 /* SOLID */;
                _this.styles.backgroundClip = [0 /* BORDER_BOX */];
                _this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
                _this.bounds = reformatInputBounds(_this.bounds);
            }
            switch (_this.type) {
                case CHECKBOX:
                    _this.styles.borderTopRightRadius =
                        _this.styles.borderTopLeftRadius =
                            _this.styles.borderBottomRightRadius =
                                _this.styles.borderBottomLeftRadius =
                                    CHECKBOX_BORDER_RADIUS;
                    break;
                case RADIO:
                    _this.styles.borderTopRightRadius =
                        _this.styles.borderTopLeftRadius =
                            _this.styles.borderBottomRightRadius =
                                _this.styles.borderBottomLeftRadius =
                                    RADIO_BORDER_RADIUS;
                    break;
            }
            return _this;
        }
        return InputElementContainer;
    }(ElementContainer));

    var SelectElementContainer = /** @class */ (function (_super) {
        __extends(SelectElementContainer, _super);
        function SelectElementContainer(context, element) {
            var _this = _super.call(this, context, element) || this;
            var option = element.options[element.selectedIndex || 0];
            _this.value = option ? option.text || '' : '';
            return _this;
        }
        return SelectElementContainer;
    }(ElementContainer));

    var TextareaElementContainer = /** @class */ (function (_super) {
        __extends(TextareaElementContainer, _super);
        function TextareaElementContainer(context, element) {
            var _this = _super.call(this, context, element) || this;
            _this.value = element.value;
            return _this;
        }
        return TextareaElementContainer;
    }(ElementContainer));

    var IFrameElementContainer = /** @class */ (function (_super) {
        __extends(IFrameElementContainer, _super);
        function IFrameElementContainer(context, iframe) {
            var _this = _super.call(this, context, iframe) || this;
            _this.src = iframe.src;
            _this.width = parseInt(iframe.width, 10) || 0;
            _this.height = parseInt(iframe.height, 10) || 0;
            _this.backgroundColor = _this.styles.backgroundColor;
            try {
                if (iframe.contentWindow &&
                    iframe.contentWindow.document &&
                    iframe.contentWindow.document.documentElement) {
                    _this.tree = parseTree(context, iframe.contentWindow.document.documentElement);
                    // http://www.w3.org/TR/css3-background/#special-backgrounds
                    var documentBackgroundColor = iframe.contentWindow.document.documentElement
                        ? parseColor(context, getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor)
                        : COLORS.TRANSPARENT;
                    var bodyBackgroundColor = iframe.contentWindow.document.body
                        ? parseColor(context, getComputedStyle(iframe.contentWindow.document.body).backgroundColor)
                        : COLORS.TRANSPARENT;
                    _this.backgroundColor = isTransparent(documentBackgroundColor)
                        ? isTransparent(bodyBackgroundColor)
                            ? _this.styles.backgroundColor
                            : bodyBackgroundColor
                        : documentBackgroundColor;
                }
            }
            catch (e) { }
            return _this;
        }
        return IFrameElementContainer;
    }(ElementContainer));

    var LIST_OWNERS = ['OL', 'UL', 'MENU'];
    var parseNodeTree = function (context, node, parent, root) {
        for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
            nextNode = childNode.nextSibling;
            if (isTextNode(childNode) && childNode.data.trim().length > 0) {
                parent.textNodes.push(new TextContainer(context, childNode, parent.styles));
            }
            else if (isElementNode(childNode)) {
                if (isSlotElement(childNode) && childNode.assignedNodes) {
                    childNode.assignedNodes().forEach(function (childNode) { return parseNodeTree(context, childNode, parent, root); });
                }
                else {
                    var container = createContainer(context, childNode);
                    if (container.styles.isVisible()) {
                        if (createsRealStackingContext(childNode, container, root)) {
                            container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
                        }
                        else if (createsStackingContext(container.styles)) {
                            container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
                        }
                        if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
                            container.flags |= 8 /* IS_LIST_OWNER */;
                        }
                        parent.elements.push(container);
                        childNode.slot;
                        if (childNode.shadowRoot) {
                            parseNodeTree(context, childNode.shadowRoot, container, root);
                        }
                        else if (!isTextareaElement(childNode) &&
                            !isSVGElement(childNode) &&
                            !isSelectElement(childNode)) {
                            parseNodeTree(context, childNode, container, root);
                        }
                    }
                }
            }
        }
    };
    var createContainer = function (context, element) {
        if (isImageElement(element)) {
            return new ImageElementContainer(context, element);
        }
        if (isCanvasElement(element)) {
            return new CanvasElementContainer(context, element);
        }
        if (isSVGElement(element)) {
            return new SVGElementContainer(context, element);
        }
        if (isLIElement(element)) {
            return new LIElementContainer(context, element);
        }
        if (isOLElement(element)) {
            return new OLElementContainer(context, element);
        }
        if (isInputElement(element)) {
            return new InputElementContainer(context, element);
        }
        if (isSelectElement(element)) {
            return new SelectElementContainer(context, element);
        }
        if (isTextareaElement(element)) {
            return new TextareaElementContainer(context, element);
        }
        if (isIFrameElement(element)) {
            return new IFrameElementContainer(context, element);
        }
        return new ElementContainer(context, element);
    };
    var parseTree = function (context, element) {
        var container = createContainer(context, element);
        container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
        parseNodeTree(context, element, container, container);
        return container;
    };
    var createsRealStackingContext = function (node, container, root) {
        return (container.styles.isPositionedWithZIndex() ||
            container.styles.opacity < 1 ||
            container.styles.isTransformed() ||
            (isBodyElement(node) && root.styles.isTransparent()));
    };
    var createsStackingContext = function (styles) { return styles.isPositioned() || styles.isFloating(); };
    var isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; };
    var isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; };
    var isHTMLElementNode = function (node) {
        return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node);
    };
    var isSVGElementNode = function (element) {
        return typeof element.className === 'object';
    };
    var isLIElement = function (node) { return node.tagName === 'LI'; };
    var isOLElement = function (node) { return node.tagName === 'OL'; };
    var isInputElement = function (node) { return node.tagName === 'INPUT'; };
    var isHTMLElement = function (node) { return node.tagName === 'HTML'; };
    var isSVGElement = function (node) { return node.tagName === 'svg'; };
    var isBodyElement = function (node) { return node.tagName === 'BODY'; };
    var isCanvasElement = function (node) { return node.tagName === 'CANVAS'; };
    var isVideoElement = function (node) { return node.tagName === 'VIDEO'; };
    var isImageElement = function (node) { return node.tagName === 'IMG'; };
    var isIFrameElement = function (node) { return node.tagName === 'IFRAME'; };
    var isStyleElement = function (node) { return node.tagName === 'STYLE'; };
    var isScriptElement = function (node) { return node.tagName === 'SCRIPT'; };
    var isTextareaElement = function (node) { return node.tagName === 'TEXTAREA'; };
    var isSelectElement = function (node) { return node.tagName === 'SELECT'; };
    var isSlotElement = function (node) { return node.tagName === 'SLOT'; };
    // https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
    var isCustomElement = function (node) { return node.tagName.indexOf('-') > 0; };

    var CounterState = /** @class */ (function () {
        function CounterState() {
            this.counters = {};
        }
        CounterState.prototype.getCounterValue = function (name) {
            var counter = this.counters[name];
            if (counter && counter.length) {
                return counter[counter.length - 1];
            }
            return 1;
        };
        CounterState.prototype.getCounterValues = function (name) {
            var counter = this.counters[name];
            return counter ? counter : [];
        };
        CounterState.prototype.pop = function (counters) {
            var _this = this;
            counters.forEach(function (counter) { return _this.counters[counter].pop(); });
        };
        CounterState.prototype.parse = function (style) {
            var _this = this;
            var counterIncrement = style.counterIncrement;
            var counterReset = style.counterReset;
            var canReset = true;
            if (counterIncrement !== null) {
                counterIncrement.forEach(function (entry) {
                    var counter = _this.counters[entry.counter];
                    if (counter && entry.increment !== 0) {
                        canReset = false;
                        if (!counter.length) {
                            counter.push(1);
                        }
                        counter[Math.max(0, counter.length - 1)] += entry.increment;
                    }
                });
            }
            var counterNames = [];
            if (canReset) {
                counterReset.forEach(function (entry) {
                    var counter = _this.counters[entry.counter];
                    counterNames.push(entry.counter);
                    if (!counter) {
                        counter = _this.counters[entry.counter] = [];
                    }
                    counter.push(entry.reset);
                });
            }
            return counterNames;
        };
        return CounterState;
    }());
    var ROMAN_UPPER = {
        integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
        values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
    };
    var ARMENIAN = {
        integers: [
            9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70,
            60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
        ],
        values: [
            'Ք',
            'Փ',
            'Ւ',
            'Ց',
            'Ր',
            'Տ',
            'Վ',
            'Ս',
            'Ռ',
            'Ջ',
            'Պ',
            'Չ',
            'Ո',
            'Շ',
            'Ն',
            'Յ',
            'Մ',
            'Ճ',
            'Ղ',
            'Ձ',
            'Հ',
            'Կ',
            'Ծ',
            'Խ',
            'Լ',
            'Ի',
            'Ժ',
            'Թ',
            'Ը',
            'Է',
            'Զ',
            'Ե',
            'Դ',
            'Գ',
            'Բ',
            'Ա'
        ]
    };
    var HEBREW = {
        integers: [
            10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20,
            19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
        ],
        values: [
            'י׳',
            'ט׳',
            'ח׳',
            'ז׳',
            'ו׳',
            'ה׳',
            'ד׳',
            'ג׳',
            'ב׳',
            'א׳',
            'ת',
            'ש',
            'ר',
            'ק',
            'צ',
            'פ',
            'ע',
            'ס',
            'נ',
            'מ',
            'ל',
            'כ',
            'יט',
            'יח',
            'יז',
            'טז',
            'טו',
            'י',
            'ט',
            'ח',
            'ז',
            'ו',
            'ה',
            'ד',
            'ג',
            'ב',
            'א'
        ]
    };
    var GEORGIAN = {
        integers: [
            10000, 9000, 8000, 7000, 6000, 5000, 4000, 3000, 2000, 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90,
            80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
        ],
        values: [
            'ჵ',
            'ჰ',
            'ჯ',
            'ჴ',
            'ხ',
            'ჭ',
            'წ',
            'ძ',
            'ც',
            'ჩ',
            'შ',
            'ყ',
            'ღ',
            'ქ',
            'ფ',
            'ჳ',
            'ტ',
            'ს',
            'რ',
            'ჟ',
            'პ',
            'ო',
            'ჲ',
            'ნ',
            'მ',
            'ლ',
            'კ',
            'ი',
            'თ',
            'ჱ',
            'ზ',
            'ვ',
            'ე',
            'დ',
            'გ',
            'ბ',
            'ა'
        ]
    };
    var createAdditiveCounter = function (value, min, max, symbols, fallback, suffix) {
        if (value < min || value > max) {
            return createCounterText(value, fallback, suffix.length > 0);
        }
        return (symbols.integers.reduce(function (string, integer, index) {
            while (value >= integer) {
                value -= integer;
                string += symbols.values[index];
            }
            return string;
        }, '') + suffix);
    };
    var createCounterStyleWithSymbolResolver = function (value, codePointRangeLength, isNumeric, resolver) {
        var string = '';
        do {
            if (!isNumeric) {
                value--;
            }
            string = resolver(value) + string;
            value /= codePointRangeLength;
        } while (value * codePointRangeLength >= codePointRangeLength);
        return string;
    };
    var createCounterStyleFromRange = function (value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
        var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
        return ((value < 0 ? '-' : '') +
            (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) {
                return fromCodePoint$1(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
            }) +
                suffix));
    };
    var createCounterStyleFromSymbols = function (value, symbols, suffix) {
        if (suffix === void 0) { suffix = '. '; }
        var codePointRangeLength = symbols.length;
        return (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) { return symbols[Math.floor(codePoint % codePointRangeLength)]; }) + suffix);
    };
    var CJK_ZEROS = 1 << 0;
    var CJK_TEN_COEFFICIENTS = 1 << 1;
    var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
    var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
    var createCJKCounter = function (value, numbers, multipliers, negativeSign, suffix, flags) {
        if (value < -9999 || value > 9999) {
            return createCounterText(value, 4 /* CJK_DECIMAL */, suffix.length > 0);
        }
        var tmp = Math.abs(value);
        var string = suffix;
        if (tmp === 0) {
            return numbers[0] + string;
        }
        for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
            var coefficient = tmp % 10;
            if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') {
                string = numbers[coefficient] + string;
            }
            else if (coefficient > 1 ||
                (coefficient === 1 && digit === 0) ||
                (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS)) ||
                (coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100) ||
                (coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS))) {
                string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string;
            }
            else if (coefficient === 1 && digit > 0) {
                string = multipliers[digit - 1] + string;
            }
            tmp = Math.floor(tmp / 10);
        }
        return (value < 0 ? negativeSign : '') + string;
    };
    var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬';
    var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬';
    var JAPANESE_NEGATIVE = 'マイナス';
    var KOREAN_NEGATIVE = '마이너스';
    var createCounterText = function (value, type, appendSuffix) {
        var defaultSuffix = appendSuffix ? '. ' : '';
        var cjkSuffix = appendSuffix ? '、' : '';
        var koreanSuffix = appendSuffix ? ', ' : '';
        var spaceSuffix = appendSuffix ? ' ' : '';
        switch (type) {
            case 0 /* DISC */:
                return '•' + spaceSuffix;
            case 1 /* CIRCLE */:
                return '◦' + spaceSuffix;
            case 2 /* SQUARE */:
                return '◾' + spaceSuffix;
            case 5 /* DECIMAL_LEADING_ZERO */:
                var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
                return string.length < 4 ? "0" + string : string;
            case 4 /* CJK_DECIMAL */:
                return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
            case 6 /* LOWER_ROMAN */:
                return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
            case 7 /* UPPER_ROMAN */:
                return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, 3 /* DECIMAL */, defaultSuffix);
            case 8 /* LOWER_GREEK */:
                return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
            case 9 /* LOWER_ALPHA */:
                return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
            case 10 /* UPPER_ALPHA */:
                return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
            case 11 /* ARABIC_INDIC */:
                return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
            case 12 /* ARMENIAN */:
            case 49 /* UPPER_ARMENIAN */:
                return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix);
            case 35 /* LOWER_ARMENIAN */:
                return createAdditiveCounter(value, 1, 9999, ARMENIAN, 3 /* DECIMAL */, defaultSuffix).toLowerCase();
            case 13 /* BENGALI */:
                return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
            case 14 /* CAMBODIAN */:
            case 30 /* KHMER */:
                return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
            case 15 /* CJK_EARTHLY_BRANCH */:
                return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
            case 16 /* CJK_HEAVENLY_STEM */:
                return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
            case 17 /* CJK_IDEOGRAPHIC */:
            case 48 /* TRAD_CHINESE_INFORMAL */:
                return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
            case 47 /* TRAD_CHINESE_FORMAL */:
                return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
            case 42 /* SIMP_CHINESE_INFORMAL */:
                return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
            case 41 /* SIMP_CHINESE_FORMAL */:
                return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
            case 26 /* JAPANESE_INFORMAL */:
                return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
            case 25 /* JAPANESE_FORMAL */:
                return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
            case 31 /* KOREAN_HANGUL_FORMAL */:
                return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
            case 33 /* KOREAN_HANJA_INFORMAL */:
                return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
            case 32 /* KOREAN_HANJA_FORMAL */:
                return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
            case 18 /* DEVANAGARI */:
                return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
            case 20 /* GEORGIAN */:
                return createAdditiveCounter(value, 1, 19999, GEORGIAN, 3 /* DECIMAL */, defaultSuffix);
            case 21 /* GUJARATI */:
                return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
            case 22 /* GURMUKHI */:
                return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
            case 22 /* HEBREW */:
                return createAdditiveCounter(value, 1, 10999, HEBREW, 3 /* DECIMAL */, defaultSuffix);
            case 23 /* HIRAGANA */:
                return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
            case 24 /* HIRAGANA_IROHA */:
                return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
            case 27 /* KANNADA */:
                return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
            case 28 /* KATAKANA */:
                return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
            case 29 /* KATAKANA_IROHA */:
                return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
            case 34 /* LAO */:
                return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
            case 37 /* MONGOLIAN */:
                return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
            case 38 /* MYANMAR */:
                return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
            case 39 /* ORIYA */:
                return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
            case 40 /* PERSIAN */:
                return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
            case 43 /* TAMIL */:
                return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
            case 44 /* TELUGU */:
                return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
            case 45 /* THAI */:
                return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
            case 46 /* TIBETAN */:
                return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
            case 3 /* DECIMAL */:
            default:
                return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
        }
    };

    var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore';
    var DocumentCloner = /** @class */ (function () {
        function DocumentCloner(context, element, options) {
            this.context = context;
            this.options = options;
            this.scrolledElements = [];
            this.referenceElement = element;
            this.counters = new CounterState();
            this.quoteDepth = 0;
            if (!element.ownerDocument) {
                throw new Error('Cloned element does not have an owner document');
            }
            this.documentElement = this.cloneNode(element.ownerDocument.documentElement, false);
        }
        DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) {
            var _this = this;
            var iframe = createIFrameContainer(ownerDocument, windowSize);
            if (!iframe.contentWindow) {
                return Promise.reject("Unable to find iframe window");
            }
            var scrollX = ownerDocument.defaultView.pageXOffset;
            var scrollY = ownerDocument.defaultView.pageYOffset;
            var cloneWindow = iframe.contentWindow;
            var documentClone = cloneWindow.document;
            /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
             if window url is about:blank, we can assign the url to current by writing onto the document
             */
            var iframeLoad = iframeLoader(iframe).then(function () { return __awaiter(_this, void 0, void 0, function () {
                var onclone, referenceElement;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            this.scrolledElements.forEach(restoreNodeScroll);
                            if (cloneWindow) {
                                cloneWindow.scrollTo(windowSize.left, windowSize.top);
                                if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) &&
                                    (cloneWindow.scrollY !== windowSize.top || cloneWindow.scrollX !== windowSize.left)) {
                                    this.context.logger.warn('Unable to restore scroll position for cloned document');
                                    this.context.windowBounds = this.context.windowBounds.add(cloneWindow.scrollX - windowSize.left, cloneWindow.scrollY - windowSize.top, 0, 0);
                                }
                            }
                            onclone = this.options.onclone;
                            referenceElement = this.clonedReferenceElement;
                            if (typeof referenceElement === 'undefined') {
                                return [2 /*return*/, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")];
                            }
                            if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
                            return [4 /*yield*/, documentClone.fonts.ready];
                        case 1:
                            _a.sent();
                            _a.label = 2;
                        case 2:
                            if (!/(AppleWebKit)/g.test(navigator.userAgent)) return [3 /*break*/, 4];
                            return [4 /*yield*/, imagesReady(documentClone)];
                        case 3:
                            _a.sent();
                            _a.label = 4;
                        case 4:
                            if (typeof onclone === 'function') {
                                return [2 /*return*/, Promise.resolve()
                                        .then(function () { return onclone(documentClone, referenceElement); })
                                        .then(function () { return iframe; })];
                            }
                            return [2 /*return*/, iframe];
                    }
                });
            }); });
            documentClone.open();
            documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
            // Chrome scrolls the parent document for some reason after the write to the cloned window???
            restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
            documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement);
            documentClone.close();
            return iframeLoad;
        };
        DocumentCloner.prototype.createElementClone = function (node) {
            if (isDebugging(node, 2 /* CLONE */)) {
                debugger;
            }
            if (isCanvasElement(node)) {
                return this.createCanvasClone(node);
            }
            if (isVideoElement(node)) {
                return this.createVideoClone(node);
            }
            if (isStyleElement(node)) {
                return this.createStyleClone(node);
            }
            var clone = node.cloneNode(false);
            if (isImageElement(clone)) {
                if (isImageElement(node) && node.currentSrc && node.currentSrc !== node.src) {
                    clone.src = node.currentSrc;
                    clone.srcset = '';
                }
                if (clone.loading === 'lazy') {
                    clone.loading = 'eager';
                }
            }
            if (isCustomElement(clone)) {
                return this.createCustomElementClone(clone);
            }
            return clone;
        };
        DocumentCloner.prototype.createCustomElementClone = function (node) {
            var clone = document.createElement('html2canvascustomelement');
            copyCSSStyles(node.style, clone);
            return clone;
        };
        DocumentCloner.prototype.createStyleClone = function (node) {
            try {
                var sheet = node.sheet;
                if (sheet && sheet.cssRules) {
                    var css = [].slice.call(sheet.cssRules, 0).reduce(function (css, rule) {
                        if (rule && typeof rule.cssText === 'string') {
                            return css + rule.cssText;
                        }
                        return css;
                    }, '');
                    var style = node.cloneNode(false);
                    style.textContent = css;
                    return style;
                }
            }
            catch (e) {
                // accessing node.sheet.cssRules throws a DOMException
                this.context.logger.error('Unable to access cssRules property', e);
                if (e.name !== 'SecurityError') {
                    throw e;
                }
            }
            return node.cloneNode(false);
        };
        DocumentCloner.prototype.createCanvasClone = function (canvas) {
            var _a;
            if (this.options.inlineImages && canvas.ownerDocument) {
                var img = canvas.ownerDocument.createElement('img');
                try {
                    img.src = canvas.toDataURL();
                    return img;
                }
                catch (e) {
                    this.context.logger.info("Unable to inline canvas contents, canvas is tainted", canvas);
                }
            }
            var clonedCanvas = canvas.cloneNode(false);
            try {
                clonedCanvas.width = canvas.width;
                clonedCanvas.height = canvas.height;
                var ctx = canvas.getContext('2d');
                var clonedCtx = clonedCanvas.getContext('2d');
                if (clonedCtx) {
                    if (!this.options.allowTaint && ctx) {
                        clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
                    }
                    else {
                        var gl = (_a = canvas.getContext('webgl2')) !== null && _a !== void 0 ? _a : canvas.getContext('webgl');
                        if (gl) {
                            var attribs = gl.getContextAttributes();
                            if ((attribs === null || attribs === void 0 ? void 0 : attribs.preserveDrawingBuffer) === false) {
                                this.context.logger.warn('Unable to clone WebGL context as it has preserveDrawingBuffer=false', canvas);
                            }
                        }
                        clonedCtx.drawImage(canvas, 0, 0);
                    }
                }
                return clonedCanvas;
            }
            catch (e) {
                this.context.logger.info("Unable to clone canvas as it is tainted", canvas);
            }
            return clonedCanvas;
        };
        DocumentCloner.prototype.createVideoClone = function (video) {
            var canvas = video.ownerDocument.createElement('canvas');
            canvas.width = video.offsetWidth;
            canvas.height = video.offsetHeight;
            var ctx = canvas.getContext('2d');
            try {
                if (ctx) {
                    ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
                    if (!this.options.allowTaint) {
                        ctx.getImageData(0, 0, canvas.width, canvas.height);
                    }
                }
                return canvas;
            }
            catch (e) {
                this.context.logger.info("Unable to clone video as it is tainted", video);
            }
            var blankCanvas = video.ownerDocument.createElement('canvas');
            blankCanvas.width = video.offsetWidth;
            blankCanvas.height = video.offsetHeight;
            return blankCanvas;
        };
        DocumentCloner.prototype.appendChildNode = function (clone, child, copyStyles) {
            if (!isElementNode(child) ||
                (!isScriptElement(child) &&
                    !child.hasAttribute(IGNORE_ATTRIBUTE) &&
                    (typeof this.options.ignoreElements !== 'function' || !this.options.ignoreElements(child)))) {
                if (!this.options.copyStyles || !isElementNode(child) || !isStyleElement(child)) {
                    clone.appendChild(this.cloneNode(child, copyStyles));
                }
            }
        };
        DocumentCloner.prototype.cloneChildNodes = function (node, clone, copyStyles) {
            var _this = this;
            for (var child = node.shadowRoot ? node.shadowRoot.firstChild : node.firstChild; child; child = child.nextSibling) {
                if (isElementNode(child) && isSlotElement(child) && typeof child.assignedNodes === 'function') {
                    var assignedNodes = child.assignedNodes();
                    if (assignedNodes.length) {
                        assignedNodes.forEach(function (assignedNode) { return _this.appendChildNode(clone, assignedNode, copyStyles); });
                    }
                }
                else {
                    this.appendChildNode(clone, child, copyStyles);
                }
            }
        };
        DocumentCloner.prototype.cloneNode = function (node, copyStyles) {
            if (isTextNode(node)) {
                return document.createTextNode(node.data);
            }
            if (!node.ownerDocument) {
                return node.cloneNode(false);
            }
            var window = node.ownerDocument.defaultView;
            if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
                var clone = this.createElementClone(node);
                clone.style.transitionProperty = 'none';
                var style = window.getComputedStyle(node);
                var styleBefore = window.getComputedStyle(node, ':before');
                var styleAfter = window.getComputedStyle(node, ':after');
                if (this.referenceElement === node && isHTMLElementNode(clone)) {
                    this.clonedReferenceElement = clone;
                }
                if (isBodyElement(clone)) {
                    createPseudoHideStyles(clone);
                }
                var counters = this.counters.parse(new CSSParsedCounterDeclaration(this.context, style));
                var before = this.resolvePseudoContent(node, clone, styleBefore, PseudoElementType.BEFORE);
                if (isCustomElement(node)) {
                    copyStyles = true;
                }
                if (!isVideoElement(node)) {
                    this.cloneChildNodes(node, clone, copyStyles);
                }
                if (before) {
                    clone.insertBefore(before, clone.firstChild);
                }
                var after = this.resolvePseudoContent(node, clone, styleAfter, PseudoElementType.AFTER);
                if (after) {
                    clone.appendChild(after);
                }
                this.counters.pop(counters);
                if ((style && (this.options.copyStyles || isSVGElementNode(node)) && !isIFrameElement(node)) ||
                    copyStyles) {
                    copyCSSStyles(style, clone);
                }
                if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
                    this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
                }
                if ((isTextareaElement(node) || isSelectElement(node)) &&
                    (isTextareaElement(clone) || isSelectElement(clone))) {
                    clone.value = node.value;
                }
                return clone;
            }
            return node.cloneNode(false);
        };
        DocumentCloner.prototype.resolvePseudoContent = function (node, clone, style, pseudoElt) {
            var _this = this;
            if (!style) {
                return;
            }
            var value = style.content;
            var document = clone.ownerDocument;
            if (!document || !value || value === 'none' || value === '-moz-alt-content' || style.display === 'none') {
                return;
            }
            this.counters.parse(new CSSParsedCounterDeclaration(this.context, style));
            var declaration = new CSSParsedPseudoDeclaration(this.context, style);
            var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
            copyCSSStyles(style, anonymousReplacedElement);
            declaration.content.forEach(function (token) {
                if (token.type === 0 /* STRING_TOKEN */) {
                    anonymousReplacedElement.appendChild(document.createTextNode(token.value));
                }
                else if (token.type === 22 /* URL_TOKEN */) {
                    var img = document.createElement('img');
                    img.src = token.value;
                    img.style.opacity = '1';
                    anonymousReplacedElement.appendChild(img);
                }
                else if (token.type === 18 /* FUNCTION */) {
                    if (token.name === 'attr') {
                        var attr = token.values.filter(isIdentToken);
                        if (attr.length) {
                            anonymousReplacedElement.appendChild(document.createTextNode(node.getAttribute(attr[0].value) || ''));
                        }
                    }
                    else if (token.name === 'counter') {
                        var _a = token.values.filter(nonFunctionArgSeparator), counter = _a[0], counterStyle = _a[1];
                        if (counter && isIdentToken(counter)) {
                            var counterState = _this.counters.getCounterValue(counter.value);
                            var counterType = counterStyle && isIdentToken(counterStyle)
                                ? listStyleType.parse(_this.context, counterStyle.value)
                                : 3 /* DECIMAL */;
                            anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
                        }
                    }
                    else if (token.name === 'counters') {
                        var _b = token.values.filter(nonFunctionArgSeparator), counter = _b[0], delim = _b[1], counterStyle = _b[2];
                        if (counter && isIdentToken(counter)) {
                            var counterStates = _this.counters.getCounterValues(counter.value);
                            var counterType_1 = counterStyle && isIdentToken(counterStyle)
                                ? listStyleType.parse(_this.context, counterStyle.value)
                                : 3 /* DECIMAL */;
                            var separator = delim && delim.type === 0 /* STRING_TOKEN */ ? delim.value : '';
                            var text = counterStates
                                .map(function (value) { return createCounterText(value, counterType_1, false); })
                                .join(separator);
                            anonymousReplacedElement.appendChild(document.createTextNode(text));
                        }
                    }
                    else ;
                }
                else if (token.type === 20 /* IDENT_TOKEN */) {
                    switch (token.value) {
                        case 'open-quote':
                            anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
                            break;
                        case 'close-quote':
                            anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, --_this.quoteDepth, false)));
                            break;
                        default:
                            // safari doesn't parse string tokens correctly because of lack of quotes
                            anonymousReplacedElement.appendChild(document.createTextNode(token.value));
                    }
                }
            });
            anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
            var newClassName = pseudoElt === PseudoElementType.BEFORE
                ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE
                : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
            if (isSVGElementNode(clone)) {
                clone.className.baseValue += newClassName;
            }
            else {
                clone.className += newClassName;
            }
            return anonymousReplacedElement;
        };
        DocumentCloner.destroy = function (container) {
            if (container.parentNode) {
                container.parentNode.removeChild(container);
                return true;
            }
            return false;
        };
        return DocumentCloner;
    }());
    var PseudoElementType;
    (function (PseudoElementType) {
        PseudoElementType[PseudoElementType["BEFORE"] = 0] = "BEFORE";
        PseudoElementType[PseudoElementType["AFTER"] = 1] = "AFTER";
    })(PseudoElementType || (PseudoElementType = {}));
    var createIFrameContainer = function (ownerDocument, bounds) {
        var cloneIframeContainer = ownerDocument.createElement('iframe');
        cloneIframeContainer.className = 'html2canvas-container';
        cloneIframeContainer.style.visibility = 'hidden';
        cloneIframeContainer.style.position = 'fixed';
        cloneIframeContainer.style.left = '-10000px';
        cloneIframeContainer.style.top = '0px';
        cloneIframeContainer.style.border = '0';
        cloneIframeContainer.width = bounds.width.toString();
        cloneIframeContainer.height = bounds.height.toString();
        cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it
        cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true');
        ownerDocument.body.appendChild(cloneIframeContainer);
        return cloneIframeContainer;
    };
    var imageReady = function (img) {
        return new Promise(function (resolve) {
            if (img.complete) {
                resolve();
                return;
            }
            if (!img.src) {
                resolve();
                return;
            }
            img.onload = resolve;
            img.onerror = resolve;
        });
    };
    var imagesReady = function (document) {
        return Promise.all([].slice.call(document.images, 0).map(imageReady));
    };
    var iframeLoader = function (iframe) {
        return new Promise(function (resolve, reject) {
            var cloneWindow = iframe.contentWindow;
            if (!cloneWindow) {
                return reject("No window assigned for iframe");
            }
            var documentClone = cloneWindow.document;
            cloneWindow.onload = iframe.onload = function () {
                cloneWindow.onload = iframe.onload = null;
                var interval = setInterval(function () {
                    if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
                        clearInterval(interval);
                        resolve(iframe);
                    }
                }, 50);
            };
        });
    };
    var ignoredStyleProperties = [
        'all',
        'd',
        'content' // Safari shows pseudoelements if content is set
    ];
    var copyCSSStyles = function (style, target) {
        // Edge does not provide value for cssText
        for (var i = style.length - 1; i >= 0; i--) {
            var property = style.item(i);
            if (ignoredStyleProperties.indexOf(property) === -1) {
                target.style.setProperty(property, style.getPropertyValue(property));
            }
        }
        return target;
    };
    var serializeDoctype = function (doctype) {
        var str = '';
        if (doctype) {
            str += '<!DOCTYPE ';
            if (doctype.name) {
                str += doctype.name;
            }
            if (doctype.internalSubset) {
                str += doctype.internalSubset;
            }
            if (doctype.publicId) {
                str += "\"" + doctype.publicId + "\"";
            }
            if (doctype.systemId) {
                str += "\"" + doctype.systemId + "\"";
            }
            str += '>';
        }
        return str;
    };
    var restoreOwnerScroll = function (ownerDocument, x, y) {
        if (ownerDocument &&
            ownerDocument.defaultView &&
            (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
            ownerDocument.defaultView.scrollTo(x, y);
        }
    };
    var restoreNodeScroll = function (_a) {
        var element = _a[0], x = _a[1], y = _a[2];
        element.scrollLeft = x;
        element.scrollTop = y;
    };
    var PSEUDO_BEFORE = ':before';
    var PSEUDO_AFTER = ':after';
    var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before';
    var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
    var PSEUDO_HIDE_ELEMENT_STYLE = "{\n    content: \"\" !important;\n    display: none !important;\n}";
    var createPseudoHideStyles = function (body) {
        createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + "\n         ." + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
    };
    var createStyles = function (body, styles) {
        var document = body.ownerDocument;
        if (document) {
            var style = document.createElement('style');
            style.textContent = styles;
            body.appendChild(style);
        }
    };

    var CacheStorage = /** @class */ (function () {
        function CacheStorage() {
        }
        CacheStorage.getOrigin = function (url) {
            var link = CacheStorage._link;
            if (!link) {
                return 'about:blank';
            }
            link.href = url;
            link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
            return link.protocol + link.hostname + link.port;
        };
        CacheStorage.isSameOrigin = function (src) {
            return CacheStorage.getOrigin(src) === CacheStorage._origin;
        };
        CacheStorage.setContext = function (window) {
            CacheStorage._link = window.document.createElement('a');
            CacheStorage._origin = CacheStorage.getOrigin(window.location.href);
        };
        CacheStorage._origin = 'about:blank';
        return CacheStorage;
    }());
    var Cache = /** @class */ (function () {
        function Cache(context, _options) {
            this.context = context;
            this._options = _options;
            // eslint-disable-next-line @typescript-eslint/no-explicit-any
            this._cache = {};
        }
        Cache.prototype.addImage = function (src) {
            var result = Promise.resolve();
            if (this.has(src)) {
                return result;
            }
            if (isBlobImage(src) || isRenderable(src)) {
                (this._cache[src] = this.loadImage(src)).catch(function () {
                    // prevent unhandled rejection
                });
                return result;
            }
            return result;
        };
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Cache.prototype.match = function (src) {
            return this._cache[src];
        };
        Cache.prototype.loadImage = function (key) {
            return __awaiter(this, void 0, void 0, function () {
                var isSameOrigin, useCORS, useProxy, src;
                var _this = this;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            isSameOrigin = CacheStorage.isSameOrigin(key);
                            useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
                            useProxy = !isInlineImage(key) &&
                                !isSameOrigin &&
                                !isBlobImage(key) &&
                                typeof this._options.proxy === 'string' &&
                                FEATURES.SUPPORT_CORS_XHR &&
                                !useCORS;
                            if (!isSameOrigin &&
                                this._options.allowTaint === false &&
                                !isInlineImage(key) &&
                                !isBlobImage(key) &&
                                !useProxy &&
                                !useCORS) {
                                return [2 /*return*/];
                            }
                            src = key;
                            if (!useProxy) return [3 /*break*/, 2];
                            return [4 /*yield*/, this.proxy(src)];
                        case 1:
                            src = _a.sent();
                            _a.label = 2;
                        case 2:
                            this.context.logger.debug("Added image " + key.substring(0, 256));
                            return [4 /*yield*/, new Promise(function (resolve, reject) {
                                    var img = new Image();
                                    img.onload = function () { return resolve(img); };
                                    img.onerror = reject;
                                    //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
                                    if (isInlineBase64Image(src) || useCORS) {
                                        img.crossOrigin = 'anonymous';
                                    }
                                    img.src = src;
                                    if (img.complete === true) {
                                        // Inline XML images may fail to parse, throwing an Error later on
                                        setTimeout(function () { return resolve(img); }, 500);
                                    }
                                    if (_this._options.imageTimeout > 0) {
                                        setTimeout(function () { return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image"); }, _this._options.imageTimeout);
                                    }
                                })];
                        case 3: return [2 /*return*/, _a.sent()];
                    }
                });
            });
        };
        Cache.prototype.has = function (key) {
            return typeof this._cache[key] !== 'undefined';
        };
        Cache.prototype.keys = function () {
            return Promise.resolve(Object.keys(this._cache));
        };
        Cache.prototype.proxy = function (src) {
            var _this = this;
            var proxy = this._options.proxy;
            if (!proxy) {
                throw new Error('No proxy defined');
            }
            var key = src.substring(0, 256);
            return new Promise(function (resolve, reject) {
                var responseType = FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
                var xhr = new XMLHttpRequest();
                xhr.onload = function () {
                    if (xhr.status === 200) {
                        if (responseType === 'text') {
                            resolve(xhr.response);
                        }
                        else {
                            var reader_1 = new FileReader();
                            reader_1.addEventListener('load', function () { return resolve(reader_1.result); }, false);
                            reader_1.addEventListener('error', function (e) { return reject(e); }, false);
                            reader_1.readAsDataURL(xhr.response);
                        }
                    }
                    else {
                        reject("Failed to proxy resource " + key + " with status code " + xhr.status);
                    }
                };
                xhr.onerror = reject;
                var queryString = proxy.indexOf('?') > -1 ? '&' : '?';
                xhr.open('GET', "" + proxy + queryString + "url=" + encodeURIComponent(src) + "&responseType=" + responseType);
                if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
                    xhr.responseType = responseType;
                }
                if (_this._options.imageTimeout) {
                    var timeout_1 = _this._options.imageTimeout;
                    xhr.timeout = timeout_1;
                    xhr.ontimeout = function () { return reject("Timed out (" + timeout_1 + "ms) proxying " + key); };
                }
                xhr.send();
            });
        };
        return Cache;
    }());
    var INLINE_SVG = /^data:image\/svg\+xml/i;
    var INLINE_BASE64 = /^data:image\/.*;base64,/i;
    var INLINE_IMG = /^data:image\/.*/i;
    var isRenderable = function (src) { return FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src); };
    var isInlineImage = function (src) { return INLINE_IMG.test(src); };
    var isInlineBase64Image = function (src) { return INLINE_BASE64.test(src); };
    var isBlobImage = function (src) { return src.substr(0, 4) === 'blob'; };
    var isSVG = function (src) { return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src); };

    var Vector = /** @class */ (function () {
        function Vector(x, y) {
            this.type = 0 /* VECTOR */;
            this.x = x;
            this.y = y;
        }
        Vector.prototype.add = function (deltaX, deltaY) {
            return new Vector(this.x + deltaX, this.y + deltaY);
        };
        return Vector;
    }());

    var lerp = function (a, b, t) {
        return new Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
    };
    var BezierCurve = /** @class */ (function () {
        function BezierCurve(start, startControl, endControl, end) {
            this.type = 1 /* BEZIER_CURVE */;
            this.start = start;
            this.startControl = startControl;
            this.endControl = endControl;
            this.end = end;
        }
        BezierCurve.prototype.subdivide = function (t, firstHalf) {
            var ab = lerp(this.start, this.startControl, t);
            var bc = lerp(this.startControl, this.endControl, t);
            var cd = lerp(this.endControl, this.end, t);
            var abbc = lerp(ab, bc, t);
            var bccd = lerp(bc, cd, t);
            var dest = lerp(abbc, bccd, t);
            return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
        };
        BezierCurve.prototype.add = function (deltaX, deltaY) {
            return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
        };
        BezierCurve.prototype.reverse = function () {
            return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
        };
        return BezierCurve;
    }());
    var isBezierCurve = function (path) { return path.type === 1 /* BEZIER_CURVE */; };

    var BoundCurves = /** @class */ (function () {
        function BoundCurves(element) {
            var styles = element.styles;
            var bounds = element.bounds;
            var _a = getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height), tlh = _a[0], tlv = _a[1];
            var _b = getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height), trh = _b[0], trv = _b[1];
            var _c = getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height), brh = _c[0], brv = _c[1];
            var _d = getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height), blh = _d[0], blv = _d[1];
            var factors = [];
            factors.push((tlh + trh) / bounds.width);
            factors.push((blh + brh) / bounds.width);
            factors.push((tlv + blv) / bounds.height);
            factors.push((trv + brv) / bounds.height);
            var maxFactor = Math.max.apply(Math, factors);
            if (maxFactor > 1) {
                tlh /= maxFactor;
                tlv /= maxFactor;
                trh /= maxFactor;
                trv /= maxFactor;
                brh /= maxFactor;
                brv /= maxFactor;
                blh /= maxFactor;
                blv /= maxFactor;
            }
            var topWidth = bounds.width - trh;
            var rightHeight = bounds.height - brv;
            var bottomWidth = bounds.width - brh;
            var leftHeight = bounds.height - blv;
            var borderTopWidth = styles.borderTopWidth;
            var borderRightWidth = styles.borderRightWidth;
            var borderBottomWidth = styles.borderBottomWidth;
            var borderLeftWidth = styles.borderLeftWidth;
            var paddingTop = getAbsoluteValue(styles.paddingTop, element.bounds.width);
            var paddingRight = getAbsoluteValue(styles.paddingRight, element.bounds.width);
            var paddingBottom = getAbsoluteValue(styles.paddingBottom, element.bounds.width);
            var paddingLeft = getAbsoluteValue(styles.paddingLeft, element.bounds.width);
            this.topLeftBorderDoubleOuterBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3, tlh - borderLeftWidth / 3, tlv - borderTopWidth / 3, CORNER.TOP_LEFT)
                    : new Vector(bounds.left + borderLeftWidth / 3, bounds.top + borderTopWidth / 3);
            this.topRightBorderDoubleOuterBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 3, trh - borderRightWidth / 3, trv - borderTopWidth / 3, CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + borderTopWidth / 3);
            this.bottomRightBorderDoubleOuterBox =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 3, brv - borderBottomWidth / 3, CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
            this.bottomLeftBorderDoubleOuterBox =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth / 3, bounds.top + leftHeight, blh - borderLeftWidth / 3, blv - borderBottomWidth / 3, CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left + borderLeftWidth / 3, bounds.top + bounds.height - borderBottomWidth / 3);
            this.topLeftBorderDoubleInnerBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3, tlh - (borderLeftWidth * 2) / 3, tlv - (borderTopWidth * 2) / 3, CORNER.TOP_LEFT)
                    : new Vector(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3);
            this.topRightBorderDoubleInnerBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + topWidth, bounds.top + (borderTopWidth * 2) / 3, trh - (borderRightWidth * 2) / 3, trv - (borderTopWidth * 2) / 3, CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width - (borderRightWidth * 2) / 3, bounds.top + (borderTopWidth * 2) / 3);
            this.bottomRightBorderDoubleInnerBox =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - (borderRightWidth * 2) / 3, brv - (borderBottomWidth * 2) / 3, CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width - (borderRightWidth * 2) / 3, bounds.top + bounds.height - (borderBottomWidth * 2) / 3);
            this.bottomLeftBorderDoubleInnerBox =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + leftHeight, blh - (borderLeftWidth * 2) / 3, blv - (borderBottomWidth * 2) / 3, CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left + (borderLeftWidth * 2) / 3, bounds.top + bounds.height - (borderBottomWidth * 2) / 3);
            this.topLeftBorderStroke =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2, tlh - borderLeftWidth / 2, tlv - borderTopWidth / 2, CORNER.TOP_LEFT)
                    : new Vector(bounds.left + borderLeftWidth / 2, bounds.top + borderTopWidth / 2);
            this.topRightBorderStroke =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + topWidth, bounds.top + borderTopWidth / 2, trh - borderRightWidth / 2, trv - borderTopWidth / 2, CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + borderTopWidth / 2);
            this.bottomRightBorderStroke =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh - borderRightWidth / 2, brv - borderBottomWidth / 2, CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
            this.bottomLeftBorderStroke =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth / 2, bounds.top + leftHeight, blh - borderLeftWidth / 2, blv - borderBottomWidth / 2, CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left + borderLeftWidth / 2, bounds.top + bounds.height - borderBottomWidth / 2);
            this.topLeftBorderBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT)
                    : new Vector(bounds.left, bounds.top);
            this.topRightBorderBox =
                trh > 0 || trv > 0
                    ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width, bounds.top);
            this.bottomRightBorderBox =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width, bounds.top + bounds.height);
            this.bottomLeftBorderBox =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left, bounds.top + bounds.height);
            this.topLeftPaddingBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + borderTopWidth, Math.max(0, tlh - borderLeftWidth), Math.max(0, tlv - borderTopWidth), CORNER.TOP_LEFT)
                    : new Vector(bounds.left + borderLeftWidth, bounds.top + borderTopWidth);
            this.topRightPaddingBox =
                trh > 0 || trv > 0
                    ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width - borderRightWidth), bounds.top + borderTopWidth, topWidth > bounds.width + borderRightWidth ? 0 : Math.max(0, trh - borderRightWidth), Math.max(0, trv - borderTopWidth), CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + borderTopWidth);
            this.bottomRightPaddingBox =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth), bounds.top + Math.min(rightHeight, bounds.height - borderBottomWidth), Math.max(0, brh - borderRightWidth), Math.max(0, brv - borderBottomWidth), CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + bounds.height - borderBottomWidth);
            this.bottomLeftPaddingBox =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth, bounds.top + Math.min(leftHeight, bounds.height - borderBottomWidth), Math.max(0, blh - borderLeftWidth), Math.max(0, blv - borderBottomWidth), CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left + borderLeftWidth, bounds.top + bounds.height - borderBottomWidth);
            this.topLeftContentBox =
                tlh > 0 || tlv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop, Math.max(0, tlh - (borderLeftWidth + paddingLeft)), Math.max(0, tlv - (borderTopWidth + paddingTop)), CORNER.TOP_LEFT)
                    : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop);
            this.topRightContentBox =
                trh > 0 || trv > 0
                    ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth + paddingLeft), bounds.top + borderTopWidth + paddingTop, topWidth > bounds.width + borderLeftWidth + paddingLeft ? 0 : trh - borderLeftWidth + paddingLeft, trv - (borderTopWidth + paddingTop), CORNER.TOP_RIGHT)
                    : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + borderTopWidth + paddingTop);
            this.bottomRightContentBox =
                brh > 0 || brv > 0
                    ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth + paddingLeft)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth + paddingTop), Math.max(0, brh - (borderRightWidth + paddingRight)), brv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_RIGHT)
                    : new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
            this.bottomLeftContentBox =
                blh > 0 || blv > 0
                    ? getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth + paddingLeft)), blv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_LEFT)
                    : new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
        }
        return BoundCurves;
    }());
    var CORNER;
    (function (CORNER) {
        CORNER[CORNER["TOP_LEFT"] = 0] = "TOP_LEFT";
        CORNER[CORNER["TOP_RIGHT"] = 1] = "TOP_RIGHT";
        CORNER[CORNER["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT";
        CORNER[CORNER["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT";
    })(CORNER || (CORNER = {}));
    var getCurvePoints = function (x, y, r1, r2, position) {
        var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
        var ox = r1 * kappa; // control point offset horizontal
        var oy = r2 * kappa; // control point offset vertical
        var xm = x + r1; // x-middle
        var ym = y + r2; // y-middle
        switch (position) {
            case CORNER.TOP_LEFT:
                return new BezierCurve(new Vector(x, ym), new Vector(x, ym - oy), new Vector(xm - ox, y), new Vector(xm, y));
            case CORNER.TOP_RIGHT:
                return new BezierCurve(new Vector(x, y), new Vector(x + ox, y), new Vector(xm, ym - oy), new Vector(xm, ym));
            case CORNER.BOTTOM_RIGHT:
                return new BezierCurve(new Vector(xm, y), new Vector(xm, y + oy), new Vector(x + ox, ym), new Vector(x, ym));
            case CORNER.BOTTOM_LEFT:
            default:
                return new BezierCurve(new Vector(xm, ym), new Vector(xm - ox, ym), new Vector(x, y + oy), new Vector(x, y));
        }
    };
    var calculateBorderBoxPath = function (curves) {
        return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox];
    };
    var calculateContentBoxPath = function (curves) {
        return [
            curves.topLeftContentBox,
            curves.topRightContentBox,
            curves.bottomRightContentBox,
            curves.bottomLeftContentBox
        ];
    };
    var calculatePaddingBoxPath = function (curves) {
        return [
            curves.topLeftPaddingBox,
            curves.topRightPaddingBox,
            curves.bottomRightPaddingBox,
            curves.bottomLeftPaddingBox
        ];
    };

    var TransformEffect = /** @class */ (function () {
        function TransformEffect(offsetX, offsetY, matrix) {
            this.offsetX = offsetX;
            this.offsetY = offsetY;
            this.matrix = matrix;
            this.type = 0 /* TRANSFORM */;
            this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
        }
        return TransformEffect;
    }());
    var ClipEffect = /** @class */ (function () {
        function ClipEffect(path, target) {
            this.path = path;
            this.target = target;
            this.type = 1 /* CLIP */;
        }
        return ClipEffect;
    }());
    var OpacityEffect = /** @class */ (function () {
        function OpacityEffect(opacity) {
            this.opacity = opacity;
            this.type = 2 /* OPACITY */;
            this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
        }
        return OpacityEffect;
    }());
    var isTransformEffect = function (effect) {
        return effect.type === 0 /* TRANSFORM */;
    };
    var isClipEffect = function (effect) { return effect.type === 1 /* CLIP */; };
    var isOpacityEffect = function (effect) { return effect.type === 2 /* OPACITY */; };

    var equalPath = function (a, b) {
        if (a.length === b.length) {
            return a.some(function (v, i) { return v === b[i]; });
        }
        return false;
    };
    var transformPath = function (path, deltaX, deltaY, deltaW, deltaH) {
        return path.map(function (point, index) {
            switch (index) {
                case 0:
                    return point.add(deltaX, deltaY);
                case 1:
                    return point.add(deltaX + deltaW, deltaY);
                case 2:
                    return point.add(deltaX + deltaW, deltaY + deltaH);
                case 3:
                    return point.add(deltaX, deltaY + deltaH);
            }
            return point;
        });
    };

    var StackingContext = /** @class */ (function () {
        function StackingContext(container) {
            this.element = container;
            this.inlineLevel = [];
            this.nonInlineLevel = [];
            this.negativeZIndex = [];
            this.zeroOrAutoZIndexOrTransformedOrOpacity = [];
            this.positiveZIndex = [];
            this.nonPositionedFloats = [];
            this.nonPositionedInlineLevel = [];
        }
        return StackingContext;
    }());
    var ElementPaint = /** @class */ (function () {
        function ElementPaint(container, parent) {
            this.container = container;
            this.parent = parent;
            this.effects = [];
            this.curves = new BoundCurves(this.container);
            if (this.container.styles.opacity < 1) {
                this.effects.push(new OpacityEffect(this.container.styles.opacity));
            }
            if (this.container.styles.transform !== null) {
                var offsetX = this.container.bounds.left + this.container.styles.transformOrigin[0].number;
                var offsetY = this.container.bounds.top + this.container.styles.transformOrigin[1].number;
                var matrix = this.container.styles.transform;
                this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
            }
            if (this.container.styles.overflowX !== 0 /* VISIBLE */) {
                var borderBox = calculateBorderBoxPath(this.curves);
                var paddingBox = calculatePaddingBoxPath(this.curves);
                if (equalPath(borderBox, paddingBox)) {
                    this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
                }
                else {
                    this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
                    this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
                }
            }
        }
        ElementPaint.prototype.getEffects = function (target) {
            var inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(this.container.styles.position) === -1;
            var parent = this.parent;
            var effects = this.effects.slice(0);
            while (parent) {
                var croplessEffects = parent.effects.filter(function (effect) { return !isClipEffect(effect); });
                if (inFlow || parent.container.styles.position !== 0 /* STATIC */ || !parent.parent) {
                    effects.unshift.apply(effects, croplessEffects);
                    inFlow = [2 /* ABSOLUTE */, 3 /* FIXED */].indexOf(parent.container.styles.position) === -1;
                    if (parent.container.styles.overflowX !== 0 /* VISIBLE */) {
                        var borderBox = calculateBorderBoxPath(parent.curves);
                        var paddingBox = calculatePaddingBoxPath(parent.curves);
                        if (!equalPath(borderBox, paddingBox)) {
                            effects.unshift(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
                        }
                    }
                }
                else {
                    effects.unshift.apply(effects, croplessEffects);
                }
                parent = parent.parent;
            }
            return effects.filter(function (effect) { return contains(effect.target, target); });
        };
        return ElementPaint;
    }());
    var parseStackTree = function (parent, stackingContext, realStackingContext, listItems) {
        parent.container.elements.forEach(function (child) {
            var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
            var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
            var paintContainer = new ElementPaint(child, parent);
            if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
                listItems.push(paintContainer);
            }
            var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
            if (treatAsRealStackingContext || createsStackingContext) {
                var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
                var stack = new StackingContext(paintContainer);
                if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) {
                    var order_1 = child.styles.zIndex.order;
                    if (order_1 < 0) {
                        var index_1 = 0;
                        parentStack.negativeZIndex.some(function (current, i) {
                            if (order_1 > current.element.container.styles.zIndex.order) {
                                index_1 = i;
                                return false;
                            }
                            else if (index_1 > 0) {
                                return true;
                            }
                            return false;
                        });
                        parentStack.negativeZIndex.splice(index_1, 0, stack);
                    }
                    else if (order_1 > 0) {
                        var index_2 = 0;
                        parentStack.positiveZIndex.some(function (current, i) {
                            if (order_1 >= current.element.container.styles.zIndex.order) {
                                index_2 = i + 1;
                                return false;
                            }
                            else if (index_2 > 0) {
                                return true;
                            }
                            return false;
                        });
                        parentStack.positiveZIndex.splice(index_2, 0, stack);
                    }
                    else {
                        parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack);
                    }
                }
                else {
                    if (child.styles.isFloating()) {
                        parentStack.nonPositionedFloats.push(stack);
                    }
                    else {
                        parentStack.nonPositionedInlineLevel.push(stack);
                    }
                }
                parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems);
            }
            else {
                if (child.styles.isInlineLevel()) {
                    stackingContext.inlineLevel.push(paintContainer);
                }
                else {
                    stackingContext.nonInlineLevel.push(paintContainer);
                }
                parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
            }
            if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
                processListItems(child, listOwnerItems);
            }
        });
    };
    var processListItems = function (owner, elements) {
        var numbering = owner instanceof OLElementContainer ? owner.start : 1;
        var reversed = owner instanceof OLElementContainer ? owner.reversed : false;
        for (var i = 0; i < elements.length; i++) {
            var item = elements[i];
            if (item.container instanceof LIElementContainer &&
                typeof item.container.value === 'number' &&
                item.container.value !== 0) {
                numbering = item.container.value;
            }
            item.listValue = createCounterText(numbering, item.container.styles.listStyleType, true);
            numbering += reversed ? -1 : 1;
        }
    };
    var parseStackingContexts = function (container) {
        var paintContainer = new ElementPaint(container, null);
        var root = new StackingContext(paintContainer);
        var listItems = [];
        parseStackTree(paintContainer, root, root, listItems);
        processListItems(paintContainer.container, listItems);
        return root;
    };

    var parsePathForBorder = function (curves, borderSide) {
        switch (borderSide) {
            case 0:
                return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
            case 1:
                return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
            case 2:
                return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
            case 3:
            default:
                return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);
        }
    };
    var parsePathForBorderDoubleOuter = function (curves, borderSide) {
        switch (borderSide) {
            case 0:
                return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox, curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox);
            case 1:
                return createPathFromCurves(curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox, curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox);
            case 2:
                return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox, curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox);
            case 3:
            default:
                return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox, curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox);
        }
    };
    var parsePathForBorderDoubleInner = function (curves, borderSide) {
        switch (borderSide) {
            case 0:
                return createPathFromCurves(curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox, curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox);
            case 1:
                return createPathFromCurves(curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox, curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox);
            case 2:
                return createPathFromCurves(curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox);
            case 3:
            default:
                return createPathFromCurves(curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox, curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox);
        }
    };
    var parsePathForBorderStroke = function (curves, borderSide) {
        switch (borderSide) {
            case 0:
                return createStrokePathFromCurves(curves.topLeftBorderStroke, curves.topRightBorderStroke);
            case 1:
                return createStrokePathFromCurves(curves.topRightBorderStroke, curves.bottomRightBorderStroke);
            case 2:
                return createStrokePathFromCurves(curves.bottomRightBorderStroke, curves.bottomLeftBorderStroke);
            case 3:
            default:
                return createStrokePathFromCurves(curves.bottomLeftBorderStroke, curves.topLeftBorderStroke);
        }
    };
    var createStrokePathFromCurves = function (outer1, outer2) {
        var path = [];
        if (isBezierCurve(outer1)) {
            path.push(outer1.subdivide(0.5, false));
        }
        else {
            path.push(outer1);
        }
        if (isBezierCurve(outer2)) {
            path.push(outer2.subdivide(0.5, true));
        }
        else {
            path.push(outer2);
        }
        return path;
    };
    var createPathFromCurves = function (outer1, inner1, outer2, inner2) {
        var path = [];
        if (isBezierCurve(outer1)) {
            path.push(outer1.subdivide(0.5, false));
        }
        else {
            path.push(outer1);
        }
        if (isBezierCurve(outer2)) {
            path.push(outer2.subdivide(0.5, true));
        }
        else {
            path.push(outer2);
        }
        if (isBezierCurve(inner2)) {
            path.push(inner2.subdivide(0.5, true).reverse());
        }
        else {
            path.push(inner2);
        }
        if (isBezierCurve(inner1)) {
            path.push(inner1.subdivide(0.5, false).reverse());
        }
        else {
            path.push(inner1);
        }
        return path;
    };

    var paddingBox = function (element) {
        var bounds = element.bounds;
        var styles = element.styles;
        return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
    };
    var contentBox = function (element) {
        var styles = element.styles;
        var bounds = element.bounds;
        var paddingLeft = getAbsoluteValue(styles.paddingLeft, bounds.width);
        var paddingRight = getAbsoluteValue(styles.paddingRight, bounds.width);
        var paddingTop = getAbsoluteValue(styles.paddingTop, bounds.width);
        var paddingBottom = getAbsoluteValue(styles.paddingBottom, bounds.width);
        return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
    };

    var calculateBackgroundPositioningArea = function (backgroundOrigin, element) {
        if (backgroundOrigin === 0 /* BORDER_BOX */) {
            return element.bounds;
        }
        if (backgroundOrigin === 2 /* CONTENT_BOX */) {
            return contentBox(element);
        }
        return paddingBox(element);
    };
    var calculateBackgroundPaintingArea = function (backgroundClip, element) {
        if (backgroundClip === 0 /* BORDER_BOX */) {
            return element.bounds;
        }
        if (backgroundClip === 2 /* CONTENT_BOX */) {
            return contentBox(element);
        }
        return paddingBox(element);
    };
    var calculateBackgroundRendering = function (container, index, intrinsicSize) {
        var backgroundPositioningArea = calculateBackgroundPositioningArea(getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container);
        var backgroundPaintingArea = calculateBackgroundPaintingArea(getBackgroundValueForIndex(container.styles.backgroundClip, index), container);
        var backgroundImageSize = calculateBackgroundSize(getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea);
        var sizeWidth = backgroundImageSize[0], sizeHeight = backgroundImageSize[1];
        var position = getAbsoluteValueForTuple(getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight);
        var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
        var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
        var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
        return [path, offsetX, offsetY, sizeWidth, sizeHeight];
    };
    var isAuto = function (token) { return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO; };
    var hasIntrinsicValue = function (value) { return typeof value === 'number'; };
    var calculateBackgroundSize = function (size, _a, bounds) {
        var intrinsicWidth = _a[0], intrinsicHeight = _a[1], intrinsicProportion = _a[2];
        var first = size[0], second = size[1];
        if (!first) {
            return [0, 0];
        }
        if (isLengthPercentage(first) && second && isLengthPercentage(second)) {
            return [getAbsoluteValue(first, bounds.width), getAbsoluteValue(second, bounds.height)];
        }
        var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion);
        if (isIdentToken(first) && (first.value === BACKGROUND_SIZE.CONTAIN || first.value === BACKGROUND_SIZE.COVER)) {
            if (hasIntrinsicValue(intrinsicProportion)) {
                var targetRatio = bounds.width / bounds.height;
                return targetRatio < intrinsicProportion !== (first.value === BACKGROUND_SIZE.COVER)
                    ? [bounds.width, bounds.width / intrinsicProportion]
                    : [bounds.height * intrinsicProportion, bounds.height];
            }
            return [bounds.width, bounds.height];
        }
        var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth);
        var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight);
        var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight;
        // If the background-size is auto or auto auto:
        if (isAuto(first) && (!second || isAuto(second))) {
            // If the image has both horizontal and vertical intrinsic dimensions, it's rendered at that size.
            if (hasIntrinsicWidth && hasIntrinsicHeight) {
                return [intrinsicWidth, intrinsicHeight];
            }
            // If the image has no intrinsic dimensions and has no intrinsic proportions,
            // it's rendered at the size of the background positioning area.
            if (!hasIntrinsicProportion && !hasIntrinsicDimensions) {
                return [bounds.width, bounds.height];
            }
            // TODO If the image has no intrinsic dimensions but has intrinsic proportions, it's rendered as if contain had been specified instead.
            // If the image has only one intrinsic dimension and has intrinsic proportions, it's rendered at the size corresponding to that one dimension.
            // The other dimension is computed using the specified dimension and the intrinsic proportions.
            if (hasIntrinsicDimensions && hasIntrinsicProportion) {
                var width_1 = hasIntrinsicWidth
                    ? intrinsicWidth
                    : intrinsicHeight * intrinsicProportion;
                var height_1 = hasIntrinsicHeight
                    ? intrinsicHeight
                    : intrinsicWidth / intrinsicProportion;
                return [width_1, height_1];
            }
            // If the image has only one intrinsic dimension but has no intrinsic proportions,
            // it's rendered using the specified dimension and the other dimension of the background positioning area.
            var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width;
            var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height;
            return [width_2, height_2];
        }
        // If the image has intrinsic proportions, it's stretched to the specified dimension.
        // The unspecified dimension is computed using the specified dimension and the intrinsic proportions.
        if (hasIntrinsicProportion) {
            var width_3 = 0;
            var height_3 = 0;
            if (isLengthPercentage(first)) {
                width_3 = getAbsoluteValue(first, bounds.width);
            }
            else if (isLengthPercentage(second)) {
                height_3 = getAbsoluteValue(second, bounds.height);
            }
            if (isAuto(first)) {
                width_3 = height_3 * intrinsicProportion;
            }
            else if (!second || isAuto(second)) {
                height_3 = width_3 / intrinsicProportion;
            }
            return [width_3, height_3];
        }
        // If the image has no intrinsic proportions, it's stretched to the specified dimension.
        // The unspecified dimension is computed using the image's corresponding intrinsic dimension,
        // if there is one. If there is no such intrinsic dimension,
        // it becomes the corresponding dimension of the background positioning area.
        var width = null;
        var height = null;
        if (isLengthPercentage(first)) {
            width = getAbsoluteValue(first, bounds.width);
        }
        else if (second && isLengthPercentage(second)) {
            height = getAbsoluteValue(second, bounds.height);
        }
        if (width !== null && (!second || isAuto(second))) {
            height =
                hasIntrinsicWidth && hasIntrinsicHeight
                    ? (width / intrinsicWidth) * intrinsicHeight
                    : bounds.height;
        }
        if (height !== null && isAuto(first)) {
            width =
                hasIntrinsicWidth && hasIntrinsicHeight
                    ? (height / intrinsicHeight) * intrinsicWidth
                    : bounds.width;
        }
        if (width !== null && height !== null) {
            return [width, height];
        }
        throw new Error("Unable to calculate background-size for element");
    };
    var getBackgroundValueForIndex = function (values, index) {
        var value = values[index];
        if (typeof value === 'undefined') {
            return values[0];
        }
        return value;
    };
    var calculateBackgroundRepeatPath = function (repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) {
        var x = _a[0], y = _a[1];
        var width = _b[0], height = _b[1];
        switch (repeat) {
            case 2 /* REPEAT_X */:
                return [
                    new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
                    new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
                    new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
                    new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
                ];
            case 3 /* REPEAT_Y */:
                return [
                    new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
                    new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
                    new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
                    new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
                ];
            case 1 /* NO_REPEAT */:
                return [
                    new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
                    new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
                    new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)),
                    new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height))
                ];
            default:
                return [
                    new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)),
                    new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)),
                    new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)),
                    new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top))
                ];
        }
    };

    var SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';

    var SAMPLE_TEXT = 'Hidden Text';
    var FontMetrics = /** @class */ (function () {
        function FontMetrics(document) {
            this._data = {};
            this._document = document;
        }
        FontMetrics.prototype.parseMetrics = function (fontFamily, fontSize) {
            var container = this._document.createElement('div');
            var img = this._document.createElement('img');
            var span = this._document.createElement('span');
            var body = this._document.body;
            container.style.visibility = 'hidden';
            container.style.fontFamily = fontFamily;
            container.style.fontSize = fontSize;
            container.style.margin = '0';
            container.style.padding = '0';
            container.style.whiteSpace = 'nowrap';
            body.appendChild(container);
            img.src = SMALL_IMAGE;
            img.width = 1;
            img.height = 1;
            img.style.margin = '0';
            img.style.padding = '0';
            img.style.verticalAlign = 'baseline';
            span.style.fontFamily = fontFamily;
            span.style.fontSize = fontSize;
            span.style.margin = '0';
            span.style.padding = '0';
            span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
            container.appendChild(span);
            container.appendChild(img);
            var baseline = img.offsetTop - span.offsetTop + 2;
            container.removeChild(span);
            container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
            container.style.lineHeight = 'normal';
            img.style.verticalAlign = 'super';
            var middle = img.offsetTop - container.offsetTop + 2;
            body.removeChild(container);
            return { baseline: baseline, middle: middle };
        };
        FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
            var key = fontFamily + " " + fontSize;
            if (typeof this._data[key] === 'undefined') {
                this._data[key] = this.parseMetrics(fontFamily, fontSize);
            }
            return this._data[key];
        };
        return FontMetrics;
    }());

    var Renderer = /** @class */ (function () {
        function Renderer(context, options) {
            this.context = context;
            this.options = options;
        }
        return Renderer;
    }());

    var MASK_OFFSET = 10000;
    var CanvasRenderer = /** @class */ (function (_super) {
        __extends(CanvasRenderer, _super);
        function CanvasRenderer(context, options) {
            var _this = _super.call(this, context, options) || this;
            _this._activeEffects = [];
            _this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
            _this.ctx = _this.canvas.getContext('2d');
            if (!options.canvas) {
                _this.canvas.width = Math.floor(options.width * options.scale);
                _this.canvas.height = Math.floor(options.height * options.scale);
                _this.canvas.style.width = options.width + "px";
                _this.canvas.style.height = options.height + "px";
            }
            _this.fontMetrics = new FontMetrics(document);
            _this.ctx.scale(_this.options.scale, _this.options.scale);
            _this.ctx.translate(-options.x, -options.y);
            _this.ctx.textBaseline = 'bottom';
            _this._activeEffects = [];
            _this.context.logger.debug("Canvas renderer initialized (" + options.width + "x" + options.height + ") with scale " + options.scale);
            return _this;
        }
        CanvasRenderer.prototype.applyEffects = function (effects) {
            var _this = this;
            while (this._activeEffects.length) {
                this.popEffect();
            }
            effects.forEach(function (effect) { return _this.applyEffect(effect); });
        };
        CanvasRenderer.prototype.applyEffect = function (effect) {
            this.ctx.save();
            if (isOpacityEffect(effect)) {
                this.ctx.globalAlpha = effect.opacity;
            }
            if (isTransformEffect(effect)) {
                this.ctx.translate(effect.offsetX, effect.offsetY);
                this.ctx.transform(effect.matrix[0], effect.matrix[1], effect.matrix[2], effect.matrix[3], effect.matrix[4], effect.matrix[5]);
                this.ctx.translate(-effect.offsetX, -effect.offsetY);
            }
            if (isClipEffect(effect)) {
                this.path(effect.path);
                this.ctx.clip();
            }
            this._activeEffects.push(effect);
        };
        CanvasRenderer.prototype.popEffect = function () {
            this._activeEffects.pop();
            this.ctx.restore();
        };
        CanvasRenderer.prototype.renderStack = function (stack) {
            return __awaiter(this, void 0, void 0, function () {
                var styles;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            styles = stack.element.container.styles;
                            if (!styles.isVisible()) return [3 /*break*/, 2];
                            return [4 /*yield*/, this.renderStackContent(stack)];
                        case 1:
                            _a.sent();
                            _a.label = 2;
                        case 2: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderNode = function (paint) {
            return __awaiter(this, void 0, void 0, function () {
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            if (contains(paint.container.flags, 16 /* DEBUG_RENDER */)) {
                                debugger;
                            }
                            if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
                            return [4 /*yield*/, this.renderNodeBackgroundAndBorders(paint)];
                        case 1:
                            _a.sent();
                            return [4 /*yield*/, this.renderNodeContent(paint)];
                        case 2:
                            _a.sent();
                            _a.label = 3;
                        case 3: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing, baseline) {
            var _this = this;
            if (letterSpacing === 0) {
                this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
            }
            else {
                var letters = segmentGraphemes(text.text);
                letters.reduce(function (left, letter) {
                    _this.ctx.fillText(letter, left, text.bounds.top + baseline);
                    return left + _this.ctx.measureText(letter).width;
                }, text.bounds.left);
            }
        };
        CanvasRenderer.prototype.createFontStyle = function (styles) {
            var fontVariant = styles.fontVariant
                .filter(function (variant) { return variant === 'normal' || variant === 'small-caps'; })
                .join('');
            var fontFamily = fixIOSSystemFonts(styles.fontFamily).join(', ');
            var fontSize = isDimensionToken(styles.fontSize)
                ? "" + styles.fontSize.number + styles.fontSize.unit
                : styles.fontSize.number + "px";
            return [
                [styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
                fontFamily,
                fontSize
            ];
        };
        CanvasRenderer.prototype.renderTextNode = function (text, styles) {
            return __awaiter(this, void 0, void 0, function () {
                var _a, font, fontFamily, fontSize, _b, baseline, middle, paintOrder;
                var _this = this;
                return __generator(this, function (_c) {
                    _a = this.createFontStyle(styles), font = _a[0], fontFamily = _a[1], fontSize = _a[2];
                    this.ctx.font = font;
                    this.ctx.direction = styles.direction === 1 /* RTL */ ? 'rtl' : 'ltr';
                    this.ctx.textAlign = 'left';
                    this.ctx.textBaseline = 'alphabetic';
                    _b = this.fontMetrics.getMetrics(fontFamily, fontSize), baseline = _b.baseline, middle = _b.middle;
                    paintOrder = styles.paintOrder;
                    text.textBounds.forEach(function (text) {
                        paintOrder.forEach(function (paintOrderLayer) {
                            switch (paintOrderLayer) {
                                case 0 /* FILL */:
                                    _this.ctx.fillStyle = asString(styles.color);
                                    _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
                                    var textShadows = styles.textShadow;
                                    if (textShadows.length && text.text.trim().length) {
                                        textShadows
                                            .slice(0)
                                            .reverse()
                                            .forEach(function (textShadow) {
                                            _this.ctx.shadowColor = asString(textShadow.color);
                                            _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
                                            _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
                                            _this.ctx.shadowBlur = textShadow.blur.number;
                                            _this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
                                        });
                                        _this.ctx.shadowColor = '';
                                        _this.ctx.shadowOffsetX = 0;
                                        _this.ctx.shadowOffsetY = 0;
                                        _this.ctx.shadowBlur = 0;
                                    }
                                    if (styles.textDecorationLine.length) {
                                        _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
                                        styles.textDecorationLine.forEach(function (textDecorationLine) {
                                            switch (textDecorationLine) {
                                                case 1 /* UNDERLINE */:
                                                    // Draws a line at the baseline of the font
                                                    // TODO As some browsers display the line as more than 1px if the font-size is big,
                                                    // need to take that into account both in position and size
                                                    _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
                                                    break;
                                                case 2 /* OVERLINE */:
                                                    _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1);
                                                    break;
                                                case 3 /* LINE_THROUGH */:
                                                    // TODO try and find exact position for line-through
                                                    _this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
                                                    break;
                                            }
                                        });
                                    }
                                    break;
                                case 1 /* STROKE */:
                                    if (styles.webkitTextStrokeWidth && text.text.trim().length) {
                                        _this.ctx.strokeStyle = asString(styles.webkitTextStrokeColor);
                                        _this.ctx.lineWidth = styles.webkitTextStrokeWidth;
                                        // eslint-disable-next-line @typescript-eslint/no-explicit-any
                                        _this.ctx.lineJoin = !!window.chrome ? 'miter' : 'round';
                                        _this.ctx.strokeText(text.text, text.bounds.left, text.bounds.top + baseline);
                                    }
                                    _this.ctx.strokeStyle = '';
                                    _this.ctx.lineWidth = 0;
                                    _this.ctx.lineJoin = 'miter';
                                    break;
                            }
                        });
                    });
                    return [2 /*return*/];
                });
            });
        };
        CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
            if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
                var box = contentBox(container);
                var path = calculatePaddingBoxPath(curves);
                this.path(path);
                this.ctx.save();
                this.ctx.clip();
                this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
                this.ctx.restore();
            }
        };
        CanvasRenderer.prototype.renderNodeContent = function (paint) {
            return __awaiter(this, void 0, void 0, function () {
                var container, curves, styles, _i, _a, child, image, image, iframeRenderer, canvas, size, _b, fontFamily, fontSize, baseline, bounds, x, textBounds, img, image, url, fontFamily, bounds;
                return __generator(this, function (_c) {
                    switch (_c.label) {
                        case 0:
                            this.applyEffects(paint.getEffects(4 /* CONTENT */));
                            container = paint.container;
                            curves = paint.curves;
                            styles = container.styles;
                            _i = 0, _a = container.textNodes;
                            _c.label = 1;
                        case 1:
                            if (!(_i < _a.length)) return [3 /*break*/, 4];
                            child = _a[_i];
                            return [4 /*yield*/, this.renderTextNode(child, styles)];
                        case 2:
                            _c.sent();
                            _c.label = 3;
                        case 3:
                            _i++;
                            return [3 /*break*/, 1];
                        case 4:
                            if (!(container instanceof ImageElementContainer)) return [3 /*break*/, 8];
                            _c.label = 5;
                        case 5:
                            _c.trys.push([5, 7, , 8]);
                            return [4 /*yield*/, this.context.cache.match(container.src)];
                        case 6:
                            image = _c.sent();
                            this.renderReplacedElement(container, curves, image);
                            return [3 /*break*/, 8];
                        case 7:
                            _c.sent();
                            this.context.logger.error("Error loading image " + container.src);
                            return [3 /*break*/, 8];
                        case 8:
                            if (container instanceof CanvasElementContainer) {
                                this.renderReplacedElement(container, curves, container.canvas);
                            }
                            if (!(container instanceof SVGElementContainer)) return [3 /*break*/, 12];
                            _c.label = 9;
                        case 9:
                            _c.trys.push([9, 11, , 12]);
                            return [4 /*yield*/, this.context.cache.match(container.svg)];
                        case 10:
                            image = _c.sent();
                            this.renderReplacedElement(container, curves, image);
                            return [3 /*break*/, 12];
                        case 11:
                            _c.sent();
                            this.context.logger.error("Error loading svg " + container.svg.substring(0, 255));
                            return [3 /*break*/, 12];
                        case 12:
                            if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
                            iframeRenderer = new CanvasRenderer(this.context, {
                                scale: this.options.scale,
                                backgroundColor: container.backgroundColor,
                                x: 0,
                                y: 0,
                                width: container.width,
                                height: container.height
                            });
                            return [4 /*yield*/, iframeRenderer.render(container.tree)];
                        case 13:
                            canvas = _c.sent();
                            if (container.width && container.height) {
                                this.ctx.drawImage(canvas, 0, 0, container.width, container.height, container.bounds.left, container.bounds.top, container.bounds.width, container.bounds.height);
                            }
                            _c.label = 14;
                        case 14:
                            if (container instanceof InputElementContainer) {
                                size = Math.min(container.bounds.width, container.bounds.height);
                                if (container.type === CHECKBOX) {
                                    if (container.checked) {
                                        this.ctx.save();
                                        this.path([
                                            new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79),
                                            new Vector(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549),
                                            new Vector(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071),
                                            new Vector(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649),
                                            new Vector(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23),
                                            new Vector(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085),
                                            new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)
                                        ]);
                                        this.ctx.fillStyle = asString(INPUT_COLOR);
                                        this.ctx.fill();
                                        this.ctx.restore();
                                    }
                                }
                                else if (container.type === RADIO) {
                                    if (container.checked) {
                                        this.ctx.save();
                                        this.ctx.beginPath();
                                        this.ctx.arc(container.bounds.left + size / 2, container.bounds.top + size / 2, size / 4, 0, Math.PI * 2, true);
                                        this.ctx.fillStyle = asString(INPUT_COLOR);
                                        this.ctx.fill();
                                        this.ctx.restore();
                                    }
                                }
                            }
                            if (isTextInputElement(container) && container.value.length) {
                                _b = this.createFontStyle(styles), fontFamily = _b[0], fontSize = _b[1];
                                baseline = this.fontMetrics.getMetrics(fontFamily, fontSize).baseline;
                                this.ctx.font = fontFamily;
                                this.ctx.fillStyle = asString(styles.color);
                                this.ctx.textBaseline = 'alphabetic';
                                this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
                                bounds = contentBox(container);
                                x = 0;
                                switch (container.styles.textAlign) {
                                    case 1 /* CENTER */:
                                        x += bounds.width / 2;
                                        break;
                                    case 2 /* RIGHT */:
                                        x += bounds.width;
                                        break;
                                }
                                textBounds = bounds.add(x, 0, 0, -bounds.height / 2 + 1);
                                this.ctx.save();
                                this.path([
                                    new Vector(bounds.left, bounds.top),
                                    new Vector(bounds.left + bounds.width, bounds.top),
                                    new Vector(bounds.left + bounds.width, bounds.top + bounds.height),
                                    new Vector(bounds.left, bounds.top + bounds.height)
                                ]);
                                this.ctx.clip();
                                this.renderTextWithLetterSpacing(new TextBounds(container.value, textBounds), styles.letterSpacing, baseline);
                                this.ctx.restore();
                                this.ctx.textBaseline = 'alphabetic';
                                this.ctx.textAlign = 'left';
                            }
                            if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
                            if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
                            img = container.styles.listStyleImage;
                            if (!(img.type === 0 /* URL */)) return [3 /*break*/, 18];
                            image = void 0;
                            url = img.url;
                            _c.label = 15;
                        case 15:
                            _c.trys.push([15, 17, , 18]);
                            return [4 /*yield*/, this.context.cache.match(url)];
                        case 16:
                            image = _c.sent();
                            this.ctx.drawImage(image, container.bounds.left - (image.width + 10), container.bounds.top);
                            return [3 /*break*/, 18];
                        case 17:
                            _c.sent();
                            this.context.logger.error("Error loading list-style-image " + url);
                            return [3 /*break*/, 18];
                        case 18: return [3 /*break*/, 20];
                        case 19:
                            if (paint.listValue && container.styles.listStyleType !== -1 /* NONE */) {
                                fontFamily = this.createFontStyle(styles)[0];
                                this.ctx.font = fontFamily;
                                this.ctx.fillStyle = asString(styles.color);
                                this.ctx.textBaseline = 'middle';
                                this.ctx.textAlign = 'right';
                                bounds = new Bounds(container.bounds.left, container.bounds.top + getAbsoluteValue(container.styles.paddingTop, container.bounds.width), container.bounds.width, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 1);
                                this.renderTextWithLetterSpacing(new TextBounds(paint.listValue, bounds), styles.letterSpacing, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 2);
                                this.ctx.textBaseline = 'bottom';
                                this.ctx.textAlign = 'left';
                            }
                            _c.label = 20;
                        case 20: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderStackContent = function (stack) {
            return __awaiter(this, void 0, void 0, function () {
                var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child;
                return __generator(this, function (_p) {
                    switch (_p.label) {
                        case 0:
                            if (contains(stack.element.container.flags, 16 /* DEBUG_RENDER */)) {
                                debugger;
                            }
                            // https://www.w3.org/TR/css-position-3/#painting-order
                            // 1. the background and borders of the element forming the stacking context.
                            return [4 /*yield*/, this.renderNodeBackgroundAndBorders(stack.element)];
                        case 1:
                            // https://www.w3.org/TR/css-position-3/#painting-order
                            // 1. the background and borders of the element forming the stacking context.
                            _p.sent();
                            _i = 0, _a = stack.negativeZIndex;
                            _p.label = 2;
                        case 2:
                            if (!(_i < _a.length)) return [3 /*break*/, 5];
                            child = _a[_i];
                            return [4 /*yield*/, this.renderStack(child)];
                        case 3:
                            _p.sent();
                            _p.label = 4;
                        case 4:
                            _i++;
                            return [3 /*break*/, 2];
                        case 5: 
                        // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
                        return [4 /*yield*/, this.renderNodeContent(stack.element)];
                        case 6:
                            // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
                            _p.sent();
                            _b = 0, _c = stack.nonInlineLevel;
                            _p.label = 7;
                        case 7:
                            if (!(_b < _c.length)) return [3 /*break*/, 10];
                            child = _c[_b];
                            return [4 /*yield*/, this.renderNode(child)];
                        case 8:
                            _p.sent();
                            _p.label = 9;
                        case 9:
                            _b++;
                            return [3 /*break*/, 7];
                        case 10:
                            _d = 0, _e = stack.nonPositionedFloats;
                            _p.label = 11;
                        case 11:
                            if (!(_d < _e.length)) return [3 /*break*/, 14];
                            child = _e[_d];
                            return [4 /*yield*/, this.renderStack(child)];
                        case 12:
                            _p.sent();
                            _p.label = 13;
                        case 13:
                            _d++;
                            return [3 /*break*/, 11];
                        case 14:
                            _f = 0, _g = stack.nonPositionedInlineLevel;
                            _p.label = 15;
                        case 15:
                            if (!(_f < _g.length)) return [3 /*break*/, 18];
                            child = _g[_f];
                            return [4 /*yield*/, this.renderStack(child)];
                        case 16:
                            _p.sent();
                            _p.label = 17;
                        case 17:
                            _f++;
                            return [3 /*break*/, 15];
                        case 18:
                            _h = 0, _j = stack.inlineLevel;
                            _p.label = 19;
                        case 19:
                            if (!(_h < _j.length)) return [3 /*break*/, 22];
                            child = _j[_h];
                            return [4 /*yield*/, this.renderNode(child)];
                        case 20:
                            _p.sent();
                            _p.label = 21;
                        case 21:
                            _h++;
                            return [3 /*break*/, 19];
                        case 22:
                            _k = 0, _l = stack.zeroOrAutoZIndexOrTransformedOrOpacity;
                            _p.label = 23;
                        case 23:
                            if (!(_k < _l.length)) return [3 /*break*/, 26];
                            child = _l[_k];
                            return [4 /*yield*/, this.renderStack(child)];
                        case 24:
                            _p.sent();
                            _p.label = 25;
                        case 25:
                            _k++;
                            return [3 /*break*/, 23];
                        case 26:
                            _m = 0, _o = stack.positiveZIndex;
                            _p.label = 27;
                        case 27:
                            if (!(_m < _o.length)) return [3 /*break*/, 30];
                            child = _o[_m];
                            return [4 /*yield*/, this.renderStack(child)];
                        case 28:
                            _p.sent();
                            _p.label = 29;
                        case 29:
                            _m++;
                            return [3 /*break*/, 27];
                        case 30: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.mask = function (paths) {
            this.ctx.beginPath();
            this.ctx.moveTo(0, 0);
            this.ctx.lineTo(this.canvas.width, 0);
            this.ctx.lineTo(this.canvas.width, this.canvas.height);
            this.ctx.lineTo(0, this.canvas.height);
            this.ctx.lineTo(0, 0);
            this.formatPath(paths.slice(0).reverse());
            this.ctx.closePath();
        };
        CanvasRenderer.prototype.path = function (paths) {
            this.ctx.beginPath();
            this.formatPath(paths);
            this.ctx.closePath();
        };
        CanvasRenderer.prototype.formatPath = function (paths) {
            var _this = this;
            paths.forEach(function (point, index) {
                var start = isBezierCurve(point) ? point.start : point;
                if (index === 0) {
                    _this.ctx.moveTo(start.x, start.y);
                }
                else {
                    _this.ctx.lineTo(start.x, start.y);
                }
                if (isBezierCurve(point)) {
                    _this.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
                }
            });
        };
        CanvasRenderer.prototype.renderRepeat = function (path, pattern, offsetX, offsetY) {
            this.path(path);
            this.ctx.fillStyle = pattern;
            this.ctx.translate(offsetX, offsetY);
            this.ctx.fill();
            this.ctx.translate(-offsetX, -offsetY);
        };
        CanvasRenderer.prototype.resizeImage = function (image, width, height) {
            var _a;
            if (image.width === width && image.height === height) {
                return image;
            }
            var ownerDocument = (_a = this.canvas.ownerDocument) !== null && _a !== void 0 ? _a : document;
            var canvas = ownerDocument.createElement('canvas');
            canvas.width = Math.max(1, width);
            canvas.height = Math.max(1, height);
            var ctx = canvas.getContext('2d');
            ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, width, height);
            return canvas;
        };
        CanvasRenderer.prototype.renderBackgroundImage = function (container) {
            return __awaiter(this, void 0, void 0, function () {
                var index, _loop_1, this_1, _i, _a, backgroundImage;
                return __generator(this, function (_b) {
                    switch (_b.label) {
                        case 0:
                            index = container.styles.backgroundImage.length - 1;
                            _loop_1 = function (backgroundImage) {
                                var image, url, _c, path, x, y, width, height, pattern, _d, path, x, y, width, height, _e, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _f, path, left, top_1, width, height, position, x, y, _g, rx, ry, radialGradient_1, midX, midY, f, invF;
                                return __generator(this, function (_h) {
                                    switch (_h.label) {
                                        case 0:
                                            if (!(backgroundImage.type === 0 /* URL */)) return [3 /*break*/, 5];
                                            image = void 0;
                                            url = backgroundImage.url;
                                            _h.label = 1;
                                        case 1:
                                            _h.trys.push([1, 3, , 4]);
                                            return [4 /*yield*/, this_1.context.cache.match(url)];
                                        case 2:
                                            image = _h.sent();
                                            return [3 /*break*/, 4];
                                        case 3:
                                            _h.sent();
                                            this_1.context.logger.error("Error loading background-image " + url);
                                            return [3 /*break*/, 4];
                                        case 4:
                                            if (image) {
                                                _c = calculateBackgroundRendering(container, index, [
                                                    image.width,
                                                    image.height,
                                                    image.width / image.height
                                                ]), path = _c[0], x = _c[1], y = _c[2], width = _c[3], height = _c[4];
                                                pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
                                                this_1.renderRepeat(path, pattern, x, y);
                                            }
                                            return [3 /*break*/, 6];
                                        case 5:
                                            if (isLinearGradient(backgroundImage)) {
                                                _d = calculateBackgroundRendering(container, index, [null, null, null]), path = _d[0], x = _d[1], y = _d[2], width = _d[3], height = _d[4];
                                                _e = calculateGradientDirection(backgroundImage.angle, width, height), lineLength = _e[0], x0 = _e[1], x1 = _e[2], y0 = _e[3], y1 = _e[4];
                                                canvas = document.createElement('canvas');
                                                canvas.width = width;
                                                canvas.height = height;
                                                ctx = canvas.getContext('2d');
                                                gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
                                                processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) {
                                                    return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
                                                });
                                                ctx.fillStyle = gradient_1;
                                                ctx.fillRect(0, 0, width, height);
                                                if (width > 0 && height > 0) {
                                                    pattern = this_1.ctx.createPattern(canvas, 'repeat');
                                                    this_1.renderRepeat(path, pattern, x, y);
                                                }
                                            }
                                            else if (isRadialGradient(backgroundImage)) {
                                                _f = calculateBackgroundRendering(container, index, [
                                                    null,
                                                    null,
                                                    null
                                                ]), path = _f[0], left = _f[1], top_1 = _f[2], width = _f[3], height = _f[4];
                                                position = backgroundImage.position.length === 0 ? [FIFTY_PERCENT] : backgroundImage.position;
                                                x = getAbsoluteValue(position[0], width);
                                                y = getAbsoluteValue(position[position.length - 1], height);
                                                _g = calculateRadius(backgroundImage, x, y, width, height), rx = _g[0], ry = _g[1];
                                                if (rx > 0 && ry > 0) {
                                                    radialGradient_1 = this_1.ctx.createRadialGradient(left + x, top_1 + y, 0, left + x, top_1 + y, rx);
                                                    processColorStops(backgroundImage.stops, rx * 2).forEach(function (colorStop) {
                                                        return radialGradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
                                                    });
                                                    this_1.path(path);
                                                    this_1.ctx.fillStyle = radialGradient_1;
                                                    if (rx !== ry) {
                                                        midX = container.bounds.left + 0.5 * container.bounds.width;
                                                        midY = container.bounds.top + 0.5 * container.bounds.height;
                                                        f = ry / rx;
                                                        invF = 1 / f;
                                                        this_1.ctx.save();
                                                        this_1.ctx.translate(midX, midY);
                                                        this_1.ctx.transform(1, 0, 0, f, 0, 0);
                                                        this_1.ctx.translate(-midX, -midY);
                                                        this_1.ctx.fillRect(left, invF * (top_1 - midY) + midY, width, height * invF);
                                                        this_1.ctx.restore();
                                                    }
                                                    else {
                                                        this_1.ctx.fill();
                                                    }
                                                }
                                            }
                                            _h.label = 6;
                                        case 6:
                                            index--;
                                            return [2 /*return*/];
                                    }
                                });
                            };
                            this_1 = this;
                            _i = 0, _a = container.styles.backgroundImage.slice(0).reverse();
                            _b.label = 1;
                        case 1:
                            if (!(_i < _a.length)) return [3 /*break*/, 4];
                            backgroundImage = _a[_i];
                            return [5 /*yield**/, _loop_1(backgroundImage)];
                        case 2:
                            _b.sent();
                            _b.label = 3;
                        case 3:
                            _i++;
                            return [3 /*break*/, 1];
                        case 4: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderSolidBorder = function (color, side, curvePoints) {
            return __awaiter(this, void 0, void 0, function () {
                return __generator(this, function (_a) {
                    this.path(parsePathForBorder(curvePoints, side));
                    this.ctx.fillStyle = asString(color);
                    this.ctx.fill();
                    return [2 /*return*/];
                });
            });
        };
        CanvasRenderer.prototype.renderDoubleBorder = function (color, width, side, curvePoints) {
            return __awaiter(this, void 0, void 0, function () {
                var outerPaths, innerPaths;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            if (!(width < 3)) return [3 /*break*/, 2];
                            return [4 /*yield*/, this.renderSolidBorder(color, side, curvePoints)];
                        case 1:
                            _a.sent();
                            return [2 /*return*/];
                        case 2:
                            outerPaths = parsePathForBorderDoubleOuter(curvePoints, side);
                            this.path(outerPaths);
                            this.ctx.fillStyle = asString(color);
                            this.ctx.fill();
                            innerPaths = parsePathForBorderDoubleInner(curvePoints, side);
                            this.path(innerPaths);
                            this.ctx.fill();
                            return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderNodeBackgroundAndBorders = function (paint) {
            return __awaiter(this, void 0, void 0, function () {
                var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border;
                var _this = this;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            this.applyEffects(paint.getEffects(2 /* BACKGROUND_BORDERS */));
                            styles = paint.container.styles;
                            hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
                            borders = [
                                { style: styles.borderTopStyle, color: styles.borderTopColor, width: styles.borderTopWidth },
                                { style: styles.borderRightStyle, color: styles.borderRightColor, width: styles.borderRightWidth },
                                { style: styles.borderBottomStyle, color: styles.borderBottomColor, width: styles.borderBottomWidth },
                                { style: styles.borderLeftStyle, color: styles.borderLeftColor, width: styles.borderLeftWidth }
                            ];
                            backgroundPaintingArea = calculateBackgroundCurvedPaintingArea(getBackgroundValueForIndex(styles.backgroundClip, 0), paint.curves);
                            if (!(hasBackground || styles.boxShadow.length)) return [3 /*break*/, 2];
                            this.ctx.save();
                            this.path(backgroundPaintingArea);
                            this.ctx.clip();
                            if (!isTransparent(styles.backgroundColor)) {
                                this.ctx.fillStyle = asString(styles.backgroundColor);
                                this.ctx.fill();
                            }
                            return [4 /*yield*/, this.renderBackgroundImage(paint.container)];
                        case 1:
                            _a.sent();
                            this.ctx.restore();
                            styles.boxShadow
                                .slice(0)
                                .reverse()
                                .forEach(function (shadow) {
                                _this.ctx.save();
                                var borderBoxArea = calculateBorderBoxPath(paint.curves);
                                var maskOffset = shadow.inset ? 0 : MASK_OFFSET;
                                var shadowPaintingArea = transformPath(borderBoxArea, -maskOffset + (shadow.inset ? 1 : -1) * shadow.spread.number, (shadow.inset ? 1 : -1) * shadow.spread.number, shadow.spread.number * (shadow.inset ? -2 : 2), shadow.spread.number * (shadow.inset ? -2 : 2));
                                if (shadow.inset) {
                                    _this.path(borderBoxArea);
                                    _this.ctx.clip();
                                    _this.mask(shadowPaintingArea);
                                }
                                else {
                                    _this.mask(borderBoxArea);
                                    _this.ctx.clip();
                                    _this.path(shadowPaintingArea);
                                }
                                _this.ctx.shadowOffsetX = shadow.offsetX.number + maskOffset;
                                _this.ctx.shadowOffsetY = shadow.offsetY.number;
                                _this.ctx.shadowColor = asString(shadow.color);
                                _this.ctx.shadowBlur = shadow.blur.number;
                                _this.ctx.fillStyle = shadow.inset ? asString(shadow.color) : 'rgba(0,0,0,1)';
                                _this.ctx.fill();
                                _this.ctx.restore();
                            });
                            _a.label = 2;
                        case 2:
                            side = 0;
                            _i = 0, borders_1 = borders;
                            _a.label = 3;
                        case 3:
                            if (!(_i < borders_1.length)) return [3 /*break*/, 13];
                            border = borders_1[_i];
                            if (!(border.style !== 0 /* NONE */ && !isTransparent(border.color) && border.width > 0)) return [3 /*break*/, 11];
                            if (!(border.style === 2 /* DASHED */)) return [3 /*break*/, 5];
                            return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 2 /* DASHED */)];
                        case 4:
                            _a.sent();
                            return [3 /*break*/, 11];
                        case 5:
                            if (!(border.style === 3 /* DOTTED */)) return [3 /*break*/, 7];
                            return [4 /*yield*/, this.renderDashedDottedBorder(border.color, border.width, side, paint.curves, 3 /* DOTTED */)];
                        case 6:
                            _a.sent();
                            return [3 /*break*/, 11];
                        case 7:
                            if (!(border.style === 4 /* DOUBLE */)) return [3 /*break*/, 9];
                            return [4 /*yield*/, this.renderDoubleBorder(border.color, border.width, side, paint.curves)];
                        case 8:
                            _a.sent();
                            return [3 /*break*/, 11];
                        case 9: return [4 /*yield*/, this.renderSolidBorder(border.color, side, paint.curves)];
                        case 10:
                            _a.sent();
                            _a.label = 11;
                        case 11:
                            side++;
                            _a.label = 12;
                        case 12:
                            _i++;
                            return [3 /*break*/, 3];
                        case 13: return [2 /*return*/];
                    }
                });
            });
        };
        CanvasRenderer.prototype.renderDashedDottedBorder = function (color, width, side, curvePoints, style) {
            return __awaiter(this, void 0, void 0, function () {
                var strokePaths, boxPaths, startX, startY, endX, endY, length, dashLength, spaceLength, useLineDash, multiplier, numberOfDashes, minSpace, maxSpace, path1, path2, path1, path2;
                return __generator(this, function (_a) {
                    this.ctx.save();
                    strokePaths = parsePathForBorderStroke(curvePoints, side);
                    boxPaths = parsePathForBorder(curvePoints, side);
                    if (style === 2 /* DASHED */) {
                        this.path(boxPaths);
                        this.ctx.clip();
                    }
                    if (isBezierCurve(boxPaths[0])) {
                        startX = boxPaths[0].start.x;
                        startY = boxPaths[0].start.y;
                    }
                    else {
                        startX = boxPaths[0].x;
                        startY = boxPaths[0].y;
                    }
                    if (isBezierCurve(boxPaths[1])) {
                        endX = boxPaths[1].end.x;
                        endY = boxPaths[1].end.y;
                    }
                    else {
                        endX = boxPaths[1].x;
                        endY = boxPaths[1].y;
                    }
                    if (side === 0 || side === 2) {
                        length = Math.abs(startX - endX);
                    }
                    else {
                        length = Math.abs(startY - endY);
                    }
                    this.ctx.beginPath();
                    if (style === 3 /* DOTTED */) {
                        this.formatPath(strokePaths);
                    }
                    else {
                        this.formatPath(boxPaths.slice(0, 2));
                    }
                    dashLength = width < 3 ? width * 3 : width * 2;
                    spaceLength = width < 3 ? width * 2 : width;
                    if (style === 3 /* DOTTED */) {
                        dashLength = width;
                        spaceLength = width;
                    }
                    useLineDash = true;
                    if (length <= dashLength * 2) {
                        useLineDash = false;
                    }
                    else if (length <= dashLength * 2 + spaceLength) {
                        multiplier = length / (2 * dashLength + spaceLength);
                        dashLength *= multiplier;
                        spaceLength *= multiplier;
                    }
                    else {
                        numberOfDashes = Math.floor((length + spaceLength) / (dashLength + spaceLength));
                        minSpace = (length - numberOfDashes * dashLength) / (numberOfDashes - 1);
                        maxSpace = (length - (numberOfDashes + 1) * dashLength) / numberOfDashes;
                        spaceLength =
                            maxSpace <= 0 || Math.abs(spaceLength - minSpace) < Math.abs(spaceLength - maxSpace)
                                ? minSpace
                                : maxSpace;
                    }
                    if (useLineDash) {
                        if (style === 3 /* DOTTED */) {
                            this.ctx.setLineDash([0, dashLength + spaceLength]);
                        }
                        else {
                            this.ctx.setLineDash([dashLength, spaceLength]);
                        }
                    }
                    if (style === 3 /* DOTTED */) {
                        this.ctx.lineCap = 'round';
                        this.ctx.lineWidth = width;
                    }
                    else {
                        this.ctx.lineWidth = width * 2 + 1.1;
                    }
                    this.ctx.strokeStyle = asString(color);
                    this.ctx.stroke();
                    this.ctx.setLineDash([]);
                    // dashed round edge gap
                    if (style === 2 /* DASHED */) {
                        if (isBezierCurve(boxPaths[0])) {
                            path1 = boxPaths[3];
                            path2 = boxPaths[0];
                            this.ctx.beginPath();
                            this.formatPath([new Vector(path1.end.x, path1.end.y), new Vector(path2.start.x, path2.start.y)]);
                            this.ctx.stroke();
                        }
                        if (isBezierCurve(boxPaths[1])) {
                            path1 = boxPaths[1];
                            path2 = boxPaths[2];
                            this.ctx.beginPath();
                            this.formatPath([new Vector(path1.end.x, path1.end.y), new Vector(path2.start.x, path2.start.y)]);
                            this.ctx.stroke();
                        }
                    }
                    this.ctx.restore();
                    return [2 /*return*/];
                });
            });
        };
        CanvasRenderer.prototype.render = function (element) {
            return __awaiter(this, void 0, void 0, function () {
                var stack;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            if (this.options.backgroundColor) {
                                this.ctx.fillStyle = asString(this.options.backgroundColor);
                                this.ctx.fillRect(this.options.x, this.options.y, this.options.width, this.options.height);
                            }
                            stack = parseStackingContexts(element);
                            return [4 /*yield*/, this.renderStack(stack)];
                        case 1:
                            _a.sent();
                            this.applyEffects([]);
                            return [2 /*return*/, this.canvas];
                    }
                });
            });
        };
        return CanvasRenderer;
    }(Renderer));
    var isTextInputElement = function (container) {
        if (container instanceof TextareaElementContainer) {
            return true;
        }
        else if (container instanceof SelectElementContainer) {
            return true;
        }
        else if (container instanceof InputElementContainer && container.type !== RADIO && container.type !== CHECKBOX) {
            return true;
        }
        return false;
    };
    var calculateBackgroundCurvedPaintingArea = function (clip, curves) {
        switch (clip) {
            case 0 /* BORDER_BOX */:
                return calculateBorderBoxPath(curves);
            case 2 /* CONTENT_BOX */:
                return calculateContentBoxPath(curves);
            case 1 /* PADDING_BOX */:
            default:
                return calculatePaddingBoxPath(curves);
        }
    };
    var canvasTextAlign = function (textAlign) {
        switch (textAlign) {
            case 1 /* CENTER */:
                return 'center';
            case 2 /* RIGHT */:
                return 'right';
            case 0 /* LEFT */:
            default:
                return 'left';
        }
    };
    // see https://github.com/niklasvh/html2canvas/pull/2645
    var iOSBrokenFonts = ['-apple-system', 'system-ui'];
    var fixIOSSystemFonts = function (fontFamilies) {
        return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent)
            ? fontFamilies.filter(function (fontFamily) { return iOSBrokenFonts.indexOf(fontFamily) === -1; })
            : fontFamilies;
    };

    var ForeignObjectRenderer = /** @class */ (function (_super) {
        __extends(ForeignObjectRenderer, _super);
        function ForeignObjectRenderer(context, options) {
            var _this = _super.call(this, context, options) || this;
            _this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
            _this.ctx = _this.canvas.getContext('2d');
            _this.options = options;
            _this.canvas.width = Math.floor(options.width * options.scale);
            _this.canvas.height = Math.floor(options.height * options.scale);
            _this.canvas.style.width = options.width + "px";
            _this.canvas.style.height = options.height + "px";
            _this.ctx.scale(_this.options.scale, _this.options.scale);
            _this.ctx.translate(-options.x, -options.y);
            _this.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
            return _this;
        }
        ForeignObjectRenderer.prototype.render = function (element) {
            return __awaiter(this, void 0, void 0, function () {
                var svg, img;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            svg = createForeignObjectSVG(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, element);
                            return [4 /*yield*/, loadSerializedSVG(svg)];
                        case 1:
                            img = _a.sent();
                            if (this.options.backgroundColor) {
                                this.ctx.fillStyle = asString(this.options.backgroundColor);
                                this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale);
                            }
                            this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale);
                            return [2 /*return*/, this.canvas];
                    }
                });
            });
        };
        return ForeignObjectRenderer;
    }(Renderer));
    var loadSerializedSVG = function (svg) {
        return new Promise(function (resolve, reject) {
            var img = new Image();
            img.onload = function () {
                resolve(img);
            };
            img.onerror = reject;
            img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
        });
    };

    var Logger = /** @class */ (function () {
        function Logger(_a) {
            var id = _a.id, enabled = _a.enabled;
            this.id = id;
            this.enabled = enabled;
            this.start = Date.now();
        }
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Logger.prototype.debug = function () {
            var args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                args[_i] = arguments[_i];
            }
            if (this.enabled) {
                // eslint-disable-next-line no-console
                if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
                    // eslint-disable-next-line no-console
                    console.debug.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
                }
                else {
                    this.info.apply(this, args);
                }
            }
        };
        Logger.prototype.getTime = function () {
            return Date.now() - this.start;
        };
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Logger.prototype.info = function () {
            var args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                args[_i] = arguments[_i];
            }
            if (this.enabled) {
                // eslint-disable-next-line no-console
                if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
                    // eslint-disable-next-line no-console
                    console.info.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
                }
            }
        };
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Logger.prototype.warn = function () {
            var args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                args[_i] = arguments[_i];
            }
            if (this.enabled) {
                // eslint-disable-next-line no-console
                if (typeof window !== 'undefined' && window.console && typeof console.warn === 'function') {
                    // eslint-disable-next-line no-console
                    console.warn.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
                }
                else {
                    this.info.apply(this, args);
                }
            }
        };
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        Logger.prototype.error = function () {
            var args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                args[_i] = arguments[_i];
            }
            if (this.enabled) {
                // eslint-disable-next-line no-console
                if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
                    // eslint-disable-next-line no-console
                    console.error.apply(console, __spreadArray([this.id, this.getTime() + "ms"], args));
                }
                else {
                    this.info.apply(this, args);
                }
            }
        };
        Logger.instances = {};
        return Logger;
    }());

    var Context = /** @class */ (function () {
        function Context(options, windowBounds) {
            var _a;
            this.windowBounds = windowBounds;
            this.instanceName = "#" + Context.instanceCount++;
            this.logger = new Logger({ id: this.instanceName, enabled: options.logging });
            this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options);
        }
        Context.instanceCount = 1;
        return Context;
    }());

    var html2canvas = function (element, options) {
        if (options === void 0) { options = {}; }
        return renderElement(element, options);
    };
    if (typeof window !== 'undefined') {
        CacheStorage.setContext(window);
    }
    var renderElement = function (element, opts) { return __awaiter(void 0, void 0, void 0, function () {
        var ownerDocument, defaultView, resourceOptions, contextOptions, windowOptions, windowBounds, context, foreignObjectRendering, cloneOptions, documentCloner, clonedElement, container, _a, width, height, left, top, backgroundColor, renderOptions, canvas, renderer, root, renderer;
        var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
        return __generator(this, function (_u) {
            switch (_u.label) {
                case 0:
                    if (!element || typeof element !== 'object') {
                        return [2 /*return*/, Promise.reject('Invalid element provided as first argument')];
                    }
                    ownerDocument = element.ownerDocument;
                    if (!ownerDocument) {
                        throw new Error("Element is not attached to a Document");
                    }
                    defaultView = ownerDocument.defaultView;
                    if (!defaultView) {
                        throw new Error("Document is not attached to a Window");
                    }
                    resourceOptions = {
                        allowTaint: (_b = opts.allowTaint) !== null && _b !== void 0 ? _b : false,
                        imageTimeout: (_c = opts.imageTimeout) !== null && _c !== void 0 ? _c : 15000,
                        proxy: opts.proxy,
                        useCORS: (_d = opts.useCORS) !== null && _d !== void 0 ? _d : false
                    };
                    contextOptions = __assign({ logging: (_e = opts.logging) !== null && _e !== void 0 ? _e : true, cache: opts.cache }, resourceOptions);
                    windowOptions = {
                        windowWidth: (_f = opts.windowWidth) !== null && _f !== void 0 ? _f : defaultView.innerWidth,
                        windowHeight: (_g = opts.windowHeight) !== null && _g !== void 0 ? _g : defaultView.innerHeight,
                        scrollX: (_h = opts.scrollX) !== null && _h !== void 0 ? _h : defaultView.pageXOffset,
                        scrollY: (_j = opts.scrollY) !== null && _j !== void 0 ? _j : defaultView.pageYOffset
                    };
                    windowBounds = new Bounds(windowOptions.scrollX, windowOptions.scrollY, windowOptions.windowWidth, windowOptions.windowHeight);
                    context = new Context(contextOptions, windowBounds);
                    foreignObjectRendering = (_k = opts.foreignObjectRendering) !== null && _k !== void 0 ? _k : false;
                    cloneOptions = {
                        allowTaint: (_l = opts.allowTaint) !== null && _l !== void 0 ? _l : false,
                        onclone: opts.onclone,
                        ignoreElements: opts.ignoreElements,
                        inlineImages: foreignObjectRendering,
                        copyStyles: foreignObjectRendering
                    };
                    context.logger.debug("Starting document clone with size " + windowBounds.width + "x" + windowBounds.height + " scrolled to " + -windowBounds.left + "," + -windowBounds.top);
                    documentCloner = new DocumentCloner(context, element, cloneOptions);
                    clonedElement = documentCloner.clonedReferenceElement;
                    if (!clonedElement) {
                        return [2 /*return*/, Promise.reject("Unable to find element in cloned iframe")];
                    }
                    return [4 /*yield*/, documentCloner.toIFrame(ownerDocument, windowBounds)];
                case 1:
                    container = _u.sent();
                    _a = isBodyElement(clonedElement) || isHTMLElement(clonedElement)
                        ? parseDocumentSize(clonedElement.ownerDocument)
                        : parseBounds(context, clonedElement), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
                    backgroundColor = parseBackgroundColor(context, clonedElement, opts.backgroundColor);
                    renderOptions = {
                        canvas: opts.canvas,
                        backgroundColor: backgroundColor,
                        scale: (_o = (_m = opts.scale) !== null && _m !== void 0 ? _m : defaultView.devicePixelRatio) !== null && _o !== void 0 ? _o : 1,
                        x: ((_p = opts.x) !== null && _p !== void 0 ? _p : 0) + left,
                        y: ((_q = opts.y) !== null && _q !== void 0 ? _q : 0) + top,
                        width: (_r = opts.width) !== null && _r !== void 0 ? _r : Math.ceil(width),
                        height: (_s = opts.height) !== null && _s !== void 0 ? _s : Math.ceil(height)
                    };
                    if (!foreignObjectRendering) return [3 /*break*/, 3];
                    context.logger.debug("Document cloned, using foreign object rendering");
                    renderer = new ForeignObjectRenderer(context, renderOptions);
                    return [4 /*yield*/, renderer.render(clonedElement)];
                case 2:
                    canvas = _u.sent();
                    return [3 /*break*/, 5];
                case 3:
                    context.logger.debug("Document cloned, element located at " + left + "," + top + " with size " + width + "x" + height + " using computed rendering");
                    context.logger.debug("Starting DOM parsing");
                    root = parseTree(context, clonedElement);
                    if (backgroundColor === root.styles.backgroundColor) {
                        root.styles.backgroundColor = COLORS.TRANSPARENT;
                    }
                    context.logger.debug("Starting renderer for element at " + renderOptions.x + "," + renderOptions.y + " with size " + renderOptions.width + "x" + renderOptions.height);
                    renderer = new CanvasRenderer(context, renderOptions);
                    return [4 /*yield*/, renderer.render(root)];
                case 4:
                    canvas = _u.sent();
                    _u.label = 5;
                case 5:
                    if ((_t = opts.removeContainer) !== null && _t !== void 0 ? _t : true) {
                        if (!DocumentCloner.destroy(container)) {
                            context.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore");
                        }
                    }
                    context.logger.debug("Finished rendering");
                    return [2 /*return*/, canvas];
            }
        });
    }); };
    var parseBackgroundColor = function (context, element, backgroundColorOverride) {
        var ownerDocument = element.ownerDocument;
        // http://www.w3.org/TR/css3-background/#special-backgrounds
        var documentBackgroundColor = ownerDocument.documentElement
            ? parseColor(context, getComputedStyle(ownerDocument.documentElement).backgroundColor)
            : COLORS.TRANSPARENT;
        var bodyBackgroundColor = ownerDocument.body
            ? parseColor(context, getComputedStyle(ownerDocument.body).backgroundColor)
            : COLORS.TRANSPARENT;
        var defaultBackgroundColor = typeof backgroundColorOverride === 'string'
            ? parseColor(context, backgroundColorOverride)
            : backgroundColorOverride === null
                ? COLORS.TRANSPARENT
                : 0xffffffff;
        return element === ownerDocument.documentElement
            ? isTransparent(documentBackgroundColor)
                ? isTransparent(bodyBackgroundColor)
                    ? defaultBackgroundColor
                    : bodyBackgroundColor
                : documentBackgroundColor
            : defaultBackgroundColor;
    };

    return html2canvas;

})));
//# sourceMappingURL=html2canvas.js.map


/***/ }),

/***/ "c8ba":
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || new Function("return this")();
} catch (e) {
	// This works if the window reference is available
	if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),

/***/ "e6ce":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXTERNAL MODULE: ./node_modules/html2canvas/dist/html2canvas.js
var html2canvas = __webpack_require__("c0e9");

// CONCATENATED MODULE: ./src/content/ipiContent.js
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/* harmony default export */ var ipiContent = ({
  // 百分比颜色
  regColor: [{
    class: 'text-color-red',
    color: 'red'
  }, {
    class: 'text-color-dark-green',
    color: 'dark-green'
  }, {
    class: 'text-color-light-green',
    color: 'light-green'
  }, {
    class: 'text-color-yellow',
    color: 'yellow'
  }],
  // 需要抓取的节点
  nodes: [{
    type: 'ipi',
    query: '#index-section #index-popover span',
    require: true
  }, // 冗余库存率
  {
    type: 'excess_inventory_rate',
    query: '#excess-inventory-widget #percentage .kpi-percentage'
  }, {
    type: 'excess_inventory_color',
    query: '#excess-inventory-widget #percentage',
    contentType: 'className'
  }, // 售出率
  {
    type: 'sell_through_rate',
    query: '#sell-through-widget #percentage .kpi-percentage'
  }, {
    type: 'sell_through_color',
    query: '#sell-through-widget #percentage',
    contentType: 'className'
  }, // 无在售信息的库存率
  {
    type: 'stranded_inventory_rate',
    query: '#stranded-inventory-widget #percentage .kpi-percentage'
  }, {
    type: 'stranded_inventory_color',
    query: '#stranded-inventory-widget #percentage',
    contentType: 'className'
  }, // 有存货库存率
  {
    type: 'in_stock_rate',
    query: '#instock-inventory-widget #percentage .kpi-percentage'
  }, {
    type: 'in_stock_color',
    query: '#instock-inventory-widget #percentage',
    contentType: 'className'
  }, {
    type: 'sub_items',
    dataType: 'array',
    children: [[{
      type: 'storage_type',
      query: '#storage-monitor-content #sortable-storage-quantity-component .toggle-active',
      // 兼容日本新节点
      newQuery: '#storage-monitor-content #sortable-storage-component .toggle-active'
    }, {
      type: 'qty_stock_max',
      query: '#storage-monitor-content #sortable-storage-quantity-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'qty_stock_used',
      query: '#storage-monitor-content #sortable-storage-quantity-component .storage-detail .a-histogram-row td:nth-child(2) span'
    }, {
      type: 'vol_stock_max',
      query: '#volume-only-monitor-content #sortable-storage-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'vol_stock_used',
      query: '#volume-only-monitor-content #sortable-storage-component .current-utilization-detail'
    }], [{
      type: 'storage_type',
      query: '#storage-monitor-content #non_sortable-storage-quantity-component .toggle-active',
      newQuery: '#storage-monitor-content #non_sortable-storage-component .toggle-active'
    }, {
      type: 'qty_stock_max',
      query: '#storage-monitor-content #non_sortable-storage-quantity-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'qty_stock_used',
      query: '#storage-monitor-content #non_sortable-storage-quantity-component .storage-detail .a-histogram-row td:nth-child(2) span'
    }, {
      type: 'vol_stock_max',
      query: '#volume-only-monitor-content #non_sortable-storage-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'vol_stock_used',
      query: '#volume-only-monitor-content #non_sortable-storage-component .current-utilization-detail'
    }], [{
      type: 'storage_type',
      query: '#storage-monitor-content #apparel-storage-quantity-component .toggle-active',
      newQuery: '#storage-monitor-content #apparel-storage-component .toggle-active'
    }, {
      type: 'qty_stock_max',
      query: '#storage-monitor-content #apparel-storage-quantity-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'qty_stock_used',
      query: '#storage-monitor-content #apparel-storage-quantity-component .storage-detail .a-histogram-row td:nth-child(2) span'
    }, {
      type: 'vol_stock_max',
      query: '#volume-only-monitor-content #apparel-storage-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'vol_stock_used',
      query: '#volume-only-monitor-content #apparel-storage-component .current-utilization-detail'
    }], [{
      type: 'storage_type',
      query: '#storage-monitor-content #footwear-storage-quantity-component .toggle-active',
      newQuery: '#storage-monitor-content #footwear-storage-component .toggle-active'
    }, {
      type: 'qty_stock_max',
      query: '#storage-monitor-content #footwear-storage-quantity-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'qty_stock_used',
      query: '#storage-monitor-content #footwear-storage-quantity-component .storage-detail .a-histogram-row td:nth-child(2) span'
    }, {
      type: 'vol_stock_max',
      query: '#volume-only-monitor-content #footwear-storage-component .storage-detail .a-histogram-row:nth-child(2) td:nth-child(2) span'
    }, {
      type: 'vol_stock_used',
      query: '#volume-only-monitor-content #footwear-storage-component .current-utilization-detail'
    }]]
  }],

  /**
   * @description 抓取ipi
   */
  waitIpiPage: function waitIpiPage() {
    var _this = this;

    return new Promise(function (resolve) {
      var maxCount = 10;
      var count = 0;
      var timer = setInterval(function () {
        var data = _this.getDomText();

        if (data) {
          resolve({
            code: 666,
            data: _objectSpread({
              type: 0
            }, data)
          });
        } else if (count > maxCount) {
          resolve({
            code: 13
          });
        } else {
          count++;
          return;
        }

        clearInterval(timer);
      }, 2000);
    });
  },

  /**
   * @description 循环获取节点元素
   */
  getDomText: function getDomText() {
    var _this2 = this;

    var param = {};

    var _iterator = _createForOfIteratorHelper(this.nodes),
        _step;

    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var node = _step.value;

        try {
          // 抓取补货限制、仓储容量
          if (node.dataType === 'array') {
            var subItems = param[node.type] = [];

            var _iterator2 = _createForOfIteratorHelper(node.children),
                _step2;

            try {
              for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
                var subItem = _step2.value;
                var obj = {};
                subItems.push(obj);

                var _iterator3 = _createForOfIteratorHelper(subItem),
                    _step3;

                try {
                  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
                    var item = _step3.value;
                    var type = item.type;
                    obj[type] = document.querySelector(item.query) || document.querySelector(item.newQuery); // 如果该项必须获取，但是获取值为空，则返回false

                    if (item.require && !obj[type]) return false; // 获取文本内容

                    obj[type] = obj[type] && obj[type][item.contentType || 'innerText'];
                  }
                } catch (err) {
                  _iterator3.e(err);
                } finally {
                  _iterator3.f();
                }
              }
            } catch (err) {
              _iterator2.e(err);
            } finally {
              _iterator2.f();
            }
          } else {
            var _ret = function () {
              var type = node.type;
              param[type] = document.querySelector(node.query);

              if (!param[type]) {
                // 如果该项必须获取，但是获取值为空，则返回false
                if (node.require) return {
                  v: false
                };
                return "continue";
              } // 获取颜色


              if (node.contentType === 'className') {
                param[type] = param[type].className;

                var colorInfo = _this2.regColor.find(function (item) {
                  return param[type].indexOf(item.class) !== -1;
                });

                param[type] = colorInfo ? colorInfo.color : param[type];
              } else {
                // 获取文本内容
                param[type] = param[type].innerText;
              }
            }();

            if (_ret === "continue") continue;
            if (_typeof(_ret) === "object") return _ret.v;
          }
        } catch (e) {
          param[node.type] = null;
        }
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }

    return param;
  }
});
// EXTERNAL MODULE: ./src/platform/tiktok/xGnarly/webmssdk.js
var webmssdk = __webpack_require__("7762");

// CONCATENATED MODULE: ./src/platform/tiktok/xGnarly/xGnarlySignerScript.js
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == xGnarlySignerScript_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

function xGnarlySignerScript_typeof(obj) { "@babel/helpers - typeof"; return xGnarlySignerScript_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, xGnarlySignerScript_typeof(obj); }


function injectXGnarlySignerScript() {
  Object(webmssdk["a" /* default */])(); // 等待 __tsign 加载完成

  function waitForTSign(callback) {
    var maxAttempts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
    var attempts = 0;

    var check = function check() {
      attempts++;

      if (window.__tsign && window.__tsign.u && window.__tsign.u[870] && window.__tsign.u[871]) {
        console.log('[AK-TikTok] __tsign loaded successfully');
        callback();
      } else if (attempts < maxAttempts) {
        setTimeout(check, 100);
      } else {
        console.error('[AK-TikTok] __tsign not found after', maxAttempts * 100, 'ms');
      }
    };

    check();
  } // 签名服务


  var TikTokSigner = {
    /**
     * 生成 X-Bogus
     */
    generateXBogus: function generateXBogus(params) {
      try {
        if (!window.__tsign || !window.__tsign.u[870] || !window.__tsign.u[870].v) {
          throw new Error('X-Bogus function not found');
        }

        return window.__tsign.u[870].v(params, undefined);
      } catch (error) {
        console.error('[AK-TikTok] generateXBogus error:', error);
        throw error;
      }
    },

    /**
     * 生成 X-Gnarly
     */
    generateXGnarly: function generateXGnarly(params) {
      var body = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';

      try {
        if (!window.__tsign || !window.__tsign.u[871] || !window.__tsign.u[871].v) {
          throw new Error('X-Gnarly function not found');
        }

        var bodyStr = xGnarlySignerScript_typeof(body) === 'object' ? JSON.stringify(body) : body;
        return window.__tsign.u[871].v(params, bodyStr || '');
      } catch (error) {
        console.error('[AK-TikTok] generateXGnarly error:', error);
        throw error;
      }
    },

    /**
     * 完整签名生成
     */
    sign: function sign(url) {
      var body = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
      var splited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

      try {
        var urlObj = new URL(url);
        var params = urlObj.search.slice(1);

        if (!params) {
          throw new Error('URL parameters are required');
        }

        var xBogus = this.generateXBogus(params);
        var xGnarly = this.generateXGnarly(params, body);

        if (splited) {
          return {
            signedUrl: "".concat(url, "&X-Bogus=").concat(xBogus, "&X-Gnarly=").concat(xGnarly),
            xBogus: xBogus,
            xGnarly: xGnarly,
            params: params
          };
        }

        return "".concat(url, "&X-Bogus=").concat(xBogus, "&X-Gnarly=").concat(xGnarly);
      } catch (error) {
        console.error('[AK-TikTok] sign error:', error);
        throw error;
      }
    },

    /**
     * 获取浏览器信息
     */
    getNavigatorInfo: function getNavigatorInfo() {
      return {
        deviceScaleFactor: window.devicePixelRatio || 1,
        userAgent: navigator.userAgent,
        browser_language: navigator.language,
        browser_platform: navigator.platform,
        browser_name: navigator.appCodeName,
        browser_version: navigator.appVersion,
        screen_width: screen.width,
        screen_height: screen.height,
        viewport_width: window.innerWidth,
        viewport_height: window.innerHeight
      };
    }
  }; // 监听来自 Content Script 的消息

  window.addEventListener('message', /*#__PURE__*/function () {
    var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
      var _event$data, requestId, action, url, body, splited, result, urlObj1, params1, urlObj2, params2;

      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              if (!(event.source !== window)) {
                _context.next = 2;
                break;
              }

              return _context.abrupt("return");

            case 2:
              if (!(!event.data || event.data.type !== 'AK_TIKTOK_SIGN_REQUEST')) {
                _context.next = 4;
                break;
              }

              return _context.abrupt("return");

            case 4:
              _event$data = event.data, requestId = _event$data.requestId, action = _event$data.action, url = _event$data.url, body = _event$data.body, splited = _event$data.splited;
              _context.prev = 5;
              _context.t0 = action;
              _context.next = _context.t0 === 'sign' ? 9 : _context.t0 === 'xbogus' ? 11 : _context.t0 === 'xgnarly' ? 15 : _context.t0 === 'navigator' ? 19 : 21;
              break;

            case 9:
              result = TikTokSigner.sign(url, body, splited);
              return _context.abrupt("break", 22);

            case 11:
              urlObj1 = new URL(url);
              params1 = urlObj1.search.slice(1);
              result = TikTokSigner.generateXBogus(params1);
              return _context.abrupt("break", 22);

            case 15:
              urlObj2 = new URL(url);
              params2 = urlObj2.search.slice(1);
              result = TikTokSigner.generateXGnarly(params2, body);
              return _context.abrupt("break", 22);

            case 19:
              result = TikTokSigner.getNavigatorInfo();
              return _context.abrupt("break", 22);

            case 21:
              throw new Error('Unknown action: ' + action);

            case 22:
              window.postMessage({
                type: 'AK_TIKTOK_SIGN_RESPONSE',
                requestId: requestId,
                success: true,
                data: result
              }, '*');
              _context.next = 28;
              break;

            case 25:
              _context.prev = 25;
              _context.t1 = _context["catch"](5);
              window.postMessage({
                type: 'AK_TIKTOK_SIGN_RESPONSE',
                requestId: requestId,
                success: false,
                error: _context.t1.message,
                stack: _context.t1.stack
              }, '*');

            case 28:
            case "end":
              return _context.stop();
          }
        }
      }, _callee, null, [[5, 25]]);
    }));

    return function (_x) {
      return _ref.apply(this, arguments);
    };
  }()); // 等待 __tsign 加载后初始化

  waitForTSign(function () {
    window.__AK_TikTok_Signer__ = TikTokSigner;
    window.postMessage({
      type: 'AK_TIKTOK_SIGNER_READY'
    }, '*');
    console.log('[AK-TikTok] Signer injected and ready');
  });
}
// CONCATENATED MODULE: ./src/platform/tiktok/xGnarly/signerBridge.js
function signerBridge_typeof(obj) { "@babel/helpers - typeof"; return signerBridge_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, signerBridge_typeof(obj); }

function signerBridge_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ signerBridge_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == signerBridge_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }

function signerBridge_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function signerBridge_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { signerBridge_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { signerBridge_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

/* eslint-disable */

/**
 * TikTok 签名桥接器
 * 在 Content Script 中运行，连接页面注入脚本和 Background Script
 */


var signerBridge_TikTokSignerBridge = /*#__PURE__*/function () {
  function TikTokSignerBridge() {
    _classCallCheck(this, TikTokSignerBridge);

    this.pendingRequests = new Map();
    this.signerReady = false;
    this.readyCallbacks = [];
    this.init();
  }

  _createClass(TikTokSignerBridge, [{
    key: "init",
    value: function init() {
      // 注入签名脚本
      this.injectSigner(); // 监听页面返回的消息

      this.setupPageMessageListener(); // 监听 Background 的请求

      this.setupBackgroundListener();
    }
    /**
     * 注入签名脚本到页面
     */

  }, {
    key: "injectSigner",
    value: function injectSigner() {
      // const script = document.createElement('script');
      // script.src = chrome.runtime.getURL('platform/tiktok/inject/xGnarlySigner.js');
      // script.onload = () => {
      //   console.log('[AK-Bridge] Signer script injected');
      //   script.remove();
      // };
      // script.onerror = () => {
      //   console.error('[AK-Bridge] Failed to inject signer script');
      // };
      // (document.head || document.documentElement).appendChild(script);
      injectXGnarlySignerScript();
    }
    /**
     * 监听来自页面的消息
     */

  }, {
    key: "setupPageMessageListener",
    value: function setupPageMessageListener() {
      var _this = this;

      window.addEventListener('message', function (event) {
        // 只接收来自当前窗口的消息
        if (event.source !== window) return;

        var _ref = event.data || {},
            type = _ref.type,
            requestId = _ref.requestId,
            success = _ref.success,
            data = _ref.data,
            error = _ref.error; // 签名器就绪


        if (type === 'AK_TIKTOK_SIGNER_READY') {
          console.log('[AK-Bridge] Signer is ready');
          _this.signerReady = true;

          _this.readyCallbacks.forEach(function (cb) {
            return cb();
          });

          _this.readyCallbacks = [];
          return;
        } // 签名响应


        if (type === 'AK_TIKTOK_SIGN_RESPONSE') {
          var pending = _this.pendingRequests.get(requestId);

          if (pending) {
            clearTimeout(pending.timeout);

            if (success) {
              pending.resolve(data);
            } else {
              pending.reject(new Error(error || 'Unknown error'));
            }

            _this.pendingRequests.delete(requestId);
          }
        }
      });
    }
    /**
     * 监听来自 Background 的请求（使用 sendMessage）
     */

  }, {
    key: "setupBackgroundListener",
    value: function setupBackgroundListener() {
      var _this2 = this;

      chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
        if (message.type === 'TIKTOK_SIGN_PING') {
          _this2.waitForReady().then(function () {
            return sendResponse({
              success: true,
              ready: true
            });
          }).catch(function (err) {
            return sendResponse({
              success: false,
              error: (err === null || err === void 0 ? void 0 : err.message) || String(err)
            });
          });

          return true;
        } // 只处理 TikTok 签名请求


        if (message.type !== 'TIKTOK_SIGN_REQUEST') return false;
        console.log('[AK-Bridge] Received sign request:', message.action);
        var action = message.action,
            url = message.url,
            body = message.body,
            splited = message.splited; // 异步处理请求

        _this2.request(action, url, body, splited).then(function (data) {
          console.log('[AK-Bridge] Sign success:', data);
          sendResponse({
            success: true,
            data: data
          });
        }).catch(function (error) {
          console.error('[AK-Bridge] Sign error:', error);
          sendResponse({
            success: false,
            error: error.message,
            stack: error.stack
          });
        }); // 返回 true 表示异步发送响应


        return true;
      });
    }
    /**
     * 等待签名器就绪
     */

  }, {
    key: "waitForReady",
    value: function waitForReady() {
      var _this3 = this;

      return new Promise(function (resolve) {
        if (_this3.signerReady) {
          resolve();
        } else {
          _this3.readyCallbacks.push(resolve);
        }
      });
    }
    /**
     * 发送请求到页面
     * @param {string} action - 操作类型: 'sign', 'xbogus', 'xgnarly', 'navigator'
     * @param {string} url - URL
     * @param {string|object} body - 请求体
     * @param {boolean} splited - 是否返回分离的值
     */

  }, {
    key: "request",
    value: function () {
      var _request = signerBridge_asyncToGenerator( /*#__PURE__*/signerBridge_regeneratorRuntime().mark(function _callee(action, url) {
        var _this4 = this;

        var body,
            splited,
            requestId,
            _args = arguments;
        return signerBridge_regeneratorRuntime().wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                body = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
                splited = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
                _context.next = 4;
                return this.waitForReady();

              case 4:
                requestId = "sign_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9));
                return _context.abrupt("return", new Promise(function (resolve, reject) {
                  // 设置超时
                  var timeout = setTimeout(function () {
                    _this4.pendingRequests.delete(requestId);

                    reject(new Error('Request timeout'));
                  }, 10000); // 10秒超时
                  // 保存 Promise 回调

                  _this4.pendingRequests.set(requestId, {
                    resolve: resolve,
                    reject: reject,
                    timeout: timeout
                  }); // 发送消息到页面


                  window.postMessage({
                    type: 'AK_TIKTOK_SIGN_REQUEST',
                    requestId: requestId,
                    action: action,
                    url: url,
                    body: body,
                    splited: splited
                  }, '*');
                }));

              case 6:
              case "end":
                return _context.stop();
            }
          }
        }, _callee, this);
      }));

      function request(_x, _x2) {
        return _request.apply(this, arguments);
      }

      return request;
    }()
    /**
     * 快捷方法：完整签名
     */

  }, {
    key: "sign",
    value: function () {
      var _sign = signerBridge_asyncToGenerator( /*#__PURE__*/signerBridge_regeneratorRuntime().mark(function _callee2(url) {
        var body,
            splited,
            _args2 = arguments;
        return signerBridge_regeneratorRuntime().wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                body = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : '';
                splited = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
                return _context2.abrupt("return", this.request('sign', url, body, splited));

              case 3:
              case "end":
                return _context2.stop();
            }
          }
        }, _callee2, this);
      }));

      function sign(_x3) {
        return _sign.apply(this, arguments);
      }

      return sign;
    }()
    /**
     * 快捷方法：生成 X-Bogus
     */

  }, {
    key: "generateXBogus",
    value: function () {
      var _generateXBogus = signerBridge_asyncToGenerator( /*#__PURE__*/signerBridge_regeneratorRuntime().mark(function _callee3(url) {
        return signerBridge_regeneratorRuntime().wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                return _context3.abrupt("return", this.request('xbogus', url));

              case 1:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3, this);
      }));

      function generateXBogus(_x4) {
        return _generateXBogus.apply(this, arguments);
      }

      return generateXBogus;
    }()
    /**
     * 快捷方法：生成 X-Gnarly
     */

  }, {
    key: "generateXGnarly",
    value: function () {
      var _generateXGnarly = signerBridge_asyncToGenerator( /*#__PURE__*/signerBridge_regeneratorRuntime().mark(function _callee4(url) {
        var body,
            _args4 = arguments;
        return signerBridge_regeneratorRuntime().wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                body = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : '';
                return _context4.abrupt("return", this.request('xgnarly', url, body));

              case 2:
              case "end":
                return _context4.stop();
            }
          }
        }, _callee4, this);
      }));

      function generateXGnarly(_x5) {
        return _generateXGnarly.apply(this, arguments);
      }

      return generateXGnarly;
    }()
    /**
     * 快捷方法：获取浏览器信息
     */

  }, {
    key: "getNavigatorInfo",
    value: function () {
      var _getNavigatorInfo = signerBridge_asyncToGenerator( /*#__PURE__*/signerBridge_regeneratorRuntime().mark(function _callee5() {
        return signerBridge_regeneratorRuntime().wrap(function _callee5$(_context5) {
          while (1) {
            switch (_context5.prev = _context5.next) {
              case 0:
                return _context5.abrupt("return", this.request('navigator'));

              case 1:
              case "end":
                return _context5.stop();
            }
          }
        }, _callee5, this);
      }));

      function getNavigatorInfo() {
        return _getNavigatorInfo.apply(this, arguments);
      }

      return getNavigatorInfo;
    }()
  }]);

  return TikTokSignerBridge;
}(); // 只在 TikTok 相关页面初始化


if (window.location.hostname.includes('tiktok')) {
  console.log('[AK-Bridge] Initializing TikTok signer bridge');
  window.__AK_TikTok_Bridge__ = new signerBridge_TikTokSignerBridge();
}
// CONCATENATED MODULE: ./src/content/index.js
function content_typeof(obj) { "@babel/helpers - typeof"; return content_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, content_typeof(obj); }

function content_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = content_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || content_unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function content_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return content_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return content_arrayLikeToArray(o, minLen); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return content_arrayLikeToArray(arr); }

function content_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function content_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ content_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == content_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }

function content_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function content_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { content_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { content_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }


 // 导入 TikTok 签名桥接器



(function () {
  var siteMap = {
    'https://sellercentral.amazon.com': '',
    'https://sellercentral-japan.amazon.com': '',
    'https://sellercentral.amazon.ca': '',
    'https://sellercentral.amazon.de': '',
    'https://sellercentral.amazon.com.au': '',
    'https://sellercentral-europe.amazon.com': '',
    'https://sellercentral.amazon.in': '',
    'https://sellercentral.amazon.ae': '',
    'https://sellercentral.amazon.co.uk': '',
    'https://sellercentral.amazon.sg': '',
    'https://sellercentral.amazon.fr': '',
    'https://sellercentral.amazon.it': '',
    'https://sellercentral.amazon.es': '',
    'https://sellercentral.amazon.nl': '',
    'https://sellercentral.amazon.com.mx': '',
    'https://sellercentral.amazon.com.br': '',
    'https://sellercentral.amazon.se': '',
    'https://sellercentral.amazon.co.jp': '',
    'https://sellercentral.amazon.sa': ''
  };
  var pages = {
    '/inventory/ref=xx_invmgr_dnav_xx': 1,
    '/coupons/create-coupon-bulk-page': 1,
    '/mcf/orders/create-order': 1,
    '/merchandising-new/create': 1
  };
  var codeToSiteMap = {
    A2Q3Y263D00KWC: 'BR',
    A2EUQ1WTGCTBG2: 'CA',
    A1AM78C64UM0Y8: 'MX',
    ATVPDKIKX0DER: 'US',
    A2VIGQ35RCS4UG: 'AE',
    A1PA6795UKMFR9: 'DE',
    ARBP9OOSHTCHU: 'EG',
    A1RKKUPIHCS9HS: 'ES',
    A13V1IB3VIYZZH: 'FR',
    A1F83G8C2ARO7P: 'UK',
    A21TJRUUN4KGV: 'IN',
    APJ6JRA9NG5V4: 'IT',
    A1805IZSGTT6HS: 'NL',
    A17E79C6D8DWNP: 'SA',
    A33AVAJ2PDY3EV: 'TR',
    A19VAU5U5O7RUS: 'SG',
    A39IBJ37TRP1C6: 'AU',
    A1VC38T7YXB528: 'JP',
    A2NODRKZP88ZB9: 'SE',
    A1C3SOZRARQ6R3: 'PL',
    AMEN7PMS3EDWL: 'BE',
    A28R8C7NBKEWEA: 'IE'
  };
  var marketplaceId;
  var sellerName; // 监听长连接

  chrome.runtime.onConnect.addListener(function (port) {
    var cb;

    switch (port.name) {
      case 'screen-connect':
        cb = /*#__PURE__*/function () {
          var _ref = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee(request) {
            var balance, totalBalanceDom;
            return content_regeneratorRuntime().wrap(function _callee$(_context) {
              while (1) {
                switch (_context.prev = _context.next) {
                  case 0:
                    if (!(request.cmd == 'screen')) {
                      _context.next = 6;
                      break;
                    }

                    _context.next = 3;
                    return waitKatSpinner(request.type);

                  case 3:
                    balance = '';
                    totalBalanceDom = document.querySelector('.linkable-multi-row-card-rows-container .currency-total-amount');

                    if (totalBalanceDom) {
                      balance = totalBalanceDom.innerText;
                      port.postMessage(balance);
                    } else port.postMessage(false); // var svgElements = document.body.querySelectorAll('svg')
                    // svgElements.forEach(function(item) {
                    //   item.setAttribute('width', item.getBoundingClientRect().width)
                    //   item.style.width = null
                    // })
                    // html2canvas(document.body, {
                    //   useCORS: true,
                    // }).then(function(canvas) {
                    //   port.postMessage({dataurl:canvas.toDataURL('image/jpg'), balance})
                    // }).catch(() => port.postMessage(false))


                  case 6:
                  case "end":
                    return _context.stop();
                }
              }
            }, _callee);
          }));

          return function cb(_x) {
            return _ref.apply(this, arguments);
          };
        }();

        break;

      case 'site-switch':
        cb = /*#__PURE__*/function () {
          var _ref2 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee2(request) {
            return content_regeneratorRuntime().wrap(function _callee2$(_context2) {
              while (1) {
                switch (_context2.prev = _context2.next) {
                  case 0:
                    if (!(request.cmd === 'switchSite')) {
                      _context2.next = 10;
                      break;
                    }

                    // 记录当前站点
                    siteMap[window.location.origin] = request.countryCode;
                    port.postMessage(1);

                    if (checkSite()) {
                      _context2.next = 8;
                      break;
                    }

                    closeSiteRemind();
                    return _context2.abrupt("return");

                  case 8:
                    observeAmazonPage(); // 弹出切换站点页面提醒

                    if (!request.noRemind) openSiteRemind();

                  case 10:
                  case "end":
                    return _context2.stop();
                }
              }
            }, _callee2);
          }));

          return function cb(_x2) {
            return _ref2.apply(this, arguments);
          };
        }();

        break;

      case 'get-referenceId':
        cb = /*#__PURE__*/function () {
          var _ref3 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee3(request) {
            var res;
            return content_regeneratorRuntime().wrap(function _callee3$(_context3) {
              while (1) {
                switch (_context3.prev = _context3.next) {
                  case 0:
                    if (!(request.cmd === 'reference')) {
                      _context3.next = 5;
                      break;
                    }

                    _context3.next = 3;
                    return waitShipmentPage();

                  case 3:
                    res = _context3.sent;
                    port.postMessage(res);

                  case 5:
                  case "end":
                    return _context3.stop();
                }
              }
            }, _callee3);
          }));

          return function cb(_x3) {
            return _ref3.apply(this, arguments);
          };
        }();

        break;

      case 'get-ipi':
        cb = /*#__PURE__*/function () {
          var _ref4 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee4(request) {
            var res;
            return content_regeneratorRuntime().wrap(function _callee4$(_context4) {
              while (1) {
                switch (_context4.prev = _context4.next) {
                  case 0:
                    if (!(request.cmd === 'ipi')) {
                      _context4.next = 5;
                      break;
                    }

                    _context4.next = 3;
                    return ipiContent.waitIpiPage();

                  case 3:
                    res = _context4.sent;
                    port.postMessage(res);

                  case 5:
                  case "end":
                    return _context4.stop();
                }
              }
            }, _callee4);
          }));

          return function cb(_x4) {
            return _ref4.apply(this, arguments);
          };
        }();

        break;

      case 'get-money':
        cb = /*#__PURE__*/function () {
          var _ref5 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee5(request) {
            var res;
            return content_regeneratorRuntime().wrap(function _callee5$(_context5) {
              while (1) {
                switch (_context5.prev = _context5.next) {
                  case 0:
                    if (!(request.cmd === 'money')) {
                      _context5.next = 5;
                      break;
                    }

                    _context5.next = 3;
                    return waitGetMoney();

                  case 3:
                    res = _context5.sent;
                    port.postMessage(res);

                  case 5:
                  case "end":
                    return _context5.stop();
                }
              }
            }, _callee5);
          }));

          return function cb(_x5) {
            return _ref5.apply(this, arguments);
          };
        }();

        break;

      case 'inject-script':
        cb = /*#__PURE__*/function () {
          var _ref6 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee6(request) {
            return content_regeneratorRuntime().wrap(function _callee6$(_context6) {
              while (1) {
                switch (_context6.prev = _context6.next) {
                  case 0:
                    if (request.cmd === 'initScript') {
                      observeAmazonPage();
                    }

                  case 1:
                  case "end":
                    return _context6.stop();
                }
              }
            }, _callee6);
          }));

          return function cb(_x6) {
            return _ref6.apply(this, arguments);
          };
        }();

        break;
    }

    port.onMessage.addListener(cb);
  });
  /**
   * @description 抓取referenceid
   */

  function waitShipmentPage() {
    return new Promise(function (resolve) {
      var maxCount = 15;
      var count = 0;
      var timer = setInterval(function () {
        var referenceIdDOM = document.querySelector('#fba-core-view-meta-data-shipment-name dl dd:last-child');
        var referenceIdDOM2 = document.querySelector('#shipment-info-amazon-reference-id-line'); // const languageDOM = document.querySelector('#sc-lang-switcher-footer-select option[selected="selected"]')

        console.log('referenceIdDOM', referenceIdDOM, 'referenceIdDOM2', referenceIdDOM2);

        if (referenceIdDOM) {
          console.log('referenceId旧页面');

          try {
            var text = referenceIdDOM.innerText;
            var referenceId = text.split(':')[1] || text.split('：')[1];
            resolve({
              code: 1,
              data: referenceId
            });
          } catch (e) {
            resolve({
              code: 15,
              msg: "\u83B7\u53D6\u5931\u8D25\uFF0C\u4E9A\u9A6C\u900A\u89C4\u5219\u53EF\u80FD\u6539\u53D8:".concat(e.message)
            });
          }
        } else if (referenceIdDOM2) {
          console.log('referenceId新页面');

          try {
            var _text = referenceIdDOM2.innerText;

            var _referenceId = _text.split(':')[1] || _text.split('：')[1];

            resolve({
              code: 1,
              data: _referenceId
            });
          } catch (e) {
            resolve({
              code: 15,
              msg: "\u83B7\u53D6\u5931\u8D25\uFF0C\u4E9A\u9A6C\u900A\u89C4\u5219\u53EF\u80FD\u6539\u53D8:".concat(e.message)
            });
          }
        } else if (count > maxCount) {
          // 切换语言没有出来，则判定站点离线
          // if (!languageDOM) resolve({ code: 11 })
          // 切换语言有出来，referenceId没有，则判定页面加载超时
          // else resolve({ code: 13 })
          resolve({
            code: 15,
            msg: "\u83B7\u53D6\u5931\u8D25\uFF0C\u4E9A\u9A6C\u900A\u89C4\u5219\u53EF\u80FD\u6539\u53D8"
          });
        } else {
          count++;
          return;
        }

        clearInterval(timer);
      }, 1000);
    });
  }

  function waitKatSpinner(type) {
    return new Promise(function (resolve) {
      var maxCount = 15;
      var count = 0;
      var timer = setInterval(function () {
        var loadingEle;

        switch (type) {
          case 'home':
            loadingEle = document.querySelector('#KPI_CARD_PAYMENTS .casino-expand-action');
            break;

          case "finance":
            loadingEle = document.querySelector('.linkable-multi-row-card') && document.querySelector('.payment-tiles-container .currency-total-amount');
            break;
        }

        if (loadingEle) {
          // 增加5s延时，等样式加载完
          setTimeout(function () {
            resolve(true);
          }, 5000);
          clearInterval(timer);
        } else {
          if (count > maxCount) {
            clearInterval(timer);
            resolve(false);
          } else {
            count++;
          }
        }
      }, 2000);
    });
  }

  function waitSiteLoadingEle() {
    return new Promise(function (resolve) {
      var maxCount = 8;
      var count = 0;
      var timer = setInterval(function () {
        var loadingEle = document.querySelector('#pleasewaitmask');

        if (loadingEle && loadingEle.style && loadingEle.style.visibility === 'hidden') {
          resolve(true);
          clearInterval(timer);
        } else {
          if (count > maxCount) {
            clearInterval(timer);
            resolve(false);
          } else {
            count++;
          }
        }
      }, 2000);
    });
  }
  /**
   * @description 获取提现结果
   */


  function waitGetMoney() {
    return new Promise(function (resolve) {
      var maxCount = 15;
      var count = 0;
      var timer = setInterval(function () {
        var successText = document.querySelectorAll('#root .kat-alert')[0];
        var errorText = [].concat(_toConsumableArray(document.querySelectorAll('#root .ineligibility-alert-section .kat-row  div') || []), _toConsumableArray(document.querySelectorAll('#root .ineligibility-alert-section .kat-row  span') || [])); // const languageDOM = document.querySelector('#sc-lang-switcher-footer-select option[selected="selected"]')

        if (successText) {
          console.log('提现成功');
          var text = successText.innerText;
          resolve({
            code: 0,
            msg: text
          });
        } else if (errorText.length > 0) {
          console.log('提现失败');

          try {
            var _text2 = errorText.map(function (item) {
              return item.innerText;
            }).join('\n');

            resolve({
              code: 1,
              msg: _text2
            });
          } catch (e) {
            resolve({
              code: 2,
              msg: "\u6293\u53D6\u63D0\u73B0\u5931\u8D25\u4FE1\u606F\u5931\u8D25\uFF0C\u4E9A\u9A6C\u900A\u89C4\u5219\u53EF\u80FD\u6539\u53D8:".concat(e.message)
            });
          }
        } else if (count > maxCount) {
          // 切换语言没有出来，则判定站点离线
          // if (!languageDOM) resolve({ code: 11 })
          // 切换语言有出来，referenceId没有，则判定页面加载超时
          // else resolve({ code: 13 })
          // 默认无法提现
          resolve({
            code: 2,
            msg: "\u8BE5\u5E97\u94FA\u63D0\u73B0\u65F6\u9700\u8981\u91CD\u65B0\u767B\u9646\uFF0C\u8BF7\u5230\u540E\u53F0\u6838\u5B9E"
          });
        } else {
          count++;
          return;
        }

        clearInterval(timer);
      }, 1000);
    });
  }
  /**
   * 监听亚马逊页面
   */


  function observeAmazonPage() {
    return _observeAmazonPage.apply(this, arguments);
  }
  /**
   * 监听用户是否切换站点
   */


  function _observeAmazonPage() {
    _observeAmazonPage = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee8() {
      var dom, _iterator, _step, i;

      return content_regeneratorRuntime().wrap(function _callee8$(_context8) {
        while (1) {
          switch (_context8.prev = _context8.next) {
            case 0:
              // 监听用户是否切换站点
              observeChangeSite();
              _context8.next = 3;
              return judgmentPageUrl();

            case 3:
              dom = _context8.sent;
              console.log('已获取到DOM', dom);

              if (dom) {
                _iterator = content_createForOfIteratorHelper(dom);

                try {
                  for (_iterator.s(); !(_step = _iterator.n()).done;) {
                    i = _step.value;
                    i.addEventListener('click', interceptEvent, true);
                  }
                } catch (err) {
                  _iterator.e(err);
                } finally {
                  _iterator.f();
                }
              } else {
                // 未获取到敏感dom，上报错误
                chrome.runtime.sendMessage({
                  type: 'reportLog',
                  text: "".concat(window.location.href, "\u9875\u9762\u672A\u83B7\u53D6\u5230\u654F\u611F\u6309\u94AEdom\uFF0C\u53EF\u80FD\u662F\u4E9A\u9A6C\u900A\u89C4\u5219\u6539\u53D8\uFF01"),
                  reportType: 'error'
                }); // log.report(`${window.location.href}页面未获取到敏感按钮dom，可能是亚马逊规则改变！`, 'error')
              }

            case 6:
            case "end":
              return _context8.stop();
          }
        }
      }, _callee8);
    }));
    return _observeAmazonPage.apply(this, arguments);
  }

  function observeChangeSite() {
    return _observeChangeSite.apply(this, arguments);
  }
  /**
   * 当弹出站点列表时，监听站点列表是否被点击
   */


  function _observeChangeSite() {
    _observeChangeSite = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee9() {
      var count,
          dom,
          _args9 = arguments;
      return content_regeneratorRuntime().wrap(function _callee9$(_context9) {
        while (1) {
          switch (_context9.prev = _context9.next) {
            case 0:
              count = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : 0;

              if (!(count > 120)) {
                _context9.next = 3;
                break;
              }

              return _context9.abrupt("return");

            case 3:
              _context9.next = 5;
              return delay(1000);

            case 5:
              // 监听亚马逊显示站点列表事件
              dom = document.querySelector('.dropdown-account-switcher');

              if (!dom) {
                _context9.next = 9;
                break;
              }

              dom.addEventListener('click', observeSiteList);
              return _context9.abrupt("return");

            case 9:
              observeChangeSite(count + 1);

            case 10:
            case "end":
              return _context9.stop();
          }
        }
      }, _callee9);
    }));
    return _observeChangeSite.apply(this, arguments);
  }

  function observeSiteList() {
    return _observeSiteList.apply(this, arguments);
  }
  /**
   * 发送中断消息
   */


  function _observeSiteList() {
    _observeSiteList = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee11() {
      var fn;
      return content_regeneratorRuntime().wrap(function _callee11$(_context11) {
        while (1) {
          switch (_context11.prev = _context11.next) {
            case 0:
              fn = /*#__PURE__*/function () {
                var _ref8 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee10() {
                  var count,
                      dropdownDom,
                      dom,
                      _args10 = arguments;
                  return content_regeneratorRuntime().wrap(function _callee10$(_context10) {
                    while (1) {
                      switch (_context10.prev = _context10.next) {
                        case 0:
                          count = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : 0;

                          if (!(count > 100)) {
                            _context10.next = 3;
                            break;
                          }

                          return _context10.abrupt("return");

                        case 3:
                          dropdownDom = document.querySelector('.dropdown-account-switcher-list-pointer-area');

                          if (dropdownDom) {
                            _context10.next = 6;
                            break;
                          }

                          return _context10.abrupt("return");

                        case 6:
                          dom = dropdownDom.querySelectorAll('.dropdown-account-switcher-list-item-indented');

                          if (!(dom && dom.length > 0)) {
                            _context10.next = 11;
                            break;
                          }

                          // 监听是否点击切换站点
                          dom.forEach(function (item) {
                            // item.addEventListener('click', sendSuspendMsg)
                            item.onclick = sendSuspendMsg;
                          });
                          _context10.next = 14;
                          break;

                        case 11:
                          _context10.next = 13;
                          return delay(300);

                        case 13:
                          fn(count + 1);

                        case 14:
                        case "end":
                          return _context10.stop();
                      }
                    }
                  }, _callee10);
                }));

                return function fn() {
                  return _ref8.apply(this, arguments);
                };
              }();

              fn();

            case 2:
            case "end":
              return _context11.stop();
          }
        }
      }, _callee11);
    }));
    return _observeSiteList.apply(this, arguments);
  }

  function sendSuspendMsg() {
    chrome.runtime.sendMessage({
      type: 'suspend'
    }, function (response) {
      console.log('已中断', JSON.stringify(response));
    });
  }
  /**
   * 拦截事件
   */


  function interceptEvent(e) {
    // 如果站点已改变,且点击的是敏感按钮,且拦截操作并提示
    if (checkSite() && sensitiveBtn(e.target)) {
      e.stopPropagation(); // 上报日志

      chrome.runtime.sendMessage({
        type: 'reportLog',
        text: "\u7528\u6237\u8FDB\u884C\u4E86\u654F\u611F\u64CD\u4F5C----\u9875\u9762\u8DEF\u5F84:".concat(window.location.pathname, "----\u8282\u70B9\uFF1A").concat(e.target),
        reportType: 'sensitive'
      }); // log.report(`用户进行了敏感操作----页面路径:${window.location.pathname}----节点：${e.target}`, 'sensitive')
      // 通知插件自动切换回原站点

      chrome.runtime.sendMessage({
        type: 'changeSite',
        marketplaceId: marketplaceId,
        origin: window.location.origin,
        sellerName: sellerName
      }, function (response) {
        siteMap[window.location.origin] = response.countryCode;
        console.log("\u5207\u6362\u56DE\u539F\u7AD9\u70B9\u56DE\u8C03,\u5DF2\u5207\u6362\u5230\u7AD9\u70B9".concat(codeToSiteMap[response.countryCode]));
      });
      alert("\u6E29\u99A8\u63D0\u793A\uFF1A\u5F53\u524D\u7AD9\u70B9\u4E0E\u9875\u9762\u663E\u793A\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u572815s\u540E\u91CD\u8BD5");
    }
  }
  /**
   * 获取当前页面需要拦截的DOM
  */


  function judgmentPageUrl() {
    var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    console.log('judgmentPageUrl', count);
    return new Promise( /*#__PURE__*/function () {
      var _ref7 = content_asyncToGenerator( /*#__PURE__*/content_regeneratorRuntime().mark(function _callee7(resolve) {
        var arr, pathname, dom, _dom, _dom2, _dom3, _dom4, _dom5, _dom6;

        return content_regeneratorRuntime().wrap(function _callee7$(_context7) {
          while (1) {
            switch (_context7.prev = _context7.next) {
              case 0:
                if (!(count > 60)) {
                  _context7.next = 3;
                  break;
                }

                resolve([]);
                return _context7.abrupt("return");

              case 3:
                _context7.next = 5;
                return delay(1000);

              case 5:
                arr = [];
                pathname = window.location.pathname;
                _context7.t0 = true;
                _context7.next = _context7.t0 === (pathname.indexOf('/inventory') !== -1) ? 10 : _context7.t0 === (pathname.indexOf('/pricing/health') !== -1) ? 13 : _context7.t0 === (pathname.indexOf('/coupons') !== -1) ? 16 : _context7.t0 === (pathname.indexOf('/mcf/orders/create-order') !== -1) ? 19 : _context7.t0 === (pathname.indexOf('/merchandising-new') !== -1) ? 22 : _context7.t0 === (pathname.indexOf('/prime-discounts') !== -1) ? 25 : _context7.t0 === (pathname.indexOf('/promotions') !== -1) ? 28 : 31;
                break;

              case 10:
                dom = document.getElementById('root');
                if (dom) arr.push(dom);
                return _context7.abrupt("break", 33);

              case 13:
                _dom = document.getElementById('root');
                if (_dom) arr.push(_dom);
                return _context7.abrupt("break", 33);

              case 16:
                _dom2 = [].concat(_toConsumableArray(document.querySelectorAll('.header-main .action-buttons kat-button')), [document.getElementById('coupons-bulk-spread-sheet-variable-action-button'), document.querySelector('.dirty-bulk-upload .bulk-button'), document.getElementById('coupons-create-next-step'), document.getElementById('coupons-create-submit')]).filter(Boolean);
                if (_dom2.length > 0) arr.push.apply(arr, _toConsumableArray(_dom2));
                return _context7.abrupt("break", 33);

              case 19:
                _dom3 = [document.getElementById('place_order_button'), document.getElementById('hold_inventory_button')];
                if (_dom3.length > 0) arr.push.apply(arr, _dom3);
                return _context7.abrupt("break", 33);

              case 22:
                _dom4 = document.querySelectorAll('#smui-root kat-button').filter(Boolean);
                if (_dom4.length > 0) arr.push.apply(arr, _toConsumableArray(_dom4)); // 判断该页面按钮DOM是否获取完毕
                // resolve((arr.length < 2) ? await judgmentPageUrl(++count) : arr)
                // if (window.location.hash === '#review') {
                //   const dom = document.getElementById('smui-root').getElementsByTagName('kat-button')
                //   if (dom) arr.push(dom)
                // }

                return _context7.abrupt("break", 33);

              case 25:
                _dom5 = [document.getElementById('createPromoButton'), document.querySelector('.cbp-btn-container #saveButton'), document.querySelector('.cbp-btn-container #submitButton'), document.querySelector('#inlineAddFormControls #inlineAddUploadButton'), document.querySelector('#uploadFormControls #uploadButton'), document.getElementById('saveAllAndSubmitBtn'), document.querySelector('#submittedPageModalFooter .cbp-modal-submit-button'), document.querySelector('#reviewTable tbody'), document.querySelector('#reviewPageModalFooter .cbp-modal-submit-button')].filter(Boolean);
                if (_dom5.length > 0) arr.push.apply(arr, _toConsumableArray(_dom5));
                return _context7.abrupt("break", 33);

              case 28:
                _dom6 = [document.getElementById('epmMoneyOffLink'), document.getElementById('epmBOGOLink'), document.getElementById('a-autoid-1'), document.getElementById('a-autoid-3')].filter(Boolean);
                if (_dom6.length > 0) arr.push.apply(arr, _toConsumableArray(_dom6));
                return _context7.abrupt("break", 33);

              case 31:
                resolve([]);
                return _context7.abrupt("return");

              case 33:
                _context7.t1 = resolve;

                if (!(arr.length < 1)) {
                  _context7.next = 40;
                  break;
                }

                _context7.next = 37;
                return judgmentPageUrl(++count);

              case 37:
                _context7.t2 = _context7.sent;
                _context7.next = 41;
                break;

              case 40:
                _context7.t2 = arr;

              case 41:
                _context7.t3 = _context7.t2;
                (0, _context7.t1)(_context7.t3);

              case 43:
              case "end":
                return _context7.stop();
            }
          }
        }, _callee7);
      }));

      return function (_x7) {
        return _ref7.apply(this, arguments);
      };
    }());
  }
  /**
   * 检测是否是敏感按钮
   */


  function sensitiveBtn(target) {
    var _target$id;

    var pathname = window.location.pathname;
    console.log('sensitiveBtn', pathname, target);

    switch (true) {
      // 管理库存页面
      case pathname.indexOf('/inventory') !== -1:
        if (['kat-button', 'button', 'kat-dropdown-button'].indexOf(target.tagName.toLocaleLowerCase()) > -1) {
          var _target$getAttribute;

          // 批量改价
          var label = (_target$getAttribute = target.getAttribute('label')) === null || _target$getAttribute === void 0 ? void 0 : _target$getAttribute.trim().toLocaleLowerCase();
          if (['save all', 'save', '保存', '保存所有'].indexOf(label) > -1) return true; // 下架商品
          // 删除商品信息

          if (target.className.indexOf('saveButton') > -1) return true; // 单个修改b2b价格

          if (target.className.indexOf('submitButton') > -1) return true; // 单个修改多地点库存

          if (target.id === 'save') return true;
        }

        break;
      // 定价状况

      case pathname.indexOf('/pricing/health') !== -1:
        if (['kat-button', 'button', 'kat-dropdown-button'].indexOf(target.tagName.toLocaleLowerCase()) > -1) {
          var _target$getAttribute2, _target$getAttribute3;

          // 全部保存
          var _label = (_target$getAttribute2 = target.getAttribute('label')) === null || _target$getAttribute2 === void 0 ? void 0 : _target$getAttribute2.trim().toLocaleLowerCase();

          if (['全部保存', '保存', 'save all', 'save'].indexOf(_label) > -1) return true; // 下拉选项中的降低到您的最高价格

          var dataAction = (_target$getAttribute3 = target.getAttribute('data-action')) === null || _target$getAttribute3 === void 0 ? void 0 : _target$getAttribute3.toLocaleUpperCase();
          if (dataAction === 'MATCH_MAXIMUM_PRICE') return true;
        } // 单个保存


        if (((_target$id = target.id) === null || _target$id === void 0 ? void 0 : _target$id.toLocaleLowerCase()) === 'consolidated-match-price-dropdown-button') return true;
        break;
      // 折扣详情列表

      case pathname.indexOf('/prime-discounts/review/') !== -1:
        if (['cbp-modal-submit-button', 'cbp-edit-discard-button'].indexOf(target.className) > -1) return true;
        break;

      default:
        return true;
    }
  }
  /**
   * 检测当前站点是否被更换
   */


  function checkSite() {
    try {
      // marketplaceId = document.getElementById('partner-switcher') && document.getElementById('partner-switcher').getElementsByClassName('currentSelection')[0] && document.getElementById('partner-switcher').getElementsByClassName('currentSelection')[0].getAttribute('id')
      // marketplaceId = document.getElementById('partner-switcher').getAttribute('data-marketplace_selection')
      // marketplaceId = window.ue_mid
      var noscripts = document.querySelectorAll('noscript');
      Object.keys(codeToSiteMap).forEach(function (i) {
        noscripts.forEach(function (noscript) {
          if (noscript && noscript.innerText && noscript.innerText.indexOf(i) > -1) marketplaceId = i;
        });
      });
      sellerName = document.querySelector('#dropdown-account-switcher-container .dropdown-account-switcher-header-label-global') && document.querySelector('#dropdown-account-switcher-container .dropdown-account-switcher-header-label-global').innerText;
      var origin = window.location.origin; // 站点已被切换

      if (siteMap[origin] && siteMap[origin] !== marketplaceId) return true;
      return false;
    } catch (e) {
      chrome.runtime.sendMessage({
        type: 'reportLog',
        text: 'checkSite方法错误----' + e.message,
        reportType: 'sensitive'
      }); // log.report('checkSite方法错误----' + e, 'sensitive')

      return false;
    }
  }
  /**
   * 延时 
  */


  function delay(time) {
    return new Promise(function (resolve) {
      setTimeout(function () {
        resolve(1);
      }, time);
    });
  }
  /**
   * @description 切换站点页面提醒
   */


  function openSiteRemind() {
    // 如果切换的站点和当前站点一致，则关掉弹窗
    // if (!checkSite()){
    //   closeSiteRemind()
    //   return
    // }
    if (document.getElementById('lx_change_site_popup')) return; // 如果有切回原站点通知弹窗，则删掉

    if (document.getElementById('lx_site_result_popup')) document.body.removeChild(document.getElementById('lx_site_result_popup'));
    createSiteRemidDom();
    setTimeout(function () {
      var soptBtn = document.getElementById('lx_change_site_popup_stop');
      var closeBtn = document.getElementById('lx_change_site_popup_close');
      soptBtn.addEventListener('click', handleStopRunning);
      closeBtn.addEventListener('click', closeSiteRemind);
    }, 0);
  }
  /**
   * @description 创建提醒dom
   */


  function createSiteRemidDom() {
    var body = document.querySelector('body');
    var container = document.createElement('div');
    container.setAttribute('id', 'lx_change_site_popup');
    container.style = "position: fixed;top: 20px;right:20px;background-color:#fff;border-radius:8px;padding:20px 30px 50px 40px;border-radius: 20px;box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);z-index: 999999";
    container.innerHTML = "\n      <header style=\"position: relative;margin-bottom: 20px;\">\n        <svg style=\"position: absolute;left:-24px;top:50%;transform: translateY(-50%);height:18px;width: 18px;\" t=\"1709884599509\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"33205\" width=\"200\" height=\"200\"><path d=\"M512 1024A512 512 0 1 0 512 0a512 512 0 0 0 0 1024z m-34.56-425.6L454.4 287.36c0-34.56 23.04-63.36 57.6-63.36 28.8 0 57.6 23.04 57.6 57.6l-23.04 316.8c-5.76 17.28-17.28 28.8-34.56 28.8s-28.8-11.52-34.56-28.8zM512 684.8c34.56 0 57.6 23.04 57.6 57.6s-23.04 57.6-57.6 57.6-57.6-23.04-57.6-57.6 23.04-57.6 57.6-57.6z\" fill=\"#F58718\" p-id=\"33206\"></path></svg>\n        <h5 style=\"margin: 0;font-size:18px;font-weight: 600;\">\u63D2\u4EF6\u5DF2\u5207\u6362\u7AD9\u70B9</h5>\n      </header>\n      <p style=\"margin:0 0 4px 0;font-size:12px;color:rgb(99,99,99)\">\u63D2\u4EF6\u4EFB\u52A1\u6267\u884C\u4E2D\uFF0C\u5DF2\u5207\u6362\u7AD9\u70B9\uFF0C\u4E0E\u5F53\u524D\u9875\u9762\u7AD9\u70B9\u4E0D\u4E00\u81F4\u3002</p>\n      <p style=\"margin: 0 0 16px 0;font-size:12px;color:rgb(99,99,99);\">\u53EF\u9009\u62E9\u4EE5\u4E0B\u64CD\u4F5C\uFF1A</p>\n      <div id=\"lx_change_site_popup_stop\" style=\"position:relative;padding: 12px 28px 12px 12px;margin-bottom:8px;font-size:14px;color:#005bf5;border:1px solid #005bf5;border-radius:4px;background:#EBF3FF;cursor: pointer;\">\n        \u6682\u505C\u63D2\u4EF6\uFF0C\u5C06\u81EA\u52A8\u5207\u6362\u56DE\u5F53\u524D\u9875\u9762\u7AD9\u70B9\uFF0C\u53EF\u8FDB\u884C\u64CD\u4F5C\u30021h\u540E\u63D2\u4EF6\u7EE7\u7EED\u6267\u884C\n        <svg style=\"position:absolute;right:8px;top:50%;transform: translateY(-50%);height:14px;width:14px\" t=\"1710140693533\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"11187\" width=\"200\" height=\"200\"><path d=\"M634.752 247.488l4.928 4.288L865.92 478.08a48 48 0 0 1 4.288 62.976l-4.288 4.864-226.24 226.304a48 48 0 0 1-72.192-62.976l4.288-4.928L716.16 560 192 560a48 48 0 0 1-6.528-95.552L192 464h524.096L571.776 319.616a48 48 0 0 1-4.288-62.976l4.288-4.928a48 48 0 0 1 62.976-4.288z\" fill=\"#005bf5\" p-id=\"11188\"></path></svg>\n      </div>\n      <div id=\"lx_change_site_popup_close\" style=\"position:relative;padding: 12px 28px 12px 12px;font-size:14px;color:#E52E2E;border:1px solid #E52E2E;border-radius:4px;background:#fff1f0;cursor: pointer;\">\n        \u63D2\u4EF6\u7EE7\u7EED\u6267\u884C\uFF0C\u7528\u6237\u4E0D\u80FD\u5728\u672C\u9875\u9762\u7EE7\u7EED\u64CD\u4F5C\u3002 \n        <svg style=\"position:absolute;right:8px;top:50%;transform: translateY(-50%);height:14px;width:14px\" t=\"1710140693533\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"11187\" width=\"200\" height=\"200\"><path d=\"M634.752 247.488l4.928 4.288L865.92 478.08a48 48 0 0 1 4.288 62.976l-4.288 4.864-226.24 226.304a48 48 0 0 1-72.192-62.976l4.288-4.928L716.16 560 192 560a48 48 0 0 1-6.528-95.552L192 464h524.096L571.776 319.616a48 48 0 0 1-4.288-62.976l4.288-4.928a48 48 0 0 1 62.976-4.288z\" fill=\"#E52E2E\" p-id=\"11188\"></path></svg>\n      </div>\n    "; // <div style="position:absolute;bottom:12px;right:20px;color:#E52E2E;font-weight:600"><input type="checkbox" id="lx_change_site_popup_checkbox">&nbsp;&nbsp;今日不再提醒</div>

    body.appendChild(container);
  }
  /**
   * @description
   */


  function handleStopRunning() {
    closeSiteRemind(); // 通知插件自动切换回原站点

    chrome.runtime.sendMessage({
      type: 'changeSite',
      marketplaceId: marketplaceId,
      origin: window.location.origin,
      sellerName: sellerName
    }, function (response) {
      // 切换成功通知
      if (response.code === 1) {
        siteMap[window.location.origin] = response.countryCode;
        console.log("\u5207\u6362\u56DE\u539F\u7AD9\u70B9\u56DE\u8C03,\u5DF2\u5207\u6362\u5230\u7AD9\u70B9".concat(codeToSiteMap[response.countryCode]));
        openChangeNoticeDialog(true);
      } else {
        // 失败通知
        console.log("\u5207\u6362\u56DE\u539F\u7AD9\u70B9\u56DE\u8C03,\u5207\u6362\u7AD9\u70B9\u5931\u8D25\uFF0C\u63D0\u793A\u5BA2\u6237\u5237\u65B0\u9875\u9762");
        window.location.reload();
      }
    });
  }
  /**
   * @description 切回原站点成功、失败弹窗
   */


  function openChangeNoticeDialog(succ) {
    var body = document.querySelector('body');
    var container = document.createElement('div');
    container.setAttribute('id', 'lx_site_result_popup');
    container.style = "position: fixed;top: 20px;right:20px;background-color:#fff;border-radius:8px;padding:20px 30px 60px 40px;border-radius: 20px;box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);";
    container.innerHTML = "\n      <header style=\"position: relative;margin-bottom: 40px;\">\n      <svg style=\"position: absolute;left:-24px;top:50%;transform: translateY(-50%);height:18px;width: 18px;\" t=\"1710299403373\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"11387\" width=\"200\" height=\"200\"><path d=\"M512 1024A512 512 0 1 0 512 0a512 512 0 0 0 0 1024zM337.408 473.856l4.864 4.288L444.16 579.968l237.632-237.568a48 48 0 0 1 62.976-4.288l4.864 4.288a48 48 0 0 1 4.288 62.976l-4.288 4.864-271.488 271.552a48 48 0 0 1-62.976 4.288l-4.928-4.288-135.744-135.744a48 48 0 0 1 62.976-72.192z\" fill=\"#28A864\" p-id=\"11388\"></path></svg>\n        <h5 style=\"margin: 0;font-size:18px;font-weight: 600;\">\u7CFB\u7EDF\u5DF2\u5207\u6362\u56DE\u539F\u7AD9\u70B9</h5>\n      </header>\n      <p style=\"margin:0 0 4px 0;font-size:12px;color:rgb(99,99,99)\">\n      \u63D2\u4EF6\u5DF2\u6682\u505C\uFF0C\u7CFB\u7EDF\u5DF2\u5207\u6362\u56DE\u539F\u7AD9\u70B9\uFF0C\u53EF\u8FDB\u884C\u64CD\u4F5C\u30021h\u540E\u63D2\u4EF6\u7EE7\u7EED\u6267\u884C\n      </p>\n      <button style=\"position:absolute;bottom:20px;right:12px;border: 0;border-radius: 4px;padding:8px;cursor: pointer;color:#fff;background:#005BF5\" id=\"lx_site_result_btn\">\u6211\u77E5\u9053\u4E86</button>\n    ";
    body.appendChild(container);
    setTimeout(function () {
      var btn = document.getElementById('lx_site_result_btn');
      btn.addEventListener('click', closeChangeSiteDialog);
    }, 0);
  }
  /**
   * @description 关闭切回原站点成功弹窗
   */


  function closeChangeSiteDialog() {
    var popup = document.getElementById('lx_site_result_popup');

    if (popup) {
      var btn = document.getElementById('lx_site_result_btn');
      btn.removeEventListener('click', closeChangeSiteDialog);
      document.body.removeChild(popup);
    }
  }
  /**
   * @description 关闭弹窗
   */


  function closeSiteRemind() {
    // 如果已勾选不再提醒，则继续在serviceworker里
    var noRemind = document.getElementById('lx_change_site_popup_checkbox');
    chrome.runtime.sendMessage({
      type: 'sitePopCheckbox',
      noRemind: noRemind && noRemind.checked
    });
    var popup = document.getElementById('lx_change_site_popup');

    if (popup) {
      var soptBtn = document.getElementById('lx_change_site_popup_stop');
      var closeBtn = document.getElementById('lx_change_site_popup_close');
      soptBtn.removeEventListener('click', handleStopRunning);
      closeBtn.removeEventListener('click', closeSiteRemind);
      document.body.removeChild(popup);
    }
  }

  window.onload = observeAmazonPage;
})();

/***/ }),

/***/ "f28c":
/***/ (function(module, exports) {

// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
    throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
    throw new Error('clearTimeout has not been defined');
}
(function () {
    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
        }
    } catch (e) {
        cachedSetTimeout = defaultSetTimout;
    }
    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
        }
    } catch (e) {
        cachedClearTimeout = defaultClearTimeout;
    }
} ())
function runTimeout(fun) {
    if (cachedSetTimeout === setTimeout) {
        //normal enviroments in sane situations
        return setTimeout(fun, 0);
    }
    // if setTimeout wasn't available but was latter defined
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
        cachedSetTimeout = setTimeout;
        return setTimeout(fun, 0);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedSetTimeout(fun, 0);
    } catch(e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
            return cachedSetTimeout.call(null, fun, 0);
        } catch(e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
            return cachedSetTimeout.call(this, fun, 0);
        }
    }


}
function runClearTimeout(marker) {
    if (cachedClearTimeout === clearTimeout) {
        //normal enviroments in sane situations
        return clearTimeout(marker);
    }
    // if clearTimeout wasn't available but was latter defined
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
        cachedClearTimeout = clearTimeout;
        return clearTimeout(marker);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedClearTimeout(marker);
    } catch (e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
            return cachedClearTimeout.call(null, marker);
        } catch (e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
            return cachedClearTimeout.call(this, marker);
        }
    }



}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
    if (!draining || !currentQueue) {
        return;
    }
    draining = false;
    if (currentQueue.length) {
        queue = currentQueue.concat(queue);
    } else {
        queueIndex = -1;
    }
    if (queue.length) {
        drainQueue();
    }
}

function drainQueue() {
    if (draining) {
        return;
    }
    var timeout = runTimeout(cleanUpNextTick);
    draining = true;

    var len = queue.length;
    while(len) {
        currentQueue = queue;
        queue = [];
        while (++queueIndex < len) {
            if (currentQueue) {
                currentQueue[queueIndex].run();
            }
        }
        queueIndex = -1;
        len = queue.length;
    }
    currentQueue = null;
    draining = false;
    runClearTimeout(timeout);
}

process.nextTick = function (fun) {
    var args = new Array(arguments.length - 1);
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            args[i - 1] = arguments[i];
        }
    }
    queue.push(new Item(fun, args));
    if (queue.length === 1 && !draining) {
        runTimeout(drainQueue);
    }
};

// v8 likes predictible objects
function Item(fun, array) {
    this.fun = fun;
    this.array = array;
}
Item.prototype.run = function () {
    this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) { return [] }

process.binding = function (name) {
    throw new Error('process.binding is not supported');
};

process.cwd = function () { return '/' };
process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };


/***/ })

/******/ });