import { __require as J } from "../../../../global@4.4.0/node_modules/global/document.js";
var O, U;
function Q() {
  if (U) return O;
  U = 1;
  var I = J(), N = Object.create || /* @__PURE__ */ function() {
    function e() {
    }
    return function(t) {
      if (arguments.length !== 1)
        throw new Error("Object.create shim only accepts one parameter.");
      return e.prototype = t, new e();
    };
  }();
  function v(e, t) {
    this.name = "ParsingError", this.code = e.code, this.message = t || e.message;
  }
  v.prototype = N(Error.prototype), v.prototype.constructor = v, v.Errors = {
    BadSignature: {
      code: 0,
      message: "Malformed WebVTT signature."
    },
    BadTimeStamp: {
      code: 1,
      message: "Malformed time stamp."
    }
  };
  function P(e) {
    function t(s, x, h, f) {
      return (s | 0) * 3600 + (x | 0) * 60 + (h | 0) + (f | 0) / 1e3;
    }
    var r = e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
    return r ? r[3] ? t(r[1], r[2], r[3].replace(":", ""), r[4]) : r[1] > 59 ? t(r[1], r[2], 0, r[4]) : t(0, r[1], r[2], r[4]) : null;
  }
  function w() {
    this.values = N(null);
  }
  w.prototype = {
    // Only accept the first assignment to any key.
    set: function(e, t) {
      !this.get(e) && t !== "" && (this.values[e] = t);
    },
    // Return the value for a key, or a default value.
    // If 'defaultKey' is passed then 'dflt' is assumed to be an object with
    // a number of possible default values as properties where 'defaultKey' is
    // the key of the property that will be chosen; otherwise it's assumed to be
    // a single value.
    get: function(e, t, r) {
      return r ? this.has(e) ? this.values[e] : t[r] : this.has(e) ? this.values[e] : t;
    },
    // Check whether we have a value for a key.
    has: function(e) {
      return e in this.values;
    },
    // Accept a setting if its one of the given alternatives.
    alt: function(e, t, r) {
      for (var s = 0; s < r.length; ++s)
        if (t === r[s]) {
          this.set(e, t);
          break;
        }
    },
    // Accept a setting if its a valid (signed) integer.
    integer: function(e, t) {
      /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10));
    },
    // Accept a setting if its a valid percentage.
    percent: function(e, t) {
      return t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t), t >= 0 && t <= 100) ? (this.set(e, t), !0) : !1;
    }
  };
  function E(e, t, r, s) {
    var x = s ? e.split(s) : [e];
    for (var h in x)
      if (typeof x[h] == "string") {
        var f = x[h].split(r);
        if (f.length === 2) {
          var l = f[0].trim(), a = f[1].trim();
          t(l, a);
        }
      }
  }
  function V(e, t, r) {
    var s = e;
    function x() {
      var l = P(e);
      if (l === null)
        throw new v(
          v.Errors.BadTimeStamp,
          "Malformed timestamp: " + s
        );
      return e = e.replace(/^[^\sa-zA-Z-]+/, ""), l;
    }
    function h(l, a) {
      var o = new w();
      E(l, function(n, i) {
        switch (n) {
          case "region":
            for (var c = r.length - 1; c >= 0; c--)
              if (r[c].id === i) {
                o.set(n, r[c].region);
                break;
              }
            break;
          case "vertical":
            o.alt(n, i, ["rl", "lr"]);
            break;
          case "line":
            var g = i.split(","), u = g[0];
            o.integer(n, u), o.percent(n, u) && o.set("snapToLines", !1), o.alt(n, u, ["auto"]), g.length === 2 && o.alt("lineAlign", g[1], ["start", "center", "end"]);
            break;
          case "position":
            g = i.split(","), o.percent(n, g[0]), g.length === 2 && o.alt("positionAlign", g[1], ["start", "center", "end"]);
            break;
          case "size":
            o.percent(n, i);
            break;
          case "align":
            o.alt(n, i, ["start", "center", "end", "left", "right"]);
            break;
        }
      }, /:/, /\s/), a.region = o.get("region", null), a.vertical = o.get("vertical", "");
      try {
        a.line = o.get("line", "auto");
      } catch {
      }
      a.lineAlign = o.get("lineAlign", "start"), a.snapToLines = o.get("snapToLines", !0), a.size = o.get("size", 100);
      try {
        a.align = o.get("align", "center");
      } catch {
        a.align = o.get("align", "middle");
      }
      try {
        a.position = o.get("position", "auto");
      } catch {
        a.position = o.get("position", {
          start: 0,
          left: 0,
          center: 50,
          middle: 50,
          end: 100,
          right: 100
        }, a.align);
      }
      a.positionAlign = o.get("positionAlign", {
        start: "start",
        left: "start",
        center: "center",
        middle: "center",
        end: "end",
        right: "end"
      }, a.align);
    }
    function f() {
      e = e.replace(/^\s+/, "");
    }
    if (f(), t.startTime = x(), f(), e.substr(0, 3) !== "-->")
      throw new v(
        v.Errors.BadTimeStamp,
        "Malformed time stamp (time stamps must be separated by '-->'): " + s
      );
    e = e.substr(3), f(), t.endTime = x(), f(), h(e, t);
  }
  var L = I.createElement && I.createElement("textarea"), X = {
    c: "span",
    i: "i",
    b: "b",
    u: "u",
    ruby: "ruby",
    rt: "rt",
    v: "span",
    lang: "span"
  }, k = {
    white: "rgba(255,255,255,1)",
    lime: "rgba(0,255,0,1)",
    cyan: "rgba(0,255,255,1)",
    red: "rgba(255,0,0,1)",
    yellow: "rgba(255,255,0,1)",
    magenta: "rgba(255,0,255,1)",
    blue: "rgba(0,0,255,1)",
    black: "rgba(0,0,0,1)"
  }, z = {
    v: "title",
    lang: "lang"
  }, R = {
    rt: "ruby"
  };
  function D(e, t) {
    function r() {
      if (!t)
        return null;
      function u(p) {
        return t = t.substr(p.length), p;
      }
      var d = t.match(/^([^<]*)(<[^>]*>?)?/);
      return u(d[1] ? d[1] : d[2]);
    }
    function s(u) {
      return L.innerHTML = u, u = L.textContent, L.textContent = "", u;
    }
    function x(u, d) {
      return !R[d.localName] || R[d.localName] === u.localName;
    }
    function h(u, d) {
      var p = X[u];
      if (!p)
        return null;
      var b = e.document.createElement(p), T = z[u];
      return T && d && (b[T] = d.trim()), b;
    }
    for (var f = e.document.createElement("div"), l = f, a, o = []; (a = r()) !== null; ) {
      if (a[0] === "<") {
        if (a[1] === "/") {
          o.length && o[o.length - 1] === a.substr(2).replace(">", "") && (o.pop(), l = l.parentNode);
          continue;
        }
        var n = P(a.substr(1, a.length - 2)), i;
        if (n) {
          i = e.document.createProcessingInstruction("timestamp", n), l.appendChild(i);
          continue;
        }
        var c = a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
        if (!c || (i = h(c[1], c[3]), !i) || !x(l, i))
          continue;
        if (c[2]) {
          var g = c[2].split(".");
          g.forEach(function(u) {
            var d = /^bg_/.test(u), p = d ? u.slice(3) : u;
            if (k.hasOwnProperty(p)) {
              var b = d ? "background-color" : "color", T = k[p];
              i.style[b] = T;
            }
          }), i.className = g.join(" ");
        }
        o.push(c[1]), l.appendChild(i), l = i;
        continue;
      }
      l.appendChild(e.document.createTextNode(s(a)));
    }
    return f;
  }
  var M = [
    [1470, 1470],
    [1472, 1472],
    [1475, 1475],
    [1478, 1478],
    [1488, 1514],
    [1520, 1524],
    [1544, 1544],
    [1547, 1547],
    [1549, 1549],
    [1563, 1563],
    [1566, 1610],
    [1645, 1647],
    [1649, 1749],
    [1765, 1766],
    [1774, 1775],
    [1786, 1805],
    [1807, 1808],
    [1810, 1839],
    [1869, 1957],
    [1969, 1969],
    [1984, 2026],
    [2036, 2037],
    [2042, 2042],
    [2048, 2069],
    [2074, 2074],
    [2084, 2084],
    [2088, 2088],
    [2096, 2110],
    [2112, 2136],
    [2142, 2142],
    [2208, 2208],
    [2210, 2220],
    [8207, 8207],
    [64285, 64285],
    [64287, 64296],
    [64298, 64310],
    [64312, 64316],
    [64318, 64318],
    [64320, 64321],
    [64323, 64324],
    [64326, 64449],
    [64467, 64829],
    [64848, 64911],
    [64914, 64967],
    [65008, 65020],
    [65136, 65140],
    [65142, 65276],
    [67584, 67589],
    [67592, 67592],
    [67594, 67637],
    [67639, 67640],
    [67644, 67644],
    [67647, 67669],
    [67671, 67679],
    [67840, 67867],
    [67872, 67897],
    [67903, 67903],
    [67968, 68023],
    [68030, 68031],
    [68096, 68096],
    [68112, 68115],
    [68117, 68119],
    [68121, 68147],
    [68160, 68167],
    [68176, 68184],
    [68192, 68223],
    [68352, 68405],
    [68416, 68437],
    [68440, 68466],
    [68472, 68479],
    [68608, 68680],
    [126464, 126467],
    [126469, 126495],
    [126497, 126498],
    [126500, 126500],
    [126503, 126503],
    [126505, 126514],
    [126516, 126519],
    [126521, 126521],
    [126523, 126523],
    [126530, 126530],
    [126535, 126535],
    [126537, 126537],
    [126539, 126539],
    [126541, 126543],
    [126545, 126546],
    [126548, 126548],
    [126551, 126551],
    [126553, 126553],
    [126555, 126555],
    [126557, 126557],
    [126559, 126559],
    [126561, 126562],
    [126564, 126564],
    [126567, 126570],
    [126572, 126578],
    [126580, 126583],
    [126585, 126588],
    [126590, 126590],
    [126592, 126601],
    [126603, 126619],
    [126625, 126627],
    [126629, 126633],
    [126635, 126651],
    [1114109, 1114109]
  ];
  function W(e) {
    for (var t = 0; t < M.length; t++) {
      var r = M[t];
      if (e >= r[0] && e <= r[1])
        return !0;
    }
    return !1;
  }
  function G(e) {
    var t = [], r = "", s;
    if (!e || !e.childNodes)
      return "ltr";
    function x(l, a) {
      for (var o = a.childNodes.length - 1; o >= 0; o--)
        l.push(a.childNodes[o]);
    }
    function h(l) {
      if (!l || !l.length)
        return null;
      var a = l.pop(), o = a.textContent || a.innerText;
      if (o) {
        var n = o.match(/^.*(\n|\r)/);
        return n ? (l.length = 0, n[0]) : o;
      }
      if (a.tagName === "ruby")
        return h(l);
      if (a.childNodes)
        return x(l, a), h(l);
    }
    for (x(t, e); r = h(t); )
      for (var f = 0; f < r.length; f++)
        if (s = r.charCodeAt(f), W(s))
          return "rtl";
    return "ltr";
  }
  function Y(e) {
    if (typeof e.line == "number" && (e.snapToLines || e.line >= 0 && e.line <= 100))
      return e.line;
    if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement)
      return -1;
    for (var t = e.track, r = t.textTrackList, s = 0, x = 0; x < r.length && r[x] !== t; x++)
      r[x].mode === "showing" && s++;
    return ++s * -1;
  }
  function S() {
  }
  S.prototype.applyStyles = function(e, t) {
    t = t || this.div;
    for (var r in e)
      e.hasOwnProperty(r) && (t.style[r] = e[r]);
  }, S.prototype.formatStyle = function(e, t) {
    return e === 0 ? 0 : e + t;
  };
  function C(e, t, r) {
    S.call(this), this.cue = t, this.cueDiv = D(e, t.text);
    var s = {
      color: "rgba(255, 255, 255, 1)",
      backgroundColor: "rgba(0, 0, 0, 0.8)",
      position: "relative",
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
      display: "inline",
      writingMode: t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl",
      unicodeBidi: "plaintext"
    };
    this.applyStyles(s, this.cueDiv), this.div = e.document.createElement("div"), s = {
      direction: G(this.cueDiv),
      writingMode: t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl",
      unicodeBidi: "plaintext",
      textAlign: t.align === "middle" ? "center" : t.align,
      font: r.font,
      whiteSpace: "pre-line",
      position: "absolute"
    }, this.applyStyles(s), this.div.appendChild(this.cueDiv);
    var x = 0;
    switch (t.positionAlign) {
      case "start":
      case "line-left":
        x = t.position;
        break;
      case "center":
        x = t.position - t.size / 2;
        break;
      case "end":
      case "line-right":
        x = t.position - t.size;
        break;
    }
    t.vertical === "" ? this.applyStyles({
      left: this.formatStyle(x, "%"),
      width: this.formatStyle(t.size, "%")
    }) : this.applyStyles({
      top: this.formatStyle(x, "%"),
      height: this.formatStyle(t.size, "%")
    }), this.move = function(h) {
      this.applyStyles({
        top: this.formatStyle(h.top, "px"),
        bottom: this.formatStyle(h.bottom, "px"),
        left: this.formatStyle(h.left, "px"),
        right: this.formatStyle(h.right, "px"),
        height: this.formatStyle(h.height, "px"),
        width: this.formatStyle(h.width, "px")
      });
    };
  }
  C.prototype = N(S.prototype), C.prototype.constructor = C;
  function m(e) {
    var t, r, s, x;
    if (e.div) {
      r = e.div.offsetHeight, s = e.div.offsetWidth, x = e.div.offsetTop;
      var h = (h = e.div.childNodes) && (h = h[0]) && h.getClientRects && h.getClientRects();
      e = e.div.getBoundingClientRect(), t = h ? Math.max(h[0] && h[0].height || 0, e.height / h.length) : 0;
    }
    this.left = e.left, this.right = e.right, this.top = e.top || x, this.height = e.height || r, this.bottom = e.bottom || x + (e.height || r), this.width = e.width || s, this.lineHeight = t !== void 0 ? t : e.lineHeight;
  }
  m.prototype.move = function(e, t) {
    switch (t = t !== void 0 ? t : this.lineHeight, e) {
      case "+x":
        this.left += t, this.right += t;
        break;
      case "-x":
        this.left -= t, this.right -= t;
        break;
      case "+y":
        this.top += t, this.bottom += t;
        break;
      case "-y":
        this.top -= t, this.bottom -= t;
        break;
    }
  }, m.prototype.overlaps = function(e) {
    return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top;
  }, m.prototype.overlapsAny = function(e) {
    for (var t = 0; t < e.length; t++)
      if (this.overlaps(e[t]))
        return !0;
    return !1;
  }, m.prototype.within = function(e) {
    return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right;
  }, m.prototype.overlapsOppositeAxis = function(e, t) {
    switch (t) {
      case "+x":
        return this.left < e.left;
      case "-x":
        return this.right > e.right;
      case "+y":
        return this.top < e.top;
      case "-y":
        return this.bottom > e.bottom;
    }
  }, m.prototype.intersectPercentage = function(e) {
    var t = Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left)), r = Math.max(0, Math.min(this.bottom, e.bottom) - Math.max(this.top, e.top)), s = t * r;
    return s / (this.height * this.width);
  }, m.prototype.toCSSCompatValues = function(e) {
    return {
      top: this.top - e.top,
      bottom: e.bottom - this.bottom,
      left: this.left - e.left,
      right: e.right - this.right,
      height: this.height,
      width: this.width
    };
  }, m.getSimpleBoxPosition = function(e) {
    var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0, r = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0, s = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0;
    e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e;
    var x = {
      left: e.left,
      right: e.right,
      top: e.top || s,
      height: e.height || t,
      bottom: e.bottom || s + (e.height || t),
      width: e.width || r
    };
    return x;
  };
  function q(e, t, r, s) {
    function x(p, b) {
      for (var T, _ = new m(p), B = 1, A = 0; A < b.length; A++) {
        for (; p.overlapsOppositeAxis(r, b[A]) || p.within(r) && p.overlapsAny(s); )
          p.move(b[A]);
        if (p.within(r))
          return p;
        var H = p.intersectPercentage(r);
        B > H && (T = new m(p), B = H), p = new m(_);
      }
      return T || _;
    }
    var h = new m(t), f = t.cue, l = Y(f), a = [];
    if (f.snapToLines) {
      var o;
      switch (f.vertical) {
        case "":
          a = ["+y", "-y"], o = "height";
          break;
        case "rl":
          a = ["+x", "-x"], o = "width";
          break;
        case "lr":
          a = ["-x", "+x"], o = "width";
          break;
      }
      var n = h.lineHeight, i = n * Math.round(l), c = r[o] + n, g = a[0];
      Math.abs(i) > c && (i = i < 0 ? -1 : 1, i *= Math.ceil(c / n) * n), l < 0 && (i += f.vertical === "" ? r.height : r.width, a = a.reverse()), h.move(g, i);
    } else {
      var u = h.lineHeight / r.height * 100;
      switch (f.lineAlign) {
        case "center":
          l -= u / 2;
          break;
        case "end":
          l -= u;
          break;
      }
      switch (f.vertical) {
        case "":
          t.applyStyles({
            top: t.formatStyle(l, "%")
          });
          break;
        case "rl":
          t.applyStyles({
            left: t.formatStyle(l, "%")
          });
          break;
        case "lr":
          t.applyStyles({
            right: t.formatStyle(l, "%")
          });
          break;
      }
      a = ["+y", "-x", "+x", "-y"], h = new m(t);
    }
    var d = x(h, a);
    t.move(d.toCSSCompatValues(r));
  }
  function y() {
  }
  y.StringDecoder = function() {
    return {
      decode: function(e) {
        if (!e)
          return "";
        if (typeof e != "string")
          throw new Error("Error - expected string data.");
        return decodeURIComponent(encodeURIComponent(e));
      }
    };
  }, y.convertCueToDOMTree = function(e, t) {
    return !e || !t ? null : D(e, t);
  };
  var F = 0.05, $ = "sans-serif", Z = "1.5%";
  return y.processCues = function(e, t, r) {
    if (!e || !t || !r)
      return null;
    for (; r.firstChild; )
      r.removeChild(r.firstChild);
    var s = e.document.createElement("div");
    s.style.position = "absolute", s.style.left = "0", s.style.right = "0", s.style.top = "0", s.style.bottom = "0", s.style.margin = Z, r.appendChild(s);
    function x(n) {
      for (var i = 0; i < n.length; i++)
        if (n[i].hasBeenReset || !n[i].displayState)
          return !0;
      return !1;
    }
    if (!x(t)) {
      for (var h = 0; h < t.length; h++)
        s.appendChild(t[h].displayState);
      return;
    }
    var f = [], l = m.getSimpleBoxPosition(s), a = Math.round(l.height * F * 100) / 100, o = {
      font: a + "px " + $
    };
    (function() {
      for (var n, i, c = 0; c < t.length; c++)
        i = t[c], n = new C(e, i, o), s.appendChild(n.div), q(e, n, l, f), i.displayState = n.div, f.push(m.getSimpleBoxPosition(n));
    })();
  }, y.Parser = function(e, t, r) {
    r || (r = t, t = {}), t || (t = {}), this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "", this.decoder = r || new TextDecoder("utf8"), this.regionList = [];
  }, y.Parser.prototype = {
    // If the error is a ParsingError then report it to the consumer if
    // possible. If it's not a ParsingError then throw it like normal.
    reportOrThrowError: function(e) {
      if (e instanceof v)
        this.onparsingerror && this.onparsingerror(e);
      else
        throw e;
    },
    parse: function(e) {
      var t = this;
      e && (t.buffer += t.decoder.decode(e, { stream: !0 }));
      function r() {
        for (var n = t.buffer, i = 0; i < n.length && n[i] !== "\r" && n[i] !== `
`; )
          ++i;
        var c = n.substr(0, i);
        return n[i] === "\r" && ++i, n[i] === `
` && ++i, t.buffer = n.substr(i), c;
      }
      function s(n) {
        var i = new w();
        if (E(n, function(g, u) {
          switch (g) {
            case "id":
              i.set(g, u);
              break;
            case "width":
              i.percent(g, u);
              break;
            case "lines":
              i.integer(g, u);
              break;
            case "regionanchor":
            case "viewportanchor":
              var d = u.split(",");
              if (d.length !== 2)
                break;
              var p = new w();
              if (p.percent("x", d[0]), p.percent("y", d[1]), !p.has("x") || !p.has("y"))
                break;
              i.set(g + "X", p.get("x")), i.set(g + "Y", p.get("y"));
              break;
            case "scroll":
              i.alt(g, u, ["up"]);
              break;
          }
        }, /=/, /\s/), i.has("id")) {
          var c = new (t.vttjs.VTTRegion || t.window.VTTRegion)();
          c.width = i.get("width", 100), c.lines = i.get("lines", 3), c.regionAnchorX = i.get("regionanchorX", 0), c.regionAnchorY = i.get("regionanchorY", 100), c.viewportAnchorX = i.get("viewportanchorX", 0), c.viewportAnchorY = i.get("viewportanchorY", 100), c.scroll = i.get("scroll", ""), t.onregion && t.onregion(c), t.regionList.push({
            id: i.get("id"),
            region: c
          });
        }
      }
      function x(n) {
        var i = new w();
        E(n, function(c, g) {
          switch (c) {
            case "MPEGT":
              i.integer(c + "S", g);
              break;
            case "LOCA":
              i.set(c + "L", P(g));
              break;
          }
        }, /[^\d]:/, /,/), t.ontimestampmap && t.ontimestampmap({
          MPEGTS: i.get("MPEGTS"),
          LOCAL: i.get("LOCAL")
        });
      }
      function h(n) {
        n.match(/X-TIMESTAMP-MAP/) ? E(n, function(i, c) {
          switch (i) {
            case "X-TIMESTAMP-MAP":
              x(c);
              break;
          }
        }, /=/) : E(n, function(i, c) {
          switch (i) {
            case "Region":
              s(c);
              break;
          }
        }, /:/);
      }
      try {
        var f;
        if (t.state === "INITIAL") {
          if (!/\r\n|\n/.test(t.buffer))
            return this;
          f = r();
          var l = f.match(/^WEBVTT([ \t].*)?$/);
          if (!l || !l[0])
            throw new v(v.Errors.BadSignature);
          t.state = "HEADER";
        }
        for (var a = !1; t.buffer; ) {
          if (!/\r\n|\n/.test(t.buffer))
            return this;
          switch (a ? a = !1 : f = r(), t.state) {
            case "HEADER":
              /:/.test(f) ? h(f) : f || (t.state = "ID");
              continue;
            case "NOTE":
              f || (t.state = "ID");
              continue;
            case "ID":
              if (/^NOTE($|[ \t])/.test(f)) {
                t.state = "NOTE";
                break;
              }
              if (!f)
                continue;
              t.cue = new (t.vttjs.VTTCue || t.window.VTTCue)(0, 0, "");
              try {
                t.cue.align = "center";
              } catch {
                t.cue.align = "middle";
              }
              if (t.state = "CUE", f.indexOf("-->") === -1) {
                t.cue.id = f;
                continue;
              }
            // Process line as start of a cue.
            /*falls through*/
            case "CUE":
              try {
                V(f, t.cue, t.regionList);
              } catch (n) {
                t.reportOrThrowError(n), t.cue = null, t.state = "BADCUE";
                continue;
              }
              t.state = "CUETEXT";
              continue;
            case "CUETEXT":
              var o = f.indexOf("-->") !== -1;
              if (!f || o && (a = !0)) {
                t.oncue && t.oncue(t.cue), t.cue = null, t.state = "ID";
                continue;
              }
              t.cue.text && (t.cue.text += `
`), t.cue.text += f.replace(/\u2028/g, `
`).replace(/u2029/g, `
`);
              continue;
            case "BADCUE":
              f || (t.state = "ID");
              continue;
          }
        }
      } catch (n) {
        t.reportOrThrowError(n), t.state === "CUETEXT" && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t.state = t.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
      }
      return this;
    },
    flush: function() {
      var e = this;
      try {
        if (e.buffer += e.decoder.decode(), (e.cue || e.state === "HEADER") && (e.buffer += `

`, e.parse()), e.state === "INITIAL")
          throw new v(v.Errors.BadSignature);
      } catch (t) {
        e.reportOrThrowError(t);
      }
      return e.onflush && e.onflush(), this;
    }
  }, O = y, O;
}
export {
  Q as __require
};
//# sourceMappingURL=vtt.js.map
